diff --git a/stardew-access/CustomCommands.cs b/stardew-access/CustomCommands.cs index 80411c7..026a193 100644 --- a/stardew-access/CustomCommands.cs +++ b/stardew-access/CustomCommands.cs @@ -39,6 +39,7 @@ namespace stardew_access MainClass.DebugLog("Flooring is " + (MainClass.Config.ReadFlooring ? "on" : "off")); }); + #region Radar Feature helper.ConsoleCommands.Add("radar", "Toggle radar feature.", (string commmand, string[] args) => { MainClass.Config.Radar = !MainClass.Config.Radar; @@ -47,7 +48,6 @@ namespace stardew_access MainClass.DebugLog("Radar " + (MainClass.Config.Radar ? "on" : "off")); }); - #region Radar Feature helper.ConsoleCommands.Add("rdebug", "Toggle debugging in radar feature.", (string commmand, string[] args) => { MainClass.radarDebug = !MainClass.radarDebug; diff --git a/stardew-access/Features/ReadTile.cs b/stardew-access/Features/ReadTile.cs index 79fa5ad..7cdb846 100644 --- a/stardew-access/Features/ReadTile.cs +++ b/stardew-access/Features/ReadTile.cs @@ -4,6 +4,9 @@ using StardewValley; namespace stardew_access.Features { + /// + /// Reads the name and information about a tile. + /// public class ReadTile { private bool isBusy; // To pause execution of run method between fixed intervals diff --git a/stardew-access/Features/TileViewer.cs b/stardew-access/Features/TileViewer.cs index ad2d62b..030610e 100644 --- a/stardew-access/Features/TileViewer.cs +++ b/stardew-access/Features/TileViewer.cs @@ -1,10 +1,7 @@ -using System; -using System.Collections.Generic; -using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework; using xTile; using StardewValley; using StardewValley.Menus; -using stardew_access.Features; namespace stardew_access.Features { diff --git a/stardew-access/Features/Warnings.cs b/stardew-access/Features/Warnings.cs index dd683d6..328f78d 100644 --- a/stardew-access/Features/Warnings.cs +++ b/stardew-access/Features/Warnings.cs @@ -1,7 +1,11 @@ namespace stardew_access.Features { + /// + /// Warns the player when their health or stamina/energy is low. Also warns when its past midnight. + /// public class Warnings { + // Store the previously checked value private int prevStamina; private int prevHealth; private int prevHour; @@ -20,6 +24,9 @@ namespace stardew_access.Features this.checkForTimeOfDay(); } + /// + /// Warns when its past 12:00 am and 1:00 am + /// private void checkForTimeOfDay() { if (MainClass.ModHelper == null) @@ -38,6 +45,9 @@ namespace stardew_access.Features prevHour = hours; } + /// + /// Warns when stamina reaches below 50, 25 and 10. + /// public void checkForStamina() { if (MainClass.ModHelper == null) @@ -56,6 +66,9 @@ namespace stardew_access.Features prevStamina = stamina; } + /// + /// Warns when health reaches below 50, 25 and 10. + /// public void checkForHealth() { if (MainClass.ModHelper == null) diff --git a/stardew-access/ModConfig.cs b/stardew-access/ModConfig.cs index aac7609..d323e27 100644 --- a/stardew-access/ModConfig.cs +++ b/stardew-access/ModConfig.cs @@ -7,37 +7,37 @@ namespace stardew_access // https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Input#SButton button key codes #region Simulate mouse clicks - public KeybindList LeftClickMainKey { get; set; } = KeybindList.Parse("LeftControl + Enter"); - public KeybindList RightClickMainKey { get; set; } = KeybindList.Parse("LeftShift + Enter"); - public KeybindList LeftClickAlternateKey { get; set; } = KeybindList.Parse("OemOpenBrackets"); - public KeybindList RightClickAlternateKey { get; set; } = KeybindList.Parse("OemCloseBrackets"); + public KeybindList LeftClickMainKey { get; set; } = KeybindList.Parse("LeftControl + Enter"); // Primary key to simulate mouse left click + public KeybindList RightClickMainKey { get; set; } = KeybindList.Parse("LeftShift + Enter"); // Primary key to simulate mouse right click + public KeybindList LeftClickAlternateKey { get; set; } = KeybindList.Parse("OemOpenBrackets"); // Secondary key to simulate mouse left click + public KeybindList RightClickAlternateKey { get; set; } = KeybindList.Parse("OemCloseBrackets"); // Secondary key to simulate mouse right click #endregion #region Chat menu - public KeybindList ChatMenuNextKey { get; set; } = KeybindList.Parse("PageUp"); - public KeybindList ChatMenuPreviousKey { get; set; } = KeybindList.Parse("PageDown"); + public KeybindList ChatMenuNextKey { get; set; } = KeybindList.Parse("PageUp"); // Read previous chat message + public KeybindList ChatMenuPreviousKey { get; set; } = KeybindList.Parse("PageDown"); // Read next chat message #endregion #region Read tile - public Boolean ReadTile { get; set; } = true; - public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J"); - public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J"); - public Boolean ReadFlooring { get; set; } = false; + public Boolean ReadTile { get; set; } = true; // Toggle this feature. + public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J"); // Manually trigger read tile for the tile player is *looking at*. + public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J"); // Manually trigger read tile for the tile player is *standing on*. + public Boolean ReadFlooring { get; set; } = false; // Toggle reading floorings. #endregion #region Tile viewer - public KeybindList TileCursorUpKey { get; set; } = KeybindList.Parse("Up"); - public KeybindList TileCursorRightKey { get; set; } = KeybindList.Parse("Right"); - public KeybindList TileCursorDownKey { get; set; } = KeybindList.Parse("Down"); - public KeybindList TileCursorLeftKey { get; set; } = KeybindList.Parse("Left"); - public KeybindList TileCursorPreciseUpKey { get; set; } = KeybindList.Parse("LeftShift + Up"); - public KeybindList TileCursorPreciseRightKey { get; set; } = KeybindList.Parse("LeftShift + Right"); - public KeybindList TileCursorPreciseDownKey { get; set; } = KeybindList.Parse("LeftShift + Down"); - public KeybindList TileCursorPreciseLeftKey { get; set; } = KeybindList.Parse("LeftShift + Left"); - public KeybindList ToggleRelativeCursorLockKey { get; set; } = KeybindList.Parse("L"); - public KeybindList AutoWalkToTileKey { get; set; } = KeybindList.Parse("LeftControl + Enter"); - public bool LimitTileCursorToScreen { get; set; } = false; - public int TileCursorPreciseMovementDistance { get; set; } = 8; + public KeybindList TileCursorUpKey { get; set; } = KeybindList.Parse("Up"); // Move the cursor one tile up + public KeybindList TileCursorRightKey { get; set; } = KeybindList.Parse("Right"); // Move the cursor one tile right + public KeybindList TileCursorDownKey { get; set; } = KeybindList.Parse("Down"); // Move the cursor one tile down + public KeybindList TileCursorLeftKey { get; set; } = KeybindList.Parse("Left"); // Move the cursor one tile left + public KeybindList TileCursorPreciseUpKey { get; set; } = KeybindList.Parse("LeftShift + Up"); // Move the cursor up by precision i.e. pixel by pixel + public KeybindList TileCursorPreciseRightKey { get; set; } = KeybindList.Parse("LeftShift + Right"); // Move the cursor right by precision i.e. pixel by pixel + public KeybindList TileCursorPreciseDownKey { get; set; } = KeybindList.Parse("LeftShift + Down"); // Move the cursor down by precision i.e. pixel by pixel + public KeybindList TileCursorPreciseLeftKey { get; set; } = KeybindList.Parse("LeftShift + Left"); // Move the cursor left by precision i.e. pixel by pixel + public KeybindList ToggleRelativeCursorLockKey { get; set; } = KeybindList.Parse("L"); // Toggles realative cursor lock i.e. if enabled, the cursor will reset when player moves. + public KeybindList AutoWalkToTileKey { get; set; } = KeybindList.Parse("LeftControl + Enter"); // Auto walk to the tile + public bool LimitTileCursorToScreen { get; set; } = false; // #TODO add command for this // Toggle whether to prevent cursor from going out of screen. + public int TileCursorPreciseMovementDistance { get; set; } = 8; // Specifies the number of pixels the cursor should move when using precision movement i.e. with *left shift*. #endregion #region Radar @@ -68,13 +68,14 @@ namespace stardew_access #endregion #region Others - public KeybindList HealthNStaminaKey { get; set; } = KeybindList.Parse("H"); - public KeybindList PositionKey { get; set; } = KeybindList.Parse("K"); - public KeybindList LocationKey { get; set; } = KeybindList.Parse("LeftAlt + K"); - public KeybindList MoneyKey { get; set; } = KeybindList.Parse("R"); - public KeybindList TimeNSeasonKey { get; set; } = KeybindList.Parse("Q"); + public KeybindList HealthNStaminaKey { get; set; } = KeybindList.Parse("H"); // Narrate health and stamina. + public KeybindList PositionKey { get; set; } = KeybindList.Parse("K"); // Narrate player position. + public KeybindList LocationKey { get; set; } = KeybindList.Parse("LeftAlt + K"); // Narrate current location name. + public KeybindList MoneyKey { get; set; } = KeybindList.Parse("R"); // Narrate the money the player has currently. + public KeybindList TimeNSeasonKey { get; set; } = KeybindList.Parse("Q"); // Narrate the time of day, day and date and season public Boolean VerboseCoordinates { get; set; } = true; - public Boolean SnapMouse { get; set; } = true; + public Boolean SnapMouse { get; set; } = true; // Toggles the snap mouse feature + // TODO add command to toggle warning feature #endregion // TODO Add the exclusion and focus list too diff --git a/stardew-access/Patches/BuildingNAnimalMenuPatches.cs b/stardew-access/Patches/BuildingNAnimalMenuPatches.cs index 63e51da..2b6d929 100644 --- a/stardew-access/Patches/BuildingNAnimalMenuPatches.cs +++ b/stardew-access/Patches/BuildingNAnimalMenuPatches.cs @@ -28,8 +28,8 @@ namespace stardew_access.Patches try { int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position - bool isCPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); // For narrating animal details - bool isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box + bool isPrimaryInfoKeyPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); // For narrating animal details + bool isEnterPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter); // For escaping/unselecting from the animal name text box string toSpeak = " ", details = " "; isOnFarm = ___movingAnimal; @@ -40,14 +40,14 @@ namespace stardew_access.Patches { toSpeak = ___textBox.Text; - if (isEscPressed) + if (isEnterPressed) { ___textBox.Selected = false; } } else { - if (isCPressed & !isNarratingAnimalInfo) + if (isPrimaryInfoKeyPressed & !isNarratingAnimalInfo) { string name = ___animal.displayName; string type = ___animal.displayType; @@ -205,7 +205,7 @@ namespace stardew_access.Patches return; int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position - bool isCPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); + bool isPrimaryInfoKeyPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); string ingredients = ""; string name = currentBluprint.displayName; string upgradeName = currentBluprint.nameOfBuildingToUpgrade; @@ -242,7 +242,7 @@ namespace stardew_access.Patches blueprintInfo = $"{name}, Price: {price}, Ingredients: {ingredients}, Dimensions: {width} width and {height} height, Description: {description}"; - if (isCPressed && !isSayingBlueprintInfo) + if (isPrimaryInfoKeyPressed && !isSayingBlueprintInfo) { SayBlueprintInfo(blueprintInfo); } diff --git a/stardew-access/Patches/DonationMenuPatches.cs b/stardew-access/Patches/DonationMenuPatches.cs index 8f4747b..159bc25 100644 --- a/stardew-access/Patches/DonationMenuPatches.cs +++ b/stardew-access/Patches/DonationMenuPatches.cs @@ -82,9 +82,9 @@ namespace stardew_access.Patches int i = narrateHoveredItemInInventory(__instance.inventory, __instance.inventory.inventory, __instance.inventory.actualInventory, x, y); if (i != -9999) { - bool isCPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); // For donating hovered item + bool isPrimaryInfoKeyPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); // For donating hovered item - if (isCPressed && __instance.inventory.actualInventory[i] != null) + if (isPrimaryInfoKeyPressed && __instance.inventory.actualInventory[i] != null) { foreach (var tile in donationTiles) { diff --git a/stardew-access/Patches/MenuPatches.cs b/stardew-access/Patches/MenuPatches.cs index 62a78ab..5bd970b 100644 --- a/stardew-access/Patches/MenuPatches.cs +++ b/stardew-access/Patches/MenuPatches.cs @@ -169,7 +169,7 @@ namespace stardew_access.Patches try { int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position - bool isCPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); + bool isPrimaryInfoKeyPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); string toSpeak = " ", extra = ""; if (___confirmingEmpty) @@ -181,7 +181,7 @@ namespace stardew_access.Patches } else { - if (isCPressed && !isNarratingPondInfo) + if (isPrimaryInfoKeyPressed && !isNarratingPondInfo) { string pond_name_text = Game1.content.LoadString("Strings\\UI:PondQuery_Name", ____fishItem.DisplayName); string population_text = Game1.content.LoadString("Strings\\UI:PondQuery_Population", string.Concat(____pond.FishCount), ____pond.maxOccupants.Value); @@ -458,7 +458,7 @@ namespace stardew_access.Patches { string toSpeak = ""; int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position - bool isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box + bool isEnterPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter); // For escaping/unselecting from the animal name text box if (firstTimeInNamingMenu) { @@ -471,7 +471,7 @@ namespace stardew_access.Patches ___textBox.Update(); toSpeak = ___textBox.Text; - if (isEscPressed) + if (isEnterPressed) { ___textBox.Selected = false; } diff --git a/stardew-access/Patches/QuestPatches.cs b/stardew-access/Patches/QuestPatches.cs index 015df71..0b38787 100644 --- a/stardew-access/Patches/QuestPatches.cs +++ b/stardew-access/Patches/QuestPatches.cs @@ -153,7 +153,7 @@ namespace stardew_access.Patches { try { - bool isCPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); + bool isPrimaryInfoKeyPressed = MainClass.Config.PrimaryInfoKey.JustPressed(); int x = Game1.getMouseX(true), y = Game1.getMouseY(true); // Mouse x and y position string toSpeak = " ", extra = ""; @@ -203,7 +203,7 @@ namespace stardew_access.Patches string description = Game1.parseText(____shownQuest.GetDescription(), Game1.dialogueFont, __instance.width - 128); string title = ____shownQuest.GetName(); - if (firstTimeInIndividualQuest || (isCPressed && !isNarratingQuestInfo)) + if (firstTimeInIndividualQuest || (isPrimaryInfoKeyPressed && !isNarratingQuestInfo)) { if (firstTimeInIndividualQuest) toSpeak = "Back button"; diff --git a/stardew-access/Patches/TitleMenuPatches.cs b/stardew-access/Patches/TitleMenuPatches.cs index 3873cf3..39f3387 100644 --- a/stardew-access/Patches/TitleMenuPatches.cs +++ b/stardew-access/Patches/TitleMenuPatches.cs @@ -247,7 +247,7 @@ namespace stardew_access.Patches { try { - bool isEscPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape); // For escaping/unselecting from the animal name text box + bool isEnterPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter); // For escaping/unselecting from the animal name text box string toSpeak = " "; string currentPetName = getCurrentPetName(); @@ -255,7 +255,7 @@ namespace stardew_access.Patches { toSpeak = ___nameBox.Text; - if (isEscPressed) + if (isEnterPressed) { ___nameBox.Selected = false; } @@ -264,7 +264,7 @@ namespace stardew_access.Patches { toSpeak = ___farmnameBox.Text; - if (isEscPressed) + if (isEnterPressed) { ___farmnameBox.Selected = false; } @@ -273,7 +273,7 @@ namespace stardew_access.Patches { toSpeak = ___favThingBox.Text; - if (isEscPressed) + if (isEnterPressed) { ___favThingBox.Selected = false; }