Skip to content

Comments

Frostyrc fixes#1429

Merged
gmason0 merged 8 commits intochsami:developmentfrom
Netoxique:frostyrc_fixes
Aug 30, 2025
Merged

Frostyrc fixes#1429
gmason0 merged 8 commits intochsami:developmentfrom
Netoxique:frostyrc_fixes

Conversation

@Netoxique
Copy link
Contributor

@Netoxique Netoxique commented Aug 24, 2025

Fixed not drinking at ferox if energy/health recovered before drinking.
Fixed getting stuck after teleporting to bank by checking energy/health after crafting.
Fixed getting stuck after break by allowing breaks after runcrafting.
Fixed logic that bounced back to bank after already teleporting to Ferox.
Faster walking to wrath ruins.

Summary by CodeRabbit

  • New Features
    • Smarter Ferox Enclave refills: automatically drinks when energy is low or health is low, waits to high energy, and coordinates travel and drinking.
    • Teleport prioritization: prefers Ferox Enclave when a refill is needed, improving reliability and speed.
    • Wrath travel enhancement: detects and teleports via the Mythic Statue when available.
    • Smoother crafting/banking flow: resumes banking after refilling, reducing downtime and unnecessary waits.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 24, 2025

Walkthrough

Adds a volatile flag to coordinate Ferox pool usage, expands run-energy/HP checks to trigger drinking, reorders bank teleport priorities based on refill need, introduces Mythic Statue teleport during Wrath walking and reduces a sleep, and adjusts crafting flow to re-enable break lock and transition to BANKING.

Changes

Cohort / File(s) Summary
Energy and teleport control-flow updates
runelite-client/.../microbot/frosty/frostyrc/RcScript.java
Adds volatile forceDrinkAtFerox flag; enhances handleFeroxRunEnergy with HP/run thresholds, movement/waiting near pool, and post-drink reset; reorders bank teleports with conditional Ferox-first and immediate energy handling; adjusts Wrath walking (Mythic Statue TP, shorter sleep); updates crafting to re-lock break handler before BANKING.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller as Caller
  participant Rc as RcScript
  participant Move as Movement
  participant Pool as Ferox Pool

  Caller->>Rc: handleFeroxRunEnergy()
  alt forceDrinkAtFerox || runEnergy <= 15 || hp% <= 20
    Rc->>Move: Navigate to Ferox (if far)
    Move-->>Rc: Within pool range
    Rc->>Pool: Drink
    Rc-->>Rc: Wait until runEnergy > 90
    Rc-->>Rc: forceDrinkAtFerox = false
  else
    Rc-->>Caller: No action
  end
Loading
sequenceDiagram
  autonumber
  participant Bank as Banking Logic
  participant Rc as RcScript
  participant TP as Teleports
  participant Ferox as Ferox Flow

  Bank->>Rc: Determine teleport order
  Rc-->>Rc: needRefill = forceDrinkAtFerox || runEnergy <= 15 || hp% <= 20
  alt needRefill
    Rc->>TP: Try Ferox Enclave first (then Crafting, Farming)
    TP-->>Rc: Using Ferox Enclave
    Rc-->>Rc: forceDrinkAtFerox = true
    Rc->>Ferox: handleFeroxRunEnergy()
  else
    Rc->>TP: Original order (Crafting, Farming, Ferox)
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java (1)

335-351: Prevent unintended world-walking to Ferox; gate by proximity/region and add timeouts/reset.

Calling handleFeroxRunEnergy from arbitrary states can trigger a long walk across the world to feroxPoolWp. This risks getting stuck or fighting with teleport logic. Also, sleepUntil has no explicit timeout here, and forceDrinkAtFerox may be left true for longer than intended if movement/drink fails.

Recommend:

  • Only walk to the pool if already near (or already in the Ferox region). Otherwise, set the flag and return, letting handleBankTeleport prioritize Ferox and consume the flag.
  • Add explicit timeouts to sleepUntil to avoid indefinite waits.
  • Ensure the flag resets even when the pool interaction doesn’t complete quickly.

Proposed patch within this block:

-        if (forceDrinkAtFerox || Rs2Player.getRunEnergy() <= 15 || Rs2Player.getHealthPercentage() <= 20) {
-            Microbot.log("We are thirsty...let us Drink");
-            forceDrinkAtFerox = true;
-            if (plugin.getMyWorldPoint().distanceTo(feroxPoolWp) > 5) {
-                Microbot.log("Walking to Ferox pool");
-                Rs2Walker.walkTo(feroxPoolWp);
-                sleepUntil(() -> plugin.getMyWorldPoint().distanceTo(feroxPoolWp) < 5);
-            }
-
-            if (plugin.getMyWorldPoint().distanceTo(feroxPoolWp) < 5) {
-                Microbot.log("Interacting with the Ferox pool");
-                Rs2GameObject.interact(feroxPool, "Drink");
-            }
-            sleepUntil(() -> (!Rs2Player.isInteracting()) && !Rs2Player.isAnimating() && Rs2Player.getRunEnergy() > 90);
-            sleepGaussian(1100, 200);
-            forceDrinkAtFerox = false;
-        }
+        if (forceDrinkAtFerox || Rs2Player.getRunEnergy() <= 15 || Rs2Player.getHealthPercentage() <= 20) {
+            Microbot.log("We are thirsty...let us Drink");
+            int dist = plugin.getMyWorldPoint().distanceTo(feroxPoolWp);
+            // If we're far and not already in Ferox region, just set the flag and let bank teleport handle routing.
+            if (dist > 25 && !Teleports.FEROX_ENCLAVE.matchesRegion(plugin.getMyWorldPoint().getRegionID())) {
+                forceDrinkAtFerox = true;
+                return;
+            }
+            forceDrinkAtFerox = true;
+            if (dist > 5) {
+                Microbot.log("Walking to Ferox pool");
+                Rs2Walker.walkTo(feroxPoolWp);
+                sleepUntil(() -> plugin.getMyWorldPoint().distanceTo(feroxPoolWp) < 5, 10000);
+            }
+            if (plugin.getMyWorldPoint().distanceTo(feroxPoolWp) < 5) {
+                Microbot.log("Interacting with the Ferox pool");
+                Rs2GameObject.interact(feroxPool, "Drink");
+            }
+            sleepUntil(() -> (!Rs2Player.isInteracting()) && !Rs2Player.isAnimating() && Rs2Player.getRunEnergy() > 90, 15000);
+            sleepGaussian(1100, 200);
+            forceDrinkAtFerox = false;
+        }
🧹 Nitpick comments (2)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java (2)

463-468: Add a post-click wait after Mythic Statue interaction to avoid walking during teleport anim.

After clicking the statue, immediately walking can conflict with the teleport animation. Add a short wait for the animation to finish.

-            GameObject statue = Rs2GameObject.get("Mythic Statue");
-            if (statue != null && !Rs2Player.isAnimating()) {
-                Rs2GameObject.interact(statue, "Teleport");
-            }
+            GameObject statue = Rs2GameObject.get("Mythic Statue");
+            if (statue != null && !Rs2Player.isAnimating()) {
+                Rs2GameObject.interact(statue, "Teleport");
+                sleepUntil(() -> !Rs2Player.isAnimating(), 5000);
+            }

If you’ve seen occasional stalls here, this should reduce them. If not, feel free to skip.


750-756: Reordered bank teleports based on refill need is good; consider aligning thresholds.

The new needRefill gate uses energy <= 15 or HP <= 20%, while other pool triggers in this class (e.g., PoH pool usage) use 45%. Consider harmonizing thresholds or making them config-driven to avoid inconsistent behavior between PoH vs Ferox refills.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a91cba4 and b5f4515.

📒 Files selected for processing (1)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java (7 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java (2)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/player/Rs2Player.java (1)
  • Rs2Player (67-2062)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/gameobject/Rs2GameObject.java (1)
  • Rs2GameObject (36-2002)
🔇 Additional comments (2)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java (2)

51-51: Sensible cross-method coordination with a volatile flag.

Using a volatile boolean for forceDrinkAtFerox is a reasonable choice for visibility across the scheduler and any auxiliary threads. No concerns here.


770-773: Immediate Ferox drink after teleport is the right call.

Setting the flag and invoking handleFeroxRunEnergy right after a Ferox teleport eliminates the “teleport-to-Ferox-but-didn’t-drink” bounce. Nice.

Comment on lines +720 to +725
handleFeroxRunEnergy();

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

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

Don’t call handleFeroxRunEnergy from CRAFTING; set the flag and let teleport logic consume it.

Calling handleFeroxRunEnergy here can trigger a long “walk to Ferox” from within altar regions. Safer: mark intent via forceDrinkAtFerox and allow handleBankTeleport (now prioritizing Ferox when needRefill) to route correctly. If we happen to already be at/near Ferox, still allow immediate drink.

-        handleFeroxRunEnergy();
+        if (Teleports.FEROX_ENCLAVE.matchesRegion(plugin.getMyWorldPoint().getRegionID())
+            || plugin.getMyWorldPoint().distanceTo(feroxPoolWp) < 25) {
+            handleFeroxRunEnergy();
+        } else {
+            // Defer to bank teleport routing; this prevents long world-walks from altars.
+            forceDrinkAtFerox = true;
+        }
📝 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
handleFeroxRunEnergy();
if (plugin.isBreakHandlerEnabled()) {
BreakHandlerScript.setLockState(false);
}
// Only immediately handle Ferox run energy if we're in or very near Ferox;
// otherwise defer to teleport routing via forceDrinkAtFerox.
if (Teleports.FEROX_ENCLAVE.matchesRegion(plugin.getMyWorldPoint().getRegionID())
|| plugin.getMyWorldPoint().distanceTo(feroxPoolWp) < 25)
{
handleFeroxRunEnergy();
}
else
{
// Defer to bank teleport routing; prevents long world-walks from altars.
forceDrinkAtFerox = true;
}
if (plugin.isBreakHandlerEnabled())
{
BreakHandlerScript.setLockState(false);
}
🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/frosty/frostyrc/RcScript.java
around lines 720 to 725, remove the direct call to handleFeroxRunEnergy and
instead set the forceDrinkAtFerox flag so teleport/banking logic can consume the
intent; ensure handleBankTeleport (which now prioritizes Ferox when needRefill)
will route to Ferox and call handleFeroxRunEnergy when it performs the teleport,
and add a short conditional to still call handleFeroxRunEnergy immediately only
if the player is already at or very near Ferox to avoid long unwanted walks from
altar regions.

@gmason0 gmason0 merged commit f4d1c61 into chsami:development Aug 30, 2025
2 checks passed
@chsami chsami mentioned this pull request Sep 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants