Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.runecrafting.abysscrafter;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api2007.WebWalking;
- import org.tribot.api.util.ABCUtil;
- import org.tribot.api2007.Camera;
- import org.tribot.api2007.Game;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Objects;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.types.RSItem;
- import org.tribot.api2007.types.RSObject;
- import org.tribot.api2007.types.RSTile;
- import scripts.methods.Methods;
- public class Runecrafting {
- private Main main;
- public Runecrafting(Main main) {
- setMain(main);
- }
- public void setMain(Main main) {
- this.main = main;
- }
- public Main getMain() {
- return main;
- }
- public RSTile[] getRiftPath() {
- return getMain().getPathNavigator().findPath(getMain().getRune().getRiftLocation());
- }
- public boolean enterRift() {
- if(Locations.isInsideAltar()) {
- return true;
- }
- if(getMain().getHouse().isInside()) {
- getMain().setState(State.TELEPORTING_TO_EDGEVILLE);
- return false;
- }
- if(!Player.getPosition().equals(getMain().getRune().getRiftLocation()) && !Player.isMoving()) {
- if(Game.getDestination() == null) {
- Walking.walkPath(getRiftPath());
- }
- if(Game.getDestination() != null && !Game.getDestination().isOnScreen() || !Player.isMoving())
- Walking.walkPath(getRiftPath());
- //Methods.performAntiBan();
- getMain().sleep(50, 150);
- }
- getMain().getObstacles().setObstacle(null);
- RSObject[] rift = Objects.findNearest(64, getMain().getRune().getRiftName());
- if(rift != null && rift.length > 0) {
- int distance = Methods.distanceTo(getMain(), rift[0].getPosition());
- int tries = 0;
- if(!rift[0].isOnScreen()
- && distance < 6) {
- Camera.turnToTile(rift[0]);
- }
- while(!Locations.isInsideAltar() && Methods.distanceTo(getMain(), rift[0].getPosition()) < 2) {
- if(tries == 0) {
- Camera.turnToTile(rift[0]);
- } else if(tries >= 10) {
- Camera.turnToTile(rift[0]);
- tries = 0;
- }
- tries++;
- if(rift[0].click("Exit-through")) {
- General.sleep(abc.DELAY_TRACKER.SWITCH_OBJECT.next());
- abc.DELAY_TRACKER.SWITCH_OBJECT.reset();
- }
- getMain().sleep(50, 150);
- }
- }
- getMain().sleep(100, 200);
- return false;
- }
- public boolean craftRunes() {
- if(Locations.isInsideAltar()) {
- RSObject[] altar = Objects.findNearest(24, "Altar");
- if(altar != null && altar.length > 0) {
- if(!altar[0].isOnScreen()) {
- Camera.turnToTile(altar[0]);
- if(!altar[0].isOnScreen())
- WebWalking.walkTo(altar[0]);
- }
- while(Inventory.getCount(Constants.ESSENCE) > 0) {
- if(altar[0].click("Craft-rune")) {
- General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next());
- abc.DELAY_TRACKER.ITEM_INTERACTION.reset();
- craftedRunes(6000);
- }
- getMain().sleep(50, 150);
- }
- RSItem[] giantPouch = Inventory.find(Constants.POUCHES[3]);
- RSItem[] largePouch = Inventory.find(Constants.POUCHES[2]);
- RSItem[] medPouch = Inventory.find(Constants.POUCHES[1]);
- RSItem[] smallPouch = Inventory.find(Constants.POUCHES[0]);
- int essCount = 0;
- boolean hasGiantPouch = false;
- if(giantPouch != null && giantPouch.length > 0) {
- hasGiantPouch = true;
- essCount = Inventory.getCount(Constants.ESSENCE);
- if(giantPouch[0].click("Empty")) {
- General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next());
- abc.DELAY_TRACKER.ITEM_INTERACTION.reset();
- emptiedPouch(essCount, 2000);
- }
- }
- if(largePouch != null && largePouch.length > 0) {
- essCount = Inventory.getCount(Constants.ESSENCE);
- if(largePouch[0].click("Empty")) {
- General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next());
- abc.DELAY_TRACKER.ITEM_INTERACTION.reset();
- emptiedPouch(essCount, 2000);
- }
- }
- if(hasGiantPouch) {
- while(Inventory.getCount(Constants.ESSENCE) > 0) {
- if(altar[0].click("Craft-rune")) {
- General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next());
- abc.DELAY_TRACKER.ITEM_INTERACTION.reset();
- craftedRunes(6000);
- }
- getMain().sleep(50, 150);
- }
- }
- if(medPouch != null && medPouch.length > 0) {
- essCount = Inventory.getCount(Constants.ESSENCE);
- if(medPouch[0].click("Empty")) {
- General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next());
- abc.DELAY_TRACKER.ITEM_INTERACTION.reset();
- emptiedPouch(essCount, 2000);
- }
- }
- if(smallPouch != null && smallPouch.length > 0) {
- essCount = Inventory.getCount(Constants.ESSENCE);
- if(smallPouch[0].click("Empty")) {
- General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next());
- abc.DELAY_TRACKER.ITEM_INTERACTION.reset();
- emptiedPouch(essCount, 2000);
- }
- }
- while(Inventory.getCount(Constants.ESSENCE) > 0) {
- if(altar[0].click("Craft-rune")) {
- General.sleep(abc.DELAY_TRACKER.ITEM_INTERACTION.next());
- abc.DELAY_TRACKER.ITEM_INTERACTION.reset();
- craftedRunes(6000);
- }
- getMain().sleep(50, 150);
- }
- while(Player.getAnimation() != -1) {
- getMain().sleep(50, 150);
- }
- if(Inventory.getCount(Constants.ESSENCE) <= 0) {
- int natsCrafted = getMain().getNatsCrafted();
- getMain().setNatsCrafted(natsCrafted + Inventory.getCount(getMain().getRune().getItemId()));
- return true;
- }
- return false;
- }
- }
- return false;
- }
- private ABCUtil abc = new ABCUtil();
- private boolean craftedRunes(int i) {
- long t = System.currentTimeMillis();
- while (Timing.timeFromMark(t) < i) {
- if (Inventory.getCount(Constants.ESSENCE) <= 0) {
- if(Player.getAnimation() == -1) {
- return true;
- }
- }
- getMain().sleep(50, 150);
- }
- return false;
- }
- private boolean emptiedPouch(int essAmt, int i) {
- long t = System.currentTimeMillis();
- while (Timing.timeFromMark(t) < i) {
- if (Inventory.getCount(Constants.ESSENCE) > essAmt) {
- return true;
- }
- getMain().sleep(50, 150);
- }
- return false;
- }
- public boolean isAtRift() {
- RSObject[] rift = Objects.findNearest(64, getMain().getRune().getRiftName());
- if(rift != null && rift.length > 0) {
- if(Methods.distanceTo(getMain(), rift[0].getPosition()) <= 5) {
- return true;
- }
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement