Skip to content

feat: add Attack Ranges Plus plugin#477

Open
pjmarz wants to merge 2 commits into
chsami:developmentfrom
pjmarz:feat/attackrangesplus-plugin
Open

feat: add Attack Ranges Plus plugin#477
pjmarz wants to merge 2 commits into
chsami:developmentfrom
pjmarz:feat/attackrangesplus-plugin

Conversation

@pjmarz

@pjmarz pjmarz commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Summary

New plugin: Attack Ranges Plus, an overlay that draws your attack range on the ground, clipped to line of sight, with the radius auto-detected from your equipped weapon and combat style (melee, ranged including longrange, magic while autocasting) via Rs2Combat.getAttackRange(). An optional second outline shows the interacting player's threat range (their weapon's base reach). Display can be gated to PvP areas or the Wilderness only.

Pure overlay, no automation: it never clicks, moves, or casts.

Implementation notes:

  • Line-of-sight molding via WorldArea.hasLineOfSightTo per tile; the boundary is built as one cached GeneralPath, rebuilt only on origin, radius, or game-tick change, with the translucent fill OFF by default to keep FPS at baseline.
  • All client reads happen in render() on the client thread.
  • Adapted from the ry-java/AttackRanges2 example plugin and rebuilt for Microbot (credited in the README).
  • The name uses an inline prefix literal; happy to register a constant in PluginConstants.java as a follow-up if preferred.

Contents

  • attackrangesplus/ (6 classes: Plugin, Config, Overlay, Calc, RangeMode, DisplayMode)
  • resources/.../attackrangesplus/docs/README.md + assets/icon.png + assets/card.png

Testing

  • ./gradlew clean build green on JDK 11 (Temurin), matching CI; generatePluginsJson picks the plugin up with the correct metadata.
  • Manual: equipped melee, ranged, and magic weapons and verified the radius follows the weapon (halberd 2, longrange bonus, autocast spell range); confirmed the outline molds around walls and doors (no highlight through line-of-sight blockers); toggled the target-range outline against another player; FPS at baseline with fill off.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 the new Attack Ranges Plus plugin to the Microbot RuneLite client, including overlay rendering, configuration, and user-facing documentation.

Changes:

  • Introduces plugin entrypoint, config options, and display/range mode enums.
  • Implements an overlay that computes LoS-clipped attackable tiles and renders an outline (and optional fill) for player and optionally opponent.
  • Adds end-user README documentation for features, setup, and limitations.

Reviewed changes

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

Show a summary per file
File Description
src/main/resources/net/runelite/client/plugins/microbot/attackrangesplus/docs/README.md Adds user documentation for the plugin’s purpose, features, configuration, and limitations.
src/main/java/net/runelite/client/plugins/microbot/attackrangesplus/RangeMode.java Adds range sizing modes (auto vs fixed overrides) for configuration/UI.
src/main/java/net/runelite/client/plugins/microbot/attackrangesplus/DisplayMode.java Adds overlay visibility modes (always / PvP areas / wilderness).
src/main/java/net/runelite/client/plugins/microbot/attackrangesplus/AttackRangesPlusPlugin.java Registers the plugin and overlay with the client and provides config injection.
src/main/java/net/runelite/client/plugins/microbot/attackrangesplus/AttackRangesPlusOverlay.java Implements LoS-clipped tile computation plus cached path rendering for player/opponent.
src/main/java/net/runelite/client/plugins/microbot/attackrangesplus/AttackRangesPlusConfig.java Adds configuration items and in-client config panel information text.
src/main/java/net/runelite/client/plugins/microbot/attackrangesplus/AttackRangesPlusCalc.java Adds radius resolution for player (auto via Rs2Combat) and opponent (weapon data lookup).

Comment on lines +11 to +20
| Feature | Description |
|---------|-------------|
| **Attack style - Auto (detect)** | Reads your equipped weapon and selected attack style to show your exact reach - long-range, autocast spell range, halberds at 2 tiles, melee at 1. Recommended. |
| **Attack style - Melee / Ranged / Magic** | Fixed overrides: Melee forces 1 tile, Ranged forces 7 tiles (representative preview), Magic forces 10 tiles (use this when you click-cast without autocast set). |
| **Line color** | Color of the attack-range outline drawn on the ground. |
| **Fill area** | Shades the tiles inside your attack range. Off by default - the fill is repainted every frame and costs FPS at large ranges such as magic. The outline alone is cheap. |
| **Fill color** | Color and opacity of the shaded area (used only when Fill area is on). |
| **Show overlay** | Controls when the overlay appears: Always, In PvP areas (Wilderness, PvP/Deadman worlds, and PvP-flagged zones), or Wilderness only. |
| **Show target's range** | Also outlines the attack range of the player you are currently fighting, based on their equipped weapon's base reach. |
| **Target line color** | Outline color used for the target's range indicator. |
Comment on lines +293 to +296
private void buildPaths(WorldView wv, int plane)
{
final GeneralPath f = new GeneralPath(GeneralPath.WIND_NON_ZERO);
final GeneralPath o = new GeneralPath();
Comment on lines +322 to +337
if (!set.contains(tile.dy(1)) && nw != null && ne != null) // north
{
segment(o, nw, ne);
}
if (!set.contains(tile.dy(-1)) && sw != null && se != null) // south
{
segment(o, sw, se);
}
if (!set.contains(tile.dx(1)) && se != null && ne != null) // east
{
segment(o, se, ne);
}
if (!set.contains(tile.dx(-1)) && sw != null && nw != null) // west
{
segment(o, sw, nw);
}
Comment on lines +35 to +44
private static Map<Integer, Weapon> weaponsMap;

private static Map<Integer, Weapon> weapons()
{
if (weaponsMap == null)
{
weaponsMap = WeaponsGenerator.generate();
}
return weaponsMap;
}
Comment on lines +61 to +68
try
{
return Math.max(Rs2Combat.getAttackRange(), 0);
}
catch (Exception e)
{
return MELEE_RADIUS;
}
…read-safe weapon map, log AUTO fallback

Addresses Copilot review feedback on chsami#477.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@pjmarz

pjmarz commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Addressed: the fill path is now only built while Show fill is enabled, the weapon map uses an initialization-on-demand holder (thread-safe), and the AUTO range fallback logs once at debug instead of failing silently. On the remaining two: the README table uses standard single-pipe rows (there are no double pipes in the file), and the neighbor-check allocations are bounded (the LoS set rebuilds at most once per game tick at radius 10 or less, roughly 1.7k short-lived WorldPoints), so the readable WorldPoint-set form is kept.

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