Skip to content

Comments

Auto cooking fixes#1486

Merged
chsami merged 9 commits intochsami:developmentfrom
heap-overfl0w:auto-cooking-fixes
Sep 8, 2025
Merged

Auto cooking fixes#1486
chsami merged 9 commits intochsami:developmentfrom
heap-overfl0w:auto-cooking-fixes

Conversation

@heap-overfl0w
Copy link
Contributor

  • All routing decisions outside BANKING state now use inventory-only checks, so starting with the bank open no longer tricks the script into WALKING/COOKING states without raw food to cook in the inventory.
  • BANKING state specifically checks the bank for raw food and handles withdrawals, then closes the bank.
  • Null check on Rogue's Den banker

chsami and others added 9 commits September 3, 2025 14:22
…pawn times.

- Added fuzzy gem bag support because I don't have an account to test this with. My implementation passes the eye test but will need actual testing.
…ragonstones, our gem bag will never be "completely full" (consisting of >= 60 gems of all 5 types) and could cause unnecessary fill attempts. Let's check the 4 types individually.
…checks, so starting with the bank open no longer tricks the script into WALKING/COOKING states without raw food to cook in the inventory.

- BANKING state specifically checks the bank for raw food and handles withdrawals, then closes the bank.
- Null check on Rogue's Den banker
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 7, 2025

Walkthrough

This PR removes the Quest Helper Integration section from README.md. In AutoCookingScript, it adds guards for missing locations and bank/item requirements, adjusts COOKING flow to transition to WALKING, adds banker null checks, switches post-deposit validation to a new hasRawItemInBank helper, and refactors hasRawItem to inventory-only. In FortisGemStallThievingSpot, it adds player detection and world-hopping guards, integrates gem bag checking/opening/filling, and revises banking to deposit specific uncut gems, empty the gem bag, and close the bank. New private helpers support gem detection and bag fullness. No public APIs changed.

Possibly related PRs

  • Add fortis gem stall #1472: Modifies FortisGemStallThievingSpot’s thieve()/bank() logic and mappings, directly overlapping with the same class and behaviors.
✨ 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

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: 0

🧹 Nitpick comments (5)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/thieving/stalls/model/FortisGemStallThievingSpot.java (3)

84-91: Consider using a collection for gem IDs to reduce duplication.

The individual deposit calls work but could be simplified.

-        Rs2Bank.depositAll(ItemID.UNCUT_SAPPHIRE);
-        Rs2Bank.depositAll(ItemID.UNCUT_EMERALD);
-        Rs2Bank.depositAll(ItemID.UNCUT_RUBY);
-        Rs2Bank.depositAll(ItemID.UNCUT_DIAMOND);
+        int[] uncutGems = {ItemID.UNCUT_SAPPHIRE, ItemID.UNCUT_EMERALD, ItemID.UNCUT_RUBY, ItemID.UNCUT_DIAMOND};
+        for (int gemId : uncutGems) {
+            Rs2Bank.depositAll(gemId);
+        }

104-110: Consider extracting gem IDs to a constant.

The gem ID checks are duplicated between isUncutGem and the banking logic.

+    private static final int[] UNCUT_GEM_IDS = {
+        ItemID.UNCUT_SAPPHIRE,
+        ItemID.UNCUT_EMERALD,
+        ItemID.UNCUT_RUBY,
+        ItemID.UNCUT_DIAMOND
+    };
+
     private boolean isUncutGem(Rs2ItemModel item) {
         int id = item.getId();
-        return id == ItemID.UNCUT_SAPPHIRE ||
-                id == ItemID.UNCUT_EMERALD ||
-                id == ItemID.UNCUT_RUBY ||
-                id == ItemID.UNCUT_DIAMOND;
+        for (int gemId : UNCUT_GEM_IDS) {
+            if (id == gemId) return true;
+        }
+        return false;
     }

52-58: Wait for stall respawn before world-hopping
Prevent excessive hops by polling for the “Steal-from” action (e.g. via Global.sleepUntil) for a few seconds before falling back to Microbot.hopToWorld in FortisGemStallThievingSpot.java (lines 52–58).

runelite-client/src/main/java/net/runelite/client/plugins/microbot/cooking/scripts/AutoCookingScript.java (2)

143-143: Null-guard on Rogue's Den banker prevents NPE; add a resilient fallback.

If the banker is transiently null for many ticks, you’ll spin in BANKING. Consider falling back to walkToBankAndUseBank() after N failed attempts or surfacing a one-time message.


168-170: Minor ordering: close bank before state change.

Reduces the chance of being in WALKING with the bank still open for one tick.

-                        state = CookingState.WALKING;
-                        Rs2Bank.closeBank();
+                        Rs2Bank.closeBank();
+                        state = CookingState.WALKING;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9cdf8cc and 5f18953.

📒 Files selected for processing (3)
  • README.md (0 hunks)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/cooking/scripts/AutoCookingScript.java (5 hunks)
  • runelite-client/src/main/java/net/runelite/client/plugins/microbot/thieving/stalls/model/FortisGemStallThievingSpot.java (2 hunks)
💤 Files with no reviewable changes (1)
  • README.md
🧰 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/thieving/stalls/model/FortisGemStallThievingSpot.java
🧬 Code graph analysis (2)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/thieving/stalls/model/FortisGemStallThievingSpot.java (4)
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/gameobject/Rs2GameObject.java (1)
  • Rs2GameObject (36-2002)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/inventory/Rs2Inventory.java (1)
  • Rs2Inventory (60-2325)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/player/Rs2Player.java (1)
  • Rs2Player (67-2076)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/cooking/scripts/AutoCookingScript.java (1)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/util/player/Rs2Player.java (1)
  • Rs2Player (67-2076)
⏰ 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 (10)
runelite-client/src/main/java/net/runelite/client/plugins/microbot/thieving/stalls/model/FortisGemStallThievingSpot.java (5)

39-41: LGTM! Player detection improves anti-ban.

The addition of player detection before thieving helps avoid competition and potential reports.


43-50: World hopping logic looks good.

The null check prevents NPEs and the world hop with login wait is properly implemented.


63-77: Gem bag automation is well implemented.

The gem bag handling logic properly checks state, opens the bag when needed, and fills it with uncut gems. The sequence of operations is correct.


82-82: Add null check for bank open verification.

Good defensive programming with the early return when bank is not open.


112-119: Gem bag fullness check implementation is correct.

The 60-unit threshold per gem type and the unknown state handling are appropriate. The stream operations correctly extract quantities.

runelite-client/src/main/java/net/runelite/client/plugins/microbot/cooking/scripts/AutoCookingScript.java (5)

77-81: Good fail-fast on missing location.

Prevents null-driven NPEs and pointless ticks.


90-93: Close bank before cooking to avoid UI conflicts.

Eliminates misclicks on the bank UI when starting the cook flow.


132-134: Sensible fallback to WALKING when cooker not found.

Avoids getting stuck in COOKING without an interactable object.


154-158: Bank-based raw check after deposit is correct.

Shuts down cleanly when out of raws; aligns with inventory-only checks elsewhere.


229-231: Helper separation (bank vs inventory) is clean.

Keeps routing logic unambiguous and prevents false positives.

@chsami chsami merged commit 098256a into chsami:development Sep 8, 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