Class 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 Summary
Modifier and TypeMethodDescriptionall()Returns currently worn items.static Itemat(EquipmentSlot slot) Returns the item worn in one slot.static intcapacity()Returns wearable slot capacity.static booleancontains(EquipmentSlot slot, int itemId) static booleancontainsAny(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.static intidAt(EquipmentSlot slot) Returns the item identifier worn in one slot.static booleaninteract(EquipmentSlot slot) Dispatches the default action for a worn slot.static booleanisEmpty(EquipmentSlot slot) static booleanReports whether worn items can currently be read at all.static booleanopen()Opens the equipment tab.static booleanremove(EquipmentSlot slot) Removes the currently worn item in a slot using its default action.
-
Method Details
-
capacity
public static int capacity()Returns wearable slot capacity.- Returns:
- number of defined wearable equipment slots
-
all
Returns currently worn items.- Returns:
- immutable equipment snapshots from the current native scene snapshot
-
at
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
nullwhen the slot is empty or unobserved
-
idAt
Returns the item identifier worn in one slot.- Parameters:
slot- equipment slot to read- Returns:
- worn item id, or
-1when the slot is empty or unobserved
-
contains
- Parameters:
slot- equipment slot to readitemId- item identifier to compare- Returns:
- whether exactly this item is worn in the slot
-
containsAny
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 readitemIds- accepted item identifiers- Returns:
- whether any accepted item is worn in the slot
-
isEmpty
- 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:
truewhen the equipment tab action was accepted
-
interact
Dispatches the default action for a worn slot.- Parameters:
slot- equipment slot- Returns:
truewhen the runtime accepted the action
-
remove
Removes the currently worn item in a slot using its default action.- Parameters:
slot- equipment slot- Returns:
truewhen the action was accepted; verify equipment for completion
-