Geode menu is now accessible

master
shoaib11120 2022-01-06 19:08:06 +05:30
parent 12bd0bea80
commit b3657c080f
1 changed files with 25 additions and 4 deletions

View File

@ -15,6 +15,24 @@ namespace stardew_access.Patches
{ {
int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y; // Mouse x and y position int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y; // Mouse x and y position
#region Narrate the treasure recieved on breaking the geode
if (__instance.geodeTreasure != null)
{
string name = __instance.geodeTreasure.DisplayName;
int stack = __instance.geodeTreasure.Stack;
string toSpeak = $"Recieved {stack} {name}";
if (geodeMenuQueryKey != toSpeak)
{
geodeMenuQueryKey = toSpeak;
ScreenReader.say(toSpeak, true);
}
return;
}
#endregion
#region Narrate hovered buttons in the menu
if (__instance.geodeSpot != null && __instance.geodeSpot.containsPoint(x, y)) if (__instance.geodeSpot != null && __instance.geodeSpot.containsPoint(x, y))
{ {
string toSpeak = "Place geode here"; string toSpeak = "Place geode here";
@ -60,11 +78,13 @@ namespace stardew_access.Patches
ScreenReader.say(toSpeak, true); ScreenReader.say(toSpeak, true);
} }
return; return;
} }
#endregion
#region Narrate hovered item
for (int i = 0; i < __instance.inventory.inventory.Count; i++) for (int i = 0; i < __instance.inventory.inventory.Count; i++)
{ {
if(__instance.inventory.inventory[i].containsPoint(x, y)) if (__instance.inventory.inventory[i].containsPoint(x, y))
{ {
string toSpeak = ""; string toSpeak = "";
if ((i + 1) <= __instance.inventory.actualInventory.Count) if ((i + 1) <= __instance.inventory.actualInventory.Count)
@ -74,7 +94,7 @@ namespace stardew_access.Patches
string name = __instance.inventory.actualInventory[i].DisplayName; string name = __instance.inventory.actualInventory[i].DisplayName;
int stack = __instance.inventory.actualInventory[i].Stack; int stack = __instance.inventory.actualInventory[i].Stack;
if(stack>1) if (stack > 1)
toSpeak = $"{stack} {name}"; toSpeak = $"{stack} {name}";
else else
toSpeak = $"{name}"; toSpeak = $"{name}";
@ -99,7 +119,8 @@ namespace stardew_access.Patches
} }
return; return;
} }
} }
#endregion
} }
catch (Exception e) catch (Exception e)
{ {