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