Skip to main content
Corvus Connection

IRpgEconomyApi

Interface
TheOmenDen.StreamPulse.Scripting.IRpgEconomyApiThe viewer economy from a script (ctx.Rpg.Economy, spec 063): read a wallet / the shop / a ledger, credit or debit currency, buy a shop item, and author a shop entry, all dispatching the same Mediator handlers the chat / redeem / node / desktop paths run (AC-11 parity). Every method is failure-safe: a not-joined viewer, an insufficient balance, a gated-out or unavailable RPG store, or any error yields the method's "no result" fallback (null / 0 / an empty list), never a throw. Currency is base-unit copper (1 silver = 100 copper, 1 gold = 100 silver, 1 platinum = 100 gold).

Members

8
  • BuyAsync
    method
    ValueTask<RpgPurchaseInfo> BuyAsync(string twitchUserId, string itemSlug, int quantity = default, CancellationToken cancellationToken = default)
    Buys quantity of a shop item for a joined viewer, or null on any rejection/failure.
  • CreditAsync
    method
    ValueTask<long?> CreditAsync(string twitchUserId, long amountCopper, CancellationToken cancellationToken = default)
    Credits copper to a joined viewer and returns the new balance, or null on failure.
  • DebitAsync
    method
    ValueTask<long?> DebitAsync(string twitchUserId, long amountCopper, CancellationToken cancellationToken = default)
    Debits copper from a joined viewer and returns the new balance, or null when they can't afford it / on failure.
  • DefineShopEntryAsync
    method
    ValueTask<RpgShopEntryInfo> DefineShopEntryAsync(string itemSlug, long priceCopper, int? perViewerLimit = default, int? globalStock = default, DateTimeOffset? availableFrom = default, DateTimeOffset? availableUntil = default, bool isActive = default, CancellationToken cancellationToken = default)
    Creates or updates a shop listing (streamer authoring), or null on failure. Nullable knobs mean unconstrained.
  • GetLedgerAsync
    method
    ValueTask<IReadOnlyList<RpgLedgerEntryInfo>> GetLedgerAsync(string twitchUserId, int limit = default, CancellationToken cancellationToken = default)
    A joined viewer's most-recent wallet ledger rows (newest first), or an empty list when unavailable.
  • GetShopAsync
    method
    ValueTask<IReadOnlyList<RpgShopEntryInfo>> GetShopAsync(CancellationToken cancellationToken = default)
    The streamer's currently-purchasable shop, or an empty list when unavailable.
  • GetWalletAsync
    method
    ValueTask<long> GetWalletAsync(string twitchUserId, CancellationToken cancellationToken = default)
    The viewer's balance in copper; 0 when not joined / unavailable.
  • SellAsync
    method
    ValueTask<RpgSellInfo> SellAsync(string twitchUserId, string itemSlug, int quantity = default, CancellationToken cancellationToken = default)
    Sells quantity of a held item back for currency, or null when not held / capped / on failure.