Guest User

Untitled

a guest
Oct 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.00 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Graphics;
  3. import java.util.Map;
  4.  
  5. import org.rsbot.event.listeners.PaintListener;
  6. import org.rsbot.script.Script;
  7. import org.rsbot.script.ScriptManifest;
  8. import org.rsbot.script.methods.Calculations;
  9. import org.rsbot.script.methods.MethodContext;
  10. import org.rsbot.script.wrappers.RSComponent;
  11. import org.rsbot.script.wrappers.RSGroundItem;
  12. import org.rsbot.script.wrappers.RSItem;
  13. import org.rsbot.script.wrappers.RSNPC;
  14. import org.rsbot.script.wrappers.RSPlayer;
  15. import org.rsbot.script.wrappers.RSTile;
  16.  
  17. @ScriptManifest(authors = "Sweet Dylz", category = "Combat", name = "Get Me Hides!", version = 1.1, description =
  18. "<br> 1. Start in Beefy Bill's field. </br>" +
  19. "<br> 2. Have at least twenty open inventory spots </br>" +
  20. "<br> 3. ??? </br> " +
  21. "<br> 4. PROFIT!!! </br> <br> </br> " +
  22. "Do you want to bury bones? " +
  23. "<select name='buryBones'>" +
  24. "<option>No</option>"
  25. + "<option>Yes</option>")
  26.  
  27. public class GetMeHides extends Script implements PaintListener
  28. {
  29. private int cowhide = 1739;
  30. private int[] cow = {81, 397, 1767, 1766, 1768};
  31. private int beefyBill = 246;
  32. private boolean walkingToCow = false;
  33. private boolean buryBones = false;
  34.  
  35. private int totalHides = 0;
  36. private long startTime = System.currentTimeMillis();
  37. private String activity = "";
  38.  
  39. public boolean onStart(Map<String, String> args)
  40. {
  41. if(args.get("buryBones").equals("Yes"))
  42. buryBones = true;
  43.  
  44. log("Let's kill some cows...");
  45. return true;
  46. }
  47.  
  48. public void onFinish()
  49. {
  50. log("Banked " + totalHides + " hides - go buy something shiny");
  51. }
  52.  
  53. public void bank()
  54. {
  55. activity = "banking";
  56.  
  57. RSNPC bill = npcs.getNearest(beefyBill);
  58. RSItem hide = inventory.getItem(cowhide);
  59.  
  60. if(bill == null)
  61. {
  62. walking.walkTo(new RSTile(3179, 3322));
  63. }
  64.  
  65. if(bill != null && hide != null)
  66. {
  67. while(!bill.isOnScreen())
  68. {
  69. walking.walkPathMM(walking.findPath(bill.getLocation()));
  70. activity = "walking to bill";
  71. sleep(random(2400, 2600));
  72. }
  73.  
  74. while(!bill.isOnScreen() || getMyPlayer().isMoving())
  75. sleep(random(100, 200));
  76.  
  77. hide.doClick(true);
  78. bill.doAction("-> Bee");
  79.  
  80. sleep(random(800, 1000));
  81.  
  82. if(interfaces.get(236).isValid())
  83. interfaces.get(236).getComponent(1).doClick();
  84. if(interfaces.get(451).isValid())
  85. interfaces.get(451).getComponent(1).doClick();
  86.  
  87. sleep(random(1000, 1200));
  88.  
  89. if(interfaces.get(241).isValid())
  90. interfaces.get(241).getComponent(5).doClick();
  91.  
  92. if(!inventory.contains(cowhide))
  93. totalHides += 18;
  94. }
  95. }
  96.  
  97. public void attackCow()
  98. {
  99. camera.setAltitude(true);
  100.  
  101. RSNPC target = npcs.getNearestFreeToAttack(cow);
  102.  
  103. activity = "killing cows";
  104.  
  105. if(target == null)
  106. walking.walkTo(new RSTile(3179, 3322));
  107.  
  108. if(target != null && !getMyPlayer().isInteractingWithLocalPlayer() && !getMyPlayer().isInCombat())
  109. {
  110. if(!target.isOnScreen() && !getMyPlayer().isMoving() && getMyPlayer().getInteracting() == null && !getMyPlayer().isInCombat())
  111. {
  112. mouse.click(calc.tileToMinimap(walking.findPath(target.getLocation())[1]), true);
  113. walkingToCow = true;
  114. }
  115.  
  116. if(target.isOnScreen() && getMyPlayer().getInteracting() == null && !getMyPlayer().isInCombat())
  117. {
  118. target.doAction("tack");
  119. walkingToCow = false;
  120. }
  121. }
  122. }
  123.  
  124. public void takeHides()
  125. {
  126. RSGroundItem hide = groundItems.getNearest(cowhide);
  127.  
  128. activity = "picking up a hide";
  129.  
  130. if(hide != null)
  131. {
  132. if(!hide.isOnScreen())
  133. {
  134. walking.walkPathMM(walking.findPath(hide.getLocation()));
  135. sleep(random(500, 600));
  136. }
  137.  
  138. if(hide.isOnScreen())
  139. {
  140. if(walkingToCow)
  141. {
  142. walking.walkPathOnScreen(walking.findPath(hide.getLocation()));
  143. walkingToCow = false;
  144. sleep(random(300, 400));
  145. }
  146.  
  147. hide.doAction("Take C");
  148.  
  149. if(buryBones)
  150. {
  151. RSGroundItem bone = groundItems.getNearest(526);
  152.  
  153. if(bone != null)
  154. {
  155. sleep(random(700, 900));
  156. bone.doAction("Take B");
  157. }
  158. }
  159. sleep(random(600, 800));
  160.  
  161. if(inventory.contains(526) && buryBones)
  162. inventory.getItem(526).doClick(true);
  163. }
  164. }
  165. return;
  166. }
  167.  
  168. public int loop()
  169. {
  170. //String runEnergy = interfaces.get(750).getComponent(5).getText();
  171.  
  172. if(!game.isLoggedIn())
  173. return(random(500, 600));
  174.  
  175. /*getMyPlayer().
  176.  
  177. if(runEnergy != null)
  178. if((Character.isDigit(runEnergy.charAt(0))))
  179. if(Integer.parseInt(runEnergy.trim()) >= random(70, 90))
  180. interfaces.get(750).getComponent(1).doClick();*/
  181.  
  182. antiban();
  183.  
  184. if(getMyPlayer().getLocation().getY() >= 3350)
  185. walking.walkTo(new RSTile(3179, 3322));
  186.  
  187. if(hasTwentyHides() && !getMyPlayer().isInCombat())
  188. bank();
  189. else if(groundItems.getNearest(cowhide)!= null)
  190. {
  191. takeHides();
  192. }
  193. else if(!getMyPlayer().isInCombat() && getMyPlayer().getInteracting() == null)
  194. attackCow();
  195.  
  196. return random(200,300);
  197. }
  198.  
  199. public boolean hasTwentyHides()
  200. {
  201. return inventory.getCount(cowhide) >= 20;
  202. }
  203.  
  204. public void onRepaint(Graphics g)
  205. {
  206. if(game.isLoggedIn())
  207. {
  208. g.setColor(Color.CYAN);
  209. long millis = System.currentTimeMillis() - startTime;
  210. long hours = millis / (1000 * 60 * 60);
  211. millis -= hours * (1000 * 60 * 60);
  212. long minutes = millis / (1000 * 60);
  213. millis -= minutes * (1000 * 60);
  214. long seconds = millis / 1000;
  215.  
  216. g.drawString("Get me Hides! by Sweet Dylz" , 9, 207);
  217. g.drawString("Currently: " + activity, 9, 227);
  218. g.drawString("Hides banked: " + totalHides , 9, 239);
  219. g.drawString("Time run: " + hours + " hours, " + minutes + " minutes, " + seconds + " seconds", 9, 251);
  220.  
  221. g.setColor(Color.ORANGE);
  222. g.drawLine((int)mouse.getClientLocation().getX(), 0, (int)mouse.getClientLocation().getX(), 500);
  223. g.drawLine(0, (int)mouse.getClientLocation().getY(), 764, (int)mouse.getClientLocation().getY());
  224. }
  225. }
  226.  
  227. public void antiban()
  228. {
  229. int rand = random(1,1200);
  230.  
  231. if(rand >= 1 && rand < 11)
  232. log("Antiban");
  233.  
  234. switch(rand)
  235. {
  236. case 1:
  237. RSPlayer p = players.getNearestByLevel(2, 130);
  238. if(p.isOnScreen())
  239. {
  240. mouse.click(p.getScreenLocation(), false);
  241. p.doAction("Cancel");
  242. }
  243. break;
  244. case 2:
  245. case 3:
  246. case 4:
  247. RSItem i = inventory.getItemAt(random(1,27));
  248. i.doClick(false);
  249. i.doAction("Examine");
  250. break;
  251. case 5:
  252. camera.moveRandomly(random(3000, 7000));
  253. camera.setAltitude(true);
  254. break;
  255. case 6:
  256. mouse.click(566, 185, 10, 15, true);
  257. RSComponent hpMenu = interfaces.get(320).getComponent(184);
  258. sleep(random(800, 1200));
  259. hpMenu.doHover();
  260. sleep(random(800, 1200));
  261. break;
  262. case 7:
  263. mouse.click(566, 185, 10, 15, true);
  264. RSComponent attMenu = interfaces.get(320).getComponent(194);
  265. sleep(random(800, 1200));
  266. attMenu.doHover();
  267. sleep(random(800, 1200));
  268. break;
  269. case 8:
  270. mouse.click(566, 185, 10, 15, true);
  271. RSComponent strMenu = interfaces.get(320).getComponent(5);
  272. sleep(random(800, 1200));
  273. strMenu.doHover();
  274. sleep(random(800, 1200));
  275. break;
  276. case 9:
  277. mouse.click(566, 185, 10, 15, true);
  278. RSComponent defMenu = interfaces.get(320).getComponent(22);
  279. sleep(800, 1200);
  280. defMenu.doHover();
  281. sleep(random(800, 1200));
  282. break;
  283. case 10:
  284. camera.setAngle(random(1,179));
  285. break;
  286. default:
  287. break;
  288. }
  289. }
  290.  
  291. }
Add Comment
Please, Sign In to add comment