Skip to content

02. Regular Selling & Item Offers (ClientIntent.SELL) ​

When a customer visits with ClientIntent.SELL (or ClientIntent.SELLNBUY), they place one or more items onto the counter at the end of their opening dialogue for the player to inspect and purchase.


Core Fields & Counter Spawning Method ​

Field / MethodTypeDescription
sc.clientIntentStoreClient.ClientIntentSet to StoreClient.ClientIntent.SELL (2) or SELLNBUY (3).
sc.sellPriceModifierintPercentage price modifier on the seller's asking price (negative = cheaper).
PlayerStore.Instance.AddDirectSellingItemToTablevoidCalled inside mainDialogue's SetEndAction to spawn the offered item onto the counter.

AddDirectSellingItemToTable Signature ​

csharp
PlayerStore.Instance.AddDirectSellingItemToTable(
    string itemId,        // Item ID (e.g. "sci_keycard")
    bool isOwnedByPlayer, // Pass false when the customer is selling to the player
    bool isStolen,        // Marks the item as stolen
    bool isContraband,    // Marks the item as contraband
    int customPrice       // Custom price; pass 0 to calculate automatically from base value
);

Code Example: Single-Item Scavenger Seller ​

csharp
private static StoreClient CreateSingleItemSeller()
{
    var sc = new StoreClient
    {
        identifier = "keycard_finder",
        displayName = NpcFrameworkSdk.T("通风管拾荒者", "Vent Scavenger"),
        spriteName = SpriteDict.GetRandomScavSpriteName(),
        clientFaction = "FACTION_LOWER_LEVEL",
        clientIntent = StoreClient.ClientIntent.SELL,
        sellPriceModifier = -10
    };

    sc.mainDialogue
        .SetText(sc.displayName, NpcFrameworkSdk.T("我在通风井底下捡到一张科研门禁卡,你要收吗?", "Found a science keycard down in the air ducts. Interested?"))
        .SetEndAction(() =>
        {
            PlayerStore.Instance?.AddDirectSellingItemToTable("sci_keycard", false, true, false, 0);
        });

    sc.acceptDealDialogue = new Dialogue()
        .SetText(sc.displayName, NpcFrameworkSdk.T("爽快!这下今晚能去喝一杯了。", "Sweet! Drinks are on me tonight."));

    sc.CompleteClientCreation(false);
    return sc;
}

Custom NPC Framework Documentation