2022-01-14 05:23:15 +00:00
|
|
|
|
using Microsoft.Xna.Framework;
|
2022-03-19 09:53:18 +00:00
|
|
|
|
using Microsoft.Xna.Framework.Input;
|
2022-02-13 12:42:19 +00:00
|
|
|
|
using stardew_access.Features;
|
2022-01-14 05:23:15 +00:00
|
|
|
|
using StardewModdingAPI;
|
2021-12-10 15:47:50 +00:00
|
|
|
|
using StardewValley;
|
2022-03-19 10:14:57 +00:00
|
|
|
|
using StardewValley.Locations;
|
2021-12-10 15:47:50 +00:00
|
|
|
|
using StardewValley.Menus;
|
|
|
|
|
|
|
|
|
|
namespace stardew_access.Patches
|
|
|
|
|
{
|
2022-01-04 14:02:44 +00:00
|
|
|
|
internal class MenuPatches
|
2021-12-10 15:47:50 +00:00
|
|
|
|
{
|
2021-12-13 14:29:17 +00:00
|
|
|
|
private static string currentLetterText = " ";
|
2022-03-19 10:14:57 +00:00
|
|
|
|
private static string museumQueryKey = " ";
|
2021-12-30 13:39:05 +00:00
|
|
|
|
private static string currentLevelUpTitle = " ";
|
2022-01-16 11:40:03 +00:00
|
|
|
|
public static Vector2? prevTile = null;
|
2022-03-19 09:53:18 +00:00
|
|
|
|
private static bool isMoving = false;
|
|
|
|
|
|
2022-03-19 10:14:57 +00:00
|
|
|
|
#region Museum Menu Patch
|
2022-03-19 09:53:18 +00:00
|
|
|
|
internal static bool MuseumMenuKeyPressPatch()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (isMoving)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (!isMoving)
|
|
|
|
|
{
|
|
|
|
|
isMoving = true;
|
|
|
|
|
Task.Delay(200).ContinueWith(_ => { isMoving = false; });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal static void MuseumMenuPatch(MuseumMenu __instance, bool ___holdingMuseumPiece)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
2022-03-19 09:53:18 +00:00
|
|
|
|
|
2022-03-19 10:14:57 +00:00
|
|
|
|
if (__instance.heldItem != null)
|
2022-03-19 09:53:18 +00:00
|
|
|
|
{
|
|
|
|
|
// Museum Inventory
|
2022-03-19 10:14:57 +00:00
|
|
|
|
string toSpeak = "";
|
|
|
|
|
int tileX = (int)(Utility.ModifyCoordinateFromUIScale(x) + (float)Game1.viewport.X) / 64;
|
|
|
|
|
int tileY = (int)(Utility.ModifyCoordinateFromUIScale(y) + (float)Game1.viewport.Y) / 64;
|
|
|
|
|
LibraryMuseum libraryMuseum = (LibraryMuseum)Game1.currentLocation;
|
|
|
|
|
|
|
|
|
|
if (libraryMuseum.isTileSuitableForMuseumPiece(tileX, tileY))
|
2022-03-20 07:34:24 +00:00
|
|
|
|
toSpeak = $"slot {tileX}x {tileY}y";
|
2022-03-19 10:14:57 +00:00
|
|
|
|
|
|
|
|
|
if (museumQueryKey != toSpeak)
|
|
|
|
|
{
|
|
|
|
|
museumQueryKey = toSpeak;
|
|
|
|
|
MainClass.GetScreenReader().Say(toSpeak, true);
|
|
|
|
|
}
|
2022-03-19 09:53:18 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// Player Inventory
|
2022-03-19 10:14:57 +00:00
|
|
|
|
if (!narrateHoveredItemInInventory(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y))
|
|
|
|
|
{
|
|
|
|
|
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
|
|
|
|
{
|
|
|
|
|
if (museumQueryKey != $"ok button")
|
|
|
|
|
{
|
|
|
|
|
museumQueryKey = $"ok button";
|
|
|
|
|
MainClass.GetScreenReader().Say("ok button", true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-19 09:53:18 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-19 10:14:57 +00:00
|
|
|
|
#endregion
|
2022-03-19 09:53:18 +00:00
|
|
|
|
|
|
|
|
|
internal static bool narrateHoveredItemInInventory(InventoryMenu inventoryMenu, List<ClickableComponent> inventory, IList<Item> actualInventory, int x, int y)
|
|
|
|
|
{
|
|
|
|
|
#region Narrate hovered item
|
|
|
|
|
for (int i = 0; i < inventory.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
if (inventory[i].containsPoint(x, y))
|
|
|
|
|
{
|
|
|
|
|
string toSpeak = "";
|
|
|
|
|
if ((i + 1) <= actualInventory.Count)
|
|
|
|
|
{
|
|
|
|
|
if (actualInventory[i] != null)
|
|
|
|
|
{
|
|
|
|
|
string name = actualInventory[i].DisplayName;
|
|
|
|
|
int stack = actualInventory[i].Stack;
|
|
|
|
|
string quality = "";
|
|
|
|
|
|
|
|
|
|
#region Add quality of item
|
|
|
|
|
if (actualInventory[i] is StardewValley.Object && ((StardewValley.Object)actualInventory[i]).quality > 0)
|
|
|
|
|
{
|
|
|
|
|
int qualityIndex = ((StardewValley.Object)actualInventory[i]).quality;
|
|
|
|
|
if (qualityIndex == 1)
|
|
|
|
|
{
|
|
|
|
|
quality = "Silver quality";
|
|
|
|
|
}
|
|
|
|
|
else if (qualityIndex == 2 || qualityIndex == 3)
|
|
|
|
|
{
|
|
|
|
|
quality = "Gold quality";
|
|
|
|
|
}
|
|
|
|
|
else if (qualityIndex >= 4)
|
|
|
|
|
{
|
|
|
|
|
quality = "Iridium quality";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
if (inventoryMenu.highlightMethod(inventoryMenu.actualInventory[i]))
|
|
|
|
|
name = $"Donatable {name}";
|
|
|
|
|
|
|
|
|
|
if (stack > 1)
|
|
|
|
|
toSpeak = $"{stack} {name} {quality}";
|
|
|
|
|
else
|
|
|
|
|
toSpeak = $"{name} {quality}";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// For empty slot
|
|
|
|
|
toSpeak = "Empty Slot";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// For empty slot
|
|
|
|
|
toSpeak = "Empty Slot";
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-19 10:14:57 +00:00
|
|
|
|
if (museumQueryKey != $"{toSpeak}:{i}")
|
2022-03-19 09:53:18 +00:00
|
|
|
|
{
|
2022-03-19 10:14:57 +00:00
|
|
|
|
museumQueryKey = $"{toSpeak}:{i}";
|
2022-03-19 09:53:18 +00:00
|
|
|
|
MainClass.GetScreenReader().Say(toSpeak, true);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2021-12-28 15:13:07 +00:00
|
|
|
|
|
2022-01-14 05:23:15 +00:00
|
|
|
|
internal static bool PlaySoundPatch(string cueName)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!Context.IsPlayerFree)
|
|
|
|
|
return true;
|
|
|
|
|
|
2022-02-01 07:20:40 +00:00
|
|
|
|
if (!Game1.player.isMoving())
|
2022-01-14 05:23:15 +00:00
|
|
|
|
return true;
|
|
|
|
|
|
2022-02-01 07:20:40 +00:00
|
|
|
|
if (cueName == "grassyStep" || cueName == "sandyStep" || cueName == "snowyStep" || cueName == "stoneStep" || cueName == "thudStep" || cueName == "woodyStep")
|
2022-01-14 05:23:15 +00:00
|
|
|
|
{
|
2022-01-16 11:40:03 +00:00
|
|
|
|
Vector2 nextTile = CurrentPlayer.getNextTile();
|
2022-01-21 08:51:43 +00:00
|
|
|
|
if (ReadTile.isCollidingAtTile((int)nextTile.X, (int)nextTile.Y))
|
2022-01-14 05:23:15 +00:00
|
|
|
|
{
|
2022-01-16 11:40:03 +00:00
|
|
|
|
if (prevTile != nextTile)
|
|
|
|
|
{
|
|
|
|
|
prevTile = nextTile;
|
2022-01-21 08:51:43 +00:00
|
|
|
|
//Game1.playSound("colliding");
|
2022-01-16 11:40:03 +00:00
|
|
|
|
}
|
2022-01-14 05:23:15 +00:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2022-01-14 05:23:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-03 14:25:15 +00:00
|
|
|
|
internal static void LanguageSelectionMenuPatch(LanguageSelectionMenu __instance)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
2022-01-03 14:25:15 +00:00
|
|
|
|
|
2022-02-01 07:20:40 +00:00
|
|
|
|
if (__instance.nextPageButton != null && __instance.nextPageButton.containsPoint(x, y))
|
2022-01-03 14:25:15 +00:00
|
|
|
|
{
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker($"Next Page Button", true);
|
2022-01-03 14:25:15 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (__instance.previousPageButton != null && __instance.previousPageButton.containsPoint(x, y))
|
|
|
|
|
{
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker($"Previous Page Button", true);
|
2022-01-03 14:25:15 +00:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-01 07:20:40 +00:00
|
|
|
|
for (int i = 0; i < __instance.languages.Count; i++)
|
2022-01-03 14:25:15 +00:00
|
|
|
|
{
|
2022-02-01 07:20:40 +00:00
|
|
|
|
if (__instance.languages[i].containsPoint(x, y))
|
2022-01-03 14:25:15 +00:00
|
|
|
|
{
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker($"{__instance.languageList[i]} Button", true);
|
2022-01-03 14:25:15 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2022-01-03 14:25:15 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-03 14:17:58 +00:00
|
|
|
|
internal static void MineElevatorMenuPatch(List<ClickableComponent> ___elevators)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
|
2022-02-01 07:20:40 +00:00
|
|
|
|
for (int i = 0; i < ___elevators.Count; i++)
|
2022-01-03 14:17:58 +00:00
|
|
|
|
{
|
2022-02-01 07:20:40 +00:00
|
|
|
|
if (___elevators[i].containsPoint(x, y))
|
2022-01-03 14:17:58 +00:00
|
|
|
|
{
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker($"{___elevators[i].name} level", true);
|
2022-01-03 14:17:58 +00:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2022-01-03 14:17:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-31 15:15:52 +00:00
|
|
|
|
internal static void NamingMenuPatch(NamingMenu __instance, string title, TextBox ___textBox)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
__instance.textBoxCC.snapMouseCursor();
|
|
|
|
|
___textBox.SelectMe();
|
|
|
|
|
string toSpeak = $"{title}";
|
|
|
|
|
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithChecker(toSpeak, true);
|
2021-12-31 15:15:52 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2021-12-31 15:15:52 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-30 13:55:42 +00:00
|
|
|
|
internal static void ConfirmationDialogPatch(ConfirmationDialog __instance, string ___message)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
2021-12-30 13:55:42 +00:00
|
|
|
|
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker(___message, true);
|
2022-02-01 07:20:40 +00:00
|
|
|
|
if (__instance.okButton.containsPoint(x, y))
|
2021-12-30 13:55:42 +00:00
|
|
|
|
{
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker("Ok Button", false);
|
2022-02-01 07:20:40 +00:00
|
|
|
|
}
|
|
|
|
|
else if (__instance.cancelButton.containsPoint(x, y))
|
2021-12-30 13:55:42 +00:00
|
|
|
|
{
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker("Cancel Button", false);
|
2021-12-30 13:55:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2021-12-30 13:55:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-05 06:05:36 +00:00
|
|
|
|
internal static void LevelUpMenuPatch(LevelUpMenu __instance, List<int> ___professionsToChoose, List<string> ___leftProfessionDescription, List<string> ___rightProfessionDescription, List<string> ___extraInfoForLevel, List<CraftingRecipe> ___newCraftingRecipes, string ___title, bool ___isActive, bool ___isProfessionChooser)
|
2021-12-30 13:39:05 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
int x = Game1.getMouseX(true), y = Game1.getMouseY(true);
|
2021-12-30 13:39:05 +00:00
|
|
|
|
string leftProfession = " ", rightProfession = " ", extraInfo = " ", newCraftingRecipe = " ", toSpeak = " ";
|
|
|
|
|
|
|
|
|
|
if (!__instance.informationUp)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (__instance.isProfessionChooser)
|
|
|
|
|
{
|
|
|
|
|
if (___professionsToChoose.Count() == 0)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
for (int j = 0; j < ___leftProfessionDescription.Count; j++)
|
|
|
|
|
{
|
|
|
|
|
leftProfession += ___leftProfessionDescription[j] + ", ";
|
|
|
|
|
}
|
|
|
|
|
for (int i = 0; i < ___rightProfessionDescription.Count; i++)
|
|
|
|
|
{
|
|
|
|
|
rightProfession += ___rightProfessionDescription[i] + ", ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (__instance.leftProfession.containsPoint(x, y))
|
2022-02-05 06:05:36 +00:00
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
if ((MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) && __instance.readyToClose())
|
2022-02-05 06:05:36 +00:00
|
|
|
|
{
|
|
|
|
|
Game1.player.professions.Add(___professionsToChoose[0]);
|
|
|
|
|
__instance.getImmediateProfessionPerk(___professionsToChoose[0]);
|
|
|
|
|
___isActive = false;
|
|
|
|
|
__instance.informationUp = false;
|
|
|
|
|
___isProfessionChooser = false;
|
|
|
|
|
__instance.RemoveLevelFromLevelList();
|
|
|
|
|
__instance.exitThisMenu();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-30 13:39:05 +00:00
|
|
|
|
toSpeak = $"Selected: {leftProfession} Left click to choose.";
|
2022-02-05 06:05:36 +00:00
|
|
|
|
}
|
2021-12-30 13:39:05 +00:00
|
|
|
|
|
|
|
|
|
if (__instance.rightProfession.containsPoint(x, y))
|
2022-02-05 06:05:36 +00:00
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
if ((MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed()) && __instance.readyToClose())
|
2022-02-05 06:05:36 +00:00
|
|
|
|
{
|
|
|
|
|
Game1.player.professions.Add(___professionsToChoose[1]);
|
|
|
|
|
__instance.getImmediateProfessionPerk(___professionsToChoose[1]);
|
|
|
|
|
___isActive = false;
|
|
|
|
|
__instance.informationUp = false;
|
|
|
|
|
___isProfessionChooser = false;
|
|
|
|
|
__instance.RemoveLevelFromLevelList();
|
|
|
|
|
__instance.exitThisMenu();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-30 13:39:05 +00:00
|
|
|
|
toSpeak = $"Selected: {rightProfession} Left click to choose.";
|
2022-02-05 06:05:36 +00:00
|
|
|
|
}
|
2021-12-30 13:39:05 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
foreach (string s2 in ___extraInfoForLevel)
|
|
|
|
|
{
|
|
|
|
|
extraInfo += s2 + ", ";
|
|
|
|
|
}
|
|
|
|
|
foreach (CraftingRecipe s in ___newCraftingRecipes)
|
|
|
|
|
{
|
|
|
|
|
string cookingOrCrafting = Game1.content.LoadString("Strings\\UI:LearnedRecipe_" + (s.isCookingRecipe ? "cooking" : "crafting"));
|
|
|
|
|
string message = Game1.content.LoadString("Strings\\UI:LevelUp_NewRecipe", cookingOrCrafting, s.DisplayName);
|
|
|
|
|
|
|
|
|
|
newCraftingRecipe += $"{message}, ";
|
|
|
|
|
}
|
2022-02-05 06:05:36 +00:00
|
|
|
|
}
|
2021-12-30 13:39:05 +00:00
|
|
|
|
|
2022-02-05 06:05:36 +00:00
|
|
|
|
if (__instance.okButton.containsPoint(x, y))
|
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
if (MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed())
|
2022-02-05 06:05:36 +00:00
|
|
|
|
__instance.okButtonClicked();
|
|
|
|
|
|
|
|
|
|
toSpeak = $"{___title} {extraInfo} {newCraftingRecipe}. Left click to close.";
|
2021-12-30 13:39:05 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (toSpeak != " ")
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker(toSpeak, true);
|
2021-12-30 13:39:05 +00:00
|
|
|
|
else if (__instance.isProfessionChooser && currentLevelUpTitle != $"{___title}. Select a new profession.")
|
|
|
|
|
{
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithMenuChecker($"{___title}. Select a new profession.", true);
|
2021-12-30 13:39:05 +00:00
|
|
|
|
currentLevelUpTitle = $"{___title}. Select a new profession.";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2021-12-30 13:39:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-27 14:39:45 +00:00
|
|
|
|
internal static void ShippingMenuPatch(ShippingMenu __instance, List<int> ___categoryTotals)
|
|
|
|
|
{
|
2021-12-28 15:13:07 +00:00
|
|
|
|
try
|
2021-12-27 14:39:45 +00:00
|
|
|
|
{
|
2022-02-05 06:05:36 +00:00
|
|
|
|
|
2021-12-28 15:13:07 +00:00
|
|
|
|
if (__instance.currentPage == -1)
|
2021-12-27 14:39:45 +00:00
|
|
|
|
{
|
2021-12-28 15:13:07 +00:00
|
|
|
|
int total = ___categoryTotals[5];
|
|
|
|
|
string toSpeak;
|
2022-03-21 06:42:50 +00:00
|
|
|
|
if (__instance.okButton.containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
2021-12-27 14:39:45 +00:00
|
|
|
|
{
|
2022-02-05 06:05:36 +00:00
|
|
|
|
// Perform Left Click
|
2022-03-21 06:42:50 +00:00
|
|
|
|
if (MainClass.Config.LeftClickMainKey.JustPressed() || MainClass.Config.LeftClickAlternateKey.JustPressed())
|
2022-02-05 06:05:36 +00:00
|
|
|
|
{
|
|
|
|
|
Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true));
|
|
|
|
|
}
|
2021-12-28 15:13:07 +00:00
|
|
|
|
toSpeak = $"{total}g in total. Press left mouse button to save.";
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithChecker(toSpeak, true);
|
2021-12-27 14:39:45 +00:00
|
|
|
|
}
|
2021-12-28 15:13:07 +00:00
|
|
|
|
for (int i = 0; i < __instance.categories.Count; i++)
|
|
|
|
|
{
|
2022-03-21 06:42:50 +00:00
|
|
|
|
if (__instance.categories[i].containsPoint(Game1.getMouseX(true), Game1.getMouseY(true)))
|
2021-12-28 15:13:07 +00:00
|
|
|
|
{
|
|
|
|
|
toSpeak = $"Money recieved from {__instance.getCategoryName(i)}: {___categoryTotals[i]}g.";
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithChecker(toSpeak, true);
|
2021-12-28 15:13:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-27 14:39:45 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-28 15:13:07 +00:00
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2021-12-28 15:13:07 +00:00
|
|
|
|
}
|
2021-12-27 14:39:45 +00:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-13 14:29:17 +00:00
|
|
|
|
internal static void LetterViewerMenuPatch(LetterViewerMenu __instance)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (!__instance.IsActive())
|
|
|
|
|
return;
|
|
|
|
|
|
2022-03-19 09:00:37 +00:00
|
|
|
|
int x = Game1.getMousePosition().X, y = Game1.getMousePosition().Y;
|
2021-12-13 14:29:17 +00:00
|
|
|
|
#region Texts in the letter
|
|
|
|
|
string message = __instance.mailMessage[__instance.page];
|
|
|
|
|
|
2022-01-13 07:16:06 +00:00
|
|
|
|
string toSpeak = $"{message}";
|
2021-12-13 14:29:17 +00:00
|
|
|
|
|
|
|
|
|
if (__instance.ShouldShowInteractable())
|
|
|
|
|
{
|
|
|
|
|
if (__instance.moneyIncluded > 0)
|
|
|
|
|
{
|
|
|
|
|
string moneyText = Game1.content.LoadString("Strings\\UI:LetterViewer_MoneyIncluded", __instance.moneyIncluded);
|
|
|
|
|
toSpeak += $"\t\n\t ,Included money: {moneyText}";
|
|
|
|
|
}
|
|
|
|
|
else if (__instance.learnedRecipe != null && __instance.learnedRecipe.Length > 0)
|
|
|
|
|
{
|
|
|
|
|
string recipeText = Game1.content.LoadString("Strings\\UI:LetterViewer_LearnedRecipe", __instance.cookingOrCrafting);
|
|
|
|
|
toSpeak += $"\t\n\t ,Learned Recipe: {recipeText}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (currentLetterText != toSpeak)
|
|
|
|
|
{
|
|
|
|
|
currentLetterText = toSpeak;
|
2021-12-14 13:43:34 +00:00
|
|
|
|
|
|
|
|
|
// snap mouse to accept quest button
|
2022-03-19 09:00:37 +00:00
|
|
|
|
if (__instance.acceptQuestButton != null && __instance.questID != -1)
|
2021-12-14 13:43:34 +00:00
|
|
|
|
{
|
|
|
|
|
toSpeak += "\t\n Left click to accept quest.";
|
|
|
|
|
__instance.acceptQuestButton.snapMouseCursorToCenter();
|
|
|
|
|
}
|
2022-03-19 09:00:37 +00:00
|
|
|
|
if (__instance.mailMessage.Count > 1)
|
|
|
|
|
toSpeak = $"Page {__instance.page + 1} of {__instance.mailMessage.Count}:\n\t{toSpeak}";
|
|
|
|
|
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().Say(toSpeak, false);
|
2021-12-13 14:29:17 +00:00
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Narrate items given in the mail
|
|
|
|
|
if (__instance.ShouldShowInteractable())
|
|
|
|
|
{
|
|
|
|
|
foreach (ClickableComponent c in __instance.itemsToGrab)
|
|
|
|
|
{
|
|
|
|
|
string name = c.name;
|
|
|
|
|
string label = c.label;
|
|
|
|
|
|
2022-03-19 09:00:37 +00:00
|
|
|
|
if (c.containsPoint(x, y))
|
2022-02-13 11:27:06 +00:00
|
|
|
|
MainClass.GetScreenReader().SayWithChecker($"Grab: {name} \t\n {label}", false);
|
2021-12-13 14:29:17 +00:00
|
|
|
|
}
|
2021-12-14 13:36:06 +00:00
|
|
|
|
}
|
2021-12-13 14:29:17 +00:00
|
|
|
|
#endregion
|
2022-03-19 09:00:37 +00:00
|
|
|
|
|
|
|
|
|
#region Narrate buttons
|
|
|
|
|
if (__instance.backButton != null && __instance.backButton.visible && __instance.backButton.containsPoint(x, y))
|
|
|
|
|
MainClass.GetScreenReader().SayWithChecker($"Previous page button", false);
|
|
|
|
|
|
|
|
|
|
if (__instance.forwardButton != null && __instance.forwardButton.visible && __instance.forwardButton.containsPoint(x, y))
|
|
|
|
|
MainClass.GetScreenReader().SayWithChecker($"Next page button", false);
|
|
|
|
|
|
|
|
|
|
#endregion
|
2021-12-13 14:29:17 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2021-12-13 14:29:17 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-10 15:47:50 +00:00
|
|
|
|
|
2022-03-29 14:27:38 +00:00
|
|
|
|
#region Cleanup on exitting a menu
|
2022-01-07 10:34:37 +00:00
|
|
|
|
internal static void Game1ExitActiveMenuPatch()
|
2022-01-06 13:22:23 +00:00
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2022-03-29 14:27:38 +00:00
|
|
|
|
Cleanup(Game1.activeClickableMenu);
|
2022-01-07 10:34:37 +00:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2022-03-19 07:24:53 +00:00
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
2022-01-07 10:34:37 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-07 09:27:57 +00:00
|
|
|
|
|
2022-01-07 10:34:37 +00:00
|
|
|
|
internal static void IClickableMenuOnExitPatch(IClickableMenu __instance)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2022-03-29 14:27:38 +00:00
|
|
|
|
Cleanup(__instance);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-07 08:34:58 +00:00
|
|
|
|
|
2022-03-29 14:27:38 +00:00
|
|
|
|
private static void Cleanup(IClickableMenu menu)
|
|
|
|
|
{
|
|
|
|
|
if (menu is GameMenu)
|
|
|
|
|
{
|
|
|
|
|
GameMenuPatches.gameMenuQueryKey = "";
|
|
|
|
|
GameMenuPatches.craftingPageQueryKey = "";
|
|
|
|
|
GameMenuPatches.inventoryPageQueryKey = "";
|
|
|
|
|
GameMenuPatches.exitPageQueryKey = "";
|
|
|
|
|
GameMenuPatches.optionsPageQueryKey = "";
|
|
|
|
|
GameMenuPatches.socialPageQuery = "";
|
|
|
|
|
GameMenuPatches.currentSelectedCraftingRecipe = -1;
|
|
|
|
|
GameMenuPatches.isSelectingRecipe = false;
|
|
|
|
|
}
|
2022-01-07 08:34:58 +00:00
|
|
|
|
|
2022-03-29 14:27:38 +00:00
|
|
|
|
if (menu is JunimoNoteMenu)
|
|
|
|
|
{
|
|
|
|
|
GameMenuPatches.currentIngredientListItem = -1;
|
|
|
|
|
GameMenuPatches.currentIngredientInputSlot = -1;
|
|
|
|
|
GameMenuPatches.currentInventorySlot = -1;
|
|
|
|
|
GameMenuPatches.junimoNoteMenuQuery = "";
|
|
|
|
|
}
|
2022-01-07 11:13:44 +00:00
|
|
|
|
|
2022-03-29 14:27:38 +00:00
|
|
|
|
if (menu is ShopMenu)
|
|
|
|
|
{
|
|
|
|
|
GameMenuPatches.shopMenuQueryKey = "";
|
|
|
|
|
}
|
2022-02-03 10:39:30 +00:00
|
|
|
|
|
2022-03-29 14:27:38 +00:00
|
|
|
|
if (menu is ItemGrabMenu)
|
|
|
|
|
{
|
|
|
|
|
GameMenuPatches.itemGrabMenuQueryKey = "";
|
|
|
|
|
}
|
2022-02-04 08:45:24 +00:00
|
|
|
|
|
2022-03-29 14:27:38 +00:00
|
|
|
|
if (menu is GeodeMenu)
|
|
|
|
|
{
|
|
|
|
|
GameMenuPatches.geodeMenuQueryKey = "";
|
|
|
|
|
}
|
2022-02-13 14:26:09 +00:00
|
|
|
|
|
2022-03-29 14:27:38 +00:00
|
|
|
|
if (menu is CarpenterMenu)
|
|
|
|
|
{
|
|
|
|
|
BuildingNAnimalMenuPatches.carpenterMenuQuery = "";
|
|
|
|
|
BuildingNAnimalMenuPatches.isUpgrading = false;
|
|
|
|
|
BuildingNAnimalMenuPatches.isDemolishing = false;
|
|
|
|
|
BuildingNAnimalMenuPatches.isPainting = false;
|
|
|
|
|
BuildingNAnimalMenuPatches.isMoving = false;
|
|
|
|
|
BuildingNAnimalMenuPatches.isConstructing = false;
|
|
|
|
|
BuildingNAnimalMenuPatches.carpenterMenu = null;
|
2022-01-06 13:22:23 +00:00
|
|
|
|
}
|
2022-03-29 14:27:38 +00:00
|
|
|
|
|
|
|
|
|
if (menu is PurchaseAnimalsMenu)
|
2022-01-06 13:22:23 +00:00
|
|
|
|
{
|
2022-03-29 14:27:38 +00:00
|
|
|
|
BuildingNAnimalMenuPatches.purchaseAnimalMenuQuery = "";
|
|
|
|
|
BuildingNAnimalMenuPatches.firstTimeInNamingMenu = true;
|
|
|
|
|
BuildingNAnimalMenuPatches.purchaseAnimalsMenu = null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (menu is DialogueBox)
|
|
|
|
|
{
|
|
|
|
|
DialoguePatches.isDialogueAppearingFirstTime = true;
|
|
|
|
|
DialoguePatches.currentDialogue = " ";
|
2022-01-06 13:22:23 +00:00
|
|
|
|
}
|
2022-03-29 14:27:38 +00:00
|
|
|
|
|
|
|
|
|
GameMenuPatches.hoveredItemQueryKey = "";
|
2022-01-06 13:22:23 +00:00
|
|
|
|
}
|
2022-03-29 14:27:38 +00:00
|
|
|
|
#endregion
|
2022-01-06 13:22:23 +00:00
|
|
|
|
|
2022-01-30 16:55:02 +00:00
|
|
|
|
internal static void ExitEventPatch()
|
|
|
|
|
{
|
2022-02-13 11:27:06 +00:00
|
|
|
|
if (MainClass.GetScreenReader() != null)
|
|
|
|
|
MainClass.GetScreenReader().CloseScreenReader();
|
2022-01-30 16:55:02 +00:00
|
|
|
|
}
|
2021-12-14 13:36:06 +00:00
|
|
|
|
internal static void resetGlobalVars()
|
|
|
|
|
{
|
|
|
|
|
currentLetterText = " ";
|
2021-12-30 13:39:05 +00:00
|
|
|
|
currentLevelUpTitle = " ";
|
2021-12-14 13:36:06 +00:00
|
|
|
|
}
|
2021-12-10 15:47:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|