import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Bank;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.util.Filter;
import org.rsbot.script.util.Timer;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;
@ScriptManifest(name = "MinerProRX", authors = "RXbots", keywords = "Mining", version = 1.03, description = "
The Very best [Brainy] Universial miner, By RXbots")
public class MinerProRX extends Script implements PaintListener, MouseListener {
private RSTile bankTile;
private boolean powerMine, canStart, smart, isInDesert;
private String location = "Varrock";
private int[] rockIDs, emptyRockIDs;
private RSArea mineArea;
private int startEXP, gpPerOre, startLevel;
private double experiencePerRock;
private long startTime;
private Actions action;
private Set actionSet;
private Set particles;
MinerProRXgui gui;
public static interface Constants {
RSArea VARROCK_EAST_MINE = new RSArea(3280, 3359, 3290, 3372);
RSArea VARROCK_BANK_AREA = new RSArea(3250, 3419, 3257, 3423);
RSArea YANILLE_BANK_AREA = new RSArea(2609, 3095, 2613, 3089);
RSArea ALKARID_MINE_AREA = new RSArea(3293, 3286, 3304, 3318);
RSArea DRAYNOR_MINE_AREA = new RSArea(3142, 3144, 3149, 3154);
RSArea DRAYNOR_BANK_AREA = new RSArea(3092, 3240, 3097, 3246);
RSArea ALKARID_BANK_AREA = new RSArea(3269, 3161, 3272, 3173);
RSArea ESS_MINE = new RSArea(2870, 4790, 2950, 4870);
RSArea FALADOR_BANK_AREA = new RSArea(3009, 3355, 3018, 3358);
RSArea GUILD_ENTRANCE_AREA = new RSArea(3015, 3336, 3024, 3342);
RSArea GUILD_EXIT_AREA = new RSArea(3017, 9736, 3022, 9742);
RSArea GUILD_MINE_AREA = new RSArea(3016, 9730, 3055, 9756);
RSArea RIMMINGTON_MINE_AREA = new RSArea(2966, 3230, 2988, 3251);
RSArea AUBURY_AREA = new RSArea(new RSTile[] { new RSTile(3252, 3404),
new RSTile(3253, 3404), new RSTile(3255, 3401),
new RSTile(3253, 3399), new RSTile(3252, 3399) });
RSArea WIZARD_TOWER_AREA = new RSArea(new RSTile[] {
new RSTile(2597, 3089), new RSTile(2597, 3087),
new RSTile(2592, 3082), new RSTile(2589, 3083),
new RSTile(2585, 3086), new RSTile(2585, 3089),
new RSTile(2589, 3093), new RSTile(2592, 3093) });
int GUILD_ENTRANCE_LADDER = 2113;
int GUILD_EXIT_LADDER = 6226;
int ESSENCE_PORTAL = 2492;
int VARROCK_CLOSED_DOOR = 24381;
int AUBURY = 553;
int DISTENTOR = 462;
RSTile WIZARD_TOWER_DOOR_TILE = new RSTile(2598, 3087);
RSTile VARROCK_DOOR_TILE = new RSTile(3253, 3398);
int[] COAL_ROCKS = { 5770, 5771, 5772, 11930, 11932, 11931 };
int[] COAL_EMPTY = { 5763, 5764, 5765, 11552, 11554 };
int[] PICKAXES = { 1265, 1267, 1269, 1296, 1273, 1271, 1275, 15259 };
int[] IRON_EMPTY = { 11557, 11555, 11556, 11554, 11552, 11553, 9725, 9723, 9724 };
int[] IRON_ROCKS = { 11954, 11956, 11955, 37307, 37309, 37308, 9717, 9718, 9719 };
int[] COPPER_ROCKS = { 11960, 11962, 11961 };
int[] COPPER_EMPTY = { 11557, 11555, 11556 };
int[] SILVER_ROCKS = { 37306, 37305, 37304 };
int[] SILVER_EMPTY = { 11554, 11553, 11552 };
int[] MITHIL_ROCKS = { 11944, 11943, 11942 };
int[] MITHIL_EMPTY = { 11554, 11552, 11553 };
int[] ADAMANTITE_ROCKS = { 11941, 11939 };
int[] ADAMANTITE_EMPTY = { 11554, 11552 };
int[] GOLD_ROCKS = { 37312, 37310 };
int[] GOLD_EMPTY = { 11552, 11554 };
int[] TIN_ROCKS = { 11959, 11957, 11958 };
int[] TIN_EMPTY = { 11557, 11555, 11556 };
int[] WIZARD_TOWER_DOORS = { 1600, 1601 };
int[] ESSENCE_ROCK = { 2491 };
double[] EXPERIENCE_RATES = { 5, 17.5, 35, 40, 50, 65, 80, 95, 125 };
String[] ORE_NAMES = { "Essence", "Clay", "Copper", "Tin", "Iron",
"Silver", "Coal", "Granite", "Gold", "Mithril", "Adamantite",
"Runite" };
String[] STRATEGY_NAMES = { "Powermine", "Bank", "Desert",
"Avoid other players" };
}
public static abstract class Actions {
public abstract void process();
public abstract boolean isValid();
public abstract String getDescription();
public void complete() {
}
public void paint(Graphics g) {
}
}
public abstract class WalkingAction extends Actions {
private RSArea dest;
private String name;
private RSTile last;
public WalkingAction(RSArea dest, String name) {
this.dest = dest;
this.name = name;
}
protected abstract boolean isTargetValid();
public void process() {
if (!walking.isRunEnabled() && walking.getEnergy() > 20) {
walking.setRun(true);
sleep(500);
}
RSTile tile = dest.getCentralTile();
if (last == null || getMyPlayer().isIdle()
|| (calc.distanceTo(last) < 10 && !dest.contains(last))) {
if (calc.tileOnMap(tile)) {
walking.walkTileMM(tile);
} else if (!walking.walkTo(tile)) {
walking.walkTileMM(walking.getClosestTileOnMap(tile));
}
last = walking.getDestination();
sleep(random(1000, 1800));
}
}
public boolean isValid() {
return isTargetValid()
&& !dest.contains(getMyPlayer().getLocation())
&& walking.getDestination() == null;
}
public void complete() {
last = null;
}
public void paint(Graphics g) {
g.setColor(new Color(0, 0, 255, 100));
for (RSTile t : dest.getTileArray()) {
Point pn = calc.tileToScreen(t, 0, 0, 0);
Point px = calc.tileToScreen(t, 1, 0, 0);
Point py = calc.tileToScreen(t, 0, 1, 0);
Point pxy = calc.tileToScreen(t, 1, 1, 0);
if (pn.x > -1 && px.x > -1 && py.x > -1 && pxy.x > -1) {
g.fillPolygon(new int[] { py.x, pxy.x, px.x, pn.x },
new int[] { py.y, pxy.y, px.y, pn.y }, 4);
}
}
}
public String getDescription() {
return "Walking to " + name + ".";
}
}
public abstract class BankingAction extends Actions {
RSObject highlight;
int fail;
@Override
public void process() {
RSObject bankBooth = objects.getNearest(Bank.BANK_BOOTHS);
if (bankBooth != null) {
if (bank.isOpen()) {
highlight = null;
bank.depositAllExcept(Constants.PICKAXES);
} else {
if (bankBooth.isOnScreen()) {
highlight = bankBooth;
fail++;
if (!getMyPlayer().isMoving())
bankBooth.doAction("Use-quickly");
} else
walking.walkTileMM(bankBooth.getLocation());
}
}
}
public void complete() {
fail = 0;
}
public void paint(Graphics g) {
g.setColor(new Color(0, 255, 0, 100));
if (highlight != null)
for (Polygon p : highlight.getModel().getTriangles())
g.drawPolygon(p);
}
@Override
public boolean isValid() {
return !canMine() && calc.distanceTo(bankTile) < 14;
}
@Override
public String getDescription() {
return "Processing Bank Procedures.";
}
}
public class MiningAction extends Actions {
public static final int DIST_EXPONENT = 2;
public static final int MAX_OTHER_DIST = 10;
public static final int MY_PLAYER_WEIGHT = 2;
RSTile[] rock_tiles;
int[] rockID, emptyID;
int fail;
RSArea area;
boolean analyze;
RSObject last, highlight;
public MiningAction(int[] rockID, int[] emptyID, RSArea area,
boolean analyze) {
this.analyze = analyze;
this.rockID = rockID;
this.emptyID = emptyID;
this.area = area;
}
public void process() {
RSObject rock;
if (analyze) {
RSObject[] rocks = getNearestBestRocks();
rock = rocks[0];
} else
rock = getNearestRock();
if (rock != null) {
if (last != null) {
if (accept(last)) {
if (rock.isOnScreen()) {
highlight = rock;
rock.doAction("Mine");
sleep(random(450, 540));
last = rock;
fail++;
} else {
highlight = null;
walking.walkTileMM(walking.getClosestTileOnMap(rock
.getLocation()));
}
} else {
fail = 0;
}
} else {
if (players.getMyPlayer().getInteracting() == null) {
if (rock.isOnScreen()) {
rock.doAction("Mine");
sleep(random(350, 450));
fail++;
last = rock;
} else {
walking.walkTileMM(walking.getClosestTileOnMap(rock
.getLocation()));
}
}
}
} else {
idle();
}
}
public void complete() {
fail = 0;
}
public boolean isValid() {
return area.contains(players.getMyPlayer().getLocation())
&& canMine();
}
public String getDescription() {
return "Processing & Executing Mining Procedures";
}
public void paint(Graphics g) {
g.setColor(new Color(255, 0, 0, 100));
for (Polygon p : highlight.getModel().getTriangles()) {
g.drawPolygon(p);
}
}
private RSObject getNearestRock() {
List rocks = getRocks();
int dis = 99999;
RSObject obj = null;
final RSPlayer me = players.getMyPlayer();
for (RSObject o : rocks) {
if (calc.distanceBetween(o.getLocation(), me.getLocation()) < dis) {
obj = o;
dis = (int) calc.distanceBetween(o.getLocation(),
me.getLocation());
}
}
return obj;
}
private RSObject[] getNearestBestRocks() {
List rocks = getRocks();
if (rocks.size() == 0) {
return new RSObject[0];
}
final RSPlayer me = getMyPlayer();
RSPlayer[] nearby = players.getAll(new Filter() {
public boolean accept(RSPlayer player) {
return !player.equals(me);
}
});
int lowest_cost = 999999, next_cost = 999999;
int lowest_ptr = 0, next_ptr = 0;
double max = Math.pow(MAX_OTHER_DIST, DIST_EXPONENT);
for (int i = 0; i < rocks.size(); ++i) {
RSObject rock = rocks.get(i);
RSTile loc = rock.getLocation();
int cost = (int) Math.pow(calc.distanceTo(loc), DIST_EXPONENT)
* MY_PLAYER_WEIGHT;
for (RSPlayer player : nearby) {
double dist = calc.distanceBetween(player.getLocation(),
loc);
if (dist < MAX_OTHER_DIST) {
cost += max / Math.pow(dist, DIST_EXPONENT);
}
}
if (cost < lowest_cost) {
next_cost = lowest_cost;
next_ptr = lowest_ptr;
lowest_cost = cost;
lowest_ptr = i;
}
}
if (next_cost == 999999) {
return new RSObject[] { rocks.get(lowest_ptr) };
}
RSObject[] nearest = new RSObject[] { rocks.get(lowest_ptr),
rocks.get(next_ptr) };
if (nearest[1].equals(last)) {
RSObject temp = nearest[0];
nearest[0] = nearest[1];
nearest[1] = temp;
}
return nearest;
}
private List getRocks() {
if (rock_tiles == null) { // objects.getAll each exec would be too
// expensive
RSObject[] rocks = objects.getAll(new Filter() {
public boolean accept(RSObject o) {
if (area.contains(o.getLocation())) {
int oid = o.getID();
for (int id : rockID) {
if (id == oid) {
return true;
}
}
for (int id : emptyID) {
if (id == oid) {
return true;
}
}
}
return false;
}
});
if (rocks.length > 0) {
rock_tiles = new RSTile[rocks.length];
for (int i = 0, rocksLength = rocks.length; i < rocksLength; i++) {
rock_tiles[i] = rocks[i].getLocation();
}
} else {
return new ArrayList(0);
}
}
// loop appropriate tiles only since rock tiles don't change
ArrayList rocks = new ArrayList();
for (RSTile t : rock_tiles) {
RSObject obj = objects.getTopAt(t);
if (obj != null) {
int oid = obj.getID();
for (int id : rockID) {
if (id == oid) {
rocks.add(obj);
break;
}
}
}
}
return rocks;
}
private boolean accept(RSObject rock) {
if (last != null
&& (rock.equals(last) || objects.getTopAt(
last.getLocation()).getID() == last.getID())) {
for (int i = 1;; ++i) {
if (!getMyPlayer().isIdle()) {
return false;
}
if (i == 10) {
break;
}
sleep(50);
}
}
return true;
}
}
public boolean onStart() {
gui = new MinerProRXgui();
particles = new HashSet();
gui.setVisible(true);
actionSet = new HashSet();
while (!canStart)
sleep(20);
actionSet.add(new MiningAction(rockIDs, emptyRockIDs, mineArea, smart));
actionSet.add(new BankingAction() {
});
startEXP = skills.getCurrentExp(Skills.MINING);
startTime = System.currentTimeMillis();
startLevel = skills.getRealLevel(Skills.MINING);
log("Loaded Action Queue, Total Loaded Actions: " + actionSet.size());
log(" Welcmoe to MinerProRX")
return true;
}
@Override
public int loop() {
if (!canStart)
return 200;
if (!canMine() && powerMine) {
inventory.dropAllExcept(Constants.PICKAXES);
return random(150, 250);
}
for (Actions act : actionSet) {
if (act.isValid()) {
action = act;
act.process();
}
}
return random(300, 500);
}
@Override
public void onRepaint(Graphics g) {
if(mouse.isPressed()){
Particle pl = Particle.newParticle(mouse.getLocation().x, mouse.getLocation().y);
pl.b = random(200, 255);
particles.add(pl);
}
Iterator i = particles.iterator();
while (i.hasNext()) {
Particle p = i.next();
if (p.a <= 0 || p.x < 0) {
i.remove();
} else {
g.setColor(new Color(p.r, p.g, p.b, p.a));
g.fillOval(p.x - p.rad, p.y - p.rad, p.rad * 2, p.rad * 2);
p.a -= 10;
p.y += 1;
p.x += p.v;
}
}
long runTime = System.currentTimeMillis() - startTime;
int XPGained = skills.getCurrentExp(Skills.MINING) - startEXP;
int XPToLevel = skills.getExpToNextLevel(Skills.MINING);
double oresMined = XPGained/experiencePerRock;
double gpPerHour = 0, oresPerSecond = 0, XPPerSecond = 0;
if(XPGained > 1000) {
XPPerSecond = (XPGained * 1000 / runTime);
oresPerSecond = (oresMined * 1000 / runTime);
gpPerHour = Math.ceil(oresMined * 360000D / runTime) * 10 * gpPerOre;
}
action.paint(g);
g.drawRect(8, 345, 505, 112);
g.setColor(new Color(15, 15, 25, 250));
g.fillRect(8, 345, 505, 112);
g.setColor(Color.red);
g.setFont(new Font("Times New Roman", Font.ITALIC, 16));
g.drawString("MinerProRX", 160, 360);//Revolutionizing Mining
g.setFont(new Font("Times New Roman", Font.PLAIN, 12));
g.setColor(Color.WHITE);
g.drawString("What am I doing?", 15, 370);
g.drawString("I am currently:: " + action.getDescription(), 15, 380);
g.drawString("I have mined for: "+ Timer.format(runTime), 15, 390);
g.setColor(Color.GREEN);
g.drawString("Money stuff for you!", 15, 410);
g.drawString("Cash every hour: "+ gpPerHour, 15, 420);
g.drawString("Cash a second: "+(int)(oresPerSecond*gpPerOre), 15, 430);
g.drawString("Your money!: "+(int)(oresMined*gpPerOre), 15, 440);
g.setColor(Color.BLUE);
g.drawString("level and xp", 180, 400);
g.drawString("XP every hour: "+ (int)XPPerSecond*3600, 180, 410);
g.drawString("XP every second: "+(int)XPPerSecond, 180, 420);
g.drawString("Ores an hour: "+(int)(oresPerSecond*3600), 180, 430);
g.drawString("XP till you level: "+XPToLevel, 180, 440);
g.drawString("Ores till you level: "+(int)(XPToLevel/experiencePerRock), 180, 450);
g.setColor(Color.MAGENTA);
g.drawString("Ores mined total: "+(int)oresMined, 370, 400);
g.drawString("XP gained total: "+XPGained, 370, 410);
g.setColor(Color.CYAN);
g.drawString("Started at level: "+startLevel, 370, 430);
g.drawString("Your new level: "+skills.getRealLevel(Skills.MINING), 370, 440);
}
private boolean canMine() {
return !inventory.isFull();
}
private boolean inTower() {
return Constants.WIZARD_TOWER_AREA
.contains(getMyPlayer().getLocation());
}
private boolean inShop() {
return Constants.AUBURY_AREA.contains(getMyPlayer().getLocation());
}
private void idle() {
if (random(0, 50) == 0) {
int rand2 = random(1, 3);
for (int i = 0; i < rand2; i++) {
mouse.move(random(100, 700), random(100, 500));
sleep(random(200, 700));
}
mouse.move(random(0, 800), 647, 50, 100);
sleep(random(100, 1500));
mouse.move(random(75, 400), random(75, 400), 30);
}
if (random(0, 50) == 0) {
Point curPos = mouse.getLocation();
mouse.move(random(0, 750), random(0, 500), 20);
sleep(random(100, 300));
mouse.move(curPos, 20, 20);
}
if (random(0, 50) == 0) {
int angle = camera.getAngle() + random(-40, 40);
if (angle < 0) {
angle += 359;
}
if (angle > 359) {
angle -= 359;
}
camera.setAngle(angle);
}
if (random(0, 50) == 0) {
if (random(0, 4) == 0) {
camera.setPitch(random(50, 80));
} else {
camera.setPitch(true);
}
}
}
public class MinerProRXgui extends JFrame {
public MinerProRXgui() {
initComponents();
}
private void initalizationButtonActionPerformed(ActionEvent e) {
location = locationComboBox.getSelectedItem().toString();
for (int i = 0; i < strategyList.getSelectedIndices().length; i++) {
if (strategyList.getSelectedValues()[i].toString().contains(
"Avoid"))
smart = true;
if (strategyList.getSelectedValues()[i].toString().contains(
"Desert"))
if (location.contains("Desert"))
isInDesert = true;
if (strategyList.getSelectedValues()[i].toString().contains(
"Power"))
powerMine = true;
}
String name = oreList.getSelectedValue().toString();
if (oreList.getSelectedIndices().length <= 1) {
if (name.contains("ron")) {
gpPerOre = grandExchange.getMarketPrice(grandExchange.getItemID("Iron ore"));
experiencePerRock = Constants.EXPERIENCE_RATES[2];
rockIDs = Constants.IRON_ROCKS;
emptyRockIDs = Constants.IRON_EMPTY;
} else if (name.contains("oal")) {
gpPerOre = grandExchange.getMarketPrice(grandExchange.getItemID("Coal"));
experiencePerRock = Constants.EXPERIENCE_RATES[4];
rockIDs = Constants.COAL_ROCKS;
emptyRockIDs = Constants.COAL_EMPTY;
} else if (name.equals("Tin")) {
gpPerOre = grandExchange.getMarketPrice(grandExchange.getItemID("Tin ore"));
experiencePerRock = Constants.EXPERIENCE_RATES[1];
rockIDs = Constants.TIN_ROCKS;
emptyRockIDs = Constants.TIN_EMPTY;
} else if (name.contains("opper")) {
gpPerOre = grandExchange.getMarketPrice(grandExchange.getItemID("Copper ore"));
experiencePerRock = Constants.EXPERIENCE_RATES[1];
rockIDs = Constants.COPPER_ROCKS;
emptyRockIDs = Constants.COPPER_EMPTY;
} else if (name.equals("Essence")) {
gpPerOre = grandExchange.getMarketPrice(grandExchange.getItemID("Pure essence"));
experiencePerRock = Constants.EXPERIENCE_RATES[0];
rockIDs = Constants.ESSENCE_ROCK;
emptyRockIDs = Constants.ESSENCE_ROCK;
} else if(name.equals("Silver")) {
gpPerOre = grandExchange.getMarketPrice(grandExchange.getItemID("Silver ore"));
experiencePerRock = Constants.EXPERIENCE_RATES[3];
rockIDs = Constants.SILVER_ROCKS;
emptyRockIDs = Constants.SILVER_EMPTY;
}
} else {
JOptionPane
.showMessageDialog(null,
"Please only select one ore type. Restart the script to resubmit information.");
}
if (location.contains("Varro")) {
bankTile = Constants.VARROCK_BANK_AREA.getCentralTile();
if (!name.equals("Essence")) {
mineArea = Constants.VARROCK_EAST_MINE;
actionSet.add(new WalkingAction(
Constants.VARROCK_BANK_AREA, "Varrock Bank") {
protected boolean isTargetValid() {
return !canMine();
}
});
actionSet.add(new WalkingAction(
Constants.VARROCK_EAST_MINE, "Varrock East Mines") {
protected boolean isTargetValid() {
return canMine();
}
});
} else {
mineArea = Constants.ESS_MINE;
actionSet.add(new WalkingAction(Constants.ESS_MINE,
"Essence Mine") {
protected boolean isTargetValid() {
return canMine();
}
public void process() {
RSNPC arby = npcs.getNearest(Constants.AUBURY);
if (inShop()) {
if (arby != null)
if (arby.isOnScreen())
if (arby.doAction("Teleport"))
sleep(random(1300, 1500));
} else if (calc
.distanceTo(Constants.VARROCK_DOOR_TILE) < 2) {
if (objects
.getAllAt(Constants.VARROCK_DOOR_TILE) != null) {
RSObject door = null;
for (RSObject o : objects
.getAllAt(Constants.VARROCK_DOOR_TILE)) {
if (o.getID() == Constants.VARROCK_CLOSED_DOOR)
door = o;
}
if (door != null)
door.doAction("Open");
else {
super.process();
}
}
} else {
if (calc.distanceTo(Constants.ESS_MINE
.getCentralTile()) > 100)
walking.walkTo(Constants.AUBURY_AREA
.getCentralTile());
else
super.process();
}
}
});
actionSet.add(new WalkingAction(
Constants.VARROCK_BANK_AREA, "Varrock East Bank") {
@Override
protected boolean isTargetValid() {
return !canMine();
}
public void process() {
RSObject obj = objects
.getNearest(Constants.ESSENCE_PORTAL);
if (obj != null) {
if (calc.distanceTo(obj) > 3)
walking.walkTileMM(obj.getLocation());
if (obj.isOnScreen()) {
if (obj.doAction("Enter"))
sleep(random(1200, 1500));
} else {
walking.walkTileOnScreen(obj.getLocation());
}
} else {
super.process();
}
}
});
}
} else if (location.contains("Mining")) {
mineArea = Constants.GUILD_MINE_AREA;
bankTile = Constants.FALADOR_BANK_AREA.getCentralTile();
actionSet.add(new WalkingAction(Constants.FALADOR_BANK_AREA,
"Falador Bank") {
@Override
protected boolean isTargetValid() {
return !canMine();
}
public void process() {
final RSPlayer me = players.getMyPlayer();
if (Constants.GUILD_MINE_AREA.contains(me.getLocation())) {
if (Constants.GUILD_EXIT_AREA.contains(me
.getLocation())) {
if (me.isIdle()) {
RSObject ladder = objects
.getNearest(Constants.GUILD_EXIT_LADDER);
if (ladder != null) {
ladder.doAction("Climb-up");
}
}
} else {
walking.walkTileMM(walking
.getClosestTileOnMap(Constants.GUILD_EXIT_AREA
.getCentralTile()));
}
} else {
super.process();
}
}
});
actionSet.add(new WalkingAction(Constants.GUILD_MINE_AREA,
"Mining Guild") {
@Override
protected boolean isTargetValid() {
return canMine();
}
public void process() {
RSObject ladder = objects
.getNearest(Constants.GUILD_ENTRANCE_LADDER);
if (ladder == null
&& objects.getNearest(rockIDs) == null) {
walking.walkTo(Constants.GUILD_ENTRANCE_AREA
.getCentralTile());
} else if (calc.tileOnMap(Constants.GUILD_ENTRANCE_AREA
.getCentralTile()) || ladder != null) {
if (ladder != null) {
if (ladder.isOnScreen())
ladder.doAction("Climb-down");
else
walking.walkTo(Constants.GUILD_ENTRANCE_AREA
.getCentralTile());
}
} else {
super.process();
}
}
});
} else if (location.equals("Al Karid")) {
mineArea = Constants.ALKARID_MINE_AREA;
bankTile = Constants.ALKARID_BANK_AREA.getCentralTile();
actionSet.add(new WalkingAction(Constants.ALKARID_BANK_AREA, "Al Karid Bank"){
@Override
protected boolean isTargetValid() {
return !canMine();
}
});
actionSet.add(new WalkingAction(Constants.ALKARID_MINE_AREA, "Al Karid Mines"){
@Override
protected boolean isTargetValid() {
return canMine();
}
});
} else if(location.equals("Draynor")) {
mineArea = Constants.DRAYNOR_MINE_AREA;
bankTile = Constants.DRAYNOR_BANK_AREA.getCentralTile();
actionSet.add(new WalkingAction(Constants.DRAYNOR_BANK_AREA, "Draynor Bank"){
@Override
protected boolean isTargetValid() {
return !canMine();
}
});
actionSet.add(new WalkingAction(Constants.DRAYNOR_MINE_AREA, "Draynor Mines"){
@Override
protected boolean isTargetValid() {
return canMine();
}
});
} else if(location.equals("Rimmington")) {
mineArea = Constants.RIMMINGTON_MINE_AREA;
bankTile = Constants.FALADOR_BANK_AREA.getCentralTile();
actionSet.add(new WalkingAction(Constants.FALADOR_BANK_AREA, "Falador Bank"){
@Override
protected boolean isTargetValid() {
return !canMine();
}
});
actionSet.add(new WalkingAction(Constants.RIMMINGTON_MINE_AREA, "Rimmington Mines"){
@Override
protected boolean isTargetValid() {
return canMine();
}
});
} else {
JOptionPane
.showMessageDialog(null,
"Location Not Supported In Free Version! Please consider buying the paid version when released.");
}
canStart = true;
this.setVisible(false);
}
private void initComponents() {
initalizationButton = new JButton();
tabbedPane1 = new JTabbedPane();
panel1 = new JPanel();
label1 = new JLabel();
label2 = new JLabel();
locationComboBox = new JComboBox();
label3 = new JLabel();
label4 = new JLabel();
label5 = new JLabel();
scrollPane1 = new JScrollPane();
oreList = new JList();
scrollPane2 = new JScrollPane();
strategyList = new JList();
label6 = new JLabel();
oreList.setListData(Constants.ORE_NAMES);
strategyList.setListData(Constants.STRATEGY_NAMES);
// ======== this ========
setTitle("MinerProRX");
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());
// ---- initalizationButton ----
initalizationButton.setText("Initialize");
initalizationButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
initalizationButtonActionPerformed(e);
}
});
contentPane.add(initalizationButton, BorderLayout.SOUTH);
{
{
panel1.setLayout(new GridBagLayout());
// ---- label1 ----
label1.setText("Mining Settings");
label1.setForeground(Color.red);
label1.setFont(new Font("Times New Roman", Font.ITALIC, 13));
panel1.add(label1, new GridBagConstraints(0, 0, 4, 1, 0.0,
0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0,
0));
// ---- label2 ----
label2.setText("Mine Location:");
panel1.add(label2, new GridBagConstraints(0, 1, 4, 1, 0.0,
0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0,
0));
panel1.add(locationComboBox, new GridBagConstraints(4, 1,
5, 1, 0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0,
0));
locationComboBox
.setModel(new javax.swing.DefaultComboBoxModel(
new String[] { "Varrock", "Mining Guild",
"Yanille", "Al Karid", "Draynor",
"Crafting Guild", "Rimmington" }));
// ---- label3 ----
label3.setText("Please Select Options Below From List.");
label3.setForeground(Color.red);
label3.setFont(new Font("Times New Roman", Font.ITALIC, 12));
panel1.add(label3, new GridBagConstraints(0, 2, 9, 1, 0.0,
0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0,
0));
// ---- label4 ----
label4.setText("Ore Selection");
panel1.add(label4, new GridBagConstraints(0, 3, 4, 1, 0.0,
0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0,
0));
label5.setText("Stratergy");
panel1.add(label5, new GridBagConstraints(5, 3, 4, 1, 0.0,
0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0,
0));
{
scrollPane1.setViewportView(oreList);
}
panel1.add(scrollPane1, new GridBagConstraints(0, 4, 4, 8,
0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0,
0));
{
scrollPane2.setViewportView(strategyList);
}
panel1.add(scrollPane2, new GridBagConstraints(5, 4, 4, 8,
0.0, 0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0,
0));
// ---- label6 ----
label6.setText("Note: Will mine ore selection RANDOMLY!");
label6.setFont(new Font("Times New Roman", Font.ITALIC, 10));
label6.setForeground(Color.red);
panel1.add(label6, new GridBagConstraints(0, 12, 9, 1, 0.0,
0.0, GridBagConstraints.CENTER,
GridBagConstraints.BOTH, new Insets(0, 0, 5, 0), 0,
0));
}
tabbedPane1.addTab("Basic Settings", panel1);
}
contentPane.add(tabbedPane1, BorderLayout.CENTER);
pack();
setLocationRelativeTo(getOwner());
}
private JButton initalizationButton;
private JTabbedPane tabbedPane1;
private JPanel panel1;
private JLabel label1;
private JLabel label2;
private JComboBox locationComboBox;
private JLabel label3;
private JLabel label4;
private JLabel label5;
private JScrollPane scrollPane1;
private JScrollPane scrollPane2;
private JLabel label6;
private JList strategyList;
private JList oreList;
}
private static class Particle {
private int r, g, b, a, x, y, v, rad;
public static Particle newParticle(int x, int y) {
Particle p = new Particle();
int random = (int) (Math.random() * 0xffffff);
p.rad = ((random >> 1) & 1) + 1;
p.v = (random & 3) - 1;
p.x = x;
p.y = y;
p.r = random & 0xff;
p.g = (random >> 8) & 0xff;
p.b = (random >> 16) & 0xff;
p.a = 200;
return p;
}
}
@Override
public void mouseClicked(MouseEvent e) {
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
}