Added chat menu keys to mod config
This commit is contained in:
		| @@ -133,7 +133,7 @@ namespace stardew_access.Features | |||||||
|             { |             { | ||||||
|                 this.cursorMoveInput(new Vector2(-Game1.tileSize, 0)); |                 this.cursorMoveInput(new Vector2(-Game1.tileSize, 0)); | ||||||
|             } |             } | ||||||
|             else if (MainClass.Config.AutoWalkToTile.JustPressed() && StardewModdingAPI.Context.IsPlayerFree) |             else if (MainClass.Config.AutoWalkToTileKey.JustPressed() && StardewModdingAPI.Context.IsPlayerFree) | ||||||
|             { |             { | ||||||
|                 this.startAutoWalking(); |                 this.startAutoWalking(); | ||||||
|             } |             } | ||||||
|   | |||||||
| @@ -4,31 +4,28 @@ namespace stardew_access | |||||||
| { | { | ||||||
|     internal class ModConfig |     internal class ModConfig | ||||||
|     { |     { | ||||||
|         public Boolean VerboseCoordinates { get; set; } = true; |  | ||||||
|         public Boolean ReadTile { get; set; } = true; |  | ||||||
|         public Boolean SnapMouse { get; set; } = true; |  | ||||||
|         public Boolean Radar { get; set; } = false; |  | ||||||
|         public Boolean RadarStereoSound { get; set; } = true; |  | ||||||
|         public Boolean ReadFlooring { get; set; } = false; |  | ||||||
|  |  | ||||||
|         #region KeyBinds |  | ||||||
|  |  | ||||||
|         // https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Input#SButton button key codes |         // 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 LeftClickMainKey { get; set; } = KeybindList.Parse("LeftControl + Enter"); | ||||||
|         public KeybindList RightClickMainKey { get; set; } = KeybindList.Parse("LeftShift + Enter"); |         public KeybindList RightClickMainKey { get; set; } = KeybindList.Parse("LeftShift + Enter"); | ||||||
|         public KeybindList LeftClickAlternateKey { get; set; } = KeybindList.Parse("OemOpenBrackets"); |         public KeybindList LeftClickAlternateKey { get; set; } = KeybindList.Parse("OemOpenBrackets"); | ||||||
|         public KeybindList RightClickAlternateKey { get; set; } = KeybindList.Parse("OemCloseBrackets"); |         public KeybindList RightClickAlternateKey { get; set; } = KeybindList.Parse("OemCloseBrackets"); | ||||||
|         public KeybindList HealthNStaminaKey { get; set; } = KeybindList.Parse("H"); |         #endregion | ||||||
|         public KeybindList PositionKey { get; set; } = KeybindList.Parse("K"); |  | ||||||
|         public KeybindList LocationKey { get; set; } = KeybindList.Parse("LeftAlt + K"); |         #region Chat menu | ||||||
|         public KeybindList MoneyKey { get; set; } = KeybindList.Parse("R"); |         public KeybindList ChatMenuNextKey { get; set; } = KeybindList.Parse("PageUp"); | ||||||
|         public KeybindList TimeNSeasonKey { get; set; } = KeybindList.Parse("Q"); |         public KeybindList ChatMenuPreviousKey { get; set; } = KeybindList.Parse("PageDown"); | ||||||
|  |         #endregion | ||||||
|  |  | ||||||
|  |         #region Read tile | ||||||
|  |         public Boolean ReadTile { get; set; } = true; | ||||||
|         public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J"); |         public KeybindList ReadTileKey { get; set; } = KeybindList.Parse("J"); | ||||||
|         public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J"); |         public KeybindList ReadStandingTileKey { get; set; } = KeybindList.Parse("LeftAlt + J"); | ||||||
|         public bool LimitTileCursorToScreen { get; set; } = false; |         public Boolean ReadFlooring { get; set; } = false; | ||||||
|         public int TileCursorPreciseMovementDistance { get; set; } = 8; |         #endregion | ||||||
|  |  | ||||||
|         //Tile viewer keys |         #region Tile viewer | ||||||
|         public KeybindList TileCursorUpKey { get; set; } = KeybindList.Parse("Up"); |         public KeybindList TileCursorUpKey { get; set; } = KeybindList.Parse("Up"); | ||||||
|         public KeybindList TileCursorRightKey { get; set; } = KeybindList.Parse("Right"); |         public KeybindList TileCursorRightKey { get; set; } = KeybindList.Parse("Right"); | ||||||
|         public KeybindList TileCursorDownKey { get; set; } = KeybindList.Parse("Down"); |         public KeybindList TileCursorDownKey { get; set; } = KeybindList.Parse("Down"); | ||||||
| @@ -38,7 +35,24 @@ namespace stardew_access | |||||||
|         public KeybindList TileCursorPreciseDownKey { get; set; } = KeybindList.Parse("LeftShift + Down"); |         public KeybindList TileCursorPreciseDownKey { get; set; } = KeybindList.Parse("LeftShift + Down"); | ||||||
|         public KeybindList TileCursorPreciseLeftKey { get; set; } = KeybindList.Parse("LeftShift + Left"); |         public KeybindList TileCursorPreciseLeftKey { get; set; } = KeybindList.Parse("LeftShift + Left"); | ||||||
|         public KeybindList ToggleRelativeCursorLockKey { get; set; } = KeybindList.Parse("L"); |         public KeybindList ToggleRelativeCursorLockKey { get; set; } = KeybindList.Parse("L"); | ||||||
|         public KeybindList AutoWalkToTile { get; set; } = KeybindList.Parse("LeftControl + Enter"); |         public KeybindList AutoWalkToTileKey { get; set; } = KeybindList.Parse("LeftControl + Enter"); | ||||||
|  |         public bool LimitTileCursorToScreen { get; set; } = false; | ||||||
|  |         public int TileCursorPreciseMovementDistance { get; set; } = 8; | ||||||
|  |         #endregion | ||||||
|  |  | ||||||
|  |         #region Radar | ||||||
|  |         public Boolean Radar { get; set; } = false; | ||||||
|  |         public Boolean RadarStereoSound { get; set; } = true; | ||||||
|  |         #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 Boolean VerboseCoordinates { get; set; } = true; | ||||||
|  |         public Boolean SnapMouse { get; set; } = true; | ||||||
|         #endregion |         #endregion | ||||||
|  |  | ||||||
|         // TODO Add the exclusion and focus list too |         // TODO Add the exclusion and focus list too | ||||||
|   | |||||||
| @@ -192,22 +192,18 @@ namespace stardew_access | |||||||
|             if (e == null) |             if (e == null) | ||||||
|                 return; |                 return; | ||||||
|  |  | ||||||
|             bool isLeftAltPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt); |  | ||||||
|  |  | ||||||
|             #region Simulate left and right clicks |             #region Simulate left and right clicks | ||||||
|             if (Game1.activeClickableMenu != null) |             if (Game1.activeClickableMenu != null) | ||||||
|             { |             { | ||||||
|                 bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift); |  | ||||||
|                 bool isLeftControlPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl); |  | ||||||
|                 bool isCustomizingChrachter = Game1.activeClickableMenu is CharacterCustomization || (TitleMenu.subMenu != null && TitleMenu.subMenu is CharacterCustomization); |                 bool isCustomizingChrachter = Game1.activeClickableMenu is CharacterCustomization || (TitleMenu.subMenu != null && TitleMenu.subMenu is CharacterCustomization); | ||||||
|  |  | ||||||
|                 #region Mouse Click Simulation |                 #region Mouse Click Simulation | ||||||
|                 // Main Keybinds |                 // Main Keybinds | ||||||
|                 if (isLeftControlPressed && Config.LeftClickMainKey.JustPressed()) |                 if (Config.LeftClickMainKey.JustPressed()) | ||||||
|                 { |                 { | ||||||
|                     Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); |                     Game1.activeClickableMenu.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); | ||||||
|                 } |                 } | ||||||
|                 if (isLeftShiftPressed && Config.RightClickMainKey.JustPressed()) |                 if (Config.RightClickMainKey.JustPressed()) | ||||||
|                 { |                 { | ||||||
|                     Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); |                     Game1.activeClickableMenu.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); | ||||||
|                 } |                 } | ||||||
| @@ -226,17 +222,15 @@ namespace stardew_access | |||||||
|  |  | ||||||
|             if (Game1.currentMinigame != null) |             if (Game1.currentMinigame != null) | ||||||
|             { |             { | ||||||
|                 bool isLeftShiftPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftShift); |  | ||||||
|                 bool isLeftControlPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl); |  | ||||||
|                 bool isCustomizingChrachter = Game1.activeClickableMenu is CharacterCustomization || (TitleMenu.subMenu != null && TitleMenu.subMenu is CharacterCustomization); |                 bool isCustomizingChrachter = Game1.activeClickableMenu is CharacterCustomization || (TitleMenu.subMenu != null && TitleMenu.subMenu is CharacterCustomization); | ||||||
|  |  | ||||||
|                 #region Mouse Click Simulation |                 #region Mouse Click Simulation | ||||||
|                 // Main Keybinds |                 // Main Keybinds | ||||||
|                 if (isLeftControlPressed && Config.LeftClickMainKey.JustPressed()) |                 if (Config.LeftClickMainKey.JustPressed()) | ||||||
|                 { |                 { | ||||||
|                     Game1.currentMinigame.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); |                     Game1.currentMinigame.receiveLeftClick(Game1.getMouseX(true), Game1.getMouseY(true)); | ||||||
|                 } |                 } | ||||||
|                 if (isLeftShiftPressed && Config.RightClickMainKey.JustPressed()) |                 if (Config.RightClickMainKey.JustPressed()) | ||||||
|                 { |                 { | ||||||
|                     Game1.currentMinigame.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); |                     Game1.currentMinigame.receiveRightClick(Game1.getMouseX(true), Game1.getMouseY(true)); | ||||||
|                 } |                 } | ||||||
|   | |||||||
| @@ -16,19 +16,19 @@ namespace stardew_access.Patches | |||||||
|  |  | ||||||
|                 if (__instance.chatBox.Selected) |                 if (__instance.chatBox.Selected) | ||||||
|                 { |                 { | ||||||
|                     bool isPrevArrowPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.PageUp); |                     bool isPrevButtonPressed = MainClass.Config.ChatMenuNextKey.JustPressed(); | ||||||
|                     bool isNextArrowPressed = Game1.input.GetKeyboardState().IsKeyDown(Microsoft.Xna.Framework.Input.Keys.PageDown); |                     bool isNextButtonPressed = MainClass.Config.ChatMenuPreviousKey.JustPressed(); | ||||||
|  |  | ||||||
|                     if (___messages.Count > 0) |                     if (___messages.Count > 0) | ||||||
|                     { |                     { | ||||||
|                         #region To narrate previous and next chat messages |                         #region To narrate previous and next chat messages | ||||||
|                         if (isNextArrowPressed && !isChatRunning) |                         if (isNextButtonPressed && !isChatRunning) | ||||||
|                         { |                         { | ||||||
|                             isChatRunning = true; |                             isChatRunning = true; | ||||||
|                             CycleThroughChatMessages(true, ___messages); |                             CycleThroughChatMessages(true, ___messages); | ||||||
|                             Task.Delay(200).ContinueWith(_ => { isChatRunning = false; }); |                             Task.Delay(200).ContinueWith(_ => { isChatRunning = false; }); | ||||||
|                         } |                         } | ||||||
|                         else if (isPrevArrowPressed && !isChatRunning) |                         else if (isPrevButtonPressed && !isChatRunning) | ||||||
|                         { |                         { | ||||||
|                             isChatRunning = true; |                             isChatRunning = true; | ||||||
|                             CycleThroughChatMessages(false, ___messages); |                             CycleThroughChatMessages(false, ___messages); | ||||||
| @@ -58,22 +58,9 @@ namespace stardew_access.Patches | |||||||
|         private static void CycleThroughChatMessages(bool increase, List<ChatMessage> ___messages) |         private static void CycleThroughChatMessages(bool increase, List<ChatMessage> ___messages) | ||||||
|         { |         { | ||||||
|             string toSpeak = " "; |             string toSpeak = " "; | ||||||
|             if (increase) |  | ||||||
|             { |             currentChatMessageIndex = (increase) ? (Math.Min(currentChatMessageIndex + 1, ___messages.Count - 1)) : (currentChatMessageIndex = Math.Max(currentChatMessageIndex - 1, 0)); | ||||||
|                 ++currentChatMessageIndex; |  | ||||||
|                 if (currentChatMessageIndex > ___messages.Count - 1) |  | ||||||
|                 { |  | ||||||
|                     currentChatMessageIndex = ___messages.Count - 1; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             else |  | ||||||
|             { |  | ||||||
|                 --currentChatMessageIndex; |  | ||||||
|                 if (currentChatMessageIndex < 0) |  | ||||||
|                 { |  | ||||||
|                     currentChatMessageIndex = 0; |  | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|             ___messages[currentChatMessageIndex].message.ForEach(message => |             ___messages[currentChatMessageIndex].message.ForEach(message => | ||||||
|             { |             { | ||||||
|                 toSpeak += $"{message.message}, "; |                 toSpeak += $"{message.message}, "; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user