aorecomp

Anarchy Online classic in the browser

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


commit 86ce56638218faeb5d91769eb5746fd926c36789
parent 0dec4211bcca2e77da3de5b75455259be08dac18
Author: anon <anon@example.com>
Date:   Mon,  2 Nov 2026 06:58:40 +0000

Support original Clan and ICC insurance and reclaim

Diffstat:
MTODO.md | 37+++++++++++++++++++++++++++++--------
Mdocs/insurance.md | 85++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
Mdocs/reclaim.md | 13++++++++-----
Aserver/faction_insurance_test.go | 129+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver/gamedata/insurance.yaml | 24+++++++++++++++++++++++-
Mserver/gamedata/insurance_test.go | 20+++++++++++++++++++-
Mserver/gamedata/load.go | 1+
Mserver/insurance.go | 17+++++++++++++++--
8 files changed, 304 insertions(+), 22 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -1054,9 +1054,23 @@ Historical outdoor give-up timing and obstacle navigation remain open. and fresh server/WASM recovery. Controlled tests cover its death destination and exact item collection; an ordinary earned level-seven death now returns to that scanner and recovers with bought supplies. Ordinary - level-10 collection remains pending. Original courtyard access and - Clan/ICC coverage remain open. See [street insurance](docs/insurance.md#street-level-omni-pair). + earned level-10 collection remains pending. Selected original Clan/ICC pairs + now pass controlled level-ten native saving, fatal combat, saved return and + exact reclaim collection, including page/cold recovery. Connected earned + level-ten travel/recovery and original courtyard access remain open. See + [street insurance](docs/insurance.md#street-level-omni-pair) and + [Clan/ICC coverage](docs/insurance.md#clan-and-icc-scanners). Unsaved training return must not imply that training contains a reclaim booth. +- [x] Admit selected original Clan/ICC scanners and reclaim through shared rules. + Tir117650 uses its authored Clan-only SaveChar requirement; Newland117651 + accepts all citizens. The original Omni-only hardcode is replaced by the + selected template's requirements. Tests cover all three affiliations, typed + identities, cold death/return and exactly-once collection. Two controlled + level-ten WASM clients walk to the actual scanners/booths, save, die through + combat and recover their same Monster Parts. Both page reconnects and a final + fresh server/two-client cold run retain exact instances and saved points. + This does not establish earned level-ten progression or original fees/arrivals. + See [Clan and ICC scanners](docs/insurance.md#clan-and-icc-scanners). - [x] Include type 51059 reclaim booths in native frame snapshots. Check: the maintained generic picker resolves the real typed booth after cold loading, with read-only C traversal and preserved guest registers. The physical booth @@ -3225,12 +3239,19 @@ 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. +- [x] Identify the reproduced browser-console 404 in the earned continuation. + Fresh native clients from the unchanged earned checkpoint now retain Chrome's + ConsoleMessage.location(): the matching message identifies `/favicon.ico`. + A direct request confirms the ordinary HTTP fallback404, and the client HTML + has no icon declaration. The optional browser-icon request accounts for this + reproduced message. The original URL-less message cannot be retroactively + attributed; the native reproduction supplies the missing current evidence. + See `local/earned-eighth-boundary/favicon-verified.json` and its captured + HTTP response. The earlier trace remains at + `local/earned-eight/native-20261101-161130/earned-eight-backyard-entry/1/trace.json`. +- [ ] [P2] Extract the original executable's icon and use it as our `favicon.ico`. + Check: the browser serves the extracted icon at `/favicon.ico` without a 404 + and displays the original game icon. - [ ] [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/docs/insurance.md b/docs/insurance.md @@ -1,6 +1,6 @@ # Saving a resurrection location -The two admitted original Omni-Med scanners in Omni Entertainment save a player's +The admitted original faction scanners save a player's resurrection location through native right-click Use. The selected scanner's identity persists in SQLite as `resurrection_terminal`, also exposed in the control editor. Death returns @@ -9,10 +9,11 @@ Unsaved characters return to their affiliated training entrance with a usable backyard association, under the provisional policy described in [player resurrection](player-resurrection.md). -This enables two scanners through `server/gamedata/insurance.yaml`. +Four scanners in Omni Entertainment, Tir and Newland are enabled through +`server/gamedata/insurance.yaml`. Saving has no fee; the higher-level price formula has not been recovered. The exact historical arrival transform is also -unknown. The current return is explicitly provisional: playfield 705, +unknown. The first Omni scanner's return is explicitly provisional: playfield 705, XYZ `[918, 20.7, 578]`, facing east, three metres beside the scanner with human ground clearance. It is not presented as the shipped resurrection destination. The street-level scanner `51005:0xc00802c1` uses the same rule at @@ -26,7 +27,7 @@ The 14.9.1 resource database supplies these facts: Structure Scanner. Its OnUse function 53032 (`SaveChar`) requires stat 33 equal to 2, Omni affiliation. A separate failure function displays the restriction for other factions. The corresponding Clan and ICC templates - are 117650 and 117651; they are not enabled by this milestone. + are 117650 and 117651; their selected Tir/Newland placements are described below. - Resource 1000026, instance 705, statel index 252 at payload offset 41125, has a 104-byte entry for `51005:0xc00202c1`, template 117665. Its XYZ is `[915, 20.1999912262, 578]`; source quaternion WZYX is @@ -98,6 +99,80 @@ remain in `local/earned-death/`. The subsequent verifies fatal combat and recovery at the street scanner. Ordinary level-ten reclaim collection remains a progression check. +## Clan and ICC scanners + +The selected original Tir scanner is `51005:0xc0020280`, template 117650, at +`[490.9920044, 8.0001211, 399.6037598]`. Its nearby reclaim is +`51059:0xc0020280` at `[485.5439453, 8.0000734, 399.3544922]`. Their shared +numeric identity does not make their typed identities interchangeable. + +Newland's selected ICC scanner is `51005:0xc0020236`, template 117651, at +`[235.8953857, 32.4100380, 313.8017883]`. The admitted reclaim is +`51059:0xc0010236` at `[314.1781006, 32.4001007, 301.3121948]`. +These are placements in the affiliated starting cities, rather than a scanner +invented inside training. + +The original Federated template's SaveChar 53032 requires Side 33 equal to 1. +The ICC template's SaveChar has no requirements and its description explicitly +permits all citizens. Omni-Med retains its authored Side 2 requirement. Each +configured scanner now selects its original template; the shared postfix +requirement evaluator applies that SaveChar contract. Reclaim remains private +and uses its own typed placement and proximity check. + +Complete original item records 117650, 117651, 117665 and 37180 match the +maintained catalog. The independently reread statels, raw bytes, original +resource/index hashes and local wiki search are retained under +`local/faction-insurance/`. The wiki's insurance-technology article is lore; +it does not establish this version's placement, faction predicate or fee. +The period [February 2002 play report](https://game.watch.impress.co.jp/docs/20020213/yuki14_2.htm) +describes insurance saving outside training, but its level-five XP protection +predates the selected templates' below-level-20 rule. It supplies no arrival +transform or price formula for 14.9.1. + +Tir's provisional return is three metres north of its scanner, at +`[490.9920044, 8.5001211, 402.6037598]`, facing north. Newland's is three +metres east, at `[238.8953857, 32.9100380, 313.8017883]`, facing east. +Both retain the existing half-metre vertical clearance and free-save policy. +These transforms and fees remain reconstruction choices. + +`server/faction_insurance_test.go` reproduces the missing scanner support before +the change. It verifies Clan acceptance and Neutral/Omni rejection at the +Federated scanner, all three affiliations at ICC, cold death and saved-return +precedence, retained equipped/NoDrop items, and exactly-once collection of the +same ordinary instance from each faction's reclaim. These are controlled +level-ten fixtures, rather than earned progression evidence. + +Two fresh WASM clients also save at the actual typed scanners through normal +native right-click, displaying the insured message and retaining native stat +236 at cumulative XP 38650. Each controlled level-ten character then starts +combat, stops its own attack and dies to the test NPC's retaliation. Native +action 152 returns each to its saved city scanner with 1 HP/1 nano, while its +original Monster Part moves to private reclaim. The Clan death and pending +item additionally survive a cold server/WASM restart before collection. + +Ordinary native walking reaches both admitted reclaim booths. Newland's direct +line crosses a building; walking around it through `[299,320]`, `[320,320]` +and `[318,303]` reaches the actual booth. Native picking, right-click Use and +left-click collection recover each exact instance once. The rendered private +window and subsequent inventory agree with authoritative ownership. Both page +reconnects retain those items, saved scanners, skills, XP/IP and wallets. +Quiet health regeneration is allowed to advance. No combat-balance or earned +level-ten progression claim follows from these fixtures. + +The complete Go suite passes 1,744 roots and 17,097 test results. The focused +insurance/reclaim/resurrection selection passes 42 roots and 136 results under +the race detector; vet and the production build also pass. Final fresh-server +and two-client WASM recovery, followed by both page reloads, retains both exact +physical item/location rows and saved scanners. The native runs record no +native/protocol exceptions. Their console-404 follow-up is identified separately +as the optional `/favicon.ico` request in the earned-checkpoint reproduction. + +The evidence and independent packet/state verifier are under +`local/faction-insurance/`. An initial canal placement and a temporary driver's +empty-inventory logging error are retained with their limits; the driver error +occurs after the successful Clan return, and its saved database is used for +the continuation. All test-owned browsers and servers are closed between runs. + ## Native contract and server handling The target is original `anarchy-vanilla-14.9.1/kkr.dll`, SHA-256 @@ -114,7 +189,7 @@ The export is `local/reports/insurance-1491-evidence.json`; REA was closed before browser tests. The server validates the current session, loaded/alive state, both player -identities, Use command, target identity, playfield, affiliation and five-metre +identities, Use command, target identity, playfield, authored SaveChar requirements and five-metre three-dimensional range. It uses the same GenericCmd sequence watermark as corpse use, so repeated or older commands cannot repeat an acknowledgement. The profile is saved atomically before live state changes or success packets. diff --git a/docs/reclaim.md b/docs/reclaim.md @@ -2,16 +2,19 @@ Level 10 and higher players now send ordinary inventory items to private reclaim storage when defeated in PvE. Equipment and NoDrop items stay with the -player. Two selected original reclaim booths in Omni Entertainment support native use, +player. Four selected original reclaim booths in Omni Entertainment, Tir and +Newland support native use, contents, close/reopen and collection into the next free inventory slot. Ownership and availability survive reconnect and server restart. Unsaved resurrection uses the affiliated training entrance. This does not add -reclaim to training: both admitted booths are in Omni Entertainment. -Reachable Clan/ICC insurance and reclaim coverage is still required for normal -progression into levels where inventory enters reclaim. +reclaim to training: the admitted booths are in the cities. +Original Clan/ICC scanner and reclaim placements now share the same rules; +the connected earned level-ten progression check remains open. The original street-level pair and its typed placement checks are described in [street insurance](insurance.md#street-level-omni-pair). +The Tir/Newland placements and authored scanner affiliation rules are recorded +under [Clan and ICC scanners](insurance.md#clan-and-icc-scanners). The collection delay is provisionally 75 seconds from the killing blow. This uses the native DeadTimer fallback, not a recovered historical server timer. @@ -42,7 +45,7 @@ Original addresses use base `0x10000000`; generated C uses `0x36000000`. covered items awaiting corpse collection remains unresolved. - Shipped `cd_image/text/help/Death and insurance.txt` describes a short delay and retrieval at any reclaim terminal. It does not require the terminal - beside the saved scanner. This implementation enables one known booth; + beside the saved scanner. This implementation enables four known booths; affiliation and the player's saved scanner do not restrict reclaim use. - Resource 1000026, instance 705, statel index 262 at payload offset 42025, contains the 84-byte booth `51059:0xc00902c1`, XYZ diff --git a/server/faction_insurance_test.go b/server/faction_insurance_test.go @@ -0,0 +1,129 @@ +package main + +import ( + "encoding/binary" + "slices" + "testing" + "time" +) + +func TestFactionInsuranceUsesAuthoredScannerRestrictions(t *testing.T) { + for _, scenario := range []struct { + name string + scanner uint32 + playfield uint32 + position [3]float32 + appearance uint16 + accepted bool + }{ + {"Clan at Federated", 0xc0020280, 640, [3]float32{490.992, 8.5, 402.60376}, 0x315, true}, + {"Neutral at Federated", 0xc0020280, 640, [3]float32{490.992, 8.5, 402.60376}, 0x115, false}, + {"Omni at Federated", 0xc0020280, 640, [3]float32{490.992, 8.5, 402.60376}, 0x515, false}, + {"Neutral at ICC", 0xc0020236, 566, [3]float32{238.89539, 32.91, 313.8018}, 0x115, true}, + {"Clan at ICC", 0xc0020236, 566, [3]float32{238.89539, 32.91, 313.8018}, 0x315, true}, + {"Omni at ICC", 0xc0020236, 566, [3]float32{238.89539, 32.91, 313.8018}, 0x515, true}, + } { + t.Run(scenario.name, func(t *testing.T) { + world, output := newReclaimWorld(t) + player := world.characters[1] + player.playfield, player.position, player.appearance = scenario.playfield, scenario.position, scenario.appearance + request := insuranceUseRequest(1)[20:] + binary.BigEndian.PutUint32(request[44:48], scenario.scanner) + + if err := world.handleTerminalUse(world.clients[1], request); err != nil { + t.Fatal(err) + } + restored := newTestInventoryServer(t).characters[1] + + if scenario.accepted { + if player.resurrectionTerminal != scenario.scanner || restored.resurrectionTerminal != scenario.scanner || + len(output.packets) != 2 || binary.BigEndian.Uint32(output.packets[0][29:33]) != 1 || + binary.BigEndian.Uint32(output.packets[1][29:33]) != 79 { + t.Fatal("authored scanner use did not persist and acknowledge its saved point") + } + } else if player.resurrectionTerminal != 0 || restored.resurrectionTerminal != 0 || + len(output.packets) != 1 || binary.BigEndian.Uint32(output.packets[0][29:33]) != 2 { + t.Fatal("foreign scanner use changed its saved point or received success") + } + }) + } +} + +func TestFactionInsuranceColdDeathReturnAndExactReclaim(t *testing.T) { + for _, scenario := range []struct { + name string + scanner uint32 + reclaim uint32 + playfield uint32 + arrival [3]float32 + rotation [4]float32 + collection [3]float32 + appearance uint16 + }{ + {"Clan", 0xc0020280, 0xc0020280, 640, [3]float32{490.992, 8.500121, 402.60376}, [4]float32{0, 0, 0, 1}, [3]float32{485.54395, 8.5, 399.3545}, 0x315}, + {"Neutral", 0xc0020236, 0xc0010236, 566, [3]float32{238.89539, 32.910038, 313.8018}, [4]float32{0, .70710677, 0, .70710677}, [3]float32{314.1781, 32.9, 301.3122}, 0x115}, + } { + t.Run(scenario.name, func(t *testing.T) { + world, _ := newReclaimWorld(t) + loadResurrectionLocations(t, world) + player, client := world.characters[1], world.clients[1] + player.playfield, player.position, player.appearance = scenario.playfield, scenario.arrival, scenario.appearance + before := slices.Clone(player.inventory.Items) + request := insuranceUseRequest(1)[20:] + binary.BigEndian.PutUint32(request[44:48], scenario.scanner) + + if err := world.handleTerminalUse(client, request); err != nil { + t.Fatal(err) + } + defeatReclaimPlayer(t, world) + dead := newTestInventoryServer(t).characters[1] + if err := world.handleResurrection(client, resurrectionRequest(1)[20:]); err != nil { + t.Fatal(err) + } + returned := newTestInventoryServer(t).characters[1] + + // Reconnect at the actual reclaim booth after its waiting period. + world.clients[1], client.ready = client, true + client.loading = false + player.position = scenario.collection + inventory := player.inventory + inventory.Reclaim = slices.Clone(inventory.Reclaim) + if len(inventory.Reclaim) != 1 { + t.Fatal("death did not retain exactly one reclaim item") + } + inventory.Reclaim[0].AvailableAt = time.Now().Add(-time.Second).UTC() + if err := world.saveInventory_locked(player, inventory); err != nil { + t.Fatal(err) + } + binary.BigEndian.PutUint32(request[20:24], 2) + binary.BigEndian.PutUint32(request[40:44], 51059) + binary.BigEndian.PutUint32(request[44:48], scenario.reclaim) + if err := world.handleTerminalUse(client, request); err != nil { + t.Fatal(err) + } + if err := world.handleReclaim(client, reclaimRequest(109)); err != nil { + t.Fatal(err) + } + if err := world.handleInventory(client, reclaimTakeRequest(0)); err != nil { + t.Fatal(err) + } + if err := world.handleInventory(client, reclaimTakeRequest(0)); err != nil { + t.Fatal(err) + } + restored := newTestInventoryServer(t).characters[1] + + if dead.health != 0 || dead.resurrectionTerminal != scenario.scanner || len(dead.inventory.Reclaim) != 1 || + dead.inventory.Reclaim[0].Item != before[2] || !slices.Equal(dead.inventory.Items, before[:2]) { + t.Fatal("cold death lost its saved point or item ownership") + } + if returned.playfield != scenario.playfield || returned.position != scenario.arrival || returned.rotation != scenario.rotation || + returned.health != 1 || returned.nano != 1 || returned.resurrectionTerminal != scenario.scanner { + t.Fatal("saved scanner did not override affiliated training return", returned.userData()) + } + if !slices.Equal(player.inventory.Items, before) || !slices.Equal(restored.inventory.Items, before) || + len(player.inventory.Reclaim) != 0 || len(restored.inventory.Reclaim) != 0 { + t.Fatal("reclaim lost or duplicated an original instance") + } + }) + } +} diff --git a/server/gamedata/insurance.yaml b/server/gamedata/insurance.yaml @@ -1,18 +1,34 @@ -# Selected original 14.9.1 Omni-Med 117665 and Insurance Reclaim 37180 statels. +# Selected original 14.9.1 faction scanners and Insurance Reclaim 37180 statels. # Arrival transforms are provisional positions three metres in front of each scanner. scanners: 3221357249: + template: 117665 playfield: 705 position: [915, 20.19999122619629, 578] arrival: position: [918, 20.7, 578] rotation: [0, 0.70710677, 0, 0.70710677] 3221750465: + template: 117665 playfield: 705 position: [601, 16.400100708007812, 329] arrival: position: [598, 16.9, 329] rotation: [0, -0.70710677, 0, 0.70710677] + 3221357184: + template: 117650 + playfield: 640 + position: [490.99200439453125, 8.000121116638184, 399.603759765625] + arrival: + position: [490.99200439453125, 8.500121116638184, 402.603759765625] + rotation: [0, 0, 0, 1] + 3221357110: + template: 117651 + playfield: 566 + position: [235.8953857421875, 32.410037994384766, 313.8017883300781] + arrival: + position: [238.8953857421875, 32.910037994384766, 313.8017883300781] + rotation: [0, 0.70710677, 0, 0.70710677] reclaim: 3221816001: playfield: 705 @@ -20,3 +36,9 @@ reclaim: 3221881537: playfield: 705 position: [601, 16.400100708007812, 331] + 3221357184: + playfield: 640 + position: [485.5439453125, 8.000073432922363, 399.3544921875] + 3221291574: + playfield: 566 + position: [314.1781005859375, 32.40010070800781, 301.31219482421875] diff --git a/server/gamedata/insurance_test.go b/server/gamedata/insurance_test.go @@ -6,10 +6,28 @@ func TestInsuranceTerminalsMatchSelectedOriginalPlacements(t *testing.T) { scanner := InsuranceTerminals.Scanners[0xc00802c1] reclaim := InsuranceTerminals.Reclaim[0xc00a02c1] - if len(InsuranceTerminals.Scanners) != 2 || len(InsuranceTerminals.Reclaim) != 2 || scanner.Playfield != 705 || + if len(InsuranceTerminals.Scanners) != 4 || len(InsuranceTerminals.Reclaim) != 4 || scanner.Template != 117665 || scanner.Playfield != 705 || scanner.Position != [3]float32{601, 16.4001, 329} || scanner.Arrival.Position != [3]float32{598, 16.9, 329} || scanner.Arrival.Rotation != [4]float32{0, -.70710677, 0, .70710677} || reclaim.Playfield != 705 || reclaim.Position != [3]float32{601, 16.4001, 331} { t.Fatal("selected original insurance placements or provisional arrival changed") } } + +func TestFactionInsuranceMatchesOriginalTemplatesAndTypedPlacements(t *testing.T) { + clan := InsuranceTerminals.Scanners[0xc0020280] + icc := InsuranceTerminals.Scanners[0xc0020236] + clanReclaim := InsuranceTerminals.Reclaim[0xc0020280] + iccReclaim := InsuranceTerminals.Reclaim[0xc0010236] + + if clan.Template != 117650 || clan.Playfield != 640 || clan.Position != [3]float32{490.992, 8.000121, 399.60376} || + clan.Arrival.Position != [3]float32{490.992, 8.500121, 402.60376} || clan.Arrival.Rotation != [4]float32{0, 0, 0, 1} || + clanReclaim.Playfield != 640 || clanReclaim.Position != [3]float32{485.54395, 8.000073, 399.3545} { + t.Fatal("Tir scanner and reclaim no longer match their original typed placements") + } + if icc.Template != 117651 || icc.Playfield != 566 || icc.Position != [3]float32{235.89539, 32.410038, 313.8018} || + icc.Arrival.Position != [3]float32{238.89539, 32.910038, 313.8018} || icc.Arrival.Rotation != [4]float32{0, .70710677, 0, .70710677} || + iccReclaim.Playfield != 566 || iccReclaim.Position != [3]float32{314.1781, 32.4001, 301.3122} { + t.Fatal("Newland scanner and reclaim no longer match their original typed placements") + } +} diff --git a/server/gamedata/load.go b/server/gamedata/load.go @@ -47,6 +47,7 @@ var ( } InsuranceTerminals struct { Scanners map[uint32]struct { + Template uint32 `yaml:"template"` Playfield uint32 `yaml:"playfield"` Position [3]float32 `yaml:"position"` Arrival struct { diff --git a/server/insurance.go b/server/insurance.go @@ -36,13 +36,26 @@ func (server *server) handleTerminalUse(client *worldClient, body []byte) error return server.useWorldItem_locked(client, body, placement) } - // Selected original scanners share Omni-Med template 117665's side criterion. + // Apply the selected scanner's authored SaveChar requirements. scanner, knownScanner := gamedata.InsuranceTerminals.Scanners[binary.BigEndian.Uint32(body[44:48])] position := predictedPosition_locked(player, time.Now()) x, y, z := position[0]-scanner.Position[0], position[1]-scanner.Position[1], position[2]-scanner.Position[2] - accepted := client.target && knownScanner && player.playfield == scanner.Playfield && player.appearance>>9&3 == 2 && + accepted := client.target && knownScanner && player.playfield == scanner.Playfield && binary.BigEndian.Uint32(body[40:44]) == 51005 && x*x+y*y+z*z <= 5*5 + if accepted { + accepted = false + for _, section := range gamedata.ItemTemplates[scanner.Template].Sections { + if section.Type != 2 || section.Subtype != 0 || section.Functions == nil { + continue + } + for _, function := range *section.Functions { + if function.ID == 53032 { + accepted = requirementsMet(function.Requirements, player.meetsStatRequirement) + } + } + } + } reclaim := binary.BigEndian.Uint32(body[40:44]) == 51059 grid := binary.BigEndian.Uint32(body[40:44]) == 51005 && binary.BigEndian.Uint32(body[44:48]) == 0xc0040320 var destination userData