# Bank System The bank system allows players to store items permanently, freeing up inventory space. ## Objects ### bank_booth A bank terminal that players can interact with. Has no special behavior — the `bank` command checks for any `bank_booth` object in the room. (**The filename is the ID** — `bank_booth.yaml` → `bank_booth`; no `id:` field.) ```yaml name: bank booth color: "E2" description: "..." inroom_description: "A bank booth is set into the wall." ``` To place a bank booth in a room, add it to the room's `objects:` list: ```yaml objects: - id: bank_booth ``` ## Commands | Command | Description | |---------|-------------| | `bank` | Opens bank interface (requires bank booth in room) | | `use bank` | Same as `bank` | ### Bank Interface Commands | Command | Description | |---------|-------------| | `deposit ` | Move item from inventory to bank | | `deposit all` | Deposit entire inventory | | `withdraw ` | Move item from bank to inventory | | `browse` / `list` | Show bank contents | | `leave` | Exit bank interface | ## Implementation ### 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 ### Data Files | File | Purpose | |------|---------| | `data/objects/bank_booth.yaml` | Bank booth object definition | | `data/help/bank.yaml` | Help topic for the bank system | Default bank booth locations: Town Square (room 1), Forge (room 12).