ground items: add configuration for which coin value color highlighting uses

This commit is contained in:
Abel Briggs
2019-04-02 07:44:17 -05:00
committed by Adam
parent 2e661f682d
commit b50222cc28
3 changed files with 95 additions and 18 deletions

View File

@@ -32,6 +32,7 @@ import net.runelite.client.config.ConfigItem;
import net.runelite.client.plugins.grounditems.config.ItemHighlightMode; import net.runelite.client.plugins.grounditems.config.ItemHighlightMode;
import net.runelite.client.plugins.grounditems.config.MenuHighlightMode; import net.runelite.client.plugins.grounditems.config.MenuHighlightMode;
import net.runelite.client.plugins.grounditems.config.PriceDisplayMode; import net.runelite.client.plugins.grounditems.config.PriceDisplayMode;
import net.runelite.client.plugins.grounditems.config.ValueCalculationMode;
@ConfigGroup("grounditems") @ConfigGroup("grounditems")
public interface GroundItemsConfig extends Config public interface GroundItemsConfig extends Config
@@ -171,11 +172,22 @@ public interface GroundItemsConfig extends Config
return MenuHighlightMode.NAME; return MenuHighlightMode.NAME;
} }
@ConfigItem(
keyName = "highlightValueCalculation",
name = "Highlight Value Calculation",
description = "Configures which coin value is used to determine highlight color",
position = 11
)
default ValueCalculationMode valueCalculationMode()
{
return ValueCalculationMode.HIGHEST;
}
@ConfigItem( @ConfigItem(
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 = 11 position = 12
) )
default int getHighlightOverValue() default int getHighlightOverValue()
{ {
@@ -186,7 +198,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 = 12 position = 13
) )
default int getHideUnderValue() default int getHideUnderValue()
{ {
@@ -197,7 +209,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 = 13 position = 14
) )
default Color defaultColor() default Color defaultColor()
{ {
@@ -208,7 +220,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 = 14 position = 15
) )
default Color highlightedColor() default Color highlightedColor()
{ {
@@ -219,7 +231,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 = 15 position = 16
) )
default Color hiddenColor() default Color hiddenColor()
{ {
@@ -230,7 +242,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 = 16 position = 17
) )
default Color lowValueColor() default Color lowValueColor()
{ {
@@ -241,7 +253,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 = 17 position = 18
) )
default int lowValuePrice() default int lowValuePrice()
{ {
@@ -252,7 +264,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 = 18 position = 19
) )
default Color mediumValueColor() default Color mediumValueColor()
{ {
@@ -263,7 +275,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 = 19 position = 20
) )
default int mediumValuePrice() default int mediumValuePrice()
{ {
@@ -274,7 +286,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 = 20 position = 21
) )
default Color highValueColor() default Color highValueColor()
{ {
@@ -285,7 +297,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 = 21 position = 22
) )
default int highValuePrice() default int highValuePrice()
{ {
@@ -296,7 +308,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 = 22 position = 23
) )
default Color insaneValueColor() default Color insaneValueColor()
{ {
@@ -307,7 +319,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 = 23 position = 24
) )
default int insaneValuePrice() default int insaneValuePrice()
{ {
@@ -318,7 +330,7 @@ public interface GroundItemsConfig extends Config
keyName = "onlyShowLoot", keyName = "onlyShowLoot",
name = "Only show loot", name = "Only show loot",
description = "Only shows drops from NPCs and players", description = "Only shows drops from NPCs and players",
position = 24 position = 25
) )
default boolean onlyShowLoot() default boolean onlyShowLoot()
{ {
@@ -329,7 +341,7 @@ public interface GroundItemsConfig extends Config
keyName = "doubleTapDelay", keyName = "doubleTapDelay",
name = "Delay for double-tap ALT to hide", name = "Delay for double-tap ALT to hide",
description = "Decrease this number if you accidentally hide ground items often. (0 = Disabled)", description = "Decrease this number if you accidentally hide ground items often. (0 = Disabled)",
position = 25 position = 26
) )
default int doubleTapDelay() default int doubleTapDelay()
{ {
@@ -340,7 +352,7 @@ public interface GroundItemsConfig extends Config
keyName = "collapseEntries", keyName = "collapseEntries",
name = "Collapse ground item menu entries", name = "Collapse ground item menu entries",
description = "Collapses ground item menu entries together and appends count", description = "Collapses ground item menu entries together and appends count",
position = 26 position = 27
) )
default boolean collapseEntries() default boolean collapseEntries()
{ {

View File

@@ -82,6 +82,7 @@ import net.runelite.client.plugins.grounditems.config.MenuHighlightMode;
import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.BOTH; import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.BOTH;
import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.NAME; import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.NAME;
import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.OPTION; import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.OPTION;
import net.runelite.client.plugins.grounditems.config.ValueCalculationMode;
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; import net.runelite.client.util.StackFormatter;
@@ -550,11 +551,29 @@ public class GroundItemsPlugin extends Plugin
return null; return null;
} }
ValueCalculationMode mode = config.valueCalculationMode();
for (Map.Entry<Integer, Color> entry : priceChecks.entrySet()) for (Map.Entry<Integer, Color> entry : priceChecks.entrySet())
{ {
if (gePrice > entry.getKey() || haPrice > entry.getKey()) switch (mode)
{ {
return entry.getValue(); case GE:
if (gePrice > entry.getKey())
{
return entry.getValue();
}
break;
case HA:
if (haPrice > entry.getKey())
{
return entry.getValue();
}
break;
default: // case HIGHEST
if (gePrice > entry.getKey() || haPrice > entry.getKey())
{
return entry.getValue();
}
break;
} }
} }

View File

@@ -0,0 +1,46 @@
/*
* Copyright (c) 2019, Abel Briggs <https://github.com/abelbriggs1>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.grounditems.config;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum ValueCalculationMode
{
HA("High Alchemy"), // calc highlight by HA value
GE("Grand Exchange"), // calc by GE
HIGHEST("Highest"); // use whatever is highest.
private final String name;
@Override
public String toString()
{
return name;
}
}