Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import javax.imageio.ImageIO;
- import java.io.IOException;
- import java.net.URL;
- import org.rsbot.event.listeners.PaintListener;
- import org.rsbot.script.Script;
- import org.rsbot.script.ScriptManifest;
- import org.rsbot.script.methods.GrandExchange.GEItem;
- import org.rsbot.script.wrappers.*;
- @ScriptManifest(authors = {"Furion"}, keywords = {"money, make, maker, furion"}, name = "Furion's Guild Looter", description = "Loots valuable things from the cooking guild.", version = 1.0)
- public class FurionsGuildLooter extends Script implements PaintListener {
- int chocolateID = 1973;
- int appleID = 1955;
- int grapesID = 1987;
- int doorID = 2712;
- int bankID = 782;
- int appleIndicationID = 24212;
- int grapesIndicationID = 24067;
- int runEnergy = random(55, 100);
- int stairsID[] = { 24073, 24074, 24075 };
- int chocolatePrice;
- int applesPrice;
- int grapesPrice;
- int chocolatePicked;
- int applesPicked;
- int grapesPicked;
- int chocoInInv;
- int applesInInv;
- int grapesInInv;
- int lootPerHour;
- boolean grapesCollected = false;
- boolean applesCollected = false;
- int collected = 0;
- long millis = 0;
- long hours = 0;
- long minutes = 0;
- long seconds = 0;
- long startTime = 0;
- long nextRun;
- String botStatus = "null";
- GEItem chocolate;
- GEItem grapes;
- GEItem apples;
- RSTile bankTile = new RSTile(3185, 3442);
- RSTile guildTile = new RSTile(3143, 3443);
- RSTile guildTile2 = new RSTile(3143, 3445);
- RSTile chocolatePickUp = new RSTile(3143, 3453);
- RSTile chocolatePickUpID = new RSTile(3143, 3452);
- RSTile applePickUp = new RSTile(3140, 3447, 1);
- RSTile applePickUp2 = new RSTile(3141, 3447, 1);
- RSTile applePickUp3 = new RSTile(3141, 3447, 2);
- RSTile applePickUpID = new RSTile(3141, 3448, 1);
- RSTile applePickUpID2 = new RSTile(3141, 3446, 2);
- RSTile grapesPickUp = new RSTile(3144, 3450, 2);
- RSTile grapesPickUpID = new RSTile(3143, 3450);
- RSArea doorArea = new RSArea(new RSTile(3136, 3443), new RSTile(3148, 3438));
- RSArea chocolateArea = new RSArea(new RSTile(3140, 3444), new RSTile(3144,3453));
- RSArea bankArea = new RSArea(new RSTile(3178, 3447), new RSTile(3195, 3431));
- //RSArea appleArea = new RSArea(new RSTile(3148, 3152, 1), new RSTile(3138, 3446, 1));
- //RSArea grapesArea = new RSArea(new RSTile(3146, 3446, 2), new RSTile(3138,3454, 2));
- private enum lootingStates {walkToGuild, collectChocolate, collectApples, collectGrapes, leaveGuild, walkToBank, bankLoot, unknownState };
- public boolean onStart() {
- log("Loading Prices.. please wait.");
- chocolate = grandExchange.lookup(chocolateID);
- apples = grandExchange.lookup(appleID);
- grapes = grandExchange.lookup(grapesID);
- chocolatePrice = chocolate.getGuidePrice();
- applesPrice = apples.getGuidePrice();
- grapesPrice = grapes.getGuidePrice();
- startTime = System.currentTimeMillis();
- nextRun = System.currentTimeMillis();
- botStatus = "Initializing...";
- return true;
- }
- /*
- * For the script writer.
- * All I did to this script, is add three RSGroundItems.
- * added a null check to each of the three collecting states,
- * and check if they were on screen.
- * If they were on screen OR if the areas/indicators are right.
- */
- private lootingStates mainStates() {
- RSGroundItem Grape = groundItems.getNearest(grapesID);
- RSGroundItem Choco = groundItems.getNearest(chocolateID);
- RSGroundItem Apple = groundItems.getNearest(appleID);
- if (!inventory.isFull() && chocolateArea.contains(getMyPlayer().getLocation()) || !inventory.isFull() && Choco != null && Choco.isOnScreen() /* && !getMyPlayer().isMoving()*/) {
- botStatus = "Collecting chocolate...";
- return lootingStates.collectChocolate;
- }
- if (!inventory.isFull() && indicateApple() || !inventory.isFull() && Apple != null && Apple.isOnScreen()) {
- botStatus = "Collecting apples...";
- return lootingStates.collectApples;
- }
- if (!inventory.isFull() && indicateGrapes() || !inventory.isFull() && Grape != null && Grape.isOnScreen()) {
- botStatus = "Collecting grapes...";
- return lootingStates.collectGrapes;
- }
- if (inventory.isFull() && indicateApple() || inventory.isFull() && indicateGrapes()) {
- botStatus = "Leaving guild...";
- return lootingStates.leaveGuild;
- }
- if (doorArea.contains(getMyPlayer().getLocation()) && inventory.isFull()) {
- botStatus = "Walking to bank...";
- return lootingStates.walkToBank;
- }
- if (!chocolateArea.contains(getMyPlayer().getLocation()) && inventory.isFull() && !bankArea.contains(getMyPlayer().getLocation())) {
- botStatus = "Walking to bank...";
- return lootingStates.walkToBank;
- }
- if (inventory.isFull() && bankArea.contains(getMyPlayer().getLocation())) {
- botStatus = "Banking...";
- return lootingStates.bankLoot;
- } else if (!inventory.isFull()) {
- botStatus = "Walking to guild...";
- return lootingStates.walkToGuild;
- }
- if (!chocolateArea.contains(getMyPlayer().getLocation()) && !bankArea.contains(getMyPlayer().getLocation()) && !inventory.isFull()) {
- botStatus = "Walking to guild...";
- return lootingStates.walkToGuild;
- }
- botStatus = "null";
- return lootingStates.unknownState;
- }
- public boolean indicateApple() {
- RSObject appleIndicate = objects.getNearest(appleIndicationID);
- if(appleIndicate != null && appleIndicate.isOnScreen()) {
- return true;
- } else {
- return false;
- }
- }
- public boolean indicateGrapes() {
- RSObject grapesIndicate = objects.getNearest(grapesIndicationID);
- if(grapesIndicate != null && grapesIndicate.isOnScreen()) {
- return true;
- } else {
- return false;
- }
- }
- public void startRunning(final int energy) {
- if (nextRun < System.currentTimeMillis() && walking.getEnergy() >= energy && !walking.isRunEnabled()) {
- nextRun = System.currentTimeMillis() + 7000;
- runEnergy = random(40, 100);
- walking.setRun(true);
- sleep(random(400, 600));
- }
- }
- public void climbUp() {
- RSObject stairsObject = objects.getNearest(stairsID);
- camera.turnTo(stairsObject);
- stairsObject.interact("Climb-Up");
- sleep(random(400, 600));
- }
- public void climbDown() {
- RSObject stairsObject = objects.getNearest(stairsID);
- camera.turnTo(stairsObject);
- stairsObject.interact("Climb-Down");
- sleep(random(400, 600));
- }
- private void openBank() {
- RSObject bankObject = objects.getNearest(bankID);
- if (bankObject != null && bankObject.isOnScreen() && !getMyPlayer().isMoving()) {
- bank.open();
- sleep(random(350, 500));
- if (bank.isOpen()) {
- bank.depositAll();
- sleep(random(350, 500));
- bank.close();
- sleep(random(250, 400));
- }
- }
- }
- public void openDoor() {
- RSObject doorObject = objects.getNearest(doorID);
- if (doorObject != null && doorObject.isOnScreen() && !getMyPlayer().isMoving()) {
- camera.turnTo(doorObject);
- doorObject.interact("Open");
- sleep(random(1000, 1200));
- }
- }
- @Override
- public int loop() {
- if (game.isLoggedIn()) {
- if(inventory.isFull() && chocolateArea.contains(getMyPlayer().getLocation())) {
- walking.walkTo(guildTile2);
- sleep(random(350, 500));
- openDoor();
- sleep(random(350, 500));
- }
- if(!inventory.isFull() && doorArea.contains(getMyPlayer().getLocation())) {
- openDoor();
- sleep(random(350, 500));
- }
- switch (mainStates()) {
- case collectChocolate:
- RSGroundItem chocolateItem = groundItems.getNearest(chocolateID);
- if (chocolateItem != null && chocolateItem.isOnScreen() && !getMyPlayer().isMoving()) {
- camera.turnTo(chocolatePickUp);
- sleep(random(500, 1000));
- mouse.move(calc.tileToScreen(chocolatePickUp, -500));
- String[] actions = menu.getActions();
- for(String act : actions) {
- if(act.contains("Take")) {
- mouse.click(calc.tileToScreen(chocolateItem.getLocation(), -500), true);
- sleep(random(500, 550));
- if (chocoInInv < inventory.getCount(chocolateID)) {
- chocolatePicked++;
- }
- chocoInInv = inventory.getCount(chocolateID);
- }
- }
- } else {
- climbUp();
- sleep(random(1500, 2000));
- }
- return 50;
- case collectApples:
- // <editor-fold defaultstate="collapsed" desc="comment">
- // RSGroundItem appleItem = groundItems.getNearest(appleID);
- // if (appleItem != null && appleItem.isOnScreen() && !getMyPlayer().isMoving()) {
- // walking.walkTo(applePickUpID);
- // sleep(random(250, 500));
- // mouse.move(calc.tileToScreen(applePickUp, -500));
- // String[] actions = menu.getActions();
- // for(String act : actions) {
- // if(act.contains("Take")) {
- // mouse.click(calc.tileToScreen(appleItem.getLocation(), -500), true);
- // if (applesInInv < inventory.getCount(appleID)) {
- // applesPicked++;
- // }
- // applesInInv = inventory.getCount(appleID);
- // }
- // }
- // }
- // sleep(random(500, 1000));
- // if (appleItem != null && appleItem.isOnScreen() && !getMyPlayer().isMoving()) {
- // camera.turnTo(applePickUp2);
- // mouse.move(calc.tileToScreen(applePickUp2, -500));
- // String[] actions = menu.getActions();
- // for(String act : actions) {
- // if(act.contains("Take")) {
- // mouse.click(calc.tileToScreen(appleItem.getLocation(), -500), true);
- // if (applesInInv < inventory.getCount(appleID)) {
- // applesPicked++;
- // }
- // applesInInv = inventory.getCount(appleID);
- // }
- // }
- // } else {
- // climbUp();
- // sleep(random(1000, 2000));
- // }// </editor-fold>
- if (collectingApples()) {
- collectingApples();
- }
- return 50;
- case leaveGuild:
- if(inventory.isFull() && indicateGrapes()) {
- climbDown();
- sleep(random(1200, 2000));
- climbDown();
- sleep(random(1200, 2000));
- }
- if(inventory.isFull() && indicateApple()) {
- climbDown();
- sleep(random(1200, 2000));
- }
- if(inventory.isFull() && chocolateArea.contains(getMyPlayer().getLocation())) {
- openDoor();
- sleep(random(500, 550));
- }
- return 50;
- case walkToBank:
- final RSWeb walkBank = web.getWeb(getMyPlayer().getLocation(), bankTile);
- final RSObject bankBooth = objects.getNearest(bankID);
- if (walkBank != null) {
- if(!walkBank.finished()) {
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4) {
- try {
- walkBank.step();
- sleep(1000, 1200);
- while(getMyPlayer().isMoving()){
- sleep(1000, 1200);
- }
- } catch (Exception ignored) {
- sleep(300, 500);
- }
- }
- }
- if(calc.distanceTo(bankTile) >= 6){
- walking.walkTileMM(bankTile);
- sleep(random(350, 400));
- camera.turnTo(bankBooth);
- }
- }
- return 50;
- case walkToGuild:
- final RSWeb walkGuild = web.getWeb(getMyPlayer().getLocation(), guildTile);
- if (walkGuild != null) {
- if (!walkGuild.finished()) {
- if (!getMyPlayer().isMoving() || calc.distanceTo(walking.getDestination()) < 4) {
- try {
- walkGuild.step();
- sleep(1000, 1200);
- while(getMyPlayer().isMoving()){
- sleep(1000, 1200);
- }
- } catch (Exception ignored) {
- sleep(300, 500);
- }
- }
- }
- if(calc.distanceTo(guildTile) >= 6){
- walking.walkTileMM(guildTile);
- sleep(random(300, 350));
- }
- openDoor();
- sleep(random(500, 550));
- walking.walkTo(chocolatePickUpID);
- sleep(random(750, 800));
- }
- return 50;
- case bankLoot:
- openBank();
- sleep(random(1500, 2000));
- return 50;
- case collectGrapes:
- // <editor-fold defaultstate="collapsed" desc="comment">
- // RSGroundItem appleItem11 = groundItems.getNearest(appleID);
- // if (appleItem11 != null && appleItem11.isOnScreen() && !getMyPlayer().isMoving()) {
- // walking.walkTo(applePickUpID2);
- // sleep(random(350, 500));
- // camera.turnTo(applePickUp3);
- // sleep(random(500, 550));
- // mouse.move(calc.tileToScreen(applePickUp3, -500));
- // String[] actions = menu.getActions();
- // for(String act : actions) {
- // if(act.contains("Take")) {
- // mouse.click(calc.tileToScreen(appleItem11.getLocation(), -500), true);
- // if (grapesInInv < inventory.getCount(grapesID)) {
- // grapesPicked++;
- // }
- // grapesInInv = inventory.getCount(grapesID);
- // }
- // }
- // }
- // sleep(random(1500, 2000));
- // RSGroundItem grapesItem = groundItems.getNearest(grapesID);
- // if (grapesItem != null && grapesItem.isOnScreen() && !getMyPlayer().isMoving()) {
- // walking.walkTo(grapesPickUpID);
- // sleep(random(350, 500));
- // camera.turnTo(grapesPickUp);
- // sleep(random(500, 1000));
- // mouse.move(calc.tileToScreen(grapesPickUp, -500));
- // String[] actions1 = menu.getActions();
- // for(String act : actions1) {
- // if(act.contains("Take")) {
- // mouse.click(calc.tileToScreen(grapesItem.getLocation(), -500), true);
- // }
- // }
- // } else {
- // climbDown();
- // sleep(random(1500, 2000));
- // }// </editor-fold>
- if (collectingGrapes()) {
- sleep(1000,2000);
- collectingGrapes();
- }
- return 50;
- }
- }
- return random(50, 100);
- }
- private boolean collectingGrapes() {
- RSGroundItem appleItem11 = groundItems.getNearest(appleID);
- if (appleItem11 != null && appleItem11.isOnScreen() && !getMyPlayer().isMoving()) {
- walking.walkTo(applePickUpID2);
- sleep(random(350, 500));
- camera.turnTo(applePickUp3);
- sleep(random(500, 550));
- mouse.move(calc.tileToScreen(applePickUp3, -500));
- String[] actions = menu.getActions();
- for(String act : actions) {
- if(act.contains("Take")) {
- mouse.click(calc.tileToScreen(appleItem11.getLocation(), -500), true);
- if (grapesInInv < inventory.getCount(grapesID)) {
- grapesPicked++;
- }
- grapesInInv = inventory.getCount(grapesID);
- return true;
- }
- }
- }
- sleep(random(1500, 2000));
- RSGroundItem grapesItem = groundItems.getNearest(grapesID);
- if (grapesItem != null && grapesItem.isOnScreen() && !getMyPlayer().isMoving()) {
- walking.walkTo(grapesPickUpID);
- sleep(random(350, 500));
- camera.turnTo(grapesPickUp);
- sleep(random(500, 1000));
- mouse.move(calc.tileToScreen(grapesPickUp, -500));
- String[] actions1 = menu.getActions();
- for(String act : actions1) {
- if(act.contains("Take")) {
- mouse.click(calc.tileToScreen(grapesItem.getLocation(), -500), true);
- return true;
- }
- }
- } else if (appleItem11 == null && grapesItem == null || !appleItem11.isOnScreen() && !grapesItem.isOnScreen() || grapesItem == null && appleItem11 == null && !grapesItem.isOnScreen() && !appleItem11.isOnScreen()) {
- climbDown();
- sleep(random(1500, 2000));
- }
- return false;
- }
- private boolean collectingApples() {
- RSGroundItem appleItem = groundItems.getNearest(appleID);
- if (appleItem != null && appleItem.isOnScreen() && !getMyPlayer().isMoving()) {
- walking.walkTo(applePickUpID);
- sleep(random(250, 500));
- mouse.move(calc.tileToScreen(applePickUp, -500));
- String[] actions = menu.getActions();
- for(String act : actions) {
- if(act.contains("Take")) {
- mouse.click(calc.tileToScreen(appleItem.getLocation(), -500), true);
- sleep(400, 1500);
- if (applesInInv < inventory.getCount(appleID)) {
- applesPicked++;
- }
- applesInInv = inventory.getCount(appleID);
- //collected = true;
- collected++;
- log("collected = "+collected);
- return true;
- }
- }
- }
- sleep(random(500, 1000));
- if (appleItem != null && appleItem.isOnScreen() && !getMyPlayer().isMoving()) {
- camera.turnTo(applePickUp2);
- mouse.move(calc.tileToScreen(applePickUp2, -500));
- String[] actions = menu.getActions();
- for(String act : actions) {
- if(act.contains("Take")) {
- mouse.click(calc.tileToScreen(appleItem.getLocation(), -500), true);
- sleep(400, 1500);
- if (applesInInv < inventory.getCount(appleID)) {
- applesPicked++;
- }
- applesInInv = inventory.getCount(appleID);
- sleep(400,1500);
- //collected = false;
- collected++;
- log("collected = "+collected);
- return true;
- }
- }
- } else if (appleItem == null || !appleItem.isOnScreen() || appleItem == null && !appleItem.isOnScreen()) {
- climbUp();
- log("collected = "+collected);
- sleep(random(1000, 2000));
- }
- return false;
- }
- private final RenderingHints antialiasing = new RenderingHints(
- RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
- private Image getImage(String url) {
- try {
- return ImageIO.read(new URL(url));
- } catch(IOException e) {
- return null;
- }
- }
- private final Color color1 = new Color(203, 181, 141);
- private final Color color2 = new Color(255, 255, 255);
- private final Color color3 = new Color(0, 0, 0);
- private final BasicStroke stroke1 = new BasicStroke(1);
- private final Font font1 = new Font("Tahoma", 0, 13);
- private final Font font2 = new Font("Tahoma", 0, 12);
- private final Font font3 = new Font("Tahoma", 0, 11);
- private final Image img1 = getImage("http://i55.tinypic.com/6h16l4.png");
- public void onRepaint(Graphics g1) {
- millis = System.currentTimeMillis() - startTime;
- hours = millis / (1000 * 60 * 60);
- millis -= hours * (1000 * 60 * 60);
- minutes = millis / (1000 * 60);
- millis -= minutes * (1000 * 60);
- seconds = millis / 1000;
- lootPerHour = (int) ((chocolatePrice * chocolatePicked) + (applesPrice * applesPicked) + (grapesPrice * grapesPicked) * 3600000D / (System.currentTimeMillis() - startTime));
- Graphics2D g = (Graphics2D)g1;
- g.setRenderingHints(antialiasing);
- g.setColor(color1);
- g.fillRoundRect(8, 346, 487, 111, 16, 16);
- g.setColor(color2);
- g.setStroke(stroke1);
- g.drawRoundRect(8, 346, 487, 111, 16, 16);
- g.setFont(font1);
- g.setColor(color3);
- g.drawString("Loot: " + (chocolatePrice * chocolatePicked) + (grapesPrice * grapesPicked) + (applesPrice * applesPicked), 329, 411);
- g.setColor(color2);
- //g.drawString("Loot: " + (chocolatePrice * chocolatePicked) + (grapesPrice * grapesPicked) + (applesPrice * applesPicked), 328, 410);
- g.setColor(color3);
- g.drawString("Status: " + botStatus, 128, 411);
- g.setColor(color2);
- //g.drawString("Status: " + botStatus, 127, 410);
- g.setFont(font2);
- g.setColor(color3);
- g.drawString("AntiBan: Idle", 129, 443);
- g.setColor(color2);
- //g.drawString("AntiBan: Idle", 128, 442);
- g.setColor(color3);
- g.drawString("Loot / Hr: " + lootPerHour, 329, 443);
- g.setColor(color2);
- //g.drawString("Loot / Hr: " + lootPerHour, 328, 442);
- g.setColor(color3);
- g.drawString("Welcome to Furion's Guild Looter!", 171, 369);
- g.setColor(color2);
- //g.drawString("Welcome to Furion's Guild Looter!", 170, 368);
- g.drawImage(img1, 28, 382, null);
- g.setFont(font3);
- g.setColor(color3);
- g.drawString("Made by Furion", 226, 387);
- g.setColor(color2);
- //g.drawString("Made by Furion", 225, 386);
- g.setColor(color3);
- g.drawString("Time running: " + +hours + ":" + minutes + ":" + seconds, 14, 368);
- g.setColor(color2);
- //g.drawString("Time running:", 13, 367);
- }
- @Override
- public void onFinish() {
- log("Thanks for using!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement