Skip to content

feat(aiofighter): telegrab unreachable loot#462

Merged
chsami merged 2 commits into
chsami:developmentfrom
pjmarz:feat/aiofighter-telegrab-loot
Jun 2, 2026
Merged

feat(aiofighter): telegrab unreachable loot#462
chsami merged 2 commits into
chsami:developmentfrom
pjmarz:feat/aiofighter-telegrab-loot

Conversation

@pjmarz
Copy link
Copy Markdown
Contributor

@pjmarz pjmarz commented May 30, 2026

Summary

Adds an opt-in "Telegrab unreachable loot" toggle to AIO Fighter's Loot section (default off). When enabled, wanted loot the player can't reach on foot (for example, drops behind the bars at the caged Lesser Demon) is collected with Telekinetic Grab instead of walking to it, which otherwise just spams "I can't reach that!". With the toggle off, looting behaviour is unchanged.

How it works

  • Reachability is checked with Rs2Tile.isTileReachable (strict collision flood-fill), so only genuinely unreachable tiles trigger a grab and reachable loot is walked to as before. (Rs2Walker.canReach is unsuitable here: it returns true when the player can path to within ~2 tiles of the target, which holds for caged drops you can't actually stand on.)
  • It plugs into the existing Rs2LootEngine loot action, so it only ever telegrabs items the current loot config already selects (item list / GE value / ashes / bones / etc.). No duplicated selection logic.
  • It casts once per pile and waits for the grab to resolve before continuing, keeping the cast and reachability calls off the client-thread hot path (a naive per-tick re-cast saturated the client thread and produced TimeoutExceptions in other scripts).
  • Requires 33 Magic plus law and air runes (guarded by Rs2Magic.canCast); if it can't cast, the item is skipped rather than walked to.

Affected files

  • aiofighter/AIOFighterConfig.java (new toggleTelegrabUnreachableLoot option, Loot section, default off)
  • aiofighter/loot/LootScript.java (telegrab-aware loot action)
  • aiofighter/AIOFighterPlugin.java (version bump 2.1.7 -> 2.2.0)

minClientVersion stays 2.1.32: verified Rs2Tile.isTileReachable, Rs2Magic.canCast/cast(MagicAction), MagicAction.TELEKINETIC_GRAB, and the getGroundItems().get(location, id) pattern all exist at that tag.

Test plan

  • Build: ./gradlew build -PpluginList=AIOFighterPlugin
  • Caged Lesser Demon (Wizard's Tower top floor) with the toggle on and law/air runes: confirmed it Telekinetic Grabs the drops through the bars and the "I can't reach that!" spam stops.
  • Verified live via the agent server: Magic and Hitpoints XP climbing, no TimeoutExceptions, client thread responsive.
  • Toggle off: looting behaviour unchanged (walks to loot as before).

Repro context

The caged Lesser Demon is a classic Telekinetic Grab spot: the demon is safespotted and its drops land behind the cage bars where the player can't walk. The looter tried to walk to them every tick, spamming "I can't reach that!" and never collecting the drops. This adds the telegrab path so those drops are collected, with the Magic XP from the grabs being a nice bonus at this training spot.

🤖 Generated with Claude Code

Opt-in "Telegrab unreachable loot" toggle (Loot section, default off). When
enabled, wanted loot that can't be reached on foot (e.g. drops behind the bars
at the caged Lesser Demon) is picked up with Telekinetic Grab instead of
walking, which otherwise spams "I can't reach that!".

- Reachability via Rs2Tile.isTileReachable (strict flood-fill); reachable loot
  is walked as before.
- Casts once per pile and waits for the grab to resolve, keeping cast/
  reachability calls off the client-thread hot path.
- Reuses the existing Rs2LootEngine selection, so only configured loot is grabbed.

2.1.7 -> 2.2.0

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 30, 2026 23:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for Telekinetic Grab looting for unreachable ground items in AIO Fighter, plus a plugin version bump.

Changes:

  • Route loot actions through a new lootOrTelegrab(...) handler that telegrabs unreachable loot when enabled.
  • Add a config toggle to enable/disable telegrabbing unreachable loot.
  • Bump plugin version to 2.2.0.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
src/main/java/net/runelite/client/plugins/microbot/aiofighter/loot/LootScript.java Adds telegrab-based looting path for unreachable items and wires it into the loot engine.
src/main/java/net/runelite/client/plugins/microbot/aiofighter/AIOFighterPlugin.java Updates plugin version to reflect the new feature.
src/main/java/net/runelite/client/plugins/microbot/aiofighter/AIOFighterConfig.java Introduces a config toggle that enables telegrabbing unreachable loot.

Comment on lines +110 to +115
final int id = groundItem.getId();
if (Rs2Magic.canCast(MagicAction.TELEKINETIC_GRAB) && Rs2Magic.cast(MagicAction.TELEKINETIC_GRAB)) {
sleep(300, 500); // let the spell arm before clicking the item
final WorldPoint me = Rs2Player.getWorldLocation();
final int range = (me == null ? 10 : me.distanceTo(wp) + 2);
Rs2GroundItem.interact(id, "Cast", range);
// pile stops the loot loop from re-casting mid-grab (the spellbook stutter)
// and keeps the cast/reachability calls off the client thread's hot path,
// which was saturating it and causing TimeoutExceptions in other scripts.
sleepUntil(() -> Rs2GroundItem.getGroundItems().get(wp, id) == null, 3000);
@ConfigItem(
keyName = "telegrabUnreachableLoot",
name = "Telegrab unreachable loot",
description = "Use Telekinetic Grab (needs 33 Magic + law & air runes) to pick up wanted loot you can't walk to, e.g. caged or fenced-off drops. Off = walk to loot as normal.",
Comment on lines +112 to +114
sleep(300, 500); // let the spell arm before clicking the item
final WorldPoint me = Rs2Player.getWorldLocation();
final int range = (me == null ? 10 : me.distanceTo(wp) + 2);
// pile stops the loot loop from re-casting mid-grab (the spellbook stutter)
// and keeps the cast/reachability calls off the client thread's hot path,
// which was saturating it and causing TimeoutExceptions in other scripts.
sleepUntil(() -> Rs2GroundItem.getGroundItems().get(wp, id) == null, 3000);
- Align telegrab targeting with the wait condition. interact() grabs the
  nearest pile of the item id, so we now wait until a pile of that id is
  removed (the same id selector) instead of keying on a specific WorldPoint;
  robust when multiple same-id piles are in range.
- Extract telegrab timing/range values into named constants.
- Document in the config that unreachable loot is skipped (not walked to)
  when Telekinetic Grab can't be cast.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@pjmarz
Copy link
Copy Markdown
Contributor Author

pjmarz commented May 30, 2026

Thanks for the review. Addressed in 8ad98a4:

  1. Targeting vs wait alignment (LootScript): interact(id, "Cast", range) grabs the nearest pile of the item id, so the wait now keys on that same id selector (waits until a pile of that id is removed) instead of a specific WorldPoint. This is robust when multiple same-id piles are in range.
  2. Magic numbers (LootScript): extracted the timing/range values into named constants (TELEGRAB_ARM_MIN_MS, TELEGRAB_ARM_MAX_MS, TELEGRAB_RANGE_PADDING, TELEGRAB_FALLBACK_RANGE, TELEGRAB_GRAB_TIMEOUT_MS).
  3. Config clarity (AIOFighterConfig): the description now notes that unreachable loot is skipped (not walked to) when Telekinetic Grab can't be cast.

@chsami chsami merged commit b9ee5e1 into chsami:development Jun 2, 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.

3 participants