From 5ed6eb09860050f1a669539a75df21200d59f554 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 1 Mar 2017 20:06:03 -0500 Subject: fix `world_downminelevel` command not working, prevent invalid `world_setminelevel` value --- src/TrainerMod/TrainerMod.cs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/TrainerMod') diff --git a/src/TrainerMod/TrainerMod.cs b/src/TrainerMod/TrainerMod.cs index 5cbd1ae6..1d4e0b17 100644 --- a/src/TrainerMod/TrainerMod.cs +++ b/src/TrainerMod/TrainerMod.cs @@ -6,6 +6,7 @@ using Microsoft.Xna.Framework; using StardewModdingAPI; using StardewModdingAPI.Events; using StardewValley; +using StardewValley.Locations; using StardewValley.Menus; using StardewValley.Objects; using StardewValley.Tools; @@ -655,18 +656,21 @@ namespace TrainerMod break; case "world_downminelevel": - Game1.nextMineLevel(); - this.Monitor.Log("OK, warping you to the next mine level.", LogLevel.Info); - break; + { + int level = (Game1.currentLocation as MineShaft)?.mineLevel ?? 0; + this.Monitor.Log($"OK, warping you to mine level {level + 1}.", LogLevel.Info); + Game1.enterMine(false, level + 1, ""); + break; + } case "world_setminelevel": if (args.Any()) { if (args[0].IsInt()) { - int level = args[0].ToInt(); - Game1.enterMine(true, level, ""); + int level = Math.Max(1, args[0].ToInt()); this.Monitor.Log($"OK, warping you to mine level {level}.", LogLevel.Info); + Game1.enterMine(true, level, ""); } else this.LogArgumentNotInt(command); -- cgit