commit a5ee4be7dff656638e8c4dcfd1869d80ef8bd80a
parent f0b2fe9ac1b10397798354a1cb9663a128edf911
Author: anon <anon@example.com>
Date: Sat, 24 Oct 2026 13:49:20 +0000
Correct bank rejection feedback and preserve equip timers
Diffstat:
5 files changed, 205 insertions(+), 27 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -856,11 +856,24 @@ and unresolved indoor lifecycle are explicit in [flight](docs/vehicles.md#yalmah
Unique scope, stack operations and reconnect/restart are covered. See
[bank storage](docs/bank-storage.md) for native evidence and reconstruction
policies.
-- [ ] Extend bank runtime failure coverage: exercise CharacterAction 46 icon
- restoration and rejected optimistic splits in the WASM UI, full ordinary
- inventory, Unique/NoDrop combinations, deletion and merging, and bank layout
- persistence. Verify item identity/count conservation after each case; packet
- tests alone do not establish native UI recovery.
+- [x] Verify server-side bank rejection in the WASM UI with a Unique duplicate
+ hidden in an unopened carried backpack. Action 146 restores the source and
+ native text explains the rejection, without the action-46 contract error.
+ Repeated attempts preserve IDs/counts/placements and the bank opening anchor.
+ Protocol tests preserve pending equipment work when bank requests overlap it.
+- [x] Exercise bank Unique/NoDrop transfers, native Delete cancellation and
+ confirmation, Ctrl-split, ordinary-inventory merge/redeposit and bank layout
+ persistence through browser reload. Check IDs, counts and placements against
+ SQLite and native client state. Original default controls have no established
+ direct same-bank merge gesture; see [bank storage](docs/bank-storage.md).
+- [x] Verify full ordinary inventory prevents bank withdrawal in the WASM UI
+ without changing IDs/counts/placements. The native validator displays the
+ inventory-full message without sending a transfer. Depositing one item then
+ withdrawing succeeds into the freed slot with the original instance/count.
+- [ ] Exercise a server-rejected optimistic bank split in the WASM UI. Check
+ identity/count conservation, source restoration and continued usability.
+ Packet tests alone do not establish native UI recovery; an equip-delay split
+ attempt was blocked locally before it sent a request.
- [ ] Implement Briefcase of Holding remote bank access using its authored
profession, skill, title-level and combat conditions; research bank CASH/XP
semantics and historical filled-bag deletion policy.
diff --git a/docs/bank-storage.md b/docs/bank-storage.md
@@ -32,9 +32,12 @@ this contract. Original addresses below use image base 0x10000000.
IDs against carried/equipped items and carried Chest contents on withdrawal.
Bank contents are excluded; the bank may contain duplicate Unique items.
NoDrop has no bank-specific prohibition. Filled owned backpacks are permitted.
-- CharacterAction reader/activation `0x1007d5c0`/`0x1007d640`, handler
- `0x1006fa30` case 46 and correction `0x100624b0` establish rejection payload
- `{46,0,0,sourcePage,sourceSlot}`. The source is the second identity.
+- CharacterAction reader/activation `0x1007d5c0`/`0x1007d640` and handler
+ `0x1006fa30` case 146 invoke `0x10062960` with the first identity:
+ `{146,sourcePage,sourceSlot,0,0}`. This refreshes the source without replacing
+ the bank proxy or resetting its opening anchor. It also stops the native
+ equipment-delay timer. Case 46 refreshes the second identity but always
+ prints a contract-specific error, so it is unsuitable for bank feedback.
- Split API `0x10022d50` and optimistic split `0x1005edb0` accept bank page 105,
retain the requested count in the source, and allocate the first free slot.
Delete API `0x10027670` and receiver `0x1005f270` also support page 105.
@@ -43,12 +46,24 @@ this contract. Original addresses below use image base 0x10000000.
map 3. Same-grid drops in `0x10045110` only change the local visual layout;
they send no server reorder request. UpdateContainer `0x100441e0` rebuilds
the grid through `0x10045320`, restoring optimistic dummy icons on rejection.
+- Default CCR container bindings support Ctrl-left-release splitting and
+ held-right item menus. Normal left-click withdraws from the bank. DDR's
+ `JoinItems` call in `0x10045110` requires an owned container, excluding the
+ bank. No direct same-bank merge or arbitrary pickup/reorder gesture was
+ established. A successful split starts dragging its retained source, which
+ can be placed in an empty bank cell to change its visual position.
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`.
@@ -82,8 +97,10 @@ ContainerAddItem (`0x47537a24`) uses these identities:
| 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 46 translates ordinary
-source slots only, preserving bank and packed bag source positions.
+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...`.
## Server policy and persistence
@@ -110,6 +127,12 @@ 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 uses
+BankIIR to restore the bank view; a busy deposit is ignored. Neither sends
+action 146, which would cancel the native equip bar while leaving the server's
+delayed operation pending. This is a reconstruction policy, not recovered
+original-server packet selection.
+
Briefcase of Holding (205736) invokes the same bank effect with separate authored
profession, skill, title-level and combat conditions. Remote bank opening is not
implemented by ordinary terminal support.
@@ -135,8 +158,29 @@ 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.
-Native UI recovery for action-46 rejections and invalid split snapshots, plus
-additional merge/delete/layout checks, remains explicit follow-up work in TODO.
+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.
+
+Rejected optimistic bank splits still need a native UI recovery check. The
+native client locally blocked splitting during equipment delay; that run does
+not establish receipt of a server rejection or snapshot.
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
@@ -147,3 +191,13 @@ Regression logs are retained in `local/bank-research/`: the full Go suite 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.
diff --git a/server/backpacks.go b/server/backpacks.go
@@ -155,8 +155,15 @@ func (server *server) moveContainerItem_locked(client *worldClient, body []byte)
sourceBag := uint32(0)
items := inventory.Items
bank := sourcePage == 105 || binary.BigEndian.Uint32(body[24:28]) == 57005
- if bank && (!server.bankAvailable_locked(client) || client.equipment != nil) {
- return client.send(characterActionPacket(client.id, [5]uint32{46, 0, 0, sourcePage, sourceSlot}))
+ if bank && client.equipment != nil {
+ // Source refresh 146 cancels the native equip bar. Keep that operation alive.
+ if sourcePage == 105 && server.bankAvailable_locked(client) {
+ return client.send(bankInventoryPacket(player))
+ }
+ return nil
+ }
+ if bank && !server.bankAvailable_locked(client) {
+ return client.send(characterActionPacket(client.id, [5]uint32{146, sourcePage, sourceSlot}))
}
if sourcePage == 105 {
items = inventory.Bank
@@ -175,9 +182,18 @@ func (server *server) moveContainerItem_locked(client *worldClient, body []byte)
return nil
}
item := items[index]
- if bank && itemStat(item.templateDefinition(), 8) > 0 ||
- sourcePage == 105 && itemStat(item.templateDefinition(), 0)&0x08000000 != 0 && inventory.carriesUnique(item) {
- return client.send(characterActionPacket(client.id, [5]uint32{46, 0, 0, sourcePage, binary.BigEndian.Uint32(body[20:24])}))
+ if bank && itemStat(item.templateDefinition(), 8) > 0 {
+ return client.send(characterActionPacket(client.id, [5]uint32{146, sourcePage, binary.BigEndian.Uint32(body[20:24])}))
+ }
+ if sourcePage == 105 && itemStat(item.templateDefinition(), 0)&0x08000000 != 0 && inventory.carriesUnique(item) {
+ if err := client.send(characterActionPacket(client.id, [5]uint32{146, sourcePage, sourceSlot})); err != nil {
+ return err
+ }
+ text := "You already have this unique item..."
+ reply := binary.BigEndian.AppendUint32(nil, uint32(len(text)))
+ reply = append(reply, text...)
+ reply = append(reply, 0, 0)
+ return client.send(n3Packet(0x5f4b442a, 50000, client.id, reply))
}
// Validate the owner and placement before changing either side of the transfer.
@@ -193,7 +209,7 @@ func (server *server) moveContainerItem_locked(client *worldClient, body []byte)
} else if targetType == 51017 {
if targetID == sourceBag || !slices.ContainsFunc(inventory.Items, func(item ownedItem) bool { return item.ID == targetID && item.isPortableContainer() }) {
if bank {
- return client.send(characterActionPacket(client.id, [5]uint32{46, 0, 0, sourcePage, binary.BigEndian.Uint32(body[20:24])}))
+ return client.send(characterActionPacket(client.id, [5]uint32{146, sourcePage, binary.BigEndian.Uint32(body[20:24])}))
}
return nil
}
@@ -203,7 +219,7 @@ func (server *server) moveContainerItem_locked(client *worldClient, body []byte)
}
if !known || item.Type == 51017 || itemStat(gamedata.ItemTemplates[item.Template], 0)&0x00200000 != 0 || itemStat(gamedata.ItemTemplates[item.Template], 8) > 0 {
if bank {
- return client.send(characterActionPacket(client.id, [5]uint32{46, 0, 0, sourcePage, binary.BigEndian.Uint32(body[20:24])}))
+ return client.send(characterActionPacket(client.id, [5]uint32{146, sourcePage, binary.BigEndian.Uint32(body[20:24])}))
}
return nil
}
@@ -230,7 +246,7 @@ func (server *server) moveContainerItem_locked(client *worldClient, body []byte)
}
if slot < first || slot >= end || slices.ContainsFunc(targetItems, func(item ownedItem) bool { return item.Slot == slot }) {
if bank {
- return client.send(characterActionPacket(client.id, [5]uint32{46, 0, 0, sourcePage, binary.BigEndian.Uint32(body[20:24])}))
+ return client.send(characterActionPacket(client.id, [5]uint32{146, sourcePage, binary.BigEndian.Uint32(body[20:24])}))
}
return nil
}
diff --git a/server/bank_test.go b/server/bank_test.go
@@ -4,6 +4,7 @@ import (
"ao/server/gamedata"
"bytes"
"encoding/binary"
+ "fmt"
"reflect"
"slices"
"sync"
@@ -345,7 +346,7 @@ func TestBankCapacityRejectionPreservesItemAndCorrectsItsSource(t *testing.T) {
after, _ := readTestItemStore(world)
if err != nil || !bytes.Equal(before, after) || len(player.inventory.Bank) != 102 || len(conn.packets) != 1 ||
- !bytes.Equal(conn.packets[0][29:49], []byte{0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 104, 0, 0, 0, 48}) {
+ !bytes.Equal(conn.packets[0][29:49], []byte{0, 0, 0, 146, 0, 0, 0, 104, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0}) {
t.Fatalf("full bank lost an item or used wrong source correction: %v %x", err, conn.packets)
}
}
@@ -365,7 +366,7 @@ func TestBankFullInventoryRejectsWithdrawal(t *testing.T) {
err := world.handleInventory(client, backpackMoveRequest(105, 0, 50000, 1, 111)[20:])
after, _ := readTestItemStore(world)
- if err != nil || !bytes.Equal(before, after) || len(conn.packets) != 1 || !bytes.Equal(conn.packets[0][29:49], []byte{0, 0, 0, 46, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 0, 0, 0, 0}) {
+ if err != nil || !bytes.Equal(before, after) || len(conn.packets) != 1 || !bytes.Equal(conn.packets[0][29:49], []byte{0, 0, 0, 146, 0, 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) {
t.Fatal("full inventory changed bank item or omitted rejection", err)
}
}
@@ -417,7 +418,11 @@ func TestBankUniqueChecksCarriedLowTemplateAndExcludesBank(t *testing.T) {
after, _ := readTestItemStore(world)
accepted := placement == "bank" || placement == "banked bag"
- if err != nil || len(conn.packets) != 1 || bytes.Equal(before, after) == accepted {
+ expectedPackets := 2
+ if accepted {
+ expectedPackets = 1
+ }
+ if err != nil || len(conn.packets) != expectedPackets || bytes.Equal(before, after) == accepted {
t.Fatal("Unique used the wrong ownership scope", err)
}
expected := uint32(0x5e477770)
@@ -482,7 +487,7 @@ func TestBankUniqueUsesLowTemplateAcrossQualityEndpoints(t *testing.T) {
err := world.handleInventory(client, backpackMoveRequest(105, 0, 50000, 1, 111)[20:])
after, _ := readTestItemStore(world)
- if err != nil || !bytes.Equal(before, after) || len(conn.packets) != 1 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 46 {
+ if err != nil || !bytes.Equal(before, after) || len(conn.packets) != 2 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 146 {
t.Fatal("Unique compared endpoint template IDs instead of low template", err)
}
}
@@ -536,7 +541,7 @@ func TestBankMovementClosesStorageBeforePlayerReturns(t *testing.T) {
err := world.handleMovement(client, request)
world.handleInventory(client, backpackMoveRequest(104, 64, 57005, 1, 111)[20:])
- if err != nil || client.bank != nil || len(player.inventory.Bank) != 0 || len(conn.packets) != 2 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 106 || binary.BigEndian.Uint32(conn.packets[1][29:33]) != 46 {
+ if err != nil || client.bank != nil || len(player.inventory.Bank) != 0 || len(conn.packets) != 2 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 106 || binary.BigEndian.Uint32(conn.packets[1][29:33]) != 146 {
t.Fatalf("movement left bank access active: %v %x", err, conn.packets)
}
}
@@ -567,3 +572,93 @@ func TestBankLoadedWeaponRoundTripPreservesAmmunition(t *testing.T) {
t.Fatal("bank transfer changed loaded rounds or weapon identity")
}
}
+
+func TestBankUniqueRejectionRestoresSourceWithoutContractFeedback(t *testing.T) {
+ world, conn := newBankWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ for range 2 {
+ if granted, err := world.grantItem_locked(player, 43328); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ }
+ if err := world.handleInventory(client, backpackMoveRequest(104, 69, 57005, 1, 111)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ before, _ := readTestItemStore(world)
+ anchor := *client.bank
+ conn.packets = nil
+
+ err := world.handleInventory(client, backpackMoveRequest(105, 0, 50000, 1, 111)[20:])
+ after, _ := readTestItemStore(world)
+
+ if err != nil || !bytes.Equal(before, after) || *client.bank != anchor || len(conn.packets) != 2 {
+ t.Fatal("Unique rejection changed bank contents or opening anchor", err)
+ }
+ if !bytes.Equal(conn.packets[0][29:49], []byte{0, 0, 0, 146, 0, 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) ||
+ binary.BigEndian.Uint32(conn.packets[1][16:20]) != 0x5f4b442a ||
+ binary.BigEndian.Uint16(conn.packets[1][6:8]) != 71 ||
+ !bytes.Equal(conn.packets[1][29:71], append([]byte{0, 0, 0, 36}, []byte("You already have this unique item...\x00\x00")...)) {
+ t.Fatalf("Unique rejection emitted wrong native correction or feedback: %x", conn.packets)
+ }
+}
+
+func TestBankTransferRejectionPreservesPendingEquipmentTimer(t *testing.T) {
+ for _, page := range []uint32{104, 105} {
+ t.Run(map[uint32]string{104: "deposit", 105: "withdraw"}[page], func(t *testing.T) {
+ world, conn := newBankWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ if err := world.handleInventory(client, backpackMoveRequest(104, 64, 57005, 1, 111)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ player.stats.Ranged.Pistol, player.stats.Ranged.FlingShot = 6, 6
+ if granted, err := world.grantItem_locked(player, 123742); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ if err := world.handleInventory(client, inventoryMovePacket(1, 64, 6)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ move := client.equipment
+ if move == nil {
+ t.Fatal("pistol equip was not admitted")
+ }
+ before, _ := readTestItemStore(world)
+ conn.packets = nil
+ request := backpackMoveRequest(105, 0, 50000, 1, 111)
+ if page == 104 {
+ request = backpackMoveRequest(104, 65, 57005, 1, 111)
+ }
+
+ err := world.handleInventory(client, request[20:])
+ after, _ := readTestItemStore(world)
+
+ if err != nil || !bytes.Equal(before, after) || client.equipment != move || len(player.inventory.Bank) != 1 {
+ t.Fatal("busy rejection changed equipment or ownership", err)
+ }
+ if page == 104 && len(conn.packets) != 0 || page == 105 && (len(conn.packets) != 1 || binary.BigEndian.Uint32(conn.packets[0][16:20]) != 0x343c287f) {
+ t.Fatalf("busy rejection canceled native equipment timer: %x", conn.packets)
+ }
+ })
+ }
+}
+
+func TestBankSourceRefreshUsesNativePageCoordinates(t *testing.T) {
+ for _, source := range []struct{ page, slot, native uint32 }{
+ {104, 64, 48}, {104, 93, 77}, {105, 0, 0}, {105, 48, 48}, {105, 64, 64}, {105, 77, 77}, {105, 101, 101}, {107, 1<<16 | 20, 1<<16 | 20},
+ } {
+ t.Run(fmt.Sprintf("%d/%d", source.page, source.slot), func(t *testing.T) {
+ world, conn := newBankWorld(t)
+ client := world.clients[1]
+ if err := world.handleBankClose(client, characterActionPacket(1, [5]uint32{106})[20:]); err != nil {
+ t.Fatal(err)
+ }
+
+ err := world.handleInventory(client, backpackMoveRequest(source.page, source.slot, 57005, 1, 111)[20:])
+
+ if err != nil || len(conn.packets) != 1 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 146 ||
+ binary.BigEndian.Uint32(conn.packets[0][33:37]) != source.page || binary.BigEndian.Uint32(conn.packets[0][37:41]) != source.native ||
+ binary.BigEndian.Uint64(conn.packets[0][41:49]) != 0 {
+ t.Fatalf("source refresh translated wrong page/slot: %v %x", err, conn.packets)
+ }
+ })
+ }
+}
diff --git a/server/target_protocol.go b/server/target_protocol.go
@@ -132,10 +132,10 @@ func targetPacket(packet []byte) []byte {
}
case 0x5e477770:
action := binary.BigEndian.Uint32(packet[36:40])
- if (action == 52 || action == 53 || action == 112) && binary.BigEndian.Uint32(packet[40:44]) == 104 {
+ if (action == 52 || action == 53 || action == 112 || action == 146) && binary.BigEndian.Uint32(packet[40:44]) == 104 {
binary.BigEndian.PutUint32(packet[44:48], binary.BigEndian.Uint32(packet[44:48])-16)
}
- if (action == 46 || action == 53) && binary.BigEndian.Uint32(packet[48:52]) == 104 {
+ if action == 53 && binary.BigEndian.Uint32(packet[48:52]) == 104 {
binary.BigEndian.PutUint32(packet[52:56], binary.BigEndian.Uint32(packet[52:56])-16)
}
case 0x54111123: