summaryrefslogtreecommitdiff
path: root/src/TrainerMod/Framework/Commands/Player/SetStyleCommand.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/TrainerMod/Framework/Commands/Player/SetStyleCommand.cs')
-rw-r--r--src/TrainerMod/Framework/Commands/Player/SetStyleCommand.cs102
1 files changed, 102 insertions, 0 deletions
diff --git a/src/TrainerMod/Framework/Commands/Player/SetStyleCommand.cs b/src/TrainerMod/Framework/Commands/Player/SetStyleCommand.cs
new file mode 100644
index 00000000..9ef5f88b
--- /dev/null
+++ b/src/TrainerMod/Framework/Commands/Player/SetStyleCommand.cs
@@ -0,0 +1,102 @@
+using StardewModdingAPI;
+using StardewValley;
+
+namespace TrainerMod.Framework.Commands.Player
+{
+ /// <summary>A command which edits a player style.</summary>
+ internal class SetStyleCommand : TrainerCommand
+ {
+ /*********
+ ** Public methods
+ *********/
+ /// <summary>Construct an instance.</summary>
+ public SetStyleCommand()
+ : base("player_changestyle", "Sets the style of a player feature.\n\nUsage: player_changecolor <target> <value>.\n- target: what to change (one of 'hair', 'shirt', 'skin', 'acc', 'shoe', 'swim', or 'gender').\n- value: the integer style ID.") { }
+
+ /// <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, string[] args)
+ {
+ // validate
+ if (args.Length <= 1)
+ {
+ this.LogArgumentsInvalid(monitor, command);
+ return;
+ }
+ if (!int.TryParse(args[1], out int styleID))
+ {
+ this.LogArgumentsInvalid(monitor, command);
+ return;
+ }
+
+ // handle
+ switch (args[0])
+ {
+ case "hair":
+ Game1.player.changeHairStyle(styleID);
+ monitor.Log("OK, your hair style is updated.", LogLevel.Info);
+ break;
+
+ case "shirt":
+ Game1.player.changeShirt(styleID);
+ monitor.Log("OK, your shirt style is updated.", LogLevel.Info);
+ break;
+
+ case "acc":
+ Game1.player.changeAccessory(styleID);
+ monitor.Log("OK, your accessory style is updated.", LogLevel.Info);
+ break;
+
+ case "skin":
+ Game1.player.changeSkinColor(styleID);
+ monitor.Log("OK, your skin color is updated.", LogLevel.Info);
+ break;
+
+ case "shoe":
+ Game1.player.changeShoeColor(styleID);
+ monitor.Log("OK, your shoe style is updated.", LogLevel.Info);
+ break;
+
+ case "swim":
+ switch (styleID)
+ {
+ case 0:
+ Game1.player.changeOutOfSwimSuit();
+ monitor.Log("OK, you're no longer in your swimming suit.", LogLevel.Info);
+ break;
+ case 1:
+ Game1.player.changeIntoSwimsuit();
+ monitor.Log("OK, you're now in your swimming suit.", LogLevel.Info);
+ break;
+ default:
+ this.LogUsageError(monitor, "The swim value should be 0 (no swimming suit) or 1 (swimming suit).", command);
+ break;
+ }
+ break;
+
+ case "gender":
+ switch (styleID)
+ {
+ case 0:
+ Game1.player.changeGender(true);
+ monitor.Log("OK, you're now male.", LogLevel.Info);
+ break;
+ case 1:
+ Game1.player.changeGender(false);
+ monitor.Log("OK, you're now female.", LogLevel.Info);
+ break;
+ default:
+ this.LogUsageError(monitor, "The gender value should be 0 (male) or 1 (female).", command);
+ break;
+ }
+ break;
+
+ default:
+ this.LogArgumentsInvalid(monitor, command);
+ break;
+ }
+ }
+ }
+}