Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BasicStroke;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- 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;
- @ScriptManifest(authors = { "clScripts" }, keywords = "mining", name = "clPowerMiner", version = 1.0, description = "Power Mines Tin & Copper. First Script!")
- public class clPowerMiner extends Script implements PaintListener, MessageListener {
- ScriptManifest props = getClass().getAnnotation(ScriptManifest.class);
- int[] rockID ={3245, 3038, 3229, 3027 };
- int miningAnimation = 628;
- int pickaxe = 1271;
- int oresMined = 0;
- long startTime;
- int expGained = 0;
- int startExp = 0;
- private int levelsGained;
- public boolean onStart(){
- log("Welcome! Have fun botting!");
- log("You are using version " + props.version());
- startTime = System.currentTimeMillis();
- startExp = skills.getCurrentExp(Skills.MINING);
- return true;
- }
- @Override
- public int loop() {
- if(atSite()){
- minerock();
- if(inventory.isFull()){
- inventory.dropAllExcept(pickaxe);
- }
- }
- return random(1500, 2000);
- }
- public void onFinish() {
- log("Thank you for using cPowerMiner!");
- }
- private boolean atSite() {
- RSObject rock = objects.getNearest(rockID);
- if(rock != null){
- if(rock.isOnScreen()){
- if(random(1, 15) ==4)antiBan();
- return true;
- }
- }
- return false;
- }
- private void minerock(){
- RSObject rock = objects.getNearest(rockID);
- if(getMyPlayer().getAnimation() != miningAnimation)
- rock.doAction("Mine");
- sleep(1000, 2000 );
- if(random(1, 16) ==8)antiBan();
- }
- @Override
- public void onRepaint(Graphics g){
- g.setColor(Color.ORANGE);
- g.drawLine(mouse.getLocation().x - 6, mouse.getLocation().y, mouse.getLocation().x + 6,
- mouse.getLocation().y);
- g.drawLine(mouse.getLocation().x, mouse.getLocation().y - 6,mouse.getLocation().x,mouse.getLocation().y + 6);
- g.setColor(Color.GREEN);
- g.drawLine(mouse.getPressLocation().x - 6, mouse.getPressLocation().y, mouse.getPressLocation().x + 6, mouse.getPressLocation().y);
- g.drawLine(mouse.getPressLocation().x, mouse.getPressLocation().y - 6, mouse.getPressLocation().x, mouse.getPressLocation().y + 6);
- //START: Code generated using Enfilade's Easel
- final Color color1 = new Color(0, 0, 204, 207);
- final Color color2 = new Color(0, 0, 0);
- final Color color3 = new Color(102, 0, 102);
- final Color color4 = new Color(255, 0, 0, 225);
- final BasicStroke stroke1 = new BasicStroke(1);
- final Font font1 = new Font("Rockwell Condensed", 1, 22);
- final Font font2 = new Font("SansSerif", 1, 18);
- //END: Code generated using Enfilade's Easel
- expGained = skills.getCurrentExp(Skills.MINING) - startExp;
- 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;
- g.setColor(Color.cyan);
- g.setFont(new Font("Arial", 5, 17));
- float xpsec = 0;
- if((minutes > 0 || hours > 0 || seconds > 0) && expGained > 0) {
- xpsec = ((float) expGained)/(seconds + (minutes*60) + (hours*60*60));
- }
- float xpmin = xpsec * 60;
- float xphour = xpmin * 60;
- float oresec = 0;
- if((minutes > 0 || hours > 0 || seconds > 0) && oresMined > 0) {
- oresec = ((float) oresMined)/(seconds + (minutes*60) + (hours*60*60));
- }
- float oremin = oresec * 60;
- float orehour = oremin * 60;
- Graphics2D g11 = (Graphics2D)g;
- g11.setColor(color1);
- g11.fillRect(61, 346, 433, 125);
- g11.setColor(color2);
- g11.setStroke(stroke1);
- g11.drawRect(61, 346, 433, 125);
- g11.setFont(font1);
- g11.setColor(color3);
- g11.drawString("clPowerMiner Version" + props.version(), 259, 367);
- g11.setFont(font2);
- g11.setColor(color4);
- g11.drawString("Runtime:"+ hours + ":" + minutes + ":" + seconds, 69, 393);
- g11.drawString("Experience gained:" + expGained + " Exp/h: " + (int)xphour, 69, 412);
- g11.drawString("Ores mined:" + oresMined + " Ores/h: " + (int)orehour, 69, 433);
- g11.drawString("Levels gained:" + levelsGained , 69, 452 );
- }
- @Override
- public void messageReceived(MessageEvent e) {
- String txt = e.getMessage();
- if(txt.contains("You manage to mine")){
- oresMined++;
- }
- if(txt.contains("You've just advanced a Mining" )){
- levelsGained++;
- log("You have advanced a level thanks to clPowerMiner!");
- }
- }
- public void antiBan() {
- int b = random(0, 30);
- switch(b) {
- case 3:
- mouse.moveSlightly();
- sleep(500, 800);
- break;
- case 7:
- mouse.moveRandomly(10, 50);
- sleep(1500);
- break;
- case 16:
- mouse.moveOffScreen();
- sleep(2000);
- break;
- case 18:
- camera.moveRandomly(random(750, 1250));
- break;
- case 9: camera.setNorth();
- break;
- case 20:
- camera.moveRandomly(1564);
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement