diff options
| author | historia <[not public]> | 2026-06-24 20:58:25 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-24 20:58:25 -0400 |
| commit | 9d4b799db4868bcab291b83599ff088763cd4ed6 (patch) | |
| tree | 252f0fcc779acf35243983d643d6399ee2e0cd0b /building_guide/bank.md | |
| parent | d25638d98fe63efdeab570ef77e6a6a97f2d7a60 (diff) | |
| download | thehouseoficarus-9d4b799db4868bcab291b83599ff088763cd4ed6.tar.gz | |
feat: new type of non-violent 'combat': work
Diffstat (limited to 'building_guide/bank.md')
| -rw-r--r-- | building_guide/bank.md | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/building_guide/bank.md b/building_guide/bank.md new file mode 100644 index 0000000..0a5ec88 --- /dev/null +++ b/building_guide/bank.md @@ -0,0 +1,68 @@ +# 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. + +```yaml +id: bank_booth +name: bank booth +color: "226" +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 <item>` | Move item from inventory to bank | +| `deposit all` | Deposit entire inventory | +| `withdraw <item>` | 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). |
