Merge pull request #5991 from SebastiaanVanspauwen/ag-marks
agility plugin: highlight multiple marks
This commit is contained in:
@@ -30,6 +30,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.geom.Area;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
@@ -63,7 +64,7 @@ class AgilityOverlay extends Overlay
|
||||
{
|
||||
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
|
||||
Point mousePosition = client.getMouseCanvasPosition();
|
||||
final Tile markOfGrace = plugin.getMarkOfGrace();
|
||||
final List<Tile> marksOfGrace = plugin.getMarksOfGrace();
|
||||
plugin.getObstacles().forEach((object, tile) ->
|
||||
{
|
||||
if (Obstacles.SHORTCUT_OBSTACLE_IDS.contains(object.getId()) && !config.highlightShortcuts() ||
|
||||
@@ -90,7 +91,7 @@ class AgilityOverlay extends Overlay
|
||||
if (objectClickbox != null)
|
||||
{
|
||||
Color configColor = config.getOverlayColor();
|
||||
if (config.highlightMarks() && markOfGrace != null)
|
||||
if (config.highlightMarks() && !marksOfGrace.isEmpty())
|
||||
{
|
||||
configColor = config.getMarkColor();
|
||||
}
|
||||
@@ -112,19 +113,22 @@ class AgilityOverlay extends Overlay
|
||||
|
||||
});
|
||||
|
||||
if (markOfGrace != null && config.highlightMarks())
|
||||
if (config.highlightMarks() && !marksOfGrace.isEmpty())
|
||||
{
|
||||
if (markOfGrace.getPlane() == client.getPlane() && markOfGrace.getItemLayer() != null
|
||||
&& markOfGrace.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
|
||||
for (Tile markOfGraceTile : marksOfGrace)
|
||||
{
|
||||
final Polygon poly = markOfGrace.getItemLayer().getCanvasTilePoly();
|
||||
|
||||
if (poly == null)
|
||||
if (markOfGraceTile.getPlane() == client.getPlane() && markOfGraceTile.getItemLayer() != null
|
||||
&& markOfGraceTile.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
final Polygon poly = markOfGraceTile.getItemLayer().getCanvasTilePoly();
|
||||
|
||||
OverlayUtil.renderPolygon(graphics, poly, config.getMarkColor());
|
||||
if (poly == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
OverlayUtil.renderPolygon(graphics, poly, config.getMarkColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,10 @@ package net.runelite.client.plugins.agility;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
@@ -81,7 +83,7 @@ public class AgilityPlugin extends Plugin
|
||||
private final Map<TileObject, Tile> obstacles = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private Tile markOfGrace;
|
||||
private final List<Tile> marksOfGrace = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@@ -131,7 +133,7 @@ public class AgilityPlugin extends Plugin
|
||||
{
|
||||
overlayManager.remove(agilityOverlay);
|
||||
overlayManager.remove(lapCounterOverlay);
|
||||
markOfGrace = null;
|
||||
marksOfGrace.clear();
|
||||
obstacles.clear();
|
||||
session = null;
|
||||
}
|
||||
@@ -148,7 +150,7 @@ public class AgilityPlugin extends Plugin
|
||||
removeAgilityArenaTimer();
|
||||
break;
|
||||
case LOADING:
|
||||
markOfGrace = null;
|
||||
marksOfGrace.clear();
|
||||
obstacles.clear();
|
||||
break;
|
||||
case LOGGED_IN:
|
||||
@@ -219,19 +221,15 @@ public class AgilityPlugin extends Plugin
|
||||
|
||||
if (item.getId() == ItemID.MARK_OF_GRACE)
|
||||
{
|
||||
markOfGrace = tile;
|
||||
marksOfGrace.add(tile);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemDespawned(ItemDespawned itemDespawned)
|
||||
{
|
||||
final Item item = itemDespawned.getItem();
|
||||
|
||||
if (item.getId() == ItemID.MARK_OF_GRACE)
|
||||
{
|
||||
markOfGrace = null;
|
||||
}
|
||||
final Tile tile = itemDespawned.getTile();
|
||||
marksOfGrace.remove(tile);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
Reference in New Issue
Block a user