Skip to content
Open
Show file tree
Hide file tree
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 @@ -1091,6 +1091,25 @@ public static boolean depositAll(String name) {
return depositAll(name, false);
}

/**
* Empty containers using the "Empty containers" button
* This button empties all containers like log baskets, herb sacks, etc. directly to the bank
*
* @return true if containers were emptied successfully, false otherwise
*/
public static boolean emptyContainers() {
Microbot.status = "Empty containers";
if (!Rs2Bank.isOpen()) return false;

Widget widget = Rs2Widget.getWidget(786471); // Empty containers button ID
if (widget == null) return false;

Rs2Widget.clickWidget(widget);
sleep(1000, 2000); // Wait for containers to be emptied

return true;
Comment on lines +1104 to +1110
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Check the click result before reporting success.
emptyContainers() returns true even if the widget click fails, so callers can’t distinguish failure from success. Capture the click result (and optionally add a state confirmation) before returning success.

🛠️ Proposed fix
-		Rs2Widget.clickWidget(widget);
-		sleep(1000, 2000); // Wait for containers to be emptied
-		
-		return true;
+		boolean clicked = Rs2Widget.clickWidget(widget);
+		if (!clicked) return false;
+		sleep(1000, 2000); // Wait for containers to be emptied
+		return true;

As per coding guidelines, verify interaction success by checking return values and using sleepUntil for state confirmation.

📝 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
Widget widget = Rs2Widget.getWidget(786471); // Empty containers button ID
if (widget == null) return false;
Rs2Widget.clickWidget(widget);
sleep(1000, 2000); // Wait for containers to be emptied
return true;
Widget widget = Rs2Widget.getWidget(786471); // Empty containers button ID
if (widget == null) return false;
boolean clicked = Rs2Widget.clickWidget(widget);
if (!clicked) return false;
sleep(1000, 2000); // Wait for containers to be emptied
return true;
🤖 Prompt for AI Agents
In
`@runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/bank/Rs2Bank.java`
around lines 1104 - 1110, The emptyContainers() method currently clicks the
widget returned by Rs2Widget.getWidget(786471) and always returns true; change
it to capture the boolean result of Rs2Widget.clickWidget(widget) and only
proceed to the sleep/return true if that click returned true, otherwise return
false; additionally, after a successful click, add a short confirmation using a
state check (e.g., sleepUntil or checking the widget/state that indicates
containers are empty) before returning true so callers can reliably detect
success.

}

/**
* deposit all items
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class Rs2BankID {
49558, 49559, 49560, 49612, 49613, 49614, 49615, 49616, 49617, 49618, 50061, 50530, 50531, 50741, 50748, 50863, 50864, 50865,
50866, 50867, 50868, 50869, 50895, 50896, 50901, 50902, 51346, 51347, 51515, 51516, 51616, 51617, 52003, 52005, 52006, 52007,
52008, 52396, 52397, 52813, 52814, 52915, 53014, 53015, 53260, 53950, 53951, 53952, 53953, 54117, 54372, 54373, 54374, 54375,
54376, 54377, 54515, 54516, 54672, 54736, 54737, 54741, 54742, 54773, 54774, 54933, 54934, 55085, 55199, 55235, 55236, 57330
54376, 54377, 54515, 54516, 54672, 54736, 54737, 54741, 54742, 54773, 54774, 54933, 54934, 55085, 55199, 55235, 55236, 57330,
58627, 58628, 58629, 58630, 58128 // Charred Island, Sunbleak, and Deepfin bank chests
};
}