Skip to content

Comments

Allow interacting with Rs2ItemModel's submenu#1555

Merged
chsami merged 5 commits intochsami:developmentfrom
Krulvis:feature/invokesubmenu
Oct 11, 2025
Merged

Allow interacting with Rs2ItemModel's submenu#1555
chsami merged 5 commits intochsami:developmentfrom
Krulvis:feature/invokesubmenu

Conversation

@Krulvis
Copy link
Contributor

@Krulvis Krulvis commented Oct 5, 2025

Rs2ItemModel provides access to subops from which the sub-menu action and main action can be derived.
Lets say you want to teleport to "Castle wars" with your "Ring of dueling":
The ring provides a sub-menu with "Castle Wars" on right-click under "Rub". The sub-menu's "Castle Wars" comes from the Rs2ItemModel's subOps but the index of "Rub" depends on the inventory interface from which this interaction is executed.

This change has also been implemented throughout Rs2Walker to make sure it no longer relies on the 2-step transport interactions. Neither does it still need to calculate the invokeMenu's required identification with the number placed at the displayInfo.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 5, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes add sub-action support for inventory item interactions. Rs2Inventory now computes the menu identifier by first checking the primary actions array; if not found, it queries Rs2ItemModel for a sub-action mapping, calculates the identifier via NewMenuEntry.findIdentifier, and sets an empty target for sub-action paths. Invocation now passes a target variable rather than always using the item name. Rs2ItemModel introduces getSubops() and getIndexOfSubAction(String), with lazy composition loading to expose sub-operations and map sub-actions to their corresponding main action and sub-index.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title accurately and concisely summarizes the primary enhancement of the pull request, which is enabling interaction with the Rs2ItemModel's submenu entries, and it avoids unnecessary detail or generic phrasing.
Description Check ✅ Passed The pull request description clearly explains the addition of subOps in Rs2ItemModel and how it enables deriving the correct submenu action and main action index (e.g., “Castle Wars” under “Rub” for the Ring of dueling), and it references the related changes in Rs2Walker. This aligns closely with the file-level summaries that introduce subops accessors and update inventory invocation logic. The description is specific and on-topic, providing meaningful context for the changeset.

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.

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

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between dca6f15 and 0cfc1cd.

📒 Files selected for processing (2)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/inventory/Rs2Inventory.java (3 hunks)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/inventory/Rs2ItemModel.java (21 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-08-25T15:51:39.272Z
Learnt from: runsonmypc
PR: chsami/Microbot#1417
File: runelite-client/src/main/java/net/runelite/client/plugins/microbot/agility/AgilityScript.java:13-13
Timestamp: 2025-08-25T15:51:39.272Z
Learning: Both net.runelite.api.ItemID and net.runelite.api.gameval.ItemID are valid import paths in the RuneLite codebase. The microbot plugins consistently use net.runelite.api.ItemID as their established pattern.

Applied to files:

  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/inventory/Rs2ItemModel.java
📚 Learning: 2025-08-26T13:22:16.518Z
Learnt from: Voxsylvae
PR: chsami/Microbot#1415
File: runelite-client/src/main/java/net/runelite/client/plugins/microbot/pluginscheduler/tasks/requirements/PrePostScheduleRequirements.java:1215-1221
Timestamp: 2025-08-26T13:22:16.518Z
Learning: The Rs2Equipment.get(slot) method in the Microbot framework returns Rs2ItemModel instances with slot indices that correspond to valid EquipmentInventorySlot values, as items are retrieved by iterating through the enum values themselves. When processing equipment items that were originally obtained via Rs2Equipment.get(slot), the slot indices are guaranteed to be valid for EquipmentInventorySlot.values()[index] access.

Applied to files:

  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/inventory/Rs2ItemModel.java
🧬 Code graph analysis (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/inventory/Rs2Inventory.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

@Krulvis Krulvis marked this pull request as draft October 5, 2025 17:33
@Krulvis Krulvis marked this pull request as ready for review October 6, 2025 21:21
@chsami chsami merged commit 6496172 into chsami:development Oct 11, 2025
1 check passed
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