Advertisement
TheBat

BatFireRunes v1.0

Feb 9th, 2012
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.61 KB | None | 0 0
  1. import java.awt.Color;
  2. import java.awt.Font;
  3. import java.awt.Graphics;
  4. import java.awt.Image;
  5. import java.awt.Point;
  6. import java.awt.Rectangle;
  7. import java.awt.event.MouseEvent;
  8. import java.awt.event.MouseListener;
  9. import java.io.IOException;
  10. import java.net.URL;
  11. import java.util.List;
  12. import javax.imageio.ImageIO;
  13. import org.runedream.api.Script;
  14. import org.runedream.api.ScriptManifest;
  15. import org.runedream.api.methods.Bank;
  16. import org.runedream.api.methods.Camera;
  17. import org.runedream.api.methods.Environment;
  18. import org.runedream.api.methods.Game;
  19. import org.runedream.api.methods.ImageUtil;
  20. import org.runedream.api.methods.Mouse;
  21. import org.runedream.api.util.Log;
  22. import org.runedream.api.util.Random;
  23.  
  24. @ScriptManifest(
  25. authors = { "TheBat"},
  26. name = "BatFireRunes",
  27. version = 1.0,
  28. description = "Crafts Fire Runes.",
  29. keywords = {},
  30. language = { true, true, true, true })
  31.  
  32. public class BatFireRunes extends Script implements MouseListener{
  33.  
  34. //color points for the runecrafting alter symbol
  35. private static final Color RCSA = new Color(246,183,1);
  36. private static final Color RCSB = new Color(89,84,84);
  37. private static final Point distRCS = new Point(2,-5);
  38.  
  39. //color points for the mysterious ruins
  40. private static final Color ChestA = new Color(108,104,104);
  41. private static final Color ChestB = new Color(98,94,94);
  42. private static final Color ChestC = new Color(89,86,85);
  43. private static final Point ChestAB = new Point(-21,-13);
  44. private static final Point ChestAC = new Point(-18,-35);
  45.  
  46. //color points for the bank symbol
  47. private static final Color tourchesA = new Color(215,121,50);
  48. private static final Color tourchesB = new Color(212,119,54);
  49. private static final Point tourchesAB = new Point(-282,-3);
  50.  
  51. //color points for the first walking spot
  52. private static final Color WS1A = new Color(70,53,17);
  53. private static final Color WS1B = new Color(234,243,243);
  54. private static final Point distWS1 = new Point(12,0);
  55.  
  56. //color points for the second walking spot
  57. private static final Color WS2A = new Color(74,109,58);
  58. private static final Color WS2B = new Color(71,53,22);
  59. private static final Point distWS2 = new Point(-9,3);
  60.  
  61. //color points for the cactuses by the bank
  62. private static final Color CactA = new Color(78,109,50);
  63. private static final Color CactB = new Color(78,109,50);
  64. private static final Point CactAB = new Point(-9,-12);
  65.  
  66. //color points for the walking spot by the bank
  67. private static final Color WS3A = new Color(237,237,231);
  68. private static final Color WS3B = new Color(74,59,16);
  69. private static final Point distWS3 = new Point(0,-9);
  70.  
  71. //color points for the mysterious ruins
  72. private static final Color MystRuinA = new Color(253,126,76);
  73. private static final Color MystRuinB = new Color(248,124,75);
  74. private static final Color MystRuinC = new Color(253,126,76);
  75. private static final Point MystRuinAB = new Point(-30,15);
  76. private static final Point MystRuinAC = new Point(-8,30);
  77.  
  78. //color points for the swords by the banker
  79. private static final Color SwordsA = new Color(185,183,27);
  80. private static final Color SwordsB = new Color(178,154,26);
  81. private static final Color SwordsC = new Color(186,184,27);
  82. private static final Point SwordsAB = new Point(8,-10);
  83. private static final Point SwordsAC = new Point(-1,-7);
  84.  
  85. //color points for the exit portal
  86. private static final Color portA = new Color(170,49,28);
  87. private static final Color portB = new Color(196,49,29);
  88. private static final Color portC = new Color(175,49,29);
  89. private static final Point portAB = new Point(-12,-22);
  90. private static final Point portAC = new Point(-26,-5);
  91.  
  92.  
  93. //Class variables
  94. private static int RUNS = 0;
  95. private static double TIME = 0;
  96. private static Image pic = null;
  97. private static Image unchk = null;
  98. private static Image chk = null;
  99. private static String status = "";
  100.  
  101. public static int walkmod = 1;
  102. public static int levelGained = 0;
  103. public static boolean moving = false;
  104. private boolean showPaint = true;
  105. private int walkBack = 0;
  106. private boolean firstRun = true;
  107.  
  108. private String statusChk = "";
  109. private double timeChk = 0;
  110.  
  111. private Point pt3 = new Point();
  112. private Point pt4 = new Point();
  113.  
  114. private int templvls = levelGained;
  115. private boolean first = false;
  116. private static boolean resting = false;
  117. public static boolean staminaFull;
  118. private boolean rest = false;
  119. private boolean ruins = true;
  120. private boolean walkThere = false;
  121.  
  122.  
  123. //Threads
  124. private StaminaChecker staminaCheck = new StaminaChecker();
  125. private LevelUpCheck levelUpCheck = new LevelUpCheck();
  126. private Moving move = new Moving();
  127.  
  128.  
  129. /**
  130. * Actions to be performed when the script starts up.
  131. */
  132. public boolean onStart(){
  133. try {
  134. pic = ImageIO.read(new URL("http://i1024.photobucket.com/albums/y308/dudebrosick/Fire_rune_detail.png"));
  135. } catch (IOException e) {
  136. }
  137. try {
  138. unchk = ImageIO.read(new URL("http://i1024.photobucket.com/albums/y308/dudebrosick/chkun.png"));
  139. } catch (IOException e) {
  140. }
  141. try {
  142. chk = ImageIO.read(new URL("http://i1024.photobucket.com/albums/y308/dudebrosick/chk.png"));
  143. } catch (IOException e) {
  144. }
  145. Mouse.setSpeed(Random.random(8, 11));
  146. TIME = System.currentTimeMillis();
  147. timeChk = System.currentTimeMillis();
  148. Game.clickCompass();
  149. Camera.pitchUp(1000);
  150. staminaCheck.start();
  151. move.start();
  152. status = "Finding bank";
  153. statusChk = "Finding bank";
  154. return true;
  155. }
  156. /**
  157. * The main loop
  158. */
  159. public int loop() {
  160. if(status.equals(statusChk)){
  161. if(System.currentTimeMillis() - timeChk > 120000){
  162. Log.log("Stopped because of inactivity.", Color.RED);
  163. logOut();
  164. return -1;
  165. }
  166. }else{
  167. statusChk = status;
  168. timeChk = System.currentTimeMillis();
  169. }
  170. //Log out after 6 hours.
  171. //if(System.currentTimeMillis() - TIME > 21600000){
  172. //Log.log("Reached the 6 hour limit.", Color.RED);
  173. //logOut();
  174. //return -1;
  175. //}
  176. if(staminaCheck.staminaOff && staminaFull&& !status.equals("Checking Friends")
  177. && !status.equals("Checking stats") && !status.equals("Checking new abilities")
  178. && !status.equals("Banking") && !status.equals("Finding Bank")){
  179. int x = 0;
  180. int y = 0;
  181. Point pfullStam = new Point(721,96);
  182. Mouse.click((x = pfullStam.x+Random.random(-3,5)),(y = pfullStam.y+Random.random(3,25)));
  183. sleep(400,500);
  184. Mouse.click(x, (y + Random.random(21,32)));
  185. sleep(400,500);
  186. BatFireRunes.walkmod = 1;
  187. }
  188. if(staminaCheck.staminaOff && !staminaFull && resting && !status.equals("Checking Friends")
  189. && !status.equals("Checking stats") && !status.equals("Checking new abilities")
  190. && !status.equals("Banking") && !status.equals("Finding Bank") && !status.equals("Entering ruins")){
  191. rest = true;
  192. int x = 0;
  193. int y = 0;
  194. Point pfullStam = new Point(721,96);
  195. Mouse.click((x = pfullStam.x+Random.random(-3,5)),(y = pfullStam.y+Random.random(3,25)));
  196. sleep(400,500);
  197. Mouse.click(x, (y + Random.random(38,49)));
  198. double timeOut = System.currentTimeMillis();
  199. //while(!staminaFull){
  200. //if(System.currentTimeMillis() - timeOut > 35000)break;
  201. //}
  202. sleep(27000,29000);
  203. rest = false;
  204. Point pfullStam1 = new Point(721,96);
  205. Mouse.click((x = pfullStam1.x+Random.random(-3,5)),(y = pfullStam1.y+Random.random(3,25)));
  206. sleep(400,500);
  207. Mouse.click(x, (y + Random.random(21,32)));
  208. sleep(400,500);
  209. BatFireRunes.walkmod = 1;
  210. }
  211. Mouse.setSpeed(Random.random(6, 9));
  212. if(status.equals("Crafting runes")){
  213. levelUpCheck = new LevelUpCheck();
  214. }
  215. double timeOut = 0;
  216. double timeOut1 = 0;
  217.  
  218. if(status.equals("Finding bank")){
  219. Mouse.click(Random.random(642, 670), Random.random(170, 200)); //returns to inventory tab
  220. timeOut = System.currentTimeMillis();
  221. while(!bankIsOpen()){
  222. if(first){
  223. first = false;
  224. move.interrupt();
  225. move = new Moving();
  226. move.start();
  227. if(Random.random(0, 11) <= 1){
  228. status = "Antiban";
  229. antiban();
  230. return 1000;
  231. }
  232. }
  233. int trys = 0;
  234. while((pt3 = findItemThreePoint(SwordsA, SwordsB, SwordsC, SwordsAB, SwordsAC, 20, new Point(3,3), new Point(512,332))).equals(new Point(-1,-1))){
  235. sleep(600,700);
  236. if(trys==2 || trys ==3){
  237. Point pt = new Point();
  238. if((pt = findItemTwoPoint(CactA, CactB, CactAB, 5, new Point(621,3), new Point(704,158))).equals(new Point(-1,-1))){
  239. int x = Random.random(322,345);
  240. int y = Random.random(134,155);
  241. Mouse.click(x,y);
  242. sleep(500,600);
  243. if(checkColor(new Color (28,28,28), new Point(x,y), 10)){
  244. Mouse.click(x,y+ Random.random(21,32));
  245. }
  246. }else{
  247. pt = new Point(pt.x - 52, pt.y + 32);
  248. Mouse.click(pt);
  249. }
  250. }else if(trys==5){
  251. Point pt = new Point();
  252. if((pt = findItemTwoPoint(CactA, CactB, CactAB, 5, new Point(621,3), new Point(704,158))).equals(new Point(-1,-1))){
  253. if(!walkThere){
  254. Point ptx = findItemTwoPoint(WS3A, WS3B, distWS3, 5, new Point(548,5), new Point(704,164));
  255. Mouse.click(ptx.x + 10,ptx.y);
  256. sleep(walkmod*1000,walkmod*1200);
  257. walkThere = true;
  258. }
  259. }else{
  260. pt = new Point(pt.x - 52, pt.y + 32);
  261. Mouse.click(pt);
  262. }
  263. }
  264. trys++;
  265. if(System.currentTimeMillis() - timeOut > 13000)return 1000;
  266. }
  267. timeOut = System.currentTimeMillis();
  268. while((pt4 = findItemThreePoint(ChestA, ChestB, ChestC, ChestAB, ChestAC, 20, new Point(pt3.x-15,pt3.y), new Point(pt3.x+35,pt3.y+70))).equals(new Point(-1,-1))){
  269. sleep(walkmod * 400,walkmod * 600);
  270. if(System.currentTimeMillis() - timeOut > 9000)return 1000;
  271. }
  272. timeOut1 = System.currentTimeMillis();
  273. if(!moving){
  274. if(!bankIsOpen()){
  275. Mouse.click(pt4.x+10,pt4.y+10);
  276. sleep(400,500);
  277. }else
  278. break;
  279. if(!bankIsOpen()){
  280. Mouse.click(pt4.x+10, (pt4.y+10 + Random.random(21,32)));
  281. sleep(100,200);
  282. Mouse.move(Random.random(0,765), Random.random(0,502));
  283. sleep(walkmod * 400,walkmod * 600);
  284. }else
  285. break;
  286. }
  287. sleep(2000);
  288. if(System.currentTimeMillis() - timeOut1 > 9000)return 1000;
  289. }
  290. walkThere = false;
  291. first = true;
  292. status = "Banking";
  293. return 1000;
  294. }
  295. if(status.equals("Banking")){
  296. move.interrupt();
  297. BatFireRunes.moving = false;
  298. if(bankIsOpen()){
  299. if(!this.checkColor(new Color(75,75,75), new Point(62,109), 15)){
  300. Log.log("Out of rune essence. Shutting down.", Color.RED);
  301. Mouse.move(489,30);
  302. if(Mouse.getLocation()!= new Point(489,30)) Mouse.move(489,30);
  303. sleep(200,300);
  304. Mouse.click();
  305. logOut();
  306. return -1;
  307. }
  308. int x = Random.random(50, 60);
  309. int y = Random.random(100, 110);
  310. Bank.depositAll();
  311. sleep(500,700);
  312. Mouse.click(x,y);
  313. sleep(500,700);
  314. Mouse.click(x, (y + Random.random(103,126)));
  315. sleep(500,700);
  316. Mouse.move(489,30);
  317. if(Mouse.getLocation()!= new Point(489,30)) Mouse.move(489,30);
  318. sleep(200,300);
  319. Mouse.click();
  320. sleep(100,200);
  321. Mouse.move(Random.random(0,765), Random.random(0,502));
  322. sleep(400,500);
  323. }
  324. status = "Walking to ruins";
  325. return 1000;
  326. }
  327. if(status.equals("Walking to ruins")){
  328. // walks until it finds the RC symbol
  329. Point pt4 = new Point();
  330. while((pt4 = findItemTwoPoint(RCSA, RCSB, distRCS, 4, new Point(522,3), new Point(705,164))).equals(new Point(-1,-1))){
  331. Mouse.click(Random.random(560,590),Random.random(81,88));
  332. sleep(walkmod * 1000, walkmod * 1200);
  333. return 1000;
  334. }
  335. Mouse.click(pt4);
  336. sleep(100,200);
  337. Mouse.move(Random.random(0,765), Random.random(0,502));
  338. sleep(walkmod * 2000);
  339. Mouse.move(Random.random(0,765), Random.random(0,502));
  340. //AntiBan
  341. if(Random.random(0, 10) <= 5)
  342. Camera.rotateLeft(Random.random(500,1200));
  343. else
  344. Camera.rotateRight(Random.random(500,1200));
  345. Mouse.move(Random.random(0,765), Random.random(0,502));
  346. sleep(walkmod * 5000);
  347. Mouse.move(Random.random(0,765), Random.random(0,502));
  348. sleep(walkmod * 3000);
  349. Mouse.move(Random.random(0,765), Random.random(0,502));
  350. sleep(walkmod * 3000);
  351. Mouse.move(Random.random(0,765), Random.random(0,502));
  352. status = "Entering ruins";
  353. return 1000;
  354. }
  355. if(status.equals("Entering ruins")){
  356. Mouse.click(Random.random(642, 670), Random.random(170, 200)); //returns to inventory tab
  357. move.interrupt();
  358. move = new Moving();
  359. move.start();
  360. int trys = 0;
  361. Point pt1 = new Point();
  362. timeOut = System.currentTimeMillis();
  363. timeOut1 = System.currentTimeMillis();
  364.  
  365. while((pt1 = findItemThreePoint(MystRuinA, MystRuinB, MystRuinC, MystRuinAB, MystRuinAC, 4)).equals(new Point(-1,-1))){
  366. if(trys == 3){
  367. Point pn = findItemTwoPoint(RCSA, RCSB, distRCS, 4, new Point(522,3), new Point(705,164));
  368. Mouse.click(pn.x +2, pn.y);
  369. if(Random.random(0, 10) <= 5)
  370. Camera.rotateLeft(Random.random(500,1200));
  371. else
  372. Camera.rotateRight(Random.random(500,1200));
  373. }
  374. trys++;
  375. if(System.currentTimeMillis() - timeOut > 9000)return 1000;
  376. sleep(200,300);
  377.  
  378. }
  379. sleep(200,300);
  380. if(!moving){
  381. Mouse.click(pt1);
  382. sleep(400,500);
  383. Mouse.click(pt1.x, (pt1.y + Random.random(21,32)));
  384. sleep(100,200);
  385. }
  386. Mouse.move(Random.random(0,765), Random.random(0,502));
  387. sleep(2000,3000);
  388. boolean portFound = false;
  389.  
  390. for(int i = 0;i < 60;i++){
  391. if(!(findItemTwoPoint(portA, portB, portAB, 10, new Point(3,3), new Point(512,332)).equals(new Point(-1,-1)))) {
  392. portFound = true;
  393. break;
  394. }
  395. sleep(1);
  396. }
  397.  
  398. if(portFound){
  399. move.interrupt();
  400. status = "Crafting runes";
  401. }
  402. return 1000;
  403. }
  404.  
  405. if(status.equals("Crafting runes")){
  406. Game.clickCompass();
  407. Camera.pitchUp(900);
  408. Mouse.click(658,117);
  409. sleep(100,200);
  410. Mouse.move(Random.random(0,765), Random.random(0,502));
  411. sleep(walkmod * 4000,walkmod * 4200);
  412. Point pt = new Point (336,199);
  413. timeOut = System.currentTimeMillis();
  414. while((pt = findItemTwoPoint(tourchesA, tourchesB, tourchesAB, 20, new Point(3,3), new Point(512,332))).equals(new Point(-1,-1))){
  415. if(System.currentTimeMillis() - timeOut > walkmod * 36000)return 1000;
  416. }
  417. pt = new Point (pt.x,pt.y+20);
  418. Mouse.click(pt);
  419. sleep(400,500);
  420. levelUpCheck.start();
  421. Mouse.click(pt.x,pt.y + Random.random(21,32));
  422. sleep(100,200);
  423. Mouse.move(Random.random(0,765), Random.random(0,502));
  424. sleep(3000);
  425. status = "Exiting ruins";
  426. return 1000;
  427. }
  428.  
  429. if(status.equals("Exiting ruins")){
  430. if(ruins){
  431. Mouse.click(Random.random(587,609), Random.random(55,72));
  432. sleep(walkmod * 4500);
  433. }
  434. Point pt2 = new Point();
  435. while((pt2 = findItemThreePoint(portA, portB, portC, portAB, portAC, 4)).equals(new Point(-1,-1))){
  436. }
  437. sleep(200,300);
  438. Mouse.click(pt2);
  439. sleep(400,500);
  440. Mouse.click(pt2.x, (pt2.y + Random.random(21,32)));
  441. sleep(100,200);
  442. Mouse.move(Random.random(0,765), Random.random(0,502));
  443. sleep(4000);
  444. try{
  445. levelUpCheck.interrupt();
  446. }catch(IllegalThreadStateException e){}
  447. //Antiban => checks levels if you get a lvl up.
  448. if(templvls < levelGained){
  449. status = "Checking new Abilities";
  450. Mouse.click(Random.random(590, 604),Random.random(177, 196));
  451. sleep(300,500);
  452. int x = Random.random(560, 600);
  453. int y = Random.random(385, 397);
  454. Mouse.click(x,y);
  455. sleep(300,500);
  456. Mouse.click(x,y + Random.random(21,32));
  457. sleep(400,500);
  458. Mouse.click(Random.random(216, 715),Random.random(128, 435));
  459. sleep(600,1000);
  460. Mouse.scroll(Random.random(7,12), false);
  461. sleep(100,200);
  462. Mouse.move(Random.random(0,765), Random.random(0,502));
  463. sleep(600,900);
  464. Mouse.move(Random.random(0,765), Random.random(0,502));
  465. sleep(100,200);
  466. Mouse.move(Random.random(0,765), Random.random(0,502));
  467. sleep(1000,2000);
  468. Mouse.click(Random.random(740, 743),Random.random(20, 24));
  469. sleep(300,500);
  470. Mouse.click(Random.random(642, 670), Random.random(170, 200)); //returns to inventory tab
  471. templvls = levelGained;
  472. }
  473.  
  474. ruins = false;
  475. for(int i = 0;i < 60;i++){
  476. if(!(findItemTwoPoint(MystRuinA, MystRuinB, MystRuinAB, 4, new Point(3,3), new Point(512,332)).equals(new Point(-1,-1)))) {
  477. ruins = true;
  478. break;
  479. }
  480. sleep(1);
  481. }
  482. if(ruins)status = "Walking back";
  483. return 1000;
  484. }
  485.  
  486. if(status.equals("Walking back")){
  487. if(firstRun){
  488. Point lp = findItemTwoPoint(WS1A, WS1B, distWS1, 5, new Point(522,3), new Point(705,164));
  489. Mouse.click(lp.x+2,lp.y);
  490. sleep(100,200);
  491. //Random mouse movement
  492. Mouse.move(Random.random(0,765), Random.random(0,502));
  493. sleep(walkmod * 3000);
  494. sleep(100,200);
  495. Mouse.move(Random.random(0,765), Random.random(0,502));
  496. sleep(walkmod * 2000);
  497. sleep(100,200);
  498. Mouse.move(Random.random(0,765), Random.random(0,502));
  499. sleep(walkmod * 4000);
  500. sleep(100,200);
  501. Mouse.move(Random.random(0,765), Random.random(0,502));
  502. sleep(walkmod * 2000);
  503. //End
  504. move.interrupt();
  505. move = new Moving();
  506. move.start();
  507. Point pt5 = findItemTwoPoint(WS2A, WS2B, distWS2, 5, new Point(631,3), new Point(705,77));
  508. Mouse.click(pt5.x+Random.random(10, 35),pt5.y-Random.random(5, 15));
  509. sleep(2700);
  510. if(!moving){
  511. pt5 = findItemTwoPoint(WS2A, WS2B, distWS2, 5, new Point(625,8), new Point(765,46));
  512. Mouse.click(pt5.x,pt5.y);
  513. }
  514.  
  515. Mouse.move(Random.random(0,765), Random.random(0,502));
  516. move.interrupt();
  517. sleep(walkmod * 6500);
  518. walkBack = 0;
  519. }
  520.  
  521. while(walkBack<8){
  522. Mouse.click(670,87);
  523. sleep(walkmod * 910, walkmod*920);
  524. walkBack++;
  525. firstRun = false;
  526. return 1000;
  527. }
  528. firstRun = true;
  529. sleep(3000);
  530. RUNS++;
  531. status = "Finding bank";
  532. return 1000;
  533. }
  534. return 1000;
  535. }
  536.  
  537. /**
  538. * Performs actions that are "human-like"
  539. */
  540. private void antiban() {
  541. if(!bankIsOpen()){
  542. int lolz = Random.random(0, 11);
  543. if(lolz <= 5){
  544. status = "Checking stats";
  545. if(!bankIsOpen()){
  546. Mouse.click(Random.random(590, 604),Random.random(177, 196));
  547. sleep(300,500);
  548. }
  549. int x = Random.random(556, 729);
  550. int y = Random.random(214, 428);
  551. if(!bankIsOpen()){
  552. Mouse.click(x,y);
  553. sleep(300,500);
  554. }
  555. if(!bankIsOpen()){
  556. Mouse.click(x,y + Random.random(21,32));
  557. sleep(400,500);
  558. }
  559. if(!bankIsOpen()){
  560. Mouse.click(Random.random(216, 715),Random.random(128, 435));
  561. sleep(600,1000);
  562. }
  563. if(!bankIsOpen()){
  564. Mouse.scroll(Random.random(7,12), false);
  565. sleep(3000,5000);
  566. }
  567. if(!bankIsOpen()){
  568. Mouse.click(Random.random(740, 743),Random.random(20, 24));
  569. sleep(300,500);
  570. }
  571. }else if(lolz > 5){
  572. status = "Checking Friends";
  573. if(!bankIsOpen()){
  574. Mouse.click(Random.random(558, 575),Random.random(473, 498));
  575. sleep(300,500);
  576. }
  577. int x = Random.random(556, 729);
  578. int y = Random.random(214, 428);
  579. if(!bankIsOpen()){
  580. Mouse.move(x,y);
  581. sleep(1000,1500);
  582. }
  583.  
  584. }
  585. Mouse.click(Random.random(642, 670), Random.random(170, 200));
  586. }
  587. status = "Finding bank";
  588. }
  589. /**
  590. * The actions performed when the script stops.
  591. */
  592. public void onStop(){
  593. staminaCheck.interrupt();
  594. move.interrupt();
  595. levelUpCheck.interrupt();
  596. //Environment.saveScreenshot();
  597. Log.log("Thanks for using BatFireRunes!");
  598. Log.log("Total runtime of: " + getTime(System.currentTimeMillis() - TIME));
  599. Log.log("You completed " + RUNS + " runs.");
  600. }
  601.  
  602. /**
  603. * The paint.
  604. */
  605. public void onRepaint(Graphics g){
  606. if(showPaint){
  607. g.setColor(new Color(203,186,153));
  608. g.fillRect(7,345,505,128);
  609. g.setColor(Color.BLACK);
  610. g.drawString("Use resting.",125,400);
  611. g.drawString("Time Running : " + getTime(System.currentTimeMillis() - TIME), 11, 360);
  612. g.drawString("Total Runs: " + RUNS ,11,380);
  613. g.drawString("Runs/Hour: " + (int)((double)(RUNS*3600000)/(System.currentTimeMillis() - TIME)),11,400);
  614. g.drawString("Levels Gained: " + levelGained ,11,420);
  615. g.drawString("Status: " + status ,11,440);
  616. if(!rest){
  617. if(!staminaCheck.staminaOff()){
  618. g.setColor(Color.GREEN);
  619. g.drawString("Running", 11,460);
  620. }else {
  621. g.setColor(Color.RED);
  622. g.drawString("Walking", 11,460);
  623. walkmod = 2;
  624. }
  625. }else{
  626. g.setColor(Color.BLUE);
  627. g.drawString("Resting", 11,460);
  628. }
  629. g.setColor(Color.BLACK);
  630. g.setFont(new Font("Salaryman", 1, 25));
  631. g.drawImage(pic, 270, 370, null, null);
  632. g.drawString("Version 1.0",255,380);
  633. g.drawString("BatFireRunes",240,460);
  634. g.setColor(Color.RED);
  635. g.drawString("Fire",280,460);
  636.  
  637. if(resting) g.drawImage(chk, 110, 388, null, null);
  638. else g.drawImage(unchk, 110, 388, null, null);
  639. g.drawString("x",500,360);
  640. }else{
  641. g.setColor(Color.GREEN);
  642. g.setFont(new Font("Salaryman", 1, 25));
  643. g.drawString("o",500,360);
  644. }
  645. g.setColor(Color.RED);
  646. if(moving){
  647. g.drawLine(Mouse.getLocation().x-2,0,Mouse.getLocation().x-2,2100);
  648. g.drawLine(0,Mouse.getLocation().y-2,2100,Mouse.getLocation().y-2);
  649. g.drawLine(Mouse.getLocation().x+2,0,Mouse.getLocation().x+2,2100);
  650. g.drawLine(0,Mouse.getLocation().y+2,2100,Mouse.getLocation().y+2);
  651. }
  652. else{
  653. g.drawLine(Mouse.getLocation().x,0,Mouse.getLocation().x,2100);
  654. g.drawLine(0,Mouse.getLocation().y,2100,Mouse.getLocation().y);
  655. }
  656. }
  657.  
  658. /**
  659. * This is a time display method from jaanu22
  660. *
  661. * @param millis
  662. * - Give it the current counter time in milliseconds.
  663. * @return
  664. * - Returns the time in a more readable format
  665. */
  666. private static String getTime(double millis){
  667. double time = millis / 1000;
  668. String seconds = Integer.toString((int) (time % 60));
  669. String minutes = Integer.toString((int) ((time % 3600) / 60));
  670. String hours = Integer.toString((int) (time / 3600));
  671. for (int i = 0; i < 2; i++)
  672. {
  673. if (seconds.length() < 2)
  674. {
  675. seconds = "0" + seconds;
  676. }
  677. if (minutes.length() < 2)
  678. {
  679. minutes = "0" + minutes;
  680. }
  681. if (hours.length() < 2)
  682. {
  683. hours = "0" + hours;
  684. }
  685. }
  686. return hours + ":" + minutes + ":" + seconds;
  687. }
  688.  
  689. /**
  690. * Checks if the bank is open.
  691. *
  692. * @return boolean
  693. * - true if the bank is open
  694. * - false if the bank is open
  695. */
  696. private boolean bankIsOpen() {
  697. sleep(200,300);
  698. if(checkColor(new Color(242,170,62), new Point(198,30), 20) && checkColor(new Color(130,77,30), new Point(374,313), 20))return true;
  699. else return false;
  700. }
  701.  
  702. /**
  703. * Logs you out.
  704. */
  705. private void logOut(){
  706. Mouse.click(Random.random(758,784),Random.random(4,15));
  707. sleep(Random.random(600,800));
  708. Mouse.click(Random.random(576,708),Random.random(355,372));
  709. }
  710.  
  711. /**
  712. * Return the center point between two points of color, indicating where the desire object is.
  713. * Returns (-1,-1) if the point is not found.
  714. *
  715. * @param col1
  716. * - The color value of a point on object.
  717. * @param col2
  718. * - The color value of a point on object.
  719. * @param p
  720. * - the distance x and y between the two points of color.
  721. * @return
  722. */
  723. private Point findItemTwoPoint(Color col1, Color col2, Point p, int tolerance){
  724. Point out = new Point(0,0);
  725. List<Point> test1 = ImageUtil.getPointsWithColor(Game.getImage(), col1,.05);
  726. List<Point> test2 = ImageUtil.getPointsWithColor(Game.getImage(), col2,.05);
  727. boolean breakable = false;
  728. boolean pointFound = false;
  729. for(int i = 0;i < test1.size();i++){
  730. for(int j = 0;j < test2.size();j++){
  731. if(Math.abs(test1.get(i).x - test2.get(j).x - p.x) < tolerance){
  732. if(Math.abs(test1.get(i).y - test2.get(j).y - p.y) < tolerance){
  733. out = new Point((int)((test1.get(i).x + test2.get(j).x)/2),
  734. (int)((test1.get(i).y + test2.get(j).y)/2));
  735. pointFound = true;
  736. breakable = true;
  737. break;
  738.  
  739. }
  740. }
  741. }
  742. if(breakable)break;
  743. }
  744. if(pointFound)return out;
  745. else return new Point(-1,-1);
  746. }
  747.  
  748. /**
  749. * This works with bounds
  750. * Return the center point between two points of color, indicating where the desire object is.
  751. * Returns (-1,-1) if the point is not found.
  752. *
  753. *
  754. * @param col1
  755. * - The color value of a point on object.
  756. * @param col2
  757. * - The color value of a point on object.
  758. * @param p
  759. * - the distance x and y between the two points of color.
  760. * @param TL
  761. * - The top left bound
  762. * @param BR
  763. * - The bottom right bound
  764. * @return
  765. */
  766. private Point findItemTwoPoint(Color col1, Color col2, Point p, int tolerance, Point TL, Point BR){
  767. Point out = new Point(0,0);
  768. List<Point> test1 = ImageUtil.getPointsWithColor(Game.getImage(), new Rectangle(TL.x,TL.y,BR.x-TL.x,BR.y-TL.y), col1,.05);
  769. List<Point> test2 = ImageUtil.getPointsWithColor(Game.getImage(), new Rectangle(TL.x,TL.y,BR.x-TL.x,BR.y-TL.y), col2,.05);
  770. boolean breakable = false;
  771. boolean pointFound = false;
  772. for(int i = 0;i < test1.size();i++){
  773. for(int j = 0;j < test2.size();j++){
  774. if(Math.abs(test1.get(i).x - test2.get(j).x - p.x) < tolerance){
  775. if(Math.abs(test1.get(i).y - test2.get(j).y - p.y) < tolerance){
  776. out = new Point((int)((test1.get(i).x + test2.get(j).x)/2),
  777. (int)((test1.get(i).y + test2.get(j).y)/2));
  778. pointFound = true;
  779. breakable = true;
  780. break;
  781. }
  782. }
  783. }
  784. if(breakable)break;
  785. }
  786. if(pointFound)return out;
  787. else return new Point(-1,-1);
  788. }
  789.  
  790. /**
  791. * Return the center point of a triangle, indicating where the desire object is.
  792. * Returns (-1,-1) if the point is not found.
  793. *
  794. * @param col1
  795. * - The color of the first point
  796. * @param col2
  797. * - The color of the second point
  798. * @param col3
  799. * - The color of the third point
  800. * @param p1
  801. * - The distance between point 1 and point 2
  802. * @param p2
  803. * - The distance between point 1 and point 3
  804. * @param tolerance
  805. * - The distance tolerance in pixels
  806. *
  807. * @return Point the point
  808. */
  809. private Point findItemThreePoint(Color col1, Color col2, Color col3, Point p1, Point p2, int tolerance){
  810. Point out = new Point();
  811. Point pt2 = new Point();
  812. Point pt1 = findItemTwoPoint(col1,col2, p1, tolerance);
  813. if(!pt1.equals(new Point (-1,-1))){
  814. pt2 = findItemTwoPoint(col1,col3, p2, tolerance);
  815. if(!pt2.equals(new Point (-1,-1))){
  816. out = new Point((int)((pt1.x + pt2.x)/2),
  817. (int)((pt1.y + pt2.y)/2));
  818. }else return new Point (-1,-1);
  819. }else return new Point (-1,-1);
  820. return out;
  821. }
  822.  
  823. /**
  824. * This works with bounds
  825. * Return the center point of a triangle, indicating where the desire object is.
  826. * Returns (-1,-1) if the point is not found.
  827. *
  828. * @param col1
  829. * - The color of the first point
  830. * @param col2
  831. * - The color of the second point
  832. * @param col3
  833. * - The color of the third point
  834. * @param p1
  835. * - The distance between point 1 and point 2
  836. * @param p2
  837. * - The distance between point 1 and point 3
  838. * @param tolerance
  839. * - The distance tolerance in pixels
  840. * @param TL
  841. * - The top left corner of the bounds
  842. * @param BR
  843. * - The bottom right corner of the bounds
  844. *
  845. * @return Point the point
  846. */
  847. private Point findItemThreePoint(Color col1, Color col2, Color col3, Point p1, Point p2, int tolerance, Point TL, Point BR){
  848. Point out = new Point();
  849. Point pt2 = new Point();
  850. Point pt1 = findItemTwoPoint(col1,col2, p1, tolerance, TL, BR);
  851. if(!pt1.equals(new Point (-1,-1))){
  852. pt2 = findItemTwoPoint(col1,col3, p2, tolerance,TL, BR);
  853. if(!pt2.equals(new Point (-1,-1))){
  854. out = new Point((int)((pt1.x + pt2.x)/2),
  855. (int)((pt1.y + pt2.y)/2));
  856. }else return new Point (-1,-1);
  857. }else return new Point (-1,-1);
  858. return out;
  859. }
  860.  
  861. /**
  862. * Returns whether the given point is a certain color.
  863. * Accounts for the variable colors that runescape produces whenever you log in.
  864. * @param col
  865. * - Color to check for.
  866. * @param p
  867. * - Point to check at.
  868. * @return
  869. */
  870. private boolean checkColor(Color col, Point p, int tol){
  871. if(Math.abs(col.getRed() - Game.getColorAt(p).getRed()) < tol)
  872. if(Math.abs(col.getGreen() - Game.getColorAt(p).getGreen()) < tol)
  873. if(Math.abs(col.getBlue() - Game.getColorAt(p).getBlue()) < tol)
  874. return true;
  875. return false;
  876. }
  877.  
  878. /**
  879. * Mouse listener
  880. */
  881. public void mouseClicked(MouseEvent e) {
  882. Point pt = e.getPoint();
  883. if (pt.x >= 499 && pt.x <= 512 && pt.y >= 345 && pt.y <= 360) {
  884. showPaint = !showPaint;
  885. }
  886. if (pt.x >= 110 && pt.x <= 191 && pt.y >= 388 && pt.y <= 400) {
  887. resting = !resting;
  888. }
  889. }
  890. public void mouseEntered(MouseEvent arg0) {}
  891. public void mouseExited(MouseEvent arg0) {}
  892. public void mousePressed(MouseEvent arg0) {}
  893. public void mouseReleased(MouseEvent arg0) {}
  894.  
  895. class StaminaChecker extends Thread implements Runnable {
  896. private Point p = new Point(722,104);
  897. private Color cOn = new Color (235,217,102);
  898. private Color cOff = new Color (142,97,55);
  899. private Point pfullStam = new Point(721,96);
  900. private Color fullStam = new Color (94,86,71);
  901. private boolean staminaOff;
  902. public boolean staminaOff() {
  903. return this.staminaOff;
  904. }
  905. public StaminaChecker() {
  906. this.setPriority(MIN_PRIORITY);
  907. }
  908.  
  909. @Override
  910. public void run() {
  911. try{
  912. while (!Thread.interrupted()) {
  913. if (!checkColor(cOn, p, 20)){
  914. staminaOff = true;
  915. BatFireRunes.walkmod = 2;
  916. if(checkColor(fullStam, pfullStam, 20)){
  917. BatFireRunes.staminaFull = true;
  918. }
  919. }else if (!checkColor(cOff, p, 20)){
  920. staminaOff = false;
  921. BatFireRunes.staminaFull = false;
  922. BatFireRunes.walkmod = 1;
  923. }
  924. if(Thread.interrupted()) return;
  925. }
  926. } finally{}
  927. }
  928.  
  929. /**
  930. * Returns whether the given point is a certain color.
  931. * Accounts for the variable colors that runescape produces whenever you log in.
  932. * @param col
  933. * - Color to check for.
  934. * @param p
  935. * - Point to check at.
  936. * @return
  937. */
  938. private boolean checkColor(Color col, Point p, int tol){
  939. if(Math.abs(col.getRed() - Game.getColorAt(p).getRed()) < tol)
  940. if(Math.abs(col.getGreen() - Game.getColorAt(p).getGreen()) < tol)
  941. if(Math.abs(col.getBlue() - Game.getColorAt(p).getBlue()) < tol)
  942. return true;
  943. return false;
  944. }
  945. }
  946.  
  947. class LevelUpCheck extends Thread implements Runnable {
  948. private Point ptB = new Point(271,92);
  949. private Color ptBC = new Color (5,4,4);
  950.  
  951. public LevelUpCheck() {
  952. this.setPriority(MIN_PRIORITY);
  953. }
  954.  
  955. @Override
  956. public void run() {
  957. try{
  958. while (!Thread.interrupted()) {
  959. if(checkColor(ptBC, ptB, 5)){
  960. BatFireRunes.levelGained++;
  961. return;
  962. }
  963. if(Thread.interrupted()) return;
  964. }
  965. } finally{}
  966. }
  967.  
  968. /**
  969. * Returns whether the given point is a certain color.
  970. * Accounts for the variable colors that runescape produces whenever you log in.
  971. * @param col
  972. * - Color to check for.
  973. * @param p
  974. * - Point to check at.
  975. * @return
  976. */
  977. private boolean checkColor(Color col, Point p, int tol){
  978. if(Math.abs(col.getRed() - Game.getColorAt(p).getRed()) < tol)
  979. if(Math.abs(col.getGreen() - Game.getColorAt(p).getGreen()) < tol)
  980. if(Math.abs(col.getBlue() - Game.getColorAt(p).getBlue()) < tol)
  981. return true;
  982. return false;
  983. }
  984. }
  985.  
  986. class Moving extends Thread implements Runnable {
  987.  
  988. private Point TL = new Point(564,3);
  989. private Point BR = new Point(683,160);
  990. private Point pt = new Point();
  991. private Color white = new Color(247,239,245);
  992.  
  993. public Moving() {
  994. this.setPriority(MIN_PRIORITY);
  995. }
  996.  
  997. @Override
  998. public void run() {
  999. try{
  1000. while (!Thread.interrupted()) {
  1001. List<Point> test1 = ImageUtil.getPointsWithColor(Game.getImage(), white,.05);
  1002. Color temp = new Color(10,10,10);
  1003. for(int i = 0; i < test1.size(); i++){
  1004. if((test1.get(i).x > TL.x) && (test1.get(i).y > TL.y)){
  1005. if((test1.get(i).x < BR.x) && (test1.get(i).y < BR.y)){
  1006. if(!checkColor(white, new Point(test1.get(i).x-1, test1.get(i).y), 10) && !checkColor(white, new Point(test1.get(i).x+1, test1.get(i).y), 10)){
  1007. pt = test1.get(i);
  1008. break;
  1009. }
  1010. }
  1011. }
  1012. }
  1013. temp = ImageUtil.getColorAt(Game.getImage(), pt);
  1014. sleep(500);
  1015. if(temp.equals(ImageUtil.getColorAt(Game.getImage(), pt))){
  1016. BatFireRunes.moving = false;
  1017. }else{
  1018. BatFireRunes.moving = true;
  1019. }
  1020. }
  1021. if(Thread.interrupted()) return;
  1022.  
  1023. } catch (InterruptedException e) {
  1024. return;
  1025. } finally{
  1026. BatFireRunes.moving = false;
  1027. }
  1028. }
  1029. }
  1030. }//Ends BatFireRune class.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement