Skip to content

ItemType

ItemType Class

The ItemType class provides static information about item types (from items.xml/items.otb).

Constructor

ItemType(id)
ItemType(name)

Basic Properties

MethodReturnsDescription
getId()numberItem ID
getClientId()numberClient ID
getName()stringItem name
getPluralName()stringPlural name
getArticle()stringArticle (a/an)
getDescription()stringDescription
getGroup()numberItem group
getType()numberItem type
local itemType = ItemType(2160)
print("Name: " .. itemType:getName())
print("ID: " .. itemType:getId())

Classification

MethodReturnsDescription
isMovable()booleanCan be moved
isStackable()booleanIs stackable
isPickupable()booleanCan be picked up
isContainer()booleanIs container
isFluidContainer()booleanIs fluid container
isRune()booleanIs rune
isDoor()booleanIs door
isMagicField()booleanIs magic field
isUseable()booleanIs useable
isBlocking()booleanBlocks movement
isGroundTile()booleanIs ground tile
isSplash()booleanIs splash
isPodium()booleanIs podium
isCorpse()booleanIs corpse

Combat Properties

MethodReturnsDescription
getAttack()numberAttack value
getDefense()numberDefense value
getExtraDefense()numberExtra defense
getArmor()numberArmor value
getWeaponType()numberWeapon type
getShootRange()numberShoot range
getAmmoType()numberAmmo type
getHitChance()numberHit chance

Physical Properties

MethodReturnsDescription
getWeight()numberWeight
getSlotPosition()numberSlot flags
getCapacity()numberContainer capacity
getFloorChange()numberFloor change
getCharges()numberDefault charges
getRotateTo()numberRotate to ID
getWorth()numberGold value
getDecayId()numberDecay target ID
getDecayTime()numberDecay time

Requirements

MethodReturnsDescription
getMinReqLevel()numberRequired level
getMinReqMagicLevel()numberRequired magic level

Abilities

MethodReturnsDescription
getAbilities()tableItem abilities
hasAbilities()booleanHas any abilities
hasShowAttributes()booleanShows attributes
hasShowCharges()booleanShows charges
hasShowDuration()booleanShows duration

Transformation

MethodReturnsDescription
getTransformEquipId()numberTransform on equip
getTransformDeEquipId()numberTransform on deequip

Examples

Get Item Info

local function getItemInfo(itemId)
local it = ItemType(itemId)
if it:getId() == 0 then
return nil
end
return {
id = it:getId(),
name = it:getName(),
weight = it:getWeight(),
attack = it:getAttack(),
defense = it:getDefense(),
armor = it:getArmor(),
stackable = it:isStackable()
}
end

Check Equipment

local function isEquipment(itemId)
local it = ItemType(itemId)
local slot = it:getSlotPosition()
return slot > 0
end