aorecomp

Anarchy Online classic in the browser

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


docs/combat-client-effect-handlers.md (19372B)


Client effect handlers and skill locks in 14.9.1

This continues the effect inventory using the same original kkr.dll and matching resource database. Original addresses use base 0x10000000; generated C uses 0x36000000. Function names below come from native registrations where available. Unnamed IDs retain their numbers; behavioral descriptions do not assign modern function names to them.

All 47 observed IDs admitted by 100bfb40 now have a dispatch classification below. This is complete coverage of that intersection, with explicitly partial semantics for deeper rendering, AI and item-data consumers. The other 25 observed IDs are rejected by this executor. Neither the gate nor the inventory establishes original server execution rules.

Application, scheduling and removal

SimpleChar's constructor at 1006d5f1 sets its Beholder interface vtable to 1017139c. Vtable entry +0x34 is 10002370, the common effect-list apply routine. It clones each effect with 100bfc30, then sets flag mask 0x1 for a nonzero third argument and clears it for zero. For ordinary modifier handlers, mask 0x1 selects removal. This independently resolves the ApplySpells wire byte: byte 1 becomes argument 0 and adds; byte 0 becomes argument 1 and removes. SpellList activation passes zero and adds. Exact packets and function bodies are in the protocol report.

The routine copies the source identity, initializes the clone, and chooses the target using argument key 32. Target 2 resolves the receiving character, target 3 uses the supplied subject; other target modes have additional context. TimedEffect, a remaining count above 1, or a positive interval causes insertion into the target's effect list, category 9, through 100027e0. Ordinary immediate effects call 100be8e0 directly. A count of -1 takes a separate cleanup path here; it must not be assumed to mean an infinite effect in every entry point.

The queued actor path calls 100021f0 from the two-second GameTime branch of 1006ea50. It visits the queued effects, invokes 100be8e0, and removes finished entries. The executor advances elapsed time by 200 each accepted visit. Together these establish centiseconds with two-second scheduling resolution for this path. Item and visual consumers can have other entry points; this is not proof of server scheduler resolution.

100be8e0 first applies the gate and criteria. A rejected function clears its remaining count. A failed criterion decrements the count and returns before advancing elapsed time. An ordinary successful tick waits for interval key 4, resets elapsed time to zero, decrements a positive remaining count and dispatches. This discards excess elapsed time rather than carrying it into the next tick. Removal requests for queued effects are initialized with one remaining tick.

TimedEffect 53014 has its own branch before the switch:

if remaining == 0 or criteria fail: stop before this branch
elapsed += 200
if elapsed < delay4: return
if flags & 1: return
if not (flags & 2):
    flags |= 2
    apply_additive_modifier(stat0, amount39)
    timed_total[stat0] += amount39
if elapsed < delay4 + duration25: return
flags |= 1
remove_additive_modifier(stat0, amount39)
flags &= ~1
remaining = 0
timed_total[stat0] -= amount39

The add/remove wrapper is 100bd370 -> 100bd600; 10071700 and 10071770 maintain the separate totals map at actor +0x14c. The Riposte Item resource 42031 supplies (stat=227, amount=55, key11=1, key46=0, duration=4000), so the raw duration is 40 seconds in this actor path. Keys 11 and 46 are decoded and preserved, but this branch does not use them to calculate its duration.

The early flags & 1 return is significant: replaying TimedEffect through the generic removal entry point does not perform the internal expiry subtraction. Likewise, criterion failure can finish a queued effect before its internal expiry branch. These are observed client branches, not a complete cancellation or stacking policy for a server to invent around.

Numeric handlers

Skill 53012 and Modify 53045 both reach 100bd600; Modify uses the wrapper 100bd4d0. The target must support SimpleChar. Argument key 0 is the stat and key 39 the signed amount. Addition calls 10074730, removal 10074b00. Their modifier map is separate from the base stat. The latter removes an entry when its sum becomes zero. Removing maximum health stat 1 clamps current health to the resulting final maximum in this call path.

Dependencies are invalidated and consumers notified, including initiative timing, ability trickle, health/nano foundations, regeneration and physical scale. The effect report details those calls. For an authoritative buff implementation, retaining each applied effect and its amount is necessary to remove it once; overwriting the base stat would not reproduce this additive behavior.

Set 53026 (100bd380) is different. It requests stat key 0 and value key 39, then uses the subject's setter/definition operations. Stat 0 takes a flag operation. It diverts IDs 4, 27, 37, 47, 49, 59, 60, 214, 365 and 131072 to a restricted character branch, which only implements selected cases: profession 60, fatness 47, the stat-49 stub call, and 131072. The other diverted IDs do not simply fall through to a generic assignment. This is not permission to use Set for arbitrary authoritative health changes.

AddSkill 53028 (100bd550) requires DummyItemBase, not SimpleChar. Its three arguments decode as keys 55, 0 and 39. 1008f590 selects item list key 55 and updates the pair whose key equals argument 0, or appends that pair when absent. The stored value is argument 39. This changes an item's skill/weight list; it does not grant that skill amount to a character. The First-Aid Kit example has (55=3, 0=123, 39=1).

Unnamed 53110 (100c2000) temporarily replaces a base stat. On apply, 100760c0 saves the mode-2 value once in a map at the stat helper's +0x0c, then writes the requested value. Further applications update the value while preserving the first saved original. On removal, 10076180 restores that original and erases its entry. There is no percentage calculation here. It is not a stack of independent replacement effects. The Mid's resource 96078 uses stat 360 and value 20.

Unnamed 53175 (100c3050) applies an additive amount calculated as trunc(level54 * amount39 * 0.005). The original single-precision multiplier at 10170e9c is 0.004999999888241291. Removal recalculates that amount using the current level and calls the same modifier removal helper; it does not retrieve a previously saved amount. This matters if level changes while the effect is active. This observation does not establish the complete server organization-advantage scaling policy.

Unnamed 53139/53140 (100c2980/100c29e0) set/clear one bit in a supported stat. They read the stat in mode 2 and use 1 << (amount39 & 31). These handlers do not consult the removal flag. Unnamed 53067/53068 operate on feature-mask key 73 through 10059930 and 10059a80, reversing those calls on removal. Those helpers maintain a byte reference count per bit and update Features stat 224. They also notify movement/animation consumers. A positive duration schedules inverse events 128 or 64 respectively through 1002ee20. This is a distinct mask/count mechanism, not the additive skill map.

Skill locks are a separate mechanism

SkillTime 53033 is admitted but dispatches ATR_t::ActivateTestArgument at 1010def0. Its entire body is ret 4. Its three serialized arguments are keys 55, 0 and 39; decoding them does not start a client lock.

The actual lock state is a vector of eight-byte (skill, remaining_seconds) pairs behind the first pointer in the actor's stat helper at +0x154:

Function Behavior
100738e0(skill) Tests membership.
10073ab0(skill) Returns remaining seconds, or zero when absent.
10073ae0(skill, raw_duration) Ignores an already-present skill. Otherwise appends a lock after the duration calculation below, then calls 100572b0 for consumers. That helper marks the found skill/action entry dirty and emits its UI notification only for the local player.
10073d00() Decrements each remaining duration by one and erases entries reaching zero. Called from the one-second GameTime branch at 1006ef69.
duration = trunc(raw_duration + raw_duration * effective_SkillLockModifier382 * 0.01)

The multiplication of the two integers precedes the floating-point scaling in the original instructions. The setter does not refresh an existing lock, and does not explicitly clamp its newly computed duration. Global tick phase affects the first decrement. Native fStatToString registration at 100318a8 names stat 382 SkillLockModifier.

Replication is CharacterAction, class 0x5e477770, action 170. Its second identity supplies (type=skill, instance=raw_duration); the first identity is unused by this branch. Reader 1007d5c0, activation 1007d640 and actor callback 1006fa30 establish that route. The callback's original compressed tables at 10070d6c and 10070c08 map action 170 to 10070a5a, which calls 10073ae0. Generic SkillIIR assignments do not create this vector. This supports separate server lock state and expiry plus the native notification, without pretending that the SkillTime local handler executes the lock.

All observed admitted handlers

"Decoded" below means the immediate numeric or stub behavior is established. "Partial" identifies a classified path whose deeper consumer or full policy remains outside this pass. Presentation classifications require a concrete render/text/appearance call; an evocative name alone was not enough.

ID / native name Dispatch Classification and coverage
53012 Skill 100bd600 Decoded: additive character modifier.
53014 TimedEffect special branch, 100bd370 Decoded core: timed modifier and internal expiry; cancellation boundary above.
53019 Nano 100be540 Decoded immediate path: learned nano-list lookup/add/remove helpers 10064eb0/10064dd0/10064e60, messages; startup crystal learning uses this path. Guard behavior remains as written.
53026 Set 100bd380 Decoded: subject stat setter with restricted cases.
53028 AddSkill 100bd550 Decoded: item skill-list pair insertion/update.
53030 GfxEffect 100be720 Partial presentation: creates/deletes visual effects, stores effect identity and duration.
53032 SaveChar 100c1da0 Decoded no-op: calls return-only 1010ba00.
53033 SkillTime 1010def0 Decoded no-op; actual lock route above.
53035 HeadMesh 100bd9a0 Partial presentation: mesh/category attach/remove.
53037 BackMesh 100bd9a0 Partial presentation: same handler.
53038 ShoulderMesh 100bd9a0 Partial presentation: same handler.
53039 Texture 100bdbd0 Partial presentation: texture/appearance calls and tracking.
53044 StaticText 1010def0 Decoded no-op in this executor.
53045 Modify 100bd4d0 Decoded: wrapper for additive modifier.
53051 unnamed 1000c340 Decoded no-op; shared exported aliases do not change return-only body.
53054 BodyCatMesh 100c1350 Partial presentation: actor mesh/category add/remove.
53055 AttractorMesh 100c13b0 Partial presentation: mesh attachment add/remove.
53057 HeadText 100c14e0 Decoded presentation: text notification on application.
53060 unnamed 100c1540 Partial: conditional stat-359 assignment/clear, actor refresh and duration event 32. No invented stat name.
53065 unnamed 100c1620 Partial item data: four fields through item virtual method, selector 0.
53066 unnamed 100c16e0 Decoded no-op after argument/context reads: calls return-only 1000c340.
53067 unnamed 100c1730 Decoded core: reference-counted feature mask addition/removal, inverse event 128.
53068 unnamed 100c17f0 Decoded core: inverse feature-mask operation, inverse event 64.
53069 NextHead 100c2aa0 Decoded no-op through 1010ba00.
53070 PrevHead 100c2aa0 Decoded no-op through 1010ba00.
53075 unnamed 100c18f0 Partial item data: same four-field virtual operation, selector 1.
53076 unnamed 100c19b0 Partial item data: same operation, selector 2.
53079 unnamed 100c1a70 Decoded presentation: visual effect create/delete and duration.
53086 unnamed 100c1da0 Decoded no-op through 1010ba00.
53087 unnamed 100c2d60 Decoded no-op after context reads: 1000c310 is return-only.
53100 unnamed 100c1e70 Decoded no-op after context reads: 1000c310 and 1010ba00 return.
53110 unnamed 100c2000 Decoded: temporary base-stat replacement/restore.
53115 unnamed 100c20a0 Partial presentation: local-player message with string and two arguments.
53117 unnamed 100c2100 Partial: target eligibility checks/messages; no demonstrated damage/hate mutation.
53118 unnamed 100c2330 Partial: NPC restriction and controller state 3; updates feature bits.
53121 unnamed 100c2480 Partial: native text identifies fear; NPC controller state 2 apply/reset.
53127 unnamed 100c2680 Partial: native text identifies mind control; NPC controller state 4 apply/reset.
53128 unnamed 100c2760 Partial: native text identifies daze; NPC controller state 5 and feature bit 0x200.
53130 unnamed 100c2810 Decoded client operation: deletes the current-use item through 10061bc0/1005f270, then clears that reference; see inventory combinations.
53132 GenerateName 100bdf60 Decoded presentation: applies supplied name strings through 10070f40.
53134 unnamed 100c2840 Decoded presentation: text to local actor or within an argument-specified 3D radius.
53138 flight 100c1cc0 Movement events 27/35 enter flight mode 7 and restore the saved ground mode; see vehicles.
53139 unnamed 100c2980 Decoded: set a bit in a stat.
53140 unnamed 100c29e0 Decoded: clear a bit in a stat.
53162 unnamed 100c2aa0 Decoded no-op through 1010ba00.
53175 unnamed 100c3050 Decoded numeric: level-scaled additive modifier.
53177 unnamed 100c3170 Decoded no-op after argument/context reads: calls 1000c340.

WeaponItem vtable 101745cc + 0xc0 resolves to 100ae2e0 for the four-field item operation. Selectors 1 and 2 replace stored four-word descriptors at +0x1d0 and +0x1cc; selector 0 delegates to 1009f2a0. This storage alone does not establish combat damage arithmetic. Their complete later consumer is left partial rather than labeling all three as harmless cosmetics.

A bounded follow-up reaches concrete native consumers. Base Item +0x190 feeds an effect resource and color through 1009f1c0. WeaponItem +0x1d0 feeds NewHitLocation, CreateEffect2, SetColor and GetTimeToImpact through 100ac450; +0x1cc feeds the hit effect resource and color through 100ac610. The latter callback also drains previously received result/HP pairs through 100ab5a0; that separate work must not be discarded with a visual branch. The inspected descriptor branches do not compute damage or roll53089 chances. Resource-selected subclasses, virtual callbacks and historical server behavior remain bounded unknowns. Complete maintained-C function boundaries, hashes and reused original Evidence IDs are retained in docs/research-notes/weapon-contract-research/native-descriptors/findings.md.

The NPC controller helpers 1005b010 through 1005b19c establish those state and feature changes. They do not supply an NPC hate table or authoritative taunt formula. No such formula was recovered in the inspected admitted paths.

Rejected and unresolved boundaries

The 25 observed IDs rejected before this local dispatch are:

53002 53016 53063 53064 53073 53083 53089 53092 53105 53107
53109 53124 53126 53133 53137 53144 53153 53154 53155 53166
53167 53173 53178 53181 53185

Hit 53002 therefore does not produce local healing, damage, HoT or DoT ticks through this executor. Its definitions remain readable data. Rejected effects may have server execution or other client readers; the gate is not a global absence proof. No independent heal RNG, armor/reflect outcome, ammunition consumption or hate calculation was found in the admitted handler bodies inspected here. Combat stats separately covers nano cost eligibility/refund, regeneration and pool caps; those must not be invented from effect names.

Server buff stacking priorities, nanoline replacement, cancellation, reconnect replay and server-authoritative periodic damage remain separate contracts. The recovered minimal building blocks are additive modifiers with explicit removal, a distinct temporary base replacement mechanism, timed client prediction, and CharacterAction skill locks. Implementing every item effect by calling the additive helper would be incorrect.

Retained evidence

The catalog and gate are in local/reports/combat-item-effects-inventory.json. local/reports/combat-client-effect-handler-map.json maps the 72 observed IDs to gate status and targets; TimedEffect has an explicit special-branch note rather than being treated as a switch case. The original executor/gate are in decompile batch 19 and modifiers in batch 21.

The continuation evidence is in local/reports/combat-client-pass2-decompiles-*.json:

Batch Evidence ID Relevant coverage
2 ev_b36e6b8b14d9f960dd1705c8d5cd0779c3be3306d575aa456b07008bdb956f40 Core numeric handlers, TimedEffect totals and SkillTime stub.
3 ev_3c35ce2d6454b2e9f741c25a66383f242d46fbb8029551ab3e61d2121e188deb Nano-list handler and item/visual classifications.
4 ev_80beaf091eb5a5d73960b97b09e3dd3afded2f2ee46f14ff090b6de347cb12ed Lock getters, setter, expiry and actor callback.
5 ev_74b850319e01a5d695961489586fe30fa511941488693d18d9ceb3bd4ce83148 Remaining admitted handlers and temporary base-stat map.
9 ev_21b6bf56ea3b01fefafecdb673e392142538e12a995ac4070c4b8a8f1a26f59b Common application, queued insertion, feature helpers and empty stubs.
10 ev_1a3cb7e77a4267701716a4ec28b32bf1ad4e1f9c934ef18e59cc10785519c56f Skill-lock consumer notification.
12 ev_6c81309872313c894024f13d5290bf165ffea1c85cbbce3ba560840d5824fc13 Legacy mesh, texture and visual-effect handlers.
14 ev_700456d500ded1b651bc8f770dbe843118f6c6286ca349ae445f40ef86a4e8c5 Queued effect tick, item descriptors and learned nano-list helpers.

Generated source for the effect executor is lifted-0056.c; continued handlers are in lifted-0057.c, common application in lifted-0000.c, skill locks and stat maps in lifted-0034.c, and the actor callback/tick in lifted-0033.c. The level scaling and important time/bit branches were also checked against their original instruction comments and constants. This is static evidence; live buff/expiry/lock replay has not yet been validated by this investigation.