Guest User

Untitled

a guest
Nov 22nd, 2018
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.60 KB | None | 0 0
  1.  
  2. import org.rsbot.script.*;
  3. import java.awt.*;
  4. import java.awt.event.*;
  5. import org.rsbot.script.internal.event.PaintListener;
  6. import org.rsbot.script.methods.Calculations;
  7. import org.rsbot.script.methods.Game;
  8. import org.rsbot.script.methods.GroundItems;
  9. import org.rsbot.script.methods.Mouse;
  10. import org.rsbot.script.methods.Players;
  11. import org.rsbot.script.methods.Skills;
  12. import org.rsbot.script.methods.Walking;
  13. import org.rsbot.script.methods.tabs.Inventory;
  14. import org.rsbot.script.methods.ui.Interfaces;
  15.  
  16. import org.rsbot.script.wrappers.Tile;
  17.  
  18. @ScriptManifest(authors = "NEXBot (Muhatashim)", name = "NEXBury", version = .8, description = "Finds bones, buries them")
  19. public class NEXBury extends Script implements PaintListener, MouseListener {
  20.  
  21. long Time = System.currentTimeMillis();
  22. boolean lookForEmote = false;
  23. boolean showPaint = true;
  24. boolean isPressed = false;
  25. int bonesBuried = 0;
  26. Tile LastLocation = null;
  27. int EXPGained = 0;
  28. int startEXP = 0;
  29. int currentEXP = 0;
  30. int LVLGained = 0;
  31. int startLVL = 0;
  32. int currentLVL = 0;
  33. long startTime = 0;
  34. long currentTime = 0;
  35. long timeout2Start = 0;
  36. long timeout2Curr = 0;
  37. double divide = 0;
  38. double expPrHr = 0;
  39.  
  40. public boolean onStart() {
  41. startEXP = Skills.getExperience(5);
  42. startLVL = Skills.getLevel(5);
  43. startTime = System.currentTimeMillis();
  44. return true;
  45. }
  46.  
  47. @Override
  48. public int loop() {
  49. if (Walking.getEnergy() >= random(40, 60)) {
  50. Walking.setRun(true);
  51. }
  52. if ((Players.getLocal().isMoving() && GroundItems.getNearest("Bones").isOnScreen() && LastLocation != GroundItems.getNearest("Bones").getLocation()) || Calculations.distanceTo(LastLocation) <= 2) {
  53. Mouse.setPrecisionSpeed(random(3, 10));
  54. int x = GroundItems.getNearest("Bones").getPoint().x + random(-10, 10);
  55. int y = GroundItems.getNearest("Bones").getPoint().y + random(-10, 10);
  56. Mouse.move(x, y);
  57. LastLocation = GroundItems.getNearest("Bones").getLocation();
  58. GroundItems.getNearest("Bones").interact("Bones");
  59. sleep(600);
  60. }
  61. try {
  62. if (!Players.getLocal().isMoving() && LastLocation != GroundItems.getNearest("Bones").getLocation()) {
  63. if (GroundItems.getNearest("Bones") != null) {
  64. Mouse.setPrecisionSpeed(random(3, 8));
  65. if (GroundItems.getNearest("Bones").isOnScreen()) {
  66. LastLocation = GroundItems.getNearest("Bones").getLocation();
  67. GroundItems.getNearest("Bones").interact("Bones");
  68. sleep(600);
  69. }
  70. try {
  71. if (!GroundItems.getNearest("Bones").isOnScreen()) {
  72. Walking.walkTileMM(GroundItems.getNearest("Bones").getLocation());
  73. }
  74. } catch (Exception ignored) {
  75. }
  76. }
  77. }
  78. } catch (Exception ignored) {
  79. }
  80. if (GroundItems.getNearest("ones") == null || (Inventory.isFull()) || (Inventory.getCount() >= random(10, 100) && (Calculations.distanceTo(GroundItems.getNearest("Bones").getLocation()) >= 4)) || expPrHr <= 2000 && Inventory.contains(Inventory.getItemID("one"))) {
  81. int x = 0;
  82. if (lookForEmote == true) {
  83. if (Players.getLocal().getAnimation() == 827) {
  84. bonesBuried++;
  85. log(bonesBuried);
  86. lookForEmote = false;
  87. }
  88. }
  89. while (x != 28) {
  90. Mouse.setPrecisionSpeed(random(5, 10));
  91. if (Inventory.contains(Inventory.getItemID("one"))) {
  92. if (x != 28) {
  93. if (Inventory.getCount() <= random(1, 6)) {
  94. break;
  95. }
  96. try {
  97. if (Inventory.getItemAt(x).getName().contains("ones")) {
  98. Inventory.getItemAt(x).interact("ury");
  99. sleep(random(200, 300));
  100. x++;
  101. } else {
  102. if (Inventory.getItemAt(x).getName() != null && Inventory.getItemAt(x).hasAction("drop")) {
  103. Inventory.getItemAt(x).interact("drop");
  104. }
  105. x++;
  106. }
  107. } catch (Exception ignored) {
  108. }
  109. }
  110. }
  111. }
  112. }
  113. return (random(
  114. 10, 50));
  115. }
  116. private final Color color1 = new Color(255, 255, 255);
  117. private final Color color2 = new Color(0, 0, 0);
  118. private final Color color3 = new Color(230, 227, 179);
  119. private final Color color4 = new Color(224, 8, 0);
  120. private final Color color5 = new Color(51, 51, 255);
  121. private final Color color6 = new Color(1, 1, 1);
  122. private final Color color7 = new Color(102, 102, 255);
  123. private final Color color8 = new Color(0, 0, 0);
  124. private final Color color9 = new Color(153, 255, 255);
  125. private final Color color10 = new Color(255, 51, 51);
  126. private final BasicStroke stroke1 = new BasicStroke(1);
  127. private final Font font1 = new Font("Arial", 0, 15);
  128.  
  129. public void onRepaint(Graphics g1) {
  130. if (Game.isLoggedIn()) {
  131. long Mill = System.currentTimeMillis() - Time;
  132. long Hrs = Mill / (1000 * 60 * 60);
  133. Mill -= Hrs * (1000 * 60 * 60);
  134. long Min = Mill / (1000 * 60);
  135. Mill -= Min * (1000 * 60);
  136. long Sec = Mill / 1000;
  137. Graphics2D g = (Graphics2D) g1;
  138. if (showPaint) {
  139. g.setColor(color1);
  140. g.fillRect(10, 458, 139, 15);
  141. g.setColor(color2);
  142. g.setStroke(stroke1);
  143. g.drawRect(10, 458, 139, 15);
  144. g.setColor(color3);
  145. g.fillRect(9, 346, 489, 108);
  146. g.setColor(color2);
  147. g.drawLine(500, 458, 515, 471);
  148. g.setColor(color4);
  149. g.fillRect(152, 459, 346, 14);
  150. g.setColor(color2);
  151. g.drawRect(152, 459, 346, 14);
  152. g.setFont(font1);
  153. g.drawString("NEXBot's NEXBury", 305, 443);
  154. g.drawString("Current action:", 306, 410);
  155. g.setColor(color6);
  156. g.drawString("Run time:", 14, 364);
  157. g.drawString(Hrs + ":" + Min + ":" + Sec, 83, 365);
  158. }
  159. //
  160. currentEXP = Skills.getExperience(5);
  161. EXPGained = currentEXP - startEXP;
  162. currentLVL = Skills.getLevel(5);
  163. LVLGained = currentLVL - startLVL;
  164. LVLGained = currentLVL - startLVL;
  165. try {
  166. currentTime = System.currentTimeMillis();
  167. divide = currentTime - startTime;
  168. divide = divide / 1000 / 60 / 60;
  169. expPrHr = EXPGained / divide;
  170. } catch (NullPointerException e) {
  171. }
  172. g.setColor(color5);
  173. //
  174. g.setColor(color7);
  175. g.fillRoundRect(289, 250, 228, 87, 16, 16);
  176. g.setColor(color8);
  177. g.setStroke(stroke1);
  178. g.drawRoundRect(289, 250, 228, 87, 16, 16);
  179. g.setFont(font1);
  180. g.setColor(color9);
  181. g.drawString("EXP Gained: " + EXPGained, 295, 268);
  182. g.drawString("LVLS Gained: " + LVLGained, 295, 287);
  183. g.drawString("Current Level : " + currentLVL, 295, 303);
  184. g.drawString("Current EXP: " + currentEXP, 295, 320);
  185. g.drawString("EXP Per HR: " + expPrHr, 295, 337);
  186. //Mouse
  187. g.drawOval(Mouse.getLocation().x - 11, Mouse.getLocation().y - 11, 22, 22);
  188. g.drawOval(Mouse.getLocation().x - 3, Mouse.getLocation().y - 3, 6, 6);
  189. //Mouse click
  190. if (Mouse.isPressed() || isPressed) {
  191. isPressed = true;
  192. if (timeout2Start != 0) {
  193. timeout2Curr = System.currentTimeMillis();
  194. if (timeout2Curr - timeout2Start >= 5000) {
  195. timeout2Start = 0;
  196. timeout2Curr = 0;
  197. isPressed = false;
  198. }
  199. }
  200. if (timeout2Start == 0) {
  201. timeout2Start = System.currentTimeMillis();
  202. }
  203. g.setColor(color10);
  204. g.drawOval(Mouse.getPressLocation().x - 11, Mouse.getPressLocation().y - 11, 22, 22);
  205. }
  206. if (showPaint) {
  207. g.setColor(color4);
  208. }
  209. }
  210. }
  211.  
  212. public void mouseClicked(MouseEvent e) {
  213. if (Interfaces.getComponent(137, 0).contains(e.getPoint())) {
  214. showPaint = !showPaint;
  215. }
  216. }
  217.  
  218. public void mousePressed(MouseEvent e) {
  219. throw new UnsupportedOperationException("Not supported yet.");
  220. }
  221.  
  222. public void mouseReleased(MouseEvent e) {
  223. throw new UnsupportedOperationException("Not supported yet.");
  224. }
  225.  
  226. public void mouseEntered(MouseEvent e) {
  227. throw new UnsupportedOperationException("Not supported yet.");
  228. }
  229.  
  230. public void mouseExited(MouseEvent e) {
  231. throw new UnsupportedOperationException("Not supported yet.");
  232. }
  233. }
Add Comment
Please, Sign In to add comment