Package rsb.wrappers

Class RSObject

All Implemented Interfaces:
Clickable, Clickable07, Positionable

public class RSObject extends MethodProvider implements Clickable07, Positionable
A wrapper for a tile object which interprets the underlying tile objects type and furthermore acts as a factory for the RSModel of the RSObject (refer to getModel for better explanation) RSObject can represent any types game object
  • Constructor Details

    • RSObject

      public RSObject(MethodContext ctx, net.runelite.api.TileObject obj, RSObject.Type type, int plane)
      Creates a new RSObject with the following parameters:
      Parameters:
      ctx - The context in which the object exists (the singleton RuneLite)
      obj - The TileObject which this RSObject is associated with
      type - The type of game object corresponding to the enumerated types
      plane - The plane that this object exists on
  • Method Details

    • getLocation

      public WalkerTile getLocation()
      Gets the RSTile on which this object is centered. An RSObject may cover multiple tiles, in which case this will return the floored central tile.
      Specified by:
      getLocation in interface Positionable
      Returns:
      The central RSTile.
      See Also:
    • getArea

      public RSArea getArea()
      Gets the area of tiles covered by this object.
      Returns:
      The RSArea containing all the tiles on which this object can be found.
    • getDef

      public net.runelite.api.ObjectComposition getDef()
      Gets the object definition of this object.
      Returns:
      The RSObjectDef if available, otherwise null.
    • setClientThreadProvider

      public void setClientThreadProvider()
      Gets the client thread provider from the clientUI to allow passing runnables to it
    • getID

      public int getID()
      Gets the ID of this object.
      Returns:
      The ID.
    • getName

      public String getName(RSObject object)
      Returns the name of the object.
      Parameters:
      object - The object to look up.
      Returns:
      The object name if the definition is available; otherwise "".
    • getName

      public String getName()
      Returns the name of the object.
      Returns:
      The object name if the definition is available; otherwise "".
    • getModel

      public RSModel getModel()
      Gets the Model of this object. Checks what kind of object it is and returns the model of the object based on that
      Returns:
      The RSModel, or null if unavailable.
    • isOnScreen

      public boolean isOnScreen()
      Determines whether this object is on the game screen.
      Returns:
      true if the object is on screen else false
    • getType

      public RSObject.Type getType()
      Returns this object's type.
      Returns:
      The type of the object.
    • doAction

      public boolean doAction(String action)
      Performs the specified action on this object.
      Specified by:
      doAction in interface Clickable
      Parameters:
      action - the menu item to search and click
      Returns:
      true if clicked, false if object does not contain the desired action
    • doAction

      public boolean doAction(String action, String option)
      Performs the specified action on this object.
      Specified by:
      doAction in interface Clickable
      Parameters:
      action - the action of the menu item to search and click
      option - the option of the menu item to search and click
      Returns:
      true if clicked, false if object does not contain the desired action
    • doClick

      public boolean doClick()
      Left-clicks this object.
      Specified by:
      doClick in interface Clickable
      Returns:
      true if clicked otherwise false
    • doClick

      public boolean doClick(boolean leftClick)
      Clicks this object.
      Specified by:
      doClick in interface Clickable
      Parameters:
      leftClick - true to left-click; false to right-click.
      Returns:
      true if clicked otherwise false
    • doHover

      public boolean doHover()
      Moves the mouse over this object.
      Specified by:
      doHover in interface Clickable
      Returns:
      true if the object was hovered over (or attempted to) otherwise false
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • turnTo

      public boolean turnTo()
      Turns the camera towards the RSObject.
      Specified by:
      turnTo in interface Positionable
      Returns:
      true If RSObject is on screen after attempted to move camera angle.
    • isClickable

      public boolean isClickable()
      Checks if the RSObject is clickable (interactive)
      Specified by:
      isClickable in interface Clickable07
      Returns:
      true if the object is capable of being interacted with otherwise false
    • getObj

      public net.runelite.api.TileObject getObj()
      Gets the TileObject associated with this RSObject
      Returns:
      the TileObject else null