summaryrefslogtreecommitdiff
path: root/StardewModdingAPI
diff options
context:
space:
mode:
Diffstat (limited to 'StardewModdingAPI')
-rw-r--r--StardewModdingAPI/App.config6
-rw-r--r--StardewModdingAPI/Command.cs111
-rw-r--r--StardewModdingAPI/Events.cs20
-rw-r--r--StardewModdingAPI/Extensions.cs42
-rw-r--r--StardewModdingAPI/Mod.cs39
-rw-r--r--StardewModdingAPI/ModItem.cs25
-rw-r--r--StardewModdingAPI/Program.cs552
-rw-r--r--StardewModdingAPI/Properties/AssemblyInfo.cs36
-rw-r--r--StardewModdingAPI/StardewModdingAPI.csproj90
-rw-r--r--StardewModdingAPI/icon.icobin0 -> 4286 bytes
-rw-r--r--StardewModdingAPI/obj/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt18
-rw-r--r--StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs0
-rw-r--r--StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs0
-rw-r--r--StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs0
-rw-r--r--StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt35
-rw-r--r--StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs0
-rw-r--r--StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs0
-rw-r--r--StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs0
18 files changed, 974 insertions, 0 deletions
diff --git a/StardewModdingAPI/App.config b/StardewModdingAPI/App.config
new file mode 100644
index 00000000..8e156463
--- /dev/null
+++ b/StardewModdingAPI/App.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
+ </startup>
+</configuration> \ No newline at end of file
diff --git a/StardewModdingAPI/Command.cs b/StardewModdingAPI/Command.cs
new file mode 100644
index 00000000..1659b1e9
--- /dev/null
+++ b/StardewModdingAPI/Command.cs
@@ -0,0 +1,111 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StardewModdingAPI
+{
+ public class Command
+ {
+ internal static List<Command> RegisteredCommands = new List<Command>();
+
+ public String CommandName;
+ public String CommandDesc;
+ public String[] CommandArgs;
+ public String[] CalledArgs;
+ public delegate void CommandFireHandler(Command cmd);
+ public event CommandFireHandler CommandFired;
+
+ /// <summary>
+ /// Calls the specified command. (It runs the command)
+ /// </summary>
+ /// <param name="input">The command to run</param>
+ public static void CallCommand(string input)
+ {
+ input = input.TrimEnd(new[] {' '});
+ string[] args = new string[0];
+ Command fnd;
+ if (input.Contains(" "))
+ {
+ args = input.Split(new[] {" "}, 2, StringSplitOptions.RemoveEmptyEntries);
+ fnd = FindCommand(args[0]);
+ args = args[1].Split(new[] { " " }, 2, StringSplitOptions.RemoveEmptyEntries);
+ }
+ else
+ {
+ fnd = FindCommand(input);
+ }
+
+ if (fnd != null)
+ {
+ fnd.CalledArgs = args;
+ fnd.Fire();
+ }
+ else
+ {
+ Program.LogError("Unknown Command");
+ }
+ }
+
+ /// <summary>
+ /// Registers a command to the list of commands properly
+ /// </summary>
+ /// <param name="command">Name of the command to register</param>
+ /// <param name="cdesc">Description</param>
+ /// <param name="args">Arguments (these are purely for viewing so that a user can see what an argument needs to be)</param>
+ /// <returns></returns>
+ public static Command RegisterCommand(string command, string cdesc, string[] args = null)
+ {
+ Command c = new Command(command, cdesc, args);
+ if (RegisteredCommands.Contains(c))
+ {
+ Program.LogError("Command already registered! [{0}]", c.CommandName);
+ return RegisteredCommands.Find(x => x.Equals(c));
+ }
+
+ RegisteredCommands.Add(c);
+ Program.LogColour(ConsoleColor.Cyan, "Registered command: " + command);
+
+ return c;
+ }
+
+ /// <summary>
+ /// Looks up a command in the list of registered commands. Returns null if it doesn't exist (I think)
+ /// </summary>
+ /// <param name="name">Name of command to find</param>
+ /// <returns></returns>
+ public static Command FindCommand(string name)
+ {
+ return RegisteredCommands.Find(x => x.CommandName.Equals(name));
+ }
+
+ /// <summary>
+ /// Creates a Command from a Name, Description, and Arguments
+ /// </summary>
+ /// <param name="cname">Name</param>
+ /// <param name="cdesc">Description</param>
+ /// <param name="args">Arguments</param>
+ public Command(String cname, String cdesc, String[] args = null)
+ {
+ CommandName = cname;
+ CommandDesc = cdesc;
+ if (args == null)
+ args = new string[0];
+ CommandArgs = args;
+ }
+
+ /// <summary>
+ /// Runs a command. Fires it. Calls it. Any of those.
+ /// </summary>
+ public void Fire()
+ {
+ if (CommandFired == null)
+ {
+ Program.LogError("Command failed to fire because it's fire event is null: " + CommandName);
+ return;
+ }
+ CommandFired.Invoke(this);
+ }
+ }
+}
diff --git a/StardewModdingAPI/Events.cs b/StardewModdingAPI/Events.cs
new file mode 100644
index 00000000..1ec5e74a
--- /dev/null
+++ b/StardewModdingAPI/Events.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StardewModdingAPI
+{
+ public static class Events
+ {
+ public delegate void BlankEventHandler();
+
+ public static event BlankEventHandler GameLoaded = delegate {};
+
+ public static void InvokeGameLoaded()
+ {
+ GameLoaded.Invoke();
+ }
+ }
+}
diff --git a/StardewModdingAPI/Extensions.cs b/StardewModdingAPI/Extensions.cs
new file mode 100644
index 00000000..0078ebe9
--- /dev/null
+++ b/StardewModdingAPI/Extensions.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Input;
+
+namespace StardewModdingAPI
+{
+ public static class Extensions
+ {
+ public static Random Random = new Random();
+
+ public static bool IsKeyDown(this Keys key)
+ {
+ return Keyboard.GetState().IsKeyDown(key);
+ }
+
+ public static Color RandomColour()
+ {
+ return new Color(Random.Next(0, 255), Random.Next(0, 255), Random.Next(0, 255));
+ }
+
+ public static string ToSingular(this IEnumerable<Object> enumerable)
+ {
+ string result = string.Join(", ", enumerable);
+ return result;
+ }
+
+ public static bool IsInt32(this string s)
+ {
+ int i;
+ return Int32.TryParse(s, out i);
+ }
+
+ public static Int32 AsInt32(this string s)
+ {
+ return Int32.Parse(s);
+ }
+ }
+} \ No newline at end of file
diff --git a/StardewModdingAPI/Mod.cs b/StardewModdingAPI/Mod.cs
new file mode 100644
index 00000000..32021b4a
--- /dev/null
+++ b/StardewModdingAPI/Mod.cs
@@ -0,0 +1,39 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace StardewModdingAPI
+{
+ public class Mod
+ {
+ /// <summary>
+ /// The name of your mod.
+ /// </summary>
+ public virtual string Name { get; protected set; }
+
+ /// <summary>
+ /// The name of the mod's authour.
+ /// </summary>
+ public virtual string Authour { get; protected set; }
+
+ /// <summary>
+ /// The version of the mod.
+ /// </summary>
+ public virtual string Version { get; protected set; }
+
+ /// <summary>
+ /// A description of the mod.
+ /// </summary>
+ public virtual string Description { get; protected set; }
+
+ /// <summary>
+ /// A basic method that is the entry-point of your mod. It will always be called once when the mod loads.
+ /// </summary>
+ public virtual void Entry()
+ {
+
+ }
+ }
+}
diff --git a/StardewModdingAPI/ModItem.cs b/StardewModdingAPI/ModItem.cs
new file mode 100644
index 00000000..b1323bf4
--- /dev/null
+++ b/StardewModdingAPI/ModItem.cs
@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using StardewValley;
+
+namespace StardewModdingAPI
+{
+ class ModItem : StardewValley.Object
+ {
+ public Item AsItem { get { return (Item) this; } }
+ public override string Name { get; set; }
+ public string Description { get; set; }
+ public int ID { get; set; }
+ public Texture2D Texture { get; set; }
+
+ public ModItem()
+ {
+
+ }
+ }
+}
diff --git a/StardewModdingAPI/Program.cs b/StardewModdingAPI/Program.cs
new file mode 100644
index 00000000..fb6ce115
--- /dev/null
+++ b/StardewModdingAPI/Program.cs
@@ -0,0 +1,552 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using Microsoft.Xna.Framework;
+using Microsoft.Xna.Framework.Graphics;
+using Microsoft.Xna.Framework.Input;
+using StardewValley;
+using StardewValley.Menus;
+using StardewValley.Network;
+using Keys = Microsoft.Xna.Framework.Input.Keys;
+
+namespace StardewModdingAPI
+{
+ public class Program
+ {
+ public static string DataPath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley"));
+ public static string ModPath = Path.Combine(Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley")), "Mods");
+
+ public static Game1 gamePtr;
+ public static bool ready;
+
+ public static Assembly StardewAssembly;
+ public static Type StardewProgramType;
+ public static FieldInfo StardewGameInfo;
+ public static Form StardewForm;
+
+ public static Thread gameThread;
+ public static Thread consoleInputThread;
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ private static void Main(string[] args)
+ {
+ Console.Title = "Stardew Modding API Console";
+
+ if (File.Exists(ModPath))
+ File.Delete(ModPath);
+ if (!Directory.Exists(ModPath))
+ Directory.CreateDirectory(ModPath);
+
+ Log(Assembly.GetExecutingAssembly().Location);
+ LogInfo("Initializing SDV Assembly...");
+ StardewAssembly = AppDomain.CurrentDomain.GetAssemblies().First(x => x.GetName().Name.Equals("Stardew Valley"));
+ StardewProgramType = StardewAssembly.GetType("StardewValley.Program", true);
+ StardewGameInfo = StardewProgramType.GetField("gamePtr");
+
+ LogInfo("Injecting New SDV Version...");
+ Game1.version += "-Z_MODDED";
+
+ gameThread = new Thread(RunGame);
+ LogInfo("Starting SDV...");
+ gameThread.Start();
+
+ while (!ready)
+ {
+
+ }
+
+ Log("SDV Loaded Into Memory");
+
+ consoleInputThread = new Thread(ConsoleInputThread);
+ LogInfo("Initializing Console Input Thread...");
+ consoleInputThread.Start();
+
+
+ LogInfo("Applying Final SDV Tweaks...");
+ StardewInvoke(() =>
+ {
+ gamePtr.IsMouseVisible = false;
+ gamePtr.Window.Title = "Stardew Valley";
+ });
+
+ LogInfo("Game Loaded");
+ LogColour(ConsoleColor.Cyan, "Type 'help' for help, or 'help <cmd>' for a command's usage");
+ Events.InvokeGameLoaded();
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ public static void RunGame()
+ {
+ try
+ {
+ gamePtr = new Game1();
+ Game1.graphics.GraphicsProfile = GraphicsProfile.HiDef;
+ LoadMods();
+
+ StardewForm = Control.FromHandle(Program.gamePtr.Window.Handle).FindForm();
+ StardewGameInfo.SetValue(StardewProgramType, gamePtr);
+
+ KeyboardInput.KeyDown += KeyboardInput_KeyDown;
+
+ ready = true;
+
+ gamePtr.Run();
+ }
+ catch (Exception ex)
+ {
+ LogError("Game failed to start: " + ex);
+ }
+ if (consoleInputThread != null && consoleInputThread.ThreadState == ThreadState.Running)
+ consoleInputThread.Abort();
+ Log("Game Execution Finished");
+ Console.ReadKey();
+ Environment.Exit(0);
+ }
+
+ public static void LoadMods()
+ {
+ LogColour(ConsoleColor.Green, "LOADING MODS");
+ foreach (String s in Directory.GetFiles(ModPath, "*.dll"))
+ {
+ LogColour(ConsoleColor.Green, "Found DLL: " + s);
+ Assembly mod = Assembly.LoadFile(s);
+
+ if (mod.DefinedTypes.Count(x => x.BaseType == typeof (Mod)) > 0)
+ {
+ LogColour(ConsoleColor.Green, "Loading Mod DLL...");
+ TypeInfo tar = mod.DefinedTypes.First(x => x.BaseType == typeof(Mod));
+ Mod m = (Mod)mod.CreateInstance(tar.ToString());
+ Console.WriteLine("LOADED MOD: {0} by {1} - Version {2} | Description: {3}", m.Name, m.Authour, m.Version, m.Description);
+ m.Entry();
+ }
+ else
+ {
+ LogError("Invalid Mod DLL");
+ }
+ }
+ }
+
+ public static void ConsoleInputThread()
+ {
+ string input = string.Empty;
+
+ RegisterCommands();
+
+ while (true)
+ {
+ Command.CallCommand(Console.ReadLine());
+ }
+ }
+
+ static void KeyboardInput_KeyDown(object sender, StardewValley.KeyEventArgs e)
+ {
+ switch (e.KeyCode)
+ {
+ case Keys.B:
+ Game1.player.hairstyleColor = Extensions.RandomColour();
+ break;
+ case Keys.OemPlus:
+ Game1.player.Money += 5000;
+ break;
+ }
+ }
+
+ public static void StardewInvoke(Action a)
+ {
+ StardewForm.Invoke(a);
+ }
+
+
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+ #region Commands
+
+ public static void RegisterCommands()
+ {
+ Command.RegisterCommand("help", "Lists all commands | 'help <cmd>' returns command description").CommandFired += help_CommandFired;
+ Command.RegisterCommand("types", "Lists all value types | types").CommandFired += types_CommandFired;
+
+ Command.RegisterCommand("hide", "Hides the game form | hide").CommandFired += hide_CommandFired;
+ Command.RegisterCommand("show", "Shows the game form | show").CommandFired += show_CommandFired;
+
+ Command.RegisterCommand("save", "Saves the game? Doesn't seem to work. | save").CommandFired += save_CommandFired;
+
+ Command.RegisterCommand("exit", "Closes the game | exit").CommandFired += exit_CommandFired;
+ Command.RegisterCommand("stop", "Closes the game | stop").CommandFired += exit_CommandFired;
+
+ Command.RegisterCommand("player_setname", "Sets the player's name | player_setname <object> <value>", new[] { "(player, pet, farm)<object> (String)<value> The target name" }).CommandFired += player_setName;
+ Command.RegisterCommand("player_setmoney", "Sets the player's money | player_setmoney <value>", new[] { "(Int32)<value> The target money" }).CommandFired += player_setMoney;
+ Command.RegisterCommand("player_setenergy", "Sets the player's energy | player_setenergy <value>", new[] { "(Int32)<value> The target energy" }).CommandFired += player_setEnergy;
+ Command.RegisterCommand("player_setmaxenergy", "Sets the player's max energy | player_setmaxenergy <value>", new[] { "(Int32)<value> The target max energy" }).CommandFired += player_setMaxEnergy;
+
+ Command.RegisterCommand("player_setlevel", "Sets the player's specified skill to the specified value | player_setlevel <skill> <value>", new[] { "(luck, mining, combat, farming, fishing, foraging)<skill> (1-10)<value> The target level" }).CommandFired += player_setLevel;
+ Command.RegisterCommand("player_setspeed", "Sets the player's speed to the specified value?", new[] {"(Int32:5)<value> The target speed"}).CommandFired += player_setSpeed;
+ 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;
+
+ }
+
+ static void help_CommandFired(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 0)
+ {
+ Command fnd = Command.FindCommand(cmd.CalledArgs[0]);
+ if (fnd == null)
+ LogError("The command specified could not be found");
+ else
+ {
+ if (fnd.CommandArgs.Length > 0)
+ LogInfo("{0}: {1} - {2}", fnd.CommandName, fnd.CommandDesc, fnd.CommandArgs.ToSingular());
+ else
+ LogInfo("{0}: {1}", fnd.CommandName, fnd.CommandDesc);
+ }
+ }
+ else
+ LogInfo("Commands: " + Command.RegisteredCommands.Select(x => x.CommandName).ToSingular());
+ }
+
+ static void types_CommandFired(Command cmd)
+ {
+ LogInfo("[Int32: {0} - {1}], [Int64: {2} - {3}], [String: \"raw text\"], [Colour: r,g,b (EG: 128, 32, 255)]", Int32.MinValue, Int32.MaxValue, Int64.MinValue, Int64.MaxValue);
+ }
+
+ static void hide_CommandFired(Command cmd)
+ {
+ StardewInvoke(() => { StardewForm.Hide(); });
+ }
+
+ static void show_CommandFired(Command cmd)
+ {
+ StardewInvoke(() => { StardewForm.Show(); });
+ }
+
+ static void save_CommandFired(Command cmd)
+ {
+ StardewValley.SaveGame.Save();
+ }
+
+ static void exit_CommandFired(Command cmd)
+ {
+ Application.Exit();
+ Environment.Exit(0);
+ }
+
+ static void player_setName(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 1)
+ {
+ string obj = cmd.CalledArgs[0];
+ string[] objs = "player,pet,farm".Split(new[] {','});
+ if (objs.Contains(obj))
+ {
+ switch (obj)
+ {
+ case "player":
+ Game1.player.Name = cmd.CalledArgs[1];
+ break;
+ case "pet":
+ LogError("Pets cannot currently be renamed.");
+ break;
+ case "farm":
+ Game1.player.farmName = cmd.CalledArgs[1];
+ break;
+ }
+ }
+ else
+ {
+ LogError("<object> is invalid");
+ }
+ }
+ else
+ {
+ LogError("<object> and <value> must be specified");
+ }
+ }
+
+ static void player_setMoney(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 0)
+ {
+ int ou = 0;
+ if (Int32.TryParse(cmd.CalledArgs[0], out ou))
+ {
+ Game1.player.Money = ou;
+ LogInfo("Set {0}'s money to {1}", Game1.player.Name, Game1.player.Money);
+ }
+ else
+ {
+ LogError("<value> must be a whole number (Int32)");
+ }
+ }
+ else
+ {
+ LogError("<value> must be specified");
+ }
+ }
+
+ static void player_setEnergy(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 0)
+ {
+ int ou = 0;
+ if (Int32.TryParse(cmd.CalledArgs[0], out ou))
+ {
+ Game1.player.Stamina = ou;
+ LogInfo("Set {0}'s energy to {1}", Game1.player.Name, Game1.player.Stamina);
+ }
+ else
+ {
+ LogError("<value> must be a whole number (Int32)");
+ }
+ }
+ else
+ {
+ LogError("<value> must be specified");
+ }
+ }
+
+ static void player_setMaxEnergy(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 0)
+ {
+ int ou = 0;
+ if (Int32.TryParse(cmd.CalledArgs[0], out ou))
+ {
+ Game1.player.MaxStamina = ou;
+ LogInfo("Set {0}'s max energy to {1}", Game1.player.Name, Game1.player.MaxStamina);
+ }
+ else
+ {
+ LogError("<value> must be a whole number (Int32)");
+ }
+ }
+ else
+ {
+ LogError("<value> must be specified");
+ }
+ }
+
+ static void player_setLevel(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 1)
+ {
+ string skill = cmd.CalledArgs[0];
+ string[] skills = "luck,mining,combat,farming,fishing,foraging".Split(new[] { ',' });
+ if (skills.Contains(skill))
+ {
+ int ou = 0;
+ if (Int32.TryParse(cmd.CalledArgs[1], out ou))
+ {
+ switch (skill)
+ {
+ case "luck":
+ Game1.player.LuckLevel = ou;
+ break;
+ case "mining":
+ Game1.player.MiningLevel = ou;
+ break;
+ case "combat":
+ Game1.player.CombatLevel = ou;
+ break;
+ case "farming":
+ Game1.player.FarmingLevel = ou;
+ break;
+ case "fishing":
+ Game1.player.FishingLevel = ou;
+ break;
+ case "foraging":
+ Game1.player.ForagingLevel = ou;
+ break;
+ }
+ }
+ else
+ {
+ LogError("<value> must be a whole number (Int32)");
+ }
+ }
+ else
+ {
+ LogError("<skill> is invalid");
+ }
+ }
+ else
+ {
+ LogError("<skill> and <value> must be specified");
+ }
+ }
+
+ static void player_setSpeed(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 0)
+ {
+ if (cmd.CalledArgs[0].IsInt32())
+ {
+ Game1.player.Speed = cmd.CalledArgs[0].AsInt32();
+ LogInfo("Set {0}'s speed to {1}", Game1.player.Name, Game1.player.Speed);
+ }
+ else
+ {
+ LogError("<value> must be a whole number (Int32)");
+ }
+ }
+ else
+ {
+ LogError("<value> must be specified");
+ }
+ }
+
+
+ static void player_changeColour(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 1)
+ {
+ string obj = cmd.CalledArgs[0];
+ string[] objs = "hair,eyes,pants".Split(new[] { ',' });
+ if (objs.Contains(obj))
+ {
+ string[] cs = cmd.CalledArgs[1].Split(new[] {','}, 3);
+ if (cs[0].IsInt32() && cs[1].IsInt32() && cs[2].IsInt32())
+ {
+ Color c = new Color(cs[0].AsInt32(), cs[1].AsInt32(), cs[2].AsInt32());
+ switch (obj)
+ {
+ case "hair":
+ Game1.player.hairstyleColor = c;
+ break;
+ case "eyes":
+ Game1.player.changeEyeColor(c);
+ break;
+ case "pants":
+ Game1.player.pantsColor = c;
+ break;
+ }
+ }
+ else
+ {
+ LogError("<colour> is invalid");
+ }
+ }
+ else
+ {
+ LogError("<object> is invalid");
+ }
+ }
+ else
+ {
+ LogError("<object> and <colour> must be specified");
+ }
+ }
+
+ static void player_changeStyle(Command cmd)
+ {
+ if (cmd.CalledArgs.Length > 1)
+ {
+ string obj = cmd.CalledArgs[0];
+ string[] objs = "hair,shirt,skin,acc,shoe,swim,gender".Split(new[] { ',' });
+ if (objs.Contains(obj))
+ {
+ if (cmd.CalledArgs[1].IsInt32())
+ {
+ int i = cmd.CalledArgs[1].AsInt32();
+ switch (obj)
+ {
+ case "hair":
+ Game1.player.changeHairStyle(i);
+ break;
+ case "shirt":
+ Game1.player.changeShirt(i);
+ break;
+ case "acc":
+ Game1.player.changeAccessory(i);
+ break;
+ case "skin":
+ Game1.player.changeSkinColor(i);
+ break;
+ case "shoe":
+ Game1.player.changeShoeColor(i);
+ break;
+ case "swim":
+ if (i == 0)
+ Game1.player.changeOutOfSwimSuit();
+ else if (i == 1)
+ Game1.player.changeIntoSwimsuit();
+ else
+ LogError("<value> must be 0 or 1 for this <object>");
+ break;
+ case "gender":
+ if (i == 0)
+ Game1.player.changeGender(true);
+ else if (i == 1)
+ Game1.player.changeGender(false);
+ else
+ LogError("<value> must be 0 or 1 for this <object>");
+ break;
+ }
+ }
+ else
+ {
+ LogError("<value> is invalid");
+ }
+ }
+ else
+ {
+ LogError("<object> is invalid");
+ }
+ }
+ else
+ {
+ LogError("<object> and <value> must be specified");
+ }
+ }
+
+ #endregion
+
+
+
+ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+
+ #region Logging
+
+ public static void Log(object o, params object[] format)
+ {
+ Console.WriteLine("[{0}] {1}", System.DateTime.Now.ToLongTimeString(), String.Format(o.ToString(), format));
+ }
+
+ public static void LogColour(ConsoleColor c, object o, params object[] format)
+ {
+ Console.ForegroundColor = c;
+ Log(o.ToString(), format);
+ Console.ForegroundColor = ConsoleColor.Gray;
+ }
+
+ public static void LogInfo(object o, params object[] format)
+ {
+ Console.ForegroundColor = ConsoleColor.Yellow;
+ Log(o.ToString(), format);
+ Console.ForegroundColor = ConsoleColor.Gray;
+ }
+
+ public static void LogError(object o, params object[] format)
+ {
+ Console.ForegroundColor = ConsoleColor.Red;
+ Log(o.ToString(), format);
+ Console.ForegroundColor = ConsoleColor.Gray;
+ }
+
+ #endregion
+ }
+}
diff --git a/StardewModdingAPI/Properties/AssemblyInfo.cs b/StardewModdingAPI/Properties/AssemblyInfo.cs
new file mode 100644
index 00000000..c9a2a11c
--- /dev/null
+++ b/StardewModdingAPI/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("StardewModdingAPI")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("StardewModdingAPI")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("5c3f7f42-fefd-43db-aaea-92ea3bcad531")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/StardewModdingAPI/StardewModdingAPI.csproj b/StardewModdingAPI/StardewModdingAPI.csproj
new file mode 100644
index 00000000..3b9d4a39
--- /dev/null
+++ b/StardewModdingAPI/StardewModdingAPI.csproj
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>StardewModdingAPI</RootNamespace>
+ <AssemblyName>StardewModdingAPI</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <SccProjectName>SAK</SccProjectName>
+ <SccLocalPath>SAK</SccLocalPath>
+ <SccAuxPath>SAK</SccAuxPath>
+ <SccProvider>SAK</SccProvider>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
+ <PlatformTarget>x86</PlatformTarget>
+ <OutputPath>bin\x86\Debug\</OutputPath>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
+ <PlatformTarget>x86</PlatformTarget>
+ <OutputPath>bin\x86\Release\</OutputPath>
+ </PropertyGroup>
+ <PropertyGroup>
+ <ApplicationIcon>icon.ico</ApplicationIcon>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+ <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+ <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+ <Reference Include="Microsoft.Xna.Framework.Xact, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
+ <Reference Include="Stardew Valley, Version=1.0.5900.38427, Culture=neutral, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Windows.Forms" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Command.cs" />
+ <Compile Include="Events.cs" />
+ <Compile Include="Extensions.cs" />
+ <Compile Include="Mod.cs" />
+ <Compile Include="ModItem.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="icon.ico" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/StardewModdingAPI/icon.ico b/StardewModdingAPI/icon.ico
new file mode 100644
index 00000000..2985c5cd
--- /dev/null
+++ b/StardewModdingAPI/icon.ico
Binary files differ
diff --git a/StardewModdingAPI/obj/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt b/StardewModdingAPI/obj/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt
new file mode 100644
index 00000000..1f43f37e
--- /dev/null
+++ b/StardewModdingAPI/obj/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt
@@ -0,0 +1,18 @@
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\StardewModdingAPI.exe.config
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\StardewModdingAPI.exe
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\StardewModdingAPI.pdb
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Microsoft.Xna.Framework.dll
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Microsoft.Xna.Framework.Game.dll
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Microsoft.Xna.Framework.Graphics.dll
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Microsoft.Xna.Framework.Xact.dll
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Stardew Valley.exe
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\xTile.dll
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Lidgren.Network.dll
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Steamworks.NET.dll
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Microsoft.Xna.Framework.xml
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Microsoft.Xna.Framework.Game.xml
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Microsoft.Xna.Framework.Graphics.xml
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\Debug\Microsoft.Xna.Framework.Xact.xml
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\obj\Debug\StardewModdingAPI.csprojResolveAssemblyReference.cache
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\obj\Debug\StardewModdingAPI.exe
+c:\users\zoryn\documents\visual studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\obj\Debug\StardewModdingAPI.pdb
diff --git a/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
diff --git a/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
diff --git a/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/StardewModdingAPI/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
diff --git a/StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt b/StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt
new file mode 100644
index 00000000..c9ca0a86
--- /dev/null
+++ b/StardewModdingAPI/obj/x86/Debug/StardewModdingAPI.csproj.FileListAbsolute.txt
@@ -0,0 +1,35 @@
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Stardew Valley.exe
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\xTile.dll
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Lidgren.Network.dll
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Steamworks.NET.dll
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.csprojResolveAssemblyReference.cache
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\WindowsGame1.exe
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\WindowsGame1.pdb
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe.config
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.pdb
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.exe
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.pdb
+C:\Users\Zoryn\Documents\Visual Studio 2013\Projects\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Stardew Valley.pdb
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe.config
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.exe
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.pdb
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.pdb
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Stardew Valley.exe
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\WindowsGame1.exe
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\xTile.dll
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Lidgren.Network.dll
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Steamworks.NET.dll
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\WindowsGame1.pdb
+C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.csprojResolveAssemblyReference.cache
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe.config
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.exe
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.pdb
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.pdb
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Stardew Valley.exe
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\xTile.dll
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Lidgren.Network.dll
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Steamworks.NET.dll
+C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.csprojResolveAssemblyReference.cache
diff --git a/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
diff --git a/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
diff --git a/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/StardewModdingAPI/obj/x86/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs