Mojo 8 Share Posted June 18, 2017 I'm attempting to set up a feature in my script that will allow for once an account is banned, it will fetch for the next one in order of a txt file. Logging it in using the same script. Each client would have their own txt file of accounts to choose from. Just need to know the right direction to go in. I would use parameters in order to select the txt file for that specific client to use. I saw on the forums that for this to be done I would need to disable and re-enable some of the built in account handlers. Any help is appreciated, thanks in advance. Link to comment Share on other sites More sharing options...
RetroBot 35 Share Posted June 18, 2017 public class AutoLogin { private Rectangle existingUserBox; private Rectangle cancelBox; // when password is wrong private Rectangle tryAgainBox; // when password is wrong private Rectangle backBox; // when on recover password screen public static String username; public static String password; private AbstractScript script; public AutoLogin(AbstractScript script) { existingUserBox = new Rectangle(397, 280, 529 - 397, 30); cancelBox = new Rectangle(396, 308, 529 - 397, 30); tryAgainBox = new Rectangle(315, 260, 425 - 291, 30); backBox = new Rectangle(396, 305, 528 - 390, 30); this.script = script; } private boolean isAccountDisabled() { return script.getClient().getMessage0().contains("disabled"); } public boolean isAccountLocked() { return script.getClient().getMessage0().contains("stolen"); } private boolean isNonMember() { return script.getClient().getMessage0().contains("members account"); } private boolean rsUpdated() { return script.getClient().getMessage1().contains("updated"); } private boolean isPasswordWrong() { return script.getClient().getLoginIndex() == 3; } private boolean forgotPasswordScreen() { return script.getClient().getLoginIndex() == 5; } private boolean clickExistingUser() { return script.getMouse().click(existingUserBox); } private boolean clickCancel() { return script.getMouse().click(cancelBox); } private boolean clickTryAgain() { return script.getMouse().click(tryAgainBox); } private boolean clickBack() { return script.getMouse().click(backBox); } private void handleDisabled() { script.log("Disabled"); script.stop(); } private boolean isConnecting() { return script.getClient().getMessage1().contains("Connecting"); } private void handleWrongPassword() { Main.state = "Wrong pass"; clickTryAgain(); clickCancel(); } private void enterUserName() { if (username != null) { script.getKeyboard().type(username); } else { readAccounts(script); } } private void enterPassword() { if (password != null) { script.getKeyboard().type(password); } else { readAccounts(script); } } private boolean onSecondScreen() { return script.getClient().getGameStateID() == 30; } private boolean clickPlay() { return script.getWidgets().getWidgetChild(378, 17).interact(); } public void login() { if (!onSecondScreen()) { int index = script.getClient().getLoginIndex(); switch (index) { case 0: Main.state = "Clicking Existing User"; readAccounts(script); clickExistingUser(); break; case 1: Main.state = "Clicking Canceling"; clickCancel(); break; case 2: if (isAccountLocked()) { Main.state = "Locked"; script.log(username + " is locked"); clickCancel(); } if (isAccountDisabled()) { Main.state = "Disabled"; script.log(username + " is disabled"); clickCancel(); } if (isNonMember()) { Main.state = "Account is non-member.. stopping script"; script.stop(); } if (rsUpdated()) { Main.state = "RS update"; script.log("RS Update"); script.stop(); } if (!isConnecting() && !isAccountDisabled()) { Main.state = "Entering account details"; enterUserName(); enterPassword(); } break; case 3: if (isPasswordWrong()) { Main.state = "Wrong password"; handleWrongPassword(); } break; case 5: if (forgotPasswordScreen()) { Main.state = "Clicked forgot password"; clickBack(); } } } } } You can look up how to read a text file, and find plenty of results on stack overflow. Link to comment Share on other sites More sharing options...
Roma 2221 Share Posted June 18, 2017 You can change accounts using ScriptManager#setAccount Link to comment Share on other sites More sharing options...
Genius 49 Share Posted June 18, 2017 ^ and check out Java's Scanner class for reading text files Link to comment Share on other sites More sharing options...
Mojo 8 Author Share Posted June 20, 2017 Wow thanks @@RetroBot and everyone for the replies Link to comment Share on other sites More sharing options...
None 227 Share Posted June 27, 2017 [code=auto:0]public AutoLogin(AbstractScript script) { existingUserBox = new Rectangle(397, 280, 529 - 397, 30); cancelBox = new Rectangle(396, 308, 529 - 397, 30); tryAgainBox = new Rectangle(315, 260, 425 - 291, 30); backBox = new Rectangle(396, 305, 528 - 390, 30); this.script = script; } private boolean isAccountDisabled() { return script.getClient().getMessage0().contains("disabled"); } public boolean isAccountLocked() { return script.getClient().getMessage0().contains("stolen"); } private boolean isNonMember() { return script.getClient().getMessage0().contains("members account"); } private boolean rsUpdated() { return script.getClient().getMessage1().contains("updated"); } private boolean isPasswordWrong() { return script.getClient().getLoginIndex() == 3; } private boolean forgotPasswordScreen() { return script.getClient().getLoginIndex() == 5; } private boolean clickExistingUser() { return script.getMouse().click(existingUserBox); } private boolean clickCancel() { return script.getMouse().click(cancelBox); } private boolean clickTryAgain() { return script.getMouse().click(tryAgainBox); } private boolean clickBack() { return script.getMouse().click(backBox); } private void handleDisabled() { script.log("Disabled"); script.stop(); } private boolean isConnecting() { return script.getClient().getMessage1().contains("Connecting"); } private void handleWrongPassword() { Main.state = "Wrong pass"; clickTryAgain(); clickCancel(); } private void enterUserName() { if (username != null) { script.getKeyboard().type(username); } else { readAccounts(script); } } private void enterPassword() { if (password != null) { script.getKeyboard().type(password); //script.sleep(5000); // added this sleep in so it could check player settings.. } else { readAccounts(script); } } private boolean onSecondScreen() { return script.getClient().getGameStateID() == 30; } private boolean clickPlay() { return script.getWidgets().getWidgetChild(378, 17).interact(); } public void login() { if (!onSecondScreen()) { int index = script.getClient().getLoginIndex(); switch (index) { case 0: Main.state = "Clicking Existing User"; readAccounts(script); clickExistingUser(); break; case 1: Main.state = "Clicking Canceling"; clickCancel(); break; case 2: if (isAccountLocked()) { Main.state = "Locked"; script.log(username + " is locked"); appendToFileLocks(); isTrue = true; Main.startTime2 = System.currentTimeMillis(); clickCancel(); } if (isAccountDisabled()) { Main.state = "Disabled"; script.log(username + " is disabled"); clickCancel(); } if (isNonMember()) { Main.state = "Account is non-member.. stopping script"; script.stop(); } if (rsUpdated()) { Main.state = "RS update"; script.log("RS Update"); script.stop(); } if (!isConnecting() && !isAccountDisabled()) { Main.state = "Entering account details"; enterUserName(); enterPassword(); } break; case 3: if (isPasswordWrong()) { Main.state = "Wrong password"; handleWrongPassword(); } break; case 5: if (forgotPasswordScreen()) { Main.state = "Clicked forgot password"; clickBack(); } } } } [/code] You can look up how to read a text file, and find plenty of results on stack overflow. this really needs to be in a code block it looks like cancer without Link to comment Share on other sites More sharing options...
RetroBot 35 Share Posted June 27, 2017 this really needs to be in a code block it looks like cancer without Fixed it Link to comment Share on other sites More sharing options...
None 227 Share Posted June 27, 2017 Fixed it Thank you Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.