From 2d3d79be0404bddb529f38b0291087c9adf2ae22 Mon Sep 17 00:00:00 2001 From: Mohammad Shoaib Date: Sat, 19 Mar 2022 12:54:53 +0530 Subject: [PATCH] Added alt + j keybind --- stardew-access/CustomCommands.cs | 108 +++++++++--------- stardew-access/CustomSoundEffects.cs | 2 +- stardew-access/Features/CurrentPlayer.cs | 14 ++- stardew-access/Features/Other.cs | 2 +- stardew-access/Features/Radar.cs | 8 +- stardew-access/Features/ReadTile.cs | 26 +++-- stardew-access/ModEntry.cs | 31 +++-- .../Patches/BuildingNAnimalMenuPatches.cs | 4 +- stardew-access/Patches/ChatManuPatches.cs | 2 +- stardew-access/Patches/DialoguePatches.cs | 6 +- stardew-access/Patches/GameMenuPatches.cs | 22 ++-- stardew-access/Patches/MenuPatches.cs | 20 ++-- stardew-access/Patches/QuestPatches.cs | 6 +- stardew-access/Patches/TitleMenuPatches.cs | 8 +- stardew-access/manifest.json | 2 +- 15 files changed, 148 insertions(+), 113 deletions(-) diff --git a/stardew-access/CustomCommands.cs b/stardew-access/CustomCommands.cs index d589ea2..db08520 100644 --- a/stardew-access/CustomCommands.cs +++ b/stardew-access/CustomCommands.cs @@ -17,28 +17,28 @@ namespace stardew_access { MainClass.readTile = !MainClass.readTile; - MainClass.GetMonitor().Log("Read Tile is " + (MainClass.readTile ? "on" : "off"), LogLevel.Info); + MainClass.DebugLog("Read Tile is " + (MainClass.readTile ? "on" : "off")); }); helper.ConsoleCommands.Add("snapmouse", "Toggle snap mouse feature.", (string commmand, string[] args) => { MainClass.snapMouse = !MainClass.snapMouse; - MainClass.GetMonitor().Log("Snap Mouse is " + (MainClass.snapMouse ? "on" : "off"), LogLevel.Info); + MainClass.DebugLog("Snap Mouse is " + (MainClass.snapMouse ? "on" : "off")); }); helper.ConsoleCommands.Add("flooring", "Toggle flooring in read tile.", (string commmand, string[] args) => { MainClass.readFlooring = !MainClass.readFlooring; - MainClass.GetMonitor().Log("Flooring is " + (MainClass.readFlooring ? "on" : "off"), LogLevel.Info); + MainClass.DebugLog("Flooring is " + (MainClass.readFlooring ? "on" : "off")); }); helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) => { MainClass.radar = !MainClass.radar; - MainClass.GetMonitor().Log("Radar " + (MainClass.radar ? "on" : "off"), LogLevel.Info); + MainClass.DebugLog("Radar " + (MainClass.radar ? "on" : "off")); }); #region Radar Feature @@ -46,21 +46,21 @@ namespace stardew_access { MainClass.radarDebug = !MainClass.radarDebug; - MainClass.GetMonitor().Log("Radar debugging " + (MainClass.radarDebug ? "on" : "off"), LogLevel.Info); + MainClass.DebugLog("Radar debugging " + (MainClass.radarDebug ? "on" : "off")); }); helper.ConsoleCommands.Add("rstereo", "Toggle stereo sound in radar feature.", (string commmand, string[] args) => { MainClass.radarStereoSound = !MainClass.radarStereoSound; - MainClass.GetMonitor().Log("Stereo sound is " + (MainClass.radarStereoSound ? "on" : "off"), LogLevel.Info); + MainClass.DebugLog("Stereo sound is " + (MainClass.radarStereoSound ? "on" : "off")); }); helper.ConsoleCommands.Add("rfocus", "Toggle focus mode in radar feature.", (string commmand, string[] args) => { bool focus = MainClass.RadarFeature.ToggleFocus(); - MainClass.GetMonitor().Log("Focus mode is " + (focus ? "on" : "off"), LogLevel.Info); + MainClass.DebugLog("Focus mode is " + (focus ? "on" : "off")); }); helper.ConsoleCommands.Add("rdelay", "Set the delay of radar feature in milliseconds.", (string commmand, string[] args) => @@ -79,19 +79,19 @@ namespace stardew_access { MainClass.RadarFeature.delay = delay; if (delay >= 1000) - MainClass.GetMonitor().Log($"Delay set to {MainClass.RadarFeature.delay} milliseconds.", LogLevel.Info); + MainClass.DebugLog($"Delay set to {MainClass.RadarFeature.delay} milliseconds."); else - MainClass.GetMonitor().Log($"Delay should be atleast 1 second or 1000 millisecond long.", LogLevel.Info); + MainClass.DebugLog($"Delay should be atleast 1 second or 1000 millisecond long."); } else { - MainClass.GetMonitor().Log("Invalid delay amount, it can only be in numeric form.", LogLevel.Info); + MainClass.DebugLog("Invalid delay amount, it can only be in numeric form."); } } else { - MainClass.GetMonitor().Log("Enter the delay amount (in milliseconds)!", LogLevel.Info); + MainClass.DebugLog("Enter the delay amount (in milliseconds)!"); } }); @@ -112,19 +112,19 @@ namespace stardew_access { MainClass.RadarFeature.range = range; if (range >= 2 && range <= 10) - MainClass.GetMonitor().Log($"Range set to {MainClass.RadarFeature.range}.", LogLevel.Info); + MainClass.DebugLog($"Range set to {MainClass.RadarFeature.range}."); else - MainClass.GetMonitor().Log($"Range should be atleast 2 and maximum 10.", LogLevel.Info); + MainClass.DebugLog($"Range should be atleast 2 and maximum 10."); } else { - MainClass.GetMonitor().Log("Invalid range amount, it can only be in numeric form.", LogLevel.Info); + MainClass.DebugLog("Invalid range amount, it can only be in numeric form."); } } else { - MainClass.GetMonitor().Log("Enter the range amount!", LogLevel.Info); + MainClass.DebugLog("Enter the range amount!"); } }); @@ -143,16 +143,16 @@ namespace stardew_access if (!MainClass.RadarFeature.exclusions.Contains(keyToAdd)) { MainClass.RadarFeature.exclusions.Add(keyToAdd); - MainClass.GetMonitor().Log($"Added {keyToAdd} key to exclusions list.", LogLevel.Info); + MainClass.DebugLog($"Added {keyToAdd} key to exclusions list."); } else { - MainClass.GetMonitor().Log($"{keyToAdd} key already present in the list.", LogLevel.Info); + MainClass.DebugLog($"{keyToAdd} key already present in the list."); } } else { - MainClass.GetMonitor().Log("Unable to add the key to exclusions list.", LogLevel.Info); + MainClass.DebugLog("Unable to add the key to exclusions list."); } }); @@ -168,16 +168,16 @@ namespace stardew_access if (MainClass.RadarFeature.exclusions.Contains(keyToAdd)) { MainClass.RadarFeature.exclusions.Remove(keyToAdd); - MainClass.GetMonitor().Log($"Removed {keyToAdd} key from exclusions list.", LogLevel.Info); + MainClass.DebugLog($"Removed {keyToAdd} key from exclusions list."); } else { - MainClass.GetMonitor().Log($"Cannot find {keyToAdd} key in exclusions list.", LogLevel.Info); + MainClass.DebugLog($"Cannot find {keyToAdd} key in exclusions list."); } } else { - MainClass.GetMonitor().Log("Unable to remove the key from exclusions list.", LogLevel.Info); + MainClass.DebugLog("Unable to remove the key from exclusions list."); } }); @@ -190,23 +190,23 @@ namespace stardew_access { toPrint = $"{toPrint}\t{i + 1}: {MainClass.RadarFeature.exclusions[i]}"; } - MainClass.GetMonitor().Log(toPrint, LogLevel.Info); + MainClass.DebugLog(toPrint); } else { - MainClass.GetMonitor().Log("No exclusions found.", LogLevel.Info); + MainClass.DebugLog("No exclusions found."); } }); helper.ConsoleCommands.Add("reclear", "Clear the focus exclusions in the radar featrure.", (string commmand, string[] args) => { MainClass.RadarFeature.exclusions.Clear(); - MainClass.GetMonitor().Log($"Cleared the focus list in the exclusions feature.", LogLevel.Info); + MainClass.DebugLog($"Cleared the focus list in the exclusions feature."); }); helper.ConsoleCommands.Add("recount", "Number of exclusions in the radar feature.", (string commmand, string[] args) => { - MainClass.GetMonitor().Log($"There are {MainClass.RadarFeature.exclusions.Count} exclusiond in the radar feature.", LogLevel.Info); + MainClass.DebugLog($"There are {MainClass.RadarFeature.exclusions.Count} exclusiond in the radar feature."); }); #endregion @@ -223,16 +223,16 @@ namespace stardew_access if (!MainClass.RadarFeature.focus.Contains(keyToAdd)) { MainClass.RadarFeature.focus.Add(keyToAdd); - MainClass.GetMonitor().Log($"Added {keyToAdd} key to focus list.", LogLevel.Info); + MainClass.DebugLog($"Added {keyToAdd} key to focus list."); } else { - MainClass.GetMonitor().Log($"{keyToAdd} key already present in the list.", LogLevel.Info); + MainClass.DebugLog($"{keyToAdd} key already present in the list."); } } else { - MainClass.GetMonitor().Log("Unable to add the key to focus list.", LogLevel.Info); + MainClass.DebugLog("Unable to add the key to focus list."); } }); @@ -248,16 +248,16 @@ namespace stardew_access if (MainClass.RadarFeature.focus.Contains(keyToAdd)) { MainClass.RadarFeature.focus.Remove(keyToAdd); - MainClass.GetMonitor().Log($"Removed {keyToAdd} key from focus list.", LogLevel.Info); + MainClass.DebugLog($"Removed {keyToAdd} key from focus list."); } else { - MainClass.GetMonitor().Log($"Cannot find {keyToAdd} key in focus list.", LogLevel.Info); + MainClass.DebugLog($"Cannot find {keyToAdd} key in focus list."); } } else { - MainClass.GetMonitor().Log("Unable to remove the key from focus list.", LogLevel.Info); + MainClass.DebugLog("Unable to remove the key from focus list."); } }); @@ -270,23 +270,23 @@ namespace stardew_access { toPrint = $"{toPrint}\t{i + 1}): {MainClass.RadarFeature.focus[i]}"; } - MainClass.GetMonitor().Log(toPrint, LogLevel.Info); + MainClass.DebugLog(toPrint); } else { - MainClass.GetMonitor().Log("No objects found in the focus list.", LogLevel.Info); + MainClass.DebugLog("No objects found in the focus list."); } }); helper.ConsoleCommands.Add("rfclear", "Clear the focus list in the radar featrure.", (string commmand, string[] args) => { MainClass.RadarFeature.focus.Clear(); - MainClass.GetMonitor().Log($"Cleared the focus list in the radar feature.", LogLevel.Info); + MainClass.DebugLog($"Cleared the focus list in the radar feature."); }); helper.ConsoleCommands.Add("rfcount", "Number of list in the radar feature.", (string commmand, string[] args) => { - MainClass.GetMonitor().Log($"There are {MainClass.RadarFeature.focus.Count} objects in the focus list in the radar feature.", LogLevel.Info); + MainClass.DebugLog($"There are {MainClass.RadarFeature.focus.Count} objects in the focus list in the radar feature."); }); #endregion @@ -297,14 +297,14 @@ namespace stardew_access { if (Game1.currentLocation is not Farm) { - MainClass.GetMonitor().Log("Can only use this command in the farm", LogLevel.Info); + MainClass.DebugLog("Can only use this command in the farm"); return; } string? indexInString = args.ElementAtOrDefault(0); if (indexInString == null) { - MainClass.GetMonitor().Log("Enter the index too!", LogLevel.Info); + MainClass.DebugLog("Enter the index too!"); return; } @@ -313,12 +313,12 @@ namespace stardew_access if (!isParsable || !(index >= 0 && index <= 9)) { - MainClass.GetMonitor().Log("Index can only be a number and from 0 to 9 only", LogLevel.Info); + MainClass.DebugLog("Index can only be a number and from 0 to 9 only"); return; } BuildingNAnimalMenuPatches.marked[index] = new Vector2((int)Game1.player.getTileX(), (int)Game1.player.getTileY()); - MainClass.GetMonitor().Log($"Location {(int)Game1.player.getTileX()}x {(int)Game1.player.getTileY()}y added at {index} index.", LogLevel.Info); + MainClass.DebugLog($"Location {(int)Game1.player.getTileX()}x {(int)Game1.player.getTileY()}y added at {index} index."); }); helper.ConsoleCommands.Add("marklist", "List all marked positions.", (string commmand, string[] args) => @@ -333,16 +333,16 @@ namespace stardew_access } if (toPrint == "") - MainClass.GetMonitor().Log("No positions marked!", LogLevel.Info); + MainClass.DebugLog("No positions marked!"); else - MainClass.GetMonitor().Log($"Marked positions:{toPrint}\nOpen command menu and use pageup and pagedown to check the list", LogLevel.Info); + MainClass.DebugLog($"Marked positions:{toPrint}\nOpen command menu and use pageup and pagedown to check the list"); }); helper.ConsoleCommands.Add("buildlist", "List all buildings for selection for upgrading/demolishing/painting", (string commmand, string[] args) => { if ((Game1.activeClickableMenu is not CarpenterMenu && Game1.activeClickableMenu is not PurchaseAnimalsMenu) || !BuildingNAnimalMenuPatches.isOnFarm) { - MainClass.GetMonitor().Log($"Cannot list buildings.", LogLevel.Info); + MainClass.DebugLog($"Cannot list buildings."); return; } @@ -363,11 +363,11 @@ namespace stardew_access if (toPrint == "") { - MainClass.GetMonitor().Log("No appropriate buildings to list", LogLevel.Info); + MainClass.DebugLog("No appropriate buildings to list"); } else { - MainClass.GetMonitor().Log($"Available buildings:{toPrint}\nOpen command menu and use pageup and pagedown to check the list", LogLevel.Info); + MainClass.DebugLog($"Available buildings:{toPrint}\nOpen command menu and use pageup and pagedown to check the list"); } }); @@ -375,14 +375,14 @@ namespace stardew_access { if ((Game1.activeClickableMenu is not CarpenterMenu && Game1.activeClickableMenu is not PurchaseAnimalsMenu) || !BuildingNAnimalMenuPatches.isOnFarm) { - MainClass.GetMonitor().Log($"Cannot select building.", LogLevel.Info); + MainClass.DebugLog($"Cannot select building."); return; } string? indexInString = args.ElementAtOrDefault(0); if (indexInString == null) { - MainClass.GetMonitor().Log("Enter the index of the building too! Use buildlist", LogLevel.Info); + MainClass.DebugLog("Enter the index of the building too! Use buildlist"); return; } @@ -391,7 +391,7 @@ namespace stardew_access if (!isParsable) { - MainClass.GetMonitor().Log("Index can only be a number.", LogLevel.Info); + MainClass.DebugLog("Index can only be a number."); return; } @@ -405,13 +405,13 @@ namespace stardew_access { if (BuildingNAnimalMenuPatches.availableBuildings[index] == null) { - MainClass.GetMonitor().Log($"No building found with index {index}. Use buildlist.", LogLevel.Info); + MainClass.DebugLog($"No building found with index {index}. Use buildlist."); return; } if (positionIndexInString == null) { - MainClass.GetMonitor().Log("Enter the index of marked place too! Use marklist.", LogLevel.Info); + MainClass.DebugLog("Enter the index of marked place too! Use marklist."); return; } @@ -419,7 +419,7 @@ namespace stardew_access if (!isParsable) { - MainClass.GetMonitor().Log("Index can only be a number.", LogLevel.Info); + MainClass.DebugLog("Index can only be a number."); return; } } @@ -428,7 +428,7 @@ namespace stardew_access { if (BuildingNAnimalMenuPatches.marked[index] == Vector2.Zero) { - MainClass.GetMonitor().Log($"No marked position found at {index} index.", LogLevel.Info); + MainClass.DebugLog($"No marked position found at {index} index."); return; } } @@ -436,7 +436,7 @@ namespace stardew_access { if (BuildingNAnimalMenuPatches.availableBuildings[index] == null) { - MainClass.GetMonitor().Log($"No building found with index {index}. Use buildlist.", LogLevel.Info); + MainClass.DebugLog($"No building found with index {index}. Use buildlist."); return; } } @@ -455,7 +455,7 @@ namespace stardew_access if (response != null) { - MainClass.GetMonitor().Log(response, LogLevel.Info); + MainClass.DebugLog(response); } }); #endregion @@ -464,7 +464,7 @@ namespace stardew_access { MainClass.GetScreenReader().InitializeScreenReader(); - MainClass.GetMonitor().Log("Screen Reader refreshed!", LogLevel.Info); + MainClass.DebugLog("Screen Reader refreshed!"); }); } } diff --git a/stardew-access/CustomSoundEffects.cs b/stardew-access/CustomSoundEffects.cs index 8ad60e9..de23067 100644 --- a/stardew-access/CustomSoundEffects.cs +++ b/stardew-access/CustomSoundEffects.cs @@ -71,7 +71,7 @@ namespace stardew_access } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to initialize custom sounds:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to initialize custom sounds:\n{e.Message}\n{e.StackTrace}"); } } } diff --git a/stardew-access/Features/CurrentPlayer.cs b/stardew-access/Features/CurrentPlayer.cs index 1bc15cd..7ea330e 100644 --- a/stardew-access/Features/CurrentPlayer.cs +++ b/stardew-access/Features/CurrentPlayer.cs @@ -31,13 +31,20 @@ namespace stardew_access.Features return staminaPercentage; } + public static Vector2 getPosition() + { + if (Game1.player == null) + return Vector2.Zero; + + return Game1.player.getTileLocation(); + } + public static int getPositionX() { if (Game1.player == null) return 0; - int x = (int)Game1.player.getTileLocation().X; - return x; + return (int)getPosition().X; } public static int getPositionY() @@ -45,8 +52,7 @@ namespace stardew_access.Features if (Game1.player == null) return 0; - int y = (int)Game1.player.getTileLocation().Y; - return y; + return (int)getPosition().Y; } public static string getTimeOfDay() diff --git a/stardew-access/Features/Other.cs b/stardew-access/Features/Other.cs index a9d078e..a518787 100644 --- a/stardew-access/Features/Other.cs +++ b/stardew-access/Features/Other.cs @@ -96,7 +96,7 @@ namespace stardew_access.Features } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate hud messages:\n{e.Message}\n{e.StackTrace}", StardewModdingAPI.LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate hud messages:\n{e.Message}\n{e.StackTrace}"); } await Task.Delay(300); diff --git a/stardew-access/Features/Radar.cs b/stardew-access/Features/Radar.cs index ba9ebde..4fcba88 100644 --- a/stardew-access/Features/Radar.cs +++ b/stardew-access/Features/Radar.cs @@ -99,7 +99,7 @@ namespace stardew_access.Features public async void Run() { if (MainClass.radarDebug) - MainClass.GetMonitor().Log($"\n\nRead Tile started", StardewModdingAPI.LogLevel.Debug); + MainClass.DebugLog($"\n\nRead Tile started"); isRunning = true; Vector2 currPosition = Game1.player.getTileLocation(); @@ -111,7 +111,7 @@ namespace stardew_access.Features SearchNearbyTiles(currPosition, range); if (MainClass.radarDebug) - MainClass.GetMonitor().Log($"\nRead Tile stopped\n\n", StardewModdingAPI.LogLevel.Debug); + MainClass.DebugLog($"\nRead Tile stopped\n\n"); await Task.Delay(delay); isRunning = false; @@ -244,7 +244,7 @@ namespace stardew_access.Features } catch (Exception e) { - MainClass.GetMonitor().Log($"{e.Message}\n{e.StackTrace}\n{e.Source}", StardewModdingAPI.LogLevel.Error); + MainClass.ErrorLog($"{e.Message}\n{e.StackTrace}\n{e.Source}"); } } @@ -296,7 +296,7 @@ namespace stardew_access.Features #endregion if (MainClass.radarDebug) - MainClass.GetMonitor().Log($"{radarFocus}\tObject:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}", StardewModdingAPI.LogLevel.Debug); + MainClass.ErrorLog($"{radarFocus}\tObject:{searchQuery.ToLower().Trim()}\tPosition: X={position.X} Y={position.Y}"); int px = (int)Game1.player.getTileX(); // Player's X postion int py = (int)Game1.player.getTileY(); // Player's Y postion diff --git a/stardew-access/Features/ReadTile.cs b/stardew-access/Features/ReadTile.cs index cf77810..85b4498 100644 --- a/stardew-access/Features/ReadTile.cs +++ b/stardew-access/Features/ReadTile.cs @@ -22,17 +22,28 @@ namespace stardew_access.Features isReadingTile = false; } - public static async void run(bool manuallyTriggered = false) + public static async void run(bool manuallyTriggered = false, bool playersPosition = false) { isReadingTile = true; try { - #region Get Next Grab Tile - Vector2 tile = CurrentPlayer.getNextTile(); - int x = (int)tile.X; - int y = (int)tile.Y; + Vector2 tile; + int x, y; + #region Get Tile + if (!playersPosition) + { + // Grab tile + tile = CurrentPlayer.getNextTile(); + } + else + { + // Player's standing tile + tile = CurrentPlayer.getPosition(); + } #endregion + x = (int)tile.X; + y = (int)tile.Y; if (Context.IsPlayerFree) { @@ -62,13 +73,14 @@ namespace stardew_access.Features } #endregion - prevTile = tile; + if (!manuallyTriggered) + prevTile = tile; } } catch (Exception e) { - MainClass.GetMonitor().Log($"Error in Read Tile:\n{e.Message}\n{e.StackTrace}", LogLevel.Debug); + MainClass.ErrorLog($"Error in Read Tile:\n{e.Message}\n{e.StackTrace}"); } await Task.Delay(100); diff --git a/stardew-access/ModEntry.cs b/stardew-access/ModEntry.cs index dde56a1..407b417 100644 --- a/stardew-access/ModEntry.cs +++ b/stardew-access/ModEntry.cs @@ -41,11 +41,6 @@ namespace stardew_access screenReader = value; } - public static IMonitor GetMonitor() - { - return monitor; - } - public static void SetMonitor(IMonitor value) { monitor = value; @@ -140,6 +135,8 @@ namespace stardew_access if (e == null) return; + bool isLeftAltPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt); + if (Game1.activeClickableMenu != null) { bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift); @@ -198,10 +195,20 @@ namespace stardew_access MainClass.GetScreenReader().Say(toSpeak, true); } - // Manual read tile - if (Equals(e.Button, SButton.J)) + // Manual read tile at looking tile + if (Equals(e.Button, SButton.J) && !isLeftAltPressed) { + readTile = false; ReadTile.run(manuallyTriggered: true); + Task.Delay(1000).ContinueWith(t => { readTile = true; }); + } + + // Manual read tile at player's position + if (Equals(e.Button, SButton.J) && isLeftAltPressed) + { + readTile = false; + ReadTile.run(manuallyTriggered: true, playersPosition: true); + Task.Delay(1000).ContinueWith(t => { readTile = true; }); } /*if (Equals(e.Button, SButton.B)) @@ -210,5 +217,15 @@ namespace stardew_access monitor.Log($"{Game1.player.controller.pathToEndPoint==null}", LogLevel.Debug); // true if path not found }*/ } + + public static void ErrorLog(string message) + { + monitor.Log(message, LogLevel.Error); + } + + public static void DebugLog(string message) + { + monitor.Log(message, LogLevel.Debug); + } } } \ No newline at end of file diff --git a/stardew-access/Patches/BuildingNAnimalMenuPatches.cs b/stardew-access/Patches/BuildingNAnimalMenuPatches.cs index 7d346a4..6aaef02 100644 --- a/stardew-access/Patches/BuildingNAnimalMenuPatches.cs +++ b/stardew-access/Patches/BuildingNAnimalMenuPatches.cs @@ -98,7 +98,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -269,7 +269,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } diff --git a/stardew-access/Patches/ChatManuPatches.cs b/stardew-access/Patches/ChatManuPatches.cs index 66b7b0a..e30427e 100644 --- a/stardew-access/Patches/ChatManuPatches.cs +++ b/stardew-access/Patches/ChatManuPatches.cs @@ -48,7 +48,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } diff --git a/stardew-access/Patches/DialoguePatches.cs b/stardew-access/Patches/DialoguePatches.cs index 669171c..8eaf766 100644 --- a/stardew-access/Patches/DialoguePatches.cs +++ b/stardew-access/Patches/DialoguePatches.cs @@ -105,7 +105,7 @@ namespace stardew_access.Patches else toSpeak = response; - MainClass.GetMonitor().Log(toSpeak, LogLevel.Debug); + MainClass.ErrorLog(toSpeak); MainClass.GetScreenReader().Say(toSpeak, true); } } @@ -130,7 +130,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate dialog:\n{e.StackTrace}\n{e.Message}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate dialog:\n{e.StackTrace}\n{e.Message}"); } } @@ -315,7 +315,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate dialog:\n{e.StackTrace}\n{e.Message}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate dialog:\n{e.StackTrace}\n{e.Message}"); } } } diff --git a/stardew-access/Patches/GameMenuPatches.cs b/stardew-access/Patches/GameMenuPatches.cs index 08ca10a..f815451 100644 --- a/stardew-access/Patches/GameMenuPatches.cs +++ b/stardew-access/Patches/GameMenuPatches.cs @@ -129,7 +129,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -289,7 +289,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } await Task.Delay(200); @@ -440,7 +440,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -548,7 +548,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -578,7 +578,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -662,7 +662,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -853,7 +853,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -1099,7 +1099,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -1317,7 +1317,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -1370,7 +1370,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -1405,7 +1405,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } diff --git a/stardew-access/Patches/MenuPatches.cs b/stardew-access/Patches/MenuPatches.cs index 0a009d8..94ad707 100644 --- a/stardew-access/Patches/MenuPatches.cs +++ b/stardew-access/Patches/MenuPatches.cs @@ -38,7 +38,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } return true; @@ -73,7 +73,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -93,7 +93,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -109,7 +109,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -131,7 +131,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -232,7 +232,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -270,7 +270,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -331,7 +331,7 @@ namespace stardew_access.Patches catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -373,7 +373,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -424,7 +424,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } diff --git a/stardew-access/Patches/QuestPatches.cs b/stardew-access/Patches/QuestPatches.cs index 9d958fc..3acb6a4 100644 --- a/stardew-access/Patches/QuestPatches.cs +++ b/stardew-access/Patches/QuestPatches.cs @@ -39,7 +39,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -142,7 +142,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } #endregion @@ -238,7 +238,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } #endregion diff --git a/stardew-access/Patches/TitleMenuPatches.cs b/stardew-access/Patches/TitleMenuPatches.cs index f9d5b4a..4d46d16 100644 --- a/stardew-access/Patches/TitleMenuPatches.cs +++ b/stardew-access/Patches/TitleMenuPatches.cs @@ -49,7 +49,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -103,7 +103,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -157,7 +157,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } @@ -179,7 +179,7 @@ namespace stardew_access.Patches } catch (Exception e) { - MainClass.GetMonitor().Log($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}", LogLevel.Error); + MainClass.ErrorLog($"Unable to narrate Text:\n{e.Message}\n{e.StackTrace}"); } } diff --git a/stardew-access/manifest.json b/stardew-access/manifest.json index 95dc2b5..4196f38 100644 --- a/stardew-access/manifest.json +++ b/stardew-access/manifest.json @@ -1,7 +1,7 @@ { "Name": "Stardew Access", "Author": "Mohammad Shoaib", - "Version": "1.1.0", + "Version": "1.1.1", "Description": "An accessibility mod with screen reader support!", "UniqueID": "shoaib.stardewaccess", "EntryDll": "stardew-access.dll",