commit 74b62b47ffd882949e9342c7105ff98291c50a87
parent ced54447676c9a2eb2eec628ef149ffe089bb6d6
Author: anon <anon@example.com>
Date: Mon, 2 Nov 2026 22:33:25 +0000
Support selected qualities for the M-10.3 pistol family
Diffstat:
8 files changed, 378 insertions(+), 21 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -369,6 +369,11 @@ unverified mass/deletion/reclaim policies are in [backpacks](docs/backpacks.md).
short two-client native checks cover strict Pistol/Fling gates, selected
damage/timing, Bullets, pickup, wear/removal, sale and exact cold ownership.
Acquisition remains open; see [M-10 contracts](docs/catalog-weapons.md#reviewed-shortened-and-regular-m-10-qualities).
+ The audited M-10.3 pair also admits QL38..119, fixing qualified QL39 wear.
+ Public-handler checks cover both anchors and damage/timing/midpoint boundaries;
+ a short two-client WASM check covers native QL39/78/79 wear, QL80 refusal,
+ one Bullet shot and exact page/cold ownership. Historical acquisition stays
+ open; see [M-10.3 contracts](docs/catalog-weapons.md#reviewed-m-103-qualities).
Six regular Steel-Ribbed pairs now use the shared QL1..200 path after complete
original descriptor audits, fixing qualified selected-quality wear rejection.
Public-handler and short two-client WASM checks cover strict Sense/Agility
diff --git a/docs/catalog-weapons.md b/docs/catalog-weapons.md
@@ -176,8 +176,8 @@ Two additional explicit endpoint pairs extend the shared pistol path:
123744/123745 (Shortened, QL12..21) and 123746/123747 (regular, QL22..37).
Before admission, qualified QL13 wear failed at the public inventory handler;
the retained failing regression is in `local/m10-quality/red-qualified-wear.log`.
-The production change consists of two rows in `item_families.yaml`. Later M-10.3
-and Nano tiers retain their separate, unreviewed intervals.
+These intervals are explicit rows in `item_families.yaml`. The M-10.3 interval
+is reviewed below; later M-10.4 and Nano tiers remain separate and unreviewed.
An independent read of all six original resource payloads, including Rusty,
matches the exported records and retains their hashes. Complete within-pair
@@ -239,6 +239,67 @@ Master line but supplies no Shortened/regular acquisition contract. Direct Auno
QL13/23 pages were inaccessible during the bounded follow-up. Original audits,
literal expectations and test reports are under `local/m10-quality/`.
+## Reviewed M-10.3 qualities
+
+The explicit pair 123748/123749 admits OT M-10.3 Flechette Pistol QL38..119.
+Qualified QL39 wear previously failed through the public inventory handler.
+An independent original-resource read/reparse matches both complete exported
+records. Within-pair headers, stat membership, full sections, attack/defense
+weights, getter defaults and presentation descriptors match; only the reviewed
+numeric properties and strict Pistol/Fling thresholds vary. This supports the
+pairing, rather than recovering the historical server's family table.
+
+| QL | Damage | Critical | Attack/recharge (cs) | Minimum Pistol/Fling | Value |
+| --- | --- | ---: | ---: | --- | ---: |
+| 38 | 4-43 | 25 | 124 | 174 / 90 | 18639 |
+| 39 | 4-44 | 25 | 124 | 179 / 92 | 18661 |
+| 58 | 4-60 | 32 | 124 | 265 / 135 | 27579 |
+| 59 | 5-61 | 32 | 123 | 270 / 137 | 28495 |
+| 78 | 5-77 | 38 | 123 | 356 / 180 | 54402 |
+| 79 | 5-78 | 39 | 123 | 361 / 183 | 56212 |
+| 98 | 5-94 | 45 | 123 | 447 / 226 | 99105 |
+| 99 | 6-95 | 45 | 122 | 452 / 228 | 101809 |
+| 118 | 6-111 | 52 | 122 | 538 / 271 | 161691 |
+| 119 | 6-112 | 52 | 122 | 543 / 273 | 165289 |
+
+MultiRanged runs from 118 to 535. The pair retains a 20-Bullet magazine,
+Projectile damage, 22m range, 150cs equip delay, Pistol attack, Dodge Ranged
+defense and Ranged Initiative. No new OnWear, OnHit or Use gameplay effect
+is admitted. The production change is one shared family row.
+
+Existing public-handler regressions cover both stored anchors at all ten QLs,
+including the midpoint and both minimum-damage/delay transitions. Combat cases
+use attack rating 800, keeping the upper endpoint out of OE while independently
+checking normal/critical and Fling damage, ammunition and reloads. Controlled
+QL39/79 pickups follow the exact physical item through failed wear,
+wear/removal/rewear, cancelled/accepted/repeated sales and cold ownership.
+Final fixture wallets are 934 and 2811 credits.
+
+`TestBrowserM103Qualities` uses two controlled WASM clients. A level 200
+Adventurer's abilities 300 contribute 74 trickle; raw Pistol 526/Fling 109 gives
+effective 600/183 within native training caps.
+Native input wears/removes QL39 and QL78, wears QL79 and refuses QL80's higher
+Fling requirement. The observer's weapon packet must contain the correct
+nearer definition and selected stats. An actual reload loads 20 Bullets; one
+ordinary shot must deal 195 Projectile damage and leave 19 loaded/80 carried.
+Page replay and fresh-server clients must retain all five exact item identities.
+This is a controlled contract fixture, not earned progression.
+
+Original payloads, index/payload hashes, the independent arithmetic and test
+reports are in `local/m10-3-quality/`. The
+[current AO Index](https://www.aoindex.com/items/page/62) lists QL38..119;
+it does not establish historical values or acquisition. Bounded web queries
+found no period M-10.3 stock contract. The local Fandom dump contains no exact
+M-10.3/M-10 plaintext match; its one Flechette match is unrelated buff rifles.
+Original shop, mission and creature-drop membership remain open.
+
+The native check passes in 66.26s (warm47.42s, cold18.84s); all ten retained
+trace error arrays are empty. Its independent verifier checks native/durable
+item ledgers, the shot/ammo totals and original payload hashes. Screenshots
+and evidence are in `local/m10-3-quality/20261102-143118/`. The related normal
+Go selection passes in 36.558s/7.689s, focused new-case race checks pass in
+106.108s/97.535s, and vet passes.
+
## Verification
`server/starter_weapons_test.go` covers all eight starter definitions, every
diff --git a/server/browser_m103_test.go b/server/browser_m103_test.go
@@ -0,0 +1,143 @@
+package main
+
+import (
+ "context"
+ "crypto/sha256"
+ "encoding/json"
+ "fmt"
+ "net/http"
+ "net/http/httptest"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "reflect"
+ "runtime"
+ "testing"
+ "time"
+)
+
+func TestBrowserM103Qualities(t *testing.T) {
+ if os.Getenv("AO_GAME_TEST") != "1" {
+ t.Skip("set AO_GAME_TEST=1 for the focused native M-10.3 check")
+ }
+ _, source, _, _ := runtime.Caller(0)
+ root := filepath.Dir(filepath.Dir(source))
+ output := filepath.Join(root, "local/m10-3-quality", time.Now().Format("20060102-150405"))
+ t.Chdir(t.TempDir())
+ for _, phase := range []string{"warm", "cold"} {
+ t.Run(phase, func(t *testing.T) {
+ world := newServer()
+ t.Cleanup(func() { world.db.Close() })
+ var target *character
+ for _, actor := range world.characters {
+ if actor.npc && actor.playfield == 950 && actor.monsterData == 17655 && actor.level == 1 && actor.combatProfile != nil && (target == nil || actor.id < target.id) {
+ target = actor
+ }
+ }
+ if target == nil {
+ t.Fatal("no Leet for the controlled shot")
+ }
+ if phase == "warm" {
+ for index := 0; index < 2; index++ {
+ player := world.newCharacter()
+ player.name = fmt.Sprint("M103", index)
+ player.position = target.position
+ player.position[0] -= float32(index * 3)
+ player.position[2] -= 2
+ player.rotation = [4]float32{0, 0, 0, 1}
+ player.browserTokenHash = fmt.Sprintf("%x", sha256.Sum256([]byte(fmt.Sprint("m103-", index))))
+ if index == 0 {
+ player.level, player.profession, player.appearance, player.aggDef = 200, 6, 0x515, 75
+ player.stats.Abilities = characterAbilitiesStats{300, 300, 300, 300, 300, 300}
+ player.stats.Ranged.Pistol, player.stats.Ranged.FlingShot = 526, 109
+ if player.trainingMaximum(112) < 526 || player.trainingMaximum(150) < 109 {
+ t.Fatal("controlled skills exceed native training caps")
+ }
+ pistol, _ := player.effectiveStat(112)
+ fling, _ := player.effectiveStat(150)
+ if pistol != 600 || fling != 183 {
+ t.Fatal("controlled effective Pistol/Fling values differ", pistol, fling)
+ }
+ }
+ player.health, player.nano = player.maximumHealth(), player.maximumNano()
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ }
+ // Controlled contracts and target HP isolate delivery, not earned progression.
+ owner := world.characters[1]
+ for _, item := range []struct{ template, quality uint32 }{
+ {123748, 39}, {123749, 78}, {123749, 79}, {123748, 80}, {21605, 1},
+ } {
+ if granted, err := world.grantItem_locked(owner, item.template); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ owner.inventory.Items[len(owner.inventory.Items)-1].Quality = item.quality
+ }
+ owner.inventory.Items[4].Count = 100
+ if err := world.saveInventory_locked(owner, owner.inventory); err != nil {
+ t.Fatal(err)
+ }
+ profile := *target.combatProfile
+ profile.Health = 10000
+ target.combatProfile, target.health = &profile, 10000
+ world.combatRoll = landedCombatRoll
+ }
+ owner, watcher := 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": watcher.inventory,
+ "target": target.id, "health": target.health, "fighting": owner.fighting})
+ })
+ 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)
+ world.advanceCombat(now)
+ case <-ctx.Done():
+ return
+ }
+ }
+ }()
+ defer func() { cancel(); <-stopped }()
+
+ command := exec.CommandContext(ctx, "node", filepath.Join(root, "tools/client/test_m103.mjs"), host.URL, filepath.Join(output, phase))
+ command.Dir, command.Stdout, command.Stderr = root, os.Stdout, os.Stderr
+ err := command.Run()
+ t.Logf("Browser artifacts: %s", output)
+
+ if err != nil {
+ t.Fatal(err)
+ }
+ world.mutex.Lock()
+ defer world.mutex.Unlock()
+ expected := []ownedItem{
+ {ID: 1, Type: 51018, Template: 123748, Quality: 39, Slot: 64, Count: 1},
+ {ID: 2, Type: 51018, Template: 123749, Quality: 78, Slot: 65, Count: 1},
+ {ID: 3, Type: 51018, Template: 123749, Quality: 79, Slot: 6, Count: 1, Ammo: 19},
+ {ID: 4, Type: 51018, Template: 123748, Quality: 80, Slot: 67, Count: 1},
+ {ID: 5, Type: 51005, Template: 21605, Quality: 1, Slot: 68, Count: 80},
+ }
+ if !reflect.DeepEqual(owner.inventory.Items, expected) || owner.inventory.Credits != 0 ||
+ len(watcher.inventory.Items) != 0 || watcher.inventory.Credits != 0 || world.nextItem != 5 {
+ t.Fatal("native wear, shot or cold recovery lost an instance, round or cash")
+ }
+ })
+ if t.Failed() {
+ return
+ }
+ }
+}
diff --git a/server/gamedata/item_families.yaml b/server/gamedata/item_families.yaml
@@ -15,6 +15,7 @@
- [123742, 123743]
- [123744, 123745]
- [123746, 123747]
+- [123748, 123749]
# Vektor ND shotguns: original descriptor audits; docs/vektor-shotguns.md.
- [124256, 124257]
- [124258, 124259]
diff --git a/server/gamedata/item_quality_test.go b/server/gamedata/item_quality_test.go
@@ -14,6 +14,7 @@ func TestReviewedItemFamilyQualityRanges(t *testing.T) {
{85638, 85637, 1, 200}, {85686, 85685, 1, 200}, {85742, 85741, 1, 200},
{42640, 42641, 1, 400}, {206730, 206731, 50, 150}, {158416, 158417, 1, 200}, {123742, 123743, 1, 11},
{123744, 123745, 12, 21}, {123746, 123747, 22, 37},
+ {123748, 123749, 38, 119},
{124256, 124257, 1, 4}, {124258, 124259, 5, 69}, {124260, 124261, 70, 179},
{70558, 85640, 1, 200}, {70559, 85689, 1, 200}, {70560, 85688, 1, 200}, {70561, 85744, 1, 200},
{70562, 85597, 1, 200}, {70563, 85558, 1, 200}, {70564, 85515, 1, 200}, {70565, 85514, 1, 200},
diff --git a/server/weapon_quality_lifecycle_test.go b/server/weapon_quality_lifecycle_test.go
@@ -18,6 +18,8 @@ func TestWeaponQualityGeneratedPickupEquipRemoveAndSale(t *testing.T) {
{123742, 5, 24, 15, 127}, {123743, 5, 24, 15, 127},
{123744, 13, 61, 33, 195}, {123745, 13, 61, 33, 195},
{123746, 30, 138, 72, 528}, {123747, 30, 138, 72, 528},
+ {123748, 39, 179, 92, 934}, {123749, 39, 179, 92, 934},
+ {123748, 79, 361, 183, 2811}, {123749, 79, 361, 183, 2811},
} {
t.Run(fmt.Sprintf("%d/QL%d", scenario.template, scenario.quality), func(t *testing.T) {
world, _ := newKillExperienceWorld(t, "unarmed")
diff --git a/server/weapon_quality_test.go b/server/weapon_quality_test.go
@@ -34,6 +34,16 @@ func TestWeaponQualityEquipRequiresInterpolatedSkillsAndRecovers(t *testing.T) {
{123746, 123747, 30, 4, 36, 22, 124, 10554, 98, 123747, 138, 72},
{123746, 123747, 36, 4, 41, 24, 124, 16478, 113, 123747, 165, 86},
{123746, 123747, 37, 4, 42, 24, 124, 17780, 116, 123747, 170, 88},
+ {123748, 123749, 38, 4, 43, 25, 124, 18639, 118, 123748, 174, 90},
+ {123748, 123749, 39, 4, 44, 25, 124, 18661, 123, 123748, 179, 92},
+ {123748, 123749, 58, 4, 60, 32, 124, 27579, 221, 123748, 265, 135},
+ {123748, 123749, 59, 5, 61, 32, 123, 28495, 226, 123748, 270, 137},
+ {123748, 123749, 78, 5, 77, 38, 123, 54402, 324, 123748, 356, 180},
+ {123748, 123749, 79, 5, 78, 39, 123, 56212, 329, 123749, 361, 183},
+ {123748, 123749, 98, 5, 94, 45, 123, 99105, 427, 123749, 447, 226},
+ {123748, 123749, 99, 6, 95, 45, 122, 101809, 432, 123749, 452, 228},
+ {123748, 123749, 118, 6, 111, 52, 122, 161691, 530, 123749, 538, 271},
+ {123748, 123749, 119, 6, 112, 52, 122, 165289, 535, 123749, 543, 273},
} {
for _, template := range [2]uint32{scenario.low, scenario.high} {
t.Run(fmt.Sprintf("%d/QL%d", template, scenario.quality), func(t *testing.T) {
@@ -144,25 +154,36 @@ func TestWeaponQualityEquipRequiresInterpolatedSkillsAndRecovers(t *testing.T) {
func TestWeaponQualityNormalAndFlingDamageAmmoAndReloadRecover(t *testing.T) {
for _, scenario := range []struct {
low, high, quality, normal, critical, delay uint32
+ pistol, fling uint16
}{
- {123742, 123743, 1, 24, 48, 125},
- {123742, 123743, 2, 26, 50, 125},
- {123742, 123743, 5, 30, 56, 125},
- {123742, 123743, 6, 32, 60, 125},
- {123742, 123743, 10, 38, 68, 125},
- {123742, 123743, 11, 40, 70, 125},
- {123744, 123745, 12, 42, 74, 125},
- {123744, 123745, 13, 44, 76, 125},
- {123744, 123745, 16, 50, 84, 125},
- {123744, 123745, 17, 50, 86, 124},
- {123744, 123745, 20, 56, 94, 124},
- {123744, 123745, 21, 58, 96, 124},
- {123746, 123747, 22, 60, 98, 124},
- {123746, 123747, 23, 62, 100, 124},
- {123746, 123747, 29, 72, 114, 124},
- {123746, 123747, 30, 72, 116, 124},
- {123746, 123747, 36, 82, 130, 124},
- {123746, 123747, 37, 84, 132, 124},
+ {123742, 123743, 1, 24, 48, 125, 400, 100},
+ {123742, 123743, 2, 26, 50, 125, 400, 100},
+ {123742, 123743, 5, 30, 56, 125, 400, 100},
+ {123742, 123743, 6, 32, 60, 125, 400, 100},
+ {123742, 123743, 10, 38, 68, 125, 400, 100},
+ {123742, 123743, 11, 40, 70, 125, 400, 100},
+ {123744, 123745, 12, 42, 74, 125, 400, 100},
+ {123744, 123745, 13, 44, 76, 125, 400, 100},
+ {123744, 123745, 16, 50, 84, 125, 400, 100},
+ {123744, 123745, 17, 50, 86, 124, 400, 100},
+ {123744, 123745, 20, 56, 94, 124, 400, 100},
+ {123744, 123745, 21, 58, 96, 124, 400, 100},
+ {123746, 123747, 22, 60, 98, 124, 400, 100},
+ {123746, 123747, 23, 62, 100, 124, 400, 100},
+ {123746, 123747, 29, 72, 114, 124, 400, 100},
+ {123746, 123747, 30, 72, 116, 124, 400, 100},
+ {123746, 123747, 36, 82, 130, 124, 400, 100},
+ {123746, 123747, 37, 84, 132, 124, 400, 100},
+ {123748, 123749, 38, 129, 204, 124, 800, 300},
+ {123748, 123749, 39, 132, 207, 124, 800, 300},
+ {123748, 123749, 58, 180, 276, 124, 800, 300},
+ {123748, 123749, 59, 183, 279, 123, 800, 300},
+ {123748, 123749, 78, 231, 345, 123, 800, 300},
+ {123748, 123749, 79, 234, 351, 123, 800, 300},
+ {123748, 123749, 98, 282, 417, 123, 800, 300},
+ {123748, 123749, 99, 285, 420, 122, 800, 300},
+ {123748, 123749, 118, 333, 489, 122, 800, 300},
+ {123748, 123749, 119, 336, 492, 122, 800, 300},
} {
for _, template := range [2]uint32{scenario.low, scenario.high} {
for _, critical := range []bool{false, true} {
@@ -170,7 +191,7 @@ func TestWeaponQualityNormalAndFlingDamageAmmoAndReloadRecover(t *testing.T) {
world, owner := newRangedWorld(t)
player, target, client := world.characters[1], world.characters[1000000], world.clients[1]
player.stats.Abilities = characterAbilitiesStats{1, 1, 1, 1, 1, 1}
- player.stats.Ranged.Pistol, player.stats.Ranged.FlingShot = 400, 100
+ player.stats.Ranged.Pistol, player.stats.Ranged.FlingShot = scenario.pistol, scenario.fling
player.stats.Speed.RangedInitiative, player.aggDef = 0, 75
player.inventory.Items[0].Template, player.inventory.Items[0].Quality = template, scenario.quality
if err := world.saveUser_locked(player); err != nil {
diff --git a/tools/client/test_m103.mjs b/tools/client/test_m103.mjs
@@ -0,0 +1,123 @@
+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 = {};
+async function bagClick(game, id, button = 'right') {
+ await game.wait('native equipment action finishes', state =>
+ !game.local(state).actions.includes(3) && !game.local(state).actions.includes(6));
+ const item = game.local().inventory.find(item => item.id === id);
+ assert(item && item.slot >= 48 && item.slot < 57);
+ const cell = item.slot - 48;
+ await game.click(681 + cell % 3 * 54, 45 + Math.floor(cell / 3) * 54, button);
+}
+try {
+ for (const index of [0, 1]) {
+ const context = await browser.newContext({viewport: {width: 1024, height: 768}});
+ await context.addCookies([{name: 'ao_client', value: 'm103-' + index, url}]);
+ const page = await context.newPage();
+ const game = await GameTest.attach(page);
+ games.push(game);
+ await page.goto(url);
+ await game.ready();
+ }
+ const [owner, observer] = games;
+ const server = async () => (await owner.page.request.get(url + '/test-state')).json();
+ evidence.initial = await server();
+ if (evidence.initial.inventory.Items[2].Ammo === 0) {
+ assert.equal(owner.local().stats[112], 526);
+ assert.equal(owner.local().stats[150], 109);
+ await owner.key('KeyI');
+ await owner.page.keyboard.press('Control+1');
+ for (const id of [1, 2, 3]) {
+ const sequence = observer.sequence;
+ await bagClick(owner, id);
+ await owner.wait('selected M-10.3 worn', state => owner.local(state).inventory.some(item => item.id === id && item.slot === 6));
+ await observer.wait('observer receives selected M-10.3', () => observer.events.some(event =>
+ event.sequence > sequence && event.direction === 'framereceived' && event.opcode === '3b1d2268' &&
+ event.actor[0] === 51018 && event.actor[1] === id));
+ const packet = Buffer.from(observer.events.find(event => event.sequence > sequence &&
+ event.direction === 'framereceived' && event.opcode === '3b1d2268' && event.actor[0] === 51018 && event.actor[1] === id).hex, 'hex');
+ const stats = new Map();
+ for (let offset = 59; offset < packet.readUInt16BE(6) - 4; offset += 8)
+ stats.set(packet.readUInt32BE(offset), packet.readUInt32BE(offset + 4));
+ const [quality, definition, minimum, maximum, critical, delay, value, multi] = {
+ 1: [39, 123748, 4, 44, 25, 124, 18661, 123],
+ 2: [78, 123748, 5, 77, 38, 123, 54402, 324],
+ 3: [79, 123749, 5, 78, 39, 123, 56212, 329],
+ }[id];
+ assert.equal(stats.get(23), definition);
+ const base = {
+ 123748: {74: 18639, 134: 118, 284: 25, 285: 43, 286: 4, 294: 124, 210: 124, 212: 20},
+ 123749: {74: 165289, 134: 535, 284: 52, 285: 112, 286: 6, 294: 122, 210: 122, 212: 20},
+ }[definition];
+ for (const [stat, expected] of Object.entries({74: value, 134: multi, 284: critical, 285: maximum,
+ 286: minimum, 294: delay, 210: delay, 212: 20, 26: 0, 701: quality, 702: 123748, 703: 123749}))
+ assert.equal(stats.get(Number(stat)) ?? base[stat], expected, 'selected native weapon stat ' + stat);
+ evidence['worn' + id] = {native: owner.local().inventory, server: await server()};
+ await owner.save(output + '/worn-' + id);
+ if (id !== 3) {
+ await owner.click(867, 206, 'right');
+ await owner.wait('same M-10.3 removed', state => owner.local(state).inventory.some(item => item.id === id && item.slot >= 48));
+ }
+ }
+ const rejected = await server();
+ const sequence = owner.sequence;
+ await bagClick(owner, 4);
+ await owner.save(output + '/rejected-80');
+ assert(!owner.events.some(event => event.sequence > sequence && event.direction === 'framesent' && event.opcode === '47537a24'));
+ assert.deepEqual((await server()).inventory, rejected.inventory);
+
+ // The actual native ammunition-on-weapon request loads twenty Bullets.
+ await bagClick(owner, 5, 'left');
+ await owner.click(867, 206, 'right');
+ await owner.wait('bullet stack debited', state => owner.local(state).inventory.some(item => item.id === 5 && item.count === 80));
+ assert.equal((await server()).inventory.Items[2].Ammo, 20);
+ await owner.wait('native reload completes', state => !owner.local(state).actions.includes(5));
+ const before = await server();
+ const deadline = Date.now() + 10000;
+ while (owner.state.selected[0] !== 50000 || owner.state.selected[1] !== before.target) {
+ assert(Date.now() < deadline, 'Native Tab did not select the controlled Leet');
+ const selected = owner.state.selected;
+ await owner.key('Tab');
+ await owner.wait('native target cycle advances', state => state.selected[0] !== selected[0] || state.selected[1] !== selected[1]);
+ }
+ const attack = owner.sequence;
+ await owner.key('KeyQ');
+ await owner.wait('one real selected-quality shot', () => owner.events.some(event => event.sequence > attack &&
+ event.direction === 'framereceived' && event.opcode === '46002f16' && event.actor[1] === owner.local().id));
+ await owner.key('KeyQ');
+ await Promise.all(games.map(game => game.wait('native selected-quality impact', state =>
+ state.actors.some(actor => actor.id === before.target && actor.stats[27] === 9805))));
+ evidence.shot = await server();
+ assert.equal(evidence.shot.health, 9805);
+ assert.equal(evidence.shot.inventory.Items[2].Ammo, 19);
+ assert.equal(evidence.shot.fighting, 0);
+ await owner.save(output + '/shot');
+ await observer.save(output + '/observer-shot');
+ await owner.page.reload();
+ await owner.ready();
+ }
+ assert.deepEqual(owner.local().inventory.map(item => [item.id, item.slot, item.quality, ...item.templates, item.count]).sort((a, b) => a[0] - b[0]), [
+ [1, 48, 39, 123748, 123749, 1], [2, 49, 78, 123748, 123749, 1],
+ [3, 6, 79, 123748, 123749, 1], [4, 51, 80, 123748, 123749, 1],
+ [5, 52, 1, 21605, 21605, 80],
+ ]);
+ assert.equal((await server()).inventory.Items[2].Ammo, 19);
+ assert.deepEqual(observer.local().inventory, []);
+ evidence.final = {native: owner.local().inventory, server: await server()};
+ assert(games.every(game => game.errors.length === 0));
+ console.log('PASS: native M-10.3 selected qualities, wear/removal, Fling gate, bullet reload, shot and page/cold ownership');
+} 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(); }
+}