Class Game
java.lang.Object
org.rspeer.game.Game
Provides general game state operations
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intRepresents the state of the authenticator screen.static final intRepresents the state during the second part of world hopping.static final intRepresents the state when the connection is lost.static final intRepresents the state of the credentials screen.static final intRepresents the state during world hopping.static final intRepresents the state when the player is in-game.static final intRepresents the game state during loading.static final intRepresents the game state while loading a region.static final intRepresents the game state during the login process. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddMouseListener(BotMouseListener listener) Deprecated.static voidstatic voidExecutes a task on the game thread.static <T> Tstatic <T> TExecutes a callable task on the game thread.static <T> CompletableFuture<T> Executes a function asynchronously on the game thread.static voidcheckClientThread(String operation) static AccountTypestatic Canvasstatic jag.oldscape.RSClientstatic intstatic org.rspeer.event.EventDispatcherstatic List<jag.oldscape.RSWorldMatrix> static jag.oldscape.RSWorldMatrixstatic jag.oldscape.RSWorldMatrixgetMatrix(int id) static jag.oldscape.RSWorldMatrixgetMatrixAt(Coord coord) static List<BotMouseListener> Deprecated.static ProxygetProxy()static intstatic intstatic intgetState()Gets the current game state.static intgetTick()Deprecated.static intstatic jag.oldscape.RSWorldMatrixstatic intstatic Stringstatic WorldEntitygetWorldEntity(int id) static WorldEntitygetWorldEntity(jag.oldscape.RSWorldMatrix matrix) static booleanstatic booleanstatic booleanstatic booleanChecks if the player is logged in.static booleanstatic booleanstatic booleanstatic booleanstatic booleanstatic booleanstatic GameLogic.ClientAccessstatic booleanlogout()static booleanlogout(boolean direct) static voidqueueAction(Action action) static voidqueueAction(MenuAction action) static voidremoveMouseListener(BotMouseListener listener) Deprecated.static voidsetFps(int fps) static voidstatic voidsetSceneRenderingDisabled(boolean sceneRenderingDisabled) static voidsetTickCount(int tickCount) static voidsetVerboseMenuActions(boolean verboseMenuActions) static GameLogic.ClientAccessstatic booleantryWithIdleAccess(Runnable runnable) static voidwithIdleAccess(Runnable runnable) static <T> TwithIdleAccess(Callable<T> callable, T fallback)
-
Field Details
-
STATE_LOADING_GAME
public static final int STATE_LOADING_GAMERepresents the game state during loading.- See Also:
-
STATE_CREDENTIALS_SCREEN
public static final int STATE_CREDENTIALS_SCREENRepresents the state of the credentials screen.- See Also:
-
STATE_AUTHENTICATOR_SCREEN
public static final int STATE_AUTHENTICATOR_SCREENRepresents the state of the authenticator screen.- See Also:
-
STATE_LOGGING_IN
public static final int STATE_LOGGING_INRepresents the game state during the login process.- See Also:
-
STATE_LOADING_REGION
public static final int STATE_LOADING_REGIONRepresents the game state while loading a region.- See Also:
-
STATE_IN_GAME
public static final int STATE_IN_GAMERepresents the state when the player is in-game.- See Also:
-
STATE_CONNECTION_LOST
public static final int STATE_CONNECTION_LOSTRepresents the state when the connection is lost.- See Also:
-
STATE_HOPPING_WORLD
public static final int STATE_HOPPING_WORLDRepresents the state during world hopping.- See Also:
-
STATE_COMPLETING_WORLD_TRANSFER
public static final int STATE_COMPLETING_WORLD_TRANSFERRepresents the state during the second part of world hopping.- See Also:
-
-
Constructor Details
-
Game
public Game()
-
-
Method Details
-
getClient
public static jag.oldscape.RSClient getClient() -
setFps
public static void setFps(int fps) -
getTick
Deprecated.- Returns:
- Note: This method should NOT be used for your own timers. The game seems to randomly reset this value so it should only be used in conjunction with values that align with it, such as varp/varc values
-
getServerTick
public static int getServerTick()- Returns:
- Note: This method should NOT be used for your own timers. The game seems to randomly reset this value so it should only be used in conjunction with values that align with it, such as varp/varc values
-
getTickCount
public static int getTickCount() -
setTickCount
public static void setTickCount(int tickCount) -
getTopLevelMatrixId
public static int getTopLevelMatrixId() -
getTopLevelMatrix
public static jag.oldscape.RSWorldMatrix getTopLevelMatrix() -
getLocalMatrix
public static jag.oldscape.RSWorldMatrix getLocalMatrix() -
getMatrix
public static jag.oldscape.RSWorldMatrix getMatrix(int id) -
getWorldEntity
-
getWorldEntity
-
getMatrixAt
-
getLoadedMatrixes
-
getRemainingMembershipDays
public static int getRemainingMembershipDays() -
isMembershipPresent
public static boolean isMembershipPresent() -
logout
public static boolean logout() -
logout
public static boolean logout(boolean direct) - Parameters:
direct-trueindicates to instantly log out by setting the clients main state.falsemeans to use the logout button in game- Returns:
trueif an attempt was made to log out
-
getAccountType
-
addMouseListener
-
removeMouseListener
-
getMouseListeners
-
queueAction
-
queueAction
-
getState
public static int getState()Gets the current game state.The returned game state can be compared against the predefined
STATE_constants in theGameclass to determine the current phase of the game. For example,STATE_IN_GAMErepresents the state when the player is actively in-game.- Returns:
- the current game state as an integer
- See Also:
-
isWorldHopping
public static boolean isWorldHopping() -
isLoggedIn
public static boolean isLoggedIn()Checks if the player is logged in.- Returns:
trueif the player is logged in;falseotherwise
-
isOnCredentialsScreen
public static boolean isOnCredentialsScreen() -
isLoadingRegion
public static boolean isLoadingRegion() -
getEngineCycle
public static int getEngineCycle() -
getCanvas
-
getEventDispatcher
public static org.rspeer.event.EventDispatcher getEventDispatcher() -
call
Executes a callable task on the game thread.- Type Parameters:
T- the return type of the task- Parameters:
callable- the task to execute- Returns:
- the result of the task, or
nullif an error occurs
-
call
-
callAsync
Executes a function asynchronously on the game thread.- Type Parameters:
T- the return type of the function- Parameters:
function- the function to execute- Returns:
- a
CompletableFuturerepresenting the result
-
call
Executes a task on the game thread.- Parameters:
runnable- the task to execute
-
getProxy
-
getProxyCredentials
-
isClientThread
public static boolean isClientThread() -
hasClientAccess
public static boolean hasClientAccess() -
isMainLoopRunning
public static boolean isMainLoopRunning() -
lockClientAccess
-
tryLockClientAccess
-
checkClientThread
-
awaitMainLoopIdle
public static void awaitMainLoopIdle() -
withIdleAccess
-
tryWithIdleAccess
-
withIdleAccess
-
setProxy
-
isVerboseMenuActions
public static boolean isVerboseMenuActions() -
setVerboseMenuActions
public static void setVerboseMenuActions(boolean verboseMenuActions) -
isSceneRenderingDisabled
public static boolean isSceneRenderingDisabled() -
setSceneRenderingDisabled
public static void setSceneRenderingDisabled(boolean sceneRenderingDisabled) -
getUsernameOrCharacterId
-