Skip to main content

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.

From the file ITEMTYPE.DAT to the game. The file holds, in order: Count (2 bytes); Types (16 bytes each). The game: Copy the records into memory. In memory: The item types (ItemTypeRuntime), which can change in play. Used by: Inventory slots, Hands and classes, Use, damage and defense.
The game turns it into the item types (ItemTypeRuntime), which can change in play.

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 byWhat it checks
Inventory placementWhether the item fits the chosen inventory slot; see InventorySlotMask.3
HandsWhether the item needs one hand or both.4
UseWhat using the item does, by its ItemKind.5
Class restrictionWhether the character's class may use it; see CharacterClassMask.6
DamageWhich of two sets of dice to roll.7
DefenseAn adjustment added to defense when the item is worn.8
Item namesHow 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.

Sources​

Locations refer to the game executable reference; comparative sources are listed in the technical references (REF-MW-011).

Footnotes​

  1. ITEMTYPE.DAT loader, run with the other set-up routines of overlay 249 before the start menu, and the item-type records. ↩

  2. Reserve a conjured-weapon type and the save writer. ↩

  3. Placement check and the inventory-slot masks. ↩

  4. Hand checks. ↩

  5. Use an inventory item. ↩

  6. Class check. ↩

  7. Item damage dice. ↩

  8. Defense recomputation. ↩

  9. Item name selection. ↩

  10. The item-type records, the conjured-weapon type reservation and the holy symbol check. ↩