Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import org.rsbot.event.events.MessageEvent;
- import org.rsbot.event.listeners.MessageListener;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.Skills;
- import org.rsbot.script.wrappers.RSObject;
- import org.rsbot.script.wrappers.RSTile;
- import org.rsbot.script.wrappers.RSTilePath;
- @ScriptManifest(
- authors = {"Jakebobjo"},
- name = "LegendMiner",
- version = 1.0,
- description = "LegendMiner, by Jakebobjo.",
- keywords = {"Miner", "PwrLvl"})
- public class LegendMiner extends Script implements PaintListener, MessageListener {
- int boothID = 11402;
- int[] pickaxeID = {1265, 1267, 1269, 1273, 1271, 1275, 15259};
- int[] oreID = {11959, 11957, 11058};
- RSTile[] tilesToBank = {new RSTile(3182, 3376), new RSTile(3176, 3187),
- new RSTile(3169, 3399), new RSTile(3168, 3411), new RSTile(3169, 3423), new RSTile(3178, 3429),
- new RSTile(3183, 3438)};
- RSTilePath pathToBank;
- //Paint Variables
- public long startTime = 0;
- public long millis = 0;
- public long hours = 0;
- public long minutes = 0;
- public long seconds = 0;
- public long last = 0;
- public int oresMined = 0;
- public int oresHour = 0;
- public int startExp = 0;
- public int expGained = 0;
- public int expHour = 0;
- public int expTNL = 0;
- public int currLevel;
- public int startLevel;
- public int lvlsGained;
- private int percentTNL;
- private int tinPrice;
- private int profitHour;
- private int profitGained;
- public float sXP = 0;
- public float mXP = 0;
- public float hXP = 0;
- long STL;
- long MTL;
- long HTL;
- public boolean onStart() {
- pathToBank = walking.newTilePath(tilesToBank);
- startTime = System.currentTimeMillis();
- startExp = skills.getCurrentExp(Skills.MINING);
- startLevel = skills.getCurrentLevel(Skills.MINING);
- tinPrice = grandExchange.lookup(438).getGuidePrice();
- return true;
- }
- public int loop() {
- if(inventory.isFull()){
- if(atBank()){
- doBank();
- } else {
- walk();
- }
- } else {
- if(atMine()){
- mineOres();
- } else {
- walkR();
- }
- }
- return random(600, 800);
- }
- private void mineOres() {
- RSObject rock = objects.getNearest(oreID);
- if(getMyPlayer().getAnimation() != 625){
- rock.doAction("Mine");
- }
- sleep(1200, 1500);
- }
- public void messageReceived(MessageEvent e) {
- String x = e.getMessage().toLowerCase();
- if (x.contains("manage to mine")) {
- oresMined++;
- }
- }
- private void walkR() {
- pathToBank.reverse();
- pathToBank.traverse();
- pathToBank.reverse();
- }
- private void walk(){
- pathToBank.traverse();
- }
- public void onFinish() {
- }
- public void doBank(){
- if(bank.isOpen()){
- bank.depositAllExcept(pickaxeID);
- sleep(800, 1200);
- } else {
- bank.open();
- sleep(1800, 2200);
- }
- }
- private boolean atBank(){
- RSObject bank = objects.getNearest(boothID);
- if(bank != null){
- if(bank.isOnScreen()){
- return true;
- }
- }
- return false;
- }
- private boolean atMine(){
- RSObject ore = objects.getNearest(oreID);
- if(ore != null){
- if(ore.isOnScreen()){
- return true;
- }
- }
- return false;
- }
- //START: Code generated using Enfilade's Easel
- private final RenderingHints antialiasing = new RenderingHints(
- RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- private final Color color1 = new Color(204, 204, 204, 184);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(0, 153, 153);
- private final Color color4 = new Color(255, 0, 0);
- private final Color color5 = new Color(102, 255, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial Black", 0, 15);
- private final Font font2 = new Font("Arial", 1, 15);
- //END: Code generated using Enfilade's Easel
- /*
- * ----- PAINT -----
- */
- @Override
- public void onRepaint(Graphics g) {
- expGained = skills.getCurrentExp(skills.MINING) - startExp;
- expHour = (int) ((expGained) * 3600000D / (System.currentTimeMillis() - startTime));
- profitHour = (int) ((profitGained) * 3600000D / (System.currentTimeMillis() - startTime));
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- currLevel = skills.getCurrentLevel(skills.MINING);
- lvlsGained = currLevel - startLevel;
- profitGained = oresMined*tinPrice;
- final int percentBar = (int) (skills.getPercentToNextLevel(skills.MINING)*3.02);
- percentTNL = skills.getPercentToNextLevel(skills.MINING);
- expTNL = skills.getExpToNextLevel(skills.MINING);
- if ((minutes > 0 || hours > 0 || seconds > 0) && expGained > 0) {
- sXP = (float) expGained
- / (float) (seconds + minutes * 60 + hours * 60 * 60);
- }
- mXP = sXP * 60;
- hXP = mXP * 60;
- if (sXP > 0) {
- STL = (int) (expTNL / sXP);
- }
- if (STL >= 60) {
- MTL = STL / 60;
- STL -= MTL * 60;
- } else {
- MTL = 0;
- }
- if (MTL >= 60) {
- HTL = MTL / 60;
- MTL -= HTL * 60;
- } else {
- HTL = 0;
- }
- if(oresMined == 0){
- oresHour = 0;
- }else{
- oresHour = (int) ((oresMined) * 3600000D / (System.currentTimeMillis() - startTime));
- }
- //Paint
- Graphics2D g1 = (Graphics2D)g;
- g1.setRenderingHints(antialiasing);
- //Percent Bar
- g.setColor(color4);
- g.fillRoundRect(13, 25, 493, 17, 16, 16);
- g.setColor(color2);
- g.drawRoundRect(13, 25, 493, 17, 16, 16);
- g.setColor(color5);
- g.fillRoundRect(13, 25, percentBar, 17, 16, 16);
- g.setColor(color2);
- g.drawRoundRect(13, 25, percentBar, 17, 16, 16);
- //Main Paint
- g1.setColor(color1);
- g1.fillRect(8, 346, 501, 125);
- g1.setColor(color2);
- g1.setStroke(stroke1);
- g1.drawRect(8, 346, 501, 125);
- g1.setFont(font1);
- g1.setColor(color3);
- g1.drawString("LEGENDMINER V1.0", 17, 365);
- g1.setColor(color2);
- g1.drawString("LEGENDMINER V1.0", 15, 363);
- g1.setFont(font2);
- g1.drawString("Runetime: " + hours +":"+ minutes + ":" + seconds, 200, 364);
- g1.drawString("Exp TNL: " + skills.getExpToNextLevel(Skills.MINING), 360, 364);
- g1.drawString("Exp Gained: " + expGained + " Exp/h: " + expHour, 17, 388);
- g1.drawString("Ore Mined: " + oresMined + " Ore/h: " + oresHour, 17, 408);
- g1.drawString("Current Lvl: " + currLevel + " (" + lvlsGained + ")", 17, 428);
- g1.drawString("Time TNL: " + HTL + ":" + MTL + ":" + STL, 17, 448);
- g1.drawString("Profit Gained: " + profitGained + " Profit/h: " + profitHour, 17, 468);
- g1.drawString(percentTNL + "%", 475, 40);
- //Mouse
- g.setColor(Color.WHITE);
- g.drawLine(0, (int) (mouse.getLocation().getY()), 800, (int) (mouse.getLocation().getY()));
- g.drawLine((int) (mouse.getLocation().getX()), 0, (int) (mouse.getLocation().getX()), 800);
- g.setColor(Color.WHITE);
- g.drawLine(0, (int) (mouse.getLocation().getY()), 800, (int) (mouse.getLocation().getY()));
- g.drawLine((int) (mouse.getLocation().getX()), 0, (int) (mouse.getLocation().getX()), 800);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment