Skip to main content

Items

Home · The engine in ten minutes · ItemRuntime · ItemTypeRuntime

In brief​

Items are entries of one table of 600, whose initial content is read from ITEM.DAT. Items of the same kind share an item type loaded from ITEMTYPE.DAT, which says which inventory slots accept them, which classes can use them, how much damage they do and what using them does. Each character has 27 inventory slots. Worn armour, shields, bracers and a ring set a character's defense; using an item depends on its kind: an attack, a spell, a potion, a text, food. Items lying in a block form piles; a thrown item flies half a block at a time and falls where its flight ends. The whole item table is saved with the game.

Where an item entry can be. New items are copies of a template among the first hundred entries, made in the first unused entry. An item in play is on the floor or in a niche, in flight, carried in an inventory slot or on the pointer, or in a quiver. Its entry is freed, with block -1, when it is eaten, used up, spent, copied into the spellbook or removed by a script; an item taken by a monster leaves play without its entry being freed.
Items are copies of templates; an entry returns to the free pool when its item leaves the game.

Where item data comes from​

DataLoaded fromKept as
Individual itemsITEM.DAT recordsItemRuntime entries
Item namesITEM.DAT name slotsTwo name indices per item: before and after identification
Shared item-type propertiesITEMTYPE.DATItemTypeRuntime entries

An item's own fields say where it is, whether it is identified, cursed or magical, and its value, whose meaning depends on its kind: the enchantment of a weapon or piece of armour, the spell of a scroll, the potion or the wand's spell, the food points of a ration. Its type gives everything shared: the slots it fits, the classes allowed, the damage dice, the defense adjustment, how many hands it needs and its ItemKind, which decides what using it does.12

Item names​

An unidentified item shows its first name, an identified one its second. When the second name is empty, the game builds the name from the item's kind and value:3

KindName of an identified item
Worn items and weapons (kinds 0 to 3)"+n name", or "n Cursed name" for a negative value; the plain name for 0.
ITEM_KIND_MAGE_SCROLL, ITEM_KIND_CLERIC_SCROLL"Mage Scroll of …" or "Cleric Scroll of …" with the full name of the spell definition.
ITEM_KIND_RING"Ring of" Adornment, Wizardry, Sustenance or Feather Fall.
ITEM_KIND_POTION"Potion of" Giant Strength, Healing, Extra Healing, Poison, Vitality, Speed, Invisibility or Cure Poison.
ITEM_KIND_WAND"Wand of" Stick, Lightning, Frost, Curing, Fireball, Magic Missile or Dispel Magic; a wand of value 5 keeps its first name.

Bug

The ring names are read from a list of six entries without checking the value, so a ring whose value is beyond the list takes a name from the lists that follow it. Identified, the Crimson Ring, of value 10, would be named "Ring of Vitality", a potion's word. A ring held in a hand can be identified by Improved Identify. A faithful reimplementation reads the names as one continuous list.

The pages of this chapter​

PageWhat it covers
The inventoryThe 27 slots, moving and equipping items, the selected character, two hands.
What worn items changeDefense, the rings that act while worn, what a monster can take.
Using itemsWhat each kind of item does when used; food, books, texts and horns.
Potions, scrolls and wandsPotions, spells cast from items, wand charges.
On the floor and in the airPiles and niches, taking and dropping, throwing and launching.
Where an item isLocations, new items, level changes and saves, scripts.
The item typesThe 64 types and what their items share.
Kinds, slots and recordsTypes by kind and by slot mask; templates and flag bytes.
Weapons, armour and foodEnchantments, named weapons, rations and bones.
Scrolls and parchmentsThe spells of the scrolls and the texts of the parchments.
Potions, wands, rings and amuletsThe values that select their effects.
Keys, gems and quest itemsThe objects the level scripts test.

Sources​

Locations refer to the game executable reference.

Footnotes​

  1. ITEM.DAT loader and print an item's name. ↩

  2. ITEMTYPE.DAT loader and use an inventory item. ↩

  3. Print an item's name and the item name parts. ↩