Skip to content

fix(AutoMiningPlugin): progressive mode banks and mines at the chosen mine, blank keep list no longer stalls drop mode (1.0.15) - #655

Merged
chsami merged 3 commits into
developmentfrom
claude/improve-mining-202610181803
Oct 18, 2026
Merged

chsami merged 3 commits into
developmentfrom
claude/improve-mining-202610181803

Conversation

@chsami

@chsami chsami commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Hardening for AutoMiningPlugin. Three reliability fixes, plugin version 1.0.14 -> 1.0.15.

1. Progressive mode with banking never deposits (mining-F1)

What a player sees: Progressive mode and Use Bank are both on. The inventory fills at a mine (for example Al Kharid iron). The script walks to the bank and opens it, then closes it and walks back to the mine, then walks to the bank again. It repeats this forever with a full inventory and never deposits anything.

Root cause: AutoMiningScript.java:82 ran the progressive location check on every tick, before the state switch. In RESETTING, the bank branch (AutoMiningScript.java:196-201) returns as soon as Rs2Bank.walkToBankAndUseBank opens the bank, so the deposit can only happen on the next tick. On that tick, the check at line 82 ran first. The player was at the bank, far from the mine, so it called Rs2Walker.walkTo(targetPoint, 3). The walker closes an open bank before walking, so the player went back to the mine while still in RESETTING.

Change: The progressive location check now runs only in State.MINING. In RESETTING, the bank branch now gets its next tick: deposit, close the bank, walk back, then set MINING. While mining, progressive mode still walks to the chosen mine and still switches mines on level-up.

2 and 3. Progressive mode walks back and forth between the start tile and the chosen mine (mining-F2, mining-F3)

What a player sees:

  • Case A: The player starts progressive mode more than distanceToStray tiles (default 20) from the chosen mine, for example in Lumbridge castle with level 1 Mining. The script walks to Lumbridge Swamp mine, then walks back to the castle, then to the mine again, and never mines.
  • Case B: The player starts at the tin mine and reaches level 15. The target becomes iron at Al Kharid, and the same back-and-forth starts between the old mine and the new one.

Root cause: On the first tick, lines 71-73 set initialPlayerLocation to the player's own tile. In ensureProgressiveLocation (AutoMiningScript.java:316-318), the anchor was only moved to the mine when initialPlayerLocation == null, which by then can never be true. So the stray check in MINING (lines 142-148), the rock search in findRock (lines 238/244) and the walk back after banking (line 213) all used the start tile or the old mine. #390 (237e175) introduced this when it narrowed the condition to null-only, so that the anchor would not move while the player stood at the bank. targetPoint is the fixed coordinate of the selected location, though, not the player's position, so the earlier condition never followed the player to the bank anyway.

Change: The pre-#390 condition is back: ensureProgressiveLocation sets the anchor to targetPoint whenever they differ. The anchor follows the selected mine at start and after every level-up mine switch. It also recovers if another script's shutdown clears the shared static anchor. Non-progressive mode never calls this method, so it is unchanged. The F2 finding proposed setting the anchor in updateActiveRock. This one change fixes both findings, and it also handles the anchor being cleared by another script's shutdown.

4. A blank or comma-only "Items to keep" makes drop mode stall on a full inventory (mining-F4)

What a player sees: Use Bank is off and "Items to keep" is cleared, or set to something like pickaxe, (comma and space) or a,,b. When the inventory fills, nothing is dropped, and the script stands still with a full inventory. No error is logged.

Root cause: AutoMiningScript.java:217 built the keep list with a plain split(",") and trim, which leaves an empty-string entry. Rs2ItemModel.matches(false, ...) does a case-insensitive contains check, and contains("") is true for every item. dropAllExcept therefore dropped nothing, the state went back to MINING, the full-inventory check set RESETTING again, and this repeated.

Change: Drop mode now builds its keep list with the new MiningBankRule.parseItemsToKeep. It reuses the existing parseItemNames, which the banking path already uses and which removes empty entries. If the parsed list is empty, it falls back to pickaxe, the config default, so a blank field never drops an inventory pickaxe. Lowercasing does not change matching, because the match lowercases both sides. Normal values such as pickaxe or Dragon pickaxe, Gem bag behave as before.

Validation

  • ./gradlew build -x test -PpluginList=AutoMiningPlugin: BUILD SUCCESSFUL.
  • ./gradlew cleanTest test --tests 'net.runelite.client.plugins.microbot.mining.*' --tests '*PluginManifestVersionTest*': BUILD SUCCESSFUL (MiningBankRuleTest 9/9, RockSelectorTest 5/5, PluginManifestVersionTest 1/1).
  • New test MiningBankRuleTest.blankKeepListFallsBackToPickaxe covers "", " , ", "," and ", ". It fails on the base commit 241ecdd (does not compile: parseItemsToKeep does not exist there).
  • mining-F1, F2 and F3 have no unit test. That logic runs inside the scheduled loop and depends on static Rs2Player, Rs2Walker and Rs2Bank calls. Three reviewers (regression, fidelity, standards) traced each change and approved it.

Not live-tested. These changes have not been run against a live game client.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV

chsami and others added 3 commits October 18, 2026 18:30
…p list (1.0.15)

- Run the progressive location check only in MINING so a bank trip can
  deposit instead of being walked back to the mine before the deposit tick.
- Anchor the mining location to the selected progressive mine, so the
  walk-back, rock search and bank return no longer pull the player to the
  start tile (also after a level-up switches the mine).
- Parse "Items to keep" with MiningBankRule.parseItemNames so empty entries
  no longer match every item and stall drop mode on a full inventory.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
A blank or separator-only "Items to keep" parsed to an empty list, so
drop mode dropped the whole inventory, including a carried pickaxe.
Fall back to the config default "pickaxe" when the parsed list is empty.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
keepListDropsEmptyEntries only exercised the empty-entry filtering that
parseItemNames already had, so it passed on the old code and proved
nothing. The blank-list fallback test, now also covering ", ", is the
one that fails without the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LjtEMzQHGuq4M1Mpqk9pPV
@chsami
chsami merged commit 75bb538 into development Oct 18, 2026
1 check passed
@chsami
chsami deleted the claude/improve-mining-202610181803 branch October 18, 2026 16:58
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.

1 participant