Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ RcConfig provideConfig(ConfigManager configManager) {
@Getter
private WorldPoint myWorldPoint;
@Getter
public static String version = "v1.1.0";
public static String version = "v1.1.2";

@Subscribe
public void onGameObjectSpawned(GameObjectSpawned event) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ public boolean run() {
try {
if (!Microbot.isLoggedIn()) return;
if (!super.run()) return;
if (shouldPauseForBreak()) return;
long startTime = System.currentTimeMillis();
Comment on lines +104 to 105
Copy link
Contributor

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 in shouldPauseForBreak() to always unlock on any pause condition. See suggested diff below.

🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 104-105, returning early when shouldPauseForBreak() is true can
leave the BreakHandler lock held and stall the handler; update
shouldPauseForBreak() (or the caller) so that any pause path explicitly
releases/unlocks the BreakHandler before returning—e.g., ensure
BreakHandler.unlock() is invoked on every pause condition (use a finally or
explicit unlock before return) so the lock is never left set when pausing.


if (lumbyElite == -1) {
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Always clear BreakHandler lock when pausing.
When isBreakActive() is true you return without calling setLockState(false), potentially preventing BreakHandler from taking over. Unlock for both active and imminent breaks.

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
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 164 to 179, when BreakHandlerScript.isBreakActive() returns true
the method returns without clearing the BreakHandler lock; modify the method so
it calls BreakHandlerScript.setLockState(false) before returning true for both
the active-break branch and the breakIn <= 0 branch (i.e., ensure the lock is
released in both cases), keeping the existing checks and return values
otherwise.


private void checkPouches() {
Rs2Inventory.interact(colossalPouch, "Check");
sleepGaussian(900, 200);
Expand All @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The 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.
Casting/contact dialogues often fail with bank open. Also, only early-return if repair succeeded; otherwise fall through to normal banking.

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
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.
}
🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 199-204, closing the bank UI and waiting before attempting to
repair pouches is required and the method should only early-return if the repair
actually succeeded; modify the block to first close the bank if it's open (and
wait until it's closed), sleep briefly to ensure dialogs can be opened, then
call Rs2Magic.repairPouchesWithLunar(); after the repair attempt, verify success
by checking that Rs2Inventory.hasDegradedPouch() is now false and only then
sleepGaussian(900, 200) and return; if the pouch still degrades, fall through to
normal banking logic so the rest of the method can handle it.

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;
Expand All @@ -197,10 +219,6 @@ private void handleBanking() {
handleFeroxRunEnergy();
}

if (plugin.isBreakHandlerEnabled()) {
BreakHandlerScript.setLockState(false);
}

while (!Rs2Bank.isOpen() && isRunning() &&
(!Rs2Inventory.allPouchesFull()
|| !Rs2Inventory.contains(colossalPouch)
Expand Down Expand Up @@ -456,6 +474,8 @@ private void handleWrathWalking() {
BreakHandlerScript.setLockState(true);
}

if (Rs2Bank.isOpen()) { Rs2Bank.closeBank(); }

Comment on lines +477 to +478
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure bank is fully closed before myth cape interactions.
Without a wait, item interactions can be flaky if the bank overlay lingers a tick.

Apply:

-        if (Rs2Bank.isOpen()) { Rs2Bank.closeBank(); }
+        if (Rs2Bank.isOpen()) {
+            Rs2Bank.closeBank();
+            sleepUntil(() -> !Rs2Bank.isOpen(), 1200);
+        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (Rs2Bank.isOpen()) { Rs2Bank.closeBank(); }
if (Rs2Bank.isOpen()) {
Rs2Bank.closeBank();
sleepUntil(() -> !Rs2Bank.isOpen(), 1200);
}
🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 480-481, the code closes the bank but does not wait for the bank
overlay to fully disappear, causing flaky item interactions; modify the logic to
close the bank and then wait until Rs2Bank.isOpen() returns false (or until a
short timeout, e.g., 500ms) before proceeding with myth cape interactions so the
overlay is fully gone and subsequent clicks are reliable.

if (Rs2Inventory.contains(mythCape)) {
Microbot.log("Interacting with myth cape");
Rs2Inventory.interact(mythCape, "Teleport");
Expand Down Expand Up @@ -721,6 +741,9 @@ private void handleCrafting() {

if (plugin.isBreakHandlerEnabled()) {
BreakHandlerScript.setLockState(false);
if (BreakHandlerScript.isBreakActive() || BreakHandlerScript.breakIn <= 0) {
return;
}
}

state = State.BANKING;
Expand Down