bank

Bank open, deposit and withdraw, the PIN, and loadouts.

Methods
23
Fields
None

Getting one

bank

Methods

MethodReturnsDescription
isOpen()booleanWhether the bank interface is open. A pure read.
isNearBank()booleanWhether the bank is open, or a bank booth, chest or banker is in range.
cached()RememberedItems?The bank as this account last saw it, kept across relogs and restarts.
seedVault()RememberedItems?The seed vault as this account last saw it, kept across relogs and restarts.
onPinScreen()booleanWhether the bank PIN keypad is open. A read only: no call types a PIN, so a plugin stops here and hands back to the player.
enablePinKeyboard()()Lets the number keys the player types press the bank PIN keypad's digits, with no click and no mouse movement. It lasts one opening of the…
withdrawNotesEnabled()booleanWhether the bank's Note withdrawal mode is on.
nearestBanker()NPC?The nearest banker NPC exposing Bank.
depositBox()DepositBoxThe deposit box interface.
search()ContainerQueryA query over the bank's contents, live or last-known. An unseen bank reads as empty: cached() ~= nil tells the two apart.
item(number)ItemHandle?The first bank slot holding an item.
deposit(number, number | "all")booleanDeposit from the inventory.
withdraw(number, number | "all")booleanWithdraw from the bank.
depositInventory()booleanPress the bank's Deposit inventory button.
depositEquipment()booleanPress the bank's Deposit worn items button.
depositLootingBag()booleanClick Deposit on the looting bag in the inventory.
depositContainers()booleanPress the bank's Deposit loot bags and other containers button.
setWithdrawNotes(boolean)booleanTurn Note withdrawal mode on or off. The bank's button flips the mode, so this presses it only when the mode differs.
togglePlaceholders()booleanToggle placeholders.
click(string, string)booleanUse one named option on one bank item, the route to an option withdraw has no amount for ("Withdraw-All-but-1").
open(string?)booleanOpen the nearest bank.
close()booleanClose the bank with its frame's close button.
newLoadout(EquipmentGoal, InventoryGoal)LoadoutA bank trip towards a goal: open the bank, deposit what the goal does not want, withdraw and equip what it does. The goal is fixed here, an…

Method details

isOpen

isOpen: (Bank) -> boolean

Whether the bank interface is open. A pure read.

isNearBank

isNearBank: (Bank) -> boolean

Whether the bank is open, or a bank booth, chest or banker is in range.

cached

cached: (Bank) -> RememberedItems?

The bank as this account last saw it, kept across relogs and restarts.

nil until this account's bank has been opened with Bento running: an unseen bank and an empty one are different answers. live while the bank is open. The rows are read-only: to act on an item, withdraw or click with the bank open.

seedVault

seedVault: (Bank) -> RememberedItems?

The seed vault as this account last saw it, kept across relogs and restarts.

nil until the seed vault has been opened with Bento running. live while it is open.

onPinScreen

onPinScreen: (Bank) -> boolean

Whether the bank PIN keypad is open. A read only: no call types a PIN, so a plugin stops here and hands back to the player.

enablePinKeyboard

enablePinKeyboard: (Bank) -> ()

Lets the number keys the player types press the bank PIN keypad's digits, with no click and no mouse movement. It lasts one opening of the keypad: call it each time the keypad is set up (the bankpinButtonSetup script callback). The player types the PIN; no call types one.

nearestBanker

nearestBanker: (Bank) -> NPC?

The nearest banker NPC exposing Bank.

Returns
nil when none is reachable.

item

item: (Bank, number) -> ItemHandle?

The first bank slot holding an item.

bank:item(id) ~= nil says whether the bank holds it, and its quantity() how many. Read from the bank container, which is remembered after the bank closes.

itemId
Exact item id.
Returns
nil when the bank does not hold it.

deposit

deposit: (Bank, number, number | "all") -> boolean

Deposit from the inventory.

bank:deposit(id, "all") deposits every one; it takes any amount. A repeat of the same call is not throttled.

itemId
Exact item id.
amount
A whole number from 1, or "all".
Returns
false when the bank is shut or the inventory does not hold it.

withdraw

withdraw: (Bank, number, number | "all") -> boolean

Withdraw from the bank.

bank:withdraw(id, "all") and bank:withdraw(id, n). Withdraw-X opens the amount prompt; ui:dialogue():typeAmount(n) answers it.

itemId
Exact item id.
amount
A whole number from 1, or "all".
Returns
false when the bank is shut or does not hold it.

depositInventory

depositInventory: (Bank) -> boolean

Press the bank's Deposit inventory button.

Returns
false when the bank is shut.

depositEquipment

depositEquipment: (Bank) -> boolean

Press the bank's Deposit worn items button.

Returns
false when the bank is shut.

depositLootingBag

depositLootingBag: (Bank) -> boolean

Click Deposit on the looting bag in the inventory.

Returns
false when the bank is closed or the inventory holds no looting bag.

depositContainers

depositContainers: (Bank) -> boolean

Press the bank's Deposit loot bags and other containers button.

Returns
false when the bank is shut.

setWithdrawNotes

setWithdrawNotes: (Bank, boolean) -> boolean

Turn Note withdrawal mode on or off. The bank's button flips the mode, so this presses it only when the mode differs.

on
What it should be.
Returns
true when it already is, or the click was queued; false when it differs and the bank is shut.

togglePlaceholders

togglePlaceholders: (Bank) -> boolean

Toggle placeholders.

Returns
false when the bank is shut.

click

click: (Bank, string, string) -> boolean

Use one named option on one bank item, the route to an option withdraw has no amount for ("Withdraw-All-but-1").

item
The name pattern, matched as for inventory:containsName.
option
The option to use, e.g. "Withdraw-All".
Returns
false when the bank is shut, no item matches, or it has no such option.

open

open: (Bank, string?) -> boolean

Open the nearest bank.

Already open is success. Returns false when no bank target is in range (logged once per run of misses). One search a tick per client: a second call in the tick reuses the first's result, so a miss costs nothing the second time.

The nearest banker or bank object by path. It does not answer the PIN-settings warning, and it banks on an ultimate ironman.

target
Name pattern to prefer; omit for the nearest of any kind.

close

close: (Bank) -> boolean

Close the bank with its frame's close button.

The button is Bankmain.FRAME op 1 on child 11. Not Escape (ui:pressKey(KeyEvent.VK_ESCAPE)), which closes the bank only while the game's Escape-closes-interfaces setting is on.

Returns
false when the bank is not open.

newLoadout

newLoadout: (Bank, EquipmentGoal, InventoryGoal) -> Loadout

A bank trip towards a goal: open the bank, deposit what the goal does not want, withdraw and equip what it does. The goal is fixed here, and a malformed goal raises here, so a typo cannot leave an item out of a goal and deposit it. It reads no game state, so make it once, when the plugin loads or starts, and keep it: its run advances one step a tick.

local trip = bank:newLoadout("4151:1,1704:1", { { itemId = ItemID.SHARK, quantity = 10 } })

function plugin:onGameTick()
    local status, reason = trip:run()
    if status == "done" then
        -- worn and carried: move on
    elseif status == "blocked" then
        log:warn(reason) -- it will not get there by itself: fetch what it lacks, or stop
    end
    -- "running": it acted, or is waiting for its last click to land
end
equipment
What to wear, and which slots to keep empty. A slot it does not name is left as it is, so an empty goal changes nothing worn.
inventory
What to carry; everything else carried is deposited.