Added drop item area detection and narration of lst shipped item
parent
2049ed2b9e
commit
4ec08076a7
|
@ -110,7 +110,22 @@ namespace stardew_access
|
||||||
harmony.Patch(
|
harmony.Patch(
|
||||||
original: AccessTools.Method(typeof(CraftingPage), nameof(CraftingPage.draw), new Type[] { typeof(SpriteBatch) }),
|
original: AccessTools.Method(typeof(CraftingPage), nameof(CraftingPage.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.CraftingPagePatch))
|
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.CraftingPagePatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(InventoryMenu), nameof(InventoryMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
|
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.InventoryMenuPatch))
|
||||||
|
);
|
||||||
|
|
||||||
|
/*harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(MenuWithInventory), nameof(MenuWithInventory.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
|
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.MenuWithInventoryPatch))
|
||||||
|
);*/
|
||||||
|
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(ItemGrabMenu), nameof(ItemGrabMenu.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
|
postfix: new HarmonyMethod(typeof(GameMenuPatches), nameof(GameMenuPatches.ItemGrabMenuPatch))
|
||||||
|
);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Menu Patches
|
#region Menu Patches
|
||||||
|
|
|
@ -7,6 +7,47 @@ namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
internal class GameMenuPatches
|
internal class GameMenuPatches
|
||||||
{
|
{
|
||||||
|
internal static void ItemGrabMenuPatch(ItemGrabMenu __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y; // Mouse x and y position
|
||||||
|
|
||||||
|
if (__instance.okButton != null && __instance.okButton.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
ScreenReader.sayWithMenuChecker("Ok Button", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (__instance.trashCan != null && __instance.trashCan.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
ScreenReader.sayWithMenuChecker("Trash Can", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
ScreenReader.sayWithMenuChecker("Drop Item", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (__instance.shippingBin && Game1.getFarm().lastItemShipped != null && __instance.lastShippedHolder.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
Item lastShippedItem = Game1.getFarm().lastItemShipped;
|
||||||
|
string name = lastShippedItem.DisplayName;
|
||||||
|
int count = lastShippedItem.Stack;
|
||||||
|
|
||||||
|
string toSpeak = $"Last Shipped: {count} {name}";
|
||||||
|
|
||||||
|
ScreenReader.sayWithMenuChecker(toSpeak, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static void CraftingPagePatch(CraftingPage __instance)
|
internal static void CraftingPagePatch(CraftingPage __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -43,6 +84,24 @@ namespace stardew_access.Patches
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void InventoryMenuPatch(InventoryMenu __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int x = Game1.getMousePosition(true).X, y = Game1.getMousePosition(true).Y; // Mouse x and y position
|
||||||
|
|
||||||
|
if (__instance.dropItemInvisibleButton != null && __instance.dropItemInvisibleButton.containsPoint(x, y))
|
||||||
|
{
|
||||||
|
ScreenReader.sayWithMenuChecker("Drop Item", true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static void OptionsPagePatch(OptionsPage __instance)
|
internal static void OptionsPagePatch(OptionsPage __instance)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using StardewModdingAPI;
|
||||||
using StardewModdingAPI;
|
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
using StardewValley.Menus;
|
using StardewValley.Menus;
|
||||||
using StardewValley.Quests;
|
|
||||||
|
|
||||||
namespace stardew_access.Patches
|
namespace stardew_access.Patches
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue