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 haPrice;
private int gePrice;
private boolean tradeable;
@Value
static class GroundItemKey

View File

@@ -87,11 +87,22 @@ public interface GroundItemsConfig extends Config
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(
keyName = "showMenuItemQuantities",
name = "Show Menu Item Quantities",
description = "Configures whether or not to show the item quantities in the menu",
position = 3
position = 4
)
default boolean showMenuItemQuantities()
{
@@ -102,7 +113,7 @@ public interface GroundItemsConfig extends Config
keyName = "priceDisplayMode",
name = "Price Display Mode",
description = "Configures what price types are shown alongside of ground item name",
position = 4
position = 5
)
default PriceDisplayMode priceDisplayMode()
{
@@ -113,7 +124,7 @@ public interface GroundItemsConfig extends Config
keyName = "itemHighlightMode",
name = "Item Highlight Mode",
description = "Configures how ground items will be highlighted",
position = 5
position = 6
)
default ItemHighlightMode itemHighlightMode()
{
@@ -124,7 +135,7 @@ public interface GroundItemsConfig extends Config
keyName = "menuHighlightMode",
name = "Menu Highlight Mode",
description = "Configures what to highlight in right-click menu",
position = 6
position = 7
)
default MenuHighlightMode menuHighlightMode()
{
@@ -135,7 +146,7 @@ public interface GroundItemsConfig extends Config
keyName = "hideUnderGeValue",
name = "Hide < GE Value",
description = "Configures hidden ground items under GE value",
position = 7
position = 8
)
default int getHideUnderGeValue()
{
@@ -146,7 +157,7 @@ public interface GroundItemsConfig extends Config
keyName = "hideUnderHaValue",
name = "Hide < HA Value",
description = "Configures hidden ground items under High Alch value",
position = 8
position = 9
)
default int getHideUnderHAValue()
{
@@ -157,7 +168,7 @@ public interface GroundItemsConfig extends Config
keyName = "defaultColor",
name = "Default items color",
description = "Configures the color for default, non-highlighted items",
position = 9
position = 10
)
default Color defaultColor()
{
@@ -168,7 +179,7 @@ public interface GroundItemsConfig extends Config
keyName = "highlightedColor",
name = "Highlighted items color",
description = "Configures the color for highlighted items",
position = 10
position = 11
)
default Color highlightedColor()
{
@@ -179,7 +190,7 @@ public interface GroundItemsConfig extends Config
keyName = "lowValueColor",
name = "Low value items color",
description = "Configures the color for low value items",
position = 11
position = 12
)
default Color lowValueColor()
{
@@ -190,7 +201,7 @@ public interface GroundItemsConfig extends Config
keyName = "lowValuePrice",
name = "Low value price",
description = "Configures the start price for low value items",
position = 12
position = 13
)
default int lowValuePrice()
{
@@ -201,7 +212,7 @@ public interface GroundItemsConfig extends Config
keyName = "mediumValueColor",
name = "Medium value items color",
description = "Configures the color for medium value items",
position = 13
position = 14
)
default Color mediumValueColor()
{
@@ -212,7 +223,7 @@ public interface GroundItemsConfig extends Config
keyName = "mediumValuePrice",
name = "Medium value price",
description = "Configures the start price for medium value items",
position = 14
position = 15
)
default int mediumValuePrice()
{
@@ -223,7 +234,7 @@ public interface GroundItemsConfig extends Config
keyName = "highValueColor",
name = "High value items color",
description = "Configures the color for high value items",
position = 15
position = 16
)
default Color highValueColor()
{
@@ -234,7 +245,7 @@ public interface GroundItemsConfig extends Config
keyName = "highValuePrice",
name = "High value price",
description = "Configures the start price for high value items",
position = 16
position = 17
)
default int highValuePrice()
{
@@ -245,7 +256,7 @@ public interface GroundItemsConfig extends Config
keyName = "insaneValueColor",
name = "Insane value items color",
description = "Configures the color for insane value items",
position = 17
position = 18
)
default Color insaneValueColor()
{
@@ -256,7 +267,7 @@ public interface GroundItemsConfig extends Config
keyName = "insaneValuePrice",
name = "Insane value price",
description = "Configures the start price for insane value items",
position = 18
position = 19
)
default int insaneValuePrice()
{

View File

@@ -138,12 +138,18 @@ public class GroundItemsOverlay extends Overlay
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
&& ((item.getGePrice() > 0 && item.getGePrice() < config.getHideUnderGeValue())
|| item.getHaPrice() < config.getHideUnderHAValue()))
if (!plugin.isHotKeyPressed() && !highlighted)
{
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(),

View File

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