Guest User

Untitled

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