CALEMXS

bank

Jul 31st, 2015
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.91 KB | None | 0 0
  1. package com.calem.elder.tasks;
  2. import com.runemate.game.api.hybrid.input.Mouse;
  3. import com.runemate.game.api.hybrid.local.Camera;
  4. import com.runemate.game.api.hybrid.local.Screen;
  5. import com.runemate.game.api.hybrid.local.hud.Menu;
  6. import com.runemate.game.api.hybrid.local.hud.interfaces.Bank;
  7. import com.runemate.game.api.hybrid.location.navigation.Traversal;
  8. import com.runemate.game.api.hybrid.location.navigation.basic.BresenhamPath;
  9. import com.runemate.game.api.hybrid.location.navigation.web.WebPath;
  10. import com.runemate.game.api.hybrid.region.Banks;
  11. import com.runemate.game.api.hybrid.region.Players;
  12. import com.runemate.game.api.hybrid.util.calculations.Random;
  13. import com.runemate.game.api.script.Execution;
  14. import com.runemate.game.api.script.framework.task.Task;
  15.  
  16. /**
  17. * Created by Calem on 30.4.2015.
  18. */
  19. public class banking extends Task {
  20. @Override
  21. public boolean validate() {
  22. return 1 > 0; // execute when inventory is full. Change this to anything else when you want the script to bank.
  23.  
  24. }
  25.  
  26. @Override
  27. public void execute() {
  28. if (Banks.getLoaded() != null) {
  29. System.out.println("Not null");
  30. if (Banks.getLoaded().nearest().getPosition().distanceTo(Players.getLocal()) <= 10) {
  31. System.out.println("Under 10");
  32. if (Banks.getLoaded().nearest().isVisible()) {
  33. System.out.println("Visible");
  34. if (Banks.getLoaded().nearest().interact("Bank")) {
  35. System.out.println("Interact");
  36. Execution.delayUntil(() -> Bank.isOpen(), Random.nextInt(800, 2000));
  37. } else {
  38. System.out.println("Failed interaction.");
  39. if (Menu.isOpen() && !Menu.contains("Bank")) {
  40. switch (Random.nextInt(1, 5)) {
  41. case 3:
  42. Menu.close();
  43. break;
  44.  
  45. default:
  46. Mouse.move(Screen.getBounds().getInteractionPoint());
  47. break;
  48. }
  49. }
  50. switch (Random.nextInt(1, 10)) {
  51. case 5:
  52. Mouse.move(Screen.getBounds().getInteractionPoint());
  53. break;
  54. }
  55. }
  56. } else {
  57. System.out.println("Not visible");
  58. Camera.passivelyTurnTo(Random.nextInt(1, 359));
  59. }
  60. } else {
  61. System.out.println("More than 10");
  62. WebPath path = Traversal.getDefaultWeb().getPathBuilder().buildTo(Banks.getLoaded().sortByDistance().limit(3).random().getPosition().randomize(1, 3));
  63. if (path != null) {
  64. if (path.step(true)) {
  65. switch (Random.nextInt(1, 7)) {
  66. case 5:
  67. Camera.passivelyTurnTo(Random.nextInt(1, 359));
  68. break;
  69. }
  70. }
  71. } else {
  72. BresenhamPath p = BresenhamPath.buildTo(Banks.getLoaded().sortByDistance().limit(3).random().getPosition().randomize(1, 3));
  73.  
  74. if (p != null) {
  75. if (p.step(true)) {
  76. switch (Random.nextInt(1, 7)) {
  77. case 5:
  78. Camera.passivelyTurnTo(Random.nextInt(1, 359));
  79. break;
  80. }
  81. }
  82. }
  83. }
  84. }
  85. } else {
  86. System.out.println("we are fucked");
  87. }
  88. }
  89. }
Add Comment
Please, Sign In to add comment