Merge pull request #620 from Sethtroll/addhighlightonly

Ground items: Add a highlight items only option
This commit is contained in:
Adam
2018-02-21 15:01:29 -05:00
committed by GitHub
2 changed files with 56 additions and 32 deletions

View File

@@ -38,10 +38,22 @@ import java.awt.Color;
) )
public interface GroundItemsConfig extends Config public interface GroundItemsConfig extends Config
{ {
@ConfigItem(
keyName = "showHighlightedOnly",
name = "Show Highlighted items only",
description = "Configures whether or not to draw items only on your highlighted list",
position = 1
)
default boolean showHighlightedOnly()
{
return false;
}
@ConfigItem( @ConfigItem(
keyName = "showGEPrice", keyName = "showGEPrice",
name = "Show Grand Exchange Prices", name = "Show Grand Exchange Prices",
description = "Configures whether or not to draw GE prices alongside ground items" description = "Configures whether or not to draw GE prices alongside ground items",
position = 2
) )
default boolean showGEPrice() default boolean showGEPrice()
{ {
@@ -51,37 +63,19 @@ public interface GroundItemsConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "showHAValue", keyName = "showHAValue",
name = "Show High Alchemy Values", name = "Show High Alchemy Values",
description = "Configures whether or not to draw High Alchemy values alongside ground items" description = "Configures whether or not to draw High Alchemy values alongside ground items",
position = 3
) )
default boolean showHAValue() default boolean showHAValue()
{ {
return false; return false;
} }
@ConfigItem(
keyName = "hiddenItems",
name = "Hidden Items",
description = "Configures hidden ground items. Format: (item), (item)"
)
default String getHiddenItems()
{
return "";
}
@ConfigItem(
keyName = "highlightedItems",
name = "Highlighted Items",
description = "Configures specifically highlighted ground items. Format: (item), (item)"
)
default String getHighlightItems()
{
return "";
}
@ConfigItem( @ConfigItem(
keyName = "hideUnderGeValue", keyName = "hideUnderGeValue",
name = "Hide < GE Value", name = "Hide < GE Value",
description = "Configures hidden ground items under GE value" description = "Configures hidden ground items under GE value",
position = 4
) )
default int getHideUnderGeValue() default int getHideUnderGeValue()
{ {
@@ -91,17 +85,41 @@ public interface GroundItemsConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "hideUnderHaValue", keyName = "hideUnderHaValue",
name = "Hide < HA Value", name = "Hide < HA Value",
description = "Configures hidden ground items under High Alch value" description = "Configures hidden ground items under High Alch value",
position = 5
) )
default int getHideUnderHAValue() default int getHideUnderHAValue()
{ {
return 0; return 0;
} }
@ConfigItem(
keyName = "highlightedItems",
name = "Highlighted Items",
description = "Configures specifically highlighted ground items. Format: (item), (item)",
position = 6
)
default String getHighlightItems()
{
return "";
}
@ConfigItem(
keyName = "hiddenItems",
name = "Hidden Items",
description = "Configures hidden ground items. Format: (item), (item)",
position = 7
)
default String getHiddenItems()
{
return "";
}
@ConfigItem( @ConfigItem(
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 = 8
) )
default Color highlightedColor() default Color highlightedColor()
{ {
@@ -111,7 +129,8 @@ public interface GroundItemsConfig extends Config
@ConfigItem( @ConfigItem(
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 = 9
) )
default Color lowValueColor() default Color lowValueColor()
{ {
@@ -121,7 +140,8 @@ public interface GroundItemsConfig extends Config
@ConfigItem( @ConfigItem(
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 = 10
) )
default Color mediumValueColor() default Color mediumValueColor()
{ {
@@ -131,7 +151,8 @@ public interface GroundItemsConfig extends Config
@ConfigItem( @ConfigItem(
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 = 11
) )
default Color highValueColor() default Color highValueColor()
{ {
@@ -141,7 +162,8 @@ public interface GroundItemsConfig extends Config
@ConfigItem( @ConfigItem(
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 = 12
) )
default Color insaneValueColor() default Color insaneValueColor()
{ {

View File

@@ -153,7 +153,9 @@ public class GroundItemsOverlay extends Overlay
ItemComposition itemDefinition = itemManager.getItemComposition(itemId); ItemComposition itemDefinition = itemManager.getItemComposition(itemId);
Integer currentQuantity = items.get(itemId); Integer currentQuantity = items.get(itemId);
if (!hiddenItems.contains(itemDefinition.getName().toLowerCase()))
String itemName = itemDefinition.getName().toLowerCase();
if (config.showHighlightedOnly() ? highlightedItems.contains(itemName) : !hiddenItems.contains(itemName))
{ {
if (itemDefinition.getNote() != -1) if (itemDefinition.getNote() != -1)
{ {
@@ -179,8 +181,8 @@ public class GroundItemsOverlay extends Overlay
alchPrice = Math.round(itemDefinition.getPrice() * HIGH_ALCHEMY_CONSTANT) * quantity; alchPrice = Math.round(itemDefinition.getPrice() * HIGH_ALCHEMY_CONSTANT) * quantity;
} }
if (highlightedItems.contains(itemDefinition.getName().toLowerCase()) || if (highlightedItems.contains(itemDefinition.getName().toLowerCase()) ||
gePrice == 0 || ((gePrice >= config.getHideUnderGeValue()) && gePrice == 0 || ((gePrice >= config.getHideUnderGeValue()) &&
(alchPrice >= config.getHideUnderHAValue()))) (alchPrice >= config.getHideUnderHAValue())))
{ {
items.put(itemId, quantity); items.put(itemId, quantity);
} }