Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. package masterbots;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.FileReader;
  5. import java.io.IOException;
  6. import java.io.InputStreamReader;
  7. import java.net.URL;
  8. import java.util.ArrayList;
  9. import java.util.List;
  10. import java.util.concurrent.ExecutionException;
  11. import java.util.concurrent.ExecutorService;
  12. import java.util.concurrent.Executors;
  13. import java.util.concurrent.Future;
  14.  
  15. import accounts.Account;
  16. import accounts.World;
  17. import dropbots.DropBotLogic;
  18. import dropbots.DropBotUILauncher;
  19. import masterbots.LootBotLauncher;
  20. import realmrelay.data.Valuable;
  21.  
  22. public class FULLINVBOTREGISTERER implements Runnable {
  23.  
  24. private Account accountToVerify;
  25.  
  26. public FULLINVBOTREGISTERER(Account account) {
  27. accountToVerify = account;
  28. }
  29.  
  30. public int current;
  31. public int total;
  32.  
  33. private static int poolSize = 40;
  34.  
  35. public static boolean isRunning = false;
  36.  
  37. public static ArrayList<Account> waitingForAnswer = new ArrayList<Account>();
  38.  
  39. static int maxWaitingForAnswer = 0;
  40.  
  41. @SuppressWarnings({ "rawtypes", "unchecked" }) // I truly dont know
  42. public static void getAllMulesWithValuableItems() throws ExecutionException, InterruptedException {
  43.  
  44. maxWaitingForAnswer = 0;
  45. System.out.println("Running inventory checker...");
  46. waitingForAnswer.clear();
  47.  
  48. ExecutorService service = Executors.newFixedThreadPool(poolSize);
  49. List<Future<Runnable>> futures = new ArrayList<Future<Runnable>>();
  50.  
  51. try (BufferedReader br = new BufferedReader(new FileReader(LootBotLauncher.AccountFile))) {
  52. for (String line; (line = br.readLine()) != null;) {
  53.  
  54. if (line.contains("'")) {
  55. maxWaitingForAnswer++;
  56.  
  57. String email = line.substring(1, line.indexOf("': '"));
  58. String password = line.substring(line.indexOf("': '") + 4, line.indexOf("',"));
  59.  
  60. Account e = new Account(email, password);
  61.  
  62. Future f = service.submit(new FULLINVBOTREGISTERER(e));
  63. futures.add(f);
  64.  
  65. } else {
  66. System.out.println("Found invalid line " + line);
  67. }
  68. }
  69. return;
  70.  
  71. } catch (IOException e) {
  72. e.printStackTrace();
  73. }
  74.  
  75. for (Future<Runnable> f : futures) {
  76. f.get();
  77. }
  78.  
  79. System.out.println("Ended");
  80.  
  81. service.shutdownNow();
  82.  
  83. }
  84.  
  85. public void run() {
  86.  
  87. waitingForAnswer.add(accountToVerify);
  88. String charList;
  89. String email = accountToVerify.email;
  90. String password = accountToVerify.password;
  91.  
  92. try {
  93.  
  94. String emailBuff = email;
  95. String damnSon = email.replace("+", "%2B");
  96. email = emailBuff;
  97.  
  98. URL url = new URL(
  99. "http://realmofthemadgodhrd.appspot.com/char/list?guid=" + damnSon + "&password=" + password);
  100. BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
  101. charList = in.readLine();
  102. in.close();
  103.  
  104. if (charList.contains("<Equipment>")) {
  105.  
  106. String s = charList.substring(charList.indexOf("<Equipment>") + 11, charList.indexOf("</Equipment>"));
  107.  
  108. String s2[] = s.split(",");
  109.  
  110. int numberOfItems = 0;
  111.  
  112. for (int i = 4; i < s2.length; i++) {
  113.  
  114. int item = Integer.parseInt(s2[i]);
  115.  
  116. if (item != -1) {
  117.  
  118. numberOfItems++;
  119.  
  120. }
  121. }
  122.  
  123. if (numberOfItems == 6) {
  124.  
  125. for (Account yeezus : World.availableMasterBots) {
  126. if (yeezus.email.equals(accountToVerify.email)) {
  127. World.availableMasterBots.remove(yeezus);
  128. System.out.println("Removed " + accountToVerify.email + " becuz full inv bot");
  129. }
  130. }
  131.  
  132. }
  133. }
  134.  
  135. waitingForAnswer.remove(accountToVerify);
  136.  
  137. } catch (Exception ex) {
  138. System.err.println("ERROR ");
  139. ex.printStackTrace();
  140. }
  141. }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement