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.
This commit is contained in:
Adam
2020-08-31 12:11:16 -04:00
parent d8ddbe2cfa
commit d7cb489eaf
2 changed files with 5 additions and 4 deletions

View File

@@ -46,6 +46,7 @@ import net.runelite.api.Player;
import net.runelite.api.Point; import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; 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 static net.runelite.client.plugins.grounditems.config.ItemHighlightMode.MENU;
import net.runelite.client.plugins.grounditems.config.PriceDisplayMode; import net.runelite.client.plugins.grounditems.config.PriceDisplayMode;
import net.runelite.client.ui.overlay.Overlay; 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 // We must offset the text on the z-axis such that
// it doesn't obscure the ground items below it. // it doesn't obscure the ground items below it.
private static final int OFFSET_Z = 20; 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. // The 15 pixel gap between each drawn ground item.
private static final int STRING_GAP = 15; private static final int STRING_GAP = 15;
// Size of the hidden/highlight boxes // Size of the hidden/highlight boxes

View File

@@ -105,6 +105,9 @@ public class GroundItemsPlugin extends Plugin
private final Color color; 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 // ItemID for coins
private static final int COINS = ItemID.COINS_995; private static final int COINS = ItemID.COINS_995;
// Ground item menu options // Ground item menu options
@@ -646,7 +649,7 @@ public class GroundItemsPlugin extends Plugin
if (item.getQuantity() > 1) if (item.getQuantity() > 1)
{ {
if (item.getQuantity() > (int) Character.MAX_VALUE) if (item.getQuantity() >= MAX_QUANTITY)
{ {
notificationStringBuilder.append(" (Lots!)"); notificationStringBuilder.append(" (Lots!)");
} }