NpcFrameworkSdk Complete API Reference
Drop NpcFrameworkSdk.cs into your mod project to call every feature of Custom NPC Framework without adding a DLL reference.
Core Registration, Localization & Summoning
| Method / Property | Return Type | Description |
|---|---|---|
NpcFrameworkSdk.IsChinese | bool | Returns true when the active language is Simplified Chinese (respecting the framework's language setting or game locale). |
NpcFrameworkSdk.T(string zh, string en) | string | Returns zh if IsChinese is true, otherwise en. |
NpcFrameworkSdk.RegisterNpc(...) | void | Registers a custom NPC or storyline stage entry with full scheduling rules. |
NpcFrameworkSdk.SummonNpcNow(string id) | bool | Forces id to clientStack[0] immediately (calling them to the door if empty) or queues them as the first customer on the next shutter open. |
NpcFrameworkSdk.ResolveSprite(string name) | string | Validates name against SpriteDict.Instance.spriteDictionary with built-in safe fallbacks. |
Per-Save Storyline State Store (cnpcf_ Namespace)
csharp
int GetSaveInt(string key, int defaultValue = 0);
void SetSaveInt(string key, int value);
int AddSaveInt(string key, int delta, int defaultValue = 0);
bool GetSaveBool(string key, bool defaultValue = false);
void SetSaveBool(string key, bool value);
string GetSaveString(string key, string defaultValue = "");
void SetSaveString(string key, string value);Holophone & 18-Subsystem Toolkit Methods
csharp
void RegisterPhoneContact(long number, string dialogFuncId, Func<string> displayNameGetter, int cooldownDays, Func<bool> isUnlockedPredicate, Func<StorePhoneClient, Dialogue> callDialogFactory, params string[] clientAliases);
void SyncPhoneContacts();
void ApplyClientProfile(StoreClient client, Dictionary<string, object> profile);
GameItem CreateHandnoteItem(string title, string body, string signature, int fontIndex = 0);
GameItem CreatePaperNoteItem(string title, string body);
bool SpawnItemOnCounterOrStore(GameItem item, bool isStolen = false, bool isContraband = false);
bool GiveHandnoteToPlayer(string title, string body, string signature, int fontIndex = 0);
bool PostStoreRequest(string id, string title, string description, string requesterName, string factionId, string requiredItemId, int requiredCount = 1, int durationDays = 5, int creditReward = 200, int reputationReward = 10, bool force = true);
void AttachProcurementOffer(StoreClient client, string clientName, string offerDescription, string collectDescription, int dueInDays, int initialAdvanceCash, int finalRewardCash, Func<GameItem, bool> itemValidator);
GunOrderData BuildCustomGunOrder(int tier, int baseReward, string dialogText, bool isBestOrder, IList<(string statTag, int minVal, int bonusReward, bool isMandatory)> requirements);
void TriggerNews(string id, string headline, string body, int durationDays = 1);
bool RegisterAfterhourEvent(string id, string locationId, Func<string> titleGetter, Func<string> descriptionGetter, int durationDays = 2, float dailyChancePercent = 25f, bool closesLocation = false, Func<bool> canStartPredicate = null, Action onStart = null, Action onEnd = null);
void RegisterNightlyHook(Action hook);
void RegisterDumpingGroundWatcher(Action<GameInventory> watcher);