Merge pull request #233 from deathbeam/hide-items-under-value
Add hide items under value to GroundItems plugin
This commit is contained in:
@@ -85,4 +85,24 @@ public interface GroundItemsConfig extends Config
|
|||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "hideUnderGeValue",
|
||||||
|
name = "Hide < GE Value",
|
||||||
|
description = "Configures hidden ground items under GE value"
|
||||||
|
)
|
||||||
|
default int getHideUnderGeValue()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "hideUnderHaValue",
|
||||||
|
name = "Hide < HA Value",
|
||||||
|
description = "Configures hidden ground items under High Alch value"
|
||||||
|
)
|
||||||
|
default int getHideUnderHAValue()
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -191,13 +191,24 @@ public class GroundItemsOverlay extends Overlay
|
|||||||
Integer currentQuantity = items.get(itemId);
|
Integer currentQuantity = items.get(itemId);
|
||||||
if (!hiddenItems.contains(itemDefinition.getName().toLowerCase()))
|
if (!hiddenItems.contains(itemDefinition.getName().toLowerCase()))
|
||||||
{
|
{
|
||||||
if (currentQuantity == null)
|
if (itemDefinition.getNote() != -1)
|
||||||
{
|
{
|
||||||
items.put(itemId, itemQuantity);
|
itemId = itemDefinition.getLinkedNoteId();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
int quantity = currentQuantity == null
|
||||||
|
? itemQuantity
|
||||||
|
: currentQuantity + itemQuantity;
|
||||||
|
|
||||||
|
ItemPrice itemPrice = itemManager.get(itemId);
|
||||||
|
|
||||||
|
int gePrice = itemPrice == null ? 0 : itemPrice.getPrice() * quantity;
|
||||||
|
int alchPrice = Math.round(itemDefinition.getPrice() * HIGH_ALCHEMY_CONSTANT);
|
||||||
|
|
||||||
|
if (gePrice == 0 || ((gePrice >= config.getHideUnderGeValue()) &&
|
||||||
|
(alchPrice >= config.getHideUnderHAValue())))
|
||||||
{
|
{
|
||||||
items.put(itemId, currentQuantity + itemQuantity);
|
items.put(itemId, quantity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user