Guest User

Untitled

a guest
Jul 19th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 52.04 KB | None | 0 0
  1. import java.awt.*;
  2. import java.util.*;
  3. import javax.swing.*;
  4. import java.awt.event.*;
  5. import java.net.*;
  6. import java.io.*;
  7. import java.awt.Rectangle;
  8. import java.awt.Color;
  9. import java.awt.Component;
  10. import java.awt.Container;
  11. import java.awt.Dimension;
  12. import java.awt.Graphics;
  13.  
  14. import org.rsbot.script.ScriptManifest;
  15. import org.rsbot.bot.Bot;
  16. import org.rsbot.event.listeners.PaintListener;
  17. import org.rsbot.event.listeners.ServerMessageListener;
  18. import org.rsbot.event.events.ServerMessageEvent;
  19. import org.rsbot.bot.input.Mouse;
  20. import org.rsbot.script.Calculations;
  21. import org.rsbot.script.Constants;
  22. import org.rsbot.script.Methods;
  23. import org.rsbot.script.Script;
  24. import org.rsbot.script.wrappers.RSInterface;
  25. import org.rsbot.script.wrappers.RSInterfaceChild;
  26. import org.rsbot.script.wrappers.RSInterfaceComponent;
  27. import org.rsbot.script.wrappers.RSItem;
  28. import org.rsbot.script.wrappers.RSItemTile;
  29. import org.rsbot.script.wrappers.RSObject;
  30. import org.rsbot.script.wrappers.RSTile;
  31. import org.rsbot.script.wrappers.RSTilePath;
  32. import org.rsbot.script.wrappers.RSPlayer;
  33. import org.rsbot.script.wrappers.RSCharacter;
  34. import org.rsbot.script.wrappers.RSNPC;
  35.  
  36. @ScriptManifest(authors = { "Scaper" }, category = "Combat", name = "SmartPC", version = 1.0, description = "<html>"
  37. //+ "Original script by: " + getAuthor() + "<br>\n"
  38. + "'SmartPC' is a modified by Fatality."
  39. + "<br>"
  40. + "<h4>Instructions:</h4>-Start script on lander dock (of your choice) at the void outpost.<br>"
  41. + "-Make sure you have a working Autologin script in your AntiRandom folder.<br><br>"
  42. + "Exchange points for:<br>"
  43. + "<input type=\"radio\" name=\"num\" value=\"1\" />ATTACK EXP <input type=\"radio\" name=\"num\" value=\"2\" />STRENGTH EXP "
  44. + "<input type=\"radio\" name=\"num\" value=\"3\" />DEFENCE EXP <input type=\"radio\" name=\"num\" value=\"4\" />RANGE EXP"
  45. + "<input type=\"radio\" name=\"num\" value=\"5\" />PRAYER EXP <input type=\"radio\" name=\"num\" value=\"6\" />MAGIC EXP "
  46. + "<input type=\"radio\" name=\"num\" value=\"7\" />HITPOINTS EXP <input type=\"radio\" name=\"num\" value=\"0\" />DO NOT EXCHANGE"
  47. + "<br><br>"
  48. + "Prayer Setting:<br>"
  49. + "<input type=\"radio\" name=\"whichPray\" value=\"0\" />NO PRAYER "
  50. + "<input type=\"radio\" name=\"whichPray\" value=\"1\" />MELEE "
  51. + "<input type=\"radio\" name=\"whichPray\" value=\"2\" />RANGE"
  52. + "<input type=\"radio\" name=\"whichPray\" value=\"3\" />MAGE<br><br>"
  53. + "Special Attack Setting:<br>"
  54. + "<b>Special Attack ?</b> <select name=\"iWantSpec\"><option selected>No<option>Yes</select> <br>"
  55. + "</html>")
  56. public class SmartPC extends Script implements PaintListener{
  57.  
  58. final ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
  59.  
  60.  
  61. long startTime;
  62. int state=1;
  63. int prev=0;
  64. int portW=0;
  65. int points=0;
  66. int won=0;
  67. int lost=0;
  68. int health;
  69. int door[]={14239, 14241, 14235, 14237, 14233, 14235, 14239};
  70. int portal[]={6150,6151,6152,6153,6142,6143,6144,6145};
  71. int gangplank[]={14315,25631,25632};
  72. int centerX=0;
  73. int centerY=0;
  74. int num;
  75. int whichPray;
  76. int randomInt;
  77. int GambleInt;
  78. long lastCheck = -1;
  79. long timer = System.currentTimeMillis();
  80. long startIdle = System.currentTimeMillis();
  81. int checkTime;
  82. boolean notyet=true;
  83. boolean u=true;
  84. boolean setboat=false;
  85. boolean specYes=false;
  86. boolean highLevel=false;
  87. String currentp ="none";
  88. int jpoints=0;
  89. int Evoid[]={3788, 3789};
  90.  
  91. int startX;
  92. int startY;
  93. int desX;
  94. int desY;
  95.  
  96. public RSTile bridge;
  97. public RSTile boat;
  98.  
  99. RSTile first = new RSTile(2657, 2639);
  100. RSTile firstB = new RSTile(2661,2639);
  101. RSTile second = new RSTile(2644,2644);
  102. RSTile secondB = new RSTile(2640, 2644);
  103. RSTile third = new RSTile(2638,2653);
  104. RSTile thirdB = new RSTile(2634, 2653);
  105. RSTile cache;
  106. RSTile temp;
  107.  
  108. //to center
  109. public RSTile[] toCenterTile;
  110. //to west
  111. public RSTile centToWestA[];
  112. public RSTile centToWestB[];
  113. //to east
  114. public RSTile centToEastA[];
  115. public RSTile centToEastB[];
  116. //to south door
  117. public RSTile centToSouth[];
  118. //to south-east
  119. public RSTile southToEast[];
  120. //to south-west
  121. public RSTile southToWest[];
  122.  
  123. public RSTile westToSWest;
  124.  
  125. public RSTile eastToSEast;
  126.  
  127. public RSTile sWestToSEast;
  128.  
  129. public RSTile center;
  130. public RSTile center1;
  131. public RSTile voidE=new RSTile(2659,2649);
  132.  
  133.  
  134. public boolean onStart(Map<String, String>args) {
  135. startTime = System.currentTimeMillis();
  136. Bot.getEventManager().addListener(PaintListener.class, this);
  137. //num=Integer.parseInt(args[0]);
  138. //whichPray=Integer.parseInt(args[1]);
  139. //specYes=Integer.parseInt(args[2]);
  140. num = Integer.parseInt(args.get("num"));
  141. whichPray = Integer.parseInt(args.get("whichPray"));
  142. if(num==1){
  143. log("Points will be exchanged for Attack exp");
  144. }
  145. if(num==2){
  146. log("Points will be exchanged for Strength exp");
  147. }
  148. if(num==3){
  149. log("Points will be exchanged for Defence exp");
  150. }
  151. if(num==4){
  152. log("Points will be exchanged for Range exp");
  153. }
  154. if(num==5){
  155. log("Points will be exchanged for Prayer exp");
  156. }
  157. if(num==6){
  158. log("Points will be exchanged for Magic exp");
  159. }
  160. if(num==7){
  161. log("Points will be exchanged for Hitpoints exp");
  162. }
  163. if(args.get("iWantSpec").equals("Yes"))
  164. log("we will use spec");
  165. specYes = true;
  166. return true;
  167. }
  168.  
  169. public void onFinish() {
  170. log("Script Ended.");
  171. Bot.getEventManager( ).removeListener(PaintListener.class, this);
  172. }
  173.  
  174.  
  175.  
  176. public int loop(){
  177. int j;
  178. if(getMyPlayer().getAnimation() != -1) {
  179. startIdle = System.currentTimeMillis();
  180. RSTile lastLocation = getMyPlayer().getLocation();
  181. if(System.currentTimeMillis() - startIdle >= 10000 && getMyPlayer().getLocation() == lastLocation)
  182. state = prev;
  183. }
  184. try{
  185. if(setboat == false){
  186. setBoat();
  187. }
  188. if (getEnergy() >= 100) {
  189. setRun(true);
  190. }
  191. /*if (getSetting(Methods.SETTING_AUTO_RETALIATE) != 0) {
  192. openTab(Constants.TAB_ATTACK);
  193. wait(random(300,600));
  194. clickMouse(random(578,708), random(362,398), true);
  195. wait(random(800, 1000));
  196. }*/
  197. setCameraRotation(1);
  198. if(getMyPlayer().isMoving()){
  199. return random(400, 500);
  200. }
  201. if(state != 2 && findVoid() && distanceTo(temp) < 9){
  202. makeTile();
  203. currentp="none";
  204. while(getMyPlayer().isMoving()){
  205. wait(random(500, 900));
  206. }
  207. setRun(true);
  208. walkToCenter();
  209. while(getMyPlayer().isMoving()){
  210. wait(random(500, 900));
  211. }
  212. wait(random(500, 600));
  213. state=3;
  214. }
  215. if(distanceTo(bridge) > 2 && distanceTo(boat) > 2 && distanceTo(bridge) < 20){
  216. if(distanceTo(bridge) > 17){
  217. RSTile bridg = bridge;
  218. int bX= bridg.getX();
  219. int bY= bridg.getY();
  220. RSTile a = new RSTile(bX,bY+5);
  221. myWalkTile(a,1);
  222. wait(random(3000, 4000));
  223. while(getMyPlayer().isMoving()){
  224. wait(random(500, 900));
  225. }
  226. }
  227. myWalkTile(bridge,1);
  228. wait(2000);
  229. while(getMyPlayer().isMoving()){
  230. wait(random(500, 900));
  231. }
  232. }
  233. if(distanceTo(bridge) < 2){
  234. notyet=true;
  235. currentp="none";
  236. wait(random(1000,1350));
  237. if(interfaceExists(242) || interfaceExists(211)) {
  238. lost++;
  239. } else if(interfaceExists(243)){
  240. won++; }
  241. while(interfaceExists(242) || interfaceExists(211) || interfaceExists(243)) {
  242. pressContinue();
  243. wait(random(1234,2345));
  244. }
  245.  
  246.  
  247. if(bridge==first){
  248.  
  249. if(jpoints >= 100 && (distanceTo(boat) < 2)) {
  250. log("You reached over 100 points; spending now!");
  251. spendPoints();
  252. myWalkTile(bridge,1);
  253. points=0;
  254. jpoints=0;
  255. if(distanceTo(bridge) < 4 || !(interfaceExists(242) || !(interfaceExists(211) || !(interfaceExists(243))))){
  256. atObject(findObject(gangplank), "Cross");
  257. }else{
  258. return random(20,100);
  259. }
  260. wait(random(700, 1000));
  261. state=2;
  262. }
  263.  
  264. }
  265.  
  266. if(bridge==second){
  267.  
  268. if(jpoints >= 100){
  269. log("You reached over 100 points; spending now!");
  270. spendPoints();
  271. myWalkTile(bridge,1);
  272. points=0;
  273. jpoints=0;
  274. if(distanceTo(bridge) < 4){
  275. atObject(findObject(gangplank), "Cross");
  276. }else{
  277. return random(20,100);
  278. }
  279. wait(random(700, 1000));
  280. state=2;
  281. }
  282. }
  283.  
  284. if(bridge==third){
  285.  
  286. if(jpoints >= 100){
  287. log("You reached over 100 points; spending now!");
  288. spendPoints();
  289. setCameraRotation(1);
  290. clickMouse(556,74,true);
  291. wait(random(4000, 5000));
  292. myWalkTile(bridge,1);
  293. points=0;
  294. jpoints=0;
  295. if(distanceTo(bridge) < 4){
  296. atObject(findObject(gangplank), "Cross");
  297. }else{
  298. return random(20,100);
  299. }
  300. wait(random(700, 1000));
  301. state=2;
  302. }
  303. }
  304.  
  305. wait(random(700, 1000));
  306. if(distanceTo(bridge) < 4){
  307. atObject(findObject(gangplank), "Cross");
  308. }else{
  309. return random(20,100);
  310. }
  311. wait(random(700, 1000));
  312. state=2;
  313. }
  314. switch(state){
  315. case 0:
  316. if(getInteractingNPCMx() != null || getAnimation()) {
  317. antiBan();
  318. wait(250);
  319. }else{
  320. state = prev;
  321. }
  322. return random(500, 1000);
  323. case 1:
  324. if(distanceTo(boat) < 2){
  325. state=2;
  326. }
  327. return random(20,100);
  328. case 2:
  329. if(distanceTo(boat) < 2 || distanceTo(bridge) < 2){
  330. wait(random(2000, 2645));
  331. RSInterfaceChild a = RSInterface.getChildInterface(407,16);
  332. String text = a.getText();
  333. jpoints=extract(text);
  334. if(jpoints == 240 || jpoints >= 240){
  335. log("Ending Script, you have over 240 points");
  336. return -1;
  337. }
  338. return random(20,100);
  339. }else{
  340. setRun(true);
  341. RSNPC squire = getNearestNPCByID(3781);
  342. usePrayer();
  343. if(squire==null){
  344. return random(20,100);
  345. }
  346. makeTile();
  347. if(distanceTo(center) > 30){
  348. currentp="none";
  349. if(getMyPlayer().isMoving()) {
  350. return random(20,100);
  351. }
  352. walkToCenter();
  353. if(getMyPlayer().isMoving()) {
  354. return random(20,100);
  355. }
  356. }
  357. state=3;
  358. }
  359. return random(20,100);
  360. case 3:
  361. RSNPC Atta;
  362. Atta = getNearestNPCByName("Shifter", "Defiler", "Torcher", "Brawler", "Ravager");
  363. if(Atta != null && distanceTo(Atta) < 5) {
  364. atNPC2(Atta, "Attack");
  365. state= 0;
  366. prev= 4;
  367. return random(20,100);
  368. }else{
  369. state=4;
  370. prev=4;
  371. }
  372. return random(20,100);
  373. case 4:
  374. stayNearPortal();
  375. RSNPC mons;
  376. mons = getNearestNPCByName("Spinner");
  377. avoidBrawler(mons);
  378. if(mons != null && distanceTo(mons) < 7) {
  379.  
  380. atNPC2(mons, "Attack");
  381. state= 0;
  382. prev= 4;
  383. return random(20,100);
  384. }
  385. stayNearPortal();
  386. RSNPC Portal;
  387. Portal = getNearestNPCByID(portal);
  388. avoidBrawler(Portal);
  389. if(Portal != null && distanceTo(Portal) < 5){
  390. atNPC2(Portal, "Attack");
  391. state= 0;
  392. prev= 4;
  393. return random(20,100);
  394. }else{
  395. state=5;
  396. }
  397. return random(20,100);
  398. case 5:
  399. stayNearPortal();
  400. RSNPC monst;
  401. monst = getNearestNPCByName("Shifter", "Defiler", "Torcher", "Brawler", "Ravager");
  402. if(monst != null && distanceTo(monst) < 7) {
  403. atNPC2(monst, "Attack");
  404. state= 0;
  405. prev= 4;
  406. return random(20,100);
  407. }else{
  408. stayNearPortal();
  409. wait(random(100, 500));
  410. state = 6;
  411. prev=5;
  412. }
  413. return random(20,100);
  414. case 6:
  415. if(!(newPortal())){
  416. if(distanceTo(bridge) > 2 && distanceTo(boat) > 2 && distanceTo(bridge) < 20){
  417. myWalkTile(bridge,1);
  418. wait(2000);
  419. if(getMyPlayer().isMoving()){
  420. return random(20,100);
  421. }
  422. }
  423. return 100;
  424. }else{
  425. state=prev;
  426. }
  427. return random(20,100);
  428. }
  429. }catch(Exception e){
  430. e.printStackTrace();
  431. }
  432. return random(20,100);
  433. }
  434.  
  435. public void setMaxAltitude() {
  436. Bot.getInputManager().pressKey((char) 38);
  437. wait(random(500,1000));
  438. Bot.getInputManager().releaseKey((char) 38);
  439. }
  440.  
  441. public void pressContinue(){
  442. clickMouse(254+random(0,20), 455+random(0,4), true);
  443. wait(random(300, 1500));
  444. }
  445.  
  446.  
  447. public int getSpec() {
  448. return getSetting(300)/10;
  449. }
  450.  
  451. boolean specEnabled() {
  452. return (getSetting(301)) == 1;
  453. }
  454.  
  455. void doSpec() {
  456. if(getSpec() == 1000 && (!(specEnabled()))) {
  457. openTab(TAB_ATTACK);
  458. clickMouse(645 + random(0, 4), 425 + random(0, 4), true);
  459. wait(random(500, 1000));
  460. } else {
  461. wait(random(50, 100));
  462. }
  463. }
  464.  
  465. public boolean PrayerEnabled() {
  466. return getSetting(1395) > 0;
  467. }
  468.  
  469. public void usePrayer(){
  470. int prayerLevel = skills.getCurrentSkillLevel(STAT_PRAYER);
  471. if(whichPray==0) {
  472. return; }
  473. /*wait(random(700,1000));
  474. openTab(TAB_PRAYER);
  475. wait(random(300, 500));
  476. openTab(TAB_PRAYER);
  477. wait(random(300, 500));*/
  478. if(whichPray==1) {//Strength prayer (melee)
  479. if (!PrayerEnabled()) {
  480. clickMouse(random(715, 752), random(60, 80), true);
  481. }
  482. /*else if(prayerLevel >=13 && prayerLevel <=30) {
  483. clickMouse(599+random(0,5), 268+random(0,5), true);
  484. }
  485. else if(prayerLevel >=31) {
  486. clickMouse(712+random(0,5), 306+random(0,5), true);
  487. }*/
  488. }
  489. else if(whichPray==2) {//Range prayer
  490. if(prayerLevel >=8 && prayerLevel <=25) {
  491. clickMouse(673+random(0,5), 226+random(0,5), true);
  492. }
  493. else if(prayerLevel >=26 && prayerLevel <=43) {
  494. clickMouse(599+random(0,5), 298+random(0,5), true);
  495. }
  496. else if(prayerLevel >=44) {
  497. clickMouse(559+random(0,5), 374+random(0,5), true);
  498. }
  499. }
  500. else if(whichPray==3) {//Magic prayer
  501. if(prayerLevel >=9 && prayerLevel <= 26) {
  502. clickMouse(709+random(0,5), 228+random(0,5), true);
  503. }
  504. else if(prayerLevel >=27 && prayerLevel <= 44) {
  505. clickMouse(634+random(0,5), 306+random(0,5), true);
  506. }
  507. else if(prayerLevel <=45) {
  508. clickMouse(599+random(0,5), 375+random(0,5), true);
  509. }
  510. }
  511. return;
  512. }
  513.  
  514. public void antiBan(){
  515. int t;
  516. int u;
  517. t = random(0,9);
  518. u = random(0,15);
  519. if( u == 9 ){
  520. try{
  521. switch(t){
  522. case 8://Random mouse
  523. moveMouse(0 + random(0, 500), 0 + random(0, 500));
  524. break;
  525. case 4://Does special attack if possible
  526. if(specYes)
  527. doSpec();
  528. break;
  529. case 2://Random mouse
  530. moveMouse(0 + random(0, 500), 0 + random(0, 500));
  531. break;
  532. case 3://Random player
  533. clickCharacter(getNearestPlayerByLevel(1,130) , "Cancel");
  534. break;
  535. case 1://Spec if possible
  536. if(specYes)
  537. doSpec();
  538. break;
  539. case 5://Max altitude
  540. setMaxAltitude();
  541. break;
  542. case 0://Leave empty
  543. case 7://Random mouse
  544. moveMouse(0 + random(0, 500), 0 + random(0, 500));
  545. break;
  546. case 6://Checks stat you selected in argument
  547. if ( getCurrentTab( ) != TAB_STATS ) {
  548. openTab( TAB_STATS );
  549. if(num==1){
  550. moveMouse(580+random(1, 5),245+random(1, 5));;
  551. }
  552. if(num==2){
  553. moveMouse(580+random(1, 5),270+random(1, 5));;
  554. }
  555. if(num==3){
  556. moveMouse(580+random(1, 5),305+random(1, 5));;
  557. }
  558. if(num==4){
  559. moveMouse(580+random(1, 5),340+random(1, 5));;
  560. }
  561. if(num==5){
  562. moveMouse(580+random(1, 5),370+random(1, 5));;
  563. }
  564. if(num==6){
  565. moveMouse(580+random(1, 5),400+random(1, 5));;
  566. }
  567. if(num==7){
  568. moveMouse(630+random(1, 5),245+random(1, 5));;
  569. }
  570. if(num==0){
  571. moveMouse(580+random(1, 5),270+random(1, 5));;
  572. }
  573. }
  574. break;
  575. }
  576. }catch(Exception e){
  577. e.printStackTrace();
  578. }
  579. }
  580.  
  581. }
  582.  
  583. public boolean findVoid(){
  584. RSNPC squire = getNearestNPCByID(3781);
  585. if(squire != null){
  586. temp = squire.getLocation();
  587. return true;
  588. }else{
  589. return false;
  590. }
  591. }
  592.  
  593. public void makeTile()throws InterruptedException{
  594. findVoid();
  595. startX=temp.getX();
  596. startY=temp.getY();
  597. desX= temp.getX() + 2;
  598. desY= temp.getY() - 14;
  599. centerX=desX;
  600. centerY=desY;
  601. center=new RSTile(centerX,centerY);
  602. center1=new RSTile(centerX,centerY+7);
  603. toCenterTile=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
  604. /* To West Tiles */
  605. startX=desX;
  606. startY=centerY;
  607. desX= startX - 12;
  608. desY=centerY;
  609. centToWestA=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
  610. startX=desX - 4;
  611. desX=desX - 13;
  612. desY=centerY-1;
  613. centToWestB=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
  614. westToSWest=new RSTile(desX+10, desY-9);
  615. /* To East Tiles */
  616. startX=centerX;
  617. startY=centerY;
  618. desX=startX + 12;
  619. desY=startY;
  620. centToEastA=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
  621. startX=desX + 3;
  622. desX=startX + 7;
  623. desY=centerY-4;
  624. centToEastB=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
  625. eastToSEast=new RSTile(desX-7, desY-8);
  626. /* To South Tile */
  627. startX=centerX;
  628. startY=centerY;
  629. desX=startX;
  630. desY=startY - 7;
  631. centToSouth=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
  632. /* To South West Tile */
  633. startX=centerX;
  634. startY=desY- 3;
  635. desX=startX - 8;
  636. desY=startY - 10;
  637. southToWest=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
  638. sWestToSEast=new RSTile(centerX,desY);
  639. /* To South East Tile */
  640. desX=startX + 10;
  641. desY=startY - 10;
  642. southToEast=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
  643. }
  644.  
  645. public int goPortal(int j)throws InterruptedException{
  646. int p;
  647. if(j==0){
  648. log("Choosing Random Portal");
  649. p = random(1,5);
  650. }else{
  651. p=j;
  652. }
  653. if(p==1){
  654. log("Going to West Portal");
  655. RSTilePath towestA = new RSTilePath(randomizePath(centToWestA, 2, 2), this);
  656. towestA.walkToEnd();
  657. while(getMyPlayer().isMoving()){
  658. wait(random(100, 300));
  659. }
  660. openDoor("West");
  661. RSTilePath towestB = new RSTilePath(randomizePath(centToWestB, 2, 2), this);
  662. towestB.walkToEnd();
  663. currentp="west";
  664. }
  665. if(p==2){
  666. log("Going to East Portal");
  667. RSTilePath toEastA = new RSTilePath(randomizePath(centToEastA, 2, 2), this);
  668. toEastA.walkToEnd();
  669. while(getMyPlayer().isMoving()){
  670. wait(random(100, 300));
  671. }
  672. openDoor("East");
  673. RSTilePath toeastB = new RSTilePath(randomizePath(centToEastB, 2, 2), this);
  674. toeastB.walkToEnd();
  675. currentp="east";
  676. }
  677. if(p==3){
  678. log("Going to South-West Portal");
  679. RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this);
  680. ToSouth.walkToEnd();
  681. while(getMyPlayer().isMoving()){
  682. wait(random(100, 300));
  683. }
  684. openDoor("South");
  685. RSTilePath toSouthWest = new RSTilePath(randomizePath(southToWest, 2, 2), this);
  686. toSouthWest.walkToEnd();
  687. currentp="sWest";
  688. }
  689. if(p==4){
  690. log("Going to South-East Portal");
  691. RSTilePath toSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this);
  692. toSouth.walkToEnd();
  693. while(getMyPlayer().isMoving()){
  694. wait(random(100, 300));
  695. }
  696. openDoor("South");
  697. RSTilePath toSouthEast = new RSTilePath(randomizePath(southToEast, 2, 2), this);
  698. toSouthEast.walkToEnd();
  699. currentp="sEast";
  700. }
  701.  
  702. return random(200,400);
  703. }
  704.  
  705. /*public boolean atDoor(RSObject door, String action){
  706. if(door == null)
  707. return false;
  708. int x = (door.getLocation().getX() - Bot.getClient().getBaseX()) * 128 + 64;
  709. int y = (door.getLocation().getY() - Bot.getClient().getBaseY()) * 128 + 64;
  710. Point p = Calculations.worldToScreen(x + random(-40,-64), y + random(52,-64), random(0,210));
  711. moveMouse(p);
  712. if(!menuContains(action)){
  713. wait(random(1500, 2000));
  714. log("action not found retrying");
  715. return atDoor(door, action);
  716. } else {
  717. if(getMenuItems().get(0).contains(action)){
  718. clickMouse(true);
  719. return true;
  720. } else {
  721. return atMenu(action);
  722. }
  723. }
  724. }
  725.  
  726. public boolean menuContains(String item) {
  727. try {
  728. for (String s : getMenuItems()) {
  729. if (s.toLowerCase().contains(item.toLowerCase()))
  730. return true;
  731. }
  732. } catch (Exception e) {
  733. return menuContains(item);
  734. }
  735. return false;
  736. }*/
  737.  
  738. public int openDoor(String j) {
  739. /*RSObject temp = getNearestObjectByID(door);
  740. if(door == null){
  741. return (random(50, 100));
  742. }else{
  743. wait(random(100, 200));
  744. if(getNearestObjectByID(door) != null) {
  745. if(j == "West") {
  746. j="w";
  747. }
  748. else if(j == "East") {
  749. j="e";
  750. }
  751. else if(j == "South") {
  752. j="s";
  753.  
  754. }
  755. setCompass(j.toCharArray()[0]);
  756. if(atDoor(getNearestObjectByID(door).getID(), j.toCharArray()[0])) {
  757. wait(2000);
  758. }
  759. }*/
  760. return (random(100, 200));
  761. }
  762.  
  763.  
  764. public int goFromPortal(int p)throws InterruptedException{
  765. if(currentp=="west"){
  766. if(p==2){
  767. log("Going to East Portal");
  768. walkToCenter();
  769. goPortal(p);
  770. currentp="east";
  771. }
  772. if(p==3){
  773. log("Going to South-West Portal");
  774. stayNearPortal();
  775. myWalkTile(westToSWest,1);
  776. while(getMyPlayer().isMoving()){
  777. wait(random(100, 300));
  778. }
  779. myWalkTile(southToWest[1],1);
  780. currentp="sWest";
  781. }
  782. if(p==4){
  783. log("Going to South-East Portal");
  784. stayNearPortal();
  785. myWalkTile(westToSWest,1);
  786. while(getMyPlayer().isMoving()){
  787. wait(random(100, 300));
  788. }
  789. myWalkTile(southToWest[1],1);
  790. while(getMyPlayer().isMoving()){
  791. wait(random(100, 300));
  792. }
  793. myWalkTile(sWestToSEast,1);
  794. while(getMyPlayer().isMoving()){
  795. wait(random(100, 300));
  796. }
  797. myWalkTile(southToEast[1],1);
  798. wait(random(2800,3000));
  799. while(getMyPlayer().isMoving()){
  800. wait(random(100, 300));
  801. }
  802. currentp="sEast";
  803. }
  804. return random(100,300);
  805. }
  806. if(currentp=="east"){
  807. if(p==1){
  808. log("Going to West Portal");
  809. walkToCenter();
  810. goPortal(p);
  811. }
  812. if(p==4){
  813. log("Going to South-East Portal");
  814. stayNearPortal();
  815. wait(random(300,500));
  816. myWalkTile(eastToSEast,1);
  817. while(getMyPlayer().isMoving()){
  818. wait(random(100, 300));
  819. }
  820. myWalkTile(southToEast[1],1);
  821. currentp="sEast";
  822. }
  823. if(p==3){
  824. log("Going to South-West Portal");
  825. stayNearPortal();
  826. myWalkTile(eastToSEast,1);
  827. while(getMyPlayer().isMoving()){
  828. wait(random(100, 300));
  829. }
  830. myWalkTile(southToEast[1],1);
  831. while(getMyPlayer().isMoving()){
  832. wait(random(100, 300));
  833. }
  834. myWalkTile(sWestToSEast,1);
  835. while(getMyPlayer().isMoving()){
  836. wait(random(100, 300));
  837. }
  838. myWalkTile(southToWest[1],1);
  839. while(getMyPlayer().isMoving()){
  840. wait(random(100, 300));
  841. }
  842. currentp="sWest";
  843. }
  844. return random(200,400);
  845. }
  846. if(currentp=="sWest"){
  847. if(p==1){
  848. log("Going to West Portal");
  849. stayNearPortal();
  850. wait(random(100,300));
  851. myWalkTile(westToSWest,1);
  852. while(getMyPlayer().isMoving()){
  853. wait(random(100, 300));
  854. }
  855. myWalkTile(centToWestB[1],1);
  856. while(getMyPlayer().isMoving()){
  857. wait(random(100, 300));
  858. }
  859. currentp="west";
  860. }
  861. if(p==2){
  862. stayNearPortal();
  863. log("Going to East Portal");
  864. myWalkTile(sWestToSEast,1);
  865. while(getMyPlayer().isMoving()){
  866. wait(random(100, 300));
  867. }
  868. myWalkTile(southToEast[1],1);
  869. while(getMyPlayer().isMoving()){
  870. wait(random(100, 300));
  871. }
  872. myWalkTile(eastToSEast,1);
  873. while(getMyPlayer().isMoving()){
  874. wait(random(100, 300));
  875. }
  876. myWalkTile(centToEastB[1],1);
  877. while(getMyPlayer().isMoving()){
  878. wait(random(100, 300));
  879. }
  880. currentp="east";
  881. wait(random(200, 500));
  882. }
  883. if(p==4){
  884. log("Going to South-East Portal");
  885. stayNearPortal();
  886. myWalkTile(sWestToSEast,1);
  887. while(getMyPlayer().isMoving()){
  888. wait(random(100, 300));
  889. }
  890. myWalkTile(southToEast[1],1);
  891. while(getMyPlayer().isMoving()){
  892. wait(random(100, 300));
  893. }
  894. currentp="sEast";
  895. }
  896. return random(200,400);
  897. }
  898. if(currentp=="sEast"){
  899. if(p==1){
  900. stayNearPortal();
  901. log("Going to West Portal");
  902. myWalkTile(sWestToSEast,1);
  903. while(getMyPlayer().isMoving()){
  904. wait(random(100, 300));
  905. }
  906. myWalkTile(southToWest[1],1);
  907. while(getMyPlayer().isMoving()){
  908. wait(random(100, 300));
  909. }
  910. myWalkTile(westToSWest,1);
  911. while(getMyPlayer().isMoving()){
  912. wait(random(100, 300));
  913. }
  914. myWalkTile(centToWestB[1],1);
  915. while(getMyPlayer().isMoving()){
  916. wait(random(100, 300));
  917. }
  918. currentp="west";
  919. wait(random(200, 500));
  920. }
  921. if(p==2){
  922. stayNearPortal();
  923. log("Going to East Portal");
  924. myWalkTile(eastToSEast,1);
  925. while(getMyPlayer().isMoving()){
  926. wait(random(100, 300));
  927. }
  928. myWalkTile(centToEastB[1],1);
  929. currentp="east";
  930. wait(random(200, 500));
  931. }
  932. if(p==3){
  933. log("Going to South-West Portal");
  934. stayNearPortal();
  935. myWalkTile(sWestToSEast,1);
  936. while(getMyPlayer().isMoving()){
  937. wait(random(100, 300));
  938. }
  939. myWalkTile(southToWest[1],1);
  940. while(getMyPlayer().isMoving()){
  941. wait(random(100, 300));
  942. }
  943. currentp="sWest";
  944. }
  945. return random(100,300);
  946. }
  947. return random(200,400);
  948. }
  949.  
  950. public int walkToCenter()throws InterruptedException{
  951. if(distanceTo(center) < 7){
  952. return -1;
  953. }
  954. if(currentp=="none"){
  955. log("Walking to center");
  956. myWalkTile(center1,3);
  957. while(getMyPlayer().isMoving()){
  958. wait(random(100, 300));
  959. }
  960. wait(random(2000,2500));
  961. myWalkTile(center,1);
  962. while(getMyPlayer().isMoving()){
  963. wait(random(100, 300));
  964. }
  965. wait(random(400,600));
  966. }
  967. if(currentp=="west"){
  968. log("Walking to center");
  969. RSTilePath towestB = new RSTilePath(randomizePath(centToWestB, 2, 2), this);
  970. towestB.walkToStart();
  971. while(getMyPlayer().isMoving()){
  972. wait(random(100, 300));
  973. }
  974. openDoor("East");
  975. while(getMyPlayer().isMoving()){
  976. wait(random(100, 300));
  977. }
  978. RSTilePath towestA = new RSTilePath(randomizePath(centToWestA, 2, 2), this);
  979. towestA.walkToStart();
  980. }
  981. if(currentp=="east"){
  982. log("Walking to center");
  983. RSTilePath toeastB = new RSTilePath(randomizePath(centToEastB, 2, 2), this);
  984. toeastB.walkToStart();
  985. while(getMyPlayer().isMoving()){
  986. wait(random(100, 300));
  987. }
  988. openDoor("West");
  989. while(getMyPlayer().isMoving()){
  990. wait(random(100, 300));
  991. }
  992. RSTilePath toeastA = new RSTilePath(randomizePath(centToEastA, 2, 2), this);
  993. toeastA.walkToStart();
  994. }
  995. if(currentp=="sWest"){
  996. log("Walking to center");
  997. RSTilePath toSouthWest = new RSTilePath(randomizePath(southToWest, 2, 2), this);
  998. toSouthWest.walkToStart();
  999. while(getMyPlayer().isMoving()){
  1000. wait(random(100, 300));
  1001. }
  1002. wait(random(600, 800));
  1003. openDoor("North");
  1004. while(getMyPlayer().isMoving()){
  1005. wait(random(100, 300));
  1006. }
  1007. RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this);
  1008. ToSouth.walkToStart();
  1009. }
  1010. if(currentp=="sEast"){
  1011. log("Walking to center");
  1012. RSTilePath toSouthEast = new RSTilePath(randomizePath(southToEast, 2, 2), this);
  1013. toSouthEast.walkToStart();
  1014. while(getMyPlayer().isMoving()){
  1015. wait(random(100, 300));
  1016. }
  1017. wait(random(600, 800));
  1018. openDoor("North");
  1019. while(getMyPlayer().isMoving()){
  1020. wait(random(100, 300));
  1021. }
  1022. RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this);
  1023. ToSouth.walkToStart();
  1024. }
  1025. return random(200,400);
  1026. }
  1027.  
  1028. public void stayNearPortal()throws InterruptedException{
  1029. if(getMyPlayer().getAnimation() == -1 || !(getMyPlayer().isInCombat())) {
  1030. if(currentp=="west"){
  1031. if(distanceTo(centToWestB[1]) > 5){
  1032. myWalkTile(centToWestB[1],1);
  1033. while(getMyPlayer().isMoving()){
  1034. wait(random(400, 500));
  1035. }
  1036. }
  1037. }
  1038. if(currentp=="east"){
  1039. if(distanceTo(centToEastB[1]) > 5){
  1040. myWalkTile(centToEastB[1],1);
  1041. while(getMyPlayer().isMoving()){
  1042. wait(random(400, 500));
  1043. }
  1044. }
  1045. }
  1046. if(currentp=="sWest"){
  1047. if(distanceTo(southToWest[1]) > 5){
  1048. myWalkTile(southToWest[1],1);
  1049. while(getMyPlayer().isMoving()){
  1050. wait(random(400, 500));
  1051. }
  1052. }
  1053. }
  1054. if(currentp=="sEast"){
  1055. if(distanceTo(southToEast[1]) > 5){
  1056. myWalkTile(southToEast[1],1);
  1057. while(getMyPlayer().isMoving()){
  1058. wait(random(400, 500));
  1059. }
  1060. }
  1061. }
  1062. }
  1063. }
  1064.  
  1065. public boolean newPortal()throws InterruptedException{
  1066. int g;
  1067. int a;
  1068. int b;
  1069. int c;
  1070. int d;
  1071. int e;
  1072. RSInterfaceChild west = RSInterface.getChildInterface(408, 13);
  1073. String wh = west.getText();
  1074. log("West-portal health is at:"+wh);
  1075. RSInterfaceChild east = RSInterface.getChildInterface(408, 14);
  1076. String eh = east.getText();
  1077. log("East-portal health is at:"+eh);
  1078. RSInterfaceChild sWest = RSInterface.getChildInterface(408, 16);
  1079. String sWh = sWest.getText();
  1080. log("South-West portal health is at:"+sWh);
  1081. RSInterfaceChild sEast = RSInterface.getChildInterface(408, 15);
  1082. String sEh = sEast.getText();
  1083. log("South-East portal health is at:"+sEh);
  1084. a=Integer.parseInt(wh);
  1085. b=Integer.parseInt(eh);
  1086. c=Integer.parseInt(sWh);
  1087. d=Integer.parseInt(sEh);
  1088. if(a > b){
  1089. g=a;
  1090. e=1;
  1091. }else{
  1092. g=b;
  1093. e=2;
  1094. }
  1095. if(g < c){
  1096. g=c;
  1097. e=3;
  1098. }
  1099. if(g < d){
  1100. g=d;
  1101. e=4;
  1102. }
  1103. if(a == b && c == d && a==c && b==d){
  1104. g=random(1,4);
  1105. e=g;
  1106. }
  1107. health = g;
  1108. if(health == 0){
  1109. return false;
  1110. }else{
  1111. if(distanceTo(center) < 7 || currentp=="none"){
  1112. walkToCenter();
  1113. goPortal(e);
  1114. }else{
  1115. goFromPortal(e);
  1116. }
  1117. wait(random(600, 900));
  1118. return true;
  1119. }
  1120. }
  1121.  
  1122. public boolean interfaceExists(int inte) {
  1123. return (RSInterface.getInterface(inte).isValid());
  1124. }
  1125.  
  1126. public void setBoat(){
  1127. if(setboat == false){
  1128. if(distanceTo(first) < 2 || distanceTo(firstB) < 2){
  1129. log("Novice");
  1130. bridge = first;
  1131. boat= firstB;
  1132. setboat = true;
  1133. }
  1134. if(distanceTo(second) < 2 || distanceTo(secondB) < 2){
  1135. log("Intermediate");
  1136. bridge = second;
  1137. boat = secondB;
  1138. setboat = true;
  1139. }
  1140. if(distanceTo(third) < 2 || distanceTo(thirdB) < 2){
  1141. log("Veteran");
  1142. bridge = third;
  1143. boat = thirdB;
  1144. setboat = true;
  1145. }
  1146. }
  1147. }
  1148.  
  1149. public void confirm(){
  1150. clickMouse(random(247, 253), random(290,294),true);
  1151. }
  1152.  
  1153. public boolean findV(){
  1154. while(!interfaceExists(267)){
  1155. atNPC2(getNearestNPCByID(Evoid), "Exchange");
  1156. return false;
  1157. }
  1158. return true;
  1159. }
  1160.  
  1161. public boolean spendPoints(){
  1162.  
  1163. if(num==0){
  1164. return true;
  1165. }
  1166.  
  1167. if(distanceTo(voidE) > 5){
  1168.  
  1169. if(bridge==third){
  1170. setCameraRotation(1);
  1171. clickMouse(random(678,685),random(112,117),true);
  1172. wait(random(4000, 5000));
  1173. }
  1174. myWalkTile(voidE,1);
  1175. wait(random(4000, 5000));
  1176. while(getMyPlayer().isMoving()){
  1177. wait(random(500, 900));
  1178. }
  1179. }
  1180. while(getMyPlayer().isMoving()){
  1181. wait(random(1000, 1200));
  1182. }
  1183. while(!findV()){wait(400);};
  1184. wait(random(800,1100));
  1185. if(num==1){//Attack
  1186. log("Buying attack exp");
  1187. clickMouse(random(202,205),random(70,74),true);
  1188. confirm();
  1189. while(!findV()){wait(200);};
  1190. clickMouse(random(202,205),random(70,74),true);
  1191. confirm();
  1192. return true;
  1193. }else if(num==2){//Strength
  1194. log("Buying strength exp");
  1195. clickMouse(random(420,424),random(68,72),true);
  1196. confirm();
  1197. while(!findV()){wait(200);};
  1198. clickMouse(random(420,424),random(68,72),true);
  1199. confirm();
  1200. return true;
  1201. }else if(num==3){//Defence
  1202. log("Buying defence exp");
  1203. clickMouse(random(202,206),random(106,110),true);
  1204. confirm();
  1205. while(!findV()){wait(200);};
  1206. clickMouse(random(202,206),random(106,110),true);
  1207. confirm();
  1208. return true;
  1209. }else if(num==7){//Hitpoints
  1210. log("Buying hitpoints exp");
  1211. clickMouse(random(425,429),random(143,157),true);
  1212. confirm();
  1213. while(!findV()){wait(200);};
  1214. clickMouse(random(425,429),random(143,157),true);
  1215. confirm();
  1216. return true;
  1217. }else if(num==4){//Range
  1218. log("Buying range exp");
  1219. clickMouse(424+random(1,4),104+random(1,4),true);
  1220. confirm();
  1221. while(!findV()){wait(200);};
  1222. clickMouse(424+random(1,4),104+random(1,4),true);
  1223. confirm();
  1224. return true;
  1225. }else if(num==6){//Magic
  1226. log("Buying magic exp");
  1227. clickMouse(random(204,208),random(145,149),true);
  1228. confirm();
  1229. while(!findV()){wait(200);};
  1230. clickMouse(random(204,208),random(145,149),true);
  1231. confirm();
  1232. return true;
  1233. }else if(num==5){//Prayer
  1234. log("Buying prayer exp");
  1235. clickMouse(random(204,208),random(183,187),true);
  1236. confirm();
  1237. while(!findV()){wait(200);};
  1238. clickMouse(random(204,208),random(183,187),true);
  1239. confirm();
  1240. return true;
  1241. }
  1242. return false;
  1243. }
  1244.  
  1245. public int avoidBrawler(RSNPC temp){
  1246. if(temp == null){
  1247. return random(100,300);
  1248. }
  1249. if(getMyPlayer().getAnimation() != -1 || getMyPlayer().isInCombat()) {
  1250. return random(100, 200);
  1251. }
  1252. RSNPC brawler = getNearestNPCByName("Brawler");
  1253. if(brawler==null){
  1254. return -1;
  1255. }
  1256. RSTile brawl = brawler.getLocation();
  1257. int bX= brawl.getX();
  1258. int bY= brawl.getY();
  1259. RSTile player = getMyPlayer().getLocation();
  1260. int pX= player.getX();
  1261. int pY= player.getY();
  1262. RSTile attack = temp.getLocation();
  1263. int aX=attack.getX();
  1264. int aY=attack.getY();
  1265. if(distanceTo(brawler) < 2){
  1266. if(pX==bX+1 || pX==bX-1 || pX==bX){
  1267. if(pX==aX || pX==aX+1 || pX==aX-1){
  1268. RSTile to = new RSTile(pX+random(3,4), pY);
  1269. myWalkTile(to,1);
  1270. while(getMyPlayer().isMoving()){
  1271. wait(random(500, 900));
  1272. }
  1273. RSTile monst= temp.getLocation();
  1274. int tY=monst.getY();
  1275. player = getMyPlayer().getLocation();
  1276. pX= player.getX();
  1277. RSTile too = new RSTile(pX, tY);
  1278. myWalkTile(too,1);
  1279. wait(random(1000, 1100));
  1280. while(getMyPlayer().isMoving()){
  1281. wait(random(500, 900));
  1282. }
  1283. myWalkTile(monst,1);
  1284. while(getMyPlayer().isMoving()){
  1285. wait(random(500, 900));
  1286. }
  1287. return random(100,300);
  1288. }
  1289. }
  1290. if(pY==bY+1 || pY==bY-1 || pY==bY){
  1291. if(pY==aY || pY==aY+1 || pY==aY-1){
  1292. RSTile to = new RSTile(pX, pY+random(3,4));
  1293. myWalkTile(to,1);
  1294. wait(random(1000, 1100));
  1295. while(getMyPlayer().isMoving()){
  1296. wait(random(500, 900));
  1297. }
  1298. RSTile monst= temp.getLocation();
  1299. int tX=monst.getX();
  1300. player = getMyPlayer().getLocation();
  1301. pY= player.getY();
  1302. RSTile too = new RSTile(tX, pY);
  1303. myWalkTile(too,1);
  1304. while(getMyPlayer().isMoving()){
  1305. wait(random(500, 900));
  1306. }
  1307. myWalkTile(monst,1);
  1308. while(getMyPlayer().isMoving()){
  1309. wait(random(500, 900));
  1310. }
  1311. return random(20,100);
  1312. }
  1313. return random(100,300);
  1314. }
  1315. return random(100,300);
  1316. }
  1317. return random (10,20);
  1318. }
  1319.  
  1320. public int extract(String s) {
  1321. int j = s.length()-1;
  1322. while (j >= 0 && Character.isDigit(s.charAt(j))) {
  1323. j--;
  1324. }
  1325. return Integer.parseInt(s.substring(j+1,s.length()));
  1326. }
  1327.  
  1328. public boolean myWalkTile(RSTile theTile, int randomness) { //BY TENAC
  1329. if(theTile == null)
  1330. return false;
  1331. if((distanceTo(theTile)) <= 17) {
  1332. RSTile newTile;
  1333. if(randomness == 0)
  1334. newTile = new RSTile(theTile.getX(), theTile.getY());
  1335. else
  1336. newTile = new RSTile(theTile.getX() + random(-randomness, randomness), theTile.getY() + random(-randomness, randomness));
  1337.  
  1338. if(random(0, 30) == 0)
  1339. turnToTile(newTile, 15);
  1340.  
  1341. if(tileOnScreen(newTile) && random(0, 10) == 0) {
  1342. if(!atTile(newTile, "Walk")) {
  1343. if(!walkTileMM(newTile)) {
  1344. //log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")");
  1345. return false;
  1346. } else {
  1347. return true;
  1348. }
  1349. } else {
  1350. return true;
  1351. }
  1352. } else {
  1353. if(!walkTileMM(newTile)) {
  1354. //log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")");
  1355. return false;
  1356. } else {
  1357. return true;
  1358. }
  1359. }
  1360. } else {
  1361. //log("Tile out of reach: (" + theTile.getX() + ", " + theTile.getY() + ")");
  1362. return false;
  1363. }
  1364. }
  1365.  
  1366. public boolean atNPC2(RSNPC npc, String action) {
  1367. if (npc == null) return false;
  1368. RSTile tile = npc.getLocation();
  1369. if (!tile.isValid()) return false;
  1370. if (distanceTo(tile) > 4) {
  1371. myWalkTile(tile,1);
  1372. wait(750 + random(0, 250));
  1373. while(getMyPlayer().isMoving()) wait(40);
  1374. }
  1375. return clickCharacter2(npc, action);
  1376. }
  1377.  
  1378. public boolean clickCharacter2(RSCharacter c, String action) {
  1379. Point screenLoc = null;
  1380. for (int i = 0; i < 20; i++) {
  1381. screenLoc = c.getScreenLocation();
  1382. if (!c.isValid() || !pointOnScreen(screenLoc)) return false;
  1383.  
  1384. if (getMouseLocation().equals(screenLoc)) break;
  1385. moveMouse(screenLoc);
  1386. }
  1387. screenLoc = c.getScreenLocation();
  1388. if (!getMouseLocation().equals(screenLoc)|| getMyPlayer().getInteracting() != null) return false;
  1389. if (getMenuItems().get(0).toLowerCase().contains(action.toLowerCase())) {
  1390. clickMouse(screenLoc, true);
  1391. return true;
  1392. } else {
  1393. clickMouse(screenLoc, false);
  1394. return atMenu(action);
  1395. }
  1396. }
  1397.  
  1398. public RSTile getInteractingNPCMx() {
  1399. int[] validNPCs = Bot.getClient().getRSNPCIndexArray();
  1400. final org.rsbot.accessors.RSNPC[] npcs = Bot.getClient()
  1401. .getRSNPCArray();
  1402.  
  1403. for (int element : validNPCs) {
  1404. if (npcs[element] == null) {
  1405. continue;
  1406. }
  1407. RSNPC Monster = new RSNPC(npcs[element]);
  1408. try {
  1409. if (Monster.isInteractingWithLocalPlayer()) {
  1410. return Monster.getLocation();
  1411. }
  1412. } catch (Exception e) {
  1413. e.printStackTrace();
  1414. }
  1415. }
  1416. return null;
  1417. }
  1418.  
  1419. private boolean getAnimation() {
  1420. int attackTimer = 750;
  1421. long timer = System.currentTimeMillis();
  1422. while(System.currentTimeMillis() - timer < attackTimer) {
  1423. wait(50);
  1424. if(getMyPlayer().getAnimation() != -1)
  1425. timer = System.currentTimeMillis();
  1426.  
  1427. if(System.currentTimeMillis() - timer > attackTimer) {
  1428. //log("Fight took to long, proberly in-active");
  1429. return false;
  1430. }
  1431. }
  1432. return true;
  1433. }
  1434.  
  1435.  
  1436. public void onRepaint(Graphics g)
  1437. {
  1438. long l = System.currentTimeMillis() - startTime;
  1439. long l1 = l / 1000L;
  1440. long l2 = l1 / 60L;
  1441. long l3 = l2 / 60L;
  1442. int i = (int)l1 % 60;
  1443. int j = (int)l2 % 60;
  1444. int k = (int)l3 % 60;
  1445. StringBuilder stringbuilder = new StringBuilder();
  1446. if(k < 10)
  1447. stringbuilder.append('0');
  1448. stringbuilder.append(k);
  1449. stringbuilder.append(':');
  1450. if(j < 10)
  1451. stringbuilder.append('0');
  1452. stringbuilder.append(j);
  1453. stringbuilder.append(':');
  1454. if(i < 10)
  1455. stringbuilder.append('0');
  1456. stringbuilder.append(i);
  1457. if(isLoggedIn()){
  1458. if(bridge==first){
  1459. points = won*2;
  1460. }
  1461. if(bridge==second){
  1462. points = won*3;
  1463. }
  1464. if(bridge==third){
  1465. points = won*4;
  1466. }
  1467. byte byte0 = 18;
  1468. int i1 = 240;
  1469. g.setColor(Color.GREEN);
  1470. // g.drawString("SmartPC v." + getVersion(), byte0, i1);
  1471. g.setColor(new Color(51, 153, 255, 170));
  1472. g.drawRoundRect(byte0, 240, 175, 65, 20, 20);
  1473. g.fillRoundRect(byte0, 240, 175, 65, 20, 20);
  1474. g.setColor(Color.YELLOW);
  1475. g.drawString((new StringBuilder()).append("Elapsed time: ").append(stringbuilder.toString()).toString(), byte0, i1 += 20);
  1476. g.drawString((new StringBuilder()).append("Games won: ").append(won).append(" games").toString(), byte0, i1 += 15);
  1477. g.drawString((new StringBuilder()).append("Games lost: ").append(lost).append(" games").toString(), byte0, i1 += 15);
  1478. g.drawString((new StringBuilder()).append("Total points: ").append(jpoints).append(" points").toString(), byte0, i1 += 15);
  1479. }
  1480. }
  1481.  
  1482. }
Add Comment
Please, Sign In to add comment