From 8bd44fe360db69a0f361251837bbfef7f8c48406 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Date: Fri, 8 Apr 2022 15:50:57 +0530 Subject: [PATCH] Fixed bug in crafting/cooking menu --- stardew-access/Patches/GameMenuPatches.cs | 40 +++++++++++++++-------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/stardew-access/Patches/GameMenuPatches.cs b/stardew-access/Patches/GameMenuPatches.cs index fc4c107..b6dfaa4 100644 --- a/stardew-access/Patches/GameMenuPatches.cs +++ b/stardew-access/Patches/GameMenuPatches.cs @@ -1031,19 +1031,7 @@ namespace stardew_access.Patches #endregion #region Narrate hovered recipe - if (___hoverRecipe == null) - { - string query = $"unknown recipe:{__instance.getCurrentlySnappedComponent().myID}"; - - if (craftingPageQueryKey != query) - { - craftingPageQueryKey = query; - gameMenuQueryKey = ""; - hoveredItemQueryKey = ""; - MainClass.GetScreenReader().Say("unknown recipe", true); - } - } - else + if (___hoverRecipe != null) { string name = ___hoverRecipe.DisplayName; int numberOfProduce = ___hoverRecipe.numberProducedPerCraft; @@ -1119,6 +1107,32 @@ namespace stardew_access.Patches } return; } + else + { + var isRecipeInFocus = false; + foreach (var item in __instance.pagesOfCraftingRecipes[___currentCraftingPage]) + { + if (item.Key.containsPoint(x, y)) + { + isRecipeInFocus = true; + break; + } + } + + if (isRecipeInFocus) + { + string query = $"unknown recipe:{__instance.getCurrentlySnappedComponent().myID}"; + + if (craftingPageQueryKey != query) + { + craftingPageQueryKey = query; + gameMenuQueryKey = ""; + hoveredItemQueryKey = ""; + MainClass.GetScreenReader().Say("unknown recipe", true); + } + return; + } + } #endregion #region Narrate hovered item