Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.tools;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api2007.Banking;
- import org.tribot.api2007.Interfaces;
- import org.tribot.api2007.Inventory;
- import scripts.data.Conditions;
- public class Bank {
- public static boolean IsInterfaceUp() {
- if (Interfaces.get(12) != null) {
- return true;
- } else {
- return false;
- }
- }
- public static boolean HasCoins() {
- if (Inventory.find("Coins").length > 1) {
- return true;
- } else {
- return false;
- }
- }
- // Opens bank, banks and closes. Used for ids
- public static void DepositExcept(int timeToWait, String... itemNames) {
- long t = Timer.Tic();
- while (Timer.Toc(t) < timeToWait || !Banking.openBank()) {
- Banking.openBank();
- if (timeToWait < 1) {
- break;
- }
- }
- General.sleep(450, 600);
- Banking.depositAllExcept(itemNames);
- General.sleep(450, 600);
- Banking.close();
- Timing.waitCondition(Conditions.bankClosed, 1000);
- }
- // Opens bank, banks and closes. Used for strings
- public static void DepositExcept(int timeToWait, int... itemIDs) {
- long t = Timer.Tic();
- while (Timer.Toc(t) < timeToWait || !Banking.openBank()) {
- Banking.openBank();
- if (timeToWait < 1) {
- break;
- }
- }
- General.sleep(450, 600);
- Banking.depositAllExcept(itemIDs);
- General.sleep(450, 600);
- Banking.close();
- Timing.waitCondition(Conditions.bankClosed, 1000);
- }
- // Opens bank, withdraws and closes. Used for strings
- public static void Withdraw(int amount, int timeToWait, String... itemNames) {
- long t = Timer.Tic();
- while (Timer.Toc(t) < timeToWait || !Banking.openBank()) {
- Banking.openBank();
- if (timeToWait < 1) {
- break;
- }
- }
- General.sleep(450, 600);
- Banking.withdraw(amount, itemNames);
- General.sleep(1450, 1600);
- Banking.close();
- Timing.waitCondition(Conditions.bankClosed, 1000);
- }
- // Opens bank, withdraws and closes. Used for ids
- public static void Withdraw(int amount, int timeToWait, int... itemIDs) {
- long t = Timer.Tic();
- while (Timer.Toc(t) < timeToWait || !Banking.openBank()) {
- Banking.openBank();
- if (timeToWait < 1) {
- break;
- }
- }
- General.sleep(450, 600);
- for (int b = 0; b < itemIDs.length; b++) {
- Banking.withdraw(amount, itemIDs[b]);
- }
- General.sleep(1450, 1600);
- Banking.close();
- Timing.waitCondition(Conditions.bankClosed, 1000);
- }
- }
Add Comment
Please, Sign In to add comment