Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

pyramid plunder source

Joined
Jan 28, 2015
Messages
12
here is a source code for pyramid plunder it was made in 2011, so it should work for old school i dont know about RS3 found this on my computer dont have time to comb through so if anyone could test it out most of the leg work is done.
Let me know who ends up gettin this thing running, sidenote obviously it was made for another client but this should save you quite a bit of time. message me if you want the file its self.





private final RenderingHints antialiasing = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
//-=-=- Prepare our variables -=-=-
//Prepare walking locations
private RSTile tilePyramid = new RSTile(3289,2801);
//private RSTile tilePyramidMid = new RSTile(3303,2800); //Midway between the bank and pyramid
private RSTile tileBank = new RSTile(3314,2798);

//Tags that indicate the position behind the spikes for each room
private int room1SpikeYLoc = 4473; //South
private int room2SpikeYLoc = 4474; //South
private int room3SpikeYLoc = 4466; //South
private int room4SpikeXLoc = 1930; //West
private int room5SpikeXLoc = 1962; //West
private int room6SpikeYLoc = 4427; //North
private int room7SpikeYLoc = 4424; //North
private int room8SpikeYLoc = 4423; //North

//The Guardian Mummy's ID
private int guardianID = 4476;

//Object and Item IDs
private int bankBooth = 20325; //The bank booth
private int ladderUp = 20277, ladderDown = 20275; //Ladders to and from the bank room
private int sceptreID = 9044; //Scepter ID
private int emptyVialID = 229; //Empty vial ID
private int doorNorth = 16543, doorEast = 16544, doorSouth = 16545, doorWest = 16546; //Pyramid entrances
private int roomExit = 16458; //The door out of the rooms
private int guardianExit = 16459; //The door out of the entrance rooms
private int spikeTrap = 16517; //The ID of the spike traps
private int[] antiPoisonIDs = {185,183,181,2448}; //Antipoison IDs
private int chestID = 16537; //The ID of the chest that sits in each room (holds possibly sceptre)

//Information about the urns in each room
private boolean[] urnCompleted = {false,false,false,false,false,false,false,false,false,false,false,false,false};
private int[] urnsCurrent = {0,0,0,0,0,0,0,0,0,0,0,0,0}; //Temporary storage for the urns in the current room
private int[] urns1 = {16519, 16528, 16523, 16518, 16532, 16527, 16522, 16531, 16526, 16530, 16525, 16520, 16529};
private int[] urns2 = {16518, 16523, 16532, 16528, 16519, 16529, 16527, 16522, 16526, 16531, 16525, 16521, 16530};
private int[] urns3 = {16527, 16523, 16519, 16524, 16528, 16532, 16521, 16531, 16522, 16518, 16525, 16529, 0};
private int[] urns4 = {16531, 16526, 16521, 16530, 16525, 16532, 16520, 16527, 16522, 16529, 16524, 16528, 16523};
private int[] urns5 = {16522, 16532, 16520, 16526, 16531, 16524, 16519, 16528, 16523, 16529, 16527, 16521, 16525};
private int[] urns6 = {16525, 16530, 16521, 16526, 16518, 16523, 16522, 16532, 16524, 16529, 16527, 16531, 16520};
private int[] urns7 = {16523, 16518, 16527, 16532, 16531, 16522, 16524, 16529, 16520, 16525, 16530, 16521, 16526};
private int[] urns8 = {16520, 16525, 16530, 16521, 16526, 16518, 16523, 16528, 16532, 16529, 16527, 16522, 16531};
private boolean thisUrnSuccess = false; //Tracks completing an urn
private boolean thisUrnFailure = false; //Tracks failing an urn

private int[] junkItems = {9026,9032,9036,9030,9042,9038,emptyVialID};

//Information about the doors in each room
private boolean[] doorCompleted = {false,false,false,false};
private int[] doorsInPyramid = {16539,16540,16541,16542};
private int[] doorsInPyramid4 = {16542,16541,16540,16539}; //Special case for room 4 door order
private int[] doorsInPyramid5 = {16541,16540,16539,16542}; //Special case for room 5 door order
private int[] doorsInPyramid6 = {16539,16542,16541,16540}; //Special case for room 6 door order
private boolean thisDoorSuccess = false; //Tracks completing an urn
private boolean thisDoorFailure = false; //Tracks failing an urn

//Misc Flags
private boolean spikePassed = false; //Flag indicating that we passed the trap successfully
private int spikeFailures; //Will track if we fail the spikes too many times
private boolean isPoisoned = false;
private boolean mummyPreventedEntrance = false;
private boolean hideHUD = false; //Flag tracks of the heads up display should be hidden or not

//Keeps track of which of the 4 rooms the Guardian is in.
//This will be in a clockwise pattern so 1=North, 2=East, 3=South, 4=West
public int guardianRoom = 1;

//Information trackers
private int t_xpStartThieving = 0;
private int t_lvlStartThieving = 0;
private int t_urnsFailed = 0;
private int t_urnsLooted = 0;
private int t_chestsLooted = 0;
private int t_tripsCompleted = 0;
private int t_foodConsumed = 0;
private int t_antiConsumed = 0;
private int t_sceptresCollected = 0;
private boolean setupCompleted = false; //Tracks if the user finished the settings menu
private boolean roomHasBeenReset = false; //Tracks if the current room within the pyramid has been reset
// happens if all doors have been opened and we still didnt advance

private String[] foodNames = {"Trout","Salmon","Tuna","Lobster","Swordfish","Monkfish","Shark"};
private int[] foodList = {333,329,361,379,373,7946,385};
private int foodSelection = 6; //Tracks which food the user is selecting in the settings menu
private int foodID = 385; //The ID of food (default is shark)

public long startTime = System.currentTimeMillis();
long ttlCalcT;

private Image BKG;
String currentStatus = "Initializing...";
private boolean advancedGFX = false; //Flag for GUI
private boolean dropJunkItems = true; //Flag for dropping non-gold items
private boolean enableAntiban = true; //Antiban flag
private boolean noobMode = false; //Flag that makes low leveled players have at least 6 food items for safety
private boolean usingTotem = false; //Flag that determines if the player is going to be using an aitpoison totem
private boolean skippingUrns = false; //Flag that determines if we're ignoring urns (only searching chests for sceptres)
private boolean safeEater = false; //Flag that the user can set to force eating at 70% instead of the default 50%

//boolean values determining if we will loot chests
private boolean[] lootChest = {false, false, false, false, false, true, true, true};
private boolean thisChestLooted = false;

//Declare common colors used in painting methods
//Declare our colors
private Color clrBright = new Color(189, 167, 128);
private Color clrMiddle = new Color(162,148,120);
private Color clrDark = new Color(85, 79, 63);

//Mouse trackers
private boolean mouseOverStartButton = false;
private boolean mouseOverCancelButton = false;

public boolean onStart()
{
//Start up welcome message
log("Starting up Pyramid Plunder Master by TheKoolKat");

//Load skill information
t_xpStartThieving = skills.getCurrentExp(skills.THIEVING);
t_lvlStartThieving = skills.getRealLevel(skills.THIEVING);

//Set the mouse speed
mouse.setSpeed(5);

//Load the image(s) we will be using for the HUD
try
{
BKG = ImageIO.read(new URL("http://i54.tinypic.com/cygj.jpg"));
//BKG = ImageIO.read(new File("PPM.jpg"));
}
catch (final java.io.IOException e)
{
e.printStackTrace();
}

return true;
}

public void onFinish()
{
log("Thanks for using Pyramid Plunder Master!");
log("You gained " + (skills.getCurrentExp(skills.THIEVING) - t_xpStartThieving) + " experience.");
}

public int loop()
{
//Don't run the script if the user hasn't finished the configuration options screen
if (!setupCompleted)
{
return 0;
}

//Always check for a sceptre!
if (sceptreOnGround())
{
currentStatus = "Picking up a sceptre!";
if (inventoryContainsJunk())
{
dropJunk();
}

collectSceptre();

//We don't want to do anything else while there is a sceptre on the ground such as walk away
// so we will return to the loop entry until we have collected it
return 100;
}

//Do we need to eat?
if (!bank.isOpen())
{
if (combat.getHealth() < 70 && safeEater == true)
{
currentStatus = "Eating";
eatFoodItem();
}
else if (combat.getHealth() < 50)
{
currentStatus = "Eating";
eatFoodItem();
}
}

//Are we poisoned?
if (combat.isPoisoned())
{
currentStatus = "Curing poison";
drinkAntiPoison();
sleep(random(400,800));
}

//Are we out of the pyramid?
if (getCurrentRoom() == 0)
{
//Do we need to bank?
if (!inventoryReady())
{
//Is the bank open?
if (bank.isOpen())
{
currentStatus = "Banking";
doBanking();
}
else
{
currentStatus = "Walking to the bank";
getToTheBank();
}
}
else //Inventory is ready
{
//Reset urns incase we leveled up recently
urnsCurrent[0] = 0; //This will flag the urn searcher to recalculate the room we process

//Drop any junk items if needed
if (dropJunkItems == true)
{
if (inventoryContainsJunk())
{
dropJunk();
return(100);
}
}

//Is the guardian close by?
RSNPC guardianLocator = npcs.getNearest(guardianID);
if (guardianLocator != null && getCurrentRoom() == 0)
{
//Guardian found!
processGuardian();
}

//Is the bank close by?
RSObject bankBoothLocation = objects.getNearest(bankBooth);
if (bankBoothLocation != null)
{
currentStatus = "Walking back to Pyramid";
//Walk up the ladder
RSObject ladderOutOfBank = objects.getNearest(ladderUp);
if (ladderOutOfBank != null)
{
//Is the ladder visible?
if (ladderOutOfBank.isOnScreen())
{
//Climb it
ladderOutOfBank.interact("Climb");
//Wait for the ladder down to exist, this way we know we're upstairs
//Wait no more than 6 seconds before trying again
waitForObject(ladderDown, 3);
}
else
{
//The ladder isn't visible, so walk to it (if not already walking)
if (!getMyPlayer().isMoving())
{
walking.walkTileMM(ladderOutOfBank.getLocation());
}
}
}
}
else //Bank isn't visible, so we must be outside
{
//Are we anywhere near the pyramid?
RSObject doorNLocator = objects.getNearest(doorNorth);

//Is the guardian in room 1?
if (guardianRoom == 1)
{
//Are we already inside the room? We determine this by looking for the exit door
RSObject exitDoor = objects.getNearest(guardianExit);
if (exitDoor != null)
{
//Look for the guardian
guardianLocator = npcs.getNearest(guardianID);
if (guardianLocator == null)
{
//No guardian in here, move to the next room
guardianRoom = 2;
sleep(random(500,800));
exitDoor.doClick();
sleep(random(1600,2000));
return 0;
}
}

//Is the entrance to room 1 visible? If so go inside.
if (doorNLocator != null)
{
if (doorNLocator.isOnScreen())
{
currentStatus = "Searching for Guardian (North Room)";
doorNLocator.doClick();
moveMouseAround();
waitForObject(guardianExit, 5);
return 0;
}
else
{
//walkThisPath(pathToPyramid);
walkTo(tilePyramid);
}
}
else
{
//walkThisPath(pathToPyramid);
walkTo(tilePyramid);
}
}
else if (guardianRoom == 2)
{
currentStatus = "Searching for Guardian (East Room)";
processGuardianRoom(2);
}
else if (guardianRoom == 3)
{
currentStatus = "Searching for Guardian (South Room)";
processGuardianRoom(3);
}
else if (guardianRoom == 4)
{
currentStatus = "Searching for Guardian (West Room)";
processGuardianRoom(4);
}
}
}
}
else //We're in a room within the pyramid!
{
if (isPastSpikes())
{
if (maxRoom() == getCurrentRoom())
{
//If this is the highest room we can enter, we should search the urns
//But first we check to see if we have finished all of the urns
if (allUrnsCompleted() || skippingUrns == true)
{
//Should we loot the chest?
if (lootChest[getCurrentRoom() - 1] == true && thisChestLooted == false)
{
lootChest();
return 100;
}
else
{
//Get out of the pyramid!
currentStatus = "Leaving Pyramid";
exitPyramid();
}
}
else
{
processUrns();
}
}
else
{
//Should we loot the chest?
if (lootChest[getCurrentRoom() - 1] == true && thisChestLooted == false)
{
lootChest();
return 100;
}
else
{
//Search the doors for the next room
processDoors();
}
}
}
else
{
passSpikeTrap();
}
}
return 0;
}

//This will loot the chest in the middle of the room
private void lootChest()
{
if (lootChest[getCurrentRoom() - 1] == true)
{
//Loot the chest
if (getCurrentRoom() > 0 && isPastSpikes())
{
//Should we be looting this chest?
if (lootChest[getCurrentRoom() - 1] == true && thisChestLooted == false)
{
//Find the chest
RSObject thisChest = objects.getNearest(chestID);
if (thisChest != null)
{
currentStatus = "Looting room " + getCurrentRoom() + " chest";
if (thisChest.isOnScreen())
{
thisChest.doClick();
moveMouseAround();
sleep(random(1200,2000));
//Make sure player isn't moving or they might miss the chest
//since this method isn't very smart yet
while (getMyPlayer().isMoving()) sleep(100);
thisChestLooted = true;
t_chestsLooted++;
}
else
{
walking.walkTileMM(thisChest.getLocation());
sleep(random(1000,1500));
while (getMyPlayer().isMoving()) sleep(100);
}
}
}
}
}
}

//This method will check for the guardian in a room and exit the room if it doesn't exist
//Note that since walking is involved, the north room gets processed by the main loop and not this method
private void processGuardianRoom(int roomNum)
{
//Check to see if we're outside of the pyramid
RSObject doorNLocator = objects.getNearest(doorNorth);
RSObject doorELocator = objects.getNearest(doorEast);
RSObject doorSLocator = objects.getNearest(doorSouth);
RSObject doorWLocator = objects.getNearest(doorWest);

//Are we outside of the pyramid?
if (doorNLocator != null)
{
//Lets walk to the specified door
if (roomNum == 2)
{
if (!getMyPlayer().isMoving())
{
walking.walkTileMM(doorELocator.getLocation());
moveMouseAround();
}
}
else if (roomNum == 3)
{
if (!getMyPlayer().isMoving())
{
walking.walkTileMM(doorSLocator.getLocation());
moveMouseAround();
}
}
else if (roomNum == 4)
{
if (!getMyPlayer().isMoving())
{
walking.walkTileMM(doorWLocator.getLocation());
moveMouseAround();
}
}
sleep(random(2000,2300));
}
else
{
//We're probably inside of the room
//Look for the guardian
RSNPC guardianLocator = npcs.getNearest(guardianID);
RSObject exitDoor = objects.getNearest(guardianExit);
if (guardianLocator == null)
{
if (exitDoor != null)
{
//No guardian in here, move to the next room
exitDoor.doClick();
sleep(random(1600,2000));
//wait for the north door to become visisble again (or 3 seconds)
waitForObject(doorNorth, 3);
//Is the north door visible?
RSObject nDoor = objects.getNearest(doorNorth);
if (nDoor != null)
{
//North door exists so we exited the previous room
//and can increment our door counter
guardianRoom++;
if (guardianRoom == 5) guardianRoom = 1;
}
else return;
}
}
}

//Click to enter the guardian room if it is visible
if (roomNum == 2)
{
if (doorELocator != null)
{
if (doorELocator.isOnScreen())
{
doorELocator.doClick();
moveMouseAround();
waitForObject(guardianExit, 5);
}
}
}
else if (roomNum == 3)
{
if (doorSLocator != null)
{
if (doorSLocator.isOnScreen())
{
doorSLocator.doClick();
moveMouseAround();
waitForObject(guardianExit, 5);
}
}
}
else if (roomNum == 4)
{
if (doorWLocator != null)
{
if (doorWLocator.isOnScreen())
{
doorWLocator.doClick();
moveMouseAround();
waitForObject(guardianExit, 5);
}
}
}
}


private void processGuardian()
{
//Failsafe: Don't do any of this if there is a spike trap visible!
RSObject closeSpike = objects.getNearest(spikeTrap);
if (closeSpike != null) return;

//Find the guardian
RSNPC guardianLocator = npcs.getNearest(guardianID);
if (guardianLocator != null)
{
currentStatus = "Interacting with Guardian";
//If the guardian is visible...
if(guardianLocator.isOnScreen())
{
RSComponent menu1 = interfaces.getComponent(64, 5);
RSComponent menu2 = interfaces.getComponent(241, 5);
if(menu1 != null && menu1.isValid())
{
menu1.doClick(true);
sleep(1400, 2000);
}
if(menu2 != null && menu2.isValid())
{
menu2.doClick(true);
prepUrns(); //Load the urn IDs to search now
resetDoors(); //Make sure the doors are reset
t_tripsCompleted++; //Trips completed tracker increment
sleep(random(1800,2500));
moveCamera();
}
if(!menu1.isValid() && !menu2.isValid())
{
if (guardianLocator.interact("Start-activity"))
{
moveMouseAround();
sleep(1500, 2200);
}
else
{
walking.walkTileMM(guardianLocator.getLocation());
sleep(1500, 2200);
}
}
}
else
{
//Walk to the guardian
walking.walkTileMM(guardianLocator.getLocation());
}
}
}

//This method will take care of the doors in the current room to advance to the next room
private void processDoors()
{
for(int i = 0; i < doorCompleted.length; i++)
{
if(doorCompleted == false)
{
searchDoor(i);
break;
}
}

//If all the doors are completed, we will force reset them because
//sometimes a room will change while you are searching it, which causes
//the door to the next room to occasionally move to a door that
//you already searched (Jagex is dumb for this)
if (doorCompleted[0] == true && doorCompleted[1] == true && doorCompleted[2] == true && doorCompleted[3] == true)
{
//This is duplicated code from the resetDoors method because we don't want to reset the chest!
for(int i = 0; i < doorCompleted.length; i++)
{
doorCompleted = false;
roomHasBeenReset = true; //Set this flag because trying all the doors again will require a different action
}
}
}

//This will click a door and wait for it to complete (or retry on failure)
private void searchDoor(int doorNum)
{
try
{
//Log the room that we're in before we click the door so we can check
//to see if we passed it later on
int roomBefore = getCurrentRoom();

//Get the nearest door from the list
RSObject currentDoor;
if (getCurrentRoom() == 4) //Special order for room 4
{
currentDoor = objects.getNearest(doorsInPyramid4[doorNum]);
}
else if (getCurrentRoom() == 5) //Special order for room 5
{
currentDoor = objects.getNearest(doorsInPyramid5[doorNum]);
}
else if (getCurrentRoom() == 6) //Special order for room 6
{
currentDoor = objects.getNearest(doorsInPyramid6[doorNum]);
}
else //Every other room
{
currentDoor = objects.getNearest(doorsInPyramid[doorNum]);
}

if(currentDoor != null)
{
if(currentDoor.isOnScreen())
{
currentStatus = "Opening door (" + (doorNum + 1) + "/4)";
//Lets make sure we move when we click a supposedly visible door (avoiding an RSBot bug)
RSTile positionBefore = getMyPlayer().getLocation();
//Open the door (pick lock if first round, else "Enter")
if (!roomHasBeenReset)
currentDoor.interact("Pick-lock");
else
currentDoor.doClick();

moveMouseAround();
//Wait up to 4 seconds for it to either complete the door or fail
int loopCounter = 0;
while (loopCounter < 40)
{
sleep(100);
loopCounter++;

//Did something happen with the door?
if (thisDoorSuccess == true)
{
thisDoorSuccess = false;
doorCompleted[doorNum] = true;
spikeFailures = 0;
return;
}

if (thisDoorFailure == true)
{
thisDoorFailure = false;
sleep(random(200,600));
return;
}

//Did we get to the next room?
if (roomBefore < getCurrentRoom())
{
resetDoors();
//Give the room time to load
sleep(random(700,1000));
//Move the camera a bit
moveCamera();
return;
}
}

//Have we moved?
RSTile positionNow = getMyPlayer().getLocation();
if (positionBefore.getX() == positionNow.getX() && positionBefore.getY() == positionNow.getY())
{
//Is the door more than 1 tile away?
if (calc.distanceTo(currentDoor.getLocation()) > 1)
{
//Looks like we didn't move. Lets click close to it on the minimap to be safe
walking.walkTileMM(currentDoor.getLocation());
sleep(random(1200, 1800));
}
}
}
else
{
walking.walkTileMM(currentDoor.getLocation());
sleep(random(1200, 1800));
}
}
}
catch (Exception ex) { }
}

//This method will take care of the urns in the current room (collect from each one)
private void processUrns()
{
for(int i = 0; i <= 12; i++)
{
if(urnCompleted == false)
{
searchUrn(i);
return;
}
}
}

//This will click an urn and wait for it to complete (or retry on failure)
private void searchUrn(int urnNum)
{
try
{
//If the urn number is 0 it means one doesn't exist for that slot so we'll pass it
//This only happens in one room
if (urnsCurrent[urnNum] == 0)
{
urnCompleted[urnNum] = true;
return;
}

//Get the nearest urn from the list
RSObject currentUrn = objects.getNearest(urnsCurrent[urnNum]);
if(currentUrn != null)
{
if(currentUrn.isOnScreen())
{
if (getCurrentRoom() == 3)
currentStatus = "Looting Urn (" + (urnNum + 1) + "/12)";
else
currentStatus = "Looting Urn (" + (urnNum + 1) + "/13)";
currentUrn.interact("Search");
moveMouseAround();
//Wait up to 6 seconds for it to either complete the urn or fail
int loopCounter = 0;
while (loopCounter < 60)
{
sleep(100);
loopCounter++;

//Did something happen with the urn?
if (thisUrnSuccess == true)
{
thisUrnSuccess = false;
sleep(random(1500,2000));
urnCompleted[urnNum] = true;
t_urnsLooted++;
return;
}

if (thisUrnFailure == true)
{
thisUrnFailure = false;
t_urnsFailed++;
return;
}
}
}
else
{
walking.walkTileMM(currentUrn.getLocation());
sleep(random(900, 1200));
}
}
}
catch (Exception ex) { }
}

//Returns if all the urns in the room have been completed, false if they havent
private boolean allUrnsCompleted()
{
//Loop through the array to see if all urns are completed
for (int i=0; i < 13; i++ )
{
if (urnCompleted == false) return false;
}

//If none were false we'll return true
return true;
}

private void exitPyramid()
{
//Find the nearest door
if (getCurrentRoom() > 0)
{
RSObject nearestExit = objects.getNearest(roomExit);
if (nearestExit != null)
{
if (nearestExit.isOnScreen())
{
nearestExit.doClick();
moveMouseAround();
//Wait for the mummy confirm exit interface to appear
waitForInterface(228,2,4);

//If the interface is good click it
RSComponent exitInterface = interfaces.getComponent(228, 2);
if(exitInterface != null && exitInterface.isValid())
{
exitInterface.doClick();
sleep(random(800,1200));
}
}
else
{
walking.walkTileMM(nearestExit.getLocation());
}
}
}
}

//Reset the flags for the doors once we pass through a room successfully
private void resetDoors()
{
for(int i = 0; i < doorCompleted.length; i++)
{
doorCompleted = false;
}

//Also reset the chest switch too
thisChestLooted = false;
//Reset switch that tracks of this room's doors were all opened already
roomHasBeenReset = false;
}

//Will fill the temporary urn list with the urns from the current room in the proper order
private void prepUrns()
{
if (maxRoom() > 0)
{
switch (maxRoom())
{
case 1:
System.arraycopy(urns1, 0, urnsCurrent, 0, 13);
break;
case 2:
System.arraycopy(urns2, 0, urnsCurrent, 0, 13);
break;
case 3:
System.arraycopy(urns3, 0, urnsCurrent, 0, 13);
break;
case 4:
System.arraycopy(urns4, 0, urnsCurrent, 0, 13);
break;
case 5:
System.arraycopy(urns5, 0, urnsCurrent, 0, 13);
break;
case 6:
System.arraycopy(urns6, 0, urnsCurrent, 0, 13);
break;
case 7:
System.arraycopy(urns7, 0, urnsCurrent, 0, 13);
break;
case 8:
System.arraycopy(urns8, 0, urnsCurrent, 0, 13);
break;
}
}

//Reset the urn flags
urnCompleted[0] = false;
urnCompleted[1] = false;
urnCompleted[2] = false;
urnCompleted[3] = false;
urnCompleted[4] = false;
urnCompleted[5] = false;
urnCompleted[6] = false;
urnCompleted[7] = false;
urnCompleted[8] = false;
urnCompleted[9] = false;
urnCompleted[10] = false;
urnCompleted[11] = false;
urnCompleted[12] = false;
}

//Returns true if the inventory has enough items for a trip through the pyramid, false if not
private boolean inventoryReady()
{
//If we have a sceptre in our inventory, we don't want to risk it
if (inventory.getCount(sceptreID) > 0) return false;

//Do we have enough food?
if (!noobMode)
{
if(inventory.getCount(foodID) < 3) return false;
}
else
{
if(inventory.getCount(foodID) < 6) return false;
}

//Are we using anti poisons?
if (!usingTotem)
{
//Do we have at least one sip of antipoison left?
RSItem antiPoison;
boolean foundAnti = false; //Temporary flag
for (int thisAnti : antiPoisonIDs)
{
//If we find one of the anti IDs then set a flag indicating that
if (inventory.contains(thisAnti))
{
foundAnti = true;
break; //No need to check any more if we found an anti, we're good
}
}
//If the inventory doesnt contain any, we're in bad shape.
if (!foundAnti) return false;
}

//If we made it through all of the checks, we're good to go
return true;
}

//Determine what the maximum room that the player can enter is, based on their thieving level
private int maxRoom()
{
int level = skills.getCurrentLevel(skills.THIEVING);
if(level >= 91)
return 8;
else if(level >= 81)
return 7;
else if(level >= 71)
return 6;
else if(level >= 61)
return 5;
else if(level >= 51)
return 4;
else if(level >= 41)
return 3;
else if(level >= 31)
return 2;
else if(level >= 21)
return 1;
else
return 0;
}

//Get the room that we are currently in
private int getCurrentRoom()
{
RSComponent interfaceResult = interfaces.getComponent(428, 4);
if (interfaceResult != null && interfaceResult.isValid())
{
String interfaceString = interfaceResult.getText();
return Integer.parseInt(interfaceString.substring(9, 10));
}
return 0;
}

//Drink a sip of antipoison potion, lowest available dosage first
private void drinkAntiPoison()
{
//Loop through all possible antipoison anti IDso
RSItem antiPoison;
for (int thisAnti : antiPoisonIDs)
{
if (inventory.contains(thisAnti))
{
antiPoison = inventory.getItem(thisAnti);
antiPoison.doClick(true);
t_antiConsumed++;
break;
}
}
}

//Will eat food and keep trying to eat until the player gains health
//This is done because if the user is picking an urn the eating wont work
private void eatFoodItem()
{
if(inventory.getCount(foodID) > 0)
{
//Flag that lets us known when we've healed
boolean okToContinue = false;
//Get the player's health
int playerHealthBefore = combat.getHealth();
//Try to eat the food
while (okToContinue == false)
{
RSItem foodItem = inventory.getItem(foodID);
foodItem.doClick(true);
sleep(random(2500,3000));
//Did the player's health increase?
int playerHealthNow = combat.getHealth();
if (playerHealthNow > playerHealthBefore)
{
okToContinue = true;
t_foodConsumed++; //Update food tracker
}
}
}
}

//This method will essentially make the script sleep until the bank is open
//but it will only wait the specified number of seconds
private void waitForBankToOpen(int maxSeconds)
{
int loopCounter = 0;
while (!bank.isOpen())
{
sleep(100);
loopCounter++;

//Have we reached our time limit? If so we will return.
if (loopCounter == maxSeconds * 10) return;
}
}

//Wait a specified maximum number of seconds for an object to appear before giving up
private void waitForObject(int theObjectID, int maxSeconds)
{
int loopCounter = 0;
RSObject objLocator = objects.getNearest(theObjectID);

while (objLocator == null)
{
objLocator = objects.getNearest(theObjectID);
sleep(100);
loopCounter++;

//Have we reached our time limit? If so we will return.
if (loopCounter == maxSeconds * 10) return;
}
}

//Wait for a specified interface/component to appear or x seconds
private void waitForInterface(int interfaceNum, int componentNum, int maxSeconds)
{
RSComponent targetInterface;
int loopCounter = 0;
boolean okToGo = false;
while (!okToGo)
{
sleep(100);
loopCounter++;

//Have we reached our time limit? If so we will return.
if (loopCounter == maxSeconds * 10) return;

//Try to get the interface
targetInterface = interfaces.getComponent(interfaceNum, componentNum);
//If the interface is valid and exists then we can return
if (targetInterface != null && targetInterface.isValid()) okToGo = true;
}
}

//Will walk to the bank in Sophanem, climbing ladders as necessary
private void getToTheBank()
{
//Is the bank close by?
RSObject bankBoothLocation = objects.getNearest(bankBooth);
if (bankBoothLocation != null)
{
//We found the bank, is it visible?
if (bankBoothLocation.isOnScreen())
{
bankBoothLocation.interact("quickly");
waitForBankToOpen(5);
}
else
{
//Only walk toward the booth is we're not already moving
if (!getMyPlayer().isMoving())
{
walking.walkTileMM(bankBoothLocation.getLocation());
sleep(1500,2000);
}
}
}
else
{
//Walk toward the ladder if the ladder isn't on the screen
if (!ladderToBankVisible())
//walkThisPath(pathToBank);
walkTo(tileBank);
else
doLadders(); //Climb down the ladder to the bank
}
}

//Perform banking activities such as depositing and withdrawing as necessary
private void doBanking()
{
//Are we holding a sceptre? If so then add it to the sceptre counter
if (inventory.contains(sceptreID))
t_sceptresCollected++;

//Deposit any items we're holding
bank.depositAll();
sleep(random(500,800));
//Count how many potions and food are in the bank
int countPots4 = bank.getCount(antiPoisonIDs[3]);
int countPots3 = bank.getCount(antiPoisonIDs[2]);
int countPots2 = bank.getCount(antiPoisonIDs[1]);
int countPots1 = bank.getCount(antiPoisonIDs[0]);
int countFood = bank.getCount(foodID);

//Don't even process the anti-poison code if we don't have enough food
if (countFood < 15)
{
log("You don't have enough food left or it isn't visible!");
log("Not going to risk getting you killed. Stopping script...");
stopScript(true);
}

//are we consuming antipoisons?
if (!usingTotem)
{
//Do we have enough potions and food?
if (countPots1 == 0 && countPots2 == 0 && countPots3 == 0 && countPots4 == 0)
{
log("You don't have any Super Anti-Poison potions left or I can't find them!");
log("Not going to risk getting you killed. Stopping script...");
stopScript(true);
}
else if (countPots4 >= 4)
{
//Our preferred situation is four 4-dose pots
bank.withdraw(antiPoisonIDs[3], 4);
}
else //Withdraw whatever else we can
{
//Do we have ANY four dose? If so withdraw them all (since it must be less than 4)
if (countPots4 > 0) bank.withdraw(antiPoisonIDs[3], countPots4);
//Repeat this process until we have at least 4 pots in our inventory or all of the
//pots in the bank if there are less than 4
if (countPots3 > 0) bank.withdraw(antiPoisonIDs[2], 4 - countPots4);
//Only withdraw more if we have 3 or less in our inventory now
if (countPots4 + countPots3 < 4)
if (countPots2 > 0) bank.withdraw(antiPoisonIDs[1], 4 - countPots3 - countPots4);
//Ditto the above for the single dose pots
if (countPots4 + countPots3 + countPots2 < 4)
if (countPots1 > 0) bank.withdraw(antiPoisonIDs[0], 4 - countPots2 - countPots3 - countPots4);
//The bank will either have no antis left if the above line runs, or it will only contain single doses
}
}

//Now withdraw the food
bank.withdraw(foodID, 0);
guardianRoom = 1; //Set the guardian room to 1 so we can start fresh in finding the guardian
}

//Walk a path
private void walkTo(RSTile thisTile)
{
RSWeb webToTile = web.getWeb(getMyPlayer().getLocation(), thisTile);

try
{
if (webToTile != null)
{
webToTile.step();
sleep(random(900,1300));
}
}
catch (Exception ex) { }
}

//Is the ladder down to the bank visible?
private boolean ladderToBankVisible()
{
RSObject ladderFinder = objects.getNearest(ladderDown);
if (ladderFinder != null)
{
if (ladderFinder.isOnScreen()) return true;
}
return false;
}

//Runs immediately after the walkThisPath, checks for ladders while walking to climb them as needed
private void doLadders()
{
RSObject ladderFinder;
if (inventoryReady())
{
//Search for the ladder up ID
ladderFinder = objects.getNearest(ladderUp);
}
else
{
//Search for the ladder down ID
ladderFinder = objects.getNearest(ladderDown);
}

//If one of the ladders exists...
if (ladderFinder != null)
{
//Is it visible on the screen?
if (ladderFinder.isOnScreen())
{
//Try clicking it
sleep(random(300,500));
ladderFinder.interact("Climb");
sleep(random(2300,3000));
}
}
}

//Returns true if a sceptre is found on the ground
private boolean sceptreOnGround()
{
RSGroundItem sceptreResult = groundItems.getNearest(sceptreID);
return (sceptreResult != null);
}

//Determines if our inventory contains any junk items(ivory, pottery, or stone)
private boolean inventoryContainsJunk()
{
//Loop through all of the junk items and see if any are in our inventory
for (int i=0; i< junkItems.length;i++)
{
if (inventory.contains(junkItems)) return true;
}

return false;
}

//Drop junk items
private void dropJunk()
{
boolean junkFound = false; //Flag that gets set if we drop any junk, used for the pause at the end to prevent spam clicking

for (RSItem item : inventory.getItems())
{
if (arrayContains(junkItems, item.getID()))
{
junkFound = true;
currentStatus = "Dropping junk items";
//Drop junk item
item.interact("Drop");
//Occasionally sleep for antiban measure
if (enableAntiban)
{
int rndVal = random(1, 30);
if (rndVal == 10) sleep(random(1000,2000));
}
}
}

if (junkFound) sleep(random(800,1400));
}

public boolean arrayContains(int[] array, int num)
{
for (int i : array) {
if (i == num)
return true;
}
return false;
}

//Will collect a sceptre that is on the ground
private void collectSceptre()
{
if(inventory.isFull())
{
if (inventory.contains(emptyVialID))
{
RSItem vialID = inventory.getItem(emptyVialID);
vialID.interact("Drop");
sleep(random(600,1000));
}
else if (inventory.contains(foodID))
{
RSItem foodItem = inventory.getItem(foodID);
foodItem.interact("Eat");
sleep(1400, 1900);
}
else if(inventory.contains(185))
{
RSItem item = inventory.getItem(185);
item.interact("Drop");
sleep(random(600,1000));
}
else if(inventory.contains(183)){
RSItem item = inventory.getItem(183);
item.interact("Drop");
sleep(random(600,1000));
}
else if(inventory.contains(181)){
RSItem item = inventory.getItem(181);
item.interact("Drop");
sleep(random(600,1000));
}
else
{
log("Something went wrong! Unable to pick up sceptre!");
}
}

//Pick it up
RSGroundItem sceptreFinder = groundItems.getNearest(sceptreID);
if(sceptreFinder != null)
{
//Walk to it if it isn't on screen
if (!sceptreFinder.isOnScreen())
{
walking.walkTileMM(sceptreFinder.getLocation());
sleep(random(1500,3000));
return;
}

sceptreFinder.interact("Take");
sleep(random(1200, 1800));
log("Found and collected a sceptre!");
}
}

//Get past the spike traps
private void passSpikeTrap()
{
//Are we in a room of the pyramid?
if (getCurrentRoom() > 0)
{
//Can we find a spike trap?
RSObject closeSpike = objects.getNearest(spikeTrap);
if (closeSpike != null)
{
//Safeguard: Have we failed the trap 3 times in a row?
if (spikeFailures == 3)
{
currentStatus = "Failsafe: Stuck at spikes!";
//Just walk away from the spikes and retry
RSObject safeSpot = objects.getNearest(roomExit);
if (safeSpot != null)
{
walking.walkTileMM(safeSpot.getLocation());
moveCamera();
sleep(random(1000,1500));
spikeFailures = 0;
}
}

if (closeSpike.isOnScreen())
{
currentStatus = "Getting past spike trap";
//Keep track of health to determine if we failed it
int healthNow = combat.getLifePoints();
int healthBefore = combat.getLifePoints();
//Click the spikes
closeSpike.doClick();
//Update to fix spike mis-click issue
//RSObject thisSpike = objects.getTopAt(spikeLocations[(getCurrentRoom() - 1)]);
//RSTile thisSpikeTile = spikeLocations[(getCurrentRoom() - 1)];
//mouse.move(calc.tileToScreen(thisSpikeTile));
//mouse.click(true);

resetDoors();
moveMouseAround();
//30% chance of moving the camera again
if (random(0,100) > 70) moveCamera();

//Wait for something to happen or 5 seconds max before retrying
int loops = 0;
while (spikePassed == false)
{
healthNow = combat.getLifePoints();
if (healthNow < healthBefore)
{
//We failed the trip if our health dropped
spikeFailures++;
moveCamera();
sleep(random(400,700));
return;
}

sleep(100);
//Don't wait more than 5 seconds before trying again
loops++;
if (loops >= 50) break;
}
sleep(random(1000,1500));
if (isPastSpikes())
{
spikePassed = false;
}
else
{
//Give the player more time finish walking (lame animation)
spikeFailures = 0;
sleep(random(1300,1700));
}
}
else
{
currentStatus = "Getting past spike trap";
//Get closer to it
RSTile tempTile = new RSTile(getMyPlayer().getLocation().getX(), getMyPlayer().getLocation().getY() - 2);
walking.walkTileOnScreen(tempTile);
sleep(random(1200,1600));
}
}
}
}

//This method will determine if we're past the spike traps in a given room
private boolean isPastSpikes()
{
if (getCurrentRoom() > 0)
{
switch (getCurrentRoom())
{
case 1:
if (getMyPlayer().getLocation().getY() < room1SpikeYLoc)
return true;
else
return false;
case 2:
if (getMyPlayer().getLocation().getY() < room2SpikeYLoc)
return true;
else
return false;
case 3:
if (getMyPlayer().getLocation().getY() < room3SpikeYLoc)
return true;
else
return false;
case 4:
if (getMyPlayer().getLocation().getX() > room4SpikeXLoc)
return true;
else
return false;
case 5:
if (getMyPlayer().getLocation().getX() < room5SpikeXLoc)
return true;
else
return false;
case 6:
if (getMyPlayer().getLocation().getY() > room6SpikeYLoc)
return true;
else
return false;
case 7:
if (getMyPlayer().getLocation().getY() > room7SpikeYLoc)
{
return true;
}
else
{
//Special case since two of the doors in the room can be below this position
if (getMyPlayer().getLocation().getX() > 1947)
return true;
else
return false;
}
case 8:
if (getMyPlayer().getLocation().getY() > room8SpikeYLoc)
return true;
else
return false;
}
}
return false;
}

public void mouseMoved(MouseEvent e)
{
double mX = e.getX();
double mY = e.getY();
double thisX, thisY;

//Is the mouse over the start button?
//456, 425, 50, 18
thisX = 456; thisY = 425;
if (mX >= thisX & mX <= (thisX + 50) && mY >= thisY && mY <= (thisY + 18))
mouseOverStartButton = true;
else
mouseOverStartButton = false;

//Is the mouse over the cancel button?
thisX = 456; thisY = 450;
if (mX >= thisX & mX <= (thisX + 50) && mY >= thisY && mY <= (thisY + 18))
mouseOverCancelButton = true;
else
mouseOverCancelButton = false;

}

public void mouseDragged(MouseEvent e)
{

}

public void mouseClicked(MouseEvent e)
{
double mX = e.getX();
double mY = e.getY();
double thisX, thisY;

//Did the user finish configuring settings?
if (setupCompleted)
{
//Was the mouse clicked within the area of the hide/show box?
if (e.getX() >= 476 && e.getX() <= 515
&& e.getY() >= 322 && e.getY() <= 337)
{
//User clicked within the box, so toggle HUD!
if (hideHUD == true)
hideHUD = false;
else
hideHUD = true;
}
}
else
{
//User is on the settings menu so we have special area code
//--Food selection--
//Trout (20,405)
thisX = 20; thisY = 405;
if (mX >= thisX & mX <= (thisX + 80) && mY >= thisY && mY <= (thisY + 10))
foodSelection = 0;
//Salmon (20,420)
thisX = 20; thisY = 420;
if (mX >= thisX & mX <= (thisX + 80) && mY >= thisY && mY <= (thisY + 10))
foodSelection = 1;
//Tuna (20,435)
thisX = 20; thisY = 435;
if (mX >= thisX & mX <= (thisX + 80) && mY >= thisY && mY <= (thisY + 10))
foodSelection = 2;
//Lobster (20,450)
thisX = 20; thisY = 450;
if (mX >= thisX & mX <= (thisX + 80) && mY >= thisY && mY <= (thisY + 10))
foodSelection = 3;
//Swordfish (90,405)
thisX = 90; thisY = 405;
if (mX >= thisX & mX <= (thisX + 80) && mY >= thisY && mY <= (thisY + 10))
foodSelection = 4;
//Monkfish (90,420)
thisX = 90; thisY = 420;
if (mX >= thisX & mX <= (thisX + 80) && mY >= thisY && mY <= (thisY + 10))
foodSelection = 5;
//Shark (90,435)
thisX = 90; thisY = 435;
if (mX >= thisX & mX <= (thisX + 80) && mY >= thisY && mY <= (thisY + 10))
foodSelection = 6;

foodID = foodList[foodSelection];


//--Loot Chests selection--
//187,405, 1
thisX = 187; thisY = 405;
if (mX >= thisX & mX <= (thisX + 25) && mY >= thisY && mY <= (thisY + 10))
lootChest[0] = !lootChest[0];
//187,420, 2
thisX = 187; thisY = 420;
if (mX >= thisX & mX <= (thisX + 25) && mY >= thisY && mY <= (thisY + 10))
lootChest[1] = !lootChest[1];
//187,435, 3
thisX = 187; thisY = 435;
if (mX >= thisX & mX <= (thisX + 25) && mY >= thisY && mY <= (thisY + 10))
lootChest[2] = !lootChest[2];
//187,450, 4
thisX = 187; thisY = 450;
if (mX >= thisX & mX <= (thisX + 25) && mY >= thisY && mY <= (thisY + 10))
lootChest[3] = !lootChest[3];
//227,405, 5
thisX = 227; thisY = 405;
if (mX >= thisX & mX <= (thisX + 25) && mY >= thisY && mY <= (thisY + 10))
lootChest[4] = !lootChest[4];
//227,420, 6
thisX = 227; thisY = 420;
if (mX >= thisX & mX <= (thisX + 25) && mY >= thisY && mY <= (thisY + 10))
lootChest[5] = !lootChest[5];
//227,435, 7
thisX = 227; thisY = 435;
if (mX >= thisX & mX <= (thisX + 25) && mY >= thisY && mY <= (thisY + 10))
lootChest[6] = !lootChest[6];
//227,450, 8
thisX = 227; thisY = 450;
if (mX >= thisX & mX <= (thisX + 25) && mY >= thisY && mY <= (thisY + 10))
lootChest[7] = !lootChest[7];

//--Misc--
//280, 405
thisX = 280; thisY = 405;
if (mX >= thisX & mX <= (thisX + 100) && mY >= thisY && mY <= (thisY + 10))
advancedGFX = !advancedGFX;
//280, 420
thisX = 280; thisY = 420;
if (mX >= thisX & mX <= (thisX + 100) && mY >= thisY && mY <= (thisY + 10))
dropJunkItems = !dropJunkItems;
//280, 435
thisX = 280; thisY = 435;
if (mX >= thisX & mX <= (thisX + 100) && mY >= thisY && mY <= (thisY + 10))
enableAntiban = !enableAntiban;
//280, 450
thisX = 280; thisY = 450;
if (mX >= thisX & mX <= (thisX + 100) && mY >= thisY && mY <= (thisY + 10))
noobMode = !noobMode;
//380, 405
thisX = 380; thisY = 405;
if (mX >= thisX & mX <= (thisX + 100) && mY >= thisY && mY <= (thisY + 10))
usingTotem = !usingTotem;
//380, 420
thisX = 380; thisY = 420;
if (mX >= thisX & mX <= (thisX + 100) && mY >= thisY && mY <= (thisY + 10))
{
skippingUrns = !skippingUrns;

//If skipping urns, select all of the chests by default
if (skippingUrns)
{
lootChest[0] = true; lootChest[1] = true;
lootChest[2] = true; lootChest[3] = true;
lootChest[4] = true; lootChest[5] = true;
lootChest[6] = true; lootChest[7] = true;
}
}
//380, 435
thisX = 380; thisY = 435;
if (mX >= thisX & mX <= (thisX + 100) && mY >= thisY && mY <= (thisY + 10))
safeEater = !safeEater;

//--Start button--
//456, 425, 50, 18
thisX = 456; thisY = 425;
if (mX >= thisX & mX <= (thisX + 50) && mY >= thisY && mY <= (thisY + 18))
{
setupCompleted = true;
}

//--Cancel button--
//456, 450, 50, 18
thisX = 456; thisY = 450;
if (mX >= thisX & mX <= (thisX + 50) && mY >= thisY && mY <= (thisY + 18))
{
log("Script startup cancelled by user!");
stopScript();
}
}
}

@Override
public void mouseEntered(MouseEvent arg0) { }

@Override
public void mouseExited(MouseEvent arg0) { }

@Override
public void mousePressed(MouseEvent arg0) { }

@Override
public void mouseReleased(MouseEvent arg0) { }


public void messageReceived(MessageEvent arg0)
{
try
{
String serverString = arg0.getMessage();

if (serverString.contains("bandaged hand punches you away"))
{
mummyPreventedEntrance = true;
}

if (serverString.contains("ou deactivate the trap"))
{
spikePassed = true;
}

if (serverString.contains("successfully loot the urn") || serverString.contains("have already looted"))
{
thisUrnSuccess = true;
}

if (serverString.contains("bitten by something moving"))
{
thisUrnFailure = true;
}

if (serverString.contains("our attempt fails"))
{
//Since this is the same string as failing to loot an urn, we should check
//to see what we're doing based on location
if (isPastSpikes())
thisDoorFailure = true;
}

if (serverString.contains("leads to a dead end"))
{
thisDoorSuccess = true;
}
}
catch(java.lang.Throwable t){}
}

//Will move the mouse around randomly with a little delay.
private void moveMouseAround()
{
//Don't do this if antiban option is disabled
if (!enableAntiban) return;

//Move the mouse
sleep(random(300,600));
mouse.moveSlightly();

//1 in 5 chance of moving it again
if (random(1,5) == 3)
{
sleep(random(100,300));
mouse.moveSlightly();
}
}

private void moveCamera()
{
//Don't do this if antiban option is disabled
if (!enableAntiban) return;

//Get the current angle
int curAngle = camera.getAngle();
//Move the angle within 90 degrees of the current angle
int newAngle = (random(curAngle - 90, curAngle + 90));
if (newAngle > 360) newAngle = (newAngle - 360);
if (newAngle < 0) newAngle = (newAngle + 360);
camera.setAngle(newAngle);
}

private String formatRunTime(long hours, long minutes, long seconds)
{
String formattedTime = String.valueOf(hours);
if (minutes < 10) {
formattedTime = formattedTime + ":0" + String.valueOf(minutes);
}
else formattedTime = formattedTime + ":" + String.valueOf(minutes);
if (seconds < 10) {
formattedTime = formattedTime + ":0" + String.valueOf(seconds);
}
else formattedTime = formattedTime + ":" + String.valueOf(seconds);

return formattedTime;
}

public void onRepaint(Graphics g1)
{
Graphics2D g = (Graphics2D)g1;

if (game.isLoggedIn())
{
//If initial setup hasn't been completed yet then draw the setup graphics
if (!setupCompleted)
{
//----- Draw the background image -----
g.drawImage(BKG, 0, 338, null);

//---FOOD CHOICES---
g.setFont(new Font("Verdana", Font.BOLD, 12));
g.setColor(Color.GREEN);
g.drawString("Food Choices", 40, 395);
g.drawLine(40, 398, 140, 398);
g.setColor(clrBright);
g.drawRect(12, 380, 150, 87);

boolean checkThisBox;
if (foodSelection == 0) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,20,405,"Trout", checkThisBox);
if (foodSelection == 1) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,20,420,"Salmon", checkThisBox);
if (foodSelection == 2) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,20,435,"Tuna", checkThisBox);
if (foodSelection == 3) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,20,450,"Lobster", checkThisBox);
if (foodSelection == 4) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,90,405,"Swordfish", checkThisBox);
if (foodSelection == 5) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,90,420,"Monkfish", checkThisBox);
if (foodSelection == 6) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,90,435,"Shark", checkThisBox);

//---LOOT CHESTS---
g.setFont(new Font("Verdana", Font.BOLD, 12));
g.setColor(Color.YELLOW);
g.drawString("Loot Chests", 180, 395);
g.drawLine(180, 398, 255, 398);
g.setColor(clrBright);
g.drawRect(172, 382, 93, 85);

if (lootChest[0]) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,187,405,"1", checkThisBox);
if (lootChest[1]) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,187,420,"2", checkThisBox);
if (lootChest[2]) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,187,435,"3", checkThisBox);
if (lootChest[3]) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,187,450,"4", checkThisBox);
if (lootChest[4]) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,227,405,"5", checkThisBox);
if (lootChest[5]) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,227,420,"6", checkThisBox);
if (lootChest[6]) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,227,435,"7", checkThisBox);
if (lootChest[7]) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,227,450,"8", checkThisBox);

//---OTHER---
g.setFont(new Font("Verdana", Font.BOLD, 12));
g.setColor(Color.CYAN);
g.drawString("Other Settings", 280, 395);
g.drawLine(280, 398, 375, 398);

if (advancedGFX) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,280,405, "High Gfx", checkThisBox);
if (dropJunkItems) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,280,420, "Drop Junk", checkThisBox);
if (enableAntiban) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,280,435, "Antiban", checkThisBox);
if (noobMode) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,280,450, "Noob Mode", checkThisBox);
if (usingTotem) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,380,405, "Totem", checkThisBox);
if (skippingUrns) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,380,420, "Skip Urns", checkThisBox);
if (safeEater) checkThisBox = true; else checkThisBox = false;
drawCheckbox(g,380,435, "Eat More", checkThisBox);

//Draw the Start button
drawButton(g, 456, 425, 50, 18, " Start");

//Draw the Cancel button
drawButton(g, 456, 450, 50, 18, "Cancel");

//Outline the start button in green if the mouse is hovering it
if (mouseOverStartButton)
{
//Special - Outline button in green
g.setColor(Color.GREEN);
g.drawRect(455, 424, 52, 20);
}

//Outline the cancel button in red if the mouse is hovering it
if (mouseOverCancelButton)
{
//Special - Outline button in red
g.setColor(Color.RED);
g.drawRect(455, 449, 52, 20);
}
}
else
{
g.setRenderingHints(antialiasing);

//----- Draw the mouse -----
//if (advancedGFX) //Only if advanced graphics are enabled
//{
g.setColor(Color.RED);
g.drawOval(mouse.getLocation().x -1, mouse.getLocation().y -1, 2, 2);
g.setColor(Color.BLACK);
g.drawOval(mouse.getLocation().x - 7, mouse.getLocation().y - 7, 14, 14);
g.drawLine(mouse.getLocation().x - 1000, mouse.getLocation().y,mouse.getLocation().x - 7, mouse.getLocation().y);
g.drawLine(mouse.getLocation().x + 1000, mouse.getLocation().y,mouse.getLocation().x + 7, mouse.getLocation().y);
g.drawLine(mouse.getLocation().x, mouse.getLocation().y - 1000, mouse.getLocation().x, mouse.getLocation().y - 7);
g.drawLine(mouse.getLocation().x, mouse.getLocation().y + 1000, mouse.getLocation().x, mouse.getLocation().y + 7);
//}

//Draw the HUD if it is not hidden
if (hideHUD == false)
{
long seconds = 0;
long minutes = 0;
long hours = 0;
String formattedTime = "";

//Length of time the script has been running
long runTime = System.currentTimeMillis() - startTime;

//Should we log out?
//if (minsToLogout > 0) {
// if ((runTime / 1000) / 60 == minsToLogout && logoutInitiated == false) {
// logoutInitiated = true;
// }
//}

seconds = runTime / 1000;
if (seconds >= 60) {
minutes = seconds / 60;
seconds -= minutes * 60;
}
if (minutes >= 60) {
hours = minutes / 60;
minutes -= hours * 60;
}

//Format the time so it looks like proper time (Why don't all script writers do this?)
formattedTime = formatRunTime(hours, minutes, seconds);

//----- Calculations -----
int xpGainedThieving = (skills.getCurrentExp(skills.THIEVING) - t_xpStartThieving);
int xpPHThieving = (int) ((xpGainedThieving) * 3600000D / (System.currentTimeMillis() - startTime));
if(xpPHThieving > 0)
ttlCalcT = (long) (skills.getExpToNextLevel(skills.THIEVING) * 3600000D) / xpPHThieving;

//----- Draw the background image -----
g.drawImage(BKG, 0, 338, null);

//----- Draw large text fields -----
g.setFont(new Font("sans serif", Font.BOLD, 13));
g.setColor(Color.WHITE);
g.drawString("Time Running: " + formattedTime, 15, 395);
g.drawString("Exp Gained: " + xpGainedThieving + " (" + xpPHThieving + " /hr)", 15, 415);
if (skills.getRealLevel(skills.THIEVING) < 99)
g.drawString("Time to " + (skills.getRealLevel(skills.THIEVING) + 1) + " Thieving: " + getTime(ttlCalcT), 15, 435);
else
g.drawString("You are a master thief!", 15, 435);

//----- Draw small text fields (trackers) -----
g.setFont(new Font("Verdana", Font.PLAIN, 9));
g.setColor(Color.ORANGE);
g.drawString("Pyramids Completed: " + (t_tripsCompleted - 1), 325, 390);
g.drawString("Consumed Food: " + t_foodConsumed, 325, 400);
g.drawString("Consumed Anti: " + t_antiConsumed, 325, 410);
g.setColor(Color.YELLOW);
g.drawString("Urns Looted: " + t_urnsLooted, 325, 420);
g.drawString("Urns Failed: " + t_urnsFailed, 325, 430);
g.setColor(Color.LIGHT_GRAY);
g.drawString("Chests Looted: " + t_chestsLooted, 325, 440);
g.drawString("Sceptres Collected: " + t_sceptresCollected, 325, 450);

//----- Draw the status indicator -----
g.setFont(new Font("sans serif", Font.PLAIN, 12));
g.setColor(Color.GREEN);
g.drawString("Status: " + currentStatus, 15, 455);

//----- Draw a thieving level progress bar -----
int prctToGo = skills.getPercentToNextLevel(skills.THIEVING);
double prctImg = (prctToGo * 5);
//Draw the semi-transparent background for the bar
g.setColor(new Color(0, 0, 0, 150));
g.fillRect(7, 461, 503, 11);
//Draw an outline over it
g.setColor(new Color(0, 0, 0, 150));
g.drawRect(7, 461, 503, 11);
//Draw the top part of the progress meter
g.setColor(new Color(189, 167, 128, 150));
g.fillRect(8, 462, (int) prctImg, 5);
//And the bottom part of the progress meter
g.setColor(new Color(85, 79, 63, 150));
g.fillRect(8, 467, (int) prctImg, 6);

//----- Draw the text over top of the progress bar -----
//Did we gain any levels?
int levelsGained = (skills.getRealLevel(skills.THIEVING) - t_lvlStartThieving);
g.setFont(new Font("Verdana", Font.PLAIN, 9));
g.setColor(Color.WHITE);
if (levelsGained > 0)
g.drawString("Thieving Level: " + skills.getRealLevel(skills.THIEVING) + " (" + levelsGained + ")", 10, 471);
else
g.drawString("Thieving Level: " + skills.getRealLevel(skills.THIEVING), 10, 471);
//Draw the percentage on the right side of the progress bar
g.drawString(prctToGo + "%", 480, 471);

//----- Draw a box allowing the HUD to be hidden -----
//Draw the semi-transparent background
g.setColor(new Color(0, 0, 0, 150));
g.fillRect(479, 322, 39, 15);
//Draw the text
g.setFont(new Font("Verdana", 0, 9));
g.setColor(Color.WHITE);
g.drawString("HIDE", 486, 334);
g.setColor(Color.BLACK);
g.drawRect(479, 322, 39, 15);
}
else
{
//The HUD is hidden so only drop the box allowing it to be shown again
//----- Draw a box allowing the HUD to be hidden -----
//Draw the semi-transparent background
g.setColor(new Color(0, 0, 0, 150));
g.fillRect(479, 322, 39, 15);
//Draw the text
g.setFont(new Font("Verdana", 0, 9));
g.setColor(Color.WHITE);
g.drawString("SHOW", 482, 334);
g.setColor(Color.BLACK);
g.drawRect(479, 322, 39, 15);
}

if (advancedGFX)
{
//Colorize the urns if they're close by and not finished
if (getCurrentRoom() == maxRoom())
{
//Loop through the urns
if (!allUrnsCompleted())
{
for (int i=0; i < 13; i++)
{
//Is this urn completed?
if (urnCompleted == false)
{
//Get the urn's location
RSObject tempUrn = objects.getNearest(urnsCurrent);
//Is it visible?
if (tempUrn.isOnScreen())
{
//Colorize it
g.setColor(new Color(0,255,0,100));
Polygon myPoly = getPolygonFromTile(tempUrn.getLocation());
if (myPoly != null)
g.fillPolygon(myPoly);
}
}
}
}
}

//Colorize the chest if we're looting it (but not the final room)
if (getCurrentRoom() > 0 && getCurrentRoom() != maxRoom())
{
if (lootChest[getCurrentRoom() - 1] == true && thisChestLooted == false)
{
//Get the chest's location
RSObject tempChest = objects.getNearest(chestID);
//Is it visible?
if (tempChest.isOnScreen())
{
//Colorize it
g.setColor(new Color(0,255,0,100));
Polygon myPoly = getPolygonFromTile(tempChest.getLocation());
if (myPoly != null)
g.fillPolygon(myPoly);
}
}
}
} //advancedGFX
}//setupCompleted
}
}

private Polygon getPolygonFromTile(final RSTile tile)
{
if (tile == null) return null;
final Point[] corners = {calc.tileToScreen(tile, 0, 1, 0), calc.tileToScreen(tile, 1, 1, 0),calc.tileToScreen(tile, 1, 0, 0),calc.tileToScreen(tile, 0, 0, 0)};
final int[] xPoints = { corners[0].x, corners[1].x, corners[2].x, corners[3].x };
final int[] yPoints = { corners[0].y, corners[1].y, corners[2].y, corners[3].y };
//If any of the points are 0 or less than 0 then we'll
//assume the entire tile isn't on the screen and ignore it
for (int i=0; i < corners.length; i++)
{
if (corners.x <= 0 || corners.y <= 0)
{
return null;
}
}
return new Polygon(xPoints, yPoints, 4);
}

private void drawButton(Graphics2D g, int xPos, int yPos, int btnWidth, int btnHeight, String theText)
{
//Outline the box in black
g.setColor(Color.BLACK);
g.drawRect(xPos -1, yPos -1, btnWidth + 2, btnHeight + 2);

//Draw the background of the button (middle color)
g.setColor(clrMiddle);
g.fillRect(xPos, yPos, btnWidth, btnHeight);

//Draw the color for the top and left side of the button (bright color)
g.setColor(clrBright);
g.drawLine(xPos, yPos, xPos + btnWidth, yPos);
g.drawLine(xPos, yPos, xPos, yPos + btnHeight);

//Draw the right and bottom sides of the button (dark color)
g.setColor(clrDark);
g.drawLine(xPos, yPos + btnHeight, xPos + btnWidth, yPos + btnHeight);
g.drawLine(xPos + btnWidth, yPos, xPos + btnWidth, yPos + btnHeight);

//Draw the text
g.setColor(Color.WHITE);
g.setFont(new Font("Verdana", 0, 10));
g.drawString(theText, xPos + 5, yPos + 13);
}

private void drawCheckbox(Graphics2D g, int xPos, int yPos, String theText, boolean isChecked)
{
//Outline the box in black
g.setColor(Color.BLACK);
g.drawRect(xPos -1, yPos -1, 12, 12);

//Draw the top and left sides (dark color)
g.setColor(clrDark);
g.drawLine(xPos, yPos, xPos + 10, yPos);
g.drawLine(xPos, yPos, xPos, yPos + 10);

//Draw the right and bottom sides (bright color)
g.setColor(clrBright);
g.drawLine(xPos, yPos + 10, xPos + 10, yPos + 10);
g.drawLine(xPos + 10, yPos, xPos + 10, yPos + 10);

//Draw the text
g.setColor(Color.WHITE);
g.setFont(new Font("Verdana", 0, 10));
g.drawString(theText, xPos + 15, yPos + 9);

if (isChecked)
{
//Fill with the middle color if it is checked
g.setColor(clrMiddle);
g.fillRect(xPos + 1, yPos + 1, 9, 9);
}

}

public String getTime(long millis)
{
long time = millis / 1000;
String seconds = Integer.toString((int) (time % 60));
String minutes = Integer.toString((int) ((time % 3600) / 60));
String hours = Integer.toString((int) (time / 3600));
for (int i = 0; i < 2; i++) {
if (seconds.length() < 2) {
seconds = "0" + seconds;
}
if (minutes.length() < 2) {
minutes = "0" + minutes;
}
if (hours.length() < 2) {
hours = "0" + hours;
}
}
String returnThis = hours + ":" + minutes + ":" + seconds;
return returnThis;
}
}
 
Joined
Dec 10, 2014
Messages
3,255
The formatting's a bit off :/
Maybe try wrapping it in code tags?

Also, this made me cringe a bit
Code:
String returnThis = hours + ":" + minutes + ":" + seconds;
return returnThis;
 
Joined
Jan 28, 2015
Messages
12
this was a rough overveiw if anyone wants the java file i would be more than welcome to facilitate. :p
 
Joined
Jan 1, 2015
Messages
272
and for what it is worth I already have one that is developed just the person who was loaning me the account has changed the pass so I have been at a stand still.

If someone could loan me an account that can access pp start with 2 super anti p and 5 food and start at bank i dont need bank pin or anything
 
Top