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 Detail

      • LoginUtility

        public LoginUtility()
    • Method Detail

      • 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.
      • setEscToCancel

        public static void setEscToCancel​(boolean b)
        At the login screen you can hit escape instead of clicking the cancel button
        Parameters:
        b -
      • isEscToCancel

        public static boolean isEscToCancel()
        Returns:
        true if esc to cancel enabled, else false
      • 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
      • setAccount

        public static void setAccount​(org.dreambot.core.Account account)
      • 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, and -1 if neither
      • isWorldScreenOpen

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

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

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

        @Deprecated
        public static boolean changeWorld​(int givenWorld)
        Deprecated.
        Changes the selected world to the given world Note: Based on getWorldRectangle, see method docs for possible errors.
        Parameters:
        givenWorld - The world you want to hop to
        Returns:
        True if selected world is given world already, or if given world successfully selected.
      • getWorldRectangle

        @Deprecated
        public static java.awt.Rectangle getWorldRectangle​(int world)
        Deprecated.
        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

        @Deprecated
        public static int getWorldIndex​(int world)
        Deprecated.
        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()
      • getContinueButton

        public static java.awt.Rectangle getContinueButton()
      • getBackButtonOnLauncher

        public static java.awt.Rectangle getBackButtonOnLauncher()
      • getAcceptTOSButton

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

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

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

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

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

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

        public static java.awt.Rectangle getDisconnectedBackButton()
      • getPlayNowButton

        public static java.awt.Rectangle getPlayNowButton()
      • getPlayNowTryAgainButton

        public static java.awt.Rectangle getPlayNowTryAgainButton()
      • getMustAcceptTosBackButton

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

        @Deprecated
        public static int getWorldListColumnSize()
        Deprecated.
        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

        @Deprecated
        public static void setWorldListColumnSize​(int worldListColumnSize)
        Deprecated.
      • getBaseX

        public static int getBaseX()
      • setBaseX

        public static void setBaseX​(int baseX)
      • getBaseY

        public static int getBaseY()
      • setBaseY

        public static void setBaseY​(int baseY)
      • isRememberUsername

        public static boolean isRememberUsername()
      • setRememberUsername

        public static void setRememberUsername​(boolean rememberUsername)
      • isNoInputLogin

        public static boolean isNoInputLogin()
      • setNoInputLogin

        public static void setNoInputLogin​(boolean useSetters)
      • enterUsername

        public static void enterUsername​(java.lang.String username)
      • enterPassword

        public static void enterPassword​(java.lang.String password)
      • getHopWorld

        public static int getHopWorld()
      • setHopWorld

        public static void setHopWorld​(int hopWorld)