Class Game


  • public class Game
    extends Object
    Provides general game state operations
    • Field Detail

      • STATE_LOADING_GAME

        public static final int STATE_LOADING_GAME
        Represents the game state during loading.
        See Also:
        Constant Field Values
      • STATE_CREDENTIALS_SCREEN

        public static final int STATE_CREDENTIALS_SCREEN
        Represents the state of the credentials screen.
        See Also:
        Constant Field Values
      • STATE_AUTHENTICATOR_SCREEN

        public static final int STATE_AUTHENTICATOR_SCREEN
        Represents the state of the authenticator screen.
        See Also:
        Constant Field Values
      • STATE_LOGGING_IN

        public static final int STATE_LOGGING_IN
        Represents the game state during the login process.
        See Also:
        Constant Field Values
      • STATE_LOADING_REGION

        public static final int STATE_LOADING_REGION
        Represents the game state while loading a region.
        See Also:
        Constant Field Values
      • STATE_IN_GAME

        public static final int STATE_IN_GAME
        Represents the state when the player is in-game.
        See Also:
        Constant Field Values
      • STATE_CONNECTION_LOST

        public static final int STATE_CONNECTION_LOST
        Represents the state when the connection is lost.
        See Also:
        Constant Field Values
      • STATE_HOPPING_WORLD

        public static final int STATE_HOPPING_WORLD
        Represents the state during world hopping.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Game

        public Game()
    • Method Detail

      • getClient

        public static RSClient getClient()
      • setClient

        public static void setClient​(RSClient client)
      • getRevision

        public static int getRevision()
      • setFps

        public static void setFps​(int fps)
      • getTick

        public static int getTick()
      • getRemainingMembershipDays

        public static int getRemainingMembershipDays()
      • isMembershipPresent

        public static boolean isMembershipPresent()
      • logout

        public static boolean logout()
      • logout

        public static boolean logout​(boolean direct)
        Parameters:
        direct - true indicates to instantly log out by setting the clients main state. false means to use the logout button in game
        Returns:
        true if an attempt was made to log out
      • getAccountType

        public static AccountType getAccountType()
      • queueAction

        public static void queueAction​(MenuAction action)
      • queueAction

        public static void queueAction​(Action action)
      • isLoggedIn

        public static boolean isLoggedIn()
        Checks if the player is logged in.
        Returns:
        true if the player is logged in; false otherwise
      • isOnCredentialsScreen

        public static boolean isOnCredentialsScreen()
      • isLoadingRegion

        public static boolean isLoadingRegion()
      • getEngineCycle

        public static int getEngineCycle()
      • getCanvas

        public static Canvas getCanvas()
      • getEventMediator

        public static EventMediator getEventMediator()
      • call

        public static <T> T call​(Callable<T> callable)
        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 null if an error occurs
      • callAsync

        public static <T> CompletableFuture<T> callAsync​(Function<RSClient,​T> function)
        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 CompletableFuture representing the result
      • call

        public static void call​(Runnable runnable)
        Executes a task on the game thread.
        Parameters:
        runnable - the task to execute
      • getProxy

        public static Proxy getProxy()
      • setProxy

        public static void setProxy​(Proxy proxy)
      • getProxyCredentials

        public static Pair<String,​String> getProxyCredentials()
      • setProxyCredentials

        public static void setProxyCredentials​(Pair<String,​String> proxyCredentials)
      • isVerboseMenuActions

        public static boolean isVerboseMenuActions()
      • setVerboseMenuActions

        public static void setVerboseMenuActions​(boolean verboseMenuActions)