Patched draw method of TrashBear.cs to speak the wanted item
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics;
|
|||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using stardew_access.Patches;
|
using stardew_access.Patches;
|
||||||
using StardewValley;
|
using StardewValley;
|
||||||
|
using StardewValley.Characters;
|
||||||
using StardewValley.Menus;
|
using StardewValley.Menus;
|
||||||
using StardewValley.Minigames;
|
using StardewValley.Minigames;
|
||||||
|
|
||||||
@@ -306,6 +307,11 @@ namespace stardew_access
|
|||||||
original: AccessTools.Method(typeof(Game1), nameof(Game1.closeTextEntry)),
|
original: AccessTools.Method(typeof(Game1), nameof(Game1.closeTextEntry)),
|
||||||
prefix: new HarmonyMethod(typeof(Game1Patch), nameof(Game1Patch.CloseTextEntryPatch))
|
prefix: new HarmonyMethod(typeof(Game1Patch), nameof(Game1Patch.CloseTextEntryPatch))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
harmony.Patch(
|
||||||
|
original: AccessTools.Method(typeof(TrashBear), nameof(TrashBear.draw), new Type[] { typeof(SpriteBatch) }),
|
||||||
|
prefix: new HarmonyMethod(typeof(TrashBearPatch), nameof(TrashBearPatch.DrawPatch))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
stardew-access/Patches/MiscPatches/TrashBearPatch.cs
Normal file
23
stardew-access/Patches/MiscPatches/TrashBearPatch.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using StardewValley;
|
||||||
|
|
||||||
|
namespace stardew_access.Patches
|
||||||
|
{
|
||||||
|
internal class TrashBearPatch
|
||||||
|
{
|
||||||
|
internal static void DrawPatch(int ___itemWantedIndex, int ___showWantBubbleTimer)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (___showWantBubbleTimer >= 2900)
|
||||||
|
{
|
||||||
|
string itemName = Game1.objectInformation[___itemWantedIndex].Split('/')[4];
|
||||||
|
MainClass.ScreenReader.Say($"Trash Bear wants {itemName}!", true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
MainClass.ErrorLog($"An error occured TrashBearPatch::DrawPatch():\n{e.Message}\n{e.StackTrace}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user