Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import javax.swing.*;
- import javax.swing.border.*;
- import java.awt.*;
- import java.awt.event.*;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseMotionListener;
- import org.rsbot.script.*;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.methods.*;
- import org.rsbot.script.methods.Camera;
- import org.rsbot.script.wrappers.*;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.event.listeners.ServerMessageListener;
- import org.rsbot.event.events.ServerMessageEvent;
- import org.rsbot.script.methods.Game;
- import org.rsbot.script.internal.*;
- @ScriptManifest(authors = {"Harrison"}, keywords = "Mining", name = "Heroic Miner", version = 1.5, description = "Multi Locational miner. Now with the option to Powermine.")
- public class heroicMiner extends Script implements PaintListener, ServerMessageListener, MouseMotionListener {
- private RSTile nearestRock;
- public static RSTile draynorBankTile = new RSTile(3093, 3245);
- public static RSTile swampMineTile = new RSTile(3147, 3149);
- public static RSTile guildLadder = new RSTile(3021, 9739);
- public static RSTile guildFrontMiddle = new RSTile(3034, 9737);
- public RSTile[] toDraynorBank = { new RSTile(3148, 3163), new RSTile(3144, 3175), new RSTile(3140, 3188), new RSTile(3138, 3200), new RSTile(3129, 3208),
- new RSTile(3118, 3216), new RSTile(3109, 3228), new RSTile(3102, 3234), new RSTile(3092, 3245) };
- public RSTile[] toSwampMine = { new RSTile(3098, 3233), new RSTile(3106, 3224), new RSTile(3118, 3217), new RSTile(3125, 3209), new RSTile(3134, 3202),
- new RSTile(3140, 3190), new RSTile(3142, 3180), new RSTile(3145, 3169), new RSTile(3147, 3161), new RSTile(3146, 3148) };
- public RSTile[] toVarrWestMine = { new RSTile(3174, 3428), new RSTile(3171, 3415), new RSTile(3171, 3403), new RSTile(3175, 3389), new RSTile(3178, 3381),
- new RSTile(3183, 3371), new RSTile(3175, 3367) };
- public RSTile[] toVarrWestBank = { new RSTile(3186, 3376), new RSTile(3176, 3388), new RSTile(3170, 3397), new RSTile(3171, 3411), new RSTile(3171, 3422),
- new RSTile(3182, 3429), new RSTile(3182, 3436) };
- public RSTile[] fallyMineBankB = { new RSTile(3022, 3338), new RSTile(3024, 3351), new RSTile(3013, 3357) };
- public RSTile[] fallyBankMineB = { new RSTile(3013, 3357), new RSTile(3024, 3351), new RSTile(3022, 3338) };
- public RSArea swampArea = new RSArea(new RSTile(3150, 3155), new RSTile(3143, 3144));
- public RSArea draynorBankArea = new RSArea(new RSTile(3092, 3240), new RSTile(3097, 3246));
- public RSArea varrwestBank = new RSArea(new RSTile(3178, 3447), new RSTile(3195, 3431));
- public RSArea varrwestMine = new RSArea(new RSTile(3171, 3363), new RSTile(3185, 3379));
- public RSArea fallyEastBank = new RSArea(new RSTile(3019, 3359), new RSTile(3008, 3354));
- public RSArea fallyMineGuild = new RSArea(new RSTile(3017, 9732), new RSTile(3055, 9755));
- public RSArea fallyMineArea = new RSArea(new RSTile(3031, 3360), new RSTile(3008, 3330));
- public static int[] ironRock = { 11954, 11955, 11956 };
- public static int[] coalRock = { 2096, 2097, 5770, 5771, 5772, 11930, 11931, 11932, 11963, 11964, 14850, 14851, 14852, 31068, 31069, 31070, 32426 };
- public static int[] pickID = {1265, 1269, 1267, 1273, 1271, 1275, 14107, 15259, 15261};
- public int[] thebankid = {11402, 11758, 11402, 2213};
- private int startExp = 0;
- private int startlvl = 0;
- private int gainedExp = 0;
- private int oresMined = 0;
- private int gemsMined = 0;
- private int hourlyOre = 0;
- private int oreHour = 0;
- private int expHour = 0;
- private int fallyMineGuildUpLadder = 6226;
- private int fallyMineGuildDownLadder = 2113;
- public RSObject ore, nextOre;
- public int currentID;
- public int rockID;
- public RSObject lastOre;
- public long startTime = System.currentTimeMillis();
- String location = "Unknown";
- //== Points & Timers ==
- private Point mPlayer;
- private Timer pTimer;
- minerGUI gui;
- //=== Booleans ===
- private boolean barHover = false;
- private boolean abRunOnce = false;
- boolean lumSwampCoal = false;
- boolean varrwestIron = false;
- boolean fallyMinngGuild = false;
- boolean lumSwampCoalPwr = false;
- boolean varrwestIronPwr = false;
- boolean fallyMinngGuildPwr = false;
- public boolean lumSwampMine(){
- if (swampArea.contains(getMyPlayer().getLocation())) {
- location = "Lumby Swamp Mine";
- return true;
- } else return false;
- }
- public boolean draynorBank(){
- if (draynorBankArea.contains(getMyPlayer().getLocation())) {
- location = "Draynor Bank";
- return true;
- } else return false;
- }
- public boolean varrwestMine(){
- if (varrwestMine.contains(getMyPlayer().getLocation())) {
- location = "Varrock West Mine";
- return true;
- } else return false;
- }
- public boolean varrwestBank(){
- if (varrwestBank.contains(getMyPlayer().getLocation())) {
- location = "Varrock West Bank";
- return true;
- } else return false;
- }
- public boolean fallyEastMine(){
- if (fallyMineGuild.contains(getMyPlayer().getLocation())) {
- location = "Falador Mining Guild";
- return true;
- } else return false;
- }
- public boolean fallyMineArea(){
- if(fallyMineArea.contains(getMyPlayer().getLocation())) {
- location = "Falador Mining Area";
- return true;
- } else return false;
- }
- public boolean fallyEastBank(){
- if(fallyEastBank.contains(getMyPlayer().getLocation())) {
- return true;
- } else return false;
- }
- /************************************************************************************************************************************************************************\
- ************************************************************************************************************************************************************************
- ************************************************************************************************************************************************************************
- ************************************************************************************************************************************************************************
- ************************************************************************************************************************************************************************
- ************************************************************************************************************************************************************************
- \************************************************************************************************************************************************************************/
- public boolean onStart() {
- gui = new minerGUI();
- gui.setVisible(true);
- while (gui.isVisible()) {
- sleep(1000);
- }
- startTime = System.currentTimeMillis();
- log("Please login in then run this script.");
- log("If you don't you will encounter problems with Exp Gain.");
- startExp = skills.getCurrentExp(Skills.MINING);
- startlvl = skills.getCurrentLevel(Skills.MINING);
- return true;
- }
- public RSObject getSecondNearest(int... ids) {
- RSObject cur = null;
- double dist = -1;
- RSTile[] tiles = varrwestMine.getTileArray();
- for (int x = 0; x < tiles.length; x++) {
- RSObject o = objects.getTopAt(tiles[x]);
- if (o != null) {
- boolean isObject = false;
- for (int id : ids) {
- if (o.getID() == id) {
- isObject = true;
- break;
- }
- }
- if (isObject) {
- double distTmp = calc.distanceBetween(ore.getLocation(), o.getLocation());
- String strCurrentRockLoc = ore.getLocation().toString();
- String strPossRockLoc = o.getLocation().toString();
- if (cur == null && !( o.getLocation().equals(ore.getLocation())) ) {
- dist = distTmp;
- cur = o;
- }
- if (distTmp < dist && !( o.getLocation().equals(ore.getLocation())) ) {
- cur = o;
- dist = distTmp;
- }
- }
- }
- }
- return cur;
- }
- public void MineIron() {
- ore = objects.getNearest( ironRock );
- RSComponent fullInventoryIFace = interfaces.get(210).getComponent(1);
- if ( fullInventoryIFace.isValid() )
- //isInventoryFull = true;
- if ( ore == null) {
- ore = objects.getNearest( ironRock );
- if ( ore != null ) {
- if ( !(calc.tileOnScreen(ore.getLocation())) ) {
- camera.turnToObject(ore);
- }
- if ( !(calc.tileOnScreen(ore.getLocation())) ){
- walking.walkTo(ore.getLocation());
- }
- }
- }
- if ( ore != null ) {
- currentID = objects.getTopAt(ore.getLocation()).getID();
- if ( currentID == 11956 || currentID == 11955 ) {
- if ( nextOre != null ) {
- if ( !(calc.tileOnScreen(nextOre.getLocation())) ) {
- camera.turnToObject(nextOre);
- }
- if ( !(calc.tileOnScreen(nextOre.getLocation())) ){
- walking.walkTileMM(nextOre.getLocation());
- }
- ore = nextOre;
- }
- }
- if ( !(getMyPlayer().isMoving()) && !onHorizontalOrVertTile(ore.getLocation()) ) {
- ore.doAction("Mine");
- } else if ( getMyPlayer().getAnimation() == -1 && onHorizontalOrVertTile(ore.getLocation()) ) {
- ore.doAction("Mine");
- }
- nextOre = getSecondNearest( ironRock );
- if (nextOre != null) {
- if ( !(calc.tileOnScreen(nextOre.getLocation())) )
- camera.turnToObject(nextOre);
- mouse.move( calc.tileToScreen(nextOre.getLocation()), 13, 13 );
- } else {
- ore = null;
- }
- }
- }
- public boolean onHorizontalOrVertTile(RSTile tile){
- boolean bool = false;
- if ( getMyPlayer().getLocation().getX() == tile.getX() || getMyPlayer().getLocation().getY() == tile.getY() ) {
- if ( calc.distanceTo(tile) == 1 ) {
- bool = true;
- } else
- bool = false;
- }
- return bool;
- }
- public void MineCoal() {
- ore = objects.getNearest( coalRock );
- RSComponent fullInventoryIFace = interfaces.get(210).getComponent(1);
- if ( fullInventoryIFace.isValid() )
- //isInventoryFull = true;
- if ( ore == null) {
- antiban2();
- ore = objects.getNearest( coalRock );
- if ( ore != null ) {
- if ( !(calc.tileOnScreen(ore.getLocation())) ) {
- camera.turnToObject(ore);
- }
- if ( !(calc.tileOnScreen(ore.getLocation())) ){
- walking.walkTo(ore.getLocation());
- }
- }
- }
- if ( ore != null ) {
- currentID = objects.getTopAt(ore.getLocation()).getID();
- if ( currentID == 11552 || currentID == 11553 ) {
- if ( nextOre != null ) {
- if ( !(calc.tileOnScreen(nextOre.getLocation())) ) {
- camera.turnToObject(nextOre);
- }
- if ( !(calc.tileOnScreen(nextOre.getLocation())) ){
- walking.walkTileMM(nextOre.getLocation());
- }
- ore = nextOre;
- }
- }
- if ( !(getMyPlayer().isMoving()) && !onHorizontalOrVertTile(ore.getLocation()) ) {
- ore.doAction("Mine");
- antiban2();
- } else if ( getMyPlayer().getAnimation() == -1 && onHorizontalOrVertTile(ore.getLocation()) ) {
- ore.doAction("Mine");
- antiban2();
- }
- nextOre = getSecondNearest( coalRock );
- if (nextOre != null) {
- if ( !(calc.tileOnScreen(nextOre.getLocation())) )
- camera.turnToObject(nextOre);
- mouse.move( calc.tileToScreen(nextOre.getLocation()), 13, 13 );
- } else {
- ore = null;
- }
- }
- }
- private void antiban2() {
- switch (random (0, 10)) {
- case 0:
- mouse.move(random(-200, 700), random(200, 400));
- break;
- case 1:
- camera.setAngle(random(0, 180));
- camera.setPitch(random(0, 100));
- break;
- }
- }
- private void antiban() {
- switch (random(0, 20)) {
- case 0:
- game.openTab(Game.TAB_STATS);
- mouse.move(704 + random(-30, 29), 223 + random(-13, 13));
- sleep(random(500, 1250));
- game.openTab(Game.TAB_INVENTORY);
- break;
- case 1:
- game.openTab(Game.TAB_FRIENDS);
- sleep(random(500, 1250));
- game.openTab(Game.TAB_INVENTORY);
- break;
- case 2:
- camera.setAngle(random(0, 180));
- camera.setPitch(random(0, 100));
- break;
- default:
- }
- abRunOnce = true;
- }
- private void bank() {
- RSObject bankBooth = objects.getNearest(thebankid);
- if (bankBooth != null && !bank.isOpen()) {
- bankBooth.doAction("Use-quickly");
- }
- if (bankBooth != null && bank.isOpen()) {
- bank.depositAllExcept(pickID);
- bank.close();
- }
- }
- public int loop() {
- mouse.setSpeed(random(3, 5));
- switch (getState()) {
- case toDraynorBank:
- walking.walkPathMM(toDraynorBank, 1 ,1);
- return (random(1000, 2500));
- case toSwampMine:
- walking.walkPathMM(toSwampMine, 2 ,2);
- return (random(1000, 2000));
- case toVarrWestBank:
- walking.walkPathMM(toVarrWestBank, 1, 1);
- return (random(1000, 2000));
- case toVarrWestMine:
- walking.walkPathMM(toVarrWestMine, 0, 0);
- return (random(1000, 2000));
- case fallyMineBankB:
- walking.walkPathMM(fallyMineBankB, 2, 2);
- return (random(1000, 2000));
- case fallyBankMineB:
- walking.walkPathMM(fallyBankMineB, 2, 2);
- return (random(1000, 2000));
- case guildFrontMiddle:
- if (walking.getDestination() != null && calc.distanceBetween(walking.getDestination(), guildFrontMiddle) < random(2, 3))
- return random(50, 100);
- if (calc.distanceTo(guildFrontMiddle) < random(2, 3))
- return random(50, 100);
- walking.walkTileMM(walking.getClosestTileOnMap(guildFrontMiddle), random(1, 3), random(1, 3));
- return random(600, 900);
- case toMineGuildLadder:
- if (walking.getDestination() != null && calc.distanceBetween(walking.getDestination(), guildLadder) < random(2, 3))
- return random(50, 100);
- if (calc.distanceTo(guildLadder) < random(2, 3))
- return random(50, 100);
- walking.walkTileMM(walking.getClosestTileOnMap(guildLadder), random(1, 3), random(1, 3));
- return random(600, 900);
- case nuller:
- return random(250, 600);
- case dropIt:
- mouse.setSpeed(random(5, 7));
- inventory.dropAllExcept(pickID);
- return random(250, 600);
- }
- return 100;
- }
- private enum State {
- toDraynorBank, toSwampMine, toVarrWestBank, toVarrWestMine, toMineGuildLadder, fallyBankMineB, fallyMineBankB, guildFrontMiddle, sleep, nuller, dropIt
- }
- private State getState() {
- game.openTab(Game.TAB_INVENTORY);
- if ( walking.getEnergy() >= random(60,102)) {
- walking.setRun(true);
- }
- if (lumSwampCoal == true) {
- try {
- if (inventory.isFull() && !draynorBank()) {
- return State.toDraynorBank;
- } else if (inventory.isFull() && draynorBank()) {
- bank();
- return State.nuller;
- } else if (!inventory.isFull() && !lumSwampMine()) {
- return State.toSwampMine;
- } else if (lumSwampMine() && !inventory.isFull()) {
- MineCoal();
- return State.nuller;
- } else if (!draynorBank() && !lumSwampMine() && !inventory.isFull()) {
- return State.toSwampMine;
- } else if (!draynorBank() && !lumSwampMine() && inventory.isFull()) {
- return State.toDraynorBank;
- }
- } catch (Exception e) {
- return State.sleep;
- }
- }
- if (lumSwampCoalPwr == true) {
- try {
- if(inventory.isFull()) {
- return State.dropIt;
- } else if (!inventory.isFull()) {
- MineCoal();
- }
- } catch (Exception e) {
- return State.sleep;
- }
- }
- if (varrwestIron == true) {
- try {
- if (inventory.isFull() && !varrwestBank()) {
- return State.toVarrWestBank;
- } else if (inventory.isFull() && varrwestBank()) {
- bank();
- return State.nuller;
- } else if (!inventory.isFull() && !varrwestMine()) {
- return State.toVarrWestMine;
- } else if (varrwestMine() && !inventory.isFull()) {
- MineIron();
- return State.nuller;
- } else if (!varrwestBank() && !varrwestMine() && !inventory.isFull()) {
- return State.toVarrWestMine;
- } else if (!varrwestBank() && !varrwestMine() && inventory.isFull()) {
- return State.toVarrWestBank;
- }
- } catch (Exception e) {
- return State.sleep;
- }
- }
- if (varrwestIronPwr == true) {
- try {
- if(inventory.isFull()) {
- return State.dropIt;
- } else if (!inventory.isFull()) {
- MineIron();
- }
- } catch (Exception e) {
- return State.sleep;
- }
- }
- if (fallyMinngGuild == true) {
- RSObject ladder = objects.getNearest(fallyMineGuildUpLadder);
- RSObject ladderDown = objects.getNearest(fallyMineGuildDownLadder);
- RSObject bankBooth = objects.getNearest(thebankid);
- RSObject randomObj = objects.getNearest(7829);
- try {
- if (inventory.isFull() && fallyEastMine() && !ladder.isOnScreen()) {
- antiban2();
- return State.toMineGuildLadder;
- } else if (inventory.isFull() && fallyEastMine() && ladder.isOnScreen()) {
- ladder.doAction("Climb-up");
- sleep(random(3000, 7000));
- return State.nuller;
- } else if (fallyEastMine() && !inventory.isFull() && calc.distanceTo(randomObj) < 7) {
- return State.guildFrontMiddle;
- } else if (fallyEastMine() && !inventory.isFull() && calc.distanceTo(randomObj) > 7) {
- MineCoal();
- } else if (inventory.isFull() && fallyMineArea() && !bankBooth.isOnScreen()) {
- return State.fallyMineBankB;
- } else if (fallyMineArea() && inventory.isFull() && bankBooth.isOnScreen()) {
- bank();
- return State.nuller;
- } else if (fallyMineArea() && !inventory.isFull() && !ladderDown.isOnScreen()) {
- antiban2();
- return State.fallyBankMineB;
- } else if (fallyMineArea() && !inventory.isFull() && ladderDown.isOnScreen()) {
- ladderDown.doAction("Climb-down");
- sleep(random(1000, 2000));
- return State.nuller;
- }
- } catch (Exception e) {
- return State.sleep;
- }
- }
- if (fallyMinngGuildPwr == true) {
- try {
- if(inventory.isFull()) {
- return State.dropIt;
- } else if (!inventory.isFull()) {
- MineCoal();
- }
- } catch (Exception e) {
- return State.sleep;
- }
- }
- return State.nuller;
- }
- public int sleepForAnim(int timeout) {
- long start = System.currentTimeMillis();
- RSPlayer myPlayer = getMyPlayer();
- int anim = -1;
- while (System.currentTimeMillis() - start < timeout) {
- if ((anim = myPlayer.getAnimation()) != -1) {
- break;
- }
- sleep(random(5, 15));
- }
- return anim;
- }
- private void drawTile(Graphics render, RSTile tile, Color color, boolean drawCardinalDirections) {
- Point southwest = calc.tileToScreen(tile, 0, 0, 0);
- Point southeast = calc.tileToScreen(new RSTile(tile.getX() + 1, tile.getY()), 0, 0, 0);
- Point northwest = calc.tileToScreen(new RSTile(tile.getX(), tile.getY() + 1), 0, 0, 0);
- Point northeast = calc.tileToScreen(new RSTile(tile.getX() + 1, tile.getY() + 1), 0, 0, 0);
- if (calc.pointOnScreen(southwest) && calc.pointOnScreen(southeast) && calc.pointOnScreen(northwest) && calc.pointOnScreen(northeast)) {
- render.setColor(Color.BLACK);
- render.drawPolygon(new int[] { (int) northwest.getX(), (int) northeast.getX(), (int) southeast.getX(), (int) southwest.getX() }, new int[] { (int) northwest.getY(), (int) northeast.getY(), (int) southeast.getY(), (int) southwest.getY() }, 4);
- render.setColor(color);
- render.fillPolygon(new int[] { (int) northwest.getX(), (int) northeast.getX(), (int) southeast.getX(), (int) southwest.getX() }, new int[] { (int) northwest.getY(), (int) northeast.getY(), (int) southeast.getY(), (int) southwest.getY() }, 4);
- if (drawCardinalDirections) {
- render.setColor(Color.WHITE);
- }
- }
- }
- public void mouseDragged(MouseEvent e) {
- mPlayer = e.getPoint();
- }
- public void mouseMoved(MouseEvent e) {
- mPlayer = e.getPoint();
- }
- public void onRepaint(final Graphics g) {
- final Color Black = new Color(0, 0, 0);
- final Color Border = new Color(0, 153, 153);
- final Color LightFill = new Color(0, 153, 153, 99);
- //=== Timer ===
- long millis = System.currentTimeMillis() - startTime;
- int expHour = (int) (3600000.0 / millis * gainedExp);
- int oreHour = (int) (3600000.0 / millis * hourlyOre);
- long hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- long minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- long seconds = millis / 1000;
- gainedExp = skills.getCurrentExp(Skills.MINING) - startExp;
- final int percent = skills.getPercentToNextLevel(Skills.MINING);
- int lvlGain = skills.getCurrentLevel(Skills.MINING) - startlvl;
- Point m = mouse.getLocation();
- final int x = 24;
- int y = 47;
- int y2 = 47 + 16 + 16 + 16 + 16 + 5 + 16 + 16 + 5;
- //Exp Bar Area
- if (mPlayer.x >= 20 && mPlayer.x < 20 + 168 && mPlayer.y >= y2 && mPlayer.y < y2 + 13) {
- barHover = true;
- } else {
- barHover = false;
- }
- //=== Locations ===
- if (lumSwampMine()){
- location = "Lumby Swamp Mine";
- } else if (draynorBank()){
- location = "Draynor Bank";
- } else if (varrwestMine()){
- location = "Varrock West Mine";
- } else if (varrwestBank()){
- location = "Varrock West Bank";
- } else if (fallyEastBank()){
- location = "Falador East Bank";
- } else if (fallyEastMine()){
- location = "Mining Guild";
- } else if (fallyMineArea()){
- location = "Fally Mine Area";
- } else {
- location = "Unknown";
- }
- if (game.isLoggedIn()) {
- drawTile(g, players.getMyPlayer().getLocation(), LightFill, true);
- //Bot Mouse
- g.setColor(Black);
- g.drawLine(0, m.y, 1024, m.y);
- g.drawLine(m.x, 0, m.x, 1024);
- //Player Mouse
- g.setColor(Color.RED);
- g.drawLine(mPlayer.x - 8, mPlayer.y, mPlayer.x + 8, mPlayer.y);
- g.drawLine(mPlayer.x, mPlayer.y - 8, mPlayer.x, mPlayer.y + 8);
- g.setColor(Border);
- g.drawRect(16, 31, 174, 143);
- g.setColor(LightFill);
- g.fillRect(17, 32, 173, 142);
- g.setFont(new Font("SansSerif", 0, 12));
- g.setColor(Black);
- g.drawString("Ores Mined: " + oresMined, x, y);
- y += 16;
- g.drawString("Gems Mined: " + gemsMined, x, y);
- y += 16;
- g.drawString("Levels Gained: " + lvlGain, x, y);
- y += 16;
- g.drawString("Exp Gained: " + gainedExp, x, y);
- y += 16;
- g.drawLine(25, 100, 182, 100);
- y += 5;
- g.drawString("Remaning Exp: " + skills.getExpToNextLevel(Skills.MINING), x, y);
- y += 16;
- g.drawString("Runtime: " + hours + ":" + minutes + ":" + seconds, x, y);
- y += 16;
- g.drawString("Location: " + location, x, y);
- y += 5;
- g.drawRect(x - 5, y, 169, 14);
- // Exp Bar
- g.setColor(Color.RED);
- /* x, y, width, height, rounded, rounded */
- g.fillRoundRect(x - 4, y + 1, 168, 13, 0, 0);
- g.setColor(Color.GREEN);
- g.fillRoundRect(x - 4, y + 1, (int) (percent * 168 / 100.0), 13, 0, 0);
- //Hovered
- if (barHover == true) {
- g.setColor(Border);
- g.drawRect(mPlayer.x, mPlayer.y - 35, 141, 34);
- g.setColor(new Color(0, 153, 153, 255));
- g.fillRect(mPlayer.x + 1, mPlayer.y - 34, 140, 33);
- g.setColor(Black);
- g.drawString("Exp/Hr: " + expHour, mPlayer.x + 5, mPlayer.y - 20);
- g.drawString("Ores/Hr: " + oreHour, mPlayer.x + 5, mPlayer.y - 5);
- }
- }
- }
- public void serverMessageRecieved(final ServerMessageEvent arg0) {
- final String serverString = arg0.getMessage();
- if (serverString.contains("You manage to mine some")){
- oresMined++;
- }
- if (serverString.contains("found")) {
- gemsMined++;
- }
- if (serverString.contains("clay")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("copper")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("tin")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("iron")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("silver")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("coal")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("gold")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("mith")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("adamantite")) {
- hourlyOre = hourlyOre + 1;
- }
- if (serverString.contains("rune")) {
- hourlyOre = hourlyOre + 1;
- }
- }
- public void onFinish() {
- log("Goodbye");
- }
- public class minerGUI extends JFrame {
- public minerGUI() {
- initComponents();
- }
- private void initComponents() {
- // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
- // Generated using JFormDesigner Evaluation license - joe dirt
- comboBox1 = new JComboBox();
- label1 = new JLabel();
- button1 = new JButton();
- checkBox1 = new JCheckBox();
- //======== this ========
- setTitle("Miner Settings");
- setResizable(false);
- setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
- Container contentPane = getContentPane();
- contentPane.setLayout(null);
- //---- comboBox1 ----
- comboBox1.setModel(new DefaultComboBoxModel(new String[] {
- "Choose Location",
- "Lumbridge Swamp [Coal]",
- "Varrock West [Iron]",
- "Falador Mining Guild [Coal]"
- }));
- contentPane.add(comboBox1);
- comboBox1.setBounds(5, 5, 250, comboBox1.getPreferredSize().height);
- //---- label1 ----
- label1.setText("Created by Harrison(Stew)");
- contentPane.add(label1);
- label1.setBounds(new Rectangle(new Point(20, 65), label1.getPreferredSize()));
- //---- button1 ----
- button1.setText("Start");
- button1.addMouseListener(new MouseAdapter() {
- @Override
- public void mouseClicked(MouseEvent e) {
- button1MouseClicked(e);
- }
- });
- contentPane.add(button1);
- button1.setBounds(new Rectangle(new Point(190, 45), button1.getPreferredSize()));
- //---- checkBox1 ----
- checkBox1.setText("Powermine? (Check if yes)");
- contentPane.add(checkBox1);
- checkBox1.setBounds(new Rectangle(new Point(5, 35), checkBox1.getPreferredSize()));
- { // compute preferred size
- Dimension preferredSize = new Dimension();
- for(int i = 0; i < contentPane.getComponentCount(); i++) {
- Rectangle bounds = contentPane.getComponent(i).getBounds();
- preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
- preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
- }
- Insets insets = contentPane.getInsets();
- preferredSize.width += insets.right;
- preferredSize.height += insets.bottom;
- contentPane.setMinimumSize(preferredSize);
- contentPane.setPreferredSize(preferredSize);
- }
- pack();
- setLocationRelativeTo(getOwner());
- // JFormDesigner - End of component initialization //GEN-END:initComponents
- }
- private void button1MouseClicked(MouseEvent e) {
- if(comboBox1.getSelectedItem().toString().contains("Lumbridge Swamp [Coal]") && !checkBox1.isSelected()) {
- lumSwampCoal = true;
- } else if (comboBox1.getSelectedItem().toString().contains("Lumbridge Swamp [Coal]") && checkBox1.isSelected()) {
- lumSwampCoalPwr = true;
- }
- if(comboBox1.getSelectedItem().toString().contains("Varrock West [Iron]") && !checkBox1.isSelected()) {
- varrwestIron = true;
- } else if (comboBox1.getSelectedItem().toString().contains("Varrock West [Iron]") && checkBox1.isSelected()) {
- varrwestIronPwr = true;
- }
- if (comboBox1.getSelectedItem().toString().contains("Falador Mining Guild [Coal]") && !checkBox1.isSelected()) {
- fallyMinngGuild = true;
- } else if (comboBox1.getSelectedItem().toString().contains("Falador Mining Guild [Coal]") && checkBox1.isSelected()) {
- fallyMinngGuildPwr = true;
- }
- gui.setVisible(false);
- }
- // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
- // Generated using JFormDesigner Evaluation license - joe dirt
- private JComboBox comboBox1;
- private JLabel label1;
- private JButton button1;
- private JCheckBox checkBox1;
- // JFormDesigner - End of variables declaration //GEN-END:variables
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement