Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.76 KB | None | 0 0
  1. import java.util.Map;
  2. import org.rsbot.script.Script;
  3. import org.rsbot.script.ScriptManifest;
  4. import org.rsbot.script.wrappers.RSObject;import org.rsbot.event.listeners.PaintListener;
  5. import java.awt.*;
  6. import javax.imageio.ImageIO;
  7. import java.io.IOException;
  8. import java.net.URL;
  9. import org.rsbot.script.methods.Skills;
  10.  
  11. @ScriptManifest(authors = "gpianist", name = "SSMiner", version = 1.0, description = "Start at Rimmington")
  12. public class SSMiner extends Script implements PaintListener {
  13.  
  14. int[] OreID = { 9711, 9713 };
  15. int[] pickID = { 1265, 1267, 1269, 1271, 1273, 1275 };
  16. private String status = "";
  17. public long startTime = System.currentTimeMillis();
  18. public int startexp;
  19. int exp;
  20.  
  21. public boolean onStart() {
  22. log("Welcome to Test.");
  23. mouse.setSpeed(9);
  24. return true;
  25.  
  26. }
  27.  
  28. public void antiban() {
  29.  
  30. int b = random(0, 10);
  31. switch (b) {
  32. case 1:
  33. if (random(0, 10) == 5) {
  34. log("Antiban- move mouse");
  35. status = "Moving Mouse";
  36. mouse.moveSlightly();
  37. sleep(200, 600);
  38. mouse.moveRandomly(150, 350);
  39. }
  40. break;
  41. case 2:
  42. if (random(0, 13) == 2) {
  43.  
  44. log("Antiban- Turn screen");
  45. status = "Turning Screen";
  46. camera.setAngle(random(30, 70));
  47. sleep(400, 1200);
  48.  
  49. }
  50. break;
  51. case 3:
  52. if (random(0, 24) == 6) {
  53.  
  54. log("Antiban- mouse off screen");
  55. mouse.moveOffScreen();
  56. status = "Moving off screen";
  57. sleep(random(600, random(1200, 2000)));
  58. }
  59. break;
  60. case 4:
  61. if (random(0, 18) == 3) {
  62.  
  63. log("Antiban- Checking Xp.");
  64. game.openTab(1);
  65. status = "Doing rangdom stuff";
  66. skills.doHover(skills.INTERFACE_MINING);
  67. sleep(random(2100, 3400));
  68. }
  69. break;
  70. default:
  71. break;
  72. }
  73. }
  74.  
  75. private Image getImage(String url) {
  76. try {
  77. return ImageIO.read(new URL(url));
  78. } catch(IOException e) {
  79. return null;
  80. }
  81. }
  82.  
  83. private final Color color1 = new Color(204, 0, 0, 140);
  84. private final Color color2 = new Color(0, 0, 0);
  85. private final Color color3 = new Color(255, 255, 255);
  86.  
  87. private final BasicStroke stroke5 = new BasicStroke(5);
  88.  
  89. private final Font font1 = new Font("Arial", 0, 13);
  90.  
  91. public void onRepaint(Graphics g) {
  92. int xpGained = 0;
  93. if ( startexp == 0) {
  94. startexp = skills.getCurrentExp(Skills.MINING);
  95. }
  96. xpGained = skills.getCurrentExp(Skills.MINING) - startexp;
  97. long millis = System.currentTimeMillis() - startTime;
  98. long hours = millis / (1000 * 60 * 60);
  99. millis -= hours * (1000 * 60 * 60);
  100. long minutes = millis / (1000 * 60);
  101. millis -= minutes * (1000 * 60);
  102. long seconds = millis / 1000;
  103. Graphics2D g2 = (Graphics2D)g;
  104. float xpsec = 0;
  105. if ((minutes > 0 || hours > 0 || seconds > 0) && exp > 0) {
  106. xpsec = ((float) exp)/(float)(seconds + (minutes*60) + (hours*60*60));
  107. }
  108. float xpmin = xpsec * 60;
  109. float xphour = xpmin * 60;
  110.  
  111. g2.setColor(color1);
  112. g2.fillRoundRect(553, 287, 179, 173, 16, 16);
  113. g2.setColor(color2);
  114. g2.setStroke(stroke5);
  115. g2.drawRoundRect(553, 287, 179, 173, 16, 16);
  116. g2.setFont(font1);
  117. g2.setColor(color3);
  118. g2.drawString("GPianists's SSMiner!" , 563, 305);
  119. g2.drawString("Time Running:" + hours + ": " + minutes + ": " + seconds, 562, 346);
  120. g2.drawString("Status: " + status, 563, 383);
  121. g2.drawString("XP Gained: " + xpGained, 563, 410);
  122. g2.drawString("Approximatly: " + (int)xphour + "/hr", 563, 440);
  123. g2.setColor(color2);
  124. g2.fillRoundRect(6, 458, 90, 18, 16, 16);
  125. g2.drawRoundRect(6, 458, 90, 18, 16, 16);
  126. g2.drawLine(mouse.getLocation().x - 6, mouse.getLocation().y,
  127. mouse.getLocation().x + 6, mouse.getLocation().y);
  128. g2.drawLine(mouse.getLocation
  129. ().x, mouse.getLocation().y - 6,
  130. mouse.getLocation().x, mouse.getLocation().y + 6);
  131. }
  132.  
  133. private void mineOre() {
  134. RSObject Ore = objects.getNearest(OreID);
  135. if (Ore != null && getMyPlayer().getAnimation() == -1) {
  136. Ore.doAction("Mine");
  137. }
  138. }
  139.  
  140. private void dropOre() {
  141. inventory.dropAllExcept(pickID);
  142. }
  143.  
  144. public void onFinish() {
  145. log("Goodbye.");
  146. }
  147.  
  148. public int loop() {
  149. if (inventory.isFull()) {
  150. dropOre();
  151. } else if (!inventory.isFull()) {
  152. mineOre();
  153. }
  154. return (random(650, 950));
  155.  
  156. }
  157. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement