Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import com.rarebot.script.Script;
- import com.rarebot.script.ScriptManifest;
- import com.rarebot.script.wrappers.RSGroundItem;
- import com.rarebot.script.wrappers.RSTile;
- import com.rarebot.script.wrappers.RSNPC;
- import com.rarebot.script.wrappers.RSArea;
- import com.rarebot.script.wrappers.RSWeb;
- import com.rarebot.event.listeners.*;
- import java.awt.*;
- @ScriptManifest(name = "AshPicker", version = 1.0, description = "Looting ash at West Varrock bank", authors = "Plankmaker600")
- public class Looter extends Script implements PaintListener {
- public int gpMade;
- public int oakPrice;
- public int gpHour;
- public int pickHour;
- private static final int[] ash = { 592, 593 };
- private static final int BANKER_ID = 553;
- private int ASHES_LOOTED;
- private long startTime = System.currentTimeMillis();
- RSArea atBank = new RSArea(new RSTile(3177,3430), new RSTile(3196,3448));
- RSArea atSpot = new RSArea(new RSTile(3166,3426), new RSTile(3210,3432));
- RSTile bankTile = new RSTile(3185,3435);
- RSTile spotTile = new RSTile(3201,3429);
- RSWeb bankPath;
- RSWeb spotPath;
- public boolean onStart() {
- return true;
- }
- private void walkBank() {
- bankPath = web.getWeb(getMyPlayer().getLocation(), bankTile);
- bankPath.step();
- }
- private void walkSpot() {
- spotPath = web.getWeb(getMyPlayer().getLocation(), spotTile);
- spotPath.step();
- }
- private void loot() {
- RSGroundItem fish = groundItems.getNearest(ash);
- if(getMyPlayer().getAnimation() == -1) {
- if(fish != null) {
- Point p = fish.getPoint();
- if(fish.isOnScreen()) {
- mouse.move(p);
- mouse.click(true);
- sleep(1000);
- } else {
- walking.walkTileMM(fish.getLocation());
- }
- } else {
- sleep(1000);
- }
- }
- }
- private void bank() {
- RSNPC banker = npcs.getNearest(BANKER_ID);
- if(bank.isOpen()) {
- if(inventory.containsOneOf(ash)) {
- bank.depositAll();
- ASHES_LOOTED = ASHES_LOOTED +28;
- }
- sleep(2000);
- if(!inventory.containsOneOf(ash)) {
- bank.close();
- }
- } else {
- if(banker != null) {
- if(banker.isOnScreen()) {
- banker.interact("bank bank");
- sleep(1000, 2000);
- } else {
- walking.walkTileMM(banker.getLocation());
- sleep(500, 700);
- }
- }
- }
- }
- private void antiban() {
- switch(random(1,5)) {
- case 1:
- mouse.move(random(100, 700), random(100, 500));
- break;
- case 2:
- camera.setPitch(true);
- int angle = camera.getAngle() + random(-100, 100);
- if(angle < 0) {
- angle += 359;
- }
- if(angle > 359) {
- angle -= 359;
- }
- camera.setAngle(angle);
- break;
- case 5:
- int angle2 = camera.getAngle() + random(-40, 40);
- if(angle2 < 0) {
- angle2 += 359;
- }
- if(angle2 > 359) {
- angle2 -= 359;
- }
- camera.setAngle(angle2);
- break;
- }
- }
- @Override
- public int loop() {
- if(random(1,5) == 3) {
- antiban();
- }
- if(!walking.isRunEnabled() && walking.getEnergy() > 20) {
- walking.setRun(true);
- }
- if(!inventory.isFull()) {
- if(!atSpot.contains(getMyPlayer().getLocation())) {
- walkSpot();
- } else {
- loot();
- }
- } else {
- if(!atBank.contains(getMyPlayer().getLocation())) {
- walkBank();
- } else {
- bank();
- }
- }
- return(random(500,1000));
- }
- private final Color color1 = new Color(51, 102, 255, 154);
- private final Color color2 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Tahoma", 1, 16);
- private final Font font2 = new Font("Tahoma", 0, 12);
- public void onRepaint(Graphics g1) {
- Graphics2D g = (Graphics2D)g1;
- gpHour = (int) ((gpMade) * 3600000D/ (System.currentTimeMillis() - startTime));
- gpMade = 89 * ASHES_LOOTED;
- pickHour = (int) ((ASHES_LOOTED) * 3600000D/ (System.currentTimeMillis() - startTime));
- g.setFont(font1);
- g.drawString("AshLooter", 300, 25);
- g.setFont(font2);
- g.drawString("Run Time: " + getRuntime(), 300, 65);
- g.drawString("Ashes Banked: " + ASHES_LOOTED, 300, 80);
- g.drawString("Profit Per Hour:" + gpHour, 300, 95);
- g.drawString("Profit Gained:" + gpMade, 300, 110);
- g.drawString("Ashes Per Hour:" + pickHour, 300, 125);
- g.drawString("By Plankmaker600", 300, 145);
- }
- private String getRuntime() {
- try {
- 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;
- return ("" + (hours < 10 ? "0" : "") + hours + ":"
- + (minutes < 10 ? "0" : "") + minutes + ":"
- + (seconds < 10 ? "0" : "") + seconds + "");
- } catch (Exception e) {
- return "";
- }
- }
- }
Add Comment
Please, Sign In to add comment