Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package osbotOS;
- import java.awt.Color;
- import java.util.ArrayList;
- import java.util.Collections;
- import org.osbot.rs07.api.ui.EquipmentSlot;
- import org.osbot.rs07.api.ui.Skill;
- import org.osbot.rs07.script.Script;
- import Data.Constants;
- import Methods.BankingMethods;
- import Methods.Core;
- import Methods.PositionMethods;
- import Methods.PouchMethods;
- public class ActivityInBank extends Node {
- public boolean pouchesFull = false;
- public boolean bankingIsDone = false;
- public static ArrayList<Node> subnodes = new ArrayList<>();
- public int eatAt;
- public int foodID;
- public int foodHeals;
- public boolean usingTabs;
- public boolean usingGlory;
- public boolean usingPrayer;
- public boolean usingStam;
- public int tabAmount;
- public boolean needToWithdrawFood;
- public boolean needToWithdrawGlory;
- public boolean needToWithdrawPrayer;
- public boolean needToWithdrawRunes;
- public boolean needToWithdrawTabs;
- public boolean needToWithdrawStam;
- public boolean nearBank = this.validateNearBank();
- public BankingMethods bankMethods = new BankingMethods();
- public PositionMethods positionMethods = new PositionMethods();
- public PouchMethods pouchMethods = new PouchMethods();
- public Core coreMethods = new Core();
- public Constants c = new Constants();
- public ActivityInBank(Script script) {
- super(script);
- this.needToWithdrawFood = this.validateFood();
- this.needToWithdrawGlory = this.validateGlory();
- this.needToWithdrawPrayer = this.validatePrayer();
- this.needToWithdrawRunes = this.validateRunes();
- this.needToWithdrawTabs = this.validateTabs();
- this.needToWithdrawStam = this.validateStam();
- // TODO Auto-generated constructor stub
- }
- @Override
- public void execute() {
- Collections.addAll(subnodes, new SubActivityInBankGetTabs(this.script),
- new SubActivityInBankGetRunes(this.script),
- new SubActivityInBankGetGlory(this.script),
- new SubActivityInBankGetFood(this.script),
- new SubActivityInBankGetPrayer(this.script),
- new SubActivityInBankGetStam(this.script)); //add all nodes to the ArrayList
- this.bankMethods.openBank(this.script, this.c.BANK_ID,
- this.c.BANK_OPTION);
- while (!this.bankingIsDone) {
- for (Node node : subnodes) {
- if (node.validate()) {
- node.execute();
- }
- }
- this.coreMethods.waitTime(50);
- }
- this.bankMethods.closeBank(this.script);
- }
- @Override
- public boolean validate() {
- this.bankingIsDone = !(this.needToWithdrawFood
- || this.needToWithdrawGlory || this.needToWithdrawPrayer
- || this.needToWithdrawRunes || this.needToWithdrawTabs);
- this.script.log("Banking is done: " + this.bankingIsDone);
- return this.nearBank && !this.bankingIsDone;
- }
- public boolean validateFood() {
- int playerMaxHealth = this.script.getSkills()
- .getStatic(Skill.HITPOINTS);
- int playerHealth = this.script.myPlayer().getHealth();
- int currentHealth = playerMaxHealth * (playerHealth / 100);
- return (currentHealth <= this.eatAt);
- }
- public boolean validateGlory() {
- EquipmentSlot glorySlot = this.script.equipment
- .getForNameThatContains("Amulet of glory");
- boolean gloryIsEmpty = !this.script.equipment
- .isWearingItemThatContains(glorySlot, "Amulet of glory(");
- boolean needAGlory = false;
- if (gloryIsEmpty) {
- needAGlory = true;
- }
- return (needAGlory && this.usingGlory);
- }
- public boolean validatePrayer() {
- int[] prayerIDs = new int[] { 2434, 139, 141, 143 };
- boolean hasPrayerPot = this.script.inventory.contains(prayerIDs);
- return !hasPrayerPot && this.usingPrayer;
- }
- public boolean validateRunes() {
- int[] brokenIds = { 5511, 5513, 5515 };
- boolean isBroken = this.script.inventory.contains(brokenIds);
- return isBroken;
- }
- public boolean validateTabs() {
- boolean hasTabs = this.script.inventory.getAmount("Teleport to house") != 0;
- return !hasTabs && this.usingTabs;
- }
- public boolean validateNearBank() {
- boolean inBank = this.positionMethods.isPlayerInBox(this.script, 3095,
- 3098, 3494, 3497);
- return inBank;
- }
- public boolean validateStam() {
- Color stamColor = new Color(228, 115, 61); //color at 581 141
- boolean needAStam = !this.script.colorPicker.colorAt(581, 141).equals(
- stamColor);
- return needAStam;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement