Skip to main content

Banking & Deposit Box

This document covers the Bank Actions and Deposit Box Actions APIs, as well as the Bank Workflow Builder for assembling declarative, tick-advanced banking sequences.


Banking Flow Workflow


Bank Actions API

BankActions is the result-aware bank interaction API. It requires the bank to be open for item and mode operations. All write methods return InteractionResult and are paced.

Core Methods

  • isOpen(): Returns true if the bank interface is open and visible.
  • openNearest(): Interacts with the nearest bank object that has a currently reachable interaction tile, then falls back to a bank NPC when no reachable bank object matches.
  • count(int itemId) / count(String name): Returns the quantity of the item in the bank.
  • contains(int itemId, int quantity) / contains(Collection<Integer> ids, int quantity): Checks if the bank contains the specified item(s).
  • withdraw(int itemId, int amount) / withdraw(String name, int amount): Withdraws the specified quantity.
  • withdrawNoted(int itemId, int amount) / withdrawNoted(String name, int amount): Withdraws the specified quantity in noted form.
  • withdrawAll(int itemId) / withdrawAll(String name): Withdraws all of the item (queues Withdraw-All).
  • depositInventory(): Deposits the entire inventory.
  • depositEquipment(): Deposits all equipped items.
  • depositAll(): Alias for depositInventory().
  • ensureWithdrawMode(boolean noted): Toggles withdraw mode (noted or item).
  • ensureWithdrawMode(BankWithdrawMode mode): Typed overload for item/note mode.
  • ensureWithdrawQuantity(int amount): Sets the default withdraw quantity.
  • click(BankWidget widget): Clicks supported typed bank controls, returning a result.

Example

InteractionResult open = BankActions.openNearest();
if (open.failed()) {
return;
}

if (BankActions.isOpen() && BankActions.count(561) >= 100) {
BankActions.ensureWithdrawMode(BankWithdrawMode.NOTE);
BankActions.withdrawNoted(561, 100);
}

Important Behavior

  • openNearest() resolves targets dynamically without hardcoded object or NPC IDs. Bank objects must expose a Bank action and at least one interaction tile reachable from the player's current collision region; inaccessible booths are skipped.
  • close() succeeds when the bank is already closed; otherwise it waits for ActionPacer and clicks the first visible bank-group widget that exposes a Close action.
  • ensureWithdrawQuantity(...) sets the requested quantity varbit only after confirming the bank is open.
  • Do not change BankInteraction.withdrawX(Widget, int, boolean) default-amount behavior without live verification.

Deposit Box Actions API

DepositBoxActions interacts with the bank deposit box interface (widget group 192), allowing bulk or selective deposits without opening a full bank interface.

Query Methods

  • isOpen(): Returns true if the deposit box container (group 192) is visible.

Action Methods

  • depositAll(): Clicks the deposit-all-inventory button (child 4).
  • depositEquipment(): Clicks the deposit-all-equipment button (child 6).
  • deposit(int itemId, int quantity): Deposits the exact quantity of the item.
  • deposit(String name, int quantity): Deposits by display name (partial, case-insensitive).
  • deposit(Predicate<Widget> predicate, int quantity): Deposits items matching a widget predicate.
  • close(): Clicks the close button (child 1).

Deposit Quantity Mapping

QuantityAction Queued
1Deposit-1
5Deposit-5
10Deposit-10
Any other valueDeposit-All

Bank Workflow Builder

BankWorkflowBuilder assembles StepHandler chains to coordinate bank movement, opening, depositing, loadout-satisfying withdrawals, and equipment styling. It extends AbstractWorkflowBuilder, so build() returns a StepHandler you advance once per tick.

Internal Services (Auto-Wired)

Unlike other workflow builders, the BankWorkflowBuilder wires its Services internally. create() binds live SDK-backed services automatically.

boolean isBankOpen();
boolean openNearestSceneBank();
WorldPoint nearestBankPoint(WorldPoint source);
WorldPoint playerLocation();
void walkTo(WorldPoint destination);
boolean isWalking();
boolean withdraw(InventoryLoadout loadout, int maxActions);
boolean equip(EquipmentLoadout loadout);

Example: Full Reconcile

reconcile runs the full walk → open → deposit foreign → withdraw missing → equip cycle from a declared target state:

InventoryLoadout inv = new InventoryLoadout();
inv.add(LoadoutItem.builder(ItemID.YEW_LOGS).amount(27).build());
inv.add(LoadoutItem.builder(ItemID.KNIFE).amount(1).build());

EquipmentLoadout eq = new EquipmentLoadout();
eq.add(LoadoutItem.builder(ItemID.STAFF_OF_FIRE)
.slot(EquipmentInventorySlot.WEAPON).build());

StepHandler bank = BankWorkflowBuilder.create()
.reconcile(inv, eq)
.build();

Example: Granular Verb Chaining

StepHandler bank = BankWorkflowBuilder.create()
.openNearest() // walk to and open the nearest scene bank
.depositInventory() // deposit everything in the inventory
.depositEquipment() // deposit everything worn
.withdraw(inv) // withdraw to satisfy the inventory loadout
.equip(eq) // wield items the equipment loadout wants worn
.build();

Tick Usage Pattern

Hold the handler as plugin state and advance it; rebuild/reset when the banking task changes:

private StepHandler bank;

@Subscribe
public void onGameTick(GameTick event) {
if (bank == null) {
bank = BankWorkflowBuilder.create().reconcile(inv, eq).build();
}
if (!bank.isCompleted()) {
bank.step();
} else {
bank = null; // ready for next cycle
}
}

Testing

Swap mock services in @Before and restore them in @After:

@Before public void setUp() { BankWorkflowBuilder.setServicesForTesting(fake); }
@After public void tearDown() { BankWorkflowBuilder.resetServicesForTesting(); }

Combine with ActionPacer.reset() in @Before for any step gated by pacing.