NpcHelper.StardewValley.Sdk 2.5.0.1

dotnet add package NpcHelper.StardewValley.Sdk --version 2.5.0.1
                    
NuGet\Install-Package NpcHelper.StardewValley.Sdk -Version 2.5.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="NpcHelper.StardewValley.Sdk" Version="2.5.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NpcHelper.StardewValley.Sdk" Version="2.5.0.1" />
                    
Directory.Packages.props
<PackageReference Include="NpcHelper.StardewValley.Sdk" />
                    
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 NpcHelper.StardewValley.Sdk --version 2.5.0.1
                    
#r "nuget: NpcHelper.StardewValley.Sdk, 2.5.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 NpcHelper.StardewValley.Sdk@2.5.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=NpcHelper.StardewValley.Sdk&version=2.5.0.1
                    
Install as a Cake Addin
#tool nuget:?package=NpcHelper.StardewValley.Sdk&version=2.5.0.1
                    
Install as a Cake Tool

NPC Helper Stardew Valley SDK

Define Stardew Valley NPCs in C# and generate a standard NPC Helper 2 content pack or a C# SMAPI mod. The SDK is for mod authors who want strongly typed NPC definitions, validation, and repeatable output from code or build scripts instead of maintaining every content file by hand.

What you need

  • .NET 6 SDK or later.
  • NPC Helper 2 installed in the game to load the generated NPC content.
  • For generated DLL mods, SMAPI and a C# SMAPI mod project.

The SDK itself does not depend on SMAPI or Stardew Valley assemblies.

Install

Add the NuGet package to your project:

dotnet package add NpcHelper.StardewValley.Sdk

For .NET 9 SDK or earlier, use:

dotnet add package NpcHelper.StardewValley.Sdk

The package is all a developer needs. There is no NpcHelper.dll to download from Nexus and no HintPath to set: a DLL mod talks to the NPC Helper 2 game mod through SMAPI's mod API using the INpcHelperApi interface that ships inside this package, so your project never references the runtime assembly. Players still install NPC Helper 2 from Nexus.

Generate a content pack

using NpcHelper.Sdk;

var rei = new NpcBuilder("Rei")
    .DisplayName("Rei the Baker")
    .Gender(Gender.Female)
    .Birthday(Season.Summer, 12)
    .Spawn("Town", 10, 12)
    .Introduction("Hi! I'm Rei.")
    .Loves("Diamond", "Coffee")
    .OnWeekdays(schedule => schedule.At(600, "Town", 10, 12));

var result = new NpcPackBuilder("Me.ReiPack", "Rei Pack")
    .Author("Me")
    .Add(rei)
    .WriteTo("output/[HP] ReiPack");

if (!result.Ok)
    Console.Error.WriteLine(result.Report);

WriteTo creates a regular TOML content pack and validates it using the NPC Helper loader. The generated pack still requires the NPC Helper 2 game mod.

Generate a translation pack

A translation-only pack holds no NPC definition, so it works with any mod that adds the NPC and can be updated on its own.

var result = new TranslationPackBuilder("Me.ReiThai", "Rei Thai", "th")
    .Author("Me")
    .ForMod("Me.ReiPack")                  // load after the mod that adds Rei
    .Npc("Rei", t => t
        .DisplayName("เรย์")
        .Dialogue("Introduction", "สวัสดี"))
    .WriteTo("output/[HP] ReiThai");

FromNpc(npc) starts from an NPC's current texts, so only the values need replacing. PackChecks.CheckManifest(folder) and PackChecks.CheckTranslations(folder, basePackFolder) run the same checks as npchelper validate.

Generate a DLL mod

Use the SDK from a C# SMAPI mod project when NPC definitions should be registered by code at runtime. The npchelper tool can scaffold a starting project:

dotnet tool install --global NpcHelper.StardewValley.Cli
npchelper new dll-mod MyNpcMod --id Me.MyNpcMod

The CLI package includes the SDK, so you do not need to add the SDK package separately just to use the CLI.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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.
  • net6.0

    • 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.