Merge branch 'master' into bugs

master
Mohammad Shoaib Khan 2022-10-23 12:03:40 +05:30
commit 1cf4637687
6 changed files with 160 additions and 479 deletions

View File

@ -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()));
}
}
}

View File

@ -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;

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>) }),
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

View File

@ -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}");
}
}
}
}

View File

@ -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)
{

View File

@ -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"