RunePouch

Group
player
Methods
5
Fields
None

Getting one

player:magic():runePouch()

Methods

MethodReturnsDescription
isCarried()booleanWhether the pouch is in the inventory.
contents(){ { rune: Rune, quantity: number } }What a spell can draw on from the pouch now: empty while no pouch is carried.
storedContents(){ { rune: Rune, quantity: number } }The pouch's contents as the game's vars hold them, which stay set while the pouch is banked. To ask what a spell can use, read contents.
missing({ { rune: Rune, amount: number } }){ Rune }Which of runes the pouch does not hold enough of, read as storedContents is.
fillFromBank({ { rune: Rune, amount: number } })(RunStatus, string?)One step towards a pouch holding runes, with the bank open: open the pouch, empty it when it holds a rune the list does not want or has n…

Returned by

MethodReturnsDescription
Magic.runePouchRunePouchThe rune pouch.

Method details

contents

contents: (RunePouch) -> { { rune: Rune, quantity: number } }

What a spell can draw on from the pouch now: empty while no pouch is carried.

storedContents

storedContents: (RunePouch) -> { { rune: Rune, quantity: number } }

The pouch's contents as the game's vars hold them, which stay set while the pouch is banked. To ask what a spell can use, read contents.

missing

missing: (RunePouch, { { rune: Rune, amount: number } }) -> { Rune }

Which of runes the pouch does not hold enough of, read as storedContents is.

runes
Each { rune, amount }, at least amount of rune.
Returns
The runes that are absent or short; empty when it holds them all.

fillFromBank

fillFromBank: (RunePouch, { { rune: Rune, amount: number } }) -> (RunStatus, string?)

One step towards a pouch holding runes, with the bank open: open the pouch, empty it when it holds a rune the list does not want or has no room for one that it does, withdraw all of each missing rune into it, close it. It leaves the bank open.

local status, reason = player:magic():runePouch():fillFromBank({
    { rune = Rune.LAW, amount = 500 },
    { rune = Rune.WATER, amount = 1000 },
})
if status == "blocked" then log:warn(reason) end
-- "running": a click was queued, call again next tick. "done": it holds them, shut.
runes
Each { rune, amount }, at least amount of rune.
Returns
"done" when the pouch holds them and its bank-side interface is shut, "running" when a click was queued, and "blocked" with the reason when the bank is not open, no pouch is carried, or the bank lacks a rune.