aorecomp

Anarchy Online classic in the browser

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


docs/research-notes/token-upload-research/native-functions-audit.md (7562B)


Token Use native-function audit

Read-only bounded audit, 2026-10-27. Reused original evidence and maintained 14.9.1 KKR lifted C; no REA session, export, client/server or native call started. The parent owns the current original KKR session. Original KKR SHA-256 is a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0. Maintained addresses add 0x26000000 to original addresses. No production edits.

Important negative result

There is no client-side immediate token-stat addition in the reviewed Use path, and StaticText53044 does not format/display token feedback there. The records describe intended authoritative effects; the client executor gates Hit53002 out and maps StaticText53044 to a return-only handler. Do not implement server token delivery on the assumption that TemplateAction applies either one.

Exact Use/callback sequence

Step Original / maintained symbol Finding
Successful GenericCmd acknowledgement 1005e790 / lifted-0028.c:sub_3605E790 Decrements native inventory proxy count once via1002d2c0/1002d2f0. A zero result triggers event20, if any, then ItemRemoved notification.
TemplateAction action3 1005e980 / lifted-0028.c:sub_3605E980 Constructs a fresh template and calls its Use virtual at+0x58. It does not debit the physical inventory count again.
Item Use 100902b0 / lifted-0042.c:sub_360902B0 Selects event0 with100020c0 and invokes effect-list apply virtual+0x34. It installs the current item/subject context first; no saved mission-acceptance level is consulted.
Effect-list application 10002370 / lifted-0000.c:sub_36002370 Clones functions in source order, sets apply/remove flags and resolves selectors; ordinary count1/interval0 functions go directly to100be8e0. Target2 is the self/user context, not arbitrary selected hostile target.
Common effect executor 100be8e0 / lifted-0056.c:sub_360BE8E0 Calls100bfb40 before requirements. Rejected IDs set remaining count to0 and return. Accepted IDs evaluate per-function criteria via100056e0 before dispatch.
StaticText dispatch 1010def0 / lifted-0079.c:sub_3610DEF0 Entire maintained body is ret4; no stat read, sprintf, message callback or token-count update.

Exact reviewed instruction points:100be8e8 gate;100be8f1 clears remaining count;100be92c criteria call;100902b0 selects event0 at10090496 and applies it at1009049e. docs/nano-learning.md and docs/first-aid.md already establish the ACK -> TemplateAction -> DeleteItem sequence and one-debit ownership. The latter explicitly traces the same immediate Hit rejection.

Retained original evidence:

The first three are retained in local/reports/first-aid-protocol-1491-evidence.json. They prove client receive behavior, not original server transaction ordering or exactly which token feedback packet the original server emitted.

Token descriptors and current-level criteria

Reviewed local/mission-encounter-research/original-token-records.json and token-eligibility.md. Ordinary96349/96350, special152932/152933 and bravery158421/158422 use self-target2 Hit53002, [stat75/62, equal positive endpoints, damageType0], count1, interval0. Ordinary tokens contain the base +1 and eight separate level54/operator2 requirements; special tokens have+25, bravery+1. Preserve the exact Clan threshold >50 versus Omni >49.

Native criteria100056e0 reads the subject's current stat at evaluation time. Operator2 uses signed getter mode0 and strict greater-than when the initial subject is local; nonlocal initial subjects deliberately bypass that comparison. Equality operator0 checks presence and getter mode3. Source: client/game/kkr.dll/lifted-0002-00.c:sub_360056E0 and docs/combat-client-requirements.md, original assembly ev_766b14bab9ca66a483cc487e7daa79d93f1790c34718cedc6ad768caac1acc3d. Authoritative server validation must not copy the nonlocal visibility bypass.

Crucially the native Hit gate returns before these per-function predicates, so the native Use callback itself never computes those increments or reads their current-level predicates. The authored requirements support a server implementation evaluating current redemption level; this audit does not recover an original server implementation or show a client-side token formula.

The final StaticText function is self-target2 and contains the exact string Side tokens collected: %d. followed by20 opaque bytes. Omni starts 4b000000, Clan 3e000000, followed by16 zero bytes. Those first DWORDs are little-endian75 and62. This strongly suggests formatting the resulting side-stat total after preceding increments, but the client no-op supplies no formatter semantics for the other bytes or original server emission route. Do not generalize the blob to arbitrary StaticText formatting without evidence.

Native ordinary stat setter1006e030, maintained lifted-0033.c:sub_3606E030, takes62 and75 through the generic raw-stat store at1006e630 (62 enters1006e285;75 is below the78 special-table lower bound and also enters1006e285). Neither has a token-feedback formatting branch. Thus an absolute token-stat packet can update the count without an extra client-side increment; formatted redemption feedback remains separately server-produced.

Implementation constraints and unresolved scope

Persist the accepted self-target side-stat increment and one physical item debit atomically before success. Evaluate action3's Side33 equality separately from each function's level condition. Send the authoritative final stat value; do not rely on native Hit, invent a nano modifier, multiply physical Count or re-evaluate mission-time level. Publishing TemplateAction is harmless for these effects but cannot substitute for the authoritative stat/feedback messages.

This scope does not prove original overflow/count caps, generic Hit endpoint randomness, arbitrary StaticText argument semantics, token-feedback wire route, shared cross-template Unique groups, mission issuance, probability or XP policy. Token earning probability was deliberately not researched here. Parent original REA/runtime work may close the feedback route and exact use admission separately.

Input hashes