Patched forge menu

master
Mohammad Shoaib 2022-04-12 23:54:46 +05:30
parent 3b55110e11
commit bf9ca47dc4
3 changed files with 151 additions and 42 deletions

View File

@ -185,6 +185,11 @@ namespace stardew_access
original: AccessTools.Method(typeof(PondQueryMenu), nameof(PondQueryMenu.draw), new Type[] { typeof(SpriteBatch) }), original: AccessTools.Method(typeof(PondQueryMenu), nameof(PondQueryMenu.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.PondQueryMenuPatch)) postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.PondQueryMenuPatch))
); );
harmony.Patch(
original: AccessTools.Method(typeof(ForgeMenu), nameof(ForgeMenu.draw), new Type[] { typeof(SpriteBatch) }),
postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.ForgeMenuPatch))
);
#endregion #endregion
#region Quest Patches #region Quest Patches

View File

@ -149,68 +149,49 @@ namespace stardew_access.Patches
#region Skip narrating hover text for certain menus #region Skip narrating hover text for certain menus
if (Game1.activeClickableMenu is TitleMenu && !(((TitleMenu)Game1.activeClickableMenu).GetChildMenu() is CharacterCustomization)) if (Game1.activeClickableMenu is TitleMenu && !(((TitleMenu)Game1.activeClickableMenu).GetChildMenu() is CharacterCustomization))
return; return;
else if (Game1.activeClickableMenu is LetterViewerMenu || Game1.activeClickableMenu is QuestLog)
if (Game1.activeClickableMenu is LetterViewerMenu || Game1.activeClickableMenu is QuestLog)
return; return;
else if (Game1.activeClickableMenu is Billboard)
if (Game1.activeClickableMenu is Billboard)
return; return;
else if (Game1.activeClickableMenu is GeodeMenu)
if (Game1.activeClickableMenu is GeodeMenu)
return; return;
else if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is InventoryPage)
if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is InventoryPage)
return; return;
else if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is CraftingPage)
if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is CraftingPage)
return; return;
else if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is OptionsPage)
if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is OptionsPage)
return; return;
else if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is ExitPage)
if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is ExitPage)
return; return;
else if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is SocialPage)
if (Game1.activeClickableMenu is GameMenu && ((GameMenu)Game1.activeClickableMenu).GetCurrentPage() is SocialPage)
return; return;
else if (Game1.activeClickableMenu is ItemGrabMenu)
if (Game1.activeClickableMenu is ItemGrabMenu)
return; return;
else if (Game1.activeClickableMenu is ShopMenu)
if (Game1.activeClickableMenu is ShopMenu)
return; return;
else if (Game1.activeClickableMenu is ConfirmationDialog)
if (Game1.activeClickableMenu is ConfirmationDialog)
return; return;
else if (Game1.activeClickableMenu is JunimoNoteMenu)
if (Game1.activeClickableMenu is JunimoNoteMenu)
return; return;
else if (Game1.activeClickableMenu is CarpenterMenu)
if (Game1.activeClickableMenu is CarpenterMenu)
return; return;
else if (Game1.activeClickableMenu is PurchaseAnimalsMenu)
if (Game1.activeClickableMenu is PurchaseAnimalsMenu)
return; return;
else if (Game1.activeClickableMenu is CraftingPage)
if (Game1.activeClickableMenu is CraftingPage)
return; return;
else if (Game1.activeClickableMenu is AnimalQueryMenu)
if (Game1.activeClickableMenu is AnimalQueryMenu)
return; return;
else if (Game1.activeClickableMenu is ConfirmationDialog)
if (Game1.activeClickableMenu is ConfirmationDialog)
return; return;
else if (Game1.activeClickableMenu is ReadyCheckDialog)
if (Game1.activeClickableMenu is ReadyCheckDialog)
return; return;
else if (Game1.activeClickableMenu is JojaCDMenu)
if (Game1.activeClickableMenu is JojaCDMenu)
return; return;
else if (Game1.activeClickableMenu is TailoringMenu)
if (Game1.activeClickableMenu is TailoringMenu)
return; return;
else if (Game1.activeClickableMenu is PondQueryMenu)
if (Game1.activeClickableMenu is PondQueryMenu) return;
else if (Game1.activeClickableMenu is ForgeMenu)
return; return;
#endregion #endregion

View File

@ -17,8 +17,112 @@ namespace stardew_access.Patches
internal static string animalQueryMenuQuery = " "; internal static string animalQueryMenuQuery = " ";
internal static string tailoringMenuQuery = " "; internal static string tailoringMenuQuery = " ";
internal static string pondQueryMenuQuery = " "; internal static string pondQueryMenuQuery = " ";
internal static string forgeMenuQuery = " ";
public static Vector2? prevTile = null; public static Vector2? prevTile = null;
internal static void ForgeMenuPatch(ForgeMenu __instance)
{
try
{
int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position
string toSpeak = " ";
if (__instance.leftIngredientSpot != null && __instance.leftIngredientSpot.containsPoint(x, y))
{
if (__instance.leftIngredientSpot.item == null)
{
toSpeak = "Input weapon or tool here";
}
else
{
Item item = __instance.leftIngredientSpot.item;
toSpeak = $"Weapon slot: {item.Stack} {item.DisplayName}";
}
}
else if (__instance.rightIngredientSpot != null && __instance.rightIngredientSpot.containsPoint(x, y))
{
if (__instance.rightIngredientSpot.item == null)
{
toSpeak = "Input gemstone here";
}
else
{
Item item = __instance.rightIngredientSpot.item;
toSpeak = $"Gemstone slot: {item.Stack} {item.DisplayName}";
}
}
else if (__instance.startTailoringButton != null && __instance.startTailoringButton.containsPoint(x, y))
{
toSpeak = "Star forging button";
}
else if (__instance.unforgeButton != null && __instance.unforgeButton.containsPoint(x, y))
{
toSpeak = "Unforge button";
}
else if (__instance.trashCan != null && __instance.trashCan.containsPoint(x, y))
{
toSpeak = "Trashcan";
}
else if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
{
toSpeak = "ok button";
}
else if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
{
toSpeak = "drop item";
}
else if (__instance.equipmentIcons.Count > 0 && __instance.equipmentIcons[0].containsPoint(x, y))
{
toSpeak = "Left ring Slot";
if (Game1.player.leftRing.Value != null)
toSpeak = $"{toSpeak}: {Game1.player.leftRing.Value.DisplayName}";
}
else if (__instance.equipmentIcons.Count > 0 && __instance.equipmentIcons[1].containsPoint(x, y))
{
toSpeak = "Right ring Slot";
if (Game1.player.rightRing.Value != null)
toSpeak = $"{toSpeak}: {Game1.player.rightRing.Value.DisplayName}";
}
else
{
for (int i = 0; i < __instance.inventory.inventory.Count; i++)
{
if (!__instance.inventory.inventory[i].containsPoint(x, y))
continue;
if (__instance.inventory.actualInventory[i] == null)
toSpeak = "Empty slot";
else
toSpeak = $"{__instance.inventory.actualInventory[i].Stack} {__instance.inventory.actualInventory[i].DisplayName}";
if (forgeMenuQuery != $"{toSpeak}:{i}")
{
forgeMenuQuery = $"{toSpeak}:{i}";
MainClass.ScreenReader.Say(toSpeak, true);
}
return;
}
}
if (forgeMenuQuery != toSpeak)
{
forgeMenuQuery = toSpeak;
MainClass.ScreenReader.Say(toSpeak, true);
if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
Game1.playSound("drop_item");
}
}
catch (System.Exception e)
{
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
}
}
internal static void PondQueryMenuPatch(PondQueryMenu __instance, StardewValley.Object ____fishItem, FishPond ____pond, string ____statusText, bool ___confirmingEmpty) internal static void PondQueryMenuPatch(PondQueryMenu __instance, StardewValley.Object ____fishItem, FishPond ____pond, string ____statusText, bool ___confirmingEmpty)
{ {
try try
@ -107,6 +211,18 @@ namespace stardew_access.Patches
{ {
toSpeak = "Star tailoring button"; toSpeak = "Star tailoring button";
} }
else if (__instance.trashCan != null && __instance.trashCan.containsPoint(x, y))
{
toSpeak = "Trashcan";
}
else if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
{
toSpeak = "ok button";
}
else if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
{
toSpeak = "drop item";
}
else if (__instance.equipmentIcons.Count > 0 && __instance.equipmentIcons[0].containsPoint(x, y)) else if (__instance.equipmentIcons.Count > 0 && __instance.equipmentIcons[0].containsPoint(x, y))
{ {
toSpeak = "Hat Slot"; toSpeak = "Hat Slot";
@ -155,6 +271,9 @@ namespace stardew_access.Patches
{ {
tailoringMenuQuery = toSpeak; tailoringMenuQuery = toSpeak;
MainClass.ScreenReader.Say(toSpeak, true); MainClass.ScreenReader.Say(toSpeak, true);
if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
Game1.playSound("drop_item");
} }
} }
catch (System.Exception e) catch (System.Exception e)
@ -660,6 +779,10 @@ namespace stardew_access.Patches
{ {
tailoringMenuQuery = " "; tailoringMenuQuery = " ";
} }
else if (menu is ForgeMenu)
{
forgeMenuQuery = " ";
}
else if (menu is PondQueryMenu) else if (menu is PondQueryMenu)
{ {
pondQueryMenuQuery = " "; pondQueryMenuQuery = " ";