Fixed bug for Museum menu patch

master
Mohammad Shoaib Khan 2023-03-09 13:12:07 +05:30
parent 2ddebd3615
commit 8970a2c441
No known key found for this signature in database
GPG Key ID: D8040D966320B620
1 changed files with 28 additions and 23 deletions

View File

@ -88,6 +88,8 @@ namespace stardew_access.Patches
{ {
if (__instance.heldItem != null) return; if (__instance.heldItem != null) return;
if (narrateHoveredButtons(__instance, x, y)) return;
int hoveredItemIndex = InventoryUtils.narrateHoveredSlotAndReturnIndex(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y, int hoveredItemIndex = InventoryUtils.narrateHoveredSlotAndReturnIndex(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y,
handleHighlightedItem: true, highlightedItemPrefix: "Donatable "); handleHighlightedItem: true, highlightedItemPrefix: "Donatable ");
if (hoveredItemIndex != -9999) if (hoveredItemIndex != -9999)
@ -99,7 +101,9 @@ namespace stardew_access.Patches
manuallyDonateItem(__instance, hoveredItemIndex); manuallyDonateItem(__instance, hoveredItemIndex);
} }
} }
else }
private static bool narrateHoveredButtons(MuseumMenu __instance, int x, int y)
{ {
string toSpeak = ""; string toSpeak = "";
bool isDropItemButton = false; bool isDropItemButton = false;
@ -115,7 +119,7 @@ namespace stardew_access.Patches
} }
else else
{ {
return; return false;
} }
if (museumQueryKey != toSpeak) if (museumQueryKey != toSpeak)
@ -124,7 +128,8 @@ namespace stardew_access.Patches
MainClass.ScreenReader.Say(toSpeak, true); MainClass.ScreenReader.Say(toSpeak, true);
if (isDropItemButton) Game1.playSound("drop_item"); if (isDropItemButton) Game1.playSound("drop_item");
} }
}
return true;
} }
private static void manuallyDonateItem(MuseumMenu __instance, int i) private static void manuallyDonateItem(MuseumMenu __instance, int i)