Advertisement
Guest User

Untitled

a guest
May 29th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.10 KB | None | 0 0
  1. import java.util.Map;
  2.  
  3. import org.rsbot.bot.Bot;
  4. import org.rsbot.gui.AccountManager;
  5. import org.rsbot.script.Script;
  6. import org.rsbot.script.ScriptManifest;
  7. import org.rsbot.script.wrappers.RSInterface;
  8. import org.rsbot.script.wrappers.RSInterfaceChild;
  9. import org.rsbot.script.wrappers.RSInterfaceComponent;
  10.  
  11. @ScriptManifest(authors = { "ProCrus" },
  12.   category = "Login",
  13.   name = "ProLogin",
  14.   version = 1.0,
  15.   description = "" +
  16.   "
  17. " +
  18.   "ProLogin" +
  19.   "
  20. " +
  21.   "by ProCrus" +
  22.   "
  23. " +
  24.   "Uses Username and Password from Account Manager." +
  25.   "
  26. ")
  27.  
  28. public class ProLogin extends Script
  29. {
  30.  private String userName;
  31.  private String passWord;
  32.  
  33.  private RSInterfaceChild memberLogin = getInterface(905, 38);//Make 38 59 for F2P
  34.  private RSInterfaceComponent clickMem = memberLogin.getComponents()[4];
  35.  private RSInterface enterUsernamePass = getInterface(596);
  36.  private RSInterfaceChild userNameEnter = getInterface(596, 71);
  37.  private RSInterfaceChild passWordEnter = getInterface(596, 91);
  38.  private RSInterfaceChild loginButton = getInterface(596, 75);
  39.  
  40.  private RSInterfaceChild clickWorld = getInterface(906, 179);
  41.  
  42.  
  43.  
  44.  @Override
  45.  public void onFinish()
  46.  {
  47.  
  48.   return;
  49.  }
  50.  @Override
  51.  public boolean onStart(final Map args)
  52.  {
  53.   return true;
  54.  }
  55.  private int getLogin()
  56.  {
  57.   return getLoginIndex();
  58.  }
  59.  
  60.  
  61.  @Override
  62.  public int loop()
  63.  {
  64.   userName = Bot.getAccountName().replaceAll("_", " ").toLowerCase().trim();
  65.   passWord = AccountManager.***********(Bot.getAccountName());
  66.   if (getLogin() == 2)
  67.   {
  68.    if (enterUsernamePass.isValid())
  69.    {
  70.     int x;
  71.     int y;
  72.     if (checkForUsername() && checkForPassword())
  73.     {
  74.      x = (loginButton.getAbsoluteX() + random(10, 60));
  75.      y = (loginButton.getAbsoluteY() + random(5, 20));
  76.      moveMouse(x, y, true);
  77.      wait(60);
  78.      clickMouse(true);
  79.     }
  80.     if (!checkForUsername())
  81.     {
  82.      x = (userNameEnter.getAbsoluteX() + random(10, 60));
  83.      y = (userNameEnter.getAbsoluteY() + random(5, 20));
  84.      moveMouse(x, y, true);
  85.      wait(60);
  86.      clickMouse(true);
  87.      wait(60);
  88.      sendText(userName, false);
  89.      return 70;
  90.     }
  91.     if (checkForUsername() && !checkForPassword())
  92.     {
  93.      x = (passWordEnter.getAbsoluteX() + random(10, 60));
  94.      y = (passWordEnter.getAbsoluteY() + random(5, 20));
  95.      moveMouse(x, y, true);
  96.      wait(60);
  97.      clickMouse(true);
  98.      wait(60);
  99.      sendText(passWord, false);
  100.      return 70;
  101.     }
  102.     return 70;
  103.    }
  104.    else
  105.    {
  106.     if (memberLogin.isValid())
  107.     {
  108.      clickRSComponent(clickMem, true);
  109.     }
  110.    }
  111.   }
  112.   if (getLogin() == 6)
  113.   {
  114.    atInterface(clickWorld, "");
  115.   }
  116.   if (getLogin() == 9)
  117.   {
  118.    onFinish();
  119.   }
  120.   return 0;
  121.  }
  122.  
  123.  private boolean checkForUsername()
  124.  {
  125.   String currentEntered = userNameEnter.getText().toLowerCase();
  126.   if (currentEntered.equalsIgnoreCase(userName))
  127.    return true;
  128.   return false;
  129.  }
  130.  
  131.  private boolean checkForPassword()
  132.  {
  133.   int currentEntered = passWordEnter.getText().toLowerCase().length();
  134.   if (currentEntered == passWord.length())
  135.    return true;
  136.   return false;
  137.  }
  138.  
  139. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement