From 8fd846a5bc56ca5a1a1004128c628949dfbd2548 Mon Sep 17 00:00:00 2001 From: shoaib11120 Date: Sat, 25 Dec 2021 06:08:09 +0530 Subject: [PATCH] Fixed hovered item count --- stardew-access/ModEntry.cs | 5 ----- stardew-access/Patches/DialoguePatcher.cs | 11 ++++++++++- stardew-access/Patches/MenuPatch.cs | 13 ------------- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs index 38636cc..ad8578e 100644 --- a/stardew-access/ModEntry.cs +++ b/stardew-access/ModEntry.cs @@ -105,11 +105,6 @@ namespace stardew_access postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.BillboardPatch)) ); - harmony.Patch( - original: AccessTools.Method(typeof(InventoryMenu), nameof(InventoryMenu.hover)), - postfix: new HarmonyMethod(typeof(MenuPatch), nameof(MenuPatch.InventoryMenuPatch)) - ); - #endregion #region Custom Commands diff --git a/stardew-access/Patches/DialoguePatcher.cs b/stardew-access/Patches/DialoguePatcher.cs index c5ce96e..81208d4 100644 --- a/stardew-access/Patches/DialoguePatcher.cs +++ b/stardew-access/Patches/DialoguePatcher.cs @@ -33,7 +33,7 @@ namespace stardew_access.Patches ScreenReader.say(toSpeak, false); } } - else if (__instance.isQuestion) + else if (__instance.isQuestion || __instance.responses.Count > 0) { // For Dialogues with responses/answers like the dialogue when we click on tv string toSpeak = " "; @@ -89,6 +89,15 @@ namespace stardew_access.Patches StringBuilder toSpeak = new StringBuilder(); + #region Add item count before title + if(hoveredItem != null) + { + int count = hoveredItem.Stack; + if(count > 1) + toSpeak.Append($"{count} "); + } + #endregion + #region Add title if any if (boldTitleText != null) toSpeak.Append($"{boldTitleText}\n"); diff --git a/stardew-access/Patches/MenuPatch.cs b/stardew-access/Patches/MenuPatch.cs index 229750d..f38cd71 100644 --- a/stardew-access/Patches/MenuPatch.cs +++ b/stardew-access/Patches/MenuPatch.cs @@ -14,19 +14,6 @@ namespace stardew_access.Patches private static string currentLetterText = " "; private static string currentDailyQuestText = " "; - public static void InventoryMenuPatch(InventoryMenu __instance, Item __result) - { - if (__result == null) - return; - - if (__result.Stack > 1) - { - __instance.hoverTitle = $"{__result.Stack} {__result.DisplayName}"; - __instance.descriptionTitle = __result.Stack + __result.DisplayName; - } - - } - internal static void BillboardPatch(Billboard __instance, bool ___dailyQuestBoard) { if (!___dailyQuestBoard)