diff options
author | ClxS <slxxls92@gmail.com> | 2016-03-03 17:17:44 +0000 |
---|---|---|
committer | ClxS <slxxls92@gmail.com> | 2016-03-03 17:17:44 +0000 |
commit | 14c7389921e0a548fa2386a0c3dfdb5ae5da296c (patch) | |
tree | eaa65b3f6693f5e89d7ac82d8039fa097ecf9a01 | |
parent | 2a9c08e1ad85a28b74b27a3e8d7f568c2f77a38f (diff) | |
parent | 659825ea783cdf57f7b1150bfd8a8191217b76ef (diff) | |
download | SMAPI-14c7389921e0a548fa2386a0c3dfdb5ae5da296c.tar.gz SMAPI-14c7389921e0a548fa2386a0c3dfdb5ae5da296c.tar.bz2 SMAPI-14c7389921e0a548fa2386a0c3dfdb5ae5da296c.zip |
Merge pull request #2 from Zoryn4163/master
Merge pull request #2 from Zoryn4163/master
-rw-r--r-- | Release/Mods/TrainerMod.dll | bin | 23552 -> 23552 bytes | |||
-rw-r--r-- | Release/SMAPI_0.36A.zip | bin | 0 -> 32690 bytes | |||
-rw-r--r-- | Release/StardewModdingAPI.exe | bin | 66560 -> 67072 bytes | |||
-rw-r--r-- | StardewModdingAPI/Inheritance/SGame.cs | 37 | ||||
-rw-r--r-- | StardewModdingAPI/Inheritance/SObject.cs | 22 | ||||
-rw-r--r-- | TrainerMod/TrainerMod.cs | 3 | ||||
-rw-r--r-- | TrainerMod/bin/Debug/TrainerMod.dll | bin | 23552 -> 23552 bytes | |||
-rw-r--r-- | TrainerMod/obj/Debug/TrainerMod.dll | bin | 23552 -> 23552 bytes |
8 files changed, 55 insertions, 7 deletions
diff --git a/Release/Mods/TrainerMod.dll b/Release/Mods/TrainerMod.dll Binary files differindex 9fc10782..d6e49439 100644 --- a/Release/Mods/TrainerMod.dll +++ b/Release/Mods/TrainerMod.dll diff --git a/Release/SMAPI_0.36A.zip b/Release/SMAPI_0.36A.zip Binary files differnew file mode 100644 index 00000000..3327651f --- /dev/null +++ b/Release/SMAPI_0.36A.zip diff --git a/Release/StardewModdingAPI.exe b/Release/StardewModdingAPI.exe Binary files differindex aa593708..24cc0edd 100644 --- a/Release/StardewModdingAPI.exe +++ b/Release/StardewModdingAPI.exe 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 Binary files differindex 9fc10782..d6e49439 100644 --- a/TrainerMod/bin/Debug/TrainerMod.dll +++ b/TrainerMod/bin/Debug/TrainerMod.dll diff --git a/TrainerMod/obj/Debug/TrainerMod.dll b/TrainerMod/obj/Debug/TrainerMod.dll Binary files differindex 9fc10782..d6e49439 100644 --- a/TrainerMod/obj/Debug/TrainerMod.dll +++ b/TrainerMod/obj/Debug/TrainerMod.dll |