From 685d84c92f8c4d9303816584b347c3ba5517ed85 Mon Sep 17 00:00:00 2001
From: shoaib11120 <shoaib.khan20@outlook.com>
Date: Wed, 12 Jan 2022 12:40:41 +0530
Subject: [PATCH] Added required item to hover item narration

---
 stardew-access/Patches/DialoguePatches.cs | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/stardew-access/Patches/DialoguePatches.cs b/stardew-access/Patches/DialoguePatches.cs
index ceb1666..1c6d8b4 100644
--- a/stardew-access/Patches/DialoguePatches.cs
+++ b/stardew-access/Patches/DialoguePatches.cs
@@ -108,7 +108,7 @@ namespace stardew_access.Patches
             currentDialogue = " ";
         }
 
-        internal static void HoverTextPatch(string? text, int moneyAmountToDisplayAtBottom = -1, string? boldTitleText = null, string[]? buffIconsToDisplay = null, Item? hoveredItem = null, CraftingRecipe? craftingIngredients = null)
+        internal static void HoverTextPatch(string? text, int moneyAmountToDisplayAtBottom = -1, string? boldTitleText = null, int extraItemToShowIndex = -1, int extraItemToShowAmount = -1, string[]? buffIconsToDisplay = null, Item? hoveredItem = null, CraftingRecipe? craftingIngredients = null)
         {
             try
             {
@@ -179,6 +179,18 @@ namespace stardew_access.Patches
                 }
                 #endregion
 
+                #region Narrate hovered required ingredients
+                if (extraItemToShowIndex != -1)
+                {
+                    string itemName = Game1.objectInformation[extraItemToShowIndex].Split('/')[0];
+
+                    if (extraItemToShowAmount != -1)
+                        toSpeak.Append($"Required: {extraItemToShowAmount} {itemName}");
+                    else
+                        toSpeak.Append($"Required: {itemName}");
+                }
+                #endregion
+
                 #region Add money
                 if (moneyAmountToDisplayAtBottom != -1)
                     toSpeak.Append($"\nCost: {moneyAmountToDisplayAtBottom}g\n");