Item types (ITEMTYPE.DAT)
File formats · Field reference · Schema
In brief
ITEMTYPE.DAT describes what all items of the same kind have in common:
where they can be placed in the inventory, which character classes can use
them, the dice they roll for damage and a few other properties. Every item of
ITEM.DAT has a type, which is a record number in this file.
Organization
The file is a count followed by one 16-byte record per type; the record
number is the type that an item of ITEM.DAT names. The
field reference lists the fields of a
record. Several of them are only partly understood.
Reading the file
The game reads ITEMTYPE.DAT once, when the program starts, among the
set-up routines that run before the introduction and the start menu.1
It copies the records unchanged into the item-type table, one
ItemTypeRuntime per type; no part
of the file is converted. The table can then change in play: types 51 to 56
are reserved at run time for conjured weapons, filled by the spells that
create them and stored with each saved game.2
Who uses it
Each record is consulted by a different part of the game:
| Used by | What it checks |
|---|---|
| Inventory placement | Whether the item fits the chosen inventory slot; see InventorySlotMask.3 |
| Hands | Whether the item needs one hand or both.4 |
| Use | What using the item does, by its ItemKind.5 |
| Class restriction | Whether the character's class may use it; see CharacterClassMask.6 |
| Damage | Which of two sets of dice to roll.7 |
| Defense | An adjustment added to defense when the item is worn.8 |
| Item names | How the item's name is formatted.9 |
Unused parts
Three parts of each record are loaded and saved but never used by the game: the second mask word, the bonus of the second damage profile and the byte before the properties, along with the upper bits of the properties. The field reference gives the details.10
Example
The file starts with the type count, 40 00 (64 types). The first type
record follows:
offset bytes meaning
0002 08 00 08 00 inventory and usage masks
0006 00 39 adjustment 0, class mask 0x39
0008 01 01 08 00 01 0a 00 hand byte, then dice 1d8 and 1d10
000f 00 01 00 unknown byte, properties: kind 1, a melee weapon
This class mask has CHARACTER_CLASS_FIGHTER, CHARACTER_CLASS_THIEF,
CHARACTER_CLASS_PALADIN and CHARACTER_CLASS_RANGER of
CharacterClassMask set, but not the mage
or cleric bits.
Related pages
- Items.
- The item types: every type of the original file.
ItemTypeRuntime: the in-memory copy.
Sources
Locations refer to the game executable reference;
comparative sources are listed in the technical references
(REF-MW-011).