Package net.storm.sdk.game
Class Client
java.lang.Object
net.storm.sdk.game.Client
Provides low-level access to the game client and its internal state.
This class exposes methods for interacting with the game engine, including
menu interactions, skill queries, world management, login handling, and
various client settings.
This is a comprehensive utility class that wraps the underlying IClient
implementation and provides static access to most client functionality.
Example usage:
// Check if we're on the client thread
if (Client.isClientThread()) {
// Safe to perform client operations
}
// Get skill information
int attackLevel = Client.getRealSkillLevel(Skill.ATTACK);
int currentHp = Client.getBoostedSkillLevel(Skill.HITPOINTS);
// Interact with a menu entry
Client.interact(identifier, opcode, param0, param1);
// World hopping
World[] worlds = Client.getWorldList();
if (worlds != null) {
Client.hopToWorld(worlds[0]);
}
// Get current energy
int runEnergy = Client.getEnergy();
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidchangeWorld(net.runelite.api.World world) Changes to a different world without hopping.static net.runelite.api.WorldCreates a new empty World instance.static intgetBoostedSkillLevel(net.runelite.api.Skill skill) Gets the boosted (current) level of a skill.static StringGets the current build ID of the client.static CanvasGets the game canvas for rendering and input.static StringGets the character ID for the logged-in account.static IClientGets the underlying client interface.static StringGets the Discord user ID associated with the client.static StringGets the Discord username associated with the client.static StringGets the display name of the logged-in player.static intGets the current run energy (0-10000, where 10000 = 100%).static INPCGets the player's follower NPC (pet).static net.runelite.api.FriendContainerGets the friend list container.static net.runelite.api.GameStateGets the current game state.static net.runelite.api.GrandExchangeOffer[]Gets all Grand Exchange offer slots.static INPCGets the NPC indicated by the hint arrow, if any.static IPlayerGets the player indicated by the hint arrow, if any.static List<? extends SceneEntity> Gets the list of entities currently under the mouse cursor.static int[]Gets the integer stack used by client scripts.static net.runelite.api.ItemCompositiongetItemComposition(int id) Gets the composition data for an item by ID.static net.runelite.api.ItemContainergetItemContainer(int id) Gets an item container by its ID.static net.runelite.api.coords.LocalPointGets the local destination point for the current movement.static StringGets the current login message displayed on the login screen.static StringGets the first login response message.static StringGets the second login response message.static StringGets the third login response message.static intGets the current camera/map angle in JAU (Jagex Angle Units).static int[]Gets the IDs of all loaded map regions.static intGets the current minimap state.static booleanstatic intstatic long[]static int[]static int[]static net.runelite.api.ObjectCompositiongetObjectComposition(int id) Gets the composition data for a game object by ID.static StringGets the current password entered on the login screen.static intgetPlane()Gets the current plane (floor level) the player is on.static String[]Gets the available player right-click menu options.static net.runelite.api.PreferencesGets the client preferences.static intgetRealSkillLevel(net.runelite.api.Skill skill) Gets the real (base) level of a skill.static ITileGets the currently selected scene tile.static StringGets the current session ID.static intgetSkillExperience(net.runelite.api.Skill skill) Gets the experience points in a skill.static intGets the current game tick count.static net.runelite.api.WorldViewGets the top-level world view.static LongGets the user ID for the current session.static StringGets the current username entered on the login screen.static intgetVarbitValue(int[] vars, int id) Gets a varbit value from a varps array.static intgetVarcIntValue(int varClientInt) Gets the value of a client integer variable.static StringgetVarcStrValue(int varClientStr) Gets the value of a client string variable.static int[]getVarps()Gets the array of all varps (variable parameters).static intgetVarpValue(int id) Gets the value of a varp (variable parameter).static intGets the viewport height in pixels.static intGets the viewport width in pixels.static intGets the current windowed mode setting.static intgetWorld()Gets the current world number.static net.runelite.api.World[]Gets the list of all available worlds.static net.runelite.api.worldmap.WorldMapGets the world map instance.static EnumSet<net.runelite.api.WorldType> Gets the set of world types for the current world.static net.runelite.api.ClientGets the wrapped RuneLite client instance.static voidhopToWorld(net.runelite.api.World world) Hops to a different world while logged in.static voidinteract(int x, int y) Performs an interaction at the specified screen coordinates.static voidinteract(int x, int y, boolean click) Performs an interaction at the specified screen coordinates with optional click.static voidinteract(int identifier, int opcode, int param0, int param1) Sends a menu interaction with default click coordinates.static voidinteract(int identifier, int opcode, int param0, int param1, int clickX, int clickY) Sends a menu interaction with click coordinates but no entity.static voidinteract(int identifier, int opcode, int param0, int param1, int clickX, int clickY, SceneEntity sceneEntity) Sends a menu interaction with full parameter specification.static voidinteract(AutomatedMenu automatedMenu) Sends an automated menu interaction to the client.static voidinvokeMenuAction(int param0, int param1, int opcode, int id, int itemId, int worldViewId, String option, String target) Invokes a menu action with full parameter specification.static voidinvokeWidgetAction(int identifier, int param1, int param0, int itemId, String target) Invokes a widget action directly.static booleanChecks if the current thread is the game client thread.static booleanisFriended(String name, boolean b) Checks if a player with the given name is on the friends list.static booleanChecks if the player is in an instanced region.static booleanChecks if OAuth credentials are currently set.static booleanChecks if the client is in resizable mode.static booleanChecks if the world select interface is currently open.static booleanLoads the world list from the server.static voidOpens the world hopper interface.static voidprocessDialog(int id, int idx) Processes a dialog with the specified ID and index.static voidpromptCredentials(boolean clearPassword) Prompts for login credentials on the login screen.static voidRuns a client script with the specified arguments.static voidsetCharacterId(String characterId) Sets the character ID.static voidsetCheckClick(boolean checkClick) Sets whether to check for click validation.static voidsetDisplayName(String displayName) Sets the display name for the player.static voidsetDraggedWidget(net.runelite.api.widgets.Widget widget) Sets the widget currently being dragged.static voidsetGameState(int gameState) Sets the game state by ordinal value.static voidsetGameState(net.runelite.api.GameState gameState) Sets the game state.static voidsetKeyboardIdleTicks(int ticks) Sets the keyboard idle tick counter.static voidsetLastButton(int button) Sets the last mouse button that was pressed.static voidsetLoginIndex(int index) Sets the login screen index.static voidsetMenuOpened(boolean opened) Sets whether the right-click menu is opened.static voidsetMinimapState(int state) Sets the minimap state.static voidsetMouseIdleCycles(int minValue) Sets the mouse idle cycle counter.static voidsetMouseIdleTicks(int ticks) Sets the mouse idle tick counter.static voidsetMouseRecorderEnabled(boolean enabled) static voidSets the client to normal (username/password) login mode.static voidSets the client to OAuth login mode.static voidSets the one-time password (authenticator code) for login.static voidsetPassword(String password) Sets the password on the login screen.static voidsetSelectedSceneTileX(int sceneX) Sets the selected scene tile X coordinate for viewport walking.static voidsetSelectedSceneTileY(int sceneY) Sets the selected scene tile Y coordinate for viewport walking.static voidsetSessionId(String sessionId) Sets the session ID.static voidsetUsername(String username) Sets the username on the login screen.static voidsetVarcIntValue(int inputType, int inputType1) Sets a client integer variable value.static voidsetVarcStrValue(int var, String value) Sets a client string variable value.static voidsetViewportWalking(boolean b) Enables or disables viewport walking mode.static voidsetWindowedMode(int i) Sets the windowed mode.static voidsetWorldSelectOpen(boolean open) Opens or closes the world select interface.static voidsleep(int cycles) Sleeps for the specified number of client cycles.
-
Constructor Details
-
Client
public Client()
-
-
Method Details
-
getClient
Gets the underlying client interface.- Returns:
- the
IClientinstance
-
getWrapped
public static net.runelite.api.Client getWrapped()Gets the wrapped RuneLite client instance.- Returns:
- the underlying RuneLite
Client
-
getBuildId
Gets the current build ID of the client.- Returns:
- the build ID string
-
interact
Sends an automated menu interaction to the client.- Parameters:
automatedMenu- theAutomatedMenuto execute
-
interact
public static void interact(int identifier, int opcode, int param0, int param1, int clickX, int clickY, SceneEntity sceneEntity) Sends a menu interaction with full parameter specification.- Parameters:
identifier- the menu entry identifieropcode- the menu action opcodeparam0- the first parameter (typically widget child or x coordinate)param1- the second parameter (typically widget id or y coordinate)clickX- the x coordinate of the clickclickY- the y coordinate of the clicksceneEntity- the scene entity being interacted with, ornull
-
interact
public static void interact(int identifier, int opcode, int param0, int param1, int clickX, int clickY) Sends a menu interaction with click coordinates but no entity.- Parameters:
identifier- the menu entry identifieropcode- the menu action opcodeparam0- the first parameterparam1- the second parameterclickX- the x coordinate of the clickclickY- the y coordinate of the click
-
interact
public static void interact(int identifier, int opcode, int param0, int param1) Sends a menu interaction with default click coordinates.- Parameters:
identifier- the menu entry identifieropcode- the menu action opcodeparam0- the first parameterparam1- the second parameter
-
interact
public static void interact(int x, int y) Performs an interaction at the specified screen coordinates.- Parameters:
x- the x coordinatey- the y coordinate
-
interact
public static void interact(int x, int y, boolean click) Performs an interaction at the specified screen coordinates with optional click.- Parameters:
x- the x coordinatey- the y coordinateclick- whether to perform a click
-
getPlayerOptions
Gets the available player right-click menu options.- Returns:
- an array of player menu option strings
-
getObjectComposition
public static net.runelite.api.ObjectComposition getObjectComposition(int id) Gets the composition data for a game object by ID.- Parameters:
id- the object ID- Returns:
- the
ObjectCompositionfor the object
-
isClientThread
public static boolean isClientThread()Checks if the current thread is the game client thread. Many client operations must be performed on the client thread.- Returns:
trueif on the client thread,falseotherwise
-
getItemComposition
public static net.runelite.api.ItemComposition getItemComposition(int id) Gets the composition data for an item by ID.- Parameters:
id- the item ID- Returns:
- the
ItemCompositionfor the item
-
getItemContainer
public static net.runelite.api.ItemContainer getItemContainer(int id) Gets an item container by its ID.- Parameters:
id- the container ID- Returns:
- the
ItemContainer, ornullif not found
-
getTopLevelWorldView
public static net.runelite.api.WorldView getTopLevelWorldView()Gets the top-level world view.- Returns:
- the
WorldView
-
getHintArrowPlayer
Gets the player indicated by the hint arrow, if any.- Returns:
- the
IPlayerwith the hint arrow, ornull
-
getVarps
public static int[] getVarps()Gets the array of all varps (variable parameters).- Returns:
- the varps array
-
getVarbitValue
public static int getVarbitValue(int[] vars, int id) Gets a varbit value from a varps array.- Parameters:
vars- the varps arrayid- the varbit ID- Returns:
- the varbit value
-
getVarpValue
public static int getVarpValue(int id) Gets the value of a varp (variable parameter).- Parameters:
id- the varp ID- Returns:
- the varp value
-
getVarcIntValue
public static int getVarcIntValue(int varClientInt) Gets the value of a client integer variable.- Parameters:
varClientInt- the variable ID- Returns:
- the variable value
-
getVarcStrValue
Gets the value of a client string variable.- Parameters:
varClientStr- the variable ID- Returns:
- the variable string value
-
getGameState
public static net.runelite.api.GameState getGameState()Gets the current game state.- Returns:
- the current
GameState
-
setGameState
public static void setGameState(net.runelite.api.GameState gameState) Sets the game state.- Parameters:
gameState- theGameStateto set
-
setGameState
public static void setGameState(int gameState) Sets the game state by ordinal value.- Parameters:
gameState- the game state ordinal
-
getTickCount
public static int getTickCount()Gets the current game tick count.- Returns:
- the tick count
-
runScript
Runs a client script with the specified arguments.- Parameters:
args- the script arguments
-
getBoostedSkillLevel
public static int getBoostedSkillLevel(net.runelite.api.Skill skill) Gets the boosted (current) level of a skill. This reflects temporary boosts or drains.- Parameters:
skill- theSkillto query- Returns:
- the boosted skill level
-
getRealSkillLevel
public static int getRealSkillLevel(net.runelite.api.Skill skill) Gets the real (base) level of a skill. This is the actual level without temporary modifiers.- Parameters:
skill- theSkillto query- Returns:
- the real skill level
-
getSkillExperience
public static int getSkillExperience(net.runelite.api.Skill skill) Gets the experience points in a skill.- Parameters:
skill- theSkillto query- Returns:
- the experience points
-
isInInstancedRegion
public static boolean isInInstancedRegion()Checks if the player is in an instanced region. Instanced regions include activities like raids, certain minigames, etc.- Returns:
trueif in an instanced region,falseotherwise
-
getWorldList
public static net.runelite.api.World[] getWorldList()Gets the list of all available worlds.- Returns:
- an array of
Worldobjects
-
getWorld
public static int getWorld()Gets the current world number.- Returns:
- the world number
-
openWorldHopper
public static void openWorldHopper()Opens the world hopper interface. -
changeWorld
public static void changeWorld(net.runelite.api.World world) Changes to a different world without hopping. Used primarily on the login screen.- Parameters:
world- theWorldto change to
-
hopToWorld
public static void hopToWorld(net.runelite.api.World world) Hops to a different world while logged in.- Parameters:
world- theWorldto hop to
-
getCanvas
Gets the game canvas for rendering and input.- Returns:
- the game
Canvas
-
setVarcIntValue
public static void setVarcIntValue(int inputType, int inputType1) Sets a client integer variable value.- Parameters:
inputType- the variable IDinputType1- the value to set
-
setVarcStrValue
Sets a client string variable value.- Parameters:
var- the variable IDvalue- the string value to set
-
getGrandExchangeOffers
public static net.runelite.api.GrandExchangeOffer[] getGrandExchangeOffers()Gets all Grand Exchange offer slots.- Returns:
- an array of
GrandExchangeOfferobjects
-
getMapRegions
public static int[] getMapRegions()Gets the IDs of all loaded map regions.- Returns:
- an array of map region IDs
-
getWorldType
Gets the set of world types for the current world.- Returns:
- an
EnumSetofWorldTypevalues
-
getIntStack
public static int[] getIntStack()Gets the integer stack used by client scripts.- Returns:
- the int stack array
-
getEnergy
public static int getEnergy()Gets the current run energy (0-10000, where 10000 = 100%).- Returns:
- the run energy value
-
getFriendContainer
public static net.runelite.api.FriendContainer getFriendContainer()Gets the friend list container.- Returns:
- the
FriendContainer
-
isFriended
Checks if a player with the given name is on the friends list.- Parameters:
name- the player name to checkb- whether to check the display name- Returns:
trueif the player is friended,falseotherwise
-
getViewportWidth
public static int getViewportWidth()Gets the viewport width in pixels.- Returns:
- the viewport width
-
getViewportHeight
public static int getViewportHeight()Gets the viewport height in pixels.- Returns:
- the viewport height
-
getPlane
public static int getPlane()Gets the current plane (floor level) the player is on. Ground level is 0, with higher values for upper floors.- Returns:
- the plane number
-
isResized
public static boolean isResized()Checks if the client is in resizable mode.- Returns:
trueif resizable,falseif fixed
-
getMapAngle
public static int getMapAngle()Gets the current camera/map angle in JAU (Jagex Angle Units).- Returns:
- the map angle (0-2047)
-
getWorldMap
public static net.runelite.api.worldmap.WorldMap getWorldMap()Gets the world map instance.- Returns:
- the
WorldMap
-
createWorld
public static net.runelite.api.World createWorld()Creates a new empty World instance.- Returns:
- a new
World
-
setSelectedSceneTileX
public static void setSelectedSceneTileX(int sceneX) Sets the selected scene tile X coordinate for viewport walking.- Parameters:
sceneX- the scene X coordinate
-
setSelectedSceneTileY
public static void setSelectedSceneTileY(int sceneY) Sets the selected scene tile Y coordinate for viewport walking.- Parameters:
sceneY- the scene Y coordinate
-
setViewportWalking
public static void setViewportWalking(boolean b) Enables or disables viewport walking mode.- Parameters:
b-trueto enable viewport walking
-
getLocalDestinationLocation
public static net.runelite.api.coords.LocalPoint getLocalDestinationLocation()Gets the local destination point for the current movement.- Returns:
- the destination
LocalPoint, ornullif not moving
-
setLastButton
public static void setLastButton(int button) Sets the last mouse button that was pressed.- Parameters:
button- the button code
-
setCheckClick
public static void setCheckClick(boolean checkClick) Sets whether to check for click validation.- Parameters:
checkClick-trueto enable click checking
-
getFollower
Gets the player's follower NPC (pet).- Returns:
- the follower
INPC, ornullif none
-
getHintArrowNpc
Gets the NPC indicated by the hint arrow, if any.- Returns:
- the
INPCwith the hint arrow, ornull
-
invokeWidgetAction
public static void invokeWidgetAction(int identifier, int param1, int param0, int itemId, String target) Invokes a widget action directly.- Parameters:
identifier- the menu identifierparam1- the widget IDparam0- the widget child IDitemId- the item ID, or -1 if not applicabletarget- the target string
-
getLoginMessage
Gets the current login message displayed on the login screen.- Returns:
- the login message string
-
setLoginIndex
public static void setLoginIndex(int index) Sets the login screen index.- Parameters:
index- the login index
-
setMouseIdleTicks
public static void setMouseIdleTicks(int ticks) Sets the mouse idle tick counter. Used to prevent automatic logout due to inactivity.- Parameters:
ticks- the number of idle ticks
-
setKeyboardIdleTicks
public static void setKeyboardIdleTicks(int ticks) Sets the keyboard idle tick counter. Used to prevent automatic logout due to inactivity.- Parameters:
ticks- the number of idle ticks
-
loadWorlds
public static boolean loadWorlds()Loads the world list from the server.- Returns:
trueif worlds were loaded successfully
-
promptCredentials
public static void promptCredentials(boolean clearPassword) Prompts for login credentials on the login screen.- Parameters:
clearPassword- whether to clear the current password
-
isWorldSelectOpen
public static boolean isWorldSelectOpen()Checks if the world select interface is currently open.- Returns:
trueif world select is open
-
setWorldSelectOpen
public static void setWorldSelectOpen(boolean open) Opens or closes the world select interface.- Parameters:
open-trueto open,falseto close
-
isOAuthCredentialsSet
public static boolean isOAuthCredentialsSet()Checks if OAuth credentials are currently set.- Returns:
trueif OAuth credentials are set
-
getPassword
Gets the current password entered on the login screen.- Returns:
- the password string
-
setPassword
Sets the password on the login screen.- Parameters:
password- the password to set
-
getUsername
Gets the current username entered on the login screen.- Returns:
- the username string
-
setUsername
Sets the username on the login screen.- Parameters:
username- the username to set
-
setOtp
Sets the one-time password (authenticator code) for login.- Parameters:
now- the OTP code
-
getWindowedMode
public static int getWindowedMode()Gets the current windowed mode setting.- Returns:
- the windowed mode value
-
setWindowedMode
public static void setWindowedMode(int i) Sets the windowed mode.- Parameters:
i- the windowed mode value to set
-
getPreferences
public static net.runelite.api.Preferences getPreferences()Gets the client preferences.- Returns:
- the
Preferencesobject
-
setMouseIdleCycles
public static void setMouseIdleCycles(int minValue) Sets the mouse idle cycle counter.- Parameters:
minValue- the number of idle cycles
-
getHoveredEntities
Gets the list of entities currently under the mouse cursor.- Returns:
- a list of hovered
SceneEntityobjects
-
getSelectedSceneTile
Gets the currently selected scene tile.- Returns:
- the selected
ITile, ornullif none selected
-
setDraggedWidget
public static void setDraggedWidget(net.runelite.api.widgets.Widget widget) Sets the widget currently being dragged.- Parameters:
widget- theWidgetto set as dragged
-
getMinimapState
public static int getMinimapState()Gets the current minimap state.- Returns:
- the minimap state value
-
setMinimapState
public static void setMinimapState(int state) Sets the minimap state.- Parameters:
state- the state to set
-
processDialog
public static void processDialog(int id, int idx) Processes a dialog with the specified ID and index.- Parameters:
id- the dialog IDidx- the option index
-
setMenuOpened
public static void setMenuOpened(boolean opened) Sets whether the right-click menu is opened.- Parameters:
opened-trueto mark menu as opened
-
setOAuthLoginMode
public static void setOAuthLoginMode()Sets the client to OAuth login mode. -
setNormalLoginMode
public static void setNormalLoginMode()Sets the client to normal (username/password) login mode. -
getDisplayName
Gets the display name of the logged-in player.- Returns:
- the display name string
-
getSessionId
Gets the current session ID.- Returns:
- the session ID string
-
getCharacterId
Gets the character ID for the logged-in account.- Returns:
- the character ID string
-
setDisplayName
Sets the display name for the player.- Parameters:
displayName- the display name to set
-
setSessionId
Sets the session ID.- Parameters:
sessionId- the session ID to set
-
setCharacterId
Sets the character ID.- Parameters:
characterId- the character ID to set
-
getLoginResponse1
Gets the first login response message.- Returns:
- the first response string
-
getLoginResponse2
Gets the second login response message.- Returns:
- the second response string
-
getLoginResponse3
Gets the third login response message.- Returns:
- the third response string
-
sleep
public static void sleep(int cycles) Sleeps for the specified number of client cycles.- Parameters:
cycles- the number of cycles to sleep
-
getDiscordId
Gets the Discord user ID associated with the client.- Returns:
- the Discord ID string
-
getDiscordUser
Gets the Discord username associated with the client.- Returns:
- the Discord username string
-
getUserId
Gets the user ID for the current session.- Returns:
- the user ID, or
nullif not available
-
invokeMenuAction
public static void invokeMenuAction(int param0, int param1, int opcode, int id, int itemId, int worldViewId, String option, String target) Invokes a menu action with full parameter specification.- Parameters:
param0- the first parameterparam1- the second parameteropcode- the menu action opcodeid- the menu entry IDitemId- the item ID, or -1 if not applicableworldViewId- the world view IDoption- the menu option texttarget- the menu target text
-
getMouseRecorderXs
public static int[] getMouseRecorderXs() -
getMouseRecorderYs
public static int[] getMouseRecorderYs() -
getMouseRecorderTimes
public static long[] getMouseRecorderTimes() -
getMouseRecorderEnabled
public static boolean getMouseRecorderEnabled() -
setMouseRecorderEnabled
public static void setMouseRecorderEnabled(boolean enabled) -
getMouseRecorderIndex
public static int getMouseRecorderIndex()
-