The Great E
Active Member
- Joined
- Nov 16, 2008
- Sythe Gold
- 0
- Messages
- 216
This is the script and i dont know what to start with in the inv...
Code:
import java.applet.Applet;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Map;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.*;
import java.applet.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import com.speljohan.rsbot.bot.Bot;
import com.speljohan.rsbot.script.Calculations;
import com.speljohan.rsbot.script.Script;
import com.speljohan.rsbot.script.wrappers.*;
import com.speljohan.rsbot.script.InputManager;
import com.speljohan.rsbot.event.listeners.ServerMessageListener;
import com.speljohan.rsbot.event.events.ServerMessageEvent;
public class MageTrainingArena extends Script implements ServerMessageListener, ActionListener {
public double getVersion() {
return 1.07;
}
public String getName() {
return "Mage Training Arena";
}
public String getScriptCategory() {
return "Magic";
}
public String getAuthor() {
return "Bug5532";
}
public boolean onStart(Map<String, String> args) {
Bot.getEventManager().addListener(ServerMessageListener.class, this);
enchant = false;
telegrab = false;
bonefield = false;
alchgame = false;
if (args.get("eSpell").equals("Sapphire")) eSpell=6;
if (args.get("eSpell").equals("Emerald")) eSpell=17;
if (args.get("eSpell").equals("Ruby")) eSpell=30;
if (args.get("eSpell").equals("Diamond")) eSpell=38;
if (args.get("eSpell").equals("Dragonstone")) eSpell=53;
if (args.get("peach") != null) peaches = true;
if (args.get("hop") != null) worldhop = true;
if (args.get("style").equals("enchant"))enchant=true;
if (args.get("style").equals("tele"))telegrab=true;
if (args.get("style").equals("bones"))bonefield=true;
if (args.get("style").equals("alch"))alchgame=true;
if(random(0,1)==1){
objects = greenredO;
items = greenredI;
}else{
objects = blueyellowO;
items = blueyellowI;
}
createAndShowGUI2();
while(check1) {
wait(1000);
}
createAndShowGUI3();
wait(10000);
frame3.setVisible(false);
frame3.dispose();
setting629=getSetting(629);
return true;
}
public void onFinish() {
}
public void serverMessageRecieved(ServerMessageEvent e) {}
public void antiban() {
int anti = random(0,110);
if (anti <= 35){
moveMouse(random(0,764),random(0,501));
}
if (anti >= 36 && anti <= 41 ){
openTab(random(0,12));
}
if (anti >= 42 && anti <= 52){
openTab(TAB_STATS);
wait( random(250,700));
moveMouse(random(556,707),random(230,442));
wait( random(750,1500));
}
if (anti >= 53 && anti <= 63){
setRun(true);
}else {
openTab(TAB_STATS);
wait( random(350,800));
moveMouse(random(556,648),random(230,281));
wait( random(550,1300));
}
if (anti >= 64 && anti <= 110){
int button = random(37,40);
Bot.getInputManager().pressKey((char) button);
wait(random(500, 1500));
Bot.getInputManager().releaseKey((char) button);
}
}
public boolean enchant = false;
public boolean telegrab = false;
public boolean bonefield = false;
public boolean alchgame = false;
public int cosmic = 564;
public int nat = 561;
public int law = 563;
public int oRed = 10802;
public int oBlue = 10801;
public int oGreen = 10800;
public int oYellow = 10799;
public int cRed = 6901;
public int cBlue = 6900;
public int cGreen = 6898;
public int cYellow = 6899;
public int orb = 6902;
public int pot = 10803;
public int dragonstone = 6903;
public int enchantPortal = 10779;
public int[] objects2 = {oRed,oBlue,oGreen,oYellow};
public int[] items2 = {cRed,cBlue,cGreen,cYellow};
public int[] objects = {oBlue,oYellow};
public int[] items = {cBlue,cYellow};
public int[] greenredO ={oRed,oGreen};
public int[] greenredI ={cRed,cGreen};
public int[] blueyellowO={oBlue,oYellow};
public int[] blueyellowI={cBlue,cYellow};
public int[] inven = {0,0,0,0};
public int eSpell = 62;
public boolean worldhop = false;
public int[] membersworlds = {12,15,18,22,23,24,26,27,28,36,39,42,44,45,46,48,51,52,53,54,56,58,59,60,64,65,66,67,68,69,70,71,76,77,78,79,82,83,84,88,89,91,92,97,98,99,100,103,104,110,111,112,114,115,116,117,121,124,130,131,132,133,137,138}; //,143,145,148,151,156,157,158,159,160,162,164,166,168};
public int telegrabPortal = 10778;
public int wall = 10755;
public int[] mazeWalls = {99,53,71,121,106,127,87,122,90,98};
public int statue = 6888;
public int mazeGuard = 3102;
public int endPlatform = 10777;
public int mazeNumber = 20;
public RSTile[] telePoints = {new RSTile(0,0),new RSTile(0,0),new RSTile(0,0),new RSTile(0,0),new RSTile(0,0),new RSTile(0,0),new RSTile(0,0),new RSTile(0,0)};
public int[] maze0setup = {2,4,-3,-1};
public int[] maze1setup = {9,0,0,-1};
public int[] maze2setup = {-4,-2,-9,-8};
public int[] maze3setup = {-9,-9,-9,-10};
public int[] maze4setup = {4,1,0,-5};
public int[] maze5setup = {4,9,0,-1};
public int[] maze6setup = {-1,8,-8,-1};
public int[] maze7setup = {9,-9,0,-10};
public int[] maze8setup = {0,-1,-9,-8};
public int[] maze9setup = {9,0,0,-10};
public int[] mazesetup[] = {maze0setup,maze1setup,maze2setup,maze3setup,maze4setup,maze5setup,maze6setup,maze7setup,maze8setup,maze9setup};
public int[][] order = {{0,3,2,3,2,1,0,3,0,1},{2,3,0,1,2,3,0},{3,0,1,2,3,0,1,2},{1,2,3,2,1,2,3,2,1},{2,1,0,3,0,3,2},{0,1,0,3,0,1,2,1,0,3},{0,3,0,1,0,3,0,1},{3,2,1,2,3,2,3,2},{3,2,3,0,3,0,1,2,1},{0,3,2,3,0,3,2}};
public int setting629;
public int bonePortal = 10781;
public int exitPortal = 10782;
public int[] boneIDs = {6904,6905,6906,6907};
public int[] pickupIDs = {10725,10726,10727,10728};
public int[] foodIDs = {1963,6883};
public int dropoff = 10735;
public int gSpell = 10;
public boolean peaches = false;
public int loop() {
standingStill();
if (findObject(10773) != null) {
if (goTo(new RSTile(3369,3306))){
if(!atTile(new RSTile(3369,3306),"Climb-down")) rotate();
}
return random(500,1000);
}
if(getEnergy() == random(41,56) || getEnergy() > 56) setRun(true);
if(alchgame){}
if (bonefield){
if(!inventoryContains(nat)){
RSObject exitportal = findObject(exitPortal);
if (exitportal!=null){
if(canReach(exitportal,true)){
if (goTo(exitportal)){
atObject(exitportal,"Enter");
}
return random(500,1000);
}
}
log("Out of nature runes.");
return -1;
}
RSObject portal = findObject(bonePortal);
if(canReach(portal, true)){
if (goTo(portal)){
atObject(portal,"Enter");
}
return random(500,1000);
}
if(getInventoryCount(foodIDs)>0&&skills.getCurrentSkillLevel(3)<(skills.getLvlByExp(skills.getCurrentSkillExp(3))*3/10)){
while(true){
for (int i=0;i<foodIDs.length;i++){
if(inventoryContains(foodIDs[i])) clickInventoryItem(foodIDs[i],true);
}
wait1();
if(getInventoryCount(foodIDs)==0||skills.getCurrentSkillLevel(3)>=(skills.getLvlByExp(skills.getCurrentSkillExp(3))*9/10))break;
}
return random(500,1000);
}
RSObject Bdeposit = findNearestObject(10,dropoff);
if (getInventoryCount(foodIDs)>=16){
if (goTo(Bdeposit)){
if(!atObject(Bdeposit,"Deposit")) rotate();
}
return random(500,1000);
}
invSpace();
if (bonesValue()+getInventoryCount(foodIDs)>=spareSpace){
myOpenTab(TAB_MAGIC);
if((peaches&&skills.getCurrentSkillLevel(3)<(skills.getLvlByExp(skills.getCurrentSkillExp(3))*3/10)+6)){
castSpell(42);
}else castSpell(gSpell);
return random(500,1000);
}else{
RSObject bonepile = findNearestObject(10,pickupIDs);
if(bonepile!=null) {
if (goTo(bonepile)){
if (clickObject(bonepile,"Grab Bones")){
standingCount = 0;
}
return random(500,1000);
}
}
}
}
if (telegrab){
if(!inventoryContains(law)){
log("Out of law runes.");
return -1;
}
RSObject portal = findObject(telegrabPortal);
if(canReach(portal, true)){
orderNum=0;
mazeNumber=20;
statOld2 = new RSTile(0,0);
if (goTo(portal)){
if(atObject(portal,"Enter")){
wait3();
setting629=getSetting(629);
}
}
return random(500,1000);
}
RSNPC mazeg = getNearestNPCByID(mazeGuard);
if(mazeg !=null){
goTo(mazeg.getLocation());
while (canContinue()) clickContinue();
if(interfaceExists(228)){
atInterface(228,2);
mazeNumber = 20;
}else{
atNPC(mazeg,"Talk");
}
return random(500,1000);
}
if (mazeNumber == 20){
getMaze();
log("Maze = "+mazeNumber);
if (mazeNumber != 20){
if(getWayRound(mazesetup[mazeNumber])){
return random(500,1000);
}else if(mazeNumber == 9){
if(getWayRound(mazesetup[0])){
mazeNumber = 0;
log("Maze = "+mazeNumber);
return random(500,1000);
}
}
}
goTo(findObject(wall));
log("Failed to setup maze.");
mazeNumber = 20;
return random(500,1000);
}
RSItemTile stat = getGroundItemByID(52,statue);
if(stat!=null && getSetting(629)==setting629){
goTo(stat,7);
if(atTile(stat,"Observe")) {
wait2();
wait2();
wait2();
}
rotate();
return random(500,1000);
}
log("check1");
solveMaze();
}
if (enchant){
if(!inventoryContains(cosmic)){
log("Out of cosmic runes.");
return -1;
}
RSObject portal = findObject(enchantPortal);
RSObject Dpot = findObject(pot);
RSItemTile stone = getGroundItemByID(dragonstone);
if(canReach(portal, true)){
if(random(0,1)==1){
objects = greenredO;
items = greenredI;
}else{
objects = blueyellowO;
items = blueyellowI;
}
if (goTo(portal)){
atObject(portal,"Enter");
}
return random(500,1000);
}
if(stone ==null&& worldhop && !inventoryContains(dragonstone)){
wait3();
RSObject portal2 = findObject(enchantPortal);
if(canReach(portal2, true))return random(500,1000);
if(isLoggedIn()){
mylogout();
}
wait2();
if (!interfaceExists(744)){
return random(500,1000);
}
//int randworld = membersworlds[random(0,membersworlds.length-1)];
World = random(76,150);
while (getInterface(744,46).getText().replace("World ","").length() < 1){
wait1();
}
int tempworld = Integer.parseInt(getInterface(744,46).getText().replace("World ",""));
while (tempworld == Integer.parseInt(getInterface(744,46).getText().replace("World ",""))){
//switchWorld(randworld);
changeWorld();
wait2();
}
//atInterface(774,334);
wait(random(17000,22000));
return random(500,1000);
}
if (stone!=null && !isInventoryFull()) {
RSItemTile stone2=getNearestGroundItemByID(25,dragonstone);
if (stone2 !=null){
if (goTo(stone2)){
if(getMyPlayer().isMoving())return random(200,500);
if(atTile(stone2,"Take")){
log("Got Dragonstone!");
}
}
return random(500,1000);
}
}
enchant();
for (int i=0;i<2;i++){
if(colour[i] == 2) {
if( inventoryContains(items[i])){
log("Number 2: "+i);
return random(500,1000);
}
}
}
if(isInventoryFull() && getInventoryCount(orb) > random(7,9) || getInventoryCount(orb) > 15){
if (goTo(Dpot)){
atObject(Dpot,"Deposit");
}
return random(500,1000);
}
if(getInventoryCount(dragonstone) > 0){
myOpenTab(TAB_MAGIC);
castSpell(eSpell);
if (getCurrentTab() != TAB_INVENTORY) return random(500,1000);
clickInventoryItem(dragonstone,true);
return random(500,1000);
}
if(!isInventoryFull()){
for (int i=0;i<2;i++){
int b = i;
for (int j=0;j<2;j++){
if(colour[j] == 2){
zeroInven();
i = 2;
b = j;
break;
}
}
log("b="+b);
if(getInventoryCount(items[b]) < 4){
inven[b] = objects[b];
}else inven[b] = 0;
}
RSObject ob = findObject(inven);
if(ob != null){
if (goTo(ob)){
while(true){
atObject(ob, "Take");
wait1();
if(getInventoryCount(objectToItem(ob))>4 || isInventoryFull()) break;
}
/*int invCount = getInventoryCount(objectToItem(ob));
if(invCount > 5) invCount=5;
for (int i=0; i<5-invCount; i++){
atObject(ob, "Take");
wait1();
}*/
}
}else log("No Object");
}
}
return random(200,500);
}
public int objectToItem(RSObject o){
for (int i=0;i<2;i++){
if (o.getID() == objects[i]){
return items[i];
}
}
return 0;
}
public int spareSpace=10;
public void invSpace(){
if (getInventoryCount(boneIDs[0])==0 &&
getInventoryCount(boneIDs[1])==0 &&
getInventoryCount(boneIDs[2])==0 &&
getInventoryCount(boneIDs[3])==0 &&
getInventoryCount(foodIDs[0])==0 &&
getInventoryCount(foodIDs[1])==0) {
spareSpace=28-getInventoryCount();
}
}
public int bonesValue(){
int b=getInventoryCount(boneIDs[0]);
int c=getInventoryCount(boneIDs[1])*2;
int d=getInventoryCount(boneIDs[2])*3;
int e=getInventoryCount(boneIDs[3])*4;
return (b+c+d+e);
}
public int picker = 0;
public int[] colour = {0,0,0,0};
public int set625;
public void enchant() {
for (int i=0;i<2;i++){
if(colour[i] == 0 && inventoryContains(items[i])){
picker = i;
break;
}
}
for (int i=0;i<2;i++){
if(colour[i] == 2) {
if( inventoryContains(items[i])){
log("Number 2: "+i);
picker = i;
break;
}
if (getInventoryCount() < 22){
log("Number 2: "+i);
picker = i;
break;
}
}
}
if (colour[picker]==1) zeroColour();
log("Picker = "+picker);
set625=getSetting(625);
log("set1 "+set625);
if(getInventoryCount(items[picker]) > 0){
while(true){
myOpenTab(TAB_MAGIC);
// wait1();
castSpell(eSpell);
// wait1();
if(clickInventoryItem(items[picker],true)){
wait2();
break;
}
}
if (set625<getSetting(625) && colour[picker] != 2) {
log("Colour set as: "+ picker);
zeroColour();
colour[picker] = 2;
}
if (set625==getSetting(625)) {
if (colour[picker] == 2){
zeroColour();
}
colour[picker] = 1;
}
}
log("set2 "+getSetting(625));
}
public void wait1() {
wait(random(150,250));
}
public void wait2() {
wait(random(750,1500));
}
public void wait3() {
wait(random(5500,6500));
}
public void zeroColour(){
for (int i=0;i<2;i++){
colour[i]=0;
}
}
public void zeroInven(){
for (int i=0;i<2;i++){
inven[i]=0;
}
}
public boolean goTo(RSObject t) {
if (t!=null) return goTo(t.getLocation());
return false;
}
public boolean goTo(RSTile t){
return goTo(t,5);
}
// walks in strait line to tile, returns True when within set range of tile.
public boolean goTo(RSTile t,int range) { //New walking method by me(Bug5532).
if (distanceTo(t) < range) return true;
if (distanceTo(t) < 13){
walkTileMM(t);
wait(random(500,1000));
return false;
}
while(true){
t = new RSTile( ((t.getX()+getMyPlayer().getLocation().getX())/2)+random(-1,1) , ((t.getY()+getMyPlayer().getLocation().getY())/2)+random(-1,1) ) ;
if (distanceTo(t) < 15){
walkTileMM(t);
wait(random(500,1000));
break;
}
}
return false;
}
public void myOpenTab(int tab) { // Credit goes to nebule for this!
if (tab == getCurrentTab()) {
return;
}
switch(tab) {
case TAB_ATTACK: input.holdKey((char) KeyEvent.VK_F1, random(300, 700)); break;
case TAB_STATS: input.holdKey((char) KeyEvent.VK_F2, random(300, 700)); break;
case TAB_QUESTS: input.holdKey((char) KeyEvent.VK_F3, random(300, 700)); break;
case TAB_INVENTORY: input.holdKey((char) KeyEvent.VK_F4, random(300, 700)); break;
case TAB_EQUIPMENT: input.holdKey((char) KeyEvent.VK_F5, random(300, 700)); break;
case TAB_PRAYER: input.holdKey((char) KeyEvent.VK_F6, random(300, 700)); break;
case TAB_MAGIC: input.holdKey((char) KeyEvent.VK_F7, random(300, 700)); break;
case TAB_FRIENDS: input.holdKey((char) KeyEvent.VK_F8, random(300, 700)); break;
default: openTab(tab); break;
}
}
public boolean menuContains (String action) {
java.util.List<String> actions = getMenuItems();
for (int j = 0; j < actions.size(); j++) {
if (actions.get(j).contains(action))
return true;
}
return false;
}
public RSItemTile getNearestGroundItemByID( int[] ids) {
return getNearestGroundItemByID(50,ids);
}
public RSItemTile getNearestGroundItemByID( int range, int id) {
int[] j = {id};
return getNearestGroundItemByID(range,j);
}
public RSItemTile getNearestGroundItemByID(int range, int[] ids) {
int pX = getMyPlayer().getLocation().getX();
int pY = getMyPlayer().getLocation().getY();
int minX = pX - range;
int minY = pY - range;
int maxX = pX + range;
int maxY = pY + range;
int dist = 100;
RSItemTile nItem = null;
for (int x = minX; x <= maxX; x++) {
for (int y = minY; y <= maxY; y++) {
if (Calculations.canReach(new RSTile(x,y), false)){
RSItemTile[] items = getGroundItemsAt(x, y);
for (RSItemTile item : items) {
int iId = item.getItem().getID();
for (int id : ids) {
if (iId == id) {
// log(""+id+" at "+x+","+y);
if (distanceTo(new RSTile(x,y)) < dist){
dist = distanceTo(new RSTile(x,y));
nItem = item;
}
}
}
}
}
}
}
return nItem;
}
public RSObject findNearestObject(int range, int id) {
int[] ids= {id};
return findNearestObject(range,ids);
}
public RSObject findNearestObject(int range, int[] ids) {
int minX = getMyPlayer().getLocation().getX() - range;
int minY = getMyPlayer().getLocation().getY() - range;
int maxX = getMyPlayer().getLocation().getX() + range;
int maxY = getMyPlayer().getLocation().getY() + range;
int dist = 100;
RSObject nObject = null;
for (int x = minX; x < maxX; x++) {
for (int y = minY; y < maxY; y++) {
RSObject o = getObjectAt(x, y);
if (o != null) {
for (int id : ids) {
if (o.getID() == id) {
if (distanceTo(new RSTile(x,y)) < dist){
dist = distanceTo(new RSTile(x,y));
nObject = o;
}
}
}
}
}
}
return nObject;
}
public int countObjects(int range, int ids) {
int minX = getMyPlayer().getLocation().getX() - range;
int minY = getMyPlayer().getLocation().getY() - range;
int maxX = getMyPlayer().getLocation().getX() + range;
int maxY = getMyPlayer().getLocation().getY() + range;
int count=0;
for (int x = minX; x < maxX; x++) {
for (int y = minY; y < maxY; y++) {
RSObject o = getObjectAt(x, y);
if (o != null) {
if (o.getID() == ids) {
count++;
}
}
}
}
return count;
}
public void getMaze() {
for (int i=0;i<10;i++){
if (countObjects(52,wall) == mazeWalls[i]){
wait2();
if (countObjects(52,wall) == mazeWalls[i]){
wait2();
if (countObjects(52,wall) == mazeWalls[i]){
wait2();
mazeNumber = i;
break;
}
}
}
}
}
public boolean getWayRound(int[] maze){
RSItemTile a = getGroundItemByID(52,statue);
RSObject b = findObject(52,endPlatform);
if(a==null||b==null)return false;
int xDif = a.getX()-b.getLocation().getX();
int yDif = a.getY()-b.getLocation().getY();
if(xDif == maze[0] && yDif == maze[1]){
telePoints[0]=new RSTile(b.getLocation().getX()+maze[2],b.getLocation().getY()+maze[3]);
telePoints[1]=new RSTile(telePoints[0].getX()+9,telePoints[0].getY());
telePoints[2]=new RSTile(telePoints[1].getX()+1,telePoints[1].getY()+1);
telePoints[3]=new RSTile(telePoints[2].getX(),telePoints[2].getY()+9);
telePoints[4]=new RSTile(telePoints[3].getX()-1,telePoints[3].getY()+1);
telePoints[5]=new RSTile(telePoints[4].getX()-9,telePoints[4].getY());
telePoints[6]=new RSTile(telePoints[5].getX()-1,telePoints[5].getY()-1);
telePoints[7]=new RSTile(telePoints[6].getX(),telePoints[6].getY()-9);
log("Setup Co-ords.");
return true;
}
if(xDif == (maze[0]*-1) && yDif == (maze[1]*-1)){
telePoints[0]=new RSTile(b.getLocation().getX()-maze[2],b.getLocation().getY()-maze[3]);
telePoints[1]=new RSTile(telePoints[0].getX()-9,telePoints[0].getY());
telePoints[2]=new RSTile(telePoints[1].getX()-1,telePoints[1].getY()-1);
telePoints[3]=new RSTile(telePoints[2].getX(),telePoints[2].getY()-9);
telePoints[4]=new RSTile(telePoints[3].getX()+1,telePoints[3].getY()-1);
telePoints[5]=new RSTile(telePoints[4].getX()+9,telePoints[4].getY());
telePoints[6]=new RSTile(telePoints[5].getX()+1,telePoints[5].getY()+1);
telePoints[7]=new RSTile(telePoints[6].getX(),telePoints[6].getY()+9);
log("Setup Co-ords.");
return true;
}
if(xDif == (maze[1]) && yDif == (maze[0]*-1)){
telePoints[0]=new RSTile(b.getLocation().getX()+maze[3],b.getLocation().getY()-maze[2]);
telePoints[1]=new RSTile(telePoints[0].getX(),telePoints[0].getY()-9);
telePoints[2]=new RSTile(telePoints[1].getX()+1,telePoints[1].getY()-1);
telePoints[3]=new RSTile(telePoints[2].getX()+9,telePoints[2].getY());
telePoints[4]=new RSTile(telePoints[3].getX()+1,telePoints[3].getY()+1);
telePoints[5]=new RSTile(telePoints[4].getX(),telePoints[4].getY()+9);
telePoints[6]=new RSTile(telePoints[5].getX()-1,telePoints[5].getY()+1);
telePoints[7]=new RSTile(telePoints[6].getX()-9,telePoints[6].getY());
log("Setup Co-ords.");
return true;
}
if(xDif == (maze[1]*-1) && yDif == (maze[0])){
telePoints[0]=new RSTile(b.getLocation().getX()-maze[3],b.getLocation().getY()+maze[2]);
telePoints[1]=new RSTile(telePoints[0].getX(),telePoints[0].getY()+9);
telePoints[2]=new RSTile(telePoints[1].getX()-1,telePoints[1].getY()+1);
telePoints[3]=new RSTile(telePoints[2].getX()-9,telePoints[2].getY());
telePoints[4]=new RSTile(telePoints[3].getX()-1,telePoints[3].getY()-1);
telePoints[5]=new RSTile(telePoints[4].getX(),telePoints[4].getY()-9);
telePoints[6]=new RSTile(telePoints[5].getX()+1,telePoints[5].getY()-1);
telePoints[7]=new RSTile(telePoints[6].getX()+9,telePoints[6].getY());
log("Setup Co-ords.");
return true;
}
return false;
}
public int oldNum;
public RSTile statOld2 = new RSTile(0,0);
public int orderNum = 0;
public void solveMaze(){
RSItemTile stat2 = getGroundItemByID(52,statue);
RSTile statOld;
// log("check2");
log("orderNum="+orderNum);
log("Direction="+order[mazeNumber][orderNum]);
if(getMyPlayer().getLocation().equals(nextTeleTile())){
if(!statOld2.equals(stat2)){
if(orderNum==0){
statOld2=stat2;
oldNum=0;
}else if(orderNum==oldNum){
orderNum++;
}
statOld2=stat2;
oldNum=orderNum;
}else {
myOpenTab(TAB_MAGIC);
castSpell(21);
if(atTile(stat2,"Cast")){
statOld=stat2;
wait3();
RSItemTile stat3 = getGroundItemByID(52,statue);
if (stat3 != null){
if (statOld.getX()!=stat3.getX()||statOld.getY()!=stat3.getY()) {
log("Statue moved");
orderNum++;
}
}else {
orderNum++;
}
if (orderNum ==order[mazeNumber].length){
log("Maze Complete!");
mazeNumber=20;
orderNum=0;
}
}
}
}else{
// log("check3");
// log("orderNum="+orderNum);
log("X:"+nextTeleTile().getX()+" Y:"+nextTeleTile().getY());
atTile(nextTeleTile(),"Walk");
}
}
public RSTile nextTeleTile(){
if (distanceTo(telePoints[order[mazeNumber][orderNum]*2]) < distanceTo(telePoints[(order[mazeNumber][orderNum]*2)+1]) ){
return telePoints[order[mazeNumber][orderNum]*2];
}
return telePoints[(order[mazeNumber][orderNum]*2)+1];
}
public boolean clickObject(RSObject object, String action) {
return clickTile(object.getLocation(), action);
}
public boolean clickTile(RSTile tile,String action) {
try {
Point location = Calculations.tileToScreen(tile);
if (location.x == -1 || location.y == -1) return false;
moveMouse(location, 3, 3);
wait(random(30,70));
clickMouse(true);
return true;
/*if (getMenuItems().get(0).equals(action)) {
clickMouse(true);
} else {
clickMouse(false);
if (!atMenu(action)) return false;
}
wait(random(500, 1000));
while (true) {
if (!getMyPlayer().isMoving()) break;
wait(random(500, 1000));
}
return true;*/
} catch (Exception e) {
return false;
}
}
public boolean clickInventoryItem(int itemID, boolean click) {
if (getCurrentTab() != TAB_INVENTORY
&& !RSInterface.getInterface(INTERFACE_BANK).isValid()
&& !RSInterface.getInterface(INTERFACE_STORE).isValid()) {
openTab(TAB_INVENTORY);
}
int[] items = getInventoryArray();
java.util.List<Integer> possible = new ArrayList<Integer>();
for (int i = 0; i < items.length; i++) {
if (items[i] == itemID) {
possible.add(i);
}
}
if (possible.size() == 0) return false;
int idx = possible.get(random(0, possible.size()));
Point t = getInventoryItemPoint(idx);
clickMouse(t, 5, 5, click);
return true;
}
public RSTile oldPosition = new RSTile(0,0);
public int standingCount = 0;
public boolean logout = false;
public void standingStill() {
//log("working????");
if ((oldPosition.getX() == getMyPlayer().getLocation().getX()) && (oldPosition.getY() == getMyPlayer().getLocation().getY()) ){
standingCount++;
//log("ADDING TO COUNT!!!");
}
if ( (oldPosition.getX() != getMyPlayer().getLocation().getX()) && (oldPosition.getY() != getMyPlayer().getLocation().getY()) ){
// log("old POS!!!");
oldPosition = new RSTile(getMyPlayer().getLocation().getX(), getMyPlayer().getLocation().getY() ) ;
standingCount = 0;
}
if (getMyPlayer().getInteracting() != null || getMyPlayer().getAnimation() != -1){
// log("stand count 0!!!");
standingCount = 0;
}
if (standingCount > 5 && standingCount < 20) {
log("I'm not doing anything... Probably stuck, SPIN AROUND!");
rotate();
}
//if (standingCount > 15) beep();
if (standingCount > 20) {
log("I'm stuck, so will logout before the BANHAMMER.");
log("Please post where you got stuck on the forums :)");
stopAllScripts();
logout = true;
}
// log("X:"+oldPosition.getX() + " Y:" + oldPosition.getY() );
}
@Override
public void castSpell(int spell) {// WoW Sucks
// openTab(TAB_MAGIC);
int x = 0;
int y = 0;
if (spell == 1 || spell == 8 || spell == 15 || spell == 22
|| spell == 29 || spell == 36 || spell == 43 || spell == 50
|| spell == 57) {
x = 570;
} else if (spell == 2 || spell == 9 || spell == 16 || spell == 23
|| spell == 30 || spell == 37 || spell == 44 || spell == 51
|| spell == 58) {
x = 595;
} else if (spell == 3 || spell == 10 || spell == 17 || spell == 24
|| spell == 31 || spell == 38 || spell == 45 || spell == 52
|| spell == 59) {
x = 620;
} else if (spell == 4 || spell == 11 || spell == 18 || spell == 25
|| spell == 32 || spell == 39 || spell == 46 || spell == 53
|| spell == 60) {
x = 645;
} else if (spell == 5 || spell == 12 || spell == 19 || spell == 26
|| spell == 33 || spell == 40 || spell == 47 || spell == 54
|| spell == 61) {
x = 670;
} else if (spell == 6 || spell == 13 || spell == 20 || spell == 27
|| spell == 34 || spell == 41 || spell == 48 || spell == 55
|| spell == 62) {
x = 695;
} else if (spell == 7 || spell == 14 || spell == 21 || spell == 28
|| spell == 35 || spell == 42 || spell == 49 || spell == 56
|| spell == 63) {
x = 720;
}
if (spell <= 7) {
y = 237;
} else if (spell <= 14) {
y = 262;
} else if (spell <= 21) {
y = 287;
} else if (spell <= 28) {
y = 312;
} else if (spell <= 35) {
y = 337;
} else if (spell <= 42) {
y = 362;
} else if (spell <= 49) {
y = 387;
} else if (spell <= 56) {
y = 412;
} else if (spell <= 63) {
y = 437;
}
clickMouse(x + random(-7, 7), y + random(-7, 7), true);
}
public boolean mylogout() { //by Bug5532
if (interfaceExists(548)){
atInterface(548,63);
}else return false;
wait(random(300,800));
if (interfaceExists(182)){
atInterface(182,6);
}else return false;
return true;
}
public void rotate() {
int button = random(37,40);
Bot.getInputManager().pressKey((char) button);
wait(random(500, 1500));
Bot.getInputManager().releaseKey((char) button);
}
public JButton button;
public JFrame frame2;
private void createAndShowGUI2() {
frame2 = new JFrame("Start Up");// the frame
frame2.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
JLabel label;
c.gridx = 0;
c.gridy = 0;
label = new JLabel("Press Ok to open [URL]http://bug5532.blogspot.com/[/URL] ");
panel.add(label, c);
c.gridx = 0;
c.gridy = 1;
label = new JLabel("and start the script.");
panel.add(label, c);
c.gridx = 0;
c.gridy = 2;
button = new JButton("Ok");
button.addActionListener(this);
panel.add(button, c);
//Display the window.
frame2.add(panel);
// frame.setSize(400, 250);
frame2.pack();
frame2.setBounds(260, 180, frame2.getWidth(), frame2.getHeight());
frame2.setVisible(true);
}
public JFrame frame3;
private void createAndShowGUI3() {
frame3 = new JFrame("Click Adz");// the frame
frame3.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
JPanel panel = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
JLabel label;
c.gridx = 1;
c.gridy = 0;
label = new JLabel("Please click the adz now! Script Starting....");
panel.add(label, c);
//button.addActionListener(this);
//Display the window.
frame3.add(panel);
frame3.setUndecorated(true);
frame3.setAlwaysOnTop(true);
// frame.setSize(400, 250);
frame3.pack();
frame3.setBounds(260, 180, frame3.getWidth()+5, frame3.getHeight()+5);
frame3.setVisible(true);
}
public boolean check1=true;
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == button) {
frame2.setVisible(false);
frame2.dispose();
try {
Runtime.getRuntime().exec("\"C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE\" " + "[URL]http://bug5532.blogspot.com/[/URL]");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
check1=false;
}
}
public String getScriptDescription() {
String html = "";
html += "<html>";
html += "<head>";
html += "<style type=\"text/css\"> hr {color: sienna} p {margin-left: 20px} body {background-image: url(\"[URL]http://img225.imageshack.us/img225/721/robbgef0.gif[/URL]\")}</style>";
html += "</head>";
html += "<body>";
html += "<center>";
// html += "<body color=red>";
// html += "<font color=red>";
html += "<h2>" + getName( ) + " v" + getVersion( ) + "</h2><br>";
html += "<b>Author: </b>" + getAuthor( ) + "<br>\n";
// html += "<br>";
html += " <h1>Please visit <a href=\"[URL]http://bug5532.blogspot.com/[/URL]\">[URL]http://bug5532.blogspot.com/[/URL]</a> <br>and click on ONE of the ads on the left.</h1>";
html += "Please do this once a day! Clicking will help towards releasing new Scripts, Thanks alot Bug5532.<br>";
html += "<br>";
// html += "<b>Features:</b><br>";
// html += "-Completes all 4 Mage Arena Training mini games!<br>";
// html += "<br>";
html += "Start in the Magic Training Arena with the correct staff equipped and correct runes.<br>";
html += "<br>";
html += "<b>Arguments:</b><br>";
html += "Game?: ";
html += " Enchantment:<input type=\"radio\" name=\"style\" value=\"enchant\" checked=\"checked\"> ";
html += " Telekinetic:<input type=\"radio\" name=\"style\" value=\"tele\"> ";
html += " Graveyard:<input type=\"radio\" name=\"style\" value=\"bones\">";
html += " Alching:<input type=\"radio\" name=\"style\" value=\"alch\"><br>";
html += "Enchant Spell: <select name=\"eSpell\"> <option>Sapphire<option>Emerald<option>Ruby<option>Diamond<option>Dragonstone<option>Onyx</select>";
html += " Peaches spell? <input type=\"checkbox\" name=\"peach\" value=\"yes\" >";
html += " Alch: <select name=\"aSpell\"> <option selected>High<option>Low</select><br>";
html += "World Hop? <input type=\"checkbox\" name=\"hop\" value=\"yes\" >";
html += "</center>";
html += "</body>";
html += "</html>";
return( html );
}
public int World;
public boolean Members =true;
public void changeWorld() { // All credit goes to Wazzu :D
if(Members == false){
World = random(1,75);
}
if(Members == true){
World = random(76,150);
}
clickMouse(382, 238, 10, 5, true);
wait(random(3000,5000));
if(World == 1) {
clickMouse(100,214,5,3,true);
}
if(World == 2) {
clickMouse(100,234,5,3,true);
}
if(World == 3) {
clickMouse(100,274,5,3,true);
}
if(World == 4) {
clickMouse(100,294,5,3,true);
}
if(World == 5) {
clickMouse(100,332,5,3,true);
}
if(World == 6) {
clickMouse(100,386,5,3,true);
}
if(World == 7) {
clickMouse(100,408,5,3,true);
}
if(World == 8) {
clickMouse(100,425,5,3,true);
}
if(World == 9) {
clickMouse(190,45,5,3,true);
}
if(World == 10) {
clickMouse(190,120,5,3,true);
}
if(World == 11) {
clickMouse(190,140,5,3,true);
}
if(World == 12) {
clickMouse(190,180,5,3,true);
}
if(World == 13) {
clickMouse(190,197,5,3,true);
}
if(World == 14) {
clickMouse(190,216,5,3,true);
}
if(World == 15) {
clickMouse(190,235,5,3,true);
}
if(World == 16) {
clickMouse(190,270,5,3,true);
}
if(World == 17) {
clickMouse(190,290,5,3,true);
}
if(World == 18) {
clickMouse(190,330,5,3,true);
}
if(World == 19) {
clickMouse(190,350,5,3,true);
}
if(World == 20) {
clickMouse(190,387,5,3,true);
}
if(World == 21) {
clickMouse(190,460,5,3,true);
}
if(World == 22) {
clickMouse(280,45,5,3,true);
}
if(World == 23) {
clickMouse(280,60,5,3,true);
}
if(World == 24) {
clickMouse(280,155,5,3,true);
}
if(World == 25) {
clickMouse(280,197,5,3,true);
}
if(World == 26) {
clickMouse(280,272,5,3,true);
}
if(World == 27) {
clickMouse(280,290,5,3,true);
}
if(World == 28) {
clickMouse(280,310,5,3,true);
}
if(World == 29) {
clickMouse(280,480,5,3,true);
}
if(World == 30) {
clickMouse(375,45,5,3,true);
}
if(World == 31) {
clickMouse(375,63,5,3,true);
}
if(World == 32) {
clickMouse(375,83,5,3,true);
}
if(World == 33) {
clickMouse(375,177,5,3,true);
}
if(World == 34) {
clickMouse(375,195,5,3,true);
}
if(World == 35) {
clickMouse(375,272,5,3,true);
}
if(World == 36) {
clickMouse(375,290,5,3,true);
}
if(World == 37) {
clickMouse(375,310,5,3,true);
}
if(World == 38) {
clickMouse(375,369,5,3,true);
}
if(World == 39) {
clickMouse(375,425,5,3,true);
}
if(World == 40) {
clickMouse(375,444,5,3,true);
}
if(World == 41) {
clickMouse(375,460,5,3,true);
}
if(World == 42) {
clickMouse(375,480,5,3,true);
}
if(World == 43) {
clickMouse(470,120,5,3,true);
}
if(World == 44) {
clickMouse(470,138,5,3,true);
}
if(World == 45) {
clickMouse(470,197,5,3,true);
}
if(World == 46) {
clickMouse(470,215,5,3,true);
}
if(World == 47) {
clickMouse(470,235,5,3,true);
}
if(World == 48) {
clickMouse(470,253,5,3,true);
}
if(World == 49) {
clickMouse(470,270,5,3,true);
}
if(World == 50) {
clickMouse(470,345,5,3,true);
}
if(World == 51) {
clickMouse(470,445,5,3,true);
}
if(World == 52) {
clickMouse(470,463,5,3,true);
}
if(World == 53) {
clickMouse(470,480,5,3,true);
}
if(World == 54) {
clickMouse(560,64,5,3,true);
}
if(World == 55) {
clickMouse(560,102,5,3,true);
}
if(World == 56) {
clickMouse(560,120,5,3,true);
}
if(World == 57) {
clickMouse(560,140,5,3,true);
}
if(World == 58) {
clickMouse(560,157,5,3,true);
}
if(World == 59) {
clickMouse(560,273,5,3,true);
}
if(World == 60) {
clickMouse(560,290,5,3,true);
}
if(World == 61) {
clickMouse(560,310,5,3,true);
}
if(World == 62) {
clickMouse(560,367,5,3,true);
}
if(World == 63) {
clickMouse(560,388,5,3,true);
}
if(World == 64) {
clickMouse(560,480,5,3,true);
}
if(World == 65) {
clickMouse(655,45,5,3,true);
}
if(World == 66) {
clickMouse(655,83,5,3,true);
}
if(World == 67) {
clickMouse(655,100,5,3,true);
}
if(World == 68) {
clickMouse(655,120,5,3,true);
}
if(World == 69) {
clickMouse(655,140,5,3,true);
}
if(World == 70) {
clickMouse(655,293,5,3,true);
}
if(World == 71) {
clickMouse(655,330,5,3,true);
}
if(World == 72) {
clickMouse(655,367,5,3,true);
}
if(World == 73) {
clickMouse(655,405,5,3,true);
}
if(World == 74) {
clickMouse(100,155,5,3,true);
}
if(World == 75) {
clickMouse(100,177,5,3,true);
}
if(World == 76) {
clickMouse(95,310,5,3,true);
}
if(World == 77) {
clickMouse(100,250,5,3,true);
}
if(World == 78) {
clickMouse(100,367,5,3,true);
}
if(World == 79) {
clickMouse(100,445,5,3,true);
}
if(World == 80) {
clickMouse(100,463,5,3,true);
}
if(World == 81) {
clickMouse(100,480,5,3,true);
}
if(World == 82) {
clickMouse(190,63,5,3,true);
}
if(World == 83) {
clickMouse(190,83,5,3,true);
}
if(World == 84) {
clickMouse(190,100,5,3,true);
}
if(World == 85) {
clickMouse(190,157,5,3,true);
}
if(World == 86) {
clickMouse(190,254,5,3,true);
}
if(World == 87) {
clickMouse(190,310,5,3,true);
}
if(World == 88) {
clickMouse(190,365,5,3,true);
}
if(World == 89) {
clickMouse(190,405,5,3,true);
}
if(World == 90) {
clickMouse(190,423,5,3,true);
}
if(World == 91) {
clickMouse(190,440,5,3,true);
}
if(World == 92) {
clickMouse(190,481,5,3,true);
}
if(World == 93) {
clickMouse(280,83,5,3,true);
}
if(World == 94) {
clickMouse(280,101,5,3,true);
}
if(World == 95) {
clickMouse(280,121,5,3,true);
}
if(World == 96) {
clickMouse(280,140,5,3,true);
}
if(World == 97) {
clickMouse(280,177,5,3,true);
}
if(World == 98) {
clickMouse(280,215,5,3,true);
}
if(World == 99) {
clickMouse(280,234,5,3,true);
}
if(World == 100) {
clickMouse(280,253,5,3,true);
}
if(World == 101) {
clickMouse(280,330,5,3,true);
}
if(World == 102) {
clickMouse(280,349,5,3,true);
}
if(World == 103) {
clickMouse(280,368,5,3,true);
}
if(World == 104) {
clickMouse(280,386,5,3,true);
}
if(World == 105) {
clickMouse(280,405,5,3,true);
}
if(World == 106) {
clickMouse(280,424,5,3,true);
}
if(World == 107) {
clickMouse(280,444,5,3,true);
}
if(World == 108) {
clickMouse(280,465,5,3,true);
}
if(World == 109) {
clickMouse(375,100,5,3,true);
}
if(World == 110) {
clickMouse(375,119,5,3,true);
}
if(World == 111) {
clickMouse(375,138,5,3,true);
}
if(World == 112) {
clickMouse(375,157,5,3,true);
}
if(World == 113) {
clickMouse(375,213,5,3,true);
}
if(World == 114) {
clickMouse(375,232,5,3,true);
}
if(World == 115) {
clickMouse(375,251,5,3,true);
}
if(World == 116) {
clickMouse(375,329,5,3,true);
}
if(World == 117) {
clickMouse(375,350,5,3,true);
}
if(World == 118) {
clickMouse(375,385,5,3,true);
}
if(World == 119) {
clickMouse(375,404,5,3,true);
}
if(World == 120) {
clickMouse(470,45,5,3,true);
}
if(World == 121) {
clickMouse(470,65,5,3,true);
}
if(World == 122) {
clickMouse(470,84,5,3,true);
}
if(World == 123) {
clickMouse(470,103,5,3,true);
}
if(World == 124) {
clickMouse(470,160,5,3,true);
}
if(World == 125) {
clickMouse(470,178,5,3,true);
}
if(World == 126) {
clickMouse(470,293,5,3,true);
}
if(World == 127) {
clickMouse(470,312,5,3,true);
}
if(World == 128) {
clickMouse(470,331,5,3,true);
}
if(World == 129) {
clickMouse(470,367,5,3,true);
}
if(World == 130) {
clickMouse(470,386,5,3,true);
}
if(World == 131) {
clickMouse(470,405,5,3,true);
}
if(World == 132) {
clickMouse(470,424,5,3,true);
}
if(World == 133) {
clickMouse(560,45,5,3,true);
}
if(World == 134) {
clickMouse(560,83,5,3,true);
}
if(World == 135) {
clickMouse(560,178,5,3,true);
}
if(World == 136) {
clickMouse(560,197,5,3,true);
}
if(World == 137) {
clickMouse(560,216,5,3,true);
}
if(World == 138) {
clickMouse(560,235,5,3,true);
}
if(World == 139) {
clickMouse(560,254,5,3,true);
}
if(World == 140) {
clickMouse(560,330,5,3,true);
}
if(World == 141) {
clickMouse(560,350,5,3,true);
}
if(World == 142) {
clickMouse(560,405,5,3,true);
}
if(World == 143) {
clickMouse(560,424,5,3,true);
}
if(World == 144) {
clickMouse(560,443,5,3,true);
}
if(World == 145) {
clickMouse(560,462,5,3,true);
}
if(World == 146) {
clickMouse(655,61,5,3,true);
}
if(World == 147) {
clickMouse(655,176,5,3,true);
}
if(World == 148) {
clickMouse(655,195,5,3,true);
}
if(World == 149) {
clickMouse(655,214,5,3,true);
}
if(World == 150) {
clickMouse(655,233,5,3,true);
}
}
}

