Generated reference. This page mirrors
Code/Banking/README.md, this module's source-of-truth documentation (Standards/02_DOCUMENTATION_STANDARDS.md §1). Edit it there, not here -- this file is regenerated on every docs build and any local edit is silently overwritten.
Banking¶
Purpose. A second, bank-held balance per character, distinct from Economy's cash on
hand, with a real "open an account" precondition. ROADMAP.md Milestone
14's
first build item: "legacy built the enabling hook and never the bank" — see
Legacy/01_FEATURE_INVENTORY.md's Economy section.
See Documentation/Architecture/26_BANKING.md
for the full design, including why this is a second balance rather than a UI on top of
IEconomyService.
Responsibilities.
- BankAccount / IBankingService / BankAccountStore — the account itself:
LoadAsync, HasAccount, GetSavingsBalance, OpenAccountAsync, DepositAsync,
WithdrawAsync. BankAccountStore is the one implementation; nothing else writes a
character's savings balance.
- OpenAccountAsync refuses a character who already has an account — a real, checkable
precondition, not an idempotent load-or-create.
- DepositAsync/WithdrawAsync compose with IEconomyService (LoadOrCreateAsync,
CanAfford, DebitAsync, CreditAsync) rather than duplicating balance-tracking; both
credit the destination balance before debiting the source, generalising
PropertyStore.PurchaseAsync's own ordering rule — see
26_BANKING.md §3.
- BankConfiguration — the operator-tunable interaction range (InteractionRange, default
150, no legacy precedent — banking never shipped in the original at all), following
DoorConfiguration's precedent
(05_CONFIGURATION.md).
- BankComponent — the placed-in-map entity: [Rpc.Host] RequestOpenAccount() /
RequestDeposit(int) / RequestWithdraw(int), each distance-gated against
IPawnLocator/BankConfiguration.InteractionRange, the same real check DoorComponent
established in Milestone 11.
- CharacterBankAccountComponent — the per-character replication surface: [Sync(FromHost)]
HasAccount / SavingsBalance, mirroring CharacterEconomyComponent's poll-and-assign shape.
- BankModule — registers IBankingService and the BankConfiguration schema.
Not responsible for.
- Moving cash — Economy's job; BankAccountStore calls IEconomyService.CanAfford/
DebitAsync/CreditAsync, it never touches cash-on-hand's own persisted document.
- Interest, fees, multiple account types, bank-to-bank transfers, or any risk on either
balance (robbery, confiscation) — no legacy precedent and no current consumer; see
26_BANKING.md §8.
- A bank UI panel — the Panel-vs-PanelComponent registry question this once cited is
resolved project-wide now (self-resolving PanelComponents via Applejack.Movement.LocalPawn,
scene-placed rather than routed through IHudRegistry/IMenuRegistry; see
Code/Economy/Ui/MoneyDisplay.razor for the worked example and Code/Ui/README.md's
"Panel-vs-PanelComponent" entry for the full writeup) — a bank UI panel itself is simply not
built yet, not blocked on anything.
- Who may place a bank, or any per-bank ownership/lock/seal state — a bank has none; see
26_BANKING.md §4.
Dependencies. Core (IServiceRegistry, IServiceResolver, IPersistenceBackend,
ISchemaRegistry, IGameLog, IConfigurationInspector), Character (CharacterId,
Character, ConnectionExtensions.GetCharacter()), Economy (IEconomyService), Movement
(IPawnLocator, for BankComponent's distance check).
Public API.
- IBankingService — LoadAsync(CharacterId), HasAccount(CharacterId),
GetSavingsBalance(CharacterId), OpenAccountAsync(CharacterId),
DepositAsync(CharacterId, int), WithdrawAsync(CharacterId, int).
- BankComponent, CharacterBankAccountComponent.
Events published. None yet — no current consumer, following Economy's own identical
deferral of a MoneyChanged event.
Persistence. BankAccountDocument { CharacterId, SavingsBalance } under
bankaccounts/{characterId}, schema version 1.
Future improvements.
- Interest, fees, multiple account types, bank-to-bank transfers — all named in
26_BANKING.md §8
as bigger scope than this pass.
- A bank HUD/menu panel once the Panel-vs-PanelComponent registry question is resolved.
- A MoneyChanged/SavingsChanged event once a UI or scoreboard consumer exists.