Issue#52 Patched speech bubbles

master
Mohammad Shoaib Khan 2022-10-23 11:14:58 +05:30
parent d131d26ac8
commit 9d1c6f95dd
4 changed files with 27 additions and 8 deletions

View File

@ -45,7 +45,7 @@ namespace stardew_access.Features
foreach (var location in data) foreach (var location in data)
{ {
if (!Game1.currentLocation.name.Value.ToLower().Equals(location.Key.ToLower())) if (!Game1.currentLocation.Name.ToLower().Equals(location.Key.ToLower()))
continue; continue;
if (location.Value != null) if (location.Value != null)

View File

@ -478,7 +478,7 @@ namespace stardew_access.Features
return (CATEGORY.Interactables, "Island Trader"); return (CATEGORY.Interactables, "Island Trader");
} }
} }
else if (Game1.currentLocation.name.Value.ToLower().Equals("coop")) else if (Game1.currentLocation.Name.ToLower().Equals("coop"))
{ {
if (x >= 6 && x <= 9 && y == 3) if (x >= 6 && x <= 9 && y == 3)
{ {
@ -489,7 +489,7 @@ namespace stardew_access.Features
return (CATEGORY.Others, "Empty Feeding Bench"); return (CATEGORY.Others, "Empty Feeding Bench");
} }
} }
else if (Game1.currentLocation.name.Value.ToLower().Equals("big coop") || Game1.currentLocation.name.Value.ToLower().Equals("coop2")) else if (Game1.currentLocation.Name.ToLower().Equals("big coop") || Game1.currentLocation.Name.ToLower().Equals("coop2"))
{ {
if (x >= 6 && x <= 13 && y == 3) if (x >= 6 && x <= 13 && y == 3)
{ {
@ -500,7 +500,7 @@ namespace stardew_access.Features
return (CATEGORY.Others, "Empty Feeding Bench"); return (CATEGORY.Others, "Empty Feeding Bench");
} }
} }
else if (Game1.currentLocation.name.Value.ToLower().Equals("deluxe coop") || Game1.currentLocation.name.Value.ToLower().Equals("coop3")) else if (Game1.currentLocation.Name.ToLower().Equals("deluxe coop") || Game1.currentLocation.Name.ToLower().Equals("coop3"))
{ {
if (x >= 6 && x <= 17 && y == 3) if (x >= 6 && x <= 17 && y == 3)
{ {
@ -511,7 +511,7 @@ namespace stardew_access.Features
return (CATEGORY.Others, "Empty Feeding Bench"); return (CATEGORY.Others, "Empty Feeding Bench");
} }
} }
else if (Game1.currentLocation.name.Value.ToLower().Equals("barn")) else if (Game1.currentLocation.Name.ToLower().Equals("barn"))
{ {
if (x >= 8 && x <= 11 && y == 3) if (x >= 8 && x <= 11 && y == 3)
{ {
@ -522,7 +522,7 @@ namespace stardew_access.Features
return (CATEGORY.Others, "Empty Feeding Bench"); return (CATEGORY.Others, "Empty Feeding Bench");
} }
} }
else if (Game1.currentLocation.name.Value.ToLower().Equals("big barn") || Game1.currentLocation.name.Value.ToLower().Equals("barn2")) else if (Game1.currentLocation.Name.ToLower().Equals("big barn") || Game1.currentLocation.Name.ToLower().Equals("barn2"))
{ {
if (x >= 8 && x <= 15 && y == 3) if (x >= 8 && x <= 15 && y == 3)
{ {
@ -533,7 +533,7 @@ namespace stardew_access.Features
return (CATEGORY.Others, "Empty Feeding Bench"); return (CATEGORY.Others, "Empty Feeding Bench");
} }
} }
else if (Game1.currentLocation.name.Value.ToLower().Equals("deluxe barn") || Game1.currentLocation.name.Value.ToLower().Equals("barn3")) else if (Game1.currentLocation.Name.ToLower().Equals("deluxe barn") || Game1.currentLocation.Name.ToLower().Equals("barn3"))
{ {
if (x >= 8 && x <= 19 && y == 3) if (x >= 8 && x <= 19 && y == 3)
{ {

View File

@ -28,6 +28,11 @@ namespace stardew_access
original: AccessTools.Method(typeof(IClickableMenu), nameof(IClickableMenu.drawHoverText), new Type[] { typeof(SpriteBatch), typeof(string), typeof(SpriteFont), typeof(int), typeof(int), typeof(int), typeof(string), typeof(int), typeof(string[]), typeof(Item), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(float), typeof(CraftingRecipe), typeof(IList<Item>) }), original: AccessTools.Method(typeof(IClickableMenu), nameof(IClickableMenu.drawHoverText), new Type[] { typeof(SpriteBatch), typeof(string), typeof(SpriteFont), typeof(int), typeof(int), typeof(int), typeof(string), typeof(int), typeof(string[]), typeof(Item), typeof(int), typeof(int), typeof(int), typeof(int), typeof(int), typeof(float), typeof(CraftingRecipe), typeof(IList<Item>) }),
postfix: new HarmonyMethod(typeof(DialoguePatches), nameof(DialoguePatches.HoverTextPatch)) postfix: new HarmonyMethod(typeof(DialoguePatches), nameof(DialoguePatches.HoverTextPatch))
); );
harmony.Patch(
original: AccessTools.Method(typeof(NPC), nameof(NPC.drawAboveAlwaysFrontLayer)),
postfix: new HarmonyMethod(typeof(DialoguePatches), nameof(DialoguePatches.drawAboveAlwaysFrontLayerPatch))
);
#endregion #endregion
#region Title Menu Patches #region Title Menu Patches

View File

@ -340,7 +340,6 @@ namespace stardew_access.Patches
} }
catch (Exception e) catch (Exception e)
{ {
MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}");
} }
} }
@ -409,5 +408,20 @@ namespace stardew_access.Patches
#endregion #endregion
} }
internal static void drawAboveAlwaysFrontLayerPatch(NPC __instance, string ___textAboveHead, int ___textAboveHeadTimer)
{
try
{
if (___textAboveHeadTimer > 2900 && ___textAboveHead != null)
{
MainClass.ScreenReader.SayWithChecker($"{__instance.displayName} says {___textAboveHead}", true);
}
}
catch (Exception e)
{
MainClass.ErrorLog($"Error in patch:NPCShowTextAboveHeadPatch \n{e.Message}\n{e.StackTrace}");
}
}
} }
} }