Class Equipment
- java.lang.Object
-
- org.dreambot.api.methods.container.impl.equipment.Equipment
-
public class Equipment extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
add(int index, Item t)
static boolean
add(Item t)
static @NonNull java.util.List<@Nullable Item>
all()
static @NonNull java.util.List<@NonNull Item>
all(@NonNull Filter<Item> filter)
A list of all the filtered items.static int
capacity()
Gets the capacity for the equipment interfacestatic boolean
contains(int id)
Contains boolean.static boolean
contains(int[] ids)
static boolean
contains(@NonNull java.lang.Object o)
static boolean
contains(@NonNull Filter<Item> filter)
Checks if your equipment contains one item which meets the specified filter.static boolean
contains(java.lang.Integer... ids)
Checks if your equipment contains one item which meets one of the specified ids.static boolean
contains(java.lang.String string)
Determines if collection contains item with specified name.static boolean
contains(java.lang.String... names)
Checks if your equipment contains one item which meets one of the specified names.static boolean
containsAll(int... ids)
Checks if your equipment contains all of the items with specified IDsstatic boolean
containsAll(@NonNull java.util.Collection<?> collection)
Checks if your equipment contains all of the items in the collectionsstatic boolean
containsAll(java.lang.String... names)
Checks if your equipment contains all of the items with names specifiedstatic int
count(int id)
Count of all the items that match the search.static int
count(@NonNull Filter<Item> filter)
Count of all the items that match the search.static int
count(java.lang.String name)
Count of all the items that match the search.static int
emptySlotCount()
Gets the number of slots that do not contain itemsstatic boolean
equip(@NonNull EquipmentSlot slot, int[] ids)
static boolean
equip(@NonNull EquipmentSlot slot, @NonNull Filter<Item> filter)
Equips the first item that matches the given filter in the slot providedstatic boolean
equip(@NonNull EquipmentSlot slot, java.lang.Integer... ids)
Equips the first item that matches one of the given IDs in the slot providedstatic boolean
equip(@NonNull EquipmentSlot slot, java.lang.String... names)
Equips the first item that matches one of the given names in the slot providedstatic @NonNull java.util.List<@NonNull Item>
except(@NonNull Filter<Item> filter)
Get all items which do not fit the given criteria.static int
fullSlotCount()
Gets the number of slots that contains itemsstatic @Nullable Item
get(int id)
static @Nullable Item
get(int[] ids)
static @Nullable Item
get(@NonNull Filter<Item> filter)
static @Nullable Item
get(java.lang.Integer... ids)
static @Nullable Item
get(java.lang.String name)
Get item for specified name.static @Nullable Item
get(java.lang.String... names)
static int
getFirstEmptySlot()
Gets the first empty slot in your equipment.static int
getFirstFullSlot()
Gets the next full slot in your equipmentstatic int
getIdForSlot(int slot)
Gets the Id of the Item in the slot.static int
getIdForSlot(@NonNull EquipmentSlot slot)
Gets the ID of theItem
in theEquipmentSlot
static @Nullable Item
getItemInSlot(int slot)
Gets item in specified slot.static @Nullable Item
getItemInSlot(@NonNull EquipmentSlot equipmentSlot)
Gets item in specified slot.static @NonNull java.lang.String
getNameForSlot(int slot)
Gets the Name for the Item in the slot.static @NonNull java.lang.String
getNameForSlot(@NonNull EquipmentSlot slot)
Gets the Name for theItem
in theEquipmentSlot
.static @Nullable java.awt.Rectangle
getSlotBounds(@NonNull EquipmentSlot slot)
Gets the rectangular bounds of theWidgetChild
for the givenEquipmentSlot
static @Nullable EquipmentSlot
getSlotForItem(@NonNull Filter<Item> filter)
Gets theEquipmentSlot
for a given item filterstatic @Nullable WidgetChild
getWidgetForSlot(@NonNull EquipmentSlot slot)
Gets theWidgetChild
for theEquipmentSlot
givenstatic boolean
interact(@NonNull EquipmentSlot slot, @Nullable java.lang.String action)
Interacts with the slot specified with the action specified Opens theTab.EQUIPMENT
tab if neededstatic boolean
isEmpty()
static boolean
isFull()
Determines if equipment full.static boolean
isLoaded()
Checks if the internal equipment tables have been loaded Used primarily for ItemEventManagersstatic boolean
isOpen()
static boolean
isSlotEmpty(int slot)
Checks if the given slot is empty Uses the values fromEquipmentSlot.getSlot()
static boolean
isSlotEmpty(@NonNull EquipmentSlot slot)
Checks if the givenEquipmentSlot
is emptystatic boolean
isSlotFull(int slot)
Checks if the slot has an Item in it slot is based onEquipmentSlot.getSlot()
static boolean
isSlotFull(@NonNull EquipmentSlot slot)
Checks if the givenEquipmentSlot
is fullstatic boolean
onlyContains(int[] ids)
static boolean
onlyContains(@NonNull Filter<Item> filter)
Checks if your Equipment only contains items that match the Filterstatic boolean
onlyContains(java.lang.Integer... ids)
Checks if your Equipment only contains items with specified IDsstatic boolean
onlyContains(java.lang.String... names)
Checks if your equipment only contains items with specified namesstatic boolean
open()
Opens the equipment tabstatic @Nullable Item
set(int index, Item element)
static int
size()
static int
slot(int id)
Gets the slot for the item with specified ID.static int
slot(@NonNull java.lang.String name)
Gets the slot for the item with specified name.static int
slot(@NonNull Filter<Item> filter)
Gets the slot for the item with specified name.static boolean
slotContains(int slot, int[] ids)
static boolean
slotContains(int slot, @NonNull Filter<Item> filter)
Checks if the slot contains items that matches the filter.static boolean
slotContains(int slot, @NonNull Item item)
Checks if the slot contains the givenItem
slot based onEquipmentSlot.getSlot()
static boolean
slotContains(int slot, java.lang.Integer... ids)
Checks if the slot contains an item that matches any the given ids.static boolean
slotContains(int slot, java.lang.String name)
Checks if the slot contains anItem
that matches the given name.static boolean
slotContains(int slot, java.lang.String... names)
Checks if the slot contains any items that match the given names.static boolean
slotContains(@NonNull EquipmentSlot slot, int[] ids)
static boolean
slotContains(@NonNull EquipmentSlot slot, @NonNull Filter<Item> filter)
Checks if theEquipmentSlot
contains items that matches the given filter.static boolean
slotContains(@NonNull EquipmentSlot slot, @NonNull Item item)
Checks if theEquipmentSlot
contains the givenItem
static boolean
slotContains(@NonNull EquipmentSlot slot, java.lang.Integer... ids)
Checks if theEquipmentSlot
contains an item that matches any the given ids.static boolean
slotContains(@NonNull EquipmentSlot slot, java.lang.String name)
Checks if theEquipmentSlot
contains an item that matches the given name.static boolean
slotContains(@NonNull EquipmentSlot slot, java.lang.String... names)
Checks if theEquipmentSlot
contains any items that match the given names.static boolean
slotNameContains(int slot, @NonNull java.lang.String sub)
Deprecated.static boolean
slotNameContains(@NonNull EquipmentSlot slot, @NonNull java.lang.String sub)
Deprecated.static @Nullable java.lang.Object @NonNull []
toArray()
static boolean
unequip(@NonNull EquipmentSlot slot)
Unequips the equipment from the equipment slotstatic boolean
unequip(@NonNull Filter<Item> filter)
Unequips an item that matches the given Filterstatic int
widgetChildId()
Gets the child ID of theWidgetChild
for the equipment interfacestatic int
widgetParentId()
Gets the ID of the parentWidget
for the Equipment Interface
-
-
-
Method Detail
-
widgetParentId
public static int widgetParentId()
Gets the ID of the parentWidget
for the Equipment Interface- Returns:
- ID of the parent widget for equipment interface
-
widgetChildId
public static int widgetChildId()
Gets the child ID of theWidgetChild
for the equipment interface- Returns:
- Child ID of the WidgetChild for equipment interface
-
capacity
public static int capacity()
Gets the capacity for the equipment interface
-
all
public static @NonNull java.util.List<@Nullable Item> all()
-
isLoaded
public static boolean isLoaded()
Checks if the internal equipment tables have been loaded Used primarily for ItemEventManagers- Returns:
- True if the equipment tables have been loaded
-
equip
public static boolean equip(@NonNull EquipmentSlot slot, java.lang.Integer... ids)
Equips the first item that matches one of the given IDs in the slot provided- Parameters:
slot
-EquipmentSlot
of the item to equipids
- IDs of the Items to search for to equip- Returns:
- true if equipped successfully or already equipped, else false
-
equip
public static boolean equip(@NonNull EquipmentSlot slot, int[] ids)
-
equip
public static boolean equip(@NonNull EquipmentSlot slot, java.lang.String... names)
Equips the first item that matches one of the given names in the slot provided- Parameters:
slot
-EquipmentSlot
of the item to equipnames
- names of the Items to search for to equip- Returns:
- true if equipped successfully or already equipped, else false
-
equip
public static boolean equip(@NonNull EquipmentSlot slot, @NonNull Filter<Item> filter)
Equips the first item that matches the given filter in the slot provided- Parameters:
slot
-EquipmentSlot
of the item to equipfilter
- filter of the Items to search for to equip- Returns:
- true if equipped successfully or already equipped, else false
-
getSlotForItem
public static @Nullable EquipmentSlot getSlotForItem(@NonNull Filter<Item> filter)
Gets theEquipmentSlot
for a given item filter- Parameters:
filter
- Filter to match an item with- Returns:
- the
EquipmentSlot
of the item if found, otherwise null
-
unequip
public static boolean unequip(@NonNull EquipmentSlot slot)
Unequips the equipment from the equipment slot- Parameters:
slot
-EquipmentSlot
to unequip from- Returns:
- true if successfully unequipped
-
unequip
public static boolean unequip(@NonNull Filter<Item> filter)
Unequips an item that matches the given Filter- Parameters:
filter
- Filter of the item to unequip- Returns:
- True if can't find item slot or successfully unequipped
-
open
public static boolean open()
Opens the equipment tab- Returns:
- true if successfully opened or already open
-
interact
public static boolean interact(@NonNull EquipmentSlot slot, @Nullable java.lang.String action)
Interacts with the slot specified with the action specified Opens theTab.EQUIPMENT
tab if needed- Parameters:
slot
-EquipmentSlot
to interact withaction
- Action to use for the interaction- Returns:
- True if
EquipmentSlot
contains an item and interaction is successful, else false
-
getWidgetForSlot
public static @Nullable WidgetChild getWidgetForSlot(@NonNull EquipmentSlot slot)
Gets theWidgetChild
for theEquipmentSlot
given- Parameters:
slot
- slot to get WidgetChild of- Returns:
- WidgetChild of the given equipment slot
-
getSlotBounds
public static @Nullable java.awt.Rectangle getSlotBounds(@NonNull EquipmentSlot slot)
Gets the rectangular bounds of theWidgetChild
for the givenEquipmentSlot
- Parameters:
slot
- Slot to get the bounds of- Returns:
- Rectangular bounds of the slot, null if
WidgetChild
is not found.
-
fullSlotCount
public static int fullSlotCount()
Gets the number of slots that contains items
-
emptySlotCount
public static int emptySlotCount()
Gets the number of slots that do not contain items
-
isSlotEmpty
public static boolean isSlotEmpty(int slot)
Checks if the given slot is empty Uses the values fromEquipmentSlot.getSlot()
- Parameters:
slot
- slot to check, based onEquipmentSlot.getSlot()
- Returns:
- True if slot empty or if given slot is larger than the number of available slots, else false.
-
isSlotEmpty
public static boolean isSlotEmpty(@NonNull EquipmentSlot slot)
Checks if the givenEquipmentSlot
is empty- Parameters:
slot
- EquipmentSlot to check if empty- Returns:
- True if empty, else false.
-
isSlotFull
public static boolean isSlotFull(int slot)
Checks if the slot has an Item in it slot is based onEquipmentSlot.getSlot()
- Parameters:
slot
- slot to check- Returns:
- True if there's an item there, else False
-
isSlotFull
public static boolean isSlotFull(@NonNull EquipmentSlot slot)
Checks if the givenEquipmentSlot
is full- Parameters:
slot
- EquipmentSlot to check- Returns:
- True if given slot contains an item, else false.
-
onlyContains
public static boolean onlyContains(java.lang.String... names)
Checks if your equipment only contains items with specified names- Parameters:
names
- Names of items to look for- Returns:
- True if Equipment only contains items with the given names, else False
-
onlyContains
public static boolean onlyContains(java.lang.Integer... ids)
Checks if your Equipment only contains items with specified IDs- Parameters:
ids
- IDs of items to check for- Returns:
- True if Equipment only contains items with specified IDs, else False
-
onlyContains
public static boolean onlyContains(int[] ids)
-
onlyContains
public static boolean onlyContains(@NonNull Filter<Item> filter)
Checks if your Equipment only contains items that match the Filter- Parameters:
filter
- Filter to pass items through- Returns:
- True if Equipment only contains items matching Filter, else False
-
slotContains
public static boolean slotContains(int slot, java.lang.String... names)
Checks if the slot contains any items that match the given names. slot is based onEquipmentSlot.getSlot()
- Parameters:
slot
- slot to check, based onEquipmentSlot.getSlot()
names
- names of the items to check- Returns:
- true if the given slot contains an item that matches any of the given names, else false
-
slotContains
public static boolean slotContains(@NonNull EquipmentSlot slot, java.lang.String... names)
Checks if theEquipmentSlot
contains any items that match the given names.- Parameters:
slot
- EquipmentSlot to checknames
- names of the items to check- Returns:
- true if given slot contains any items matching the given names, else false
-
slotContains
public static boolean slotContains(int slot, java.lang.String name)
Checks if the slot contains anItem
that matches the given name. slot is based onEquipmentSlot.getSlot()
- Parameters:
slot
- slot to check, based onEquipmentSlot.getSlot()
name
- name of the item to check- Returns:
- true if the given slot contains an item that contains the given name, else false
-
slotContains
public static boolean slotContains(@NonNull EquipmentSlot slot, java.lang.String name)
Checks if theEquipmentSlot
contains an item that matches the given name.- Parameters:
slot
- EquipmentSlot to checkname
- name of the item to check- Returns:
- true if given slot contains an item that contains the given name, else false
-
slotNameContains
@Deprecated public static boolean slotNameContains(int slot, @NonNull java.lang.String sub)
Deprecated.
-
slotNameContains
@Deprecated public static boolean slotNameContains(@NonNull EquipmentSlot slot, @NonNull java.lang.String sub)
Deprecated.
-
slotContains
public static boolean slotContains(int slot, java.lang.Integer... ids)
Checks if the slot contains an item that matches any the given ids. slot based onEquipmentSlot.getSlot()
- Parameters:
slot
- slot to checkids
- ids of the items to check.- Returns:
- True if slot contains an item that matches any of the given ids, else false.
-
slotContains
public static boolean slotContains(int slot, int[] ids)
-
slotContains
public static boolean slotContains(@NonNull EquipmentSlot slot, java.lang.Integer... ids)
Checks if theEquipmentSlot
contains an item that matches any the given ids.- Parameters:
slot
- slot to checkids
- ids of the items to check.- Returns:
- True if slot contains an item that matches any of the given ids, else false.
-
slotContains
public static boolean slotContains(@NonNull EquipmentSlot slot, int[] ids)
-
slotContains
public static boolean slotContains(int slot, @NonNull Item item)
Checks if the slot contains the givenItem
slot based onEquipmentSlot.getSlot()
- Parameters:
slot
- slot to checkitem
- The Item to check.- Returns:
- True if slot contains the given item, else false.
-
slotContains
public static boolean slotContains(@NonNull EquipmentSlot slot, @NonNull Item item)
Checks if theEquipmentSlot
contains the givenItem
- Parameters:
slot
- slot to checkitem
- The Item to check.- Returns:
- True if slot contains the given item, else false.
-
slotContains
public static boolean slotContains(int slot, @NonNull Filter<Item> filter)
Checks if the slot contains items that matches the filter. slot based onEquipmentSlot.getSlot()
- Parameters:
slot
- slot to check for the given filterfilter
- Filter to check- Returns:
- True if slot contains an Item matching the given filter, else false.
-
slotContains
public static boolean slotContains(@NonNull EquipmentSlot slot, @NonNull Filter<Item> filter)
Checks if theEquipmentSlot
contains items that matches the given filter.- Parameters:
slot
- slot to check for the given filterfilter
- Filter to check- Returns:
- True if slot contains an Item matching the given filter, else false.
-
getFirstEmptySlot
public static int getFirstEmptySlot()
Gets the first empty slot in your equipment.- Returns:
- slot number, if equipment is full -1.
-
getFirstFullSlot
public static int getFirstFullSlot()
Gets the next full slot in your equipment- Returns:
- slot number, if equipment is empty -1
-
getIdForSlot
public static int getIdForSlot(int slot)
Gets the Id of the Item in the slot. slot based onEquipmentSlot.getSlot()
- Parameters:
slot
- Slot to get item id of.- Returns:
- Item ID or -1 if no item.
-
getIdForSlot
public static int getIdForSlot(@NonNull EquipmentSlot slot)
Gets the ID of theItem
in theEquipmentSlot
- Parameters:
slot
- slot to get item id of- Returns:
- Item ID or -1 if slot does not contain an item
-
getNameForSlot
public static @NonNull java.lang.String getNameForSlot(int slot)
Gets the Name for the Item in the slot. slot based onEquipmentSlot.getSlot()
- Parameters:
slot
- Slot to get item name of.- Returns:
- Item name or "" if item is null.
-
getNameForSlot
public static @NonNull java.lang.String getNameForSlot(@NonNull EquipmentSlot slot)
Gets the Name for theItem
in theEquipmentSlot
. NOTE: Does not return null if slot is empty.- Parameters:
slot
- Slot to get item name of.- Returns:
- Item name or empty String if slot does not contain an item
-
slot
public static int slot(int id)
Gets the slot for the item with specified ID.- Parameters:
id
- ID of item to get slot of.- Returns:
- Item slot or -1 if Item is null.
-
slot
public static int slot(@NonNull java.lang.String name)
Gets the slot for the item with specified name.- Parameters:
name
- Name of item to get slot of.- Returns:
- Item slot or -1 if Item is null.
-
slot
public static int slot(@NonNull Filter<Item> filter)
Gets the slot for the item with specified name.- Parameters:
filter
- filter of the item to get slot of.- Returns:
- Item slot or -1 if Item is null.
-
add
public static boolean add(Item t)
-
toArray
public static @Nullable java.lang.Object @NonNull [] toArray()
-
add
public static void add(int index, Item t)
-
all
public static @NonNull java.util.List<@NonNull Item> all(@NonNull Filter<Item> filter)
A list of all the filtered items.- Parameters:
filter
- the filter to search with.- Returns:
- the list of all filtered items.
-
getItemInSlot
public static @Nullable Item getItemInSlot(int slot)
Gets item in specified slot. slot based onEquipmentSlot.getSlot()
- Parameters:
slot
- the index.- Returns:
- the item in slot.
-
getItemInSlot
public static @Nullable Item getItemInSlot(@NonNull EquipmentSlot equipmentSlot)
Gets item in specified slot.- Parameters:
equipmentSlot
- theEquipmentSlot
.- Returns:
- the item in slot.
-
get
public static @Nullable Item get(int id)
-
get
public static @Nullable Item get(java.lang.Integer... ids)
-
get
public static @Nullable Item get(int[] ids)
-
get
public static @Nullable Item get(java.lang.String name)
Get item for specified name.- Parameters:
name
- the name of the item.- Returns:
- the item if list contains it, otherwise null.
-
get
public static @Nullable Item get(java.lang.String... names)
-
except
public static @NonNull java.util.List<@NonNull Item> except(@NonNull Filter<Item> filter)
Get all items which do not fit the given criteria.- Parameters:
filter
- The filter of the items to ignore.- Returns:
- The list of items found which do not match the given criteria.
-
size
public static int size()
-
isEmpty
public static boolean isEmpty()
-
contains
public static boolean contains(int id)
Contains boolean.- Parameters:
id
- the id- Returns:
- the boolean
-
contains
public static boolean contains(java.lang.String string)
Determines if collection contains item with specified name.- Parameters:
string
- the name of the item.- Returns:
- true if collection contains item, otherwise false.
-
containsAll
public static boolean containsAll(java.lang.String... names)
Checks if your equipment contains all of the items with names specified- Parameters:
names
- Names of items to check for- Returns:
- True if equipment contains all names, else False
-
containsAll
public static boolean containsAll(int... ids)
Checks if your equipment contains all of the items with specified IDs- Parameters:
ids
- IDs of items to check for- Returns:
- True if equipment contains all IDs, else false.
-
containsAll
public static boolean containsAll(@NonNull java.util.Collection<?> collection)
Checks if your equipment contains all of the items in the collections- Parameters:
collection
- The collection of items to compare against- Returns:
- True if equipment contains all of the items, else false.
-
contains
public static boolean contains(java.lang.Integer... ids)
Checks if your equipment contains one item which meets one of the specified ids.- Parameters:
ids
- Item IDs to check for- Returns:
- True if equipment contains one of, else false
-
contains
public static boolean contains(int[] ids)
-
contains
public static boolean contains(java.lang.String... names)
Checks if your equipment contains one item which meets one of the specified names.- Parameters:
names
- names to check for- Returns:
- true if equipment contains one of, else false.
-
contains
public static boolean contains(@NonNull Filter<Item> filter)
Checks if your equipment contains one item which meets the specified filter.- Parameters:
filter
- the filter to search with.- Returns:
- true if equipment contains one of, else false.
-
contains
public static boolean contains(@NonNull java.lang.Object o)
-
isFull
public static boolean isFull()
Determines if equipment full.
-
count
public static int count(java.lang.String name)
Count of all the items that match the search.- Parameters:
name
- the name of the item.- Returns:
- the total count of matching items.
-
count
public static int count(int id)
Count of all the items that match the search.- Parameters:
id
- the id of them item.- Returns:
- the total count of matching items.
-
count
public static int count(@NonNull Filter<Item> filter)
Count of all the items that match the search.- Parameters:
filter
- the filter to count with- Returns:
- the total count of matching items.
-
isOpen
public static boolean isOpen()
-
-