Advertisement
Guest User

Untitled

a guest
Jun 1st, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. package CosmicLooter;
  2.  
  3. import org.tbot.wrappers.Tile;
  4.  
  5. public class CosmicLooterGlobal {
  6.  
  7. public static int[] worldList = new int[]{302, 303, 304, 305, 306, 309, 310, 311, 312, 313, 314, 318, 320, 322, 327, 328, 329, 330, 333, 334, 336, 338, 341, 342, 343, 344, 346, 350, 351, 352, 354, 357, 358, 359, 360, 362, 367, 368, 369, 370, 374, 375, 376, 377, 378, 386};
  8. public static String cosmicRune = new String("Cosmic rune");
  9. public static Tile cosmicTile = new Tile(2947, 3898, 0);
  10. public static Tile lumbyTile = new Tile(3220, 3219, 0);
  11. }
  12.  
  13. package CosmicLooter;
  14.  
  15. import org.tbot.bot.TBot;
  16. import org.tbot.methods.Game;
  17.  
  18. public class EndScript implements Node {
  19.  
  20. @Override
  21. public boolean validate() {
  22. // if cosmic tile > 5 or lumbytile distance is less than 20
  23. return CosmicLooterGlobal.cosmicTile.distance() > 5 || CosmicLooterGlobal.lumbyTile.distance() < 20 && Game.isLoggedIn();
  24. }
  25.  
  26. @Override
  27. public void execute() {
  28. // end script
  29. TBot.getBot().getScriptHandler().stopScript();
  30. }
  31. }
  32.  
  33. package CosmicLooter;
  34.  
  35. import org.tbot.internal.handlers.LogHandler;
  36. import org.tbot.methods.Game;
  37. import org.tbot.methods.GroundItems;
  38. import org.tbot.methods.tabs.Inventory;
  39.  
  40. import java.util.Random;
  41.  
  42. public class Hop implements Node{
  43. @Override
  44. public boolean validate() {
  45. return (GroundItems.getNearest(CosmicLooterGlobal.cosmicRune) == null && Game.isLoggedIn() && Game.getGameState() == 30);
  46. }
  47.  
  48. @Override
  49. public void execute() {
  50. Game.instaHop(getRandom(CosmicLooterGlobal.worldList));
  51. }
  52.  
  53. public static int getRandom(int[] array) {
  54. int random = (new Random()).nextInt(CosmicLooterGlobal.worldList.length);
  55. LogHandler.log(Integer.valueOf(array[random]));
  56. return array[random];
  57. }
  58. }
  59.  
  60. package CosmicLooter;
  61.  
  62. import org.tbot.internal.AbstractScript;
  63. import org.tbot.internal.Manifest;
  64. import org.tbot.internal.ScriptCategory;
  65. import org.tbot.methods.Game;
  66.  
  67. @Manifest(
  68. version = 1.0D,
  69. name = "Cosmic Script",
  70. description = "",
  71. category = ScriptCategory.MONEY_MAKING,
  72. authors = {"Jebbyo"}
  73. )
  74.  
  75. public class Main extends AbstractScript {
  76.  
  77. private final Node[] nodes = {new Pickup(), new EndScript()};
  78.  
  79.  
  80. @Override
  81. public int loop() {
  82. if (Game.isLoggedIn()) {
  83. for (Node node : nodes) {
  84. final Node n = node;
  85. if (n.validate()) {
  86. n.execute();
  87. break;
  88. }
  89. }
  90. }
  91. return 150;
  92. }
  93. }
  94.  
  95. package CosmicLooter;
  96.  
  97. public interface Node {
  98.  
  99. boolean validate();
  100.  
  101. void execute();
  102.  
  103. }
  104.  
  105.  
  106. package CosmicLooter;
  107.  
  108. import org.tbot.internal.handlers.LogHandler;
  109. import org.tbot.methods.Game;
  110. import org.tbot.methods.GroundItems;
  111. import org.tbot.methods.Time;
  112. import org.tbot.wrappers.GroundItem;
  113.  
  114. import java.util.Random;
  115.  
  116. public class Pickup implements Node {
  117.  
  118. GroundItem rune;
  119.  
  120.  
  121. @Override
  122. public boolean validate() {
  123. if(GroundItems.getNearest(CosmicLooterGlobal.cosmicRune) == null && Game.isLoggedIn()) {
  124. Game.instaHop(getRandom(CosmicLooterGlobal.worldList));
  125. Time.sleep(1000,2000);
  126. }
  127. return GroundItems.getNearest(CosmicLooterGlobal.cosmicRune) != null;
  128. }
  129.  
  130. @Override
  131. public void execute() {
  132. if (GroundItems.getNearest(CosmicLooterGlobal.cosmicRune) != null) {
  133. this.rune = GroundItems.getNearest(CosmicLooterGlobal.cosmicRune);
  134. if (this.rune != null && rune.isOnScreen()) {
  135. this.rune.interact("Take " + this.rune.getName());
  136. Time.sleep(600, 1200);
  137. }
  138. }
  139. }
  140.  
  141. public static int getRandom(int[] array) {
  142. int random = (new Random()).nextInt(CosmicLooterGlobal.worldList.length);
  143. LogHandler.log(Integer.valueOf(array[random]));
  144. return array[random];
  145. }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement