aorecomp

Anarchy Online classic in the browser

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


docs/combat-client-effects.md (7753B)


Item effects and client prediction in 14.9.1

The client has more than weapon animations. It reads item/nano requirements and effect definitions, executes selected local effect handlers, maintains stat modifiers, and predicts resource recovery. These paths must be separated from server-supplied damage outcomes.

This report uses the original engine image and hash identified in the reconstruction index. Original addresses use base 0x10000000; generated kkr C uses 0x36000000.

Shipped data coverage

The matching database catalog contains 83,245 item records (type 1000020) and 4,366 nano records (1040005). Its index digest was checked against the original database before this inventory. Across those definitions there are 223,338 effect references using 72 distinct function IDs. Three item records retain one undecoded trailing zero byte each: 120802, 120827 and 203911. Those bytes were preserved, not silently discarded.

tools/data/extract_items.py preserves each effect's function ID, header words, requirements, tick count, tick interval, target, argument header, typed arguments and skipped bytes. Its argument layouts originated in CellAO's extractor; successful framing and complete byte coverage do not independently prove every argument's meaning or effect behavior. Server execution should not be inferred from those layout names alone.

Native StateParse_t name registrations in generated lifted-0048.c identify 22 of the 72 observed IDs. Selected examples are:

Function ID Native registered name Data example / boundary
53002 Hit Simple First-Aid Kit 23314 has arguments 27, 10, 12, 0; reading endpoints does not perform the health outcome.
53012 Skill Present in equipment/nano definitions; exact effect flags and argument semantics still matter.
53019 Nano A registered name, not proof of a complete server nano-cast implementation.
53028 AddSkill Separate function identity from Modify.
53033 SkillTime First-Aid Kit 23314 carries three serialized integers, 9, 123, 40. Its local handler is a no-op; actual skill locks use CharacterAction 170.
53045 Modify 160,911 references, including armor stat additions. Local modifier execution is traced below.

All counts, registration string/assignment addresses, example definitions and requirement-operator frequencies are retained in local/reports/combat-item-effects-inventory.json. The second pass maps all 47 observed IDs admitted by the tick gate in the handler report, with remaining semantic gaps identified there. Exact core wire fields are documented in the spell stream report.

The local tick gate

FUN_100be8e0 processes a data-driven effect. It first calls FUN_100bfb40 with the function ID. A rejected ID clears the remaining tick count and returns before the effect dispatch. The gate's raw byte table is at 0x100bfb70, covering 182 IDs starting at 53002; its jump table is at 0x100bfb64. The complete native allowlist contains 87 IDs, of which 47 occur in this database's 72-ID effect inventory.

Crucially, Hit 53002 is rejected by this local tick path, while Modify 53045 is admitted. Hit definitions can still be read for tooltips: N3Msg_GetDamageString at 0x10024300 reads negative health-effect endpoints in its nano branch. Reading that definition is separate from selecting and applying a damage/heal result. Queued weapon results and health messages are covered in the protocol report.

The allowed path checks remaining ticks and requirements through FUN_100056e0, accumulates elapsed time, and dispatches by effect ID once the interval is reached. This establishes a local executor and its gate; it does not prove that every admitted handler changes a stat, that every effect is client-authoritative, or that rejected functions have no other read paths. Some dispatch entries invoke a test-argument handler or presentation machinery.

REA batch 19, evidence ev_f28cc89d25d840908ea753e766d4e2d1a718ef5138b04f190e82062755593b1d, contains the complete gate and executor. It is retained in local/reports/combat-client-decompiles-19.json and the full state evidence bundle. Table decoding was checked against the original image bytes.

Modifier application and removal

The Modify case dispatches through FUN_100bd4d0 to FUN_100bd600. The latter requires a SimpleChar target and reads the stat key and adjustment from its effect arguments. Effect flag mask 0x1 selects removal rather than addition:

if (effect.flags & 1) == 0:
    add_modifier(stat, amount)       # FUN_10074730
else:
    remove_modifier(stat, amount)    # FUN_10074b00, final argument zero

The add helper increments the stat's modifier-map value. The removal helper subtracts it and erases a zero-valued entry. Removing a health-max modifier (stat 1) also clamps current health 27 to the reduced final maximum when its third argument is zero. Both helpers invalidate/recompute affected state and notify consumers. Concrete dependencies include:

The first observed handler also emits a stat-change notification using the old and resulting values. Sending a raw base-stat assignment is therefore not equivalent to applying and later removing a temporary modifier.

REA batch 21, evidence ev_27c953512839b1cff0ac854ff041eb3e0813c2df061a8858060432f10da08405, contains the three modifier functions and the criteria evaluator. The selected generated instruction bodies are in lifted-0056.c and lifted-0034.c.

Criteria and remaining boundaries

Item action and effect requirements use (stat, value, operator) triples. Eighteen operator values occur in the catalog: 0, 1, 2, 3, 4, 18, 22, 24, 26, 42, 66, 80, 83, 85, 88, 89, 92 and 93. The requirement report maps every observed value to its native branch or explicit rejection, including subject switching, getter modes, boolean stack semantics and caller flags. The basic cases are:

Operator Recovered operation
0 Equality, after checking that the subject supports the stat; getter mode 3.
1 The evaluated comparison is strictly less than the raw required value.
2 The evaluated comparison is strictly greater than the raw required value; failure text adds 1 to the raw threshold.
3 Pop two booleans and push OR.
4 Pop two booleans and push AND.

Boolean stack underflow returns false. There is no implicit AND across leftover stack values. Strict comparisons deliberately pass for a nonlocal initial subject, and a null initial subject passes the list. Do not copy these client visibility shortcuts into server validation, or translate raw operator 2 into an unconditional greater-than-or-equal test. Operators 92 and 93 reject the entire evaluation in this executable despite appearing in the shipped data.

This pass does not fully recover all 72 observed effect handlers, temporary effect stacking/replacement rules, the delegated land-control service, or the server's decision to apply an effect. An inventory of definitions is not an executable server rules engine. The immediate implementation consequence is to preserve base stats, temporary modifiers, active effects and authoritative health as distinct state, and replicate coherent effect application/removal to the client.