Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import net.runelite.client.plugins.microbot.util.gameobject.Rs2GameObject;
import net.runelite.client.plugins.microbot.util.inventory.Rs2Inventory;
import net.runelite.client.plugins.microbot.util.npc.Rs2Npc;
import net.runelite.client.plugins.microbot.util.npc.Rs2NpcModel;
import net.runelite.client.plugins.microbot.util.magic.Rs2Magic;
import net.runelite.client.plugins.skillcalculator.skills.MagicAction;
import net.runelite.client.plugins.microbot.util.player.Rs2Player;
import net.runelite.client.plugins.microbot.util.walker.Rs2Walker;
import net.runelite.client.plugins.microbot.agility.courses.PyramidObstacleData.ObstacleArea;
Expand Down Expand Up @@ -1157,7 +1160,7 @@ private boolean handlePyramidTurnIn() {
}
} else {
// Not in dialogue, use pyramid top on Simon
boolean used = Rs2Inventory.useItemOnNpc(ItemID.PYRAMID_TOP, simon);
boolean used = Rs2Inventory.useItemOnNpc(ItemID.PYRAMID_TOP, new Rs2NpcModel(simon));
if (used) {
log.debug("Successfully used pyramid top on Simon");
Global.sleepUntil(() -> Rs2Dialogue.isInDialogue(), 3000);
Expand Down Expand Up @@ -1197,19 +1200,35 @@ private boolean handlePyramidTurnIn() {
return false;
}
}

/**
* Checks for empty waterskins in inventory and drops them
* @return true if waterskins were dropped, false otherwise
*/


private boolean handleEmptyWaterskins() {
if (Rs2Inventory.contains(ItemID.WATERSKIN0)) {
log.debug("Found empty waterskin(s), dropping them");
Rs2Inventory.drop(ItemID.WATERSKIN0);
Global.sleep(300, 500);
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;
Comment on lines +1206 to +1231
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!

}

}
}