Guest User

Untitled

a guest
Jun 23rd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.82 KB | None | 0 0
  1. package com.scripts;
  2.  
  3. import java.awt.Point;
  4.  
  5. import com.kbot2.scriptable.Script;
  6. import com.kbot2.scriptable.*;
  7. import com.kbot2.scriptable.methods.*;
  8. import com.kbot2.scriptable.methods.data.*;
  9. import com.kbot2.scriptable.methods.wrappers.*;
  10. import com.kbot2.scriptable.methods.data.Skills;
  11. import com.kbot2.scriptable.methods.input.Mouse;
  12.  
  13. public class LumbySwampMiner extends Script {
  14.  
  15. public int BANK_BOOTH = 2213;
  16. public final int[] PICKAXE = { 1275, 1271, 1273, 1269, 1267, 1265 };
  17. public final int[] COAL_ROCK = { 11930, 11931, 11932 };
  18. public final int[] MITH_ROCK = { 11944, 11943, 11942 };
  19. public Tile[] BANK_TO_MINE = new Tile[]{new Tile(3093,3243), new Tile(3096,3247), new Tile(3098,3242), new Tile(3098,3237), new Tile(3100,3232), new Tile(3103,3228), new Tile(3108,3225), new Tile(3111,3221), new Tile(3116,3218), new Tile(3119,3213), new Tile(3123,3209), new Tile(3127,3206), new Tile(3132,3205), new Tile(3137,3203), new Tile(3138,3198), new Tile(3138,3193), new Tile(3142,3189), new Tile(3142,3184), new Tile(3142,3179), new Tile(3142,3174), new Tile(3142,3169), new Tile(3144,3164), new Tile(3146,3159), new Tile(3150,3155), new Tile(3151,3150), new Tile(3147,3149), };
  20. public Tile[] MINE_TO_BANK = Walking.reversePath(BANK_TO_MINE);
  21. Obj rockCoal;
  22. Obj rockMith;
  23. Obj booth;
  24.  
  25. public boolean onStart() {
  26. if(skills.getLevel(Skills.SKILL_MINING) < 30) {
  27. log("You need at least level 30 mining.");
  28. return false;}
  29. return true;
  30. }
  31.  
  32. public void onStop() {
  33. return;
  34. }
  35.  
  36. public void mouseSpeed() {
  37. int speed = random(1000,2800);
  38. double newSpeed = speed / 1000;
  39. setMouseSpeed(newSpeed);
  40. }
  41.  
  42. public boolean isInMiningArea() {
  43. int myX = players.getMyPlayer().getLocation().getX();
  44. int myY = players.getMyPlayer().getLocation().getY();
  45. if(myX >= 3133 && myX <= 3153 && myY <= 3156 && myY >= 3140) {
  46. return true; }
  47. return false;
  48. }
  49.  
  50. public boolean isInBank() {
  51. int myX = players.getMyPlayer().getLocation().getX();
  52. int myY = players.getMyPlayer().getLocation().getY();
  53. if(myX >= 3092 && myX <= 3098 && myY <= 3246 && myY >= 3240) {
  54. return true; }
  55. return false;
  56. }
  57.  
  58. public void antiBan() {
  59. int i = random(0,80);
  60. if(i == 0 || i == 1) {
  61. mouse.moveMouse(random(0,515),random(0,336)); }
  62. if(i == 2) {
  63. mouse.moveMouse(random(0,515),random(0,336));
  64. sleep(50,200);
  65. mouse.moveMouse(random(0,515),random(0,336)); }
  66. if(i == 3) {
  67. if(random(0,6) == 0) {
  68. clickMouse(new Point(random(0,515),random(0,336)),false); }}
  69. if(i == 4) {
  70. mouse.moveMouse(random(0,765),random(0,505)); }
  71. if(i == 5) {
  72. sleep(500,3000); }
  73. if(i == 6) {
  74. camera.setAngle(random(-359,359)); }
  75. if(i == random(0,6)) {
  76. mouseSpeed(); }
  77. }
  78.  
  79. public int loop() {
  80. if (walking.getEnergy() >= random(35, 100)) {
  81. walking.setRunning(true);
  82. sleep(random(400, 900));
  83. }
  84. while(getMyPlayer().getAnimation() == 624) {
  85. antiBan();
  86. sleep(300,600);
  87. }
  88. if(!inventory.isFull() && getMyPlayer().getAnimation() == -1 && !getMyPlayer().isMoving() && isInMiningArea()) {
  89. sleep(300);
  90. if(!inventory.isFull() && getMyPlayer().getAnimation() == -1 && !getMyPlayer().isMoving() && isInMiningArea()) {
  91. sleep(50,750);
  92. mouseSpeed();
  93. Obj rockCoal = getClosestObject(10, COAL_ROCK);
  94. if(rockCoal == null) {
  95. if(skills.getLevel(Skills.SKILL_MINING) >= 55) {
  96. Obj rockMith = getClosestObject(10, MITH_ROCK);
  97. if(rockMith == null) {
  98. antiBan();
  99. }
  100. else {
  101. rockMith.doAction("Mine");
  102. sleep(400,700);
  103. while(getMyPlayer().isMoving() && getMyPlayer().getAnimation() != 624) {
  104. sleep (100,300);
  105. antiBan();
  106. }
  107. }
  108. }
  109. else {
  110. sleep(100,300);
  111. antiBan();
  112. }
  113. }
  114. else {
  115. rockCoal.doAction("Mine");
  116. sleep(400,700);
  117. while(getMyPlayer().isMoving() && getMyPlayer().getAnimation() != 624) {
  118. sleep (100,300);
  119. antiBan();
  120. }
  121. }
  122. }
  123. return random(10,50);
  124. }
  125. if(inventory.isFull() && isInMiningArea()) {
  126. sleep(200,1300);
  127. walking.walkPath(walking.randomizePath(MINE_TO_BANK, 2, 2));
  128. return random(10,20);
  129. }
  130. if(inventory.getCount() > 1 && isInBank()) {
  131. mouseSpeed();
  132. antiBan();
  133. Obj booth = getClosestObject(7, BANK_BOOTH);
  134. booth.doAction("Use-quickly");
  135. sleep(700,1700);
  136. }
  137. if(bank.isOpen()) {
  138. antiBan();
  139. while (inventory.getCount() > 1) {
  140. bank.depositAllExcept(PICKAXE);
  141. sleep(200,500); }
  142. antiBan();
  143. if(random(0,4) == 0) {
  144. clickMouse(new Point(489,35),random(-5,5),random(-5,5),true);
  145. sleep(200,500);
  146. walking.walkPath(walking.randomizePath(BANK_TO_MINE, 2, 2));}
  147. else {
  148. walking.walkPath(walking.randomizePath(BANK_TO_MINE, 2, 2));
  149. }
  150. }
  151. if(!getMyPlayer().isMoving() && players.getMyPlayer().getLocation().getY() >= 3155 && players.getMyPlayer().getLocation().getY() <= 3239) {
  152. if(inventory.getCount() > 1) {
  153. walking.walkPath(walking.randomizePath(MINE_TO_BANK, 2, 2)); }
  154. else {
  155. walking.walkPath(walking.randomizePath(BANK_TO_MINE, 2, 2)); }
  156. }
  157. if(!getMyPlayer().isMoving() && isInBank() && inventory.getCount() <= 1) { //just a failsafe
  158. sleep(300,800);
  159. walking.walkPath(walking.randomizePath(BANK_TO_MINE, 2, 2));
  160. }
  161. return random(400,800);
  162. }
  163.  
  164. public String getName() {
  165. return "Lumbridge Swamp Miner";
  166. }
  167.  
  168. public String getAuthor() {
  169. return "Mizleh";
  170. }
  171.  
  172. public String getDescription() {
  173. return "Mines and banks coal in the Lumbridge swamp.";
  174. }
  175. }
Add Comment
Please, Sign In to add comment