diff --git a/Release/Mods/TrainerMod.dll b/Release/Mods/TrainerMod.dll index 9fc10782..d6e49439 100644 Binary files a/Release/Mods/TrainerMod.dll and b/Release/Mods/TrainerMod.dll differ diff --git a/Release/SMAPI_0.36A.zip b/Release/SMAPI_0.36A.zip new file mode 100644 index 00000000..3327651f Binary files /dev/null and b/Release/SMAPI_0.36A.zip differ diff --git a/Release/StardewModdingAPI.exe b/Release/StardewModdingAPI.exe index aa593708..24cc0edd 100644 Binary files a/Release/StardewModdingAPI.exe and b/Release/StardewModdingAPI.exe differ diff --git a/StardewModdingAPI/Inheritance/SGame.cs b/StardewModdingAPI/Inheritance/SGame.cs index 99db73d9..bed57e34 100644 --- a/StardewModdingAPI/Inheritance/SGame.cs +++ b/StardewModdingAPI/Inheritance/SGame.cs @@ -2,11 +2,16 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; +using System.Xml.Serialization; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using StardewValley; +using StardewValley.Characters; using StardewValley.Menus; +using StardewValley.Monsters; +using StardewValley.Quests; +using StardewValley.TerrainFeatures; namespace StardewModdingAPI.Inheritance { @@ -53,7 +58,37 @@ namespace StardewModdingAPI.Inheritance { if (Program.debug) { - //SaveGame.serializer. + SaveGame.serializer = new XmlSerializer(typeof (SaveGame), new Type[28] + { + typeof (Tool), + typeof (GameLocation), + typeof (Crow), + typeof (Duggy), + typeof (Bug), + typeof (BigSlime), + typeof (Fireball), + typeof (Ghost), + typeof (Child), + typeof (Pet), + typeof (Dog), + typeof (StardewValley.Characters.Cat), + typeof (Horse), + typeof (GreenSlime), + typeof (LavaCrab), + typeof (RockCrab), + typeof (ShadowGuy), + typeof (SkeletonMage), + typeof (SquidKid), + typeof (Grub), + typeof (Fly), + typeof (DustSpirit), + typeof (Quest), + typeof (MetalHead), + typeof (ShadowGirl), + typeof (Monster), + typeof (TerrainFeature), + typeof (SObject) + }); } } diff --git a/StardewModdingAPI/Inheritance/SObject.cs b/StardewModdingAPI/Inheritance/SObject.cs index 5c80cd52..023106b8 100644 --- a/StardewModdingAPI/Inheritance/SObject.cs +++ b/StardewModdingAPI/Inheritance/SObject.cs @@ -33,7 +33,9 @@ namespace StardewModdingAPI.Inheritance public Boolean FlaggedForPickup { get; set; } + [XmlIgnore] public Vector2 CurrentMouse { get; protected set; } + [XmlIgnore] public Vector2 PlacedAt { get; protected set; } public override int Stack @@ -205,15 +207,20 @@ namespace StardewModdingAPI.Inheritance public override void actionWhenBeingHeld(Farmer who) { - Point p = Game1.getMousePosition(); - CurrentMouse = new Vector2((p.X / Game1.tileSize), (p.Y / Game1.tileSize)); - Program.LogInfo(canBePlacedHere(Game1.currentLocation, CurrentMouse)); + int x = Game1.oldMouseState.X + Game1.viewport.X; + int y = Game1.oldMouseState.Y + Game1.viewport.Y; + + x = x / Game1.tileSize; + y = y / Game1.tileSize; + + CurrentMouse = new Vector2(x, y); + //Program.LogDebug(canBePlacedHere(Game1.currentLocation, CurrentMouse)); base.actionWhenBeingHeld(who); } public override bool canBePlacedHere(GameLocation l, Vector2 tile) { - Program.LogInfo(CurrentMouse.ToString().Replace("{", "").Replace("}", "")); + //Program.LogDebug(CurrentMouse.ToString().Replace("{", "").Replace("}", "")); if (!l.objects.ContainsKey(tile)) return true; @@ -225,8 +232,11 @@ namespace StardewModdingAPI.Inheritance if (Game1.didPlayerJustRightClick()) return false; - x = (x / Game1.tileSize) * Game1.tileSize; - y = (y / Game1.tileSize) * Game1.tileSize; + x = (x / Game1.tileSize); + y = (y / Game1.tileSize); + + //Program.LogDebug(x + " - " + y); + //Console.ReadKey(); Vector2 key = new Vector2(x, y); diff --git a/TrainerMod/TrainerMod.cs b/TrainerMod/TrainerMod.cs index 86b03673..4aa2167f 100644 --- a/TrainerMod/TrainerMod.cs +++ b/TrainerMod/TrainerMod.cs @@ -761,7 +761,10 @@ namespace TrainerMod static void RegisterNewItem(Command cmd) { if (!Program.debug) + { + Program.LogError("Experimental code cannot be run in user mode."); return; + } SObject s = SGame.PullModItemFromDict(0, true); s.Stack = 999; Game1.player.addItemToInventory(s); diff --git a/TrainerMod/bin/Debug/TrainerMod.dll b/TrainerMod/bin/Debug/TrainerMod.dll index 9fc10782..d6e49439 100644 Binary files a/TrainerMod/bin/Debug/TrainerMod.dll and b/TrainerMod/bin/Debug/TrainerMod.dll differ diff --git a/TrainerMod/obj/Debug/TrainerMod.dll b/TrainerMod/obj/Debug/TrainerMod.dll index 9fc10782..d6e49439 100644 Binary files a/TrainerMod/obj/Debug/TrainerMod.dll and b/TrainerMod/obj/Debug/TrainerMod.dll differ