Add option to always draw untradeable items

Instead of checking for GE price being above 0, use isTradeable boolean
to determine if the price checks should apply or not and add
configuration value to disable this behaviour.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-04-02 00:55:28 +02:00
parent a1ea91a0c2
commit 7a3ee8d1c0
4 changed files with 40 additions and 21 deletions

View File

@@ -41,6 +41,7 @@ class GroundItem
private int height; private int height;
private int haPrice; private int haPrice;
private int gePrice; private int gePrice;
private boolean tradeable;
@Value @Value
static class GroundItemKey static class GroundItemKey

View File

@@ -87,11 +87,22 @@ public interface GroundItemsConfig extends Config
return false; return false;
} }
@ConfigItem(
keyName = "dontHideUntradeables",
name = "Do not hide untradeables",
description = "Configures whether or not untradeable items ignore hiding under settings",
position = 3
)
default boolean dontHideUntradeables()
{
return true;
}
@ConfigItem( @ConfigItem(
keyName = "showMenuItemQuantities", keyName = "showMenuItemQuantities",
name = "Show Menu Item Quantities", name = "Show Menu Item Quantities",
description = "Configures whether or not to show the item quantities in the menu", description = "Configures whether or not to show the item quantities in the menu",
position = 3 position = 4
) )
default boolean showMenuItemQuantities() default boolean showMenuItemQuantities()
{ {
@@ -102,7 +113,7 @@ public interface GroundItemsConfig extends Config
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 = 4 position = 5
) )
default PriceDisplayMode priceDisplayMode() default PriceDisplayMode priceDisplayMode()
{ {
@@ -113,7 +124,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 = 5 position = 6
) )
default ItemHighlightMode itemHighlightMode() default ItemHighlightMode itemHighlightMode()
{ {
@@ -124,7 +135,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 = 6 position = 7
) )
default MenuHighlightMode menuHighlightMode() default MenuHighlightMode menuHighlightMode()
{ {
@@ -135,7 +146,7 @@ public interface GroundItemsConfig extends Config
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 = 7 position = 8
) )
default int getHideUnderGeValue() default int getHideUnderGeValue()
{ {
@@ -146,7 +157,7 @@ public interface GroundItemsConfig extends Config
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 = 8 position = 9
) )
default int getHideUnderHAValue() default int getHideUnderHAValue()
{ {
@@ -157,7 +168,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 = 9 position = 10
) )
default Color defaultColor() default Color defaultColor()
{ {
@@ -168,7 +179,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 = 10 position = 11
) )
default Color highlightedColor() default Color highlightedColor()
{ {
@@ -179,7 +190,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 = 11 position = 12
) )
default Color lowValueColor() default Color lowValueColor()
{ {
@@ -190,7 +201,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 = 12 position = 13
) )
default int lowValuePrice() default int lowValuePrice()
{ {
@@ -201,7 +212,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 = 13 position = 14
) )
default Color mediumValueColor() default Color mediumValueColor()
{ {
@@ -212,7 +223,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 = 14 position = 15
) )
default int mediumValuePrice() default int mediumValuePrice()
{ {
@@ -223,7 +234,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 = 15 position = 16
) )
default Color highValueColor() default Color highValueColor()
{ {
@@ -234,7 +245,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 = 16 position = 17
) )
default int highValuePrice() default int highValuePrice()
{ {
@@ -245,7 +256,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 = 17 position = 18
) )
default Color insaneValueColor() default Color insaneValueColor()
{ {
@@ -256,7 +267,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 = 18 position = 19
) )
default int insaneValuePrice() default int insaneValuePrice()
{ {

View File

@@ -138,12 +138,18 @@ public class GroundItemsOverlay extends Overlay
item.setGePrice(itemPrice.getPrice() * item.getQuantity()); item.setGePrice(itemPrice.getPrice() * item.getQuantity());
} }
// Do not display items that are under HA or GE price and are not highlighted if (!plugin.isHotKeyPressed() && !highlighted)
if (!plugin.isHotKeyPressed() && !highlighted
&& ((item.getGePrice() > 0 && item.getGePrice() < config.getHideUnderGeValue())
|| item.getHaPrice() < config.getHideUnderHAValue()))
{ {
continue; // Check if item is under config threshold
final boolean underThreshold = item.getGePrice() < config.getHideUnderGeValue()
|| item.getHaPrice() < config.getHideUnderHAValue();
// If item is under threshold an we are either not always showing untradeables or item is tradeable
// do not display item
if (underThreshold && (!config.dontHideUntradeables() || item.isTradeable()))
{
continue;
}
} }
final Color color = getCostColor(item.getGePrice() > 0 ? item.getGePrice() : item.getHaPrice(), final Color color = getCostColor(item.getGePrice() > 0 ? item.getGePrice() : item.getHaPrice(),

View File

@@ -293,6 +293,7 @@ public class GroundItemsPlugin extends Plugin
.quantity(item.getQuantity()) .quantity(item.getQuantity())
.name(itemComposition.getName()) .name(itemComposition.getName())
.haPrice(alchPrice * item.getQuantity()) .haPrice(alchPrice * item.getQuantity())
.tradeable(itemComposition.isTradeable())
.build(); .build();