Guest User

Untitled

a guest
Oct 20th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.37 KB | None | 0 0
  1. import java.awt.BasicStroke;
  2. import java.awt.Color;
  3. import java.awt.Font;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6. import java.awt.Point;
  7. import java.awt.Rectangle;
  8. import java.awt.event.KeyEvent;
  9. import java.awt.event.MouseEvent;
  10. import java.awt.event.MouseListener;
  11.  
  12. import org.rsbot.event.events.MessageEvent;
  13. import org.rsbot.event.listeners.MessageListener;
  14. import org.rsbot.event.listeners.PaintListener;
  15. import org.rsbot.script.Script;
  16. import org.rsbot.script.ScriptManifest;
  17. import org.rsbot.script.methods.Skills;
  18. import org.rsbot.script.util.Timer;
  19. import org.rsbot.script.wrappers.RSObject;
  20.  
  21. @ScriptManifest(
  22. authors = ("3G_Connection"),
  23. version = 0.01,
  24. keywords = {"Powermining, Iron, Rimmington" },
  25. description = "Powermines Iron in Rimmington, By 3G_Connection",
  26. name = "IronPowerMiner"
  27. )
  28.  
  29. public class IronPowerMiner extends Script implements PaintListener, MessageListener, MouseListener {
  30.  
  31. private int oreID = 440;
  32. private int[] rockID = {9718, 9717};
  33. private int miningAnimation = 625;
  34.  
  35. long startTime;
  36.  
  37. public boolean showPaint = true;
  38.  
  39. public int startLvl;
  40. public int expGained;
  41. public int startExp;
  42. public int oresMined;
  43. public int lvlsGained;
  44. public int currentLvl;
  45.  
  46. int expPH = (int) (expGained * 3600000D / (System.currentTimeMillis() - startTime));
  47. final int oresPH = (int) (oresMined * 3600000D / (System.currentTimeMillis() - startTime));
  48.  
  49. public boolean onStart() {
  50. log("Thank you for using IronPowerMiner, by 3G_Connection");
  51. mouse.setSpeed(random(3, 7));
  52. startTime = System.currentTimeMillis();
  53. startExp = skills.getCurrentExp(Skills.MINING);
  54. currentLvl = skills.getCurrentExp(Skills.MINING);
  55. return true;
  56. }
  57.  
  58. @Override
  59. public int loop() {
  60. RSObject rock = objects.getNearest(rockID);
  61. if(getMyPlayer().getAnimation() !=miningAnimation) {
  62. rock.interact("Mine");
  63. dropOre();
  64. if(random(1, 15) == 7) antiBan();
  65. return 10;
  66. }
  67. return 10;
  68. }
  69. public void onFinish() {
  70. log("You gained: " + expGained + "xp, thanks for using my script.");
  71. }
  72.  
  73. private void dropOre() {
  74. if (inventory.getCount(oreID) >= 2) {
  75. }
  76. }
  77.  
  78. //START: Code generated using Enfilade's Easel
  79. private final Color color1 = new Color(51, 0, 51);
  80. private final Color color2 = new Color(0, 0, 0);
  81. private final Color color3 = new Color(255, 255, 255);
  82. private final Color color4 = new Color(102, 0, 0);
  83. private final Color color5 = new Color(0, 204, 0);
  84.  
  85. private final BasicStroke stroke1 = new BasicStroke(20);
  86. private final BasicStroke stroke2 = new BasicStroke(1);
  87.  
  88. private final Font font1 = new Font("Chalkboard", 1, 32);
  89. private final Font font2 = new Font("Chalkboard", 1, 20);
  90. private final Font font3 = new Font("Chalkboard", 1, 15);
  91. private final Font font4 = new Font("Chalkboard", 1, 12);
  92. //END: Code generated using Enfilade's Easel
  93.  
  94.  
  95.  
  96. /*
  97. * ===== PAINT =====
  98. */
  99. @Override
  100. public void onRepaint(Graphics g) {
  101.  
  102. expGained = skills.getCurrentExp(Skills.MINING) - startExp;
  103. lvlsGained = skills.getCurrentLevel(Skills.MINING) - startLvl;
  104.  
  105. Graphics2D g1 = (Graphics2D)g;
  106.  
  107. final int PercentBar = (int) (skills.getPercentToNextLevel(Skills.MINING)*4.2);
  108.  
  109. g1.setColor(color1);
  110. g1.fillRect(14, 352, 490, 114);
  111. g1.setColor(color2);
  112. g1.setStroke(stroke1);
  113. g1.drawRect(14, 352, 490, 114);
  114. g1.drawRect(274, 292, 230, 59);
  115. g1.setColor(color1);
  116. g1.fillRect(284, 302, 210, 61);
  117. g1.setFont(font1);
  118. g1.setColor(color3);
  119. g1.drawString("IronPowerMiner", 29, 391);
  120. g1.setFont(font2);
  121. g1.drawString("By 3G_Connection", 29, 421);
  122. g1.setFont(font3);
  123. g1.drawString("Runtime: " + Timer.format(System.currentTimeMillis() - startTime), 290, 320);
  124. g1.drawString("Exp Gained: " + expGained, 289, 345);
  125. g1.drawString("Exp Gained/h: " + " (" + (int) expPH + ")", 290, 370);
  126. g1.drawString("Ores Mined: " + oresMined, 290, 395);
  127. g1.drawString("Ores Mined/h: " + (int) oresPH , 290, 420);
  128. g1.drawString("Current Level: " + currentLvl + " (" + lvlsGained + ")", 290, 445);
  129. g1.setFont(font4);
  130. g1.drawString("Show/Hide Paint", 415, 470);
  131. g1.setColor(color4);
  132. g1.fillRoundRect(4, 282, 259, 58, 16, 16);
  133. g1.setColor(color2);
  134. g1.setStroke(stroke2);
  135. g1.drawRoundRect(4, 282, 259, 58, 16, 16);
  136. g1.setColor(color5);
  137. g1.fillRoundRect(3, 282, PercentBar, 58, 16, 16);
  138.  
  139. }
  140.  
  141. @Override
  142. public void messageReceived(MessageEvent e) {
  143. String txt = e.getMessage();
  144. if(txt.contains("You manage to mine")) {
  145. oresMined++;
  146.  
  147. }
  148. }
  149.  
  150. public void antiBan() {
  151. int r = random(1, 6);
  152. int a = random(1, 5);
  153. int b = random(5, 10);
  154. int j[] = {100, 500, 1000};
  155. int t = random(0, 3);
  156. switch (r) {
  157. case 1:
  158. if (r == a) {
  159. if (t == 0) {
  160. antiBan();
  161. } else {
  162. antiBan();
  163. }
  164. }
  165. sleep(random(a*j[t], b*j[t]));
  166. break;
  167. case 2:
  168. antiBan();
  169. break;
  170. case 3:
  171. if (r == a) {
  172. if (t == 0) {
  173. antiBan();
  174. } else {
  175. antiBan();
  176. }
  177. }
  178. sleep(random(a*j[t], b*j[t]));
  179. break;
  180. case 4:
  181. antiBan();
  182. break;
  183. case 5:
  184. if (r == a) {
  185. if (t == 0) {
  186. antiBan();
  187. } else {
  188. antiBan();
  189. }
  190. }
  191. sleep(random(a*j[t], b*j[t]));
  192. break;
  193. }
  194. }
  195.  
  196. public void antiBan1()
  197. {
  198. if(getMyPlayer().getAnimation() != -1 && !getMyPlayer().isMoving())
  199. {
  200. try {
  201. switch (random(1,10))
  202. {
  203.  
  204. case 1:
  205. log("{ANTIBAN} Changing camera pitch");
  206. int startingPitch = camera.getPitch();
  207. camera.setPitch(random(20, 100));
  208. log("Changed pitch from " + startingPitch + " to " + camera.getPitch());
  209.  
  210. break;
  211.  
  212. case 2:
  213. log("{ANTIBAN} Changing camera angle");
  214. int starting = camera.getAngle();
  215. camera.setAngle(random(camera.getAngle()-10,camera.getAngle()+10));
  216. log("Changed camera angle from " + starting + " to " + camera.getAngle());
  217. break;
  218.  
  219. case 3:
  220. log("{ANTIBAN} Changing camera pitch");
  221. int startingPitch2 = camera.getPitch();
  222. camera.setPitch(random(camera.getPitch()-15, camera.getPitch()+25));
  223. log("Changed pitch from " + startingPitch2 + " to " + camera.getPitch());
  224.  
  225. break;
  226.  
  227. case 4:
  228. log("{ANTIBAN} Moving camera randomly");
  229. camera.moveRandomly(3000);
  230. break;
  231.  
  232. case 5:
  233. log("{ANTIBAN} Changing camera angle (Single direction)");
  234. sleep(200, 300);
  235. int startingAngle = camera.getAngle();
  236. int randomAntiban = random(1,4);
  237. if(randomAntiban == 1)
  238. {
  239. keyboard.pressKey((char) KeyEvent.VK_LEFT);
  240. sleep(random(400,1100));
  241. keyboard.releaseKey((char) KeyEvent.VK_LEFT);
  242. }
  243. else if(randomAntiban == 2)
  244. {
  245. keyboard.pressKey((char) KeyEvent.VK_RIGHT);
  246. sleep(random(400,1100));
  247. keyboard.releaseKey((char) KeyEvent.VK_RIGHT);
  248. }
  249. else if(randomAntiban == 3)
  250. {
  251. keyboard.pressKey((char) KeyEvent.VK_UP);
  252. sleep(random(400,1100));
  253. keyboard.releaseKey((char) KeyEvent.VK_UP);
  254. }
  255. else if(randomAntiban == 4)
  256. {
  257. keyboard.pressKey((char) KeyEvent.VK_DOWN);
  258. sleep(random(400,1100));
  259. keyboard.releaseKey((char) KeyEvent.VK_DOWN);
  260. }
  261. log("Changed camera angle from " + startingAngle + " to " + camera.getAngle());
  262. break;
  263.  
  264. case 6:
  265. log("{ANTIBAN} Moving mouse slightly");
  266. Point mouseLocation = mouse.getLocation();
  267. mouse.moveSlightly();
  268. log("Moved mouse from " + "(" + mouseLocation.x +"," + mouseLocation.y + ") to" +
  269. "(" + mouse.getLocation().x +"," + mouse.getLocation().y + ")");
  270. break;
  271.  
  272. case 7:
  273. log("{ANTIBAN} Moving mouse offscreen");
  274. mouse.moveOffScreen();
  275. break;
  276. case 10:
  277. log("{ANTIBAN} Changing camera angle (Multi direction)");
  278. sleep(200, 300);
  279. int startingAngle2 = camera.getAngle();
  280. int randomAntiban2 = random(1,4);
  281. int random2nd = random(1,2);
  282. if(randomAntiban2 == 1)
  283. {
  284. keyboard.pressKey((char) KeyEvent.VK_LEFT);
  285. if(random2nd==1)
  286. {
  287. keyboard.pressKey((char) KeyEvent.VK_DOWN);
  288. }
  289. else
  290. {
  291. keyboard.pressKey((char) KeyEvent.VK_UP);
  292. }
  293. sleep(random(400,1000));
  294. keyboard.releaseKey((char) KeyEvent.VK_LEFT);
  295. if(random2nd==1)
  296. {
  297. keyboard.releaseKey((char) KeyEvent.VK_DOWN);
  298. }
  299. else
  300. {
  301. keyboard.releaseKey((char) KeyEvent.VK_UP);
  302. }
  303. }
  304. else if(randomAntiban2 == 2)
  305. {
  306. keyboard.pressKey((char) KeyEvent.VK_RIGHT);
  307. if(random2nd==1)
  308. {
  309. keyboard.pressKey((char) KeyEvent.VK_DOWN);
  310. }
  311. else
  312. {
  313. keyboard.pressKey((char) KeyEvent.VK_UP);
  314. }
  315. sleep(random(500,1100));
  316. keyboard.releaseKey((char) KeyEvent.VK_RIGHT);
  317. if(random2nd==1)
  318. {
  319. keyboard.releaseKey((char) KeyEvent.VK_DOWN);
  320. }
  321. else
  322. {
  323. keyboard.releaseKey((char) KeyEvent.VK_UP);
  324. }
  325. }
  326. log("Changed camera angle from " + startingAngle2 + " to " + camera.getAngle());
  327. break;
  328. }
  329.  
  330.  
  331. } catch (Exception e) {
  332. e.printStackTrace();
  333. }
  334. }
  335. }
  336. public void mouseClicked(MouseEvent e) {
  337. Point a = e.getPoint();
  338. Rectangle area = new Rectangle(415, 470, 100, 15);
  339. if (area.contains(a) && showPaint == true) {
  340. showPaint = false;
  341. } else{
  342. showPaint = true;
  343. }
  344. }
  345.  
  346. @Override
  347. public void mouseEntered(MouseEvent e) {
  348.  
  349. }
  350.  
  351. @Override
  352. public void mouseExited(MouseEvent e) {
  353.  
  354. }
  355.  
  356. @Override
  357. public void mousePressed(MouseEvent e) {
  358.  
  359. }
  360.  
  361. @Override
  362. public void mouseReleased(MouseEvent e) {
  363.  
  364. }
  365. }
Add Comment
Please, Sign In to add comment