From f57475069df2793e23ab4aff7522e1711ae5ff4b Mon Sep 17 00:00:00 2001 From: Abel Briggs Date: Tue, 20 Jun 2017 18:29:29 -0500 Subject: [PATCH 1/4] Disable hiding ground items overlay while in bank interface --- .../client/plugins/grounditems/GroundItemsOverlay.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java index 62ed973307..8890c41e1c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java @@ -94,11 +94,11 @@ public class GroundItemsOverlay extends Overlay return null; } - Widget bank = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); - if (bank != null && !bank.isHidden()) - { - return null; - } + //Widget bank = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER); + //if (bank != null && !bank.isHidden()) + //{ + // return null; + //} Region region = client.getRegion(); Tile[][][] tiles = region.getTiles(); From 991980eef8656fd5ead19eee66b5e1892db278be Mon Sep 17 00:00:00 2001 From: Abel Briggs Date: Tue, 20 Jun 2017 20:16:55 -0500 Subject: [PATCH 2/4] Added additional exports to ItemComposition --- .../net/runelite/rs/api/ItemComposition.java | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/runescape-api/src/main/java/net/runelite/rs/api/ItemComposition.java b/runescape-api/src/main/java/net/runelite/rs/api/ItemComposition.java index c9b3958ba1..9f207bcd99 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/ItemComposition.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/ItemComposition.java @@ -27,11 +27,61 @@ package net.runelite.rs.api; import net.runelite.mapping.Import; +/** + * ItemComposition is an interface that represents the various properties + * of an item. Imports several values from rs-client/ItemComposition, + * and allows direct access to them by calling these methods. + */ public interface ItemComposition { + /** + * Returns the item's name as a string. + * @return the name of the item + */ @Import("name") String getName(); + /** + * Returns the item's ID. A list of item IDs can be + * found in net.runelite.api.ItemID. + * @return the item's ID as an integer + */ + @Import("id") + int getId(); + + /** + * Returns a result that depends on whether the item + * is in noted form or not. + * @return 799 if noted, -1 if unnoted + */ + @Import("notedTemplate") + int getNote(); + + /** + * Returns the item ID of the noted/unnoted counterpart. + * For example, if you call this on an unnoted monkfish(ID 7946), + * this method will return the ID of a noted monkfish(ID 7947), + * and vice versa. + * @return the ID that is linked to this item in noted/unnoted form. + */ + @Import("note") + int getLinkedNoteId(); + + /** + * Returns the store price of the item. Even if the item cannot + * be found in a store, all items have a store price from which the + * High and Low Alchemy values are calculated. Multiply the price by + * 0.6 to get the High Alchemy value, or 0.4 to get the Low Alchemy + * value. + * @return the general store value of the item + */ + @Import("price") + int getPrice(); + + /** + * Returns whether or not the item is members-only. + * @return true if members-only, false otherwise. + */ @Import("isMembers") boolean isMembers(); From 8cdbca947d988b033df693bb5b2eaf7af9d23481 Mon Sep 17 00:00:00 2001 From: Abel Briggs Date: Tue, 20 Jun 2017 20:19:48 -0500 Subject: [PATCH 3/4] Fixed noted items not working with GE price lookup --- .../client/plugins/grounditems/GroundItemsOverlay.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java index 8890c41e1c..e648c4a2c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java @@ -183,6 +183,12 @@ public class GroundItemsOverlay extends Overlay } } + // sets item ID to unnoted version, if noted + if (item.getNote() != -1) + { + itemId = item.getLinkedNoteId(); + } + Color textColor = Color.WHITE; // Color to use when drawing the ground item ItemPrice itemPrice = itemManager.get(itemId); if (itemPrice != null) From 90e65472c6c03e65d14ad043ab343f4d96f8d0fb Mon Sep 17 00:00:00 2001 From: Abel Briggs Date: Tue, 20 Jun 2017 20:37:03 -0500 Subject: [PATCH 4/4] Add high alchemy prices to grounditems plugin Add configuration option to show high alch prices and ge prices --- .../grounditems/GroundItemsConfig.java | 21 ++++++++++++++++++- .../grounditems/GroundItemsOverlay.java | 11 +++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java index 4ba325e4dd..f01f5feb85 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsConfig.java @@ -40,9 +40,28 @@ public interface GroundItemsConfig name = "Enabled", description = "Configures whether or not item names/quantities are displayed" ) - default boolean enabled() { return true; } + + @ConfigItem( + keyName = "showGEPrice", + name = "Show Grand Exchange Prices", + description = "Configures whether or not to draw GE prices alongside ground items" + ) + default boolean showGEPrice() + { + return true; + } + + @ConfigItem( + keyName = "showHAValue", + name = "Show High Alchemy Values", + description = "Configure whether or not to draw High Alchemy values alongside ground items" + ) + default boolean showHAValue() + { + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java index e648c4a2c2..f06d2a1fd8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsOverlay.java @@ -73,6 +73,8 @@ public class GroundItemsOverlay extends Overlay // Threshold for highlighting items as pink. private static final int INSANE_VALUE = 10_000_000; private static final Color FADED_PINK = new Color(255, 102, 178); + // Used when getting High Alchemy value - multiplied by general store price. + private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; private final Client client = RuneLite.getClient(); private final GroundItemsConfig config; @@ -191,7 +193,7 @@ public class GroundItemsOverlay extends Overlay Color textColor = Color.WHITE; // Color to use when drawing the ground item ItemPrice itemPrice = itemManager.get(itemId); - if (itemPrice != null) + if (itemPrice != null && config.showGEPrice()) { int cost = itemPrice.getPrice() * quantity; // set the color according to rarity, if possible @@ -217,6 +219,13 @@ public class GroundItemsOverlay extends Overlay .append(" gp)"); } + if (config.showHAValue()) + { + itemStringBuilder.append(" (HA: ") + .append(Math.round(item.getPrice() * HIGH_ALCHEMY_CONSTANT)) + .append(" gp)"); + } + String itemString = itemStringBuilder.toString(); itemStringBuilder.setLength(0);