npc indicators: allow combination of higlight styles

This commit is contained in:
Håkon Paulsen
2020-06-23 17:38:38 -04:00
committed by Adam
parent 6950bf166e
commit 9168c1520d
3 changed files with 71 additions and 73 deletions

View File

@@ -28,23 +28,56 @@ import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
@ConfigGroup("npcindicators")
public interface NpcIndicatorsConfig extends Config
{
@ConfigSection(
name = "Render style",
description = "The render style of NPC highlighting",
position = 0
)
String renderStyleSection = "renderStyleSection";
@ConfigItem(
position = 0,
keyName = "highlightStyle",
name = "Highlight Style",
description = "Highlight setting"
keyName = "highlightHull",
name = "Highlight hull",
description = "Configures whether or not NPC should be highlighted by hull",
section = renderStyleSection
)
default RenderStyle renderStyle()
default boolean highlightHull()
{
return RenderStyle.HULL;
return true;
}
@ConfigItem(
position = 1,
keyName = "highlightTile",
name = "Highlight tile",
description = "Configures whether or not NPC should be highlighted by tile",
section = renderStyleSection
)
default boolean highlightTile()
{
return false;
}
@ConfigItem(
position = 2,
keyName = "highlightSouthWestTile",
name = "Highlight south west tile",
description = "Configures whether or not NPC should be highlighted by south western tile",
section = renderStyleSection
)
default boolean highlightSouthWestTile()
{
return false;
}
@ConfigItem(
position = 3,
keyName = "npcToHighlight",
name = "NPCs to Highlight",
description = "List of NPC names to highlight"
@@ -55,7 +88,7 @@ public interface NpcIndicatorsConfig extends Config
}
@ConfigItem(
position = 2,
position = 4,
keyName = "npcColor",
name = "Highlight Color",
description = "Color of the NPC highlight"
@@ -66,7 +99,7 @@ public interface NpcIndicatorsConfig extends Config
}
@ConfigItem(
position = 3,
position = 5,
keyName = "drawNames",
name = "Draw names above NPC",
description = "Configures whether or not NPC names should be drawn above the NPC"
@@ -77,7 +110,7 @@ public interface NpcIndicatorsConfig extends Config
}
@ConfigItem(
position = 4,
position = 6,
keyName = "drawMinimapNames",
name = "Draw names on minimap",
description = "Configures whether or not NPC names should be drawn on the minimap"
@@ -88,7 +121,7 @@ public interface NpcIndicatorsConfig extends Config
}
@ConfigItem(
position = 5,
position = 7,
keyName = "highlightMenuNames",
name = "Highlight menu names",
description = "Highlight NPC names in right click menu"
@@ -99,7 +132,7 @@ public interface NpcIndicatorsConfig extends Config
}
@ConfigItem(
position = 6,
position = 8,
keyName = "ignoreDeadNpcs",
name = "Ignore dead NPCs",
description = "Prevents highlighting NPCs after they are dead"
@@ -110,7 +143,15 @@ public interface NpcIndicatorsConfig extends Config
}
@ConfigItem(
position = 7,
position = 9,
keyName = "deadNpcMenuColor",
name = "Dead NPC menu color",
description = "Color of the NPC menus for dead NPCs"
)
Color deadNpcMenuColor();
@ConfigItem(
position = 10,
keyName = "showRespawnTimer",
name = "Show respawn timer",
description = "Show respawn timer of tagged NPCs")
@@ -118,12 +159,4 @@ public interface NpcIndicatorsConfig extends Config
{
return false;
}
@ConfigItem(
position = 7,
keyName = "deadNpcMenuColor",
name = "Dead NPC menu color",
description = "Color of the NPC menus for dead NPCs"
)
Color deadNpcMenuColor();
}

View File

@@ -152,34 +152,32 @@ public class NpcSceneOverlay extends Overlay
return;
}
switch (config.renderStyle())
if (config.highlightHull())
{
case SOUTH_WEST_TILE:
{
int size = npcComposition.getSize();
LocalPoint localPoint = actor.getLocalLocation();
Shape objectClickbox = actor.getConvexHull();
renderPoly(graphics, color, objectClickbox);
}
int x = localPoint.getX() - ((size - 1) * Perspective.LOCAL_TILE_SIZE / 2);
int y = localPoint.getY() - ((size - 1) * Perspective.LOCAL_TILE_SIZE / 2);
if (config.highlightTile())
{
int size = npcComposition.getSize();
LocalPoint lp = actor.getLocalLocation();
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
Polygon tilePoly = Perspective.getCanvasTilePoly(client, new LocalPoint(x, y));
renderPoly(graphics, color, tilePoly);
}
renderPoly(graphics, color, tilePoly);
break;
}
case TILE:
int size = npcComposition.getSize();
LocalPoint lp = actor.getLocalLocation();
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
if (config.highlightSouthWestTile())
{
int size = npcComposition.getSize();
LocalPoint lp = actor.getLocalLocation();
renderPoly(graphics, color, tilePoly);
break;
int x = lp.getX() - ((size - 1) * Perspective.LOCAL_TILE_SIZE / 2);
int y = lp.getY() - ((size - 1) * Perspective.LOCAL_TILE_SIZE / 2);
case HULL:
Shape objectClickbox = actor.getConvexHull();
Polygon southWestTilePoly = Perspective.getCanvasTilePoly(client, new LocalPoint(x, y));
renderPoly(graphics, color, objectClickbox);
break;
renderPoly(graphics, color, southWestTilePoly);
}
if (config.drawNames() && actor.getName() != null)

View File

@@ -1,33 +0,0 @@
/*
* Copyright (c) 2018, Raqes <j.raqes@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.npchighlight;
public enum RenderStyle
{
OFF,
TILE,
HULL,
SOUTH_WEST_TILE
}