From d7cb489eafcded7d8071adcd083608013db81de2 Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 31 Aug 2020 12:11:16 -0400 Subject: [PATCH] grounditems: fix showing Lots! for stack size in notifications The value cannot be more than MAX_VALUE so the previous condition was never met. Additionally use MAX_QUANTITY constant instead of abusing char max value which is completely unrelated. --- .../client/plugins/grounditems/GroundItemsOverlay.java | 4 +--- .../client/plugins/grounditems/GroundItemsPlugin.java | 5 ++++- 2 files changed, 5 insertions(+), 4 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 932f755f21..d38eb6a4bd 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 @@ -46,6 +46,7 @@ import net.runelite.api.Player; import net.runelite.api.Point; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; +import static net.runelite.client.plugins.grounditems.GroundItemsPlugin.MAX_QUANTITY; import static net.runelite.client.plugins.grounditems.config.ItemHighlightMode.MENU; import net.runelite.client.plugins.grounditems.config.PriceDisplayMode; import net.runelite.client.ui.overlay.Overlay; @@ -64,9 +65,6 @@ 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 OFFSET_Z = 20; - // The game won't send anything higher than this value to the plugin - - // so we replace any item quantity higher with "Lots" instead. - private static final int MAX_QUANTITY = 65535; // The 15 pixel gap between each drawn ground item. private static final int STRING_GAP = 15; // Size of the hidden/highlight boxes diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java index a141aa4123..962cbe432f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java @@ -105,6 +105,9 @@ public class GroundItemsPlugin extends Plugin private final Color color; } + // The game won't send anything higher than this value to the plugin - + // so we replace any item quantity higher with "Lots" instead. + static final int MAX_QUANTITY = 65535; // ItemID for coins private static final int COINS = ItemID.COINS_995; // Ground item menu options @@ -646,7 +649,7 @@ public class GroundItemsPlugin extends Plugin if (item.getQuantity() > 1) { - if (item.getQuantity() > (int) Character.MAX_VALUE) + if (item.getQuantity() >= MAX_QUANTITY) { notificationStringBuilder.append(" (Lots!)"); }