Tool Stardew Modding API

Discussion in 'Mods' started by Zoryn4163, Feb 28, 2016.

  1. Zoryn4163

    Zoryn4163 Big Damn Hero

    NOTICE: Due to advancements in the community, SMAPI has been deprecated. Another user wanted to take up SMAPI, so by request you can find it here:

    I am now calling this project "SMAPI" (Stardew Modding API)

    If you want the Trainer commands, you require the optional TrainerMod.dll file that comes with the project. It goes in the mods folder.

    Okay so a lot has happened since I originally made this thread. Right now, I really don't have anything to show off everything that this program does. You can use it to cheat in money, change your speed, basic trainer features. You can also reference it in a C# DLL to modify the game directly with code. I have many plans for it.

    My current proudest achievement:

    (3-1-16 @ 2:19 AM EST)
    API Loads the SDV Assemblies and can interact with them
    API Creates a Console Window that can accept commands
    API Can read DLL files that reference it so that Mods can actually be made (they go in appdata)
    Trainer Features (Set/Infinite Health/Stamina/Money, Set Skill Level, Set Time/Day/Season, Set Speed, AddItem)
    CUSTOM ITEMS (Not in release yet, but it's working!)

    I dunno yet. Implementing obvious commands and going from there.
    Events. I want events for like, everything. I like events. Fire them all!
    Documentation. That'll be fun.
    Trainer Features (AddItem, Unlimited Water, Easy Fishing, Friendship Level, Choose Specialties, Insane Damage)

    help, types, hide, show, save, load, exit, stop, player_setname, player_setmoney, player_setstamina, player_setmaxstamina, player_sethealth, player_setmaxhealth, player_setimmunity, player_setlevel, player_setspeed, player_changecolour, player_changestyle, player_additem, player_addmelee, out_items, out_melee, newitem, world_settime, world_freezetime, world_setday, world_setseason, world_downminelevel, world_setminelevel

    Random screenshots or gifs or vids or whatever. They'll show up whenever I feel like showing off a feature or something.

    Proof of concept:

    Screenshot of modding api with some simple commands on the title screen.
    GIF of setting the player's money to 500,000.
    GIF of modified fish minigame at difficulty 100
    GIF of Fishing...? Fishing is uh... Something... Yeah. This is being called from an external DLL in the mods folder as well, which I find neat.
    SMAPI SetLevel Command

    Custom blocks

    Edit: I also have no idea where this should be posted, so I threw it into 'Fan Works'
    Edit2: I guess it doesn't belong there. Thanks to whatever mod moved the post.
    Edit3: I don't know how to strike-out text and it's annoying me but whatever.
      Last edited: Mar 24, 2016
    • cantorsdust

      cantorsdust Existential Complex

      Wow, that's beautiful. I thought for sure this would take longer. I wish you the best of luck!
      • wingedwolf123

        wingedwolf123 Subatomic Cosmonaut

        I just hope mods ppl end up making don't ruin their game play .. I was big in the modding scene for star bound and it honestly ruined it for me same with terraria cause you end up making gold creating mods or god like armor etc ..
        • Zoryn4163

          Zoryn4163 Big Damn Hero

          Thanks. I thought it would too, but I had a couple friends help me out. It only actually took a few hours, and only because Program.cs was an internal class :p
          I'm hoping to get a solid API out by the coming weekend.

          If people enjoy something a mod offers I don't see why it should have to ruin something for you. If you don't like a mod, don't use it, no?
            Totori, Clovilah, Kinja and 4 others like this.
          • zipy199522

            zipy199522 Pangalactic Porcupine

            Great work Zoryn! I'm just as surprised myself to see something like this already around! This would for sure help out my work as well so I don't have to destroy my contents folder full of testing.
            • WatcherCCG

              WatcherCCG Giant Laser Beams

              Soon we'll actually need a subforum for modding. And not even a week after release. It's glorious.
              • cantorsdust

                cantorsdust Existential Complex

                Strike out is just s in brackets like so {s}{/s} but with [] not {}.

                As for plans, the basic features I would like would be the same as I would want in any trainer.

                1. Unlimited Health
                2. Unlimited Stamina
                3. Freeze / Change time of day
                4. Freeze / Change season
                5. Increased movement speed!
                6. Add items to inventory
                7. Unlimited water for watering can
                8. More money
                9. Easy Fishing!
                10. Edit relationship level with villagers
                11. Edit skill level, chosen skill specialties.
                12.One hit kills for monsters

                More advanced stuff would be like

                1. Creating new crops, fruit trees, etc. That would require registering a new art asset, new line in ObjectInformation.xnb, and a new line in Crops.xnb at least.
                2. Creating new seeds for said crops and placing them in the store. --Don't know where store inventories are set, though.
                3. Creating new items like boots, rings, etc. That would requiring adding item art, editing ObjectInformation.xnb, Boots.xnb, and then figuring out how to run new code for what the item is doing.
                3. Editing store inventories.
                4. Adding new crafting recipes, cooking recipes, etc as handled in CraftingRecipes.xnb and CookingRecipes.xnb.
                4. Adding NPCs. That would again require a new art asset, dialogue, event files, house, map edits, NPCGiftTastes, NPCDispositions, etc.
                5. Making NPCs romancable. Would requiring registering new dialogue, EngagementDialogue, etc.
                6. Adding new animations.
                7. Adding new monsters, mine levels, etc.

                Obviously these are just my thoughts. I suspect these things would take a while to implement; do what you're planning, etc. Can't wait to see it.
                  WatcherCCG likes this.
                • Declension

                  Declension Cosmic Narwhal

                  ...And add and balance butchery. Ape said he'd share his sprites, code, and all that.
                  • Zoryn4163

                    Zoryn4163 Big Damn Hero

                    It is glorious indeed.

                    For now I'm trying to get the basics of everything setup. Remember that this is a modding API, so anyone in the community could reference it and make their own mod off of it!

                    As for the trainer features, some of that is already there. Obviously, someone can make their own mod to make doing all of those things easier, but I see no reason to not add support for most of that myself.
                    1. As for the advanced features, I've yet to figure out how to make completely custom items, but it's definitely on my list.
                    2. Store inventories are set in the code afaik, I saw a couple.
                    3. Creating armour will probably be a bit trickier, and might require going to CA to request an event handler for equipping/unequipping.
                    4. AFAIK, store inventories are directly set in code, so it should be easy to manage?
                    5. Crafting and cooking recipes are also something I would like to look into. I want to do my best to be able to interface (and have a public way to interface) all of these things directly from code.
                    6. I'm no artist and haven't the slightest clue how anims are handled atm, had no desire to look into it yet.
                    7. I very much want more mine levels. I only got to floor 55 and I'm on Spring 28, so I barely even played the game, but I can tell I love the mines.
                    • WatcherCCG

                      WatcherCCG Giant Laser Beams

                      I suggest sticking to the basic trainer functions for now, then worrying about anything more complex once all that is done and wrapped up neatly in a nice little downloadable package.
                      • Pinkishu

                        Pinkishu Phantasmal Quasar

                        Hm, how would I make a mod with this to e.g. change the movement speed?
                        Reflection/Emission to change the already loaded method? Or can I somehow replace methods on launch? The example mod only seems to show using events

                        I don't see why a modding thing includes trainer features though :p
                        • boomer678

                          boomer678 Void-Bound Voyager

                          Great work! This looks promising.
                          Seems better than my hacky way of doing things. How do you plan on re-writing methods? An example would be to remove the diagonal movement check in Farmer.getMovementSpeed
                          • redteam

                            redteam Scruffy Nerf-Herder

                            Good idea. I started working on a mod manager this morning, myself, but this project caught my eye and now I'm learning C#.
                            This will add every craftable recipe to the player.

                            When I have some time later this week I wanted to look at adding new recipes like you probably meant. It looks straightforward enough, though I haven't progressed far enough in the game to have the kitchen addition (legit play-through, first, of course)!
                              Last edited: Feb 28, 2016
                            • zipy199522

                              zipy199522 Pangalactic Porcupine

                              Hey, I tried to work this so far, but I think I'm not understanding something. I create a .dll file in notepad++ and stick it in my mods directory, and try to compile the API via visual studios and I get this error.

                              Any idea where I might have went wrong/ am lacking?

                                Attached Files:

                              • boomer678

                                boomer678 Void-Bound Voyager

                                A .dll isnt a text file. You have to compile the dll in visual studio to get the assembly
                                • zipy199522

                                  zipy199522 Pangalactic Porcupine

                                  Got it. I'm assuming that means making a VS project and outputting the code as a .dll file and then putting that in my mods directory?
                                  • Zoryn4163

                                    Zoryn4163 Big Damn Hero

                                    As boomer says, I don't see why you are creating a text file. You should open visual studios and create a new c# DLL (Library or something, you'll see it in C# for Windows Deskop), then add a reference to the ModAPI.exe, then have your class inherit from Mod and define an override entry function.

                                    I haven't gotten into rewriting parts of the game yet.

                                    It has trainer features because I felt like it was a good start, and people want it anyways :p
                                    As I state above, create a DLL Project, Reference the API, and in the Entry() function you could hook my Update event and constantly set the player's speed or register a command to do it. For now the majority of the use for this is commands with arguments, but I have many plans for the future with it. Also, keep in mind that this API hasn't existed for more then 24 hours as of now, so I feel that it is very decent for being so early-on.
                                    • zipy199522

                                      zipy199522 Pangalactic Porcupine

                                      Yea that was my bad. I ended up doing something sloppy when I didn't actually think about what I was doing. I got it to work now, thanks!
                                      • Viomi

                                        Viomi Void-Bound Voyager

                                        The point of not including a trainer is to keep this mod api as minimal as possible so that the modder can add their own features on a minimal environment.

                                        Make a trainer on the side and make it available. But including it with the mod API? :/
                                        • WatcherCCG

                                          WatcherCCG Giant Laser Beams

                                          Viomi has a point. Separate the trainer from the API itself. I don't think the API needs that much extra code in it.

                                          Share This Page