using StardewModdingAPI; using StardewValley; using StardewValley.Objects; namespace TrainerMod.Framework.Commands.Player { /// A command which adds a floor item to the player inventory. internal class AddFlooringCommand : TrainerCommand { /********* ** Public methods *********/ /// Construct an instance. public AddFlooringCommand() : base("player_addflooring", "Gives the player a flooring item.\n\nUsage: player_addflooring \n- flooring: the flooring ID (ranges from 0 to 39).") { } /// 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) { // read arguments if (!args.TryGetInt(0, "floor ID", out int floorID, min: 0, max: 39)) return; // handle Wallpaper wallpaper = new Wallpaper(floorID, isFloor: true); Game1.player.addItemByMenuIfNecessary(wallpaper); monitor.Log($"OK, added flooring {floorID} to your inventory.", LogLevel.Info); } } }