agility: highlight 'Stick' in Werewolf Agility Course
Co-authored-by: dekvall <dkvldev@gmail.com>
This commit is contained in:
@@ -165,4 +165,26 @@ public interface AgilityConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "highlightStick",
|
||||||
|
name = "Highlight Stick",
|
||||||
|
description = "Highlight the retrievable stick in the Werewolf Agility Course",
|
||||||
|
position = 12
|
||||||
|
)
|
||||||
|
default boolean highlightStick()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "stickHighlightColor",
|
||||||
|
name = "Stick Highlight Color",
|
||||||
|
description = "Color of highlighted stick",
|
||||||
|
position = 13
|
||||||
|
)
|
||||||
|
default Color stickHighlightColor()
|
||||||
|
{
|
||||||
|
return Color.RED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ class AgilityOverlay extends Overlay
|
|||||||
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
|
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
|
||||||
Point mousePosition = client.getMouseCanvasPosition();
|
Point mousePosition = client.getMouseCanvasPosition();
|
||||||
final List<Tile> marksOfGrace = plugin.getMarksOfGrace();
|
final List<Tile> marksOfGrace = plugin.getMarksOfGrace();
|
||||||
|
final Tile stickTile = plugin.getStickTile();
|
||||||
|
|
||||||
plugin.getObstacles().forEach((object, obstacle) ->
|
plugin.getObstacles().forEach((object, obstacle) ->
|
||||||
{
|
{
|
||||||
if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(object.getId()) && !config.highlightShortcuts() ||
|
if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(object.getId()) && !config.highlightShortcuts() ||
|
||||||
@@ -122,21 +124,29 @@ class AgilityOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
for (Tile markOfGraceTile : marksOfGrace)
|
for (Tile markOfGraceTile : marksOfGrace)
|
||||||
{
|
{
|
||||||
if (markOfGraceTile.getPlane() == client.getPlane() && markOfGraceTile.getItemLayer() != null
|
highlightTile(graphics, playerLocation, markOfGraceTile, config.getMarkColor());
|
||||||
&& markOfGraceTile.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
|
|
||||||
{
|
|
||||||
final Polygon poly = markOfGraceTile.getItemLayer().getCanvasTilePoly();
|
|
||||||
|
|
||||||
if (poly == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
OverlayUtil.renderPolygon(graphics, poly, config.getMarkColor());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stickTile != null && config.highlightStick())
|
||||||
|
{
|
||||||
|
highlightTile(graphics, playerLocation, stickTile, config.stickHighlightColor());
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void highlightTile(Graphics2D graphics, LocalPoint playerLocation, Tile tile, Color color)
|
||||||
|
{
|
||||||
|
if (tile.getPlane() == client.getPlane() && tile.getItemLayer() != null
|
||||||
|
&& tile.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
|
||||||
|
{
|
||||||
|
final Polygon poly = tile.getItemLayer().getCanvasTilePoly();
|
||||||
|
|
||||||
|
if (poly != null)
|
||||||
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -43,7 +44,6 @@ import net.runelite.api.Tile;
|
|||||||
import net.runelite.api.TileItem;
|
import net.runelite.api.TileItem;
|
||||||
import net.runelite.api.TileObject;
|
import net.runelite.api.TileObject;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.client.events.ConfigChanged;
|
|
||||||
import net.runelite.api.events.DecorativeObjectChanged;
|
import net.runelite.api.events.DecorativeObjectChanged;
|
||||||
import net.runelite.api.events.DecorativeObjectDespawned;
|
import net.runelite.api.events.DecorativeObjectDespawned;
|
||||||
import net.runelite.api.events.DecorativeObjectSpawned;
|
import net.runelite.api.events.DecorativeObjectSpawned;
|
||||||
@@ -64,6 +64,7 @@ import net.runelite.api.events.WallObjectSpawned;
|
|||||||
import net.runelite.client.Notifier;
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.game.AgilityShortcut;
|
import net.runelite.client.game.AgilityShortcut;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
@@ -127,6 +128,9 @@ public class AgilityPlugin extends Plugin
|
|||||||
@Getter
|
@Getter
|
||||||
private int agilityLevel;
|
private int agilityLevel;
|
||||||
|
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private Tile stickTile;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
AgilityConfig getConfig(ConfigManager configManager)
|
AgilityConfig getConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
@@ -150,6 +154,7 @@ public class AgilityPlugin extends Plugin
|
|||||||
obstacles.clear();
|
obstacles.clear();
|
||||||
session = null;
|
session = null;
|
||||||
agilityLevel = 0;
|
agilityLevel = 0;
|
||||||
|
stickTile = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -166,6 +171,7 @@ public class AgilityPlugin extends Plugin
|
|||||||
case LOADING:
|
case LOADING:
|
||||||
marksOfGrace.clear();
|
marksOfGrace.clear();
|
||||||
obstacles.clear();
|
obstacles.clear();
|
||||||
|
stickTile = null;
|
||||||
break;
|
break;
|
||||||
case LOGGED_IN:
|
case LOGGED_IN:
|
||||||
if (!isInAgilityArena())
|
if (!isInAgilityArena())
|
||||||
@@ -244,13 +250,25 @@ public class AgilityPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
marksOfGrace.add(tile);
|
marksOfGrace.add(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.getId() == ItemID.STICK)
|
||||||
|
{
|
||||||
|
stickTile = tile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onItemDespawned(ItemDespawned itemDespawned)
|
public void onItemDespawned(ItemDespawned itemDespawned)
|
||||||
{
|
{
|
||||||
|
final TileItem item = itemDespawned.getItem();
|
||||||
final Tile tile = itemDespawned.getTile();
|
final Tile tile = itemDespawned.getTile();
|
||||||
|
|
||||||
marksOfGrace.remove(tile);
|
marksOfGrace.remove(tile);
|
||||||
|
|
||||||
|
if (item.getId() == ItemID.STICK && stickTile == tile)
|
||||||
|
{
|
||||||
|
stickTile = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
|
|||||||
Reference in New Issue
Block a user