commit fae765d6078c648409fcbd189d689ad9b7b33ecb
parent 9032dbc65c6e8ff59c5129c3977268963ce15f2d
Author: anon <anon@example.com>
Date: Wed, 4 Nov 2026 07:36:57 +0000
Clear stale worn armor with its exact published unwear effect
Diffstat:
11 files changed, 304 insertions(+), 15 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -4114,6 +4114,15 @@ and server restarts. Turn every reproduced bug into a focused regression test.
both directions during wear/removal without writes or deadline changes.
No product defect reproduced on this path; see
[backpack joins](docs/backpacks.md#stack-join-during-pending-equipment).
+- [x] [P0] Clear stale worn-armor sources and their native effects. A controlled
+ earlier bank transfer leaves the helmet visible at102:18; native removal
+ previously received no reply. Cancellation/row clearing alone hid the icon
+ but retained3AC and doubled it to6 on re-wear. Retain each connection's exact
+ published unwear contract, remove its effect once, then clear only the empty
+ row. Native AC now follows3 ->0 ->3 through same-page bank withdrawal/re-wear;
+ page replay and cold ownership retain both exact instances. The broader
+ disappearance audit remains open. See
+ [stale armor](docs/inventory.md#stale-worn-armor-sources).
- [x] [P0] Clear an empty carried source after stale weapon wear. Reproduction:
a controlled earlier bank transfer leaves the old ordinary icon visible;
native right-click wear sends a real request but receives no response. Source
diff --git a/docs/inventory.md b/docs/inventory.md
@@ -248,6 +248,57 @@ recovery retain axe1 worn at6 and part2 at65, zero cash and allocator2. The
ordinary companion also passes; all eight traces have no client errors or
dropped events. This is controlled ownership/view evidence, not earned progression.
+### Stale worn-armor sources
+
+A controlled completed bank transfer leaves a QL1 Metaplast helmet visible in
+the native Clothes panel while its authoritative slot18 is empty. Right-click
+removal sends source102:18 to first-free111 and previously received no reply.
+The Go baseline returns zero packets; the WASM baseline is retained in
+`local/stale-inventory-move/20261103-230631/18/`.
+
+Cancellation146 and clearing112 remove the icon but leave its native armor
+effect active. The original Stats window shows impact/melee/energy AC3 after
+clearing, then6 after normal bank withdrawal and re-wear. That incomplete
+attempt is retained in `local/stale-inventory-move/20261103-230851/18/`.
+
+The original equipment-action receiver100849c0 calls1005e980. That function
+resolves the supplied template before dispatch; action7 clears the source slot
+and runs its OnUnWear virtual callback. An empty source request carries no
+template IDs, so current bank contents cannot safely identify the old effect.
+REA evidence `ev_7fdf6ee5aa8586975f9a8eab3df3534318015426d929421345e5c822d7fa4892`
+and `ev_3cd89062e7b4d4a2c5c8aa85884ffc09b99e65eacca95d800b704227eff26bc4`
+are retained in `local/stale-armor-move/native-unwear.json`, bound to original
+`kkr.dll` SHA256 `a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0`.
+The maintained translations are
+`client/game/kkr.dll/lifted-0039.c::sub_360849C0` and
+`client/game/kkr.dll/lifted-0028.c::sub_3605E980`.
+
+Each connection now retains the exact armor-removal packet prepared from its
+published FullCharacter, updating it only after normal equipment commits. An
+authenticated empty page102 source receives cancellation, that last-published
+OnUnWear once when present, then clearing of its own row. The packet is consumed
+so duplicates cannot subtract the effect again. Unknown metadata is never
+guessed; pending equipment, foreign targets, wrong pages and invalid positions
+retain their guards. The correction writes no ownership, destroys no detached
+item and reports no successful move.
+
+`TestBrowserStaleArmorMove` verifies the original request, same-page bank
+withdrawal/re-wear, native page replay and exact cold ownership of helmet1 at18
+and part2 at65, with zero cash and allocator2. The corrected capture is
+`local/stale-inventory-move/20261103-232051/18/`,16.42 seconds. Manual inspection
+of its original Stats windows verifies impact/melee/energy AC3 ->0 ->3 and the
+cleared helmet model; all eight server AC values return to the initial vector.
+This is controlled ownership/view evidence, not earned progression. Effective
+native defense snapshots beyond the visible window remain a separate harness
+TODO. No client C/WASM change was needed.
+
+Focused Go checks pass54 roots/377 results, including ordinary and right-hand
+stale sources, normal armor removal, interpolation, equipment rollback/retry
+and loading. The focused race run passes18 results. Vet and driver syntax
+checks pass; all five final native traces have no errors or dropped events.
+Exact packet ordering, unchanged durable ownership and the manually reviewed
+Stats-window image hashes are retained in `local/stale-armor-move/validation.json`.
+
## Native visual order
The shipped `cd_image/text/help/The Inventory Window.txt` documents left-click
diff --git a/server/armor_test.go b/server/armor_test.go
@@ -85,7 +85,7 @@ func TestArmorTwoPiecesAndRemovalNotifyOnlyChangedItem(t *testing.T) {
world.handleInventory(world.clients[1], itemMovePacket(1, slot, 111)[20:])
restarted := newTestInventoryServer(t)
- if len(initial) != 2 || len(conn.packets) != 2 ||
+ if len(initial) != 2 || len(conn.packets) != 4 ||
binary.BigEndian.Uint32(conn.packets[0][16:20]) != 0x35505644 ||
binary.BigEndian.Uint32(conn.packets[0][45:49]) != 7 ||
binary.BigEndian.Uint32(conn.packets[0][53:57]) != slot ||
@@ -93,6 +93,13 @@ func TestArmorTwoPiecesAndRemovalNotifyOnlyChangedItem(t *testing.T) {
binary.BigEndian.Uint32(conn.packets[1][45:49]) != 111 {
t.Fatalf("removal repeated or changed another modifier: %x", conn.packets)
}
+ for index, action := range []uint32{146, 112} {
+ packet := conn.packets[index+2]
+ if binary.BigEndian.Uint32(packet[16:20]) != 0x5e477770 || binary.BigEndian.Uint32(packet[29:33]) != action ||
+ binary.BigEndian.Uint32(packet[33:37]) != 102 || binary.BigEndian.Uint32(packet[37:41]) != slot {
+ t.Fatalf("stale removal did not correct only its empty armor row: %x", packet)
+ }
+ }
packets := equippedItemPackets(restarted.characters[1])
other := uint32(30)
if slot == 30 {
diff --git a/server/browser_stale_inventory_move_test.go b/server/browser_stale_inventory_move_test.go
@@ -25,6 +25,10 @@ func TestBrowserStaleWornMove(t *testing.T) {
testBrowserStaleInventoryMove(t, 6)
}
+func TestBrowserStaleArmorMove(t *testing.T) {
+ testBrowserStaleInventoryMove(t, 18)
+}
+
func testBrowserStaleInventoryMove(t *testing.T, sourceSlot uint32) {
t.Helper()
if os.Getenv("AO_GAME_TEST") != "1" {
@@ -45,6 +49,9 @@ func testBrowserStaleInventoryMove(t *testing.T, sourceSlot uint32) {
inventory := playerInventory{LastID: 2, Items: []ownedItem{
{ID: 1, Type: 51018, Template: 209283, Quality: 1, Slot: sourceSlot, Count: 1},
{ID: 2, Type: 51005, Template: 42640, Quality: 1, Slot: 65, Count: 1}}}
+ if sourceSlot == 18 {
+ inventory.Items[0].Type, inventory.Items[0].Template = 51022, 85557
+ }
if err := world.saveInventory_locked(player, inventory); err != nil {
t.Fatal(err)
}
@@ -53,7 +60,14 @@ func testBrowserStaleInventoryMove(t *testing.T, sourceSlot uint32) {
mux.HandleFunc("GET /test-state", func(w http.ResponseWriter, r *http.Request) {
world.mutex.Lock()
defer world.mutex.Unlock()
- json.NewEncoder(w).Encode(player.inventory)
+ armor := [8]int32{}
+ for index := range armor {
+ armor[index] = player.equipmentBonus(90 + uint32(index))
+ }
+ json.NewEncoder(w).Encode(struct {
+ playerInventory
+ Armor [8]int32
+ }{player.inventory, armor})
})
// Isolate an earlier bank transfer without refreshing its old source.
mux.HandleFunc("POST /test-stale-view", func(w http.ResponseWriter, r *http.Request) {
@@ -103,6 +117,9 @@ func testBrowserStaleInventoryMove(t *testing.T, sourceSlot uint32) {
cold := newTestInventoryServer(t)
expected := []ownedItem{{ID: 1, Type: 51018, Template: 209283, Quality: 1, Slot: 6, Count: 1},
{ID: 2, Type: 51005, Template: 42640, Quality: 1, Slot: 65, Count: 1}}
+ if sourceSlot == 18 {
+ expected[0].Type, expected[0].Template, expected[0].Slot = 51022, 85557, 18
+ }
for _, actual := range []playerInventory{player.inventory, cold.characters[1].inventory} {
items := slices.Clone(actual.Items)
slices.SortFunc(items, func(a, b ownedItem) int { return cmp.Compare(a.ID, b.ID) })
diff --git a/server/equipment.go b/server/equipment.go
@@ -288,6 +288,9 @@ func (server *server) advanceEquipment(now time.Time) {
// Commit the old-speed prediction and ordered wear effects together.
*character = motion
for _, removed := range removedItems {
+ if removed.Slot >= 16 && removed.Slot < 32 {
+ client.armorRemoval[removed.Slot-16] = nil
+ }
if !removed.isWieldableWeapon() {
server.queueCombat_locked(updates, character, character, equipmentActionPacket(character.id, removed, 7))
}
@@ -308,6 +311,9 @@ func (server *server) advanceEquipment(now time.Time) {
updates[client] = append(updates[client], itemMovePacket(client.id, move.source, move.requestedSlot))
if move.destination < 64 && !item.isWieldableWeapon() {
server.queueCombat_locked(updates, character, character, equipmentActionPacket(character.id, character.inventory.Items[index], 6))
+ if move.destination >= 16 && move.destination < 32 {
+ client.armorRemoval[move.destination-16] = equipmentActionPacket(character.id, character.inventory.Items[index], 7)
+ }
}
if move.source == 6 || move.destination == 6 {
server.queueCombat_locked(updates, character, character, equippedWeaponPackets(character)...)
diff --git a/server/inventory.go b/server/inventory.go
@@ -381,6 +381,21 @@ func (server *server) handleInventory(client *worldClient, body []byte) error {
}
return nil
}
+ if index < 0 && client.equipment == nil && key == 0x47537a24 && sourceType == 102 && sourceSlot >= 16 && sourceSlot < 32 &&
+ binary.BigEndian.Uint32(body[24:28]) == 50000 && binary.BigEndian.Uint32(body[28:32]) == client.id &&
+ (destination == 111 || destination >= 64 && destination < 94) {
+ // Clear the stale armor row without deleting its detached physical instance.
+ if err := client.send(characterActionPacket(client.id, [5]uint32{146, 102, sourceSlot})); err != nil {
+ return err
+ }
+ if packet := client.armorRemoval[sourceSlot-16]; packet != nil {
+ if err := client.send(packet); err != nil {
+ return err
+ }
+ client.armorRemoval[sourceSlot-16] = nil
+ }
+ return client.send(characterActionPacket(client.id, [5]uint32{112, 102, sourceSlot}))
+ }
if index < 0 || (sourceSlot >= 64 && sourceType != 104) ||
(sourceSlot > 0 && sourceSlot < 16 && sourceType != 101) ||
(sourceSlot >= 33 && sourceSlot <= 45 && sourceType != 103) ||
diff --git a/server/main.go b/server/main.go
@@ -408,6 +408,13 @@ func (server *server) serveWorldClient(client *worldClient) error {
updates = append(updates, server.chatServerPacket(conn))
}
updates = append(updates, fullCharacterPacket(character))
+ // Retain the exact native unwear contract while its source row is published.
+ client.armorRemoval = [16][]byte{}
+ for _, item := range character.inventory.Items {
+ if item.Slot >= 16 && item.Slot < 32 {
+ client.armorRemoval[item.Slot-16] = equipmentActionPacket(character.id, item, 7)
+ }
+ }
petUpdates := petOwnerPackets(character)
updates = append(updates, petUpdates...)
for _, mission := range character.missions {
diff --git a/server/metaplast_test.go b/server/metaplast_test.go
@@ -96,12 +96,19 @@ func TestMetaplastNativeWearRemoveAndRestart(t *testing.T) {
world.handleInventory(world.clients[1], remove)
removed := newTestInventoryServer(t).characters[1]
if !reflect.DeepEqual(removed.inventory.Items, []ownedItem{player.inventory.Items[0], original}) ||
- len(conn.packets) != 2 || len(observer.packets) != 1 ||
+ len(conn.packets) != 4 || len(observer.packets) != 1 ||
binary.BigEndian.Uint32(conn.packets[0][45:49]) != 7 ||
binary.BigEndian.Uint32(conn.packets[0][53:57]) != piece.slot ||
len(equippedItemPackets(removed)) != 0 {
t.Fatal("removal lost the armor or repeated its effects")
}
+ for index, action := range []uint32{146, 112} {
+ packet := conn.packets[index+2]
+ if binary.BigEndian.Uint32(packet[16:20]) != 0x5e477770 || binary.BigEndian.Uint32(packet[29:33]) != action ||
+ binary.BigEndian.Uint32(packet[33:37]) != 102 || binary.BigEndian.Uint32(packet[37:41]) != piece.slot {
+ t.Fatalf("repeated removal changed more than its empty source: %x", packet)
+ }
+ }
for stat := uint32(90); stat <= 97; stat++ {
if removed.inventory.equipmentBonus(stat) != 0 {
t.Fatal("removed armor retained AC")
diff --git a/server/stale_armor_move_test.go b/server/stale_armor_move_test.go
@@ -0,0 +1,152 @@
+package main
+
+import (
+ "bytes"
+ "encoding/binary"
+ "fmt"
+ "reflect"
+ "slices"
+ "testing"
+)
+
+func TestStaleArmorMoveCorrectsItsEmptySource(t *testing.T) {
+ for _, source := range []uint32{16, 18, 21, 31} {
+ t.Run(fmt.Sprint(source), func(t *testing.T) {
+ world, output := newEquipmentWorld(t)
+ client := world.clients[1]
+ request := itemMovePacket(1, source, 111)[20:]
+ auditCheckpointWrites(t, world)
+ output.packets = nil
+
+ err := world.handleInventory(client, request)
+
+ if err != nil || len(output.packets) != 2 || len(checkpointWrites(t, world)) != 0 {
+ t.Fatal("empty worn armor source did not receive cancellation and clearing", err, len(output.packets))
+ }
+ for index, action := range []uint32{146, 112} {
+ packet := output.packets[index]
+ if binary.BigEndian.Uint32(packet[29:33]) != action || binary.BigEndian.Uint32(packet[33:37]) != 102 ||
+ binary.BigEndian.Uint32(packet[37:41]) != source {
+ t.Fatalf("stale armor correction addressed another row: %x", packet)
+ }
+ }
+ })
+ }
+}
+
+func newStaleArmorMoveWorld(t *testing.T) (*server, *combatTestConn) {
+ t.Helper()
+ world, output := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ if granted, err := world.grantItem_locked(player, 85557); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ if err := world.handleInventory(client, inventoryMovePacket(1, 65, 18)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("fixture helmet did not start wear", err)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+
+ // Complete a bank transfer while retaining the already published native armor.
+ inventory := player.inventory
+ index := slices.IndexFunc(inventory.Items, func(item ownedItem) bool { return item.Slot == 18 })
+ helmet := inventory.Items[index]
+ helmet.Slot = 0
+ inventory.Bank = []ownedItem{helmet}
+ inventory.Items = slices.Delete(slices.Clone(inventory.Items), index, index+1)
+ if err := world.saveInventory_locked(player, inventory); err != nil {
+ t.Fatal(err)
+ }
+ output.packets = nil
+ return world, output
+}
+
+func TestStaleArmorMoveUnwearsOnlyItsPublishedTemplateOnce(t *testing.T) {
+ for _, destination := range []uint32{64, 93, 111} {
+ t.Run(fmt.Sprint(destination), func(t *testing.T) {
+ world, output := newStaleArmorMoveWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ inventory := player.inventory
+ before, err := readTestItemStore(world)
+ if err != nil {
+ t.Fatal(err)
+ }
+ auditCheckpointWrites(t, world)
+
+ for range 2 {
+ if err := world.handleInventory(client, itemMovePacket(1, 18, destination)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ }
+ after, err := readTestItemStore(world)
+ cold := newTestInventoryServer(t)
+
+ if err != nil || !bytes.Equal(before, after) || len(checkpointWrites(t, world)) != 0 ||
+ !reflect.DeepEqual(player.inventory, inventory) || !reflect.DeepEqual(cold.characters[1].inventory, inventory) ||
+ world.nextItem != 2 || cold.nextItem != 2 || len(output.packets) != 5 || client.armorRemoval[2] != nil {
+ t.Fatal("stale armor correction changed ownership, allocation or repeated its unwear", err, len(output.packets))
+ }
+ for index, action := range map[int]uint32{0: 146, 2: 112, 3: 146, 4: 112} {
+ packet := output.packets[index]
+ if binary.BigEndian.Uint32(packet[16:20]) != 0x5e477770 || binary.BigEndian.Uint32(packet[29:33]) != action ||
+ binary.BigEndian.Uint32(packet[33:37]) != 102 || binary.BigEndian.Uint32(packet[37:41]) != 18 {
+ t.Fatalf("stale armor did not cancel/clear its own row: %x", packet)
+ }
+ }
+ unwear := output.packets[1]
+ words := []uint32{}
+ for offset := 29; offset < 65; offset += 4 {
+ words = append(words, binary.BigEndian.Uint32(unwear[offset:]))
+ }
+ if binary.BigEndian.Uint32(unwear[16:20]) != 0x35505644 ||
+ !slices.Equal(words, []uint32{85557, 85557, 1, 1, 7, 102, 18, 0, 0}) {
+ t.Fatal("stale armor did not use its exact last-published removal contract", words)
+ }
+ })
+ }
+}
+
+func TestStaleArmorMovePreservesInvalidAndPendingRequests(t *testing.T) {
+ for _, scenario := range []string{"foreign actor", "foreign target", "target type", "wrong page", "source before", "source after", "invalid destination", "pending equipment"} {
+ t.Run(scenario, func(t *testing.T) {
+ world, output := newStaleArmorMoveWorld(t)
+ client := world.clients[1]
+ request := itemMovePacket(1, 18, 111)[20:]
+ switch scenario {
+ case "foreign actor":
+ binary.BigEndian.PutUint32(request[8:], 2)
+ case "foreign target":
+ binary.BigEndian.PutUint32(request[28:], 2)
+ case "target type":
+ binary.BigEndian.PutUint32(request[24:], 51017)
+ case "wrong page":
+ binary.BigEndian.PutUint32(request[16:], 103)
+ case "source before":
+ binary.BigEndian.PutUint32(request[20:], 15)
+ case "source after":
+ binary.BigEndian.PutUint32(request[20:], 32)
+ case "invalid destination":
+ binary.BigEndian.PutUint32(request[32:], 94)
+ case "pending equipment":
+ if err := world.handleInventory(client, inventoryMovePacket(1, 64, 6)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("fixture weapon did not start wear", err)
+ }
+ }
+ pending := client.equipment
+ removal := slices.Clone(client.armorRemoval[2])
+ before, err := readTestItemStore(world)
+ if err != nil {
+ t.Fatal(err)
+ }
+ output.packets = nil
+ auditCheckpointWrites(t, world)
+
+ err = world.handleInventory(client, request)
+ after, readErr := readTestItemStore(world)
+
+ if err != nil || readErr != nil || !bytes.Equal(before, after) || len(checkpointWrites(t, world)) != 0 ||
+ len(output.packets) != 0 || !bytes.Equal(removal, client.armorRemoval[2]) || client.equipment != pending {
+ t.Fatal("invalid stale armor request changed ownership, pending wear or published metadata", err, readErr)
+ }
+ })
+ }
+}
diff --git a/server/state.go b/server/state.go
@@ -87,6 +87,7 @@ type worldClient struct {
npcs map[uint32]bool
dialogue *npcDialogue
equipment *equipmentMove
+ armorRemoval [16][]byte
nanoCast *nanoCast
reloadUntil time.Time
lootCorpse uint32
diff --git a/tools/client/test_stale_inventory_move.mjs b/tools/client/test_stale_inventory_move.mjs
@@ -5,8 +5,9 @@ import {GameTest} from './game_test.mjs';
const {chromium} = createRequire(import.meta.url)('playwright');
const [url, output, sourceSlot] = process.argv.slice(2);
-const sourcePage = sourceSlot === '6' ? 101 : 104;
-const nativeSlot = sourceSlot === '6' ? 6 : 48;
+const sourcePage = sourceSlot === '6' ? 101 : sourceSlot === '18' ? 102 : 104;
+const nativeSlot = sourcePage === 104 ? 48 : Number(sourceSlot);
+const wornSlot = sourcePage === 102 ? 18 : 6;
const browser = await chromium.launch({executablePath: '/usr/bin/chromium', args: [
'--enable-gpu', '--use-gl=angle', '--use-angle=gl', '--no-sandbox', '--disable-dev-shm-usage',
'--disable-background-timer-throttling', '--disable-renderer-backgrounding']});
@@ -20,39 +21,53 @@ try {
const server = async () => (await page.request.get(url + '/test-state')).json();
const cell = (pageId, slot) => game.state.grids.flatMap(grid => grid.cells).find(cell =>
cell.identity[0] === pageId && cell.identity[1] === slot && !cell.dummy);
- const sourcePresent = () => sourcePage === 101 ?
- game.local().inventory.some(item => item.id === 1 && item.slot === 6) : cell(104, 48);
+ const sourcePresent = () => sourcePage === 104 ? cell(104, 48) :
+ game.local().inventory.some(item => item.id === 1 && item.slot === nativeSlot);
const click = async (source, button = 'left') => {
assert(source, 'the exact native source must be usable');
await game.click((source.bounds[0] + source.bounds[2]) / 2, (source.bounds[1] + source.bounds[3]) / 2, button);
};
+ const saveArmor = async label => {
+ await page.keyboard.press('Control+9');
+ const open = state => state.regions.some(([left, top, right, bottom]) =>
+ left === 832 && top === 380 && right === 1024 && bottom === 606);
+ await game.wait('native armor stats visible', open);
+ await game.save(output + '/' + label);
+ await page.keyboard.press('Control+9');
+ await game.wait('native armor stats closed', state => !open(state));
+ };
await page.goto(url);
await game.ready();
await page.waitForFunction(() => touchRegion(500, 400)?.world === true);
await game.snapshot();
await game.key('KeyI');
- if (sourcePage === 101) {
+ if (sourcePage !== 104) {
await page.keyboard.press('Control+1');
+ if (sourcePage === 102) await game.click(953, 53);
await game.snapshot();
}
assert(sourcePresent() && cell(104, 49));
+ evidence.initial = await server();
+ if (sourcePage === 102) await saveArmor('initial-armor');
assert((await page.request.post(url + '/test-stale-view')).ok());
evidence.transferred = await server();
assert.deepEqual(evidence.transferred.Items.map(item => [item.ID, item.Slot]), [[2, 65]]);
assert.deepEqual(evidence.transferred.Bank.map(item => [item.ID, item.Slot]), [[1, 0]]);
await game.save(output + '/stale');
const sequence = game.sequence;
- if (sourcePage === 101) await game.click(867, 206, 'right');
+ if (sourcePage === 102) await game.click(927, 94, 'right');
+ else if (sourcePage === 101) await game.click(867, 206, 'right');
else await click(cell(104, 48), 'right');
await game.wait('actual stale inventory move', () => game.events.some(event => event.sequence > sequence &&
event.direction === 'framesent' && event.opcode === '47537a24' &&
Buffer.from(event.hex, 'hex').readUInt32BE(29) === sourcePage && Buffer.from(event.hex, 'hex').readUInt32BE(33) === nativeSlot &&
- Buffer.from(event.hex, 'hex').readUInt32BE(45) === (sourcePage === 101 ? 111 : 6)));
+ Buffer.from(event.hex, 'hex').readUInt32BE(45) === (sourcePage === 104 ? 6 : 111)));
await game.wait('stale inventory move cancelled', () => game.events.some(event => event.sequence > sequence &&
event.direction === 'framereceived' && event.opcode === '5e477770' && Buffer.from(event.hex, 'hex').readUInt32BE(29) === 146));
await game.wait('empty authoritative source cleared', () => !sourcePresent() && cell(104, 49) && game.state.dragged[0] === 0);
assert.deepEqual(await server(), evidence.transferred);
- await game.save(output + '/refused');
+ if (sourcePage === 102) await saveArmor('refused');
+ else await game.save(output + '/refused');
// The correction must leave the actual banked instance available on this page.
if (!game.state.camera.firstPerson) await game.key('F8');
@@ -64,17 +79,19 @@ try {
if (!cell(104, 48)) await game.key('KeyI');
const retry = game.sequence;
await click(cell(104, 48), 'right');
- await game.wait('valid same-page wear completes', state => game.local(state).inventory.some(item => item.id === 1 && item.slot === 6) &&
+ await game.wait('valid same-page wear completes', state => game.local(state).inventory.some(item => item.id === 1 && item.slot === wornSlot) &&
game.events.some(event => event.sequence > retry && event.direction === 'framereceived' && event.opcode === '47537a24'));
evidence.after = await server();
- assert.deepEqual(evidence.after.Items.map(item => [item.ID, item.Slot]).sort((a, b) => a[0] - b[0]), [[1, 6], [2, 65]]);
+ assert.deepEqual(evidence.after.Items.map(item => [item.ID, item.Slot]).sort((a, b) => a[0] - b[0]), [[1, wornSlot], [2, 65]]);
assert.equal(evidence.after.Bank.length, 0);
- await game.save(output + '/moved');
+ assert.deepEqual(evidence.after.Armor, evidence.initial.Armor);
+ if (sourcePage === 102) await saveArmor('moved');
+ else await game.save(output + '/moved');
await page.reload();
await game.ready();
await page.waitForFunction(() => touchRegion(500, 400)?.world === true);
await game.snapshot();
- assert.deepEqual(game.local().inventory.map(item => [item.id, item.slot]).sort((a, b) => a[0] - b[0]), [[1, 6], [2, 49]]);
+ assert.deepEqual(game.local().inventory.map(item => [item.id, item.slot]).sort((a, b) => a[0] - b[0]), [[1, wornSlot], [2, 49]]);
assert.deepEqual(await server(), evidence.after);
assert.deepEqual(game.errors, []);
console.log('PASS: stale inventory source cleared, exact banked item withdrawn/moved and both instances retained through page/cold recovery');