Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.scripts;
- import com.kbot2.scriptable.Script;
- import com.kbot2.scriptable.methods.wrappers.*;
- public class EssenceMiner extends Script {
- /*Path*/
- Tile[] fromBanktoMiddle = {new Tile(3253, 3420), new Tile(3258, 3410)};
- Tile[] fromMiddletoAubury = {new Tile(3258, 3410), new Tile(3253, 3401)};
- Tile[] fromAuburytoBank = {new Tile(3253, 3401), new Tile(3258, 3410), new Tile(3253, 3420)};
- Tile[] portal = {new Tile(2885,4850), new Tile(2889,4813), new Tile(2932,4854), new Tile(2933,4815)};
- Tile[] essLoc = {new Tile(2893,4849), new Tile(2895,4814), new Tile(2927,4850),new Tile(2929,4816)};
- final Tile[][] pathToEssLocs = new Tile[] { new Tile[] {2893,4849}, new Tile[] {2895,4814}, new Tile[] {2927,4850}, new Tile[] {2929,4816} };
- Tile center = new Tile(2910,4832);
- /*Define*/
- NPC aubury;
- Obj essence;
- Obj port;
- Obj b;
- /*ID's*/
- int AUBURY_ID = 553;
- final int ESSENCE_ID = 2491;
- int PORTAL_ID = 2492;
- int BANK_ID = 11402;
- int status = 0;
- private Tile[] whichPath() {
- Tile[] which = pathToEssLocs[0];
- int dist = getMyPlayer().getLocation().distanceTo(essLoc[0]);
- for(int i = 0; i < essLoc.length; i++) {
- if(getMyPlayer().getLocation().distanceTo(essLoc[i]) < dist) {
- dist = getMyPlayer().getLocation().distanceTo(essLoc[i]);
- which = pathToEssLocs[i];
- }
- }
- return which;
- }
- @Override
- public boolean active() {
- return true;
- }
- public String getName() {
- return "EssenceMiner";
- }
- @Override
- public String getAuthor() {
- return "SuperTaranta";
- }
- @Override
- public String getDescription() {
- return "Essence Miner";
- }
- @Override
- public boolean onStart() {
- log("Starting SuperTaranta's GayClub");
- return true;
- }
- public int loop() {
- if (!isLoggedIn()) {
- return random(1000, 1100);
- }
- if(walking.getEnergy() > 30)
- walking.setRunning(true);
- switch (status) {
- case 0:
- if (inventory.isFull()) {
- status = 6;
- } else {
- status = 1;
- }
- return random(300, 500);
- case 1:
- // From Bank To Aubury
- log("Walking from Bank to Middle");
- walking.walkPath(fromBanktoMiddle);
- while(getMyPlayer().isMoving())
- sleep(3000);
- status = 2;
- return random(150, 300);
- case 2:
- // From Bank To Aubury
- log("Walking from Middle to Aubury");
- walking.walkPath(fromMiddletoAubury);
- while(getMyPlayer().isMoving())
- sleep(2000);
- status = 3;
- return random(150, 300);
- case 3:
- //Teleport
- aubury = npcs.getClosest(20, AUBURY_ID);
- log("Teleporting");
- if (aubury != null) {
- aubury.doAction("Teleport");
- sleep(5000);
- status = 4;
- } else {
- status = 2;
- return random(150,300);
- }
- case 4:
- // From Center to Essence
- log("Center To Essence");
- camera.setAngle(random(30, 90));
- if(distanceTo(center) < 5){
- walking.walkPath(essLoc);
- while(getMyPlayer().isMoving())
- sleep(2000);
- }
- status = 5;
- return random(150, 300);
- case 5:
- //Find and Mine the Essence
- log("Looking and Mining Essence");
- essence = objects.getClosestObject(10, ESSENCE_ID);
- if (essence != null) {
- camera.setAngle(random(30, 90));
- if (getMyPlayer().getAnimation() == -1) {
- essence.doAction("Mine");
- sleep(20000);
- }
- if(inventory.isFull()){
- sleep(100);
- status = 6;
- }
- } else {
- log("Shit can't find ess");
- //whatever you want to do to find ess
- walking.objects.getClosestObject(30, ESSENCE_ID);
- sleep(100);
- return random(150, 300);
- }
- case 6:
- //Find Portal
- port = objects.getClosestObject(15, PORTAL_ID);
- log("Inventory full, looking for portal");
- if (inventory.isFull()) {
- walking.walkPath(portal);
- walking.getClosest(portal);
- while(getMyPlayer().isMoving())
- sleep(2000);
- port.doAction("Use");
- sleep(3000);
- status = 7;
- } else {
- status = 5;
- return random(150, 300);
- }
- case 7:
- // From Aubury To Bank
- log("Walking from Aubury to Bank");
- walking.walkPath(fromAuburytoBank);
- while(getMyPlayer().isMoving())
- sleep(100);
- status = 8;
- return random(150, 300);
- case 8:
- // Check Bank
- b = getClosestObject(7, BANK_ID);
- log("Checking/Opening Bank");
- while (!bank.isOpen()) {
- if (b != null)
- b.doAction("Use-quickly");
- sleep(750, 1000);
- }
- status = 9;
- return random(150, 300);
- case 9:
- // Banking
- log("Banking");
- if (!bank.isOpen()) {
- status = 8;
- return 100;
- }
- while (inventory.getCount() > 1) {
- bank.depositAll(1436);
- }
- bank.close();
- sleep(350, 500);
- if (bank.isOpen())
- bank.close();
- status = 0;
- return random(150, 300);
- }
- return random(100, 300);
- }
- }
Add Comment
Please, Sign In to add comment