aorecomp

Anarchy Online classic in the browser

git clone https://aorecomp.ubeagle.com/code/aorecomp.git


docs/bank-storage.md (26908B)


Bank storage

The 14.9.1 bank uses 102 logical slots, numbered 0..101. The owner's bank is available through the 201 Rubi-Ka Banking Service Terminals authored in the original statel resources. Opening uses the normal GenericCmd Use request; CharacterAction 106 closes the bank.

Original evidence

The original DLLs, rather than a modern server emulator's storage limit, define this contract. Original addresses below use image base 0x10000000.

The complete local evidence bundle is local/bank-research/native/: 284 KKR, 21 LLR and 145 DDR records, five exact reused records, retained snapshots, ledger.md and citations.json validating 65 citations. Static client evidence establishes packet and client behavior; it does not observe an original server.

Follow-up bundles in local/bank-failure-research/feedback/ and gestures/ retain original KKR, DDR and CCR snapshots, records and ledgers, with 10 and 28 validated citations respectively. They establish the source-refresh timer side effect and default gestures. The original server's choice of rejection message remains unknown.

tools/data/extract_banks.py extracts template 116807 from every original 14.9.1 type-1000026 resource. It validates identities, record boundaries and the exact per-instance script descriptor, then generates server/gamedata/banks.yaml. The retained local/bank-research/placements.json includes original record bytes, resource hashes and the resource index hash. Independent extraction and authored OnUse effect 53092 are recorded in local/bank-research/content/. For example, terminal 51005:0xc00502c1 is in Omni1 Entertainment, playfield 705, at [985,20.2001,580]. Its template has no faction, level, skill or combat requirement.

Wire representation

BankIIR has the owner SimpleChar envelope and these big-endian fields:

Field Encoding
CASH, XP, PLAYERID Three u32 values
Inventory count (entryCount + 1) * 1009, u32
Each entry u32 slot, u16 flags, u16 count, u32 type, u32 instance, u32 low template, u32 high template, u32 quality, u32 auxiliary

Template entries use flags3; portable Chests and Mission Keys28577 use flags2. These rows retain actual identities and can use template data until a live object exists. Bank opening sends the bank snapshot without creating owned Chest objects; normal Use after withdrawal creates the carried Chest. There is no trailing proxy identity. Bank slots never pass through the ordinary inventory conversion from internal 64..93 to native 48..77.

ContainerAddItem (0x47537a24) uses these identities:

Transfer Source Destination
Ordinary inventory to bank (104,nativeSlot) (57005,ownerID)
Bag contents to bank (107,(handle<<16)&#124;slot) (57005,ownerID)
Bank to ordinary inventory (105,bankSlot) (50000,ownerID)
Bank to carried bag (105,bankSlot) (51017,bagID)

The native producer normally sends destination slot 111. The acknowledgement uses the authoritative first-free logical slot. Action 146 translates ordinary source slots only, preserving bank and packed bag source positions. Unique withdrawal rejection also sends native TextMessage 0x5f4b442a with the same wording as the client's local validator: You already have this unique item....

Character slot attachment

An owned SimpleItem FullUpdate's explicit slot addresses the parent character's ordinary/equipment inventory during native attachment. Setting page105 does not redirect that attachment into the bank. Original kkr.dll routines 0x100b25c0 and 0x10063340 show this path; retained pseudocode is under local/ncu-upgrade-research/native/. The maintained call at client/game/kkr.dll/lifted-0053.c::sub_360B25C0 passes character+0x150 to sub_36063340 for this attachment.

Creating banked backpacks on opening the bank therefore overwrote unrelated native character rows. A controlled worn weapon1 in slot6 became type51017/id2 when banked backpack2 also occupied bank slot6. The row retained the weapon's template endpoints, while durable ownership still correctly held weapon1 and banked bag2. This was a native identity collision, not loss from storage.

Bank opening now publishes only BankIIR. It leaves existing character rows alone and allows an uninstantiated bag to withdraw normally. Its subsequent ordinary Use creates a Chest at its actual carried slot. No replacement slot, extra identity or client workaround is introduced.

TestBankOpeningDoesNotAttachStoredBackpackToCharacterSlots covers worn slot6 and both carried boundaries (shared64/93, native48/77) against overlapping bank slots, with no writes and unchanged cold ownership. The short native TestBrowserBankBackpackPreservesWornIdentity reproduces the corruption, then verifies the fixed opening, actual bag withdrawal/open/close/redeposit, weapon removal/rewear, page replay and exact cold ownership. The returned bag uses normal first-free bank slot0. This is a controlled fixture, not earned play.

Captures are local/bank-attachment/20261103-185531/ before and 20261103-185932/ after. The corrected native check takes20 seconds. The broader disappearance audit remains open.

Server policy and persistence

item_locations.bank_player_id is a distinct root placement. Its constraints allow exactly one owner/location per instance and one item per bank slot. Character-editor YAML exposes a top-level bank map with slot_1 through slot_102, alongside the equipment and inventory maps. The control panel shows item names and instance links. Banked backpacks retain their child placements.

Every accepted transfer, split, merge or deletion commits item identities, counts and both placements atomically before acknowledging success. Bank items are excluded from carried equipment modifiers and reclaim. Session gates reject stale clients, invalid owners, dead/loading players, overlapping equipment work, closed banks and movement beyond the opening locality. A banked bag's previously open handle is closed; direct/stale access requires the bag to be carried again. That security gate is a reconstruction policy; original client static evidence only establishes the normal UI prohibition on using bank items.

CASH and XP are sent as zero: their original server semantics remain unresolved. Filled-bag deletion follows the current inventory policy of atomically deleting children; historical server policy is not established. Stack representation is limited to 65535 units without wrapping; the original server's permitted maximum is not established. A rejected optimistic bank split replaces the bank snapshot; the server retains the original opening anchor even though native BankIIR activation refreshes its local anchor. The server locality remains authoritative.

Bank transfers cannot overlap pending equipment work. A busy withdrawal sends CharacterAction 146 with its page-105 source slot to restore the picked icon; replaying BankIIR alone leaves that cell marked dummy. This also stops the native equip bar, while retaining the admitted server move and deadline. A busy carried deposit validates its source and uses the shared ordinary-slot correction. These refusals use native source-refresh contracts; the original server's packet selection is not established.

TestBankTransferRejectionPreservesPendingEquipmentTimer checks both replies, unchanged database bytes, move/deadline and bank opening anchor. Completing the move permits deposit and withdrawal retries with exact stack and weapon ownership after cold recovery. TestBrowserBankDepositDuringEquipment holds a real axe placement after the native bar ends, attempts a native deposit, verifies source restoration with the bank still open, then completes and retries. Page replay and cold recovery retain all four physical instances. This is a controlled late-completion fixture, not earned progression. Captures and packet checks are retained in local/pending-bank/; the broader disappearance audit remains open.

The same WASM fixture also refuses withdrawal of the deposited part while a later axe equip awaits server completion. It waits for actual server admission, then for the local bar to end, checks source cancellation and unchanged durable ownership, completes the original move and retries from the same bank window. Page replay and cold database loading account for all four physical instances. The original hidden-icon reproduction is retained in local/pending-bank-withdrawal/.

Late withdrawals after a bank close or loss of locality use that same source correction, including while equipment is pending. The Go fixture covers both unavailable states without changing the admitted move or durable inventory. The WASM fixture processes the real bank-close handler at a controlled checkpoint before delivering another native withdrawal. Its source must remain usable, and ordinary terminal reopening after equip completion permits retry. This close checkpoint isolates a late request; it does not establish earned travel. Evidence: local/pending-bank-unavailable/.

Contained deposits also validate their open carried bag, handle and member before refusing a busy transfer. CharacterAction 146 retains the full packed page-107 source slot and restores its icon. This stops the native equipment bar; the controlled runtime reproduction waits until that bar has ended while server completion remains pending. The admitted server move/deadline, bank anchor, bag handle and durable ownership remain unchanged. TestBankContainedDepositDuringEquipmentRestoresSourceForRetry checks an unknown handle, exact cancellation, unchanged database bytes and completion/ retry with cold ownership. The combined WASM fixture now also verifies a contained source, same-window retry into bank slot 1, and all four physical instances after page and cold recovery. Captures and packet checks are retained in local/pending-contained-bank/. Original server refusal packet choice remains unestablished.

Briefcase of Holding (205736) opens the same bank from ordinary inventory or known carried backpack contents. Its authored Use requirements are Bureaucrat, effective Psychology >=300, title level >=4 and no combat. Opening does not consume the Briefcase or change its placement. Terminal and portable access share the bank snapshot, transfer rules and five-metre opening anchor. See remote bank access for source evidence, verification and the remaining wielded-weapon work.

Verification

Automated coverage exercises all 201 terminal identities, three-dimensional range boundaries, ownership/session/life-state gates, all 102 storage slots, filled bags, stack quantities and identities, full-bank/full-inventory rejection, repeated and concurrent transfers, Unique low-template scope across quality endpoints, loaded weapon ammunition, deletion, death/reclaim exclusion, failed writes and failed COMMIT. A real world connection verifies that closing the bank cannot reload. Bank, backpack, inventory, reload and item-store tests also run twice under the Go race detector.

The hardware WASM run used two Chromium clients on the GPU with OpenGL 4.5. Native controls opened private banks, deposited/withdrew a filled bag and its child, split ammunition into 1+99 units, and displayed Bank is full with 102 entries. A heap read verified capacity 102 and occupied slot 101. After a real server restart, every stored item/count/placement matched the prior snapshot; the client bank matched all 101 remaining stored entries, and withdrawing the bag restored its child. Moving away cleared the native bank proxy. Browser errors were empty. Evidence is retained in local/bank-smoke/verification.json, wire captures, native heap snapshots, screenshots and SQLite snapshots.

An additional hardware WASM run exercised server-side Unique rejection while the duplicate was hidden inside an unopened carried backpack. Both repeated attempts restored the bank icon and showed the Unique message, with no contract error, unchanged item/count/placement snapshots and the same native bank proxy. Opening that backpack made the local validator reject the duplicate before sending a request. Depositing its Unique/NoDrop child into a bank already holding duplicates succeeded; withdrawing a duplicate succeeded once none was carried.

Native Delete cancellation preserved every instance; confirmation removed only the selected bank item. Ctrl-split conserved six total charges, and placing its retained source into an empty bank cell persisted its visual position through bank closure and a full browser reload. Withdrawing the one- and three-charge stacks, merging them in ordinary inventory and redepositing preserved the kept instance with four charges and removed only the consumed instance. Full ordinary inventory displayed the native inventory-full message without sending a transfer or changing any instance. After depositing one pistol, withdrawal succeeded into the freed slot with its original ID and two-charge quantity. Evidence is retained in local/bank-failure-smoke/ with wire captures, native heap reads, OPFS layout data, screenshots and SQLite snapshots.

A separate hardware WASM check in local/bank-split-rejection-smoke/ verifies server-rejected optimistic splits. A browser-only test hook changes the next bank split's retained count from one to zero immediately before WebSocket send. At that point a native heap read proves the client already has a one-charge source and a temporary two-charge clone. Each of two rejected attempts receives BankIIR, removes the clone and restores the original three-charge source. SQLite item values, placements and allocation high-water mark remain unchanged; the other bank stacks, worn pistol, ordinary items and backpack child survive. The cursor still holds its selected source, so the test returns it to an empty bank cell before continuing. A normal split, both withdrawals, an ordinary merge and redeposit then succeed, preserving six total Essence charges and the kept original instance. This verifies the current server's correction policy; the fault hook does not reproduce an original server's rejection decision. A full browser reconnect preserved the final items, counts, placements and backpack child. verification.json in that bundle checks the packet mutation, optimistic and restored native inventories, SQLite snapshots and subsequent operations. Focused bank split/stack Go tests also passed twice (8.452 seconds).

The full-bank rejection above was performed locally by the native client; it does not prove receipt of the server rejection packet. Owned test players, items, clients and browser contexts were removed after verification, with other database rows checked unchanged. The single shared preview remains available.

Regression logs are retained in local/bank-research/: the full Go suite passed (server 412.712 seconds, game data 9.155 seconds), repeated race coverage passed (193.522 seconds), and vet passed with the existing -stdversion=false workaround. The final reload simplification and loaded-weapon transfer have additional focused passing runs. The terminal extractor was rerun to verify reproducibility.

The source-refresh follow-up has passing bank/backpack coverage and a new full Go run (server 391.978 seconds, game data 7.630 seconds), plus clean vet with the same version workaround. Bank, backpack, inventory, equipment, reload and item-store tests passed twice under the race detector (333.882 seconds). The new feedback, pending-equipment and native-slot regressions fail against the previous production code using a temporary Go overlay. Runtime conservation checks pass in local/bank-failure-smoke/verification.json; cleanup confirms only the owned test character and items were removed and SQLite integrity remains sound.

Backyard1 native access

The reported invisible Backyard1 bank is usable with the original model and placement. In the retained earned-level-eight south approach, its origin projects to [-353.66, 1022.52] on a 1024x768 frame. Being within five metres and having a typed actor did not put its body in the camera view. A controlled nearby checkpoint reproduces another off-screen third-person projection; ordinary first-person alignment exposes the complete bank and its native pick/Use target. The driver observes the camera transition before picking.

Fresh original-resource reads compare the complete template 116807 descriptor with the maintained catalog and inspect these two original statels:

Placement Playfield Identity Position
Backyard1 3000 51005:3221752760 109.204704, 115.000130, 152.970703
Indoor control 1183 51005:3221357727 196.798264, 5.009963, 136.839828

Both have no per-instance stat overrides and use stat 12's model 1010001:55865, SHA256 d84ecb6fba5c56c9e2608467db3b5119903a4f81f0c7b918da463d652b10dd71. Their different authored rotations remain intact. Original KKR PlayfieldAnarchy_t::CreateRDBDynels at 0x1014d650 and activation 0x100b25c0 were checked through REA; retained evidence is ev_895d39b7b3e640e05cbe14541292b364f1f38252caee2d420b36101fccb2e16b. The complete audit, payloads and activation evidence are under local/backyard-bank/. This result supports retaining the original rendering, geometry and placement.

TestBrowserBackyardBank uses the maintained GameTest harness, real native input and two controlled level-one players with one Monster Part each. At each placement it picks the real terminal, waits for the rendered bank window, deposits and withdraws the exact item, closes the bank, reloads the page and deposits it again. After closing the original database, a new server and fresh browser contexts reopen each bank and withdraw those same physical IDs. Native inventory and server state agree on template, QL, quantity, ammunition and slot. No native/page errors occurred. These are controlled item-contract fixtures, not earned acquisition or a replay of the earlier city approach.

The complete native check passed in 46.44s; screenshots and traces are retained under local/backyard-bank/20261102-111304/. Focused bank Go tests passed in 20.021s, and vet passed. The production server, original resources and published WASM remain unchanged. This closes the specific Backyard1 report; it does not establish physical access to every original terminal.

AO_GAME_TEST=1 go test ./server -run '^TestBrowserBackyardBank$' -count=1 -timeout=4m -v

Retained finite weapons through bank recovery

TestBrowserBankedWeaponRecovery covers the native usability missing from the Go-only loaded-weapon round trip. A controlled level-100 Adventurer starts beside the original indoor bank with one worn QL30 M-10 pistol, 19 loaded rounds and an unrelated 100-Bullet stack. The native inventory removes and deposits the same weapon, then the page reloads while it remains banked. Native bank input withdraws it into the first free carried slot; it re-equips and fires one shot. A second deposit retains 18 loaded rounds before the warm server closes.

A fresh server and two fresh WASM clients start with the pistol banked. The owner initially carries only the ammunition stack and has an empty hand. Withdrawal, wear and one normal shot retain the same physical identity, selected QL and endpoints, leaving 17 loaded rounds and all 100 carried Bullets. The observer receives the same weapon with its selected damage, critical bonus, value and loaded count. Both clients observe 72 Projectile damage against a controlled nonlethal target. This is an ownership fixture, not earned progression or evidence that Leets ordinarily spawn in shops.

Exact native proxies, public protocol events and server state are checked at withdrawal, wear and impact. The warm final bank ledger must equal the cold initial ledger before input. The existing public-handler regression separately cold-loads both sides of a bank transfer. Bank representation and transfer behavior remain unchanged. The broader equipment disappearance report remains open; this regression protects the retained finite-weapon bank path independently of the earlier armor, ordinary-item and reclaim checks.

The initial normal scenario passed in 66.73s under local/banked-weapon/20261102-134612/. The final strengthened regression passes under the Go race detector in 87.43s (warm 59.79s, cold 27.63s), alongside TestBankLoadedWeaponRoundTripPreservesAmmunition; the package takes 183.198s including initialization. Vet and driver syntax checks pass. The independent verifier checks exact banked, withdrawn and shot ledgers, warm-final/cold-initial identity and all four final browser error traces. Screenshots show the original bank, empty hand before withdrawal and the recovered weapon's 72-point hit. Final reports: local/banked-weapon/20261102-135004/. Test clients and temporary servers are closed. No gameplay server, client or published bundle change is needed for this working branch.

AO_GAME_TEST=1 go test ./server -run '^TestBrowserBankedWeaponRecovery$' -count=1 -timeout=10m -v

Stale withdrawal sources

A live bank window can still expose a slot that no longer owns an item. The previous transfer guard returned without replying, leaving the picked native source hidden. An authenticated request for an empty slot within the original 102-slot bank now receives CharacterAction146 for its page105 source, followed by current BankIIR contents. Cancellation precedes replacement so the old source does not retain its dummy state. The remaining item stays usable in the same window. The server bank anchor, ownership, quantities and global item counter remain unchanged; this refusal performs no database writes.

TestBankStaleWithdrawalCancelsAndRefreshesWithoutWrites uses the public inventory handler for an ordinary withdrawal followed by two repeated requests. It covers an empty bank and a retained second item, exact ordered replies, unchanged persisted ownership, a SQL write audit and cold reconstruction.

TestBrowserStaleBankWithdrawal isolates the stale-view condition by committing a banked part into the owner's carried backpack without refreshing the native window. This is a controlled checkpoint, not earned progression or a claim that ordinary reliable delivery drops that reply. Real native input then sends the stale withdrawal. The baseline times out waiting for cancellation; the fixed run removes the ghost and collects the remaining part through the same window. Page replay retains the bag and collected part, and reopening the bag exposes the earlier transferred part. Fresh Go loading retains all three physical IDs. The passing native run takes 15.60 seconds, including page replay, under local/stale-bank/20261103-144547/. No client or published-bundle change is needed. Related Go checks pass67roots/258results; focused race checks pass3/23, and vet and driver syntax checks pass. local/stale-bank/verification.json independently checks the actual request, cancellation-before-refresh, both contents snapshots, four clean native traces and exact item ledgers. The broader disappearance audit remains open.

Empty carried sources on bank deposits share the focused correction and first/last-row regression described under stale carried deposits. An available bank session is retained, with no ownership write or item allocation. Existing unavailable-bank and pending-equipment refusal policies remain in effect.