From 34cb47bdaa5d0e215873a03f5959f6ace0d3624a Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Sat, 22 Oct 2022 21:53:10 +0530 Subject: [PATCH 1/5] Issue#42 feeding benches in coops and barns are now dynamic --- stardew-access/Features/TileInfo.cs | 68 ++++ stardew-access/assets/static-tiles.json | 440 ------------------------ 2 files changed, 68 insertions(+), 440 deletions(-) diff --git a/stardew-access/Features/TileInfo.cs b/stardew-access/Features/TileInfo.cs index ebcdd04..1e15d45 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.Value.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.Value.ToLower().Equals("big coop") || Game1.currentLocation.name.Value.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.Value.ToLower().Equals("deluxe coop") || Game1.currentLocation.name.Value.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.Value.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.Value.ToLower().Equals("big barn") || Game1.currentLocation.name.Value.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.Value.ToLower().Equals("deluxe barn") || Game1.currentLocation.name.Value.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/assets/static-tiles.json b/stardew-access/assets/static-tiles.json index d33a93a..cbb3968 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], From a9160b4ff643a13f36fb86d3c31d38f6c2453274 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Sat, 22 Oct 2022 22:19:38 +0530 Subject: [PATCH 2/5] Issue#54 the names in static tiles now ignore anything between square brackets --- stardew-access/Features/StaticTiles.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/stardew-access/Features/StaticTiles.cs b/stardew-access/Features/StaticTiles.cs index 5befb38..c0bb806 100644 --- a/stardew-access/Features/StaticTiles.cs +++ b/stardew-access/Features/StaticTiles.cs @@ -45,7 +45,7 @@ namespace stardew_access.Features foreach (var location in data) { - if (!Game1.currentLocation.Name.ToLower().Equals(location.Key.ToLower())) + if (!Game1.currentLocation.name.Value.ToLower().Equals(location.Key.ToLower())) continue; if (location.Value != null) @@ -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())); + } } } From d131d26ac834d50b7cf9a38fc1d81c77497b6486 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Sat, 22 Oct 2022 22:23:14 +0530 Subject: [PATCH 3/5] Issue#54 updated names in static-tiles.json according to the issue --- stardew-access/assets/static-tiles.json | 60 ++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/stardew-access/assets/static-tiles.json b/stardew-access/assets/static-tiles.json index cbb3968..cbc2549 100644 --- a/stardew-access/assets/static-tiles.json +++ b/stardew-access/assets/static-tiles.json @@ -1361,7 +1361,7 @@ "y": [18, 19], "type": "decoration" }, - "Hoisin Sauce A": { + "Hoisin Sauce[A]": { "x": [4], "y": [10], "type": "decoration" @@ -1371,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" @@ -1701,7 +1701,7 @@ "y": [19], "type": "decoration" }, - "Hoisin Sauce B": { + "Hoisin Sauce[B]": { "x": [20], "y": [10], "type": "decoration" @@ -1711,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" @@ -1826,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" From 9d1c6f95dd3a44efaa8d34dca6228d55c8f9dd2d Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Sun, 23 Oct 2022 11:14:58 +0530 Subject: [PATCH 4/5] Issue#52 Patched speech bubbles --- stardew-access/Features/StaticTiles.cs | 2 +- stardew-access/Features/TileInfo.cs | 12 ++++++------ stardew-access/HarmonyPatches.cs | 5 +++++ stardew-access/Patches/DialoguePatches.cs | 16 +++++++++++++++- 4 files changed, 27 insertions(+), 8 deletions(-) diff --git a/stardew-access/Features/StaticTiles.cs b/stardew-access/Features/StaticTiles.cs index c0bb806..4ce596d 100644 --- a/stardew-access/Features/StaticTiles.cs +++ b/stardew-access/Features/StaticTiles.cs @@ -45,7 +45,7 @@ namespace stardew_access.Features 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; if (location.Value != null) diff --git a/stardew-access/Features/TileInfo.cs b/stardew-access/Features/TileInfo.cs index 1e15d45..5f20015 100644 --- a/stardew-access/Features/TileInfo.cs +++ b/stardew-access/Features/TileInfo.cs @@ -478,7 +478,7 @@ namespace stardew_access.Features 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) { @@ -489,7 +489,7 @@ namespace stardew_access.Features 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) { @@ -500,7 +500,7 @@ namespace stardew_access.Features 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) { @@ -511,7 +511,7 @@ namespace stardew_access.Features 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) { @@ -522,7 +522,7 @@ namespace stardew_access.Features 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) { @@ -533,7 +533,7 @@ namespace stardew_access.Features 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) { 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}"); + } + } } } From 950ab21d61ca1cc51edbcc8aef174ea6cabec036 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Khan Date: Sun, 23 Oct 2022 12:00:30 +0530 Subject: [PATCH 5/5] Issue#56 Other currency narration --- stardew-access/Patches/GameMenuPatches.cs | 34 ++++++++++++++++++----- 1 file changed, 27 insertions(+), 7 deletions(-) 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) {