Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.util.Map;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.Constants;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.wrappers.RSObject;
- @ScriptManifest(authors = "Spyropt" , category = "Mining", name = "PowerCopper", version = 1.0, description = "Start On Varrock Eastern Mine with Pickaxe on Inventory." + "This will mine copper and drop it.")
- public class PowerCopper extends Script implements PaintListener {
- ScriptManifest properties = getClass().getAnnotation(ScriptManifest.class);
- String name = properties.name(); // Gets the name of the script
- double version = properties.version(); // Gets the version of the script.
- //Stuff for script
- public long startTime = System.currentTimeMillis();
- private String status = "";
- public int startexp;
- public int[] AllPickaxes = { 1275, 1271, 1273, 1269, 1267, 1265, 15269 };
- public int[] IronRocksID = new int[] {11960, 11962, 11961};
- @Override
- public boolean onStart(Map<String, String> args) {
- log(name + " has started!");
- status = "Initializing";
- startTime = System.currentTimeMillis();
- return true;
- }
- @Override
- public void onFinish() {
- log(name + " has finished!");
- }
- public boolean needToDrop() {
- status = "Dropping";
- return isInventoryFull();
- }
- public boolean atRocks() {
- RSObject rockObject = getNearestObjectByID(IronRocksID);
- if (rockObject == null) {
- return false;
- }
- return tileOnScreen(rockObject.getLocation());
- }
- public void onRepaint(Graphics g) {
- if (isLoggedIn()) {
- int xpGained = 0;
- if ( startexp == 0) {
- startexp = skills.getCurrentSkillExp(Constants.STAT_MINING);
- }
- // ty to speedwing
- xpGained = skills.getCurrentSkillExp(Constants.STAT_MINING) - startexp;
- // ty to speedwing
- 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.red);
- g.setFont(new Font("Cooper Black", Font.BOLD, 12));
- g.drawString("Time running: " + hours + ":" + minutes + ":" + seconds + "." , 9, 315);
- g.drawString("Status: " + status, 9, 299);
- g.drawString("XP Gained: " + xpGained, 9, 327);
- }
- }
- @Override
- public int loop() {
- if (getMyPlayer().isMoving()) {
- return random(400, 900);
- }
- if (getMyPlayer().getAnimation() != -1) {
- return random(400, 900);
- }
- if (needToDrop()) {
- dropAllExcept(AllPickaxes);
- return random(400, 900);
- }
- RSObject rockObject = getNearestObjectByID(IronRocksID);
- if (atRocks()) {
- if (getMyPlayer().getAnimation() == -1) {
- atObject(rockObject, "Mine");
- status = "Mining";
- }
- } else {
- walkTileMM(rockObject.getLocation(), 2, 2);
- } return random(400, 600);
- }
- }
Add Comment
Please, Sign In to add comment