commit 7b908c80033738b6144dc8b4cbba170a5d4722b7
parent 267ba0ac3c9972b7a8f6c54e9265492c408128e5
Author: anon <anon@example.com>
Date: Thu, 22 Oct 2026 17:23:23 +0000
docs: record First Aid protocol and combat healing gap
Diffstat:
2 files changed, 123 insertions(+), 0 deletions(-)
diff --git a/TODO.md b/TODO.md
@@ -227,6 +227,9 @@ remaining reward-rule gaps are recorded in [character progression](docs/characte
- [ ] Use one sitting treatment kit. Check: it works in the permitted posture
and combat state and is rejected outside those conditions without consumption.
+The First Aid item, native charge protocol and unresolved combat-healing
+delivery are recorded in [First Aid research](docs/first-aid.md).
+
## Character creation
- [ ] Choose a breed at creation. Check: the choice persists and the native
diff --git a/docs/first-aid.md b/docs/first-aid.md
@@ -0,0 +1,120 @@
+# First Aid research for 14.9.1
+
+The First Aid TODO remains open. A tested prototype handles the selected
+item's charges, targeting, lock and healing feedback, but an absolute health
+update can double-apply an incoming queued weapon hit in the native client.
+The prototype is retained locally rather than enabled in the server.
+
+## Item and skill evidence
+
+QL 1 Simple First-Aid Kit 23314 is native type 51005. Its shipped record in
+`server/gamedata/items/items_000.yaml` specifies 25 charges (212), range 3
+(287), attack delay 0 (294), HasEnergy and UseEmptyDestruct. Its Can flags
+include Use, Eat, Stackable and ApplyFriendly. CannotSplit is absent in the
+selected client; an older 14.2.1 record included it and must not be used here.
+The [14.7.8 parsed record](https://auno.org/ao/db.php?id=23314&patch=14070800)
+corroborates the shipped fields.
+
+The use requirements are FirstAid123 > 7 AND `(SelectedTarget431 & 35) != 0`.
+The authored use functions are selected-target Health27 endpoints 10..12
+(Hit53002), selected-target graphics 13600 (53030), and a 40-second FirstAid
+lock on the user (SkillTime53033). The item metadata initialization function
+AddSkill53028 changes the item's skill list; it is not a character skill buff.
+The endpoints do not establish the original server's random distribution.
+
+Client base FirstAid is 5 (`0x10072760`, store `0x10072848`). Resource
+1000204/123 gives ability weights `[0,30,0,30,40,0]` in STR/AGI/STA/INT/SEN/PSY
+order. Its payload SHA-256 is
+`dd9911abddaac369fc9d56c3ac2ff44e4c7a324f68a1c54b92ca94c4201137b5`.
+Use range `0x1008fda0` accepts 3D center distance up to item range plus both
+actors' physical extents, including equality: 7 meters for default players.
+ApplyFriendly consults the inverse of attack permission (`0x10079880`);
+faction equality alone does not define every valid friendly target.
+
+Shipped `cd_image/text/tips/LookatStartupFirstAidKit.txt` explicitly permits
+use during combat and directs F1 self-targeting. The item description permits
+self or friend. Neither source establishes universal friendly NPC, dead
+target or PvP rules. Full-health consumption, historical lock persistence and
+the heal roll remain unresolved.
+
+## Native charge and feedback protocol
+
+The target is shipped `kkr.dll`, SHA-256
+`a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0`.
+Addresses below use its original `0x10000000` base; generated C uses
+`0x36000000`. The retained REA bundle is
+`local/reports/first-aid-protocol-1491-evidence.json`.
+
+- Generic command ACK `0x52526858` state 1 succeeds, state 2 rejects.
+ Success decrements the native proxy charge once through `0x1005e790`.
+ Evidence: `ev_d6fce7cdf8a26b4feb90ba17fcd1711f9ae42241843a86f766749070d244b871`.
+- TemplateAction `0x35505644` action 3 runs item effects through
+ `0x1005e980 -> 0x100902b0`, without another charge debit. Its uint32 payload
+ is `{23314,23314,1,1,3,104,sourceSlot,50000,targetID}`.
+ Evidence: `ev_3cd89062e7b4d4a2c5c8aa85884ffc09b99e65eacca95d800b704227eff26bc4`.
+- A zero-charge ACK leaves the inventory row allocated. CharacterAction112
+ with `{112,104,sourceSlot,23314,23314}` removes it through
+ `0x1005f270 -> 0x1002d620`. This kit has no removal-event20 effects.
+ Evidence: `ev_adf2bdce609e25d955a4c232cc1035041d4692c16e8af2b37e85653298399b7d`.
+- CharacterAction130 reports a heal to the healer, with payload
+ `{130,50000,targetID,0,amount}` and healer envelope identity.
+ CharacterAction129 reports it to a different recipient with
+ `{129,50000,healerID,0,amount}` and recipient envelope identity. Both are
+ text-only and gated on the envelope actor being local.
+ Evidence: `ev_447353fff8db324343138b6b4ef7a8878c73e33788d4f7cafd25bff2b9d02bb9`.
+
+The immediate use path does not itself apply this health delta locally.
+Common apply `0x10002370` sends Hit53002 with count 1 and interval 0 directly
+to `0x100be8e0`; its gate `0x100bfb40` rejects the effect before dispatch.
+This is a negative result for that specific path, not every possible message.
+Evidence: `ev_21b6bf56ea3b01fefafecdb673e392142538e12a995ac4070c4b8a8f1a26f59b`
+in `local/reports/combat-client-pass2-decompiles-9.json`, and executor/gate
+`ev_f28cc89d25d840908ea753e766d4e2d1a718ef5138b04f190e82062755593b1d`
+in `local/reports/combat-client-decompiles-19.json`.
+
+## Prototype checks and remaining delivery gap
+
+The local prototype stores charge debit and a 40-second deadline in one
+atomic inventory write, restores the remaining lock on login, and supports
+ordinary living connected friendly players. Its uniform inclusive heal roll,
+full-health success and absolute lock persistence are reconstruction choices.
+Focused Go checks passed for skill and target rejection, replay, lock expiry,
+last-charge removal, clamping, failed-save atomicity, concurrent uses,
+friendly use during combat, mixed-template stack rejection and persistence.
+These are prototype checks, not completion of native integration.
+
+Actual WASM right-click use reduced 25 charges to 24 and showed the native
+healing text. A second quiet use changed both server and native HP from 234
+to 246 while charges fell from 24 to 23. An immediate repeat during the
+lock left quantity unchanged and sent no new GenericCmd; the client blocked it.
+No adapter crash or page exception occurred.
+
+In a controlled combat use, the Leet already had an 8-damage result queued
+for the player. The server healed 145 to 157 and charges fell 22 to 21.
+The silent HealthDamage snapshot set native HP to 157 while that result
+remained queued. At impact native HP became 149: the same 8 damage was
+subtracted again. A server regeneration tick separately raised authoritative
+HP to 163. The queue and flat Health27 array were sampled read-only every
+50 milliseconds; the earlier tree-based HP probe was invalid and is not
+health-verification evidence. See `local/first-aid-smoke/combat-heal-trace.json`
+and `self-heal-verified-trace.json`.
+
+HealthDamage and StatIIR assign absolute HP. NanoAttack adds a signed delta,
+but announces nanobot damage rather than healing. StopFight drains queues
+while also clearing combat state and timers; it is not a neutral heal
+synchronization operation. No suitable additive healing message or coherent
+alternative delivery has yet been established.
+
+A [contemporary October 2002 discussion](https://forums-archive.anarchy-online.com/showthread.php?56578-Question-regarding-weapon-speeds=)
+describes using First Aid during weapon recharge and other actions being
+unavailable during attack. It does not establish queuing versus rejection,
+and concerns the user's own action cycle. It cannot justify waiting for an
+incoming opponent's animation to complete. Native ACK scheduling instead
+activates the item timer immediately and does not drain incoming queues.
+
+The implementation patch, fixture, source ledger, timing follow-up, packets,
+screenshots and traces are retained under `local/first-aid-smoke/`.
+`prototype.patch` applies on top of the extent-based range change. Further
+work must resolve combat HP delivery and then verify friendly use, restart
+lock restoration and last-charge deletion in the actual WASM client before
+checking off the First Aid milestone. All test-owned processes were closed.