summaryrefslogtreecommitdiff
path: root/src/TrainerMod
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-03-01 20:06:03 -0500
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-03-01 20:06:03 -0500
commit5ed6eb09860050f1a669539a75df21200d59f554 (patch)
tree15e064adc0820f22e67fe69698f615e24a737022 /src/TrainerMod
parent5cdf75b463cdae632ee441da312b763c899e9e72 (diff)
downloadSMAPI-5ed6eb09860050f1a669539a75df21200d59f554.tar.gz
SMAPI-5ed6eb09860050f1a669539a75df21200d59f554.tar.bz2
SMAPI-5ed6eb09860050f1a669539a75df21200d59f554.zip
fix `world_downminelevel` command not working, prevent invalid `world_setminelevel` value
Diffstat (limited to 'src/TrainerMod')
-rw-r--r--src/TrainerMod/TrainerMod.cs14
1 files changed, 9 insertions, 5 deletions
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);