aorecomp

Anarchy Online classic in the browser

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


commit 02c90eb2ca56aabd44fc6a0c56b36ea1f568d0fe
parent 857082c57ae7b35666d92a3c80e26c1c798fdbe3
Author: anon <anon@example.com>
Date:   Tue,  3 Nov 2026 17:18:02 +0000

Cover occupied-hand refusal during pending replacement

Diffstat:
MTODO.md | 4++++
Mdocs/inventory.md | 20++++++++++++++++++++
Mtools/client/test_pending_equipment.mjs | 35+++++++++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -3858,6 +3858,10 @@ and server restarts. Turn every reproduced bug into a focused regression test. cases, native completion/retry, page replay and exact cold ownership pass; this leaves the broader audit open. See [pending equipment](docs/inventory.md#another-move-while-equipment-is-pending). + That native checkpoint also verifies removal from the occupied hand during a + pending replacement. One same-slot refusal preserves the original swap and + deadline; later swaps, page replay and a cold database read retain both IDs. + This path passes without a product change; the broader audit remains open. A focused two-client native trade now follows an already instantiated QL50 weapon through cancellation, mutual acceptance, immediate recipient wear/remove/rewear and one shot, without a corrective reconnect. Its physical diff --git a/docs/inventory.md b/docs/inventory.md @@ -485,6 +485,26 @@ tests late completion and ownership, rather than earned progression or original server permission for concurrent equipment moves. Accepted native captures: `local/pending-equipment/20261102-205402/`. +The same fixture also removes the occupied hand while a replacement awaits +its server acknowledgement. After the local action ends, a real page101/slot6 +request receives one same-slot MoveItem reply. Unlike ordinary source repair, +this worn-source reply restores the hand without transient slot exchanges. +The admitted replacement, displaced identity and exact deadline remain +unchanged. Completing that replacement and reversing it retain both physical +IDs through page replay and the fixture's cold database read. No production +change was needed for this path; concurrent-equipment permission in the original +server remains outside this controlled late-acknowledgement check. + +The extended run `local/pending-equipment/20261103-091503` passes in30.15s +(Go37.738s). Six native requests, the one worn-source refusal, the later swaps +and final IDs1/2 are independently checked in +`local/replacing-hand/verification.json`. All six traces have empty error lists +and no dropped events. The added case waits for native action completion before +starting another move, rather than relying on screenshot timing. +The public-handler carried/worn refusal check passes all three Go results in +7.809s; JavaScript syntax and whitespace checks pass. Refused-hand and retained +inventory captures were reviewed. + ```sh AO_GAME_TEST=1 go test ./server -run '^TestBrowserSecondEquipmentMove$' -count=1 -timeout=4m -v ``` diff --git a/tools/client/test_pending_equipment.mjs b/tools/client/test_pending_equipment.mjs @@ -69,6 +69,41 @@ try { {...evidence.pending.inventory.Items[0], Slot: 65}, {...evidence.pending.inventory.Items[1], Slot: 6}]); assert.equal(game.events.filter(event => event.direction === 'framesent' && event.opcode === '47537a24').length, 3); await game.save(output + '/retried'); + + // Removing the occupied hand must not interrupt a pending replacement. + await game.wait('local retry action finishes', state => + !game.local(state).actions.includes(3) && !game.local(state).actions.includes(6)); + await equip(49); + evidence.replacement = await server(); + assert.equal(evidence.replacement.pending.replacedID, 2); + await game.wait('local replacement animation finishes', state => + !game.local(state).actions.includes(3) && !game.local(state).actions.includes(6)); + const hand = game.sequence; + await game.click(867, 206, 'right'); + await game.wait('occupied hand refusal acknowledged', () => game.events.some(event => + event.sequence > hand && event.direction === 'framereceived' && event.opcode === '47537a24')); + evidence.handRefused = await server(); + assert.deepEqual(evidence.handRefused, evidence.replacement); + assert.deepEqual(game.events.filter(event => event.sequence > hand && event.direction === 'framereceived' && + event.opcode === '47537a24').map(event => { + const packet = Buffer.from(event.hex, 'hex'); + return [packet.readUInt32BE(29), packet.readUInt32BE(33), packet.readUInt32BE(45)]; + }), [[101, 6, 6]]); + assert.deepEqual(game.state.dragged, [0, 0]); + await game.save(output + '/occupied-hand-refused'); + assert((await page.request.post(url + '/test-complete')).ok()); + await game.wait('original replacement completes after hand refusal', state => + game.local(state).inventory.some(item => item.id === 1 && item.slot === 6)); + + // Restore the retained layout through another ordinary native replacement. + await game.wait('local hand action finishes', state => + !game.local(state).actions.includes(3) && !game.local(state).actions.includes(6)); + await equip(49); + assert((await page.request.post(url + '/test-complete')).ok()); + await game.wait('both instances remain usable', state => + game.local(state).inventory.some(item => item.id === 2 && item.slot === 6)); + assert.equal(game.events.filter(event => event.direction === 'framesent' && event.opcode === '47537a24').length, 6); + await game.save(output + '/occupied-hand-retained'); await page.reload(); await game.ready(); await page.waitForFunction(() => touchRegion(500, 400)?.world === true);