Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.abyssCrafterV2;
- import org.tribot.api.Clicking;
- import org.tribot.api.General;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Equipment;
- import org.tribot.api2007.Game;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.Skills.SKILLS;
- import org.tribot.api2007.types.RSItem;
- import scripts.abyssCrafter.Crafter;
- public class CharacterPreparation {
- enum STATE {
- DEPOSITING_INVENTORY,
- HEAL,
- WITHDRAW_ENERGY,
- WITHDRAW_GLORY,
- WITHDRAW_TELEPORT,
- FILLING_POUCHES,
- WITHDRAWING_ESSENCE,
- SLEEP
- }
- private static STATE getState() {
- if (Inventory.find(Crafter.RUNE_TYPE).length > 0 || Inventory.find("Amulet of glory").length > 0 ) {
- return STATE.DEPOSITING_INVENTORY;
- }
- else if (Skills.getCurrentLevel(SKILLS.HITPOINTS) <= Crafter.SAFE_HEALTH) {
- return STATE.HEAL;
- }
- else if (Crafter.usingEnergyPotion && Main.needEnergyPotion()) {
- if(!Main.ENERGY_ITEM.equals("Resting")) {
- return STATE.WITHDRAW_ENERGY;
- }
- else {
- return STATE.SLEEP;
- }
- }
- else if (!Equipment.isEquipped(Main.GLORY)) {
- return STATE.DEPOSITING_INVENTORY;
- }
- else if (Main.usingEmergencyTeleport && Inventory.find(Main.TELE_TABS).length < 1) {
- return STATE.WITHDRAW_TELEPORT;
- }
- else if (Inventory.find(Main.POUCHES).length > 0 &&!Main.pouchesFilled()) {
- return STATE.FILLING_POUCHES;
- }
- else if (Inventory.find(Main.ESSENCE_TYPE).length < Inventory.find(Main.ESSENCE_TYPE).length
- + (28 - Inventory.getAll().length)) {
- return STATE.WITHDRAWING_ESSENCE;
- }
- return STATE.SLEEP;
- }
- public static void start() {
- switch (getState()) {
- case DEPOSITING_INVENTORY:
- if (Banking.openBank())
- Banking.depositAllExcept(Main.POUCHES);
- break;
- case FILLING_POUCHES:
- fillPouches();
- break;
- case HEAL:
- healUp();
- break;
- case SLEEP:
- General.sleep(400, 900);
- break;
- case WITHDRAWING_ESSENCE:
- DezUtils.withdrawItem(Main.ESSENCE_TYPE, Main.FOOD_NAME,
- Inventory.find(Main.ESSENCE_TYPE).length + inventorySpace(), true);
- break;
- case WITHDRAW_ENERGY:
- DezUtils.withdrawItem(Main.ENERGY_ITEM, Main.ESSENCE_TYPE, 1, false);
- break;
- case WITHDRAW_GLORY:
- DezUtils.withdrawItem(1, Main.ESSENCE_TYPE, Main.GLORY);
- break;
- case WITHDRAW_TELEPORT:
- DezUtils.withdrawItem(1, Main.ESSENCE_TYPE, Main.TELE_TABS);
- break;
- default:
- break;
- }
- }
- private static void fillPouches() {
- if(Inventory.find(Main.ESSENCE_TYPE).length < 4){
- DezUtils.withdrawItem(inventorySpace(), null, Main.ESSENCE_TYPE);
- }
- else if(Banking.close()){
- storeEssence();
- }
- }
- private static void healUp() {
- if(Inventory.find(Main.FOOD_NAME).length > 0){
- if (Banking.close()) {
- Clicking.click(Inventory.find(Main.FOOD_NAME));
- }
- }
- else {
- DezUtils.withdrawItem(getFoodCount(), Main.ESSENCE_TYPE, Main.FOOD_NAME);
- }
- }
- private static void storeEssence() {
- for (RSItem e : Inventory.find(Main.POUCHES)) {
- if (e != null) {
- if (e.getDefinition().getName().contains("Small")) {
- if (Game.getSetting(Main.POUCH_SETTING) < Main.SMALL_FILLED_ID) {
- if (Clicking.click("Fill", e)) {
- General.sleep(400, 1700);
- }
- }
- }
- else if (e.getDefinition().getName().contains("Medium")) {
- if (Game.getSetting(Main.POUCH_SETTING) < Main.MED_FILLED_ID) {
- if (Clicking.click("Fill", e)) {
- General.sleep(400, 1700);
- }
- }
- }
- else if (e.getDefinition().getName().contains("Large")) {
- if (Game.getSetting(Main.POUCH_SETTING) < Main.LRG_FILLED_ID) {
- if (Clicking.click("Fill", e)) {
- General.sleep(400, 1700);
- }
- }
- }
- else if (e.getDefinition().getName().contains("Giant")) {
- if (Game.getSetting(Main.POUCH_SETTING) < Main.GIANT_FILLED_ID) {
- if (Clicking.click("Fill", e)) {
- General.sleep(400, 1700);
- }
- }
- }
- }
- }
- }
- public static int inventorySpace() {
- return 28 - Inventory.getAll().length;
- }
- public static int getFoodCount() {
- return (Skills.getActualLevel(SKILLS.HITPOINTS)
- - Skills.getCurrentLevel(SKILLS.HITPOINTS)) / Main.FOOD_HEAL_AMT;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement