aorecomp

Anarchy Online classic in the browser

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


docs/fling-shot.md (12317B)


Fling Shot: native path and remaining rules

Catalog main-hand weapons with Can bit 12 support the native Fling Shot request, named damage feedback and a persistent shared skill lock. This is a prototype with ordinary and critical damage. The ranged-special milestone stays open: critical selection and several historical rules below remain provisional.

Target-era evidence

The shipped tips LookatSolarPoweredAssaultRifle.txt and LookatSawedoffSolarShotgun.txt describe placing Fling in the native shortcut bar from Controls (Ctrl+2). The tested keyboard binding is L.

The February 2, 2003 JeuxOnline discussion reports weapon attack delay * 15 - Fling skill / 100 seconds. The author attributes this to forum investigations but supplies no measurements. This is the current reconstruction's formula, not recovered original server code. The pistol's original record 123742 has attack-delay stat 294 equal to 125 centiseconds. With effective Fling 7 the reported formula gives 18.68 seconds. The implementation rounds up to the native whole-second lock, 19 seconds. Its one-second guard for extreme skills is also provisional; the original floor, exact arithmetic, raw/effective input and rounding remain unknown.

Period reports in the July 2002 MP weapon guide describe specials alongside normal shooting and critical special damage without the normal critical chat label. March 2002 NT weapon reports describe using Fling while chaincasting. A December 2002 dual-wield discussion reports one shared Fling reuse timer for two weapons. These observations do not establish all execution, recharge, swap or interruption gates.

The attributed Funcom 15.5.5 notes, dated July 20, 2004 and preserved in the patch-note copy, introduce ammunition deductions and defensive checks for Fling and other named specials. Accordingly, this 14.9.1 implementation leaves ammunition unchanged and does not add the later evade check. An empty finite clip is still rejected; the historical empty-clip/autoreload behavior remains unresolved. The old official article URL is unavailable. The official launcher's patch_id=23 URL now returns current 18.8 content, so HTTP 200 from it is not verification of the historical text. The retained source ledger distinguishes these cases.

Original client protocol

Target kkr.dll SHA-256: a37bc1c15053fdcc5572772309f7074c4f83baffe2faa164df40b059b7c480c0.

Path Original address Established contract
N3Msg_SecondarySpecialAttack 1002c090 Checks selected/fighting target, local lock, special availability, range and line of sight before sending
CharSecSpecAttackIIR_t constructor 1007d8e0 Class-derived key 0x51492120
Request reader 1007d9f0 Target identity, then special stat ID; Fling is 150
Request activation 1007da30 / 10078a40 Queues a special through the weapon holder; this is separate from its damage result
SpecialAttackInfo reader 100b2c00 Slot, damage, ammo, target identity, special stat, death reason
Result activation 100b2cb0 Named feedback, one target HP subtraction, optional target death, supplied ammo assignment
Ammo assignment helper 1007c0f0 Passes the supplied count to that weapon's stat 26; it does not decrement it

The result key is 0x754f1115, with the attacker in its N3 envelope. For the tested shot its payload is [6, damage, currentAmmo, 50000, targetID, 150, deathReason]. Death reason 4 identifies weapon damage on a killing hit. There is no critical-result flag in this message's recovered body.

Fresh REA evidence is in local/fling-shot-research/native-evidence.json:

Server behavior and limits

The shared weapon-special handler accepts Fling150 with Can bit 12, Fast Attack147 with Can bit 18 and Burst148 with Can bit 11 on a supported right-hand weapon. Unlimited-ammo weapons, including the solar shotgun, send result ammunition -1; see catalog weapons. Fling requires the authenticated, ready 14.9.1 owner and a visible living creature in range. It rejects dead/loading/replaced sessions, other owners, player targets, empty clips, active reload/equip, sitting, vehicles and an existing lock. Some of those action gates are reconstruction policy pending period verification. Server line of sight remains the existing combat TODO.

Accepted shots reuse the shared weapon-hit calculation, including ordinary or critical damage, attack rating, AC, overequipping and damage modifiers. The critical chance and damage policies are provisional. Fling-specific damage distribution and original critical selection remain open. It does not reset an existing normal attack/recharge or nano cast. It triggers normal NPC retaliation and the existing contribution, corpse and respawn lifecycle. An established matching fight now returns the native special action before result/lock, including to the owner. Automatic normal attack startup and the remaining presentation rules remain open.

skill_locks stores player, skill and an absolute deadline. Repeated requests, swapping and reconnecting cannot create another Fling before that deadline. Startup loads active locks; initialization publishes their remaining native countdown. Expiry removes the in-memory lock and emits action 164 once; no per-tick SQL writes are needed. Expired rows are ignored at startup and overwritten on the next use. Profile edits preserve active locks. The authoritative deadline and reconnect conversion use shared SkillLockModifier382 rules.

The handler prepares damage on a detached NPC copy, then commits the lock, NPC HP, contributions and corpse/respawn state in one SQLite transaction before publishing live state or success feedback. Failure leaves both actors and feedback unchanged. Database reopen tests restore living and killing outcomes; forced process termination immediately around commit is covered below.

Verification

server/fling_crash_test.go starts real child processes with disposable SQLite databases for both Fling and Fast Attack. For controlled critical hits against surviving and killed targets, the parent sends a forced kill at either SQLite's commit hook or the first native special-action write. The commit-hook stop occurs after the transaction's writes and before commit; the output stop occurs after commit and before any action bytes are published. The test does not add production fault switches or change transaction code.

Recovery before commit retains the original HP, ammunition and empty cooldown, contribution and corpse state. Recovery after commit retains the shot's HP and cooldown, living damage contribution or dead corpse rights, expiry and pending respawn. Killing hits retire the contribution map after assigning the corpse's owner. A replacement session replays the request twice: an uncommitted shot can succeed once; a committed shot emits no new result. A second database reopen checks the recovered/retried outcome. These checks cover implemented outcomes; future kill XP and other rewards must join the same atomic transition.

The published WASM client separately performed a controlled killing Fling against an isolated test Leet. Both clients received the same 95-point result; the preview process was killed on receipt of that result, without graceful shutdown. SQLite retained HP zero, killer ownership and corpse/respawn deadlines. After restart, the killer loaded the native corpse and received the native loot-rights message; both clients reconnected without another Fling result. Loaded/loose ammunition stayed 20/100 and there were no page errors or unimplemented-adapter messages. The 19-second lock expires during this cold start; the automated cases verify active-lock recovery before expiry. Raw captures and cleanup records are under local/fling-crash-research/. Only owned actors/items were removed afterward; the single shared preview and existing item records were preserved.

client/tests/fling_result.c executes unchanged sub_360B2CB0 from client/game/kkr.dll/lifted-0053.c. Its eight Fling cases verify target-only HP subtraction once, attacker/defender/observer feedback categories, ammo values 3/0/-1 forwarded unchanged, death routing and missing actors. External identity, stat, feedback and ammo boundaries are stubbed; this does not test rendering, the network reader or original server formulas. The fixture also includes seven Brawl and six Fast Attack cases; all21 run in Linux and WASM.

server/fling_shot_test.go covers owner/observer results, ammunition conservation, concurrent duplicates, normal recharge and nano-cast independence, invalid and malformed requests, failed lock/HP/NPC/contribution SQL writes, profile edit/restart preservation, remaining-lock publication, one-shot expiry, expired stored rows and kills.

Two unchanged published WASM clients exercised the L binding against the one HTTPS preview. The first two shots displayed matching six- and seven-point Fling results to attacker and observer, with 20 loaded rounds and 100 loose rounds unchanged. An immediate repeated keypress sent no second shot. Cold-start lock replay used an explicitly extended test deadline so it remained active through client loading; this is a persistence/UI check, not a cooldown formula measurement. Native probes observed a restored 125-second lock, then 43 seconds, blocked use, and the native availability notification on expiry.

That first target was an unprofiled Reet of Paradise. Its server HP reached 87, but after reconnect the native clients recovered independently to 94/96 and then 100. Both native maxima were 100. That run exposed a server recovery gate limited to the supported Leet. The subsequent NPC recovery fix removes the gate after checking the Reet's native inputs; these original Fling captures alone do not establish raw-HP agreement for that species.

The supported Leet then received a 12-point Fling with native HP 88 in both clients and ammunition still 20. A normal shot followed by Fling during weapon recharge produced another matching 12-point special, with native HP 76 in both clients. That normal shot dealt three points; regeneration occurred between the two probes. Ammunition was 19: the normal shot consumed one round, while Fling left it unchanged. All 192 item instances retained their identity, template, quality and count; the pistol's one-round change was the only item change.

On the final build a seven-point Fling took the Leet from 100 to 93 native HP. A read-only SQLite snapshot immediately afterward contained HP 93 and the active skill lock. Ammunition stayed 19 and all item rows were unchanged. The three browser runs reported no page errors or unimplemented adapter calls; their owned browser contexts were closed afterward.

Final validation passed: go test ./server/... -count=1 (server 299.073 seconds, gamedata 7.776 seconds), focused Fling/combat/corpse race checks (106.796 seconds), and eight original-client contract cases on both Linux and WASM.

Source ledgers, exact request/result captures, native probes, screenshots, controlled-deadline metadata and item audits are retained under local/fling-shot-research/. The C contract's build logs and source identity are under local/fling-research/. No production client adapters needed changes.