09. Realtime Scale, Counter & Showcase Callbacks
StoreClient exposes 6 realtime item-interaction delegates plus addict/repeat dialogue fields so customers can react the instant an item touches the scale, counter, or showcase.
The 6 Realtime Item Delegates
| Delegate Field | Signature | When It Fires |
|---|---|---|
sc.onItemAddedToWeighted | Action<GameItem> | Fires the moment an item or powder is placed onto the weighing scale. |
sc.onItemRemovedToWeighted | Action<GameItem> | Fires when an item is removed from the weighing scale. |
sc.onItemAddedToCounters | Action<GameItem> | Fires when an item is placed onto the counter trading zone. |
sc.OnItemAddedToShowcase | Action<GameItem> | Fires when an item is placed into a display showcase. |
sc.onItemSold | Action<GameItem, int> | Fires when the player sells an item to this customer (item, price). |
sc.onItemBought | Action<GameItem, int> | Fires when the player buys an item from this customer (item, price). |
Code Example: Realtime Scale Reaction (addictGeneralTrailer)
csharp
sc.IsClientAddict = true;
sc.CanReturn = true;
sc.CanReturnAsBuyer = true;
sc.onItemAddedToWeighted = item =>
{
if (item != null && (item.IsTag("SUBSTANCE") || item.IsTag("NARCOTIC")))
{
var d = new Dialogue().SetText(sc.displayName,
NpcFrameworkSdk.T("对对对!就是这个劲儿!手别抖,多倒点!", "That's the stuff! Pour it on!"));
DialogUIManager.Instance?.StartDialogue(d, false);
}
};
sc.repeatDialogue = new Dialogue()
.SetText(sc.displayName, NpcFrameworkSdk.T("求你了老板,我骨头缝都在发痒,快给我一点吧!", "Come on, I'm itching all over. Just give me a hit!"));