Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Runite Miner Recruit code 1

// To find the thread goto powerbot.org and search "Runite miner recruit"

import java.awt.AlphaComposite;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.lang.reflect.Method;
import java.util.Map;

import javax.swing.JOptionPane;

import com.speljohan.rsbot.account.Account;
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.Skills;
import com.speljohan.rsbot.script.wrappers.RSInterface;
import com.speljohan.rsbot.script.wrappers.RSInterfaceChild;
import com.speljohan.rsbot.script.wrappers.RSObject;
import com.speljohan.rsbot.script.wrappers.RSTile;

public class VidalsRuniteMinerFreeVersion extends Script implements
		PaintListener {

	int[] area_heroesguildfloor1 = new int[] { 2902, 3503, 2891, 3516 };
	int[] area_stairs = new int[] { 2893, 9906, 2891, 9908 };
	int[] area_stairsup = new int[] { 2894, 3506, 2892, 3509 };
	int[] area_runitemine = new int[] { 2940, 9883, 2936, 9886 };
	int[] area_bank = new int[] { 2848, 3537, 2843, 3545 };
	RSTile[][] path_tomine = new RSTile[][] { { new RSTile(2903, 9912),
			new RSTile(2914, 9912), new RSTile(2928, 9911),
			new RSTile(2936, 9901), new RSTile(2936, 9891),
			new RSTile(2940, 9884) } };
	RSTile[][] path_tomine1 = new RSTile[][] { { new RSTile(2940, 9884),
			new RSTile(2935, 9893), new RSTile(2937, 9903),
			new RSTile(2928, 9911), new RSTile(2915, 9911),
			new RSTile(2901, 9911), new RSTile(2893, 9907) } };
	RSTile[][] path_tostairs = new RSTile[][] { { new RSTile(2893, 3508), } };
	RSTile doorTile = new RSTile(2901, 3511);
	RSTile[][] path_todoor = new RSTile[][] { { new RSTile(2901, 3511), } };
	RSTile[][] path_tobank3 = new RSTile[][] { { new RSTile(2843, 3543), } };
	RSTile[][] path_tobank = new RSTile[][] { { new RSTile(2902, 3511),
			new RSTile(2908, 3521), new RSTile(2898, 3531),
			new RSTile(2889, 3542), new RSTile(2877, 3546), } };
	RSTile[][] path_tobank2 = new RSTile[][] { { new RSTile(2876, 3546),
			new RSTile(2865, 3546), new RSTile(2851, 3546),
			new RSTile(2843, 3543), } };
	RSTile[][] path_tobank9 = new RSTile[][] { { new RSTile(2843, 3543),
			new RSTile(2853, 3546), new RSTile(2865, 3546),
			new RSTile(2876, 3546), } };
	RSTile[][] path_tobank8 = new RSTile[][] { { new RSTile(2877, 3546),
			new RSTile(2890, 3543), new RSTile(2897, 3531),
			new RSTile(2908, 3523), new RSTile(2902, 3511), } };

	private AlphaComposite makeComposite(float alpha) {
		int type = AlphaComposite.SRC_OVER;
		return (AlphaComposite.getInstance(type, alpha));
	}

	int runenergy = 0;
	int runepick = 1275;
	boolean mineisok = false;
	int jade = 4296;
	int bankbooth = 2213;
	int[] runitemine = { 33078, 33079 };
	int[] usedrunitemine = { 33400, 33401 };
	int runiteore = 451;
	int ladder = 1754;
	int ladder2 = 1757;
	int door = 2625;
	int warguilddoorin = 33439;
	int warguilddoorout = 33438;
	int profit = 0;
	int miningXp = 0;
	int runitebanked = 0;
	String process;
	double profitperminute = 0;
	double profitperhour = 0;
	double profitpersecond = 0;
	long starttime = 0;
	long time = 0;
	long minutes = 0;
	long hours = 0;
	long seconds = 0;
	boolean heroesguild = false;
	boolean wilderness = false;

	public double getVersion() {
		return 1.8;
	}

	public String getScriptCategory() {
		return "Logik Scripting Inc.";
	}

	public String getName() {
		return "Vidal's Runite Miner EXTREME Free Version";
	}

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

	float avarageXpAHour(long timePassed, String skill, int startXp) {
		long tempTime = timePassed / 60 / 60;
		float avgTime = (float) tempTime
				/ (skills.getCurrentSkillExp(Skills.getStatIndex("skill")) - startXp);
		return 1000 / avgTime;
	}

	public String getScriptDescription() {
		String html = "";

		html += "<style type=\"text/css\">body {background:url(\"http://i223.photobucket.com/albums/dd208/countvidal/RuniteMiner.jpg\") no-repeat}</style>";
		html += "<body bgcolor=\"Black\">";
		html += "<a id=\"boots\" href=\"http://logikscripting.com\">                                             Click Here ©                                              </a>";
		html += "<br /><br /><br /><br /><br /><font color=\"Red\"><br /><b>Instructions:</b><br />";
		html += "<font color=\"Red\">1. If mining in heroes' guild start inside heroes' guild. Have a rune pick equipped and inventory empty.<br />";
		html += "<font color=\"Red\">3. Make sure you have no favorite worlds, all member worlds are first, and MAKE SURE ALL PVP WORLDS ARE NOT ON SCREEN.<br />";
		html += "<font color=\"Red\"><b>Where do you want to mine?</b><br />";
		html += "<form><font color=\"Red\"><input type=\"radio\" color=\"Red\" name=\"doing\" value=\"1\" checked=\"checked\">Heroes' Guild<br /></form>";

		return (html);
	}

	public void onRepaint(Graphics g) {
		double profitperhour;
		double profitperminute;
		double profitpersecond;
		profit = (runitebanked * 15605);
		// calc time.
		if (starttime == 0) {
			starttime = System.currentTimeMillis();
		}
		// 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;
		}
		Graphics2D g2d = (Graphics2D) g;
		float alpha = 0.25f;
		// int type = AlphaComposite.SRC_OVER;
		// AlphaComposite composite = AlphaComposite.getInstance(type, alpha);
		g2d.setComposite(makeComposite(alpha));
		g2d.setColor(Color.BLACK);
		g2d.fillRect(5, 190, 220, 150);
		g2d.setColor(Color.YELLOW.darker());
		g2d.fillRect(20, 205, 190, 120);
		alpha = 1.0f;
		// composite = AlphaComposite.getInstance(type, alpha);
		g2d.setComposite(makeComposite(alpha));
		g2d.setColor(Color.PINK);
		g2d.drawString(getName() + " v" + getVersion(), 30, 220);
		g2d.drawString("Runite Banked: " + runitebanked + ".", 30, 240);
		g2d.drawString("Total Profit: " + profit + "Gp.", 30, 260);
		g2d.drawString(hours + ":" + minutes + ":" + seconds, 30, 280);
		g2d.drawString(
				"Gained "
						+ (skills.getCurrentSkillExp(Skills
								.getStatIndex("mining")) - miningXp)
						+ " mining xp", 30, 300);
		// g2d.drawString("Average XP per hour: " + avarageXpAHour(startTime,
		// "mining", miningXp), byte0, i1 += 15);
		if (hours != 0) {
			profitperhour = profit / ((int) hours);
			g2d
					.drawString("Profit per hour: " + profitperhour + "Gp.",
							30, 320);
		} else if (minutes != 0) {
			profitperminute = profit / ((int) minutes);
			g2d.drawString("Profit per minute: " + profitperminute + "Gp.", 30,
					320);
		} else if (seconds != 0) {
			profitpersecond = profit / ((int) seconds);
			g2d.drawString("Profit per second: " + profitpersecond + "Gp.", 30,
					320);
		}
	}

	public void onFinish() {
		log("Thanks for using Vidal's Runite Miner EXTREME!");
		log("http://logikscripting.com for more amazing scripts");
	}

	public boolean onStart(Map<String, String> args) {
		int welcome = JOptionPane
				.showConfirmDialog(
						null,
						"Before using my script, would you like to thank me\nby clicking some adverts?",
						"Welcome", JOptionPane.YES_NO_OPTION);
		if (welcome == 0) {
			String message = "<html><h1>Thank you for your support!</h1><br/>"
					+ "<p>You will now be redirected to my adverts page. <br/>"
					+ "Click the adverts on the page few times a day if you can, remember stay atleast 30 seconds in each page.</p>"
					+ "</html>";
			JOptionPane.showMessageDialog(null, message);
			openURL("http://logikscripting.com/thanks/index.html");
		}
		int anti = JOptionPane
				.showConfirmDialog(
						null,
						"Make sure autologin, and breakhandler anti random/ban are turned off",
						"Have Fun!", JOptionPane.OK_OPTION);
		if (anti == -1) {
			stopAllScripts();
		}
		int Buy = JOptionPane
				.showConfirmDialog(
						null,
						"Would You Like to Buy the v2.0 Upgrade?\n\n* Added Neitiznot Runite Mining\n* State of The Art Methods\n* Integrated Chat Responder\n* World Hopping now selects ALL Member Worlds\n* Restructured script to make it EXTREMELY fast\n* New flashy paint\n* Checks for updates internally\n* MUCH faster, smoother and stable.",
						"Upgrade!", JOptionPane.YES_NO_OPTION);
		if (Buy == 0) {
			String message = "<html><h1>Payment</h1><br/>"
					+ "<p>You will now be redirected to PayPal. <br/>" + "</p>"
					+ "</html>";
			JOptionPane.showMessageDialog(null, message);
			openURL("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5213062");
		}
		miningXp = skills.getCurrentSkillExp(Skills.getStatIndex("mining"));
		int choice = Integer.parseInt(args.get("doing"));
		switch (choice) {
		case 1:
			heroesguild = true;
		case 2:
			wilderness = true;
			break;
		}
		return true;

	}

	private void climbdownladder() {
		wait(random(600, 700));
		RSObject ladder1 = getNearestObjectByID(ladder);
		wait(random(600, 700));
		if (ladder1 == null) {
			log("I cant Fucking Find that Damn Ladder! Give me a few seconds, you know bots get drunk too!");
		} else {
			atObject(ladder1, "Climb-down Ladder");
			wait(random(2000, 3000));
		}
	}

	private void climbupladder() {
		setCameraAltitude(true);
		wait(random(600, 700));
		setCameraRotation(90);
		RSObject ladder3 = getNearestObjectByID(ladder2);
		if (ladder3 == null) {
			log("I cant Fucking Find that Damn Ladder! Give me a few seconds, you know bots get drunk too!");
		} else {
			atObject(ladder3, "Climb-up Ladder");
			wait(random(600, 700));
		}
	}

	private void walktoladder() {
		walkPathMM(reversePath(path_tomine[0]), 17);
	}

	private void walktodoor() {
		walkTileMM(doorTile);
	}

	private boolean isInBounds(int... bounds) {
		boolean result = false;
		int x = getMyPlayer().getLocation().getX();
		int y = getMyPlayer().getLocation().getY();
		if (y <= bounds[0] && y >= bounds[1] && x <= bounds[2]
				&& x >= bounds[3]) {
			result = true;
		}
		return result;
	}

	public boolean isInArea(int maxX, int minY, int minX, int maxY) {
		int x = getMyPlayer().getLocation().getX();
		int y = getMyPlayer().getLocation().getY();
		if (x >= minX && x <= maxX && y >= minY && y <= maxY) {
			return true;
		}
		return false;
	}

	private void opendwardoor() {
		setCameraRotation(270);
		RSObject door2 = findObject(warguilddoorout);
		wait(random(600, 700));
		atObject(door2, "Open Door");
		wait(random(1800, 1900));
	}

	private void opendoor() {
		setCameraRotation(270);
		RSObject door1 = findObject(door);
		wait(random(600, 700));
		if (door1 == null) {
			log("Im too darn drunk to open the door, give me a sec");
		} else {
			atObject(door1, "Open Door");
			wait(random(1800, 1900));
		}
	}

	public void walkToBank() {

	}

	public void openBank() {
		boolean success = false;
		RSObject booth = getNearestObjectByID(bankbooth);
		if (distanceTo(booth) > 5) {
			walkToBank();
			wait(random(800, 900));
		}
		success = atObject(booth, "Use-quickly Bank booth");
		wait(random(600, 700));
		if (isMenuOpen()) {
			atMenu("Use-quickly Bank booth");
		}
		if (!success) {
			walkToBank();
		}

	}

	public void deposit() {
		bank.depositAllExcept(runepick);
	}

	public void walktowardoor() {
		walkPathMM(path_tobank9[0], 17);
	}

	public void walktoherodoor() {
		walkPathMM(reversePath(path_tobank[0]), 17);
	}

	public void pathtowardoor() {
		walkPathMM(path_tobank[0], 17);
	}

	public void pathtobank() {
		walkPathMM(path_tobank2[0], 17);
	}

	public boolean worldhop() {
		log("Worldhopping, this may take 1-2 Minutes.");
		logout();
		if (RSInterface.getInterface(744).getChild(580).isValid()) {
			process = "World Hopping";
			log("Process: " + process);
			int x9 = random(345, 415);
			int y9 = random(242, 250);
			moveMouse(x9, y9);
			int positionX = (input.getX());
			int positionY = (input.getY());
			boolean succsess = false;
			wait(random(400, 800));
			if (positionX == x9 && positionY == y9) {
				succsess = true;
			}
			if (!succsess) {
				worldhop();
			}
			clickMouse(true);
			wait(random(4000, 6000));

			int x10 = random(84, 296);
			int y10 = random(148, 450);
			moveMouse(x10, y10);
			clickMouse(true);
			wait(random(4000, 6000));
			boolean loggedin = true;
			if (RSInterface.getInterface(744).getChild(631).isValid()) {
				String text1 = RSInterface.getInterface(744).getChild(631)
						.getText();
				if (text1.equals("World 2")) {
					log("This is a Heavily Populated World, Choosing another one");
					loggedin = false;
				} else if (text1.equals("World 6")) {
					log("This is a Heavily Populated World, Choosing another one");
					loggedin = false;
				} else if (text1.equals("World 143")) {
					log("This is a Heavily Populated World, Choosing another one");
					loggedin = false;
				} else if (text1.equals("World 144")) {
					log("This is a Heavily Populated World, Choosing another one");
					loggedin = false;
				} else if (text1.equals("World 44")) {
					log("This is a Heavily Populated World, Choosing another one");
					loggedin = false;
				} else if (text1.contains("World 65")) {
					log("This is a PvP World, Choosing another one");
					loggedin = false;
				} else if (text1.contains("World 26")) {
					log("This is a PvP World, Choosing another one");
					loggedin = false;
				} else if (text1.contains("World 159")) {
					log("This is a PvP World, Choosing another one");
					loggedin = false;
				} else if (text1.contains("World 124")) {
					log("This is a PvP World, Choosing another one");
					loggedin = false;
				} else if (text1.contains("World 18")) {
					log("This is a PvP World, Choosing another one");
					loggedin = false;
				} else if (text1.contains("World 89")) {
					log("This is a PvP World, Choosing another one");
					loggedin = false;
				} else if (text1.contains("World 59")) {
					log("This is a PvP World, Choosing another one");
					loggedin = false;

					if (!loggedin) {
						worldhop();
					}

				} else if (loggedin && text1 != "World 2" && text1 != "World 6"
						&& text1 != "World 143" && text1 != "World 144"
						&& text1 != "World 44" && !text1.contains("World 65")
						&& !text1.contains("World 26")
						&& !text1.contains("World 159")
						&& !text1.contains("World 124")
						&& !text1.contains("World 18")
						&& !text1.contains("World 89")
						&& !text1.contains("World 59")) {
					login();
				}

			}
		}
		return isLoggedIn();

	}

	private void checkprocess() {
		if (isInArea(2893, 9905, 2891, 9909) && !isInventoryFull()) {
			process = "Walking to Runite Mine";
			return;
		} else if (isInArea(2894, 3506, 2892, 3509) && !isInventoryFull()) {
			process = "Going down the stairs";
			return;
		} else if (isInArea(2902, 3511, 2902, 3511) && !isInventoryFull()) {
			process = "Opening Heroes Guild Door";
			return;
		} else if (isInArea(2877, 3546, 2877, 3546) && !isInventoryFull()) {
			process = "Still Walking to Heroes Guild";
			return;
		} else if (isInArea(2901, 3503, 2891, 3516) && !isInventoryFull()) {
			process = "Walking to Stairs";
			return;
		} else if (isInArea(2848, 3537, 2843, 3545) && !isInventoryFull()) {
			process = "Walking to Heroes Guild";
			return;
		} else if (isInArea(2902, 3510, 2902, 3511) && isInventoryFull()) {
			process = "Walking to Bank";
			return;
		} else if (isInArea(2901, 3503, 2891, 3516) && isInventoryFull()) {
			process = "Walking to Heroes Guild Door";
			return;
		} else if (isInArea(2876, 3546, 2876, 3546) && isInventoryFull()) {
			process = "Still Walking to Bank";
			return;
		} else if (isInArea(2845, 3541, 2843, 3545) && isInventoryFull()) {
			process = "Banking Runite Ore";
			return;
		} else if (isInArea(2894, 9904, 2890, 9909) && isInventoryFull()) {
			process = "Going up the stairs";
			return;
		} else if (isInArea(2940, 9883, 2936, 9886) && isInventoryFull()) {
			process = "Inventory is full, Walking to Bank";
			return;
		} else if (isInArea(2940, 9883, 2936, 9886)) {
			process = "Mining Runite Ore";
			return;
		}
	}

	public void bank() {
		try {
			int before = getInventoryCount(runiteore);
			deposit();
			wait(500);
			int after = getInventoryCount(runiteore);
			if (after < before) {
				runitebanked += before - after;
			}
			wait(random(800, 1000));
			bank.close();
			checkprocess();
			return;
		} catch (Exception e) {
		}
	}

	public int loop() {
		int waitlength = 800;
		if (heroesguild) {
			checkprocess();
			if (process.equals("Walking to Stairs")) {
				wait(random(800, 1000));
				if (!getMyPlayer().isMoving()) {
					walkPathMM(path_tostairs[0], 17);
				}
			} else if (process.equals("Walking to Heroes Guild Door")) {
				if (!getMyPlayer().isMoving()) {
					walktodoor();
				}
				wait(random(5000, 10000));
				if (!getMyPlayer().isMoving()) {
					opendoor();
				}
			} else if (process.equals("Walking to Bank")) {
				if (isInArea(2877, 3546, 2877, 3546)) {
					if (!getMyPlayer().isMoving()) {
						opendwardoor();
					}
				} else {
					wait(random(800, 1000));
					if (!getMyPlayer().isMoving()) {
						walkPathMM(path_tobank[0], 17);
					}
				}
			} else if (process.equals("Banking Runite Ore")) {
				openBank();
				if (bank.getInterface().isValid()) {
					bank();
				}

			} else if (process.equals("Still Walking to Bank")) {
				wait(random(800, 1000));
				if (!getMyPlayer().isMoving()) {
					walkPathMM(path_tobank2[0], 14);
				}
			} else if (process.equals("Opening Heroes Guild Door")) {
				if (isInArea(2902, 3511, 2902, 3511)) {
					if (!getMyPlayer().isMoving()) {
						opendoor();
					}
				}
			} else if (process.equals("Walking to Heroes Guild")) {
				if (isInArea(2876, 3545, 2875, 3547)) {
					if (!getMyPlayer().isMoving()) {
						opendwardoor();
					}
				} else {
					wait(random(800, 1000));
					if (!getMyPlayer().isMoving()) {
						walkPathMM(path_tobank9[0], 17);
					}
				}
			} else if (process.equals("Still Walking to Heroes Guild")) {
				if (isInArea(2902, 3511, 2902, 3511)) {
					if (!getMyPlayer().isMoving()) {
						opendoor();
					}
				} else {
					wait(random(800, 1000));
					if (!getMyPlayer().isMoving()) {
						walkPathMM(path_tobank8[0], 17);
					}
				}
			} else if (process.equals("Going down the stairs")) {
				if (!getMyPlayer().isMoving()) {
					climbdownladder();
				}
			} else if (process.equals("Walking to Runite Mine")) {
				wait(random(800, 1000));
				if (!getMyPlayer().isMoving()) {
					setCameraRotation(random(1, 359));
					walkPathMM(reversePath(path_tomine1[0]), 14);
				}
			} else if (process.equals("Going up the stairs")) {
				if (!getMyPlayer().isMoving()) {
					climbupladder();
				}
			} else if (process.equals("Inventory is full, Walking to Bank")) {
				runenergy = random(30, 80);
				run(runenergy);
				wait(random(800, 1000));
				if (!getMyPlayer().isMoving()) {
					setCameraRotation(random(1, 359));
					walkPathMM(path_tomine1[0], 14);
				}
			} else if (process.equals("Mining Runite Ore")) {
				RSObject ore = getNearestObjectByID(runitemine);
				if (ore == null)
					worldhop();
				else {
					minerocks();
				}
			}
		}
		return waitlength;

	}

	public void minerocks() {
		try {
			if (onTile(getNearestObjectByID(runitemine).getLocation(), "Rocks",
					"Mine")) {
				wait(random(4000, 6000));
			}
		} catch (Exception e) {
		}
	}

	public boolean onTile(RSTile tile, String search, String action) {
		if (!tile.isValid()) {
			return false;
		}

		Point checkScreen = Calculations.tileToScreen(tile);
		if (!pointOnScreen(checkScreen)) {
			walkTileMM(tile);
			wait(random(340, 700));
		}

		try {
			Point screenLoc = null;
			for (int i = 0; i < 30; i++) {
				screenLoc = Calculations.tileToScreen(tile);
				if (!pointOnScreen(screenLoc)) {
					return false;
				}
				if (getMenuItems().get(0).toLowerCase().contains(
						search.toLowerCase())) {
					break;
				}
				if (getMouseLocation().equals(screenLoc)) {
					break;
				}
				moveMouse(screenLoc);
			}
			screenLoc = Calculations.tileToScreen(tile);
			if (getMenuItems().size() <= 1) {
				return false;
			}
			if (getMenuItems().get(0).toLowerCase().contains(
					action.toLowerCase())) {
				clickMouse(true);
				return true;
			} else {
				clickMouse(false);
				return atMenu(action);
			}
		} catch (Exception e) {
			e.printStackTrace();
			return false;
		}
	}

	public void openURL(String url) { // Credits to Ruski who gave credits to
		// Dave who gave credits to some guy who
		// made this.

		String osName = System.getProperty("os.name");

		try {

			if (osName.startsWith("Mac OS")) {

				Class fileMgr = Class.forName("com.apple.eio.FileManager");

				Method openURL = fileMgr.getDeclaredMethod("openURL",

				new Class[] { String.class });

				openURL.invoke(null, new Object[] { url });

			} else if (osName.startsWith("Windows"))

				Runtime.getRuntime().exec(

				"rundll32 url.dll,FileProtocolHandler " + url);

			else {

				String[] browsers = { "firefox", "opera", "konqueror",

				"epiphany", "mozilla", "netscape" };

				String browser = null;

				for (int count = 0; count < browsers.length && browser == null; count++)

					if (Runtime.getRuntime().exec(

					new String[] { "which", browsers[count] })

					.waitFor() == 0)

						browser = browsers[count];

				if (browser == null)

					throw new Exception("Could not find web browser");

				else

					Runtime.getRuntime().exec(new String[] { browser, url });

			}

		} catch (Exception e) {

		}

	}

	private void run(int minimum) {
		int current = getEnergy();
		if (minimum <= current) {
			setRun(true);
		}
	}

	private int distanceTo(int[] usedrunitemine2) {
		return 0;
	}

}


You need to create an account or log in to post comments to this site.


Click here to browse all 7716 code snippets