Skip to content
This repository was archived by the owner on Feb 9, 2022. It is now read-only.

Commit 2650140

Browse files
author
Explv
committed
Fix banking when both deposit box and bank are nearby, but one is not accessible.
v3.2.5
1 parent de7440c commit 2650140

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

src/main/java/activities/banking/Banking.java

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,19 @@ public void run() throws InterruptedException {
3737
if (!playerInBank()) {
3838
walkToBank();
3939
} else if (!isBankOpen()) {
40-
currentBankType = openBank();
41-
} else if (CONTINUE_BANK_INSTRUCTIONS_WIDGET.isVisible(getWidgets())) {
42-
CONTINUE_BANK_INSTRUCTIONS_WIDGET.interact(getWidgets(), "Continue");
40+
openBank();
4341
} else {
44-
succeeded = bank(currentBankType);
42+
if (getBank() != null && getBank().isOpen()) {
43+
currentBankType = BankType.BANK;
44+
} else {
45+
currentBankType = BankType.DEPOSIT_BOX;
46+
}
47+
48+
if (CONTINUE_BANK_INSTRUCTIONS_WIDGET.isVisible(getWidgets())) {
49+
CONTINUE_BANK_INSTRUCTIONS_WIDGET.interact(getWidgets(), "Continue");
50+
} else {
51+
succeeded = bank(currentBankType);
52+
}
4553
}
4654
}
4755

@@ -60,6 +68,10 @@ private boolean walkToBank() {
6068
}
6169

6270
boolean isBankOpen() {
71+
if (useDepositBoxes && getBank() != null && getDepositBox() != null) {
72+
return getBank().isOpen() || getDepositBox().isOpen();
73+
}
74+
6375
if (getBank() != null) {
6476
return getBank().isOpen();
6577
}
@@ -71,19 +83,16 @@ boolean isBankOpen() {
7183
return false;
7284
}
7385

74-
private BankType openBank() throws InterruptedException {
75-
if (getBank() != null) {
76-
if (getBank().open()) {
77-
Sleep.sleepUntil(() -> getBank().isOpen(), 5000);
78-
}
79-
return BankType.BANK;
86+
private void openBank() throws InterruptedException {
87+
if (getBank() != null && getBank().open()) {
88+
Sleep.sleepUntil(() -> getBank().isOpen(), 5000);
89+
return;
8090
}
8191

8292
if (useDepositBoxes && getDepositBox() != null) {
8393
if (getDepositBox().open()) {
8494
Sleep.sleepUntil(() -> getDepositBox().isOpen(), 5000);
8595
}
86-
return BankType.DEPOSIT_BOX;
8796
}
8897

8998
throw new IllegalStateException("Cannot open bank, no bank or deposit box found.");

src/main/java/script/AIO.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
@ScriptManifest(author = "Explv", name = "Explv's AIO " + AIO.VERSION, info = "AIO", version = 0, logo = "http://i.imgur.com/58Zz0fb.png")
2929
public class AIO extends Script {
3030

31-
public static final String VERSION = "v3.2.4";
31+
public static final String VERSION = "v3.2.5";
3232

3333
private Gui gui;
3434
private Paint paint;

0 commit comments

Comments
 (0)