commit 497235a06246b2c4f7003b18a45be47262606d61
parent 310fa819713bac1d2d06f411a8f13fe21bbe4232
Author: anon <anon@example.com>
Date: Sun, 1 Nov 2026 19:52:51 +0000
Support reviewed Cyber armor quality families
Diffstat:
5 files changed, 319 insertions(+), 0 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -327,6 +327,12 @@ unverified mass/deletion/reclaim policies are in [backpacks](docs/backpacks.md).
sleeve slots, QL100/101 wear/training, the distinct vest, exact cancelled/accepted
sale and reconnect. Historical acquisition remains unverified; production stock
and mission selections are unchanged. See [Leather contracts](docs/leather-armor.md).
+ Seven regular Cyber pairs now use that same path after complete original
+ descriptor audits, including both body styles and numerically reversed
+ quality anchors. Public-handler and controlled two-client native checks
+ cover selected-quality wear/removal, strict Intelligence/Psychic gates,
+ native UI training, sale and retained ownership. Acquisition remains open;
+ see [Cyber contracts](docs/cyber-armor.md).
- [x] Admit the complete Low-Tech armor set through shared quality and shop data.
Eight explicit original pairs cover QL1..200, including alternate body and leg
styles and independent sleeves. All three basic armor factions offer the
diff --git a/docs/cyber-armor.md b/docs/cyber-armor.md
@@ -0,0 +1,86 @@
+# Regular Cyber armor quality contracts
+
+Seven reviewed regular Cyber pairs now use the shared QL1..200 interpolation,
+requirements, equipment, value and native-delivery paths. The two body styles
+remain distinct items. This admission adds no species or item-name branch.
+Original stock, mission and creature-drop membership remain unresolved.
+
+## Original records
+
+All fourteen complete original resource 1000020 records were independently
+decoded and matched against the maintained catalog. Raw payloads, hashes,
+offsets and complete descriptors remain in `local/cyber-armor/original/`.
+The original index SHA-256 is
+`46e5dc54af9358cc9bff05f4358e86af630e497bc677f361c133c88073b84d71`.
+
+| Piece | QL1 / QL200 templates | Native wear slot | Base value at QL2 |
+| --- | --- | --- | --- |
+| Sleeves | 85477 / 21917 | 23 or 25 | 307 |
+| Pants | 85531 / 22289 | 27 | 768 |
+| Helmet | 85572 / 22219 | 18 | 921 |
+| Gloves | 85612 / 22166 | 24 | 307 |
+| Boots | 85655 / 22104 | 30 | 460 |
+| Female body armor | 85711 / 22014 | 21 | 1228 |
+| Body armor | 85712 / 22010 | 21 | 1228 |
+
+Within each pair the remaining descriptors agree after accounting for scalar
+stats 1/2/54/74, eight armor amounts, two wear thresholds and section encoding
+offsets. The offsets differ with text length; no function or criterion is
+discarded from the comparison. The QL200 IDs are numerically lower than QL1;
+the explicit pair order follows authored quality.
+
+Wear requires Intelligence (stat 19) and Psychic (stat 21) strictly greater
+than 7 at QL1, and greater than 500/450 at QL200. Shared original rounding
+gives thresholds 252/227 at QL100 and 255/230 at QL101. Both body styles have the same
+AC amounts and thresholds, with their original appearance descriptors retained.
+
+A [dated April 2002 firsthand guide](https://archives.jeuxonline.info/fils/82853.html)
+corroborates Intelligence/Psychic Cyber armor requirements qualitatively.
+The local mirror's Waitt/Bau pages were touched in 2007 and its Living Cyber
+page in 2019; these are separate families. Later acquisition guides do not
+establish a 14.9.1 selection table. The bounded research ledger is
+`local/cyber-armor/README.md`; production stock and reward pools are unchanged.
+
+## Verification
+
+Public-handler tests cover both stored anchors, every piece and both arm slots
+at QL1/2/100/200, plus glove rounding boundaries 5/101/199. They check strict
+equality rejection, exact endpoint delivery, all eight AC amounts, original
+values, removal and cold ownership. Controlled generated pickup verifies that
+the same selected-quality instance survives repeated requests, wear, removal
+and restart. Sale checks cover cancellation, acceptance and duplicate acceptance
+at four qualities while retaining the unrelated item.
+
+A controlled two-client WASM fixture uses actual native controls to remove and
+re-wear all seven equipped pieces, including independent sleeves. QL100 gloves
+stored at the high anchor wear; QL101 rejects at Intelligence255/Psychic230.
+The original skill window spends 485 IP for one point in each ability, after
+which that exact QL101 instance wears. QL200 still rejects and remains owned.
+Both body styles wear while retaining the replaced instance.
+
+The QL100 glove's base value 70888 yields 4295 credits at the original basic
+armor machine: six percent gives 4253, then the fixture's effective Computer
+Literacy 68 adds 42. The native quote agrees. Cancel/retry/accept leaves 4395 cash
+and ten exact instances. Page reconnect and stopped SQLite agree on every
+item, endpoint, quality, count and slot, with 1515 IP and unchanged observer
+ownership. Rendered Stats show 156/156/138 Projectile/Melee/Energy AC; all eight
+server totals are 156/156/138/35/35/103/35/103. No WASM runtime error occurred.
+
+The full lifecycle run `local/game-tests/cyber-20261101-114648/` passes in 37.04s.
+Its independent physical-record/native audit is `local/cyber-armor/verified.json`.
+Two fresh WASM clients loaded from that stopped database also pass in 15.27s at
+`local/game-tests/cyber-cold-20261101-114903/`. The independent cold audit
+retains every item/wallet row and non-pose character field exactly. Native
+positions settle within 0.11 m and rotation dots exceed 0.9999999. All ten owner
+proxies and the empty observer inventory match; neither client reports an error.
+The audit is `local/cyber-armor/cyber-cold-verified.json`.
+
+The normal focused Go run passes 147 test/subtest results across five roots,
+covering the Cyber lifecycles and reviewed/unreviewed family admission. The
+assets package has no test files. The expanded race selection passes 164
+results across ten roots, including existing armor quality/persistence cases;
+the server package takes 120.102s. `go vet ./server/...` passes. Both native
+runs use the maintained `GameTest` harness; their owned clients and temporary
+servers are closed, including after the first fixture-assertion failure.
+These controlled checks establish item behavior, not normally earned Cyber
+acquisition or original selection probabilities.
diff --git a/server/cyber_armor_test.go b/server/cyber_armor_test.go
@@ -0,0 +1,217 @@
+package main
+
+import (
+ "ao/server/gamedata"
+ "bytes"
+ "encoding/binary"
+ "fmt"
+ "slices"
+ "testing"
+)
+
+func TestCyberGeneratedPickupKeepsSelectedQuality(t *testing.T) {
+ world, output := newKillExperienceWorld(t, "unarmed")
+ player, client := world.characters[1], world.clients[1]
+ player.stats.Abilities.Intelligence, player.stats.Abilities.Psychic = 253, 228
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ // Controlled membership tests delivery, not historical Cyber creature drops.
+ profile := *world.characters[1000000].combatProfile
+ profile.Loot = []gamedata.NPCLoot{{Template: 22166, Quality: [2]uint32{100, 100}, Chance: 100}}
+ world.characters[1000000].combatProfile = &profile
+ world.combatRoll = func(uint32) uint32 { return 0 }
+ identity := world.nextItem + 1
+ var wire []byte
+ for _, value := range []uint32{identity, 85612, 22166, 100, 0} {
+ wire = binary.BigEndian.AppendUint32(wire, value)
+ }
+
+ attackForExperience(t, world, "unarmed")
+ if err := world.handleLootUse(client, lootUseRequest(1)); err != nil {
+ t.Fatal(err)
+ }
+ shown := slices.ContainsFunc(output.packets, func(packet []byte) bool { return bytes.Contains(packet, wire) })
+ for range 2 {
+ if err := world.handleInventory(client, lootTakeRequest()); err != nil {
+ t.Fatal(err)
+ }
+ }
+ world = newTestInventoryServer(t)
+ client = &worldClient{id: 1, conn: output, target: true, ready: true}
+ world.clients[1] = client
+ if err := world.handleInventory(client, inventoryMovePacket(1, 64, 24)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("picked-up gloves did not start wear", err)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+ worn := newTestInventoryServer(t)
+ if err := world.handleInventory(client, itemMovePacket(1, 24, 64)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("picked-up gloves did not start removal", err)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+ removed := newTestInventoryServer(t)
+
+ expected := ownedItem{ID: identity, Type: 51022, Template: 22166, Quality: 100, Slot: 24, Count: 1}
+ if !shown || !slices.Equal(worn.characters[1].inventory.Items, []ownedItem{expected}) || worn.characters[1].equipmentBonus(91) != 125 {
+ t.Fatal("generated pickup lost its native endpoints, identity, selected quality or worn AC")
+ }
+ expected.Slot = 64
+ if !slices.Equal(removed.characters[1].inventory.Items, []ownedItem{expected}) || removed.characters[1].equipmentBonus(91) != 0 ||
+ len(removed.characters[1000000].corpse.items) != 0 || removed.nextItem != identity {
+ t.Fatal("duplicate pickup, removal or cold recovery lost or duplicated the gloves")
+ }
+}
+
+func TestCyberArmorQualitiesWearRemoveAndRecover(t *testing.T) {
+ for _, scenario := range []struct {
+ low, high, slot, quality, value uint32
+ intelligence, psychic uint16
+ armor [8]int32
+ }{
+ {85477, 21917, 25, 1, 300, 7, 7, [8]int32{1, 1, 1, 1, 1, 1, 1, 1}},
+ {85477, 21917, 25, 2, 307, 9, 9, [8]int32{2, 2, 2, 1, 1, 2, 1, 2}},
+ {85477, 21917, 23, 2, 307, 9, 9, [8]int32{2, 2, 2, 1, 1, 2, 1, 2}},
+ {85477, 21917, 25, 100, 70888, 252, 227, [8]int32{125, 125, 109, 25, 25, 78, 25, 78}},
+ {85477, 21917, 25, 200, 285516, 500, 450, [8]int32{250, 250, 218, 50, 50, 156, 50, 156}},
+ {85531, 22289, 27, 1, 750, 7, 7, [8]int32{3, 3, 3, 1, 1, 3, 1, 3}},
+ {85531, 22289, 27, 2, 768, 9, 9, [8]int32{6, 6, 6, 2, 2, 5, 2, 5}},
+ {85531, 22289, 27, 100, 177223, 252, 227, [8]int32{312, 312, 273, 63, 63, 196, 63, 196}},
+ {85531, 22289, 27, 200, 713791, 500, 450, [8]int32{625, 625, 546, 125, 125, 390, 125, 390}},
+ {85572, 22219, 18, 1, 900, 7, 7, [8]int32{3, 3, 3, 1, 1, 3, 1, 3}},
+ {85572, 22219, 18, 2, 921, 9, 9, [8]int32{7, 7, 6, 2, 2, 5, 2, 5}},
+ {85572, 22219, 18, 100, 212667, 252, 227, [8]int32{375, 375, 328, 75, 75, 234, 75, 234}},
+ {85572, 22219, 18, 200, 856550, 500, 450, [8]int32{750, 750, 656, 150, 150, 468, 150, 468}},
+ {85612, 22166, 24, 1, 300, 7, 7, [8]int32{1, 1, 1, 1, 1, 1, 1, 1}},
+ {85612, 22166, 24, 2, 307, 9, 9, [8]int32{2, 2, 2, 1, 1, 2, 1, 2}},
+ {85612, 22166, 24, 5, 415, 17, 16, [8]int32{6, 6, 5, 2, 2, 4, 2, 4}},
+ {85612, 22166, 24, 100, 70888, 252, 227, [8]int32{125, 125, 109, 25, 25, 78, 25, 78}},
+ {85612, 22166, 24, 101, 72322, 255, 230, [8]int32{126, 126, 110, 26, 26, 79, 26, 79}},
+ {85612, 22166, 24, 199, 282657, 498, 448, [8]int32{249, 249, 217, 50, 50, 155, 50, 155}},
+ {85612, 22166, 24, 200, 285516, 500, 450, [8]int32{250, 250, 218, 50, 50, 156, 50, 156}},
+ {85655, 22104, 30, 1, 450, 7, 7, [8]int32{1, 1, 1, 1, 1, 1, 1, 1}},
+ {85655, 22104, 30, 2, 460, 9, 9, [8]int32{3, 3, 3, 1, 1, 2, 1, 2}},
+ {85655, 22104, 30, 100, 106334, 252, 227, [8]int32{187, 187, 164, 38, 38, 117, 38, 117}},
+ {85655, 22104, 30, 200, 428275, 500, 450, [8]int32{375, 375, 328, 75, 75, 234, 75, 234}},
+ {85711, 22014, 21, 1, 1200, 7, 7, [8]int32{5, 5, 5, 1, 1, 5, 1, 5}},
+ {85711, 22014, 21, 2, 1228, 9, 9, [8]int32{10, 10, 9, 2, 2, 8, 2, 8}},
+ {85711, 22014, 21, 100, 283557, 252, 227, [8]int32{500, 500, 438, 100, 100, 313, 100, 313}},
+ {85711, 22014, 21, 200, 1142067, 500, 450, [8]int32{1000, 1000, 875, 200, 200, 625, 200, 625}},
+ {85712, 22010, 21, 1, 1200, 7, 7, [8]int32{5, 5, 5, 1, 1, 5, 1, 5}},
+ {85712, 22010, 21, 2, 1228, 9, 9, [8]int32{10, 10, 9, 2, 2, 8, 2, 8}},
+ {85712, 22010, 21, 100, 283557, 252, 227, [8]int32{500, 500, 438, 100, 100, 313, 100, 313}},
+ {85712, 22010, 21, 200, 1142067, 500, 450, [8]int32{1000, 1000, 875, 200, 200, 625, 200, 625}},
+ } {
+ for _, anchor := range []uint32{scenario.low, scenario.high} {
+ t.Run(fmt.Sprintf("%d/QL%d/slot%d", anchor, scenario.quality, scenario.slot), func(t *testing.T) {
+ world, output := newEquipmentWorld(t)
+ t.Cleanup(func() { world.db.Close() })
+ player, client := world.characters[1], world.clients[1]
+ player.stats.Abilities.Intelligence, player.stats.Abilities.Psychic = scenario.intelligence+1, scenario.psychic+1
+ if err := world.saveUser_locked(player); err != nil {
+ t.Fatal(err)
+ }
+ if granted, err := world.grantItem_locked(player, anchor); err != nil || !granted {
+ t.Fatal("grant armor", granted, err)
+ }
+ player.inventory.Items[1].Quality = scenario.quality
+ if err := world.saveInventory_locked(player, player.inventory); err != nil {
+ t.Fatal(err)
+ }
+ weapon := player.inventory.Items[0]
+
+ for _, ability := range []*uint16{&player.stats.Abilities.Intelligence, &player.stats.Abilities.Psychic} {
+ *ability -= 1
+ if err := world.handleInventory(client, inventoryMovePacket(1, 65, scenario.slot)[20:]); err != nil || client.equipment != nil || player.inventory.Items[1].Slot != 65 {
+ t.Fatal("threshold equality equipped or lost the armor", err)
+ }
+ *ability += 1
+ }
+ output.packets = nil
+ if err := world.handleInventory(client, inventoryMovePacket(1, 65, scenario.slot)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("qualified armor did not start wear", err)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+ worn := newTestInventoryServer(t)
+ low, high := scenario.low, scenario.high
+ if scenario.quality == 1 {
+ high = low
+ } else if scenario.quality == 200 {
+ low = high
+ }
+ var action []byte
+ for _, word := range []uint32{low, high, scenario.quality, 1, 6, 102, scenario.slot, 0, 0} {
+ action = binary.BigEndian.AppendUint32(action, word)
+ }
+ if len(output.packets) != 2 || !bytes.Equal(output.packets[1][29:65], action) {
+ t.Fatal("native wear lost the selected quality or endpoint pair")
+ }
+ if err := world.handleInventory(client, itemMovePacket(1, scenario.slot, 111)[20:]); err != nil || client.equipment == nil {
+ t.Fatal("armor did not start removal", err)
+ }
+ world.advanceEquipment(client.equipment.readyAt)
+ removed := newTestInventoryServer(t)
+
+ expected := ownedItem{ID: 2, Type: 51022, Template: anchor, Quality: scenario.quality, Slot: scenario.slot, Count: 1}
+ if !slices.Equal(worn.characters[1].inventory.Items, []ownedItem{weapon, expected}) || worn.characters[1].inventory.Items[1].shopPrice() != scenario.value {
+ t.Fatal("cold armor identity, quality, value or unrelated item changed")
+ }
+ expected.Slot = 65
+ if !slices.Equal(removed.characters[1].inventory.Items, []ownedItem{weapon, expected}) || removed.nextItem != 2 {
+ t.Fatal("removal lost or replaced an instance")
+ }
+ for index, bonus := range scenario.armor {
+ if worn.characters[1].equipmentBonus(90+uint32(index)) != bonus || removed.characters[1].equipmentBonus(90+uint32(index)) != 0 {
+ t.Fatal("selected armor effects or their removal changed", index)
+ }
+ }
+ })
+ }
+ }
+}
+
+func TestCyberSaleCancellationAndReplayKeepSelectedQuality(t *testing.T) {
+ for _, scenario := range []struct{ quality, sale uint32 }{
+ {2, 15}, {100, 3544}, {101, 3616}, {200, 14275},
+ } {
+ t.Run(fmt.Sprint(scenario.quality), func(t *testing.T) {
+ world, _ := newShopWorld(t)
+ player, client := world.characters[1], world.clients[1]
+ if granted, err := world.grantItem_locked(player, 85612); err != nil || !granted {
+ t.Fatal(granted, err)
+ }
+ player.inventory.Items[1].Quality = scenario.quality
+ if err := world.saveInventory_locked(player, player.inventory); err != nil {
+ t.Fatal(err)
+ }
+ before := append([]ownedItem(nil), player.inventory.Items...)
+ offer := shopTradePacket([2]uint32{50000, 1}, 4, [2]uint32{50000, 1}, [2]uint32{104, 65})[20:]
+
+ if err := world.handleTrade(client, offer); err != nil {
+ t.Fatal(err)
+ }
+ if err := world.handleTrade(client, shopTradePacket([2]uint32{50000, 1}, 2, [2]uint32{}, [2]uint32{})[20:]); err != nil {
+ t.Fatal(err)
+ }
+ cancelled := newTestInventoryServer(t).characters[1].inventory
+ if err := world.handleShopUse(client, shopUseRequest(2)); err != nil {
+ t.Fatal(err)
+ }
+ if err := world.handleTrade(client, offer); err != nil {
+ t.Fatal(err)
+ }
+ for range 2 {
+ if err := world.handleTrade(client, shopTradePacket([2]uint32{50000, 1}, 1, [2]uint32{}, [2]uint32{})[20:]); err != nil {
+ t.Fatal(err)
+ }
+ }
+ sold := newTestInventoryServer(t).characters[1].inventory
+
+ if !slices.Equal(cancelled.Items, before) || cancelled.Credits != 100 {
+ t.Fatal("cancelled sale changed the selected instance or wallet", cancelled)
+ }
+ if !slices.Equal(sold.Items, before[:1]) || sold.Credits != 100+scenario.sale {
+ t.Fatal("accepted or repeated sale changed another item or its selected-quality price", sold)
+ }
+ })
+ }
+}
diff --git a/server/gamedata/item_families.yaml b/server/gamedata/item_families.yaml
@@ -34,6 +34,14 @@
- [85645, 85644]
- [85697, 85696]
- [85750, 85749]
+# Regular Cyber armor: complete original descriptor audits; docs/cyber-armor.md.
+- [85477, 21917]
+- [85531, 22289]
+- [85572, 22219]
+- [85612, 22166]
+- [85655, 22104]
+- [85711, 22014]
+- [85712, 22010]
# Regular recovery supplies, QL1..200: docs/medical-quality.md.
- [25812, 25811]
- [85366, 85367]
diff --git a/server/gamedata/item_quality_test.go b/server/gamedata/item_quality_test.go
@@ -17,6 +17,8 @@ func TestReviewedItemFamilyQualityRanges(t *testing.T) {
{70562, 85597, 1, 200}, {70563, 85558, 1, 200}, {70564, 85515, 1, 200}, {70565, 85514, 1, 200},
{85481, 85690, 1, 200}, {85521, 85520, 1, 200}, {85562, 85561, 1, 200}, {85602, 85601, 1, 200},
{85645, 85644, 1, 200}, {85697, 85696, 1, 200}, {85750, 85749, 1, 200},
+ {85477, 21917, 1, 200}, {85531, 22289, 1, 200}, {85572, 22219, 1, 200}, {85612, 22166, 1, 200},
+ {85655, 22104, 1, 200}, {85711, 22014, 1, 200}, {85712, 22010, 1, 200},
{25812, 25811, 1, 200}, {85366, 85367, 1, 200}, {25820, 25821, 1, 200},
} {
for _, template := range [2]uint32{family.lowTemplate, family.highTemplate} {