Added sorting on the item overlay, items now appear in the order that they'll be picked up (#320)
Changed item menu sorting:
Hidden items now appear at the bottom of the menu, so that hidden items don't get picked up over lower value non-hidden items
Added a config option to put hidden items below "Walk here"
this option makes it so that you can't accidentally pick up hidden items
Added a config option to sort by GE value
this option means that you'll always pick up highest GE value items first with left click
this option also sorts the overlay by GE value
This commit is contained in:
@@ -1,439 +1,461 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Aria <aria@ar1as.space>
|
* Copyright (c) 2017, Aria <aria@ar1as.space>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
* list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* 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
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.runelite.client.plugins.grounditems;
|
package net.runelite.client.plugins.grounditems;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
import net.runelite.client.config.ConfigItem;
|
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.TimerDisplayMode;
|
import net.runelite.client.plugins.grounditems.config.TimerDisplayMode;
|
||||||
import net.runelite.client.plugins.grounditems.config.ValueCalculationMode;
|
import net.runelite.client.plugins.grounditems.config.ValueCalculationMode;
|
||||||
|
|
||||||
@ConfigGroup("grounditems")
|
@ConfigGroup("grounditems")
|
||||||
public interface GroundItemsConfig extends Config
|
public interface GroundItemsConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightedItems",
|
keyName = "highlightedItems",
|
||||||
name = "Highlighted Items",
|
name = "Highlighted Items",
|
||||||
description = "Configures specifically highlighted ground items. Format: (item), (item)",
|
description = "Configures specifically highlighted ground items. Format: (item), (item)",
|
||||||
position = 0
|
position = 0
|
||||||
)
|
)
|
||||||
default String getHighlightItems()
|
default String getHighlightItems()
|
||||||
{
|
{
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightedItems",
|
keyName = "highlightedItems",
|
||||||
name = "",
|
name = "",
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
void setHighlightedItem(String key);
|
void setHighlightedItem(String key);
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "hiddenItems",
|
keyName = "hiddenItems",
|
||||||
name = "Hidden Items",
|
name = "Hidden Items",
|
||||||
description = "Configures hidden ground items. Format: (item), (item)",
|
description = "Configures hidden ground items. Format: (item), (item)",
|
||||||
position = 1
|
position = 1
|
||||||
)
|
)
|
||||||
default String getHiddenItems()
|
default String getHiddenItems()
|
||||||
{
|
{
|
||||||
return "Vial, Ashes, Coins, Bones, Bucket, Jug, Seaweed";
|
return "Vial, Ashes, Coins, Bones, Bucket, Jug, Seaweed";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "hiddenItems",
|
keyName = "hiddenItems",
|
||||||
name = "",
|
name = "",
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
void setHiddenItems(String key);
|
void setHiddenItems(String key);
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showHighlightedOnly",
|
keyName = "showHighlightedOnly",
|
||||||
name = "Show Highlighted items only",
|
name = "Show Highlighted items only",
|
||||||
description = "Configures whether or not to draw items only on your highlighted list",
|
description = "Configures whether or not to draw items only on your highlighted list",
|
||||||
position = 2
|
position = 2
|
||||||
)
|
)
|
||||||
default boolean showHighlightedOnly()
|
default boolean showHighlightedOnly()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "dontHideUntradeables",
|
keyName = "dontHideUntradeables",
|
||||||
name = "Do not hide untradeables",
|
name = "Do not hide untradeables",
|
||||||
description = "Configures whether or not untradeable items ignore hiding under settings",
|
description = "Configures whether or not untradeable items ignore hiding under settings",
|
||||||
position = 3
|
position = 3
|
||||||
)
|
)
|
||||||
default boolean dontHideUntradeables()
|
default boolean dontHideUntradeables()
|
||||||
{
|
{
|
||||||
return true;
|
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 = 4
|
position = 4
|
||||||
)
|
)
|
||||||
default boolean showMenuItemQuantities()
|
default boolean showMenuItemQuantities()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "recolorMenuHiddenItems",
|
keyName = "recolorMenuHiddenItems",
|
||||||
name = "Recolor Menu Hidden Items",
|
name = "Recolor Menu Hidden Items",
|
||||||
description = "Configures whether or not hidden items in right click menu will be recolored",
|
description = "Configures whether or not hidden items in right click menu will be recolored",
|
||||||
position = 5
|
position = 5
|
||||||
)
|
)
|
||||||
default boolean recolorMenuHiddenItems()
|
default boolean recolorMenuHiddenItems()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightTiles",
|
keyName = "highlightTiles",
|
||||||
name = "Highlight Tiles",
|
name = "Highlight Tiles",
|
||||||
description = "Configures whether or not to highlight tiles containing ground items",
|
description = "Configures whether or not to highlight tiles containing ground items",
|
||||||
position = 6
|
position = 6
|
||||||
)
|
)
|
||||||
default boolean highlightTiles()
|
default boolean highlightTiles()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "notifyHighlightedDrops",
|
keyName = "notifyHighlightedDrops",
|
||||||
name = "Notify for Highlighted drops",
|
name = "Notify for Highlighted drops",
|
||||||
description = "Configures whether or not to notify for drops on your highlighted list",
|
description = "Configures whether or not to notify for drops on your highlighted list",
|
||||||
position = 7
|
position = 7
|
||||||
)
|
)
|
||||||
default boolean notifyHighlightedDrops()
|
default boolean notifyHighlightedDrops()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 8
|
position = 8
|
||||||
)
|
)
|
||||||
default PriceDisplayMode priceDisplayMode()
|
default PriceDisplayMode priceDisplayMode()
|
||||||
{
|
{
|
||||||
return PriceDisplayMode.BOTH;
|
return PriceDisplayMode.BOTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 9
|
position = 9
|
||||||
)
|
)
|
||||||
default ItemHighlightMode itemHighlightMode()
|
default ItemHighlightMode itemHighlightMode()
|
||||||
{
|
{
|
||||||
return ItemHighlightMode.BOTH;
|
return ItemHighlightMode.BOTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 10
|
position = 10
|
||||||
)
|
)
|
||||||
default MenuHighlightMode menuHighlightMode()
|
default MenuHighlightMode menuHighlightMode()
|
||||||
{
|
{
|
||||||
return MenuHighlightMode.NAME;
|
return MenuHighlightMode.NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightValueCalculation",
|
keyName = "highlightValueCalculation",
|
||||||
name = "Highlight Value Calculation",
|
name = "Highlight Value Calculation",
|
||||||
description = "Configures which coin value is used to determine highlight color",
|
description = "Configures which coin value is used to determine highlight color",
|
||||||
position = 11
|
position = 11
|
||||||
)
|
)
|
||||||
default ValueCalculationMode valueCalculationMode()
|
default ValueCalculationMode valueCalculationMode()
|
||||||
{
|
{
|
||||||
return ValueCalculationMode.HIGHEST;
|
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 = 12
|
position = 12
|
||||||
)
|
)
|
||||||
default int getHighlightOverValue()
|
default int getHighlightOverValue()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 13
|
position = 13
|
||||||
)
|
)
|
||||||
default int getHideUnderValue()
|
default int getHideUnderValue()
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 14
|
position = 14
|
||||||
)
|
)
|
||||||
default Color defaultColor()
|
default Color defaultColor()
|
||||||
{
|
{
|
||||||
return Color.WHITE;
|
return Color.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 = 15
|
position = 15
|
||||||
)
|
)
|
||||||
default Color highlightedColor()
|
default Color highlightedColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#AA00FF");
|
return Color.decode("#AA00FF");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 16
|
position = 16
|
||||||
)
|
)
|
||||||
default Color hiddenColor()
|
default Color hiddenColor()
|
||||||
{
|
{
|
||||||
return Color.GRAY;
|
return Color.GRAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 = 17
|
position = 17
|
||||||
)
|
)
|
||||||
default Color lowValueColor()
|
default Color lowValueColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#66B2FF");
|
return Color.decode("#66B2FF");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 18
|
position = 18
|
||||||
)
|
)
|
||||||
default int lowValuePrice()
|
default int lowValuePrice()
|
||||||
{
|
{
|
||||||
return 20000;
|
return 20000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "notifyLowValueDrops",
|
keyName = "notifyLowValueDrops",
|
||||||
name = "Notify for low value drops",
|
name = "Notify for low value drops",
|
||||||
description = "Configures whether or not to notify for drops of low value",
|
description = "Configures whether or not to notify for drops of low value",
|
||||||
position = 19
|
position = 19
|
||||||
)
|
)
|
||||||
default boolean notifyLowValueDrops()
|
default boolean notifyLowValueDrops()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 = 20
|
position = 20
|
||||||
)
|
)
|
||||||
default Color mediumValueColor()
|
default Color mediumValueColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#99FF99");
|
return Color.decode("#99FF99");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 21
|
position = 21
|
||||||
)
|
)
|
||||||
default int mediumValuePrice()
|
default int mediumValuePrice()
|
||||||
{
|
{
|
||||||
return 100000;
|
return 100000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "notifyMediumValueDrops",
|
keyName = "notifyMediumValueDrops",
|
||||||
name = "Notify for medium value drops",
|
name = "Notify for medium value drops",
|
||||||
description = "Configures whether or not to notify for drops of medium value",
|
description = "Configures whether or not to notify for drops of medium value",
|
||||||
position = 22
|
position = 22
|
||||||
)
|
)
|
||||||
default boolean notifyMediumValueDrops()
|
default boolean notifyMediumValueDrops()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 = 23
|
position = 23
|
||||||
)
|
)
|
||||||
default Color highValueColor()
|
default Color highValueColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#FF9600");
|
return Color.decode("#FF9600");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 24
|
position = 24
|
||||||
)
|
)
|
||||||
default int highValuePrice()
|
default int highValuePrice()
|
||||||
{
|
{
|
||||||
return 1000000;
|
return 1000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "notifyHighValueDrops",
|
keyName = "notifyHighValueDrops",
|
||||||
name = "Notify for high value drops",
|
name = "Notify for high value drops",
|
||||||
description = "Configures whether or not to notify for drops of high value",
|
description = "Configures whether or not to notify for drops of high value",
|
||||||
position = 25
|
position = 25
|
||||||
)
|
)
|
||||||
default boolean notifyHighValueDrops()
|
default boolean notifyHighValueDrops()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@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 = 26
|
position = 26
|
||||||
)
|
)
|
||||||
default Color insaneValueColor()
|
default Color insaneValueColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#FF66B2");
|
return Color.decode("#FF66B2");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 27
|
position = 27
|
||||||
)
|
)
|
||||||
default int insaneValuePrice()
|
default int insaneValuePrice()
|
||||||
{
|
{
|
||||||
return 10000000;
|
return 10000000;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "notifyInsaneValueDrops",
|
keyName = "notifyInsaneValueDrops",
|
||||||
name = "Notify for insane value drops",
|
name = "Notify for insane value drops",
|
||||||
description = "Configures whether or not to notify for drops of insane value",
|
description = "Configures whether or not to notify for drops of insane value",
|
||||||
position = 28
|
position = 28
|
||||||
)
|
)
|
||||||
default boolean notifyInsaneValueDrops()
|
default boolean notifyInsaneValueDrops()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 29
|
position = 29
|
||||||
)
|
)
|
||||||
default boolean onlyShowLoot()
|
default boolean onlyShowLoot()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 30
|
position = 30
|
||||||
)
|
)
|
||||||
default int doubleTapDelay()
|
default int doubleTapDelay()
|
||||||
{
|
{
|
||||||
return 250;
|
return 250;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
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 = 31
|
position = 31
|
||||||
)
|
)
|
||||||
default boolean collapseEntries()
|
default boolean collapseEntries()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "removeIgnored",
|
keyName = "removeIgnored",
|
||||||
name = "Hide Ignored",
|
name = "Hide Ignored",
|
||||||
description = "Remove take option for items that are on the hidden items list.",
|
description = "Remove take option for items that are on the hidden items list.",
|
||||||
position = 32
|
position = 32
|
||||||
)
|
)
|
||||||
default boolean removeIgnored()
|
default boolean removeIgnored()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "toggleOutline",
|
keyName = "toggleOutline",
|
||||||
name = "Text Outline",
|
name = "Text Outline",
|
||||||
description = "Use an outline around text instead of a text shadow",
|
description = "Use an outline around text instead of a text shadow",
|
||||||
position = 33
|
position = 33
|
||||||
)
|
)
|
||||||
default boolean toggleOutline()
|
default boolean toggleOutline()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showGroundItemDuration",
|
keyName = "showGroundItemDuration",
|
||||||
name = "Show time remaining",
|
name = "Show time remaining",
|
||||||
description = "Turn on a countdown timer to show how long an item will remain on the ground",
|
description = "Turn on a countdown timer to show how long an item will remain on the ground",
|
||||||
position = 34
|
position = 34
|
||||||
)
|
)
|
||||||
default TimerDisplayMode showGroundItemDuration()
|
default TimerDisplayMode showGroundItemDuration()
|
||||||
{
|
{
|
||||||
return TimerDisplayMode.HOTKEY_PRESSED;
|
return TimerDisplayMode.HOTKEY_PRESSED;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "sortByGEPrice",
|
||||||
|
name = "Sort by GE price",
|
||||||
|
description = "Sorts ground items by GE price, instead of alch value",
|
||||||
|
position = 35
|
||||||
|
)
|
||||||
|
default boolean sortByGEPrice()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "rightClickHidden",
|
||||||
|
name = "Right click hidden items",
|
||||||
|
description = "Places hidden items below the 'Walk here' option, making it so that you need to right click to pick them up",
|
||||||
|
position = 36
|
||||||
|
)
|
||||||
|
default boolean rightClickHidden()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,475 +1,483 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, Aria <aria@ar1as.space>
|
* Copyright (c) 2017, Aria <aria@ar1as.space>
|
||||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
*
|
*
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
* list of conditions and the following disclaimer.
|
* list of conditions and the following disclaimer.
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* 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
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
* 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
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.grounditems;
|
package net.runelite.client.plugins.grounditems;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.AbstractMap.SimpleEntry;
|
import java.util.AbstractMap.SimpleEntry;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import java.util.List;
|
||||||
import net.runelite.api.Client;
|
import java.util.Comparator;
|
||||||
import net.runelite.api.Perspective;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Perspective;
|
||||||
import net.runelite.api.Tile;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.Tile;
|
||||||
import static net.runelite.client.plugins.grounditems.config.ItemHighlightMode.MENU;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.client.plugins.grounditems.config.PriceDisplayMode;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.client.plugins.grounditems.config.TimerDisplayMode;
|
import static net.runelite.client.plugins.grounditems.config.ItemHighlightMode.MENU;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.plugins.grounditems.config.PriceDisplayMode;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.plugins.grounditems.config.TimerDisplayMode;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.components.BackgroundComponent;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
import net.runelite.client.ui.overlay.components.BackgroundComponent;
|
||||||
import net.runelite.client.util.StackFormatter;
|
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||||
public class GroundItemsOverlay extends Overlay
|
import net.runelite.client.util.StackFormatter;
|
||||||
{
|
|
||||||
private static final int MAX_DISTANCE = 2500;
|
public class GroundItemsOverlay extends Overlay
|
||||||
// We must offset the text on the z-axis such that
|
{
|
||||||
// it doesn't obscure the ground items below it.
|
private static final int MAX_DISTANCE = 2500;
|
||||||
private static final int OFFSET_Z = 20;
|
// We must offset the text on the z-axis such that
|
||||||
// The game won't send anything higher than this value to the plugin -
|
// it doesn't obscure the ground items below it.
|
||||||
// so we replace any item quantity higher with "Lots" instead.
|
private static final int OFFSET_Z = 20;
|
||||||
private static final int MAX_QUANTITY = 65535;
|
// The game won't send anything higher than this value to the plugin -
|
||||||
// The 15 pixel gap between each drawn ground item.
|
// so we replace any item quantity higher with "Lots" instead.
|
||||||
private static final int STRING_GAP = 15;
|
private static final int MAX_QUANTITY = 65535;
|
||||||
// Size of the hidden/highlight boxes
|
// The 15 pixel gap between each drawn ground item.
|
||||||
private static final int RECTANGLE_SIZE = 8;
|
private static final int STRING_GAP = 15;
|
||||||
|
// Size of the hidden/highlight boxes
|
||||||
private static final int TIMER_OVERLAY_DIAMETER = 10;
|
private static final int RECTANGLE_SIZE = 8;
|
||||||
private static final int PUBLIC_ITEM_DURATION_MILLIS = 60000;
|
|
||||||
private static final float WARNING_THRESHOLD = 0.25f;
|
private static final int TIMER_OVERLAY_DIAMETER = 10;
|
||||||
private static final Color PUBLIC_TIMER_COLOR = Color.YELLOW;
|
private static final int PUBLIC_ITEM_DURATION_MILLIS = 60000;
|
||||||
private static final Color PRIVATE_TIMER_COLOR = Color.GREEN;
|
private static final float WARNING_THRESHOLD = 0.25f;
|
||||||
private static final Color PUBLIC_WARNING_TIMER_COLOR = Color.RED;
|
private static final Color PUBLIC_TIMER_COLOR = Color.YELLOW;
|
||||||
|
private static final Color PRIVATE_TIMER_COLOR = Color.GREEN;
|
||||||
private final Client client;
|
private static final Color PUBLIC_WARNING_TIMER_COLOR = Color.RED;
|
||||||
private final GroundItemsPlugin plugin;
|
|
||||||
private final GroundItemsConfig config;
|
private final Client client;
|
||||||
private final StringBuilder itemStringBuilder = new StringBuilder();
|
private final GroundItemsPlugin plugin;
|
||||||
private final BackgroundComponent backgroundComponent = new BackgroundComponent();
|
private final GroundItemsConfig config;
|
||||||
private final TextComponent textComponent = new TextComponent();
|
private final StringBuilder itemStringBuilder = new StringBuilder();
|
||||||
private final ProgressPieComponent progressPieComponent = new ProgressPieComponent();
|
private final BackgroundComponent backgroundComponent = new BackgroundComponent();
|
||||||
private final Map<WorldPoint, Integer> offsetMap = new HashMap<>();
|
private final TextComponent textComponent = new TextComponent();
|
||||||
|
private final ProgressPieComponent progressPieComponent = new ProgressPieComponent();
|
||||||
@Inject
|
private final Map<WorldPoint, Integer> offsetMap = new HashMap<>();
|
||||||
private GroundItemsOverlay(Client client, GroundItemsPlugin plugin, GroundItemsConfig config)
|
|
||||||
{
|
@Inject
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
private GroundItemsOverlay(Client client, GroundItemsPlugin plugin, GroundItemsConfig config)
|
||||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
{
|
||||||
this.client = client;
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
this.plugin = plugin;
|
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||||
this.config = config;
|
this.client = client;
|
||||||
}
|
this.plugin = plugin;
|
||||||
|
this.config = config;
|
||||||
@Override
|
}
|
||||||
public Dimension render(Graphics2D graphics)
|
|
||||||
{
|
@Override
|
||||||
final boolean dontShowOverlay = (config.itemHighlightMode() == MENU || plugin.isHideAll()) && !plugin.isHotKeyPressed();
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
if (dontShowOverlay && !config.highlightTiles())
|
final boolean dontShowOverlay = (config.itemHighlightMode() == MENU || plugin.isHideAll()) && !plugin.isHotKeyPressed();
|
||||||
{
|
|
||||||
return null;
|
if (dontShowOverlay && !config.highlightTiles())
|
||||||
}
|
{
|
||||||
|
return null;
|
||||||
final FontMetrics fm = graphics.getFontMetrics();
|
}
|
||||||
final Player player = client.getLocalPlayer();
|
|
||||||
|
final FontMetrics fm = graphics.getFontMetrics();
|
||||||
if (player == null || client.getViewportWidget() == null)
|
final Player player = client.getLocalPlayer();
|
||||||
{
|
|
||||||
return null;
|
if (player == null || client.getViewportWidget() == null)
|
||||||
}
|
{
|
||||||
|
return null;
|
||||||
offsetMap.clear();
|
}
|
||||||
final LocalPoint localLocation = player.getLocalLocation();
|
|
||||||
final Point mousePos = client.getMouseCanvasPosition();
|
offsetMap.clear();
|
||||||
Collection<GroundItem> groundItemList = GroundItemsPlugin.getCollectedGroundItems().values();
|
final LocalPoint localLocation = player.getLocalLocation();
|
||||||
GroundItem topGroundItem = null;
|
final Point mousePos = client.getMouseCanvasPosition();
|
||||||
|
Collection<GroundItem> groundItemList = GroundItemsPlugin.getCollectedGroundItems().values();
|
||||||
if (plugin.isHotKeyPressed())
|
GroundItem topGroundItem = null;
|
||||||
{
|
|
||||||
// Make copy of ground items because we are going to modify them here, and the array list supports our
|
if (plugin.isHotKeyPressed())
|
||||||
// desired behaviour here
|
{
|
||||||
groundItemList = new ArrayList<>(groundItemList);
|
// Make copy of ground items because we are going to modify them here, and the array list supports our
|
||||||
final java.awt.Point awtMousePos = new java.awt.Point(mousePos.getX(), mousePos.getY());
|
// desired behaviour here
|
||||||
GroundItem groundItem = null;
|
groundItemList = new ArrayList<>(groundItemList);
|
||||||
|
final java.awt.Point awtMousePos = new java.awt.Point(mousePos.getX(), mousePos.getY());
|
||||||
for (GroundItem item : groundItemList)
|
GroundItem groundItem = null;
|
||||||
{
|
|
||||||
item.setOffset(offsetMap.compute(item.getLocation(), (k, v) -> v != null ? v + 1 : 0));
|
for (GroundItem item : groundItemList)
|
||||||
|
{
|
||||||
if (groundItem != null)
|
item.setOffset(offsetMap.compute(item.getLocation(), (k, v) -> v != null ? v + 1 : 0));
|
||||||
{
|
|
||||||
continue;
|
if (groundItem != null)
|
||||||
}
|
{
|
||||||
|
continue;
|
||||||
if (plugin.getTextBoxBounds() != null
|
}
|
||||||
&& item.equals(plugin.getTextBoxBounds().getValue())
|
|
||||||
&& plugin.getTextBoxBounds().getKey().contains(awtMousePos))
|
if (plugin.getTextBoxBounds() != null
|
||||||
{
|
&& item.equals(plugin.getTextBoxBounds().getValue())
|
||||||
groundItem = item;
|
&& plugin.getTextBoxBounds().getKey().contains(awtMousePos))
|
||||||
continue;
|
{
|
||||||
}
|
groundItem = item;
|
||||||
|
continue;
|
||||||
if (plugin.getHiddenBoxBounds() != null
|
}
|
||||||
&& item.equals(plugin.getHiddenBoxBounds().getValue())
|
|
||||||
&& plugin.getHiddenBoxBounds().getKey().contains(awtMousePos))
|
if (plugin.getHiddenBoxBounds() != null
|
||||||
{
|
&& item.equals(plugin.getHiddenBoxBounds().getValue())
|
||||||
groundItem = item;
|
&& plugin.getHiddenBoxBounds().getKey().contains(awtMousePos))
|
||||||
continue;
|
{
|
||||||
}
|
groundItem = item;
|
||||||
|
continue;
|
||||||
if (plugin.getHighlightBoxBounds() != null
|
}
|
||||||
&& item.equals(plugin.getHighlightBoxBounds().getValue())
|
|
||||||
&& plugin.getHighlightBoxBounds().getKey().contains(awtMousePos))
|
if (plugin.getHighlightBoxBounds() != null
|
||||||
{
|
&& item.equals(plugin.getHighlightBoxBounds().getValue())
|
||||||
groundItem = item;
|
&& plugin.getHighlightBoxBounds().getKey().contains(awtMousePos))
|
||||||
}
|
{
|
||||||
}
|
groundItem = item;
|
||||||
|
}
|
||||||
if (groundItem != null)
|
}
|
||||||
{
|
|
||||||
groundItemList.remove(groundItem);
|
if (groundItem != null)
|
||||||
groundItemList.add(groundItem);
|
{
|
||||||
topGroundItem = groundItem;
|
groundItemList.remove(groundItem);
|
||||||
}
|
groundItemList.add(groundItem);
|
||||||
}
|
topGroundItem = groundItem;
|
||||||
|
}
|
||||||
plugin.setTextBoxBounds(null);
|
}
|
||||||
plugin.setHiddenBoxBounds(null);
|
|
||||||
plugin.setHighlightBoxBounds(null);
|
plugin.setTextBoxBounds(null);
|
||||||
|
plugin.setHiddenBoxBounds(null);
|
||||||
final boolean onlyShowLoot = config.onlyShowLoot();
|
plugin.setHighlightBoxBounds(null);
|
||||||
|
|
||||||
for (GroundItem item : groundItemList)
|
final boolean onlyShowLoot = config.onlyShowLoot();
|
||||||
{
|
|
||||||
final LocalPoint groundPoint = LocalPoint.fromWorld(client, item.getLocation());
|
List<GroundItem> groundItemListAsList = new ArrayList<>(groundItemList); // make a copy so we can non-destructively modify the list
|
||||||
|
|
||||||
if (groundPoint == null || localLocation.distanceTo(groundPoint) > MAX_DISTANCE
|
Comparator<GroundItem> compareByHaPrice = Comparator.comparingInt(GroundItem::getHaPrice);
|
||||||
|| (onlyShowLoot && !item.isMine()))
|
Comparator<GroundItem> compareByGePrice = Comparator.comparingInt(GroundItem::getGePrice);
|
||||||
{
|
groundItemListAsList.sort(config.sortByGEPrice() ? compareByGePrice : compareByHaPrice);
|
||||||
continue;
|
|
||||||
}
|
for (GroundItem item : groundItemListAsList)
|
||||||
|
{
|
||||||
final Color highlighted = plugin.getHighlighted(item.getName(), item.getGePrice(), item.getHaPrice());
|
final LocalPoint groundPoint = LocalPoint.fromWorld(client, item.getLocation());
|
||||||
final Color hidden = plugin.getHidden(item.getName(), item.getGePrice(), item.getHaPrice(), item.isTradeable());
|
|
||||||
|
if (groundPoint == null || localLocation.distanceTo(groundPoint) > MAX_DISTANCE
|
||||||
if (highlighted == null && !plugin.isHotKeyPressed())
|
|| (onlyShowLoot && !item.isMine()))
|
||||||
{
|
{
|
||||||
// Do not display hidden items
|
continue;
|
||||||
if (hidden != null)
|
}
|
||||||
{
|
|
||||||
continue;
|
final Color highlighted = plugin.getHighlighted(item.getName(), item.getGePrice(), item.getHaPrice());
|
||||||
}
|
final Color hidden = plugin.getHidden(item.getName(), item.getGePrice(), item.getHaPrice(), item.isTradeable());
|
||||||
|
|
||||||
// Do not display non-highlighted items
|
if (highlighted == null && !plugin.isHotKeyPressed())
|
||||||
if (config.showHighlightedOnly())
|
{
|
||||||
{
|
// Do not display hidden items
|
||||||
continue;
|
if (hidden != null)
|
||||||
}
|
{
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
final Color color = plugin.getItemColor(highlighted, hidden);
|
|
||||||
|
// Do not display non-highlighted items
|
||||||
if (config.highlightTiles())
|
if (config.showHighlightedOnly())
|
||||||
{
|
{
|
||||||
final Polygon poly = Perspective.getCanvasTilePoly(client, groundPoint);
|
continue;
|
||||||
|
}
|
||||||
if (poly != null)
|
}
|
||||||
{
|
|
||||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
final Color color = plugin.getItemColor(highlighted, hidden);
|
||||||
}
|
|
||||||
}
|
if (config.highlightTiles())
|
||||||
|
{
|
||||||
if (dontShowOverlay)
|
final Polygon poly = Perspective.getCanvasTilePoly(client, groundPoint);
|
||||||
{
|
|
||||||
continue;
|
if (poly != null)
|
||||||
}
|
{
|
||||||
|
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||||
itemStringBuilder.append(item.getName());
|
}
|
||||||
|
}
|
||||||
if (item.getQuantity() > 1)
|
|
||||||
{
|
if (dontShowOverlay)
|
||||||
if (item.getQuantity() >= MAX_QUANTITY)
|
{
|
||||||
{
|
continue;
|
||||||
itemStringBuilder.append(" (Lots!)");
|
}
|
||||||
}
|
|
||||||
else
|
itemStringBuilder.append(item.getName());
|
||||||
{
|
|
||||||
itemStringBuilder.append(" (")
|
if (item.getQuantity() > 1)
|
||||||
.append(StackFormatter.quantityToStackSize(item.getQuantity()))
|
{
|
||||||
.append(")");
|
if (item.getQuantity() >= MAX_QUANTITY)
|
||||||
}
|
{
|
||||||
}
|
itemStringBuilder.append(" (Lots!)");
|
||||||
|
}
|
||||||
if (config.priceDisplayMode() == PriceDisplayMode.BOTH)
|
else
|
||||||
{
|
{
|
||||||
if (item.getGePrice() > 0)
|
itemStringBuilder.append(" (")
|
||||||
{
|
.append(StackFormatter.quantityToStackSize(item.getQuantity()))
|
||||||
itemStringBuilder.append(" (EX: ")
|
.append(")");
|
||||||
.append(StackFormatter.quantityToStackSize(item.getGePrice()))
|
}
|
||||||
.append(" gp)");
|
}
|
||||||
}
|
|
||||||
|
if (config.priceDisplayMode() == PriceDisplayMode.BOTH)
|
||||||
if (item.getHaPrice() > 0)
|
{
|
||||||
{
|
if (item.getGePrice() > 0)
|
||||||
itemStringBuilder.append(" (HA: ")
|
{
|
||||||
.append(StackFormatter.quantityToStackSize(item.getHaPrice()))
|
itemStringBuilder.append(" (EX: ")
|
||||||
.append(" gp)");
|
.append(StackFormatter.quantityToStackSize(item.getGePrice()))
|
||||||
}
|
.append(" gp)");
|
||||||
}
|
}
|
||||||
else if (config.priceDisplayMode() != PriceDisplayMode.OFF)
|
|
||||||
{
|
if (item.getHaPrice() > 0)
|
||||||
final int price = config.priceDisplayMode() == PriceDisplayMode.GE
|
{
|
||||||
? item.getGePrice()
|
itemStringBuilder.append(" (HA: ")
|
||||||
: item.getHaPrice();
|
.append(StackFormatter.quantityToStackSize(item.getHaPrice()))
|
||||||
|
.append(" gp)");
|
||||||
if (price > 0)
|
}
|
||||||
{
|
}
|
||||||
itemStringBuilder
|
else if (config.priceDisplayMode() != PriceDisplayMode.OFF)
|
||||||
.append(" (")
|
{
|
||||||
.append(StackFormatter.quantityToStackSize(price))
|
final int price = config.priceDisplayMode() == PriceDisplayMode.GE
|
||||||
.append(" gp)");
|
? item.getGePrice()
|
||||||
}
|
: item.getHaPrice();
|
||||||
}
|
|
||||||
|
if (price > 0)
|
||||||
final String itemString = itemStringBuilder.toString();
|
{
|
||||||
itemStringBuilder.setLength(0);
|
itemStringBuilder
|
||||||
|
.append(" (")
|
||||||
if (item.getHeight() == -1)
|
.append(StackFormatter.quantityToStackSize(price))
|
||||||
{
|
.append(" gp)");
|
||||||
final Tile[][][] sceneTiles = client.getScene().getTiles();
|
}
|
||||||
final Tile itemTile = sceneTiles[client.getPlane()][groundPoint.getSceneX()][groundPoint.getSceneY()];
|
}
|
||||||
item.setHeight(itemTile.getItemLayer().getHeight());
|
|
||||||
}
|
final String itemString = itemStringBuilder.toString();
|
||||||
|
itemStringBuilder.setLength(0);
|
||||||
final Point textPoint = Perspective.getCanvasTextLocation(client,
|
|
||||||
graphics,
|
if (item.getHeight() == -1)
|
||||||
groundPoint,
|
{
|
||||||
itemString,
|
final Tile[][][] sceneTiles = client.getScene().getTiles();
|
||||||
item.getHeight() + OFFSET_Z);
|
final Tile itemTile = sceneTiles[client.getPlane()][groundPoint.getSceneX()][groundPoint.getSceneY()];
|
||||||
|
item.setHeight(itemTile.getItemLayer().getHeight());
|
||||||
if (textPoint == null)
|
}
|
||||||
{
|
|
||||||
continue;
|
final Point textPoint = Perspective.getCanvasTextLocation(client,
|
||||||
}
|
graphics,
|
||||||
|
groundPoint,
|
||||||
final int offset = plugin.isHotKeyPressed()
|
itemString,
|
||||||
? item.getOffset()
|
item.getHeight() + OFFSET_Z);
|
||||||
: offsetMap.compute(item.getLocation(), (k, v) -> v != null ? v + 1 : 0);
|
|
||||||
|
if (textPoint == null)
|
||||||
final int textX = textPoint.getX();
|
{
|
||||||
final int textY = textPoint.getY() - (STRING_GAP * offset);
|
continue;
|
||||||
|
}
|
||||||
if (plugin.isHotKeyPressed())
|
|
||||||
{
|
final int offset = plugin.isHotKeyPressed()
|
||||||
final int stringWidth = fm.stringWidth(itemString);
|
? item.getOffset()
|
||||||
final int stringHeight = fm.getHeight();
|
: offsetMap.compute(item.getLocation(), (k, v) -> v != null ? v + 1 : 0);
|
||||||
|
|
||||||
// Item bounds
|
final int textX = textPoint.getX();
|
||||||
int x = textX - 2;
|
final int textY = textPoint.getY() - (STRING_GAP * offset);
|
||||||
int y = textY - stringHeight - 2;
|
|
||||||
int width = stringWidth + 4;
|
if (plugin.isHotKeyPressed())
|
||||||
int height = stringHeight + 4;
|
{
|
||||||
final Rectangle itemBounds = new Rectangle(x, y, width, height);
|
final int stringWidth = fm.stringWidth(itemString);
|
||||||
|
final int stringHeight = fm.getHeight();
|
||||||
// Hidden box
|
|
||||||
x += width + 2;
|
// Item bounds
|
||||||
y = textY - (RECTANGLE_SIZE + stringHeight) / 2;
|
int x = textX - 2;
|
||||||
width = height = RECTANGLE_SIZE;
|
int y = textY - stringHeight - 2;
|
||||||
final Rectangle itemHiddenBox = new Rectangle(x, y, width, height);
|
int width = stringWidth + 4;
|
||||||
|
int height = stringHeight + 4;
|
||||||
// Highlight box
|
final Rectangle itemBounds = new Rectangle(x, y, width, height);
|
||||||
x += width + 2;
|
|
||||||
final Rectangle itemHighlightBox = new Rectangle(x, y, width, height);
|
// Hidden box
|
||||||
|
x += width + 2;
|
||||||
boolean mouseInBox = itemBounds.contains(mousePos.getX(), mousePos.getY());
|
y = textY - (RECTANGLE_SIZE + stringHeight) / 2;
|
||||||
boolean mouseInHiddenBox = itemHiddenBox.contains(mousePos.getX(), mousePos.getY());
|
width = height = RECTANGLE_SIZE;
|
||||||
boolean mouseInHighlightBox = itemHighlightBox.contains(mousePos.getX(), mousePos.getY());
|
final Rectangle itemHiddenBox = new Rectangle(x, y, width, height);
|
||||||
|
|
||||||
if (mouseInBox)
|
// Highlight box
|
||||||
{
|
x += width + 2;
|
||||||
plugin.setTextBoxBounds(new SimpleEntry<>(itemBounds, item));
|
final Rectangle itemHighlightBox = new Rectangle(x, y, width, height);
|
||||||
}
|
|
||||||
else if (mouseInHiddenBox)
|
boolean mouseInBox = itemBounds.contains(mousePos.getX(), mousePos.getY());
|
||||||
{
|
boolean mouseInHiddenBox = itemHiddenBox.contains(mousePos.getX(), mousePos.getY());
|
||||||
plugin.setHiddenBoxBounds(new SimpleEntry<>(itemHiddenBox, item));
|
boolean mouseInHighlightBox = itemHighlightBox.contains(mousePos.getX(), mousePos.getY());
|
||||||
|
|
||||||
}
|
if (mouseInBox)
|
||||||
else if (mouseInHighlightBox)
|
{
|
||||||
{
|
plugin.setTextBoxBounds(new SimpleEntry<>(itemBounds, item));
|
||||||
plugin.setHighlightBoxBounds(new SimpleEntry<>(itemHighlightBox, item));
|
}
|
||||||
}
|
else if (mouseInHiddenBox)
|
||||||
|
{
|
||||||
boolean topItem = topGroundItem == item;
|
plugin.setHiddenBoxBounds(new SimpleEntry<>(itemHiddenBox, item));
|
||||||
|
|
||||||
// Draw background if hovering
|
}
|
||||||
if (topItem && (mouseInBox || mouseInHiddenBox || mouseInHighlightBox))
|
else if (mouseInHighlightBox)
|
||||||
{
|
{
|
||||||
backgroundComponent.setRectangle(itemBounds);
|
plugin.setHighlightBoxBounds(new SimpleEntry<>(itemHighlightBox, item));
|
||||||
backgroundComponent.render(graphics);
|
}
|
||||||
}
|
|
||||||
|
boolean topItem = topGroundItem == item;
|
||||||
// Draw hidden box
|
|
||||||
drawRectangle(graphics, itemHiddenBox, topItem && mouseInHiddenBox ? Color.RED : color, hidden != null, true);
|
// Draw background if hovering
|
||||||
|
if (topItem && (mouseInBox || mouseInHiddenBox || mouseInHighlightBox))
|
||||||
// Draw highlight box
|
{
|
||||||
drawRectangle(graphics, itemHighlightBox, topItem && mouseInHighlightBox ? Color.GREEN : color, highlighted != null, false);
|
backgroundComponent.setRectangle(itemBounds);
|
||||||
}
|
backgroundComponent.render(graphics);
|
||||||
|
}
|
||||||
if (config.showGroundItemDuration() == TimerDisplayMode.ALWAYS
|
|
||||||
|| (config.showGroundItemDuration() == TimerDisplayMode.HOTKEY_PRESSED && plugin.isHotKeyPressed()))
|
// Draw hidden box
|
||||||
{
|
drawRectangle(graphics, itemHiddenBox, topItem && mouseInHiddenBox ? Color.RED : color, hidden != null, true);
|
||||||
drawTimerOverlay(graphics, new java.awt.Point(textX, textY), item);
|
|
||||||
}
|
// Draw highlight box
|
||||||
|
drawRectangle(graphics, itemHighlightBox, topItem && mouseInHighlightBox ? Color.GREEN : color, highlighted != null, false);
|
||||||
if (config.toggleOutline())
|
}
|
||||||
{
|
|
||||||
graphics.setColor(Color.BLACK);
|
if (config.showGroundItemDuration() == TimerDisplayMode.ALWAYS
|
||||||
graphics.drawString(itemString, textX + 1, textY + 1);
|
|| (config.showGroundItemDuration() == TimerDisplayMode.HOTKEY_PRESSED && plugin.isHotKeyPressed()))
|
||||||
graphics.drawString(itemString, textX - 1, textY - 1);
|
{
|
||||||
graphics.drawString(itemString, textX - 1, textY + 1);
|
drawTimerOverlay(graphics, new java.awt.Point(textX, textY), item);
|
||||||
graphics.drawString(itemString, textX + 1, textY - 1);
|
}
|
||||||
}
|
|
||||||
|
if (config.toggleOutline())
|
||||||
textComponent.setText(itemString);
|
{
|
||||||
textComponent.setColor(color);
|
graphics.setColor(Color.BLACK);
|
||||||
textComponent.setPosition(new java.awt.Point(textX, textY));
|
graphics.drawString(itemString, textX + 1, textY + 1);
|
||||||
textComponent.render(graphics);
|
graphics.drawString(itemString, textX - 1, textY - 1);
|
||||||
}
|
graphics.drawString(itemString, textX - 1, textY + 1);
|
||||||
|
graphics.drawString(itemString, textX + 1, textY - 1);
|
||||||
return null;
|
}
|
||||||
}
|
|
||||||
|
textComponent.setText(itemString);
|
||||||
private void drawRectangle(Graphics2D graphics, Rectangle rect, Color color, boolean inList, boolean hiddenBox)
|
textComponent.setColor(color);
|
||||||
{
|
textComponent.setPosition(new java.awt.Point(textX, textY));
|
||||||
graphics.setColor(Color.BLACK);
|
textComponent.render(graphics);
|
||||||
graphics.drawRect(rect.x + 1, rect.y + 1, rect.width, rect.height);
|
}
|
||||||
|
|
||||||
graphics.setColor(color);
|
return null;
|
||||||
graphics.draw(rect);
|
}
|
||||||
|
|
||||||
if (inList)
|
private void drawRectangle(Graphics2D graphics, Rectangle rect, Color color, boolean inList, boolean hiddenBox)
|
||||||
{
|
{
|
||||||
graphics.fill(rect);
|
graphics.setColor(Color.BLACK);
|
||||||
}
|
graphics.drawRect(rect.x + 1, rect.y + 1, rect.width, rect.height);
|
||||||
|
|
||||||
graphics.setColor(Color.WHITE);
|
graphics.setColor(color);
|
||||||
// Minus symbol
|
graphics.draw(rect);
|
||||||
graphics.drawLine
|
|
||||||
(
|
if (inList)
|
||||||
rect.x + 2,
|
{
|
||||||
rect.y + (rect.height / 2),
|
graphics.fill(rect);
|
||||||
rect.x + rect.width - 2,
|
}
|
||||||
rect.y + (rect.height / 2)
|
|
||||||
);
|
graphics.setColor(Color.WHITE);
|
||||||
|
// Minus symbol
|
||||||
if (!hiddenBox)
|
graphics.drawLine
|
||||||
{
|
(
|
||||||
// Plus symbol
|
rect.x + 2,
|
||||||
graphics.drawLine
|
rect.y + (rect.height / 2),
|
||||||
(
|
rect.x + rect.width - 2,
|
||||||
rect.x + (rect.width / 2),
|
rect.y + (rect.height / 2)
|
||||||
rect.y + 2,
|
);
|
||||||
rect.x + (rect.width / 2),
|
|
||||||
rect.y + rect.height - 2
|
if (!hiddenBox)
|
||||||
);
|
{
|
||||||
}
|
// Plus symbol
|
||||||
|
graphics.drawLine
|
||||||
}
|
(
|
||||||
|
rect.x + (rect.width / 2),
|
||||||
private void drawTimerOverlay(Graphics2D graphics, java.awt.Point location, GroundItem item)
|
rect.y + 2,
|
||||||
{
|
rect.x + (rect.width / 2),
|
||||||
progressPieComponent.setDiameter(TIMER_OVERLAY_DIAMETER);
|
rect.y + rect.height - 2
|
||||||
|
);
|
||||||
int x = (int) location.getX() - TIMER_OVERLAY_DIAMETER;
|
}
|
||||||
int y = (int) location.getY() - TIMER_OVERLAY_DIAMETER / 2;
|
|
||||||
|
}
|
||||||
progressPieComponent.setPosition(new Point(x, y));
|
|
||||||
|
private void drawTimerOverlay(Graphics2D graphics, java.awt.Point location, GroundItem item)
|
||||||
double millisOnGround = Duration.between(item.getDroppedInstant(), Instant.now()).toMillis();
|
{
|
||||||
boolean isPubliclyVisible = !item.isAlwaysPrivate() && millisOnGround > item.getDurationMillis();
|
progressPieComponent.setDiameter(TIMER_OVERLAY_DIAMETER);
|
||||||
double timeLeftRelative;
|
|
||||||
Color fillColor;
|
int x = (int) location.getX() - TIMER_OVERLAY_DIAMETER;
|
||||||
|
int y = (int) location.getY() - TIMER_OVERLAY_DIAMETER / 2;
|
||||||
if (isPubliclyVisible || !item.isOwnedByPlayer())
|
|
||||||
{
|
progressPieComponent.setPosition(new Point(x, y));
|
||||||
if (item.isOwnedByPlayer())
|
|
||||||
{
|
double millisOnGround = Duration.between(item.getDroppedInstant(), Instant.now()).toMillis();
|
||||||
timeLeftRelative = getTimeLeftRelative(millisOnGround - PUBLIC_ITEM_DURATION_MILLIS, PUBLIC_ITEM_DURATION_MILLIS);
|
boolean isPubliclyVisible = !item.isAlwaysPrivate() && millisOnGround > item.getDurationMillis();
|
||||||
|
double timeLeftRelative;
|
||||||
}
|
Color fillColor;
|
||||||
else
|
|
||||||
{
|
if (isPubliclyVisible || !item.isOwnedByPlayer())
|
||||||
timeLeftRelative = getTimeLeftRelative(millisOnGround, PUBLIC_ITEM_DURATION_MILLIS);
|
{
|
||||||
}
|
if (item.isOwnedByPlayer())
|
||||||
|
{
|
||||||
if (timeLeftRelative < WARNING_THRESHOLD)
|
timeLeftRelative = getTimeLeftRelative(millisOnGround - PUBLIC_ITEM_DURATION_MILLIS, PUBLIC_ITEM_DURATION_MILLIS);
|
||||||
{
|
|
||||||
fillColor = PUBLIC_WARNING_TIMER_COLOR;
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
timeLeftRelative = getTimeLeftRelative(millisOnGround, PUBLIC_ITEM_DURATION_MILLIS);
|
||||||
fillColor = PUBLIC_TIMER_COLOR;
|
}
|
||||||
}
|
|
||||||
}
|
if (timeLeftRelative < WARNING_THRESHOLD)
|
||||||
else
|
{
|
||||||
{
|
fillColor = PUBLIC_WARNING_TIMER_COLOR;
|
||||||
timeLeftRelative = getTimeLeftRelative(millisOnGround, item.getDurationMillis());
|
}
|
||||||
fillColor = PRIVATE_TIMER_COLOR;
|
else
|
||||||
|
{
|
||||||
}
|
fillColor = PUBLIC_TIMER_COLOR;
|
||||||
|
}
|
||||||
// don't draw timer for any permanently spawned items or broken edge cases
|
}
|
||||||
if (timeLeftRelative > 1 || timeLeftRelative < 0)
|
else
|
||||||
{
|
{
|
||||||
return;
|
timeLeftRelative = getTimeLeftRelative(millisOnGround, item.getDurationMillis());
|
||||||
}
|
fillColor = PRIVATE_TIMER_COLOR;
|
||||||
|
|
||||||
progressPieComponent.setFill(fillColor);
|
}
|
||||||
progressPieComponent.setBorderColor(fillColor);
|
|
||||||
progressPieComponent.setProgress(timeLeftRelative);
|
// don't draw timer for any permanently spawned items or broken edge cases
|
||||||
progressPieComponent.render(graphics);
|
if (timeLeftRelative > 1 || timeLeftRelative < 0)
|
||||||
}
|
{
|
||||||
|
return;
|
||||||
private double getTimeLeftRelative(double millisOnGround, int duration)
|
}
|
||||||
{
|
|
||||||
return (duration - millisOnGround) / duration;
|
progressPieComponent.setFill(fillColor);
|
||||||
}
|
progressPieComponent.setBorderColor(fillColor);
|
||||||
}
|
progressPieComponent.setProgress(timeLeftRelative);
|
||||||
|
progressPieComponent.render(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
private double getTimeLeftRelative(double millisOnGround, int duration)
|
||||||
|
{
|
||||||
|
return (duration - millisOnGround) / duration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user