Class Equipment


  • public class Equipment
    extends java.lang.Object
    • Method Detail

      • widgetParentId

        public static int widgetParentId()
        Gets the ID of the parent Widget for the Equipment Interface
        Returns:
        ID of the parent widget for equipment interface
      • widgetChildId

        public static int widgetChildId()
        Gets the child ID of the WidgetChild 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 java.util.List<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​(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 equip
        ids - IDs of the Items to search for to equip
        Returns:
        true if equipped successfully or already equipped, else false
      • equip

        public static boolean equip​(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 equip
        names - names of the Items to search for to equip
        Returns:
        true if equipped successfully or already equipped, else false
      • equip

        public static boolean equip​(EquipmentSlot slot,
                                    Filter<Item> filter)
        Equips the first item that matches the given filter in the slot provided
        Parameters:
        slot - EquipmentSlot of the item to equip
        filter - filter of the Items to search for to equip
        Returns:
        true if equipped successfully or already equipped, else false
      • getSlotForItem

        public static EquipmentSlot getSlotForItem​(Filter<Item> filter)
        Gets the EquipmentSlot 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​(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​(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​(EquipmentSlot slot,
                                       java.lang.String action)
        Interacts with the slot specified with the action specified Opens the Tab.EQUIPMENT tab if needed
        Parameters:
        slot - EquipmentSlot to interact with
        action - Action to use for the interaction
        Returns:
        True if EquipmentSlot contains an item and interaction is successful, else false
      • getSlotBounds

        public static java.awt.Rectangle getSlotBounds​(EquipmentSlot slot)
        Gets the rectangular bounds of the WidgetChild for the given EquipmentSlot
        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 from EquipmentSlot.getSlot()
        Parameters:
        slot - slot to check, based on EquipmentSlot.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​(EquipmentSlot slot)
        Checks if the given EquipmentSlot 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 on EquipmentSlot.getSlot()
        Parameters:
        slot - slot to check
        Returns:
        True if there's an item there, else False
      • isSlotFull

        public static boolean isSlotFull​(EquipmentSlot slot)
        Checks if the given EquipmentSlot 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​(Filter<Item> f)
        Checks if your Equipment only contains items that match the Filter
        Parameters:
        f - 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 on EquipmentSlot.getSlot()
        Parameters:
        slot - slot to check, based on EquipmentSlot.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​(EquipmentSlot slot,
                                           java.lang.String... names)
        Checks if the EquipmentSlot contains any items that match the given names.
        Parameters:
        slot - EquipmentSlot to check
        names - 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 an Item that matches the given name. slot is based on EquipmentSlot.getSlot()
        Parameters:
        slot - slot to check, based on EquipmentSlot.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​(EquipmentSlot slot,
                                           java.lang.String name)
        Checks if the EquipmentSlot contains an item that matches the given name.
        Parameters:
        slot - EquipmentSlot to check
        name - 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,
                                               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 on EquipmentSlot.getSlot()
        Parameters:
        slot - slot to check
        ids - 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​(EquipmentSlot slot,
                                           java.lang.Integer... ids)
        Checks if the EquipmentSlot contains an item that matches any the given ids.
        Parameters:
        slot - slot to check
        ids - 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,
                                           Item item)
        Checks if the slot contains the given Item slot based on EquipmentSlot.getSlot()
        Parameters:
        slot - slot to check
        item - The Item to check.
        Returns:
        True if slot contains the given item, else false.
      • slotContains

        public static boolean slotContains​(EquipmentSlot slot,
                                           Item item)
        Checks if the EquipmentSlot contains the given Item
        Parameters:
        slot - slot to check
        item - The Item to check.
        Returns:
        True if slot contains the given item, else false.
      • slotContains

        public static boolean slotContains​(int slot,
                                           Filter<Item> filter)
        Checks if the slot contains items that matches the filter. slot based on EquipmentSlot.getSlot()
        Parameters:
        slot - slot to check for the given filter
        filter - Filter to check
        Returns:
        True if slot contains an Item matching the given filter, else false.
      • slotContains

        public static boolean slotContains​(EquipmentSlot slot,
                                           Filter<Item> filter)
        Checks if the EquipmentSlot contains items that matches the given filter.
        Parameters:
        slot - slot to check for the given filter
        filter - 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 on EquipmentSlot.getSlot()
        Parameters:
        slot - Slot to get item id of.
        Returns:
        Item ID or -1 if no item.
      • getIdForSlot

        public static int getIdForSlot​(EquipmentSlot slot)
        Gets the ID of the Item in the EquipmentSlot
        Parameters:
        slot - slot to get item id of
        Returns:
        Item ID or -1 if slot does not contain an item
      • getNameForSlot

        public static java.lang.String getNameForSlot​(int slot)
        Gets the Name for the Item in the slot. slot based on EquipmentSlot.getSlot()
        Parameters:
        slot - Slot to get item name of.
        Returns:
        Item name or "" if item is null.
      • getNameForSlot

        public static java.lang.String getNameForSlot​(EquipmentSlot slot)
        Gets the Name for the Item in the EquipmentSlot. 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​(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​(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 java.lang.Object[] toArray()
      • add

        public static void add​(int index,
                               Item t)
      • all

        public static java.util.List<Item> all​(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 Item getItemInSlot​(int slot)
        Gets item in specified slot. slot based on EquipmentSlot.getSlot()
        Parameters:
        slot - the index.
        Returns:
        the item in slot.
      • getItemInSlot

        public static Item getItemInSlot​(EquipmentSlot equipmentSlot)
        Gets item in specified slot.
        Parameters:
        equipmentSlot - the EquipmentSlot.
        Returns:
        the item in slot.
      • get

        public static Item get​(int id)
      • get

        public static Item get​(java.lang.Integer... ids)
      • get

        public static Item get​(int[] ids)
      • get

        public static 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 Item get​(java.lang.String... names)
      • except

        public static java.util.List<Item> except​(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​(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​(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​(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​(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.
      • set

        public static Item set​(int index,
                               Item element)
      • isOpen

        public static boolean isOpen()