All pastes #1929437 Raw Edit

VenzIron.java

public javascript v1 · immutable
#1929437 ·published 2010-08-30 22:29 UTC
rendered paste body
import java.awt.Color;import java.awt.Graphics;import java.util.Map; import org.rsbot.event.events.ServerMessageEvent;import org.rsbot.event.listeners.PaintListener;import org.rsbot.event.listeners.ServerMessageListener;import org.rsbot.script.Constants;import org.rsbot.script.Script;import org.rsbot.script.ScriptManifest;import org.rsbot.script.Skills;import org.rsbot.script.wrappers.RSObject; @ScriptManifest(authors = { "v3n0m96" }, category = "Mining", name = "VenzIron", version = 1.0, description = "start by any iron ore this powermines and drops everything v1.1 will keep gems! enjoi =3")public class VenzIron extends Script implements PaintListener, ServerMessageListener  {     int ironOre = 440;    int[] ironRock = { 2093, 2092, 9719, 9717, 9718, 11956,11955, 11954, 37307, 37308, 37309, 31072, 31073, 31071 };    public boolean paint;    public int miningAnimation = 626;    public int energy = random(11, 70);    int levelsGained = 0;    public int startexp;    int gem = 0;    int exp = 0;    int rocksMined = 0;    int[] gemID = { 1617, 1619, 1621, 1623 };    int[] pickaxe = { 1265, 1267, 1269, 1271, 1273, 1275, 1296, 13661 };    public static final int MINING_STAT = Skills.getStatIndex("Mining");    public long startTime = System.currentTimeMillis();    int startLVL = skills.getCurrentSkillLevel(Constants.STAT_MINING);    int nextLVL = skills.getXPToNextLevel(Constants.STAT_MINING);      public double getVersion() {        return 1.05;    }       public int loop() {         if(isInventoryFull()) {             dropAllExcept(pickaxe);             return 500;         }          RSObject iron = getNearestObjectByID(ironRock); if(iron == null) { return 500; } if (getMyPlayer().getAnimation() == -1) {atObject(iron, "Mine");} wait(random(500, 700)); return 0;        // TODO Loop       }      public void onFinish() {        log("Thank You for using VenzIron");        log("Levels Gained: " + levelsGained);        log("Rocks Mined: " + rocksMined);    }     public boolean onStart(Map<String, String> args) {         return true;    }     public void onRepaint(Graphics g) {        if (isLoggedIn()) {            int xpGained = 0;            if ( startexp == 0) {                 startexp = skills.getCurrentSkillExp(STAT_MINING);}            long millis = System.currentTimeMillis() - startTime;            long hours = millis / (1000 * 60 * 60);            millis -= hours * (1000 * 60 * 60);            long minutes = millis / (1000 * 60);            millis -= minutes * (1000 * 60);            long seconds = millis / 1000;            long minutes2 = minutes + (hours * 60);            g.setColor(Color.green);            g.drawString("VenzIron" , 9, 315);            g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds + "", 9, 299);            g.drawString("Rocks Mined: " + rocksMined, 9, 283);            g.drawString("Levels Gained: " + levelsGained, 9, 267);            g.drawString("Gems Found: " + gem, 9, 251);            g.drawString("XP Gained: " + exp, 9, 235);        }    }       @Override    public void serverMessageRecieved(ServerMessageEvent e) {        final String serverString = e.getMessage();        if (serverString.contains("You've just advanced")) {            levelsGained++;        }        if (serverString.contains("You manage to mine")) {            rocksMined++;            exp = exp + 35;        }        if (serverString.contains("you just found")) {            gem++;            exp = exp + 65;        // TODO Server Messages     }     } }