Record Class ItemType

java.lang.Object
java.lang.Record
com.botwithus.bot.api.model.ItemType
Record Components:
id - the item ID
name - the item display name
members - whether this is a members-only item
stackable - whether this item stacks in inventory
shopPrice - the base shop price
geBuyLimit - the Grand Exchange buy limit
category - the item category ID
notedId - the noted variant ID, or -1 if none
wearpos - the equipment slot this item occupies, or -1 if not wearable
wearpos2 - a second equipment slot this item blocks while worn, or NO_WEARPOS if none
wearpos3 - a third equipment slot this item blocks while worn, or NO_WEARPOS if none
exchangeable - whether this item can be traded on the Grand Exchange
groundOptions - the right-click options when the item is on the ground
inventoryOptions - the right-click options when the item is in inventory
params - additional key-value parameters from the item definition

public record ItemType(int id, String name, boolean members, boolean stackable, int shopPrice, int geBuyLimit, int category, int notedId, int wearpos, int wearpos2, int wearpos3, boolean exchangeable, List<String> groundOptions, List<String> inventoryOptions, Map<String,Object> params) extends Record
Item definition from the game cache.

An item can claim up to three equipment slots. wearpos is the slot it is worn in; wearpos2 and wearpos3 are further slots the item blocks while worn. A two-handed weapon is the common case: it is worn in the weapon slot and blocks the shield slot through wearpos2 (cache item 36021, Camel staff, carries wearpos 3 and wearpos2 5, while the one-handed Dragon mace, item 1434, carries wearpos 3 and wearpos2 -1). See isTwoHanded().

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The cache's value for a wear position the item does not claim.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemType(int id, String name, boolean members, boolean stackable, int shopPrice, int geBuyLimit, int category, int notedId, int wearpos, boolean exchangeable, List<String> groundOptions, List<String> inventoryOptions, Map<String,Object> params)
    Builds a definition that claims no extra wear positions; wearpos2 and wearpos3 are NO_WEARPOS.
    ItemType(int id, String name, boolean members, boolean stackable, int shopPrice, int geBuyLimit, int category, int notedId, int wearpos, int wearpos2, int wearpos3, boolean exchangeable, List<String> groundOptions, List<String> inventoryOptions, Map<String,Object> params)
    Creates an instance of a ItemType record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the value of the category record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    boolean
    Returns the value of the exchangeable record component.
    int
    Returns the value of the geBuyLimit record component.
    Returns the value of the groundOptions record component.
    final int
    Returns a hash code value for this object.
    int
    id()
    Returns the value of the id record component.
    Returns the value of the inventoryOptions record component.
    boolean
    Whether wearing this item also blocks the shield slot, so nothing can be worn in the off hand alongside it.
    boolean
    Returns the value of the members record component.
    Returns the value of the name record component.
    int
    Returns the value of the notedId record component.
    Returns the value of the params record component.
    int
    Returns the value of the shopPrice record component.
    boolean
    Returns the value of the stackable record component.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the wearpos record component.
    int
    Returns the value of the wearpos2 record component.
    int
    Returns the value of the wearpos3 record component.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NO_WEARPOS

      public static final int NO_WEARPOS
      The cache's value for a wear position the item does not claim.
      See Also:
  • Constructor Details

    • ItemType

      public ItemType(int id, String name, boolean members, boolean stackable, int shopPrice, int geBuyLimit, int category, int notedId, int wearpos, boolean exchangeable, List<String> groundOptions, List<String> inventoryOptions, Map<String,Object> params)
      Builds a definition that claims no extra wear positions; wearpos2 and wearpos3 are NO_WEARPOS. Kept so code written before the extra wear positions were exposed still compiles and links.
      Parameters:
      id - the item ID
      name - the item display name
      members - whether this is a members-only item
      stackable - whether this item stacks in inventory
      shopPrice - the base shop price
      geBuyLimit - the Grand Exchange buy limit
      category - the item category ID
      notedId - the noted variant ID, or -1 if none
      wearpos - the equipment slot this item occupies, or -1
      exchangeable - whether this item can be traded on the Grand Exchange
      groundOptions - the right-click options when the item is on the ground
      inventoryOptions - the right-click options when the item is in inventory
      params - additional key-value parameters from the item definition
    • ItemType

      public ItemType(int id, String name, boolean members, boolean stackable, int shopPrice, int geBuyLimit, int category, int notedId, int wearpos, int wearpos2, int wearpos3, boolean exchangeable, List<String> groundOptions, List<String> inventoryOptions, Map<String,Object> params)
      Creates an instance of a ItemType record class.
      Parameters:
      id - the value for the id record component
      name - the value for the name record component
      members - the value for the members record component
      stackable - the value for the stackable record component
      shopPrice - the value for the shopPrice record component
      geBuyLimit - the value for the geBuyLimit record component
      category - the value for the category record component
      notedId - the value for the notedId record component
      wearpos - the value for the wearpos record component
      wearpos2 - the value for the wearpos2 record component
      wearpos3 - the value for the wearpos3 record component
      exchangeable - the value for the exchangeable record component
      groundOptions - the value for the groundOptions record component
      inventoryOptions - the value for the inventoryOptions record component
      params - the value for the params record component
  • Method Details

    • isTwoHanded

      public boolean isTwoHanded()
      Whether wearing this item also blocks the shield slot, so nothing can be worn in the off hand alongside it. True for two-handed weapons (Dragon 2h sword, Staff of light, Noxious scythe, Camel staff), false for one-handed ones (Abyssal whip, longswords, maces).
      Returns:
      true if wearpos2 or wearpos3 is the shield slot
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • id

      public int id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • members

      public boolean members()
      Returns the value of the members record component.
      Returns:
      the value of the members record component
    • stackable

      public boolean stackable()
      Returns the value of the stackable record component.
      Returns:
      the value of the stackable record component
    • shopPrice

      public int shopPrice()
      Returns the value of the shopPrice record component.
      Returns:
      the value of the shopPrice record component
    • geBuyLimit

      public int geBuyLimit()
      Returns the value of the geBuyLimit record component.
      Returns:
      the value of the geBuyLimit record component
    • category

      public int category()
      Returns the value of the category record component.
      Returns:
      the value of the category record component
    • notedId

      public int notedId()
      Returns the value of the notedId record component.
      Returns:
      the value of the notedId record component
    • wearpos

      public int wearpos()
      Returns the value of the wearpos record component.
      Returns:
      the value of the wearpos record component
    • wearpos2

      public int wearpos2()
      Returns the value of the wearpos2 record component.
      Returns:
      the value of the wearpos2 record component
    • wearpos3

      public int wearpos3()
      Returns the value of the wearpos3 record component.
      Returns:
      the value of the wearpos3 record component
    • exchangeable

      public boolean exchangeable()
      Returns the value of the exchangeable record component.
      Returns:
      the value of the exchangeable record component
    • groundOptions

      public List<String> groundOptions()
      Returns the value of the groundOptions record component.
      Returns:
      the value of the groundOptions record component
    • inventoryOptions

      public List<String> inventoryOptions()
      Returns the value of the inventoryOptions record component.
      Returns:
      the value of the inventoryOptions record component
    • params

      public Map<String,Object> params()
      Returns the value of the params record component.
      Returns:
      the value of the params record component