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