Are they supposed to be 16x16? Lol that png was 800x600 Edit: I'm working on the draw code to support 64x64 properly. Anything else seems to have some funky behaviour that I'm trying to work out. So for now, 64x64 will be the limit. Edit: Updated Draw Code. The texture shown is 16x16, but any texture up to 4096x4096 should work just fine (maybe?)
Would it be possible to override methods on the Farmer class? Maybe create new class which extends Farmer and override the methods then replace the Game1.player object with the new one. Can you override non virtual methods somehow?
I've already looked into this extensively. There is no way that I've found to override non-virtual methods, it's very saddening.
There is, but it isn't pretty. I've done some research into unit testing for my company and we have a license for all version of Visual Studio. With the highest end version of Visual Studio 2015, you can use fakes to override anything (or close to anything). I haven't done too much with it beyond a proof of concept on some in-house projects because our standard is to use mocks for unit testing and to refactor code to support mocking (interfaces and virtuals everywhere). The big question I have is if there is a way to use fakes to package something so that the methods can be overwritten even when someone is using a different version of VS.
I haven't heard of that before, but if it won't work on the Community version there's really no reason to incorporate it, as I doubt most people would pay for VS. I own VS2013 Ultimate if that makes any differences.
So far is really say this is more of a cheat/ trainer than a MOD .. can't consider it a MOD til new items recipes and or content can be patched into the game .. which is what I'm working on right now
First a minor correction, it was 2015 Enterprise. There isn't a 2015 Ultimate. To my knowledge it only works only on Enterprise 2015, which is quite expensive. I'm getting it setup on my desktop at home right now and I'm going to see if there is a way for me to override the functions and package it so that it can be used in the community edition. I might be able to create a dll that someone else can use to override methods, but I've never tried it before and that isn't exactly what the Fakes Framework is meant for. I'll play around with it tonight. Edit: Looks like there is a version that may work with VS 2013 Ultimate. http://stackoverflow.com/questions/...it-test-isolation-on-vs-2013-professional-edi Edit 2: A rough tutorial on MSDN. https://msdn.microsoft.com/en-us/library/hh549176(v=vs.120).aspx
It can do this, but the implementation is not complete. This thread is mostly a reservation for when it is more feature-complete. If you literally scroll up you will see that I have custom items. You download it and place the exe next to Stardew Valley.exe Documentation for it as a modding API is not yet existent as this is still in very early stages of development.
I think the ideal thing would be having the trainer program as standalone once it's complete, but it probably wouldn't hurt the API to also have the trainer's code.
The 'trainer' portion is very simple and uses the API's Command.RegisterCommand() method. The API just looks for inputs and if an input matches a command it fires an event. The commands will most likely be exported as their own DLL project separate from the API at a future point, but currently I see no reason to separate the two. Right now I'm just trying to get custom items to work without crashing the game with no error logs, so this isn't exactly a priority.
I understand. It's an end goal, since eventually people will want to just punch their function keys without having to deal with the API itself. For now, you are definitely doing Yoba's work.
I'm installing community 2015 on my laptop to see if I can get the code from my desktop to run. Right now I have two classes. First one is GlobalShimContext which holds the IDisposable. You call create when you start and then destroy when the game is over. Then there is OverrideFarmer who has a shipAll method that takes in a delegate which has a pass by reference of a farmer. Effectively, when shipAll is called in the code, it will call this delegate, passing in the farmer shipAll was called on, for you to do what ever you want to. I'm hoping it works on my laptop. If so I'll get it on Git and also put the dll for anyone who doesn't have 2015 Enterprise to compile with. public class OverrideFarmer { public delegate void shipAllOverride(ref Farmer farmer); public void shipAll(shipAllOverride func) { FakesDelegates.Action<Farmer> shipAllOverrideAction = (f) => { func(farmer: ref f); }; StardewValley.Fakes.ShimFarmer.AllInstances.shipAll = shipAllOverrideAction; } } }
That was just the sample code of what I was hoping to compile into a dll that could be used in SMAPI to allow overriding methods. But it appears that the application would have to be a unit test executed using mstest for this to work which makes it useless for the job. I'm going to try to see if there is another way to do this.
I've spent over half a day looking. If you can figure it out I would greatly appreciate it. I have access to private field and properties, just not non-virtual methods...
Wouldn't method hiding work? e.g. "public new void someMethodInFarmer(...)" in the subclass of Farmer
This wouldn't change any of the existing code that called someMethodInFarmer. I was looking as smocks, but that requires basically every object to be serializeable. I was also looking into the way TypeMock does it, but they seem to tie into the profiler as well, giving the same problem as trying to use Fakes. I'll keep looking to see if C# can support monkey patching in any way possible.