Skip to content

Comments

Agility Pyramid plugin will now auto-cast Humidify#1467

Merged
chsami merged 1 commit intochsami:developmentfrom
heap-overfl0w:add-humidify-to-agility-pyramid
Sep 4, 2025
Merged

Agility Pyramid plugin will now auto-cast Humidify#1467
chsami merged 1 commit intochsami:developmentfrom
heap-overfl0w:add-humidify-to-agility-pyramid

Conversation

@heap-overfl0w
Copy link
Contributor

  • Agility Pyramid plugin will now auto-cast Humidify if you have the requirements satisfied to do so.
  • Fixed a deprecated API call with Simon Templeton by using Rs2NpcModel instead.

…quirements satisfied to do so.

Fixed a deprecated API call with Simon Templeton by using Rs2NpcModel instead.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

Walkthrough

  • Updated PyramidCourse to use Rs2NpcModel with Rs2Inventory.useItemOnNpc for turning in the pyramid top to Simon (replacing direct NPC usage, in two places).
  • Added imports for Rs2NpcModel, Rs2Magic, and MagicAction.
  • Reworked waterskin management: if all waterskins are empty and Humidify is available, cast Humidify, wait for animation completion, and confirm refill; if some are filled, skip casting; if Humidify is unavailable, drop one empty waterskin.
  • Added debug logging for new decision branches.
  • Preserved existing course logic (gap crossing, XP obstacles, obstacle cooldown).

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 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 or @coderabbit 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

📜 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 19fa74d and e75d1a7.

📒 Files selected for processing (1)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/agility/courses/PyramidCourse.java (3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 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/agility/courses/PyramidCourse.java
🧬 Code graph analysis (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/agility/courses/PyramidCourse.java (4)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/magic/Rs2Magic.java (1)
  • Rs2Magic (44-608)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/inventory/Rs2Inventory.java (1)
  • Rs2Inventory (60-2244)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/Global.java (1)
  • Global (10-171)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/player/Rs2Player.java (1)
  • Rs2Player (67-2070)
🔇 Additional comments (2)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/agility/courses/PyramidCourse.java (2)

19-21: Imports for Rs2NpcModel/Magic usage look correct.

Dependencies align with Rs2Inventory.useItemOnNpc(int, Rs2NpcModel) and MagicAction.HUMIDIFY.


1163-1167: Good deprecation migration to Rs2NpcModel.

Replaces the deprecated overload cleanly and preserves reachability/dialogue handling.

Comment on lines +1206 to +1231
final boolean hasEmpty = Rs2Inventory.contains(ItemID.WATERSKIN0);
if (!hasEmpty) return false;

final boolean hasFilled = Rs2Inventory.contains(
ItemID.WATERSKIN1, ItemID.WATERSKIN2, ItemID.WATERSKIN3, ItemID.WATERSKIN4
);

if (!hasFilled && Rs2Magic.canCast(MagicAction.HUMIDIFY)) {
log.debug("All waterskins are empty; casting Humidify");
if (Rs2Magic.cast(MagicAction.HUMIDIFY)) {
Global.sleepUntil(Rs2Player::isAnimating, 1500);
Global.sleepUntil(() -> !Rs2Player.isAnimating() && !Rs2Inventory.contains(ItemID.WATERSKIN0), 3500);
Global.sleep(200, 400);
}
return true;
}
return false;

if (hasFilled && Rs2Magic.canCast(MagicAction.HUMIDIFY)) {
log.debug("Have filled waterskin(s); not casting Humidify because not all Waterskins are empty");
return false;
}

log.debug("Cannot cast Humidify; dropping empty waterskin(s)");
Rs2Inventory.drop(ItemID.WATERSKIN0);
Global.sleep(300, 500);
return true;
Copy link
Contributor

@coderabbitai coderabbitai bot Sep 3, 2025

Choose a reason for hiding this comment

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

⚠️ Potential issue

Full inventory + mixed waterskins can block pyramid-top pickup — free a slot.

When some waterskins are filled and others empty, this method returns false (no cast, no drop). If the inventory is full, the bot may fail to loot the pyramid top. Drop one empty waterskin when inventory is full regardless of Humidify availability to avoid stalling.

Apply this minimal guard right after computing hasFilled:

 final boolean hasFilled = Rs2Inventory.contains(
         ItemID.WATERSKIN1, ItemID.WATERSKIN2, ItemID.WATERSKIN3, ItemID.WATERSKIN4
 );
 
+// If inventory is full and we have a mix of filled and empty waterskins, free one slot.
+if (hasFilled && Rs2Inventory.isFull()) {
+    log.debug("Inventory full with mixed waterskins; dropping one empty waterskin to free a slot");
+    Rs2Inventory.drop(ItemID.WATERSKIN0);
+    Global.sleep(300, 500);
+    return true;
+}
+
 if (!hasFilled && Rs2Magic.canCast(MagicAction.HUMIDIFY)) {
     log.debug("All waterskins are empty; casting Humidify");
     if (Rs2Magic.cast(MagicAction.HUMIDIFY)) {
📝 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
final boolean hasEmpty = Rs2Inventory.contains(ItemID.WATERSKIN0);
if (!hasEmpty) return false;
final boolean hasFilled = Rs2Inventory.contains(
ItemID.WATERSKIN1, ItemID.WATERSKIN2, ItemID.WATERSKIN3, ItemID.WATERSKIN4
);
if (!hasFilled && Rs2Magic.canCast(MagicAction.HUMIDIFY)) {
log.debug("All waterskins are empty; casting Humidify");
if (Rs2Magic.cast(MagicAction.HUMIDIFY)) {
Global.sleepUntil(Rs2Player::isAnimating, 1500);
Global.sleepUntil(() -> !Rs2Player.isAnimating() && !Rs2Inventory.contains(ItemID.WATERSKIN0), 3500);
Global.sleep(200, 400);
}
return true;
}
return false;
if (hasFilled && Rs2Magic.canCast(MagicAction.HUMIDIFY)) {
log.debug("Have filled waterskin(s); not casting Humidify because not all Waterskins are empty");
return false;
}
log.debug("Cannot cast Humidify; dropping empty waterskin(s)");
Rs2Inventory.drop(ItemID.WATERSKIN0);
Global.sleep(300, 500);
return true;
final boolean hasEmpty = Rs2Inventory.contains(ItemID.WATERSKIN0);
if (!hasEmpty) return false;
final boolean hasFilled = Rs2Inventory.contains(
ItemID.WATERSKIN1, ItemID.WATERSKIN2, ItemID.WATERSKIN3, ItemID.WATERSKIN4
);
// If inventory is full with a mix of empty + filled waterskins, free one slot to avoid stalling.
if (hasFilled && Rs2Inventory.isFull()) {
log.debug("Inventory full with mixed waterskins; dropping one empty waterskin to free a slot");
Rs2Inventory.drop(ItemID.WATERSKIN0);
Global.sleep(300, 500);
return true;
}
if (!hasFilled && Rs2Magic.canCast(MagicAction.HUMIDIFY)) {
log.debug("All waterskins are empty; casting Humidify");
if (Rs2Magic.cast(MagicAction.HUMIDIFY)) {
Global.sleepUntil(Rs2Player::isAnimating, 1500);
Global.sleepUntil(() -> !Rs2Player.isAnimating() && !Rs2Inventory.contains(ItemID.WATERSKIN0), 3500);
Global.sleep(200, 400);
}
return true;
}
if (hasFilled && Rs2Magic.canCast(MagicAction.HUMIDIFY)) {
log.debug("Have filled waterskin(s); not casting Humidify because not all Waterskins are empty");
return false;
}
log.debug("Cannot cast Humidify; dropping empty waterskin(s)");
Rs2Inventory.drop(ItemID.WATERSKIN0);
Global.sleep(300, 500);
return true;
🤖 Prompt for AI Agents
In
runelite-client/src/main/java/net/runelite/client/plugins/microbot/agility/courses/PyramidCourse.java
around lines 1206 to 1231, after computing hasFilled, add a guard that if the
inventory is full and there is at least one empty waterskin (hasEmpty) then drop
a single empty waterskin immediately (to free a slot) regardless of Humidify
availability; place this check before the Humidify-casting branches so the bot
won't stall when inventory is full with mixed waterskins.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Silly rabbit. If someone wants to carry 28 waterskins, that’s their fault!

Copy link
Contributor

Choose a reason for hiding this comment

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

@heap-overfl0w Fair enough! 🐰 You're right that carrying 28 waterskins would be quite the inventory management choice. I'll trust users to manage their waterskin strategy sensibly. The current logic handles the normal cases well - all empty (cast Humidify) or mixed with Humidify unavailable (drop empty ones). Thanks for the feedback!

@chsami chsami merged commit f686afe into chsami:development Sep 4, 2025
2 checks 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