Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/ClassicUO/classicuo-web/llms.txt

Use this file to discover all available pages before exploring further.

The Item class represents any physical object in the game world — weapons, armour, potions, bags, chests, gold, and everything else that is not a mobile entity. Item extends the base Entity class, adding item-specific properties such as amount, container, contents, and layer. Items are returned by functions like client.findType(), client.findObject(), client.findAllItemsOfType(), and client.findItemOnLayer().
// Find all gold in the backpack and print the total
const goldType = 0xeed;
const piles = client.findAllItemsOfType(goldType, undefined, player.backpack);
const total = piles.reduce((sum, item) => sum + item.amount, 0);
client.headMsg(`You have ${total} gold`, player, 66);

Properties

Item-Specific Properties

amount

amount: number;
The stack amount of the item. Useful for stackable items like gold, reagents, and arrows.
const item = client.findObject(0x40001234);
if (item && item.amount > 5) {
  client.sysMsg(`Amount: ${item.amount}`);
}

container

container: number;
The serial of the parent container that holds this item. Returns 0 if the item is on the ground or has no container.
const axeType = 0x0f49;
const item = client.findType(axeType);
if (item && item.container > 0) {
  client.sysMsg('The item is inside a container');
}

contents

contents: undefined | Item[];
An array of Item objects directly inside this item, if it is a container. Returns undefined for non-container items.
const itemList = player.backpack.contents;
if (itemList) {
  for (const item of itemList) {
    if (item.contents && item.contents.length > 0) {
      console.log("This item is a sub-container!");
    }
  }
}
contents only returns direct children. To search nested containers recursively, use client.findType() with a range parameter controlling search depth.

layer

layer: Layers;
The equipment layer of the item, if it is equipped on a mobile. Use the Layers enum to compare values.
const robe = client.findItemOnLayer(player, Layers.Robe);
if (robe) {
  console.log(robe.layer); // Layers.Robe
}

Inherited from Entity

PropertyTypeDescription
serialnumberUnique entity serial.
namestringDisplay name. Empty string if not yet known to the client.
graphicnumberGraphic/art ID. Returns 0 if off-screen.
huenumberHue/colour. Returns 0 if off-screen.
hitsnumberDurability current value (returns 0 if unknown).
maxHitsnumberMaximum durability (returns 0 if unknown).
isHiddenbooleanWhether the item is hidden.
xnumberX coordinate (0 if off-screen or in a container).
ynumberY coordinate (0 if off-screen or in a container).
znumberZ coordinate (0 if off-screen or in a container).
directionnumberDirection value. Relevant for some multi-tile items.

Examples

Equip an item by graphic

const axe = client.findType(0x0f49); // Battle Axe graphic
if (axe) {
  player.equip(axe);
}

Read an item’s OPL (Object Property List)

const sword = client.findType(0x0f5e);
if (sword) {
  const opl = client.queryItemOPL(sword);
  console.log(opl.name);
  console.log(opl.properties);
}

Iterate over backpack contents

const items = player.backpack.contents ?? [];
for (const item of items) {
  console.log(`${item.name} (serial: 0x${item.serial.toString(16)})`);
}

Check item name

const entity = client.findObject(player.equippedItems.robe);
if (entity) {
  console.log(entity.name); // e.g. "Hooded Shroud of Shadows"
}

Build docs developers (and LLMs) love