diff --git a/stardew-access/Game/ReadTile.cs b/stardew-access/Game/ReadTile.cs index aea1f11..423a767 100644 --- a/stardew-access/Game/ReadTile.cs +++ b/stardew-access/Game/ReadTile.cs @@ -74,10 +74,7 @@ namespace stardew_access.Game { toSpeak = "Ladder"; } - else if (!Game1.currentLocation.isTilePassable(Game1.player.nextPosition(Game1.player.getDirection()), Game1.viewport)) - { - toSpeak = "Colliding"; - } else + else { try { @@ -247,6 +244,9 @@ namespace stardew_access.Game else if(stage >= 4) toReturn = $"{toReturn} tree"; + if (fruitTree.fruitsOnTree.Value > 0) + toReturn = $"Harvestable {toReturn}"; + return toReturn; } @@ -347,52 +347,6 @@ namespace stardew_access.Game return "Ice crystal"; case 75: return "Geode"; - case 76: - return "Frozen geode"; - case 77: - return "Magma geode"; - case 8: - case 66: - return "Amethyst node"; - case 14: - case 62: - return "Aquamarine node"; - case 843: - case 844: - return "Cinder shard node"; - case 2: - case 72: - return "Diamond node"; - case 12: - case 60: - return "Emerald node"; - case 44: - return "Gem node"; - case 6: - case 70: - return "Jade node"; - case 46: - return "Mystic stone"; - case 74: - return "Prismatic node"; - case 4: - case 64: - return "Ruby node"; - case 10: - case 68: - return "Topaz node"; - case 819: - return "Omni geode node"; - case 751: - case 849: - return "Copper node"; - case 764: - return "Gold node"; - case 765: - return "Iridium node"; - case 290: - case 850: - return "Iron node"; case 32: case 34: case 36: @@ -431,6 +385,59 @@ namespace stardew_access.Game return "Item box"; } + if (Game1.inMine || Game1.currentLocation is Mine) + { + switch (index) + { + case 76: + return "Frozen geode"; + case 77: + return "Magma geode"; + case 8: + case 66: + return "Amethyst node"; + case 14: + case 62: + return "Aquamarine node"; + case 843: + case 844: + return "Cinder shard node"; + case 2: + case 72: + return "Diamond node"; + case 12: + case 60: + return "Emerald node"; + case 44: + return "Gem node"; + case 6: + case 70: + return "Jade node"; + case 46: + return "Mystic stone"; + case 74: + return "Prismatic node"; + case 4: + case 64: + return "Ruby node"; + case 10: + case 68: + return "Topaz node"; + case 819: + return "Omni geode node"; + case 751: + case 849: + return "Copper node"; + case 764: + return "Gold node"; + case 765: + return "Iridium node"; + case 290: + case 850: + return "Iron node"; + } + } + return toReturn; } diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs index 0b196a9..951f984 100644 --- a/stardew-access/ModEntry.cs +++ b/stardew-access/ModEntry.cs @@ -172,11 +172,6 @@ namespace stardew_access original: AccessTools.Method(typeof(LanguageSelectionMenu), nameof(LanguageSelectionMenu.draw), new Type[] { typeof(SpriteBatch) }), postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.LanguageSelectionMenuPatch)) ); - - /*harmony.Patch( - original: AccessTools.Method(typeof(HUDMessage), nameof(HUDMessage.draw), new Type[] { typeof(SpriteBatch), typeof(int) }), - postfix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.HUDMessagePatch)) - );*/ #endregion #region Quest Patches @@ -214,6 +209,11 @@ namespace stardew_access ); #endregion + harmony.Patch( + original: AccessTools.Method(typeof(Game1), nameof(Game1.playSound)), + prefix: new HarmonyMethod(typeof(MenuPatches), nameof(MenuPatches.PlaySoundPatch)) + ); + #endregion #region Custom Commands @@ -388,7 +388,7 @@ namespace stardew_access MainClass.monitor.Log($"Unable to narrate hud messages:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); } - await Task.Delay(1000); + await Task.Delay(300); isNarratingHudMessage = false; } } diff --git a/stardew-access/Patches/MenuPatches.cs b/stardew-access/Patches/MenuPatches.cs index 2852fd3..a8e8494 100644 --- a/stardew-access/Patches/MenuPatches.cs +++ b/stardew-access/Patches/MenuPatches.cs @@ -1,6 +1,9 @@ -using StardewModdingAPI; +using Microsoft.Xna.Framework; +using stardew_access.Game; +using StardewModdingAPI; using StardewValley; using StardewValley.Menus; +using StardewValley.TerrainFeatures; namespace stardew_access.Patches { @@ -9,6 +12,51 @@ namespace stardew_access.Patches private static string currentLetterText = " "; private static string currentLevelUpTitle = " "; + internal static bool PlaySoundPatch(string cueName) + { + try + { + if (!Context.IsPlayerFree) + return true; + + if(!Game1.player.isMoving()) + return true; + + if(cueName == "grassyStep" || cueName == "sandyStep" || cueName == "snowyStep" || cueName == "stoneStep" || cueName == "thudStep" || cueName == "woodyStep") + { + if(!Game1.currentLocation.isTilePassable(Game1.player.nextPosition(Game1.player.getDirection()), Game1.viewport)) + { + return false; + } + + #region Check for objects + Vector2 gt = CurrentPlayer.getNextTile(); + + if (Game1.currentLocation.isObjectAtTile((int)gt.X, (int)gt.Y)) + { + if (!Game1.currentLocation.getObjectAtTile((int)gt.X, (int)gt.Y).isPassable()) + return false; + } + #endregion + + #region Check for terrain features + Dictionary> terrainFeature = Game1.currentLocation.terrainFeatures.FieldDict; + if (terrainFeature.ContainsKey(gt)) + { + if (!terrainFeature[gt].Get().isPassable()) + return false; + } + #endregion + } + } + catch (Exception e) + { + MainClass.monitor.Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + } + + return true; + } + internal static void LanguageSelectionMenuPatch(LanguageSelectionMenu __instance) { try