From c1926f263c21147047b23d91c11dac6478fa1211 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sun, 23 Apr 2017 22:13:49 -0400 Subject: add world_setyear command to TrainerMod --- src/TrainerMod/TrainerMod.cs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/TrainerMod/TrainerMod.cs') diff --git a/src/TrainerMod/TrainerMod.cs b/src/TrainerMod/TrainerMod.cs index 7187a358..465567f7 100644 --- a/src/TrainerMod/TrainerMod.cs +++ b/src/TrainerMod/TrainerMod.cs @@ -102,10 +102,11 @@ namespace TrainerMod .Add("list_items", "Lists and searches items in the game data.\n\nUsage: list_items [search]\n- search (optional): an arbitrary search string to filter by.", this.HandleCommand) - .Add("world_settime", "Sets the time to the specified value.\n\nUsage: world_settime \n- value: the target time in military time (like 0600 for 6am and 1800 for 6pm)", this.HandleCommand) .Add("world_freezetime", "Freezes or resumes time.\n\nUsage: world_freezetime [value]\n- value: one of 0 (resume), 1 (freeze), or blank (toggle).", this.HandleCommand) + .Add("world_settime", "Sets the time to the specified value.\n\nUsage: world_settime \n- value: the target time in military time (like 0600 for 6am and 1800 for 6pm)", this.HandleCommand) .Add("world_setday", "Sets the day to the specified value.\n\nUsage: world_setday .\n- value: the target day (a number from 1 to 28).", this.HandleCommand) - .Add("world_setseason", "Sets the season to the specified value.\n\nUsage: world_setseason \n- value: the target season (one of 'spring', 'summer', 'fall', 'winter').", this.HandleCommand) + .Add("world_setseason", "Sets the season to the specified value.\n\nUsage: world_setseason \n- season: the target season (one of 'spring', 'summer', 'fall', 'winter').", this.HandleCommand) + .Add("world_setyear", "Sets the year to the specified value.\n\nUsage: world_setyear \n- year: the target year (a number starting from 1).", this.HandleCommand) .Add("world_downminelevel", "Goes down one mine level?", this.HandleCommand) .Add("world_setminelevel", "Sets the mine level?\n\nUsage: world_setminelevel \n- value: The target level (a number between 1 and 120).", this.HandleCommand) @@ -489,6 +490,27 @@ namespace TrainerMod this.Monitor.Log($"The current season is {Game1.currentSeason}. Specify a value to change it.", LogLevel.Info); break; + case "world_setyear": + if (args.Any()) + { + int year; + if (int.TryParse(args[0], out year)) + { + if (year >= 1) + { + Game1.year = year; + this.Monitor.Log($"OK, the year is now {Game1.year}.", LogLevel.Info); + } + else + this.LogUsageError("That isn't a valid year.", command); + } + else + this.LogArgumentNotInt(command); + } + else + this.Monitor.Log($"The current year is {Game1.year}. Specify a value to change the year.", LogLevel.Info); + break; + case "player_sethealth": if (args.Any()) { -- cgit