Add option to highlight tiles under ground items (#3895)
Add new option to GroundItemConfig to highlight tiles under ground items based on color configuration.
This commit is contained in:
@@ -119,12 +119,23 @@ public interface GroundItemsConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "highlightTiles",
|
||||
name = "Highlight Tiles",
|
||||
description = "Configures whether or not to highlight tiles containing ground items",
|
||||
position = 6
|
||||
)
|
||||
default boolean highlightTiles()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "priceDisplayMode",
|
||||
name = "Price Display Mode",
|
||||
description = "Configures what price types are shown alongside of ground item name",
|
||||
position = 6
|
||||
position = 7
|
||||
)
|
||||
default PriceDisplayMode priceDisplayMode()
|
||||
{
|
||||
@@ -135,7 +146,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "itemHighlightMode",
|
||||
name = "Item Highlight Mode",
|
||||
description = "Configures how ground items will be highlighted",
|
||||
position = 7
|
||||
position = 8
|
||||
)
|
||||
default ItemHighlightMode itemHighlightMode()
|
||||
{
|
||||
@@ -146,7 +157,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "menuHighlightMode",
|
||||
name = "Menu Highlight Mode",
|
||||
description = "Configures what to highlight in right-click menu",
|
||||
position = 8
|
||||
position = 9
|
||||
)
|
||||
default MenuHighlightMode menuHighlightMode()
|
||||
{
|
||||
@@ -157,7 +168,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "highlightOverValue2",
|
||||
name = "Highlight > Value",
|
||||
description = "Configures highlighted ground items over either GE or HA value",
|
||||
position = 9
|
||||
position = 10
|
||||
)
|
||||
default int getHighlightOverValue()
|
||||
{
|
||||
@@ -168,7 +179,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "hideUnderValue",
|
||||
name = "Hide < Value",
|
||||
description = "Configures hidden ground items under both GE and HA value",
|
||||
position = 10
|
||||
position = 11
|
||||
)
|
||||
default int getHideUnderValue()
|
||||
{
|
||||
@@ -179,7 +190,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "defaultColor",
|
||||
name = "Default items color",
|
||||
description = "Configures the color for default, non-highlighted items",
|
||||
position = 11
|
||||
position = 12
|
||||
)
|
||||
default Color defaultColor()
|
||||
{
|
||||
@@ -190,7 +201,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "highlightedColor",
|
||||
name = "Highlighted items color",
|
||||
description = "Configures the color for highlighted items",
|
||||
position = 12
|
||||
position = 13
|
||||
)
|
||||
default Color highlightedColor()
|
||||
{
|
||||
@@ -201,7 +212,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "hiddenColor",
|
||||
name = "Hidden items color",
|
||||
description = "Configures the color for hidden items in right-click menu and when holding ALT",
|
||||
position = 13
|
||||
position = 14
|
||||
)
|
||||
default Color hiddenColor()
|
||||
{
|
||||
@@ -212,7 +223,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "lowValueColor",
|
||||
name = "Low value items color",
|
||||
description = "Configures the color for low value items",
|
||||
position = 14
|
||||
position = 15
|
||||
)
|
||||
default Color lowValueColor()
|
||||
{
|
||||
@@ -223,7 +234,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "lowValuePrice",
|
||||
name = "Low value price",
|
||||
description = "Configures the start price for low value items",
|
||||
position = 15
|
||||
position = 16
|
||||
)
|
||||
default int lowValuePrice()
|
||||
{
|
||||
@@ -234,7 +245,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "mediumValueColor",
|
||||
name = "Medium value items color",
|
||||
description = "Configures the color for medium value items",
|
||||
position = 16
|
||||
position = 17
|
||||
)
|
||||
default Color mediumValueColor()
|
||||
{
|
||||
@@ -245,7 +256,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "mediumValuePrice",
|
||||
name = "Medium value price",
|
||||
description = "Configures the start price for medium value items",
|
||||
position = 17
|
||||
position = 18
|
||||
)
|
||||
default int mediumValuePrice()
|
||||
{
|
||||
@@ -256,7 +267,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "highValueColor",
|
||||
name = "High value items color",
|
||||
description = "Configures the color for high value items",
|
||||
position = 18
|
||||
position = 19
|
||||
)
|
||||
default Color highValueColor()
|
||||
{
|
||||
@@ -267,7 +278,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "highValuePrice",
|
||||
name = "High value price",
|
||||
description = "Configures the start price for high value items",
|
||||
position = 19
|
||||
position = 20
|
||||
)
|
||||
default int highValuePrice()
|
||||
{
|
||||
@@ -278,7 +289,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "insaneValueColor",
|
||||
name = "Insane value items color",
|
||||
description = "Configures the color for insane value items",
|
||||
position = 20
|
||||
position = 21
|
||||
)
|
||||
default Color insaneValueColor()
|
||||
{
|
||||
@@ -289,7 +300,7 @@ public interface GroundItemsConfig extends Config
|
||||
keyName = "insaneValuePrice",
|
||||
name = "Insane value price",
|
||||
description = "Configures the start price for insane value items",
|
||||
position = 21
|
||||
position = 22
|
||||
)
|
||||
default int insaneValuePrice()
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.ArrayList;
|
||||
@@ -48,6 +49,7 @@ import net.runelite.client.plugins.grounditems.config.PriceDisplayMode;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.ui.overlay.components.BackgroundComponent;
|
||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
@@ -77,7 +79,7 @@ public class GroundItemsOverlay extends Overlay
|
||||
private final ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
public GroundItemsOverlay(Client client, GroundItemsPlugin plugin, GroundItemsConfig config, ItemManager itemManager)
|
||||
private GroundItemsOverlay(Client client, GroundItemsPlugin plugin, GroundItemsConfig config, ItemManager itemManager)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
@@ -90,7 +92,9 @@ public class GroundItemsOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!plugin.isHotKeyPressed() && config.itemHighlightMode() == MENU)
|
||||
final boolean dontShowOverlay = config.itemHighlightMode() == MENU && !plugin.isHotKeyPressed();
|
||||
|
||||
if (dontShowOverlay && !config.highlightTiles())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -200,6 +204,22 @@ public class GroundItemsOverlay extends Overlay
|
||||
}
|
||||
|
||||
final Color color = plugin.getItemColor(highlighted, hidden);
|
||||
|
||||
if (config.highlightTiles())
|
||||
{
|
||||
final Polygon poly = Perspective.getCanvasTilePoly(client, groundPoint);
|
||||
|
||||
if (poly != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||
}
|
||||
}
|
||||
|
||||
if (dontShowOverlay)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
itemStringBuilder.append(item.getName());
|
||||
|
||||
if (item.getQuantity() > 1)
|
||||
@@ -211,8 +231,8 @@ public class GroundItemsOverlay extends Overlay
|
||||
else
|
||||
{
|
||||
itemStringBuilder.append(" (")
|
||||
.append(StackFormatter.quantityToStackSize(item.getQuantity()))
|
||||
.append(")");
|
||||
.append(StackFormatter.quantityToStackSize(item.getQuantity()))
|
||||
.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user