Can someone hook it up with these scripts.

Discussion in 'RuneScape 3 Cheating' started by Magical Dubie, Feb 18, 2009.

Can someone hook it up with these scripts.
  1. Unread #1 - Feb 18, 2009 at 12:33 AM
  2. Magical Dubie
    Joined:
    Jun 23, 2008
    Posts:
    326
    Referrals:
    1
    Sythe Gold:
    0

    Magical Dubie Forum Addict
    Banned

    Can someone hook it up with these scripts.

    The most updated Aeilien Profisher or whatever its called, Tenacs GuildMiner, and good pure essence miner?

    Id really appreciate it because rsbot.org is still down for me and i know some of these people have these scripts. I did search the forums and really found nothing i trust. Thanks :]
     
  3. Unread #2 - Feb 18, 2009 at 12:44 AM
  4. JK345
    Joined:
    Jul 28, 2008
    Posts:
    21
    Referrals:
    0
    Sythe Gold:
    0

    JK345 Newcomer

    Can someone hook it up with these scripts.

    Aelin ProFisher
    Code:
    //
    // Script:
    // Pro Fisher v0.17
    //
    // Author:
    // Daniel Reed [Aelin]
    //
    // Features:
    // Antiban [Random Exp Checker/Random Mouse Movement/Tab switches/Random camera
    // movement]
    // Anticombat
    // Banking
    // Multiple Fishing Modes
    // Withdraw bait/gear
    // Recover gear when lost.
    // Power fishing
    // Anti-whirlpool
    // Paint debug, including xp gained, levels gained, percent to next level,
    // catches, times avoided combat
    // whirlpools avoided and time running.
    // Added new paths for run from combat (More efficient than running all the way
    // to the bank.)
    //
    // Credits:
    // Flight - Used his whirlpool IDs.
    // Transactions for loaning me a fishing guild account.
    //
    // Revision 0.17
    // Starting in power mode and then restarting in banking mode now works.
    //
    // Revision 0.16
    // Fixed barbarian village paths and fixed anti-whirlpool code.
    //
    // Revision 0.15
    // Fixed a simple problem in banking.
    //
    // Revision 0.14
    // Added paint functions by Photonman for est to next level.
    //
    // Revision 0.13
    // Revised paths for barbarian village, both more efficient and doesn't seem to
    // get stuck anymore.
    //
    // Revision 0.12
    // Updated to work with non-deprecated RSBot #199+
    //
    // Revision 0.11
    // Revised the average per hour counter.
    //
    // Revision 0.10
    // Added catches per hour.
    //
    // Revision 0,09
    // Added catches to next level.
    //
    // Revision 0.08
    // Added parts of post and recovery (Will be added as they are discovered.)
    //
    // Revision 0.07
    // Revised paths and ids for the fishing guild.
    //
    // Revision 0.06
    // Further revised banking to fix bait fishing mode.
    //
    // Revision 0.05
    // Revised banking code, seems to work better.
    //
    // Revision 0.04
    // Fixed Catherby Double clicks.
    //
    // Revision 0.03
    // Updated to work with latest Runescape revision.
    // Updated run code.
    // 
    // Revision 0.01
    // Initial release.
    //
    import java.awt.*;
    import java.util.Map;
    
    import com.speljohan.rsbot.bot.Bot;
    import com.speljohan.rsbot.event.listeners.PaintListener;
    import com.speljohan.rsbot.script.*;
    import com.speljohan.rsbot.script.wrappers.*;
    
    public class ProFisher extends Script implements PaintListener {
    	RSTile[] toBank = new RSTile[] { new RSTile(3087, 3227),
    			new RSTile(3085, 3242), new RSTile(3092, 3243) };
    
    	RSTile[] toArea = reversePath(toBank);
    	RSTile[] lostTiles = new RSTile[] { new RSTile(2860, 3428) };
    	RSTile[] recoverTiles = new RSTile[] { new RSTile(2849, 3430) };
    	RSTile[] runAway;
    	RSTile[] runBack;
    	int[] fishingSpots = new int[] {
    	// Draynor:
    			327, 327,
    
    			// Barbarian Village:
    			328, 328, 328,
    
    			// Catherby:
    			320, 320, 321, 321, 322,
    
    			// Guild:
    			312, 312, 313 };
    	String[] fishingCommands = new String[] {
    	// Draynor
    			"Net", "Bait",
    
    			// Barbarian Village
    			"Bait", "Lure", "Lure",
    
    			// Catherby:
    			"Net", "Bait", "Cage", "Harpoon", "Harpoon",
    
    			// Guild:
    			"Cage", "Harpoon", "Harpoon" };
    	int[] gear = new int[] {
    	// Draynor:
    			303, 307,
    
    			// Barbarian Village:
    			307, 309, 309,
    
    			// Catherby
    			303, 307, 301, 311, 311,
    
    			// Fishing Guild:
    			301, 311, 311,
    
    			// To prevent deposit of baits.
    			313, 10087, 314 };
    
    	int[] bait = new int[] {
    	// Draynor:
    			0, 313,
    
    			// Barbarian Village:
    			313, 314, 314,
    
    			// Catherby:
    			0, 313, 0, 0, 0,
    
    			// Guild:
    			0, 0, 0 };
    	int[] whirlpools = new int[] { 403, 404, 406, 406 };
    
    	int bankBooth = 2213;
    	boolean powerMode = false;
    	long catches = 0;
    	long gainedExp = 0;
    	long gainedLevels = 0;
    	final int S_WALKTO_AREA = 1000;
    	final int S_WALKTO_BANK = 1500;
    	final int S_FISH = 2000;
    	final int S_USE_BANK = 2500;
    	final int S_USE_BANKSHILO = 2550;
    	final int S_DROP = 3000;
    	int state = S_FISH;
    	RSTile lumby = new RSTile(0, 0);
    	int selectedPath = 0;
    	int fails = 0;
    	final int maxFails = 25;
    	int mode = 0;
    	int checkTime;
    	long startTime;
    	long lastCheck;
    	int startLevel;
    	int startExp;
    	int oldExp;
    	int avoidedCombat;
    	int whirlpoolsAvoided;
    	int randomRun = random(20, 65);
    	int oldLevels;
    	int xpPerCatch = 0;
    	int countToNext = 0;
    	long oldCatches = 0;
    	long avgPerHour = 0;
    	long lastAvgCheck;
    
    	public String getAuthor() {
    		return "Aelin";
    	}
    
    	public String getName() {
    		return "Pro Fisher";
    	}
    
    	public double getVersion() {
    		return 0.17;
    	}
    
    	public String getScriptCategory() {
    		return "Aelin/Pro Series/Fishing";
    	}
    
    	public String getScriptDescription() {
    		String html = "";
    
    		html += "<html>\n";
    		html += "<body>\n";
    		html += "<h2>" + getName() + " v" + getVersion() + "</h2><br>";
    		html += "<font size=\"2\">";
    		html += "Author: " + getAuthor() + "<br><br>";
    		html += "</font>";
    		html += "<form>";
    		html += "<font size=\"2\">";
    		html += "0 - Draynor - Shimp/Anchovies<br>";
    		html += "1 - Draynor - Herrings/Sardines<br>";
    		html += "2 - Barbarian Village - Pike<br>";
    		html += "3 - Barbarian Village - Trout/Salmon<br>";
    		html += "4 - Barbarian Village - Rainbow Fish<br>";
    		html += "5 - Catherby - Shimp/Anchovies<br>";
    		html += "6 - Catherby - Herring/Sardines<br>";
    		html += "7 - Catherby - Lobsters<br>";
    		html += "8 - Catherby - Tuna/Swordfish<br>";
    		html += "9 -  Catherby - Sharks<br>";
    		html += "10 - Fishing Guild - Lobsters<br>";
    		html += "11 - Fishing Guild - Tuna/Swordfish<br>";
    		html += "<12 - Fishing Guild - Sharks<br>";
    		// html += "<13 - Pictoris - Monkfish<br>";
    		html += "Mode: <input type=\"text\" name=\"mode\"><br>";
    		html += "<input type=\"radio\" name=\"power\" value=\"true\">Powerfishing Mode<br>";
    		html += "</font>";
    		html += "</form>";
    		html += "</html>\n";
    
    		return html;
    	}
    
    	//
    	// onStart( )
    	//
    	public boolean onStart(Map<String, String> args) {
    		// Add server listeners.
    		Bot.getEventManager().addListener(PaintListener.class, this);
    		// Bot.getEventManager( ).addListener(ServerMessageListener.class,
    		// this);
    
    		// log( args.get("selmode") );
    		try {
    			mode = Integer.parseInt(args.get("mode"));
    			if (args.get("power").equals("true")) {
    				powerMode = true;
    				log("Power-fishing mode activated.");
    			} else {
    				powerMode = false;
    				log("Power-mining mode deactivated.");
    			}
    		} catch (Exception e) {
    
    		}
    
    		// Is the selected mode a draynor mode?
    		if (mode >= 0 && mode <= 1) {
    
    			log("Setting paths for draynor.");
    			toBank = new RSTile[] { new RSTile(3087, 3227),
    					new RSTile(3085, 3242), new RSTile(3092, 3243) };
    			toArea = reversePath(toBank);
    			runAway = toBank;
    			runBack = toArea;
    		}
    
    		// Is the selected mode a barbarian village mode?
    		if (mode >= 2 && mode <= 4) {
    			// Yes, set paths and ids accordingly.
    			log("Setting paths for barbarian village.");
    			toBank = new RSTile[] { new RSTile(3103, 3434),
    					new RSTile(3098, 3437), new RSTile(3091, 3447),
    					new RSTile(3089, 3459), new RSTile(3100, 3469),
    					new RSTile(3100, 3484), new RSTile(3094, 3491) };
    			toArea = reversePath(toBank);
    			bankBooth = 26972;
    		}
    
    		// Is the selected mode a catherby mode?
    		if (mode >= 5 && mode <= 9) {
    			// Yes, set paths and ids accordingly.
    			log("Setting paths for catherby.");
    			toBank = new RSTile[] { new RSTile(2848, 3430),
    					new RSTile(2839, 3435), new RSTile(2822, 3438),
    					new RSTile(2810, 3440) };
    			toArea = reversePath(toBank);
    			bankBooth = 2213;
    		}
    
    		// Is the selected mode a guild mode?
    		if (mode >= 10 && mode <= 12) {
    			// Yes, set paths and ids accordingly.
    			log("Setting paths for the fishing guild.");
    			toBank = new RSTile[] { new RSTile(2599, 3421),
    					new RSTile(2594, 3414), new RSTile(2588, 3420) };
    			toArea = reversePath(toBank);
    			bankBooth = 2213;
    		}
    
    		// Is the selected mode a pictoris mode?
    		if (mode == 13) {
    			// Yes, set paths and IDs accordingly.
    			log("Setting paths for pictoris.");
    
    		}
    
    		return true;
    	}
    
    	//
    	// onFinish( )
    	//
    	public void onFinish() {
    
    		// Remove listeners.
    		Bot.getEventManager().removeListener(PaintListener.class, this);
    		// Bot.getEventManager( ).removeListener(ServerMessageListener.class,
    		// this);
    	}
    
    	//
    	// loop( )
    	//
    	public int loop() {
    		// Lost/Recover
    		// If enough energy and run enable, then enable run.
    		if (getEnergy() >= randomRun && !isRunning()) {
    			log("Setting run.");
    			randomRun = random(20, 65);
    			setRun(true);
    			return random(500, 750);
    		}
    
    		// If the player is moving, antiban.
    		if (getMyPlayer().isMoving()) {
    			return antiBan();
    		}
    
    		// Stop script if fails is too high.
    		if (fails >= maxFails) {
    			// Stop all scripts.
    			stopAllScripts();
    		}
    
    		// Process script events, based on state.
    		switch (state) {
    			// S_WALKTO_AREA - Walk to fishing area.
    			case S_WALKTO_AREA:
    				// Is the play missing gear and is the gear laying on the
    				// ground?
    				RSItemTile itemTile = getGroundItemByID(gear[mode]);
    				if (getInventoryCount(gear[mode]) == 0 && itemTile != null) {
    					if (tileOnScreen(itemTile)) {
    						log("Recovered gear.");
    						atTile(itemTile, "Take");
    						return random(500, 750);
    					} else {
    						log("Walking to gear location.");
    						walkTileMM(itemTile);
    						return random(500, 750);
    					}
    				}
    
    				// Does the player have the gear needed for the current mode?
    				if (getInventoryCount(gear[mode]) <= 0) {
    					// No, so head to the bank for new gear.
    					log("No gear for the current fishing mode, heading to bank for more.");
    					state = S_WALKTO_BANK;
    					return random(500, 750);
    				}
    
    				// Does the player need bait?
    				if (bait[mode] != 0) {
    					// Yes, do we have some?
    					if (getInventoryCount(bait[mode]) <= 0) {
    						// No, so head to the bank and withdraw some more.
    						log("Not enough bait to continue, heading to bank for more.");
    						state = S_WALKTO_BANK;
    						return random(500, 750);
    					}
    				}
    
    				// Is the player currently near the destination?
    				if (distanceTo(toArea[toArea.length - 1]) <= 2) {
    					// Yes, so start fishing and select next random path.
    					log("Ariving at fishing area, switching to fishing mode.");
    					state = S_FISH;
    
    					return random(500, 750);
    				} else {
    					// No, so continue to walk path.
    					if (!getMyPlayer().isMoving()) {
    						walkPathMM(randomizePath(toArea, 2, 2), 20);
    					}
    
    					return random(500, 750);
    				}
    
    				// S_WALKTO_BANK - Walks to the bank.
    			case S_WALKTO_BANK:
    				// Is the player currently near the destination?
    				if (distanceTo(toBank[toBank.length - 1]) <= 2) {
    					// Yes, so start banking.
    					log("Ariving at bank, making deposit.");
    					state = S_USE_BANK;
    
    					return random(500, 750);
    				} else {
    					// No, so continue to walk path.
    					if (!getMyPlayer().isMoving()) {
    						walkPathMM(randomizePath(toBank, 2, 2), 20);
    					}
    
    					return random(500, 750);
    				}
    
    				// S_FISH - Fishes based on current mode.
    			case S_FISH:
    				RSNPC spot = getNearestNPCByID(fishingSpots[mode]);
    				RSNPC whirl = getNearestNPCByID(whirlpools);
    				RSTile loc1 = new RSTile(
    						getMyPlayer().getLocation().getX() + 1, getMyPlayer()
    								.getLocation().getY());
    				RSTile loc2 = new RSTile(
    						getMyPlayer().getLocation().getX() - 1, getMyPlayer()
    								.getLocation().getY());
    				RSTile loc3 = new RSTile(getMyPlayer().getLocation().getX(),
    						getMyPlayer().getLocation().getY() + 1);
    				// RSTile loc4 = new RSTile(getMyPlayer().getLocation().getX(),
    				// getMyPlayer().getLocation().getY() - 1);
    
    				// Is the play missing gear and is the gear laying on the
    				// ground?
    				itemTile = getGroundItemByID(gear[mode]);
    				if (getInventoryCount(gear[mode]) == 0 && itemTile != null) {
    					if (tileOnScreen(itemTile)) {
    						log("Recovered gear.");
    						atTile(itemTile, "Take");
    						return random(500, 750);
    					} else {
    						log("Walking to gear location.");
    						walkTileMM(itemTile);
    						return random(500, 750);
    					}
    				}
    
    				// Anticombat: Is the player currently in combat?
    				if (getMyPlayer().isInCombat()) {
    					// Yes, so run to bank.
    					log("Running away from combat.");
    					avoidedCombat++;
    					state = S_WALKTO_BANK;
    					return random(500, 750);
    				}
    
    				// Is the player currently busy?
    				if (getMyPlayer().getAnimation() != -1
    						|| getMyPlayer().isMoving()) {
    					if (whirl != null) {
    						if (whirl.getLocation().equals(loc1)
    								|| whirl.getLocation().equals(loc2)
    								|| whirl.getLocation().equals(loc3)
    								|| whirl.getLocation().equals(loc1)) {
    
    							log("Avoiding whirlpool.");
    							whirlpoolsAvoided++;
    						}
    					} else {
    						return antiBan();
    					}
    				}
    
    				// Does the player have the gear needed for the current mode?
    				if (getInventoryCount(gear[mode]) <= 0) {
    					// No, so head to the bank for new gear.
    					log("No gear for the current fishing mode, heading to bank for more.");
    					state = S_WALKTO_BANK;
    					return random(500, 750);
    				}
    
    				// Does the player need bait?
    				if (bait[mode] != 0) {
    					// Yes, do we have some?
    					if (getInventoryCount(bait[mode]) <= 0) {
    						// No, so head to the bank and withdraw some more.
    						log("Not enough bait to continue, heading to bank for more.");
    						state = S_WALKTO_BANK;
    						return random(500, 750);
    					}
    				}
    
    				// Is the inventory full?
    				if (isInventoryFull()) {
    					// Yes, so are we power-fishing?
    					if (powerMode) {
    						// Yes, so drop.
    						log("The inventory is full, dropping all the catches.");
    						state = S_DROP;
    						return random(500, 750);
    					} else {
    						// No, so bank.
    						log("The inventory is full, heading to the bank.");
    						state = S_WALKTO_BANK;
    						return random(500, 750);
    					}
    				}
    
    				// Was a fishing spot found?
    				if (spot != null) {
    					// Yes, so reset fails.
    					fails = 0;
    
    					// Is the spot nearby?
    					if (tileOnScreen(spot.getLocation())) {
    						// Yes, so fish.
    						atNPC(spot, fishingCommands[mode]);
    						return random(1000, 1500);
    					} else {
    						// No, so walk to the fishing spots location.
    						walkTileRand(spot.getLocation());
    						return random(500, 750);
    					}
    				} else {
    					for (int i = 0; i < lostTiles.length; i++) {
    						RSTile lost = lostTiles[i];
    
    						if (distanceTo(lost) <= 4) {
    							log("Currently lost, returning.");
    							walkTileRand(recoverTiles[i]);
    							return random(500, 750);
    						}
    					}
    
    					// No, so increment fails and try again.
    					log("Couldn't find a fishing spot, trying "
    							+ (maxFails - fails) + " more times.");
    					fails++;
    					return random(1500, 3000);
    				}
    
    				// S_USE_BANK - Makes deposits.
    			case S_USE_BANK:
    				RSObject booth = findObject(bankBooth);
    
    				if (RSInterface.getInterface(INTERFACE_BANK).isValid()) {
    					bank.close();
    				}
    
    				// Was the booth found?
    				if (booth != null) {
    					// Is the bank on screen?
    					if (tileOnScreen(booth.getLocation())) {
    						// Yes, so use it.
    						atObject(booth, "Use-quickly");
    						wait(random(500, 750));
    
    						// Did the bank open?
    						if (!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
    							// No, so retry.
    							log("Unable to access account, trying "
    									+ (maxFails - fails) + " more times.");
    							fails++;
    							return random(500, 750);
    						}
    
    						// Deposit all except gear.
    						bank.depositAllExcept(gear);
    
    						// Does the current mode require bait?
    						if (bait[mode] != 0
    								&& getInventoryCount(bait[mode]) == 0) {
    							// Yes, so does the bank have bait?
    							if (bank.getCount(bait[mode]) == 0) {
    								// No, so stop script.
    								log("There is no bait in the bank, exiting.");
    								stopAllScripts();
    							} else {
    								// Yes, so withdraw.
    								bank.atItem(bait[mode], "Withdraw-All");
    							}
    						}
    
    						// Is the player out of gear and there is none in the
    						// bank?
    						if (getInventoryCount(gear[mode]) == 0
    								&& bank.getCount(gear[mode]) == 0) {
    							// No, so stop script.
    							log("No gear in inventory and no gear in the bank, exiting.");
    							stopAllScripts();
    						} else {
    							// Yes, so withdraw.
    							bank.atItem(gear[mode], "Withdraw 1");
    						}
    
    						// Is the inventory still full?
    						if (isInventoryFull()) {
    							// Yes, so rebank.
    							log("Inventory is still full, rebanking.");
    							return random(500, 750);
    						} else {
    							// No, so head back to the spots.
    							log("Banked all, heading back to area.");
    							state = S_WALKTO_AREA;
    							return random(500, 750);
    						}
    					} else {
    						// No, so walk to the booth.
    						log("Found bank, but it isn't on screen, walking to location.");
    						walkTileRand(booth.getLocation());
    						return random(500, 750);
    					}
    				} else {
    					// No, so increment fails and try again.
    					log("Unable to find a bank booth, trying "
    							+ (maxFails - fails) + " more times.");
    					fails++;
    					return random(1500, 3000);
    				}
    
    				// S_DROP - Drop inventory, use for power fishing.
    			case S_DROP:
    				log("Dropping everything except gear.");
    				dropAllExcept(gear);
    				state = S_FISH;
    				return random(500, 750);
    
    				// Default - Unknown state.
    			default:
    				log("Unknown state: " + state + " terminating script.");
    				return -1;
    		}
    	}
    
    	//
    	// walkTileRand( )
    	//
    	// This method provides a means for the script to walk to a location more
    	// randomly than RSBot's standard walkTileMM function.
    	//
    	public void walkTileRand(RSTile tile) {
    		// Local objects:
    		RSTile temp = new RSTile(tile.getX() + random(-2, 2), tile.getY()
    				+ random(-2, 2));
    
    		walkTileMM(temp);
    	}
    
    	//
    	// antiBan( )
    	//
    	// This method provides a psuedo means of antiBan.
    	// Not sure that this is the greatest method of anti-ban, due
    	// to it's repetiveness.
    	//
    	int antiBan() {
    		int GambleInt = random(1, 6);
    
    		switch (GambleInt) {
    			case 1:
    				wait(random(1000, 1500));
    				break;
    
    			case 2:
    				int x = random(0, 750);
    				int y = random(0, 500);
    				moveMouse(0, 0, x, y);
    				return random(1000, 1500);
    
    			case 3:
    				// Is the current tab the inventory?
    				if (getCurrentTab() != TAB_INVENTORY) {
    					// No, so switch to the inventory tab.
    					openTab(TAB_INVENTORY);
    					return random(500, 750);
    				} else {
    					// No, so return
    					return random(500, 750);
    				}
    
    			case 4:
    				// If the player is moving, then abort.
    				if (getMyPlayer().isMoving()) {
    					return random(750, 1000);
    				}
    
    				if (System.currentTimeMillis() - lastCheck >= checkTime) {
    					lastCheck = System.currentTimeMillis();
    					checkTime = random(60000, 180000);
    
    					if (getCurrentTab() != TAB_STATS) {
    						openTab(TAB_STATS);
    					}
    					moveMouse(663, 292, 50, 28);
    					return random(5000, 8000);
    				}
    
    			case 5:
    				if (random(1, 8) == 2) {
    					int angle = getCameraAngle() + random(-90, 90);
    					if (angle < 0) {
    						angle = 0;
    					}
    					if (angle > 359) {
    						angle = 0;
    					}
    
    					setCameraRotation(angle);
    				}
    				return random(500, 750);
    		}
    
    		return random(500, 1000);
    	}
    
    	//
    	// onRepaint( )
    	//
    	// This method is called every time the graphics is updated.
    	//
    	//
    	// onRepaint( )
    	//
    	// This method is called every time the graphics is updated.
    	//
    	public void onRepaint(Graphics g) {
    		/*
    		 * Graphics h = image.getGraphics(); try { ImageIO.write(image, "jpg",
    		 * new File("progressReport.jpg")); } catch (IOException e) {
    		 * e.printStackTrace(); }
    		 */
    
    		// local objects:
    		int index = Skills.getStatIndex("Fishing");
    		int exp = 0;
    		int levels;
    		long hours = 0, minutes = 0, seconds = 0;
    		long time;
    		long untilhour = 0, untilmin = 0, untilsec = 0;
    		double temptime = 0;
    
    		// Has start time been previously set?
    		if (startTime == 0) {
    			startTime = System.currentTimeMillis();
    		}
    
    		// Calculate hours, minutes and seconds.
    		time = System.currentTimeMillis() - startTime;
    		seconds = time / 1000;
    		if (seconds >= 60) {
    			minutes = seconds / 60;
    			seconds -= minutes * 60;
    		}
    		if (minutes >= 60) {
    			hours = minutes / 60;
    			minutes -= hours * 60;
    		}
    
    		// Has variables been previously defined?
    		if (startLevel == 0 || startExp == 0) {
    			// No, so define them now.
    			startLevel = skills.getCurrentSkillLevel(index);
    			startExp = skills.getCurrentSkillExp(index);
    			oldExp = 0;
    		}
    
    		// Calculate catches based on experience changes.
    		exp = skills.getCurrentSkillExp(index) - startExp;
    		if (exp > oldExp) {
    			xpPerCatch = exp - oldExp;
    			oldExp = exp;
    			catches++;
    			countToNext = skills.getXPToNextLevel(STAT_FISHING) / xpPerCatch
    					+ 1;
    		}
    
    		// Calculate levels gained.
    		levels = skills.getCurrentSkillLevel(index) - startLevel;
    		if (levels > oldLevels) {
    			oldLevels = levels;
    		}
    
    		//
    		if (System.currentTimeMillis() - lastAvgCheck >= 60000) {
    			lastAvgCheck = System.currentTimeMillis();
    			avgPerHour = (catches - oldCatches) * 60;
    			oldCatches = catches;
    		}
    		if (countToNext == 0) {
    			untilsec = 0;
    			untilhour = 0;
    			untilmin = 0;
    		} else {
    			if (avgPerHour == 0) {
    				untilsec = 0;
    				untilhour = 0;
    				untilmin = 0;
    			} else {
    				temptime = (double) countToNext / avgPerHour;
    				untilsec = (int) (temptime * 3600);
    				untilmin = untilsec / 60;
    				untilsec -= untilmin * 60;
    				untilhour = untilmin / 60;
    				untilmin -= untilhour * 60;
    			}
    		}
    		// Draw information.
    
    		g.setColor(Color.WHITE);
    		g.drawString(getName() + " v" + getVersion(), 9, 171);
    		g.drawString("XP Gained: " + exp, 9, 187);
    		g.drawString("Levels Gained: " + levels, 9, 203);
    		g.drawString("Percent to next level: "
    				+ skills.getPercentToNextLevel(index), 9, 219);
    		g.drawString("Catches: " + catches, 9, 235);
    		g.drawString("Catches to next level: " + countToNext, 9, 251);
    		g.drawString("Times avoided combat: " + avoidedCombat, 9, 267);
    		g.drawString("Whirlpools Avoided: " + whirlpoolsAvoided, 9, 283);
    		g.drawString("Time running: " + hours + "." + minutes + "." + seconds,
    				9, 299);
    		g.drawString("Average per hour: " + avgPerHour, 9, 315);
    		g.drawString("Est time untill next level: " + untilhour + "."
    				+ untilmin + "." + untilsec, 9, 331);
    
    		/*
    		 * h.setColor( Color.WHITE ); h.drawString(getName( ) + " v" +
    		 * getVersion( ), 9, 171); h.drawString("XP Gained: " + exp, 9, 187);
    		 * h.drawString("Levels Gained: " + levels, 9, 203);
    		 * h.drawString("Percent to next level: " +
    		 * skills.getPercentToNextLevel( index ), 9, 219);
    		 * h.drawString("Catches: " + catches, 9, 235); h.drawString("Catches to
    		 * next level: " + countToNext, 9, 251); h.drawString("Times avoided
    		 * combat: " + avoidedCombat, 9, 267); h.drawString("Whirlpools Avoided: " +
    		 * whirlpoolsAvoided, 9, 283); h.drawString("Time running: " + hours +
    		 * "." + minutes + "." + seconds, 9, 299); h.drawString("Average per
    		 * hour: " + avgPerHour, 9, 315); h.drawString("Est time untill next
    		 * level: " + untilhour + "." + untilmin + "." + untilsec , 9, 331);
    		 */
    	}
    
    	// Modified to drop all except:)
    	public boolean dropAllExcept(int... items) {
    		boolean drop = false;
    
    		for (int item : getInventoryArray()) {
    			drop = true;
    			for (int nodrop : items) {
    				if (item == nodrop) {
    					drop = false;
    				}
    			}
    
    			if (drop && item != -1) {
    				for (int i = 0; i < getInventoryCount(item); i++) {
    					atInventoryItem(item, "Drop");
    					wait(random(500, 750));
    				}
    			}
    		}
    
    		return true;
    	}
    
    }
    Tenac Guild Miner
    Code:
    import java.awt.*;
    import java.util.*;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    
    import com.speljohan.rsbot.bot.*;
    import com.speljohan.rsbot.script.*;
    import com.speljohan.rsbot.script.wrappers.*;
    import com.speljohan.rsbot.event.listeners.*;
    
    
    public class TenacGuildMiner extends Script implements PaintListener {
    
    	int[] bankerID = { 6200 };
    	int[] bankBoothID = { 11758 };
    		
    	RSTile topLadderTile = new RSTile(3019, 3339);
    	int[] ladderID = { 30941 };
    	int[] coalRockID = { 31068, 31069, 31070 };
    	int[] mithRockID = { 31086, 31087, 31088,  };
    
    	int coalID = 453;
    	int mithrilID = 447;
    	int[] gemID = { 1617, 1619, 1621, 1623 };
    	int[] pickaxeHandleID = { 466 };
    	int[] pickaxeID = { 1265, 1267, 1269, 1273, 1271, 1275 };
    	int[] pickaxeHeadID = { 480, 482, 484, 486, 488, 490 };
    	int[] brokenPickaxeID =  { 468, 470, 472, 474, 476, 478 };
    	
    	int[] junkItems = { 1917, 1971 }; //beer, kebab, 
    	int goldPiecesID = 995;
    
    	RSTile lumbridgeTile = new RSTile(3221, 3218);
    
    	RSTile bankTile = new RSTile(3014, 3356);
    	RSTile[] betweenBankAndLadderTiles = { new RSTile(3019, 3351), new RSTile(3022, 3351), new RSTile(3024, 3352) };
    	RSTile ladderTile = new RSTile(3022, 3340);
    	//RSTile[] topLadderTiles = { new RSTile(3022, 3341), new RSTile(3022, 3337) };
    	//RSTile[] bottomLadderTiles = { new RSTile(3021, 9741), new RSTile(3022, 9740) };
    
    	RSTile[] coalToLadderPath = { new RSTile(3046, 9747), new RSTile(3041, 9744), new RSTile(3036, 9737), 
    						new RSTile(3030, 9736), new RSTile(3020, 9740) };
    	RSTile[] ladderToCoalPath = reversePath(coalToLadderPath);
    
    	RSTile[] lumbridgeToFalidorPath = { new RSTile(3226, 3218), new RSTile(3233, 3220), new RSTile(3233, 3225), 
    										new RSTile(3231, 3230), new RSTile(3228, 3233), new RSTile(3223, 3238), 
    										new RSTile(3221, 3242), new RSTile(3219, 3247), new RSTile(3218, 3251), 
    										new RSTile(3217, 3256), new RSTile(3217, 3257), new RSTile(3217, 3261), 
    										new RSTile(3217, 3266), new RSTile(3216, 3272), new RSTile(3216, 3277), 
    										new RSTile(3210, 3280), new RSTile(3205, 3280), new RSTile(3204, 3279), 
    										new RSTile(3197, 3279), new RSTile(3190, 3282), new RSTile(3184, 3286), 
    										new RSTile(3178, 3287), new RSTile(3172, 3286), new RSTile(3165, 3285), 
    										new RSTile(3158, 3291), new RSTile(3149, 3296), new RSTile(3143, 3294), 
    										new RSTile(3137, 3295), new RSTile(3136, 3295), new RSTile(3130, 3295), 
    										new RSTile(3123, 3299), new RSTile(3118, 3296), new RSTile(3112, 3295),
    										new RSTile(3106, 3295), new RSTile(3099, 3295), new RSTile(3094, 3292), 
    										new RSTile(3088, 3290), new RSTile(3082, 3289), new RSTile(3076, 3288), 
    										new RSTile(3074, 3284), new RSTile(3074, 3280), new RSTile(3069, 3277), 
    										new RSTile(3063, 3277), new RSTile(3057, 3276), new RSTile(3050, 3276), 
    										new RSTile(3047, 3276), new RSTile(3044, 3274), new RSTile(3037, 3277), 
    										new RSTile(3030, 3278), new RSTile(3024, 3276), new RSTile(3018, 3275), 
    										new RSTile(3013, 3276), new RSTile(3011, 3278), new RSTile(3007, 3284), 
    										new RSTile(3004, 3289), new RSTile(3007, 3294), new RSTile(3006, 3299), 
    										new RSTile(3004, 3304), new RSTile(3006, 3310), new RSTile(3007, 3316), 
    										new RSTile(3007, 3321), new RSTile(3005, 3326), new RSTile(3007, 3331), 
    								 		new RSTile(3007, 3332), new RSTile(3007, 3337), new RSTile(3007, 3343), 
    								 		new RSTile(3007, 3349), new RSTile(3005, 3355), new RSTile(3007, 3361), 
    								 		new RSTile(3012, 3361), new RSTile(3015, 3355) };
    
    	long startTime = System.currentTimeMillis();
    	int startingLevel = skills.getCurrentSkillLevel(STAT_MINING);
    	int startingExperience = skills.getCurrentSkillExp(STAT_MINING);
    	int ranAwayFromCombat = 0;
    	int gemsBanked = 0;
    	int coalBanked = 0;
    	int mithBanked = 0;
    	int xpPerCoal = 50;
    	int energyToRunAt = random(50, 90);
    	
    	boolean walkBack = false;
    	boolean miningMith = false;
    
    	int priceOfCoal = getMarketPriceOfItem(coalID);
    	int priceOfMithril = getMarketPriceOfItem(mithrilID);
    
    	public double getVersion() {
    		return 1.1;
    	}
    
    	public String getName() {
    		return "Guild Miner";
    	}
    
    	public String getAuthor() {
    		return "Tenac";
    	}
    
    	public String getScriptCategory() {
    		return "Mining";
    	}
    
    	public String getScriptDescription( ) {
    		String html = "";
    
    		html += "<html>\n";
    		html += "<body>\n";
    
    		html += "<font size=\"6\">";
    		html += "<center><h2>" + getName() + "</h2></center>\n";
    		html += "</font>";
    
    		html += "<b>Author:</b>" + getAuthor() + "<br/>";
    		html += "<b>Version:</b>" + getVersion() + "<br/><br>";
    
    		html += "Start anywhere with a pickaxe and at least 60 mining, preferably inside Falidor East bank or Mining Guild.<br>\n<br>";
    
    		
    		html += "<input type=\"checkbox\" name=\"mineMith\" value=\"yes\" checked>Mine mithril rocks also?\n<br>";
    		
    		html += "</body>\n";
    		html += "</html\n";
    
    		return html;
    	}
    
    	public boolean onStart(Map<String, String> args) {
    		startTime = System.currentTimeMillis();
    		if(isLoggedIn()) {
    			startingLevel = skills.getCurrentSkillLevel(STAT_MINING);
    			startingExperience = skills.getCurrentSkillExp(STAT_MINING);
    			setCameraAltitude(true);
    			setCameraRotation(random(1, 359));
    		}
    
    		if(args.get("mineMith") != null)
    			miningMith = true;
    
    		Bot.getEventManager().addListener(PaintListener.class, this);
    		return true;
    	}
    
    	public void onFinish() {
    		Bot.getEventManager().removeListener(PaintListener.class, this);
    	}
    
    	public void onRepaint(Graphics g) {
    		if(isLoggedIn()) {
    			if(startTime == 0)
    				startTime = System.currentTimeMillis();
    
    			if(startingLevel == 0 || startingExperience == 0) {
    				startingLevel = skills.getCurrentSkillLevel(STAT_MINING);
    				startingExperience = skills.getCurrentSkillExp(STAT_MINING);
    			}
    
    			long millis = System.currentTimeMillis() - startTime;
    			long hours = millis / (1000 * 60 * 60);
    			millis -= hours * (1000 * 60 * 60);
    			long minutes = millis / (1000 * 60);
    			millis -= minutes * (1000 * 60);
    			long seconds = millis / 1000;
    
    			g.setColor(new Color(33, 46, 207, 100));
    			//window is (0, 0) (337, 515)
    			//my box is (515 - 260, 0) (337, 200)
    			int x = 515 - 230;
    			int y = 4;
    			g.fillRoundRect(x, y, 230, 170, 20, 20);
    			g.setColor(new Color(26, 36, 162, 255));
    			g.drawRoundRect(x, y, 230, 170, 20, 20);
    			
    			g.setColor(new Color(255, 255, 255, 255));
    			g.drawString(getAuthor() + "'s " + getName() + " v" + getVersion(), x + 10, y += 15);
    			g.drawString("Running for " + hours + ":" + minutes + ":" + seconds, x + 10, y += 15);
    			g.drawString("Banked " + coalBanked + " coal", x + 10, y += 15);
    			g.drawString("Banked " + mithBanked + " mithril", x + 10, y += 15);
    			g.drawString("Banked " + gemsBanked + " gems", x + 10, y += 15);
    			g.drawString("Gained " + ((coalBanked * priceOfCoal) + (mithBanked * priceOfMithril)) + "gp", x + 10, y += 15);
    			g.drawString("Currently level " + skills.getCurrentSkillLevel(STAT_MINING) + " and " + skills.getPercentToNextLevel(STAT_MINING) + "% to next level", x + 10, y += 15);
    			g.drawString("Gained " + (skills.getCurrentSkillLevel(STAT_MINING) - startingLevel) + " levels", x + 10, y += 15);
    			g.drawString("Gained " + (skills.getCurrentSkillExp(STAT_MINING) - startingExperience) + " experience", x + 10, y += 15);
    			//g.drawString("Earning about " + (skills.getCurrentSkillExp(14) / (hours + (60 / minutes)) + (60 / seconds) + .0001) + "xp per hour", x + 10, y += 15);
    			g.drawString("Ran from combat " + ranAwayFromCombat + " times", x + 10, y += 15);
    			g.drawString("" + (int)(skills.getXPToNextLevel(STAT_MINING) / xpPerCoal + 1) + " more coal until next level", x + 10, y += 15);
    			//g.drawString("Earning about " + (((priceOfCoal * coalBanked) + (mithBanked * priceOfMithril)) / (hours + (60 / minutes)) + (60 / seconds) + .0001) + "gp per hour", x + 10, y += 15);
    		}
    	}
    
    	public void printProgressReport() {
    		long millis = System.currentTimeMillis() - startTime;
    		long hours = millis / (1000 * 60 * 60);
    		millis -= hours * (1000 * 60 * 60);
    		long minutes = millis / (1000 * 60);
    		millis -= minutes * (1000 * 60);
    		long seconds = millis / 1000;
    
    		log(getAuthor() + "'s " + getName() + " v" + getVersion());
    		log("Running for " + hours + ":" + minutes + ":" + seconds);
    		log("Banked " + coalBanked + " coal");
    		log("Banked " + mithBanked + " mithril");
    		log("Banked " + gemsBanked + " gems");
    		log("Gained " + ((coalBanked * priceOfCoal) + (mithBanked * priceOfMithril)) + "gp");
    		log("Currently level " + skills.getCurrentSkillLevel(STAT_MINING) + " and " + skills.getPercentToNextLevel(STAT_MINING) + "% to next level");
    		log("Gained " + (skills.getCurrentSkillLevel(STAT_MINING) - startingLevel) + " levels");
    		log("Gained " + (skills.getCurrentSkillExp(STAT_MINING) - startingExperience) + " experience");
    		//log("Earning about " + (skills.getCurrentSkillExp(14) / (hours + (60 / minutes)) + (60 / seconds) + .0001) + "xp per hour");
    		log("Ran from combat " + ranAwayFromCombat + " times");
    		log("" + (int)(skills.getXPToNextLevel(STAT_MINING) / xpPerCoal + 1) + " more coal until next level");
    		//log("Earning about " + ((priceOfCoal * coalBanked) / (hours + (60 / minutes)) + (60 / seconds) + .0001) + "gp per hour");
    	}
    
    	public String getWebPage(String url) throws Exception {
    		URL theUrl = new URL(url);
    		URLConnection theUrlConnection = theUrl.openConnection();
    		BufferedReader in = new BufferedReader(new InputStreamReader(theUrlConnection.getInputStream()));
    		String inputLine = "";
    		String result = "";
    		while ((inputLine = in.readLine()) != null) {
    			result += inputLine;
    		}
    		in.close();
    		return result;
    	}
    
    	public int getMarketPriceOfItem(int id) {
    		String pageSource = "";
    		int begin = 0;
    		int end = 0;
    		try {
    			URL theUrl = new URL("http://itemdb-rs.runescape.com/viewitem.ws?obj=" + id);
    			URLConnection theUrlConnection = theUrl.openConnection();
    			BufferedReader in = new BufferedReader(new InputStreamReader(theUrlConnection.getInputStream()));
    			String inputLine = "";
    			while ((inputLine = in.readLine()) != null)
    				pageSource += inputLine;
    			in.close();
    			pageSource = pageSource.replaceAll("\n", "");
    			pageSource = pageSource.replaceAll("\t", "");
    			begin = pageSource.indexOf("<b>Market price:</b> ") + ("<b>Market price:</b> ").length();
    			end = pageSource.indexOf("</span><span><b>Maximum price:</b>");
    		} catch (Exception e) {
    			System.out.println("Error obtaining price of http://itemdb-rs.runescape.com/viewitem.ws?obj=" + id);
    		}
    		return (int)new Integer(pageSource.substring(begin, end)).intValue();
    	}
    	
    
    	public int loop() {
    		if(!isLoggedIn())
    			return random(200, 600);
    
    		if(getEnergy() >= energyToRunAt) {
    			energyToRunAt = random(50, 90);
    			setRun(true);
    		}
    		
    		if(getMyPlayer().isInCombat())
    			return runAway();
    		
    		if(distanceTo(lumbridgeTile) <= 17)
    			walkBack = true;
    
    		if(isLost()) {
    			if(myGetNextTile(lumbridgeToFalidorPath, 17) == null)
    				return teleportToLumbridge();
    			walkBack = true;
    		}
    
    		if(walkBack) {
    			if(myWalkPath(lumbridgeToFalidorPath, 17, 1)) {
    				walkBack = false;
    				depositInventory();
    			}
    			return random(50, 200);
    		}
    
    		if(getGroundItemByID(17, pickaxeHeadID) != null && (isCarryingItem(pickaxeHandleID)))
    			return fixPickaxe();
    
    		if(isCarryingItem(brokenPickaxeID) || isCarryingItem(pickaxeHandleID))
    			return getNewPick();
    
    		if(isCarryingJunk())
    			return dropJunk();
    
    		if(canEquipPickaxe())
    			return wieldPickaxe();
    		
    		if(isInventoryFull())
    			return depositInventory();
    
    		return mineCoal();
    	}
    
    	public boolean isLost() {
    		if(distanceTo(lumbridgeTile) <= 17)
    				return false;
    		if(distanceTo(bankTile) <= 17)
    			return false;
    		if(distanceTo(ladderTile) <= 17)
    			return false;
    		for(int i = 0; i < betweenBankAndLadderTiles.length - 1; i++)
    			if(distanceTo(betweenBankAndLadderTiles[i]) <= 17)
    					return false;
    		for(int i = 0; i < coalToLadderPath.length - 1; i++)
    			if(distanceTo(coalToLadderPath[i]) <= 17)
    					return false;
    		return true;
    	}
    	
    	public boolean isCarryingJunk() {
    		for(int i = 0; i < junkItems.length; i++) {
    			if(inventoryContainsOneOf(junkItems[i])) {
    				return true;
    			}
    		}
    		RSItem item = getInventoryItemByID(goldPiecesID);
    		if(item != null) {
    			if(item.getStackSize() <= 5000) {
    				return true;
    			}
    		}
    		return false;
    	}
    	
    	public int dropJunk() {
    		for(int i = 0; i < junkItems.length; i++) {
    			if(inventoryContainsOneOf(junkItems[i])) {
    				if(atInventoryItem(junkItems[i], "Drop"))
    					return random(550, 700);
    			}
    		}
    		RSItem item = getInventoryItemByID(goldPiecesID);
    		if(item != null) {
    			if(item.getStackSize() <= 5000) {
    				if(atInventoryItem(goldPiecesID, "Drop"))
    					return random(550, 700);
    			}
    		}
    		return random(40, 200);
    	}
    	
    	public void unequipWeapon() {
    		openTab(TAB_EQUIPMENT);
    		RSInterface equip = RSInterface.getInterface(INTERFACE_TAB_EQUIPMENT);
    		RSInterfaceChild weapon = equip.getChild(16);
    		atInterface(weapon);
    		wait(random(400, 800));
    		openTab(TAB_INVENTORY);
    	}
    
    	public int runAway() {
    		setRun(true);
    		if(getMyPlayer().getLocation().getY() > 6000) {
    			myWalkPathAllTheWay(coalToLadderPath, 2);
    			waitUntilNotMoving();
    			climbUpLadder();
    			wait(random(1500, 2000));
    			climbDownLadder();
    			return random(200, 600);
    		} else {
    			RSTile curentTile = getMyPlayer().getLocation();
    			int xRand = random(-16, 17);
    			int yRand;
    			if(random(0, 2) == 0)
    				yRand = -(int)(Math.sqrt((16 * 16) - (xRand * xRand)));
    			else
    				yRand = -(int)(Math.sqrt((16 * 16)- (xRand * xRand)));
    			RSTile runawayTile = new RSTile(curentTile.getX() + xRand, curentTile.getY() + yRand);
    			myWalkTile(runawayTile, 0);
    			waitUntilNearTile(runawayTile, 0);
    			wait(random(2200, 3800));
    			myWalkTile(curentTile, 1);
    			wait(random(50, 600));
    			if(random(0, 4) < 3)
    				moveMouse(random(0, 515), random(0, 337));
    			waitUntilNotMoving();
    		}
    		ranAwayFromCombat++;
    		return random(50, 100);
    	}
    
    	int attemptsClimbingUp;
    	public boolean climbUpLadder() {
    		attemptsClimbingDown = 0;
    		while(attemptsClimbingDown < 5) {
    			RSObject object = getNearestObjectById(16, ladderID);
    			if(object != null) {
    				if(!Calculations.onScreen(Calculations.tileToScreen(object.getLocation()))) {
    					myWalkTile(object.getLocation(), 1);
    					wait(random(50, 600));
    					if(random(0, 4) < 3)
    						moveMouse(random(0, 515), random(0, 337));
    					waitUntilNotMoving();
    				}
    				if(atObject(object, "up")) {
    					wait(random(200, 600));
    					while(getMyPlayer().getLocation().getY() > 6000)
    						wait(random(200, 400));
    					return true;
    				} else {
    					if(distanceTo(coalToLadderPath[coalToLadderPath.length - 1]) > 4)
    						myWalkTile(coalToLadderPath[coalToLadderPath.length - 1], 2);
    					setCameraRotation(random(1, 359));
    					setCameraAltitude(true);
    					attemptsClimbingUp++;
    				}
    			}
    		}
    		return false;
    	}
    
    	public boolean atTileModified(RSTile tile, String action, int randomness) {
    		try {
    			Point location = Calculations.tileToScreen(tile);
    			if (location.x == -1 || location.y == -1) return false;
    			moveMouse(location, randomness, randomness);
    			if (getMenuItems().get(0).toLowerCase().contains(action.toLowerCase())) {
    				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;
    		}
    	}
    
    	int attemptsClimbingDown;
    	public boolean climbDownLadder() {
    		if(!Calculations.onScreen(Calculations.tileToScreen(topLadderTile)))
    			return false;
    		attemptsClimbingDown = 0;
    		while(attemptsClimbingDown < 5) {
    			if(atTileModified(topLadderTile, "down", 16)) {
    				wait(random(400, 600));
    				while(getMyPlayer().getLocation().getY() < 6000)
    					wait(random(200, 400));
    				return true;
    			} else {
    				if(distanceTo(ladderTile) > 4)
    					myWalkTile(ladderTile, 2);
    				setCameraRotation(random(1, 359));
    				setCameraAltitude(true);
    				attemptsClimbingDown++;
    			}
    		}
    		return false;
    	}
    
    	public int getNewPick() {
    		if(getMyPlayer().getLocation().getY() > 6000) {
    			if(myWalkPath(coalToLadderPath, 15, 3)) {
    				waitUntilNotMoving();
    				climbUpLadder();
    			}
    			return random(100, 200);
    		}
    		if(distanceTo(bankTile) > 4) {
    			if(myWalkTile(betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)], 1)) {
    				waitUntilNearTile(betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)], 2);
    			}
    			myWalkTile(bankTile, 2);
    			wait(random(200, 600));
    			if(equipmentContains(pickaxeHandleID) || equipmentContains(brokenPickaxeID))
    				unequipWeapon();
    			wait(random(50, 600));
    			if(random(0, 4) < 3)
    				moveMouse(random(0, 515), random(0, 337));
    			waitUntilNotMoving();
    			return random(200, 300);
    		}
    		if(!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
    			switch(random(0, 2)) {
    				case 0: atObject(getNearestObjectById(15, bankBoothID), "uickl"); break;
    				case 1: atNPC(getNearestNPCByID(bankerID), "ank Ba"); break;
    				//case 2: atObject(getNearestObjectById(15, depositBoxID), "sit Ban"); break;
    				default: atObject(getNearestObjectById(15, bankBoothID), "uickl"); break;
    			}
    			waitUntilNotMoving();
    			return random(400, 700);
    		}
    		if(RSInterface.getInterface(INTERFACE_BANK).isValid()) {
    			coalBanked += getInventoryCount(coalID);
    			mithBanked += getInventoryCount(mithrilID);
    			gemsBanked += getInventoryCount(gemID);
    			bank.depositAll();
    
    			//broken since the bank methods are broken
    			/*
    			bank.setWithdrawModeToItem();
    			int skillMining = skills.getCurrentSkillLevel(STAT_MINING);
    			for(int i = pickaxeID.length - 1; i >= 0; i--) {
    				if((skillMining >= 61 && i == 6) || 
    				   (skillMining >= 41 && i == 5) || 
    				   (skillMining >= 31 && i == 4) || 
    				   (skillMining >= 21 && i == 3) || 
    				   (skillMining >= 6 && i == 2)  || 
    				   (skillMining >= 1 && i == 1)  || 
    				   (skillMining >= 1 && i == 0)) {
    					bank.atItem(pickaxeID[i], "hdraw 1");
    					break;
    				}
    			}
    			wait(random(400, 900));
    			if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 40 && inventoryContainsOneOf(pickaxeID[5]))
    				atInventoryItem(pickaxeID[5], "ield");
    			else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 30 && inventoryContainsOneOf(pickaxeID[4]))
    				atInventoryItem(pickaxeID[4], "ield");
    			else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 20 && inventoryContainsOneOf(pickaxeID[3]))
    				atInventoryItem(pickaxeID[3], "ield");
    			else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 5 && inventoryContainsOneOf(pickaxeID[2]))
    				atInventoryItem(pickaxeID[2], "ield");
    			else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[1]))
    				atInventoryItem(pickaxeID[1], "ield");
    			else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[0]))
    				atInventoryItem(pickaxeID[0], "ield");
    			*/
    			bank.close();
    		}
    		log("No useable pickaxe, ending script =(");
    		printProgressReport();
    		stopAllScripts();
    		return random(200, 400);
    	}
    
    	public int fixPickaxe() {
    		RSItemTile head = getGroundItemByID(17, pickaxeHeadID);
    		if(head != null) {
    			log("Getting Head..");
    			myWalkTile(head, 1);
    			waitUntilNearTile(head, 0);
    			if(!atTile(head, "ake")) {
    				setCameraRotation(random(1, 359));
    				setCameraAltitude(true);
    			}
    			return random(10, 50);
    		}
    		if(equipmentContains(pickaxeHandleID) || equipmentContains(brokenPickaxeID))
    			unequipWeapon();
    		openTab(TAB_INVENTORY);
    		wait(random(200, 300));
    		useItem(getInventoryItemByID(pickaxeHeadID), getInventoryItemByID(pickaxeHandleID));
    		if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 40 && inventoryContainsOneOf(pickaxeID[5]))
    			atInventoryItem(pickaxeID[5], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 30 && inventoryContainsOneOf(pickaxeID[4]))
    			atInventoryItem(pickaxeID[4], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 20 && inventoryContainsOneOf(pickaxeID[3]))
    			atInventoryItem(pickaxeID[3], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 5 && inventoryContainsOneOf(pickaxeID[2]))
    			atInventoryItem(pickaxeID[2], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[1]))
    			atInventoryItem(pickaxeID[1], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[0]))
    			atInventoryItem(pickaxeID[0], "ield");
    		return random(200, 400);
    	}
    
    	public boolean canEquipPickaxe() {
    		if((skills.getCurrentSkillLevel(STAT_ATTACK) >= 40 && inventoryContainsOneOf(pickaxeID[5])) ||
    		   (skills.getCurrentSkillLevel(STAT_ATTACK) >= 30 && inventoryContainsOneOf(pickaxeID[4])) ||
    		   (skills.getCurrentSkillLevel(STAT_ATTACK) >= 20 && inventoryContainsOneOf(pickaxeID[3])) ||
    		   (skills.getCurrentSkillLevel(STAT_ATTACK) >= 5 && inventoryContainsOneOf(pickaxeID[2])) ||
    		   (skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[1])) ||
    		   (skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[0])))
    			return true;
    		return false;
    	}
    	
    	public int wieldPickaxe() {
    		if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 40 && inventoryContainsOneOf(pickaxeID[5]))
    			atInventoryItem(pickaxeID[5], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 30 && inventoryContainsOneOf(pickaxeID[4]))
    			atInventoryItem(pickaxeID[4], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 20 && inventoryContainsOneOf(pickaxeID[3]))
    			atInventoryItem(pickaxeID[3], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 5 && inventoryContainsOneOf(pickaxeID[2]))
    			atInventoryItem(pickaxeID[2], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[1]))
    			atInventoryItem(pickaxeID[1], "ield");
    		else if(skills.getCurrentSkillLevel(STAT_ATTACK) >= 1 && inventoryContainsOneOf(pickaxeID[0]))
    			atInventoryItem(pickaxeID[0], "ield");
    		return random(200, 400);
    	}
    	
    	public int depositInventory() {
    		if(getMyPlayer().getLocation().getY() > 6000) {
    			if(myWalkPath(coalToLadderPath, 15, 2)) {
    				waitUntilNotMoving();
    				climbUpLadder();
    			}
    			return random(100, 200);
    		}
    
    		if(distanceTo(bankTile) > 4) {
    			if(myWalkTile(betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)], 1)) {
    				waitUntilNearTile(betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)], 2);
    			}
    			myWalkTile(bankTile, 2);
    			wait(random(200, 600));
    			if(random(0, 4) < 3)
    				moveMouse(random(0, 515), random(0, 337));
    			waitUntilNotMoving();
    			return random(200, 300);
    		}
    		if(!RSInterface.getInterface(INTERFACE_BANK).isValid()) {
    			switch(random(0, 2)) {
    				case 0: atObject(getNearestObjectById(15, bankBoothID), "uickl"); break;
    				case 1: atNPC(getNearestNPCByID(bankerID), "ank Ba"); break;
    				//case 2: atObject(getNearestObjectById(15, depositBoxID), "sit Ban"); break;
    				default: atObject(getNearestObjectById(15, bankBoothID), "uickl"); break;
    			}
    			waitUntilNotMoving();
    			return random(400, 700);
    		}
    		if(RSInterface.getInterface(INTERFACE_BANK).isValid()) {
    			coalBanked += getInventoryCount(coalID);
    			mithBanked += getInventoryCount(mithrilID);
    			gemsBanked += getInventoryCount(gemID);
    			bank.depositAllExcept(pickaxeID);
    			if(random(0, 4) == 0)
    				bank.close();
    		}
    		return random(200, 400);
    	}
    
    	public void mouseOverMiningSkill() {
    		openTab(TAB_STATS);
    		wait(random(100, 200));
    		//2 interfaces, one for the pickaxe image, other for the skill text
    		RSInterfaceChild one = RSInterface.getInterface(320).getChild(9);
    		RSInterfaceChild two = RSInterface.getInterface(320).getChild(10);
    		if(random(0, 2) == 0)
    			moveMouse(new Point(one.getAbsoluteX() + random(2, one.getWidth() - 1), one.getAbsoluteY() + random(2, one.getHeight() - 1)));
    		else
    			moveMouse(new Point(two.getAbsoluteX() + random(2, two.getWidth() - 1), two.getAbsoluteY() + random(2, two.getHeight() - 1)));
    		wait(random(800, 1200));
    	}
    	
    	//10% chance of doing antiban: 24/300, every 4.5-18 seconds doing antiban
    	public int antiBan() {
    		switch(random(0, 240)) {
    			case 0: setCameraRotation(random(1, 359)); break;
    			case 1: setCameraRotation(random(1, 359)); break;
    			case 2: setCameraRotation(random(1, 359)); break;
    			case 3: setCameraRotation(random(1, 359)); break;
    			case 4: setCameraRotation(random(1, 359)); break;
    			case 5: setCameraRotation(random(1, 359)); break;
    			case 6: setCameraRotation(random(1, 359)); break;
    			case 7: setCameraRotation(random(1, 359)); break;
    
    			case 8: setCameraAltitude(true); break;
    			case 9: setRun(true); break;
    
    			case 10: moveMouse(random(0, 515), random(0, 337)); break;
    			case 11: moveMouse(random(0, 515), random(0, 337)); break;
    			case 12: moveMouse(random(0, 515), random(0, 337)); break;
    			case 13: moveMouse(random(0, 515), random(0, 337)); break;
    	
    			case 14: moveMouse(random(0, 764), random(0, 502)); break;
    			case 15: moveMouse(random(0, 764), random(0, 502)); break;
    			case 16: moveMouse(random(0, 764), random(0, 502)); break;
    			case 17: moveMouse(random(0, 764), random(0, 502)); break;
    
    			case 18: mouseOverMiningSkill(); break;
    			case 19: mouseOverMiningSkill(); break;
    
    			case 20: openTab(TAB_INVENTORY); break;
    			case 21: openTab(TAB_STATS); break;
    			case 22: openTab(random(0, 13)); break;
    			case 23: openTab(random(0, 13)); break;
    
    			default: break;
    		}
    		return random(50, 300);
    	}
    
    	RSTile lastRockLocation = new RSTile(0000, 0000);
    	boolean mineNewRock = false;
    	RSObject rock;
    	long timeIdle = System.currentTimeMillis();
    
    	public int mineCoal() {
    		if(getMyPlayer().getLocation().getY() < 6000) {
    			if(!climbDownLadder()) {
    				if(myWalkTile(betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)], 1)) {
    					waitUntilNearTile(betweenBankAndLadderTiles[random(0, betweenBankAndLadderTiles.length)], 2);
    					myWalkTile(ladderTile, 2);
    					waitUntilNearTile(ladderTile, 1);
    				} else {
    					myWalkTile(bankTile, 2);
    					waitUntilNearTile(bankTile, 0);
    				}
    			}
    			return random(200, 400);
    		}
    		mineNewRock = true;
    		if(getObjectAt(lastRockLocation) != null) {
    			for(int i = 0; i < coalRockID.length; i++) {
    				if(getObjectAt(lastRockLocation).getID() == coalRockID[i])
    					mineNewRock = false;
    			}
    			for(int i = 0; i < mithRockID.length; i++) {
    				if(getObjectAt(lastRockLocation).getID() == mithRockID[i])
    					mineNewRock = false;
    			}
    		}
    
    		if(getMyPlayer().getAnimation() != -1)
    			timeIdle = System.currentTimeMillis();
    		
    		if(mineNewRock || ((getMyPlayer().getAnimation() == -1) && (System.currentTimeMillis() - timeIdle >= 4000) && !getMyPlayer().isMoving())) {
    			if(miningMith && getNearestObjectById(16, mithRockID) != null)
    				rock = getNearestObjectById(16, mithRockID);
    			else
    				rock = getNearestObjectById(16, coalRockID);
    			if(rock == null) {
    				if(distanceTo(ladderToCoalPath[ladderToCoalPath.length - 1]) < 6) {
    					myWalkPath(coalToLadderPath, 15, 3);
    					wait(random(50, 600));
    					if(random(0, 4) < 3)
    						moveMouse(random(0, 515), random(0, 337));
    					waitUntilNotMoving();
    					return random(50, 200);
    				}
    				if(distanceTo(coalToLadderPath[ladderToCoalPath.length - 1]) < 6) {
    					myWalkPath(ladderToCoalPath, 15, 3);
    					wait(random(50, 600));
    					if(random(0, 4) < 3)
    						moveMouse(random(0, 515), random(0, 337));
    					waitUntilNotMoving();
    					return random(50, 200);
    				}
    				if(random(0, 2) == 0)
    					myWalkPath(ladderToCoalPath, 15, 3);
    				else
    					myWalkPath(coalToLadderPath, 15, 3);
    
    				wait(random(50, 600));
    				if(random(0, 4) < 3)
    					moveMouse(random(0, 515), random(0, 337));
    				waitUntilNotMoving();
    				return random(50, 200);
    			}
    			//if(!tileOnScreen(rock.getLocation())) {
    			if(!Calculations.onScreen(Calculations.tileToScreen(rock.getLocation()))) {
    				myWalkTile(rock.getLocation(), 2);
    				wait(random(50, 600));
    				if(random(0, 4) < 3)
    					moveMouse(random(0, 515), random(0, 337));
    				waitUntilNotMoving();
    				return random(50, 200);
    			}
    			lastRockLocation = rock.getLocation();
    			atObject(rock, "ine");
    			return random(100, 300);
    		}
    		return antiBan();
    	}
    
    	int tries = 0;
    	public int teleportToLumbridge() {
    		if(distanceTo(lumbridgeTile) > 17) {
    			castSpell(1);
    			wait(random(1500, 2400));
    			if(getMyPlayer().getAnimation() != -1) {
    				wait(random(12500,14000));
    			} else {
     				tries++;
     				if(tries >= 4) {
     					log("Unable to teleport to lumbridge, stopping script");
     					printProgressReport();
     					stopAllScripts();
     				}
     				int r = random(120000, 400000);
     				log("Unable to teleport to lumbridge, will attempt again in " + (r / 1000));
     				wait(r);
    			}
    		}
    		myWalkTile(lumbridgeTile, 1);
    		setRun(true);
    		waitUntilNearTile(lumbridgeTile, 2);
    		return random(100, 600);
    	}
    
    	public void waitUntilNotMoving() {
    		wait(random(700, 800));
    		while(getMyPlayer().isMoving())
    			wait(random(25, 100));
    	}
    
    	public void waitUntilNearTile(RSTile tile, int dist) {
    		wait(random(700, 800));
    		while(distanceTo(tile) > dist && getMyPlayer().isMoving())
    			wait(random(25, 100));
    	}
    
    	public boolean myWalkTile(RSTile theTile, int randomness) {
    		if((distanceTo(theTile)) <= 17) {
    			RSTile newTile;
    			if(randomness == 0)
    				newTile = new RSTile(theTile.getX(), theTile.getY());
    			else
    				newTile = new RSTile(theTile.getX() + random(-randomness, randomness), theTile.getY() + random(-randomness, randomness));
    
    			if(random(0, 30) == 0)
    				turnToTile(newTile, 15);
    
    			if(tileOnScreen(newTile) && random(0, 8) == 0) {
    				if(!atTile(newTile, "Walk")) {
    					if(!walkTileMM(newTile)) {
    						log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")");
    						return false;
    					} else {
    						return true;
    					}
    				} else {
    					return true;
    				}
    			} else {
    				if(!walkTileMM(newTile)) {
    					log("Failed walking to tile: (" + theTile.getX() + ", " + theTile.getY() + ")");
    					return false;
    				} else {
    					return true;
    				}
    			}
    		} else {
    			log("Tile out of reach: (" + theTile.getX() + ", " + theTile.getY() + ")");
    			return false;
    		}
    	}
    
    	public RSTile myGetNextTile(RSTile[] path, int maxDist) {
    		for(int i = path.length - 1; i >= 0; i--) {
    			if(distanceTo(path[i]) <= maxDist) {
    				return path[i];
    			}
    		}
    		return null;
    	}
    
    	public boolean myWalkPath(RSTile[] path, int maxDist, int randomness) {
    		if(distanceTo(path[path.length - 1]) <= 4) {
    			return true;
    		} else {
    			RSTile theTile = myGetNextTile(path, maxDist);
    			if(theTile != null) {
    				myWalkTile(theTile, randomness);
    				waitUntilNearTile(theTile, 2);
    			}
    			return false;
    		}
    	}
    
    	public void myWalkPathAllTheWay(RSTile[] path, int randomness) {
    		while(distanceTo(path[path.length - 1]) >= 4) {
    			RSTile theTile = myGetNextTile(path, 17);
    			if(theTile != null) {
    				myWalkTile(theTile, randomness);
    				waitUntilNearTile(theTile, 2);
    			}
    		}
    	}
    
    	public RSObject getNearestObjectById(int range, int... ids) {
    		for(int i = 0; i <= range; i++) {
    			RSObject temp = findObject(i, ids);
    			if(temp != null) {
    				return temp;
    			}
    		}
    		return null;
    	}
    }
    Essence Miner
    Code:
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Point;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.Map;
    
    import com.speljohan.rsbot.bot.Bot;
    import com.speljohan.rsbot.event.listeners.PaintListener;
    import com.speljohan.rsbot.script.Calculations;
    import com.speljohan.rsbot.script.Script;
    import com.speljohan.rsbot.script.wrappers.RSInterface;
    import com.speljohan.rsbot.script.wrappers.RSNPC;
    import com.speljohan.rsbot.script.wrappers.RSObject;
    import com.speljohan.rsbot.script.wrappers.RSTile;
    
    public class YanilleEssMiner extends Script implements PaintListener {
    
        private final int bankID = 2213, npcID = 462, portalID = 2492,
                essID = 7936, doorX = 2595, wait1 = 150, wait2 = 350;
        private final int[] picks = { 1265, 1267, 1269, 1273, 1271, 1275 };
        private final RSTile doorTile = new RSTile(2598, 3088),
                mageTile = new RSTile(2595, 3088),
                bankTile = new RSTile(2611, 3093), centerTile = new RSTile(2911,
                        4832), northwestTile = new RSTile(2894, 4848),
                northeastTile = new RSTile(2926, 4849), southeastTile = new RSTile(
                        2928, 4817), southwestTile = new RSTile(2897, 4815);
        private int doorID = 1601, loads, mined;
        public int price;
        private boolean usePrice;
    
        public String getName() {
            return "Yanille Essence Miner";
        }
    
        public String getAuthor() {
            return "Fusion89k";
        }
    
        public double getVersion() {
            return 1;
        }
    
        public String getScriptCategory() {
            return "Mining";
        }
    
        public String getScriptDescription() {
            return "<html>\n"
                    + "<head></head>\n"
                    + "<body>\n"
                    + "<center>"
                    + "<h2>"
                    + getName()
                    + "</h2>"
                    + "</center>\n"
                    + "<b>Author:</b> "
                    + getAuthor()
                    + "<br />"
                    + "<b>Version:</b> "
                    + getVersion()
                    + "<br><br>"
                    + "Have Pick equipped or in inventory<br>"
                    + "<b>Requirements:</b> 66+ mage, Rune Mysteries, Pickaxe"
                    + "<br><br><input type='checkbox' name='price' value='true' checked='checked'> Use Price Finder"
                    + "<br>Will cause script to lag on start" + "</body>\n"
                    + "</html>";
        }
    
        public boolean onStart(Map<String, String> args) {
            if (args.get("price") != null) {
                usePrice = true;
                price = getMarketPriceOfItem(essID);
            }
            Bot.getEventManager().addListener(PaintListener.class, this);
            return true;
        }
    
        public void onFinish() {
            Bot.getEventManager().removeListener(PaintListener.class, this);
        }
    
        public int loop() {
            setCameraAltitude(true);
            if (getMyPlayer().isMoving() || getMyPlayer().getAnimation() != -1)
                return random(wait1, wait2);
            if (!itemCheck(picks)) {
                log("No Pickaxe - Logging Out");
                log("If your Pickaxe is equipped, please un-equip");
                logout();
                return -1;
            }
            if (skills.getCurrentSkillLevel(STAT_MAGIC) < 66) {
                log("Magic Level too low - Logging Out");
                logout();
                return -1;
            }
            if (isInventoryFull()) {
                if (inMining()) {
                    doObject(portalID);
                } else if (inGuild()) {
                    openDoor();
                } else if (distanceTo(bankTile) > 4) {
                    walkTileMM(checkTile(randomTile(bankTile)));
                } else {
                    if (!bank.getInterface().isValid()) {
                        doObject(bankID, "Use-quickly");
                        return random(50, 150);
                    } else {
                        mined += getInventoryCount(essID);
                        bank.depositAllExcept(picks);
                        loads++;
                    }
                }
            } else {
                if (!inGuild() && !inMining()) {
                    if (distanceTo(doorTile) > 4)
                        walkTileMM(checkTile(randomTile(doorTile)));
                    else
                        openDoor();
                } else if (!inMining()) {
                    RSNPC mage = getNearestNPCByID(npcID);
                    if (mage != null) {
                        if (tileOnScreen(mage.getLocation()))
                            atNPC(mage, "Teleport");
                        else
                            walkTileMM(checkTile(randomTile(mage.getLocation())));
                        wait(random(wait1 * 2, wait2 * 2));
                    }
                } else {
                    RSTile temp = locate();
                    if (!tileOnScreen(temp))
                        walkTileMM(checkTile(randomTile(temp)));
                    else {
                        atTile(temp, "Mine");
                    }
                }
            }
            return random(wait1, wait2);
        }
    
        private RSTile locate() {
            final int one = distanceTo(northwestTile), two = distanceTo(northeastTile), three = distanceTo(southeastTile), four = distanceTo(southwestTile);
            int temp = Math.min(one, Math.min(two, Math.min(three, four)));
            if (temp == one)
                return northwestTile;
            else if (temp == two)
                return northeastTile;
            else if (temp == three)
                return southeastTile;
            else
                return southwestTile;
        }
    
        private boolean itemCheck(int[] id) {
            if (isLoggedIn()) {
                if (RSInterface.getChildInterface(378, 45).getAbsoluteX() < 20) {
                    for (int i = 0; i < id.length; i++) {
                        if (getInventoryCount(id[i]) > 0
                                || getEquipmentCount(id[i]) > 0)
                            return true;
                    }
                    return false;
                }
            }
            return true;
        }
    
        private boolean inGuild() {
            return canReach(mageTile, true);
        }
    
        private boolean inMining() {
            return distanceTo(centerTile) < 100;
        }
    
        private RSTile checkTile(RSTile tile) {
            if (getEnergy() > random(60, 100))
                setRun(true);
            if (tileOnMap(tile))
                return tile;
            RSTile loc = getMyPlayer().getLocation();
            RSTile walk = new RSTile((loc.getX() + tile.getX()) / 2,
                    (loc.getY() + tile.getY()) / 2);
            if (!tileOnMap(walk))
                return checkTile(walk);
            return walk;
        }
    
        private void openDoor() {
            if (canContinue()) {
                if (doorID == 1600)
                    doorID++;
                else
                    doorID--;
            }
            int direction = 0, min = Integer.MAX_VALUE;
            int turn = getCameraAngle();
            int[] dirs = new int[] { 359, 89, 179, 269 };
            for (int i = 0; i < dirs.length; i++) {
                if (Math.abs(dirs[i] - turn) < min) {
                    direction = dirs[i];
                }
            }
            RSObject door = findObject(doorID);
            if (door == null)
                return;
            if (door.getLocation().getX() < doorX) {
                walkTileMM(randomTile(new RSTile(doorX, getMyPlayer().getLocation()
                        .getY()), 1));
                return;
            }
            if (!tileOnScreen(door.getLocation()))
                walkTileMM(randomTile(door.getLocation()));
            Point click = new Point();
            switch (direction) {
            case 359:// North
                setCompass('n');
                click = Calculations.tileToScreen(door.getLocation());
                click.x -= random(10, 15);
                break;
            case 89:// East
                setCompass('e');
                click = Calculations.tileToScreen(door.getLocation());
                click.y -= random(10, 15);
                break;
            case 179:// South
                setCompass('s');
                click = Calculations.tileToScreen(door.getLocation());
                click.x += random(10, 15);
                break;
            case 269:// West
                setCompass('w');
                click = Calculations.tileToScreen(door.getLocation());
                click.y += random(10, 15);
                break;
            }
            clickMouse(click, true);
        }
    
        private RSTile randomTile(RSTile location) {
            return randomTile(location, 2);
        }
    
        private RSTile randomTile(RSTile location, int rand) {
            return randomTile(location, rand, rand);
        }
    
        private RSTile randomTile(RSTile location, int xRand, int yRand) {
            int x = location.getX(), y = location.getY();
            return new RSTile(x + random((-1 * xRand), xRand), y
                    + random((-1 * yRand), yRand));
        }
    
        private void doObject(int id) {
            RSObject obj = findObject(id);
            if (obj != null) {
                if (tileOnScreen(obj.getLocation()))
                    clickMouse(Calculations.tileToScreen(obj.getLocation()), 3, 3,
                            true);
                else
                    walkTileMM(randomTile(obj.getLocation()));
            }
        }
    
        private void doObject(int id, String action) {
            RSObject obj = findObject(id);
            if (obj != null) {
                if (tileOnScreen(obj.getLocation()))
                    atObject(obj, action);
                else
                    walkTileMM(randomTile(obj.getLocation()));
            }
        }
    
        // All credits for this method goto Tenac. Was to lazy to make my own
        public static int getMarketPriceOfItem(int id) {
            String pageSource = "";
            int begin = 0;
            int end = 0;
            try {
                URL theUrl = new URL(
                        "http://itemdb-rs.runescape.com/viewitem.ws?obj=" + id);
                URLConnection theUrlConnection = theUrl.openConnection();
                BufferedReader in = new BufferedReader(new InputStreamReader(
                        theUrlConnection.getInputStream()));
                String inputLine = "";
                while ((inputLine = in.readLine()) != null)
                    pageSource += inputLine;
                in.close();
                begin = pageSource.indexOf("<b>Market price:</b> ")
                        + ("<b>Market price:</b> ").length();
                end = pageSource.indexOf("</span><span><b>Maximum price:</b>");
            } catch (Exception e) {
                System.out
                        .println("Error obtaining price of http://itemdb-rs.runescape.com/viewitem.ws?obj="
                                + id);
            }
            return (int) new Integer(pageSource.substring(begin, end)).intValue();
        }
    
        public void onRepaint(Graphics g) {
            g.setColor(Color.RED);
            g.drawString("Yanille Rune Essence Miner", 260, 20);
            g.drawString("Loads: " + loads + "   Ess Mined: " + mined, 260, 38);
            if (usePrice)
                g.drawString("Profit: " + price * mined + "   " + price
                        + " gp each.", 260, 56);
        }
    
    }
     
  5. Unread #3 - Feb 18, 2009 at 12:52 AM
  6. Magical Dubie
    Joined:
    Jun 23, 2008
    Posts:
    326
    Referrals:
    1
    Sythe Gold:
    0

    Magical Dubie Forum Addict
    Banned

    Can someone hook it up with these scripts.

    dude your a badass.

    is that ess miner any good though?
     
< Need RSBot Script - Willow Dropper :nuts: | RevivedCaviak? >

Users viewing this thread
1 guest


 
 
Adblock breaks this site