Cpimhoff.Sts2.ModSmith 0.0.1

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package Cpimhoff.Sts2.ModSmith --version 0.0.1
                    
NuGet\Install-Package Cpimhoff.Sts2.ModSmith -Version 0.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Cpimhoff.Sts2.ModSmith" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Cpimhoff.Sts2.ModSmith" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Cpimhoff.Sts2.ModSmith" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Cpimhoff.Sts2.ModSmith --version 0.0.1
                    
#r "nuget: Cpimhoff.Sts2.ModSmith, 0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Cpimhoff.Sts2.ModSmith@0.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Cpimhoff.Sts2.ModSmith&version=0.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Cpimhoff.Sts2.ModSmith&version=0.0.1
                    
Install as a Cake Tool

Slay the Spire II ~ ModSmith

Base mod for adding content to Slay The Spire II

For Mod Users

This mod provides shared logic which other mods may build off of, in a way that allows for multiple mods to contribute logic without conflicting with one another. You may see this mod in the "dependencies" or "required" section of other mods.

If you are installing mods by hand, you may need to install this mod. Otherwise, the installation of this mod is generally done automatically, and this can be ignored.

Introduction to Modding

Slay the Spire II is built using a fork of Godot called MegaDot. Patches (modifications to game code) are handled using Harmony.

Patching is the main source of why mods break when the game updates, and why mods may conflict. Patches are naturally fickle things -- they instruct the game to run different than the developers intended for a given function. When that code changes, or multiple mods attempt to patch the same function, problems can arise. ModSmith is designed specifically to patch common sections of the game code so multiple mods can all contribute content without conflicting (and making contributing content easier). In addition, ModSmith can handle if those common injection sites change between game versions, making mods built with ModSmith more robust to game updates.

A packaged mod for Slay the Spire II is comprised of 3 major components:

  • A .dll file, which contains all code for the mod.
  • A .pck (Godot resource pack) file, which contains asset files (art, Godot scenes, etc) for use by the Godot game engine.
  • A .json metadata file, which describes the mod.

The .dll file will be generated by the dotnet build system. You will need to install dotnet tools on your system to build C# code.

The .pck file will be generated by using MegaDot, which must be installed on your computer using the instructions at the link.

The .json file is a simple text file you can author by hand.

Prerequisites

(Optional) Decompile Slay the Spire II

Slay the Spire II's source code and complete Godot package cannot be publicly shared since it is a paid game. However, the developers at Megacrit were extremely kind in compiling their game without obfuscation. If you own a copy of the game, you can decompile it to get the fully game as its full Godot project, including its source code.

This is a hugely helpful resource, both directly for modding and for any hobbyist who wants to see a complete example of a production video game.

Install https://github.com/GDRETools/gdsdecomp. Open the app. Select "Recover project..." and select the base Slay the Spire II .pck. This is likely located in your steamapps/common/Slay The Spire II directory.

Quick Start: Your First Mod

The best way to get started with modding in Slay the Spire II is to get a mod working end to end. We'll add a single potion called "Drop of Gold", which, when used, grants 1 gold. This is not a particularly interesting addition, but doing so will allow us to ensure all the components to build and inject custom content is working.

Our mod will need to:

  1. Register itself as a mod for the game
  2. Define our new potion in code
  3. Register the new potion as part of the mod
  4. Add art for our new potion

Step 0: Init a new mod project

This project publishes a script that can generate a new starting point for a mod. It asks for some basic details, such as your name and your mod's name. Both of these can be changed later.

Step 2: Subclass ModSmith.PotionModel

using MegaCrit.Sts2.Core.Entities.Potions;
using MegaCrit.Sts2.Core.Commands;
using MegaCrit.Sts2.Core.Helpers;

namespace ExampleMod;

public sealed class DropOfGold : ModSmith.PotionModel
{
	public override PotionRarity Rarity => PotionRarity.Common;

	public override PotionUsage Usage => PotionUsage.AnyTime;

	public override TargetType TargetType => TargetType.AnyPlayer;

	public override ImagePath ImagePath => ModSmith.ResPath("drop_of_gold.png"),

	protected override async Task OnUse(PlayerChoiceContext choiceContext, Creature? target)
	{
		PotionModel.AssertValidForTargetedPotion(target);
		NCombatRoom.Instance?.PlaySplashVfx(target, StsColors.gold);
		await PlayerCmd.GainGold(1m, target);
	}
}

Step 3: Add to registry

ModSmith performs no automatic registration of added content. If you define a new potion but do not register it with ModSmith, it will do nothing.

To attach new content to ModSmith, add ModSmith.Register<T>() somewhere within your mod's initialization block:

ModSmith.Register<DropOfGold>();

ModSmith.PotionModel

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated

Current