Advertisement
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.awt.Image;
- import java.awt.Rectangle;
- import java.awt.Point;
- import java.awt.BasicStroke;
- import java.awt.Stroke;
- import java.io.IOException;
- import java.net.URL;
- import javax.imageio.ImageIO;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- import com.rarebot.event.events.MessageEvent;
- import com.rarebot.event.listeners.MessageListener;
- import com.rarebot.event.listeners.PaintListener;
- import com.rarebot.script.Script;
- import com.rarebot.script.ScriptManifest;
- import com.rarebot.script.wrappers.RSObject;
- import com.rarebot.script.wrappers.RSTile;
- import com.rarebot.script.wrappers.RSTilePath;
- import com.rarebot.script.wrappers.RSComponent;
- import com.rarebot.script.wrappers.RSInterface;
- import com.rarebot.script.methods.Skills;
- import com.rarebot.script.methods.Walking;
- import com.rarebot.script.wrappers.RSArea;
- import com.rarebot.script.wrappers.RSTile;
- @ScriptManifest(
- authors = {"Atomika"},
- version = 1.2,
- keywords = {"Mining", "resource", "Dungeon"},
- description = "Mines coal ores in lvl 15 resource dungeon and uses Desposit box!",
- name = "coalcrusherDungeonMiner(ergu)"
- )
- public class DungCoal extends Script implements PaintListener,MouseListener{
- /* coal IDs: 32428, 32427, 32426*/
- private final static int[] PICKAXE_ID = {1275, 1271, 1273, 1267, 1269};
- private final static int[] ORE_OBJECTS = {32428, 32427, 32426};
- private final static int[] COAL_OBJECTS = {32428, 32427, 32426};
- private final static int BOX_ID = 25937;
- private final static int IRON_ID = 447;
- private final static int COAL_ID = 453;
- private static final RSTile[] tilesToMine = {new RSTile(1049, 4574), new RSTile(1056, 4574), new RSTile(1063, 4573)};
- RSTilePath pathToBank;
- private final static RSTile[] BOX_LOL = {new RSTile(3034, 9772)};
- private final static RSTile[] HelpImLost = {new RSTile(1064, 4573), new RSTile(1058, 4573), new RSTile(1052, 4574), new RSTile(1047, 4577)};
- private final static int MINING_ANIMATION = -1;
- private long startTime;
- private int coalPrice = 0;
- private int oresMined;
- public String statusText;
- public String myName;
- public int oresHour = 0;
- public boolean showPaint = true ;
- RSTilePath BOX,REORIENT;
- int startExp = 0;
- int expGained = 0;
- int profit = 0;
- int profithour = 0;
- public boolean onStart()
- {
- statusText = "FUCKING INITIALIZING";
- if (!game.isLoggedIn())
- {
- log.severe("Try logging in first then restart the script!");
- stopScript();
- return false;
- }
- else
- {
- mouse.setSpeed(4);
- startTime = System.currentTimeMillis();
- startExp = skills.getCurrentExp(skills.MINING);
- coalPrice = 297;
- pathToBank = walking.newTilePath(tilesToMine);
- BOX = walking.newTilePath(BOX_LOL);
- REORIENT = walking.newTilePath(HelpImLost);
- log("Welcome to coalcrusherDungeonMiner by erguland!");
- log("Let's hope the script dont fuck up.");
- myName = account.getName();
- myName = myName.substring(0, 3);
- sleep(8000);
- if(checkJoin())
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- }
- public void mouseClicked(MouseEvent e)
- {
- RSComponent inter = interfaces.get(137).getComponent(0);
- if (inter.getArea().contains(e.getPoint())) {
- showPaint = !showPaint;
- }
- }
- private final Color color1 = new Color(51, 51, 51);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(0, 153, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Arial", 0, 19);
- public void walk() {
- pathToBank.traverse();
- }
- public void onRepaint(Graphics g) {
- 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;
- float oresMined = expGained / 50;
- float oresHour = (int) ((oresMined) * 3600000D / (System.currentTimeMillis() - startTime));
- float profit = oresMined * coalPrice;
- profithour = (int) ((profit) * 3600000D/ (System.currentTimeMillis() - startTime));
- float xpsec = 0;
- if ((minutes > 0 || hours > 0 || seconds > 0) && expGained > 0) {
- xpsec = ((float) expGained) / (float)(seconds + (minutes*60) + (hours*60*60));
- }
- float xpmin = xpsec * 60;
- float xphour = xpmin * 60;
- float expGained = skills.getCurrentExp(skills.MINING) - startExp;
- g.setFont(new Font("Arial", 0, 15));
- g.setColor(color1);
- g.fillRoundRect(549, 208, 190, 254, 16, 16);
- g.setColor(color2);
- g.drawRoundRect(549, 208, 190, 254, 16, 16);
- g.setFont(new Font("Arial", 0, 15));
- g.setColor(Color.CYAN);
- g.drawString("Mining skillcape almost here:P", 260, 470);
- g.drawString(statusText, 562, 226);
- g.drawString("Runtime: " + hours + ":" + minutes + ":" + seconds, 562, 246);
- g.drawString("Experience gained: " + expGained, 562, 266);
- g.drawString("Exp/h: " + (int)xphour, 562, 286);
- g.drawString("Ores mined: " + oresMined , 562, 306);
- g.drawString("ores mined/h: " + oresHour , 562, 326);
- g.drawString("Profit: " + profit, 562, 346);
- g.drawString("profit/h: " + (int)profithour, 562, 366);
- }
- private void setRun()
- {
- if (!walking.isRunEnabled() && walking.getEnergy() > 40)
- {
- statusText = "FUCKING RUNNING";
- walking.setRun(true);
- sleep(random(600, 800));
- return;
- }
- }
- public void checkIntercept()
- {
- RSInterface chatBox = interfaces.get(137);
- if(chatBox != null)
- {
- for(int x = 180; x < 240; x++)
- {
- if(chatBox.getComponent(x) != null && chatBox.getComponent(x).getAbsoluteY() > 330)
- {
- String curCompText = chatBox.getComponent(x).getText();
- if(curCompText.contains("Does your house have stairs") && (!(curCompText.contains(myName))))
- {
- keyboard.sendText("|||", true);
- sleep(2000);
- }
- }
- }
- }
- }
- public boolean checkJoin()
- {
- RSInterface chatBox = interfaces.get(137);
- if(chatBox != null)
- {
- for(int x = 180; x < 280; x++)
- {
- if(chatBox.getComponent(x) != null && chatBox.getComponent(x).getAbsoluteY() > 330)
- {
- String curCompText = chatBox.getComponent(x).getText();
- if(curCompText.contains("|||"))
- {
- log.severe("This mine already has a bot running in it. Switch to another world.");
- return false;
- }
- }
- }
- return true;
- }
- return true;
- }
- private final void openBox()
- {
- RSObject box = objects.getNearest(BOX_ID);
- if(!box.isOnScreen() && box != null)
- {
- camera.turnTo(box);
- camera.setPitch(10);
- }
- else
- {
- if(box.isOnScreen() && box != null)
- {
- box.interact("Deposit");
- sleep(2000, 2500);
- }
- }
- }
- private void goToBox()
- {
- BOX.traverse();
- }
- private final void gobackplease()
- {
- REORIENT.traverse();
- sleep(2000, 2500);
- }
- private final void depositOres()
- {
- mouse.move(330, 261, 3, 3);
- mouse.click(true);
- sleep(800, 1200);
- }
- private final boolean atBox()
- {
- RSObject boxy = objects.getNearest(BOX_ID);
- if(boxy != null) {
- if(boxy.isOnScreen()) {
- return true;
- } else {
- camera.turnTo(boxy);
- return false;
- }
- }
- return false;
- }
- private final void mine()
- {
- RSObject oremine = objects.getNearest(ORE_OBJECTS);
- if(getMyPlayer().getAnimation() == MINING_ANIMATION && oremine != null)
- {
- statusText = "RUNNIN TO THE ORE";
- oremine.interact("Mine");
- }
- else
- {
- statusText = "FUCKING MINING";
- objects.getNearest(ORE_OBJECTS);
- }
- sleep(1800,2000);
- }
- private final void minecoal()
- {
- RSObject oremine = objects.getNearest(COAL_OBJECTS);
- if(getMyPlayer().getAnimation() == MINING_ANIMATION && oremine != null)
- {
- statusText = "RUNNIN TO THE COAL";
- oremine.interact("Mine");
- }
- else
- {
- statusText = "MINING THE DAMN COAL";
- objects.getNearest(COAL_OBJECTS);
- }
- sleep(1800,2000);
- }
- public void do_Nothing()
- {
- sleep(random(10, 50));
- }
- private final boolean atOres()
- {
- RSObject ores = objects.getNearest(ORE_OBJECTS);
- if(ores != null)
- {
- if(ores.isOnScreen())
- {
- return true;
- }
- }
- return false;
- }
- @Override
- public int loop()
- {
- checkIntercept();
- antiban(); setRun();
- if(!atOres() && !inventory.isFull())
- {
- RSObject oreo = objects.getNearest(ORE_OBJECTS);
- if(oreo != null)
- {
- statusText = "SHEARCHING FOR ROCKS";
- camera.turnTo(oreo);
- camera.setPitch(100);
- sleep(random(800, 1000));
- walk();
- }
- else
- {
- RSObject coaly = objects.getNearest(COAL_OBJECTS);
- if(coaly != null)
- {
- camera.turnTo(coaly);
- camera.setPitch(100);
- minecoal();
- }
- else
- {
- statusText = "SHEARCHING FOR COAL";
- walk();
- camera.setPitch(100);
- sleep(random(800, 1000));
- }
- }
- }
- if(atOres() && !inventory.isFull())
- {
- mine();
- }
- if(inventory.isFull())
- {
- while(!atBox())
- {
- statusText = "SEARCHING FOR DEPOSIT BOX";
- gobackplease();
- sleep(random(500, 1000));
- }
- while(!bank.isDepositOpen())
- {
- goToBox();
- statusText = "OPENING DEPOSIT BOX";
- openBox();
- sleep(random(500, 1000));
- }
- statusText = "BANK THAT SHIT";
- bank.depositAll();
- sleep(random(500, 3000));
- bank.close();
- sleep(random(500, 2000));
- gobackplease();
- }
- if(combat.getLifePoints() < 60)
- {
- statusText = "FUCKING DEAD";
- log.severe("------------------------------------------------------------------------");
- log.severe("Hey, you're probably going to die--not that this script will do anything");
- log.severe("------------------------------------------------------------------------");
- stopScript();
- sleep(5000);
- }
- return 1;
- }
- public void antiban() {
- statusText = "FUCKING WITH THE ANTIBAN";
- int b = random(0, 10);
- switch (b) {
- case 1:
- if (random(0, 10) == 5) {
- log("[Antiban] move mouse");
- mouse.moveSlightly();
- sleep(200, 600);
- mouse.moveRandomly(150, 350);
- }
- break;
- case 2:
- if (random(0, 13) == 2) {
- log("[Antiban] Turn screen");
- camera.setAngle(random(30, 70));
- sleep(400, 1200);
- }
- break;
- case 3:
- if (random(0, 24) == 6) {
- log("[Antiban] mouse off screen");
- mouse.moveOffScreen();
- sleep(random(600, random(1200, 2000)));
- }
- break;
- case 4:
- if (random(0, 30) == 4) {
- log("[antiban] Setting camera pitch.");
- camera.setPitch(random(10, 99));
- sleep(2500, 3400);
- }
- break;
- case 5:
- if (random(0, 28) == 5) {
- log("[antiban] Checking Xp.");
- game.openTab(2);
- skills.doHover(Skills.INTERFACE_MINING);
- sleep(2000, 2200);
- }
- default:
- break;
- }
- }
- public void onFinish()
- {
- log("Nap time.");
- log("Ores mined " + oresMined);
- log("Experience gained: " + expGained);
- log("Profit: " + profit);
- }
- @Override
- public void mouseEntered(MouseEvent e) {
- // TODO Auto-generated method stub
- }
- @Override
- public void mouseExited(MouseEvent e) {
- // TODO Auto-generated method stub
- }
- @Override
- public void mousePressed(MouseEvent e) {
- // TODO Auto-generated method stub
- }
- @Override
- public void mouseReleased(MouseEvent e) {
- // TODO Auto-generated method stub
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement