aorecomp

Anarchy Online classic in the browser

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


docs/nano-kit.md (7424B)


Simple Nano Kit

The server supports exact-QL Nano Kits 85366/QL1, 85367/QL200 and 160295/QL400 through shared medical consumable rules. The QL1 Simple Nano Kit 85366 is usable from ordinary inventory, for self-use or a living connected friendly player in the same playfield. The shipped record is server/gamedata/items/items_004.yaml, payload SHA-256 f9026bb655e6549d9cfc8fb0362c072d2db49c374917e5dd3909823acc857910. The 14.7.8 parsed record corroborates its fields. The exact item and source ledger are retained in local/nano-kit-smoke/.

Authored behavior and implementation

The kit has 25 charges, HasEnergy, UseEmptyDestruct, Stackable and ApplyFriendly. Its use requires effective FirstAid123 > 7 AND selected-target mask 35. It restores CurrentNano214 using endpoints 10..12, runs target graphics 13600, locks the user's FirstAid123 for 40 seconds, and supplies the target text "Your body tingles with energy." Its description explicitly permits self or friend. There is no authored sitting or out-of-combat requirement.

The server checks predicted 3D positions using item range 3 plus both actor extents, including equality: 7 meters between default players. First Aid's base value is now persistent, with client default 5 and ability weights [0,30,0,30,40,0] in STR/AGI/STA/INT/SEN/PSY order. Default effective skill is 7 and does not satisfy the kit's requirement. The previous hardcoded native value 100 is replaced by this actual base stat. See First Aid research for the skill resource and permission evidence.

Successful use commits the decremented charge, absolute source lock deadline and recipient nano together in one SQLite transaction before acknowledging the use. In-memory inventory and recipient vitals change only after commit. Failed writes or commits leave nano, charges and the lock unchanged. Repeated sequence numbers are ignored; another sequence during the lock is rejected. Login restores the remaining lock and expiry sends CharacterAction164 for stat123. Treatment124 retains its separate clinic deadline and behavior.

The native proxy success ACK consumes one charge; TemplateAction3 separately runs the item effects. A final zero-charge row needs explicit native action112 deletion. Kit stacks can split and join only matching template/type/QL rows, including persisted backpack contents. This kit has no removal-event20 functions, so rebuilding supported stacks does not run deletion effects. The 65535 quantity ceiling is representational; the historical merge cap remains unresolved and the general merge TODO stays open.

Nano is clamped to its derived maximum and sent privately to the recipient using StatIIR214. This does not write HP or disturb pending weapon results. The local Hit53002 and StaticText53044 handlers do not perform these authored operations; StaticText's dispatch reaches the original RET4 stub at1010def0. Sending another ApplySpells packet would reach the same stub. TemplateAction3 constructs its resource from the supplied template pair and does not require a source inventory row or debit another charge. Broadcasting it to ready observers where both players exist replicates the target graphics.

The authored text uses native ChatTextIIR 0x5f4b442a: uint32 big-endian byte length, raw text without NUL, category byte0, display-mode byte0. The reader, writer and activation are original 10042440, 100424b0 and 10042510, in client/game/kkr.dll/lifted-0021.c at relocated base 0x36000000. Original PE import signatures confirm the 32-bit length and byte-sized final fields; modern serializers with a 16-bit length and trailing DWORD differ. Activation does not filter by envelope actor, so delivery is unicast to the recipient. Category0/mode0 uses normal native text output. For this 30-byte line the 36-byte body is:

0000001e596f757220626f64792074696e676c6573207769746820656e657267792e0000

Evidence limits

The inclusive uniform integer restoration roll is a reconstruction choice; the record establishes endpoints, not distribution. Success at full nano, absolute lock persistence across server restart, and the supported ordinary player permission subset are implementation policies. Historical full-nano consumption, action-phase scheduling, all friendly NPC/PvP categories and original-server range tolerance remain unproven. Direct use from a backpack is not implemented; the kit can be moved into ordinary inventory first. The health-restoring First Aid kit remains disabled pending its separate combat HP delivery problem.

The native ApplyFriendly gate rejects ordinary unteamed players as attackable in the recovered 10079880 path. Self and matching native team membership pass this part of the check. Production team rosters provide matching native membership. The server's connected-player permission policy remains broader than that client gate pending the full target/PvP audit. No feature bits or native return stubs are changed to bypass the gate. A native team fixture uses the recovered TeamMember and leader messages to exercise an eligible friendly recipient; the packet schema and source streams are retained in local/reports/team-fixture-protocol-1491-source-audit.json.

Verification

Go checks cover authored requirements, invalid targets and source items, the exact 7-meter boundary, use during combat, private recipient nano/text, observer effect replication, failed-save atomicity, closed-owner output, replays, concurrent requests, lock expiry, final-charge deletion, maximum clamping, old-profile defaults and persistent split/join conservation.

Actual WASM checks are retained under local/nano-kit-smoke/:

The first restart test recorded expected connection-refused console messages while the fixture was down. The final two-client run recorded no errors. All test-owned clients and servers were closed before final automated checks. The full go test ./server/... suite passed, followed by three race-detector repetitions of the nano-kit, stack and portable-clinic tests.