diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-01-22 20:24:13 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2021-01-22 20:24:13 -0500 |
commit | cea8e557efef1be5466cbb7102b4e163c34394c2 (patch) | |
tree | 3698e7edef38f505c0031d78115f1cb5c8bdb2e1 /src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs | |
parent | 8fd2a6fd3a3de037055ccd8ec350c92ba2cdda9d (diff) | |
download | SMAPI-cea8e557efef1be5466cbb7102b4e163c34394c2.tar.gz SMAPI-cea8e557efef1be5466cbb7102b4e163c34394c2.tar.bz2 SMAPI-cea8e557efef1be5466cbb7102b4e163c34394c2.zip |
remove inf options for player_sethealth/money/stamina
Diffstat (limited to 'src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs')
-rw-r--r-- | src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs index 6e3d68b6..e015f01a 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs @@ -7,18 +7,11 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Player internal class SetMoneyCommand : TrainerCommand { /********* - ** Fields - *********/ - /// <summary>Whether to keep the player's money at a set value.</summary> - private bool InfiniteMoney; - - - /********* ** Public methods *********/ /// <summary>Construct an instance.</summary> public SetMoneyCommand() - : base("player_setmoney", "Sets the player's money.\n\nUsage: player_setmoney <value>\n- value: an integer amount, or 'inf' for infinite money.", mayNeedUpdate: true) { } + : base("player_setmoney", "Sets the player's money.\n\nUsage: player_setmoney <value>\n- value: an integer amount.") { } /// <summary>Handle the command.</summary> /// <param name="monitor">Writes messages to the console and log file.</param> @@ -29,36 +22,19 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.Player // validate if (!args.Any()) { - monitor.Log($"You currently have {(this.InfiniteMoney ? "infinite" : Game1.player.Money.ToString())} gold. Specify a value to change it.", LogLevel.Info); + monitor.Log($"You currently have {Game1.player.Money} gold. Specify a value to change it.", LogLevel.Info); return; } // handle string amountStr = args[0]; - if (amountStr == "inf") + if (int.TryParse(amountStr, out int amount)) { - this.InfiniteMoney = true; - monitor.Log("OK, you now have infinite money.", LogLevel.Info); + Game1.player.Money = amount; + monitor.Log($"OK, you now have {Game1.player.Money} gold.", LogLevel.Info); } else - { - this.InfiniteMoney = false; - if (int.TryParse(amountStr, out int amount)) - { - Game1.player.Money = amount; - monitor.Log($"OK, you now have {Game1.player.Money} gold.", LogLevel.Info); - } - else - this.LogArgumentNotInt(monitor); - } - } - - /// <summary>Perform any logic needed on update tick.</summary> - /// <param name="monitor">Writes messages to the console and log file.</param> - public override void OnUpdated(IMonitor monitor) - { - if (this.InfiniteMoney && Context.IsWorldReady) - Game1.player.Money = 999999; + this.LogArgumentNotInt(monitor); } } } |