-
-
Notifications
You must be signed in to change notification settings - Fork 497
Frostyrc break + startup fixes #1461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b6e63ff
7901bce
45fb17a
462bbc8
eb4f3af
e5fc252
351500f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -101,6 +101,7 @@ public boolean run() { | |||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||
| if (!Microbot.isLoggedIn()) return; | ||||||||||||||||||||||||||||||||||
| if (!super.run()) return; | ||||||||||||||||||||||||||||||||||
| if (shouldPauseForBreak()) return; | ||||||||||||||||||||||||||||||||||
| long startTime = System.currentTimeMillis(); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (lumbyElite == -1) { | ||||||||||||||||||||||||||||||||||
|
|
@@ -160,6 +161,23 @@ public void shutdown() { | |||||||||||||||||||||||||||||||||
| //Rs2Player.logout(); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| private boolean shouldPauseForBreak() { | ||||||||||||||||||||||||||||||||||
| if (!plugin.isBreakHandlerEnabled()) { | ||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (BreakHandlerScript.isBreakActive()) { | ||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (BreakHandlerScript.breakIn <= 0) { | ||||||||||||||||||||||||||||||||||
| BreakHandlerScript.setLockState(false); | ||||||||||||||||||||||||||||||||||
| return true; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+164
to
+179
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Always clear BreakHandler lock when pausing. Apply: private boolean shouldPauseForBreak() {
if (!plugin.isBreakHandlerEnabled()) {
return false;
}
- if (BreakHandlerScript.isBreakActive()) {
- return true;
- }
+ if (BreakHandlerScript.isBreakActive()) {
+ BreakHandlerScript.setLockState(false);
+ return true;
+ }
if (BreakHandlerScript.breakIn <= 0) {
BreakHandlerScript.setLockState(false);
return true;
}
return false;
}🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| private void checkPouches() { | ||||||||||||||||||||||||||||||||||
| Rs2Inventory.interact(colossalPouch, "Check"); | ||||||||||||||||||||||||||||||||||
| sleepGaussian(900, 200); | ||||||||||||||||||||||||||||||||||
|
|
@@ -176,18 +194,22 @@ private void handleBanking() { | |||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (plugin.isBreakHandlerEnabled()) { | ||||||||||||||||||||||||||||||||||
| BreakHandlerScript.setLockState(true); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| Rs2Tab.switchToInventoryTab(); | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (Rs2Inventory.hasDegradedPouch()) { | ||||||||||||||||||||||||||||||||||
| Rs2Magic.repairPouchesWithLunar(); | ||||||||||||||||||||||||||||||||||
| sleepGaussian(900, 200); | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
+203
to
+208
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Repairing pouches while bank UI is open can fail; close and wait first. Apply: - if (Rs2Inventory.hasDegradedPouch()) {
- Rs2Magic.repairPouchesWithLunar();
- sleepGaussian(900, 200);
- return;
- }
+ if (Rs2Inventory.hasDegradedPouch()) {
+ if (Rs2Bank.isOpen()) {
+ Rs2Bank.closeBank();
+ sleepUntil(() -> !Rs2Bank.isOpen(), 1200);
+ }
+ if (Rs2Magic.repairPouchesWithLunar()) {
+ sleepGaussian(900, 200);
+ return;
+ }
+ // If repair failed, continue with banking logic this tick.
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| if (Rs2Inventory.anyPouchUnknown()) { | ||||||||||||||||||||||||||||||||||
| checkPouches(); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (Rs2Inventory.hasDegradedPouch()) { | ||||||||||||||||||||||||||||||||||
| Rs2Magic.repairPouchesWithLunar(); | ||||||||||||||||||||||||||||||||||
| sleepGaussian(900, 200); | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (Rs2Inventory.isFull() && Rs2Inventory.allPouchesFull() && Rs2Inventory.contains(pureEss)) { | ||||||||||||||||||||||||||||||||||
| Microbot.log("We are full, skipping bank"); | ||||||||||||||||||||||||||||||||||
| state = State.GOING_HOME; | ||||||||||||||||||||||||||||||||||
|
|
@@ -197,10 +219,6 @@ private void handleBanking() { | |||||||||||||||||||||||||||||||||
| handleFeroxRunEnergy(); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (plugin.isBreakHandlerEnabled()) { | ||||||||||||||||||||||||||||||||||
| BreakHandlerScript.setLockState(false); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| while (!Rs2Bank.isOpen() && isRunning() && | ||||||||||||||||||||||||||||||||||
| (!Rs2Inventory.allPouchesFull() | ||||||||||||||||||||||||||||||||||
| || !Rs2Inventory.contains(colossalPouch) | ||||||||||||||||||||||||||||||||||
|
|
@@ -456,6 +474,8 @@ private void handleWrathWalking() { | |||||||||||||||||||||||||||||||||
| BreakHandlerScript.setLockState(true); | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (Rs2Bank.isOpen()) { Rs2Bank.closeBank(); } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
Comment on lines
+477
to
+478
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Ensure bank is fully closed before myth cape interactions. Apply: - if (Rs2Bank.isOpen()) { Rs2Bank.closeBank(); }
+ if (Rs2Bank.isOpen()) {
+ Rs2Bank.closeBank();
+ sleepUntil(() -> !Rs2Bank.isOpen(), 1200);
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
| if (Rs2Inventory.contains(mythCape)) { | ||||||||||||||||||||||||||||||||||
| Microbot.log("Interacting with myth cape"); | ||||||||||||||||||||||||||||||||||
| Rs2Inventory.interact(mythCape, "Teleport"); | ||||||||||||||||||||||||||||||||||
|
|
@@ -721,6 +741,9 @@ private void handleCrafting() { | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| if (plugin.isBreakHandlerEnabled()) { | ||||||||||||||||||||||||||||||||||
| BreakHandlerScript.setLockState(false); | ||||||||||||||||||||||||||||||||||
| if (BreakHandlerScript.isBreakActive() || BreakHandlerScript.breakIn <= 0) { | ||||||||||||||||||||||||||||||||||
| return; | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| state = State.BANKING; | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Break pause without unlocking can stall BreakHandler.
If a break becomes active mid-loop, returning early here won’t release the BreakHandler lock unless
breakIn <= 0. If the lock was set to true in a prior step, BreakHandler may be blocked. Fix inshouldPauseForBreak()to always unlock on any pause condition. See suggested diff below.🤖 Prompt for AI Agents