aorecomp

Anarchy Online classic in the browser

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


commit 6a1d888bbff279c6712c0c931cccca336ea08e01
parent 9550b5d0c7a5a17706ff362223a5e33151d0eade
Author: anon <anon@example.com>
Date:   Fri,  6 Nov 2026 03:09:08 +0000

Verify higher-level profession combat and recovery checkpoints

Diffstat:
MTODO.md | 6++++--
Mdocs/alpha-progression-matrix.md | 47+++++++++++++++++++++++++++++++++++++++++++++--
Aserver/profession_checkpoint_combat_test.go | 251+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 300 insertions(+), 4 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -223,8 +223,10 @@ research separately. More screenshots and test cases do not count as new gamepla the finite routes, retained evidence and remaining checks. All 48 profession/ breed starts pass a full-health fight, recovery and cold ownership check using starting IP and issued equipment; MPs use their issued pet and shield. - A7 remains open for level-5/10 non-Enforcer loadouts, a current Clan/Neutral - repeat/level-training sample, and bounded release/affordability/pace checks. + The level-5/10 non-Enforcer checkpoints now pass with available shop loadouts, + including the level-ten Nanomage MA with a complete QL5 Metaplast set. + A7 remains open for a current Clan/Neutral repeat/level-training sample and + bounded release/affordability/pace checks. - [x] **A8: Isolate administration before public hosting.** The current HTTP and HTTPS listeners share a handler. Administration now requires separate diff --git a/docs/alpha-progression-matrix.md b/docs/alpha-progression-matrix.md @@ -25,10 +25,10 @@ and encounter balance remains explicitly provisional. | Acceptance criterion | Authoritative evidence | Remaining A7 check | | --- | --- | --- | -| Create offered characters and use issued tools | All 255 original heads with profession/faction choices survive restart; the twelve-profession check uploads all nineteen issued crystals with starting IP; the 48 profession/breed starter checks below connect fight, recovery and cold ownership | Starter readiness covered; higher-level non-Enforcer loadouts remain below | +| Create offered characters and use issued tools | All 255 original heads with profession/faction choices survive restart; the twelve-profession check uploads all nineteen issued crystals with starting IP; the 48 profession/breed starter checks below connect fight, recovery and cold ownership | Starter readiness covered; controlled higher-level paths are recorded below | | Fight and loot on every faction's training route | Original creature and human placement checks use native picking and exact corpse ownership through cold recovery | These controlled body checks do not establish normal-play pace | | Earn/train a level | Retained fresh Omni Enforcer loop earns level 2 and spends earned IP; the same ordinary progression continues through level 10 | Inspect retained evidence for the bounded release sample; do not repeat leveling | -| Obtain/use an upgrade and replenish supplies | Ordinary Omni armor/weapon/recovery purchases; ordinary Clan bat and Neutral glove mission rewards; current three-faction purchase/use/reconnect checks | Check controlled level-5/10 non-Enforcer loadouts for a usable encounter/recovery path | +| Obtain/use an upgrade and replenish supplies | Ordinary Omni armor/weapon/recovery purchases; ordinary Clan bat and Neutral glove mission rewards; current three-faction purchase/use/reconnect checks; 23 controlled level-5/10 profession checkpoints below | Available loadouts pass; ordinary affordability and pace remain separate below | | Finish and repeat missions | Ordinary Omni repeated contracts through level 10; ordinary Clan and Neutral entry, book return, reward wear and cold native login | One bounded current Clan/Neutral repeat/level-training integration sample remains | | Recover from death | Ordinary Omni level-10 combat death, cold pending reclaim, exact collection and return to the interrupted mission; controlled native Clan/Neutral scanner/death/reclaim checkpoints | Shared recovery ownership is covered by A6; retain the faction checkpoints in release acceptance | | Reconnect/restart without losing progress | Exact-state and failed-write/retry matrix; two-client native cold login; ordinary earned checkpoints | One bounded release acceptance pass after remaining known gaps are resolved | @@ -99,3 +99,46 @@ under `local/alpha-combat-paths/20261105-185454/` and the log is reconnect checks use client/server state (the final screenshot still shows the loading overlay). `go vet ./server`, JavaScript syntax and local document links also pass. This milestone changes coverage and documentation, not gameplay. + +## November 5 level-five and level-ten checkpoints + +`TestProfessionCheckpointsFightAndRecover` covers the eleven non-Enforcer +professions at levels 5 and 10 as Solitus, plus the fragile level-ten Nanomage +Martial Artist. Retained earned Enforcer progression supplies the other +profession's higher-level evidence. Levels, full starting resources and gear +are explicit fixture grants; training spends at most the normal 1500 starting +IP plus 4000 per gained level. Abilities and the selected weapon, survival and +recovery skills are trained through the normal handler within their native +breed/profession/level caps. These are viable checkpoint loadouts, not earned +progression or a requirement that every player maximize those skills. + +| Professions | Tested checkpoint equipment | +| --- | --- | +| Soldier | QL5/10 E-Beamer and energy ammunition | +| Fixer | QL5/10 Kerans and bullets | +| Agent | QL5/10 Gripo and bullets, reloading during combat | +| Trader | QL5/10 Vektor and energy ammunition | +| Engineer, Adventurer, Bureaucrat, Doctor, Nano-Technician | QL5/10 M-10 and bullets, with Fling qualification and combat reloads where needed | +| Martial Artist | Fists; Solitus wears QL5 Metaplast body/legs, Nanomage wears all seven pieces including two sleeves | +| Meta-Physicist | Issued shield with Inferior Anger Manifestation at level 5 or Supreme Anger Manifestation at level 10 | + +Every other row also wears QL5 Metaplast body/legs. Gear comes from the existing +basic-shop subset and passes normal wear requirements; the MP uploads/casts +the stocked formula. Native use/purchase coverage for these families remains +the three-faction A5 evidence in [profession essentials](alpha-profession-paths.md). +This additional matrix is a server integration check, not 23 browser runs. + +The full-health level-matched Leets have 175/300 HP and award exactly 175/300 XP. +All 23 cases win under the normal combat rules with PCG seed `(1,2)`, use one +issued laboratory charge, finish recovery by sitting and survive a production +cold start with exact items, ammunition, trained stats, XP, resources and +surviving pet count. The Nanomage MA's two-piece probe died with 44 enemy HP +left; the available full armor set wins with 19 HP remaining. No damage, +health, shop stock or other gameplay policy changed. This establishes an +available combat/recovery path without claiming statistical survival balance. + +The final run passes in 30.77 seconds after package initialization; its log is +`local/alpha-profession-checkpoints/complete-kit.log`. `go vet ./server` and +local document-link checks pass. Initial probes corrected missing Fling +qualification, absent combat reload input and use of an inventory-only cold +loader that does not load pets; they did not require server behavior changes. diff --git a/server/profession_checkpoint_combat_test.go b/server/profession_checkpoint_combat_test.go @@ -0,0 +1,251 @@ +package main + +import ( + "ao/server/gamedata" + "encoding/binary" + "fmt" + "math/rand/v2" + "net/http" + "reflect" + "slices" + "testing" + "time" +) + +func TestProfessionCheckpointsFightAndRecover(t *testing.T) { + for _, level := range []uint16{5, 10} { + for profession := uint16(1); profession <= 12; profession++ { + if profession == 9 { + continue // Retained earned Enforcer progression already covers these levels. + } + heads := []uint32{40681} + if level == 10 && profession == 2 { + heads = append(heads, 40172) + } + for _, head := range heads { + t.Run(fmt.Sprintf("level%d/profession%d/head%d", level, profession, head), func(t *testing.T) { + // Create the actual kit, then grant the checkpoint level and its IP budget. + data := testNPCData() + group := &data.Playfields[0].Districts[0].Groups[0] + group.Levels, group.AppearanceStatus = [2]uint16{level, level}, "inferred_species" + group.Positions = [][3]float32{{54.5, 14.75, 58}} + originalResources := resources + useNPCData(t, data) + resources = originalResources + world := newTestServer(t) + fields := creationForm() + fields.Set("profession", fmt.Sprint(profession)) + fields.Set("head_mesh", fmt.Sprint(head)) + if response := creationRequest(world, accountVisitor(t, world), fields); response.Code != http.StatusNoContent { + t.Fatal(response.Code, response.Body.String()) + } + player, target := world.characters[2], world.characters[1000000] + client := &worldClient{id: 2, conn: &combatTestConn{}, ready: true, target: true, npcs: map[uint32]bool{target.id: true}} + world.clients[2] = client + player.level = level + player.stats.ImprovementPoints += 4000 * uint32(level-1) + + // Submit legal ability/skill training through the ordinary IP transaction. + trained := *player + for _, field := range trained.stats.trainingStats() { + if field.stat >= 16 && field.stat <= 21 { + *field.value = uint16(trained.trainingMaximum(field.stat)) + } + } + primary := []uint32{116, 100, 112, 114, 113, 112, 115, 112, 102, 112, 112, 102}[profession-1] + skills := []uint32{primary, 152, 155, 124} + switch profession { + case 1: + skills = append(skills, 133, 150) + case 4: + skills = append(skills, 148) + case 5: + skills = append(skills, 151) + case 3, 6, 8, 10, 11: + skills = append(skills, 150) + case 12: + skills = append(skills, 130, 131) + } + for _, field := range trained.stats.trainingStats() { + if slices.Contains(skills, field.stat) { + *field.value = uint16(trained.trainingMaximum(field.stat)) + } + } + request := skillTrainingRequest(trained.stats) + binary.BigEndian.PutUint32(request[28:32], player.id) + if err := world.handleSkillTraining(client, request[20:]); err != nil { + t.Fatal(err) + } + trained.stats.ImprovementPoints = player.stats.ImprovementPoints + if player.stats != trained.stats || player.stats.ImprovementPoints >= 1500+4000*uint32(level-1) { + t.Fatal("checkpoint training refused", player.stats) + } + + // Grant shop-supported checkpoint gear, then use normal wear/reload admission. + gear := []ownedItem{ + {Type: 51022, Template: 85686, Quality: 5, Slot: 80, Count: 1}, + {Type: 51022, Template: 85512, Quality: 5, Slot: 81, Count: 1}, + } + // The lower-health Nanomage MA wears the complete available armor set. + if head == 40172 { + gear = append(gear, + ownedItem{Type: 51022, Template: 85557, Quality: 5, Slot: 82, Count: 1}, + ownedItem{Type: 51022, Template: 85596, Quality: 5, Slot: 83, Count: 1}, + ownedItem{Type: 51022, Template: 85638, Quality: 5, Slot: 84, Count: 1}, + ownedItem{Type: 51022, Template: 85742, Quality: 5, Slot: 85, Count: 1}, + ownedItem{Type: 51022, Template: 85742, Quality: 5, Slot: 86, Count: 1}) + } + weapon, ammo := uint32(123742), uint32(21605) + switch profession { + case 1: + weapon, ammo = 122121, 21609 + case 4: + weapon = 160476 + case 5: + weapon = 123976 + case 7: + weapon, ammo = 124258, 21609 + } + if profession != 2 && profession != 12 { + if !slices.Contains(gamedata.ShopStock[99478], gamedata.ShopItem{Template: weapon, Quality: uint32(level)}) { + t.Fatal("checkpoint weapon is not available in the basic shop") + } + gear = append(gear, ownedItem{Type: 51018, Template: weapon, Quality: uint32(level), Slot: 82, Count: 1}, + ownedItem{Type: 51005, Template: ammo, Quality: 1, Slot: 83, Count: 100}) + } + program := uint32(43725) + if profession == 12 { + crystal, quality := uint32(43784), uint32(1) + if level == 10 { + crystal, quality, program = 43769, 7, 43745 + } + gear = append(gear, ownedItem{Type: 51005, Template: crystal, Quality: quality, Slot: 84, Count: 1}) + } + inventory := player.inventory + inventory.Items = slices.Clone(inventory.Items) + for _, item := range gear { + if item.Type == 51022 && !slices.Contains(gamedata.ShopStock[99383], gamedata.ShopItem{Template: item.Template, Quality: item.Quality}) { + t.Fatal("checkpoint armor is not available in the basic shop") + } + inventory.LastID++ + item.ID = inventory.LastID + inventory.Items = append(inventory.Items, item) + } + if err := world.saveInventory_locked(player, inventory); err != nil { + t.Fatal(err) + } + moves := [][2]uint32{{80, 21}, {81, 27}} + if head == 40172 { + moves = append(moves, [2]uint32{82, 18}, [2]uint32{83, 24}, [2]uint32{84, 30}, [2]uint32{85, 23}, [2]uint32{86, 25}) + } + if profession == 12 { + moves = append(moves, [2]uint32{67, 6}) + } else if profession != 2 { + moves = append(moves, [2]uint32{82, 6}) + } + for _, move := range moves { + if err := world.handleInventory(client, inventoryMovePacket(player.id, move[0], move[1])[20:]); err != nil || client.equipment == nil { + t.Fatal("checkpoint equipment refused", move, err) + } + world.advanceEquipment(client.equipment.readyAt) + } + reload := func() { + // Reload admission uses wall time even when combat ticks are advanced. + time.Sleep(time.Until(client.reloadUntil)) + request := explicitReloadRequest(client.useSequence+1, 83, 0) + binary.BigEndian.PutUint32(request[8:12], player.id) + binary.BigEndian.PutUint32(request[36:40], player.id) + binary.BigEndian.PutUint32(request[48:52], 101) + binary.BigEndian.PutUint32(request[52:56], 6) + if err := world.handleReload(client, request); err != nil { + t.Fatal(err) + } + } + if profession != 2 && profession != 12 { + reload() + } + + // Full resources are a checkpoint; the MP casts its available tier normally. + player.health, player.nano = player.maximumHealth(), player.maximumNano() + if profession == 12 { + if err := world.handleOwnedItemUse(client, backpackUseRequest(player.id, 84, 1)[20:]); err != nil { + t.Fatal(err) + } + if err := world.handleNanoCast(client, characterActionPacket(player.id, [5]uint32{19, 0, 0, 53019, program})[20:]); err != nil || client.nanoCast == nil { + t.Fatal("checkpoint pet summon refused", err) + } + world.advanceNanos(client.nanoCast.readyAt.Add(time.Nanosecond)) + if len(player.pets) != 1 { + t.Fatal("checkpoint pet was not summoned") + } + } + world.combatRoll = rand.New(rand.NewPCG(1, 2)).Uint32N + if err := world.handleCombat(client, n3Packet(0x76793f0d, 50000, player.id, binary.BigEndian.AppendUint32(nil, 100))[20:]); err != nil { + t.Fatal(err) + } + if target.level != level || target.health != map[uint16]uint32{5: 175, 10: 300}[level] { + t.Fatal("checkpoint encounter is not full health", target.level, target.health) + } + if err := world.handleCombat(client, attackPacket(player.id, target.id)[20:]); err != nil { + t.Fatal(err) + } + if profession == 12 { + client.selectedTarget = [2]uint32{50000, target.id} + request := petFollowRequest(player.id) + binary.BigEndian.PutUint32(request[36:], 7) + if err := world.handlePetCommand(client, request[20:]); err != nil { + t.Fatal(err) + } + } + now := time.Now() + started := now + for tick := 0; tick < 3000 && target.health > 0 && player.health > 0; tick++ { + for _, item := range player.inventory.Items { + if item.Slot == 6 && item.usesAmmo() && item.Ammo == 0 { + reload() + } + } + now = now.Add(100 * time.Millisecond) + world.advanceCombat(now) + world.advanceRegeneration(now) + } + t.Logf("HP %d/%d; enemy %d; fight %s; IP %d", player.health, player.maximumHealth(), target.health, now.Sub(started), player.stats.ImprovementPoints) + if player.health == 0 || target.health != 0 || target.corpse == nil || target.corpse.looter != player.id || player.experience != map[uint16]uint32{5: 175, 10: 300}[level] { + t.Fatal("checkpoint failed its complete encounter") + } + + // Use the issued laboratory and retain exact resources/ownership on cold load. + client.selectedTarget = [2]uint32{50000, player.id} + if err := world.handlePosture(client, characterActionPacket(player.id, [5]uint32{86})[20:]); err != nil { + t.Fatal(err) + } + if player.health < player.maximumHealth() || player.nano < player.maximumNano() { + health, nano := player.health, player.nano + if err := world.handleOwnedItemUse(client, backpackUseRequest(player.id, 64, client.useSequence+1)[20:]); err != nil { + t.Fatal(err) + } + if player.inventory.Items[0].Count != 24 || player.health != min(player.maximumHealth(), health+15) || player.nano != min(player.maximumNano(), nano+15) { + t.Fatal("checkpoint recovery failed") + } + } + for tick := 0; tick < 1000 && (player.health < player.maximumHealth() || player.nano < player.maximumNano()); tick++ { + now = now.Add(2 * time.Second) + world.advanceRegeneration(now) + } + if err := world.flushWorld(); err != nil { + t.Fatal(err) + } + cold := newServerForTest(t).characters[player.id] + inventory = player.inventory + inventory.LastID = world.nextItem + if !reflect.DeepEqual(cold.inventory, inventory) { + t.Fatalf("cold inventory = %+v; want %+v", cold.inventory, inventory) + } + if player.health != player.maximumHealth() || player.nano != player.maximumNano() || cold.health != player.health || cold.nano != player.nano || cold.stats != player.stats || cold.level != level || cold.experience != player.experience || len(cold.pets) != len(player.pets) || !cold.skillLocks[124].Equal(player.skillLocks[124]) { + t.Fatalf("checkpoint cold HP/nano/pets/lock = %d/%d/%d/%s; live = %d/%d/%d/%s", cold.health, cold.nano, len(cold.pets), cold.skillLocks[124], player.health, player.nano, len(player.pets), player.skillLocks[124]) + } + }) + } + } + } +}