10. 跨日期货预定委托单 (AttachProcurementOffer)
期货预定委托(ClientIntent.PROCUREMENT_OFFER 与 PROCUREMENT_COLLECT)允许顾客在首次进店时向玩家预订一件稀缺物品:顾客当场支付一笔定金(initialAdvanceCash),并在柜台上留下一张实体预定凭条(procurement_slip);经过 dueInDays 天后,系统会在到期日自动安排该顾客再次进店取货并支付高额尾款(finalRewardCash)。
SDK 方法签名与底层实现
csharp
public static void AttachProcurementOffer(
StoreClient client,
string clientName,
string offerDescription,
string collectDescription,
int dueInDays,
int initialAdvanceCash,
int finalRewardCash,
Func<GameItem, bool> itemValidator)底层 NpcFullFeatureKit.AttachProcurementOffer 会将 client.clientIntent 设为 ClientIntent.PROCUREMENT_OFFER,并构造原版 ProcurementData 对象挂载到 client.procurementData。
代码示例:3 天期军用义体芯片预定单
csharp
private static StoreClient CreateChipProcurementClient()
{
var sc = new StoreClient
{
identifier = "cyber_surgeon_procure",
displayName = NpcFrameworkSdk.T("高阶义体外科主任", "Senior Cyber-Surgeon"),
spriteName = SpriteDict.GetRandomMedSpriteName(),
clientFaction = "FACTION_UPPER_LEVEL"
};
NpcFrameworkSdk.AttachProcurementOffer(
client: sc,
clientName: sc.displayName,
offerDescription: NpcFrameworkSdk.T("3 天后我有一台针对上层区议员的神经重构手术,急需一枚原型义体芯片。先付你 100 信用点定金,到期备好货我再付你 450 尾款。", "I need an Augmentation Chip in 3 days for a surgery. Here is 100 credits upfront and 450 upon collection."),
collectDescription: NpcFrameworkSdk.T("手术时间到了,我预订的义体芯片备齐了吗?", "It's time for the operation. Do you have the Augmentation Chip we agreed on?"),
dueInDays: 3,
initialAdvanceCash: 100,
finalRewardCash: 450,
itemValidator: item => item != null && item.itemID == "aug_chip"
);
sc.CompleteClientCreation(false);
return sc;
}