From a1a7ed928149916f5bfff9efe27fdeba999498bf Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Date: Mon, 11 Apr 2022 23:48:20 +0530 Subject: [PATCH] Bug fixes --- stardew-access/Patches/DialoguePatches.cs | 8 ++++--- stardew-access/Patches/MenuPatches.cs | 10 ++++++++ stardew-access/Patches/QuestPatches.cs | 28 +++++++++++++++++++---- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/stardew-access/Patches/DialoguePatches.cs b/stardew-access/Patches/DialoguePatches.cs index 20a147f..1296281 100644 --- a/stardew-access/Patches/DialoguePatches.cs +++ b/stardew-access/Patches/DialoguePatches.cs @@ -397,11 +397,13 @@ namespace stardew_access.Patches { foreach (ClickableComponent c in __instance.itemsToGrab) { - string name = c.name; - string label = c.label; + if (c.item == null) + continue; + + string name = c.item.DisplayName; if (c.containsPoint(x, y)) - MainClass.ScreenReader.SayWithChecker($"Grab: {name} \t\n {label}", false); + MainClass.ScreenReader.SayWithChecker($"Left click to collect {name}", false); } } #endregion diff --git a/stardew-access/Patches/MenuPatches.cs b/stardew-access/Patches/MenuPatches.cs index 65673e9..01ba637 100644 --- a/stardew-access/Patches/MenuPatches.cs +++ b/stardew-access/Patches/MenuPatches.cs @@ -511,6 +511,16 @@ namespace stardew_access.Patches DialoguePatches.currentDialogue = " "; } + if (menu is JojaCDMenu) + { + BundleMenuPatches.jojaCDMenuQuery = ""; + } + + if (menu is QuestLog) + { + QuestPatches.questLogQuery = " "; + } + GameMenuPatches.hoveredItemQueryKey = ""; } #endregion diff --git a/stardew-access/Patches/QuestPatches.cs b/stardew-access/Patches/QuestPatches.cs index b8d4a3d..142d811 100644 --- a/stardew-access/Patches/QuestPatches.cs +++ b/stardew-access/Patches/QuestPatches.cs @@ -9,6 +9,7 @@ namespace stardew_access.Patches internal class QuestPatches { internal static string currentDailyQuestText = " "; + internal static string questLogQuery = " "; #region For Special Orders Board internal static void SpecialOrdersBoardPatch(SpecialOrdersBoard __instance) @@ -153,28 +154,45 @@ namespace stardew_access.Patches try { bool snapMouseToRewardBox = false; + int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position if (___questPage == -1) { #region Quest Lists + string toSpeak = " "; for (int i = 0; i < __instance.questLogButtons.Count; i++) { if (___pages.Count() > 0 && ___pages[___currentPage].Count() > i) { + if (__instance.questLogButtons[i].containsPoint(x, y)) + continue; + string name = ___pages[___currentPage][i].GetName(); int daysLeft = ___pages[___currentPage][i].GetDaysLeft(); - string toSpeak = $"{name} quest"; + toSpeak = $"{name} quest"; if (daysLeft > 0 && ___pages[___currentPage][i].ShouldDisplayAsComplete()) toSpeak += $"\t\n {daysLeft} days left"; toSpeak += ___pages[___currentPage][i].ShouldDisplayAsComplete() ? " completed!" : ""; - if (__instance.questLogButtons[i].containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY())) - { - MainClass.ScreenReader.SayWithChecker(toSpeak, true); - } + break; } } + + if (__instance.backButton != null && __instance.backButton.visible && __instance.backButton.containsPoint(x, y)) + toSpeak = "Previous page button"; + else if (__instance.forwardButton != null && __instance.forwardButton.visible && __instance.forwardButton.containsPoint(x, y)) + toSpeak = "Next page button"; + else if (__instance.cancelQuestButton != null && __instance.cancelQuestButton.visible && __instance.cancelQuestButton.containsPoint(x, y)) + toSpeak = "Cancel quest button"; + else if (__instance.upperRightCloseButton != null && __instance.upperRightCloseButton.visible && __instance.upperRightCloseButton.containsPoint(x, y)) + toSpeak = "Close menu button"; + + if (questLogQuery != toSpeak) + { + questLogQuery = toSpeak; + MainClass.ScreenReader.Say(toSpeak, true); + } #endregion } else