Guest User

Untitled

a guest
Jun 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.43 KB | None | 0 0
  1. /* Version 1.0 *** Created By Spike
  2. */
  3. package com.scripts;
  4.  
  5. import java.awt.Color;
  6. import java.awt.Point;
  7. import java.awt.Graphics;
  8. import java.util.Map;
  9.  
  10. import com.kbot2.scriptable.Script;
  11. import com.kbot2.scriptable.methods.wrappers.NPC;
  12. import com.kbot2.scriptable.methods.wrappers.Obj;
  13. import com.kbot2.scriptable.methods.wrappers.Tile;
  14. import com.kbot2.scriptable.methods.wrappers.Interface;
  15. import com.kbot2.scriptable.methods.data.NPCs;
  16. import com.kbot2.scriptable.methods.data.Walking;
  17. import com.kbot2.scriptable.methods.data.Bank;
  18. import com.kbot2.handlers.eventSystem.eventListeners.PaintListener;
  19.  
  20. public class CraftGuildMiner extends Script {
  21. Tile[] TO_GUILD = new Tile[]{new Tile(3012,3355),
  22. new Tile(3009,3359), new Tile(3008,3354),
  23. new Tile(3008,3349), new Tile(3008,3344),
  24. new Tile(3008,3339), new Tile(3008,3334),
  25. new Tile(3008,3329), new Tile(3006,3324),
  26. new Tile(3003,3320), new Tile(2999,3316),
  27. new Tile(2995,3313), new Tile(2992,3309),
  28. new Tile(2989,3304), new Tile(2986,3300),
  29. new Tile(2983,3296), new Tile(2978,3295),
  30. new Tile(2973,3293), new Tile(2968,3293),
  31. new Tile(2963,3293), new Tile(2958,3292),
  32. new Tile(2954,3289), new Tile(2949,3289),
  33. new Tile(2944,3292), new Tile(2939,3293),
  34. new Tile(2934,3293), };
  35. Tile[] TO_BANK = walking.reversePath(TO_GUILD);
  36. Tile[] IN_GUILD = new Tile[]{new Tile(2933,3288), new Tile(2936,3283), };
  37. Tile[] OUT_GUILD = walking.reversepath(IN_GUILD);
  38.  
  39. int PICK[] = { 1275, 1271, 1273, 1269, 1267, 1265 };
  40. int ANIMATION = 625;
  41. int Gold_ID[] = { 11185, 11184, 11183, 11185};
  42. int MINED = 0;
  43. int MIN_START_XP;
  44. int MIN_START_LEVEL;
  45. int BANK_ID = 11758;
  46. int APRON = 1757;
  47. int GOLD_ORE = 444;
  48. int DOOR_ID =31119;
  49. int status = 0;
  50. int MINED = 0;
  51. int trips = 0;
  52.  
  53. long startTime;
  54. String Status;
  55.  
  56.  
  57. public boolean active(){
  58. return true;
  59. }
  60.  
  61. public boolean onStart() {
  62. MIN_START_LEVEL = skills.getLevel(Skills.SKILL_MINING);
  63. MIN_START_XP = skills.getExperience(Skills.SKILL_MINING);
  64. startTime = System.currentTimeMillis();
  65. return true;
  66. }
  67. public void onServerMessage(String message) {
  68. if (message.contains("You manage")) {
  69. MINED++;
  70. }
  71. }
  72.  
  73. public void onStop() {
  74. }
  75.  
  76. public void antiBan() {
  77. if (random(1, 10) == 5) {
  78. camera.setAngle(random(1, 360));
  79. }
  80. if (random(1, 15) == 10) {
  81. mouse.moveMouse(random(1, 765), random(1, 503), random(1, 30), random(1, 30));
  82. }
  83. if (random(1, 8) == 4) {
  84. sleep(400, 1200);
  85. }
  86. }
  87.  
  88. public String getAuthor() {
  89. return "Spike";
  90. }
  91.  
  92. public String getDescription() {
  93. return "Mines gold at crafting guild.";
  94. }
  95.  
  96.  
  97. public int loop() { // main stuff goes here
  98.  
  99.  
  100. setMouseSpeed(random(0,2));
  101.  
  102. if(walking.getEnergy() > 50)
  103. walking.setRunning(true);
  104.  
  105. if(getMyPlayer().getAnimation() != -1) {
  106. return (random(100,200));
  107. }
  108.  
  109. switch (status) {
  110. case 0:
  111. /* To Shop
  112. */
  113. Status = "Walking to the craft guild";
  114. log("Walking to the craft guild");
  115. if(walking.getEnergy() > 10)
  116. walking.setRunning(true);
  117. walking.walkPath(walking.randomizePath(TO_GUILD, 2, 2));
  118. if(!getMyPlayer().isMoving()) {
  119. status = 1;
  120. }
  121. break;
  122.  
  123. case 1:
  124. /* Opening Door
  125. */
  126. Status = "Opening Door";
  127. log("Opening..");
  128. camera.setAltitude(false);
  129. sleep(random(100, 350));
  130. Obj d = getClosestObject(3, DOOR_ID);
  131. if(d != null)
  132. d.doActionAtDoor('w', "open");
  133. log("Door is Opened");
  134. status = 2;
  135. break;
  136.  
  137. case 2:
  138. /* Walking to ores
  139. */
  140. Status = "To ore..";
  141. log("To ore..");
  142. camera.setAltitude(true);
  143. walking.walkPath(IN_GUILD);
  144. status = 3;
  145. break;
  146.  
  147. case 3:
  148. /* mining :S
  149. */
  150. Status = "mining..";
  151. log("mining..");
  152. camera.setAltitude(true);
  153. Obj rock = getClosestObject(GOLD_ID);
  154. rock.doAction("Mine");
  155. if (inventory.isFull()) {
  156. status++;
  157. }
  158. break;
  159.  
  160. case 4:
  161. /* To Bank
  162. */
  163. Status = "walking to bank";
  164. log("To bank");
  165. if(walking.getEnergy() > 10)
  166. walking.setRunning(true);
  167. camera.setAltitude(true);
  168. walking.walkPath(walking.randomizePath(OUT_GUILD, 1, 1));
  169. status = 5;
  170. break;
  171.  
  172. case 5:
  173. /* To Bank
  174. */
  175. Status = "walking to bank";
  176. log("To bank");
  177. if(walking.getEnergy() > 10)
  178. walking.setRunning(true);
  179. camera.setAltitude(true);
  180. walking.walkPath(walking.randomizePath(TO_BANK, 2, 2));
  181. status = 6;
  182. break;
  183.  
  184. case 6:
  185. /* walking to bank
  186. */
  187. Status = "Banking";
  188. log("Banking");
  189. camera.setCompass('e');
  190. Obj b = getClosestObject(7, BANK_ID);
  191. b.doAction("Use-quickly");
  192. sleep(random(350, 500));
  193. bank.depositAllExcept( APRON, PICK);
  194. sleep(random(350, 500));
  195. trips++;
  196. status = 0;
  197. return random(150, 300);
  198. }
  199. return random(1000, 2000);
  200. }
  201.  
  202. public void onRepaint(Graphics w) {
  203.  
  204. long runTime = System.currentTimeMillis() - startTime;
  205.  
  206. int secs = ((int) ((runTime / 1000) % 60));
  207. int mins = ((int) (((runTime / 1000) / 60) % 60));
  208. int hours = ((int) ((((runTime / 1000) / 60) / 60) % 60));
  209.  
  210. w.setColor(Color.red);
  211. w.drawString("Spikee's Craftin Guild Miner", 34, 43);
  212. w.drawString("Status: " + Status, 34, 61);
  213. w.drawString("Run time: " + (hours < 10 ? "0" : "") + hours + ":"
  214. + (mins < 10 ? "0" : "") + mins + ":" + (secs < 10 ? "0" : "")
  215. + secs, 34, 79);
  216. w.drawString("Experience gained: " + (skills.getExperience(Skills.SKILL_MINING) - MIN_START_XP), 34, 115);
  217. w.drawString("Exp to next level: " + (skills.getExperienceToNextLevel(Skills.SKILL_MINING)), 34, 133);
  218. w.drawString("To next level: " + (skills.getExperienceToNextLevel(Skills.SKILL_MINING)) / 40 + " Ores", 34, 151);
  219. w.drawString((skills.getPercentageToNextLevel(Skills.SKILL_MINING)) + "% to next level" , 34, 169);
  220. w.drawString("Current Level: " +(skills.getLevel(Skills.SKILL_MINING)) , 34, 187);
  221. w.drawString("No. of Ores: " + MINED , 34, 205);
  222. w.drawstring("Trips Made: " + trips ,34, 223);
  223. }
  224.  
  225. }
Add Comment
Please, Sign In to add comment