Equipment API

Access equipped items by slot and check equipment state.

Functions

is_equipped

equipment:is_equipped(filter: table?) -> boolean

Check if item matching filter is equipped.

Parameters:

ParameterTypeRequiredDescription
filtertableNoItem filter

Returns:

  • boolean - True if equipped

Example:

if equipment:is_equipped({id = 4151}) then  -- Dragon scimitar
    logger:info("Dragon scimitar equipped")
end

contains

equipment:contains(filter: table?) -> boolean

Check if equipment contains items (alias for is_equipped).

Parameters:

ParameterTypeRequiredDescription
filtertableNoItem filter

Returns:

  • boolean - True if item equipped

find_first

equipment:find_first(filter: table?) -> Item?

Find first equipped item matching filter.

Parameters:

ParameterTypeRequiredDescription
filtertableNoItem filter

Returns:

  • Item? - First matching item

Filters:

  • All Item filters are supported, including:
    • name - Exact name match
    • name_contains - Name contains text
    • name_any - Match if name equals any in array
    • name_contains_any - Match if name contains any substring in array
    • id - Exact item ID
    • Price filters (see Inventory API for full list of price filters)

Example:

-- Find specific item
local weapon = equipment:find_first({name = "Abyssal whip"})

-- Find items with any of multiple names
local shield = equipment:find_first({
    name_any = {"Dragon defender", "Dragonfire shield", "Spirit shield"}
})

-- Find items containing any substring
local combat_gear = equipment:find_all({
    name_contains_any = {"dragon", "barrows"}
})

find_all

equipment:find_all(filter: table?) -> table

Find all equipped items matching filter.

Parameters:

ParameterTypeRequiredDescription
filtertableNoItem filter (same as find_first)

Returns:

  • table - Array of items

get_item_in_slot

equipment:get_item_in_slot(slot_name: string) -> Item?

Get item in specific equipment slot.

Parameters:

ParameterTypeRequiredDescription
slot_namestringYesSlot name

Returns:

  • Item? - Item in slot, or nil

Example:

local weapon = equipment:get_item_in_slot("weapon")
if weapon then
    logger:info("Wielding: " .. weapon:name())
end

get

equipment:get() -> table

Get all equipped items by slot.

Returns:

  • table - Map of slot -> Item

Example:

local equipped = equipment:get()
for slot, item in pairs(equipped) do
    logger:info(slot .. ": " .. item:name())
end

Equipment Slots

Available slot names:

  • head
  • cape
  • neck
  • weapon
  • torso
  • shield
  • legs
  • hands
  • feet
  • ring
  • ammo

Common Patterns

Gear Check

local function check_gear()
    logger:info("=== Equipment ===")
    
    local equipped = equipment:get()
    for slot, item in pairs(equipped) do
        logger:info(slot .. ": " .. item:name())
    end
end

check_gear()

Weapon Verification

local function verify_weapon(weapon_id)
    local weapon = equipment:get_item_in_slot("weapon")
    
    if not weapon or weapon:id() ~= weapon_id then
        logger:warn("Wrong weapon equipped!")
        return false
    end
    
    logger:info("Correct weapon: " .. weapon:name())
    return true
end

Armor Check

local function check_armor_type(armor_type)
    local equipped = equipment:get()
    
    for slot, item in pairs(equipped) do
        if item:name():find(armor_type) then
            return true
        end
    end
    
    return false
end

if check_armor_type("Dragon") then
    logger:info("Wearing Dragon armor")
end

Related APIs

  • Inventory API - Inventory management
  • Bank API - Banking operations