// 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.lang.reflect.Method;
import java.util.Map;

import javax.swing.JOptionPane;

import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.methods.Skills;
//import org.rsbot.script.wrappers.RSInterfaceChild;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSTile;

public class WildyMiner 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 += "";
html += "";
html += " Click Here © ";
html += "





Instructions:
";
html += "1. If mining in heroes' guild start inside heroes' guild. Have a rune pick equipped and inventory empty.
";
html += "3. Make sure you have no favorite worlds, all member worlds are first, and MAKE SURE ALL PVP WORLDS ARE NOT ON SCREEN.
";
html += "Where do you want to mine?
";
html += "Heroes' Guild
";

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.getCurrentExp(Skills.getIndex("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 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 = "

Thank you for your support!


"
+ "

You will now be redirected to my adverts page.
"
+ "Click the adverts on the page few times a day if you can, remember stay atleast 30 seconds in each page.

"
+ "";
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) {
stopScript();
}
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 = "

Payment


"
+ "

You will now be redirected to PayPal.
" + "

"
+ "";
JOptionPane.showMessageDialog(null, message);
openURL("https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5213062");
}
miningXp = skills.getCurrentExp(Skills.getIndex("mining"));
int choice = Integer.parseInt(args.get("doing"));
switch (choice) {
case 1:
heroesguild = true;
case 2:
wilderness = true;
break;
}
return true;

}

private void climbdownladder() {
sleep(random(600, 700));
RSObject ladder1 = objects.getNearest(ladder);
sleep(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 {
tiles.doAction(ladder1.getLocation(), "Climb-down Ladder");
sleep(random(2000, 3000));
}
}

private void climbupladder() {
camera.setAltitude(true);
sleep(random(600, 700));
camera.setAngle(90);
RSObject ladder3 = objects.getNearest(ladder2);
if (ladder3 == null) {
log("I cant Fucking Find that Damn Ladder! Give me a few seconds, you know bots get drunk too!");
} else {
tiles.doAction(ladder3.getLocation(), "Climb-up Ladder");
sleep(random(600, 700));
}
}

private void walktoladder() {
walking.reversePath(path_tomine[0]);
}

private void walktodoor() {
walking.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() {
camera.setAngle(270);
RSObject door2 = objects.getNearest(warguilddoorout);
sleep(random(600, 700));
tiles.doAction(door2.getLocation(), "Open Door");
sleep(random(1800, 1900));
}

private void opendoor() {
camera.setAngle(270);
RSObject door1 = objects.getNearest(door);
sleep(random(600, 700));
if (door1 == null) {
log("Im too darn drunk to open the door, give me a sec");
} else {
tiles.doAction(door1.getLocation(), "Open Door");
sleep(random(1800, 1900));
}
}

public void openBank() {
boolean success = false;
RSObject booth = objects.getNearest(bankbooth);
if (calc.distanceTo(booth) > 5) {
//walkToBank();
sleep(random(800, 900));
}
success = booth.doAction("Use-quickly Bank booth");
sleep(random(600, 700));
if (menu.isOpen()) {
menu.doAction("Use-quickly Bank booth");
}
if (!success) {
//walkToBank();
}

}

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

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

public void walktoherodoor() {
walking.reversePath(path_tobank[0]);
}

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

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

public boolean worldhop() {
log("Worldhopping, this may take 1-2 Minutes.");
//logout();
if (interfaces.getComponent(744, 580).isValid()) {
process = "World Hopping";
log("Process: " + process);
int x9 = random(345, 415);
int y9 = random(242, 250);
mouse.move(x9, y9);
int positionX = (mouse.getRandomX(1));
int positionY = (mouse.getRandomY(1));
boolean succsess = false;
sleep(random(400, 800));
if (positionX == x9 && positionY == y9) {
succsess = true;
}
if (!succsess) {
worldhop();
}
mouse.click(true);
sleep(random(4000, 6000));

int x10 = random(84, 296);
int y10 = random(148, 450);
mouse.move(x10, y10);
mouse.click(true);
sleep(random(4000, 6000));
boolean loggedin = true;
if (interfaces.getComponent(744, 631).isValid()) {
String text1 = interfaces.getComponent(744, 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 false;//isLoggedIn();

}

private void checkprocess() {
if (isInArea(2893, 9905, 2891, 9909) && !inventory.isFull()) {
process = "Walking to Runite Mine";
return;
} else if (isInArea(2894, 3506, 2892, 3509) && !inventory.isFull()) {
process = "Going down the stairs";
return;
} else if (isInArea(2902, 3511, 2902, 3511) && !inventory.isFull()) {
process = "Opening Heroes Guild Door";
return;
} else if (isInArea(2877, 3546, 2877, 3546) && !inventory.isFull()) {
process = "Still Walking to Heroes Guild";
return;
} else if (isInArea(2901, 3503, 2891, 3516) && !inventory.isFull()) {
process = "Walking to Stairs";
return;
} else if (isInArea(2848, 3537, 2843, 3545) && !inventory.isFull()) {
process = "Walking to Heroes Guild";
return;
} else if (isInArea(2902, 3510, 2902, 3511) && inventory.isFull()) {
process = "Walking to Bank";
return;
} else if (isInArea(2901, 3503, 2891, 3516) && inventory.isFull()) {
process = "Walking to Heroes Guild Door";
return;
} else if (isInArea(2876, 3546, 2876, 3546) && inventory.isFull()) {
process = "Still Walking to Bank";
return;
} else if (isInArea(2845, 3541, 2843, 3545) && inventory.isFull()) {
process = "Banking Runite Ore";
return;
} else if (isInArea(2894, 9904, 2890, 9909) && inventory.isFull()) {
process = "Going up the stairs";
return;
} else if (isInArea(2940, 9883, 2936, 9886) && inventory.isFull()) {
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 = inventory.getCount(runiteore);
deposit();
sleep(500);
int after = inventory.getCount(runiteore);
if (after < before) {
runitebanked += before - after;
}
sleep(random(800, 1000));
bank.close();
checkprocess();
return;
} catch (Exception e) {
}
}

public int loop() {
int sleeplength = 800;
if (heroesguild) {
checkprocess();
if (process.equals("Walking to Stairs")) {
sleep(random(800, 1000));
if (!getMyPlayer().isMoving()) {
walking.walkPathMM(path_tostairs[0], 17);
}
} else if (process.equals("Walking to Heroes Guild Door")) {
if (!getMyPlayer().isMoving()) {
walktodoor();
}
sleep(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 {
sleep(random(800, 1000));
if (!getMyPlayer().isMoving()) {
walking.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")) {
sleep(random(800, 1000));
if (!getMyPlayer().isMoving()) {
walking.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 {
sleep(random(800, 1000));
if (!getMyPlayer().isMoving()) {
walking.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 {
sleep(random(800, 1000));
if (!getMyPlayer().isMoving()) {
walking.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")) {
sleep(random(800, 1000));
if (!getMyPlayer().isMoving()) {
camera.setAngle(random(1, 359));
walking.reversePath(path_tomine1[0]);
}
} 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);
sleep(random(800, 1000));
if (!getMyPlayer().isMoving()) {
camera.setAngle(random(1, 359));
walking.walkPathMM(path_tomine1[0], 14);
}
} else if (process.equals("Mining Runite Ore")) {
RSObject ore = objects.getNearest(runitemine);
if (ore == null)
worldhop();
else {
minerocks();
}
}
}
return sleeplength;

}

public boolean minerocks() {
int runiteOre[] = { 33078, 33079 };
final RSObject r = objects.getNearest(runiteOre);
try {
if (calc.distanceTo(r) <= 10) {
tiles.doAction(r.getLocation(), "Mine");
while (getMyPlayer().isMoving()) {
return false;
}
sleep(random(4000, 6000));
} else {
walking.walkTo(r.getLocation());
}
} catch (Exception e) {
}
return false;
}

/*public boolean onTile(RSObject tile, String search, String action) {
if (!tile.equals(tile)) {
return false;
}

//Point checkScreen = calc.tileToScreen(tile);
if (!tile.isOnScreen()) {
walking.walkTileMM(tile.getLocation());
sleep(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) {
if (walking.getEnergy() >= random(60, 80) && !walking.isRunEnabled()) {
walking.setRun(true);
}
}

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

}

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/Ua11ZsQw9FA/11997