Interface IClient

All Superinterfaces:
RuneLiteWrapper<net.runelite.api.Client>

public interface IClient extends RuneLiteWrapper<net.runelite.api.Client>
The primary interface for interacting with the game client.

This interface provides comprehensive access to the game client's functionality, including player information, game state, widgets, world management, and interaction capabilities. It wraps the RuneLite Client and extends it with Storm API-specific functionality.

The IClient interface is central to most game automation tasks, providing methods for:

  • Accessing player and NPC data
  • Reading and modifying game variables (varps, varbits, varcs)
  • Managing widgets and UI elements
  • Performing game interactions
  • World hopping and world management
  • Login and authentication operations
See Also:
  • Method Details

    • getBuildId

      String getBuildId()
      Gets the build identifier of the game client.
      Returns:
      the build ID string identifying the current client version
    • getLocalPlayer

      IPlayer getLocalPlayer()
      Gets the local player character.

      Returns the player entity representing the currently logged-in character. This is the primary way to access information about the user's character.

      Returns:
      the local IPlayer, or null if not logged in
    • interact

      void interact(AutomatedMenu automatedMenu)
      Performs a menu interaction using an automated menu entry.

      This method executes a game interaction as defined by the provided AutomatedMenu object, which contains all the necessary parameters for the interaction.

      Parameters:
      automatedMenu - the AutomatedMenu containing interaction parameters
    • interact

      default void interact(int identifier, int opcode, int param0, int param1)
      Performs a menu interaction with raw parameters.

      This is a convenience method that creates an AutomatedMenu from the provided parameters and executes the interaction.

      Parameters:
      identifier - the menu entry identifier
      opcode - the menu action opcode
      param0 - the first parameter (typically widget child or x coordinate)
      param1 - the second parameter (typically widget parent or y coordinate)
    • getPlayerOptions

      String[] getPlayerOptions()
      Gets the available player right-click menu options.

      Returns the array of menu options that appear when right-clicking on other players, such as "Trade", "Follow", etc.

      Returns:
      an array of player menu option strings
    • getObjectComposition

      net.runelite.api.ObjectComposition getObjectComposition(int id)
      Gets the composition data for a game object by its ID.

      Object compositions contain metadata about game objects including their name, actions, and transformation data.

      Parameters:
      id - the object ID to look up
      Returns:
      the ObjectComposition for the specified object ID
    • isClientThread

      boolean isClientThread()
      Checks if the current thread is the game client thread.

      Many game operations must be performed on the client thread. Use this method to determine if thread synchronization is needed.

      Returns:
      true if the current thread is the client thread, false otherwise
    • getItemComposition

      net.runelite.api.ItemComposition getItemComposition(int id)
      Gets the composition data for an item by its ID.

      Item compositions contain metadata about items including their name, examine text, and other properties.

      Parameters:
      id - the item ID to look up
      Returns:
      the ItemComposition for the specified item ID
    • getItemContainer

      net.runelite.api.ItemContainer getItemContainer(int id)
      Gets an item container by its ID.

      Item containers represent collections of items such as the inventory, bank, or equipment.

      Parameters:
      id - the container ID to retrieve
      Returns:
      the ItemContainer with the specified ID, or null if not found
    • getItemContainer

      @Deprecated(forRemoval=true) default net.runelite.api.ItemContainer getItemContainer(net.runelite.api.InventoryID inventoryID)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Gets an item container by its inventory type.
      Parameters:
      inventoryID - the InventoryID to retrieve
      Returns:
      the ItemContainer for the specified inventory
    • getSelectedSpellWidget

      int getSelectedSpellWidget()
      Gets the widget ID of the currently selected spell.
      Returns:
      the widget ID of the selected spell, or -1 if no spell is selected
    • getSelectedSpellChildIndex

      int getSelectedSpellChildIndex()
      Gets the child index of the currently selected spell widget.
      Returns:
      the child index of the selected spell widget
    • getSelectedSpellItemId

      int getSelectedSpellItemId()
      Gets the item ID associated with the currently selected spell.
      Returns:
      the item ID associated with the selected spell, or -1 if not applicable
    • getTopLevelWorldView

      net.runelite.api.WorldView getTopLevelWorldView()
      Gets the top-level world view.

      The world view contains information about the currently loaded game scene including tiles, objects, and entities.

      Returns:
      the top-level WorldView
    • getTiles

      ITile[][][] getTiles()
      Gets the three-dimensional array of tiles in the current scene.

      The array is indexed by [plane][x][y] where plane is the height level.

      Returns:
      a 3D array of ITile objects representing the scene
    • getPlane

      int getPlane()
      Gets the current plane (height level) of the local player.

      Planes range from 0 (ground level) to 3 (highest level).

      Returns:
      the current plane number
    • getWidgets

      IWidget[] getWidgets(int group)
      Gets all widgets in a widget group.
      Parameters:
      group - the widget group ID
      Returns:
      an array of IWidget objects in the group, or null if the group doesn't exist
    • getWidget

      IWidget getWidget(int group, int id)
      Gets a specific widget by group and child ID.
      Parameters:
      group - the widget group ID
      id - the widget child ID
      Returns:
      the IWidget, or null if not found
    • getWidget

      IWidget getWidget(int componentId)
      Gets a widget by its packed component ID.

      The component ID combines the group and child ID into a single integer.

      Parameters:
      componentId - the packed component ID
      Returns:
      the IWidget, or null if not found
    • getHintArrowPlayer

      IPlayer getHintArrowPlayer()
      Gets the player that the hint arrow is pointing to.
      Returns:
      the IPlayer targeted by the hint arrow, or null if none
    • getVarps

      int[] getVarps()
      Gets the array of varp (variable player) values.

      Varps store various player-specific game state values.

      Returns:
      an array of varp values
    • getVarbitValue

      int getVarbitValue(int[] vars, int id)
      Gets the value of a varbit from a varp array.

      Varbits are sub-values stored within varps using bit packing.

      Parameters:
      vars - the varp array to read from
      id - the varbit ID
      Returns:
      the varbit value
    • getVarpValue

      int getVarpValue(int id)
      Gets the current value of a varp.
      Parameters:
      id - the varp ID
      Returns:
      the varp value
    • getVarcIntValue

      int getVarcIntValue(int id)
      Gets the current value of a varc integer.

      Varcs (variable client) are client-side variables not synchronized with the server.

      Parameters:
      id - the varc ID
      Returns:
      the varc integer value
    • getVarcStrValue

      String getVarcStrValue(int id)
      Gets the current value of a varc string.
      Parameters:
      id - the varc ID
      Returns:
      the varc string value
    • getGameState

      net.runelite.api.GameState getGameState()
      Gets the current game state.

      The game state indicates whether the client is logged in, loading, at the login screen, etc.

      Returns:
      the current GameState
    • getTickCount

      int getTickCount()
      Gets the current game tick count.

      The tick count increments every game tick (approximately 600ms).

      Returns:
      the current tick count
    • runScript

      void runScript(Object... args)
      Executes a client script with the provided arguments.

      Client scripts are used internally by the game for various UI and gameplay functionality.

      Parameters:
      args - the script arguments, where the first argument is typically the script ID
    • getBoostedSkillLevel

      int getBoostedSkillLevel(net.runelite.api.Skill skill)
      Gets the boosted level of a skill.

      The boosted level includes temporary boosts and drains.

      Parameters:
      skill - the Skill to query
      Returns:
      the current boosted level
    • getRealSkillLevel

      int getRealSkillLevel(net.runelite.api.Skill skill)
      Gets the real (base) level of a skill.

      The real level excludes temporary boosts and drains.

      Parameters:
      skill - the Skill to query
      Returns:
      the base skill level
    • getSkillExperience

      int getSkillExperience(net.runelite.api.Skill skill)
      Gets the total experience in a skill.
      Parameters:
      skill - the Skill to query
      Returns:
      the total experience points
    • isInInstancedRegion

      boolean isInInstancedRegion()
      Checks if the player is currently in an instanced region.

      Instanced regions are unique areas created for specific players or groups, such as boss instances or minigame areas.

      Returns:
      true if in an instanced region, false otherwise
    • getWorldList

      net.runelite.api.World[] getWorldList()
      Gets the list of available worlds.
      Returns:
      an array of World objects, or null if not loaded
    • getWorld

      int getWorld()
      Gets the current world number.
      Returns:
      the world number the player is connected to
    • openWorldHopper

      void openWorldHopper()
      Opens the world hopper interface.
    • changeWorld

      void changeWorld(net.runelite.api.World world)
      Changes to a different world.

      This method initiates a world change but does not wait for completion.

      Parameters:
      world - the World to change to
    • hopToWorld

      void hopToWorld(net.runelite.api.World world)
      Hops to a different world.

      Similar to changeWorld(World), this initiates a world hop.

      Parameters:
      world - the World to hop to
    • getCanvas

      Canvas getCanvas()
      Gets the game canvas.

      The canvas is the AWT component where the game renders.

      Returns:
      the game Canvas
    • setVarcIntValue

      void setVarcIntValue(int var, int value)
      Sets the value of a varc integer.
      Parameters:
      var - the varc ID
      value - the value to set
    • setVarcStrValue

      void setVarcStrValue(int var, String value)
      Sets the value of a varc string.
      Parameters:
      var - the varc ID
      value - the string value to set
    • getGrandExchangeOffers

      net.runelite.api.GrandExchangeOffer[] getGrandExchangeOffers()
      Gets the Grand Exchange offers.
      Returns:
      an array of GrandExchangeOffer objects
    • getMapRegions

      int[] getMapRegions()
      Gets the IDs of the currently loaded map regions.
      Returns:
      an array of region IDs
    • getWorldType

      EnumSet<net.runelite.api.WorldType> getWorldType()
      Gets the types of the current world.

      World types indicate properties like PvP, members, etc.

      Returns:
      an EnumSet of WorldType values
    • getIntStack

      int[] getIntStack()
      Gets the integer stack used by client scripts.
      Returns:
      the script integer stack array
    • getEnergy

      int getEnergy()
      Gets the player's current run energy.
      Returns:
      the run energy value (0-10000, representing 0-100%)
    • getFriendContainer

      net.runelite.api.FriendContainer getFriendContainer()
      Gets the friend list container.
      Returns:
      the FriendContainer containing friend list data
    • isFriended

      boolean isFriended(String name, boolean mustBeLoggedIn)
      Checks if a player is on the friend list.
      Parameters:
      name - the player name to check
      mustBeLoggedIn - if true, only returns true if the friend is online
      Returns:
      true if the player is a friend (and online if required)
    • getViewportHeight

      int getViewportHeight()
      Gets the height of the game viewport.
      Returns:
      the viewport height in pixels
    • getViewportWidth

      int getViewportWidth()
      Gets the width of the game viewport.
      Returns:
      the viewport width in pixels
    • isResized

      boolean isResized()
      Checks if the client is in resizable mode.
      Returns:
      true if resizable mode is enabled, false for fixed mode
    • getMapAngle

      int getMapAngle()
      Gets the current camera angle on the map.
      Returns:
      the map angle in JAU (Jagex Angle Units)
    • getWorldMap

      net.runelite.api.worldmap.WorldMap getWorldMap()
      Gets the world map interface.
      Returns:
      the WorldMap instance
    • createWorld

      net.runelite.api.World createWorld()
      Creates a new World object for world hopping.
      Returns:
      a new World instance
    • setSelectedSceneTileX

      void setSelectedSceneTileX(int sceneX)
      Sets the X coordinate of the selected scene tile.

      Used for tile-based interactions and movement.

      Parameters:
      sceneX - the scene X coordinate
    • setSelectedSceneTileY

      void setSelectedSceneTileY(int sceneY)
      Sets the Y coordinate of the selected scene tile.

      Used for tile-based interactions and movement.

      Parameters:
      sceneY - the scene Y coordinate
    • setViewportWalking

      void setViewportWalking(boolean b)
      Enables or disables viewport walking mode.
      Parameters:
      b - true to enable viewport walking, false to disable
    • getLocalDestinationLocation

      net.runelite.api.coords.LocalPoint getLocalDestinationLocation()
      Gets the local destination point for player movement.
      Returns:
      the destination LocalPoint, or null if not moving
    • setLastButton

      void setLastButton(int button)
      Sets the last button pressed for interaction handling.
      Parameters:
      button - the button code
    • setCheckClick

      void setCheckClick(boolean checkClick)
      Sets whether click checking is enabled.
      Parameters:
      checkClick - true to enable click checking
    • getFollower

      @Nullable INPC getFollower()
      Gets the NPC that is following the player (pet or follower).
      Returns:
      the follower INPC, or null if no follower
    • getHintArrowNpc

      INPC getHintArrowNpc()
      Gets the NPC that the hint arrow is pointing to.
      Returns:
      the INPC targeted by the hint arrow, or null if none
    • invokeWidgetAction

      void invokeWidgetAction(int identifier, int param1, int param0, int itemId, String target)
      Invokes a widget action.
      Parameters:
      identifier - the action identifier
      param1 - the first parameter (typically widget ID)
      param0 - the second parameter (typically child index)
      itemId - the item ID if applicable
      target - the target text for the action
    • getLoginMessage

      String getLoginMessage()
      Gets the current login message displayed to the player.
      Returns:
      the login message string
    • setLoginIndex

      void setLoginIndex(int loginIndex)
      Sets the login screen index.

      Controls which login screen state is displayed.

      Parameters:
      loginIndex - the login index to set
    • setMouseIdleTicks

      void setMouseIdleTicks(int ticks)
      Sets the mouse idle tick counter.

      Used to track mouse activity for idle detection.

      Parameters:
      ticks - the number of ticks the mouse has been idle
    • setKeyboardIdleTicks

      void setKeyboardIdleTicks(int ticks)
      Sets the keyboard idle tick counter.

      Used to track keyboard activity for idle detection.

      Parameters:
      ticks - the number of ticks the keyboard has been idle
    • loadWorlds

      boolean loadWorlds()
      Attempts to load the world list from the server.
      Returns:
      true if the world list was loaded successfully
    • promptCredentials

      void promptCredentials(boolean clearPassword)
      Prompts for login credentials.
      Parameters:
      clearPassword - if true, clears the password field
    • isWorldSelectOpen

      boolean isWorldSelectOpen()
      Checks if the world select screen is currently open.
      Returns:
      true if the world select is open
    • setWorldSelectOpen

      void setWorldSelectOpen(boolean open)
      Sets whether the world select screen is open.
      Parameters:
      open - true to open world select, false to close
    • isOAuthCredentialsSet

      boolean isOAuthCredentialsSet()
      Checks if OAuth credentials are currently set.
      Returns:
      true if OAuth credentials are configured
    • getPassword

      String getPassword()
      Gets the current password.
      Returns:
      the password string
    • setPassword

      void setPassword(String password)
      Sets the password for login.
      Parameters:
      password - the password to set
    • getUsername

      String getUsername()
      Gets the current username.
      Returns:
      the username string
    • setUsername

      void setUsername(String username)
      Sets the username for login.
      Parameters:
      username - the username to set
    • setOtp

      void setOtp(String otp)
      Sets the one-time password (authenticator code) for login.
      Parameters:
      otp - the OTP code
    • getWindowedMode

      int getWindowedMode()
      Gets the current windowed mode setting.
      Returns:
      the windowed mode value
    • setWindowedMode

      void setWindowedMode(int i)
      Sets the windowed mode.
      Parameters:
      i - the windowed mode value to set
    • setMouseIdleCycles

      void setMouseIdleCycles(int minValue)
      Sets the mouse idle cycle counter.

      Similar to setMouseIdleTicks(int) but uses cycles.

      Parameters:
      minValue - the minimum cycle value
    • getHoveredEntities

      List<? extends SceneEntity> getHoveredEntities()
      Gets the list of entities currently being hovered by the mouse.
      Returns:
      a list of SceneEntity objects under the cursor
    • getSelectedSceneTile

      ITile getSelectedSceneTile()
      Gets the currently selected scene tile.
      Returns:
      the selected ITile, or null if none selected
    • setDraggedWidget

      void setDraggedWidget(net.runelite.api.widgets.Widget widget)
      Sets the widget currently being dragged.
      Parameters:
      widget - the Widget being dragged
    • getMinimapState

      int getMinimapState()
      Gets the current minimap state.

      Indicates whether the minimap is visible, hidden, or in compass mode.

      Returns:
      the minimap state value
    • setMinimapState

      void setMinimapState(int state)
      Sets the minimap state.
      Parameters:
      state - the minimap state to set
    • processDialog

      void processDialog(int id, int idx)
      Processes a dialog option selection.
      Parameters:
      id - the dialog ID
      idx - the option index to select
    • setMenuOpened

      void setMenuOpened(boolean opened)
      Sets whether the right-click menu is open.
      Parameters:
      opened - true to mark menu as opened
    • interact

      default void interact(int x, int y)
      Performs a click interaction at the specified coordinates.

      Equivalent to calling interact(int, int, boolean) with click set to true.

      Parameters:
      x - the X coordinate
      y - the Y coordinate
    • interact

      void interact(int x, int y, boolean click)
      Performs an interaction at the specified coordinates.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      click - whether to perform a click action
    • setGameState

      void setGameState(net.runelite.api.GameState gameState)
      Sets the game state.
      Parameters:
      gameState - the GameState to set
    • setGameState

      void setGameState(int gameState)
      Sets the game state by its integer value.
      Parameters:
      gameState - the game state value to set
    • setOAuthLoginMode

      void setOAuthLoginMode()
      Switches to OAuth login mode.
    • setNormalLoginMode

      void setNormalLoginMode()
      Switches to normal (username/password) login mode.
    • getDisplayName

      String getDisplayName()
      Gets the display name of the logged-in character.
      Returns:
      the character's display name
    • getSessionId

      String getSessionId()
      Gets the current session ID.
      Returns:
      the session ID string
    • getCharacterId

      String getCharacterId()
      Gets the character ID of the logged-in character.
      Returns:
      the character ID string
    • setDisplayName

      void setDisplayName(String displayName)
      Sets the display name.
      Parameters:
      displayName - the display name to set
    • setSessionId

      void setSessionId(String sessionId)
      Sets the session ID.
      Parameters:
      sessionId - the session ID to set
    • setCharacterId

      void setCharacterId(String characterId)
      Sets the character ID.
      Parameters:
      characterId - the character ID to set
    • getLoginResponse1

      String getLoginResponse1()
      Gets the first line of the login response message.
      Returns:
      the first login response line
    • getLoginResponse2

      String getLoginResponse2()
      Gets the second line of the login response message.
      Returns:
      the second login response line
    • getLoginResponse3

      String getLoginResponse3()
      Gets the third line of the login response message.
      Returns:
      the third login response line
    • getPlayerContainer

      PlayerContainer getPlayerContainer()
      Gets the player container for accessing all players.
      Returns:
      the PlayerContainer
    • getNpcContainer

      NpcContainer getNpcContainer()
      Gets the NPC container for accessing all NPCs.
      Returns:
      the NpcContainer
    • getTileContainer

      TileContainer getTileContainer()
      Gets the tile container for accessing all tiles.
      Returns:
      the TileContainer
    • sleep

      void sleep(int cycles)
      Sleeps for the specified number of game cycles.

      This pauses execution for approximately cycles * 20ms.

      Parameters:
      cycles - the number of cycles to sleep
    • getDiscordId

      String getDiscordId()
      Gets the Discord user ID if connected.
      Returns:
      the Discord ID string, or null if not connected
    • getDiscordUser

      String getDiscordUser()
      Gets the Discord username if connected.
      Returns:
      the Discord username, or null if not connected
    • getUserId

      Long getUserId()
      Gets the Storm user ID.
      Returns:
      the user ID, or null if not authenticated
    • invokeMenuAction

      void invokeMenuAction(int param0, int param1, int opcode, int id, int itemId, int worldViewId, String option, String target)
      Invokes a menu action with full parameters.

      This is a low-level method for executing menu actions with complete control over all parameters.

      Parameters:
      param0 - the first parameter
      param1 - the second parameter
      opcode - the menu action opcode
      id - the action identifier
      itemId - the item ID if applicable
      worldViewId - the world view ID
      option - the menu option text
      target - the menu target text
    • getMouseRecorder

      Object getMouseRecorder()
    • getMouseRecorderLock

      Object getMouseRecorderLock()
    • getMouseRecorderXs

      int[] getMouseRecorderXs()
    • getMouseRecorderYs

      int[] getMouseRecorderYs()
    • getMouseRecorderTimes

      long[] getMouseRecorderTimes()
    • getMouseRecorderEnabled

      boolean getMouseRecorderEnabled()
    • setMouseRecorderEnabled

      void setMouseRecorderEnabled(boolean enabled)
    • getMouseRecorderIndex

      int getMouseRecorderIndex()
    • setMouseRecorderIndex

      void setMouseRecorderIndex(int index)