Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.airRunecrafter;
- import org.tribot.api.Clicking;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.types.generic.Condition;
- import org.tribot.api.util.ABCUtil;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Game;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Objects;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.WebWalking;
- import org.tribot.api2007.types.RSObject;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- public class Main extends Script {
- public static boolean running = true;
- private STATE state;
- private String ESSENCE_TYPE = "Pure essence";
- private String TALISMAN = "Air talisman";
- private String AIR_RUNES = "Air runes";
- private RSTile RUINS_POS = new RSTile(2984, 3291, 0);
- private RSTile ALTAR_POS = new RSTile(2987, 3294, 0);
- private ABCUtil abc;
- enum STATE {
- CRAFTING,
- DEPOSITING,
- WITHDRAWING,
- TO_BANK,
- EXITING_RUINS,
- ENTERING_RUINS,
- TO_ALTAR,
- WAITING
- }
- @Override
- public void run() {
- implementAntiban();
- while (running) {
- executeSlave(600, 900);
- antiban();
- }
- }
- public void implementAntiban() {
- General.useAntiBanCompliance(true);
- abc = new ABCUtil();
- }
- private STATE getState() {
- if (Banking.isInBank() && Inventory.find(ESSENCE_TYPE).length < 1){
- if (Inventory.find(AIR_RUNES).length > 0) {
- return STATE.DEPOSITING;
- }
- else if (Inventory.find(ESSENCE_TYPE).length < 1) {
- return STATE.WITHDRAWING;
- }
- }
- else if (!atRuins() && Inventory.find(ESSENCE_TYPE).length < 1) {
- return STATE.TO_ALTAR;
- }
- else if (atRuins() && Inventory.find(ESSENCE_TYPE).length < 1) {
- return STATE.ENTERING_RUINS;
- }
- else if (inAltar()) {
- if (Inventory.find(ESSENCE_TYPE).length > 0) {
- return STATE.CRAFTING;
- }
- else {
- return STATE.EXITING_RUINS;
- }
- }
- else {
- return STATE.TO_BANK;
- }
- return STATE.WAITING;
- }
- private boolean atRuins() {
- RSObject[] ruins = Objects.getAt(RUINS_POS);
- return ruins.length > 0 && ruins[0].isOnScreen();
- }
- private boolean inAltar() {
- RSObject[] altar = Objects.find(30, "Altar");
- return altar.length > 0;
- }
- private void executeSlave(int s1, int s2) {
- state = getState();
- switch (state) {
- case CRAFTING:
- DezUtils.interactObject("Altar", null, 10, new Condition() {
- @Override
- public boolean active() {
- return Inventory.find(ESSENCE_TYPE).length < 1;
- }
- }, General.random(4600, 7500));
- break;
- case DEPOSITING:
- deposit();
- break;
- case ENTERING_RUINS:
- enterRuins();
- break;
- case EXITING_RUINS:
- DezUtils.interactObject("Portal", null, 10, new Condition() {
- @Override
- public boolean active() {
- return !inAltar();
- }
- }, General.random(4600, 7500));
- break;
- case TO_ALTAR:
- DezUtils.takePath(ALTAR_POS);
- break;
- case TO_BANK:
- if (!Player.isMoving()) WebWalking.walkToBank();
- break;
- case WAITING:
- break;
- case WITHDRAWING:
- DezUtils.withdrawItem(ESSENCE_TYPE, null, 28 - Inventory.getAll().length, true);
- break;
- default:
- break;
- }
- sleep(s1, s2);
- }
- private void enterRuins() {
- if (Inventory.find(TALISMAN).length > 0 && !Game.getUptext().contains("Use")) {
- Clicking.click(Inventory.find(TALISMAN));
- }
- else {
- DezUtils.interactObject(RUINS_POS, null, new Condition() {
- @Override
- public boolean active() {
- return inAltar();
- }
- }, General.random(4600, 7600));
- }
- }
- private void deposit() {
- if (!Banking.isBankScreenOpen()) {
- Banking.openBank();
- }
- else {
- Banking.depositAllExcept(TALISMAN);
- }
- }
- public void antiban() {
- checkXp();
- ranRightClick();
- checkEquipment();
- checkFl();
- checkMusic();
- rotateCam();
- ranMouseMoves();
- examineObj();
- pickUpMouse();
- leaveGame();
- }
- public final void rotateCam() {
- if (abc.TIME_TRACKER.ROTATE_CAMERA.next() <= Timing.currentTimeMillis()){
- abc.performRotateCamera();
- }
- }
- public void checkXp() {
- if (abc.TIME_TRACKER.CHECK_XP.next() <= Timing.currentTimeMillis()){
- abc.performXPCheck(Skills.SKILLS.RUNECRAFTING);
- }
- }
- public final void pickUpMouse() {
- if (abc.TIME_TRACKER.PICKUP_MOUSE.next() <= Timing.currentTimeMillis()){
- abc.performPickupMouse();
- }
- }
- public void leaveGame() {
- if (abc.TIME_TRACKER.LEAVE_GAME.next() <= Timing.currentTimeMillis()){
- abc.performLeaveGame();
- sleep(14000,30000);
- }
- }
- public void examineObj() {
- if (abc.TIME_TRACKER.EXAMINE_OBJECT.next() <= Timing.currentTimeMillis()){
- abc.performExamineObject();
- }
- }
- public void ranRightClick() {
- if (abc.TIME_TRACKER.RANDOM_RIGHT_CLICK.next() <= Timing.currentTimeMillis()){
- abc.performRandomRightClick();
- }
- }
- public void ranMouseMoves() {
- if (abc.TIME_TRACKER.RANDOM_MOUSE_MOVEMENT.next() <= Timing.currentTimeMillis()){
- abc.performRandomMouseMovement();
- }
- }
- public void checkEquipment() {
- if (abc.TIME_TRACKER.CHECK_EQUIPMENT.next() <= Timing.currentTimeMillis()){
- abc.performEquipmentCheck();
- }
- }
- public final void checkFl() {
- if (abc.TIME_TRACKER.CHECK_FRIENDS.next() <= Timing.currentTimeMillis()){
- abc.performFriendsCheck();
- }
- }
- public final void checkMusic() {
- if (abc.TIME_TRACKER.CHECK_MUSIC.next() <= Timing.currentTimeMillis()){
- abc.performMusicCheck();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment