Skip to content

Comments

ReturnTab boolean function in Rs2Prayer.toggle#1583

Closed
Jamdrizzle wants to merge 1 commit intochsami:mainfrom
Jamdrizzle:rs2prayer-returnTab
Closed

ReturnTab boolean function in Rs2Prayer.toggle#1583
Jamdrizzle wants to merge 1 commit intochsami:mainfrom
Jamdrizzle:rs2prayer-returnTab

Conversation

@Jamdrizzle
Copy link

Added a new optional boolean function in Rs2Prayer.toggle that has "returnTab" of which the purpose is to do the original function and then return to the previous tab after the prayer is turned on. This will be useful for PvM purposes where staying on another tab is ideal for manual play, or otherwise.

…eturnTab" of which the purpose is to do the original function and then return to the previous tab after the prayer is turned on. This will be useful for PvM purposes where staying on another tab is ideal for manual play, or otherwise.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 22, 2025

Walkthrough

A new overload method is added to the Rs2Prayer class that extends the existing prayer toggle functionality. The new toggle(prayer, on, withMouse, returnTab) method includes additional parameters to control tab management. The implementation incorporates abort conditions for insufficient prayer points, early returns for already-matching states, tab state capture and restoration, prayer action invocation, and a 10-second wait period for the prayer state to reach the desired configuration.

Possibly related PRs

  • Refactor Rs2Prayer #1463: Modifies the Rs2Prayer toggle API and implements mouse-driven prayer toggling behavior that this PR builds upon with the new 4-argument overload.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "ReturnTab boolean function in Rs2Prayer.toggle" directly and specifically describes the main change in the changeset: adding a new overload method to Rs2Prayer.toggle with a returnTab boolean parameter. The title is clear and concise, allowing someone reviewing the git history to immediately understand the primary change without ambiguity.
Description Check ✅ Passed The pull request description is directly related to the changeset and provides meaningful context about the changes. It clearly explains that a new optional boolean parameter "returnTab" was added to Rs2Prayer.toggle, describes its purpose (returning to the previous tab after toggling a prayer), and explains the use case (PvM scenarios where maintaining a different active tab is beneficial for manual play).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b32890f and d99e22b.

📒 Files selected for processing (1)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/prayer/Rs2Prayer.java (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

runelite-client/src/main/java/net/runelite/client/plugins/microbot/**/*.java: Place all gameplay automation code under runelite-client/src/main/java/net/runelite/client/plugins/microbot
Prefix configuration interfaces with the plugin name (e.g., ExampleConfig) within microbot plugins

Files:

  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/prayer/Rs2Prayer.java
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

Put shared helpers under .../microbot/util

Files:

  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/prayer/Rs2Prayer.java
**/*.java

📄 CodeRabbit inference engine (AGENTS.md)

**/*.java: Use tabs for indentation, follow the brace placement style exemplified in MicrobotPlugin.java, and keep lines under 120 characters
Use UpperCamelCase for types and lowerCamelCase for members

Files:

  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/prayer/Rs2Prayer.java
⏰ 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)

77-108: LGTM - Logic is consistent.

The new overload correctly implements the returnTab feature. The method properly:

  • Captures the original tab before switching
  • Switches to PRAYER tab only when using mouse and not already on it
  • Restores the original tab only when using mouse, returnTab is requested, and the current tab differs from the saved one

The logic handles all scenarios correctly, including edge cases where the user is already on the PRAYER tab.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Jamdrizzle Jamdrizzle changed the title Added a new optional boolean function in Rs2Prayer.toggle that has "r… ReturnTab boolean function in Rs2Prayer.toggle Oct 22, 2025
@Krulvis
Copy link
Contributor

Krulvis commented Oct 23, 2025

I would advice against adding behavioral logic like that to this function. The added functionality of going back to the previous tab has nothing to do with the original function and only adds more code to maintain. I believe it is better to make sure that this behavior is added when necessary to a script that actually requires it. If you want to reduce duplicate code you can create a wrapper function inside the script that requires this.

@Jamdrizzle Jamdrizzle closed this Oct 26, 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.

2 participants