aboutsummaryrefslogtreecommitdiff
path: root/dev_guide/bank.md
blob: ed890a75870c303a1c07de9b3a5fdd9e7be1200e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# Bank system internals

Builder-facing bank documentation (booth object, room placement, player
commands) lives in [../building_guide/bank.md](../building_guide/bank.md).
This page covers the engine side.

## Session state

`StateBank` (defined in `internal/net/server.go`) is the session state for
the bank interface. Input is routed through `handleBankInput` in
`internal/game/cmd_bank.go`.

## Player storage

Bank items are stored in the `Player.Bank` field (`map[int]*InventorySlot`),
saved in character YAML. Bank slots are sequential and reuse freed slots.
There is no slot limit.

## Command dispatch

- `bank` is classified as `ClassActive` in `classifyCommand()`
- `bank` case in `executeCommand()` calls `doBank(sess)`
- `doUse()` checks for `"bank"` or `"bank booth"` targets and routes to
  `doBank()`
- `doBank()` checks for a `bank_booth` object in the current room
- `handleBankInput()` dispatches deposit/withdraw/browse/leave commands