Skip to content

03. 整包一口价批发 (isOfferWholesale) ​

整包批发(Wholesale)允许顾客一次性将多件高价值战利品或走私货铺在柜台上,并按整包折扣价(如七折 -30、七五折 -25、八折 -20)打包出售给玩家。RestoredUnusedNPCs 中的比利第 3 幕、灰潮拾荒客、下层区制毒师、黑市军火贩以及 CyberpunkMercV 中的 V 第 3 幕均采用此机制。


核心配置三要素 ​

  1. sc.clientIntent = StoreClient.ClientIntent.SELL;
  2. sc.isOfferWholesale = true;
  3. sc.wholesaleDiscount = -30(负数代表折扣百分比,-30 即优惠 30%,按总价的 70% 结算);
  4. 在 sc.mainDialogue 最后一页的 SetEndAction 中,连续调用多次 PlayerStore.Instance.AddDirectSellingItemToTable(...) 将整批物品生成到桌面上。

代码示例:金库劫案整包七折销赃 ​

csharp
private static StoreClient CreateVaultWholesaleSeller()
{
    var sc = new StoreClient
    {
        identifier = "v_act3_heist",
        displayName = NpcFrameworkSdk.T("佣兵 V", "Mercenary V"),
        spriteName = "v_normal",
        clientFaction = "FACTION_BLACK_MARKET",
        clientIntent = StoreClient.ClientIntent.SELL,
        isOfferWholesale = true,
        wholesaleDiscount = -30 // 整包 7 折(优惠 30%)
    };

    sc.mainDialogue
        .SetText(sc.displayName, NpcFrameworkSdk.T("金库被我们掀了个底朝天,剩下的尖端货全在这儿了。", "Cleaned out their vault. Brought the rest of the high-tech loot straight to you."))
        .NextDialogue()
        .SetText(sc.displayName, NpcFrameworkSdk.T("义体芯片、指挥官门禁卡、高能电池和冲锋枪,整包七折让给你!", "Aug chips, command keycards, hypertech battery, and an SMG. 30% off the whole lot!"))
        .SetEndAction(() =>
        {
            var ps = PlayerStore.Instance;
            if (ps == null) return;
            ps.AddDirectSellingItemToTable("aug_chip", false, false, false, 0);
            ps.AddDirectSellingItemToTable("command_keycard", false, false, false, 0);
            ps.AddDirectSellingItemToTable("sci_keycard", false, false, false, 0);
            ps.AddDirectSellingItemToTable("energy_credit_hyp", false, false, false, 0);
            ps.AddDirectSellingItemToTable("smg", false, false, false, 0);
        });

    sc.CompleteClientCreation(false);
    return sc;
}

Custom NPC Framework Documentation