Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Advertising

Paste Description for The Black Tux

TG Ultra Pc - BY THE BLACK TUX
msn: the.black.tux@hotmail.com

The Black Tux
Friday, March 27th, 2009 at 10:25:38pm MDT 

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

Paste Details

advertising

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

worth-right
fantasy-obligation
fantasy-obligation