Skip to content

fix(autofishing): improve banking with Rs2Bank API, fix cooking spam clicks, added logout on, out of materials, level checks, and interrupt guards (#470#471

Merged
chsami merged 2 commits into
mainfrom
development
Jun 8, 2026
Merged

fix(autofishing): improve banking with Rs2Bank API, fix cooking spam clicks, added logout on, out of materials, level checks, and interrupt guards (#470#471
chsami merged 2 commits into
mainfrom
development

Conversation

@chsami

@chsami chsami commented Jun 8, 2026

Copy link
Copy Markdown
Owner

No description provided.

runsonmypc and others added 2 commits June 8, 2026 05:10
* feat(ArceuusLibrary): add plugin that drives the upstream Kourend Library solver

Reads bookcase / customer / solver state from the upstream Kourend Library
plugin (via reflection bridge, since its types are package-private) and
drives the player through the deliver loop: talk to customer, walk to the
nearest unsearched candidate bookcase (wall-aware via local-scene BFS),
search, deliver, claim XP. Wires both plugins into the test debug
entrypoint so they boot together.

* fix(ArceuusLibrary): pre-hover via natural mouse before NPC and bookcase clicks

The default Microbot.mouse is VirtualMouse, which never visually moves the
cursor — menu invokes from Rs2NpcModel.click and Rs2GameObject.interact
register at the cursor's last position, bypassing the antiban natural-mouse
simulator. Call Rs2Npc.hoverOverActor / Rs2GameObject.hoverOverObject right
before each click so the cursor glides to the target naturalistically when
antiban naturalMouse is enabled (no-op when disabled).

* fix(ArceuusLibrary): suppress redundant clicks and skip just-delivered customer

- Gate handleFetch / talkToCustomer / handleDeliver on !isMoving && !isAnimating so
  ticks during a click's auto-walk or search animation don't re-issue the click and
  restart the walker mid-walk. Drops the now-redundant per-walker isMoving guards.
- Track lastDeliveredCustomerId; exclude it from the no-upstream-customer fallback
  so we don't re-talk to a satisfied customer who can only respond "go talk to
  someone else" until we deliver to one of the other two.

* feat(ArceuusLibrary): section sweep — prefetch nearby books on the same floor

After fetching the wanted book, opportunistically search nearby same-plane
known-positive bookcases for any book we don't already hold. Capped per fetch
trip by tile radius (default 14) and search count (default 6). Once inventory
holds all 16 distinct deliverable books, every assignment until the next
layout reshuffle delivers without a fetch trip.

* perf(ArceuusLibrary): take over from Rs2Walker once target is in scene reach

Rs2Walker's final approach to a tile is noticeably slower than letting the
client's menu-invoke auto-walk handle the last few tiles. Once a bookcase or
customer is within IN_SCENE_REACH on the same plane, cancel Rs2Walker via
setTarget(null) and click directly — Rs2Walker still handles floor changes
and cross-region travel, but the in-section approach is no longer slow.
Applies to handleFetch, handleDeliver, talkToCustomer, and trySectionSweep.

* fix(ArceuusLibrary): customer targeting — rotate, walk to roam, strict deliver

Three related fixes to the customer-finding logic:

1. walkToCustomerHubIfFar dropped the Chebyshev close-enough check. WorldPoint
   distanceTo measures Chebyshev (max of dx, dy), so 19/19 in the west wing
   read 19 — under IN_SCENE_REACH=20 — and the function returned without
   walking, even though customer NPCs were outside the loaded scene chunks.

2. talkToCustomer round-robins via a recentlyAttempted set: when a customer
   declines (no new request, no held-book accepted), exclude them from the
   next pick so we cycle through all three. When the only un-tried customer
   isn't in cache, walk to their roam tile (added on each Customer enum value)
   to bring them into scene.

3. handleDeliver no longer falls back to findCustomerNotAdjacent. Upstream's
   customerId names exactly who asked for the book; if that NPC isn't in the
   cache momentarily, walk to *their* roam tile rather than picking the
   nearest non-adjacent customer (which sent us to Gracklebone when Sam was
   the active customer).

* fix(ArceuusLibrary): always-on sweep, 600ms tick, hub-bounce on cache miss

- Inline sweep parameters as constants (radius=14, max-per-round=6); strip
  user-facing config so there's no "off" footgun.
- Run sweep on both fetch and deliver legs so INCOMPLETE solver narrows
  via passing-through searches instead of brute-forcing one bookcase per
  trip.
- Relax sweep filter: target unsearched bookcases with non-empty possible
  set; skip only when solver pinned to a single book we already hold.
- Bump tick rate from 200ms to 600ms (one game tick).
- handleDeliver: when active customer misses NPC cache and we're already
  at their roam, bounce to the customer hub so the scene refreshes
  instead of re-issuing a no-op walkTo.
- talkToCustomer: when at roam without a cache hit, mark the customer
  attempted so the rotation advances; reset rotation when exhausted.

* fix(ArceuusLibrary): gate interact decisions on BFS reachability, not Chebyshev

WorldPoint#distanceTo is Chebyshev — it ignores walls. On the upstairs
plane, a bookcase 18 tiles away can read "in scene" while the actual
walking route requires going down stairs, across, and back up. The old
Chebyshev gate at four call sites (handleFetch, trySectionSweep,
handleDeliver, talkToCustomer) skipped Rs2Walker and called interact
directly, which then either silently no-ops or auto-walks into a wall —
producing a 60+ second tight loop spamming "Searching bookcase at ...".

Replace the gate with isInWalkingReach, a BFS through the local
collision map. Same plane plus the target tile (or one of its cardinal
neighbours, for bookcase walls) within IN_SCENE_REACH BFS tiles. When
that fails, fall through to Rs2Walker which can route via stairs.

* fix(ArceuusLibrary): skip generic-hub detour when active customer is known

The pre-deliver invariant walked every cross-floor return trip via the
ground-floor hub at (1627, 3801) — which is Gracklebone's roam tile.
Sam's roam is 11 tiles east, Villia's is 14 east + 12 north, so
delivering to either ran a detour through Gracklebone before
handleDeliver bounced to the right roam.

When upstream already has an active customer, let handleDeliver's
cache-miss branch route directly to that customer's roam. The hub walk
remains for the no-active-customer path (held-book / cycle for fresh
request), where any customer is a valid landing.

* feat(ArceuusLibrary): non-blocking walker with BFS reachability + pathfinder restriction

- Background Rs2Walker via CompletableFuture; tick loop stays free
- Cancel walker + interact directly when BFS confirms walk-reachable
- Restrict pathfinder to local routes (no teleports/transports) — 7ms vs 1.5s
- Re-issue walk when background walk completes without arriving (stuck/failed)
- Fix infinite recursion in cancelBackgroundWalk (was calling itself)
- Treat bridge.getCustomerId()==0 as "no active customer" (same as -1)
- Use isBookcaseSearched for faster search completion detection
- Customer roam coordinates corrected (Villia, Gracklebone, Sam)
- Clear pathfinder restrictions on plugin shutdown

* fix(ArceuusLibrary): abandon sweep when target is on a different plane

Sweeps are opportunistic same-floor detours. When a pendingSweepTarget
persists across a plane change, the walker would chase it cross-plane
via stairs — defeating the purpose. Now bail out and let fetch/deliver
handle cross-plane navigation properly.

* feat(ArceuusLibrary): add card and icon image for plugin hub

* fix(ArceuusLibrary): update hub card image

---------

Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>
…clicks, added logout on, out of materials, level checks, and interrupt guards (#470)

- Refactored handleDepositing to use Rs2Bank.emptyFishBarrel() + depositAllExcept(keepIds) instead of manual bank side-slot widget config + locking (removes duplication, less bot-like).
- Added proximity check + walk to fire/range in handleCooking before using raw fish on the object so the "How many would you like to cook?" widget reliably appears.
- Added lastActionTime debouncing (15s) in fishing and cooking states to prevent rapid re-click spam.
- Added hasFishingMaterials() (bait/feathers/sandworms/karambwanji) that triggers Rs2Player.logout() + shutdown() when about to fish without supplies.
- Added gear/material failure path after banking that also does Rs2Player.logout() + shutdown().
- Added cooking level requirement helpers (canCookAtLeastOneRaw, hasCookingLevelForRaw, getCookingLevelForRaw) and filter raw fish by the player's actual cooking level before offering to cook.
- Added extensive interrupt guards (`Thread.currentThread().isInterrupted() || !Microbot.isLoggedIn()`) throughout the main loop.
- Wrapped client-thread queries (findNearestFishingSpot, getNearbyFireOrRange) in try/catch + specific handling for "Interrupted waiting for client thread" errors during shutdown.
- Minor cleanups: humanized timings, waitForInventoryChanges after banking, removed unused code, small updates to supporting enums/config/overlay.
- Bumped version to 1.0.9.

Co-authored-by: chsami <aintaro@proton.me>
Co-authored-by: stonksCode <99895926+stonksCode@users.noreply.github.com>
Co-authored-by: runsonmypc <45095641+runsonmypc@users.noreply.github.com>
Co-authored-by: runsonmypc <runsonmypc@users.noreply.github.com>
Co-authored-by: afss0 <125560943+afss0@users.noreply.github.com>
Co-authored-by: afss0 <125560943@users.noreply.github.com>
Co-authored-by: Tanner <10541121+TannerIsBender@users.noreply.github.com>
Co-authored-by: Bender <admin@newgeneng.com>
@chsami chsami merged commit 2cd3543 into main Jun 8, 2026
1 check 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