diff options
author | Zoryn Aaron <zoryn4163@gmail.com> | 2016-02-29 05:21:45 -0500 |
---|---|---|
committer | Zoryn Aaron <zoryn4163@gmail.com> | 2016-02-29 05:21:45 -0500 |
commit | 57bc4aa552c3a20adb62c7b9a8222764e0dd8243 (patch) | |
tree | 64a517a9ee01b55ae3f8fbf7f332c6cc27f7c7b1 /StardewModdingAPI | |
parent | 757361cfbce23f248467966f5ab8020168418559 (diff) | |
download | SMAPI-57bc4aa552c3a20adb62c7b9a8222764e0dd8243.tar.gz SMAPI-57bc4aa552c3a20adb62c7b9a8222764e0dd8243.tar.bz2 SMAPI-57bc4aa552c3a20adb62c7b9a8222764e0dd8243.zip |
commands
im tired
Diffstat (limited to 'StardewModdingAPI')
-rw-r--r-- | StardewModdingAPI/Program.cs | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs index 846050ed..ea1ff1da 100644 --- a/StardewModdingAPI/Program.cs +++ b/StardewModdingAPI/Program.cs @@ -16,7 +16,9 @@ using StardewValley; using StardewValley.Menus; using StardewValley.Minigames; using StardewValley.Network; +using StardewValley.Tools; using Keys = Microsoft.Xna.Framework.Input.Keys; +using Object = StardewValley.Object; namespace StardewModdingAPI { @@ -236,10 +238,18 @@ namespace StardewModdingAPI Command.RegisterCommand("player_changecolour", "Sets the player's colour of the specified object | player_changecolor <object> <colour>", new[] { "(hair, eyes, pants)<object> (r,g,b)<colour>" }).CommandFired += player_changeColour; Command.RegisterCommand("player_changestyle", "Sets the player's style of the specified object | player_changecolor <object> <value>", new[] { "(hair, shirt, skin, acc, shoe, swim, gender)<object> (Int32)<value>" }).CommandFired += player_changeStyle; + Command.RegisterCommand("player_additem", "Gives the player an item | player_additem <item> <count>", new[] { "?<item> (Int32)<count>" }).CommandFired += player_addItem; + Command.RegisterCommand("player_addmelee", "Gives the player a melee item | player_addmelee <item>", new[] { "?<item>" }).CommandFired += player_addMelee; + + Command.RegisterCommand("out_items", "Outputs a list of items | out_items", new[] { "" }).CommandFired += out_items; + Command.RegisterCommand("out_melee", "Outputs a list of melee weapons | out_melee", new[] { "" }).CommandFired += out_melee; + Command.RegisterCommand("world_settime", "Sets the time to the specified value | world_settime <value>", new[] { "(Int32)<value> The target time [06:00 AM is 600]" }).CommandFired += world_setTime; Command.RegisterCommand("world_freezetime", "Freezes or thaws time | world_freezetime <value>", new[] { "(0 - 1)<value> Whether or not to freeze time. 0 is thawed, 1 is frozen" }).CommandFired += world_freezeTime; Command.RegisterCommand("world_setday", "Sets the day to the specified value | world_setday <value>", new[] { "(Int32)<value> The target day [1-28]" }).CommandFired += world_setDay; Command.RegisterCommand("world_setseason", "Sets the season to the specified value | world_setseason <value>", new[] { "(winter, spring, summer, fall)<value> The target season" }).CommandFired += world_setSeason; + Command.RegisterCommand("world_downminelevel", "Goes down one mine level? | world_downminelevel", new[] { "" }).CommandFired += world_downMineLevel; + Command.RegisterCommand("world_setminelevel", "Sets mine level? | world_setminelevel", new[] { "(Int32)<value> The target level" }).CommandFired += world_setMineLevel; } static void help_CommandFired(Command cmd) @@ -738,6 +748,109 @@ namespace StardewModdingAPI } } + static void player_addItem(Command cmd) + { + if (cmd.CalledArgs.Length > 0) + { + if (cmd.CalledArgs[0].IsInt32()) + { + int count = 1; + if (cmd.CalledArgs.Length > 1) + { + if (cmd.CalledArgs[1].IsInt32()) + { + count = cmd.CalledArgs[1].AsInt32(); + } + else + { + LogError("<count> is invalid"); + return; + } + } + Game1.player.addItemByMenuIfNecessary((Item) new StardewValley.Object(cmd.CalledArgs[0].AsInt32(), count)); + } + else + { + LogError("<item> is invalid"); + } + } + else + { + LogObjectValueNotSpecified(); + } + } + + static void player_addMelee(Command cmd) + { + if (cmd.CalledArgs.Length > 0) + { + if (cmd.CalledArgs[0].IsInt32()) + { + MeleeWeapon toAdd = new MeleeWeapon(cmd.CalledArgs[0].AsInt32()); + Game1.player.addItemByMenuIfNecessary(toAdd); + LogInfo("Given {0} to {1}", toAdd.Name, Game1.player.Name); + } + else + { + LogError("<item> is invalid"); + } + } + else + { + LogObjectValueNotSpecified(); + } + } + + static void out_items(Command cmd) + { + for (int i = 0; i < 1000; i++) + { + try + { + Item it = new StardewValley.Object(i, 1); + Console.WriteLine(i + "| " + it.Name); + } + catch + { + + } + } + } + + static void out_melee(Command cmd) + { + Dictionary<int, string> d = Game1.content.Load<Dictionary<int, string>>("Data\\weapons"); + Console.Write("DATA\\WEAPONS: "); + foreach (var v in d) + { + Console.WriteLine(v.Key + " | " + v.Value); + } + } + + static void world_downMineLevel(Command cmd) + { + Game1.nextMineLevel(); + } + + static void world_setMineLevel(Command cmd) + { + if (cmd.CalledArgs.Length > 0) + { + if (cmd.CalledArgs[0].IsInt32()) + { + Game1.enterMine(true, cmd.CalledArgs[0].AsInt32(), ""); + } + else + { + LogValueNotInt32(); + } + } + else + { + LogValueNotSpecified(); + } + } + static void blank_command(Command cmd) { } #endregion |