Violet

Cash Shop

On this page

Use core.cash_shop to inspect the Cash Shop and transfer eligible cash items through the locker.

Cash Shop state required

Locker reads return nil when the locker is unavailable. Transfer actions return false when the Cash Shop is closed, the locker is busy, or the selected item is not eligible.

A true action result means the transfer was submitted. Wait for the locker to become idle before reading or changing it again.

Locker Item Structure

core.cash_shop.locker.get_items() returns locker item records:

PropertyTypeDescription
cash_snnumberOpaque locker identifier carried by the item record
idnumberItem ID
tab_idnumberDestination inventory category
namestring?Display name when available

Pass the complete record back to withdraw_regular(); do not construct locker records manually.

Functions

core.cash_shop.is_open() -> boolean

Returns whether the Cash Shop is currently open and supported.


core.cash_shop.locker.is_busy() -> boolean

Returns whether the locker is waiting for an earlier transfer to finish.


core.cash_shop.locker.get_items() -> table<locker_item> | nil

Returns the items currently visible in the locker.


core.cash_shop.locker.withdraw_regular(item: locker_item, destination_slot: number) -> boolean

Withdraws an eligible locker item into destination_slot. Pass an item returned by get_items().


core.cash_shop.locker.deposit(inventory_item: table) -> boolean

Deposits an eligible cash item from the character inventory. Pass the item record returned by the matching core.inventory getter so its identity and position can be validated.

lua
local locker = core.cash_shop.locker
local items = locker.get_items()
if items and items[1] and not locker.is_busy() then
    locker.withdraw_regular(items[1], 1)
end