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