Class Equipment

java.lang.Object
com.valhalla.sdk.api.methods.Equipment

public final class Equipment extends Object
Queries and native actions for the local player's worn equipment.

Snapshots require the Capabilities.EQUIPMENT capability. Slot actions fail closed without Capabilities.EQUIPMENT_SLOT_ACTIONS. A successful action result confirms dispatch only; re-query equipment to confirm removal.

  • Method Details

    • capacity

      public static int capacity()
      Returns wearable slot capacity.
      Returns:
      number of defined wearable equipment slots
    • all

      public static List<Item> all()
      Returns currently worn items.
      Returns:
      immutable equipment snapshots from the current native scene snapshot
    • at

      public static Item at(EquipmentSlot slot)
      Returns the item worn in one slot.

      Matches on EquipmentSlot.getContainerSlot(), the numbering a snapshot actually carries. Matching on the panel index instead returns the wrong armour from the legs down.

      An empty result means "nothing observed", which is not the same as "nothing worn": worn items are read from the equipment widget, so a snapshot taken while another side panel owns the mobile UI is empty for every slot. Confirm with isObservable() before treating an absent item as bare.

      Parameters:
      slot - equipment slot to read
      Returns:
      the worn item, or null when the slot is empty or unobserved
    • idAt

      public static int idAt(EquipmentSlot slot)
      Returns the item identifier worn in one slot.
      Parameters:
      slot - equipment slot to read
      Returns:
      worn item id, or -1 when the slot is empty or unobserved
    • contains

      public static boolean contains(EquipmentSlot slot, int itemId)
      Parameters:
      slot - equipment slot to read
      itemId - item identifier to compare
      Returns:
      whether exactly this item is worn in the slot
    • containsAny

      public static boolean containsAny(EquipmentSlot slot, int... itemIds)
      Accepts a family of interchangeable items, such as every tier of one armour piece or every charge state of one amulet.
      Parameters:
      slot - equipment slot to read
      itemIds - accepted item identifiers
      Returns:
      whether any accepted item is worn in the slot
    • isEmpty

      public static boolean isEmpty(EquipmentSlot slot)
      Parameters:
      slot - equipment slot to read
      Returns:
      whether nothing is worn in the slot; see isObservable()
    • isObservable

      public static boolean isObservable()
      Reports whether worn items can currently be read at all.

      Equipment comes from the equipment widget rather than a panel independent container, so the whole snapshot is empty whenever another side panel is resident. Without this check an inventory-owned panel is indistinguishable from a naked character, and a script can conclude a required item was lost when it is simply not visible.

      Returns:
      whether any worn item is currently observable
    • open

      public static boolean open()
      Opens the equipment tab.
      Returns:
      true when the equipment tab action was accepted
    • interact

      public static boolean interact(EquipmentSlot slot)
      Dispatches the default action for a worn slot.
      Parameters:
      slot - equipment slot
      Returns:
      true when the runtime accepted the action
    • remove

      public static boolean remove(EquipmentSlot slot)
      Removes the currently worn item in a slot using its default action.
      Parameters:
      slot - equipment slot
      Returns:
      true when the action was accepted; verify equipment for completion