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 java.awt.Point;
- import java.awt.Rectangle;
- import java.awt.event.KeyEvent;
- import java.awt.event.MouseEvent;
- import java.awt.event.MouseListener;
- 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.util.Timer;
- import org.rsbot.script.wrappers.RSObject;
- @ScriptManifest(
- authors = ("3G_Connection"),
- version = 0.01,
- keywords = {"Powermining, Iron, Rimmington" },
- description = "Powermines Iron in Rimmington, By 3G_Connection",
- name = "IronPowerMiner"
- )
- public class IronPowerMiner extends Script implements PaintListener, MessageListener, MouseListener {
- private int oreID = 440;
- private int[] rockID = {9718, 9717};
- private int miningAnimation = 625;
- long startTime;
- public boolean showPaint = true;
- public int startLvl;
- public int expGained;
- public int startExp;
- public int oresMined;
- public int lvlsGained;
- public int currentLvl;
- int expPH = (int) (expGained * 3600000D / (System.currentTimeMillis() - startTime));
- final int oresPH = (int) (oresMined * 3600000D / (System.currentTimeMillis() - startTime));
- public boolean onStart() {
- log("Thank you for using IronPowerMiner, by 3G_Connection");
- mouse.setSpeed(random(3, 7));
- startTime = System.currentTimeMillis();
- startExp = skills.getCurrentExp(Skills.MINING);
- currentLvl = skills.getCurrentExp(Skills.MINING);
- return true;
- }
- @Override
- public int loop() {
- RSObject rock = objects.getNearest(rockID);
- if(getMyPlayer().getAnimation() !=miningAnimation) {
- rock.interact("Mine");
- dropOre();
- if(random(1, 15) == 7) antiBan();
- return 10;
- }
- return 10;
- }
- public void onFinish() {
- log("You gained: " + expGained + "xp, thanks for using my script.");
- }
- private void dropOre() {
- if (inventory.getCount(oreID) >= 2) {
- }
- }
- //START: Code generated using Enfilade's Easel
- private final Color color1 = new Color(51, 0, 51);
- private final Color color2 = new Color(0, 0, 0);
- private final Color color3 = new Color(255, 255, 255);
- private final Color color4 = new Color(102, 0, 0);
- private final Color color5 = new Color(0, 204, 0);
- private final BasicStroke stroke1 = new BasicStroke(20);
- private final BasicStroke stroke2 = new BasicStroke(1);
- private final Font font1 = new Font("Chalkboard", 1, 32);
- private final Font font2 = new Font("Chalkboard", 1, 20);
- private final Font font3 = new Font("Chalkboard", 1, 15);
- private final Font font4 = new Font("Chalkboard", 1, 12);
- //END: Code generated using Enfilade's Easel
- /*
- * ===== PAINT =====
- */
- @Override
- public void onRepaint(Graphics g) {
- expGained = skills.getCurrentExp(Skills.MINING) - startExp;
- lvlsGained = skills.getCurrentLevel(Skills.MINING) - startLvl;
- Graphics2D g1 = (Graphics2D)g;
- final int PercentBar = (int) (skills.getPercentToNextLevel(Skills.MINING)*4.2);
- g1.setColor(color1);
- g1.fillRect(14, 352, 490, 114);
- g1.setColor(color2);
- g1.setStroke(stroke1);
- g1.drawRect(14, 352, 490, 114);
- g1.drawRect(274, 292, 230, 59);
- g1.setColor(color1);
- g1.fillRect(284, 302, 210, 61);
- g1.setFont(font1);
- g1.setColor(color3);
- g1.drawString("IronPowerMiner", 29, 391);
- g1.setFont(font2);
- g1.drawString("By 3G_Connection", 29, 421);
- g1.setFont(font3);
- g1.drawString("Runtime: " + Timer.format(System.currentTimeMillis() - startTime), 290, 320);
- g1.drawString("Exp Gained: " + expGained, 289, 345);
- g1.drawString("Exp Gained/h: " + " (" + (int) expPH + ")", 290, 370);
- g1.drawString("Ores Mined: " + oresMined, 290, 395);
- g1.drawString("Ores Mined/h: " + (int) oresPH , 290, 420);
- g1.drawString("Current Level: " + currentLvl + " (" + lvlsGained + ")", 290, 445);
- g1.setFont(font4);
- g1.drawString("Show/Hide Paint", 415, 470);
- g1.setColor(color4);
- g1.fillRoundRect(4, 282, 259, 58, 16, 16);
- g1.setColor(color2);
- g1.setStroke(stroke2);
- g1.drawRoundRect(4, 282, 259, 58, 16, 16);
- g1.setColor(color5);
- g1.fillRoundRect(3, 282, PercentBar, 58, 16, 16);
- }
- @Override
- public void messageReceived(MessageEvent e) {
- String txt = e.getMessage();
- if(txt.contains("You manage to mine")) {
- oresMined++;
- }
- }
- public void antiBan() {
- int r = random(1, 6);
- int a = random(1, 5);
- int b = random(5, 10);
- int j[] = {100, 500, 1000};
- int t = random(0, 3);
- switch (r) {
- case 1:
- if (r == a) {
- if (t == 0) {
- antiBan();
- } else {
- antiBan();
- }
- }
- sleep(random(a*j[t], b*j[t]));
- break;
- case 2:
- antiBan();
- break;
- case 3:
- if (r == a) {
- if (t == 0) {
- antiBan();
- } else {
- antiBan();
- }
- }
- sleep(random(a*j[t], b*j[t]));
- break;
- case 4:
- antiBan();
- break;
- case 5:
- if (r == a) {
- if (t == 0) {
- antiBan();
- } else {
- antiBan();
- }
- }
- sleep(random(a*j[t], b*j[t]));
- break;
- }
- }
- public void antiBan1()
- {
- if(getMyPlayer().getAnimation() != -1 && !getMyPlayer().isMoving())
- {
- try {
- switch (random(1,10))
- {
- case 1:
- log("{ANTIBAN} Changing camera pitch");
- int startingPitch = camera.getPitch();
- camera.setPitch(random(20, 100));
- log("Changed pitch from " + startingPitch + " to " + camera.getPitch());
- break;
- case 2:
- log("{ANTIBAN} Changing camera angle");
- int starting = camera.getAngle();
- camera.setAngle(random(camera.getAngle()-10,camera.getAngle()+10));
- log("Changed camera angle from " + starting + " to " + camera.getAngle());
- break;
- case 3:
- log("{ANTIBAN} Changing camera pitch");
- int startingPitch2 = camera.getPitch();
- camera.setPitch(random(camera.getPitch()-15, camera.getPitch()+25));
- log("Changed pitch from " + startingPitch2 + " to " + camera.getPitch());
- break;
- case 4:
- log("{ANTIBAN} Moving camera randomly");
- camera.moveRandomly(3000);
- break;
- case 5:
- log("{ANTIBAN} Changing camera angle (Single direction)");
- sleep(200, 300);
- int startingAngle = camera.getAngle();
- int randomAntiban = random(1,4);
- if(randomAntiban == 1)
- {
- keyboard.pressKey((char) KeyEvent.VK_LEFT);
- sleep(random(400,1100));
- keyboard.releaseKey((char) KeyEvent.VK_LEFT);
- }
- else if(randomAntiban == 2)
- {
- keyboard.pressKey((char) KeyEvent.VK_RIGHT);
- sleep(random(400,1100));
- keyboard.releaseKey((char) KeyEvent.VK_RIGHT);
- }
- else if(randomAntiban == 3)
- {
- keyboard.pressKey((char) KeyEvent.VK_UP);
- sleep(random(400,1100));
- keyboard.releaseKey((char) KeyEvent.VK_UP);
- }
- else if(randomAntiban == 4)
- {
- keyboard.pressKey((char) KeyEvent.VK_DOWN);
- sleep(random(400,1100));
- keyboard.releaseKey((char) KeyEvent.VK_DOWN);
- }
- log("Changed camera angle from " + startingAngle + " to " + camera.getAngle());
- break;
- case 6:
- log("{ANTIBAN} Moving mouse slightly");
- Point mouseLocation = mouse.getLocation();
- mouse.moveSlightly();
- log("Moved mouse from " + "(" + mouseLocation.x +"," + mouseLocation.y + ") to" +
- "(" + mouse.getLocation().x +"," + mouse.getLocation().y + ")");
- break;
- case 7:
- log("{ANTIBAN} Moving mouse offscreen");
- mouse.moveOffScreen();
- break;
- case 10:
- log("{ANTIBAN} Changing camera angle (Multi direction)");
- sleep(200, 300);
- int startingAngle2 = camera.getAngle();
- int randomAntiban2 = random(1,4);
- int random2nd = random(1,2);
- if(randomAntiban2 == 1)
- {
- keyboard.pressKey((char) KeyEvent.VK_LEFT);
- if(random2nd==1)
- {
- keyboard.pressKey((char) KeyEvent.VK_DOWN);
- }
- else
- {
- keyboard.pressKey((char) KeyEvent.VK_UP);
- }
- sleep(random(400,1000));
- keyboard.releaseKey((char) KeyEvent.VK_LEFT);
- if(random2nd==1)
- {
- keyboard.releaseKey((char) KeyEvent.VK_DOWN);
- }
- else
- {
- keyboard.releaseKey((char) KeyEvent.VK_UP);
- }
- }
- else if(randomAntiban2 == 2)
- {
- keyboard.pressKey((char) KeyEvent.VK_RIGHT);
- if(random2nd==1)
- {
- keyboard.pressKey((char) KeyEvent.VK_DOWN);
- }
- else
- {
- keyboard.pressKey((char) KeyEvent.VK_UP);
- }
- sleep(random(500,1100));
- keyboard.releaseKey((char) KeyEvent.VK_RIGHT);
- if(random2nd==1)
- {
- keyboard.releaseKey((char) KeyEvent.VK_DOWN);
- }
- else
- {
- keyboard.releaseKey((char) KeyEvent.VK_UP);
- }
- }
- log("Changed camera angle from " + startingAngle2 + " to " + camera.getAngle());
- break;
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
- public void mouseClicked(MouseEvent e) {
- Point a = e.getPoint();
- Rectangle area = new Rectangle(415, 470, 100, 15);
- if (area.contains(a) && showPaint == true) {
- showPaint = false;
- } else{
- showPaint = true;
- }
- }
- @Override
- public void mouseEntered(MouseEvent e) {
- }
- @Override
- public void mouseExited(MouseEvent e) {
- }
- @Override
- public void mousePressed(MouseEvent e) {
- }
- @Override
- public void mouseReleased(MouseEvent e) {
- }
- }
Add Comment
Please, Sign In to add comment