summaryrefslogtreecommitdiff
path: root/src/TrainerMod/Framework/Commands/World
diff options
context:
space:
mode:
Diffstat (limited to 'src/TrainerMod/Framework/Commands/World')
-rw-r--r--src/TrainerMod/Framework/Commands/World/DownMineLevelCommand.cs28
-rw-r--r--src/TrainerMod/Framework/Commands/World/FreezeTimeCommand.cs67
-rw-r--r--src/TrainerMod/Framework/Commands/World/SetDayCommand.cs39
-rw-r--r--src/TrainerMod/Framework/Commands/World/SetMineLevelCommand.cs33
-rw-r--r--src/TrainerMod/Framework/Commands/World/SetSeasonCommand.cs46
-rw-r--r--src/TrainerMod/Framework/Commands/World/SetTimeCommand.cs40
-rw-r--r--src/TrainerMod/Framework/Commands/World/SetYearCommand.cs39
7 files changed, 0 insertions, 292 deletions
diff --git a/src/TrainerMod/Framework/Commands/World/DownMineLevelCommand.cs b/src/TrainerMod/Framework/Commands/World/DownMineLevelCommand.cs
deleted file mode 100644
index 4e62cf77..00000000
--- a/src/TrainerMod/Framework/Commands/World/DownMineLevelCommand.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using StardewModdingAPI;
-using StardewValley;
-using StardewValley.Locations;
-
-namespace TrainerMod.Framework.Commands.World
-{
- /// <summary>A command which moves the player to the next mine level.</summary>
- internal class DownMineLevelCommand : TrainerCommand
- {
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- public DownMineLevelCommand()
- : base("world_downminelevel", "Goes down one mine level.") { }
-
- /// <summary>Handle the command.</summary>
- /// <param name="monitor">Writes messages to the console and log file.</param>
- /// <param name="command">The command name.</param>
- /// <param name="args">The command arguments.</param>
- public override void Handle(IMonitor monitor, string command, ArgumentParser args)
- {
- int level = (Game1.currentLocation as MineShaft)?.mineLevel ?? 0;
- monitor.Log($"OK, warping you to mine level {level + 1}.", LogLevel.Info);
- Game1.enterMine(false, level + 1, "");
- }
- }
-}
diff --git a/src/TrainerMod/Framework/Commands/World/FreezeTimeCommand.cs b/src/TrainerMod/Framework/Commands/World/FreezeTimeCommand.cs
deleted file mode 100644
index 13d08398..00000000
--- a/src/TrainerMod/Framework/Commands/World/FreezeTimeCommand.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System.Linq;
-using StardewModdingAPI;
-using StardewValley;
-
-namespace TrainerMod.Framework.Commands.World
-{
- /// <summary>A command which freezes the current time.</summary>
- internal class FreezeTimeCommand : TrainerCommand
- {
- /*********
- ** Properties
- *********/
- /// <summary>The time of day at which to freeze time.</summary>
- internal static int FrozenTime;
-
- /// <summary>Whether to freeze time.</summary>
- private bool FreezeTime;
-
-
- /*********
- ** Accessors
- *********/
- /// <summary>Whether the command needs to perform logic when the game updates.</summary>
- public override bool NeedsUpdate => this.FreezeTime;
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- public FreezeTimeCommand()
- : base("world_freezetime", "Freezes or resumes time.\n\nUsage: world_freezetime [value]\n- value: one of 0 (resume), 1 (freeze), or blank (toggle).") { }
-
- /// <summary>Handle the command.</summary>
- /// <param name="monitor">Writes messages to the console and log file.</param>
- /// <param name="command">The command name.</param>
- /// <param name="args">The command arguments.</param>
- public override void Handle(IMonitor monitor, string command, ArgumentParser args)
- {
- if (args.Any())
- {
- // parse arguments
- if (!args.TryGetInt(0, "value", out int value, min: 0, max: 1))
- return;
-
- // handle
- this.FreezeTime = value == 1;
- FreezeTimeCommand.FrozenTime = Game1.timeOfDay;
- monitor.Log($"OK, time is now {(this.FreezeTime ? "frozen" : "resumed")}.", LogLevel.Info);
- }
- else
- {
- this.FreezeTime = !this.FreezeTime;
- FreezeTimeCommand.FrozenTime = Game1.timeOfDay;
- monitor.Log($"OK, time is now {(this.FreezeTime ? "frozen" : "resumed")}.", LogLevel.Info);
- }
- }
-
- /// <summary>Perform any logic needed on update tick.</summary>
- /// <param name="monitor">Writes messages to the console and log file.</param>
- public override void Update(IMonitor monitor)
- {
- if (this.FreezeTime)
- Game1.timeOfDay = FreezeTimeCommand.FrozenTime;
- }
- }
-}
diff --git a/src/TrainerMod/Framework/Commands/World/SetDayCommand.cs b/src/TrainerMod/Framework/Commands/World/SetDayCommand.cs
deleted file mode 100644
index 54267384..00000000
--- a/src/TrainerMod/Framework/Commands/World/SetDayCommand.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System.Linq;
-using StardewModdingAPI;
-using StardewValley;
-
-namespace TrainerMod.Framework.Commands.World
-{
- /// <summary>A command which sets the current day.</summary>
- internal class SetDayCommand : TrainerCommand
- {
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- public SetDayCommand()
- : base("world_setday", "Sets the day to the specified value.\n\nUsage: world_setday <value>.\n- value: the target day (a number from 1 to 28).") { }
-
- /// <summary>Handle the command.</summary>
- /// <param name="monitor">Writes messages to the console and log file.</param>
- /// <param name="command">The command name.</param>
- /// <param name="args">The command arguments.</param>
- public override void Handle(IMonitor monitor, string command, ArgumentParser args)
- {
- // no-argument mode
- if (!args.Any())
- {
- monitor.Log($"The current date is {Game1.currentSeason} {Game1.dayOfMonth}. Specify a value to change the day.", LogLevel.Info);
- return;
- }
-
- // parse arguments
- if (!args.TryGetInt(0, "day", out int day, min: 1, max: 28))
- return;
-
- // handle
- Game1.dayOfMonth = day;
- monitor.Log($"OK, the date is now {Game1.currentSeason} {Game1.dayOfMonth}.", LogLevel.Info);
- }
- }
-}
diff --git a/src/TrainerMod/Framework/Commands/World/SetMineLevelCommand.cs b/src/TrainerMod/Framework/Commands/World/SetMineLevelCommand.cs
deleted file mode 100644
index 225ec091..00000000
--- a/src/TrainerMod/Framework/Commands/World/SetMineLevelCommand.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-using System;
-using StardewModdingAPI;
-using StardewValley;
-
-namespace TrainerMod.Framework.Commands.World
-{
- /// <summary>A command which moves the player to the given mine level.</summary>
- internal class SetMineLevelCommand : TrainerCommand
- {
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- public SetMineLevelCommand()
- : base("world_setminelevel", "Sets the mine level?\n\nUsage: world_setminelevel <value>\n- value: The target level (a number starting at 1).") { }
-
- /// <summary>Handle the command.</summary>
- /// <param name="monitor">Writes messages to the console and log file.</param>
- /// <param name="command">The command name.</param>
- /// <param name="args">The command arguments.</param>
- public override void Handle(IMonitor monitor, string command, ArgumentParser args)
- {
- // parse arguments
- if (!args.TryGetInt(0, "mine level", out int level, min: 1))
- return;
-
- // handle
- level = Math.Max(1, level);
- monitor.Log($"OK, warping you to mine level {level}.", LogLevel.Info);
- Game1.enterMine(true, level, "");
- }
- }
-}
diff --git a/src/TrainerMod/Framework/Commands/World/SetSeasonCommand.cs b/src/TrainerMod/Framework/Commands/World/SetSeasonCommand.cs
deleted file mode 100644
index 96c3d920..00000000
--- a/src/TrainerMod/Framework/Commands/World/SetSeasonCommand.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-using System.Linq;
-using StardewModdingAPI;
-using StardewValley;
-
-namespace TrainerMod.Framework.Commands.World
-{
- /// <summary>A command which sets the current season.</summary>
- internal class SetSeasonCommand : TrainerCommand
- {
- /*********
- ** Properties
- *********/
- /// <summary>The valid season names.</summary>
- private readonly string[] ValidSeasons = { "winter", "spring", "summer", "fall" };
-
-
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- public SetSeasonCommand()
- : base("world_setseason", "Sets the season to the specified value.\n\nUsage: world_setseason <season>\n- season: the target season (one of 'spring', 'summer', 'fall', 'winter').") { }
-
- /// <summary>Handle the command.</summary>
- /// <param name="monitor">Writes messages to the console and log file.</param>
- /// <param name="command">The command name.</param>
- /// <param name="args">The command arguments.</param>
- public override void Handle(IMonitor monitor, string command, ArgumentParser args)
- {
- // no-argument mode
- if (!args.Any())
- {
- monitor.Log($"The current season is {Game1.currentSeason}. Specify a value to change it.", LogLevel.Info);
- return;
- }
-
- // parse arguments
- if (!args.TryGet(0, "season", out string season, oneOf: this.ValidSeasons))
- return;
-
- // handle
- Game1.currentSeason = season;
- monitor.Log($"OK, the date is now {Game1.currentSeason} {Game1.dayOfMonth}.", LogLevel.Info);
- }
- }
-}
diff --git a/src/TrainerMod/Framework/Commands/World/SetTimeCommand.cs b/src/TrainerMod/Framework/Commands/World/SetTimeCommand.cs
deleted file mode 100644
index c827ea5e..00000000
--- a/src/TrainerMod/Framework/Commands/World/SetTimeCommand.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Linq;
-using StardewModdingAPI;
-using StardewValley;
-
-namespace TrainerMod.Framework.Commands.World
-{
- /// <summary>A command which sets the current time.</summary>
- internal class SetTimeCommand : TrainerCommand
- {
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- public SetTimeCommand()
- : base("world_settime", "Sets the time to the specified value.\n\nUsage: world_settime <value>\n- value: the target time in military time (like 0600 for 6am and 1800 for 6pm).") { }
-
- /// <summary>Handle the command.</summary>
- /// <param name="monitor">Writes messages to the console and log file.</param>
- /// <param name="command">The command name.</param>
- /// <param name="args">The command arguments.</param>
- public override void Handle(IMonitor monitor, string command, ArgumentParser args)
- {
- // no-argument mode
- if (!args.Any())
- {
- monitor.Log($"The current time is {Game1.timeOfDay}. Specify a value to change it.", LogLevel.Info);
- return;
- }
-
- // parse arguments
- if (!args.TryGetInt(0, "time", out int time, min: 600, max: 2600))
- return;
-
- // handle
- Game1.timeOfDay = time;
- FreezeTimeCommand.FrozenTime = Game1.timeOfDay;
- monitor.Log($"OK, the time is now {Game1.timeOfDay.ToString().PadLeft(4, '0')}.", LogLevel.Info);
- }
- }
-}
diff --git a/src/TrainerMod/Framework/Commands/World/SetYearCommand.cs b/src/TrainerMod/Framework/Commands/World/SetYearCommand.cs
deleted file mode 100644
index 760fc170..00000000
--- a/src/TrainerMod/Framework/Commands/World/SetYearCommand.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System.Linq;
-using StardewModdingAPI;
-using StardewValley;
-
-namespace TrainerMod.Framework.Commands.World
-{
- /// <summary>A command which sets the current year.</summary>
- internal class SetYearCommand : TrainerCommand
- {
- /*********
- ** Public methods
- *********/
- /// <summary>Construct an instance.</summary>
- public SetYearCommand()
- : base("world_setyear", "Sets the year to the specified value.\n\nUsage: world_setyear <year>\n- year: the target year (a number starting from 1).") { }
-
- /// <summary>Handle the command.</summary>
- /// <param name="monitor">Writes messages to the console and log file.</param>
- /// <param name="command">The command name.</param>
- /// <param name="args">The command arguments.</param>
- public override void Handle(IMonitor monitor, string command, ArgumentParser args)
- {
- // no-argument mode
- if (!args.Any())
- {
- monitor.Log($"The current year is {Game1.year}. Specify a value to change the year.", LogLevel.Info);
- return;
- }
-
- // parse arguments
- if (!args.TryGetInt(0, "year", out int year, min: 1))
- return;
-
- // handle
- Game1.year = year;
- monitor.Log($"OK, the year is now {Game1.year}.", LogLevel.Info);
- }
- }
-}