inventory-tags: add underline as display option
Added item underline as an alternative display option for inventory tags. Item borders remain as the default display option. Close #12165
This commit is contained in:
@@ -32,6 +32,12 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
@ConfigGroup("inventorytags")
|
@ConfigGroup("inventorytags")
|
||||||
public interface InventoryTagsConfig extends Config
|
public interface InventoryTagsConfig extends Config
|
||||||
{
|
{
|
||||||
|
enum DisplayMode
|
||||||
|
{
|
||||||
|
OUTLINE,
|
||||||
|
UNDERLINE
|
||||||
|
}
|
||||||
|
|
||||||
String GROUP = "inventorytags";
|
String GROUP = "inventorytags";
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
@@ -99,4 +105,15 @@ public interface InventoryTagsConfig extends Config
|
|||||||
{
|
{
|
||||||
return new Color(0, 255, 255);
|
return new Color(0, 255, 255);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 6,
|
||||||
|
keyName = "displayMode",
|
||||||
|
name = "Display mode",
|
||||||
|
description = "How tags are displayed in the inventory"
|
||||||
|
)
|
||||||
|
default DisplayMode getDisplayMode()
|
||||||
|
{
|
||||||
|
return DisplayMode.OUTLINE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,18 +31,21 @@ import java.awt.image.BufferedImage;
|
|||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.widgets.WidgetItem;
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
|
import net.runelite.client.plugins.inventorytags.InventoryTagsConfig.DisplayMode;
|
||||||
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
||||||
|
|
||||||
public class InventoryTagsOverlay extends WidgetItemOverlay
|
public class InventoryTagsOverlay extends WidgetItemOverlay
|
||||||
{
|
{
|
||||||
private final ItemManager itemManager;
|
private final ItemManager itemManager;
|
||||||
private final InventoryTagsPlugin plugin;
|
private final InventoryTagsPlugin plugin;
|
||||||
|
private final InventoryTagsConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private InventoryTagsOverlay(ItemManager itemManager, InventoryTagsPlugin plugin)
|
private InventoryTagsOverlay(ItemManager itemManager, InventoryTagsPlugin plugin, InventoryTagsConfig config)
|
||||||
{
|
{
|
||||||
this.itemManager = itemManager;
|
this.itemManager = itemManager;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.config = config;
|
||||||
showOnEquipment();
|
showOnEquipment();
|
||||||
showOnInventory();
|
showOnInventory();
|
||||||
}
|
}
|
||||||
@@ -54,11 +57,21 @@ public class InventoryTagsOverlay extends WidgetItemOverlay
|
|||||||
if (group != null)
|
if (group != null)
|
||||||
{
|
{
|
||||||
final Color color = plugin.getGroupNameColor(group);
|
final Color color = plugin.getGroupNameColor(group);
|
||||||
|
final DisplayMode displayMode = config.getDisplayMode();
|
||||||
if (color != null)
|
if (color != null)
|
||||||
{
|
{
|
||||||
Rectangle bounds = itemWidget.getCanvasBounds();
|
Rectangle bounds = itemWidget.getCanvasBounds();
|
||||||
final BufferedImage outline = itemManager.getItemOutline(itemId, itemWidget.getQuantity(), color);
|
if (displayMode == DisplayMode.OUTLINE)
|
||||||
graphics.drawImage(outline, (int) bounds.getX(), (int) bounds.getY(), null);
|
{
|
||||||
|
final BufferedImage outline = itemManager.getItemOutline(itemId, itemWidget.getQuantity(), color);
|
||||||
|
graphics.drawImage(outline, (int) bounds.getX(), (int) bounds.getY(), null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int heightOffSet = (int) bounds.getY() + (int) bounds.getHeight() + 2;
|
||||||
|
graphics.setColor(color);
|
||||||
|
graphics.drawLine((int) bounds.getX(), heightOffSet, (int) bounds.getX() + (int) bounds.getWidth(), heightOffSet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user