Class LoginUtility


  • public class LoginUtility
    extends java.lang.Object
    This is an API class used to give easier access to scripters to writing their own login handlers. Created by Nezz on 2/20/2018.
    • Constructor Summary

      Constructors 
      Constructor Description
      LoginUtility()  
    • Method Summary

      All Methods Static Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      static boolean changeWorld​(int givenWorld)
      Changes the selected world to the given world Note: Based on getWorldRectangle, see method docs for possible errors.
      static boolean closeWorldScreen()
      Closes the world select screen
      static int getAccountStatus()
      Gets the account status, only used to determine locked vs banned in login screen.
      static java.awt.Rectangle getBackButton()  
      static int getBaseX()  
      static int getBaseY()  
      static java.awt.Rectangle getCancelLoginButton()  
      static java.awt.Rectangle getCancelWorldButton()  
      static java.awt.Rectangle getExistingUserButton()
      Gets the "Existing user" button rectangle
      static int getIndex()
      Gets the current login index of the game.
      static java.lang.String getLoginEmail()
      Gets the currently typed text in the email field of the login screen.
      static java.lang.String getLoginPassword()
      Gets the currently typed text in the password field of the login screen.
      static LoginUtility getLoginUtility()
      Deprecated.
      static java.awt.Rectangle getOpenWorldScreenButton()
      Returns the rectangle of the "Select world" button on the main login screen.
      static java.awt.Rectangle getRememberUsernameButton()  
      static RSLoginResponse getResponse()
      Gets the current login response of the login screen, based on the response text in the login screen.
      static LoginStage getStage()  
      static java.awt.Rectangle getTryAgainButton()  
      static int getWorldIndex​(int world)
      Gets the location in the worlds array for the given world, used in login world screen
      static int getWorldListColumnSize()
      World List Column Size is the number of worlds listed in the columns (usually you can just use the first column) Used to determine location of world selection buttons.
      static java.awt.Rectangle getWorldRectangle​(int world)
      Gets the rectangle for the world button in the login world screen.
      static boolean isEnterToLogin()
      See setEnterToLogin
      static boolean isWorldScreenOpen()
      Checks if the world select screen is open
      static RSLoginResponse login()
      Logs in to the client with the currently set Account
      static RSLoginResponse login​(java.lang.String email, java.lang.String password)
      Logs in to the client with the given email and password
      static RSLoginResponse login​(org.dreambot.core.Account account)
      Logs in to the client with the given Account
      static boolean openWorldScreen()
      Opens the world select screen
      static void setBaseX​(int baseX)  
      static void setBaseY​(int baseY)  
      static void setEnterToLogin​(boolean b)
      At the login screen you can hit enter instead of clicking the login button to open up the email/password interface This sets a boolean to true/false as to whether or not to use enter instead of clicking.
      static void setWorldListColumnSize​(int worldListColumnSize)  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LoginUtility

        public LoginUtility()
    • Method Detail

      • getLoginUtility

        @Deprecated
        public static LoginUtility getLoginUtility()
        Deprecated.
      • isEnterToLogin

        public static boolean isEnterToLogin()
        See setEnterToLogin
        Returns:
      • setEnterToLogin

        public static void setEnterToLogin​(boolean b)
        At the login screen you can hit enter instead of clicking the login button to open up the email/password interface This sets a boolean to true/false as to whether or not to use enter instead of clicking.
        Parameters:
        b - True sets enter to on, False sets enter to off.
      • getLoginEmail

        public static java.lang.String getLoginEmail()
        Gets the currently typed text in the email field of the login screen.
        Returns:
        String value of what is currently typed in the email field of the login screen.
      • getLoginPassword

        public static java.lang.String getLoginPassword()
        Gets the currently typed text in the password field of the login screen. Note: Unknown what it returns if "hide password" is turned on.
        Returns:
        String value of what is currently typed in the password field of the login screen.
      • getExistingUserButton

        public static java.awt.Rectangle getExistingUserButton()
        Gets the "Existing user" button rectangle
        Returns:
      • login

        public static RSLoginResponse login()
        Logs in to the client with the currently set Account
        Returns:
        RSLoginResponse, LOGGED_IN if logged in, null if in the process of logging in(typing), or the response
      • login

        public static RSLoginResponse login​(org.dreambot.core.Account account)
        Logs in to the client with the given Account
        Parameters:
        account - Account to log in with
        Returns:
        RSLoginResponse, LOGGED_IN if logged in, null if in the process of logging in(typing), or the response
      • login

        public static RSLoginResponse login​(java.lang.String email,
                                            java.lang.String password)
        Logs in to the client with the given email and password
        Parameters:
        email - Email to log in with
        password - Password to log in with
        Returns:
        RSLoginResponse, LOGGED_IN if logged in, null if in the process of logging in(typing), or the response
      • getResponse

        public static RSLoginResponse getResponse()
        Gets the current login response of the login screen, based on the response text in the login screen.
        Returns:
      • getIndex

        public static int getIndex()
        Gets the current login index of the game.
        Returns:
      • getAccountStatus

        public static int getAccountStatus()
        Gets the account status, only used to determine locked vs banned in login screen.
        Returns:
        0 if banned, 1 if locked
      • isWorldScreenOpen

        public static boolean isWorldScreenOpen()
        Checks if the world select screen is open
        Returns:
      • openWorldScreen

        public static boolean openWorldScreen()
        Opens the world select screen
        Returns:
        True if screen already open, otherwise True if screen is successfully opened
      • closeWorldScreen

        public static boolean closeWorldScreen()
        Closes the world select screen
        Returns:
        True if screen is not open, or if successfully closed.
      • getOpenWorldScreenButton

        public static java.awt.Rectangle getOpenWorldScreenButton()
        Returns the rectangle of the "Select world" button on the main login screen.
        Returns:
      • changeWorld

        public static boolean changeWorld​(int givenWorld)
        Changes the selected world to the given world Note: Based on getWorldRectangle, see method docs for possible errors.
        Parameters:
        givenWorld - World you want to select as an ID, if less than 300 given, adds 300.
        Returns:
        True if selected world is given world already, or if given world successfully selected.
      • getWorldRectangle

        public static java.awt.Rectangle getWorldRectangle​(int world)
        Gets the rectangle for the world button in the login world screen. Possible Errors: If RS changes their world column list size, rectangle is returned incorrectly. If these do change, you have to set them yourself with setWorldListColumnSize, and then it will work. If RS changes the world list base X/Y you will have to set them yourself using the methods setBaseX, setBaseY These are not things easily auto detected by our client, and as such are manually updated and hardcoded.
        Parameters:
        world - world number (>300 and < 300 both work)
        Returns:
        Rectangle of representing the button for the world, null if no world matching ID found
      • getWorldIndex

        public static int getWorldIndex​(int world)
        Gets the location in the worlds array for the given world, used in login world screen
        Parameters:
        world - world number (>300 and < 300 both work)
        Returns:
        world index in the worlds array, -1 if no world matching ID found
      • getCancelLoginButton

        public static java.awt.Rectangle getCancelLoginButton()
      • getTryAgainButton

        public static java.awt.Rectangle getTryAgainButton()
      • getBackButton

        public static java.awt.Rectangle getBackButton()
      • getCancelWorldButton

        public static java.awt.Rectangle getCancelWorldButton()
      • getRememberUsernameButton

        public static java.awt.Rectangle getRememberUsernameButton()
      • getWorldListColumnSize

        public static int getWorldListColumnSize()
        World List Column Size is the number of worlds listed in the columns (usually you can just use the first column) Used to determine location of world selection buttons. Note: RS may change these, usually they change every time they update the world count.
        Returns:
      • setWorldListColumnSize

        public static void setWorldListColumnSize​(int worldListColumnSize)
      • getBaseX

        public static int getBaseX()
      • setBaseX

        public static void setBaseX​(int baseX)
      • getBaseY

        public static int getBaseY()
      • setBaseY

        public static void setBaseY​(int baseY)