aorecomp

Anarchy Online classic in the browser

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


commit f691392abdd725b57be00d25256fa1a6f37510ef
parent a812ce7419bb182813af3baf65873adcb1aa69e1
Author: anon <anon@example.com>
Date:   Thu, 22 Oct 2026 06:59:33 +0000

Create native corpses and persist validated loot pickups

Diffstat:
MTODO.md | 11+++++++++--
Mdocs/corpse-loot.md | 71++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------
Mdocs/inventory.md | 14+++++++++++---
Mserver/combat.go | 8++++++++
Mserver/gamedata/catalog_test.go | 15+++++++++++++++
Mserver/gamedata/load.go | 4++++
Mserver/gamedata/monsters.yaml | 287+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver/gamedata/types.go | 1+
Mserver/interest.go | 16+++++++++++++---
Mserver/inventory.go | 3+++
Aserver/loot.go | 176+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aserver/loot_test.go | 250+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mserver/main.go | 5+++++
Mserver/state.go | 3+++
Mtools/data/extract_monsters.py | 18++++++++++++++++--
15 files changed, 857 insertions(+), 25 deletions(-)

diff --git a/TODO.md b/TODO.md @@ -25,6 +25,9 @@ no extra player-facing provisioning system is needed just for testing. character cannot delete it by supplying its identity. - [x] Handle a full inventory. Check: a grant or pickup fails without losing the source item or overwriting an occupied slot. +- [ ] Reconcile the 14.9.1 native inventory slot range. Check: filling the + inventory reaches its final supported slot, with every item visible and + movable before and after reconnect. Inventory persistence, protocol evidence and native visual ordering are recorded in [inventory behavior](docs/inventory.md). @@ -136,9 +139,9 @@ recorded in [inventory behavior](docs/inventory.md). ## Loot and credits -- [ ] Open a corpse containing one fixed item. Check: the native loot window +- [x] Open a corpse containing one fixed item. Check: the native loot window shows that item's identity and QL. -- [ ] Take that corpse item. Check: it moves into inventory, disappears from the +- [x] Take that corpse item. Check: it moves into inventory, disappears from the corpse and remains owned after restart. - [ ] Resolve simultaneous pickup attempts. Check: two clients requesting the same item produce one owner and no duplicate or lost item. @@ -151,6 +154,10 @@ recorded in [inventory behavior](docs/inventory.md). - [ ] Remove an expired corpse. Check: observers lose the corpse and stale loot requests cannot recover or duplicate its contents. +The fixed-item checks use a controlled fixture after a real combat kill; +production drop tables remain a separate task. Native packet evidence and +current policy limits are recorded in [corpse and loot protocol](docs/corpse-loot.md). + ## Character progression - [ ] Award XP for one creature kill. Check: the eligible killer gains one known diff --git a/docs/corpse-loot.md b/docs/corpse-loot.md @@ -1,10 +1,11 @@ -# Corpse and loot protocol research +# Corpse and loot protocol -This is partial 14.9.1 protocol recovery, not implemented server loot support. -An isolated WASM fixture renders a fallen Leet, accepts native selection, -inspection and right-click use, and displays its named loot window with QL 1 -Monster Parts. Production corpse creation, use handling and transfers remain -to be implemented. +The server creates native corpses for killed creatures with a recovered death +animation. It handles opening, closing and reopening the loot window, validates +pickup and persists the new owner before acknowledging the transfer. The fixed +WASM test fixture supplies QL 1 Monster Parts after an actual server combat kill. +Production loot tables and drop rates remain unimplemented; ordinary corpses +have empty contents. ## Corpse creation @@ -41,6 +42,8 @@ in stats 4, 59 and 89. The verified Leet fixture uses model 15222, breed 6, sex 1, race 1, static mesh stat 12 equal to zero, scale stat 360 equal to 100, and CanChangeClothes stat 223 equal to zero. Merely copying MonsterData's mesh stat 12 into a SimpleItem does not establish an animated corpse. +MultipleCount stat 26 is -1: native generic Use otherwise consumes the remains +by setting their TimeExist stat to 1 (`sub_3609FC80`). ## Creation animation @@ -73,6 +76,12 @@ The creation function takes a resource ID, whereas the living actor's death action takes the MonsterData animation key. This wire-only fixture kept the correct fallen model visible without changing maintained client code. +`tools/data/extract_monsters.py` retains each MonsterData definition's key-6000 +resources in `server/gamedata/monsters.yaml`. Corpse creation currently selects +the first variant. Matching a living actor's randomly selected death variant +is not yet implemented. Definitions without a recovered death resource do not +create a corpse. + ## Contents and pickup Native right-click use emits `GenericCmdIIR_t` (`0x52526858`). Its body is @@ -80,17 +89,32 @@ eight uint32 words: `0, sequence, 3, 1, 50000, playerID, 51050, corpseID`. The request was captured by selecting and right-clicking the rendered Leet. Closing its loot window and then using the corpse again emitted the same layout with successive sequence values 1, 2 and 3. The close/open state and -acknowledgement still need recovery before implementing the use handler. +acknowledgement use command state 0 for requests, 1 for success and 2 for failure. +The server acknowledges before sending the opening contents update. It retains +one opened corpse per session and ignores repeated command sequences. +Opening another corpse closes the previous native container first, preventing +its identity-free pickup requests from referring to the replacement contents. In scripted WASM input, settle mouse motion before pressing the button so the native world picker uses the intended cursor position. +Closing also requires `ActionIIR_t` (`0x2049527c`), with the corpse as its outer +identity and body `1, 102, 50000, playerID`. The first word is version 1. Reader +`sub_360AEA40` and activation `sub_360AEAA0` dispatch action 102 through +`sub_3608C6C0`, `sub_36097C30` and `sub_3609ED70` to native Close. That removes +the container registration through `sub_36053160`; an acknowledgement alone +leaves the registration present and prevents the window from reopening. +This is distinct from the CharacterAction message. + `InventoryUpdateIIR_t` (`0x4e536976`) starts directly with the encoded item list, using `(count + 1) * 1009`. There is no slot-count prefix in this client. Each 32-byte entry is slot, uint16 flags, uint16 count, item identity, low/high -templates, quality and auxiliary value. The verified individual-item entry uses -flags 2, count 1 and auxiliary zero. The body ends with corpse identity, zero -and one; the final one opens the native loot window. The outer identity is -the receiving player. Reader `sub_360B0C20`, activation `sub_360B0CD0` and +templates, quality and auxiliary value. Corpse item entries use flags 3, count 1 +and auxiliary zero. Flag bit 0 selects the template-proxy transfer branch in +`sub_3602D710` and `sub_3605FB40`; flags 2 render an icon but leave pickup on an +object-transfer branch requiring a separately instantiated item. The body ends +with corpse identity, container index zero and an open flag. The final one opens +the native loot window. The outer identity is the receiving player. +Reader `sub_360B0C20`, activation `sub_360B0CD0` and writer `sub_360B0C80` establish this layout. The fixture item is template 42640, QL 1, native type 51005: Monster Parts. @@ -100,10 +124,27 @@ historical drop rate or a production loot table. Left-clicking the displayed item emits `ContainerAddItem` (`0x47537a24`): source identity `(107, 0)`, target player identity `(50000, playerID)`, and destination 111, the next-free-slot sentinel. The request contains no corpse -identity. A server implementation must retain the session's opened corpse, -validate ownership and availability, and atomically persist the transfer before -acknowledging it. Pickup acknowledgement, persistence, concurrent requests and -loot rights have not yet been implemented or verified. +identity. The server validates the session's opened corpse, killer ownership, +visibility, playfield and five-metre use range. It chooses an empty inventory +slot and atomically saves ownership before removing the corpse item. Its +ContainerAddItem response carries that persisted destination slot. Native +`sub_36042750`, `sub_360614E0` and `sub_3605FB40` transfer the template proxy and +update the corpse window without a replacement contents update. + +Failed saves, full inventory, stale sessions and unavailable items retain the +previous owner. Repeated and concurrent requests cannot take the same item +twice. Corpses and untaken contents are currently runtime state; taken inventory +survives reconnect and server restart. Killer-only access is an initial policy: +public expiry, team loot, corpse cleanup, credits and random drops remain +separate milestones. + +The published WASM client was checked with a real combat kill, fallen corpse, +open/close/reopen, native Monster Parts details showing QL 1, pickup into the +ordinary inventory, empty corpse, page reconnect and server restart. The item +remained visible and owned after both reconnects. A second client joining after +death loaded the corpse with its animated model. Server tests cover rejected +access, failed saves, full inventory, repeated/concurrent pickup, switching +containers and interest reentry. Maintained native source is under `client/game/kkr.dll/`. The functions above use the rebased image addresses; subtract `0x26000000` for original image diff --git a/docs/inventory.md b/docs/inventory.md @@ -15,8 +15,9 @@ including after deleting the last item. Startup takes the maximum across owners. Profile edits and zoning preserve inventory independently of profile fields. Only individual items at an exact catalog quality are supported. Template -endpoints are identical; arbitrary-quality interpolation, stacks, backpacks, -loot and starter loadouts remain separate milestones. QL 1 Kinetic Axe equipment +endpoints are identical; arbitrary-quality interpolation, stacks, backpacks +and starter loadouts remain separate milestones. Native corpse pickup is +described in [the corpse and loot protocol](corpse-loot.md). QL 1 Kinetic Axe equipment is described below; other equipment is not supported yet. ## Native messages @@ -46,12 +47,19 @@ verified with the native WASM icon, tooltip and QL 1 details window. `ContainerAddItem` (`0x47537a24`) carries source page/slot, target owner identity and destination slot. The server accepts only an authenticated current session's own ordinary inventory and an empty destination. It saves before acknowledging -the move. Cross-owner/container transfers are rejected. The supported weapon +the move. Corpse transfers use the validated opened corpse described above; +other cross-owner/container transfers are rejected. The supported weapon also moves between ordinary inventory and the right hand as described below. This layout is corroborated by the local AOtomation `ContainerAddItemMessage` and CellAO `ContainerAddItemMessageHandler` reference sources; it is not the message used by the native same-window visual rearrangement described below. +Corpse-transfer tracing also exposed a slot-range mismatch to reconcile: the +14.9.1 native inventory buffer starts with 80 slots, and next-free placement +searches from slot 48 (`sub_3605FB40`), while server persistence currently uses +64..93. The fixed-item loot check uses an explicit persisted destination, 64. +Verification of the complete native range remains a TODO. + The captured 14.9.1 `CharacterAction` (`0x5e477770`) delete payload is exactly five integers: action 112, page 104, logical slot, low template and high template. It has no intervening unknown field or trailing short from the newer AOtomation diff --git a/server/combat.go b/server/combat.go @@ -243,6 +243,14 @@ func (server *server) advanceCombat(now time.Time) { } server.cancelCombat_locked(target.id, updates) server.queueCombat_locked(updates, target, target, deathPacket(target)) + monster := gamedata.MonsterTemplates[target.monsterData] + if target.npc && monster != nil && len(monster.DeathAnimations) != 0 { + if target.corpse == nil { + target.corpse = &npcCorpse{} + } + target.corpse.looter = attacker.id + server.queueCombat_locked(updates, target, target, corpsePacket(target)) + } } else if target.npc && target.fighting == 0 { server.startAttack_locked(target, attacker, now, updates) } diff --git a/server/gamedata/catalog_test.go b/server/gamedata/catalog_test.go @@ -271,6 +271,21 @@ func TestMonsterCatalogRetainsUnresolvedMeshes(t *testing.T) { } } +func TestMonsterCatalogRetainsDeathAnimationResources(t *testing.T) { + count := 0 + + for _, monster := range gamedata.Monsters { + if len(monster.DeathAnimations) != 0 { + count++ + } + } + + leet := gamedata.MonsterTemplates[17655] + if count != 287 || len(leet.DeathAnimations) != 1 || leet.DeathAnimations[0] != 18107 { + t.Fatal("shipped creature death animations changed") + } +} + func TestMapCoordinatesRetainBinaryProvenance(t *testing.T) { coordinates := gamedata.MapCoordinates diff --git a/server/gamedata/load.go b/server/gamedata/load.go @@ -20,6 +20,7 @@ var ( PopulationSources []*NPCPopulationSource PopulationEvidence NPCExtractionEvidence Monsters []Monster + MonsterTemplates = make(map[uint32]*Monster) Items ItemCatalog ItemTemplates = make(map[uint32]*Item) MapCoordinates MapCoordinateData @@ -38,6 +39,9 @@ func init() { PopulationEvidence = population.NPCExtractionEvidence loadYAML("npc_names.yaml", &NPCNames) loadYAML("monsters.yaml", &Monsters) + for index := range Monsters { + MonsterTemplates[Monsters[index].MonsterData] = &Monsters[index] + } loadYAML("map_coordinates.yaml", &MapCoordinates) loadYAML("terrain_evidence.yaml", &TerrainEvidence) loadYAML("playfields.yaml", &Playfields) diff --git a/server/gamedata/monsters.yaml b/server/gamedata/monsters.yaml @@ -2,6 +2,7 @@ name: protodroid mesh: 15263 mesh_filename: proto_ninjadroid.cir + death_animations: [15621] stats: 12: 15263 421: 3 @@ -15,6 +16,7 @@ name: cyborg soldier - female bader mesh: 82126 mesh_filename: hellsoldier_female.cir + death_animations: [13572] stats: 12: 82126 421: 3 @@ -28,6 +30,7 @@ name: cyborg soldier - male bader mesh: 82133 mesh_filename: hellsoldier_male3.cir + death_animations: [15621] stats: 12: 82133 421: 3 @@ -41,6 +44,7 @@ name: cyborg soldier - felmale bad mesh: 82122 mesh_filename: hellsoldier_female2.cir + death_animations: [13572] stats: 12: 82122 421: 3 @@ -54,6 +58,7 @@ name: cyborg soldier - male mesh: 82128 mesh_filename: hellsoldier_male.cir + death_animations: [15621] stats: 12: 82128 421: 3 @@ -67,6 +72,7 @@ name: cyborg soldier - male bad mesh: 82132 mesh_filename: hellsoldier_male2.cir + death_animations: [15621] stats: 12: 82132 421: 3 @@ -80,6 +86,7 @@ name: cyborg soldier - female mesh: 82126 mesh_filename: hellsoldier_female.cir + death_animations: [13572] stats: 12: 82126 421: 3 @@ -93,6 +100,7 @@ name: android mesh: 15215 mesh_filename: android.cir + death_animations: [17340] stats: 12: 15215 421: 3 @@ -106,6 +114,7 @@ name: anvian mesh: 15218 mesh_filename: anvian.cir + death_animations: [15611] stats: 12: 15218 421: 3 @@ -119,6 +128,7 @@ name: eye mutant mesh: 15224 mesh_filename: eye_mutant.cir + death_animations: [15359] stats: 12: 15224 421: 3 @@ -132,6 +142,7 @@ name: leet mesh: 15222 mesh_filename: cutecreature.cir + death_animations: [18107] stats: 12: 15222 421: 3 @@ -145,6 +156,7 @@ name: flea mesh: 15231 mesh_filename: fleamonster.cir + death_animations: [15368] stats: 12: 15231 421: 3 @@ -158,6 +170,7 @@ name: malle mesh: 15239 mesh_filename: malle.cir + death_animations: [15381] stats: 12: 15239 421: 4 @@ -171,6 +184,7 @@ name: minibronto mesh: 15243 mesh_filename: minibronto.cir + death_animations: [15387] stats: 12: 15243 421: 3 @@ -184,6 +198,7 @@ name: rhinoman mesh: 15266 mesh_filename: rhinoman.cir + death_animations: [15397] stats: 12: 15266 421: 4 @@ -197,6 +212,7 @@ name: rollerrat mesh: 15272 mesh_filename: rollerrat_exp.cir + death_animations: [15409] stats: 12: 15272 421: 3 @@ -210,6 +226,7 @@ name: gofle mesh: 15269 mesh_filename: riding_gofle.cir + death_animations: [17307] stats: 12: 15269 421: 4 @@ -223,6 +240,7 @@ name: skorpiod mesh: 15275 mesh_filename: scorpiod.cir + death_animations: [15421] stats: 12: 15275 421: 3 @@ -236,6 +254,7 @@ name: tentaclo mesh: 15285 mesh_filename: tentaclemutant.cir + death_animations: [15445] stats: 12: 15285 421: 3 @@ -249,6 +268,7 @@ name: wardroid mesh: 15294 mesh_filename: wardroid.cir + death_animations: [15505] stats: 12: 15294 421: 4 @@ -262,6 +282,7 @@ name: wingbag mesh: 15295 mesh_filename: wingdings.cir + death_animations: [15510] stats: 12: 15295 421: 3 @@ -275,6 +296,7 @@ name: breiflabb - badering mesh: 15961 mesh_filename: breiflabb_badering.cir + death_animations: [17330] stats: 12: 15961 421: 3 @@ -288,6 +310,7 @@ name: breiflabb mesh: 15963 mesh_filename: breiflabb_water.cir + death_animations: [17330] stats: 12: 15963 421: 3 @@ -301,6 +324,7 @@ name: stalker mesh: 16069 mesh_filename: stalker.cir + death_animations: [16073] stats: 12: 16069 421: 3 @@ -314,6 +338,7 @@ name: pit lizard mesh: 16777 mesh_filename: pitdragon.cir + death_animations: [16781] stats: 12: 16777 421: 8 @@ -327,6 +352,7 @@ name: sandworm mesh: 17097 mesh_filename: sandworm_01_01.cir + death_animations: [17101] stats: 12: 17097 421: 8 @@ -340,6 +366,7 @@ name: organic waste collector mesh: 17316 mesh_filename: floatingpicker.cir + death_animations: [17320] stats: 12: 17316 421: 3 @@ -353,6 +380,7 @@ name: enigma mesh: 15278 mesh_filename: skinnymutant.cir + death_animations: [17124] stats: 12: 15278 421: 3 @@ -366,6 +394,7 @@ name: mech dog - skin mesh: 15929 mesh_filename: mechdog_skin.cir + death_animations: [15985] stats: 12: 15929 421: 3 @@ -379,6 +408,7 @@ name: hovertech mesh: 20615 mesh_filename: hovertech.cir + death_animations: [30210] stats: 12: 20615 421: 2 @@ -391,6 +421,7 @@ name: ottous mesh: 41131 mesh_filename: ottous.cir + death_animations: [21550] stats: 12: 41131 421: 8 @@ -404,6 +435,7 @@ name: green lizard mesh: 22773 mesh_filename: lizard_green.cir + death_animations: [22776] stats: 12: 22773 421: 4 @@ -417,6 +449,7 @@ name: omni juggernaut mesh: 21082 mesh_filename: juggernaut.cir + death_animations: [21089] stats: 12: 21082 421: 10 @@ -430,6 +463,7 @@ name: yuttos hearder mesh: 21499 mesh_filename: yuttos.cir + death_animations: [21560] stats: 12: 21499 421: 3 @@ -443,6 +477,7 @@ name: t-droid mesh: 20956 mesh_filename: t-droid.cir + death_animations: [21489] stats: 12: 20956 421: 3 @@ -456,6 +491,7 @@ name: omni slayer droid mesh: 21715 mesh_filename: omni_slayerdroid.cir + death_animations: [21722] stats: 12: 21715 421: 3 @@ -469,6 +505,7 @@ name: medusa mesh: 25771 mesh_filename: medusa.cir + death_animations: [25775] stats: 12: 25771 421: 3 @@ -482,6 +519,7 @@ name: solitus fat male mesh: 17532 mesh_filename: solitus_male_fat.cir + death_animations: [15621] stats: 12: 17532 64: 40691 @@ -496,6 +534,7 @@ name: solitus thin female mesh: 17530 mesh_filename: solitus_female_thin.cir + death_animations: [13572] stats: 12: 17530 64: 40635 @@ -510,6 +549,7 @@ name: solitus fat female robe mesh: 17917 mesh_filename: solitus_female_fat_robe.cir + death_animations: [13572] stats: 12: 17917 64: 40636 @@ -524,6 +564,7 @@ name: solitus thin female robe mesh: 17921 mesh_filename: solitus_female_thin_robe.cir + death_animations: [13572] stats: 12: 17921 64: 40637 @@ -538,6 +579,7 @@ name: solitus fat female mesh: 17528 mesh_filename: solitus_female_fat.cir + death_animations: [13572] stats: 12: 17528 64: 40634 @@ -552,6 +594,7 @@ name: solitus thin male robe mesh: 17872 mesh_filename: solitus_male_thin_robe.cir + death_animations: [15621] stats: 12: 17872 64: 40689 @@ -566,6 +609,7 @@ name: solitus fat male robe mesh: 17867 mesh_filename: solitus_male_fat_robe.cir + death_animations: [15621] stats: 12: 17867 64: 40688 @@ -580,6 +624,7 @@ name: solitus thin male mesh: 17534 mesh_filename: solitus_male_thin.cir + death_animations: [15621] stats: 12: 17534 64: 40687 @@ -594,6 +639,7 @@ name: solitus female mesh: 5927 mesh_filename: solitus_female.cir + death_animations: [13572] stats: 12: 5927 64: 40629 @@ -608,6 +654,7 @@ name: solitus male mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40694 @@ -622,6 +669,7 @@ name: atrox thin male robe mesh: 23367 mesh_filename: athrox_male_thin_robe.cir + death_animations: [9981] stats: 12: 23367 64: 40107 @@ -636,6 +684,7 @@ name: atrox male mesh: 5900 mesh_filename: athrox_male.cir + death_animations: [9981] stats: 12: 5900 64: 40111 @@ -650,6 +699,7 @@ name: atrox fat male robe mesh: 23364 mesh_filename: athrox_male_fat_robe.cir + death_animations: [9981] stats: 12: 23364 64: 40106 @@ -664,6 +714,7 @@ name: atrox thin male mesh: 23366 mesh_filename: athrox_male_thin.cir + death_animations: [9981] stats: 12: 23366 64: 40105 @@ -678,6 +729,7 @@ name: atrox fat male mesh: 23365 mesh_filename: athrox_male_fat.cir + death_animations: [9981] stats: 12: 23365 64: 40103 @@ -692,6 +744,7 @@ name: opifex thin female robe mesh: 23375 mesh_filename: opifex_female_thin_robe.cir + death_animations: [13572] stats: 12: 23375 64: 40217 @@ -706,6 +759,7 @@ name: opifex fat female mesh: 23373 mesh_filename: opifex_female_fat.cir + death_animations: [13572] stats: 12: 23373 64: 40214 @@ -720,6 +774,7 @@ name: opifex thin female mesh: 23374 mesh_filename: opifex_female_thin.cir + death_animations: [13572] stats: 12: 23374 64: 40215 @@ -734,6 +789,7 @@ name: opifex fat female robe mesh: 23372 mesh_filename: opifex_female_fat_robe.cir + death_animations: [13572] stats: 12: 23372 64: 40216 @@ -748,6 +804,7 @@ name: opifex thin male robe mesh: 23379 mesh_filename: opifex_male_thin_robe.cir + death_animations: [15621] stats: 12: 23379 64: 40254 @@ -762,6 +819,7 @@ name: opifex fat male robe mesh: 23376 mesh_filename: opifex_male_fat_robe.cir + death_animations: [15621] stats: 12: 23376 64: 40253 @@ -776,6 +834,7 @@ name: opifex fat male mesh: 23377 mesh_filename: opifex_male_fat.cir + death_animations: [15621] stats: 12: 23377 64: 40251 @@ -790,6 +849,7 @@ name: opifex thin male mesh: 23378 mesh_filename: opifex_male_thin.cir + death_animations: [15621] stats: 12: 23378 64: 40252 @@ -804,6 +864,7 @@ name: opifex female mesh: 5934 mesh_filename: opifex_female.cir + death_animations: [13572] stats: 12: 5934 64: 40209 @@ -818,6 +879,7 @@ name: opifex male mesh: 5914 mesh_filename: opifex_male.cir + death_animations: [15621] stats: 12: 5914 64: 40249 @@ -832,6 +894,7 @@ name: nano fat male robe mesh: 17907 mesh_filename: nanomage_male_fat_robe.cir + death_animations: [15621] stats: 12: 17907 64: 40174 @@ -846,6 +909,7 @@ name: nano fat female mesh: 23368 mesh_filename: nanomage_female_fat.cir + death_animations: [13572] stats: 12: 23368 64: 40137 @@ -860,6 +924,7 @@ name: nano fat female robe mesh: 23369 mesh_filename: nanomage_female_fat_robe.cir + death_animations: [13572] stats: 12: 23369 64: 40139 @@ -874,6 +939,7 @@ name: nano fat male mesh: 17905 mesh_filename: nanomage_male_fat.cir + death_animations: [15621] stats: 12: 17905 64: 40172 @@ -888,6 +954,7 @@ name: nano female mesh: 5941 mesh_filename: nanomage_female.cir + death_animations: [13572] stats: 12: 5941 64: 40151 @@ -902,6 +969,7 @@ name: nano male mesh: 5921 mesh_filename: nanomage_male.cir + death_animations: [15621] stats: 12: 5921 64: 40171 @@ -916,6 +984,7 @@ name: nano thin female robe mesh: 23371 mesh_filename: nanomage_female_thin_robe.cir + death_animations: [13572] stats: 12: 23371 64: 40140 @@ -930,6 +999,7 @@ name: nano thin female mesh: 23370 mesh_filename: nanomage_female_thin.cir + death_animations: [13572] stats: 12: 23370 64: 40138 @@ -944,6 +1014,7 @@ name: nano thin male robe mesh: 17911 mesh_filename: nanomage_male_thin_robe.cir + death_animations: [15621] stats: 12: 17911 64: 40175 @@ -958,6 +1029,7 @@ name: nano thin male mesh: 17909 mesh_filename: nanomage_male_thin.cir + death_animations: [15621] stats: 12: 17909 64: 40173 @@ -972,6 +1044,7 @@ name: placeholder monster mesh: 26884 mesh_filename: default_monster.cir + death_animations: [26888] stats: 12: 26884 421: 3 @@ -984,6 +1057,7 @@ name: primitive medusa mesh: 32284 mesh_filename: fourarmmutant.cir + death_animations: [32289] stats: 12: 32284 421: 3 @@ -997,6 +1071,7 @@ name: giant snake mesh: 23353 mesh_filename: giant_snake.cir + death_animations: [23356] stats: 12: 23353 421: 4 @@ -1010,6 +1085,7 @@ name: biofreak noskin mesh: 29973 mesh_filename: biofreak_noskin.cir + death_animations: [29979] stats: 12: 29973 421: 2 @@ -1022,6 +1098,7 @@ name: swampghoul mesh: 18125 mesh_filename: swampghoul.cir + death_animations: [18142] stats: 12: 18125 421: 3 @@ -1035,6 +1112,7 @@ name: bronto mama mesh: 29948 mesh_filename: bronto_mama.cir + death_animations: [29956] stats: 12: 29948 421: 8 @@ -1048,6 +1126,7 @@ name: wolf zweikopf mesh: 29902 mesh_filename: wulf_zweikopf.cir + death_animations: [29907] stats: 12: 29902 421: 3 @@ -1061,6 +1140,7 @@ name: soldiervine mesh: 18217 mesh_filename: soldiervine_male.cir + death_animations: [15621] stats: 12: 18217 421: 3 @@ -1074,6 +1154,7 @@ name: scavenger dog mesh: 25783 mesh_filename: scavenger_dog.cir + death_animations: [25786] stats: 12: 25783 421: 3 @@ -1087,6 +1168,7 @@ name: salamander mesh: 23344 mesh_filename: salamander.cir + death_animations: [25855] stats: 12: 23344 421: 4 @@ -1100,6 +1182,7 @@ name: sabretooth mesh: 29878 mesh_filename: sabretooth.cir + death_animations: [29886] stats: 12: 29878 421: 3 @@ -1113,6 +1196,7 @@ name: nokken mesh: 29918 mesh_filename: nokken.cir + death_animations: [29937] stats: 12: 29918 421: 8 @@ -1126,6 +1210,7 @@ name: minibull mesh: 26904 mesh_filename: minibull.cir + death_animations: [26907] stats: 12: 26904 421: 3 @@ -1139,6 +1224,7 @@ name: deathbird mesh: 25746 mesh_filename: deathbird.cir + death_animations: [25750] stats: 12: 25746 421: 3 @@ -1152,6 +1238,7 @@ name: cute birdy mesh: 25733 mesh_filename: cute_birdy.cir + death_animations: [25736] stats: 12: 25733 421: 3 @@ -1165,6 +1252,7 @@ name: aquaan mesh: 25717 mesh_filename: aquaan.cir + death_animations: [25721] stats: 12: 25717 421: 3 @@ -1178,6 +1266,7 @@ name: aquaan queen mesh: 25836 mesh_filename: aquaan_queen.cir + death_animations: [25840] stats: 12: 25836 421: 3 @@ -1191,6 +1280,7 @@ name: mutant mantis mesh: 25758 mesh_filename: mutant_mantis.cir + death_animations: [25762] stats: 12: 25758 421: 3 @@ -1204,6 +1294,7 @@ name: stone plant mesh: 25869 mesh_filename: stone_plant.cir + death_animations: [25878] stats: 12: 25869 421: 3 @@ -1217,6 +1308,7 @@ name: skin spider mesh: 26978 mesh_filename: skin_spider.cir + death_animations: [26981] stats: 12: 26978 421: 4 @@ -1230,6 +1322,7 @@ name: hammerbeast mesh: 23331 mesh_filename: hammerbeast.cir + death_animations: [23335] stats: 12: 23331 421: 4 @@ -1243,6 +1336,7 @@ name: shadowmutant plain mesh: 30434 mesh_filename: shadow_mutant_plain.cir + death_animations: [43055] stats: 12: 30434 421: 3 @@ -1256,6 +1350,7 @@ name: rhinoman female mesh: 31102 mesh_filename: rhinoman_female.cir + death_animations: [15397] stats: 12: 31102 421: 3 @@ -1269,6 +1364,7 @@ name: desert eremite mesh: 31722 mesh_filename: desert_eremite.cir + death_animations: [31753] stats: 12: 31722 421: 5 @@ -1282,6 +1378,7 @@ name: bileswarm colossus mesh: 31870 mesh_filename: bileswarm_colossus.cir + death_animations: [31877] stats: 12: 31870 421: 3 @@ -1295,6 +1392,7 @@ name: bileswarm worker mesh: 31868 mesh_filename: bileswarm_worker.cir + death_animations: [31888] stats: 12: 31868 421: 3 @@ -1308,6 +1406,7 @@ name: sewer snake mesh: 32363 mesh_filename: sewersnake.cir + death_animations: [32376] stats: 12: 32363 421: 3 @@ -1321,6 +1420,7 @@ name: enigma floatpot mesh: 38222 mesh_filename: enigmas_floatpot.cir + death_animations: [38234] stats: 12: 38222 421: 3 @@ -1334,6 +1434,7 @@ name: drill tentacle mesh: 38200 mesh_filename: drill_tentacle.cir + death_animations: [38208] stats: 12: 38200 421: 3 @@ -1347,6 +1448,7 @@ name: clawfinger mesh: 38188 mesh_filename: clawfinger.cir + death_animations: [29979] stats: 12: 38188 421: 3 @@ -1360,6 +1462,7 @@ name: anun mesh: 38356 mesh_filename: anun.cir + death_animations: [38362] stats: 12: 38356 421: 3 @@ -1373,6 +1476,7 @@ name: nanofreak mesh: 38265 mesh_filename: nano_freak.cir + death_animations: [38274] stats: 12: 38265 421: 3 @@ -1386,6 +1490,7 @@ name: pixie mesh: 38284 mesh_filename: anvian_red.cir + death_animations: [38288] stats: 12: 38284 421: 3 @@ -1399,6 +1504,7 @@ name: autospymole mesh: 39887 mesh_filename: autopsymole.cir + death_animations: [39892] stats: 12: 39887 421: 3 @@ -1412,6 +1518,7 @@ name: wing carrion mesh: 39981 mesh_filename: wing_carrion.cir + death_animations: [39988] stats: 12: 39981 421: 3 @@ -1425,6 +1532,7 @@ name: rollerrat queen mesh: 39965 mesh_filename: rollerrat_queen.cir + death_animations: [15409] stats: 12: 39965 421: 3 @@ -1438,6 +1546,7 @@ name: babyface mesh: 39949 mesh_filename: babyface.cir + death_animations: [39956] stats: 12: 39949 421: 3 @@ -1451,6 +1560,7 @@ name: shark mesh: 39967 mesh_filename: shark.cir + death_animations: [39972] stats: 12: 39967 421: 3 @@ -1463,6 +1573,7 @@ name: gunbeetle mesh: 40043 mesh_filename: gunbeetle.cir + death_animations: [40047] stats: 12: 40043 421: 3 @@ -1476,6 +1587,7 @@ name: enigma dog mesh: 39933 mesh_filename: enigmas_dog.cir + death_animations: [39938] stats: 12: 39933 421: 3 @@ -1489,6 +1601,7 @@ name: cannon mesh: 39925 mesh_filename: cannon.cir + death_animations: [39930] stats: 12: 39925 421: 3 @@ -1502,6 +1615,7 @@ name: blubbag mesh: 39900 mesh_filename: blubbag.cir + death_animations: [39916] stats: 12: 39900 421: 3 @@ -1515,6 +1629,7 @@ name: gator mesh: 40415 mesh_filename: gator.cir + death_animations: [40450] stats: 12: 40415 421: 3 @@ -1528,6 +1643,7 @@ name: organic entrailer mesh: 40420 mesh_filename: entrailer.cir + death_animations: [40428] stats: 12: 40420 421: 3 @@ -1541,6 +1657,7 @@ name: carrion mesh: 40411 mesh_filename: carrion.cir + death_animations: [40439] stats: 12: 40411 421: 3 @@ -1554,6 +1671,7 @@ name: desert aquaan mesh: 40495 mesh_filename: desertaquaan.cir + death_animations: [40502] stats: 12: 40495 421: 3 @@ -1567,6 +1685,7 @@ name: athrox male robe mesh: 17899 mesh_filename: athrox_male_robe.cir + death_animations: [9981] stats: 12: 17899 64: 40124 @@ -1579,6 +1698,7 @@ name: nano female robe mesh: 17901 mesh_filename: nanomage_female_robe.cir + death_animations: [13572] stats: 12: 17901 64: 40152 @@ -1591,6 +1711,7 @@ name: nano male robe mesh: 17903 mesh_filename: nanomage_male_robe.cir + death_animations: [15621] stats: 12: 17903 64: 40187 @@ -1603,6 +1724,7 @@ name: opifex male robe mesh: 17915 mesh_filename: opifex_male_robe.cir + death_animations: [15621] stats: 12: 17915 64: 40259 @@ -1615,6 +1737,7 @@ name: opifex female robe mesh: 17913 mesh_filename: opifex_female_robe.cir + death_animations: [13572] stats: 12: 17913 64: 40236 @@ -1627,6 +1750,7 @@ name: solitus female robe mesh: 17919 mesh_filename: solitus_female_robe.cir + death_animations: [13572] stats: 12: 17919 64: 40651 @@ -1639,6 +1763,7 @@ name: solitus male robe mesh: 17870 mesh_filename: solitus_male_robe.cir + death_animations: [15621] stats: 12: 17870 64: 40696 @@ -1651,6 +1776,7 @@ name: human mantis mesh: 41340 mesh_filename: human_mantis.cir + death_animations: [41351] stats: 12: 41340 421: 3 @@ -1664,6 +1790,7 @@ name: battlesuit-wearing character mesh: 41416 mesh_filename: battlersuit.cir + death_animations: [9981] stats: 12: 41416 421: 2 @@ -1675,6 +1802,7 @@ name: skeleton solitus mesh: 41664 mesh_filename: skeleton_solitus.cir + death_animations: [15621] stats: 12: 41664 421: 3 @@ -1688,6 +1816,7 @@ name: skeleton solitus illuminated mesh: 41667 mesh_filename: skeleton_solitus_illum.cir + death_animations: [15621] stats: 12: 41667 421: 3 @@ -1701,6 +1830,7 @@ name: humongous baraton mesh: 41659 mesh_filename: baraton.cir + death_animations: [41670] stats: 12: 41659 421: 12 @@ -1714,6 +1844,7 @@ name: skeleton atrox illuminated mesh: 42953 mesh_filename: skeleton_athrox_illum.cir + death_animations: [9981] stats: 12: 42953 421: 3 @@ -1727,6 +1858,7 @@ name: mutant king mesh: 42886 mesh_filename: mutantking.cir + death_animations: [42890] stats: 12: 42886 421: 3 @@ -1740,6 +1872,7 @@ name: skeleton atrox mesh: 42952 mesh_filename: skeleton_athrox.cir + death_animations: [9981] stats: 12: 42952 421: 3 @@ -1753,6 +1886,7 @@ name: buckethead mesh: 43335 mesh_filename: buckethead.cir + death_animations: [43341] stats: 12: 43335 421: 3 @@ -1766,6 +1900,7 @@ name: unfinished breed failed mesh: 44141 mesh_filename: unfinished-breed_failed.cir + death_animations: [15621] stats: 12: 44141 421: 2 @@ -1777,6 +1912,7 @@ name: unfinished breed mesh: 41432 mesh_filename: unfinished-breed.cir + death_animations: [15621] stats: 12: 41432 421: 2 @@ -1788,6 +1924,7 @@ name: pony mesh: 45826 mesh_filename: pony.cir + death_animations: [45833] stats: 12: 45826 64: 0 @@ -1802,6 +1939,7 @@ name: enigma tree mesh: 45843 mesh_filename: enigmas_trees.cir + death_animations: [45849] stats: 12: 45843 64: 0 @@ -1816,6 +1954,7 @@ name: junkbot mesh: 45857 mesh_filename: junkbot.cir + death_animations: [45862] stats: 12: 45857 64: 0 @@ -1830,6 +1969,7 @@ name: buzzsaw mesh: 45809 mesh_filename: buzzsaw.cir + death_animations: [45815] stats: 12: 45809 64: 0 @@ -1844,6 +1984,7 @@ name: mutant king tentacle mesh: 45795 mesh_filename: mutantkings_tentacle.cir + death_animations: [45801] stats: 12: 45795 64: 0 @@ -1858,6 +1999,7 @@ name: alienpod mesh: 31764 mesh_filename: alienpod.cir + death_animations: [31767] stats: 12: 31764 421: 3 @@ -1871,6 +2013,7 @@ name: alienpod spider mesh: 31774 mesh_filename: alienpod_spider.cir + death_animations: [31785] stats: 12: 31774 421: 3 @@ -1884,6 +2027,7 @@ name: stankel mesh: 85335 mesh_filename: stankel.cir + death_animations: [85342] stats: 12: 85335 64: 0 @@ -1898,6 +2042,7 @@ name: dragonclaw mesh: 95294 mesh_filename: dragonclaw.cir + death_animations: [95300] stats: 12: 95294 64: 0 @@ -1912,6 +2057,7 @@ name: helium_blorrg mesh: 95310 mesh_filename: helium_blorrg.cir + death_animations: [95317] stats: 12: 95310 64: 0 @@ -1926,6 +2072,7 @@ name: puko mesh: 95326 mesh_filename: puko.cir + death_animations: [95340] stats: 12: 95326 64: 0 @@ -1940,6 +2087,7 @@ name: puko_cloakedrider mesh: 95263 mesh_filename: puko_cloakedrider.cir + death_animations: [95268] stats: 12: 95263 64: 0 @@ -1954,6 +2102,7 @@ name: piranha mesh: 93019 mesh_filename: piranha.cir + death_animations: [93025] stats: 12: 93019 64: 0 @@ -1967,6 +2116,7 @@ name: rockmonster mesh: 95368 mesh_filename: rockmonster.cir + death_animations: [95374] stats: 12: 95368 64: 0 @@ -1981,6 +2131,7 @@ name: duschbag mesh: 95388 mesh_filename: duschbag.cir + death_animations: [95433] stats: 12: 95388 64: 0 @@ -1995,6 +2146,7 @@ name: galway mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 29714 @@ -2009,6 +2161,7 @@ name: protocol droid mesh: 96024 mesh_filename: protocol_droid.cir + death_animations: [15621] stats: 12: 96024 64: 0 @@ -2023,6 +2176,7 @@ name: metapet heal mesh: 96179 mesh_filename: metapet_heal.cir + death_animations: [96184] stats: 12: 96179 64: 0 @@ -2037,6 +2191,7 @@ name: metapet stun mesh: 96181 mesh_filename: metapet_stun.cir + death_animations: [96184] stats: 12: 96181 64: 0 @@ -2051,6 +2206,7 @@ name: metapet combat mesh: 96177 mesh_filename: metapet_combat.cir + death_animations: [96184] stats: 12: 96177 64: 0 @@ -2065,6 +2221,7 @@ name: hover boat ferry mesh: 70267 mesh_filename: hover_boat_ferry_cat.cir + death_animations: [99419] stats: 12: 70267 421: 2 @@ -2076,6 +2233,7 @@ name: light oneman sportscraft mesh: 99458 mesh_filename: light_1man_sportscraft_cat.cir + death_animations: [99465] stats: 12: 99458 421: 2 @@ -2087,6 +2245,7 @@ name: omni-pol gunship mesh: 96083 mesh_filename: omni_pol_gunship_cat.cir + death_animations: [99448] stats: 12: 96083 64: 0 @@ -2101,6 +2260,7 @@ name: sleek vehicle mesh: 42370 mesh_filename: sleek_vehicle_cat.cir + death_animations: [99428] stats: 12: 42370 421: 2 @@ -2112,6 +2272,7 @@ name: grid default character mesh: 99894 mesh_filename: grid_default_character.cir + death_animations: [99899] stats: 12: 99894 64: 0 @@ -2126,6 +2287,7 @@ name: doppelgripper mesh: 100399 mesh_filename: doppelgripper.cir + death_animations: [100416] stats: 12: 100399 64: 0 @@ -2140,6 +2302,7 @@ name: home priest mesh: 17872 mesh_filename: solitus_male_thin_robe.cir + death_animations: [15621] stats: 12: 17872 64: 116711 @@ -2154,6 +2317,7 @@ name: home guard mesh: 17532 mesh_filename: solitus_male_fat.cir + death_animations: [15621] stats: 12: 17532 64: 116708 @@ -2168,6 +2332,7 @@ name: home shopkeeper mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 116705 @@ -2182,6 +2347,7 @@ name: solomonne mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 29717 @@ -2194,6 +2360,7 @@ name: simon silverstone mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 31708 @@ -2206,6 +2373,7 @@ name: alistair kolokotronis mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 31698 @@ -2218,6 +2386,7 @@ name: eleena oak mesh: 17530 mesh_filename: solitus_female_thin.cir + death_animations: [13572] stats: 12: 17530 64: 31690 @@ -2230,6 +2399,7 @@ name: eva pourais mesh: 17530 mesh_filename: solitus_female_thin.cir + death_animations: [13572] stats: 12: 17530 64: 31692 @@ -2242,6 +2412,7 @@ name: henry radiman mesh: 5921 mesh_filename: nanomage_male.cir + death_animations: [15621] stats: 12: 5921 64: 31686 @@ -2254,6 +2425,7 @@ name: ivan sergeyich mesh: 17532 mesh_filename: solitus_male_fat.cir + death_animations: [15621] stats: 12: 17532 64: 31700 @@ -2266,6 +2438,7 @@ name: max mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 31704 @@ -2278,6 +2451,7 @@ name: phillip ross mesh: 17534 mesh_filename: solitus_male_thin.cir + death_animations: [15621] stats: 12: 17534 64: 31706 @@ -2290,6 +2464,7 @@ name: rita prestin mesh: 17530 mesh_filename: solitus_female_thin.cir + death_animations: [13572] stats: 12: 17530 64: 31694 @@ -2302,6 +2477,7 @@ name: ruth montezuma mesh: 17530 mesh_filename: solitus_female_thin.cir + death_animations: [13572] stats: 12: 17530 64: 31696 @@ -2314,6 +2490,7 @@ name: sally mintona mesh: 5934 mesh_filename: opifex_female.cir + death_animations: [13572] stats: 12: 5934 64: 31688 @@ -2326,6 +2503,7 @@ name: tucker mesh: 23365 mesh_filename: athrox_male_fat.cir + death_animations: [9981] stats: 12: 23365 64: 31685 @@ -2338,6 +2516,7 @@ name: joshua kahn mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 31702 @@ -2350,6 +2529,7 @@ name: colonel frank kaehler mesh: 17870 mesh_filename: solitus_male_robe.cir + death_animations: [15621] stats: 12: 17870 64: 40666 @@ -2362,6 +2542,7 @@ name: elian zuwadza mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40672 @@ -2374,6 +2555,7 @@ name: command kelly frederickson mesh: 17917 mesh_filename: solitus_female_fat_robe.cir + death_animations: [13572] stats: 12: 17917 64: 40623 @@ -2386,6 +2568,7 @@ name: jack legchopper menendez mesh: 5900 mesh_filename: athrox_male.cir + death_animations: [9981] stats: 12: 5900 64: 40107 @@ -2398,6 +2581,7 @@ name: daria marie walzer mesh: 17530 mesh_filename: solitus_female_thin.cir + death_animations: [13572] stats: 12: 17530 64: 40663 @@ -2410,6 +2594,7 @@ name: tri plumbo mesh: 152493 mesh_filename: tri-plumbo.cir + death_animations: [152496] stats: 12: 152493 64: 0 @@ -2424,6 +2609,7 @@ name: pumpkinman mesh: 154106 mesh_filename: pumpkinman.cir + death_animations: [154119] stats: 12: 154106 64: 0 @@ -2438,6 +2624,7 @@ name: ninjadroid boss mesh: 154695 mesh_filename: proto_ninjadroid_boss.cir + death_animations: [15621] stats: 12: 154695 64: 0 @@ -2452,6 +2639,7 @@ name: rhinoman albino mesh: 155068 mesh_filename: rhinoman_albino.cir + death_animations: [15397] stats: 12: 155068 64: 0 @@ -2466,6 +2654,7 @@ name: abmouth mesh: 155548 mesh_filename: abmouth.cir + death_animations: [155561] stats: 12: 155548 64: 0 @@ -2480,6 +2669,7 @@ name: argilecrawler mesh: 156217 mesh_filename: argilecrawler.cir + death_animations: [156221] stats: 12: 156217 64: 0 @@ -2494,6 +2684,7 @@ name: test-ick-el mesh: 32284 mesh_filename: fourarmmutant.cir + death_animations: [32289] stats: 12: 32284 64: 0 @@ -2508,6 +2699,7 @@ name: leet2 mesh: 157177 mesh_filename: cutecreature_spesial.cir + death_animations: [18107] stats: 12: 157177 64: 0 @@ -2522,6 +2714,7 @@ name: mantis boss mesh: 157311 mesh_filename: mantis-boss.cir + death_animations: [157314] stats: 12: 157311 421: 4 @@ -2535,6 +2728,7 @@ name: tarasque mesh: 158150 mesh_filename: dragon_.cir + death_animations: [158155] stats: 12: 158150 64: 0 @@ -2549,6 +2743,7 @@ name: morganlefaye mesh: 158105 mesh_filename: whippergirl.cir + death_animations: [158108] stats: 12: 158105 64: 0 @@ -2563,6 +2758,7 @@ name: atrox thin male pilot mesh: 23366 mesh_filename: athrox_male_thin.cir + death_animations: [9981] stats: 12: 23366 64: 40105 @@ -2576,6 +2772,7 @@ name: atrox thin male brute mesh: 23366 mesh_filename: athrox_male_thin.cir + death_animations: [9981] stats: 12: 23366 64: 40105 @@ -2589,6 +2786,7 @@ name: solitus thin female brute mesh: 17530 mesh_filename: solitus_female_thin.cir + death_animations: [13572] stats: 12: 17530 64: 40642 @@ -2602,6 +2800,7 @@ name: atrox energy boss mesh: 159384 mesh_filename: athrox_energy_boss.cir + death_animations: [9981] stats: 12: 159384 64: 0 @@ -2616,6 +2815,7 @@ name: solitusfemale_ah_oldlady mesh: 17917 mesh_filename: solitus_female_fat_robe.cir + death_animations: [13572] stats: 12: 17917 64: 40660 @@ -2630,6 +2830,7 @@ name: solitusfemale_ah_asiantraveller mesh: 17919 mesh_filename: solitus_female_robe.cir + death_animations: [13572] stats: 12: 17919 64: 40624 @@ -2644,6 +2845,7 @@ name: solitusfemale_ah_traveller mesh: 17917 mesh_filename: solitus_female_fat_robe.cir + death_animations: [13572] stats: 12: 17917 64: 40628 @@ -2658,6 +2860,7 @@ name: solitusfemale_ah_youngwoman mesh: 5927 mesh_filename: solitus_female.cir + death_animations: [13572] stats: 12: 5927 64: 40648 @@ -2672,6 +2875,7 @@ name: solitusmale_ah_boredtraveller mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40666 @@ -2686,6 +2890,7 @@ name: solitusmale_ah_clanrecruiter mesh: 17530 mesh_filename: solitus_female_thin.cir + death_animations: [15621] stats: 12: 17530 64: 40661 @@ -2699,6 +2904,7 @@ name: solitusmale_ah_excitedkid mesh: 17532 mesh_filename: solitus_male_fat.cir + death_animations: [15621] stats: 12: 17532 64: 40700 @@ -2713,6 +2919,7 @@ name: solitusmale_ah_helpfulcolonist mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40710 @@ -2727,6 +2934,7 @@ name: solitusmale_ah_merchant mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40681 @@ -2741,6 +2949,7 @@ name: solitusmale_ah_middleagedguy mesh: 17532 mesh_filename: solitus_male_fat.cir + death_animations: [15621] stats: 12: 17532 64: 40687 @@ -2755,6 +2964,7 @@ name: solitusmale_ah_neutralobserver mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40690 @@ -2769,6 +2979,7 @@ name: solitusmale_ah_omniimmigrofficer mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40680 @@ -2783,6 +2994,7 @@ name: opifexmale_ah_cleaningtech3 mesh: 23377 mesh_filename: opifex_male_fat.cir + death_animations: [15621] stats: 12: 23377 64: 40247 @@ -2797,6 +3009,7 @@ name: opifexmale_ah_colonist mesh: 5914 mesh_filename: opifex_male.cir + death_animations: [15621] stats: 12: 5914 64: 40267 @@ -2811,6 +3024,7 @@ name: nanofemale_ah_curiouscolonist mesh: 5941 mesh_filename: nanomage_female.cir + death_animations: [13572] stats: 12: 5941 64: 40158 @@ -2825,6 +3039,7 @@ name: atroxmale_ah_cleaningtech2 mesh: 5900 mesh_filename: athrox_male.cir + death_animations: [9981] stats: 12: 5900 64: 40130 @@ -2839,6 +3054,7 @@ name: atroxmale_ah_cleaningtehnician mesh: 5900 mesh_filename: athrox_male.cir + death_animations: [9981] stats: 12: 5900 64: 40118 @@ -2853,6 +3069,7 @@ name: atroxmale_ah_colonist mesh: 5900 mesh_filename: athrox_male.cir + death_animations: [9981] stats: 12: 5900 64: 40117 @@ -2866,6 +3083,7 @@ name: solitusmale_ah_clan recruiter mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40679 @@ -2880,6 +3098,7 @@ name: atroxmale_ah_oldgeezer mesh: 5900 mesh_filename: athrox_male.cir + death_animations: [9981] stats: 12: 5900 64: 40116 @@ -2894,6 +3113,7 @@ name: land control tower 1 mesh: 201342 mesh_filename: tower_controller_HL_01_01.cir + death_animations: [204122] stats: 12: 201342 64: 0 @@ -2921,6 +3141,7 @@ name: lctower_buff_big mesh: 201337 mesh_filename: tower_buff.cir + death_animations: [201541] stats: 12: 201337 64: 0 @@ -2936,6 +3157,7 @@ name: lctower_guard_small mesh: 201417 mesh_filename: tower_guard_LL_01_01.cir + death_animations: [201439] stats: 12: 201417 64: 0 @@ -2951,6 +3173,7 @@ name: lctower_buff_small mesh: 201340 mesh_filename: tower_buff_ll.cir + death_animations: [201551] stats: 12: 201340 64: 0 @@ -2966,6 +3189,7 @@ name: lctower_guard_big mesh: 201330 mesh_filename: tower_guard_HL_01_01.cir + death_animations: [201430] stats: 12: 201330 64: 0 @@ -2981,6 +3205,7 @@ name: lctower_controller_small mesh: 201345 mesh_filename: tower_controller_LL_01_01.cir + death_animations: [204123] stats: 12: 201345 64: 0 @@ -2996,6 +3221,7 @@ name: lctower_controller_big mesh: 201342 mesh_filename: tower_controller_HL_01_01.cir + death_animations: [204122] stats: 12: 201342 64: 0 @@ -3011,6 +3237,7 @@ name: lctower_debuff_small mesh: 201334 mesh_filename: tower_debuff_ll.cir + death_animations: [201573] stats: 12: 201334 64: 0 @@ -3026,6 +3253,7 @@ name: lctower_debuff_big mesh: 201322 mesh_filename: tower_debuff.cir + death_animations: [201563] stats: 12: 201322 64: 0 @@ -3041,6 +3269,7 @@ name: lctower_service_small mesh: 201683 mesh_filename: servicepet_lowlevel.cir + death_animations: [201670] stats: 12: 201683 64: 0 @@ -3056,6 +3285,7 @@ name: lctower_service_big mesh: 201651 mesh_filename: servicepet.cir + death_animations: [201670] stats: 12: 201651 64: 0 @@ -3071,6 +3301,7 @@ name: yalmaha_executive mesh: 201481 mesh_filename: yalm2_01_01.cir + death_animations: [201491] stats: 12: 201481 64: 0 @@ -3086,6 +3317,7 @@ name: yalmaha cooler mesh: 202916 mesh_filename: yalm2_cooler.cir + death_animations: [201491] stats: 12: 202916 64: 0 @@ -3101,6 +3333,7 @@ name: yalmaha flaming mesh: 202917 mesh_filename: yalm2_flame1.cir + death_animations: [201491] stats: 12: 202917 64: 0 @@ -3116,6 +3349,7 @@ name: yalmaha - second flaming mesh: 202915 mesh_filename: yalm2_flame2.cir + death_animations: [201491] stats: 12: 202915 64: 0 @@ -3131,6 +3365,7 @@ name: yalmaha regular mesh: 202919 mesh_filename: yalm2_regular.cir + death_animations: [201491] stats: 12: 202919 64: 0 @@ -3146,6 +3381,7 @@ name: yalmaha sleek red mesh: 203288 mesh_filename: null + death_animations: [99428] stats: 12: 203288 64: 0 @@ -3161,6 +3397,7 @@ name: yalmaha sleek yellow mesh: 203290 mesh_filename: null + death_animations: [99428] stats: 12: 203290 64: 0 @@ -3176,6 +3413,7 @@ name: high commander hoover mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40675 @@ -3190,6 +3428,7 @@ name: eumenides mesh: 17905 mesh_filename: nanomage_male_fat.cir + death_animations: [15621] stats: 12: 17905 64: 29708 @@ -3204,6 +3443,7 @@ name: premature pattern mesh: 5941 mesh_filename: nanomage_female.cir + death_animations: [13572] stats: 12: 5941 64: 29699 @@ -3218,6 +3458,7 @@ name: incomplete rebuild mesh: 5921 mesh_filename: nanomage_male.cir + death_animations: [15621] stats: 12: 5921 64: 29694 @@ -3232,6 +3473,7 @@ name: fragmented soul mesh: 5921 mesh_filename: nanomage_male.cir + death_animations: [15621] stats: 12: 5921 64: 29706 @@ -3246,6 +3488,7 @@ name: neural burnout mesh: 5941 mesh_filename: nanomage_female.cir + death_animations: [13572] stats: 12: 5941 64: 29702 @@ -3260,6 +3503,7 @@ name: empty shell mesh: 5941 mesh_filename: nanomage_female.cir + death_animations: [13572] stats: 12: 5941 64: 29696 @@ -3274,6 +3518,7 @@ name: violent vagabond(robe) mesh: 17870 mesh_filename: solitus_male_robe.cir + death_animations: [15621] stats: 12: 17870 64: 40676 @@ -3288,6 +3533,7 @@ name: mugger mesh: 17534 mesh_filename: solitus_male_thin.cir + death_animations: [15621] stats: 12: 17534 64: 40705 @@ -3302,6 +3548,7 @@ name: deranged shopper mesh: 5927 mesh_filename: solitus_female.cir + death_animations: [13572] stats: 12: 5927 64: 40630 @@ -3316,6 +3563,7 @@ name: stim fiend mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 40693 @@ -3330,6 +3578,7 @@ name: architect striker(robe) mesh: 17870 mesh_filename: solitus_male_robe.cir + death_animations: [15621] stats: 12: 17870 64: 40698 @@ -3344,6 +3593,7 @@ name: strike foreman mesh: 17870 mesh_filename: solitus_male_robe.cir + death_animations: [15621] stats: 12: 17870 64: 40673 @@ -3358,6 +3608,7 @@ name: looter(robe) mesh: 17870 mesh_filename: solitus_male_robe.cir + death_animations: [15621] stats: 12: 17870 64: 40695 @@ -3372,6 +3623,7 @@ name: molested molecules mesh: 5921 mesh_filename: nanomage_male.cir + death_animations: [15621] stats: 12: 5921 64: 29704 @@ -3386,6 +3638,7 @@ name: melded patterns mesh: 23368 mesh_filename: nanomage_female_fat.cir + death_animations: [13572] stats: 12: 23368 64: 29701 @@ -3400,6 +3653,7 @@ name: vergil aeneid mesh: 5921 mesh_filename: nanomage_male.cir + death_animations: [15621] stats: 12: 5921 64: 40171 @@ -3414,6 +3668,7 @@ name: workman striker(robe) mesh: 17899 mesh_filename: athrox_male_robe.cir + death_animations: [9981] stats: 12: 17899 64: 40127 @@ -3428,6 +3683,7 @@ name: atroxmale_ah_colonist_robe mesh: 17899 mesh_filename: athrox_male_robe.cir + death_animations: [9981] stats: 12: 17899 64: 40117 @@ -3442,6 +3698,7 @@ name: manta(yalmaha)_neo_ground vehicle mesh: 204118 mesh_filename: vehicle_hovera_neo.cir + death_animations: [201508] stats: 12: 204118 64: 0 @@ -3457,6 +3714,7 @@ name: manta_(yalmaha)_sportline_ground_vehicle mesh: 204119 mesh_filename: vehicle_hovera_sportline.cir + death_animations: [201508] stats: 12: 204119 64: 0 @@ -3472,6 +3730,7 @@ name: manta_(yalmaha)_avi_ground_vehicle mesh: 204117 mesh_filename: vehicle_hovera_av.cir + death_animations: [201508] stats: 12: 204117 64: 0 @@ -3487,6 +3746,7 @@ name: redundant scan mesh: 23370 mesh_filename: nanomage_female_thin.cir + death_animations: [13572] stats: 12: 23370 64: 40660 @@ -3501,6 +3761,7 @@ name: solitus_asian_male mesh: 17532 mesh_filename: solitus_male_fat.cir + death_animations: [15621] stats: 12: 17532 64: 40680 @@ -3516,6 +3777,7 @@ name: solitusmale_ah_youngman mesh: 17532 mesh_filename: solitus_male_fat.cir + death_animations: [15621] stats: 12: 17532 64: 40700 @@ -3558,6 +3820,7 @@ name: zoftig blimp mesh: 17532 mesh_filename: solitus_male_fat.cir + death_animations: [15621] stats: 12: 17532 64: 40691 @@ -3572,6 +3835,7 @@ name: eclipser mesh: 100399 mesh_filename: doppelgripper.cir + death_animations: [100416] stats: 12: 100399 64: 0 @@ -3587,6 +3851,7 @@ name: bane mesh: 165156 mesh_filename: harhead.cir + death_animations: [165158] stats: 12: 165156 64: 0 @@ -3602,6 +3867,7 @@ name: blorrg mesh: 95310 mesh_filename: helium_blorrg.cir + death_animations: [95317] stats: 12: 95310 64: 0 @@ -3617,6 +3883,7 @@ name: skincrawler mesh: 156217 mesh_filename: argilecrawler.cir + death_animations: [156221] stats: 12: 156217 64: 0 @@ -3632,6 +3899,7 @@ name: summoned skincrawler mesh: 156217 mesh_filename: argilecrawler.cir + death_animations: [156221] stats: 12: 156217 64: 0 @@ -3647,6 +3915,7 @@ name: alpha skincrawler mesh: 156217 mesh_filename: argilecrawler.cir + death_animations: [156221] stats: 12: 156217 64: 0 @@ -3662,6 +3931,7 @@ name: necromancer mesh: 95294 mesh_filename: dragonclaw.cir + death_animations: [95300] stats: 12: 95294 64: 0 @@ -3677,6 +3947,7 @@ name: crypt guardian mesh: 165156 mesh_filename: harhead.cir + death_animations: [165158] stats: 12: 165156 64: 0 @@ -3692,6 +3963,7 @@ name: kizzermole mesh: 95388 mesh_filename: duschbag.cir + death_animations: [95433] stats: 12: 95388 64: 0 @@ -3707,6 +3979,7 @@ name: abyss serpent mesh: 32363 mesh_filename: sewersnake.cir + death_animations: [32376] stats: 12: 32363 64: 0 @@ -3722,6 +3995,7 @@ name: awakened pit demon mesh: 85335 mesh_filename: stankel.cir + death_animations: [85342] stats: 12: 85335 64: 0 @@ -3737,6 +4011,7 @@ name: cerubin the rejected mesh: 42886 mesh_filename: mutantking.cir + death_animations: [42890] stats: 12: 42886 64: 0 @@ -3752,6 +4027,7 @@ name: cerubins tentacle mesh: 45795 mesh_filename: mutantkings_tentacle.cir + death_animations: [45801] stats: 12: 45795 64: 0 @@ -3767,6 +4043,7 @@ name: dark cenobite mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 116705 @@ -3781,6 +4058,7 @@ name: dark summoner mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 116711 @@ -3795,6 +4073,7 @@ name: dark sanitary mesh: 5907 mesh_filename: solitus_male.cir + death_animations: [15621] stats: 12: 5907 64: 116708 @@ -3809,6 +4088,7 @@ name: vanguard commander_female mesh: 17919 mesh_filename: solitus_female_robe.cir + death_animations: [13572] stats: 12: 17919 64: 40629 @@ -3823,6 +4103,7 @@ name: vanguard commander_male mesh: 17870 mesh_filename: solitus_male_robe.cir + death_animations: [15621] stats: 12: 17870 64: 40694 @@ -3837,6 +4118,7 @@ name: vanguard watcher mesh: 17915 mesh_filename: opifex_male_robe.cir + death_animations: [15621] stats: 12: 17915 64: 40249 @@ -3851,6 +4133,7 @@ name: guard turret mesh: 205693 mesh_filename: Sentrygun.cir + death_animations: [211423] stats: 12: 205693 64: 0 @@ -3866,6 +4149,7 @@ name: security camera mesh: 210194 mesh_filename: camera_sphere.cir + death_animations: [210209] stats: 12: 210194 64: 0 @@ -3881,6 +4165,7 @@ name: security guard mesh: 210200 mesh_filename: camera_sphere_guard.cir + death_animations: [210224] stats: 12: 210200 64: 0 @@ -3896,6 +4181,7 @@ name: psionic_eremite_nomove mesh: 31722 mesh_filename: desert_eremite.cir + death_animations: [31753] stats: 12: 31722 421: 5 @@ -3909,6 +4195,7 @@ name: hollow_island_suzerain mesh: 208961 mesh_filename: null + death_animations: [31753] stats: 12: 208961 421: 5 diff --git a/server/gamedata/types.go b/server/gamedata/types.go @@ -137,6 +137,7 @@ type Monster struct { Name string `json:"name" yaml:"name"` Mesh uint32 `json:"mesh" yaml:"mesh"` MeshFilename *string `json:"mesh_filename" yaml:"mesh_filename"` + DeathAnimations []uint32 `json:"death_animations,omitempty" yaml:"death_animations,omitempty"` Stats map[uint32]uint32 `json:"stats" yaml:"stats"` RecordFileOffset uint64 `json:"record_file_offset" yaml:"record_file_offset"` Comment string `json:"comment,omitempty" yaml:"comment,omitempty"` diff --git a/server/interest.go b/server/interest.go @@ -18,7 +18,13 @@ func (server *server) updateNPCInterest_locked(client *worldClient, now time.Tim } } updates = append(updates, n3Packet(0x36510078, 50000, id, nil)) + if other != nil && other.corpse != nil { + updates = append(updates, n3Packet(0x36510078, 51050, id, nil)) + } delete(client.npcs, id) + if client.lootCorpse == id { + client.lootCorpse = 0 + } } // Send current state before motion when an NPC enters this observer's vicinity. @@ -33,9 +39,13 @@ func (server *server) updateNPCInterest_locked(client *worldClient, now time.Tim } client.npcs[id] = true spawned[id] = true - updates = append(updates, characterPacket(other)) - if other.health == 0 { - updates = append(updates, deathPacket(other)) + if other.corpse != nil { + updates = append(updates, corpsePacket(other)) + } else { + updates = append(updates, characterPacket(other)) + if other.health == 0 { + updates = append(updates, deathPacket(other)) + } } if other.roaming != nil && other.roaming.moving { updates = append(updates, npcMovementPacket(other, 1)) diff --git a/server/inventory.go b/server/inventory.go @@ -97,6 +97,9 @@ func (server *server) handleInventory(client *worldClient, body []byte) error { if key == 0x5e477770 { sourceType, sourceSlot = binary.BigEndian.Uint32(body[20:24]), binary.BigEndian.Uint32(body[24:28]) } + if key == 0x47537a24 && sourceType == 107 { + return server.takeLoot_locked(client, body) + } index := slices.IndexFunc(character.inventory.Items, func(item ownedItem) bool { return item.Slot == sourceSlot }) if index < 0 || (sourceSlot != 6 && sourceType != 104) || (sourceSlot == 6 && sourceType != 101) { return nil diff --git a/server/loot.go b/server/loot.go @@ -0,0 +1,176 @@ +package main + +import ( + "ao/server/gamedata" + "encoding/binary" + "math" + "slices" + "time" +) + +type npcCorpse struct { + looter uint32 + items []ownedItem +} + +func corpsePacket(character *character) []byte { + monster := gamedata.MonsterTemplates[character.monsterData] + var body []byte + for _, value := range []uint32{7, 11, 0, 0} { + body = binary.BigEndian.AppendUint32(body, value) + } + for _, value := range character.position { + body = binary.BigEndian.AppendUint32(body, math.Float32bits(value)) + } + for _, value := range character.rotation { + body = binary.BigEndian.AppendUint32(body, math.Float32bits(value)) + } + for _, value := range []uint32{character.playfield, 0, 0} { + body = binary.BigEndian.AppendUint32(body, value) + } + body = append(body, 0, 0) + + // Keep an unlimited use count and an animated model for the remains. + stats := [][2]uint32{{12, 0}, {26, 0xffffffff}, {42, monster.Mesh}, {4, uint32(character.appearance >> 4 & 7)}, + {59, uint32(character.appearance >> 7 & 3)}, {89, uint32(character.appearance & 3)}, + {223, 0}, {360, 100}, {415, 50000}, {416, character.id}} + body = binary.BigEndian.AppendUint32(body, uint32(len(stats)+1)*1009) + for _, stat := range stats { + body = binary.BigEndian.AppendUint32(body, stat[0]) + body = binary.BigEndian.AppendUint32(body, stat[1]) + } + name := append([]byte("Remains of "+character.name), 0) + body = binary.BigEndian.AppendUint32(body, uint32(len(name))) + body = append(body, name...) + + // The creation event holds the final death frame; an empty animation list + // makes n3VisualDynel_t::Run replace the otherwise valid model with a cube. + for _, value := range []uint32{2, 0, 1009, 3, 2018, 53003, 0, 4, 0, 1, 0, 0, 0xffffffff, + 51050, character.id, monster.DeathAnimations[0], 1, 0, + 50000, character.id, 1009, 0, 0, 3, 50000, character.corpse.looter, 0} { + body = binary.BigEndian.AppendUint32(body, value) + } + return n3Packet(0x4f474e05, 51050, character.id, body) +} + +func lootInventoryPacket(owner uint32, corpse *character, open bool) []byte { + body := binary.BigEndian.AppendUint32(nil, uint32(len(corpse.corpse.items)+1)*1009) + for _, item := range corpse.corpse.items { + // Bit 0 selects the native template-proxy transfer path. + for _, value := range []uint32{item.Slot, 0x00030001, item.Type, item.ID, item.Template, item.Template, item.Quality, 0} { + body = binary.BigEndian.AppendUint32(body, value) + } + } + for _, value := range []uint32{51050, corpse.id, 0, 0} { + body = binary.BigEndian.AppendUint32(body, value) + } + if open { + binary.BigEndian.PutUint32(body[len(body)-4:], 1) + } + return n3Packet(0x4e536976, 50000, owner, body) +} + +func lootClosePacket(owner, corpse uint32) []byte { + var body []byte + for _, value := range []uint32{1, 102, 50000, owner} { + body = binary.BigEndian.AppendUint32(body, value) + } + return n3Packet(0x2049527c, 51050, corpse, body) +} + +func (server *server) canLoot_locked(client *worldClient, corpse *character) bool { + if corpse == nil || corpse.corpse == nil || corpse.health != 0 || !client.npcs[corpse.id] || + corpse.corpse.looter != client.id || corpse.playfield != server.characters[client.id].playfield { + return false + } + position := predictedPosition_locked(server.characters[client.id], client, time.Now()) + x, y, z := position[0]-corpse.position[0], position[1]-corpse.position[1], position[2]-corpse.position[2] + // kkr.dll sub_3604D350 checks five metres for world item use. + return x*x+y*y+z*z <= 5*5 +} + +func (server *server) handleLootUse(client *worldClient, body []byte) error { + if len(body) != 48 { + return nil + } + server.updateMutex.Lock() + defer server.updateMutex.Unlock() + server.mutex.Lock() + defer server.mutex.Unlock() + player := server.characters[client.id] + if server.clients[client.id] != client || !client.ready || client.loading || player.health == 0 || + binary.BigEndian.Uint32(body[4:8]) != 50000 || binary.BigEndian.Uint32(body[8:12]) != client.id || + binary.BigEndian.Uint32(body[16:20]) != 0 || binary.BigEndian.Uint32(body[24:28]) != 3 || + binary.BigEndian.Uint32(body[28:32]) != 1 || binary.BigEndian.Uint32(body[32:36]) != 50000 || + binary.BigEndian.Uint32(body[36:40]) != client.id || binary.BigEndian.Uint32(body[40:44]) != 51050 { + return nil + } + sequence := binary.BigEndian.Uint32(body[20:24]) + if sequence <= client.lootSequence { + return nil + } + client.lootSequence = sequence + corpse := server.characters[binary.BigEndian.Uint32(body[44:48])] + reply := append([]byte(nil), body[16:]...) + binary.BigEndian.PutUint32(reply, 2) + if !server.canLoot_locked(client, corpse) { + return client.send(n3Packet(0x52526858, 50000, client.id, reply)) + } + + // Native Use toggles the same corpse when its window closes. + open := client.lootCorpse != corpse.id + if open && client.lootCorpse != 0 { + // Page 107 requests have no corpse identity; retire the previous window. + if err := client.send(lootClosePacket(client.id, client.lootCorpse)); err != nil { + return err + } + } + client.lootCorpse = 0 + if open { + client.lootCorpse = corpse.id + } + binary.BigEndian.PutUint32(reply, 1) + if err := client.send(n3Packet(0x52526858, 50000, client.id, reply)); err != nil { + return err + } + if open { + return client.send(lootInventoryPacket(client.id, corpse, true)) + } + // ActionIIR closes the native Chest and unregisters its container window. + return client.send(lootClosePacket(client.id, corpse.id)) +} + +func (server *server) takeLoot_locked(client *worldClient, body []byte) error { + corpse := server.characters[client.lootCorpse] + if !server.canLoot_locked(client, corpse) || binary.BigEndian.Uint32(body[24:28]) != 50000 || + binary.BigEndian.Uint32(body[28:32]) != client.id || binary.BigEndian.Uint32(body[32:36]) != 111 { + return nil + } + index := slices.IndexFunc(corpse.corpse.items, func(item ownedItem) bool { return item.Slot == binary.BigEndian.Uint32(body[20:24]) }) + if index < 0 { + return nil + } + player := server.characters[client.id] + var slot uint32 + for slot = 64; slot < 94; slot++ { + if !slices.ContainsFunc(player.inventory.Items, func(item ownedItem) bool { return item.Slot == slot }) { + break + } + } + if slot == 94 { + return client.send(lootInventoryPacket(client.id, corpse, false)) + } + + // Persist the new owner before removing the corpse item or publishing its move. + item := corpse.corpse.items[index] + item.Slot = slot + inventory := playerInventory{LastID: max(player.inventory.LastID, item.ID), Items: append(slices.Clone(player.inventory.Items), item)} + if err := server.saveInventory_locked(player, inventory); err != nil { + return err + } + server.nextItem = max(server.nextItem, item.ID) + corpse.corpse.items = slices.Delete(corpse.corpse.items, index, index+1) + reply := append([]byte(nil), body[16:]...) + binary.BigEndian.PutUint32(reply[16:20], slot) + return client.send(n3Packet(0x47537a24, 50000, client.id, reply)) +} diff --git a/server/loot_test.go b/server/loot_test.go @@ -0,0 +1,250 @@ +package main + +import ( + "bytes" + "encoding/binary" + "encoding/hex" + "os" + "slices" + "sync" + "testing" + "time" +) + +func newLootWorld(t *testing.T) (*server, *combatTestConn) { + t.Helper() + world := newTestServer(t) + player := world.newCharacter() + player.position = [3]float32{} + if err := world.saveUser_locked(player); err != nil { + t.Fatal(err) + } + world.characters = map[uint32]*character{1: player, 1000000: { + id: 1000000, name: "Leet", playfield: player.playfield, position: [3]float32{1, 0, 0}, + rotation: [4]float32{0, 0, 0, 1}, appearance: 229, monsterData: 17655, npc: true, health: 1, + }} + world.roamingNPCs = nil + conn := &combatTestConn{} + world.clients[1] = &worldClient{id: 1, conn: conn, target: true, ready: true, npcs: map[uint32]bool{1000000: true}} + if err := world.handleCombat(world.clients[1], attackPacket(1, 1000000)[20:]); err != nil { + t.Fatal(err) + } + world.advanceCombat(player.nextAttack) + world.characters[1000000].corpse.items = []ownedItem{{ID: 17, Type: 51005, Template: 42640, Quality: 1}} + return world, conn +} + +func lootUseRequest(sequence uint32) []byte { + var body []byte + for _, value := range []uint32{0, sequence, 3, 1, 50000, 1, 51050, 1000000} { + body = binary.BigEndian.AppendUint32(body, value) + } + return n3Packet(0x52526858, 50000, 1, body)[20:] +} + +func lootTakeRequest() []byte { + var body []byte + for _, value := range []uint32{107, 0, 50000, 1, 111} { + body = binary.BigEndian.AppendUint32(body, value) + } + return n3Packet(0x47537a24, 50000, 1, body)[20:] +} + +func TestLootNativeCorpseTakeAndRestart(t *testing.T) { + t.Chdir(t.TempDir()) + world, conn := newLootWorld(t) + corpse := conn.packets[len(conn.packets)-1] + animation, _ := hex.DecodeString("000007e20000cf0b000000000000000400000000000000010000000000000000ffffffff0000c76a000f4240000046bb0000000100000000") + if binary.BigEndian.Uint32(corpse[16:20]) != 0x4f474e05 || !bytes.Contains(corpse, animation) || !bytes.Contains(corpse, []byte("Remains of Leet\x00")) { + t.Fatalf("native corpse creation: %x", corpse) + } + if !bytes.Contains(corpse, []byte{0, 0, 0, 26, 255, 255, 255, 255}) { + t.Fatal("native Use would consume the corpse") + } + + if err := world.handleLootUse(world.clients[1], lootUseRequest(1)); err != nil { + t.Fatal(err) + } + if binary.BigEndian.Uint32(conn.packets[len(conn.packets)-1][37:41]) != 0x00030001 { + t.Fatal("corpse item cannot take the native template-proxy transfer path") + } + if err := world.handleInventory(world.clients[1], lootTakeRequest()); err != nil { + t.Fatal(err) + } + restarted := newTestInventoryServer(t) + + expected := []ownedItem{{ID: 17, Type: 51005, Template: 42640, Quality: 1, Slot: 64}} + if !slices.Equal(restarted.characters[1].inventory.Items, expected) || restarted.nextItem != 17 || len(world.characters[1000000].corpse.items) != 0 { + t.Fatalf("loot ownership after restart: %+v", restarted.characters[1].inventory) + } + if hex.EncodeToString(conn.packets[len(conn.packets)-1][29:49]) != "0000006b000000000000c3500000000100000040" { + t.Fatal("pickup acknowledgement lost its corpse source or persisted destination") + } + world.handleLootUse(world.clients[1], lootUseRequest(2)) + world.handleLootUse(world.clients[1], lootUseRequest(3)) + if binary.BigEndian.Uint32(conn.packets[len(conn.packets)-1][29:33]) != 1009 { + t.Fatal("corpse still publishes the taken item") + } +} + +func TestLootUseTogglesAndRejectsRepeatedSequences(t *testing.T) { + t.Chdir(t.TempDir()) + world, conn := newLootWorld(t) + conn.packets = nil + + world.handleLootUse(world.clients[1], lootUseRequest(1)) + world.handleLootUse(world.clients[1], lootUseRequest(1)) + if world.clients[1].lootCorpse != 1000000 || len(conn.packets) != 2 { + t.Fatal("repeated use closed or reopened the corpse") + } + world.handleLootUse(world.clients[1], lootUseRequest(2)) + if world.clients[1].lootCorpse != 0 || len(conn.packets) != 4 { + t.Fatal("native close use reopened the loot window") + } + if hex.EncodeToString(conn.packets[3][16:45]) != "2049527c0000c76a000f42400000000001000000660000c35000000001" { + t.Fatalf("close did not unregister the native corpse container: %x", conn.packets[3][16:]) + } + world.handleLootUse(world.clients[1], lootUseRequest(3)) + + if world.clients[1].lootCorpse != 1000000 || len(conn.packets) != 6 || binary.BigEndian.Uint32(conn.packets[4][29:33]) != 1 || binary.BigEndian.Uint32(conn.packets[4][33:37]) != 3 { + t.Fatal("reuse did not acknowledge the native status and sequence") + } +} + +func TestLootRejectsUnavailableItemsWithoutChangingOwnership(t *testing.T) { + for _, scenario := range []string{"closed", "distance", "playfield", "foreign owner", "stale session", "empty slot", "full inventory", "save failure", "repeat pickup"} { + t.Run(scenario, func(t *testing.T) { + t.Chdir(t.TempDir()) + world, _ := newLootWorld(t) + client := world.clients[1] + world.handleLootUse(client, lootUseRequest(1)) + request := lootTakeRequest() + switch scenario { + case "closed": + world.handleLootUse(client, lootUseRequest(2)) + case "distance": + world.characters[1].position[0] = 7 + case "playfield": + world.characters[1].playfield++ + case "foreign owner": + world.characters[1000000].corpse.looter = 2 + case "stale session": + world.clients[1] = &worldClient{id: 1} + case "empty slot": + binary.BigEndian.PutUint32(request[20:24], 1) + case "full inventory": + for slot := uint32(64); slot < 94; slot++ { + world.characters[1].inventory.Items = append(world.characters[1].inventory.Items, ownedItem{ID: slot, Slot: slot}) + } + case "save failure": + if err := os.Mkdir("data/players/1/inventory.yaml", 0700); err != nil { + t.Fatal(err) + } + case "repeat pickup": + if err := world.handleInventory(client, request); err != nil { + t.Fatal(err) + } + } + before := append([]ownedItem(nil), world.characters[1].inventory.Items...) + remaining := append([]ownedItem(nil), world.characters[1000000].corpse.items...) + + err := world.handleInventory(client, request) + + if (err != nil) != (scenario == "save failure") || !slices.Equal(before, world.characters[1].inventory.Items) || !slices.Equal(remaining, world.characters[1000000].corpse.items) { + t.Fatalf("%s changed ownership: %v", scenario, err) + } + }) + } +} + +func TestLootSwitchClosesThePreviousContainer(t *testing.T) { + t.Chdir(t.TempDir()) + world, conn := newLootWorld(t) + other := *world.characters[1000000] + other.id = 1000001 + world.characters[other.id] = &other + world.clients[1].npcs[other.id] = true + world.handleLootUse(world.clients[1], lootUseRequest(1)) + conn.packets = nil + request := lootUseRequest(2) + binary.BigEndian.PutUint32(request[44:48], other.id) + + err := world.handleLootUse(world.clients[1], request) + + if err != nil || world.clients[1].lootCorpse != 1000001 || len(conn.packets) != 3 || + binary.BigEndian.Uint32(conn.packets[0][16:20]) != 0x2049527c || + binary.BigEndian.Uint32(conn.packets[0][24:28]) != 1000000 || + binary.BigEndian.Uint32(conn.packets[2][16:20]) != 0x4e536976 { + t.Fatalf("switch did not close the previous container before opening its replacement: %v", err) + } +} + +func TestLootLateObserverAndInterestReentry(t *testing.T) { + t.Chdir(t.TempDir()) + world, _ := newLootWorld(t) + world.characters[2] = &character{id: 2, playfield: world.characters[1].playfield, health: 100} + conn := &combatTestConn{} + world.clients[2] = &worldClient{id: 2, conn: conn, target: true, ready: true, npcs: make(map[uint32]bool)} + + world.advanceNPCs(time.Now()) + world.characters[2].position[0] = 1000 + world.advanceNPCs(time.Now()) + world.characters[2].position[0] = 0 + world.advanceNPCs(time.Now()) + + if len(conn.packets) != 4 || binary.BigEndian.Uint32(conn.packets[0][16:20]) != 0x4f474e05 || + binary.BigEndian.Uint32(conn.packets[1][20:24]) != 50000 || binary.BigEndian.Uint32(conn.packets[2][20:24]) != 51050 || + binary.BigEndian.Uint32(conn.packets[3][16:20]) != 0x4f474e05 { + t.Fatalf("corpse interest lifecycle: %x", conn.packets) + } +} + +func TestLootUseRejectsForeignAndUnavailableCorpses(t *testing.T) { + for _, scenario := range []string{"foreign owner", "distance", "hidden", "living"} { + t.Run(scenario, func(t *testing.T) { + t.Chdir(t.TempDir()) + world, conn := newLootWorld(t) + conn.packets = nil + switch scenario { + case "foreign owner": + world.characters[1000000].corpse.looter = 2 + case "distance": + world.characters[1].position[0] = 6.01 + case "hidden": + delete(world.clients[1].npcs, 1000000) + case "living": + world.characters[1000000].health = 1 + } + + err := world.handleLootUse(world.clients[1], lootUseRequest(1)) + + if err != nil || world.clients[1].lootCorpse != 0 || len(conn.packets) != 1 || binary.BigEndian.Uint32(conn.packets[0][29:33]) != 2 { + t.Fatalf("%s opened or failed to reject corpse use: %v", scenario, err) + } + }) + } +} + +func TestLootConcurrentRepeatPickupHasOneOwner(t *testing.T) { + t.Chdir(t.TempDir()) + world, _ := newLootWorld(t) + world.handleLootUse(world.clients[1], lootUseRequest(1)) + var workers sync.WaitGroup + errors := make(chan error, 2) + + for range 2 { + workers.Go(func() { errors <- world.handleInventory(world.clients[1], lootTakeRequest()) }) + } + workers.Wait() + close(errors) + restarted := newTestInventoryServer(t) + + for err := range errors { + if err != nil { + t.Fatal(err) + } + } + if len(restarted.characters[1].inventory.Items) != 1 || restarted.characters[1].inventory.Items[0].ID != 17 || len(world.characters[1000000].corpse.items) != 0 { + t.Fatal("concurrent pickup duplicated or lost the item") + } +} diff --git a/server/main.go b/server/main.go @@ -313,6 +313,7 @@ func (server *server) serveWorldClient(client *worldClient) error { } client.id = character.id client.npcs = make(map[uint32]bool) + client.lootCorpse = 0 updates := [][]byte{playfieldPacket(character), characterPacket(character)} for id, other := range server.characters { if id != character.id && other.playfield == character.playfield && server.clients[id] != nil { @@ -401,6 +402,10 @@ func (server *server) serveWorldClient(client *worldClient) error { return fmt.Errorf("N3 message before character initialization") } switch binary.BigEndian.Uint32(body[0:4]) { + case 0x52526858: + if err := server.handleLootUse(client, body); err != nil { + return err + } case 0x47537a24: if err := server.handleInventory(client, body); err != nil { return err diff --git a/server/state.go b/server/state.go @@ -21,6 +21,7 @@ type character struct { level uint16 stats characterStats inventory playerInventory + corpse *npcCorpse health uint32 nano uint32 sitting bool @@ -55,6 +56,8 @@ type worldClient struct { npcs map[uint32]bool dialogue *npcDialogue equipment *equipmentMove + lootCorpse uint32 + lootSequence uint32 } func (client *worldClient) send(packet []byte) error { diff --git a/tools/data/extract_monsters.py b/tools/data/extract_monsters.py @@ -28,7 +28,21 @@ for kind, identity in sorted(database.records): assert encoded_count % 1009 == 0 count = encoded_count // 1009 - 1 stats = dict(struct.unpack_from('<II', payload, 12 + entry * 8) for entry in range(count)) - assert struct.unpack_from('<I', payload, 12 + count * 8)[0] == 14 + offset = 12 + count * 8 + assert struct.unpack_from('<II', payload, offset) == (14, 19) + + # Corpse creation needs the resources behind the creature's death key 6000. + animation_count = struct.unpack_from('<I', payload, offset + 8)[0] // 1009 - 1 + offset += 12 + death_animations = [] + for _ in range(animation_count): + key, encoded = struct.unpack_from('<II', payload, offset) + assert encoded % 1009 == 0 + variants = encoded // 1009 - 1 + offset += 8 + if key == 6000: + death_animations = list(struct.unpack_from('<' + 'I' * variants, payload, offset)) + offset += variants * 4 # The final name section has an explicit length and a terminating zero. offset = payload.rfind(b'\x06\x00\x00\x00\x1c\x00\x00\x00\xf1\x03\x00\x00') @@ -38,7 +52,7 @@ for kind, identity in sorted(database.records): assert payload[-1] == 0 name = payload[offset + 16:-1].decode('ascii') catalog.append({'monster_data': identity, 'name': name, 'mesh': stats[12], - 'mesh_filename': filenames.get(stats[12]), 'stats': stats, + 'mesh_filename': filenames.get(stats[12]), 'death_animations': death_animations, 'stats': stats, 'record_file_offset': database.records[kind, identity]}) database.close()