Class Game

java.lang.Object
net.storm.sdk.game.Game

public class Game extends Object
Provides static utility methods for accessing general game state information. This class serves as the primary entry point for querying the current state of the game, including login status, wilderness information, membership details, and account management.

All methods in this class are static and delegate to the underlying IGame implementation.

Example usage:


 // Check if the player is logged in before performing actions
 if (Game.isLoggedIn()) {
     // Check wilderness level for safety
     if (Game.isInWilderness()) {
         int wildyLevel = Game.getWildyLevel();
         System.out.println("Currently in level " + wildyLevel + " wilderness");
     }

     // Check membership status
     int memberDays = Game.getMembershipDays();
     System.out.println("Membership days remaining: " + memberDays);
 }

 // Logout when done
 Game.logout();
 
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    Gets the current Deadman Mode level.
    Gets the currently configured game account.
    static Instant
    Gets the instant when the player last logged in.
    static int
    Gets the number of membership days remaining on the account.
    static net.runelite.api.GameState
    Gets the current game state.
    static int
    Gets the current Wilderness level.
    static boolean
    Checks whether the screen is currently black (e.g., during loading).
    static boolean
    Checks whether the player is currently in a cutscene.
    static boolean
    Checks whether the player is currently in the Wilderness.
    static boolean
    Checks whether the player is currently logged into the game.
    static boolean
    Checks whether the game is currently on the login screen.
    static void
    Logs out the current player from the game.
    static void
    Sets the game account to be used for login operations.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Game

      public Game()
  • Method Details

    • getGameAccount

      public static GameAccount getGameAccount()
      Gets the currently configured game account.
      Returns:
      the current GameAccount, or null if no account is set
    • setGameAccount

      public static void setGameAccount(GameAccount gameAccount)
      Sets the game account to be used for login operations.
      Parameters:
      gameAccount - the GameAccount to set
    • isLoggedIn

      public static boolean isLoggedIn()
      Checks whether the player is currently logged into the game. This method returns true only when the game state indicates an active, logged-in session.
      Returns:
      true if the player is logged in, false otherwise
    • getState

      public static net.runelite.api.GameState getState()
      Gets the current game state.
      Returns:
      the current GameState
    • isInWilderness

      public static boolean isInWilderness()
      Checks whether the player is currently in the Wilderness.
      Returns:
      true if the player is in the Wilderness, false otherwise
    • getWildyLevel

      public static int getWildyLevel()
      Gets the current Wilderness level. Returns 0 if the player is not in the Wilderness.
      Returns:
      the Wilderness level, or 0 if not in Wilderness
    • isInCutscene

      public static boolean isInCutscene()
      Checks whether the player is currently in a cutscene. During cutscenes, player input is typically restricted.
      Returns:
      true if a cutscene is active, false otherwise
    • isOnLoginScreen

      public static boolean isOnLoginScreen()
      Checks whether the game is currently on the login screen. This includes the main login screen, authenticator screen, and logging in states.
      Returns:
      true if on any login screen variant, false otherwise
    • getDeadmanLevel

      public static int getDeadmanLevel()
      Gets the current Deadman Mode level. Returns 0 if not in a Deadman Mode world.
      Returns:
      the Deadman Mode level, or 0 if not applicable
    • getMembershipDays

      public static int getMembershipDays()
      Gets the number of membership days remaining on the account.
      Returns:
      the number of membership days remaining
    • isBlackScreen

      public static boolean isBlackScreen()
      Checks whether the screen is currently black (e.g., during loading).
      Returns:
      true if the screen is black, false otherwise
    • logout

      public static void logout()
      Logs out the current player from the game. This will return the player to the login screen.
    • getLastLogin

      public static Instant getLastLogin()
      Gets the instant when the player last logged in.
      Returns:
      an Instant representing the last login time, or null if not available