Guest User

Untitled

a guest
Jul 21st, 2018
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.72 KB | None | 0 0
  1. /**
  2. * @param id Id of the item you want to withdraw.
  3. */
  4. public void withdrawAllButOne(int id) {
  5. withdraw(id, 0, WITHDRAW_ALL_BUT_ONE);
  6.  
  7. }
  8.  
  9. /**
  10. * @param id Id of the item you want to withdraw.
  11. */
  12. public void withdrawAll(int id) {
  13. withdraw(id, 0, WITHDRAW_ALL);
  14. }
  15.  
  16. /**
  17. * @param id Id of the item you want to withdraw.
  18. * @param amount Amount of the item you want to withdraw.
  19. */
  20. public void withdraw(int id, int amount) {
  21. withdraw(id, amount, WITHDRAW_X);
  22.  
  23. }
  24.  
  25.  
  26. /**
  27. * @param id Id of the item you want to withdraw.
  28. * @param amount Amount of the item you want to withdraw.
  29. * @param type Withdraw type - withdraw-x, all, all-but-one
  30. */
  31. private void withdraw(int id, int amount, int type) {
  32. boolean doAction = false;
  33. Item item = bank.getItem(id);
  34. if (bank.contains(id) && item != null) {
  35. if (bank.getCount(id) >= amount) {
  36. IComponent visible = interfaces.getComponent(Bank.BANK_INTERFACE_ID, 3);
  37. if (visible != null) {
  38. if (visible.getBounds().contains(item.getBounds())) { //visible
  39. doAction = true;
  40. } else while (!visible.getBounds().contains(item.getBounds())) {
  41. item = bank.getItem(id);
  42. int scroll;
  43. if (item.getCenter().y < visible.getCenter().y) { //scroll up
  44. scroll = Bank.BANK_SCROLLBAR_UP;
  45. } else scroll = Bank.BANK_SCROLLBAR_DOWN;
  46. IComponent button = interfaces.getComponent(Bank.BANK_INTERFACE_ID, Bank.BANK_SCROLLBAR);
  47. if (button != null) {
  48. button.getChildren()[scroll].doClick();
  49. } else return;
  50. }
  51. doAction = true;
  52. }
  53. }
  54. }
  55. if (doAction) {
  56. Rectangle r = item.getBounds();
  57. mouse.moveMouse(new Point(random(r.x + 2, r.x + r.width - 2), random(r.y + 2, r.y + r.height - 2)));
  58. String action = "Withdraw-" + amount + " ";
  59. if (type == WITHDRAW_ALL) {
  60. action = "Withdraw-All";
  61. } else if (type == WITHDRAW_ALL_BUT_ONE) {
  62. action = "Withdraw-All but one";
  63. }
  64. if (menu.contains(action)) {
  65. menu.atMenu(action);
  66. } else { //withdraw X
  67. menu.atMenu("Withdraw-X");
  68. sleep(random(1000, 2000));
  69. keyboard.writeText(Integer.toString(amount), true);
  70. }
  71. }
  72. }
Add Comment
Please, Sign In to add comment