npc indicators: add fill color config
This commit is contained in:
@@ -95,16 +95,29 @@ public interface NpcIndicatorsConfig extends Config
|
|||||||
position = 4,
|
position = 4,
|
||||||
keyName = "npcColor",
|
keyName = "npcColor",
|
||||||
name = "Highlight Color",
|
name = "Highlight Color",
|
||||||
description = "Color of the NPC highlight",
|
description = "Color of the NPC highlight border, menu, and text",
|
||||||
section = renderStyleSection
|
section = renderStyleSection
|
||||||
)
|
)
|
||||||
default Color getHighlightColor()
|
default Color highlightColor()
|
||||||
{
|
{
|
||||||
return Color.CYAN;
|
return Color.CYAN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Alpha
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 5,
|
position = 5,
|
||||||
|
keyName = "fillColor",
|
||||||
|
name = "Fill Color",
|
||||||
|
description = "Color of the NPC highlight fill",
|
||||||
|
section = renderStyleSection
|
||||||
|
)
|
||||||
|
default Color fillColor()
|
||||||
|
{
|
||||||
|
return new Color(0, 255, 255, 20);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 6,
|
||||||
keyName = "borderWidth",
|
keyName = "borderWidth",
|
||||||
name = "Border Width",
|
name = "Border Width",
|
||||||
description = "Width of the highlighted NPC border",
|
description = "Width of the highlighted NPC border",
|
||||||
@@ -116,7 +129,7 @@ public interface NpcIndicatorsConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 6,
|
position = 7,
|
||||||
keyName = "outlineFeather",
|
keyName = "outlineFeather",
|
||||||
name = "Outline feather",
|
name = "Outline feather",
|
||||||
description = "Specify between 0-4 how much of the model outline should be faded",
|
description = "Specify between 0-4 how much of the model outline should be faded",
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ public class NpcIndicatorsPlugin extends Plugin implements NpcIndicatorsService
|
|||||||
|
|
||||||
if (color == null && highlightedNpcs.contains(npc) && config.highlightMenuNames() && (!npc.isDead() || !config.ignoreDeadNpcs()))
|
if (color == null && highlightedNpcs.contains(npc) && config.highlightMenuNames() && (!npc.isDead() || !config.ignoreDeadNpcs()))
|
||||||
{
|
{
|
||||||
color = config.getHighlightColor();
|
color = config.highlightColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color != null)
|
if (color != null)
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class NpcMinimapOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
for (NPC npc : plugin.getHighlightedNpcs())
|
for (NPC npc : plugin.getHighlightedNpcs())
|
||||||
{
|
{
|
||||||
renderNpcOverlay(graphics, npc, Text.removeTags(npc.getName()), config.getHighlightColor());
|
renderNpcOverlay(graphics, npc, Text.removeTags(npc.getName()), config.highlightColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import net.runelite.client.ui.overlay.OverlayLayer;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.outline.ModelOutlineRenderer;
|
import net.runelite.client.ui.overlay.outline.ModelOutlineRenderer;
|
||||||
import net.runelite.client.util.ColorUtil;
|
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
public class NpcSceneOverlay extends Overlay
|
public class NpcSceneOverlay extends Overlay
|
||||||
@@ -92,7 +91,7 @@ public class NpcSceneOverlay extends Overlay
|
|||||||
|
|
||||||
for (NPC npc : plugin.getHighlightedNpcs())
|
for (NPC npc : plugin.getHighlightedNpcs())
|
||||||
{
|
{
|
||||||
renderNpcOverlay(graphics, npc, config.getHighlightColor());
|
renderNpcOverlay(graphics, npc);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@@ -113,18 +112,12 @@ public class NpcSceneOverlay extends Overlay
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Color color = config.getHighlightColor();
|
|
||||||
|
|
||||||
final LocalPoint centerLp = new LocalPoint(
|
final LocalPoint centerLp = new LocalPoint(
|
||||||
lp.getX() + Perspective.LOCAL_TILE_SIZE * (npc.getNpcSize() - 1) / 2,
|
lp.getX() + Perspective.LOCAL_TILE_SIZE * (npc.getNpcSize() - 1) / 2,
|
||||||
lp.getY() + Perspective.LOCAL_TILE_SIZE * (npc.getNpcSize() - 1) / 2);
|
lp.getY() + Perspective.LOCAL_TILE_SIZE * (npc.getNpcSize() - 1) / 2);
|
||||||
|
|
||||||
final Polygon poly = Perspective.getCanvasTileAreaPoly(client, centerLp, npc.getNpcSize());
|
final Polygon poly = Perspective.getCanvasTileAreaPoly(client, centerLp, npc.getNpcSize());
|
||||||
|
renderPoly(graphics, config.highlightColor(), config.fillColor(), poly);
|
||||||
if (poly != null)
|
|
||||||
{
|
|
||||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
final Instant now = Instant.now();
|
final Instant now = Instant.now();
|
||||||
final double baseTick = ((npc.getDiedOnTick() + npc.getRespawnTime()) - client.getTickCount()) * (Constants.GAME_TICK_LENGTH / 1000.0);
|
final double baseTick = ((npc.getDiedOnTick() + npc.getRespawnTime()) - client.getTickCount()) * (Constants.GAME_TICK_LENGTH / 1000.0);
|
||||||
@@ -148,7 +141,7 @@ public class NpcSceneOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color)
|
private void renderNpcOverlay(Graphics2D graphics, NPC actor)
|
||||||
{
|
{
|
||||||
NPCComposition npcComposition = actor.getTransformedComposition();
|
NPCComposition npcComposition = actor.getTransformedComposition();
|
||||||
if (npcComposition == null || !npcComposition.isInteractible()
|
if (npcComposition == null || !npcComposition.isInteractible()
|
||||||
@@ -157,10 +150,13 @@ public class NpcSceneOverlay extends Overlay
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Color borderColor = config.highlightColor();
|
||||||
|
final Color fillColor = config.fillColor();
|
||||||
|
|
||||||
if (config.highlightHull())
|
if (config.highlightHull())
|
||||||
{
|
{
|
||||||
Shape objectClickbox = actor.getConvexHull();
|
Shape objectClickbox = actor.getConvexHull();
|
||||||
renderPoly(graphics, color, objectClickbox);
|
renderPoly(graphics, borderColor, fillColor, objectClickbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.highlightTile())
|
if (config.highlightTile())
|
||||||
@@ -169,7 +165,7 @@ public class NpcSceneOverlay extends Overlay
|
|||||||
LocalPoint lp = actor.getLocalLocation();
|
LocalPoint lp = actor.getLocalLocation();
|
||||||
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
|
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
|
||||||
|
|
||||||
renderPoly(graphics, color, tilePoly);
|
renderPoly(graphics, borderColor, fillColor, tilePoly);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.highlightSouthWestTile())
|
if (config.highlightSouthWestTile())
|
||||||
@@ -182,12 +178,12 @@ public class NpcSceneOverlay extends Overlay
|
|||||||
|
|
||||||
Polygon southWestTilePoly = Perspective.getCanvasTilePoly(client, new LocalPoint(x, y));
|
Polygon southWestTilePoly = Perspective.getCanvasTilePoly(client, new LocalPoint(x, y));
|
||||||
|
|
||||||
renderPoly(graphics, color, southWestTilePoly);
|
renderPoly(graphics, borderColor, fillColor, southWestTilePoly);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.highlightOutline())
|
if (config.highlightOutline())
|
||||||
{
|
{
|
||||||
modelOutlineRenderer.drawOutline(actor, (int)config.borderWidth(), color, config.outlineFeather());
|
modelOutlineRenderer.drawOutline(actor, (int)config.borderWidth(), borderColor, config.outlineFeather());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.drawNames() && actor.getName() != null)
|
if (config.drawNames() && actor.getName() != null)
|
||||||
@@ -197,19 +193,19 @@ public class NpcSceneOverlay extends Overlay
|
|||||||
|
|
||||||
if (textLocation != null)
|
if (textLocation != null)
|
||||||
{
|
{
|
||||||
OverlayUtil.renderTextLocation(graphics, textLocation, npcName, color);
|
OverlayUtil.renderTextLocation(graphics, textLocation, npcName, borderColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderPoly(Graphics2D graphics, Color color, Shape polygon)
|
private void renderPoly(Graphics2D graphics, Color borderColor, Color fillColor, Shape polygon)
|
||||||
{
|
{
|
||||||
if (polygon != null)
|
if (polygon != null)
|
||||||
{
|
{
|
||||||
graphics.setColor(color);
|
graphics.setColor(borderColor);
|
||||||
graphics.setStroke(new BasicStroke((float) config.borderWidth()));
|
graphics.setStroke(new BasicStroke((float) config.borderWidth()));
|
||||||
graphics.draw(polygon);
|
graphics.draw(polygon);
|
||||||
graphics.setColor(ColorUtil.colorWithAlpha(color, 20));
|
graphics.setColor(fillColor);
|
||||||
graphics.fill(polygon);
|
graphics.fill(polygon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class NpcIndicatorsPluginTest
|
|||||||
{
|
{
|
||||||
when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("goblin");
|
when(npcIndicatorsConfig.getNpcToHighlight()).thenReturn("goblin");
|
||||||
when(npcIndicatorsConfig.highlightMenuNames()).thenReturn(true);
|
when(npcIndicatorsConfig.highlightMenuNames()).thenReturn(true);
|
||||||
when(npcIndicatorsConfig.getHighlightColor()).thenReturn(Color.BLUE);
|
when(npcIndicatorsConfig.highlightColor()).thenReturn(Color.BLUE);
|
||||||
|
|
||||||
npcIndicatorsPlugin.rebuild();
|
npcIndicatorsPlugin.rebuild();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user