Advertisement
Guest User

Untitled

a guest
Jun 25th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.88 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Graphics2D;
  5. import java.awt.Image;
  6. import java.awt.Rectangle;
  7. import java.awt.Point;
  8. import java.awt.BasicStroke;
  9. import java.io.IOException;
  10. import java.net.URL;
  11.  
  12.  
  13. import javax.imageio.ImageIO;
  14.  
  15. import java.awt.event.ActionEvent;
  16. import java.awt.event.ActionListener;
  17. import java.awt.event.MouseEvent;
  18. import java.awt.event.MouseListener;
  19. import com.rarebot.event.events.MessageEvent;
  20. import com.rarebot.event.listeners.MessageListener;
  21. import com.rarebot.event.listeners.PaintListener;
  22. import com.rarebot.script.Script;
  23. import com.rarebot.script.ScriptManifest;
  24. import com.rarebot.script.wrappers.RSObject;
  25. import com.rarebot.script.wrappers.RSTile;
  26. import com.rarebot.script.wrappers.RSTilePath;
  27. import com.rarebot.script.wrappers.RSComponent;
  28. import com.rarebot.script.wrappers.RSInterface;
  29.  
  30. import com.rarebot.script.methods.Skills;
  31. import com.rarebot.script.methods.Walking;
  32.  
  33.  
  34.  
  35.  
  36.  
  37. @ScriptManifest(
  38. authors = {"Atomika"},
  39. version = 0.2,
  40. keywords = {"Mining", "resource", "Dungeon"},
  41. description = "Mines all ores in lvl 15 resource dungeon and uses Desposit box!",
  42. name = "SwankyDungeonMiner(ergu)"
  43. )
  44.  
  45. public class SwankyDungeonMiner extends Script implements PaintListener,MouseListener{
  46. /* coal IDs: 32428, 32427, 32426*/
  47. private final static int[] PICKAXE_ID = {1275, 1271, 1273, 1267, 1269};
  48. private final static int[] ORE_OBJECTS = {32428, 32427, 32426};
  49. private final static int[] COAL_OBJECTS = {32428, 32427, 32426};
  50. private final static int BOX_ID = 25937;
  51. private final static int IRON_ID = 447;
  52. private final static RSTile[] BOX_LOL = {new RSTile(3034, 9772)};
  53. private final static RSTile[] HelpImLost = {new RSTile(1064, 4573), new RSTile(1058, 4573), new RSTile(1052, 4574), new RSTile(1047, 4577)};
  54. private final static int MINING_ANIMATION = -1;
  55. private long startTime;
  56. private int startExp = 0;
  57. public String statusText;
  58. public String myName;
  59. public boolean showPaint = true ;
  60. RSTilePath BOX,REORIENT;
  61.  
  62.  
  63.  
  64. public boolean onStart()
  65. {
  66. statusText = "FUCKING INITIALIZING";
  67. if (!game.isLoggedIn())
  68. {
  69. log.severe("Try logging in first then restart the script!");
  70. stopScript();
  71. return false;
  72. }
  73. else
  74. {
  75. mouse.setSpeed(4);
  76. startTime = System.currentTimeMillis();
  77. startExp = skills.getCurrentExp(skills.MINING);
  78. BOX = walking.newTilePath(BOX_LOL);
  79. REORIENT = walking.newTilePath(HelpImLost);
  80. log("Welcome to SwankyDungeonMiner by Atomika!");
  81. log("Let's hope the script doesn't fuck up.");
  82. myName = account.getName();
  83. myName = myName.substring(0, 3);
  84. keyboard.sendText("Does your house have stairs?", true);
  85. sleep(8000);
  86. if(checkJoin())
  87. {
  88. return true;
  89. }
  90. else
  91. {
  92. return false;
  93. }
  94. }
  95. }
  96.  
  97. public void mouseClicked(MouseEvent e)
  98. {
  99. RSComponent inter = interfaces.get(137).getComponent(0);
  100. if (inter.getArea().contains(e.getPoint())) {
  101. showPaint = !showPaint;
  102. }
  103. }
  104.  
  105. private final Color color1 = new Color(51, 51, 51);
  106. private final Color color2 = new Color(0, 0, 0);
  107. private final Color color3 = new Color(0, 153, 0);
  108.  
  109. private final BasicStroke stroke1 = new BasicStroke(1);
  110.  
  111. private final Font font1 = new Font("Arial", 0, 19);
  112.  
  113. public void onRepaint(Graphics g1) {
  114.  
  115.  
  116.  
  117. expGained = skills.getCurrentExp(Skills.MINING) - startExp;
  118.  
  119.  
  120.  
  121. long millis = System.currentTimeMillis() - startTime;
  122.  
  123. long hours = millis / (1000 * 60 * 60);
  124.  
  125. millis -= hours * (1000 * 60 * 60);
  126.  
  127. long minutes = millis / (1000 * 60);
  128.  
  129. millis -= minutes * (1000 * 60);
  130.  
  131. long seconds = millis / 1000;
  132.  
  133.  
  134.  
  135. float xpsec = 0;
  136.  
  137. if ((minutes > 0 || hours > 0 || seconds > 0) && expGained > 0) {
  138.  
  139. xpsec =((float)expGained)/(float)(seconds +(minutes*60) + (hours*60*60));
  140.  
  141. }
  142.  
  143. float xpmin = xpsec * 60;
  144.  
  145. float xphour = xpmin * 60;
  146.  
  147.  
  148.  
  149. float oresec = 0;
  150.  
  151. if ((minutes > 0 || hours > 0 || seconds > 0) && oresMined > 0) {
  152.  
  153. oresec =((float) oresMined)/(float)(seconds +(minutes*60) + (hours*60*60));
  154.  
  155. }
  156.  
  157. float oremin = oresec * 60;
  158.  
  159. float orehour = oremin * 60;
  160.  
  161.  
  162.  
  163. g.setColor(Color.CYAN);
  164.  
  165.  
  166.  
  167. g.drawString("Runtime: "+ hours + ":" + minutes + ":" + seconds, 250, 372);
  168.  
  169. g.drawString("Experience gained: " + expGained + " Exp/h: " + (int)xphour, 250, 389);
  170.  
  171. g.drawString("Ores mined " + oresMined + " Ores/h: " + (int)orehour, 250, 400);
  172.  
  173. g.drawString("Profit: " + oresMined*coalPrice, 250, 415);
  174.  
  175. }
  176.  
  177.  
  178.  
  179.  
  180.  
  181. private void setRun()
  182. {
  183. if (!walking.isRunEnabled() && walking.getEnergy() > 40)
  184. {
  185. statusText = "FUCKING RUNNING";
  186. walking.setRun(true);
  187. sleep(random(600, 800));
  188. return;
  189. }
  190. }
  191.  
  192. public void checkIntercept()
  193. {
  194. RSInterface chatBox = interfaces.get(137);
  195. if(chatBox != null)
  196. {
  197. for(int x = 180; x < 240; x++)
  198. {
  199. if(chatBox.getComponent(x) != null && chatBox.getComponent(x).getAbsoluteY() > 330)
  200. {
  201. String curCompText = chatBox.getComponent(x).getText();
  202. if(curCompText.contains("Does your house have stairs") && (!(curCompText.contains(myName))))
  203. {
  204. keyboard.sendText("|||", true);
  205. sleep(2000);
  206. }
  207. }
  208. }
  209. }
  210. }
  211.  
  212. public boolean checkJoin()
  213. {
  214. RSInterface chatBox = interfaces.get(137);
  215. if(chatBox != null)
  216. {
  217. for(int x = 180; x < 280; x++)
  218. {
  219. if(chatBox.getComponent(x) != null && chatBox.getComponent(x).getAbsoluteY() > 330)
  220. {
  221. String curCompText = chatBox.getComponent(x).getText();
  222. if(curCompText.contains("|||"))
  223. {
  224. log.severe("This mine already has a bot running in it. Switch to another world.");
  225. return false;
  226. }
  227.  
  228. }
  229. }
  230. return true;
  231. }
  232. return true;
  233. }
  234.  
  235.  
  236. private final void openBox()
  237. {
  238. RSObject box = objects.getNearest(BOX_ID);
  239. if(!box.isOnScreen() && box != null)
  240. {
  241. camera.turnTo(box);
  242. camera.setPitch(10);
  243. }
  244. else
  245. {
  246. if(box.isOnScreen() && box != null)
  247. {
  248. box.interact("Deposit");
  249. sleep(2000, 2500);
  250. }
  251. }
  252. }
  253.  
  254. private void goToBox()
  255. {
  256. BOX.traverse();
  257. }
  258.  
  259. private final void gobackplease()
  260. {
  261. REORIENT.traverse();
  262. sleep(2000, 2500);
  263. }
  264.  
  265.  
  266. private final void depositOres()
  267. {
  268. mouse.move(330, 261, 3, 3);
  269. mouse.click(true);
  270. sleep(800, 1200);
  271. }
  272.  
  273. private final boolean atBox()
  274. {
  275. RSObject boxy = objects.getNearest(BOX_ID);
  276. if(boxy != null) {
  277. if(boxy.isOnScreen()) {
  278. return true;
  279. } else {
  280. camera.turnTo(boxy);
  281. return false;
  282. }
  283. }
  284. return false;
  285. }
  286.  
  287. private final void mine()
  288. {
  289. RSObject oremine = objects.getNearest(ORE_OBJECTS);
  290. if(getMyPlayer().getAnimation() == MINING_ANIMATION && oremine != null)
  291. {
  292. statusText = "RUNNIN TO THE FUCKING ORE";
  293. oremine.interact("Mine");
  294. }
  295. else
  296. {
  297. statusText = "FUCKING MINING";
  298. }
  299. sleep(1800,2000);
  300.  
  301. }
  302.  
  303. private final void minecoal()
  304. {
  305. RSObject oremine = objects.getNearest(COAL_OBJECTS);
  306. if(getMyPlayer().getAnimation() == MINING_ANIMATION && oremine != null)
  307. {
  308. statusText = "RUNNIN TO THE FUCKING COAL";
  309. oremine.interact("Mine");
  310. }
  311. else
  312. {
  313. statusText = "MINING THE DAMN COAL";
  314. }
  315. sleep(1800,2000);
  316.  
  317. }
  318.  
  319.  
  320.  
  321. public void do_Nothing()
  322. {
  323. sleep(random(10, 50));
  324. }
  325.  
  326.  
  327. private final boolean atOres()
  328. {
  329. RSObject ores = objects.getNearest(ORE_OBJECTS);
  330. if(ores != null)
  331. {
  332. if(ores.isOnScreen())
  333. {
  334. return true;
  335. }
  336. }
  337. return false;
  338. }
  339.  
  340. @Override
  341. public int loop()
  342. {
  343. checkIntercept();
  344. antiban(); setRun();
  345. if(!atOres() && !inventory.isFull())
  346. {
  347. RSObject oreo = objects.getNearest(ORE_OBJECTS);
  348. if(oreo != null)
  349. {
  350. statusText = "WHERE ARE THE FUCKING ROCKS";
  351. camera.turnTo(oreo);
  352. camera.setPitch(random(10, 20));
  353. sleep(random(500, 1000));
  354. }
  355. else
  356. {
  357. RSObject coaly = objects.getNearest(COAL_OBJECTS);
  358. if(coaly != null)
  359. {
  360. camera.turnTo(coaly);
  361. camera.setPitch(random(10,20));
  362. minecoal();
  363. }
  364. else
  365. {
  366. statusText = "CAN'T FIND ANY FUCKING COAL";
  367. do_Nothing();
  368. }
  369. }
  370. }
  371.  
  372. if(atOres() && !inventory.isFull())
  373. {
  374. mine();
  375. }
  376. if(inventory.isFull())
  377. {
  378. while(!atBox())
  379. {
  380. statusText = "TRYING TO FIND THE FUCKING BOX";
  381. gobackplease();
  382. sleep(random(500, 1000));
  383. }
  384. while(!bank.isDepositOpen())
  385. {
  386. goToBox();
  387. statusText = "OPENING YOUR DAMN BOX";
  388. openBox();
  389. sleep(random(500, 1000));
  390.  
  391. }
  392. statusText = "BANK THAT SHIT";
  393. bank.depositAll();
  394. sleep(random(500, 3000));
  395. bank.close();
  396. sleep(random(500, 2000));
  397. gobackplease();
  398. }
  399.  
  400. if(combat.getLifePoints() < 60)
  401. {
  402. statusText = "FUCKING DEAD";
  403. log.severe("------------------------------------------------------------------------");
  404. log.severe("Hey, you're probably going to die--not that this script will do anything");
  405. log.severe("------------------------------------------------------------------------");
  406. stopScript();
  407. sleep(5000);
  408. }
  409.  
  410. return 1;
  411. }
  412.  
  413.  
  414. public void antiban() {
  415.  
  416. statusText = "FUCKING WITH THE ANTIBAN";
  417. int b = random(0, 10);
  418. switch (b) {
  419. case 1:
  420. if (random(0, 10) == 5) {
  421. log("[Antiban] move mouse");
  422. mouse.moveSlightly();
  423. sleep(200, 600);
  424. mouse.moveRandomly(150, 350);
  425. }
  426. break;
  427. case 2:
  428. if (random(0, 13) == 2) {
  429. log("[Antiban] Turn screen");
  430. camera.setAngle(random(30, 70));
  431. sleep(400, 1200);
  432.  
  433. }
  434. break;
  435. case 3:
  436. if (random(0, 24) == 6) {
  437. log("[Antiban] mouse off screen");
  438. mouse.moveOffScreen();
  439. sleep(random(600, random(1200, 2000)));
  440. }
  441. break;
  442. case 4:
  443. if (random(0, 30) == 4) {
  444. log("[antiban] Setting camera pitch.");
  445. camera.setPitch(random(10, 99));
  446. sleep(2500, 3400);
  447. }
  448. break;
  449. case 5:
  450. if (random(0, 28) == 5) {
  451. log("[antiban] Checking Xp.");
  452. game.openTab(2);
  453. skills.doHover(Skills.INTERFACE_MINING);
  454. sleep(2000, 2200);
  455. }
  456. default:
  457. break;
  458. }
  459. }
  460.  
  461. public void onFinish()
  462. {
  463. log("Nap time.");
  464. }
  465.  
  466. @Override
  467. public void mouseEntered(MouseEvent e) {
  468. // TODO Auto-generated method stub
  469.  
  470. }
  471.  
  472. @Override
  473. public void mouseExited(MouseEvent e) {
  474. // TODO Auto-generated method stub
  475.  
  476. }
  477.  
  478. @Override
  479. public void mousePressed(MouseEvent e) {
  480. // TODO Auto-generated method stub
  481.  
  482. }
  483.  
  484. @Override
  485. public void mouseReleased(MouseEvent e) {
  486. // TODO Auto-generated method stub
  487.  
  488. }
  489.  
  490.  
  491.  
  492. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement