using StardewModdingAPI; using StardewValley; namespace TrainerMod.Framework.Commands.Player { /// A command which edits the player's current added speed. internal class SetSpeedCommand : TrainerCommand { /********* ** Public methods *********/ /// Construct an instance. public SetSpeedCommand() : base("player_setspeed", "Sets the player's added speed to the specified value.\n\nUsage: player_setspeed \n- value: an integer amount (0 is normal).") { } /// Handle the command. /// Writes messages to the console and log file. /// The command name. /// The command arguments. public override void Handle(IMonitor monitor, string command, ArgumentParser args) { // parse arguments if (!args.TryGetInt(0, "added speed", out int amount, min: 0)) return; // handle Game1.player.addedSpeed = amount; monitor.Log($"OK, your added speed is now {Game1.player.addedSpeed}.", LogLevel.Info); } } }