aorecomp

Anarchy Online classic in the browser

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


commit 0dec4211bcca2e77da3de5b75455259be08dac18
parent f0a9639bd05d8708ca4920d96bf3531f9d12e47b
Author: anon <anon@example.com>
Date:   Mon,  2 Nov 2026 02:02:18 +0000

Verify earned continuation and guard walks during zoning

Diffstat:
MDEVELOPERS.md | 3++-
MTODO.md | 27+++++++++++++++++++++++++++
Mclient/tests/game_test.mjs | 22++++++++++++++++++++++
Mdocs/character-progression.md | 20++++++++++++++++++++
Mdocs/mission-levels.md | 59+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mdocs/player-trading.md | 18++++++++++++++++++
Aserver/eighth_level_training_test.go | 90+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtools/client/game_test.mjs | 1+
8 files changed, 239 insertions(+), 1 deletion(-)

diff --git a/DEVELOPERS.md b/DEVELOPERS.md @@ -453,7 +453,8 @@ next full snapshot. Reading a large snapshot while holding a skill button can trigger native autorepeat and buy more points than intended. `GameTest.walk(x, z)` follows observed position and heading with bounded native steering/final-approach pulses. It rejects stalled routes and waits for actor -readiness when travel changes playfields. Use it for ordinary ground routes. +readiness when travel changes playfields, including a walk started while the +local actor is absent during zoning. Use it for ordinary ground routes. Run its isolated browser regression with Node.js, Playwright and Chromium available (`node` on PATH, `playwright` installed locally or on NODE_PATH, diff --git a/TODO.md b/TODO.md @@ -798,6 +798,18 @@ for exact records, protocol, tests and remaining reconstruction assumptions. verifies fifteen full-health level-ten kills, the saved rewards' qualification, all eight effective AC values and the unchanged QL10 promise after leveling. Its final cold check conserves all 36 player-owned items and five contracts. + A subsequent earned continuation clears five full-health level-seven and + five full-health level-nine encounters, returns both exact books and retains + all 110 physical item/location rows through page and cold recovery. The + player remains level seven at 2725 current XP; native level eight is open. + A new public-handler regression covers the level7 -> 8 award, atomic + Stamina-bound training refusal and the qualified 442-IP batch without a + health refill. See + [return to the interrupted contract](docs/mission-levels.md#earned-return-to-the-interrupted-contract). + Earned parts and spare pants then fund another 50-charge laboratory through + ordinary medical-shop travel, leaving 1214 credits and 77 laboratory charges. + Page and final cold recovery account for all 33 owned items and 107 physical + records, with all eight completed contracts retained. - [x] Verify mapped Tiny Stalkers as a second ordinary early combat family. Admit only SR01 at levels 2..4 through shared profiles, preserving medium identity confidence, attack-selection uncertainty and provisional balance. @@ -3157,6 +3169,15 @@ with payloads and known client/server provenance. rejected them and the route was corrected. All 21 items and 59 credits remain accounted for until the subsequent purchase. Captures: `runtime-level4/` in `local/todo-progression-play/`. +- [x] [P0] Wait for local actor readiness when a native walk starts during zoning. + An earned backyard exit captured `localId: 0` before the next city walk; the + harness dereferenced the missing actor before its existing readiness guard. + A focused public-walk regression reproduces that exact exception. The + one-line guard passes all 127 JavaScript checks. Fresh WASM clients recover + all 36 owned items, cross the original backyard/city gates, walk to the + medical shop and continue city walking after shop exit without the exception. + Earned sales/restocking and page recovery retain all remaining items and + progress. See `local/earned-eight/` and the documented native continuation. - [x] Follow moving native projections during gameplay picking. The next ordinary Leet entered the viewport during a failed pick, while all probes stayed near its first offscreen position. A focused public-driver regression @@ -3204,6 +3225,12 @@ with payloads and known client/server provenance. independently, fails later waits and writes the errors into each trace report. The focused public-driver regression fails against the old code and passes with the fix; the event/snapshot history remains bounded. +- [ ] [P2] Identify the isolated browser-console 404 in the earned continuation. + Capture the failing resource URL on a native reproduction and fix any missing + required asset. The 692-trace audit finds no native/protocol errors, but the + earlier observer console message lacks a URL; do not assume it is a favicon. + Capture: `local/earned-eight/native-20261101-161130/earned-eight-backyard-entry/1/trace.json`. + The subsequent complete city/shop path and final cold recovery pass. - [ ] [P1] Retain selected lifecycle evidence across large native world replays. Check: death/resurrection markers, including CharacterAction152 and Resurrect, survive ordinary trace rollover while memory remains bounded. The connected diff --git a/client/tests/game_test.mjs b/client/tests/game_test.mjs @@ -157,6 +157,28 @@ test('an engine failure still releases a short key press', async () => { assert.deepEqual(keys, [['down', 'KeyU'], ['up', 'KeyU']]); }); +test('walking waits for a local actor when started during the zoning gap', async () => { + const game = new GameTest(); + game.state = {localId: 0, actors: []}; + game.worldStream = 'world'; + game.readyActors.add(7); + const keys = []; + let ready = 0; + game.page = {bringToFront: async () => {}, locator: () => ({focus: async () => {}}), + waitForFunction: async () => { ++ready; }, keyboard: {press: async key => keys.push(key)}}; + game.snapshot = async () => { + game.state = {localId: 7, screen: [1024, 768], actors: [ + {type: 50000, id: 7, playfield: 3000, inventory: [], position: [60, 0, 75]}, + ]}; + return game.state; + }; + + await game.walk(60, 75); + + assert.equal(ready, 1); + assert.deepEqual(keys, []); +}); + test('walking stops for observed zoning before sending another movement pulse', async () => { const game = new GameTest(); game.state = {localId: 7, actors: [{type: 50000, id: 7, playfield: 950}]}; diff --git a/docs/character-progression.md b/docs/character-progression.md @@ -324,6 +324,26 @@ test/subtest results both normally and under the race detector. It includes all three later earned-level regressions and the skill training suite. `go vet ./server/...` also passes. +`TestEarnedEighthLevelNeedsStaminaForBodyDevelopmentTraining` isolates the +level-seven to eight boundary with a controlled one-health level-ten Leet. +At level seven, a request to train raw Body Development and 1h Blunt from +40 to 45 leaves skills, IP, health and retained items unchanged. The kill +crosses 5350 current XP to level eight with 150 remaining and awards 4000 IP. +Maximum health rises from 254 to 261 while current health stays 150. + +Stamina 22 permits Body Development 43 under the original floating-point +ability limit. Requesting 44 together with otherwise qualified 1h Blunt 45 +rejects the entire batch. Raising Stamina to 23 and both skills to 45 in one +batch costs 442 IP. Maximum health becomes 281 without refilling current +health. Cold reconstruction conserves the exact worn QL8 bat, body and pants, +laboratory and recharger counts, wallet and trained stats. This fixture checks +progression and training bookkeeping; its shortened encounter does not measure +native combat or original NPC balance. + +The focused earned-level, skill-training and cash-trade selection passes 20 +root tests and 82 test/subtest results normally and under the race detector. +`go vet ./server/...` also passes. Native earned level eight remains open. + ## Retained evidence The selected relocated `kkr.dll` has SHA-256 diff --git a/docs/mission-levels.md b/docs/mission-levels.md @@ -504,3 +504,62 @@ checks cap refusal, the earned IP award, the 705-IP batch, preserved current health and cold conservation through both armor moves. Original NPC balance, level eight onward, conditional mission XP/tokens and broader coverage remain open. + +## Earned return to the interrupted contract + +After the [earned saved-scanner death](insurance.md#street-level-omni-pair), +the retained level-seven Enforcer sold seven spare items and completed the +[credit-qualified city trip](player-trading.md#persistence-lifecycle-and-verification). +Two fresh WASM clients recovered all 32 owned items and wallets 1209/0 before +ordinary travel returned the owner to its interrupted contract 285. + +All five level-seven encounters were at full 225 HP before the new fights. +The earlier injured encounter had already regenerated to 225 in the preceding +cold checkpoint. Ordinary Q/Fast Attack defeated all five, adding 1125 XP, +13 corpse credits and one QL8 Monster Part 287. Returning the exact book 286 +consumed key 285 and delivered the saved QL7 pants 288 plus 20 credits. +Ten laboratory charges and one bought recharger charge were consumed. + +Two maximum-difficulty requests at player level seven returned no offer and +charged nothing because level 12 lies outside the admitted profiles. The first +supported offer selected level-nine encounters and QL9 Metaplast gloves. That +unforced offer cost seven credits and was accepted. All five encounters began +at full 275 HP, with the owner at full 254 HP. Their kills added 1375 XP, +22 corpse credits and QL10/QL9 parts 291/292. Thirteen laboratory charges +restored full health between fights. Exact book 290 and key 289 were consumed +on return, delivering the promised QL9 gloves 293 and 20 credits. + +The stopped checkpoint retains 29 owner items and seven observer items, all 110 +physical item/location records, eight completed contracts, full 254 HP/34 nano, +2725 current XP and 21074 IP. The same seven pieces remain worn. The four +laboratories retain 11/9/4/3 charges and recharger 284 retains 47. The wallet +reconciles as 1209 - 7 request fee + 35 corpse cash + 40 rewards = 1277 credits. +Both page reconnects and fresh server/WASM clients conserve these identities, +quantities, wallets, skills, progression and saved scanner. The observer's +allocator metadata refreshes to the current global item ID; its seven actual +items and all character state remain unchanged. + +Evidence and independent verifiers are under `local/earned-eight/`, including +`first-contract-verified.json`, `native-fights-progress.json`, +`checkpoint-verified.json` and `checkpoint-cold-verified.json`. Encounter balance +remains provisional. The separate level-eight Go regression checks training +bookkeeping; native earned level eight remains open. + +The fresh continuation then follows the original city route to medical shop +1183. Parts 287/291/292 sell for 18 credits, and spare QL7 pants 288 sell for +69. Each pending quote preserves the exact items and wallet until ACCEPT. +Buying one 50-charge laboratory for 150 credits leaves 1214 credits and +77 laboratory charges, with recharger 284 unchanged at 47. The new laboratory +is permanent instance 294; all other items, skills and progress are conserved. +Ordinary shop exit, another city walk and both page reconnects retain all +33 owned items and all 107 global physical item/location records. See +`restock-verified.json` under `local/earned-eight/`. + +A final fresh server and two fresh WASM clients, followed by both page +reconnects, retain those same 107 physical rows, 33 owned items, quantities, +wallets, skills, poses, scanner and completed contracts. The final native Stats +form shows level seven, XP 2725/5500 and full 254 HP/34 nano. The bought +laboratory shows 50 charges. See `final-cold-verified.json`. All owned test +clients and temporary servers close normally. The audit of 692 traces finds no +native/protocol errors. One earlier observer capture contains an unattributed +browser-console 404 without its resource URL; that follow-up remains open. diff --git a/docs/player-trading.md b/docs/player-trading.md @@ -160,3 +160,21 @@ Unique rejection, disconnect cancellation and 32 offer/cancel cycles without remote-row accumulation. Cold restart verifies durable identities, quantities, balances and backpack contents. The clients use ordinary mouse/keyboard input; heap and SQLite probes only inspect the resulting state. + +An earned level-seven Enforcer also sold seven spare items for 663 credits, +then lent exactly 1000 of its 1209 credits to the unchanged level-one observer. +Both native cash-only trade consents completed before either wallet changed. +The observer then satisfied the original Backyard1 exit's credit qualification +and entered Omni-1 Entertainment without a debit. A second ordinary trade +returned all 1000 credits. The settled wallets were again 1209/0, with all +25 owner items and seven observer items unchanged. No item offers or new +identities were involved. + +The stopped database conserves all 107 physical item/location rows after the +seven sales. Two fresh WASM clients recovered those wallets, ownership, +progression and insurance state exactly. Per-stage wire captures retain both +cash/consent directions and each client's two Complete messages. City traffic +exceeds one bounded trace, so the return-trade audit merges the saved stages +by event sequence. Evidence and independent verifiers are under +`local/earned-eight/`, including `sales-verified.json`, +`prepared-verified.json` and `prepared-cold-verified.json`. diff --git a/server/eighth_level_training_test.go b/server/eighth_level_training_test.go @@ -0,0 +1,90 @@ +package main + +import ( + "ao/server/gamedata" + "slices" + "testing" + "time" +) + +func TestEarnedEighthLevelNeedsStaminaForBodyDevelopmentTraining(t *testing.T) { + world, _ := newKillExperienceWorld(t, "unarmed") + player, client := world.characters[1], world.clients[1] + player.appearance = player.appearance&^(7<<4) | 4<<4 + player.profession, player.level, player.experience = 9, 7, 5350 + player.stats = defaultCharacterStats(4) + player.stats.Abilities = characterAbilitiesStats{24, 26, 22, 6, 7, 3} + player.stats.Body.BodyDevelopment, player.stats.Melee.OneHandBlunt = 40, 40 + player.stats.ImprovementPoints, player.health = 21074, 150 + if err := world.saveUser_locked(player); err != nil { + t.Fatal(err) + } + + // Retain the worn rewards and bought recovery supplies. + items := []ownedItem{ + {ID: 3, Type: 51018, Template: 122691, Quality: 8, Slot: 6, Count: 1}, + {ID: 4, Type: 51022, Template: 85686, Quality: 8, Slot: 21, Count: 1}, + {ID: 5, Type: 51022, Template: 85512, Quality: 8, Slot: 27, Count: 1}, + {ID: 6, Type: 51005, Template: 25812, Quality: 1, Slot: 64, Count: 3}, + {ID: 7, Type: 51005, Template: 25820, Quality: 1, Slot: 65, Count: 48}, + } + if err := world.saveInventory_locked(player, playerInventory{LastID: 7, Items: slices.Clone(items), Credits: 546}); err != nil { + t.Fatal(err) + } + + // Use the level-ten Leet profile at one health to isolate the earned award. + world.combatRoll = func(uint32) uint32 { return 0 } + world.characters[1000000].level = 10 + world.characters[1000000].combatProfile = gamedata.NPCCombatProfiles[17655][10] + trained := player.baseStats() + trained.Body.BodyDevelopment, trained.Melee.OneHandBlunt = 45, 45 + + if err := world.handleSkillTraining(client, skillTrainingRequest(trained)[20:]); err != nil { + t.Fatal(err) + } + cold := newTestInventoryServer(t) + + for _, current := range []*server{world, cold} { + owner := current.characters[1] + if owner.level != 7 || owner.experience != 5350 || owner.stats.ImprovementPoints != 21074 || + owner.stats.Body.BodyDevelopment != 40 || owner.stats.Melee.OneHandBlunt != 40 || + owner.health != 150 || owner.maximumHealth() != 254 || !slices.Equal(owner.inventory.Items, items) { + t.Fatal("level-seven training changed capped skills, IP, health or retained items", owner.profile()) + } + } + + attackForExperience(t, world, "unarmed") + world.advanceCombat(player.rechargeUntil.Add(time.Second)) + trained.Body.BodyDevelopment = 44 + if err := world.handleSkillTraining(client, skillTrainingRequest(trained)[20:]); err != nil { + t.Fatal(err) + } + cold = newTestInventoryServer(t) + + for _, current := range []*server{world, cold} { + owner := current.characters[1] + if owner.level != 8 || owner.experience != 150 || owner.stats.ImprovementPoints != 25074 || + owner.stats.Abilities.Stamina != 22 || owner.stats.Body.BodyDevelopment != 40 || owner.stats.Melee.OneHandBlunt != 40 || + owner.health != 150 || owner.maximumHealth() != 261 || !slices.Equal(owner.inventory.Items, items) { + t.Fatal("the ability limit allowed a partial training batch or changed earned state", owner.profile()) + } + } + + trained.Abilities.Stamina = 23 + trained.Body.BodyDevelopment = 45 + if err := world.handleSkillTraining(client, skillTrainingRequest(trained)[20:]); err != nil { + t.Fatal(err) + } + cold = newTestInventoryServer(t) + + for _, current := range []*server{world, cold} { + owner := current.characters[1] + if owner.level != 8 || owner.experience != 150 || owner.stats.ImprovementPoints != 24632 || + owner.stats.Abilities != (characterAbilitiesStats{24, 26, 23, 6, 7, 3}) || + owner.stats.Body.BodyDevelopment != 45 || owner.stats.Melee.OneHandBlunt != 45 || + owner.health != 150 || owner.maximumHealth() != 281 || owner.inventory.Credits != 546 || + !slices.Equal(owner.inventory.Items, items) { + t.Fatal("qualified training lost its cost, health maximum or retained ownership", owner.profile(), owner.inventory) + } + } +} diff --git a/tools/client/game_test.mjs b/tools/client/game_test.mjs @@ -227,6 +227,7 @@ export class GameTest { async walk(x, z) { await this.page.bringToFront(); await this.page.locator('#canvas').focus(); + if (!this.local()) await this.ready(); const field = this.local().playfield; const difference = (a, b) => Math.atan2(Math.sin(a - b), Math.cos(a - b)); let best = Infinity, progressAt = Date.now();