• Log in or sign up for an account here: https://www.sythe.org/login

Pest Control Bots, Scripts, and Macros

Status
Not open for further replies.

drowe23

Newcomer
Joined
Oct 14, 2008
Sythe Gold
0
Messages
19
Sorry I posted this in mini games section too. But I realized it might go here... Does anyone have a pest control bot or script or anything they could share with all of us at Sythe.org? and yes, someone did say cheating!

Im sure many of us would appreciate anything that can help! Thanks
 
SmartPc 4.5

latest.

Code:
import java.awt.*;
import java.util.*;
import com.speljohan.rsbot.script.*;
import com.speljohan.rsbot.bot.*;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.event.listeners.*;
import com.speljohan.rsbot.event.events.*;
import com.speljohan.rsbot.accessors.NPC;
import javax.swing.*;
import java.awt.event.*;
import java.net.*;
import java.io.*;

public class SmartPC extends Script implements PaintListener{    

    public String getName() {  
        return "SmartPC";  
    }

    public double getVersion() {  
        return 4.5;      
    }

    public String getAuthor() {
        return "Jan274";  
    }

    public String getmodifier() {
        return "Cheeseiznice, Exile, Fatality";  
    }
    
    public String getScriptCategory() {
        return "Minigames";
    }
    
    long startTime;
    int state=1;
    int prev=0;
    int portW=0;
    int points=0;
    int won=0;
    int lost=0;
    int health;
    int door[]={14239, 14241, 14235, 14237, 14233, 14235, 14239};
    int portal[]={6150,6151,6152,6153,6142,6143,6144,6145};
    int gangplank[]={14315,25631,25632};
    int centerX=0;
    int centerY=0;
    int num;
    int whichPray;
    int randomInt;
    int GambleInt;
    long lastCheck = -1;
    long timer = System.currentTimeMillis();
    long startIdle = System.currentTimeMillis();
    int checkTime;
    boolean notyet=true;
    boolean u=true;
    boolean setboat=false;
    boolean specYes=false;
    boolean highLevel=false;
    String currentp ="none";
    int jpoints=0;
    int Evoid[]={3788, 3789};

    int startX;
    int startY;
    int desX;
    int desY;
    
    public RSTile bridge;
    public RSTile boat;
    
    RSTile first = new RSTile(2657, 2639);
    RSTile firstB = new RSTile(2661,2639);
    RSTile second = new RSTile(2644,2644);
    RSTile secondB = new RSTile(2640, 2644);
    RSTile third = new RSTile(2638,2653);
    RSTile thirdB = new RSTile(2634, 2653);
    RSTile cache;
    RSTile temp;
    
    //to center
    public RSTile[] toCenterTile;
    //to west
    public RSTile centToWestA[];
    public RSTile centToWestB[];
    //to east
    public RSTile centToEastA[];
    public RSTile centToEastB[];
    //to south door
    public RSTile centToSouth[];
    //to south-east
    public RSTile southToEast[];
    //to south-west
    public RSTile southToWest[];
    
    public RSTile westToSWest;
    
    public RSTile eastToSEast;
    
    public RSTile sWestToSEast;
  
    public RSTile center;
    public RSTile center1;
    public RSTile voidE=new RSTile(2659,2649);
    
    public String getScriptDescription() {
        String html = "";
        html += "<head>\n";
        html += "<style type=\"text/css\">body {background-image: url(\"http://www.myimagehub.com/files/1053/smartpc.gif\")}</style>";
        html += "</head>\n";
        html += "Original script by: " + getAuthor() + "<br>\n";
        html += "'SmartPC' is a modified by Fatality.";
        html += "<br>";
        html += "<h4>Instructions:</h4>-Start script on lander dock (of your choice) at the void outpost.<br>";
        html += "-Make sure you have a working Autologin script in your AntiRandom folder.<br><br>";
        html += "Exchange points for:<br>";
        html += "<input type=\"radio\" name=\"num\" value=\"1\" />ATTACK EXP <input type=\"radio\" name=\"num\" value=\"2\" />STRENGTH EXP ";
        html += "<input type=\"radio\" name=\"num\" value=\"3\" />DEFENCE EXP <input type=\"radio\" name=\"num\" value=\"4\" />RANGE EXP";
        html += "<input type=\"radio\" name=\"num\" value=\"5\" />PRAYER EXP <input type=\"radio\" name=\"num\" value=\"6\" />MAGIC EXP ";
        html += "<input type=\"radio\" name=\"num\" value=\"7\" />HITPOINTS EXP <input type=\"radio\" name=\"num\" value=\"0\" />DO NOT EXCHANGE";
        html += "<br><br>";
        html += "Prayer Setting:<br>";
        html += "<input type=\"radio\" name=\"whichPray\" value=\"0\" />NO PRAYER ";
        html += "<input type=\"radio\" name=\"whichPray\" value=\"1\" />MELEE ";
        html += "<input type=\"radio\" name=\"whichPray\" value=\"2\" />RANGE";
        html += "<input type=\"radio\" name=\"whichPray\" value=\"3\" />MAGE<br><br>";
        html += "Special Attack Setting:<br>";
        html += "<b>Special Attack    ?</b> <select name=\"iWantSpec\"><option selected>No<option>Yes</select> <br>";
        return(html);
    }

    public boolean onStart(Map<String, String>args) {
        startTime = System.currentTimeMillis();
        Bot.getEventManager().addListener(PaintListener.class, this);
        //num=Integer.parseInt(args[0]);
        //whichPray=Integer.parseInt(args[1]);
        //specYes=Integer.parseInt(args[2]);
        num = Integer.parseInt(args.get("num"));
        whichPray = Integer.parseInt(args.get("whichPray"));
        if(num==1){
            log("Points will be exchanged for Attack exp");
        }
            if(num==2){
            log("Points will be exchanged for Strength exp");
        }
            if(num==3){
            log("Points will be exchanged for Defence exp");
        }
            if(num==4){
            log("Points will be exchanged for Range exp");
        }
            if(num==5){
            log("Points will be exchanged for Prayer exp");
        }
            if(num==6){
            log("Points will be exchanged for Magic exp");
        }
            if(num==7){
            log("Points will be exchanged for Hitpoints exp");
        }
            if(args.get("iWantSpec").equals("Yes"))
                log("we will use spec");
            specYes = true;
        return true;  
    }
    
    public void onFinish() {
        log("Script Ended.");
        Bot.getEventManager( ).removeListener(PaintListener.class, this);
    }
    
    

    public int loop(){
        int j;
        if(getMyPlayer().getAnimation() != -1) {
            startIdle = System.currentTimeMillis();
            RSTile lastLocation = getMyPlayer().getLocation();
    if(System.currentTimeMillis() - startIdle >= 10000 && getMyPlayer().getLocation() == lastLocation)
                state = prev;
                        }
             try{
            if(setboat == false){
                setBoat();
            }
                    if (getEnergy() >= 100) {
                setRun(true);
                    }
            /*if (getSetting(Methods.SETTING_AUTO_RETALIATE) != 0) {
                openTab(Methods.TAB_ATTACK);
                wait(random(300,600));
                clickMouse(random(578,708), random(362,398), true);
                wait(random(800, 1000));
            }*/
            setCameraRotation(1);
            if(getMyPlayer().isMoving()){
                return random(400, 500);
            }
            if(state != 2 && findVoid() && distanceTo(temp) < 9){
                makeTile();
                currentp="none";
                while(getMyPlayer().isMoving()){
                    wait(random(500, 900));
                }
                            setRun(true);
                walkToCenter();
                while(getMyPlayer().isMoving()){
                    wait(random(500, 900));
                }
                wait(random(500, 600));
                state=3;
            }
            if(distanceTo(bridge) > 2 && distanceTo(boat) > 2 && distanceTo(bridge) < 20){
                if(distanceTo(bridge) > 17){
                    RSTile bridg = bridge;
                    int bX= bridg.getX();
                    int bY= bridg.getY();
                    RSTile a = new RSTile(bX,bY+5);
                    myWalkTile(a,1);
                    wait(random(3000, 4000));
                    while(getMyPlayer().isMoving()){
                        wait(random(500, 900));
                    }
                }
                myWalkTile(bridge,1);
                wait(2000);
                while(getMyPlayer().isMoving()){
                    wait(random(500, 900));
                }
            }
            if(distanceTo(bridge) < 2){
                notyet=true;
                currentp="none";
                wait(random(1000,1350));
                if(interfaceExists(242) || interfaceExists(211)) {
                    lost++;
                    } else if(interfaceExists(243)){
                    won++; }
                    while(interfaceExists(242) || interfaceExists(211) || interfaceExists(243)) {
                        pressContinue();
                        wait(random(850,1050));
                    }
                

            if(bridge==first){

            if(jpoints >= 100 && (distanceTo(boat) < 2)) {
                log("You reached over 100 points; spending now!");
                spendPoints();
                myWalkTile(bridge,1);
                points=0;
                jpoints=0;
                if(distanceTo(bridge) < 4 || !(interfaceExists(242) || !(interfaceExists(211) || !(interfaceExists(243))))){
                    atObject(findObject(gangplank), "Cross");
                }else{
                    return random(20,100);
                }
                wait(random(700, 1000));
                state=2;
            }
        
        }

                if(bridge==second){

            if(jpoints >= 100){
                log("You reached over 100 points; spending now!");
                spendPoints();
                myWalkTile(bridge,1);
                points=0;
                 jpoints=0;
                if(distanceTo(bridge) < 4){
                    atObject(findObject(gangplank), "Cross");
                }else{
                    return random(20,100);
                }
                wait(random(700, 1000));
                state=2;
            }
        }

            if(bridge==third){

            if(jpoints >= 100){
                log("You reached over 100 points; spending now!");
                spendPoints();
                    setCameraRotation(1);
                    clickMouse(556,74,true);
                    wait(random(4000, 5000));
                myWalkTile(bridge,1);
                points=0;
                jpoints=0;
                if(distanceTo(bridge) < 4){
                    atObject(findObject(gangplank), "Cross");
                }else{
                    return random(20,100);
                }
                wait(random(700, 1000));
                state=2;
            }
        }

                wait(random(700, 1000));
                if(distanceTo(bridge) < 4){
                    atObject(findObject(gangplank), "Cross");
                }else{
                    return random(20,100);
                }
                wait(random(700, 1000));
                state=2;
            }
            switch(state){
            case 0:
                if(getInteractingNPCMx() != null || getAnimation()) {
                    antiBan();
                    wait(250);
                    }else{
                        state = prev;
                    }
                return random(500, 1000);
            case 1:
                if(distanceTo(boat) < 2){
                    state=2;
                }
                return random(20,100);
            case 2:
                if(distanceTo(boat) < 2 || distanceTo(bridge) < 2){
                    RSInterfaceChild a = RSInterface.getChildInterface(407,16);
                    String text = a.getText();
                    jpoints=extract(text);
                    if(jpoints == 240 || jpoints >= 240){
                        log("Ending Script, you have over 240 points");
                        return -1;
                    }
                    return random(20,100);
                }else{
                    setRun(true);
                    RSNPC squire = getNearestNPCByID(3781);
                    usePrayer();
                    if(squire==null){
                        return random(20,100);
                    }
                    makeTile();    
                    if(distanceTo(center) > 30){
                        currentp="none";
                        if(getMyPlayer().isMoving()) {
                            return random(20,100);
                        }
                        walkToCenter();
                        if(getMyPlayer().isMoving()) {
                            return random(20,100);
                        }
                    }
                    state=3;
                }
                return random(20,100);
            case 3:
                RSNPC Atta;
                Atta = getNearestNPCByName("Shifter", "Defiler", "Torcher", "Brawler", "Ravager");
                if(Atta != null && distanceTo(Atta) < 5) {
                    atNPC2(Atta, "Attack");
                    state= 0;
                    prev= 4;
                   return random(20,100);
                }else{
                    state=4;
                    prev=4;
                }
                return random(20,100);
            case 4:
                stayNearPortal();
                RSNPC mons;
                mons = getNearestNPCByName("Spinner");
                avoidBrawler(mons);
                if(mons != null && distanceTo(mons) < 7) {

                    atNPC2(mons, "Attack");
                    state= 0;
                    prev= 4;
                    return random(20,100);    
                }
                stayNearPortal();
                RSNPC Portal;
                Portal = getNearestNPCByID(portal);
                avoidBrawler(Portal);
                if(Portal != null && distanceTo(Portal) < 5){
                    atNPC2(Portal, "Attack");
                    state= 0;
                    prev= 4;    
                return random(20,100);
                }else{
                    state=5;
                }
                return random(20,100);
            case 5:
                stayNearPortal();
                RSNPC monst;
                monst = getNearestNPCByName("Shifter", "Defiler", "Torcher", "Brawler", "Ravager");
                if(monst != null && distanceTo(monst) < 7) {
                    atNPC2(monst, "Attack");
                    state= 0;
                    prev= 4;
                    return random(20,100);  
                }else{
                    stayNearPortal();
                    wait(random(100, 500));
                    state = 6;
                    prev=5;
                }
                return random(20,100);
            case 6:
                if(!(newPortal())){
                    if(distanceTo(bridge) > 2 && distanceTo(boat) > 2 && distanceTo(bridge) < 20){
                        myWalkTile(bridge,1);
                        wait(2000);
                        if(getMyPlayer().isMoving()){
                            return random(20,100);
                        }
                    }
                    return 100;
                }else{
                    state=prev;
                }
                return random(20,100);
            }
        }catch(Exception e){
            e.printStackTrace();
        }
       return random(20,100);
    }
    
    public void setMaxAltitude() {
           Bot.getInputManager().pressKey((char) 38);
           wait(random(500,1000));
           Bot.getInputManager().releaseKey((char) 38);
    }
    
    public void pressContinue(){
        clickMouse(254+random(0,20), 455+random(0,4), true);
    }
    
    
public int getSpec() {
return getSetting(300);
}
    
public boolean specEnabled() {
return (getSetting(301)) == 1;
}

public void doSpec() {
    if(getSpec() == 1000 && (!(specEnabled()))) {    
    openTab(Methods.TAB_ATTACK);    
        clickMouse(645+random(0,4), 425+random(0,4), true);
    }
    return;
}

public void usePrayer(){
int prayerLevel = skills.getCurrentSkillLevel(STAT_PRAYER);
if(whichPray==0) {
return; }
wait(random(700,1000));
openTab(Methods.TAB_PRAYER);
wait(random(300, 500));
openTab(Methods.TAB_PRAYER);
wait(random(300, 500));
if(whichPray==1) {//Strength prayer (melee)
if(prayerLevel >=4 && prayerLevel <=12) {
    clickMouse(599+random(0,5), 228+random(0,5), true);
}
else if(prayerLevel >=13 && prayerLevel <=30) {
    clickMouse(599+random(0,5), 268+random(0,5), true);
}
else if(prayerLevel >=31) {
    clickMouse(712+random(0,5), 306+random(0,5), true);
}
}
else if(whichPray==2) {//Range prayer
if(prayerLevel >=8 && prayerLevel <=25) {
    clickMouse(673+random(0,5), 226+random(0,5), true);    
}
else if(prayerLevel >=26 && prayerLevel <=43) {
    clickMouse(599+random(0,5), 298+random(0,5), true);
}
else if(prayerLevel >=44) {
    clickMouse(559+random(0,5), 374+random(0,5), true);
}
}
else if(whichPray==3) {//Magic prayer
if(prayerLevel >=9 && prayerLevel <= 26) {
    clickMouse(709+random(0,5), 228+random(0,5), true);
}
else if(prayerLevel >=27 && prayerLevel <= 44) {
    clickMouse(634+random(0,5), 306+random(0,5), true);
}
else if(prayerLevel <=45) {
    clickMouse(599+random(0,5), 375+random(0,5), true);
}
}
return;
}
    
    public void antiBan(){
        int t;
        int u;
            t = random(0,9);
            u = random(0,15);
            if( u == 9 ){
            try{
                switch(t){
               case 8://Random mouse
                   moveMouse(0 + random(0, 500), 0 + random(0, 500));
                   break;
               case 4://Does special attack if possible
                   if(specYes)
                    doSpec();
                      break;
               case 2://Random mouse
                   moveMouse(0 + random(0, 500), 0 + random(0, 500));
                   break;
               case 3://Random player
                                  clickCharacter(getNearestPlayerByLevel(1,130) , "Cancel");
                                  break;
               case 1://Spec if possible
                   if(specYes)
                    doSpec();
                      break;
               case 5://Max altitude
                   setMaxAltitude();
                   break;
               case 0://Leave empty
               case 7://Random mouse
                   moveMouse(0 + random(0, 500), 0 + random(0, 500));
                   break;
               case 6://Checks stat you selected in argument
                   if ( getCurrentTab( ) != TAB_STATS ) {
                       openTab( TAB_STATS );
                                  if(num==1){
            moveMouse(580+random(1, 5),245+random(1, 5));;
        }
                                  if(num==2){
            moveMouse(580+random(1, 5),270+random(1, 5));;
        }
                                  if(num==3){
            moveMouse(580+random(1, 5),305+random(1, 5));;
        }
                                  if(num==4){
            moveMouse(580+random(1, 5),340+random(1, 5));;
        }
                                  if(num==5){
            moveMouse(580+random(1, 5),370+random(1, 5));;
        }
                                  if(num==6){
            moveMouse(580+random(1, 5),400+random(1, 5));;
        }
                                  if(num==7){
            moveMouse(630+random(1, 5),245+random(1, 5));;
        }
                                  if(num==0){
            moveMouse(580+random(1, 5),270+random(1, 5));;
        }
                   }
                   break;
                }
            }catch(Exception e){
                e.printStackTrace();
            }
            }
        
    }
    
    public boolean findVoid(){
        RSNPC squire = getNearestNPCByID(3781);
        if(squire != null){
            temp = squire.getLocation();
            return true;
        }else{
            return false;
        }
    }
    
    public void makeTile()throws InterruptedException{
            findVoid();
            startX=temp.getX();
            startY=temp.getY();
            desX= temp.getX() + 2;
            desY= temp.getY() - 14;
            centerX=desX;
            centerY=desY;
            center=new RSTile(centerX,centerY);
            center1=new RSTile(centerX,centerY+7);
            toCenterTile=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
            /* To West Tiles */
            startX=desX;
            startY=centerY;
            desX= startX - 12;
            desY=centerY;
            centToWestA=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
            startX=desX - 4;
            desX=desX - 13;
            desY=centerY-1;
            centToWestB=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
            westToSWest=new RSTile(desX+10, desY-9);
            /* To East Tiles */
            startX=centerX;
            startY=centerY;
            desX=startX + 12;
            desY=startY;
            centToEastA=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
            startX=desX + 3;
            desX=startX + 7;
            desY=centerY-4;
            centToEastB=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
            eastToSEast=new RSTile(desX-7, desY-8);
            /* To South Tile */
            startX=centerX;
            startY=centerY;
            desX=startX;
            desY=startY - 7;
            centToSouth=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
            /* To South West Tile */
            startX=centerX;
            startY=desY- 3;
            desX=startX - 8;
            desY=startY - 10;
            southToWest=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
            sWestToSEast=new RSTile(centerX,desY);
            /* To South East Tile */
            desX=startX + 10;
            desY=startY - 10;
            southToEast=new RSTile[]{new RSTile(startX,startY),new RSTile(desX,desY)};
    }
    
    public int goPortal(int j)throws InterruptedException{
        int p;
        if(j==0){
            log("Choosing Random Portal");
            p = random(1,5);
        }else{
            p=j;
        }
        if(p==1){
            log("Going to West Portal");
                RSTilePath towestA = new RSTilePath(randomizePath(centToWestA, 2, 2), this);
                towestA.walkToEnd();
                while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                }
                openDoor("West");
                RSTilePath towestB = new RSTilePath(randomizePath(centToWestB, 2, 2), this);
                towestB.walkToEnd();
                currentp="west";
        }
        if(p==2){
            log("Going to East Portal");
                RSTilePath toEastA = new RSTilePath(randomizePath(centToEastA, 2, 2), this);
                toEastA.walkToEnd();
                while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                }
                openDoor("East");
                RSTilePath toeastB = new RSTilePath(randomizePath(centToEastB, 2, 2), this);
                toeastB.walkToEnd();
                currentp="east";    
        }
        if(p==3){
            log("Going to South-West Portal");
                RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this);
                ToSouth.walkToEnd();
                while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                }
                openDoor("South");
                RSTilePath toSouthWest = new RSTilePath(randomizePath(southToWest, 2, 2), this);
                toSouthWest.walkToEnd();
                currentp="sWest";
        }
        if(p==4){
            log("Going to South-East Portal");
                RSTilePath toSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this);
                toSouth.walkToEnd();
                while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                }
                openDoor("South");
                RSTilePath toSouthEast = new RSTilePath(randomizePath(southToEast, 2, 2), this);
                toSouthEast.walkToEnd();
                currentp="sEast";        
        }
        
        return random(200,400);
    }
    
public int openDoor(String j) {
        RSObject temp = findObject(door);
        if(door == null){
            return (random(50, 100));
        }else{
            wait(random(100, 200));
            if(findObject(door) != null) {
            if(j == "West") {
                setCompass('w');
            }
            else if(j == "East") {
                setCompass('e');
            }
            else if(j == "South") {
                setCompass('s');
            }
            }
                    if(atDoor(findObject(door), j, "Open")){
                wait(2000);
            }
        }
        return (random(100, 200));
    }

    public int goFromPortal(int p)throws InterruptedException{
        if(currentp=="west"){
                if(p==2){
                    log("Going to East Portal");
                    walkToCenter();
                                    goPortal(p);
                        currentp="east";
                }
                if(p==3){
                    log("Going to South-West Portal");
                    stayNearPortal();
                    myWalkTile(westToSWest,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToWest[1],1);
                    currentp="sWest";
                }
                if(p==4){
                    log("Going to South-East Portal");
                    stayNearPortal();
                    myWalkTile(westToSWest,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToWest[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(sWestToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToEast[1],1);
                    wait(random(2800,3000));
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    currentp="sEast";
                }
                return random(100,300);
            }
            if(currentp=="east"){
                if(p==1){
                    log("Going to West Portal");
                    walkToCenter();
                    goPortal(p);
                }
                if(p==4){
                    log("Going to South-East Portal");
                    stayNearPortal();
                    wait(random(300,500));
                    myWalkTile(eastToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToEast[1],1);
                    currentp="sEast";
                }
                if(p==3){
                    log("Going to South-West Portal");
                    stayNearPortal();
                    myWalkTile(eastToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToEast[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(sWestToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToWest[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    currentp="sWest";
                }
                return random(200,400);
            }
            if(currentp=="sWest"){
                if(p==1){
                    log("Going to West Portal");
                    stayNearPortal();
                    wait(random(100,300));
                    myWalkTile(westToSWest,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(centToWestB[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    currentp="west";
                }
                if(p==2){
                    stayNearPortal();
                    log("Going to East Portal");
                    myWalkTile(sWestToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToEast[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(eastToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(centToEastB[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    currentp="east";
                    wait(random(200, 500));
                }
                if(p==4){
                    log("Going to South-East Portal");
                    stayNearPortal();
                    myWalkTile(sWestToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToEast[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    currentp="sEast";
                }
                return random(200,400);
            }
            if(currentp=="sEast"){
                if(p==1){
                    stayNearPortal();
                    log("Going to West Portal");
                    myWalkTile(sWestToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToWest[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(westToSWest,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(centToWestB[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    currentp="west";
                    wait(random(200, 500));
                }
                if(p==2){
                    stayNearPortal();
                    log("Going to East Portal");
                    myWalkTile(eastToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(centToEastB[1],1);
                    currentp="east";
                    wait(random(200, 500));
                }
                if(p==3){
                    log("Going to South-West Portal");
                    stayNearPortal();
                    myWalkTile(sWestToSEast,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    myWalkTile(southToWest[1],1);
                    while(getMyPlayer().isMoving()){
                        wait(random(100, 300));
                    }
                    currentp="sWest";
                }
                return random(100,300);
            }
            return random(200,400);
    }

    public int walkToCenter()throws InterruptedException{
        if(distanceTo(center) < 7){
            return -1;
        }
        if(currentp=="none"){
            log("Walking to center");
            myWalkTile(center1,3);
            while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
            }
            wait(random(2000,2500));
            myWalkTile(center,1);
            while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
            }
            wait(random(400,600));
        }
         if(currentp=="west"){
             log("Walking to center");
                 RSTilePath towestB = new RSTilePath(randomizePath(centToWestB, 2, 2), this);
                 towestB.walkToStart();
                 while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                 }
                 openDoor("East");
                 while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                 }
                 RSTilePath towestA = new RSTilePath(randomizePath(centToWestA, 2, 2), this);
                 towestA.walkToStart();
         }    
         if(currentp=="east"){
             log("Walking to center");
                 RSTilePath toeastB = new RSTilePath(randomizePath(centToEastB, 2, 2), this);
                 toeastB.walkToStart();
                 while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                }
                 openDoor("West");
                 while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                 }
                 RSTilePath toeastA = new RSTilePath(randomizePath(centToEastA, 2, 2), this);
                 toeastA.walkToStart();        
         }
         if(currentp=="sWest"){
             log("Walking to center");
                 RSTilePath toSouthWest = new RSTilePath(randomizePath(southToWest, 2, 2), this);
                 toSouthWest.walkToStart();
                 while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                }
                 wait(random(600, 800));
                 openDoor("North");
                 while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                 }
                 RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this);
                 ToSouth.walkToStart();
         }
         if(currentp=="sEast"){
             log("Walking to center");
                 RSTilePath toSouthEast = new RSTilePath(randomizePath(southToEast, 2, 2), this);
                 toSouthEast.walkToStart();
                 while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                }
                 wait(random(600, 800));
                 openDoor("North");
                 while(getMyPlayer().isMoving()){
                    wait(random(100, 300));
                 }
                 RSTilePath ToSouth = new RSTilePath(randomizePath(centToSouth, 2, 2), this);
                 ToSouth.walkToStart();  
         }
         return random(200,400);
    }
    
    public void stayNearPortal()throws InterruptedException{
    if(getMyPlayer().getAnimation() == -1 || !(getMyPlayer().isInCombat())) {
        if(currentp=="west"){
            if(distanceTo(centToWestB[1]) > 5){
                myWalkTile(centToWestB[1],1);
                while(getMyPlayer().isMoving()){
                    wait(random(400, 500));
                }
            }
        }
        if(currentp=="east"){
            if(distanceTo(centToEastB[1]) > 5){
                myWalkTile(centToEastB[1],1);
                while(getMyPlayer().isMoving()){
                    wait(random(400, 500));
                }
            }
        }
        if(currentp=="sWest"){
            if(distanceTo(southToWest[1]) > 5){
                myWalkTile(southToWest[1],1);
                while(getMyPlayer().isMoving()){
                    wait(random(400, 500));
                }
            }
        }
        if(currentp=="sEast"){
            if(distanceTo(southToEast[1]) > 5){
                myWalkTile(southToEast[1],1);
                while(getMyPlayer().isMoving()){
                    wait(random(400, 500));
                }
            }
        }
        }
    }
    
    public boolean newPortal()throws InterruptedException{
        int g;
        int a;
        int b;
        int c;
        int d;
        int e;
        RSInterfaceChild west = RSInterface.getChildInterface(408, 13);
        String wh = west.getText();
        log("West-portal health is at:"+wh);
        RSInterfaceChild east = RSInterface.getChildInterface(408, 14);
        String eh = east.getText();
        log("East-portal health is at:"+eh);
        RSInterfaceChild sWest = RSInterface.getChildInterface(408, 16);
        String sWh = sWest.getText();
        log("South-West portal health is at:"+sWh);
        RSInterfaceChild sEast = RSInterface.getChildInterface(408, 15);
        String sEh = sEast.getText();
        log("South-East portal health is at:"+sEh);
        a=Integer.parseInt(wh);
        b=Integer.parseInt(eh);
        c=Integer.parseInt(sWh);
        d=Integer.parseInt(sEh);
        if(a > b){    
            g=a;
            e=1;
        }else{
            g=b;
            e=2;
        }
        if(g < c){
            g=c;
            e=3;
        }
        if(g < d){
            g=d;
            e=4;
        }
        if(a == b && c == d && a==c && b==d){
            g=random(1,4);
            e=g;
        }
        health = g;
        if(health == 0){
            return false;
        }else{
            if(distanceTo(center) < 7 || currentp=="none"){    
                walkToCenter();
                goPortal(e);
            }else{
                goFromPortal(e);
            }
            wait(random(600, 900));
            return true;
        }
    }
    
    public boolean interfaceExists(int inte) {
        return (RSInterface.getInterface(inte).isValid());
    }
    
    public void setBoat(){
        if(setboat == false){
            if(distanceTo(first) < 2 || distanceTo(firstB) < 2){
                log("Novice");
                bridge = first;
                boat= firstB;
                setboat = true;
            }
            if(distanceTo(second) < 2 || distanceTo(secondB) < 2){
                log("Intermediate");
                bridge = second;
                boat = secondB;
                setboat = true;
            }
            if(distanceTo(third) < 2 || distanceTo(thirdB) < 2){
                log("Veteran");
                bridge = third;
                boat = thirdB;
                setboat = true;
            }
        }
    }
    
    public void confirm(){
        clickMouse(random(247, 253), random(290,294),true);
    }
    
    public boolean findV(){
        while(!interfaceExists(267)){        
            atNPC2(getNearestNPCByID(Evoid), "Exchange");
            return false;
        }
            return true;
    }

    public boolean spendPoints(){

        if(num==0){
            return true;
             }    
        
        if(distanceTo(voidE) > 5){

            if(bridge==third){
            setCameraRotation(1);
            clickMouse(random(678,685),random(112,117),true);
            wait(random(4000, 5000));
        }
            myWalkTile(voidE,1);
            wait(random(4000, 5000));
            while(getMyPlayer().isMoving()){
                wait(random(500, 900));
            }
        }
        while(getMyPlayer().isMoving()){
            wait(random(1000, 1200));
        }
        while(!findV()){wait(400);};
        wait(random(800,1100));
        if(num==1){//Attack
            log("Buying attack exp");
            clickMouse(random(202,205),random(70,74),true);
            confirm();
            while(!findV()){wait(200);};
            clickMouse(random(202,205),random(70,74),true);
            confirm();
            return true;
        }else if(num==2){//Strength
            log("Buying strength exp");
            clickMouse(random(420,424),random(68,72),true);
            confirm();
            while(!findV()){wait(200);};
            clickMouse(random(420,424),random(68,72),true);
            confirm();
            return true;
        }else if(num==3){//Defence
            log("Buying defence exp");
            clickMouse(random(202,206),random(106,110),true);
            confirm();
            while(!findV()){wait(200);};
            clickMouse(random(202,206),random(106,110),true);
            confirm();
            return true;
        }else if(num==7){//Hitpoints
            log("Buying hitpoints exp");
            clickMouse(random(425,429),random(143,157),true);
            confirm();
            while(!findV()){wait(200);};
            clickMouse(random(425,429),random(143,157),true);
            confirm();
            return true;
        }else if(num==4){//Range
            log("Buying range exp");
            clickMouse(424+random(1,4),104+random(1,4),true);
            confirm();
            while(!findV()){wait(200);};
            clickMouse(424+random(1,4),104+random(1,4),true);
            confirm();
            return true;
        }else if(num==6){//Magic
            log("Buying magic exp");
            clickMouse(random(204,208),random(145,149),true);
            confirm();
            while(!findV()){wait(200);};
            clickMouse(random(204,208),random(145,149),true);
            confirm();
            return true;
        }else if(num==5){//Prayer
            log("Buying prayer exp");
            clickMouse(random(204,208),random(183,187),true);
            confirm();
            while(!findV()){wait(200);};
            clickMouse(random(204,208),random(183,187),true);
            confirm();
            return true;
        }
        return false;
    }
            
    public int avoidBrawler(RSNPC temp){
        if(temp == null){
            return random(100,300);
        }
        if(getMyPlayer().getAnimation() != -1 || getMyPlayer().isInCombat()) {
            return random(100, 200);
        }
        RSNPC brawler = getNearestNPCByName("Brawler");
        if(brawler==null){
            return -1;
        }
        RSTile brawl = brawler.getLocation();
        int bX= brawl.getX();
        int bY= brawl.getY();
        RSTile player = getMyPlayer().getLocation();
        int pX= player.getX();
        int pY= player.getY();
        RSTile attack = temp.getLocation();
        int aX=attack.getX();
        int aY=attack.getY();
        if(distanceTo(brawler) < 2){
            if(pX==bX+1 || pX==bX-1 || pX==bX){
                if(pX==aX || pX==aX+1 || pX==aX-1){
                    RSTile to = new RSTile(pX+random(3,4), pY);
                    myWalkTile(to,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(500, 900));
                    }
                    RSTile monst= temp.getLocation();
                    int tY=monst.getY();
                    player = getMyPlayer().getLocation();
                    pX= player.getX();
                    RSTile too = new RSTile(pX, tY);
                    myWalkTile(too,1);
                    wait(random(1000, 1100));
                    while(getMyPlayer().isMoving()){
                        wait(random(500, 900));
                    }
                    myWalkTile(monst,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(500, 900));
                    }
                    return random(100,300);
                }
            }
            if(pY==bY+1 || pY==bY-1 || pY==bY){
                if(pY==aY || pY==aY+1 || pY==aY-1){
                    RSTile to = new RSTile(pX, pY+random(3,4));
                    myWalkTile(to,1);
                    wait(random(1000, 1100));
                    while(getMyPlayer().isMoving()){
                        wait(random(500, 900));
                    }
                    RSTile monst= temp.getLocation();
                    int tX=monst.getX();
                    player = getMyPlayer().getLocation();
                    pY= player.getY();
                    RSTile too = new RSTile(tX, pY);
                    myWalkTile(too,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(500, 900));
                    }
                    myWalkTile(monst,1);
                    while(getMyPlayer().isMoving()){
                        wait(random(500, 900));
                    }
                    return random(20,100);
                }
            return random(100,300);
        }
        return random(100,300);
    }
    return random (10,20);
    }
    
    public int extract(String s) {
        int j = s.length()-1;
        while (j >= 0 && Character.isDigit(s.charAt(j))) {
            j--;
        }
        return Integer.parseInt(s.substring(j+1,s.length()));
    }

public boolean myWalkTile(RSTile theTile, int randomness) { //BY TENAC
        if(theTile == null)
            return false;
        if((distanceTo(theTile)) <= 17) {
            RSTile newTile;
            if(randomness == 0)
                newTile = new RSTile(theTile.getX(), theTile.getY());
            else
                newTile = new RSTile(theTile.getX() + random(-randomness, randomness), theTile.getY() + random(-randomness, randomness));

            if(random(0, 30) == 0)
                turnToTile(newTile, 15);

            if(tileOnScreen(newTile) && random(0, 10) == 0) {
                if(!atTile(newTile, "Walk")) {
                    if(!walkTileMM(newTile)) {
                        //log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")");
                        return false;
                    } else {
                        return true;
                    }
                } else {
                    return true;
                }
            } else {
                if(!walkTileMM(newTile)) {
                    //log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")");
                    return false;
                } else {
                    return true;
                }
            }
        } else {
            //log("Tile out of reach: (" + theTile.getX() + ", " + theTile.getY() + ")");
            return false;
        }
    }
    
    public boolean atNPC2(RSNPC npc, String action) {
        if (npc == null) return false;
        RSTile tile = npc.getLocation();
        if (!tile.isValid()) return false;
        if (distanceTo(tile) > 4) {
            myWalkTile(tile,1);
            wait(750 + random(0, 250));
            while(getMyPlayer().isMoving()) wait(40);
        }
        return clickCharacter2(npc, action);
    }

    public boolean clickCharacter2(RSCharacter c, String action) {
        Point screenLoc = null;
        for (int i = 0; i < 20; i++) {
            screenLoc = c.getScreenLocation();
            if (!c.isValid() || !pointOnScreen(screenLoc))    return false;

            if (getMouseLocation().equals(screenLoc)) break;
            moveMouse(screenLoc);
        }
        screenLoc = c.getScreenLocation();
        if (!getMouseLocation().equals(screenLoc)|| getMyPlayer().getInteracting() != null) return false;
        if (getMenuItems().get(0).toLowerCase().contains(action.toLowerCase())) {
            clickMouse(screenLoc, true);
            return true;
        } else {
            clickMouse(screenLoc, false);
            return atMenu(action);
        }
    }
    
    public RSTile getInteractingNPCMx() {
        int[] validNPCs = Bot.getClient().getNPCIndexArray();
        NPC[] npcs = Bot.getClient().getNPCArray();

        for (int element : validNPCs) {
            if (npcs[element] == null) {
                continue;
            }
            RSNPC Monster = new RSNPC(npcs[element]);
            try {
                    if (Monster.isInteractingWithLocalPlayer()) {
                           return Monster.getLocation();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    
    private boolean getAnimation() {
        int attackTimer = 750;
        long timer = System.currentTimeMillis();
        while(System.currentTimeMillis() - timer < attackTimer) {
            wait(50);
            if(getMyPlayer().getAnimation() != -1)
                timer = System.currentTimeMillis();
            
            if(System.currentTimeMillis() - timer > attackTimer) {
                //log("Fight took to long, proberly in-active");
                return false;
            }
        }
        return true;
    }

    
    public void onRepaint(Graphics g)
    {
        long l = System.currentTimeMillis() - startTime;
        long l1 = l / 1000L;
        long l2 = l1 / 60L;
        long l3 = l2 / 60L;
        int i = (int)l1 % 60;
        int j = (int)l2 % 60;
        int k = (int)l3 % 60;
        StringBuilder stringbuilder = new StringBuilder();
        if(k < 10)
            stringbuilder.append('0');
        stringbuilder.append(k);
        stringbuilder.append(':');
        if(j < 10)
            stringbuilder.append('0');
        stringbuilder.append(j);
        stringbuilder.append(':');
        if(i < 10)
            stringbuilder.append('0');
        stringbuilder.append(i);
        if(isLoggedIn()){
        if(bridge==first){
            points = won*2;
        }
        if(bridge==second){
            points = won*3;
        }
        if(bridge==third){
            points = won*4;
        }
            byte byte0 = 18;
            int i1 = 240;
            g.setColor(Color.GREEN);
            g.drawString("SmartPC v." + getVersion(), byte0, i1);
            g.setColor(Color.WHITE);
            g.drawString((new StringBuilder()).append("Elapsed time: ").append(stringbuilder.toString()).toString(), byte0, i1 += 20);
            g.drawString((new StringBuilder()).append("Games won: ").append(won).append(" games").toString(), byte0, i1 += 15);
            g.drawString((new StringBuilder()).append("Games lost: ").append(lost).append(" games").toString(), byte0, i1 += 15);
        g.drawString((new StringBuilder()).append("Total points: ").append(jpoints).append(" points").toString(), byte0, i1 += 15);
        }
    }

}
 
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top