fix(Rs2Spellbook): Arceuus to Modern spellbook swap fixes#1436
fix(Rs2Spellbook): Arceuus to Modern spellbook swap fixes#1436gmason0 merged 1 commit intochsami:developmentfrom
Conversation
…failing to swap from Arceuus to Modern
WalkthroughUpdated ARCEUUS spellbook location coordinates. Modified switchTo control flow: when switching from ARCEUUS to MODERN, the method now uses switchViaNpc() with an early return instead of switchViaAltar(). Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Caller
participant Rs2Spellbook
participant CurrentSpellbook
participant switchViaNpc
participant switchViaAltar
Caller->>Rs2Spellbook: switchTo(MODERN)
Rs2Spellbook->>CurrentSpellbook: getCurrent()
alt Current is ARCEUUS (changed path)
Note over Rs2Spellbook: New flow for ARCEUUS→MODERN
Rs2Spellbook->>switchViaNpc: invoke()
switchViaNpc-->>Rs2Spellbook: result
Rs2Spellbook-->>Caller: return
else Current is not ARCEUUS
Note over Rs2Spellbook: Existing logic continues
Rs2Spellbook->>switchViaAltar: possibly invoke()
switchViaAltar-->>Rs2Spellbook: result
Rs2Spellbook-->>Caller: return
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 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
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/magic/Rs2Spellbook.java (2)
78-81: Tyss location update: looks plausible; please verify the exact tile and ID.
- Confirm 1712,3883,0 is Tyss’ current tile (not just “Dark Altar” in general). If this is Tyss’ exact tile, adjust the comment to reflect “Tyss (Dark Altar)” for clarity.
- The comment says “Tyss NPC ID” but the value is
NpcID.ARCEUUS_DARKGUARDIAN. If RuneLite exposesNpcID.TYSS, prefer that for correctness.Proposed tweaks:
- new WorldPoint(1712, 3883, 0), // Dark Altar location north of Arceuus - NpcID.ARCEUUS_DARKGUARDIAN, // Tyss NPC ID + new WorldPoint(1712, 3883, 0), // Tyss (Dark Altar), north of Arceuus + NpcID.TYSS, // Tyss NPC ID
206-210: Arceuus→Modern path: wait for the varbit and keep a safe fallback; use enum ‘==’.
- Using Tyss here is correct, but return as “successful” only after the spellbook varbit flips to MODERN.
- If Tyss isn’t reachable, fall back to altar logic.
- Prefer
==for enum comparison.Apply:
- // For switching to MODERN, try altar method first (most reliable) - // We determine which altar to use based on current spellbook - if(Rs2Magic.getSpellbook().equals(Rs2Spellbook.ARCEUUS)) return switchViaNpc(); //Needed for swapping from Arceuus to Modern. - return switchViaAltar(); + // Prefer Tyss when coming from ARCEUUS; otherwise fall back to altar. + if (Rs2Magic.getSpellbook() == Rs2Spellbook.ARCEUUS) { + boolean started = switchViaNpc(); // Needed for swapping from Arceuus to Modern. + if (started) { + return sleepUntil(() -> getCurrentSpellbook() == MODERN, 5000); + } + // Fallback if Tyss not reachable + } + return switchViaAltar();To align semantics across methods, also make
switchViaNpc()wait for the varbit flip:@@ - Rs2Dialogue.clickOption("I'd like to stop using your spellbook now."); - return Rs2Dialogue.sleepUntilHasContinue(); + Rs2Dialogue.clickOption("I'd like to stop using your spellbook now."); + return sleepUntil(() -> getCurrentSpellbook() == MODERN, 5000); @@ - Rs2Dialogue.clickOption("Can I try the magicks myself?"); - return Rs2Dialogue.sleepUntilHasContinue(); + Rs2Dialogue.clickOption("Can I try the magicks myself?"); + return sleepUntil(() -> getCurrentSpellbook() == ARCEUUS, 5000);
📜 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.
📒 Files selected for processing (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/magic/Rs2Spellbook.java(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/magic/Rs2Spellbook.java (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/magic/Rs2Magic.java (1)
Rs2Magic(43-600)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Build
Summary by CodeRabbit