Package rsb.wrappers

Class RSItem

All Implemented Interfaces:
Clickable, Clickable07

public class RSItem extends MethodProvider implements Clickable07
Represents an item (with an id and stack size). May or may not wrap a component.
  • Constructor Details

  • Method Details

    • getDefinition

      public net.runelite.api.ItemComposition getDefinition()
      Gets this item's definition if available.
      Returns:
      The RSItemDef; or null if unavailable.
    • getID

      public int getID()
      Gets this item's id.
      Returns:
      The id.
    • getStackSize

      public int getStackSize()
      Gets this item's stack size.
      Returns:
      The stack size.
    • hasDefinition

      public boolean hasDefinition()
      Returns whether this item has an available definition.
      Returns:
      true if an item definition is available; otherwise false.
    • getItem

      public RSWidgetItem getItem()
      Gets the item wrapped by this RSItem
      Returns:
      The wrapped item or null
    • getComponent

      public RSWidget getComponent()
      Gets the component wrapped by this RSItem.
      Returns:
      The wrapped component or null.
    • isComponentValid

      public boolean isComponentValid()
      Checks whether a valid component is being wrapped.
      Returns:
      true if there is a visible wrapped component.
    • isItemValid

      public boolean isItemValid()
      Checks whether a valid item is being wrapped.
      Returns:
      true if there is a visible wrapped item
    • getName

      public String getName()
      Gets the name of this item using the wrapped component's name if available, otherwise the definition if available.
      Returns:
      The item's name or null if not found.
    • getInventoryActions

      public String[] getInventoryActions()
      Provides a list of inventory actions for the given item.
      Returns:
      The list of inventory actions for the item
    • getGroundActions

      public String[] getGroundActions()
    • doAction

      public boolean doAction(String action)
      Performs the given action on the component wrapped by this RSItem if possible.
      Specified by:
      doAction in interface Clickable
      Parameters:
      action - The action to perform.
      Returns:
      true if the component was clicked successfully; otherwise false.
    • doAction

      public boolean doAction(String action, String option)
      Performs the given action on the component wrapped by this RSItem if possible.
      Specified by:
      doAction in interface Clickable
      Parameters:
      action - The action to perform.
      option - The option of the action to perform.
      Returns:
      true if the component was clicked successfully; otherwise false.
    • doAction

      public boolean doAction(Predicate<RSMenuNode> predicate)
    • doClick

      public boolean doClick(boolean left)
      Clicks the component wrapped by this RSItem if possible.
      Specified by:
      doClick in interface Clickable
      Parameters:
      left - true if the component should be left-click; false if it should be right-clicked.
      Returns:
      true if the component was clicked successfully; otherwise false.
    • doClick

      public boolean doClick()
      Specified by:
      doClick in interface Clickable
    • doHover

      public boolean doHover()
      Specified by:
      doHover in interface Clickable
    • isClickable

      public boolean isClickable()
      Specified by:
      isClickable in interface Clickable07