aorecomp

Anarchy Online classic in the browser

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


commit 2ef20f828395aa349215d8c131bceb9982672448
parent 42f67a43d24221a617c64d71edaae2672091949c
Author: anon <anon@example.com>
Date:   Mon, 26 Oct 2026 03:31:38 +0000

Handle camping cancellation and inventory server action gaps

StopCamping121 now clears the pending logout flag and read deadline independently
of posture or nano cancellation. Native-framing world connection regressions
reproduce the ignored request and verify repeated cancellation, cancellation
without a countdown and subsequent traffic.

Bind the coverage baseline to 277 N3Msg exports, 110 named IIR classes and the
complete decoded 87,611-item/nano catalog. Distinguish request/action/event
namespaces, complete family validators and broad equipment predicates. Add
specific Follow, sneak, skill-reset, seat and remaining action/event work.

Validate 122 focused and 122 race results, vet and an GPU WASM native logout
smoke. Escape108 remains connected beyond the old deadline; normal logout still
closes after 30.004 seconds. Keep 121's ordinary UI binding and the empty gray
Logout bar explicitly unresolved. Remove the owned character and keep one
shared HTTPS8443 preview available.

Diffstat:
MTODO.md | 51+++++++++++++++++++++++++++++++++++++++++++++++++++
Adocs/server-action-coverage.md | 152+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aserver/logout_cancellation_test.go | 101+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver/main.go | 6++++++
4 files changed, 310 insertions(+), 0 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -1493,6 +1493,57 @@ and unresolved indoor lifecycle are explicit in [flight](docs/vehicles.md#yalmah catalog action/effect types and player-facing systems have an evidence-based coverage record; each missing handler, silent no-op or provisional rule has a concrete implementation/research TODO and positive/negative test criteria. + The first request pass binds277 N3Msg exports/268 entry points and110 named + IIR classes, including22 previously omitted IIR_c classes. Current routing + covers17 message keys and21 CharacterAction codes. Complete transitive and + virtual senders, other class naming schemes, chat commands and separate + world/statel/quest resources remain open; derived keys are not captured + traffic. See [action coverage](docs/server-action-coverage.md). +- [x] Inventory the complete decoded item/nano action/effect surface. Check: + all87,611 typed identities and action/event/function counts match the retained + original decode; classify all7 requirement gates,15 function events and72 + effect IDs against actual consumers and specific remaining work. Preserve + the three trailing-byte partial records and distinguish complete-contract + validators from broad equipment/weapon predicates. See + [catalog coverage](docs/server-action-coverage.md#catalog-requirements-and-events). +- [x] Honor native StopCamping121 independently of standing87 or abort108. + Check: cancellation clears the connection's logout deadline, repeats and + cancellation without a countdown remain safe, and subsequent world traffic + works. Keep successful logout and ordinary Escape cancellation working. + The separate UI binding that emits121 remains unverified; see + [camping cancellation](docs/server-action-coverage.md#camping-cancellation). +- [ ] Reconcile native camping UI after cancellation. Escape108 leaves the + connection alive beyond the old deadline and standing87 still works, but + the smoke retains an empty gray Logout progress bar. Recover the original + controller/response contract and the UI binding for StopCamping121. Check + start/cancel/restart, movement/standing/nano interactions, normal logout and + reconnect without hiding the issue with a scene reset. +- [ ] Implement player Follow from the original action29 request. Recover + target eligibility and FollowTarget delivery before sharing movement logic. + Check self/invalid/dead/different-zone targets, moving leader, keyboard + cancellation, zoning/disconnect and owner/observer/server positions. +- [ ] Implement concealment and sneak through the original actions54/163. + Recover contests, movement restrictions, target eligibility, cancellation + and visibility publication. Check threshold boundaries, combat, two observers + and reconnect without leaving hidden actors permanently visible or absent. +- [ ] Implement original skill reset action154. Recover eligibility, reset + counters, equipment restrictions and IP refund/rounding. Check repeated and + forbidden requests, atomic failure/retry and cold recovery of skills/IP. +- [ ] Support sitting on an item through action85. Recover exact seat identity, + occupancy, placement and standing/removal/disconnect behavior. Check stale, + foreign and occupied seats, two players and native observer posture. +- [ ] Recover independent Use57, UseSkill70, EventFeedback165 and Checklist175 + request contracts. Trace actual callers, arguments, recipients, responses and + authority rather than replying from names alone. Check valid and rejected + requests, duplicate/stale references, resource locks and unchanged ownership. +- [ ] Recover catalog requirement gates0/111/136 and automatic event dispatch + beyond checked OnUse/OnActivate/OnWear families. Establish producers and + meaning for events3/4/6/7/15/16/18/20/24/25/26, plus complete OnHit5 procs. + Cover target/chance/threshold boundaries, inverse effects, lifecycle and + atomic outcomes. Separate statel routes or item deletion do not execute a + catalog event automatically. The72-ID consumer matrix and11 research groups + are in `local/server-action-catalog-audit/`; existing pet, healing, travel, + tower/organization and complete equipment tasks cover their specific families. - [ ] Generalize inventory and equipment across the target catalog. Check: supported behavior follows item flags, slots, requirements, quantities and effects for every applicable item family and quality, including conditional diff --git a/docs/server-action-coverage.md b/docs/server-action-coverage.md @@ -0,0 +1,152 @@ +# Server action coverage + +Target: original 14.9.1. This inventory separates three namespaces: network +messages/CharacterAction codes, catalog requirement action IDs, and catalog +function events/effect IDs. Equal numbers in different namespaces do not imply +the same operation. A function name or a Go reference does not establish a +complete gameplay implementation. + +## Native requests + +The retained original kkr.dll export inventory contains 277 `N3Msg_` exports +at 268 distinct entry points. All have complete maintained C bodies. Shared +entry points include original no-op stubs; the prefix does not mean that a +method sends traffic. Assist, for example, selects another actor's fighting +target locally. Read-only getters, camera controls and client prediction must +be separated from authoritative requests. + +The maintained data initializers contain 110 exact IIR class-name strings: +88 ending in `_t` and 22 in `_c`. The latter include pets, FollowTarget, +organization messages and NPC conversations. The earlier 88-class inventory +covered only `_t`; it was not the complete packet-class surface. Name-derived +XOR keys remain candidates until checked against registration/serialization or +actual traffic. The census does not prove there are no differently named or +unnamed protocol classes. + +The world dispatcher currently routes 17 message keys, including 15 of those +class-derived keys, and 21 CharacterAction codes. Its unknown-message and +unknown-action branches return no response. The complete 110-row class/reference +matrix, 277 producer bodies/call candidates, source hashes and route inventory +are retained in `local/server-action-request-audit/`. A literal-reference-only +row can be an outgoing packet builder or conversion, not an incoming handler. +Absence of a literal is not proof that a dynamically selected class is unused. + +Direct CharacterAction-constructor calls expose these remaining request gaps. +The source locations below use the original kkr base 0x10000000; maintained C +uses base 0x36000000. Constructor calls are followed to the send path for the +camping request; the other rows still require their complete branch, recipient +and response contracts before implementation. + +| Request | Action | Original producer | Remaining work | +| --- | ---: | --- | --- | +| Follow | 29 | 10022240 | Validate target/lifecycle and recover authoritative movement plus native FollowTarget delivery. The request and resulting route use different message families. | +| Hide against opponent | 54 | 10022eb0 | Recover concealment/perception contest, eligibility and visibility publication. | +| Use skill | 70 | 1002c000 | Identify each actual skill request and its complete effects, feedback and locks. | +| Sit on an item | 85 | 1002ba60 | Recover seat identity, occupancy, position and stand/removal/disconnect behavior. | +| Independent item Use branch | 57 | 1002acd0 | Identify its exact item/state branch before treating it as ordinary GenericCmd Use. | +| Reset skill | 154 | 10028730 | Recover original IP-reset eligibility, refund/rounding, equipment restrictions and durable counters. | +| Enter sneak | 163 | 1002ce50 | Recover stealth state, movement, contests, observer visibility and cancellation. | +| Event feedback | 165 | 10028570 | Trace actual callers and authority; do not invent a server acknowledgement from the name. | +| Request checklist | 175 | 1002cee0 | Establish its selected item, payload, response and user-visible purpose. | + +Quest/mission selection and creation, PetCommand, organization messages, +grid selection, tower/controller messages and dropped-world-item paths also +need producer-to-handler audits. Several are only discovered class/getter +candidates at this stage. Separate world/statel resources, chat/organization +commands and transitive/virtual senders remain outside this bounded request +pass. The overall complete-action-set TODO remains open. + +## Camping cancellation + +Original `N3Msg_StartCamping` at 100278c0 sends CharacterAction 120 with null +identity arguments. `N3Msg_StopCamping` at 10027a00 separately sends 121; its send path does +not call the posture or nano-cancellation sender. The native action dispatcher +10057680 has distinct calls to those two methods. The retained CharacterAction +receiver also has separate120/121 branches. Their UI behavior is not a reason +to leave a server disconnect deadline active after a cancellation request. + +The server now clears its logout flag and connection read deadline on 121, +independently of standing (87) or abort (108). Repeated cancellation and cancellation +without a countdown are harmless. The existing 30-second successful logout +policy is unchanged; this fix does not establish the historical server's exact +logout eligibility/countdown or every native UI binding. + +Connection-level native-framing regressions first reproduce ignored 121, then +verify deadline removal, repeated requests and a subsequent ping. They exercise +the real world dispatcher. The initial fixture attempts used the wrong native +initialization drain and are excluded from the baseline conclusion. + +Native Escape sends 108, not 121, and already cancels the countdown. The hardware +WASM smoke distinguishes that working route from the newly handled protocol +request. It also captures an uncancelled 120 closing the world connection after +30.004 seconds. The separate ordinary UI binding that emits 121 has not been +established; no synthetic native call or packet is substituted for that gap. +Screenshots, traffic and timing are retained in `local/logout-cancel-smoke/`. +An empty gray Logout progress bar remains after Escape and standing, despite +the working connection. Its native controller/response contract is a separate +open TODO; this change does not claim to repair that UI state. + +## Catalog requirements and events + +The independently checked decoded catalog has 87,611 typed identities: +83,245 items and 4,366 nano programs. All current Go-loaded identities and all +action/event/function occurrence counts match the retained original decode. +Records120802/120827/203911 retain an undecoded trailing byte; their counts cover +only decoded prefixes. This audit does not reparse every original RDB payload +or cover separate world/statel/quest resource types. + +| Requirement action | Occurrences | Current selection | +| ---: | ---: | --- | +| 0 | 25 | No generic selector; complete mission/shop contracts remain open. | +| 3 | 10944 | Use requirements for checked item/nano families. | +| 6 | 48189 | Wear requirements for checked equipment families. | +| 7 | 2 | Equipment removal requirements. | +| 8 | 6274 | Wield/equipment requirements and weapon OE. | +| 111 | 7 | No generic selector; samples include doors, numeric meaning unproven. | +| 136 | 136 | No generic selector; samples include reflection bracers, meaning unproven. | + +There are 78,778 function sections across 15 event IDs and 223,338 function +occurrences across 72 effect IDs. Each effect has occurrence, record, event, +target and conditional/repeated counts, complete sample payloads, current +consumer references and one or more concrete research groups in +`local/server-action-catalog-audit/catalog.json`. Its compact complete matrix is +`function-coverage.tsv`. The 11 groups cover healing/resources, numeric effects, +secondary casts/procs, other controls/dispels, pets/shells, travel/world events, +towers/organizations/side changes, presentation/descriptors, manual item use, +requirement gates and automatic companion events. + +OnUse (0), OnActivate (10) and OnWear (14) have bounded family consumers. There is no +generic authoritative dispatcher for events 3/4/5/6/7/15/16/18/20/24/25/26. +Existing world routes or ordinary deletion do not establish execution of those +catalog events. In particular, OnHit (5) and conditional OnWear effects require +their own producer, target, chance, lifecycle and inverse-operation contracts. + +## Complete families and broad predicates + +Current bounded nano validators admit 664 distinct player-castable programs: +470 timed buffs, 61 instant-damage/taunt/child-parent programs, 60 DoTs and 73 +controls. One passive initiative child is a separate recipient effect. The +generic crystal validator admits 659 records; the two explicit startup uploaders +for a heal and a pet only learn their programs, without executing them. +Eligibility, resistance, periodic scheduling and offline/death policies retain +the limits documented for each family. + +The implant, map and resource-kit validators admit 38,808, 55 and 10 records +respectively. These are bounded contract checks, not claims that every supported +record has been individually tested in the native UI. + +The 3,049 stat-equipment and 7,379 weapon admissions are broader predicates. +Among them, 170 stat-equipment records have non-OnWear events; 7,059 weapons have +other events, mostly native activation descriptors. Those counts alone do not +make the other events unsupported gameplay, and a blanket rejection would also +discard existing starter weapons. Conversely, 83 admitted weapons have +conditional OnWear gameplay modifiers and 70 have conditional OnHit effects; +the current equipment sum does not evaluate those function conditions. +The 27 wearable portable-container records have conditional presentation, but +no conditional gameplay scalar in this audit. + +Extending support should follow reusable recipient/effect/event consumers and +whole original contracts. An ID appearing in a switch, a client return-only +handler or a passing broad predicate is insufficient evidence to admit all +uses of that function. The existing full-contract equipment audit and newly +specific action/event TODOs remain the implementation work list. diff --git a/server/logout_cancellation_test.go b/server/logout_cancellation_test.go @@ -0,0 +1,101 @@ +package main + +import ( + "encoding/binary" + "net" + "testing" + "time" +) + +type logoutDeadlineConn struct { + net.Conn + deadlines chan time.Time +} + +func (conn *logoutDeadlineConn) SetReadDeadline(deadline time.Time) error { + if err := conn.Conn.SetReadDeadline(deadline); err != nil { + return err + } + conn.deadlines <- deadline + return nil +} + +func TestStopCampingCancelsLogoutDeadline(t *testing.T) { + for _, camping := range []bool{false, true} { + name := "without countdown" + if camping { + name = "during countdown" + } + t.Run(name, func(t *testing.T) { + world := newTestServer(t) + world.newCharacter() + client, connection := net.Pipe() + serverConn := &logoutDeadlineConn{Conn: connection, deadlines: make(chan time.Time, 4)} + if err := client.SetDeadline(time.Now().Add(5 * time.Second)); err != nil { + t.Fatal(err) + } + done := make(chan error, 1) + go func() { + defer connection.Close() + done <- world.serveWorldConnection(serverConn) + }() + t.Cleanup(func() { + client.Close() + if err := <-done; err != nil { + t.Error(err) + } + }) + cookie := systemPacket(0x1b, binary.BigEndian.AppendUint32(nil, 1)) + binary.BigEndian.PutUint16(cookie, 0xdfdf) + if _, err := client.Write(cookie); err != nil { + t.Fatal(err) + } + for { + packet, err := readPacket(client) + if err != nil { + t.Fatal(err) + } + if binary.BigEndian.Uint32(packet[16:20]) == 0x5f52412e { + break + } + } + if camping { + if _, err := client.Write(targetPacket(characterActionPacket(1, [5]uint32{120}))); err != nil { + t.Fatal(err) + } + select { + case deadline := <-serverConn.deadlines: + if remaining := time.Until(deadline); remaining < 29*time.Second || remaining > 30*time.Second { + t.Fatal("camping did not start the logout countdown", remaining) + } + case <-time.After(time.Second): + t.Fatal("camping did not set a disconnect deadline") + } + } + + for range 2 { + if _, err := client.Write(targetPacket(characterActionPacket(1, [5]uint32{121}))); err != nil { + t.Fatal(err) + } + + select { + case deadline := <-serverConn.deadlines: + if !deadline.IsZero() { + t.Fatal("canceling camping retained a disconnect deadline", deadline) + } + case <-time.After(time.Second): + t.Fatal("StopCamping was ignored instead of clearing the logout deadline") + } + } + ping := systemPacket(1, nil) + binary.BigEndian.PutUint16(ping[2:4], 11) + if _, err := client.Write(ping); err != nil { + t.Fatal(err) + } + pong, err := readPacket(client) + if err != nil || binary.BigEndian.Uint16(pong[2:4]) != 11 || binary.BigEndian.Uint32(pong[16:20]) != 2 { + t.Fatal("cancelled camping did not leave a usable world connection", err, pong) + } + }) + } +} diff --git a/server/main.go b/server/main.go @@ -584,6 +584,12 @@ func (server *server) serveWorldClient(client *worldClient) error { if err := conn.SetReadDeadline(time.Now().Add(30 * time.Second)); err != nil { return err } + case 121: + // StopCamping cancels logout independently of posture or nano actions. + loggingOut = false + if err := conn.SetReadDeadline(time.Time{}); err != nil { + return err + } case 108: if err := server.handleNanoCast(client, body); err != nil { return err