ULTIMATE GUIDE

LoG iN

Join the forum, it's quick and easy

ULTIMATE GUIDE

LoG iN

ULTIMATE GUIDE

Would you like to react to this message? Create an account in a few clicks or log in to continue.

ULTIMATE GUIDE


    BmxPowerMine

    avatar
    Turk4life321
    Admin


    Posts : 41
    Join date : 2009-08-09
    Location : In Saims Room *cough*

    BmxPowerMine Empty BmxPowerMine

    Post  Turk4life321 Fri Jan 01, 2010 4:51 am

    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Font;
    import java.util.Map;
    import java.awt.FontMetrics;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.geom.Rectangle2D;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.net.URL;
    import java.net.URLConnection;
    import java.text.NumberFormat;
    import java.awt.event.KeyEvent;
    import java.util.Random;

    import org.rsbot.bot.Bot;
    import org.rsbot.event.events.ServerMessageEvent;
    import org.rsbot.event.listeners.PaintListener;
    import org.rsbot.event.listeners.ServerMessageListener;
    import org.rsbot.script.Script;
    import org.rsbot.script.ScriptManifest;
    import org.rsbot.script.wrappers.RSObject;


    @ScriptManifest(authors = { "Bmxican" }, category = "Mining", name = "Bmxican's Power Miner", version = 2.6, description = "<html><head>" +
    "</head><body>" +
    "<center><strong><h2>Bmxican's Power Miner V2.6</h2></strong></center>" +
    "<center>Start at any mine</center>" +
    "<center>Have your pickaxe equipped or in the inventory</center>"+
    "<html><head></head><body>Choose Rocks to Mine, Start in any Mine has Every ID i think <br><form>Rocktype Type:<br><input type=\"radio\" name=\"type\" value=\"1\" checked=\"checked\"> Iron <br><input type=\"radio\" name=\"type\" value=\"2\"> Coal <br><input type=\"radio\" name=\"type\" value=\"3\"> Mith <br><input type=\"radio\" name=\"type\" value=\"4\"> Addy <br><input type=\"radio\" name=\"type\" value=\"5\"> Gold <br><input type=\"radio\" name=\"type\" value=\"6\"> Iron&Coal <br><input type=\"radio\" name=\"type\" value=\"7\"> Coal&Mith <br><input type=\"radio\" name=\"type\" value=\"8\"> Iron&Coal&Mith <br><input type=\"radio\" name=\"type\" value=\"9\"> Coal&Mith&Addy <br><input type=\"radio\" name=\"type\" value=\"10\"> Mith&Addy <br><input type=\"radio\" name=\"type\" value=\"11\"> Addy&Coal <br><input type=\"radio\" name=\"type\" value=\"12\"> All Ores </body></html>")
    public class BmxPowerMine extends Script implements PaintListener, ServerMessageListener {
    ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);

    // Pic
    public int AllPic[] = {1275, 1271, 1273, 1269, 1267, 1265};

    //Minning stuff
    public int[] Rock;
    public int Type;
    public String Ore;


    //Paint stuff
    public int OresMined = 0;
    long StartTime = 0;
    public int XPHour = 0;
    public int TotalXp = 0;
    public int LvlGained = 0;
    String Status = "Starting up";
    public int OresGained = 0;
    public int StartXP = 0;
    public int StartLvl = 0;
    public int runEnergy = random(20, 95);
    public boolean setAltitude = false;
    final GarrettsPaint thePainter = new GarrettsPaint();
    AntiBan Antiban;//credits to Taha
    Thread t;
    private double latestVersion = 0;
    private double version = properties.version();
    String Updated = "Fully Updated Smile";

    private double getVersion() {
    return properties.version();
    }

    private void getLatestVersion() {
    URLConnection url = null;
    BufferedReader in = null;
    try {
    //Open the version text file
    url = new URL("http://clan-recon.info/bmx/Scripts/BmxPowerMinerVERSION.txt").openConnection();
    //Create an input stream for it
    in = new BufferedReader(new InputStreamReader(url.getInputStream()));
    //Check if the current version is outdated
    latestVersion = Double.parseDouble(in.readLine());
    } catch (final Exception e) {
    log ("Error loading version data.");
    }
    }

    private int AntiBan() {
    Status = "Performing AntiBan";
    int random = random(1, 12);

    switch (random) {
    case 1:
    if (random(1, 4) == 2)
    {
    moveMouseRandomly(300);
    return random(100, 500);
    }

    case 2:
    if (random(1, 10) == 5)
    {
    if (getCurrentTab() != TAB_FRIENDS) {
    openTab(TAB_FRIENDS);
    return random(2000, 5000);
    } else {
    return random(100, 500);
    }
    }

    case 3:
    if (random(1, 1) == 10) {
    int angle = getCameraAngle() + random(-90, 90);
    if (angle < 0)
    angle = 0;
    if (angle > 359)
    angle = 0;
    setCameraRotation(angle);
    }

    case 4:
    if (random(1, 200) == 100)
    {
    if (getMyPlayer().isMoving()) {
    return random(100, 500);
    }
    if (getCurrentTab() != TAB_STATS) {
    openTab(TAB_STATS);
    }
    moveMouse(665, 230, 40, 20);
    wait(random(3000, 6000));
    return random(100, 500);
    }
    case 5:
    if (random(1, 20) == 10)
    {
    if (getMyPlayer().isMoving()) {
    return (random(100, 500));
    }
    if (getCurrentTab() != TAB_STATS) {
    openTab(TAB_STATS);
    }
    return (random(4500, 6000));
    }

    case 6:
    if (random(1, 150) == 75)
    {
    openTab(random(0, Cool);
    wait(random(4500, 6000));
    return random(100, 500);
    }
    case 7:
    if (random(1, 1) == 10) {
    setCameraRotation(359);
    return random(100, 500);
    }

    case 8:
    if (random(1, 1) == 10) {
    setCameraRotation(89);
    return random(100, 500);
    }

    case 9:
    if (random(1, 1) == 10) {
    setCameraRotation(179);
    return random(100, 500);
    }

    case 10:
    if (random(1, 1) == 10) {
    setCameraRotation(269);
    return random(100, 500);
    }

    case 11:
    if (random(1, 1) == 10) {
    setCameraRotation(359);
    return random(100, 500);
    }

    return (random(1000, 3000));
    }
    return random(1000, 5000);
    }

    public boolean onStart(Map<String, String> args) {
    StartTime = System.currentTimeMillis();
    getLatestVersion();
    if (latestVersion > version) {
    log ("This version is now outdated!");
    log ("Please visit the RSBot site (http://www.rsbot.org/vb/showthread.php?t=179419) for the update!");
    }
    log("Thanks for using Bmxicans PowerMiner V2.6");
    Status = "Starting up...";
    Antiban = new AntiBan();
    t = new Thread(Antiban);
    log(Status);
    Type = Integer.parseInt(args.get("type"));
    switch (Type) {
    case 1:
    Rock = new int[] {2093, 2093, 2092, 9717,
    9719, 9717, 9718, 11956, 11955,
    11954, 11557, 37307, 37309, 31072,
    31073, 310712093, 2093, 2092, 9717,
    9719, 9717, 9718, 11956, 11955, 11954,
    11557, 37307, 37309, 37308};
    Ore = "Iron";
    log("Mining Iron");
    Status = "Mining Iron";
    break;
    case 2:
    Rock = new int[] {11930, 11931, 11932, 11930,
    11963, 11964, 2096, 2097, 14850, 14851,
    14852, 32426, 32426, 31068, 31069, 31070,
    31068};
    Ore = "Coal";
    log("Mining Coal");
    Status = "Mining Coal";
    break;
    case 3:
    Rock = new int[] {11942, 11944, 11943, 32438,
    32439, 31086, 31088};
    Ore = "Mith";
    log("Mining Mith");
    Status = "Mining Mith";
    break;
    case 4:
    Rock = new int[] {1939, 11941, 32435,
    32436, 11940, 31083, 31084,
    31085, 31083};
    Ore = "Addy";
    Status = "Mining Addy";
    log("Mining Addy");
    break;
    case 5:
    Rock = new int[] {37312, 37310, 9722, 9720, 15505,
    15503, 11185, 11184, 11183, 9720, 9722,
    37313, 31065, 31066};
    Ore = "Gold";
    log("Mining Gold");
    Status = "Mining Gold";
    break;
    case 6:
    Rock = new int[] {11930, 11931, 11932, 11930,
    11963, 11964, 2096, 2097, 14850, 14851,
    14852, 32426, 32426, 31068, 31069, 31070,
    31068,2093, 2093, 2092, 9717, 9719, 9717,
    9718, 11956, 11955, 11954, 11557, 37307,
    37309, 31072,31073, 310712093, 2093, 2092,
    9717, 9719, 9717, 9718, 11956, 11955, 11954,
    11557, 37307, 37309, 37308};
    Ore = "Iron&Coal";
    log("Mining Iron and Coal");
    Status = "Mining Iron and Coal";
    break;
    case 7:
    Rock = new int[] {11930, 11931, 11932, 11930,
    11963, 11964, 2096, 2097, 14850, 14851,
    14852, 32426, 32426, 31068, 31069, 31070,
    31068, 11942, 11944, 11943, 32438,
    32439, 31086, 31088};
    Ore = "Coal&Mith";
    log("Mining Coal and Mith");
    Status = "Mining Coal and Mith";
    break;
    case 8:
    Rock = new int[] {2093, 2093, 2092, 9717,
    9719, 9717, 9718, 11956, 11955,
    11954, 11557, 37307, 37309, 31072,
    31073, 310712093, 2093, 2092, 9717,
    9719, 9717, 9718, 11956, 11955, 11954,
    11557, 37307, 37309, 11930, 11931, 11932, 11930,
    11963, 11964, 2096, 2097, 14850, 14851,
    14852, 32426, 32426, 31068, 31069, 31070,
    31068, 11942, 11944, 11943, 32438,
    32439, 31086, 31088, 37308};
    Ore ="Iron&Coal&Mith";
    log("Mining Iron Coal and Mith");
    Status = "Mining Iron Coal and Mith";
    break;
    case 9:
    Rock = new int[] {11930, 11931, 11932, 11930,
    11963, 11964, 2096, 2097, 14850, 14851,
    14852, 32426, 32426, 31068, 31069, 31070,
    31068, 11942, 11944, 11943, 32438,
    32439, 31086, 31088, 1939, 11941, 32435,
    32436, 11940, 31083, 31084, 31085, 31083};
    Ore = "Coal&Mith&Addy";
    log("Mining Coal Mith and Addy");
    Status = "Mining Coal Mith and Addy";
    break;
    case 10:
    Rock = new int[] {11942, 11944, 11943, 32438,
    32439, 31086, 31088, 1939, 11941, 32435,
    32436, 11940, 31083, 31084, 31085, 31083};
    Ore = "Mith&Addy";
    log("Mining Mith and Addy");
    Status = "Mining Mith and Addy";
    break;
    case 11:
    Rock = new int[] {11930, 11931, 11932, 11930,
    11963, 11964, 2096, 2097, 14850, 14851,
    14852, 32426, 32426, 31068, 31069, 31070,
    31068, 1939, 11941, 32435, 32436, 11940,
    31083, 31084, 31085, 31083};
    Ore = "Coal&Addy";
    log("Mining Coal and Addy");
    Status = "Mining Coal and Addy";
    break;
    case 12:
    Rock = new int[] {2093, 2093, 2092, 9717,
    9719, 9717, 9718, 11956, 11955,
    11954, 11557, 37307, 37309, 31072,
    31073, 310712093, 2093, 2092, 9717,
    9719, 9717, 9718, 11956, 11955, 11954,
    11557, 37307, 37309, 11930, 11931, 11932,
    11930,11963, 11964, 2096, 2097, 14850, 14851,
    14852, 32426, 32426, 31068, 31069, 31070,
    31068, 11942, 11944, 11943, 32438,
    32439, 31086, 31088, 1939, 11941, 32435,
    32436, 11940, 31083, 31084, 31085, 31083,
    37312, 37310, 9722, 9720, 15505, 15503,
    11185, 11184, 11183, 9720, 9722, 37313,
    31065, 31066, 37308};
    Ore = "All Ores";
    log("Mining All Ores");
    Status = "Mining All Ores";
    break;

    }
    return true;
    }

    public void startRunning(final int energy) {
    if (getEnergy() >= energy && !isRunning()) {
    runEnergy = random(40, 95);
    setRun(true);
    Status = "Setting Run";
    wait(random(500, 750));
    }
    }

    public void dropAllExcept(final boolean leftToRight, final int... items) {
    while (!inventoryEmptyExcept(items)) {
    if (!leftToRight) {
    for (int c = 0; c < 4; c++) {
    for (int r = 0; r < 7; r++) {
    boolean found = false;
    for (int i = 0; i < items.length && !found; i++) {
    found = items[i] == getInventoryArray()[c + r * 4];
    }
    if (!found) {
    dropItem(c, r);
    }
    }
    }
    } else {
    for (int r = 0; r < 7; r++) {
    for (int c = 0; c < 4; c++) {
    boolean found = false;
    for (int i = 0; i < items.length && !found; i++) {
    found = items[i] == getInventoryArray()[c + r * 4];
    }
    if (!found) {
    dropItem(c, r);
    }
    }
    }
    }
    wait(random(500, 800));
    }
    }

    @Override
    public int loop() {

    if (!t.isAlive()) {
    t.start();
    log("AntiBan initialized!");
    }
    if(!setAltitude) {
    setCameraAltitude(true);
    wait(random(250, 500));
    setAltitude = true;
    return random(50, 100);
    }
    if(StartXP == 0) {
    StartXP = skills.getCurrentSkillExp(skills.getStatIndex("mining"));
    StartLvl = skills.getCurrentSkillLevel(skills.getStatIndex("mining"));
    }
    if (getMyPlayer().isMoving()){
    Status = "Walking to Rock";
    AntiBan();
    return (random(1000, 1300));
    }
    if (getMyPlayer().getAnimation()!= -1 ){
    Status = "Mininig Rock!";
    AntiBan();
    return (random(1000, 1500));
    }
    if (isInventoryFull()){
    Status = "Droping Ores";
    dropAllExcept(AllPic);
    return (random(100, 200));
    }

    thePainter.scriptRunning = true;

    if (!thePainter.savedStats)
    thePainter.saveStats();

    startRunning(runEnergy);

    RSObject RockObj = getNearestObjectByID(Rock); {
    RSObject cur = null;
    double dist = -1;
    for (int x = 0; x < 104; x++) {
    for (int y = 0; y < 104; y++) {
    final RSObject o = getObjectAt(x + Bot.getClient().getBaseX(),
    y + Bot.getClient().getBaseY());
    if (o != null) {
    boolean isObject = false;
    for (final int id : Rock) {
    if (o.getID() == id) {
    isObject = true;
    break;
    }
    }
    if (isObject) {
    final double distTmp = calculateDistance(getMyPlayer()
    .getLocation(), o.getLocation());
    if (cur == null) {
    dist = distTmp;
    cur = o;
    } else if (distTmp < dist) {
    cur = o;
    dist = distTmp;
    }
    }
    }
    }
    }

    if (RockObj != null) {
    if (tileOnScreen(RockObj.getLocation())) {
    Status = "Searching for Rocks";
    if(RockObj == null) return (random(600, 1300));

    atObject(RockObj, "Mine");
    Status = "Mining Rock!";
    return (random(1000, 1500));
    } else {
    try {
    if (tileOnMap(RockObj.getLocation())) {
    Status = "Walking To Rock Using MiniMap";
    walkTileMM(RockObj.getLocation());
    }
    return (random(1000, 1500));
    } catch (final Exception e) {
    }

    }
    }

    return (random(800, 1200));
    }
    }


    public void serverMessageRecieved(final ServerMessageEvent arg0) {
    final String Message = arg0.getMessage();
    if (Message.contains("mine some mithril")){
    TotalXp = TotalXp + 80;
    OresMined++;
    }
    if (Message.contains("mine some iron")){
    TotalXp = TotalXp + 35;
    OresMined++;
    }
    if (Message.contains("mine some adamant")){
    TotalXp = TotalXp + 95;
    OresMined++;
    }
    if (Message.contains("mine some coal")){
    TotalXp = TotalXp + 50;
    OresMined++;
    }
    if (Message.contains("mine some gold")){
    TotalXp = TotalXp + 65;
    OresMined++;
    }
    }

    //credit to garrett for help
    public void onRepaint(Graphics g) {
    thePainter.paint(g);
    }

    public class GarrettsPaint {

    final Rectangle r = new Rectangle(7, 345, 408, 114);
    final Rectangle r1 = new Rectangle(420, 345, 77, 25);
    final Rectangle r2 = new Rectangle(420, 374, 77, 26);
    final Rectangle r3 = new Rectangle(420, 404, 77, 26);
    final Rectangle r4 = new Rectangle(420, 434, 77, 25);
    final Rectangle r2c = new Rectangle(415, 374, 5, 26);
    final Rectangle r3c = new Rectangle(415, 404, 5, 26);
    final Rectangle r4c = new Rectangle(415, 434, 5, 25);
    final Rectangle sb1 = new Rectangle(12, 350, 398, 12);
    final Rectangle sb2 = new Rectangle(12, 363, 398, 12);
    final Rectangle sb3 = new Rectangle(12, 376, 398, 12);
    final Rectangle sb4 = new Rectangle(12, 389, 398, 12);
    final Rectangle sb5 = new Rectangle(12, 402, 398, 12);
    final Rectangle sb6 = new Rectangle(12, 415, 398, 12);
    final Rectangle sb7 = new Rectangle(12, 428, 398, 12);
    final Rectangle sb8 = new Rectangle(12, 441, 398, 12);
    final Rectangle sb1s = new Rectangle(12, 350, 196, 12);
    final Rectangle sb2s = new Rectangle(12, 363, 196, 12);
    final Rectangle sb3s = new Rectangle(12, 376, 196, 12);
    final Rectangle sb4s = new Rectangle(12, 389, 196, 12);
    final Rectangle sb5s = new Rectangle(12, 402, 196, 12);
    final Rectangle sb6s = new Rectangle(12, 415, 196, 12);
    final Rectangle sb7s = new Rectangle(12, 428, 196, 12);
    final Rectangle sb8s = new Rectangle(12, 441, 196, 12);
    final Rectangle sb9s = new Rectangle(213, 350, 196, 12);
    final Rectangle sb10s = new Rectangle(213, 363, 196, 12);
    final Rectangle sb11s = new Rectangle(213, 376, 196, 12);
    final Rectangle sb12s = new Rectangle(213, 389, 196, 12);
    final Rectangle sb13s = new Rectangle(213, 402, 196, 12);
    final Rectangle sb14s = new Rectangle(213, 415, 196, 12);
    final Rectangle sb15s = new Rectangle(213, 428, 196, 12);
    final Rectangle sb16s = new Rectangle(213, 441, 196, 12);
    Rectangle[] skillBars = new Rectangle[] {sb1, sb2, sb3, sb4, sb5, sb6, sb7, sb8};
    boolean savedStats = false;
    boolean scriptRunning = false;
    boolean checkedCount = false;
    int currentTab = 0;
    int lastTab = 0;
    int[] barIndex = new int[16];
    int[] start_exp = null;
    int[] start_lvl = null;
    int[] gained_exp = null;
    int[] gained_lvl = null;

    Thread mouseWatcher = new Thread();
    final NumberFormat nf = NumberFormat.getInstance();

    final long time_ScriptStart = System.currentTimeMillis();
    long runTime = System.currentTimeMillis() - time_ScriptStart;

    int sine = 0;
    int sineM = 1;
    public void paint(final Graphics g) {
    if (!isLoggedIn() || !scriptRunning)
    return;

    //credits to Jacmob for the pulsing
    if (sine >= 84) {
    sine = 84;
    sineM *= -1;
    } else if (sine <= 1) {
    sine = 1;
    sineM *= -1;
    }
    sine += sineM;

    runTime = System.currentTimeMillis() - time_ScriptStart;
    final String formattedTime = formatTime((int) runTime);

    currentTab = paintTab();

    switch(currentTab) {
    case -1: //PAINT OFF
    g.setColor(new Color(0, 0, 0, 150));
    g.fillRect(r1.x, r1.y, r1.width, r1.height);
    g.setColor(Color.WHITE);
    drawString(g, "Show Paint", r1, 5);
    break;
    case 0: //DEFAULT TAB - MAIN
    drawPaint(g, r2c);
    g.setColor(new Color(100, 100, 100, 200));
    g.drawLine(r.x + 204, r.y + 22, r.x + 204, r.y + 109);
    g.setColor(Color.WHITE);
    g.setFont(new Font("Arial", Font.BOLD, 14));
    drawString(g, properties.name(), r, -40);
    g.setFont(new Font("Arial", Font.PLAIN, 12));
    drawStringMain(g, "Runtime: ", formattedTime, r, 20, 35, 0, true);
    drawStringMain(g, "Status: ", Status, r, 20, 35, 1, true);
    int OresPerHour = 0;
    int gainedEXP = skills.getCurrentSkillExp(skills.getStatIndex("mining")) - start_exp[skills.getStatIndex("mining")];
    if ((runTime / 1000) > 0) {
    OresPerHour = (int) ((3600000.0 / (double) runTime) * OresMined);
    }
    drawStringMain(g, "Ores Mined ", Integer.toString(OresMined), r, 20, 35, 2, true);
    drawStringMain(g, "Ores Per Hour ", Integer.toString(OresPerHour), r, 20, 35, 3, true);
    break;
    case 1: //INFO
    drawPaint(g, r3c);
    g.setColor(new Color(100, 100, 100, 200));
    g.drawLine(r.x + 204, r.y + 22, r.x + 204, r.y + 109);
    g.setColor(Color.WHITE);
    g.setFont(new Font("Arial", Font.BOLD, 14));
    drawString(g, properties.name(), r, -40);
    g.setFont(new Font("Arial", Font.PLAIN, 12));
    //drawStringMain(g, "Version: ", Double.toString(properties.version()), r, 20, 35, 0, true);
    if (version < latestVersion) {
    g.setColor(Color.RED);
    drawStringMain(g,"", "***Outdated***"+Double.toString(properties.version()), r, 20, 35, 0, true);
    drawStringMain(g,"","V"+Double.toString(latestVersion)+" is now available", r, 20, 35, 1, true);
    } else {
    g.setColor(Color.GREEN);
    drawStringMain(g,"",Updated, r, 20, 35, 0, true);
    drawStringMain(g,"Latest version",Double.toString(properties.version()), r, 20, 35, 1, true);
    }
    break;
    case 2: //STATS
    drawPaint(g, r4c);
    drawStats(g);
    hoverMenu(g);
    break;
    }
    }

    public void saveStats() {
    nf.setMinimumIntegerDigits(2);
    final String[] stats = skills.statsArray;
    start_exp = new int[stats.length];
    start_lvl = new int[stats.length];
    for (int i = 0; i < stats.length; i++) {
    start_exp[i] = skills.getCurrentSkillExp(i);
    start_lvl[i] = skills.getCurrentSkillLevel(i);
    }
    for (int i = 0; i < barIndex.length; i++) {
    barIndex[i] = -1;
    }
    savedStats = true;
    }

    public int paintTab() {
    final Point mouse = new Point(Bot.getClient().getMouse().x, Bot.getClient().getMouse().y);
    if (mouseWatcher.isAlive())
    return currentTab;
    if (r1.contains(mouse)) {
    mouseWatcher = new Thread(new MouseWatcher(r1));
    mouseWatcher.start();
    if (currentTab == -1) {
    return lastTab;
    } else {
    lastTab = currentTab;
    return -1;
    }
    }
    if (currentTab == -1)
    return currentTab;
    if (r2.contains(mouse))
    return 0;
    if (r3.contains(mouse))
    return 1;
    if (r4.contains(mouse))
    return 2;
    return currentTab;
    }

    public void drawPaint(final Graphics g, final Rectangle rect) {
    g.setColor(new Color(0, 0, 0, 230));
    g.fillRect(r1.x, r1.y, r1.width, r1.height);
    g.fillRect(r2.x, r2.y, r2.width, r2.height);
    g.fillRect(r3.x, r3.y, r3.width, r3.height);
    g.fillRect(r4.x, r4.y, r4.width, r4.height);
    g.fillRect(rect.x, rect.y, rect.width, rect.height);
    g.fillRect(r.x, r.y, r.width, r.height);
    g.setColor(Color.WHITE);
    drawString(g, "Hide Paint", r1, 5);
    drawString(g, "MAIN", r2, 5);
    drawString(g, "INFO", r3, 5);
    drawString(g, "STATS", r4, 5);
    g.setColor(new Color(0, 0, 0, 230));
    }

    public void drawStat(final Graphics g, final int index, final int count) {
    if (count >= skillBars.length && !checkedCount) {
    skillBars = new Rectangle[] {sb1s, sb2s, sb3s, sb4s, sb5s, sb6s, sb7s, sb8s, sb9s, sb10s, sb11s, sb12s, sb13s, sb14s, sb15s, sb16s};
    checkedCount = true;
    }
    if (count >= skillBars.length)
    return;
    g.setFont(new Font("Arial", Font.PLAIN, 11));
    g.setColor(new Color(100, 100, 100, 150));
    g.fillRect(skillBars[count].x, skillBars[count].y, skillBars[count].width, skillBars[count].height);
    final int percent = skills.getPercentToNextLevel(index);
    g.setColor(new Color(255 - 2 * percent, (int) (1.7 * percent + sine), 0, 150));
    g.fillRect(skillBars[count].x, skillBars[count].y, (int) (((double) skillBars[count].width / 100.0) * (double) percent), skillBars[count].height);
    g.setColor(Color.WHITE);
    final String name = skills.statsArray[index];
    final String capitalized = name.substring(0, 1).toUpperCase() + name.substring(1);
    g.drawString(capitalized, skillBars[count].x + 2, skillBars[count].y + 10);
    drawStringEnd(g, percent + "%", skillBars[count], -2, 4);
    barIndex[count] = index;
    }

    public void drawStats(final Graphics g) {
    final String[] stats = skills.statsArray;
    int count = 0;
    gained_exp = new int[stats.length];
    gained_lvl = new int[stats.length];
    for (int i = 0; i < stats.length; i++) {
    gained_exp[i] = skills.getCurrentSkillExp(i) - start_exp[i];
    gained_lvl[i] = skills.getCurrentSkillLevel(i) - start_lvl[i];
    if (gained_exp[i] > 0) {
    drawStat(g, i, count);
    count++;
    }
    }
    }

    public void hoverMenu(final Graphics g) {
    final Point mouse = new Point(Bot.getClient().getMouse().x, Bot.getClient().getMouse().y);
    final Rectangle r_main = new Rectangle(mouse.x, mouse.y - 150, 300, 150);
    for (int i = 0; i < barIndex.length; i++) {
    if (barIndex[i] > -1) {
    if (skillBars[i].contains(mouse)) {
    final int xpTL = skills.getXPToNextLevel(barIndex[i]);
    final int xpHour = ((int) ((3600000.0 / (double) runTime) * gained_exp[barIndex[i]]));
    final int TTL = (int) (((double) xpTL / (double) xpHour) * 3600000);
    g.setColor(new Color(50, 50, 50, 240));
    g.fillRect(r_main.x, r_main.y, r_main.width, r_main.height);
    g.setColor(Color.WHITE);
    g.setFont(new Font("Arial", Font.BOLD, 15));
    drawString(g, skills.statsArray[barIndex[i]].toUpperCase(), r_main, -58);
    g.setFont(new Font("Arial", Font.PLAIN, 12));
    hoverDrawString(g, "Current Level: ", skills.getCurrentSkillLevel(barIndex[i]) + "", r_main, 40, 0);
    hoverDrawString(g, "XP Gained: ", gained_exp[barIndex[i]] + "xp", r_main, 40, 1);
    hoverDrawString(g, "XP / Hour: ", xpHour + "xp", r_main, 40, 2);
    hoverDrawString(g, "Lvl Gained: ", gained_lvl[barIndex[i]] + " lvls", r_main, 40, 3);
    hoverDrawString(g, "XPTL: ", xpTL + "xp", r_main, 40, 4);
    hoverDrawString(g, "TTL: ", formatTime(TTL), r_main, 40, 5);
    }
    }
    }
    }

    public void hoverDrawString(final Graphics g, final String str, final String val, final Rectangle rect, final int offset, final int index) {
    g.setColor(Color.WHITE);
    final FontMetrics font = g.getFontMetrics();
    final Rectangle2D bounds = font.getStringBounds(val, g);
    final int width = (int) bounds.getWidth();
    final int y = rect.y + offset + (20 * index);
    g.drawString(str, rect.x + 5, y);
    g.drawString(val, (rect.x + rect.width) - width - 5, y);
    if (index < 5) {
    g.setColor(new Color(100, 100, 100, 200));
    g.drawLine(rect.x + 5, y + 5, rect.x + rect.width - 5, y + 5);
    }
    }

    public void drawString(final Graphics g, final String str, final Rectangle rect, final int offset) {
    final FontMetrics font = g.getFontMetrics();
    final Rectangle2D bounds = font.getStringBounds(str, g);
    final int width = (int) bounds.getWidth();
    g.drawString(str, rect.x + ((rect.width - width) / 2), rect.y + ((rect.height / 2) + offset));
    }

    public void drawStringEnd(final Graphics g, final String str, final Rectangle rect, final int xOffset, final int yOffset) {
    final FontMetrics font = g.getFontMetrics();
    final Rectangle2D bounds = font.getStringBounds(str, g);
    final int width = (int) bounds.getWidth();
    g.drawString(str, (rect.x + rect.width) - width + xOffset, rect.y + ((rect.height / 2) + yOffset));
    }

    public void drawStringMain(final Graphics g, final String str, final String val, final Rectangle rect, final int xOffset, final int yOffset, final int index, final boolean leftSide) {
    final FontMetrics font = g.getFontMetrics();
    final Rectangle2D bounds = font.getStringBounds(val, g);
    final int indexMult = 17;
    final int width = (int) bounds.getWidth();
    if (leftSide) {
    g.drawString(str, rect.x + xOffset, rect.y + yOffset + (index * indexMult));
    g.drawString(val, rect.x + (rect.width / 2) - width - xOffset, rect.y + yOffset + (index * indexMult));
    } else {
    g.drawString(str, rect.x + (rect.width / 2) + xOffset, rect.y + yOffset + (index * indexMult));
    g.drawString(val, rect.x + rect.width - width - xOffset, rect.y + yOffset + (index * indexMult));
    }
    }

    public String formatTime(final int milliseconds) {
    final long t_seconds = milliseconds / 1000;
    final long t_minutes = t_seconds / 60;
    final long t_hours = t_minutes / 60;
    final int seconds = (int) (t_seconds % 60);
    final int minutes = (int) (t_minutes % 60);
    final int hours = (int) (t_hours % 60);
    return (nf.format(hours) + ":" + nf.format(minutes) + ":" + nf.format(seconds));
    }

    public class MouseWatcher implements Runnable {

    Rectangle rect = null;

    MouseWatcher(final Rectangle rect) {
    this.rect = rect;
    }

    public void run() {
    Point mouse = new Point(Bot.getClient().getMouse().x, Bot.getClient().getMouse().y);
    while (rect.contains(mouse)) {
    try {
    mouse = new Point(Bot.getClient().getMouse().x, Bot.getClient().getMouse().y);
    Thread.sleep(50);
    } catch(Exception e) { }
    }
    }

    }

    }

    public class AntiBan implements Runnable {
    public boolean stopThread;

    public void run() {
    Random random = new Random();
    while (!stopThread) {
    try {
    if (random.nextInt(Math.abs(15 - 0)) == 0) {
    final char[] LR = new char[] { KeyEvent.VK_LEFT,
    KeyEvent.VK_RIGHT };
    final char[] UD = new char[] { KeyEvent.VK_DOWN,
    KeyEvent.VK_UP };
    final char[] LRUD = new char[] { KeyEvent.VK_LEFT,
    KeyEvent.VK_RIGHT, KeyEvent.VK_UP, KeyEvent.VK_UP };
    final int random2 = random.nextInt(Math.abs(2 - 0));
    final int random1 = random.nextInt(Math.abs(2 - 0));
    final int random4 = random.nextInt(Math.abs(4 - 0));

    if (random.nextInt(Math.abs(3 - 0)) == 0) {
    Bot.getInputManager().pressKey(LR[random1]);
    Thread.sleep(random.nextInt(Math.abs(400 - 100)));
    Bot.getInputManager().pressKey(UD[random2]);
    Thread.sleep(random.nextInt(Math.abs(600 - 300)));
    Bot.getInputManager().releaseKey(UD[random2]);
    Thread.sleep(random.nextInt(Math.abs(400 - 100)));
    Bot.getInputManager().releaseKey(LR[random1]);
    } else {
    Bot.getInputManager().pressKey(LRUD[random4]);
    if (random4 > 1) {
    Thread.sleep(random.nextInt(Math.abs(600 - 300)));
    } else {
    Thread.sleep(random.nextInt(Math.abs(900 - 500)));
    }
    Bot.getInputManager().releaseKey(LRUD[random4]);
    }
    } else {
    Thread.sleep(random.nextInt(Math.abs(2000 - 200)));
    }
    } catch (Exception e) {
    System.out.println("AntiBan error detected!");
    }
    }
    }
    }






    public void onFinish() {
    Antiban.stopThread = true;
    log("Thank you, For using my Script V2.6");
    log("Please post feedback/proggies and any advice Thankyou");
    log("You have mined "+OresMined+" And gained " +TotalXp+" XP");
    }
    }

      Current date/time is Thu Mar 28, 2024 10:02 am