01. Regular Buying & Wishlists (ClientIntent.BUY)
A regular buyer enters the shop looking for items matching specific category tags or item IDs. The player places matching stock from the shelves or back inventory onto the counter and negotiates a sale within the buyer's budget.
Core Fields & Methods
| Field / Method | Type | Description |
|---|---|---|
sc.clientIntent | StoreClient.ClientIntent | Set to StoreClient.ClientIntent.BUY (1). |
sc.SetBudget(int amount) | void | Sets the maximum credit budget the buyer brings to the counter. |
sc.useClientBudget | bool | Enables budget checking (default true). |
sc.clientBuyingTagList | List<string> | Accepted item category tags (e.g. "MEDICAL", "FIREARM"). |
sc.clientBuyingIdList | List<string> | Specific accepted itemID values (e.g. "blood_bag", "aug_chip"). |
sc.clientBlackTagList | List<string> | Blacklisted item category tags the buyer refuses to purchase. |
sc.clientBlackIdList | List<string> | Blacklisted itemID values the buyer refuses to purchase. |
sc.SetVariety() | void | Requires distinct item types when buying multiple items in a single visit. |
Code Example: Dedicated Medical Buyer
csharp
private static StoreClient CreateMedicalBuyer()
{
var sc = new StoreClient
{
identifier = "clinic_runner",
displayName = NpcFrameworkSdk.T("诊所跑腿员", "Clinic Runner"),
spriteName = SpriteDict.GetRandomMedSpriteName(),
clientFaction = "FACTION_LOWER_LEVEL",
clientIntent = StoreClient.ClientIntent.BUY,
buyPriceModifier = 25
};
sc.SetBudget(360);
sc.clientBuyingTagList.Add("MEDICAL");
sc.clientBuyingIdList.Add("blood_bag");
sc.clientBuyingIdList.Add("hemostatic_bandage_item");
sc.clientBlackTagList.Add("NARCOTIC");
sc.mainDialogue.SetText(sc.displayName,
NpcFrameworkSdk.T("下层区诊所急需一批医疗物资,你有血袋或者止血绷带吗?", "The clinic needs medical supplies. Got any blood bags or hemostatic bandages?"));
sc.placeRightItemWhenSellingToDialogue = new Dialogue()
.SetText(sc.displayName, NpcFrameworkSdk.T("太好了,正是我们需要的。", "Great, that's exactly what we need."));
sc.acceptDealDialogue = new Dialogue()
.SetText(sc.displayName, NpcFrameworkSdk.T("多谢,这就送回诊所。", "Thanks, taking these straight back to the clinic."));
sc.CompleteClientCreation(false);
return sc;
}