rendered paste bodyimport java.awt.*;import java.awt.event.*;import java.io.*;import java.net.*;import java.util.*;import java.util.List;import java.lang.*;import com.speljohan.rsbot.bot.*;import com.speljohan.rsbot.event.events.*;import com.speljohan.rsbot.event.listeners.*;import com.speljohan.rsbot.accessors.*;import com.speljohan.rsbot.account.*;import com.speljohan.rsbot.bot.*;import com.speljohan.rsbot.script.wrappers.*;import com.speljohan.rsbot.script.*;import java.lang.Character;public class TG_Ultra_PC extends Script implements PaintListener { public String getName() { return "TG Ultra PC"; } public double getVersion() { return 1.0; } public String getAuthor() { return "The Black Tux"; } public String getScriptCategory() { return "The Black Tux"; } 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 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 specNum = 1; int jpoints = 0; int attackXp, strengthXp, defenceXp, rangeXp, prayXp; int[] Evoid = new int[] { 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 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); float avarageXpAHour(long timePassed, String skill, int startXp) { long tempTime = timePassed / 60 / 60; float avgTime = (float)tempTime / (skills.getCurrentSkillExp(Skills.getStatIndex("skill")) - startXp); return 1000 / avgTime; } 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 += "<center><font size=\"+1\"><b>" + getName() + " v" + getVersion() + " by " + getAuthor() + "</b></font></center>"; html += "<br><br>"; html += "<b>Instructions:</b><br>-Start script on lander dock (of your choice) at the void outpost.<br><br>"; html += "<b>Exchange points for:</b><br>"; html += "<input type=\"radio\" name=\"num\" value=\"1\" /> Atttack 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\" /> Ranged EXP<br>"; 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\" /> Don't Exchange"; html += "<br><br>"; html += "<b>Prayer Setting:</b><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\" /> Ranged "; html += "<input type=\"radio\" name=\"whichPray\" value=\"3\" /> Mage<br><br>"; html += "<b>Special Attack Setting:</b><br>"; html += "Use Special Attack <select name=\"iWantSpec\"><option selected>No<option>Yes</select> How many Specials? <select name=\"hManySpec\"><option selected>1<option>2<option>3<option>4</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")); attackXp = skills.getCurrentSkillExp(Skills.getStatIndex("attack")); strengthXp = skills.getCurrentSkillExp(Skills.getStatIndex("strength")); defenceXp = skills.getCurrentSkillExp(Skills.getStatIndex("defence")); rangeXp = skills.getCurrentSkillExp(Skills.getStatIndex("range")); prayXp = skills.getCurrentSkillExp(Skills.getStatIndex("prayer")); if(num==0){ log("Points will NOT be exchanged, running till 240"); } 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"); } specYes = false; if(args.get("iWantSpec").equals("Yes")) { specYes = true; for(int i = 1;i<=4;i++) { if(args.get("hManySpec").equals("" + i)) specNum = i; else continue; } log("We are using " + specNum + " specials"); } return true; } public void onFinish() { log("Script Ended."); Bot.getEventManager( ).removeListener(PaintListener.class, this); } public int loop(){ if(getMyPlayer().getAnimation() != -1) { startIdle = System.currentTimeMillis(); RSTile lastLocation = getMyPlayer().getLocation(); if(System.currentTimeMillis() - startIdle >= 10000 && getMyPlayer().getLocation() == lastLocation) state = prev; } if(getDestination() != null && !getMyPlayer().isMoving() && getMyPlayer().getInteracting() == null) { startIdle = System.currentTimeMillis(); RSTile lastLocation = getMyPlayer().getLocation(); wait: while(System.currentTimeMillis() - startIdle < 3000 && getMyPlayer().getLocation() == lastLocation && getDestination() != null && !getMyPlayer().isMoving()) { wait(15); } walkTileMM(randomizeTile(getMyPlayer().getLocation(),5,5)); } 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)); }*/ doSpec(); 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) < 5){ 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 && !(inArea(2660, 2638, 2663, 2643)) && (!(num==0))){ log("You reached over 100 points; spending now!"); spendPoints(); myWalkTile(bridge,1); points=0; jpoints=0; RSObject gangplank = findObject( new int[ ] {14315,25631,25632} ); if(gangplank != null && distanceTo(bridge) < 4 || !(interfaceExists(242) || !(interfaceExists(211) || !(interfaceExists(243))))){ clickMouse(Calculations.tileToScreen(gangplank.getLocation()),true); }else{ return random(20,50); } wait(random(700, 1000)); state=2; } } if(bridge==second){ if(jpoints >= 100 && !(inArea(2638, 2642, 2641, 2647)) && (!(num==0))){ log("You reached over 100 points; spending now!"); spendPoints(); myWalkTile(bridge,1); points=0; jpoints=0; RSObject gangplank = findObject( new int[ ] {14315,25631,25632} ); if(gangplank != null && distanceTo(bridge) < 4 || !(interfaceExists(242) || !(interfaceExists(211) || !(interfaceExists(243))))){ clickMouse(Calculations.tileToScreen(gangplank.getLocation()),true); }else{ return random(20,50); } wait(random(700, 1000)); state=2; } } if(bridge==third){ if(jpoints >= 100 && !(inArea(2632, 2649, 2635, 2654)) && (!(num==0))){ 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; RSObject gangplank = findObject( new int[ ] {14315,25631,25632} ); if(gangplank != null && distanceTo(bridge) < 4 || !(interfaceExists(242) || !(interfaceExists(211) || !(interfaceExists(243))))){ clickMouse(Calculations.tileToScreen(gangplank.getLocation()),true); }else{ return random(20,50); } wait(random(700, 1000)); state=2; } } wait(random(700, 1000)); RSObject gangplank = findObject( new int[ ] {14315,25631,25632} ); if ( gangplank != null && distanceTo(bridge) <= 5 ) { clickMouse(Calculations.tileToScreen(gangplank.getLocation()),true); }else{ return random(20,50); } wait(random(700, 1000)); state=2; } switch(state) { case 0: if(getInteractingNPCMx() != null || getAnimation(900)) { antiBan(); wait(250); }else{ state = prev; } return random(250, 500); case 1: if(distanceTo(boat) < 2){ state=2; } return random(20,50); 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,50); }else{ setRun(true); RSNPC squire = getNearestNPCByID(3781); usePrayer(); if(squire==null){ return random(20,50); } makeTile(); if(distanceTo(center) > 30){ currentp="none"; if(getMyPlayer().isMoving()) { return random(20,50); } walkToCenter(); if(getMyPlayer().isMoving()) { return random(20,50); } } state=3; } return random(20,50); case 3: /*RSNPC Atta; Atta = getNearestNPCByName("Shifter", "Defiler", "Torcher", "Brawler", "Ravager"); if(Atta != null && distanceTo(Atta) < 5) { atNPC2(Atta, "Attack");*/ if(attackNearestNpc()) { state= 0; prev= 4; return random(20,50); } else { state=4; prev=4; } return random(20,50); case 4: stayNearPortal(); if(attackNearestNpc()) { /*RSNPC mons; mons = getNearestNPCByName("Spinner"); avoidBrawler(mons); if(mons != null && distanceTo(mons) < 7) { atNPC2(mons, "Attack");*/ state= 0; prev= 4; return random(20,50); } RSNPC Portal; stayNearPortal(); Portal = getNearestNPCByID(portal); avoidBrawler(Portal); if(Portal != null && distanceTo(Portal) < 5){ attackNPC(Portal); state= 0; prev= 4; return random(20,50); }else{ state=5; } return random(20,50); case 5: stayNearPortal(); if(attackNearestNpc()) { /* 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,50); }else{ stayNearPortal(); wait(random(100, 500)); state = 6; prev=5; } return random(20,50); case 6: if(!(newPortal())){ if(distanceTo(bridge) > 2 && distanceTo(boat) > 2 && distanceTo(bridge) < 20){ myWalkTile(bridge,1); wait(random(250,750)); if(getMyPlayer().isMoving()){ return random(20,50); } } return 100; }else{ state=prev; } return random(20,50); } } catch(Exception e) { e.printStackTrace(); } return random(20,50); } public void setMaxAltitude() { Bot.getInputManager().pressKey((char) 38); wait(random(400,800)); Bot.getInputManager().releaseKey((char) 38); } public void pressContinue(){ clickMouse(254+random(0,20), 455+random(0,4), true); } public void usePrayer(){ int prayerLevel = skills.getCurrentSkillLevel(STAT_PRAYER); if(whichPray==0) { return; } wait(random(500,750)); 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 int getSpec() { return getSetting(300); } public boolean specEnabled() { return (getSetting(301)) == 1; } public void doSpec() { if(getSpec() >= (1000/specNum) && !(specEnabled()) && getMyPlayer().getInteracting() != null && specYes) { openTab(TAB_ATTACK); clickMouse(645+random(0,4), 425+random(0,4), true); wait(random(500,750)); moveMouse(random(0,750), random(0,750)); } 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 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://Empty 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(random(500,750)); } } 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(1000,1500)); 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(1000,1500)); 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 (!(getAnimation(900))) { 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(); RSInterfaceChild east = RSInterface.getChildInterface(408, 14); String eh = east.getText(); RSInterfaceChild sWest = RSInterface.getChildInterface(408, 16); String sWh = sWest.getText(); RSInterfaceChild sEast = RSInterface.getChildInterface(408, 15); String sEh = sEast.getText(); log("Portal Healths: W = " + wh + " | " + "E = " + eh + " | " + "S-W = " + sWh + " | " + "S-E = " + 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) < 4 || distanceTo(firstB) < 4){ log("We have chosen Novice boat"); bridge = first; boat= firstB; setboat = true; } if(distanceTo(second) < 4 || distanceTo(secondB) < 4){ log("We have chosen Intermediate boat"); bridge = second; boat = secondB; setboat = true; } if(distanceTo(third) < 4 || distanceTo(thirdB) < 4){ log("We have chosen Veteran boat"); 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(1500, 3000)); } myWalkTile(voidE,1); wait(random(1500, 3000)); while(getMyPlayer().isMoving()){ wait(random(500, 900)); } } while(getMyPlayer().isMoving()){ wait(15); } 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().getInteracting() != null) { 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,50); } 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 atTileModified(RSTile tile, String action) { try { Point location = Calculations.tileToScreen(tile); if (location.x == -1 || location.y == -1) return false; moveMouse(random(2,5), location.x+random(-5,5), location.y+random(-5,5), 0, 0); if (getMenuItems().get(0).toLowerCase().contains(action.toLowerCase())) { clickMouse(true); } else { clickMouse(false); if(!atMenu(action)) return false; } waitUntilNotMoving(); return true; } catch (Exception e) { return false; } } public void waitUntilNotMoving() { wait(random(700, 1000)); while(getMyPlayer().isMoving()) wait(random(25, 100)); } private boolean inArea (int x1, int y1, int x2, int y2) { int CurX, CurY; CurX = getMyPlayer().getLocation().getX(); CurY = getMyPlayer().getLocation().getY(); if (x1 < x2 && y1 < y2) { if (CurX >= x1 && CurY >= y1 && CurX <= x2 && CurY <= y2){ return true; } else return false; } return false; } 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(!atTileModified(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 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; } public RSNPC getNearestNPCByNameMx(String... names) { int Dist = 20; RSNPC closest = null; 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 { for (String name : names) { if (!name.equals(Monster.getName()) || Monster.getHPPercent() < 1) { continue; } int distance = distanceTo(Monster); if (distance < Dist) { Dist = distance; closest = Monster; } } } catch (Exception e) { e.printStackTrace(); } } return closest; } private boolean getAnimation(int attackTimer) { 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"); break; } } 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(200 + random(0, 250)); while(getMyPlayer().isMoving()) wait(40); } return clickCharacterMx(npc, action); } public boolean attackNPC(RSNPC npc) { if (npc == null) return false; RSTile tile = npc.getLocation(); if (!tile.isValid()) return false; if (distanceTo(tile) > 4) { myWalkTile(tile, 2); wait(200 + random(0, 250)); while(getMyPlayer().isMoving()) wait(20); } return clickCharacterMx(npc, "attack"); } public boolean clickCharacterMx(RSNPC c, String action) { if(c == null) { return false; } RSTile tile = c.getLocation(); if (!tile.isValid()) { return false; } try{ Point screenLoc = c.getScreenLocation(); if (distanceTo(tile) > 5 || !pointOnScreen(screenLoc)) { turnToTile(tile, 40); } for (int i = 0; i < 25; i++) { screenLoc = c.getScreenLocation(); if (!c.isValid() || !pointOnScreen(screenLoc)) { return false; } moveMouse(random(1,3), screenLoc.x+random(-5,5), screenLoc.y+random(-5,5), 0, 0); if (getMenuItems().get(0).toLowerCase().contains(c.getName().toLowerCase())) { break; } if (getMouseLocation().equals(screenLoc)) { break; } } List<String> items = getMenuItems(); if (items.size() <= 1 || items.isEmpty()) { return false; } for (int a = 0; a < items.size(); a++) { if (items.get(a).toLowerCase().contains(c.getName().toLowerCase())) { if (items.get(0).toLowerCase().contains(action.toLowerCase())) { clickMouse(true); return true; } else { clickMouse(false); return atMenu(action); } } } } catch (Exception e) { return false; } return false; } boolean attackNearestNpc() { RSNPC NPCs = getNearestNPCByNameMx("Brawler", "Defiler", "Ravager", "Shifter", "Spinner", "Torcher"); if(NPCs != null) { if(getInteractingNPCMx() != null) { //log("A NPC is attacking/interacting with us."); walkTo(getInteractingNPCMx()); atTileModified(getInteractingNPCMx(), "attack"); while(getMyPlayer().isMoving() || getAnimation(900)) wait(20); } if(attackNPC(NPCs) != false) { //log("We succesfully attacking a NPC!"); while(getMyPlayer().isMoving() || getAnimation(900)) wait(20); return true; } } else { return false; } return false; } private static int[] xpTable = { 0, 0, 83, 174, 276, 388, 512, 650, 801, 969, 1154, 1358, 1584, 1833, 2107, 2411, 2746, 3115, 3523, 3973, 4470, 5018, 5624, 6291, 7028, 7842, 8740, 9730, 10824, 12031, 13363, 14833, 16456, 18247, 20224, 22406, 24815, 27473, 30408, 33648, 37224, 41171, 45529, 50339, 55649, 61512, 67983, 75127, 83014, 91721, 101333, 111945, 123660, 136594, 150872, 166636, 184040, 203254, 224466, 247886, 273742, 302288, 333804, 368599, 407015, 449428, 496254, 547953, 605032, 668051, 737627, 814445, 899257, 992895, 1096278, 1210421, 1336443, 1475581, 1629200, 1798808, 1986068, 2192818, 2421087, 2673114, 2951373, 3258594, 3597792, 3972294, 4385776, 4842295, 5346332, 5902831, 6517253, 7195629, 7944614, 8771558, 9684577, 10692629, 11805606, 13034431 }; private static double round(double val, int places) { long factor = (long)Math.pow(10,places); val = val * factor; long tmp = Math.round(val); return (double)tmp / factor; } private double getPercentToNextLevel(String statName) { int lvl = skills.getRealSkillLevel(Skills.getStatIndex(statName)); if (lvl == 99) return 0; int xpTotal = xpTable[lvl + 1] - xpTable[lvl]; if (xpTotal == 0) return 0; int xpDone = skills.getCurrentSkillExp(Skills.getStatIndex(statName)) - xpTable[lvl]; return round((double) 100 * xpDone / xpTotal, 2); } protected int getMouseSpeed() { return random(2,4); } public void onRepaint(Graphics g) { long l = System.currentTimeMillis() - startTime; long l1 = l / 1000L; long l2 = l1 / 60L; long l3 = l2 / 60L; double hours = l / (1000 * 60 * 60); 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("TG Ultra PC 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); if(attackXp != skills.getCurrentSkillExp(Skills.getStatIndex("attack"))) { g.drawString("Gained " + (skills.getCurrentSkillExp(Skills.getStatIndex("attack")) - attackXp) + " attack xp", byte0, i1 += 15); //g.drawString("Avg. XP per hour: " + avarageXpAHour(startTime, "attack", attackXp), byte0, i1 += 15); } if(strengthXp != skills.getCurrentSkillExp(Skills.getStatIndex("strength"))) { g.drawString("Gained " + (skills.getCurrentSkillExp(Skills.getStatIndex("strength")) - strengthXp) + " strength xp", byte0, i1 += 15); //g.drawString("Avg. XP per hour: " + avarageXpAHour(startTime, "strength", strengthXp), byte0, i1 += 15); } if(defenceXp != skills.getCurrentSkillExp(Skills.getStatIndex("defence"))) { g.drawString("Gained " + (skills.getCurrentSkillExp(Skills.getStatIndex("defence")) - defenceXp) + " defence xp", byte0, i1 += 15); //g.drawString("Avg. XP per hour: " + avarageXpAHour(startTime, "defence", defenceXp), byte0, i1 += 15); } } }}