Skip to content

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 FieldSignatureWhen It Fires
sc.onItemAddedToWeightedAction<GameItem>Fires the moment an item or powder is placed onto the weighing scale.
sc.onItemRemovedToWeightedAction<GameItem>Fires when an item is removed from the weighing scale.
sc.onItemAddedToCountersAction<GameItem>Fires when an item is placed onto the counter trading zone.
sc.OnItemAddedToShowcaseAction<GameItem>Fires when an item is placed into a display showcase.
sc.onItemSoldAction<GameItem, int>Fires when the player sells an item to this customer (item, price).
sc.onItemBoughtAction<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!"));

Custom NPC Framework Documentation