Skip to main content
Corvus Connection

RPG: Buy Item

Rpg
Action
Portent preview
Pro
rpg.buyItemBuys a shop item for a joined viewer in one atomic step: the funds, stock, per-viewer limit, availability window, and active checks all pass or nothing changes. Defaults to the triggering viewer; set userId to target a specific viewer. Safely no-ops on any rejection.Buys the shop item for a viewer; binds bought / itemName / totalPrice / newBalance.
Engagement

Inputs

Name
Kind
Type
Flags
in
Exec
exec
multiplexed
  • Name
    in
    Kind
    Exec
    Type
    exec
    Flags
    multiplexed

Outputs

Name
Kind
Type
Flags
out
Exec
exec
None
bought
Data
System.Boolean
multiplexed
itemName
Data
System.String
multiplexed
totalPrice
Data
System.Int64
multiplexed
newBalance
Data
System.Int64
multiplexed
  • Name
    out
    Kind
    Exec
    Type
    exec
    Flags
    None
  • Name
    bought
    Kind
    Data
    Type
    System.Boolean
    Flags
    multiplexed
  • Name
    itemName
    Kind
    Data
    Type
    System.String
    Flags
    multiplexed
  • Name
    totalPrice
    Kind
    Data
    Type
    System.Int64
    Flags
    multiplexed
  • Name
    newBalance
    Kind
    Data
    Type
    System.Int64
    Flags
    multiplexed

Parameters

Name
Type
Required
Default
Choices
itemSlug
System.String
yes
""
None
quantity
System.Int32
no
1
None
userId
System.String
no
""
None
  • Name
    itemSlug
    Type
    System.String
    Required
    yes
    Default
    ""
    Choices
    None
  • Name
    quantity
    Type
    System.Int32
    Required
    no
    Default
    1
    Choices
    None
  • Name
    userId
    Type
    System.String
    Required
    no
    Default
    ""
    Choices
    None

Lowers to C#

var purchase = await ctx.Rpg.Economy.BuyAsync(userId, itemSlug, quantity);