aorecomp

Anarchy Online classic in the browser

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


docs/items.md (12562B)


Item and nano definitions in the 14.9.1 client

The selected client's resource database contains static item definitions. A separate download from a modern item website is not needed to recover their names, descriptions, icons, quality endpoints, attributes or serialized effects. This does not supply the historical server's inventories, loot tables, shop stock policy, drop probabilities or tradeskill rules.

Artifact and coverage

The inspected files are anarchy-vanilla-14.9.1/cd_image/data/db/ResourceDatabase.idx and ResourceDatabase.dat; version.id reads 14.9.1. Resource type 1000020 contains 83,245 item definitions and type 1040005 contains 4,366 nano formulas. Six definitions have an empty name in the source, rather than a name lost by the extraction.

tools/data/extract_items.py reads every indexed record of those two types and writes local/data/items.json. It records the source index SHA-256, each payload SHA-256 and the record's file offset. The complete editable catalog is embedded from server/gamedata/items/*.yaml and loaded into gamedata.Items. server/gamedata/items.yaml holds catalog metadata, including extraction coverage and hashes in its evidence field. Every record retains its sections, function arguments, requirements, undecoded bytes and searchable Comment field. The catalog loads at server startup, one item document at a time to bound temporary parser memory.

The JSON output is an ignored review candidate; the embedded YAML definitions are the authoritative data. Export them with go run ./tools/data/export_gamedata. Regenerate a candidate from the project root:

.\venv\Scripts\python.exe tools\data\extract_items.py
.\venv\Scripts\python.exe tools\data\test_extract_items.py

The extractor uses the Python standard library and tools/data/ao_database.py. It does not require a running game, an emulator installation, or a change to a shared REA analysis session. This finding is based on direct resource parsing and comparison with published extractor source, not observation of live item gameplay.

All 87,611 records pass structural parsing and section-boundary checks. The only unframed data is a single final zero byte in item IDs 120802, 120827 and 203911; each byte is preserved under undecoded. All 463 shop sections frame correctly. The data uses 72 distinct function IDs with known argument layouts. This is complete framing of the selected records, not complete knowledge of their gameplay semantics.

Record layout

After the database's outer resource header, item and nano payloads share this little-endian structure:

  1. Four DWORD header fields. The first identifies the native object class (51005 is SimpleItem_t, 51022 is WearableItem_t). The second equals the number of additional sections plus two in all 87,611 records, strongly supporting a total block count. The remaining pair, 15/23, frames the base attributes. Exact internal tag names remain unconfirmed.
  2. An encoded count, (count + 1) * 1009, followed by DWORD attribute/value pairs. Attribute 54 is quality. Attribute 79 is an icon resource ID. Attribute pairs remain a list so their ordering and any repeated keys are preserved.
  3. Two more DWORD fields, always 21/33 in this dataset, frame the text block. Unsigned 16-bit name and description byte lengths follow, then the two strings without an assumed terminating zero.
  4. A sequence of typed sections. Each section has its own subtype and encoded count. There is no global section length that permits safely skipping an unrecognized type.

The catalog maps text bytes through Latin-1 so every original byte can be recovered. ASCII text is unchanged. This is a lossless extraction convention; it does not establish the correct display encoding of every extended character. There are 150 records with non-ASCII bytes in their name or description.

Named catalog attributes

Top-level stats in the maintained item/nano YAML use field names:

stats:
- [item_class, 0]
- [can, 1]
- [flags, 2214593057]
- [price, 200]
- [level, 1]

server/gamedata/item_stats.go maps all 91 distinct top-level attribute IDs in the original catalog to snake_case names. ItemStats resolves those names to the same numeric pairs in memory; JSON exports and protocol data retain numeric IDs. YAML encoding preserves pair order, duplicate IDs and unsigned values. Unrecognized numeric IDs remain numeric, while unknown names and malformed pairs fail loading rather than silently becoming another attribute. Names apply only to the top-level item attributes: section-specific pairs, requirement expressions and function arguments retain their existing encoding. Those fields do not all use the same namespace.

The admin item page displays these names and values at the owned item's actual quality, using the same interpolation as gameplay. It decodes flags, capabilities, item classes and equipment positions, and retains the complete source endpoint record in an expandable section. The source endpoint's quality and raw values can differ from the owned item's interpolated values.

For Bronto Meat 165275, price is 200 and flags is 0x84000221: Visible, HasMultiplecount, TellCollision, NoDrop and DisableStatelCollision. can: 1 permits carrying, without Use, Wear or Stackable. HasMultiplecount is not the separate Stackable capability. NoDrop restricts player transfers and shop sales; it does not identify a monster drop source. Prices are base values, modified by the vendor and Computer Literacy. Vendor buy_modifier (426) means buying from the player; sell_modifier (427) means selling to the player. The server already uses these prices and restrictions. Neither the price nor the item class establishes shop stock or loot-table membership.

Names and bit positions are checked against CellAO-NightPredator commit ca77f375a7dabe3be769da94e6c2a3d093344c2c, CellAO/Libraries/Source/CellAO.Enums/{StatIds,ItemFlags,CanFlags,ItemType}.cs. Capitalization is corroborated by CellAO-Archived-Obsolete commit 433ecc25a6229000e41a88f1b39c8fe8c3a6f216, Tools/Andyzweb/wiki_stuff/StatIdParser/Stats.xml, which also names omitted stat 209 WeaponMesh. These names do not establish every field's runtime semantics or make later emulator stock/loot tables authoritative for 14.9.1.

The native object classes above follow the original KKR factory registration and RTTI: client/game/kkr.dll/lifted-0010.c, sub_36017AA0 registers 51005, and lifted-0009.c, sub_360171D0 registers 51022. The block-count and tag interpretations follow the complete original resource framing, rather than CellAO's parser, which skips those headers.

The named-YAML conversion changes 1,006,392 IDs across 176 shards. Complete numeric JSON exports before and after are byte-identical, SHA-256 4c1d9911cf1d795e622fb67ca2f8438552b0f65b151e5459ecf79b0c467406e4.

Additional sections

Section type Observed serialized contents
2 Event subtype, functions, requirements, timing, target and typed arguments.
4 Attack/defense attribute weights, with entry types 12 and 13.
6 Additional attribute pairs; the observed subtype is 27.
14, 20 Animation/sound-style action lists and integer values.
22 Action requirements; the observed subtype is 36.
23 Shop entries containing a four-byte code, two bytes and 11 opaque bytes.

Requirements are preserved as ordered signed DWORD triples: stat, value, operator. Some triples are logical operators rather than ordinary stat comparisons. Do not flatten them into a dictionary or treat the entire list as an AND operation without decoding its expression semantics.

Functions preserve their ID, header words, requirement triples, tick count, tick interval, target, argument header and argument data. Numeric arguments are signed DWORDs. Four-byte codes are reversed in function arguments, as in the reference reader. Skipped argument bytes are retained as hex instead of being discarded. Serialized function strings may have a zero byte length; consuming an extra byte for such an empty string would misalign the next argument.

For example, nano 46381 is Executive-Grade Bodyguard, quality 52. Its event contains function 53064 with code BUBO and integer arguments 197 and 0. Its action requirements include stats 130 and 131 at 778. These are observed data; they do not by themselves prove how the original server chose or created the resulting pet.

The 14.9.1 shop entries have a fixed 17-byte size. In particular, an entry whose two byte values are zero still occupies 17 bytes. A newer reference reader's extra-short special case for that pair does not apply to these records. Shop codes and the remaining bytes are retained without inventing a stock list.

Unknown section types or unknown function layouts cause extraction of that record to stop at the section's start. The remaining bytes and an explanation are saved together. Malformed lengths and counts raise an error instead of silently omitting a definition.

Definitions versus owned items

A definition is not an owned item. The initial inventory persists instance identity, owner, slot and quality for individual items. Known stacks and portable containers are supported. The reviewed interpolation families are listed in server/gamedata/item_families.yaml: Metaplast armor, Backpack of Survival, NCU Hacker Interface and the QL1..11 Rusty OT M-10 Flechette Pistol. Other interpolated families remain open. CellAO's Item constructor takes quality, low template ID and high template ID, and its item implementation interpolates properties between the templates. Consequently, one row per extracted ID is not sufficient to represent every possible quality level.

The catalog preserves the endpoint definitions; it does not guess template pairings from neighboring IDs or matching names. The shared family table supplies endpoint identity and quality admission to loot generation, equipment, control edits and native serialization. The six Metaplast pairs and their native interpolation rules are documented in armor; the reviewed pistol and shared numerical stat rules are in catalog weapons. Recover each additional pairing and its applicable fields before generating arbitrary-quality equipment. The server will also need to enforce action requirements and effect behavior rather than relying on the client's displayed description.

NPC names may appear in item-like templates, but finding the same display name in this catalog is not proof that it corresponds to a district population code. Keep item templates, monster appearance IDs and server-owned NPC identities separate until a real reference connects them.

Reference source and reproducibility

Serialization interpretation was checked against the local checkout of CellAO-NightPredator, commit ca77f375a7dabe3be769da94e6c2a3d093344c2c, specifically:

These references describe another implementation, with later-format assumptions. The empty-string and shop-entry cases above were resolved against the actual 14.9.1 bytes. The tests include fixed ammunition and terminal fixtures, check the selected database's complete indexed coverage, and verify a known pet nano's requirements and arguments.

ClickSaver's readme describes mission-reward searching and its local item database. AO Item Assistant is another useful reference for inventory tracking. These utilities explain why players could search item information outside the game; their modern databases should not replace the selected client's version-specific definitions.