Skip to content

item_def

Examine-level detail for one item template — tier, requirements, mitigation, weapon damage. The deep counterpart to the thin item record your bags return.

Returned by eq2.item_def(item_def_id), which reads the client's own examine (ExamineManager) cache. Like effect, this is a plain table of values, not of functions — read its fields directly. The one exception is HasFlag, a real method.

for _, it in ipairs(eq2.inventory()) do
  local def = eq2.item_def(it.item_def_id)
  if def then
    eq2.print(("%s: tier=%d req_level=%d"):format(def.name, def.tier, def.req_level))
  end
end

The cache has to be primed first

Item definitions are not auto-populated. eq2.item_def(id) reads whatever the client's examine cache already has — if nothing has asked the server for this item yet, it returns nil. Prime it with eq2.item_examine(id), then give the client a moment before reading back:

local id = it.item_def_id
if not eq2.item_def(id) then
  eq2.item_examine(id)      -- fire-and-forget: requests the data, returns immediately
  eq2.delay(300)
end
local def = eq2.item_def(id)

eq2.item_examine(id) returns true once the request is sent, not once the data has arrived. There's no event for "examine data is ready" — poll eq2.item_def(id) until it stops returning nil.

Fields

Field Type Notes
name string Item name.
description string Full examine-window description text.
unique_id number Echoes the id you passed in — the item-template id.
icon number Icon id.
tier number Raw tier code: 2 Treasured … 7 Ethereal. Not yet mapped to the display names ("Legendary", "Fabled", …) — read it as a number and compare, don't try to print it as a word yet.
req_level number Required level.
max_stack number Maximum stack size.
is_container bool true for bags.
flags number Raw bitfield. Confirmed so far: ATTUNED = bit 0, LORE = bit 2, NO_TRADE = bit 5 — the rest are unmapped. Prefer HasFlag(bit) over decoding this by hand.
classes number Raw class-eligibility bitmask, e.g. 0x18 = Warrior, 0x6618 = the plate-wearer group. Only a handful of bit meanings are confirmed.
condition_pct number Item condition. In practice always 100.
skill_req_a number Required-skill hash. 0xFFFFFFFF means none.
skill_req_b number Second required-skill hash, same sentinel.
item_type number 0 Generic, 1 Melee, 2 Ranged, 3 Armor, 4 Shield, 5 Bag, 11 Ammo, 13 Adornment.
mitigation_low number Armor mitigation, low roll. Armor/shield only (item_type 3/4) — 0 otherwise.
mitigation_high number Armor mitigation, high roll. Armor/shield only.
absorb number Absorb value. Armor/shield only.
wield_style number Raw wield-style code (2 = primary). Weapon only (item_type 1/2) — 0 otherwise.
weapon_dmg_low number Weapon damage, low roll. Weapon only.
weapon_dmg_high number Weapon damage, high roll. Weapon only.
weapon_delay number Weapon delay, tenths of a second. Weapon only.

HasFlag(bit)

The one method on this table. Tests a single bit of flags and returns a bool. Called with ., same as everywhere else on this table — it does not take self:
if def.HasFlag(0x20) then eq2.print(def.name .. " is NO_TRADE") end

See also