Guest User

Untitled

a guest
Jun 21st, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.94 KB | None | 0 0
  1. package com.scripts;
  2.  
  3. import com.kbot2.scriptable.Script;
  4. import com.kbot2.scriptable.methods.wrappers.*;
  5.  
  6.  
  7.  
  8. public class EssenceMiner extends Script {
  9. /*Path*/
  10. Tile[] fromBanktoMiddle = {new Tile(3253, 3420), new Tile(3258, 3410)};
  11. Tile[] fromMiddletoAubury = {new Tile(3258, 3410), new Tile(3253, 3401)};
  12. Tile[] fromAuburytoBank = {new Tile(3253, 3401), new Tile(3258, 3410), new Tile(3253, 3420)};
  13. Tile[] portal = {new Tile(2885,4850), new Tile(2889,4813), new Tile(2932,4854), new Tile(2933,4815)};
  14. Tile[] essLoc = {new Tile(2893,4849), new Tile(2895,4814), new Tile(2927,4850),new Tile(2929,4816)};
  15. final Tile[][] pathToEssLocs = new Tile[] { new Tile[] {2893,4849}, new Tile[] {2895,4814}, new Tile[] {2927,4850}, new Tile[] {2929,4816} };
  16. Tile center = new Tile(2910,4832);
  17.  
  18. /*Define*/
  19. NPC aubury;
  20. Obj essence;
  21. Obj port;
  22. Obj b;
  23.  
  24. /*ID's*/
  25. int AUBURY_ID = 553;
  26. final int ESSENCE_ID = 2491;
  27. int PORTAL_ID = 2492;
  28. int BANK_ID = 11402;
  29. int status = 0;
  30.  
  31. private Tile[] whichPath() {
  32.  
  33. Tile[] which = pathToEssLocs[0];
  34. int dist = getMyPlayer().getLocation().distanceTo(essLoc[0]);
  35.  
  36. for(int i = 0; i < essLoc.length; i++) {
  37.  
  38. if(getMyPlayer().getLocation().distanceTo(essLoc[i]) < dist) {
  39. dist = getMyPlayer().getLocation().distanceTo(essLoc[i]);
  40. which = pathToEssLocs[i];
  41. }
  42.  
  43. }
  44.  
  45. return which;
  46. }
  47. @Override
  48. public boolean active() {
  49. return true;
  50. }
  51.  
  52. public String getName() {
  53. return "EssenceMiner";
  54. }
  55.  
  56. @Override
  57. public String getAuthor() {
  58. return "SuperTaranta";
  59. }
  60.  
  61. @Override
  62. public String getDescription() {
  63. return "Essence Miner";
  64. }
  65. @Override
  66. public boolean onStart() {
  67. log("Starting SuperTaranta's GayClub");
  68. return true;
  69. }
  70.  
  71.  
  72. public int loop() {
  73. if (!isLoggedIn()) {
  74. return random(1000, 1100);
  75. }
  76. if(walking.getEnergy() > 30)
  77. walking.setRunning(true);
  78. switch (status) {
  79.  
  80.  
  81.  
  82. case 0:
  83. if (inventory.isFull()) {
  84. status = 6;
  85. } else {
  86. status = 1;
  87. }
  88. return random(300, 500);
  89. case 1:
  90. // From Bank To Aubury
  91. log("Walking from Bank to Middle");
  92. walking.walkPath(fromBanktoMiddle);
  93. while(getMyPlayer().isMoving())
  94. sleep(3000);
  95. status = 2;
  96. return random(150, 300);
  97. case 2:
  98. // From Bank To Aubury
  99. log("Walking from Middle to Aubury");
  100. walking.walkPath(fromMiddletoAubury);
  101. while(getMyPlayer().isMoving())
  102. sleep(2000);
  103. status = 3;
  104. return random(150, 300);
  105.  
  106. case 3:
  107. //Teleport
  108. aubury = npcs.getClosest(20, AUBURY_ID);
  109. log("Teleporting");
  110. if (aubury != null) {
  111. aubury.doAction("Teleport");
  112. sleep(5000);
  113. status = 4;
  114. } else {
  115. status = 2;
  116. return random(150,300);
  117. }
  118. case 4:
  119. // From Center to Essence
  120. log("Center To Essence");
  121. camera.setAngle(random(30, 90));
  122. if(distanceTo(center) < 5){
  123. walking.walkPath(essLoc);
  124. while(getMyPlayer().isMoving())
  125. sleep(2000);
  126. }
  127. status = 5;
  128. return random(150, 300);
  129. case 5:
  130. //Find and Mine the Essence
  131. log("Looking and Mining Essence");
  132. essence = objects.getClosestObject(10, ESSENCE_ID);
  133. if (essence != null) {
  134. camera.setAngle(random(30, 90));
  135. if (getMyPlayer().getAnimation() == -1) {
  136. essence.doAction("Mine");
  137. sleep(20000);
  138. }
  139. if(inventory.isFull()){
  140. sleep(100);
  141. status = 6;
  142. }
  143. } else {
  144. log("Shit can't find ess");
  145. //whatever you want to do to find ess
  146. walking.objects.getClosestObject(30, ESSENCE_ID);
  147. sleep(100);
  148. return random(150, 300);
  149. }
  150. case 6:
  151. //Find Portal
  152. port = objects.getClosestObject(15, PORTAL_ID);
  153. log("Inventory full, looking for portal");
  154. if (inventory.isFull()) {
  155. walking.walkPath(portal);
  156. walking.getClosest(portal);
  157. while(getMyPlayer().isMoving())
  158. sleep(2000);
  159. port.doAction("Use");
  160. sleep(3000);
  161. status = 7;
  162. } else {
  163. status = 5;
  164. return random(150, 300);
  165. }
  166. case 7:
  167. // From Aubury To Bank
  168. log("Walking from Aubury to Bank");
  169. walking.walkPath(fromAuburytoBank);
  170. while(getMyPlayer().isMoving())
  171. sleep(100);
  172. status = 8;
  173. return random(150, 300);
  174. case 8:
  175. // Check Bank
  176. b = getClosestObject(7, BANK_ID);
  177. log("Checking/Opening Bank");
  178. while (!bank.isOpen()) {
  179. if (b != null)
  180. b.doAction("Use-quickly");
  181. sleep(750, 1000);
  182. }
  183. status = 9;
  184. return random(150, 300);
  185. case 9:
  186. // Banking
  187. log("Banking");
  188. if (!bank.isOpen()) {
  189. status = 8;
  190. return 100;
  191. }
  192. while (inventory.getCount() > 1) {
  193. bank.depositAll(1436);
  194. }
  195. bank.close();
  196. sleep(350, 500);
  197. if (bank.isOpen())
  198. bank.close();
  199. status = 0;
  200. return random(150, 300);
  201. }
  202.  
  203. return random(100, 300);
  204. }
  205.  
  206. }
Add Comment
Please, Sign In to add comment