diff --git a/stardew-access/Features/StaticTiles.cs b/stardew-access/Features/StaticTiles.cs index 5befb38..4ce596d 100644 --- a/stardew-access/Features/StaticTiles.cs +++ b/stardew-access/Features/StaticTiles.cs @@ -83,7 +83,21 @@ namespace stardew_access.Features } if (isXPresent && isYPresent) - return (tile.Key, CATEGORY.FromString(tileType.ToString().ToLower())); + { + string key = tile.Key; + if (key.Contains('[') && key.Contains(']')) + { + int i1 = key.IndexOf('['); + int i2 = key.LastIndexOf(']'); + + if (i1 < i2) + { + key = key.Remove(i1, ++i2 - i1); + } + } + + return (key.Trim(), CATEGORY.FromString(tileType.ToString().ToLower())); + } } } diff --git a/stardew-access/Features/TileInfo.cs b/stardew-access/Features/TileInfo.cs index 95539c4..1ac2250 100644 --- a/stardew-access/Features/TileInfo.cs +++ b/stardew-access/Features/TileInfo.cs @@ -478,6 +478,72 @@ namespace stardew_access.Features return (CATEGORY.Interactables, "Island Trader"); } } + else if (Game1.currentLocation.Name.ToLower().Equals("coop")) + { + if (x >= 6 && x <= 9 && y == 3) + { + (string? name, CATEGORY category) bench = getObjectAtTile(x, y, true); + if (bench.name != null && bench.name.ToLower().Contains("hay")) + return (CATEGORY.Others, "Feeding Bench"); + else + return (CATEGORY.Others, "Empty Feeding Bench"); + } + } + else if (Game1.currentLocation.Name.ToLower().Equals("big coop") || Game1.currentLocation.Name.ToLower().Equals("coop2")) + { + if (x >= 6 && x <= 13 && y == 3) + { + (string? name, CATEGORY category) bench = getObjectAtTile(x, y, true); + if (bench.name != null && bench.name.ToLower().Contains("hay")) + return (CATEGORY.Others, "Feeding Bench"); + else + return (CATEGORY.Others, "Empty Feeding Bench"); + } + } + else if (Game1.currentLocation.Name.ToLower().Equals("deluxe coop") || Game1.currentLocation.Name.ToLower().Equals("coop3")) + { + if (x >= 6 && x <= 17 && y == 3) + { + (string? name, CATEGORY category) bench = getObjectAtTile(x, y, true); + if (bench.name != null && bench.name.ToLower().Contains("hay")) + return (CATEGORY.Others, "Feeding Bench"); + else + return (CATEGORY.Others, "Empty Feeding Bench"); + } + } + else if (Game1.currentLocation.Name.ToLower().Equals("barn")) + { + if (x >= 8 && x <= 11 && y == 3) + { + (string? name, CATEGORY category) bench = getObjectAtTile(x, y, true); + if (bench.name != null && bench.name.ToLower().Contains("hay")) + return (CATEGORY.Others, "Feeding Bench"); + else + return (CATEGORY.Others, "Empty Feeding Bench"); + } + } + else if (Game1.currentLocation.Name.ToLower().Equals("big barn") || Game1.currentLocation.Name.ToLower().Equals("barn2")) + { + if (x >= 8 && x <= 15 && y == 3) + { + (string? name, CATEGORY category) bench = getObjectAtTile(x, y, true); + if (bench.name != null && bench.name.ToLower().Contains("hay")) + return (CATEGORY.Others, "Feeding Bench"); + else + return (CATEGORY.Others, "Empty Feeding Bench"); + } + } + else if (Game1.currentLocation.Name.ToLower().Equals("deluxe barn") || Game1.currentLocation.Name.ToLower().Equals("barn3")) + { + if (x >= 8 && x <= 19 && y == 3) + { + (string? name, CATEGORY category) bench = getObjectAtTile(x, y, true); + if (bench.name != null && bench.name.ToLower().Contains("hay")) + return (CATEGORY.Others, "Feeding Bench"); + else + return (CATEGORY.Others, "Empty Feeding Bench"); + } + } return (null, null); } @@ -689,6 +755,8 @@ namespace stardew_access.Features (string? name, CATEGORY category) toReturn = (null, CATEGORY.Others); StardewValley.Object obj = Game1.currentLocation.getObjectAtTile(x, y); + if (obj == null) return toReturn; + int index = obj.ParentSheetIndex; toReturn.name = obj.DisplayName; diff --git a/stardew-access/HarmonyPatches.cs b/stardew-access/HarmonyPatches.cs index ec74193..fbd1d92 100644 --- a/stardew-access/HarmonyPatches.cs +++ b/stardew-access/HarmonyPatches.cs @@ -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) }), 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 #region Title Menu Patches diff --git a/stardew-access/Patches/DialoguePatches.cs b/stardew-access/Patches/DialoguePatches.cs index b59bbef..e131952 100644 --- a/stardew-access/Patches/DialoguePatches.cs +++ b/stardew-access/Patches/DialoguePatches.cs @@ -340,7 +340,6 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -409,5 +408,20 @@ namespace stardew_access.Patches #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}"); + } + } } } diff --git a/stardew-access/Patches/GameMenuPatches.cs b/stardew-access/Patches/GameMenuPatches.cs index f322daf..e1c2d46 100644 --- a/stardew-access/Patches/GameMenuPatches.cs +++ b/stardew-access/Patches/GameMenuPatches.cs @@ -917,7 +917,6 @@ namespace stardew_access.Patches MainClass.ScreenReader.Say(toSpeak, true); Game1.playSound("drop_item"); } - return; } if (__instance.organizeButton != null && __instance.organizeButton.containsPoint(x, y)) @@ -930,7 +929,6 @@ namespace stardew_access.Patches hoveredItemQueryKey = ""; MainClass.ScreenReader.Say(toSpeak, true); } - return; } if (__instance.trashCan != null && __instance.trashCan.containsPoint(x, y)) @@ -943,7 +941,6 @@ namespace stardew_access.Patches hoveredItemQueryKey = ""; MainClass.ScreenReader.Say(toSpeak, true); } - return; } if (__instance.organizeButton != null && __instance.organizeButton.containsPoint(x, y)) @@ -956,7 +953,6 @@ namespace stardew_access.Patches hoveredItemQueryKey = ""; MainClass.ScreenReader.Say(toSpeak, true); } - return; } if (__instance.junimoNoteIcon != null && __instance.junimoNoteIcon.containsPoint(x, y)) @@ -970,7 +966,6 @@ namespace stardew_access.Patches hoveredItemQueryKey = ""; MainClass.ScreenReader.Say(toSpeak, true); } - return; } #endregion @@ -1066,7 +1061,6 @@ namespace stardew_access.Patches hoveredItemQueryKey = ""; MainClass.ScreenReader.Say(toSpeak, true); } - return; } } #endregion @@ -1076,9 +1070,35 @@ namespace stardew_access.Patches { gameMenuQueryKey = ""; inventoryPageQueryKey = ""; - return; } #endregion + + if (MainClass.Config.MoneyKey.JustPressed()) + { + string farmName = Game1.content.LoadString("Strings\\UI:Inventory_FarmName", Game1.player.farmName.Value); + string currentFunds = Game1.content.LoadString("Strings\\UI:Inventory_CurrentFunds" + (Game1.player.useSeparateWallets ? "_Separate" : ""), Utility.getNumberWithCommas(Game1.player.Money)); + string totalEarnings = Game1.content.LoadString("Strings\\UI:Inventory_TotalEarnings" + (Game1.player.useSeparateWallets ? "_Separate" : ""), Utility.getNumberWithCommas((int)Game1.player.totalMoneyEarned)); + int festivalScore = Game1.player.festivalScore; + int walnut = Game1.netWorldState.Value.GoldenWalnuts.Value; + int qiGems = Game1.player.QiGems; + int qiCoins = Game1.player.clubCoins; + + string toSpeak = $"{farmName}\n{currentFunds}\n{totalEarnings}"; + + if (festivalScore > 0) + toSpeak = $"{toSpeak}\nFestival Score: {festivalScore}"; + + if (walnut > 0) + toSpeak = $"{toSpeak}\nGolden Walnut: {walnut}"; + + if (qiGems > 0) + toSpeak = $"{toSpeak}\nQi Gems: {qiGems}"; + + if (qiCoins > 0) + toSpeak = $"{toSpeak}\nQi Club Coins: {qiCoins}"; + + MainClass.ScreenReader.Say(toSpeak, true); + } } catch (Exception e) { diff --git a/stardew-access/assets/static-tiles.json b/stardew-access/assets/static-tiles.json index d33a93a..cbc2549 100644 --- a/stardew-access/assets/static-tiles.json +++ b/stardew-access/assets/static-tiles.json @@ -318,26 +318,6 @@ "y": [3], "type": "interactable" }, - "Feeding Bench A": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [11], - "y": [3], - "type": "other" - }, "Exit": { "x": [11], "y": [14], @@ -350,46 +330,6 @@ "y": [3], "type": "interactable" }, - "Feeding Bench A": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [11], - "y": [3], - "type": "other" - }, - "Feeding Bench E": { - "x": [12], - "y": [3], - "type": "other" - }, - "Feeding Bench F": { - "x": [13], - "y": [3], - "type": "other" - }, - "Feeding Bench G": { - "x": [14], - "y": [3], - "type": "other" - }, - "Feeding Bench H": { - "x": [15], - "y": [3], - "type": "other" - }, "Exit": { "x": [11], "y": [14], @@ -402,46 +342,6 @@ "y": [3], "type": "interactable" }, - "Feeding Bench A": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [11], - "y": [3], - "type": "other" - }, - "Feeding Bench E": { - "x": [12], - "y": [3], - "type": "other" - }, - "Feeding Bench F": { - "x": [13], - "y": [3], - "type": "other" - }, - "Feeding Bench G": { - "x": [14], - "y": [3], - "type": "other" - }, - "Feeding Bench H": { - "x": [15], - "y": [3], - "type": "other" - }, "Exit": { "x": [11], "y": [14], @@ -454,66 +354,6 @@ "y": [3], "type": "interactable" }, - "Feeding Bench A": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [11], - "y": [3], - "type": "other" - }, - "Feeding Bench E": { - "x": [12], - "y": [3], - "type": "other" - }, - "Feeding Bench F": { - "x": [13], - "y": [3], - "type": "other" - }, - "Feeding Bench G": { - "x": [14], - "y": [3], - "type": "other" - }, - "Feeding Bench H": { - "x": [15], - "y": [3], - "type": "other" - }, - "Feeding Bench I": { - "x": [16], - "y": [3], - "type": "other" - }, - "Feeding Bench J": { - "x": [17], - "y": [3], - "type": "other" - }, - "Feeding Bench K": { - "x": [18], - "y": [3], - "type": "other" - }, - "Feeding Bench L": { - "x": [19], - "y": [3], - "type": "other" - }, "Exit": { "x": [11], "y": [14], @@ -526,66 +366,6 @@ "y": [3], "type": "interactable" }, - "Feeding Bench A": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [11], - "y": [3], - "type": "other" - }, - "Feeding Bench E": { - "x": [12], - "y": [3], - "type": "other" - }, - "Feeding Bench F": { - "x": [13], - "y": [3], - "type": "other" - }, - "Feeding Bench G": { - "x": [14], - "y": [3], - "type": "other" - }, - "Feeding Bench H": { - "x": [15], - "y": [3], - "type": "other" - }, - "Feeding Bench I": { - "x": [16], - "y": [3], - "type": "other" - }, - "Feeding Bench J": { - "x": [17], - "y": [3], - "type": "other" - }, - "Feeding Bench K": { - "x": [18], - "y": [3], - "type": "other" - }, - "Feeding Bench L": { - "x": [19], - "y": [3], - "type": "other" - }, "Exit": { "x": [11], "y": [14], @@ -906,26 +686,6 @@ "y": [3], "type": "interactable" }, - "Feeding Bench A": { - "x": [6], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [7], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [9], - "y": [3], - "type": "other" - }, "Exit": { "x": [2], "y": [9], @@ -943,46 +703,6 @@ "y": [3], "type": "machine" }, - "Feeding Bench A": { - "x": [6], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [7], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench E": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench F": { - "x": [11], - "y": [3], - "type": "other" - }, - "Feeding Bench G": { - "x": [12], - "y": [3], - "type": "other" - }, - "Feeding Bench H": { - "x": [13], - "y": [3], - "type": "other" - }, "Exit": { "x": [2], "y": [9], @@ -1000,46 +720,6 @@ "y": [3], "type": "machine" }, - "Feeding Bench A": { - "x": [6], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [7], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench E": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench F": { - "x": [11], - "y": [3], - "type": "other" - }, - "Feeding Bench G": { - "x": [12], - "y": [3], - "type": "other" - }, - "Feeding Bench H": { - "x": [13], - "y": [3], - "type": "other" - }, "Exit": { "x": [2], "y": [9], @@ -1057,66 +737,6 @@ "y": [3], "type": "machine" }, - "Feeding Bench A": { - "x": [6], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [7], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench E": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench F": { - "x": [11], - "y": [3], - "type": "other" - }, - "Feeding Bench G": { - "x": [12], - "y": [3], - "type": "other" - }, - "Feeding Bench H": { - "x": [13], - "y": [3], - "type": "other" - }, - "Feeding Bench I": { - "x": [14], - "y": [3], - "type": "other" - }, - "Feeding Bench J": { - "x": [15], - "y": [3], - "type": "other" - }, - "Feeding Bench K": { - "x": [16], - "y": [3], - "type": "other" - }, - "Feeding Bench L": { - "x": [17], - "y": [3], - "type": "other" - }, "Exit": { "x": [2], "y": [9], @@ -1134,66 +754,6 @@ "y": [3], "type": "machine" }, - "Feeding Bench A": { - "x": [6], - "y": [3], - "type": "other" - }, - "Feeding Bench B": { - "x": [7], - "y": [3], - "type": "other" - }, - "Feeding Bench C": { - "x": [8], - "y": [3], - "type": "other" - }, - "Feeding Bench D": { - "x": [9], - "y": [3], - "type": "other" - }, - "Feeding Bench E": { - "x": [10], - "y": [3], - "type": "other" - }, - "Feeding Bench F": { - "x": [11], - "y": [3], - "type": "other" - }, - "Feeding Bench G": { - "x": [12], - "y": [3], - "type": "other" - }, - "Feeding Bench H": { - "x": [13], - "y": [3], - "type": "other" - }, - "Feeding Bench I": { - "x": [14], - "y": [3], - "type": "other" - }, - "Feeding Bench J": { - "x": [15], - "y": [3], - "type": "other" - }, - "Feeding Bench K": { - "x": [16], - "y": [3], - "type": "other" - }, - "Feeding Bench L": { - "x": [17], - "y": [3], - "type": "other" - }, "Exit": { "x": [2], "y": [9], @@ -1801,7 +1361,7 @@ "y": [18, 19], "type": "decoration" }, - "Hoisin Sauce A": { + "Hoisin Sauce[A]": { "x": [4], "y": [10], "type": "decoration" @@ -1811,72 +1371,72 @@ "y": [11, 12], "type": "decoration" }, - "Honey Sauce A": { + "Honey Sauce[A]": { "x": [4], "y": [13], "type": "decoration" }, - "Yeast A": { + "Yeast[A]": { "x": [4], "y": [14], "type": "decoration" }, - "Sugar Cones A": { + "Sugar Cones[A]": { "x": [4], "y": [15], "type": "decoration" }, - "Sugar Stars A": { + "Sugar Stars[A]": { "x": [4], "y": [16], "type": "decoration" }, - "Gummies A": { + "Gummies[A]": { "x": [4], "y": [17], "type": "decoration" }, - "Fruit Snacks A": { + "Fruit Snacks[A]": { "x": [4], "y": [18], "type": "decoration" }, - "Marinated Mushrooms A": { + "Marinated Mushrooms[A]": { "x": [4], "y": [19], "type": "decoration" }, - "Low Fat Beans A": { + "Low Fat Beans[A]": { "x": [7], "y": [11, 12], "type": "decoration" }, - "White Fungus Soda A": { + "White Fungus Soda[A]": { "x": [7], "y": [13], "type": "decoration" }, - "Powdered Breakfast A": { + "Powdered Breakfast[A]": { "x": [7], "y": [14, 15], "type": "decoration" }, - "Powdered Wine A": { + "Powdered Wine[A]": { "x": [7], "y": [16], "type": "decoration" }, - "Canned Scrambled Eggs A": { + "Canned Scrambled Eggs[A]": { "x": [7], "y": [17], "type": "decoration" }, - "Canned Fish A": { + "Canned Fish[A]": { "x": [7], "y": [18], "type": "decoration" }, - "Canned Meals A": { + "Canned Meals[A]": { "x": [7], "y": [19, 20], "type": "decoration" @@ -2141,7 +1701,7 @@ "y": [19], "type": "decoration" }, - "Hoisin Sauce B": { + "Hoisin Sauce[B]": { "x": [20], "y": [10], "type": "decoration" @@ -2151,37 +1711,37 @@ "y": [11, 12], "type": "decoration" }, - "Honey Sauce B": { + "Honey Sauce[B]": { "x": [20], "y": [13], "type": "decoration" }, - "Yeast B": { + "Yeast[B]": { "x": [20], "y": [14], "type": "decoration" }, - "Sugar Cones B": { + "Sugar Cones[B]": { "x": [20], "y": [15], "type": "decoration" }, - "Sugar Stars B": { + "Sugar Stars[B]": { "x": [20], "y": [16], "type": "decoration" }, - "Gummies B": { + "Gummies[B]": { "x": [20], "y": [17], "type": "decoration" }, - "Fruit Snacks B": { + "Fruit Snacks[B]": { "x": [20], "y": [18], "type": "decoration" }, - "Marinated Mushrooms B": { + "Marinated Mushrooms[B]": { "x": [20], "y": [19], "type": "decoration" @@ -2266,37 +1826,37 @@ "y": [19], "type": "decoration" }, - "Low Fat Beans B": { + "Low Fat Beans[B]": { "x": [28], "y": [11, 12], "type": "decoration" }, - "White Fungus Soda B": { + "White Fungus Soda[B]": { "x": [28], "y": [13], "type": "decoration" }, - "Powdered Breakfast B": { + "Powdered Breakfast[B]": { "x": [28], "y": [14, 15], "type": "decoration" }, - "Powdered Wine B": { + "Powdered Wine[B]": { "x": [28], "y": [16], "type": "decoration" }, - "Canned Scrambled Eggs B": { + "Canned Scrambled Eggs[B]": { "x": [28], "y": [17], "type": "decoration" }, - "Canned Fish B": { + "Canned Fish[B]": { "x": [28], "y": [18], "type": "decoration" }, - "Canned Meals B": { + "Canned Meals[B]": { "x": [28], "y": [19], "type": "decoration"