Add highlighted ground item notifications (#3647)
Add notification for highlighted item spawning on ground. Closes #3643
This commit is contained in:
@@ -127,11 +127,22 @@ public interface GroundItemsConfig extends Config
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "notifyHighlightedDrops",
|
||||||
|
name = "Notify for Highlighted drops",
|
||||||
|
description = "Configures whether or not to notify for drops on your highlighted list",
|
||||||
|
position = 7
|
||||||
|
)
|
||||||
|
default boolean notifyHighlightedDrops()
|
||||||
|
{
|
||||||
|
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 = 7
|
position = 8
|
||||||
)
|
)
|
||||||
default PriceDisplayMode priceDisplayMode()
|
default PriceDisplayMode priceDisplayMode()
|
||||||
{
|
{
|
||||||
@@ -142,7 +153,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 = 8
|
position = 9
|
||||||
)
|
)
|
||||||
default ItemHighlightMode itemHighlightMode()
|
default ItemHighlightMode itemHighlightMode()
|
||||||
{
|
{
|
||||||
@@ -153,7 +164,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 = 9
|
position = 10
|
||||||
)
|
)
|
||||||
default MenuHighlightMode menuHighlightMode()
|
default MenuHighlightMode menuHighlightMode()
|
||||||
{
|
{
|
||||||
@@ -164,7 +175,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 = 10
|
position = 11
|
||||||
)
|
)
|
||||||
default int getHighlightOverValue()
|
default int getHighlightOverValue()
|
||||||
{
|
{
|
||||||
@@ -175,7 +186,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 = 11
|
position = 12
|
||||||
)
|
)
|
||||||
default int getHideUnderValue()
|
default int getHideUnderValue()
|
||||||
{
|
{
|
||||||
@@ -186,7 +197,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 = 12
|
position = 13
|
||||||
)
|
)
|
||||||
default Color defaultColor()
|
default Color defaultColor()
|
||||||
{
|
{
|
||||||
@@ -197,7 +208,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 = 13
|
position = 14
|
||||||
)
|
)
|
||||||
default Color highlightedColor()
|
default Color highlightedColor()
|
||||||
{
|
{
|
||||||
@@ -208,7 +219,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 = 14
|
position = 15
|
||||||
)
|
)
|
||||||
default Color hiddenColor()
|
default Color hiddenColor()
|
||||||
{
|
{
|
||||||
@@ -219,7 +230,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 = 15
|
position = 16
|
||||||
)
|
)
|
||||||
default Color lowValueColor()
|
default Color lowValueColor()
|
||||||
{
|
{
|
||||||
@@ -230,7 +241,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 = 16
|
position = 17
|
||||||
)
|
)
|
||||||
default int lowValuePrice()
|
default int lowValuePrice()
|
||||||
{
|
{
|
||||||
@@ -241,7 +252,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 = 17
|
position = 18
|
||||||
)
|
)
|
||||||
default Color mediumValueColor()
|
default Color mediumValueColor()
|
||||||
{
|
{
|
||||||
@@ -252,7 +263,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 = 18
|
position = 19
|
||||||
)
|
)
|
||||||
default int mediumValuePrice()
|
default int mediumValuePrice()
|
||||||
{
|
{
|
||||||
@@ -263,7 +274,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 = 19
|
position = 20
|
||||||
)
|
)
|
||||||
default Color highValueColor()
|
default Color highValueColor()
|
||||||
{
|
{
|
||||||
@@ -274,7 +285,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 = 20
|
position = 21
|
||||||
)
|
)
|
||||||
default int highValuePrice()
|
default int highValuePrice()
|
||||||
{
|
{
|
||||||
@@ -285,7 +296,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 = 21
|
position = 22
|
||||||
)
|
)
|
||||||
default Color insaneValueColor()
|
default Color insaneValueColor()
|
||||||
{
|
{
|
||||||
@@ -296,7 +307,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 = 22
|
position = 23
|
||||||
)
|
)
|
||||||
default int insaneValuePrice()
|
default int insaneValuePrice()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import net.runelite.api.ItemLayer;
|
|||||||
import net.runelite.api.MenuAction;
|
import net.runelite.api.MenuAction;
|
||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.Node;
|
import net.runelite.api.Node;
|
||||||
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Scene;
|
import net.runelite.api.Scene;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Tile;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
@@ -63,6 +64,7 @@ import net.runelite.api.events.ItemDespawned;
|
|||||||
import net.runelite.api.events.ItemQuantityChanged;
|
import net.runelite.api.events.ItemQuantityChanged;
|
||||||
import net.runelite.api.events.ItemSpawned;
|
import net.runelite.api.events.ItemSpawned;
|
||||||
import net.runelite.api.events.MenuEntryAdded;
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
|
import net.runelite.client.Notifier;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.input.KeyManager;
|
import net.runelite.client.input.KeyManager;
|
||||||
@@ -76,6 +78,7 @@ import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.N
|
|||||||
import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.OPTION;
|
import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.OPTION;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
import net.runelite.client.util.ColorUtil;
|
import net.runelite.client.util.ColorUtil;
|
||||||
|
import net.runelite.client.util.StackFormatter;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Ground Items",
|
name = "Ground Items",
|
||||||
@@ -138,6 +141,9 @@ public class GroundItemsPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private GroundItemsOverlay overlay;
|
private GroundItemsOverlay overlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private Notifier notifier;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Map<GroundItem.GroundItemKey, GroundItem> collectedGroundItems = new LinkedHashMap<>();
|
private final Map<GroundItem.GroundItemKey, GroundItem> collectedGroundItems = new LinkedHashMap<>();
|
||||||
private final Map<Integer, Color> priceChecks = new LinkedHashMap<>();
|
private final Map<Integer, Color> priceChecks = new LinkedHashMap<>();
|
||||||
@@ -206,6 +212,13 @@ public class GroundItemsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
existing.setQuantity(existing.getQuantity() + groundItem.getQuantity());
|
existing.setQuantity(existing.getQuantity() + groundItem.getQuantity());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isHighlighted = config.highlightedColor().equals(getHighlighted(groundItem.getName(),
|
||||||
|
groundItem.getGePrice(), groundItem.getHaPrice()));
|
||||||
|
if (config.notifyHighlightedDrops() && isHighlighted)
|
||||||
|
{
|
||||||
|
notifyHighlightedItem(groundItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -484,4 +497,34 @@ public class GroundItemsPlugin extends Plugin
|
|||||||
setHotKeyPressed(false);
|
setHotKeyPressed(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notifyHighlightedItem(GroundItem item)
|
||||||
|
{
|
||||||
|
final Player local = client.getLocalPlayer();
|
||||||
|
final StringBuilder notificationStringBuilder = new StringBuilder()
|
||||||
|
.append("[")
|
||||||
|
.append(local.getName())
|
||||||
|
.append("] received a highlighted drop: ")
|
||||||
|
.append(item.getName());
|
||||||
|
|
||||||
|
if (item.getQuantity() > 1)
|
||||||
|
{
|
||||||
|
notificationStringBuilder.append(" x ").append(item.getQuantity());
|
||||||
|
|
||||||
|
|
||||||
|
if (item.getQuantity() > (int) Character.MAX_VALUE)
|
||||||
|
{
|
||||||
|
notificationStringBuilder.append(" (Lots!)");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
notificationStringBuilder.append(" (")
|
||||||
|
.append(StackFormatter.quantityToStackSize(item.getQuantity()))
|
||||||
|
.append(")");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
notificationStringBuilder.append("!");
|
||||||
|
notifier.notify(notificationStringBuilder.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user