From 10a800f456fe865fdefb07e954d85d1753c2bbf7 Mon Sep 17 00:00:00 2001 From: Zoryn Aaron Date: Wed, 2 Mar 2016 16:25:23 -0500 Subject: add quality param to additem --- TrainerMod/TrainerMod.cs | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) (limited to 'TrainerMod/TrainerMod.cs') diff --git a/TrainerMod/TrainerMod.cs b/TrainerMod/TrainerMod.cs index 6e1b4b17..250ccab5 100644 --- a/TrainerMod/TrainerMod.cs +++ b/TrainerMod/TrainerMod.cs @@ -90,7 +90,7 @@ namespace TrainerMod Command.RegisterCommand("player_changecolour", "Sets the player's colour of the specified object | player_changecolor ", new[] { "(hair, eyes, pants) (r,g,b)" }).CommandFired += player_changeColour; Command.RegisterCommand("player_changestyle", "Sets the player's style of the specified object | player_changecolor ", new[] { "(hair, shirt, skin, acc, shoe, swim, gender) (Int32)" }).CommandFired += player_changeStyle; - Command.RegisterCommand("player_additem", "Gives the player an item | player_additem ", new[] { "? (Int32)" }).CommandFired += player_addItem; + Command.RegisterCommand("player_additem", "Gives the player an item | player_additem [count] [quality]", new[] { "(Int32) (Int32)[count] (Int32)[quality]" }).CommandFired += player_addItem; Command.RegisterCommand("player_addmelee", "Gives the player a melee item | player_addmelee ", new[] { "?" }).CommandFired += player_addMelee; Command.RegisterCommand("player_addring", "Gives the player a ring | player_addring ", new[] { "?" }).CommandFired += player_addRing; @@ -596,6 +596,7 @@ namespace TrainerMod if (cmd.CalledArgs[0].IsInt32()) { int count = 1; + int quality = 0; if (cmd.CalledArgs.Length > 1) { if (cmd.CalledArgs[1].IsInt32()) @@ -604,13 +605,29 @@ namespace TrainerMod } else { - Program.LogError(" is invalid"); + Program.LogError("[count] is invalid"); return; } + + if (cmd.CalledArgs.Length > 2) + { + if (cmd.CalledArgs[2].IsInt32()) + { + quality = cmd.CalledArgs[2].AsInt32(); + } + else + { + Program.LogError("[quality] is invalid"); + return; + } + + } } - Item i = (Item) new StardewValley.Object(cmd.CalledArgs[0].AsInt32(), count); - - Game1.player.addItemByMenuIfNecessary(i); + + StardewValley.Object o = new StardewValley.Object(cmd.CalledArgs[0].AsInt32(), count); + o.quality = quality; + + Game1.player.addItemByMenuIfNecessary((Item)o); } else { @@ -739,7 +756,9 @@ namespace TrainerMod static void RegisterNewItem(Command cmd) { - Game1.player.addItemToInventory(SGame.PullModItemFromDict(0, true)); + SObject s = SGame.PullModItemFromDict(0, true); + s.Stack = 999; + Game1.player.addItemToInventory(s); } } } -- cgit