Conversation
… icon, instead of always using 1,1
WalkthroughRs2Prayer was refactored to a state-driven, UI-aware system. New methods toggle individual prayers (optionally via mouse), handle tab switching, and click within prayer widget bounds. Legacy varbit checks were replaced with VarbitID-based unlock predicates (e.g., Augury, Rigour). Quick prayer handling was expanded: detection, state checks, toggling (with/without mouse), and helpers for bulk enable/disable. Added helpers for quick-prayer orb interaction and bounds retrieval. Logging via @slf4j warns on missing widgets/bounds. Public API grew with toggle variants, bulk management methods, and unlock checks. Internal helpers structure UI interactions and verification via sleepUntil. Possibly related PRs
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 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 (4)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/prayer/Rs2Prayer.java (4)
67-75: Ensure tab switch completes before using natural mouse boundsAfter switching to the PRAYER tab you immediately fetch/click bounds. Add a short wait so the widgets are present; otherwise withMouse often degrades to the default rectangle and defeats the “natural mouse” goal.
- if (withMouse && Rs2Tab.getCurrentTab() != InterfaceTab.PRAYER) - { - Rs2Tab.switchTo(InterfaceTab.PRAYER); - } + if (withMouse && Rs2Tab.getCurrentTab() != InterfaceTab.PRAYER) + { + Rs2Tab.switchTo(InterfaceTab.PRAYER); + // Wait briefly for prayer widgets to materialize before computing bounds + sleepUntil(() -> Rs2Tab.getCurrentTab() == InterfaceTab.PRAYER + && Rs2Widget.getWidget(prayer.getIndex()) != null + && Rs2Widget.getWidget(prayer.getIndex()).getBounds() != null, 1_500); + }
302-306: Avoid rebuilding a list in the stream; precompute a SetYou recreate Arrays.asList(...) per element and do O(n) contains. Precompute an EnumSet for O(1) membership and fewer allocations.
- Arrays.stream(Rs2PrayerEnum.values()) - .filter(Rs2Prayer::isPrayerActive) - .filter(prayer -> !Arrays.asList(prayersToKeep).contains(prayer)) - .forEach(prayer -> Rs2Prayer.toggle(prayer, false, withMouse)); + final java.util.Set<Rs2PrayerEnum> keep = java.util.EnumSet.noneOf(Rs2PrayerEnum.class); + keep.addAll(Arrays.asList(prayersToKeep)); + Arrays.stream(Rs2PrayerEnum.values()) + .filter(Rs2Prayer::isPrayerActive) + .filter(prayer -> !keep.contains(prayer)) + .forEach(prayer -> Rs2Prayer.toggle(prayer, false, withMouse));
109-116: Demote noisy widget-bound warnings to debugMissing/invalid bounds during tab transitions are normal and will spam logs. Prefer debug to keep warnings meaningful.
- log.warn("Prayer widget not found: {}", prayer.getName()); + log.debug("Prayer widget not found: {}", prayer.getName()); ... - log.warn("Invalid prayer bounds for: {}", prayer.getName()); + log.debug("Invalid prayer bounds for: {}", prayer.getName()); ... - log.warn("Quick prayer orb widget not found"); + log.debug("Quick prayer orb widget not found"); ... - log.warn("Invalid quick prayer orb bounds"); + log.debug("Invalid quick prayer orb bounds");Also applies to: 248-255
32-41: Fix Javadoc to reflect behaviorThis overload always toggles (inverts state) unless out of prayer; it doesn’t check a “desired state.”
- /** - * Toggles a prayer on or off. If the prayer is already in the desired state, no action is taken. - * - * @param prayer the prayer to toggle - */ + /** + * Toggles a prayer (inverts its current state). + * No-op only when out of prayer points. + * + * @param prayer the prayer to toggle + */
📜 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/prayer/Rs2Prayer.java(5 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/prayer/Rs2Prayer.java (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/menu/NewMenuEntry.java (1)
NewMenuEntry(11-317)
⏰ 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
🔇 Additional comments (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/prayer/Rs2Prayer.java (1)
85-93: Verify CC_OP identifier/opcode for all prayer/quick-prayer actionsBoth invokePrayer and invokeQuickPrayer assume identifier 1 with MenuAction.CC_OP. If any prayer widget exposes “Activate/Deactivate” on a different op index (or the orb’s option index varies), these calls will no-op.
Please sanity-check in-game (or via widget inspector) that:
- Prayer buttons: CC_OP with identifier 1 toggles in both active and inactive states.
- Quick-prayer orb: CC_OP with identifier 1 toggles; “Setup” uses identifier 2 as used in setQuickPrayers.
If discrepancies exist, compute the correct identifier from widget actions at runtime, or switch to NewMenuEntry helpers that resolve identifiers. I can draft that if needed.
Also applies to: 226-234, 166-176
This pull request aims to refactor the Rs2Prayer class, with optional support for using the natural mouse by passing realistic rectangles into Microbot#doInvoke.
We still default to not using this feature via overloaded parameters to ensure we prevent breaking previous implementations.
I want to say shoutout to Being for assisting with this idea, I just took it the extra mile to get this more polished around the edges.
Features
Chores