export trainer to separate mod; ships with modapi in release folder

This commit is contained in:
Zoryn Aaron 2016-03-01 16:16:51 -05:00
parent e07a721f5a
commit ad683d0a0f
15 changed files with 842 additions and 708 deletions

BIN
Release/Mods/TrainerMod.dll Normal file

Binary file not shown.

Binary file not shown.

View File

@ -5,31 +5,40 @@ VisualStudioVersion = 12.0.40629.0
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewModdingAPI", "StardewModdingAPI\StardewModdingAPI.csproj", "{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StardewModdingAPI", "StardewModdingAPI\StardewModdingAPI.csproj", "{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrainerMod", "TrainerMod\TrainerMod.csproj", "{28480467-1A48-46A7-99F8-236D95225359}"
EndProject
Global Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://zoryn.visualstudio.com/defaultcollection
SccLocalPath0 = .
SccProjectUniqueName1 = StardewModdingAPI\\StardewModdingAPI.csproj
SccProjectName1 = StardewModdingAPI
SccLocalPath1 = StardewModdingAPI
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|x86 = Debug|x86 Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|x86 = Release|x86 Release|x86 = Release|x86
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|Mixed Platforms.Build.0 = Debug|x86
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|x86.ActiveCfg = Debug|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|x86.ActiveCfg = Debug|x86
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|x86.Build.0 = Debug|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Debug|x86.Build.0 = Debug|x86
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Any CPU.Build.0 = Release|Any CPU {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Any CPU.Build.0 = Release|Any CPU
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Mixed Platforms.ActiveCfg = Release|x86
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|Mixed Platforms.Build.0 = Release|x86
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|x86.ActiveCfg = Release|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|x86.ActiveCfg = Release|x86
{F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|x86.Build.0 = Release|x86 {F1A573B0-F436-472C-AE29-0B91EA6B9F8F}.Release|x86.Build.0 = Release|x86
{28480467-1A48-46A7-99F8-236D95225359}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Debug|x86.ActiveCfg = Debug|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Release|Any CPU.Build.0 = Release|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{28480467-1A48-46A7-99F8-236D95225359}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -47,9 +47,6 @@ namespace StardewModdingAPI
public static Thread gameThread; public static Thread gameThread;
public static Thread consoleInputThread; public static Thread consoleInputThread;
public static int frozenTime;
public static bool infHealth, infStamina, infMoney, freezeTime;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
private static void Main(string[] args) private static void Main(string[] args)
@ -87,34 +84,6 @@ namespace StardewModdingAPI
StardewProgramType = StardewAssembly.GetType("StardewValley.Program", true); StardewProgramType = StardewAssembly.GetType("StardewValley.Program", true);
StardewGameInfo = StardewProgramType.GetField("gamePtr"); StardewGameInfo = StardewProgramType.GetField("gamePtr");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//HOLY FUCKING SHIT IGNORE THIS I JUST WANTED TO OVERRIDE A NON VIRTUAL METHOD
/*int fieldOffset = 0;
foreach (FieldInfo sourceField in sourceFields)
{
FieldBuilder fieldBuilder
= tb.DefineField(
sourceField.Name,
sourceField.FieldType,
FieldAttributes.Public);
fieldBuilder.SetOffset(fieldOffset);
fieldOffset++;
}*/
//Type dynamicType = tb.CreateType();
//System.Object dynObj = Activator.CreateInstance(dynamicType);
/*foreach (FieldInfo sourceField in sourceFields)
{
FieldInfo destField
= dynObj.GetType().GetField(sourceField.Name);
destField.SetValue(dynObj, sourceField.GetValue(sourceObject));
}*/
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
LogInfo("Injecting New SDV Version..."); LogInfo("Injecting New SDV Version...");
@ -135,10 +104,10 @@ namespace StardewModdingAPI
consoleInputThread = new Thread(ConsoleInputThread); consoleInputThread = new Thread(ConsoleInputThread);
LogInfo("Initializing Console Input Thread..."); LogInfo("Initializing Console Input Thread...");
RegisterCommands();
Command.RegisterCommand("help", "Lists all commands | 'help <cmd>' returns command description").CommandFired += help_CommandFired;
Events.KeyPressed += Events_KeyPressed; Events.KeyPressed += Events_KeyPressed;
Events.UpdateTick += Events_UpdateTick;
Events.LoadContent += Events_LoadContent; Events.LoadContent += Events_LoadContent;
//Events.MenuChanged += Events_MenuChanged; //Events.MenuChanged += Events_MenuChanged;
Events.LocationsChanged += Events_LocationsChanged; Events.LocationsChanged += Events_LocationsChanged;
@ -288,26 +257,6 @@ namespace StardewModdingAPI
} }
static void Events_UpdateTick()
{
if (infHealth)
{
Game1.player.health = Game1.player.maxHealth;
}
if (infStamina)
{
Game1.player.stamina = Game1.player.MaxStamina;
}
if (infMoney)
{
Game1.player.money = 999999;
}
if (freezeTime)
{
Game1.timeOfDay = frozenTime;
}
}
static void Events_MenuChanged(IClickableMenu newMenu) static void Events_MenuChanged(IClickableMenu newMenu)
{ {
LogInfo("NEW MENU: " + newMenu.GetType()); LogInfo("NEW MENU: " + newMenu.GetType());
@ -350,50 +299,6 @@ namespace StardewModdingAPI
#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("load", "Shows the load screen | load").CommandFired += load_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>|inf", new[] { "(Int32)<value> The target money" }).CommandFired += player_setMoney;
Command.RegisterCommand("player_setstamina", "Sets the player's stamina | player_setstamina <value>|inf", new[] { "(Int32)<value> The target stamina" }).CommandFired += player_setStamina;
Command.RegisterCommand("player_setmaxstamina", "Sets the player's max stamina | player_setmaxstamina <value>", new[] { "(Int32)<value> The target max stamina" }).CommandFired += player_setMaxStamina;
Command.RegisterCommand("player_sethealth", "Sets the player's health | player_sethealth <value>|inf", new[] { "(Int32)<value> The target health" }).CommandFired += player_setHealth;
Command.RegisterCommand("player_setmaxhealth", "Sets the player's max health | player_setmaxhealth <value>", new[] { "(Int32)<value> The target max health" }).CommandFired += player_setMaxHealth;
Command.RegisterCommand("player_setimmunity", "Sets the player's immunity | player_setimmunity <value>", new[] { "(Int32)<value> The target immunity" }).CommandFired += player_setImmunity;
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)<value> The target speed [0 is normal]"}).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;
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("newitem", "Outputs a list of melee weapons | out_melee", new[] { "" }).CommandFired += RegisterNewItem;
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) static void help_CommandFired(Command cmd)
{ {
if (cmd.CalledArgs.Length > 0) if (cmd.CalledArgs.Length > 0)
@ -413,602 +318,6 @@ namespace StardewModdingAPI
LogInfo("Commands: " + Command.RegisteredCommands.Select(x => x.CommandName).ToSingular()); 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 load_CommandFired(Command cmd)
{
Game1.activeClickableMenu = new StardewValley.Menus.LoadGameMenu();
}
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
{
LogObjectInvalid();
}
}
else
{
LogObjectValueNotSpecified();
}
}
static void player_setMoney(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0] == "inf")
{
infMoney = true;
}
else
{
infMoney = false;
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
{
LogValueNotInt32();
}
}
}
else
{
LogValueNotSpecified();
}
}
static void player_setStamina(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0] == "inf")
{
infStamina = true;
}
else
{
infStamina = false;
int ou = 0;
if (Int32.TryParse(cmd.CalledArgs[0], out ou))
{
Game1.player.Stamina = ou;
LogInfo("Set {0}'s stamina to {1}", Game1.player.Name, Game1.player.Stamina);
}
else
{
LogValueNotInt32();
}
}
}
else
{
LogValueNotSpecified();
}
}
static void player_setMaxStamina(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 stamina to {1}", Game1.player.Name, Game1.player.MaxStamina);
}
else
{
LogValueNotInt32();
}
}
else
{
LogValueNotSpecified();
}
}
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
{
LogValueNotInt32();
}
}
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.addedSpeed = cmd.CalledArgs[0].AsInt32();
LogInfo("Set {0}'s added speed to {1}", Game1.player.Name, Game1.player.addedSpeed);
}
else
{
LogValueNotInt32();
}
}
else
{
LogValueNotSpecified();
}
}
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
{
LogObjectInvalid();
}
}
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
{
LogValueInvalid();
}
}
else
{
LogObjectInvalid();
}
}
else
{
LogObjectValueNotSpecified();
}
}
static void world_freezeTime(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
if (cmd.CalledArgs[0].AsInt32() == 0 || cmd.CalledArgs[0].AsInt32() == 1)
{
freezeTime = cmd.CalledArgs[0].AsInt32() == 1;
frozenTime = freezeTime ? Game1.timeOfDay : 0;
LogInfo("Time is now " + (freezeTime ? "frozen" : "thawed"));
}
else
{
LogError("<value> should be 0 or 1");
}
}
else
{
LogValueNotInt32();
}
}
else
{
LogValueNotSpecified();
}
}
static void world_setTime(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
if (cmd.CalledArgs[0].AsInt32() <= 2600 && cmd.CalledArgs[0].AsInt32() >= 600)
{
Game1.timeOfDay = cmd.CalledArgs[0].AsInt32();
frozenTime = freezeTime ? Game1.timeOfDay : 0;
LogInfo("Time set to: " + Game1.timeOfDay);
}
else
{
LogError("<value> should be between 600 and 2600 (06:00 AM - 02:00 AM [NEXT DAY])");
}
}
else
{
LogValueNotInt32();
}
}
else
{
LogValueNotSpecified();
}
}
static void world_setDay(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
if (cmd.CalledArgs[0].AsInt32() <= 28 && cmd.CalledArgs[0].AsInt32() > 0)
{
Game1.dayOfMonth = cmd.CalledArgs[0].AsInt32();
}
else
{
LogError("<value> must be between 1 and 28");
}
}
else
{
LogValueNotInt32();
}
}
else
{
LogValueNotSpecified();
}
}
static void world_setSeason(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
string obj = cmd.CalledArgs[0];
string[] objs = "winter,spring,summer,fall".Split(new []{','});
if (objs.Contains(obj))
{
Game1.currentSeason = obj;
}
else
{
LogValueInvalid();
}
}
else
{
LogValueNotSpecified();
}
}
static void player_setHealth(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0] == "inf")
{
infHealth = true;
}
else
{
infHealth = false;
if (cmd.CalledArgs[0].IsInt32())
{
Game1.player.health = cmd.CalledArgs[0].AsInt32();
}
else
{
LogValueNotInt32();
}
}
}
else
{
LogValueNotSpecified();
}
}
static void player_setMaxHealth(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
Game1.player.maxHealth = cmd.CalledArgs[0].AsInt32();
}
else
{
LogValueNotInt32();
}
}
else
{
LogValueNotSpecified();
}
}
static void player_setImmunity(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
Game1.player.immunity = cmd.CalledArgs[0].AsInt32();
}
else
{
LogValueNotInt32();
}
}
else
{
LogValueNotSpecified();
}
}
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);
if (it.Name != "Error Item")
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) { }
static void RegisterNewItem(Command cmd)
{
Game1.player.addItemToInventory(SGame.PullModItemFromDict(0, true));
}
#endregion
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -47,7 +47,9 @@
<ApplicationIcon>icon.ico</ApplicationIcon> <ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" /> <Reference Include="Microsoft.QualityTools.Testing.Fakes, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" /> <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.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.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" />
@ -56,6 +58,7 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath> <HintPath>..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
<EmbedInteropTypes>False</EmbedInteropTypes> <EmbedInteropTypes>False</EmbedInteropTypes>
<Private>False</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
@ -69,6 +72,7 @@
<Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86"> <Reference Include="xTile, Version=2.0.4.0, Culture=neutral, processorArchitecture=x86">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>D:\#Network-Steam\SteamRepo\steamapps\common\Stardew Valley\xTile.dll</HintPath> <HintPath>D:\#Network-Steam\SteamRepo\steamapps\common\Stardew Valley\xTile.dll</HintPath>
<Private>False</Private>
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -23,13 +23,9 @@ C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Lid
C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Steamworks.NET.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\bin\x86\Debug\WindowsGame1.pdb
C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.csprojResolveAssemblyReference.cache C:\Users\zoryn\Desktop\SDV\StardewModdingAPI\StardewModdingAPI\obj\x86\Debug\StardewModdingAPI.csprojResolveAssemblyReference.cache
C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\steam_appid.txt
C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe.config C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe.config
C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\StardewModdingAPI.exe 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\StardewModdingAPI.pdb
C:\TFSource\Master-Collection\StardewModdingAPI\StardewModdingAPI\bin\x86\Debug\Microsoft.QualityTools.Testing.Fakes.dll
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.exe 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\obj\x86\Debug\StardewModdingAPI.pdb

View File

@ -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("TrainerMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TrainerMod")]
[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("76791e28-b1b5-407c-82d6-50c3e5b7e037")]
// 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")]

700
TrainerMod/TrainerMod.cs Normal file
View File

@ -0,0 +1,700 @@
using StardewModdingAPI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mime;
using System.Text;
using System.Threading.Tasks;
using StardewModdingAPI.Inheritance;
using StardewValley;
using StardewValley.Tools;
using Microsoft.Xna.Framework;
namespace TrainerMod
{
public class TrainerMod : Mod
{
public override string Name
{
get { return "Trainer Mod"; }
}
public override string Authour
{
get { return "Zoryn Aaron"; }
}
public override string Version
{
get { return "1.0"; }
}
public override string Description
{
get { return "Registers several commands to use. Most commands are trainer-like in that they offer forms of cheating."; }
}
public static int frozenTime;
public static bool infHealth, infStamina, infMoney, freezeTime;
public override void Entry()
{
RegisterCommands();
Events.UpdateTick += Events_UpdateTick;
}
static void Events_UpdateTick()
{
if (infHealth)
{
Game1.player.health = Game1.player.maxHealth;
}
if (infStamina)
{
Game1.player.stamina = Game1.player.MaxStamina;
}
if (infMoney)
{
Game1.player.money = 999999;
}
if (freezeTime)
{
Game1.timeOfDay = frozenTime;
}
}
public static void RegisterCommands()
{
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("load", "Shows the load screen | load").CommandFired += load_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>|inf", new[] { "(Int32)<value> The target money" }).CommandFired += player_setMoney;
Command.RegisterCommand("player_setstamina", "Sets the player's stamina | player_setstamina <value>|inf", new[] { "(Int32)<value> The target stamina" }).CommandFired += player_setStamina;
Command.RegisterCommand("player_setmaxstamina", "Sets the player's max stamina | player_setmaxstamina <value>", new[] { "(Int32)<value> The target max stamina" }).CommandFired += player_setMaxStamina;
Command.RegisterCommand("player_sethealth", "Sets the player's health | player_sethealth <value>|inf", new[] { "(Int32)<value> The target health" }).CommandFired += player_setHealth;
Command.RegisterCommand("player_setmaxhealth", "Sets the player's max health | player_setmaxhealth <value>", new[] { "(Int32)<value> The target max health" }).CommandFired += player_setMaxHealth;
Command.RegisterCommand("player_setimmunity", "Sets the player's immunity | player_setimmunity <value>", new[] { "(Int32)<value> The target immunity" }).CommandFired += player_setImmunity;
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)<value> The target speed [0 is normal]" }).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;
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("newitem", "Outputs a list of melee weapons | out_melee", new[] { "" }).CommandFired += RegisterNewItem;
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 types_CommandFired(Command cmd)
{
Program.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)
{
Program.StardewInvoke(() => { Program.StardewForm.Hide(); });
}
static void show_CommandFired(Command cmd)
{
Program.StardewInvoke(() => { Program.StardewForm.Show(); });
}
static void save_CommandFired(Command cmd)
{
StardewValley.SaveGame.Save();
}
static void load_CommandFired(Command cmd)
{
Game1.activeClickableMenu = new StardewValley.Menus.LoadGameMenu();
}
static void exit_CommandFired(Command cmd)
{
Program.gamePtr.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":
Program.LogError("Pets cannot currently be renamed.");
break;
case "farm":
Game1.player.farmName = cmd.CalledArgs[1];
break;
}
}
else
{
Program.LogObjectInvalid();
}
}
else
{
Program.LogObjectValueNotSpecified();
}
}
static void player_setMoney(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0] == "inf")
{
infMoney = true;
}
else
{
infMoney = false;
int ou = 0;
if (Int32.TryParse(cmd.CalledArgs[0], out ou))
{
Game1.player.Money = ou;
Program.LogInfo("Set {0}'s money to {1}", Game1.player.Name, Game1.player.Money);
}
else
{
Program.LogValueNotInt32();
}
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void player_setStamina(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0] == "inf")
{
infStamina = true;
}
else
{
infStamina = false;
int ou = 0;
if (Int32.TryParse(cmd.CalledArgs[0], out ou))
{
Game1.player.Stamina = ou;
Program.LogInfo("Set {0}'s stamina to {1}", Game1.player.Name, Game1.player.Stamina);
}
else
{
Program.LogValueNotInt32();
}
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void player_setMaxStamina(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
int ou = 0;
if (Int32.TryParse(cmd.CalledArgs[0], out ou))
{
Game1.player.MaxStamina = ou;
Program.LogInfo("Set {0}'s max stamina to {1}", Game1.player.Name, Game1.player.MaxStamina);
}
else
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogValueNotSpecified();
}
}
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
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogError("<skill> is invalid");
}
}
else
{
Program.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.addedSpeed = cmd.CalledArgs[0].AsInt32();
Program.LogInfo("Set {0}'s added speed to {1}", Game1.player.Name, Game1.player.addedSpeed);
}
else
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogValueNotSpecified();
}
}
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
{
Program.LogError("<colour> is invalid");
}
}
else
{
Program.LogObjectInvalid();
}
}
else
{
Program.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
Program.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
Program.LogError("<value> must be 0 or 1 for this <object>");
break;
}
}
else
{
Program.LogValueInvalid();
}
}
else
{
Program.LogObjectInvalid();
}
}
else
{
Program.LogObjectValueNotSpecified();
}
}
static void world_freezeTime(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
if (cmd.CalledArgs[0].AsInt32() == 0 || cmd.CalledArgs[0].AsInt32() == 1)
{
freezeTime = cmd.CalledArgs[0].AsInt32() == 1;
frozenTime = freezeTime ? Game1.timeOfDay : 0;
Program.LogInfo("Time is now " + (freezeTime ? "frozen" : "thawed"));
}
else
{
Program.LogError("<value> should be 0 or 1");
}
}
else
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void world_setTime(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
if (cmd.CalledArgs[0].AsInt32() <= 2600 && cmd.CalledArgs[0].AsInt32() >= 600)
{
Game1.timeOfDay = cmd.CalledArgs[0].AsInt32();
frozenTime = freezeTime ? Game1.timeOfDay : 0;
Program.LogInfo("Time set to: " + Game1.timeOfDay);
}
else
{
Program.LogError("<value> should be between 600 and 2600 (06:00 AM - 02:00 AM [NEXT DAY])");
}
}
else
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void world_setDay(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
if (cmd.CalledArgs[0].AsInt32() <= 28 && cmd.CalledArgs[0].AsInt32() > 0)
{
Game1.dayOfMonth = cmd.CalledArgs[0].AsInt32();
}
else
{
Program.LogError("<value> must be between 1 and 28");
}
}
else
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void world_setSeason(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
string obj = cmd.CalledArgs[0];
string[] objs = "winter,spring,summer,fall".Split(new[] { ',' });
if (objs.Contains(obj))
{
Game1.currentSeason = obj;
}
else
{
Program.LogValueInvalid();
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void player_setHealth(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0] == "inf")
{
infHealth = true;
}
else
{
infHealth = false;
if (cmd.CalledArgs[0].IsInt32())
{
Game1.player.health = cmd.CalledArgs[0].AsInt32();
}
else
{
Program.LogValueNotInt32();
}
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void player_setMaxHealth(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
Game1.player.maxHealth = cmd.CalledArgs[0].AsInt32();
}
else
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void player_setImmunity(Command cmd)
{
if (cmd.CalledArgs.Length > 0)
{
if (cmd.CalledArgs[0].IsInt32())
{
Game1.player.immunity = cmd.CalledArgs[0].AsInt32();
}
else
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogValueNotSpecified();
}
}
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
{
Program.LogError("<count> is invalid");
return;
}
}
Game1.player.addItemByMenuIfNecessary((Item)new StardewValley.Object(cmd.CalledArgs[0].AsInt32(), count));
}
else
{
Program.LogError("<item> is invalid");
}
}
else
{
Program.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);
Program.LogInfo("Given {0} to {1}", toAdd.Name, Game1.player.Name);
}
else
{
Program.LogError("<item> is invalid");
}
}
else
{
Program.LogObjectValueNotSpecified();
}
}
static void out_items(Command cmd)
{
for (int i = 0; i < 1000; i++)
{
try
{
Item it = new StardewValley.Object(i, 1);
if (it.Name != "Error Item")
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
{
Program.LogValueNotInt32();
}
}
else
{
Program.LogValueNotSpecified();
}
}
static void blank_command(Command cmd) { }
static void RegisterNewItem(Command cmd)
{
Game1.player.addItemToInventory(SGame.PullModItemFromDict(0, true));
}
}
}

View File

@ -0,0 +1,75 @@
<?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>{28480467-1A48-46A7-99F8-236D95225359}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>TrainerMod</RootNamespace>
<AssemblyName>TrainerMod</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86">
<Private>False</Private>
</Reference>
<Reference Include="Stardew Valley">
<HintPath>D:\#Network-Steam\SteamRepo\steamapps\common\Stardew Valley\Stardew Valley.exe</HintPath>
<Private>False</Private>
</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="TrainerMod.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\StardewModdingAPI\StardewModdingAPI.csproj">
<Project>{f1a573b0-f436-472c-ae29-0b91ea6b9f8f}</Project>
<Name>StardewModdingAPI</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>mkdir "$(SolutionDir)Release\Mods\"
copy /y "$(SolutionDir)$(ProjectName)\$(OutDir)TrainerMod.dll" "$(SolutionDir)Release\Mods\"</PostBuildEvent>
</PropertyGroup>
<!-- 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>

Binary file not shown.

View File

@ -0,0 +1,5 @@
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\TrainerMod.dll
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\bin\Debug\TrainerMod.pdb
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\obj\Debug\TrainerMod.csprojResolveAssemblyReference.cache
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\obj\Debug\TrainerMod.dll
C:\TFSource\Master-Collection\StardewModdingAPI\TrainerMod\obj\Debug\TrainerMod.pdb

Binary file not shown.