commit b983571b089fe747ffb43db2920f083cc32cf5a6
parent 909926847fbe0b1261dd1f24c8795440a1a66db0
Author: anon <anon@example.com>
Date: Tue, 3 Nov 2026 00:48:29 +0000
Reject unsupported weapon wear contracts without partial bonuses
Diffstat:
6 files changed, 474 insertions(+), 5 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -478,9 +478,12 @@ unverified mass/deletion/reclaim policies are in [backpacks](docs/backpacks.md).
weapon contracts with additional events. OnWear accumulation must not imply
those other events are supported. Preserve all item properties and reject
incomplete contracts together; see `local/nano-cost-research/catalog/`.
- The independent original weapon census finds7,379 current admissions among
+ The independent original weapon census originally found7,379 admissions among
7,380 main-hand candidates:eight modify stats outside the shared validator list
- and83 have conditional modifiers that currently accumulate unconditionally.
+ and83 have conditional modifiers that accumulated unconditionally. Strict
+ OnWear admission now refuses these and two unresolved53162 contracts together,
+ leaving7,286 admissions; the broader companion-event audit remains open. See
+ [weapon wear admission](docs/weapon-wear-admission.md).
Review actual consumers before extending that list:315 has a NanoAC weapon
damage branch, but no original main-hand weapon uses NanoAC and its five
modifier records deal Energy damage. Their practical effect remains unknown;
@@ -3623,6 +3626,11 @@ and server restarts. Turn every reproduced bug into a focused regression test.
after reconnect and restart. The rejected-drag defect below is reproduced and
fixed; continue auditing other paths rather than treating that one fix or
passing Go tests as proof that the entire earlier report is resolved.
+ Unsupported conditional weapon wear now refuses the whole wear event instead
+ of applying partial bonuses. Two native Chair drags restore the source icon;
+ supported bat/HeadText wear and page/cold replay retain all three fixture
+ instances. This focused rejection case leaves the broader audit open; see
+ [weapon wear admission](docs/weapon-wear-admission.md).
The known occupied-hand rejection is now fixed using the recovered combined
delay and native slot exchange. Three replacements with a full ordinary
inventory retain all31 identities through two-client page and cold recovery;
diff --git a/docs/weapon-wear-admission.md b/docs/weapon-wear-admission.md
@@ -0,0 +1,80 @@
+# Complete weapon wear admission
+
+Unsupported weapon wear events are refused before any part of their bonuses
+applies. Previously Chesterfield Dining Chair122828 QL41 could be worn by a
+Solitus and added5 Psychic, although its original modifier requires Breed>3.
+The function condition is separate from the weapon's wear requirements.
+
+`ownedItem.isWieldableWeapon` now validates every OnWear function through the
+shared strict equipment-modifier validator. The original native HeadText
+presentation function is also admitted with its checked descriptor shape;
+its handler is `client/game/kkr.dll/lifted-0057.c::sub_360C14E0`. Undecoded
+definitions are refused. The existing inventory rejection path retains the
+instance and restores its native source icon. Admission is checked again at
+the end of a pending equip delay.
+
+## Original contract audit
+
+The retained full original-resource audit covers7,380 main-hand candidates.
+Every source hash still matches `local/weapon-contract-research/sources.json`.
+Comparing the actual Go predicate before and after this change finds exactly
+93 newly refused records and no newly admitted records:
+
+- 83 weapons with conditional modifiers.
+- Eight weapons modifying stats277 or315, outside the supported validator.
+- Temporal Chalice204706 and Unhallowed Chalice206016, with unresolved53162
+ wear functions.
+
+Admissions change from7,379 to7,286. The pre-existing invalid damage interval
+123868 remains refused. All eight issued starters and all four original
+HeadText weapons remain admitted. Source descriptors, hashes, expected changes
+and both predicate censuses are under `local/weapon-wear-admission/`.
+
+This refusal is the reconstruction's unsupported-contract policy, not a claim
+that the original game refused these weapons. The Chair is also refused for
+Atrox until the complete conditional lifecycle is supported. Existing native
+Tripler observations show that application and removal sample conditions
+independently, can leave signed offsets, and differ between owner and observer.
+Recomputing bonuses solely from current conditions would not match that
+lifecycle. The evidence and unresolved authoritative-server questions remain
+in `local/weapon-contract-research/conditional-native-lifecycle.md`.
+
+This change validates OnWear only. Independent OnHit/Use contracts and the
+broader whole-item audit remain open. Solar starters retain their event10
+descriptors. Stat315 has a NanoAC weapon-damage branch, but these five modifier
+records deal Energy damage; their practical effect is unresolved. Stat277 still
+lacks a defense/hit-chance consumer.
+
+## Focused verification
+
+Public inventory regressions check both Solitus and Atrox refusal, unsupported
+scalar and53162 companions, all four supported HeadText weapons, and a contract
+changed during an equip delay. Refusals leave the stored item bytes unchanged,
+apply no bonus, publish no observer success, and survive cold loading.
+
+`TestBrowserWeaponWearAdmission` uses two controlled native WASM clients and
+three granted instances. The level100 checkpoint and trained skills isolate
+wear admission; this is not earned progression evidence. With the old predicate,
+actual pickup/place equips the Chair and produces the incorrect+5 Psychic.
+With the fix, two repeated drags each receive the ordinary two-packet source-icon
+correction; inventory, maximum nano and Psychic remain unchanged. Native input
+also wears/removes the issued bat and Childhood Memory, then re-equips the bat.
+Childhood Memory uses explicit pickup/place because right-click invokes its
+independent Use action, including while worn.
+
+Page reload and a fresh server retain all three physical IDs, qualities, counts
+and slots without observer ownership leaks. The final native check passes in
+74.83s (live43.09, cold31.74), or82.436s including Go. Refusal and cold screenshots
+were reviewed. An independent verifier checks the failing baseline, exact
+93-record census delta, both outgoing wear requests, four correction packets,
+positive wear states and page/cold ledgers. All eight final traces have empty
+error lists and zero dropped events. Final captures are under
+`local/weapon-wear-admission/20261102-164038/`; the independent report is
+`local/weapon-wear-admission/independent-verification.json`.
+
+The related Go selection passes49 roots and543 individual results in178.210s,
+covering shared bonuses/timing, starters, selected weapon qualities, independent
+Briefcase Use, and bank/reclaim recovery. Six opt-in browser tests skip in this
+normal run; the focused native wear test above runs separately. Vet, Node syntax,
+gofmt and whitespace checks pass. All four new Go roots also pass under the race
+detector:14 individual results in96.830s.
diff --git a/server/browser_weapon_wear_admission_test.go b/server/browser_weapon_wear_admission_test.go
@@ -0,0 +1,105 @@
+package main
+
+import (
+ "context"
+ "crypto/sha256"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "runtime"
+ "slices"
+ "testing"
+ "time"
+)
+
+func TestBrowserWeaponWearAdmission(t *testing.T) {
+ if os.Getenv("AO_GAME_TEST") != "1" {
+ t.Skip("set AO_GAME_TEST=1 for the focused native weapon wear check")
+ }
+ _, source, _, _ := runtime.Caller(0)
+ root := filepath.Dir(filepath.Dir(source))
+ output := filepath.Join(root, "local/weapon-wear-admission", time.Now().Format("20060102-150405"))
+ t.Chdir(t.TempDir())
+ for _, phase := range []string{"live", "cold"} {
+ if !t.Run(phase, func(t *testing.T) {
+ world := newServer()
+ t.Cleanup(func() { world.db.Close() })
+ if phase == "live" {
+ for index := 0; index < 2; index++ {
+ player := world.newCharacter()
+ player.name, player.profession, player.level, player.appearance = fmt.Sprint("Wearaudit", index), 9, 100, 0x515
+ player.position[2] -= float32(index * 2)
+ player.stats.Abilities = characterAbilitiesStats{200, 200, 200, 200, 200, 200}
+ player.stats.Melee.OneHandBlunt, player.stats.Melee.FastAttack = 113, 34
+ player.stats.Body.Brawling = 50
+ player.health, player.nano = player.maximumHealth(), player.maximumNano()
+ player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprint("wear-audit-", index))))
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ }
+ // Controlled owned items isolate contract admission and source-icon recovery.
+ for _, template := range []uint32{122828, 121564, 154052} {
+ if granted, err := world.grantItem_locked(world.characters[1], template); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ }
+ }
+ owner, observer := world.characters[1], world.characters[2]
+ mux := http.NewServeMux()
+ mux.Handle("/", world.httpHandler())
+ mux.HandleFunc("GET /test-state", func(w http.ResponseWriter, r *http.Request) {
+ world.mutex.Lock()
+ defer world.mutex.Unlock()
+ json.NewEncoder(w).Encode(map[string]any{"inventory": owner.inventory, "observer": observer.inventory,
+ "psychic": owner.equipmentBonus(21), "nanoMaximum": owner.maximumNano()})
+ })
+ host := httptest.NewServer(mux)
+ t.Cleanup(host.Close)
+ closeTestBrowserStreams(t, world)
+ ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
+ defer cancel()
+ stopped := make(chan struct{})
+ go func() {
+ defer close(stopped)
+ ticker := time.NewTicker(20 * time.Millisecond)
+ defer ticker.Stop()
+ for {
+ select {
+ case now := <-ticker.C:
+ world.advanceEquipment(now)
+ case <-ctx.Done():
+ return
+ }
+ }
+ }()
+ defer func() { cancel(); <-stopped }()
+
+ command := exec.CommandContext(ctx, "node", filepath.Join(root, "tools/client/test_weapon_wear_admission.mjs"), host.URL, filepath.Join(output, phase))
+ command.Dir, command.Stdout, command.Stderr = root, os.Stdout, os.Stderr
+ err := command.Run()
+ cancel()
+ <-stopped
+ t.Logf("Browser artifacts: %s", output)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+ expected := []ownedItem{
+ {ID: 1, Type: 51018, Template: 122828, Quality: 41, Slot: 64, Count: 1},
+ {ID: 2, Type: 51018, Template: 121564, Quality: 1, Slot: 6, Count: 1},
+ {ID: 3, Type: 51018, Template: 154052, Quality: 1, Slot: 66, Count: 1},
+ }
+ if !slices.Equal(owner.inventory.Items, expected) || owner.equipmentBonus(21) != 0 || world.nextItem != 3 ||
+ owner.inventory.Credits != 0 || len(observer.inventory.Items) != 0 || observer.inventory.Credits != 0 {
+ t.Fatal("native refusal, supported wear or cold recovery changed the owned instances", owner.inventory)
+ }
+ }) {
+ return
+ }
+ }
+}
diff --git a/server/weapon_stats.go b/server/weapon_stats.go
@@ -7,9 +7,30 @@ import (
func (item ownedItem) isWieldableWeapon() bool {
definition := gamedata.ItemTemplates[item.Template]
- return item.Type == 51018 && definition != nil && definition.HeaderWords[0] == item.Type &&
- gamedata.ItemQualitySupported(item.Template, item.Quality) && item.templateStat(298)&64 != 0 &&
- item.templateStat(285) >= item.templateStat(286)
+ if item.Type != 51018 || definition == nil || definition.HeaderWords[0] != item.Type || definition.Undecoded != nil ||
+ !gamedata.ItemQualitySupported(item.Template, item.Quality) || item.templateStat(298)&64 == 0 ||
+ item.templateStat(285) < item.templateStat(286) {
+ return false
+ }
+
+ // A weapon's complete wear event must be supported before any bonus applies.
+ for _, section := range definition.Sections {
+ if section.Type != 2 || section.Subtype != 14 {
+ continue
+ }
+ for _, function := range *section.Functions {
+ // HeadText executes through the native presentation handler.
+ if function.ID == 53057 && function.HeaderWords == [2]uint32{0, 4} && function.ArgumentHeader == 9 &&
+ function.Target == 2 && len(function.Requirements) == 0 && function.TickCount == 1 && function.TickInterval == 0 &&
+ len(function.Arguments) == 2 && function.Arguments[0].String != nil && function.Arguments[1].Integer != nil {
+ continue
+ }
+ if !supportedEquipmentModifier(function) {
+ return false
+ }
+ }
+ }
+ return true
}
func interpolateWeapon(first, second *gamedata.Item, quality uint32) *gamedata.Item {
diff --git a/server/weapon_wear_admission_test.go b/server/weapon_wear_admission_test.go
@@ -0,0 +1,160 @@
+package main
+
+import (
+ "bytes"
+ "encoding/binary"
+ "fmt"
+ "slices"
+ "testing"
+)
+
+func TestConditionalWeaponWearRejectsWithoutChangingOwnershipOrBonuses(t *testing.T) {
+ for _, breed := range []uint16{1, 4} {
+ t.Run(fmt.Sprint(breed), func(t *testing.T) {
+ world, owner := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.appearance = player.appearance&^0x70 | breed<<4
+ player.stats.Abilities = characterAbilitiesStats{1, 1, 1, 1, 1, 1}
+ player.stats.Melee.OneHandBlunt, player.stats.Melee.FastAttack = 162, 83
+ player.stats.Body.Brawling, player.stats.Body.Dimach = 99, 36
+ player.inventory.Items[0].Template, player.inventory.Items[0].Quality = 122828, 41
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ if err := world.saveInventory_locked(player, player.inventory); err != nil {
+ t.Fatal(err)
+ }
+ before, err := readTestItemStore(world)
+ if err != nil {
+ t.Fatal(err)
+ }
+ observer := &combatTestConn{}
+ world.characters[2] = &character{id: 2, playfield: 950, health: 100}
+ world.clients[2] = &worldClient{id: 2, conn: observer, ready: true}
+ owner.packets = nil
+
+ if err := world.handleInventory(client, inventoryMovePacket(1, 64, 6)[20:]); err != nil {
+ t.Fatal(err)
+ }
+ if client.equipment != nil {
+ world.advanceEquipment(client.equipment.readyAt)
+ }
+ after, err := readTestItemStore(world)
+ cold := newTestInventoryServer(t).characters[1]
+
+ expected := []ownedItem{{ID: 1, Type: 51018, Template: 122828, Quality: 41, Slot: 64, Count: 1}}
+ if err != nil || !bytes.Equal(before, after) || !slices.Equal(player.inventory.Items, expected) ||
+ !slices.Equal(cold.inventory.Items, expected) || client.equipment != nil || player.equipmentBonus(21) != 0 ||
+ cold.equipmentBonus(21) != 0 || len(observer.packets) != 0 {
+ t.Fatal("unsupported conditional weapon changed ownership, bonuses or observers", err, player.inventory)
+ }
+ if len(owner.packets) != 2 || binary.BigEndian.Uint32(owner.packets[0][16:20]) != 0x47537a24 ||
+ binary.BigEndian.Uint32(owner.packets[1][16:20]) != 0x47537a24 {
+ t.Fatal("refused wear did not restore the ordinary source icon")
+ }
+ })
+ }
+}
+
+func TestWeaponWearRejectsUnsupportedScalarAndCompanionEffects(t *testing.T) {
+ for _, row := range []struct {
+ template, quality uint32
+ profession uint16
+ }{
+ {129077, 120, 1}, {208069, 40, 12}, {204706, 1, 10}, {206016, 1, 10},
+ } {
+ t.Run(fmt.Sprint(row.template), func(t *testing.T) {
+ world, output := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.profession, player.level = row.profession, 200
+ player.stats.Abilities = characterAbilitiesStats{1, 1, 1, 1, 1, 1}
+ switch row.template {
+ case 129077:
+ player.stats.Melee.TwoHandBlunt, player.stats.Melee.SneakAttack = 486, 244
+ case 208069:
+ player.stats.Melee.TwoHandBlunt, player.stats.Melee.FastAttack = 171, 86
+ player.stats.Body.Brawling = 103
+ case 204706:
+ player.stats.NanoAiding.MatterMetamorphosis, player.stats.NanoAiding.BiologicalMetamorphosis = 201, 201
+ case 206016:
+ player.stats.NanoAiding.MatterMetamorphosis, player.stats.NanoAiding.BiologicalMetamorphosis = 841, 841
+ }
+ player.inventory.Items[0].Template, player.inventory.Items[0].Quality = row.template, row.quality
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ if err := world.saveInventory_locked(player, player.inventory); err != nil {
+ t.Fatal(err)
+ }
+ before, err := readTestItemStore(world)
+ if err != nil {
+ t.Fatal(err)
+ }
+ output.packets = nil
+
+ err = world.handleInventory(client, inventoryMovePacket(1, 64, 6)[20:])
+ after, readErr := readTestItemStore(world)
+ cold := newTestInventoryServer(t).characters[1]
+
+ if err != nil || readErr != nil || !bytes.Equal(before, after) || client.equipment != nil || len(output.packets) != 2 ||
+ !slices.Equal(player.inventory.Items, cold.inventory.Items) || player.inventory.Items[0].Slot != 64 || cold.attackWeapon() != nil {
+ t.Fatal("unsupported wear applied a partial contract or changed its instance", err, readErr, player.inventory)
+ }
+ })
+ }
+}
+
+func TestWeaponWearRetainsNativeHeadTextPresentation(t *testing.T) {
+ for _, row := range []struct{ template, quality uint32 }{
+ {154052, 1}, {156599, 1}, {202725, 100}, {204396, 20},
+ } {
+ t.Run(fmt.Sprint(row.template), func(t *testing.T) {
+ world, _ := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.inventory.Items[0].Template, player.inventory.Items[0].Quality = row.template, row.quality
+ if err := world.saveInventory_locked(player, player.inventory); err != nil {
+ t.Fatal(err)
+ }
+
+ if err := world.handleInventory(client, inventoryMovePacket(1, 64, 6)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("native presentation companion rejected the wear contract", err)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+ cold := newTestInventoryServer(t).characters[1]
+
+ expected := []ownedItem{{ID: 1, Type: 51018, Template: row.template, Quality: row.quality, Slot: 6, Count: 1}}
+ if !slices.Equal(player.inventory.Items, expected) || !slices.Equal(cold.inventory.Items, expected) || cold.attackWeapon() == nil {
+ t.Fatal("native HeadText wear lost its weapon identity or cold state")
+ }
+ })
+ }
+}
+
+func TestPendingWeaponWearRechecksChangedItemContract(t *testing.T) {
+ world, output := newEquipmentWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ player.stats.Melee.OneHandBlunt, player.stats.Melee.FastAttack = 162, 83
+ player.stats.Body.Brawling, player.stats.Body.Dimach = 99, 36
+ if err := world.handleInventory(client, inventoryMovePacket(1, 64, 6)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("supported weapon did not begin wear", err)
+ }
+ deadline := client.equipment.readyAt
+ player.inventory.Items[0].Template, player.inventory.Items[0].Quality = 122828, 41
+ if err := world.saveInventory_locked(player, player.inventory); err != nil {
+ t.Fatal(err)
+ }
+ before, err := readTestItemStore(world)
+ if err != nil {
+ t.Fatal(err)
+ }
+ output.packets = nil
+
+ world.advanceEquipment(deadline)
+ after, err := readTestItemStore(world)
+ cold := newTestInventoryServer(t).characters[1]
+
+ if err != nil || !bytes.Equal(before, after) || client.equipment != nil || len(output.packets) != 2 ||
+ player.inventory.Items[0].Slot != 64 || !slices.Equal(player.inventory.Items, cold.inventory.Items) || cold.equipmentBonus(21) != 0 {
+ t.Fatal("pending wear admitted the changed unsupported contract", err, player.inventory)
+ }
+}
diff --git a/tools/client/test_weapon_wear_admission.mjs b/tools/client/test_weapon_wear_admission.mjs
@@ -0,0 +1,95 @@
+import assert from 'node:assert/strict';
+import fs from 'node:fs/promises';
+import {createRequire} from 'node:module';
+import {GameTest} from './game_test.mjs';
+
+const {chromium} = createRequire(import.meta.url)('playwright');
+const [url, output] = process.argv.slice(2);
+const browser = await chromium.launch({executablePath: '/usr/bin/chromium', headless: false,
+ args: ['--enable-gpu', '--use-gl=angle', '--use-angle=gl', '--no-sandbox', '--disable-dev-shm-usage',
+ '--disable-background-timer-throttling', '--disable-renderer-backgrounding']});
+const games = [], evidence = {attempts: [], supported: []};
+try {
+ for (let index = 0; index < 2; ++index) {
+ const context = await browser.newContext({viewport: {width: 1024, height: 768}});
+ await context.addCookies([{name: 'ao_client', value: 'wear-audit-' + index, url}]);
+ const page = await context.newPage(), game = await GameTest.attach(page);
+ games.push(game);
+ await page.goto(url);
+ await game.ready();
+ }
+ const [owner, observer] = games;
+ const state = async () => (await owner.page.request.get(url + '/test-state')).json();
+ evidence.initial = await state();
+ if (evidence.initial.inventory.Items[1].Slot !== 6) {
+ await owner.key('KeyI');
+ await owner.page.keyboard.press('Control+1');
+ for (let attempt = 0; attempt < 2; ++attempt) {
+ await owner.wait('native equipment action finishes', snapshot =>
+ !owner.local(snapshot).actions.includes(3) && !owner.local(snapshot).actions.includes(6));
+ const sequence = owner.sequence, observerSequence = observer.sequence;
+ await owner.click(681, 45);
+ await owner.click(867, 206);
+ await owner.wait('native request and equipment response', () =>
+ owner.events.some(event => event.sequence > sequence && event.direction === 'framesent' && event.opcode === '47537a24') &&
+ (owner.events.filter(event => event.sequence > sequence && event.direction === 'framereceived' && event.opcode === '47537a24').length >= 2 ||
+ owner.events.some(event => event.sequence > sequence && event.direction === 'framereceived' && event.opcode === '3b1d2268')));
+ const current = await state();
+ evidence.attempts.push({server: current, native: owner.local().inventory});
+ await owner.save(output + '/refused-' + attempt);
+ const request = owner.events.find(event => event.sequence > sequence && event.direction === 'framesent' && event.opcode === '47537a24');
+ const bytes = Buffer.from(request.hex, 'hex');
+ assert.deepEqual([29, 33, 37, 41, 45].map(offset => bytes.readUInt32BE(offset)), [104, 48, 50000, 1, 6]);
+ assert.deepEqual(current.inventory, evidence.initial.inventory);
+ assert.equal(current.psychic, 0);
+ assert.equal(current.nanoMaximum, evidence.initial.nanoMaximum);
+ assert.equal(owner.local().inventory.find(item => item.id === 1).slot, 48);
+ assert(!observer.events.some(event => event.sequence > observerSequence && event.direction === 'framereceived' &&
+ event.opcode === '3b1d2268' && event.actor[1] === 1));
+ }
+
+ // Supported weapons and native HeadText still use their normal wear/removal path.
+ for (const [id, remove] of [[2, true], [3, true], [2, false]]) {
+ await owner.wait('native equipment action finishes', snapshot =>
+ !owner.local(snapshot).actions.includes(3) && !owner.local(snapshot).actions.includes(6));
+ const item = owner.local().inventory.find(item => item.id === id), cell = item.slot - 48;
+ if (id === 3) {
+ await owner.click(681 + cell % 3 * 54, 45 + Math.floor(cell / 3) * 54);
+ await owner.click(867, 206);
+ } else {
+ await owner.click(681 + cell % 3 * 54, 45 + Math.floor(cell / 3) * 54, 'right');
+ }
+ await owner.wait('supported weapon worn', snapshot => owner.local(snapshot).inventory.some(item => item.id === id && item.slot === 6));
+ evidence.supported.push({id, server: await state()});
+ await owner.save(output + '/supported-' + id);
+ if (remove) {
+ await owner.wait('native equipment action finishes', snapshot =>
+ !owner.local(snapshot).actions.includes(3) && !owner.local(snapshot).actions.includes(6));
+ if (id === 3) {
+ await owner.click(867, 206);
+ await owner.click(681 + cell % 3 * 54, 45 + Math.floor(cell / 3) * 54);
+ } else {
+ await owner.click(867, 206, 'right');
+ }
+ await owner.wait('supported weapon removed', snapshot => owner.local(snapshot).inventory.some(item => item.id === id && item.slot >= 48));
+ }
+ }
+ for (const game of games) {
+ await game.page.reload();
+ await game.ready();
+ }
+ }
+ assert.deepEqual(owner.local().inventory.map(item => [item.id, item.slot, item.quality]).sort((a, b) => a[0] - b[0]),
+ [[1, 48, 41], [2, 6, 1], [3, 50, 1]]);
+ assert.equal((await state()).psychic, 0);
+ assert.deepEqual(observer.local().inventory, []);
+ evidence.final = {server: await state(), native: owner.local().inventory};
+ assert(games.every(game => game.errors.length === 0));
+ console.log('PASS: repeated native unsupported wear restores its icon; supported weapons and HeadText retain three instances through page/cold recovery');
+} finally {
+ try {
+ await fs.mkdir(output, {recursive: true});
+ await fs.writeFile(output + '/verification.json', JSON.stringify(evidence, null, 2));
+ await Promise.all(games.map((game, index) => game.save(output + '/final-' + index)));
+ } finally { await browser.close(); }
+}