Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.14 KB | None | 0 0
  1. import org.rsbot.script.Script;
  2. import org.rsbot.script.ScriptManifest;
  3. import org.rsbot.script.wrappers.RSGroundItem;
  4. import org.rsbot.script.wrappers.RSNPC;
  5. import org.rsbot.script.wrappers.RSTile;
  6. import org.rsbot.script.wrappers.RSArea;
  7. import org.rsbot.script.wrappers.RSWeb;
  8. import org.rsbot.event.listeners.*;
  9.  
  10. import java.awt.*;
  11.  
  12. @ScriptManifest(name = "Lordluke24barblootter", version = 1.00, description = "Loots fish",
  13.  
  14. authors = "Lordluke24")
  15. public class Lordluke24barbblootter extends Script implements PaintListener {
  16.  
  17. private int[] fishes = { 331 };
  18. private int FISHES_LOOTED;
  19. private long startTime = System.currentTimeMillis();
  20.  
  21. RSArea atBank = new RSArea(new RSTile(3088,3484), new RSTile(3102,3502));
  22. RSArea atSpot = new RSArea(new RSTile(3100,3419), new RSTile(3113,3439));
  23.  
  24. RSTile bankTile = new RSTile(3094,3494);
  25. RSTile spotTile = new RSTile(3105,3433);
  26.  
  27. RSWeb bankPath;
  28. RSWeb spotPath;
  29.  
  30. public boolean onStart() {
  31. return true;
  32. }
  33.  
  34. private void walkBank() {
  35. bankPath = web.getWeb(getMyPlayer().getLocation(), bankTile);
  36. bankPath.step();
  37. }
  38.  
  39. private void walkSpot() {
  40. spotPath = web.getWeb(getMyPlayer().getLocation(), spotTile);
  41. spotPath.step();
  42. }
  43.  
  44. private void loot() {
  45. RSGroundItem fish = groundItems.getNearest(fishes);
  46. if(getMyPlayer().getAnimation() == -1) {
  47. if(fish != null) {
  48. if(fish.isOnScreen()) {
  49. fish.doAction("Take");
  50. sleep(50);
  51. } else {
  52. walking.walkTileMM(fish.getLocation());
  53. }
  54. } else {
  55. sleep(50);
  56. }
  57. }
  58. }
  59.  
  60. private void bank() {
  61. if(bank.isOpen()) {
  62. if(inventory.containsOneOf(fishes)) {
  63. bank.depositAll();
  64. FISHES_LOOTED = FISHES_LOOTED +28;
  65. }
  66. sleep(2000);
  67. if(!inventory.containsOneOf(fishes)) {
  68. bank.close();
  69. }
  70. } else {
  71. bank.open();
  72. }
  73. }
  74.  
  75. private void antiban() {
  76. switch(random(1,5)) {
  77.  
  78. case 1:
  79. mouse.move(random(100, 700), random(100, 500));
  80. break;
  81.  
  82. case 2:
  83. camera.setPitch(true);
  84. int angle = camera.getAngle() + random(-100, 100);
  85. if(angle < 0) {
  86. angle += 359;
  87. }
  88. if(angle > 359) {
  89. angle -= 359;
  90. }
  91. camera.setAngle(angle);
  92. break;
  93.  
  94. case 5:
  95. int angle2 = camera.getAngle() + random(-40, 40);
  96. if(angle2 < 0) {
  97. angle2 += 359;
  98. }
  99. if(angle2 > 359) {
  100. angle2 -= 359;
  101. }
  102. camera.setAngle(angle2);
  103. break;
  104. }
  105. }
  106.  
  107. @Override
  108. public int loop() {
  109. if(random(1,5) == 3) {
  110. antiban();
  111. }
  112. if(!walking.isRunEnabled() && walking.getEnergy() > 20) {
  113. walking.setRun(true);
  114. }
  115. if(!inventory.isFull()) {
  116. if(!atSpot.contains(getMyPlayer().getLocation())) {
  117. walkSpot();
  118. } else {
  119. loot();
  120. }
  121. } else {
  122. if(!atBank.contains(getMyPlayer().getLocation())) {
  123. walkBank();
  124. } else {
  125. bank();
  126. }
  127. }
  128. return(random(500,1000));
  129. }
  130.  
  131. private final Color color1 = new Color(51, 102, 255, 154);
  132. private final Color color2 = new Color(102, 0, 102);
  133.  
  134. private final BasicStroke stroke1 = new BasicStroke(1);
  135.  
  136. private final Font font1 = new Font("Tahoma", 1, 12);
  137. private final Font font2 = new Font("Tahoma", 0, 12);
  138.  
  139. public void onRepaint(Graphics g1) {
  140. Graphics2D g = (Graphics2D)g1;
  141. g.setColor(color2);
  142. g.setStroke(stroke1);
  143. g.setFont(font2);
  144. g.drawString("Fishe Picked: " + FISHES_LOOTED, 341, 361);
  145. g.drawString("Run Time: " + getRuntime(), 380, 377);
  146. }
  147.  
  148. private String getRuntime() {
  149. try {
  150. long millis = System.currentTimeMillis() - startTime;
  151. long hours = millis / (1000 * 60 * 60);
  152. millis -= hours * (1000 * 60 * 60);
  153. long minutes = millis / (1000 * 60);
  154. millis -= minutes * (1000 * 60);
  155. long seconds = millis / 1000;
  156. return ("" + (hours < 10 ? "0" : "") + hours + ":"
  157. + (minutes < 10 ? "0" : "") + minutes + ":"
  158. + (seconds < 10 ? "0" : "") + seconds + "");
  159. } catch (Exception e) {
  160. return "";
  161. }
  162. }
  163.  
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement