diff --git a/.gitignore b/.gitignore index 439aa86b..00cc0c56 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ StardewModdingAPI/bin/ StardewModdingAPI/obj/ +*.symlink +*.lnk !*.exe !*.dll \ No newline at end of file diff --git a/Release/StardewModdingAPI.exe b/Release/StardewModdingAPI.exe index 3167a40b..21f3c99e 100644 Binary files a/Release/StardewModdingAPI.exe and b/Release/StardewModdingAPI.exe differ 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 ", 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_addmelee", "Gives the player a melee item | player_addmelee ", new[] { "?" }).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 ", new[] { "(Int32) The target time [06:00 AM is 600]" }).CommandFired += world_setTime; Command.RegisterCommand("world_freezetime", "Freezes or thaws time | world_freezetime ", new[] { "(0 - 1) 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 ", new[] { "(Int32) The target day [1-28]" }).CommandFired += world_setDay; Command.RegisterCommand("world_setseason", "Sets the season to the specified value | world_setseason ", new[] { "(winter, spring, summer, fall) 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) 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(" is invalid"); + return; + } + } + Game1.player.addItemByMenuIfNecessary((Item) new StardewValley.Object(cmd.CalledArgs[0].AsInt32(), count)); + } + else + { + LogError(" 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(" 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 d = Game1.content.Load>("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