From 7edcdc05aece2e3eb4058e29f4484ff4a745d31e Mon Sep 17 00:00:00 2001 From: MESLewis Date: Wed, 9 Oct 2019 19:39:04 -0600 Subject: [PATCH 01/26] Add teleport icon for Stony Basalt under 73 Agility --- .../runelite/client/plugins/worldmap/TeleportLocationData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportLocationData.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportLocationData.java index 8e03a1d651..45814989ea 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportLocationData.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TeleportLocationData.java @@ -129,7 +129,8 @@ enum TeleportLocationData NEITIZNOT_LYRE(TeleportType.OTHER, "Enchanted Lyre", "Neitiznot", new WorldPoint(2336, 3801, 0), "enchanted_lyre_teleport_icon.png"), JATIZSO_LYRE(TeleportType.OTHER, "Enchanted Lyre", "Jatizso", new WorldPoint(2409, 3809, 0), "enchanted_lyre_teleport_icon.png"), WEISS_ICY_BASALT(TeleportType.OTHER, "Icy Basalt", "Weiss", new WorldPoint(2846, 3940, 0), "icy_basalt_teleport_icon.png"), - TROLL_STRONGHOLD_STONY_BASALT(TeleportType.OTHER, "Stony Basalt", "Troll Stronghold", new WorldPoint(2838, 3693, 0), "stony_basalt_teleport_icon.png"), + TROLL_STRONGHOLD_STONY_BASALT(TeleportType.OTHER, "Stony Basalt", "Troll Stronghold (with 73 Agility)", new WorldPoint(2838, 3693, 0), "stony_basalt_teleport_icon.png"), + TROLL_STRONGHOLD_STONY_BASALT_OUTSIDE(TeleportType.OTHER, "Stony Basalt", "Troll Stronghold", new WorldPoint(2844, 3693, 0), "stony_basalt_teleport_icon.png"), KHAREDSTS_MEMOIRS_HOSIDIUS(TeleportType.OTHER, "Kharedst's Memoirs", "Lunch by the Lancalliums (Hosidius)", new WorldPoint(1713, 3612, 0), "kharedsts_memoirs_teleport_icon.png"), KHAREDSTS_MEMOIRS_PISCARILIUS(TeleportType.OTHER, "Kharedst's Memoirs", "The Fisher's Flute (Piscarilius)", new WorldPoint(1802, 3748, 0), "kharedsts_memoirs_teleport_icon.png"), KHAREDSTS_MEMOIRS_SHAYZIEN(TeleportType.OTHER, "Kharedst's Memoirs", "History and Hearsay (Shayzien)", new WorldPoint(1476, 3580, 0), "kharedsts_memoirs_teleport_icon.png"), From 32f624e1d5dc067595cbe6685930f9ef0f3db6a8 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 10 Oct 2019 03:49:44 -0600 Subject: [PATCH 02/26] StackFormatter: remove quantityToRSStackSize This is nearly unused, and serves no great purpose as quantityToStackSize can display the same information in a more readable format --- .../plugins/itemstats/ItemStatPlugin.java | 2 +- .../kingdomofmiscellania/KingdomCounter.java | 2 +- .../runelite/client/util/StackFormatter.java | 47 +++---------------- .../client/util/StackFormatterTest.java | 16 ------- 4 files changed, 8 insertions(+), 59 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java index 4f244d844b..b0c218bad7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java @@ -340,7 +340,7 @@ public class ItemStatPlugin extends Plugin createSeparator(invContainer, invContainer.getHeight() - 40); - final String coinText = "You have " + StackFormatter.quantityToRSStackSize(getCurrentGP()) + final String coinText = "You have " + StackFormatter.quantityToStackSize(getCurrentGP()) + (getCurrentGP() == 1 ? " coin." : " coins."); final Widget coinWidget = createText(invContainer, coinText, FontID.PLAIN_12, ORANGE_TEXT, diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java index 8a2871125f..e2e6539d9f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java @@ -48,6 +48,6 @@ public class KingdomCounter extends Counter public String getTooltip() { return "Favor: " + plugin.getFavor() + "/127" + "
" - + "Coffer: " + StackFormatter.quantityToRSStackSize(plugin.getCoffer()); + + "Coffer: " + StackFormatter.quantityToStackSize(plugin.getCoffer()); } } diff --git a/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java b/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java index c9282f7f46..a334b54148 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java +++ b/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java @@ -33,8 +33,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * A set of utility functions to use when - * formatting numbers for to stack sizes. + * A set of utility functions to use when formatting quantities */ public class StackFormatter { @@ -70,12 +69,12 @@ public class StackFormatter ); /** - * Convert a quantity to a nicely formatted stack size. - * See the StackFormatterTest to see expected output. + * Convert a quantity to a short, comma separated, SI-prefix style string + * + * example: {@code 9,450}, {@code 2.14B}, {@code 100K} * * @param quantity The quantity to convert. - * @return A condensed version, with commas, K, M or B - * as needed to 3 significant figures. + * @return a 6 or less character string, possibly with a decimal point, commas or K/M/B suffix */ public static String quantityToStackSize(long quantity) { @@ -115,41 +114,7 @@ public class StackFormatter } /** - * Convert a quantity to stack size as it would - * appear in RuneScape. - * - * @param quantity The quantity to convert. - * @return The stack size as it would appear in RS, - * with K after 100,000 and M after 10,000,000 - */ - public static String quantityToRSStackSize(int quantity) - { - if (quantity == Integer.MIN_VALUE) - { - // Integer.MIN_VALUE = Integer.MIN_VALUE * -1 so we need to correct for it. - return "-" + quantityToRSStackSize(Integer.MAX_VALUE); - } - else if (quantity < 0) - { - return "-" + quantityToRSStackSize(-quantity); - } - else if (quantity < 100_000) - { - return Integer.toString(quantity); - } - else if (quantity < 10_000_000) - { - return quantity / 1_000 + "K"; - } - else - { - return quantity / 1_000_000 + "M"; - } - } - - /** - * Convert a quantity to stack size as it would - * appear in RuneScape. (with decimals) + * Convert a quantity to a short SI-prefix style string with decimals *

* This differs from quantityToRSStack in that it displays * decimals. Ex: 27100 is 27.1k (not 27k) diff --git a/runelite-client/src/test/java/net/runelite/client/util/StackFormatterTest.java b/runelite-client/src/test/java/net/runelite/client/util/StackFormatterTest.java index 1e297a8513..23c3619a54 100644 --- a/runelite-client/src/test/java/net/runelite/client/util/StackFormatterTest.java +++ b/runelite-client/src/test/java/net/runelite/client/util/StackFormatterTest.java @@ -59,22 +59,6 @@ public class StackFormatterTest assertEquals("2.1B", StackFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE)); } - @Test - public void quantityToRSStackSize() - { - assertEquals("0", StackFormatter.quantityToRSStackSize(0)); - assertEquals("99999", StackFormatter.quantityToRSStackSize(99_999)); - assertEquals("100K", StackFormatter.quantityToRSStackSize(100_000)); - assertEquals("10M", StackFormatter.quantityToRSStackSize(10_000_000)); - assertEquals("2147M", StackFormatter.quantityToRSStackSize(Integer.MAX_VALUE)); - - assertEquals("0", StackFormatter.quantityToRSStackSize(-0)); - assertEquals("-400", StackFormatter.quantityToRSStackSize(-400)); - assertEquals("-400K", StackFormatter.quantityToRSStackSize(-400_000)); - assertEquals("-40M", StackFormatter.quantityToRSStackSize(-40_000_000)); - assertEquals("-2147M", StackFormatter.quantityToRSStackSize(Integer.MIN_VALUE)); - } - @Test public void quantityToStackSize() { From b30243c784876573b9072e46ad7041edf61e66fc Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 10 Oct 2019 04:23:35 -0600 Subject: [PATCH 03/26] StackFormatter: Fix documentation --- .../runelite/client/util/StackFormatter.java | 57 ++++++------------- 1 file changed, 18 insertions(+), 39 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java b/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java index a334b54148..8a71754620 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java +++ b/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java @@ -47,22 +47,13 @@ public class StackFormatter */ private static final Pattern SUFFIX_PATTERN = Pattern.compile("^-?[0-9,.]+([a-zA-Z]?)$"); - /** - * A number formatter - */ private static final NumberFormat NUMBER_FORMATTER = NumberFormat.getInstance(Locale.ENGLISH); - /** - * A decimal number formatter - */ private static final NumberFormat DECIMAL_FORMATTER = new DecimalFormat( "#,###.#", DecimalFormatSymbols.getInstance(Locale.ENGLISH) ); - /** - * A more precise decimal number formatter, outputting thousandths - */ private static final NumberFormat PRECISE_DECIMAL_FORMATTER = new DecimalFormat( "#,###.###", DecimalFormatSymbols.getInstance(Locale.ENGLISH) @@ -114,15 +105,12 @@ public class StackFormatter } /** - * Convert a quantity to a short SI-prefix style string with decimals - *

- * This differs from quantityToRSStack in that it displays - * decimals. Ex: 27100 is 27.1k (not 27k) - *

- * - * @param quantity The quantity to convert. - * @return The stack size as it would appear in RS, with decimals, + * Convert a quantity to a short SI-prefix style string, possibly with a decimal, * with K after 100,000 and M after 10,000,000 + * + * example: {@code 9,450}, {@code 2.1B}, {@code 100K} + * + * @see #quantityToRSDecimalStack(int, boolean) */ public static String quantityToRSDecimalStack(int quantity) { @@ -130,17 +118,14 @@ public class StackFormatter } /** - * Convert a quantity to stack size as it would - * appear in RuneScape. (with decimals) - *

- * This differs from quantityToRSStack in that it displays - * decimals. Ex: 27100 is 27.1k (not 27k) - *

- * - * @param quantity The quantity to convert. - * @param precise If true, the returned string will have thousandths precision if quantity is larger than 1 million. - * @return The stack size as it would appear in RS, with decimals, + * Convert a quantity to a short SI-prefix style string, possibly with decimals, * with K after 100,000 and M after 10,000,000 + * + * example without {@code precise}: {@code 9,450}, {@code 2.1B}, {@code 8.4M} + * example with {@code precise}: {@code 9,450}, {@code 2.147B}, {@code 8.32M} + * + * @param precise If true, allow thousandths precision if {@code quantity} is larger than 1 million. + * Otherwise have at most a single decimal */ public static String quantityToRSDecimalStack(int quantity, boolean precise) { @@ -175,27 +160,21 @@ public class StackFormatter } /** - * Specialization of format. + * Formats a number to be comma delimited. No suffixes are given * - * @param number the long number to format - * @return the formatted String - * @throws ArithmeticException if rounding is needed with rounding - * mode being set to RoundingMode.UNNECESSARY - * @see java.text.Format#format + * example: {@code 10,123,351}, {@code 5} */ public static String formatNumber(final long number) { return NUMBER_FORMATTER.format(number); } + /** - * Specialization of format. + * Formats a number to be comma delimited. No suffixes are given. Has at + * most 3 decimal places * - * @param number the double number to format - * @return the formatted String - * @throws ArithmeticException if rounding is needed with rounding - * mode being set to RoundingMode.UNNECESSARY - * @see java.text.Format#format + * example: {@code 10,123,351}, {@code 5.612} */ public static String formatNumber(double number) { From ea69b8e57d2aeeebebdb2c3ccb9f3696d52657bc Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 10 Oct 2019 04:25:53 -0600 Subject: [PATCH 04/26] StackFormatter: synchronize access to NumberFormats DecimalFormat likes to copy data into itself when formatting because it is poorly designed, as such it cannot be used by multiple threads at once. --- .../java/net/runelite/client/util/StackFormatter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java b/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java index 8a71754620..75d4a9c63f 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java +++ b/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java @@ -67,7 +67,7 @@ public class StackFormatter * @param quantity The quantity to convert. * @return a 6 or less character string, possibly with a decimal point, commas or K/M/B suffix */ - public static String quantityToStackSize(long quantity) + public static synchronized String quantityToStackSize(long quantity) { if (quantity < 0) { @@ -127,7 +127,7 @@ public class StackFormatter * @param precise If true, allow thousandths precision if {@code quantity} is larger than 1 million. * Otherwise have at most a single decimal */ - public static String quantityToRSDecimalStack(int quantity, boolean precise) + public static synchronized String quantityToRSDecimalStack(int quantity, boolean precise) { String quantityStr = String.valueOf(quantity); if (quantityStr.length() <= 4) @@ -152,7 +152,7 @@ public class StackFormatter * @param string The string to convert. * @return A long representation of it. */ - public static long stackSizeToQuantity(String string) throws ParseException + public static synchronized long stackSizeToQuantity(String string) throws ParseException { int multiplier = getMultiplier(string); float parsedValue = NUMBER_FORMATTER.parse(string).floatValue(); @@ -164,7 +164,7 @@ public class StackFormatter * * example: {@code 10,123,351}, {@code 5} */ - public static String formatNumber(final long number) + public static synchronized String formatNumber(final long number) { return NUMBER_FORMATTER.format(number); } @@ -176,7 +176,7 @@ public class StackFormatter * * example: {@code 10,123,351}, {@code 5.612} */ - public static String formatNumber(double number) + public static synchronized String formatNumber(double number) { return NUMBER_FORMATTER.format(number); } From d627171bbe23763b5f6219c69271c8b769ce7df4 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 10 Oct 2019 04:29:30 -0600 Subject: [PATCH 05/26] runelite-client: Rename StackFormatter to QuantityFormatter StackFormatter.formatNumber was incredibly misleading, it makes more sense to remove Stack from the classes name than move it. --- .../client/plugins/ammo/AmmoCounter.java | 4 +- .../client/plugins/bank/BankPlugin.java | 16 +- .../client/plugins/barrows/BarrowsPlugin.java | 4 +- .../BlastFurnaceCofferOverlay.java | 4 +- .../chatcommands/ChatCommandsPlugin.java | 6 +- .../client/plugins/examine/ExaminePlugin.java | 12 +- .../grandexchange/GrandExchangeItemPanel.java | 8 +- .../grandexchange/GrandExchangeOfferSlot.java | 12 +- .../grandexchange/GrandExchangePlugin.java | 10 +- .../grounditems/GroundItemsOverlay.java | 10 +- .../grounditems/GroundItemsPlugin.java | 4 +- .../client/plugins/hiscore/HiscorePanel.java | 50 +++--- .../plugins/itemprices/ItemPricesOverlay.java | 14 +- .../ItemsKeptOnDeathPlugin.java | 4 +- .../plugins/itemstats/ItemStatPlugin.java | 4 +- .../kingdomofmiscellania/KingdomCounter.java | 4 +- .../plugins/loottracker/LootTrackerBox.java | 8 +- .../plugins/loottracker/LootTrackerPanel.java | 4 +- .../nightmarezone/NightmareZoneOverlay.java | 8 +- .../client/plugins/xptracker/XpInfoBox.java | 4 +- .../plugins/xptracker/XpInfoBoxOverlay.java | 6 +- ...kFormatter.java => QuantityFormatter.java} | 4 +- .../client/util/QuantityFormatterTest.java | 143 ++++++++++++++++++ .../client/util/StackFormatterTest.java | 143 ------------------ 24 files changed, 243 insertions(+), 243 deletions(-) rename runelite-client/src/main/java/net/runelite/client/util/{StackFormatter.java => QuantityFormatter.java} (98%) create mode 100644 runelite-client/src/test/java/net/runelite/client/util/QuantityFormatterTest.java delete mode 100644 runelite-client/src/test/java/net/runelite/client/util/StackFormatterTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoCounter.java index f7f12c497a..4f4639d5f7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/ammo/AmmoCounter.java @@ -28,7 +28,7 @@ import java.awt.image.BufferedImage; import lombok.Getter; import net.runelite.client.plugins.Plugin; import net.runelite.client.ui.overlay.infobox.Counter; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; class AmmoCounter extends Counter { @@ -46,7 +46,7 @@ class AmmoCounter extends Counter @Override public String getText() { - return StackFormatter.quantityToRSDecimalStack(getCount()); + return QuantityFormatter.quantityToRSDecimalStack(getCount()); } @Override diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java index 4435471399..dafa61f630 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankPlugin.java @@ -61,7 +61,7 @@ import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.banktags.tabs.BankSearch; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; @PluginDescriptor( name = "Bank", @@ -241,11 +241,11 @@ public class BankPlugin extends Plugin if (config.showExact()) { - strCurrentTab += StackFormatter.formatNumber(gePrice) + ")"; + strCurrentTab += QuantityFormatter.formatNumber(gePrice) + ")"; } else { - strCurrentTab += StackFormatter.quantityToStackSize(gePrice) + ")"; + strCurrentTab += QuantityFormatter.quantityToStackSize(gePrice) + ")"; } } @@ -260,11 +260,11 @@ public class BankPlugin extends Plugin if (config.showExact()) { - strCurrentTab += StackFormatter.formatNumber(haPrice) + ")"; + strCurrentTab += QuantityFormatter.formatNumber(haPrice) + ")"; } else { - strCurrentTab += StackFormatter.quantityToStackSize(haPrice) + ")"; + strCurrentTab += QuantityFormatter.quantityToStackSize(haPrice) + ")"; } } @@ -369,7 +369,7 @@ public class BankPlugin extends Plugin long compare; try { - compare = StackFormatter.stackSizeToQuantity(matcher.group("num")); + compare = QuantityFormatter.parseQuantity(matcher.group("num")); } catch (ParseException e) { @@ -398,8 +398,8 @@ public class BankPlugin extends Plugin long compare1, compare2; try { - compare1 = StackFormatter.stackSizeToQuantity(num1); - compare2 = StackFormatter.stackSizeToQuantity(num2); + compare1 = QuantityFormatter.parseQuantity(num1); + compare2 = QuantityFormatter.parseQuantity(num2); } catch (ParseException e) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java index 68b726908b..2d4db73d12 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/barrows/BarrowsPlugin.java @@ -70,7 +70,7 @@ import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.infobox.InfoBoxPriority; import net.runelite.client.ui.overlay.infobox.LoopTimer; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; @PluginDescriptor( name = "Barrows Brothers", @@ -288,7 +288,7 @@ public class BarrowsPlugin extends Plugin final ChatMessageBuilder message = new ChatMessageBuilder() .append(ChatColorType.HIGHLIGHT) .append("Your chest is worth around ") - .append(StackFormatter.formatNumber(chestPrice)) + .append(QuantityFormatter.formatNumber(chestPrice)) .append(" coins.") .append(ChatColorType.NORMAL); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java index d88c668939..b549adbeba 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java @@ -38,7 +38,7 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; class BlastFurnaceCofferOverlay extends Overlay { @@ -74,7 +74,7 @@ class BlastFurnaceCofferOverlay extends Overlay panelComponent.getChildren().add(LineComponent.builder() .left("Coffer:") - .right(StackFormatter.quantityToStackSize(client.getVar(BLAST_FURNACE_COFFER)) + " gp") + .right(QuantityFormatter.quantityToStackSize(client.getVar(BLAST_FURNACE_COFFER)) + " gp") .build()); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index ef140b3350..85b19e266c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -62,7 +62,7 @@ import net.runelite.client.game.ItemManager; import net.runelite.client.input.KeyManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import static net.runelite.client.util.Text.sanitize; import net.runelite.http.api.chat.ChatClient; import net.runelite.http.api.chat.Duels; @@ -836,7 +836,7 @@ public class ChatCommandsPlugin extends Plugin .append(ChatColorType.NORMAL) .append(": GE average ") .append(ChatColorType.HIGHLIGHT) - .append(StackFormatter.formatNumber(itemPrice)); + .append(QuantityFormatter.formatNumber(itemPrice)); ItemComposition itemComposition = itemManager.getItemComposition(itemId); if (itemComposition != null) @@ -846,7 +846,7 @@ public class ChatCommandsPlugin extends Plugin .append(ChatColorType.NORMAL) .append(" HA value ") .append(ChatColorType.HIGHLIGHT) - .append(StackFormatter.formatNumber(alchPrice)); + .append(QuantityFormatter.formatNumber(alchPrice)); } String response = builder.build(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java index 33cc9deb90..02769cb2a5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java @@ -56,7 +56,7 @@ import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.ItemManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import net.runelite.client.util.Text; import net.runelite.http.api.examine.ExamineClient; @@ -336,7 +336,7 @@ public class ExaminePlugin extends Plugin if (quantity > 1) { message - .append(StackFormatter.formatNumber(quantity)) + .append(QuantityFormatter.formatNumber(quantity)) .append(" x "); } @@ -351,7 +351,7 @@ public class ExaminePlugin extends Plugin .append(ChatColorType.NORMAL) .append(" GE average ") .append(ChatColorType.HIGHLIGHT) - .append(StackFormatter.formatNumber(gePrice * quantity)); + .append(QuantityFormatter.formatNumber(gePrice * quantity)); if (quantity > 1) { @@ -359,7 +359,7 @@ public class ExaminePlugin extends Plugin .append(ChatColorType.NORMAL) .append(" (") .append(ChatColorType.HIGHLIGHT) - .append(StackFormatter.formatNumber(gePrice)) + .append(QuantityFormatter.formatNumber(gePrice)) .append(ChatColorType.NORMAL) .append("ea)"); } @@ -371,7 +371,7 @@ public class ExaminePlugin extends Plugin .append(ChatColorType.NORMAL) .append(" HA value ") .append(ChatColorType.HIGHLIGHT) - .append(StackFormatter.formatNumber(alchPrice * quantity)); + .append(QuantityFormatter.formatNumber(alchPrice * quantity)); if (quantity > 1) { @@ -379,7 +379,7 @@ public class ExaminePlugin extends Plugin .append(ChatColorType.NORMAL) .append(" (") .append(ChatColorType.HIGHLIGHT) - .append(StackFormatter.formatNumber(alchPrice)) + .append(QuantityFormatter.formatNumber(alchPrice)) .append(ChatColorType.NORMAL) .append("ea)"); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItemPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItemPanel.java index 7f40564e01..453f340754 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItemPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeItemPanel.java @@ -42,7 +42,7 @@ import javax.swing.border.EmptyBorder; import net.runelite.client.game.AsyncBufferedImage; import net.runelite.client.ui.ColorScheme; import net.runelite.client.util.LinkBrowser; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; /** * This panel displays an individual item result in the @@ -124,7 +124,7 @@ class GrandExchangeItemPanel extends JPanel JLabel gePriceLabel = new JLabel(); if (gePrice > 0) { - gePriceLabel.setText(StackFormatter.formatNumber(gePrice) + " gp"); + gePriceLabel.setText(QuantityFormatter.formatNumber(gePrice) + " gp"); } else { @@ -139,13 +139,13 @@ class GrandExchangeItemPanel extends JPanel // Alch price JLabel haPriceLabel = new JLabel(); - haPriceLabel.setText(StackFormatter.formatNumber(haPrice.intValue()) + " alch"); + haPriceLabel.setText(QuantityFormatter.formatNumber(haPrice.intValue()) + " alch"); haPriceLabel.setForeground(ColorScheme.GRAND_EXCHANGE_ALCH); alchAndLimitPanel.add(haPriceLabel, BorderLayout.WEST); // GE Limit JLabel geLimitLabel = new JLabel(); - String limitLabelText = geItemLimit == 0 ? "" : "Limit " + StackFormatter.formatNumber(geItemLimit); + String limitLabelText = geItemLimit == 0 ? "" : "Limit " + QuantityFormatter.formatNumber(geItemLimit); geLimitLabel.setText(limitLabelText); geLimitLabel.setForeground(ColorScheme.GRAND_EXCHANGE_LIMIT); geLimitLabel.setBorder(new CompoundBorder(geLimitLabel.getBorder(), new EmptyBorder(0, 0, 0, 7))); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java index 14090170fe..f2a35d47d8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangeOfferSlot.java @@ -52,7 +52,7 @@ import net.runelite.client.ui.FontManager; import net.runelite.client.ui.components.ThinProgressBar; import net.runelite.client.util.ColorUtil; import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; public class GrandExchangeOfferSlot extends JPanel { @@ -211,17 +211,17 @@ public class GrandExchangeOfferSlot extends JPanel || newOffer.getState() == GrandExchangeOfferState.CANCELLED_BUY; String offerState = (buying ? "Bought " : "Sold ") - + StackFormatter.quantityToRSDecimalStack(newOffer.getQuantitySold()) + " / " - + StackFormatter.quantityToRSDecimalStack(newOffer.getTotalQuantity()); + + QuantityFormatter.quantityToRSDecimalStack(newOffer.getQuantitySold()) + " / " + + QuantityFormatter.quantityToRSDecimalStack(newOffer.getTotalQuantity()); offerInfo.setText(offerState); - itemPrice.setText(htmlLabel("Price each: ", StackFormatter.formatNumber(newOffer.getPrice()))); + itemPrice.setText(htmlLabel("Price each: ", QuantityFormatter.formatNumber(newOffer.getPrice()))); String action = buying ? "Spent: " : "Received: "; - offerSpent.setText(htmlLabel(action, StackFormatter.formatNumber(newOffer.getSpent()) + " / " - + StackFormatter.formatNumber(newOffer.getPrice() * newOffer.getTotalQuantity()))); + offerSpent.setText(htmlLabel(action, QuantityFormatter.formatNumber(newOffer.getSpent()) + " / " + + QuantityFormatter.formatNumber(newOffer.getPrice() * newOffer.getTotalQuantity()))); progressBar.setForeground(getProgressColor(newOffer)); progressBar.setMaximumValue(newOffer.getTotalQuantity()); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java index bccc7be58d..b7936c243e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grandexchange/GrandExchangePlugin.java @@ -77,7 +77,7 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.ClientToolbar; import net.runelite.client.ui.NavigationButton; import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import net.runelite.client.util.Text; import net.runelite.http.api.ge.GrandExchangeClient; import net.runelite.http.api.ge.GrandExchangeTrade; @@ -456,11 +456,11 @@ public class GrandExchangePlugin extends Plugin if (config.showExact()) { - titleBuilder.append(StackFormatter.formatNumber(total)); + titleBuilder.append(QuantityFormatter.formatNumber(total)); } else { - titleBuilder.append(StackFormatter.quantityToStackSize(total)); + titleBuilder.append(QuantityFormatter.quantityToStackSize(total)); } titleBuilder.append(')'); @@ -497,7 +497,7 @@ public class GrandExchangePlugin extends Plugin // If we have item buy limit, append it if (itemLimit != null) { - final String text = geText.getText() + BUY_LIMIT_GE_TEXT + StackFormatter.formatNumber(itemLimit); + final String text = geText.getText() + BUY_LIMIT_GE_TEXT + QuantityFormatter.formatNumber(itemLimit); geText.setText(text); } } @@ -521,7 +521,7 @@ public class GrandExchangePlugin extends Plugin try { final OSBGrandExchangeResult result = CLIENT.lookupItem(itemId); - final String text = geText.getText() + OSB_GE_TEXT + StackFormatter.formatNumber(result.getOverall_average()); + final String text = geText.getText() + OSB_GE_TEXT + QuantityFormatter.formatNumber(result.getOverall_average()); geText.setText(text); } catch (IOException e) 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 9d909c300b..1e626e776a 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 @@ -55,7 +55,7 @@ import net.runelite.client.ui.overlay.OverlayUtil; import net.runelite.client.ui.overlay.components.BackgroundComponent; import net.runelite.client.ui.overlay.components.ProgressPieComponent; import net.runelite.client.ui.overlay.components.TextComponent; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import org.apache.commons.lang3.ArrayUtils; public class GroundItemsOverlay extends Overlay @@ -234,7 +234,7 @@ public class GroundItemsOverlay extends Overlay else { itemStringBuilder.append(" (") - .append(StackFormatter.quantityToStackSize(item.getQuantity())) + .append(QuantityFormatter.quantityToStackSize(item.getQuantity())) .append(")"); } } @@ -244,14 +244,14 @@ public class GroundItemsOverlay extends Overlay if (item.getGePrice() > 0) { itemStringBuilder.append(" (EX: ") - .append(StackFormatter.quantityToStackSize(item.getGePrice())) + .append(QuantityFormatter.quantityToStackSize(item.getGePrice())) .append(" gp)"); } if (item.getHaPrice() > 0) { itemStringBuilder.append(" (HA: ") - .append(StackFormatter.quantityToStackSize(item.getHaPrice())) + .append(QuantityFormatter.quantityToStackSize(item.getHaPrice())) .append(" gp)"); } } @@ -265,7 +265,7 @@ public class GroundItemsOverlay extends Overlay { itemStringBuilder .append(" (") - .append(StackFormatter.quantityToStackSize(price)) + .append(QuantityFormatter.quantityToStackSize(price)) .append(" gp)"); } } 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 22899c3a69..aafd612236 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 @@ -90,7 +90,7 @@ import static net.runelite.client.plugins.grounditems.config.MenuHighlightMode.O import net.runelite.client.plugins.grounditems.config.ValueCalculationMode; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import net.runelite.client.util.Text; @PluginDescriptor( @@ -673,7 +673,7 @@ public class GroundItemsPlugin extends Plugin else { notificationStringBuilder.append(" (") - .append(StackFormatter.quantityToStackSize(item.getQuantity())) + .append(QuantityFormatter.quantityToStackSize(item.getQuantity())) .append(")"); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java index c667fca463..0ddb3372f3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/hiscore/HiscorePanel.java @@ -59,7 +59,7 @@ import net.runelite.client.ui.components.IconTextField; import net.runelite.client.ui.components.materialtabs.MaterialTab; import net.runelite.client.ui.components.materialtabs.MaterialTabGroup; import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import net.runelite.http.api.hiscore.HiscoreClient; import net.runelite.http.api.hiscore.HiscoreEndpoint; import net.runelite.http.api.hiscore.HiscoreResult; @@ -512,8 +512,8 @@ public class HiscorePanel extends PluginPanel + result.getRanged().getExperience() + result.getPrayer().getExperience(); content += "

Skill: Combat

"; - content += "

Exact Combat Level: " + StackFormatter.formatNumber(combatLevel) + "

"; - content += "

Experience: " + StackFormatter.formatNumber(combatExperience) + "

"; + content += "

Exact Combat Level: " + QuantityFormatter.formatNumber(combatLevel) + "

"; + content += "

Experience: " + QuantityFormatter.formatNumber(combatExperience) + "

"; } else { @@ -521,20 +521,20 @@ public class HiscorePanel extends PluginPanel { case CLUE_SCROLL_ALL: { - String allRank = (result.getClueScrollAll().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollAll().getRank()); - String beginnerRank = (result.getClueScrollBeginner().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollBeginner().getRank()); - String easyRank = (result.getClueScrollEasy().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollEasy().getRank()); - String mediumRank = (result.getClueScrollMedium().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollMedium().getRank()); - String hardRank = (result.getClueScrollHard().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollHard().getRank()); - String eliteRank = (result.getClueScrollElite().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollElite().getRank()); - String masterRank = (result.getClueScrollMaster().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollMaster().getRank()); - String all = (result.getClueScrollAll().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollAll().getLevel())); - String beginner = (result.getClueScrollBeginner().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollBeginner().getLevel())); - String easy = (result.getClueScrollEasy().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollEasy().getLevel())); - String medium = (result.getClueScrollMedium().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollMedium().getLevel())); - String hard = (result.getClueScrollHard().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollHard().getLevel())); - String elite = (result.getClueScrollElite().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollElite().getLevel())); - String master = (result.getClueScrollMaster().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollMaster().getLevel())); + String allRank = (result.getClueScrollAll().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollAll().getRank()); + String beginnerRank = (result.getClueScrollBeginner().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollBeginner().getRank()); + String easyRank = (result.getClueScrollEasy().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollEasy().getRank()); + String mediumRank = (result.getClueScrollMedium().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollMedium().getRank()); + String hardRank = (result.getClueScrollHard().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollHard().getRank()); + String eliteRank = (result.getClueScrollElite().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollElite().getRank()); + String masterRank = (result.getClueScrollMaster().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollMaster().getRank()); + String all = (result.getClueScrollAll().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollAll().getLevel())); + String beginner = (result.getClueScrollBeginner().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollBeginner().getLevel())); + String easy = (result.getClueScrollEasy().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollEasy().getLevel())); + String medium = (result.getClueScrollMedium().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollMedium().getLevel())); + String hard = (result.getClueScrollHard().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollHard().getLevel())); + String elite = (result.getClueScrollElite().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollElite().getLevel())); + String master = (result.getClueScrollMaster().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollMaster().getLevel())); content += "

All: " + all + " Rank: " + allRank + "

"; content += "

Beginner: " + beginner + " Rank: " + beginnerRank + "

"; content += "

Easy: " + easy + " Rank: " + easyRank + "

"; @@ -546,27 +546,27 @@ public class HiscorePanel extends PluginPanel } case BOUNTY_HUNTER_ROGUE: { - String rank = (result.getBountyHunterRogue().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getBountyHunterRogue().getRank()); + String rank = (result.getBountyHunterRogue().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getBountyHunterRogue().getRank()); content += "

Rank: " + rank + "

"; break; } case BOUNTY_HUNTER_HUNTER: { - String rank = (result.getBountyHunterHunter().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getBountyHunterHunter().getRank()); + String rank = (result.getBountyHunterHunter().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getBountyHunterHunter().getRank()); content += "

Rank: " + rank + "

"; break; } case LAST_MAN_STANDING: { - String rank = (result.getLastManStanding().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getLastManStanding().getRank()); + String rank = (result.getLastManStanding().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getLastManStanding().getRank()); content += "

Rank: " + rank + "

"; break; } case OVERALL: { Skill requestedSkill = result.getSkill(skill); - String rank = (requestedSkill.getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(requestedSkill.getRank()); - String exp = (requestedSkill.getExperience() == -1L) ? "Unranked" : StackFormatter.formatNumber(requestedSkill.getExperience()); + String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank()); + String exp = (requestedSkill.getExperience() == -1L) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getExperience()); content += "

Skill: " + skill.getName() + "

"; content += "

Rank: " + rank + "

"; content += "

Experience: " + exp + "

"; @@ -577,8 +577,8 @@ public class HiscorePanel extends PluginPanel Skill requestedSkill = result.getSkill(skill); final long experience = requestedSkill.getExperience(); - String rank = (requestedSkill.getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(requestedSkill.getRank()); - String exp = (experience == -1L) ? "Unranked" : StackFormatter.formatNumber(experience); + String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank()); + String exp = (experience == -1L) ? "Unranked" : QuantityFormatter.formatNumber(experience); String remainingXp; if (experience == -1L) { @@ -587,7 +587,7 @@ public class HiscorePanel extends PluginPanel else { int currentLevel = Experience.getLevelForXp((int) experience); - remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? StackFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0"; + remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? QuantityFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0"; } content += "

Skill: " + skill.getName() + "

"; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java index d98828d3b0..bcb06fe6f1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java @@ -45,7 +45,7 @@ import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.tooltip.Tooltip; import net.runelite.client.ui.overlay.tooltip.TooltipManager; import net.runelite.client.util.ColorUtil; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; class ItemPricesOverlay extends Overlay { @@ -183,11 +183,11 @@ class ItemPricesOverlay extends Overlay // Special case for coins and platinum tokens if (id == ItemID.COINS_995) { - return StackFormatter.formatNumber(qty) + " gp"; + return QuantityFormatter.formatNumber(qty) + " gp"; } else if (id == ItemID.PLATINUM_TOKEN) { - return StackFormatter.formatNumber(qty * 1000) + " gp"; + return QuantityFormatter.formatNumber(qty * 1000) + " gp"; } ItemComposition itemDef = itemManager.getItemComposition(id); @@ -234,12 +234,12 @@ class ItemPricesOverlay extends Overlay if (gePrice > 0) { itemStringBuilder.append("EX: ") - .append(StackFormatter.quantityToStackSize(gePrice * qty)) + .append(QuantityFormatter.quantityToStackSize(gePrice * qty)) .append(" gp"); if (config.showEA() && qty > 1) { itemStringBuilder.append(" (") - .append(StackFormatter.quantityToStackSize(gePrice)) + .append(QuantityFormatter.quantityToStackSize(gePrice)) .append(" ea)"); } } @@ -251,12 +251,12 @@ class ItemPricesOverlay extends Overlay } itemStringBuilder.append("HA: ") - .append(StackFormatter.quantityToStackSize(haValue * qty)) + .append(QuantityFormatter.quantityToStackSize(haValue * qty)) .append(" gp"); if (config.showEA() && qty > 1) { itemStringBuilder.append(" (") - .append(StackFormatter.quantityToStackSize(haValue)) + .append(QuantityFormatter.quantityToStackSize(haValue)) .append(" ea)"); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java index 8a6e1791a7..e8fc4b30d2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java @@ -61,7 +61,7 @@ import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemMapping; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; @PluginDescriptor( name = "Items Kept on Death", @@ -570,7 +570,7 @@ public class ItemsKeptOnDeathPlugin extends Plugin total += (long) price * w.getItemQuantity(); } final Widget lostValue = client.getWidget(WidgetInfo.ITEMS_LOST_VALUE); - lostValue.setText(StackFormatter.quantityToStackSize(total) + " gp"); + lostValue.setText(QuantityFormatter.quantityToStackSize(total) + " gp"); // Update Max items kept final Widget max = client.getWidget(WidgetInfo.ITEMS_KEPT_MAX); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java index b0c218bad7..da58d97c54 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java @@ -62,7 +62,7 @@ import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.FontManager; import net.runelite.client.ui.JagexColors; import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import net.runelite.http.api.item.ItemEquipmentStats; import net.runelite.http.api.item.ItemStats; @@ -340,7 +340,7 @@ public class ItemStatPlugin extends Plugin createSeparator(invContainer, invContainer.getHeight() - 40); - final String coinText = "You have " + StackFormatter.quantityToStackSize(getCurrentGP()) + final String coinText = "You have " + QuantityFormatter.quantityToStackSize(getCurrentGP()) + (getCurrentGP() == 1 ? " coin." : " coins."); final Widget coinWidget = createText(invContainer, coinText, FontID.PLAIN_12, ORANGE_TEXT, diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java index e2e6539d9f..aaaf0468b0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/kingdomofmiscellania/KingdomCounter.java @@ -26,7 +26,7 @@ package net.runelite.client.plugins.kingdomofmiscellania; import java.awt.image.BufferedImage; import net.runelite.client.ui.overlay.infobox.Counter; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; public class KingdomCounter extends Counter { @@ -48,6 +48,6 @@ public class KingdomCounter extends Counter public String getTooltip() { return "Favor: " + plugin.getFavor() + "/127" + "
" - + "Coffer: " + StackFormatter.quantityToStackSize(plugin.getCoffer()); + + "Coffer: " + QuantityFormatter.quantityToStackSize(plugin.getCoffer()); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java index 372d1bd25a..e3a24ee377 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerBox.java @@ -53,7 +53,7 @@ import net.runelite.client.game.ItemManager; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import net.runelite.client.util.Text; class LootTrackerBox extends JPanel @@ -181,8 +181,8 @@ class LootTrackerBox extends JPanel { buildItems(); - priceLabel.setText(StackFormatter.quantityToStackSize(totalPrice) + " gp"); - priceLabel.setToolTipText(StackFormatter.formatNumber(totalPrice) + " gp"); + priceLabel.setText(QuantityFormatter.quantityToStackSize(totalPrice) + " gp"); + priceLabel.setToolTipText(QuantityFormatter.formatNumber(totalPrice) + " gp"); final long kills = getTotalKills(); if (kills > 1) @@ -354,6 +354,6 @@ class LootTrackerBox extends JPanel final int quantity = item.getQuantity(); final long price = item.getPrice(); final String ignoredLabel = item.isIgnored() ? " - Ignored" : ""; - return name + " x " + quantity + " (" + StackFormatter.quantityToStackSize(price) + ") " + ignoredLabel; + return name + " x " + quantity + " (" + QuantityFormatter.quantityToStackSize(price) + ") " + ignoredLabel; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java index e901a6820f..9dc783bab8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPanel.java @@ -50,7 +50,7 @@ import net.runelite.client.ui.PluginPanel; import net.runelite.client.ui.components.PluginErrorPanel; import net.runelite.client.util.ColorUtil; import net.runelite.client.util.ImageUtil; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import net.runelite.http.api.loottracker.LootTrackerClient; class LootTrackerPanel extends PluginPanel @@ -629,7 +629,7 @@ class LootTrackerPanel extends PluginPanel private static String htmlLabel(String key, long value) { - final String valueStr = StackFormatter.quantityToStackSize(value); + final String valueStr = QuantityFormatter.quantityToStackSize(value); return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java index d732d14d3b..231d7f82c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/nightmarezone/NightmareZoneOverlay.java @@ -43,7 +43,7 @@ import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; class NightmareZoneOverlay extends Overlay { @@ -108,15 +108,15 @@ class NightmareZoneOverlay extends Overlay panelComponent.getChildren().clear(); panelComponent.getChildren().add(LineComponent.builder() .left("Points: ") - .right(StackFormatter.formatNumber(currentPoints)) + .right(QuantityFormatter.formatNumber(currentPoints)) .build()); panelComponent.getChildren().add(LineComponent.builder() .left("Points/Hour: ") - .right(StackFormatter.formatNumber(plugin.getPointsPerHour())) + .right(QuantityFormatter.formatNumber(plugin.getPointsPerHour())) .build()); panelComponent.getChildren().add(LineComponent.builder() .left("Total: ") - .right(StackFormatter.formatNumber(totalPoints)) + .right(QuantityFormatter.formatNumber(totalPoints)) .build()); return panelComponent.render(graphics); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java index 7d9dbe7723..53bad6208a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBox.java @@ -56,7 +56,7 @@ import net.runelite.client.ui.SkillColor; import net.runelite.client.ui.components.ProgressBar; import net.runelite.client.util.ColorUtil; import net.runelite.client.util.LinkBrowser; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; class XpInfoBox extends JPanel { @@ -310,7 +310,7 @@ class XpInfoBox extends JPanel static String htmlLabel(String key, int value) { - String valueStr = StackFormatter.quantityToRSDecimalStack(value, true); + String valueStr = QuantityFormatter.quantityToRSDecimalStack(value, true); return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBoxOverlay.java index e64f398d07..f78db6f296 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBoxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpInfoBoxOverlay.java @@ -44,7 +44,7 @@ import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.ProgressBarComponent; import net.runelite.client.ui.overlay.components.SplitComponent; -import net.runelite.client.util.StackFormatter; +import net.runelite.client.util.QuantityFormatter; import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; @@ -122,7 +122,7 @@ class XpInfoBoxOverlay extends Overlay final LineComponent xpLine = LineComponent.builder() .left(leftStr + ":") - .right(StackFormatter.quantityToRSDecimalStack(rightNum, true)) + .right(QuantityFormatter.quantityToRSDecimalStack(rightNum, true)) .build(); final String bottemLeftStr; @@ -143,7 +143,7 @@ class XpInfoBoxOverlay extends Overlay final LineComponent xpLineBottom = LineComponent.builder() .left(bottemLeftStr + ":") - .right(StackFormatter.quantityToRSDecimalStack(bottomRightNum, true)) + .right(QuantityFormatter.quantityToRSDecimalStack(bottomRightNum, true)) .build(); final SplitComponent xpSplit = SplitComponent.builder() diff --git a/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java b/runelite-client/src/main/java/net/runelite/client/util/QuantityFormatter.java similarity index 98% rename from runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java rename to runelite-client/src/main/java/net/runelite/client/util/QuantityFormatter.java index 75d4a9c63f..49823b5cca 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/StackFormatter.java +++ b/runelite-client/src/main/java/net/runelite/client/util/QuantityFormatter.java @@ -35,7 +35,7 @@ import java.util.regex.Pattern; /** * A set of utility functions to use when formatting quantities */ -public class StackFormatter +public class QuantityFormatter { /** * A list of suffixes to use when formatting stack sizes. @@ -152,7 +152,7 @@ public class StackFormatter * @param string The string to convert. * @return A long representation of it. */ - public static synchronized long stackSizeToQuantity(String string) throws ParseException + public static synchronized long parseQuantity(String string) throws ParseException { int multiplier = getMultiplier(string); float parsedValue = NUMBER_FORMATTER.parse(string).floatValue(); diff --git a/runelite-client/src/test/java/net/runelite/client/util/QuantityFormatterTest.java b/runelite-client/src/test/java/net/runelite/client/util/QuantityFormatterTest.java new file mode 100644 index 0000000000..27ee40c41e --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/util/QuantityFormatterTest.java @@ -0,0 +1,143 @@ +/* + * Copyright (c) 2018, arlyon + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 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 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * 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 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package net.runelite.client.util; + +import java.text.ParseException; +import java.util.Locale; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.fail; +import org.junit.Before; +import org.junit.Test; + +public class QuantityFormatterTest +{ + @Before + public void setUp() + { + Locale.setDefault(Locale.ENGLISH); + } + + @Test + public void quantityToRSDecimalStackSize() + { + assertEquals("0", QuantityFormatter.quantityToRSDecimalStack(0)); + assertEquals("8500", QuantityFormatter.quantityToRSDecimalStack(8_500)); + assertEquals("10K", QuantityFormatter.quantityToRSDecimalStack(10_000)); + assertEquals("21.7K", QuantityFormatter.quantityToRSDecimalStack(21_700)); + assertEquals("100K", QuantityFormatter.quantityToRSDecimalStack(100_000)); + assertEquals("100.3K", QuantityFormatter.quantityToRSDecimalStack(100_300)); + assertEquals("1M", QuantityFormatter.quantityToRSDecimalStack(1_000_000)); + assertEquals("8.4M", QuantityFormatter.quantityToRSDecimalStack(8_450_000)); + assertEquals("10M", QuantityFormatter.quantityToRSDecimalStack(10_000_000)); + assertEquals("12.8M", QuantityFormatter.quantityToRSDecimalStack(12_800_000)); + assertEquals("100M", QuantityFormatter.quantityToRSDecimalStack(100_000_000)); + assertEquals("250.1M", QuantityFormatter.quantityToRSDecimalStack(250_100_000)); + assertEquals("1B", QuantityFormatter.quantityToRSDecimalStack(1_000_000_000)); + assertEquals("1.5B", QuantityFormatter.quantityToRSDecimalStack(1500_000_000)); + assertEquals("2.1B", QuantityFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE)); + } + + @Test + public void quantityToStackSize() + { + assertEquals("0", QuantityFormatter.quantityToStackSize(0)); + assertEquals("999", QuantityFormatter.quantityToStackSize(999)); + assertEquals("1,000", QuantityFormatter.quantityToStackSize(1000)); + assertEquals("9,450", QuantityFormatter.quantityToStackSize(9450)); + assertEquals("14.5K", QuantityFormatter.quantityToStackSize(14_500)); + assertEquals("99.9K", QuantityFormatter.quantityToStackSize(99_920)); + assertEquals("100K", QuantityFormatter.quantityToStackSize(100_000)); + assertEquals("10M", QuantityFormatter.quantityToStackSize(10_000_000)); + assertEquals("2.14B", QuantityFormatter.quantityToStackSize(Integer.MAX_VALUE)); + assertEquals("100B", QuantityFormatter.quantityToStackSize(100_000_000_000L)); + + assertEquals("0", QuantityFormatter.quantityToStackSize(-0)); + assertEquals("-400", QuantityFormatter.quantityToStackSize(-400)); + assertEquals("-400K", QuantityFormatter.quantityToStackSize(-400_000)); + assertEquals("-40M", QuantityFormatter.quantityToStackSize(-40_000_000)); + assertEquals("-2.14B", QuantityFormatter.quantityToStackSize(Integer.MIN_VALUE)); + assertEquals("-400B", QuantityFormatter.quantityToStackSize(-400_000_000_000L)); + } + + @Test + public void quantityToPreciseStackSize() + { + assertEquals("0", QuantityFormatter.quantityToRSDecimalStack(0)); + assertEquals("8500", QuantityFormatter.quantityToRSDecimalStack(8_500, true)); + assertEquals("10K", QuantityFormatter.quantityToRSDecimalStack(10_000, true)); + assertEquals("21.7K", QuantityFormatter.quantityToRSDecimalStack(21_710, true)); + assertEquals("100K", QuantityFormatter.quantityToRSDecimalStack(100_000, true)); + assertEquals("100.3K", QuantityFormatter.quantityToRSDecimalStack(100_310, true)); + assertEquals("1M", QuantityFormatter.quantityToRSDecimalStack(1_000_000, true)); + assertEquals("8.45M", QuantityFormatter.quantityToRSDecimalStack(8_450_000, true)); + assertEquals("8.451M", QuantityFormatter.quantityToRSDecimalStack(8_451_000, true)); + assertEquals("10M", QuantityFormatter.quantityToRSDecimalStack(10_000_000, true)); + assertEquals("12.8M", QuantityFormatter.quantityToRSDecimalStack(12_800_000, true)); + assertEquals("12.85M", QuantityFormatter.quantityToRSDecimalStack(12_850_000, true)); + assertEquals("12.851M", QuantityFormatter.quantityToRSDecimalStack(12_851_000, true)); + assertEquals("100M", QuantityFormatter.quantityToRSDecimalStack(100_000_000, true)); + assertEquals("250.1M", QuantityFormatter.quantityToRSDecimalStack(250_100_000, true)); + assertEquals("250.151M", QuantityFormatter.quantityToRSDecimalStack(250_151_000, true)); + assertEquals("1B", QuantityFormatter.quantityToRSDecimalStack(1_000_000_000, true)); + assertEquals("1.5B", QuantityFormatter.quantityToRSDecimalStack(1500_000_000, true)); + assertEquals("1.55B", QuantityFormatter.quantityToRSDecimalStack(1550_000_000, true)); + assertEquals("2.147B", QuantityFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE, true)); + } + + @Test + public void stackSizeToQuantity() throws ParseException + { + assertEquals(0, QuantityFormatter.parseQuantity("0")); + assertEquals(907, QuantityFormatter.parseQuantity("907")); + assertEquals(1200, QuantityFormatter.parseQuantity("1200")); + assertEquals(10_500, QuantityFormatter.parseQuantity("10,500")); + assertEquals(10_500, QuantityFormatter.parseQuantity("10.5K")); + assertEquals(33_560_000, QuantityFormatter.parseQuantity("33.56M")); + assertEquals(2_000_000_000, QuantityFormatter.parseQuantity("2B")); + + assertEquals(0, QuantityFormatter.parseQuantity("-0")); + assertEquals(-400, QuantityFormatter.parseQuantity("-400")); + assertEquals(-400_000, QuantityFormatter.parseQuantity("-400k")); + assertEquals(-40_543_000, QuantityFormatter.parseQuantity("-40.543M")); + + try + { + QuantityFormatter.parseQuantity("0L"); + fail("Should have thrown an exception for invalid suffix."); + } + catch (ParseException ignore) + { + } + + try + { + QuantityFormatter.parseQuantity("badstack"); + fail("Should have thrown an exception for improperly formatted stack."); + } + catch (ParseException ignore) + { + } + } +} diff --git a/runelite-client/src/test/java/net/runelite/client/util/StackFormatterTest.java b/runelite-client/src/test/java/net/runelite/client/util/StackFormatterTest.java deleted file mode 100644 index 23c3619a54..0000000000 --- a/runelite-client/src/test/java/net/runelite/client/util/StackFormatterTest.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2018, arlyon - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 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 - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * 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 - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -package net.runelite.client.util; - -import java.text.ParseException; -import java.util.Locale; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; -import org.junit.Before; -import org.junit.Test; - -public class StackFormatterTest -{ - @Before - public void setUp() - { - Locale.setDefault(Locale.ENGLISH); - } - - @Test - public void quantityToRSDecimalStackSize() - { - assertEquals("0", StackFormatter.quantityToRSDecimalStack(0)); - assertEquals("8500", StackFormatter.quantityToRSDecimalStack(8_500)); - assertEquals("10K", StackFormatter.quantityToRSDecimalStack(10_000)); - assertEquals("21.7K", StackFormatter.quantityToRSDecimalStack(21_700)); - assertEquals("100K", StackFormatter.quantityToRSDecimalStack(100_000)); - assertEquals("100.3K", StackFormatter.quantityToRSDecimalStack(100_300)); - assertEquals("1M", StackFormatter.quantityToRSDecimalStack(1_000_000)); - assertEquals("8.4M", StackFormatter.quantityToRSDecimalStack(8_450_000)); - assertEquals("10M", StackFormatter.quantityToRSDecimalStack(10_000_000)); - assertEquals("12.8M", StackFormatter.quantityToRSDecimalStack(12_800_000)); - assertEquals("100M", StackFormatter.quantityToRSDecimalStack(100_000_000)); - assertEquals("250.1M", StackFormatter.quantityToRSDecimalStack(250_100_000)); - assertEquals("1B", StackFormatter.quantityToRSDecimalStack(1_000_000_000)); - assertEquals("1.5B", StackFormatter.quantityToRSDecimalStack(1500_000_000)); - assertEquals("2.1B", StackFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE)); - } - - @Test - public void quantityToStackSize() - { - assertEquals("0", StackFormatter.quantityToStackSize(0)); - assertEquals("999", StackFormatter.quantityToStackSize(999)); - assertEquals("1,000", StackFormatter.quantityToStackSize(1000)); - assertEquals("9,450", StackFormatter.quantityToStackSize(9450)); - assertEquals("14.5K", StackFormatter.quantityToStackSize(14_500)); - assertEquals("99.9K", StackFormatter.quantityToStackSize(99_920)); - assertEquals("100K", StackFormatter.quantityToStackSize(100_000)); - assertEquals("10M", StackFormatter.quantityToStackSize(10_000_000)); - assertEquals("2.14B", StackFormatter.quantityToStackSize(Integer.MAX_VALUE)); - assertEquals("100B", StackFormatter.quantityToStackSize(100_000_000_000L)); - - assertEquals("0", StackFormatter.quantityToStackSize(-0)); - assertEquals("-400", StackFormatter.quantityToStackSize(-400)); - assertEquals("-400K", StackFormatter.quantityToStackSize(-400_000)); - assertEquals("-40M", StackFormatter.quantityToStackSize(-40_000_000)); - assertEquals("-2.14B", StackFormatter.quantityToStackSize(Integer.MIN_VALUE)); - assertEquals("-400B", StackFormatter.quantityToStackSize(-400_000_000_000L)); - } - - @Test - public void quantityToPreciseStackSize() - { - assertEquals("0", StackFormatter.quantityToRSDecimalStack(0)); - assertEquals("8500", StackFormatter.quantityToRSDecimalStack(8_500, true)); - assertEquals("10K", StackFormatter.quantityToRSDecimalStack(10_000, true)); - assertEquals("21.7K", StackFormatter.quantityToRSDecimalStack(21_710, true)); - assertEquals("100K", StackFormatter.quantityToRSDecimalStack(100_000, true)); - assertEquals("100.3K", StackFormatter.quantityToRSDecimalStack(100_310, true)); - assertEquals("1M", StackFormatter.quantityToRSDecimalStack(1_000_000, true)); - assertEquals("8.45M", StackFormatter.quantityToRSDecimalStack(8_450_000, true)); - assertEquals("8.451M", StackFormatter.quantityToRSDecimalStack(8_451_000, true)); - assertEquals("10M", StackFormatter.quantityToRSDecimalStack(10_000_000, true)); - assertEquals("12.8M", StackFormatter.quantityToRSDecimalStack(12_800_000, true)); - assertEquals("12.85M", StackFormatter.quantityToRSDecimalStack(12_850_000, true)); - assertEquals("12.851M", StackFormatter.quantityToRSDecimalStack(12_851_000, true)); - assertEquals("100M", StackFormatter.quantityToRSDecimalStack(100_000_000, true)); - assertEquals("250.1M", StackFormatter.quantityToRSDecimalStack(250_100_000, true)); - assertEquals("250.151M", StackFormatter.quantityToRSDecimalStack(250_151_000, true)); - assertEquals("1B", StackFormatter.quantityToRSDecimalStack(1_000_000_000, true)); - assertEquals("1.5B", StackFormatter.quantityToRSDecimalStack(1500_000_000, true)); - assertEquals("1.55B", StackFormatter.quantityToRSDecimalStack(1550_000_000, true)); - assertEquals("2.147B", StackFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE, true)); - } - - @Test - public void stackSizeToQuantity() throws ParseException - { - assertEquals(0, StackFormatter.stackSizeToQuantity("0")); - assertEquals(907, StackFormatter.stackSizeToQuantity("907")); - assertEquals(1200, StackFormatter.stackSizeToQuantity("1200")); - assertEquals(10_500, StackFormatter.stackSizeToQuantity("10,500")); - assertEquals(10_500, StackFormatter.stackSizeToQuantity("10.5K")); - assertEquals(33_560_000, StackFormatter.stackSizeToQuantity("33.56M")); - assertEquals(2_000_000_000, StackFormatter.stackSizeToQuantity("2B")); - - assertEquals(0, StackFormatter.stackSizeToQuantity("-0")); - assertEquals(-400, StackFormatter.stackSizeToQuantity("-400")); - assertEquals(-400_000, StackFormatter.stackSizeToQuantity("-400k")); - assertEquals(-40_543_000, StackFormatter.stackSizeToQuantity("-40.543M")); - - try - { - StackFormatter.stackSizeToQuantity("0L"); - fail("Should have thrown an exception for invalid suffix."); - } - catch (ParseException ignore) - { - } - - try - { - StackFormatter.stackSizeToQuantity("badstack"); - fail("Should have thrown an exception for improperly formatted stack."); - } - catch (ParseException ignore) - { - } - } -} From e279669952e3d6985284baffb272182f32ddb174 Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 13 Oct 2019 11:29:31 +0200 Subject: [PATCH 06/26] Properly update plugin toggle button of plugin state change Closes #9846 Signed-off-by: Tomas Slusny --- .../client/plugins/config/ConfigPanel.java | 2 +- .../client/plugins/config/ConfigPlugin.java | 4 ---- .../client/plugins/config/PluginListItem.java | 15 ++++++++++----- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index bf66f6c2d1..bd12d73470 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -306,7 +306,7 @@ public class ConfigPanel extends PluginPanel topPanelBackButton.setToolTipText("Back"); topPanel.add(topPanelBackButton, BorderLayout.WEST); - topPanel.add(listItem.createToggleButton(), BorderLayout.EAST); + topPanel.add(listItem.getConfigToggleButton(), BorderLayout.EAST); String name = listItem.getName(); JLabel title = new JLabel(name); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPlugin.java index 4ff43a6ae3..f17542447b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPlugin.java @@ -39,7 +39,6 @@ import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginManager; import net.runelite.client.ui.ClientToolbar; -import net.runelite.client.ui.ClientUI; import net.runelite.client.ui.NavigationButton; import net.runelite.client.ui.components.colorpicker.ColorPickerManager; import net.runelite.client.ui.overlay.Overlay; @@ -53,9 +52,6 @@ import net.runelite.client.util.ImageUtil; ) public class ConfigPlugin extends Plugin { - @Inject - private ClientUI clientUI; - @Inject private ClientToolbar clientToolbar; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java index ee4a6fb166..69dec09365 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java @@ -91,11 +91,14 @@ class PluginListItem extends JPanel @Getter private final String description; + @Getter + private final IconButton configToggleButton; + private final List keywords = new ArrayList<>(); private final IconButton pinButton = new IconButton(OFF_STAR); private final IconButton configButton = new IconButton(CONFIG_ICON, CONFIG_ICON_HOVER); - private final IconButton toggleButton = new IconButton(OFF_SWITCHER); + private final IconButton toggleButton; private boolean isPluginEnabled = false; @@ -215,9 +218,10 @@ class PluginListItem extends JPanel addLabelPopupMenu(nameLabel, popupMenuItems); add(nameLabel, BorderLayout.CENTER); - toggleButton.setPreferredSize(new Dimension(25, 0)); - attachToggleButtonListener(toggleButton); + toggleButton = createToggleButton(); buttonPanel.add(toggleButton); + + configToggleButton = createToggleButton(); } private void attachToggleButtonListener(IconButton button) @@ -245,9 +249,9 @@ class PluginListItem extends JPanel }); } - IconButton createToggleButton() + private IconButton createToggleButton() { - IconButton button = new IconButton(OFF_SWITCHER); + final IconButton button = new IconButton(OFF_SWITCHER); button.setPreferredSize(new Dimension(25, 0)); updateToggleButton(button); attachToggleButtonListener(button); @@ -258,6 +262,7 @@ class PluginListItem extends JPanel { isPluginEnabled = enabled; updateToggleButton(toggleButton); + updateToggleButton(configToggleButton); } void setPinned(boolean pinned) From 234245a399f4ca8b120a66f032f2374e16f8c966 Mon Sep 17 00:00:00 2001 From: 15987632 Date: Sun, 13 Oct 2019 00:45:35 -0400 Subject: [PATCH 07/26] timers plugin: remove prayer enhance infobox on expire --- .../net/runelite/client/plugins/timers/TimersPlugin.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index 1390cc883b..b84d987c8f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -105,6 +105,7 @@ public class TimersPlugin extends Plugin private static final String SUPER_ANTIFIRE_EXPIRED_MESSAGE = "Your super antifire potion has expired."; private static final String SUPER_ANTIVENOM_DRINK_MESSAGE = "You drink some of your super antivenom potion"; private static final String KILLED_TELEBLOCK_OPPONENT_TEXT = "Your Tele Block has been removed because you killed "; + private static final String PRAYER_ENHANCE_EXPIRED = "Your prayer enhance effect has worn off."; private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\."); private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes, 0 seconds\\."); @@ -592,6 +593,11 @@ public class TimersPlugin extends Plugin createGameTimer(PRAYER_ENHANCE); } + if (config.showPrayerEnhance() && event.getMessage().equals(PRAYER_ENHANCE_EXPIRED)) + { + removeGameTimer(PRAYER_ENHANCE); + } + if (config.showCharge() && event.getMessage().equals(CHARGE_MESSAGE)) { createGameTimer(CHARGE); From 2e3475a577bb2baeb45d307eee801174fbe54a01 Mon Sep 17 00:00:00 2001 From: Trey Date: Mon, 14 Oct 2019 05:53:07 -0700 Subject: [PATCH 08/26] Add revertible Neitiznot Faceguard to ItemMapping (#10038) --- .../src/main/java/net/runelite/client/game/ItemMapping.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java index 12ff493bc2..638dfcb19b 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java @@ -216,6 +216,8 @@ public enum ItemMapping ITEM_HYDRA_TAIL(HYDRA_TAIL, BONECRUSHER_NECKLACE), ITEM_DRAGONBONE_NECKLACE(DRAGONBONE_NECKLACE, BONECRUSHER_NECKLACE), ITEM_BOTTOMLESS_COMPOST_BUCKET(BOTTOMLESS_COMPOST_BUCKET, BOTTOMLESS_COMPOST_BUCKET_22997), + ITEM_BASILISK_JAW(BASILISK_JAW, NEITIZNOT_FACEGUARD), + ITEM_HELM_OF_NEITIZNOT(HELM_OF_NEITIZNOT, NEITIZNOT_FACEGUARD), // Crystal items ITEM_CRYSTAL_TOOL_SEED(CRYSTAL_TOOL_SEED, CRYSTAL_AXE, CRYSTAL_AXE_INACTIVE, CRYSTAL_HARPOON, CRYSTAL_HARPOON_INACTIVE, CRYSTAL_PICKAXE, CRYSTAL_PICKAXE_INACTIVE), From 00320437efc4708269798778dc5798d513ce6066 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Mon, 14 Oct 2019 19:14:12 +0100 Subject: [PATCH 09/26] world map: fix location of northern pipe in Mount Karuulm dungeon --- .../src/main/java/net/runelite/client/game/AgilityShortcut.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java index ff7288e5e5..2db362fa3a 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java +++ b/runelite-client/src/main/java/net/runelite/client/game/AgilityShortcut.java @@ -212,7 +212,7 @@ public enum AgilityShortcut BRIMHAVEN_DUNGEON_VINE_EAST(87, "Vine", new WorldPoint(2672, 9582, 0), VINE_26880, VINE_26882), BRIMHAVEN_DUNGEON_VINE_WEST(87, "Vine", new WorldPoint(2606, 9584, 0), VINE_26880, VINE_26882), MOUNT_KARUULM_PIPE_SOUTH(88, "Pipe", new WorldPoint(1316, 10214, 0), MYSTERIOUS_PIPE), - MOUNT_KARUULM_PIPE_NORTH(88, "Pipe", new WorldPoint(1346, 10231, 0), MYSTERIOUS_PIPE), + MOUNT_KARUULM_PIPE_NORTH(88, "Pipe", new WorldPoint(1345, 10230, 0), MYSTERIOUS_PIPE), REVENANT_CAVES_CHAMBER_JUMP(89, "Jump", new WorldPoint(3240, 10144, 0), PILLAR_31561); /** From 3181ee896b6882252c8312c6acf59e8aa3dffdce Mon Sep 17 00:00:00 2001 From: Morgan Lewis Date: Tue, 15 Oct 2019 03:15:44 -0600 Subject: [PATCH 10/26] worldmap: Update Rimmington ship transportation icons and locations (#10010) Add Rimmington to the Andougne / Brimhaven ship transportation. Also fix minor placement errors on two transportation icons in east Karamja. --- .../plugins/worldmap/TransportationPointLocation.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java index 3bbe10826a..1d627eb1d0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/TransportationPointLocation.java @@ -37,9 +37,10 @@ import javax.annotation.Nullable; enum TransportationPointLocation { //Ships - ARDOUGNE_TO_BRIMHAVEN("Ship to Brimhaven", new WorldPoint(2675, 3275, 0), new WorldPoint(2772, 3234, 0)), + ARDOUGNE_TO_BRIMHAVEN("Ship to Brimhaven / Rimmington", new WorldPoint(2675, 3275, 0)), ARDOUGNE_TO_FISHINGPLAT("Ship to Fishing Platform", new WorldPoint(2722, 3304, 0), new WorldPoint(2779, 3271, 0)), - BRIMHAVEN_TO_ARDOUGNE("Ship to Ardougne", new WorldPoint(2772, 3234, 0), new WorldPoint(2675, 3275, 0)), + BRIMHAVEN_TO_ARDOUGNE("Ship to Ardougne / Rimmington", new WorldPoint(2772, 3234, 0)), + RIMMINGTON_TO_ARDOUGNE("Ship to Ardougne / Brimhaven", new WorldPoint(2915, 3224, 0)), CATHERBY_TO_KEEP_LE_FAYE("Ship to Keep Le Faye", new WorldPoint(2804, 3421, 0), new WorldPoint(2769, 3402, 0)), CORSAIR_TO_RIMMINGTON("Ship to Rimmington", new WorldPoint(2577, 2839, 0), new WorldPoint(2909, 3227, 0 )), DRAGONTOOTH_TO_PHASMATYS("Ship to Port Phasmatys", new WorldPoint(3791, 3561, 0), new WorldPoint(3703, 3487, 0)), @@ -50,7 +51,7 @@ enum TransportationPointLocation ICEBERG_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2657, 3988, 0), new WorldPoint(2707, 3735, 0)), ISLAND_TO_APE_ATOLL("Ship to Ape Atoll", new WorldPoint(2891, 2726, 0), new WorldPoint(2802, 2706, 0)), JATIZSO_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2420, 3780, 0), new WorldPoint(2639, 3710, 0)), - KARAMJA_TO_PORT_SARIM("Ship to Port Sarim", new WorldPoint(2955, 3144, 0), new WorldPoint(3029, 3218, 0)), + KARAMJA_TO_PORT_SARIM("Ship to Port Sarim", new WorldPoint(2955, 3145, 0), new WorldPoint(3029, 3218, 0)), KARAMJA_TO_PORT_KHAZARD("Ship to Port Khazard", new WorldPoint(2763, 2957, 0), new WorldPoint(2653, 3166, 0)), LANDSEND_TO_PORTSARIM_PORTPISCARILIUS("Ship to Port Sarim/Port Piscarilius", new WorldPoint(1503, 3398, 0)), LUNAR_ISLE_TO_PIRATES_COVE("Ship to Pirates' Cove", new WorldPoint(2137, 3899, 0), new WorldPoint(2223, 3796, 0)), @@ -108,7 +109,7 @@ enum TransportationPointLocation CHARTER_BRIMHAVEN("Charter Ship", new WorldPoint(2760, 3238, 0)), CHARTER_CATHERBY("Charter Ship", new WorldPoint(2791, 3415, 0)), CHARTER_CORSAIR_("Charter Ship", new WorldPoint(2589, 2851, 0)), - CHARTER_KARAMJA_NORTH("Charter Ship", new WorldPoint(2954, 3159, 0)), + CHARTER_KARAMJA_NORTH("Charter Ship", new WorldPoint(2954, 3158, 0)), CHARTER_KARAMJA_EAST("Charter Ship", new WorldPoint(2999, 3032, 0)), CHARTER_KHAZARD("Charter Ship", new WorldPoint(2673, 3143, 0)), CHARTER_MOSLE_HARMLESS("Charter Ship", new WorldPoint(3669, 2931, 0)), From 021bb109d6e13693e65cb64c631498156ee3586b Mon Sep 17 00:00:00 2001 From: Ron Young Date: Sat, 5 Oct 2019 20:35:46 -0500 Subject: [PATCH 11/26] ChatboxTextInput: add ability to filter character inputs --- .../client/game/chatbox/ChatboxTextInput.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java index 8d4402b368..ffc7e10dc5 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java +++ b/runelite-client/src/main/java/net/runelite/client/game/chatbox/ChatboxTextInput.java @@ -129,6 +129,12 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse this.clientThread = clientThread; } + public ChatboxTextInput addCharValidator(IntPredicate validator) + { + this.charValidator = this.charValidator.and(validator); + return this; + } + public ChatboxTextInput lines(int lines) { this.lines = lines; @@ -151,7 +157,15 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse public ChatboxTextInput value(String value) { - this.value = new StringBuffer(value); + StringBuffer sb = new StringBuffer(); + for (char c : value.toCharArray()) + { + if (charValidator.test(c)) + { + sb.append(c); + } + } + this.value = sb; cursorAt(this.value.length()); return this; } From 9d898d95c521619432025c7cd4194387ceccf366 Mon Sep 17 00:00:00 2001 From: Ron Young Date: Sat, 5 Oct 2019 20:36:50 -0500 Subject: [PATCH 12/26] banktags: filter out <,>, and / from tag input --- .../plugins/banktags/BankTagsPlugin.java | 2 ++ .../plugins/banktags/tabs/TabInterface.java | 26 +++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java index ea8f6b2792..70f92668b2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java @@ -71,6 +71,7 @@ import net.runelite.client.plugins.PluginDependency; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.banktags.tabs.BankSearch; import net.runelite.client.plugins.banktags.tabs.TabInterface; +import static net.runelite.client.plugins.banktags.tabs.TabInterface.FILTERED_CHARS; import net.runelite.client.plugins.banktags.tabs.TabSprites; import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin; import net.runelite.client.util.Text; @@ -278,6 +279,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis String initialValue = Text.toCSV(tags); chatboxPanelManager.openTextInput(name + " tags:
(append " + VAR_TAG_SUFFIX + " for variation tag)") + .addCharValidator(FILTERED_CHARS) .value(initialValue) .onDone((newValue) -> clientThread.invoke(() -> diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index 9e0d6af08a..e6a3683daa 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -45,6 +45,7 @@ import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; import java.util.Objects; +import java.util.function.IntPredicate; import java.util.stream.Collectors; import javax.inject.Inject; import javax.inject.Singleton; @@ -94,6 +95,8 @@ import net.runelite.client.util.Text; @Singleton public class TabInterface { + public static final IntPredicate FILTERED_CHARS = c -> "".indexOf(c) == -1; + private static final Color HILIGHT_COLOR = JagexColors.MENU_TARGET; private static final String SCROLL_UP = "Scroll up"; private static final String SCROLL_DOWN = "Scroll down"; @@ -252,6 +255,7 @@ public class TabInterface } chatboxPanelManager.openTextInput((inventory ? "Inventory " : "Equipment ") + " tags:") + .addCharValidator(FILTERED_CHARS) .onDone((newTags) -> clientThread.invoke(() -> { @@ -273,6 +277,7 @@ public class TabInterface { case NewTab.NEW_TAB: chatboxPanelManager.openTextInput("Tag name") + .addCharValidator(FILTERED_CHARS) .onDone((tagName) -> clientThread.invoke(() -> { if (!Strings.isNullOrEmpty(tagName)) @@ -285,7 +290,6 @@ public class TabInterface .build(); break; case NewTab.IMPORT_TAB: - try { final String dataString = Toolkit @@ -296,7 +300,24 @@ public class TabInterface .trim(); final Iterator dataIter = Text.fromCSV(dataString).iterator(); - final String name = dataIter.next(); + String name = dataIter.next(); + StringBuffer sb = new StringBuffer(); + for (char c : name.toCharArray()) + { + if (FILTERED_CHARS.test(c)) + { + sb.append(c); + } + } + + if (sb.length() == 0) + { + notifier.notify("Failed to import tag tab from clipboard, invalid format."); + return; + } + + name = sb.toString(); + final String icon = dataIter.next(); tabManager.setIcon(name, icon); @@ -764,6 +785,7 @@ public class TabInterface private void renameTab(String oldTag) { chatboxPanelManager.openTextInput("Enter new tag name for tag \"" + oldTag + "\":") + .addCharValidator(FILTERED_CHARS) .onDone((newTag) -> clientThread.invoke(() -> { if (!Strings.isNullOrEmpty(newTag) && !newTag.equalsIgnoreCase(oldTag)) From 1ea3df7a1a815470674c558ed95cb2d13b3e2558 Mon Sep 17 00:00:00 2001 From: Ron Young Date: Sun, 6 Oct 2019 11:24:42 -0500 Subject: [PATCH 13/26] banktags: clean invalid config items --- .../plugins/banktags/BankTagsPlugin.java | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java index 70f92668b2..b59291af6d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java @@ -32,6 +32,7 @@ import java.awt.event.MouseWheelEvent; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.List; import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.inject.Inject; @@ -130,6 +131,9 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis @Inject private SpriteManager spriteManager; + @Inject + private ConfigManager configManager; + private boolean shiftPressed = false; @Provides @@ -141,12 +145,61 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis @Override public void startUp() { + cleanConfig(); keyManager.registerKeyListener(this); mouseManager.registerMouseWheelListener(this); clientThread.invokeLater(tabInterface::init); spriteManager.addSpriteOverrides(TabSprites.values()); } + @Deprecated + private void cleanConfig() + { + removeInvalidTags("tagtabs"); + + List tags = configManager.getConfigurationKeys(CONFIG_GROUP + ".item_"); + tags.forEach(s -> + { + String[] split = s.split("\\.", 2); + removeInvalidTags(split[1]); + }); + + List icons = configManager.getConfigurationKeys(CONFIG_GROUP + ".icon_"); + icons.forEach(s -> + { + String[] split = s.split("\\.", 2); + String replaced = split[1].replaceAll("[<>/]", ""); + if (!split[1].equals(replaced)) + { + String value = configManager.getConfiguration(CONFIG_GROUP, split[1]); + configManager.unsetConfiguration(CONFIG_GROUP, split[1]); + if (replaced.length() > "icon_".length()) + { + configManager.setConfiguration(CONFIG_GROUP, replaced, value); + } + } + }); + } + + @Deprecated + private void removeInvalidTags(final String key) + { + final String value = configManager.getConfiguration(CONFIG_GROUP, key); + String replaced = value.replaceAll("[<>/]", ""); + if (!value.equals(replaced)) + { + replaced = Text.toCSV(Text.fromCSV(replaced)); + if (replaced.isEmpty()) + { + configManager.unsetConfiguration(CONFIG_GROUP, key); + } + else + { + configManager.setConfiguration(CONFIG_GROUP, key, replaced); + } + } + } + @Override public void shutDown() { From e50dd43c9d84250e7b684e6f396295959236f8e6 Mon Sep 17 00:00:00 2001 From: dekvall Date: Wed, 7 Aug 2019 01:23:02 +0200 Subject: [PATCH 14/26] Clarify that blowpipe won't work with Robin clue The ranged bonus of the toxic blowpipe is dynamic depending on darts and does not count when trying to complete this cryptic clue. --- .../runelite/client/plugins/cluescrolls/clues/CrypticClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java index d0f950b9de..17eb5278f0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java @@ -216,7 +216,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc new CrypticClue("Search the drawers in the house next to the Port Sarim mage shop.", DRAWERS, new WorldPoint(3024, 3259, 0), "House east of Betty's. Contains a cooking sink."), new CrypticClue("With a name like that, you'd expect a little more than just a few scimitars.", "Daga", new WorldPoint(2759, 2775, 0), "Speak to Daga on Ape Atoll."), new CrypticClue("Strength potions with red spiders' eggs? He is quite a herbalist.", "Apothecary", new WorldPoint(3194, 3403, 0), "Talk to Apothecary in the South-western Varrock. (the) apothecary is just north-west of the Varrock Swordshop."), - new CrypticClue("Robin wishes to see your finest ranged equipment.", "Robin", new WorldPoint(3673, 3492, 0), "Robin at the inn in Port Phasmatys. Speak to him with +182 in ranged attack bonus."), + new CrypticClue("Robin wishes to see your finest ranged equipment.", "Robin", new WorldPoint(3673, 3492, 0), "Robin at the inn in Port Phasmatys. Speak to him with +182 in ranged attack bonus. Bonus granted by the toxic blowpipe is ignored."), new CrypticClue("You will need to under-cook to solve this one.", CRATE_357, new WorldPoint(3219, 9617, 0), "Search the crate in the Lumbridge basement."), new CrypticClue("Search through some drawers found in Taverley's houses.", DRAWERS_350, new WorldPoint(2894, 3418, 0), "The south-eastern most house, south of Jatix's Herblore Shop."), new CrypticClue("Anger Abbot Langley.", "Abbot Langley", new WorldPoint(3058, 3487, 0), "Speak to Abbot Langley in the Edgeville Monastery while you have a negative prayer bonus (currently only possible with an Ancient staff)."), From cdff0b245df0f6abad4e5f935a129d823dd96765 Mon Sep 17 00:00:00 2001 From: Ron Young Date: Tue, 15 Oct 2019 13:38:24 -0500 Subject: [PATCH 15/26] banktags: null check for no tagtabs --- .../net/runelite/client/plugins/banktags/BankTagsPlugin.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java index b59291af6d..68fd2ddda5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/BankTagsPlugin.java @@ -185,6 +185,11 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis private void removeInvalidTags(final String key) { final String value = configManager.getConfiguration(CONFIG_GROUP, key); + if (value == null) + { + return; + } + String replaced = value.replaceAll("[<>/]", ""); if (!value.equals(replaced)) { From 27f6f9e4b41baa970190989e15c83316de17cd6f Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 16 Oct 2019 08:43:22 -0400 Subject: [PATCH 16/26] Fix slayer infobox disappearing on '0' timeout Co-authored-by: trelkins3 --- .../java/net/runelite/client/plugins/slayer/SlayerPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index e446973a85..ac3e525d24 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -390,7 +390,7 @@ public class SlayerPlugin extends Plugin } } - if (infoTimer != null) + if (infoTimer != null && config.statTimeout() != 0) { Duration timeSinceInfobox = Duration.between(infoTimer, Instant.now()); Duration statTimeout = Duration.ofMinutes(config.statTimeout()); From 69ebb7123924db9ca98c05e56fed99d4fc161e6d Mon Sep 17 00:00:00 2001 From: Tomas Slusny Date: Sun, 13 Oct 2019 11:41:27 +0200 Subject: [PATCH 17/26] Null-check WorldResult in DefaultWorldPlugin Closes #8043 Signed-off-by: Tomas Slusny --- .../client/plugins/defaultworld/DefaultWorldPlugin.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java index ef987c2cc7..279d7abf49 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java @@ -114,6 +114,13 @@ public class DefaultWorldPlugin extends Plugin try { final WorldResult worldResult = worldClient.lookupWorlds(); + + if (worldResult == null) + { + log.warn("Failed to lookup worlds."); + return; + } + final World world = worldResult.findWorld(correctedWorld); if (world != null) From 5acdcae75d22c139efcc9a77eb335f6ea4d30e51 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 10 Oct 2019 05:49:14 -0600 Subject: [PATCH 18/26] runelite-api: Add some more documentation --- .../java/net/runelite/api/IndexedSprite.java | 96 ++----------------- .../java/net/runelite/api/NPCComposition.java | 44 ++------- .../net/runelite/api/ObjectComposition.java | 34 +++---- .../net/runelite/api/TextureProvider.java | 8 +- .../main/java/net/runelite/api/TileItem.java | 7 -- .../java/net/runelite/api/TileObject.java | 51 +++------- .../java/net/runelite/api/VarClientInt.java | 6 +- .../java/net/runelite/api/VarClientStr.java | 6 +- .../main/java/net/runelite/api/VarPlayer.java | 7 +- .../main/java/net/runelite/api/Varbits.java | 10 +- .../api/events/ScriptCallbackEvent.java | 5 +- .../api/events/VarClientIntChanged.java | 2 +- .../api/events/VarClientStrChanged.java | 2 +- .../runelite/api/events/VarbitChanged.java | 5 + .../api/events/WidgetMenuOptionClicked.java | 2 +- .../api/widgets/JavaScriptCallback.java | 4 + 16 files changed, 88 insertions(+), 201 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/IndexedSprite.java b/runelite-api/src/main/java/net/runelite/api/IndexedSprite.java index b033ef61e9..21334409b5 100644 --- a/runelite-api/src/main/java/net/runelite/api/IndexedSprite.java +++ b/runelite-api/src/main/java/net/runelite/api/IndexedSprite.java @@ -25,119 +25,39 @@ package net.runelite.api; /** - * Represents an indexed sprite. + * Represents an paletted sprite. */ public interface IndexedSprite { /** - * Gets the pixels contained by the sprite. - * - * @return the sprite pixels + * The bitmap of this sprite. Each value is an index into {@link #getPalette()}. + * 0 is transparent */ byte[] getPixels(); - - /** - * Sets the pixels contained by the sprite. - * - * @param pixels the new sprite pixels - */ void setPixels(byte[] pixels); /** - * Gets the color palette for the sprites pixels. - * - * @return the color palette + * The color palette in RGB. The zero index is unused. */ int[] getPalette(); - - /** - * Sets the color palette for the sprites pixels. - * - * @param palette the new color palette - */ void setPalette(int[] palette); - /** - * Gets the offset of the sprite along the x-axis. - * - * @return the x-axis offset - */ int getOffsetX(); - - /** - * Sets the offset of the sprite along the x-axis. - * - * @param offsetX new x-axis offset - */ void setOffsetX(int offsetX); - /** - * Gets the offset of the sprite along the y-axis. - * - * @return the y-axis offset - */ int getOffsetY(); - - /** - * Sets the offset of the sprite along the y-axis. - * - * @param offsetY new y-axis offset - */ void setOffsetY(int offsetY); - /** - * Gets the width of the sprite. - * - * @return the width - */ int getWidth(); - - /** - * Sets the width of the sprite. - * - * @param width the new width - */ void setWidth(int width); - /** - * Gets the original width of the sprite. - * - * @return the width - */ - int getOriginalWidth(); - /** - * Sets the original width of the sprite. - * - * @param originalWidth the width - */ + int getHeight(); + void setHeight(int height); + + int getOriginalWidth(); void setOriginalWidth(int originalWidth); - /** - * Gets the height of the sprite. - * - * @return the height - */ - int getHeight(); - - /** - * Sets the height of the sprite. - * - * @param height the height - */ - void setHeight(int height); - - /** - * Gets the original height of the sprite. - * - * @return the height - */ int getOriginalHeight(); - - /** - * Sets the original height of the sprite. - * - * @param originalHeight the height - */ void setOriginalHeight(int originalHeight); } diff --git a/runelite-api/src/main/java/net/runelite/api/NPCComposition.java b/runelite-api/src/main/java/net/runelite/api/NPCComposition.java index 0386ba954f..c058ca57cd 100644 --- a/runelite-api/src/main/java/net/runelite/api/NPCComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/NPCComposition.java @@ -25,93 +25,69 @@ package net.runelite.api; /** - * Represents the template of a specific NPC type. + * Information about a specific {@link NpcID} */ public interface NPCComposition { /** * Gets the name of the NPC. - * - * @return the name */ String getName(); /** * Gets the model IDs that compose this NPC. - * - * @return the NPCs model IDs */ int[] getModels(); /** - * Gets an array of possible right-click menu actions that can be - * performed on the NPC. - * - * @return the menu actions + * The 5 menuops this NPC has when in world. Index 0 corresponds to + * {@link MenuAction#NPC_FIRST_OPTION}, Index 2 to + * {@link MenuAction#NPC_SECOND_OPTION} and so on. */ String[] getActions(); - /** - * Gets whether the NPC can be clicked. - * - * @return true if the NPC can be clicked, false otherwise - */ boolean isClickable(); /** * Gets whether the NPC is visible on the mini-map. - * - * @return the mini-map visible state */ boolean isMinimapVisible(); - /** - * Gets whether the NPC is visible. - * - * @return the visible state - */ boolean isVisible(); /** * Gets the ID of the NPC. * - * @return the ID of the NPC * @see NpcID */ int getId(); /** - * Gets the combat level of the NPC. - * * @return the combat level, -1 if none */ int getCombatLevel(); /** - * Gets the configuration data for the NPC. - * - * @return the configuration data + * Get the {@link NpcID}s of NPCs this can transform into, depending + * on a {@link Varbits} or {@link VarPlayer} */ int[] getConfigs(); /** - * Transforms this NPC into a new state, which may have a different ID. + * Get the NPC composition the player's state says this NPC should + * transmogrify into. * - * @return the transformed composition + * @throws NullPointerException if {@link #getConfigs()} is null */ NPCComposition transform(); /** - * Gets the size of the NPC. - * - * @return the NPCs size + * How many tiles wide this NPC is */ int getSize(); /** * Gets the displayed overhead icon of the NPC. - * - * @return the overhead icon */ HeadIcon getOverheadIcon(); } diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectComposition.java b/runelite-api/src/main/java/net/runelite/api/ObjectComposition.java index 3b90539c19..43fa5aa88a 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectComposition.java @@ -25,58 +25,52 @@ package net.runelite.api; /** - * Represents the template of a specific object. + * Information about a specific {@link ObjectID} */ public interface ObjectComposition { /** * Gets ID for the object. * - * @return the object ID + * @see ObjectID */ int getId(); /** * Gets the name of the object. - * - * @return the object name */ String getName(); /** - * Gets an array of possible right-click menu actions that can be - * performed on the object. - * - * @return the menu actions + * The 5 menuops this object has when in world. Index 0 corresponds to + * {@link MenuAction#GAME_OBJECT_FIRST_OPTION}, Index 2 to + * {@link MenuAction#GAME_OBJECT_SECOND_OPTION} and so on. */ String[] getActions(); /** - * Gets the map scene ID for the object. - * - * @return the scene ID + * Gets the index of this object in the {@link Client#getMapScene()} + * array, or -1 if it has no map scene icon */ int getMapSceneId(); /** - * Gets the map icon ID for the object. - * - * @return the map icon ID + * Gets the index of this object in the {@link Client#getMapIcons()} + * array, or -1 if it has no full map icon */ int getMapIconId(); /** - * Gets IDs for objects that are considered fakes of this object, - * such as barrows walls. - * - * @return the impostor IDs + * Get the {@link ObjectID}s of objects this can transform into, depending + * on a {@link Varbits} or {@link VarPlayer} */ int[] getImpostorIds(); /** - * Gets the impostor composition for this object. + * Get the object composition the player's state says this object should + * transmogrify into. * - * @return the impostor + * @throws NullPointerException if {@link #getImpostorIds()} is null */ ObjectComposition getImpostor(); } diff --git a/runelite-api/src/main/java/net/runelite/api/TextureProvider.java b/runelite-api/src/main/java/net/runelite/api/TextureProvider.java index b7df733438..b964056108 100644 --- a/runelite-api/src/main/java/net/runelite/api/TextureProvider.java +++ b/runelite-api/src/main/java/net/runelite/api/TextureProvider.java @@ -30,21 +30,19 @@ public interface TextureProvider /** * Set the brightness for textures, clearing the texture cache. - * @param brightness + * + * .9 is the darkest value available in the standard options + * .6 is the brightest value */ void setBrightness(double brightness); /** * Get all textures - * - * @return */ Texture[] getTextures(); /** * Get the pixels for a texture - * @param textureId - * @return */ int[] load(int textureId); } diff --git a/runelite-api/src/main/java/net/runelite/api/TileItem.java b/runelite-api/src/main/java/net/runelite/api/TileItem.java index 46a6262910..8c1b08541e 100644 --- a/runelite-api/src/main/java/net/runelite/api/TileItem.java +++ b/runelite-api/src/main/java/net/runelite/api/TileItem.java @@ -30,17 +30,10 @@ package net.runelite.api; public interface TileItem extends Renderable { /** - * Gets the items ID. - * * @return the ID of the item * @see ItemID */ int getId(); - /** - * Gets the items quantity. - * - * @return the items quantity - */ int getQuantity(); } diff --git a/runelite-api/src/main/java/net/runelite/api/TileObject.java b/runelite-api/src/main/java/net/runelite/api/TileObject.java index 7c6c606756..84c192ea0c 100644 --- a/runelite-api/src/main/java/net/runelite/api/TileObject.java +++ b/runelite-api/src/main/java/net/runelite/api/TileObject.java @@ -32,88 +32,65 @@ import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; /** - * Represents an object that a tile holds. + * Represents an object on a Tile */ public interface TileObject { - /** - * Gets the hashed value of this object. - * - * @return the object hash - */ long getHash(); /** * Gets the x-axis coordinate of the object in local context. * - * @return the x-axis coordinate + * @see LocalPoint */ int getX(); /** * Gets the y-axis coordinate of the object in local context. * - * @return the y-axis coordinate + * @see LocalPoint */ int getY(); /** * Gets the plane of the tile that the object is on. - * - * @return the tile plane */ int getPlane(); /** * Gets the ID of the object. * - * @return the object ID + * @see ObjectID + * @see NullObjectID */ int getId(); - /** - * Gets the location coordinate of the object in the world. - * - * @return the world location - */ WorldPoint getWorldLocation(); - /** - * Gets the local location of the object. - * - * @return the local location - */ LocalPoint getLocalLocation(); /** - * Gets the upper-left canvas point where this object is drawn. - * - * @return the canvas location + * Calculates the position of the center of this tile on the canvas */ Point getCanvasLocation(); /** - * Gets the upper-left canvas point where this object is drawn, - * offset by the passed value. + * Calculates the position of the center of this tile on the canvas * - * @param zOffset the z-axis offset - * @return the canvas location + * @param zOffset Vertical offset to apply before projection */ Point getCanvasLocation(int zOffset); /** - * Gets the polygon of the objects model as drawn on the canvas. - * - * @return the canvas polygon + * Creates a polygon outlining the tile this object is on */ Polygon getCanvasTilePoly(); /** - * Gets the text position on the canvas. + * Calculates the canvas point to center {@code text} above the tile this object is on. * - * @param graphics the client graphics - * @param text the text to draw - * @param zOffset the offset from ground plane + * @param graphics the graphics to use for font size calculation + * @param zOffset Vertical offset to apply before projection * @return the canvas point to draw the text at */ Point getCanvasTextLocation(Graphics2D graphics, String text, int zOffset); @@ -127,9 +104,7 @@ public interface TileObject Point getMinimapLocation(); /** - * Get the on-screen clickable area of the object. - * - * @return the clickable area + * Calculate the on-screen clickable area of the object. */ @Nullable Shape getClickbox(); diff --git a/runelite-api/src/main/java/net/runelite/api/VarClientInt.java b/runelite-api/src/main/java/net/runelite/api/VarClientInt.java index 09945a1137..db67c62966 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarClientInt.java +++ b/runelite-api/src/main/java/net/runelite/api/VarClientInt.java @@ -28,7 +28,11 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * An enumeration of integer local variables. + * Client side only, content-developer integers + * + * VarCInts are stored entirely in memory, or locally on a user's + * machine in the preferences2.dat file depending on how Jagex + * configured the variable */ @AllArgsConstructor @Getter diff --git a/runelite-api/src/main/java/net/runelite/api/VarClientStr.java b/runelite-api/src/main/java/net/runelite/api/VarClientStr.java index 9667c56e74..0831569546 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarClientStr.java +++ b/runelite-api/src/main/java/net/runelite/api/VarClientStr.java @@ -28,7 +28,11 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * An enumeration of string local variables. + * Client side only, content-developer strings + * + * VarCInts are stored entirely in memory, or locally on a user's + * machine in the preferences2.dat file depending on how Jagex + * configured the variable */ @AllArgsConstructor @Getter diff --git a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java index 9ae457c29e..c4d5cb4fdf 100644 --- a/runelite-api/src/main/java/net/runelite/api/VarPlayer.java +++ b/runelite-api/src/main/java/net/runelite/api/VarPlayer.java @@ -28,7 +28,12 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * An enumeration of local player variables. + * Server controlled "content-developer" integers. + * + * VarPlayers are stored per RuneScape player save, and synchronized + * from the server to the client. The client can change them preemptively + * if it thinks they will change the next tick as a lag-hiding measure. + * The client CANNOT directly make the server change a varbit. */ @AllArgsConstructor @Getter diff --git a/runelite-api/src/main/java/net/runelite/api/Varbits.java b/runelite-api/src/main/java/net/runelite/api/Varbits.java index 6d3f8d930a..f156a4a80e 100644 --- a/runelite-api/src/main/java/net/runelite/api/Varbits.java +++ b/runelite-api/src/main/java/net/runelite/api/Varbits.java @@ -28,7 +28,15 @@ import lombok.AllArgsConstructor; import lombok.Getter; /** - * An enumeration of local client variables. + * Server controlled "content-developer" integers. + * + * @see VarPlayer + * + * These differ from a {@link VarPlayer} in that VarBits can be + * less than 32 bits. One or more VarBits can be assigned to a + * backing VarPlayer, each with a static range of bits that it is + * allowed to access. This allows a more compact representation + * of small values, like booleans */ @AllArgsConstructor @Getter diff --git a/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java b/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java index d78269be44..d13b03ea8a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java +++ b/runelite-api/src/main/java/net/runelite/api/events/ScriptCallbackEvent.java @@ -34,11 +34,12 @@ import net.runelite.api.Script; public class ScriptCallbackEvent { /** - * The script being called. + * The script that is currently being executed */ private Script script; + /** - * The name of the event that triggered script execution. + * The name passed to runelite_callback */ private String eventName; } diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java index 82c2c404d4..911befbf27 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarClientIntChanged.java @@ -28,7 +28,7 @@ package net.runelite.api.events; import lombok.Value; /** - * An event where a varbit integer has changed. + * @see net.runelite.api.VarClientInt */ @Value public class VarClientIntChanged diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java index e1d7da6ffa..5a68f5f3f9 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarClientStrChanged.java @@ -28,7 +28,7 @@ package net.runelite.api.events; import lombok.Value; /** - * An event where a varbit string has changed. + * @see net.runelite.api.VarClientStr */ @Value public class VarClientStrChanged diff --git a/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java b/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java index 9680e54ac4..fbac6d5e01 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java +++ b/runelite-api/src/main/java/net/runelite/api/events/VarbitChanged.java @@ -30,6 +30,11 @@ import lombok.Data; /** * An event when a varbit or varplayer has changed. + * + * If the client preemptively changes a varp and the server agrees + * the next tick, VarbitChanged will only be posted when the client + * changes the value, not the server. This can cause unintended effects + * if the VarPlayer has special engine behavior assigned to it. */ @Data public class VarbitChanged diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java index 9662a98ee8..36afd4dc9a 100644 --- a/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetMenuOptionClicked.java @@ -28,7 +28,7 @@ import lombok.Data; import net.runelite.api.widgets.WidgetInfo; /** - * An event where an option has been clicked in a {@link net.runelite.api.widgets.Widget}s menu. + * A MenuManager widget menu was clicked. This event is NOT fired for non-MenuManager menu options */ @Data public class WidgetMenuOptionClicked diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/JavaScriptCallback.java b/runelite-api/src/main/java/net/runelite/api/widgets/JavaScriptCallback.java index 01786beccf..5a505a46b1 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/JavaScriptCallback.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/JavaScriptCallback.java @@ -26,6 +26,10 @@ package net.runelite.api.widgets; import net.runelite.api.ScriptEvent; +/** + * An object that can be set as the first argument to a {@link Widget} listener + * to handle ScriptEvents with Java code, rather than cs2. + */ @FunctionalInterface public interface JavaScriptCallback { From eaeda0b69bd658a1b69a19b6d451385222f8dd51 Mon Sep 17 00:00:00 2001 From: trimbe Date: Sat, 5 Oct 2019 15:48:26 -0400 Subject: [PATCH 19/26] client: add random event plugin --- .../randomevents/RandomEventConfig.java | 156 ++++++++++++ .../randomevents/RandomEventPlugin.java | 227 ++++++++++++++++++ 2 files changed, 383 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventConfig.java new file mode 100644 index 0000000000..5d5abf8dca --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventConfig.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2018, trimbe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 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 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * 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 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.client.plugins.randomevents; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("randomevents") +public interface RandomEventConfig extends Config +{ + @ConfigItem( + keyName = "removeMenuOptions", + name = "Remove others' menu options", + description = "Remove menu options from random events for other players.", + position = 0 + ) + default boolean removeMenuOptions() + { + return true; + } + + @ConfigItem( + keyName = "notifyDunce", + name = "Notify on Surprise Exam", + description = "", + position = 1 + ) + default boolean notifyDunce() + { + return false; + } + + @ConfigItem( + keyName = "notifyGenie", + name = "Notify on Genie", + description = "", + position = 2 + ) + default boolean notifyGenie() + { + return false; + } + + @ConfigItem( + keyName = "notifyDemon", + name = "Notify on Drill Demon", + description = "", + position = 3 + ) + default boolean notifyDemon() + { + return false; + } + + @ConfigItem( + keyName = "notifyForester", + name = "Notify on Freaky Forester", + description = "", + position = 4 + ) + default boolean notifyForester() + { + return false; + } + + @ConfigItem( + keyName = "notifyFrog", + name = "Notify on Kiss the Frog", + description = "", + position = 5 + ) + default boolean notifyFrog() + { + return false; + } + + @ConfigItem( + keyName = "notifyGravedigger", + name = "Notify on Gravedigger", + description = "", + position = 6 + ) + default boolean notifyGravedigger() + { + return false; + } + + @ConfigItem( + keyName = "notifyMoM", + name = "Notify on Mysterious Old Man", + description = "", + position = 7 + ) + default boolean notifyMoM() + { + return false; + } + + @ConfigItem( + keyName = "notifyBob", + name = "Notify on Evil Bob", + description = "", + position = 8 + ) + default boolean notifyBob() + { + return false; + } + + @ConfigItem( + keyName = "notifyQuiz", + name = "Notify on Quiz Master", + description = "", + position = 9 + ) + default boolean notifyQuiz() + { + return false; + } + + @ConfigItem( + keyName = "notifyAll", + name = "Notify for all events", + description = "", + position = 10 + ) + default boolean notifyAllEvents() + { + return false; + } +} + diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java new file mode 100644 index 0000000000..9c9c75b778 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/randomevents/RandomEventPlugin.java @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2018, trimbe + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * 1. Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * 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 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * 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 + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +package net.runelite.client.plugins.randomevents; + +import com.google.common.collect.ImmutableSet; +import com.google.inject.Provides; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import java.util.Set; +import javax.inject.Inject; +import net.runelite.api.Actor; +import net.runelite.api.Client; +import net.runelite.api.MenuAction; +import net.runelite.api.NPC; +import net.runelite.api.NpcID; +import net.runelite.api.Player; +import net.runelite.api.events.GameTick; +import net.runelite.api.events.InteractingChanged; +import net.runelite.api.events.MenuEntryAdded; +import net.runelite.api.events.NpcSpawned; +import net.runelite.client.Notifier; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; + +@PluginDescriptor( + name = "Random Events", + description = "Notify when random events appear and remove talk/dismiss options on events that aren't yours.", + enabledByDefault = false +) +public class RandomEventPlugin extends Plugin +{ + private static final Set EVENT_NPCS = ImmutableSet.of( + NpcID.DR_JEKYLL, NpcID.DR_JEKYLL_314, + NpcID.BEE_KEEPER_6747, + NpcID.CAPT_ARNAV, + NpcID.SERGEANT_DAMIEN_6743, + NpcID.DRUNKEN_DWARF, + NpcID.FREAKY_FORESTER_6748, + NpcID.GENIE, NpcID.GENIE_327, + NpcID.EVIL_BOB, NpcID.EVIL_BOB_6754, + NpcID.POSTIE_PETE_6738, + NpcID.LEO_6746, + NpcID.MYSTERIOUS_OLD_MAN_6750, NpcID.MYSTERIOUS_OLD_MAN_6751, + NpcID.MYSTERIOUS_OLD_MAN_6752, NpcID.MYSTERIOUS_OLD_MAN_6753, + NpcID.PILLORY_GUARD, + NpcID.FLIPPA_6744, + NpcID.QUIZ_MASTER_6755, + NpcID.RICK_TURPENTINE, NpcID.RICK_TURPENTINE_376, + NpcID.SANDWICH_LADY, + NpcID.DUNCE_6749, + NpcID.NILES, NpcID.NILES_5439, + NpcID.MILES, NpcID.MILES_5440, + NpcID.GILES, NpcID.GILES_5441, + NpcID.FROG_5429 + ); + private static final Set EVENT_OPTIONS = ImmutableSet.of( + "Talk-to", + "Dismiss" + ); + private static final int RANDOM_EVENT_TIMEOUT = 150; + + private Map spawnedNpcs = new HashMap<>(); + private NPC currentRandomEvent; + // event npcs teleport to you to stay in range, we need to throttle spawns + private int lastEventTick = -RANDOM_EVENT_TIMEOUT; + + @Inject + private Client client; + + @Inject + private Notifier notifier; + + @Inject + private RandomEventConfig config; + + @Provides + RandomEventConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(RandomEventConfig.class); + } + + @Override + protected void shutDown() throws Exception + { + lastEventTick = 0; + currentRandomEvent = null; + spawnedNpcs.clear(); + } + + @Subscribe + public void onNpcSpawned(NpcSpawned event) + { + NPC npc = event.getNpc(); + + if (!EVENT_NPCS.contains(npc.getId())) + { + return; + } + + // only occasionally do event npcs spawn with non-null interacting + if (npc.getInteracting() == client.getLocalPlayer()) + { + if (client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT) + { + currentRandomEvent = npc; + lastEventTick = client.getTickCount(); + } + } + else + { + spawnedNpcs.put(npc, client.getTickCount()); + } + } + + @Subscribe + public void onInteractingChanged(InteractingChanged event) + { + Actor source = event.getSource(); + Actor target = event.getTarget(); + + if (spawnedNpcs.containsKey(source)) + { + Player player = client.getLocalPlayer(); + if (player == target && client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT) + { + currentRandomEvent = (NPC) source; + if (shouldNotify(currentRandomEvent.getId())) + { + notifier.notify("Random event spawned: " + currentRandomEvent.getName()); + } + } + } + } + + @Subscribe + public void onGameTick(GameTick event) + { + if (!spawnedNpcs.isEmpty()) + { + // allow 2 ticks for interacting to get set + spawnedNpcs.entrySet().removeIf(entry -> client.getTickCount() - entry.getValue() >= 2); + } + + if (client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT) + { + currentRandomEvent = null; + } + } + + @Subscribe + public void onMenuEntryAdded(MenuEntryAdded event) + { + if (event.getType() >= MenuAction.NPC_FIRST_OPTION.getId() + && event.getType() <= MenuAction.NPC_FIFTH_OPTION.getId() + && EVENT_OPTIONS.contains(event.getOption())) + { + NPC npc = client.getCachedNPCs()[event.getIdentifier()]; + if (npc != null && EVENT_NPCS.contains(npc.getId()) && npc != currentRandomEvent && config.removeMenuOptions()) + { + client.setMenuEntries(Arrays.copyOf(client.getMenuEntries(), client.getMenuEntries().length - 1)); + } + } + } + + private boolean shouldNotify(int id) + { + if (config.notifyAllEvents()) + { + return true; + } + + switch (id) + { + case NpcID.SERGEANT_DAMIEN_6743: + return config.notifyDemon(); + case NpcID.FREAKY_FORESTER_6748: + return config.notifyForester(); + case NpcID.FROG_5429: + return config.notifyFrog(); + case NpcID.GENIE: + case NpcID.GENIE_327: + return config.notifyGenie(); + case NpcID.EVIL_BOB: + case NpcID.EVIL_BOB_6754: + return config.notifyBob(); + case NpcID.LEO_6746: + return config.notifyGravedigger(); + case NpcID.MYSTERIOUS_OLD_MAN_6750: + case NpcID.MYSTERIOUS_OLD_MAN_6751: + case NpcID.MYSTERIOUS_OLD_MAN_6752: + case NpcID.MYSTERIOUS_OLD_MAN_6753: + return config.notifyMoM(); + case NpcID.QUIZ_MASTER_6755: + return config.notifyQuiz(); + case NpcID.DUNCE_6749: + return config.notifyDunce(); + default: + return false; + } + } +} From 846c1155030462ce183c0c7cdfc3ef207495121a Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 17 Oct 2019 10:32:58 +0000 Subject: [PATCH 20/26] Update Item IDs to 2019-10-17-rev182 --- .../main/java/net/runelite/api/ItemID.java | 28 ++++++++++++------- .../java/net/runelite/api/NullItemID.java | 7 +++-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index 2d6ea1e91e..64547c8d49 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -8080,16 +8080,17 @@ public final class ItemID public static final int BIRD_SNARE_PACK = 12740; public static final int BOX_TRAP_PACK = 12742; public static final int MAGIC_IMP_BOX_PACK = 12744; - public static final int MYSTERIOUS_EMBLEM = 12746; - public static final int MYSTERIOUS_EMBLEM_TIER_2 = 12748; - public static final int MYSTERIOUS_EMBLEM_TIER_3 = 12749; - public static final int MYSTERIOUS_EMBLEM_TIER_4 = 12750; - public static final int MYSTERIOUS_EMBLEM_TIER_5 = 12751; - public static final int MYSTERIOUS_EMBLEM_TIER_6 = 12752; - public static final int MYSTERIOUS_EMBLEM_TIER_7 = 12753; - public static final int MYSTERIOUS_EMBLEM_TIER_8 = 12754; - public static final int MYSTERIOUS_EMBLEM_TIER_9 = 12755; - public static final int MYSTERIOUS_EMBLEM_TIER_10 = 12756; + public static final int ARCHAIC_EMBLEM_TIER_1 = 12746; + public static final int ARCHAIC_EMBLEM_TIER_1_12747 = 12747; + public static final int ARCHAIC_EMBLEM_TIER_2 = 12748; + public static final int ARCHAIC_EMBLEM_TIER_3 = 12749; + public static final int ARCHAIC_EMBLEM_TIER_4 = 12750; + public static final int ARCHAIC_EMBLEM_TIER_5 = 12751; + public static final int ARCHAIC_EMBLEM_TIER_6 = 12752; + public static final int ARCHAIC_EMBLEM_TIER_7 = 12753; + public static final int ARCHAIC_EMBLEM_TIER_8 = 12754; + public static final int ARCHAIC_EMBLEM_TIER_9 = 12755; + public static final int ARCHAIC_EMBLEM_TIER_10 = 12756; public static final int BLUE_DARK_BOW_PAINT = 12757; public static final int GREEN_DARK_BOW_PAINT = 12759; public static final int YELLOW_DARK_BOW_PAINT = 12761; @@ -10860,6 +10861,7 @@ public final class ItemID public static final int HEALER_ICON_23484 = 23484; public static final int HEALER_ICON_23485 = 23485; public static final int HEALER_ICON_23486 = 23486; + public static final int ARCHAIC_EMBLEM_TIER_10_23487 = 23487; public static final int WINE_OF_ZAMORAK_23489 = 23489; public static final int LARRANS_KEY = 23490; public static final int SRARACHA = 23495; @@ -11283,5 +11285,11 @@ public final class ItemID public static final int BASILISK_JAW = 24268; public static final int NEITIZNOT_FACEGUARD = 24271; public static final int BASILISK_KNIGHT = 24276; + public static final int MYSTERIOUS_EMBLEM_TIER_1 = 24277; + public static final int MYSTERIOUS_EMBLEM_TIER_2 = 24279; + public static final int MYSTERIOUS_EMBLEM_TIER_3 = 24281; + public static final int MYSTERIOUS_EMBLEM_TIER_4 = 24283; + public static final int MYSTERIOUS_EMBLEM_TIER_5 = 24285; + public static final int DECORATIVE_EMBLEM = 24287; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index 6216678f1b..28ddf86d69 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -4551,7 +4551,6 @@ public final class NullItemID public static final int NULL_12741 = 12741; public static final int NULL_12743 = 12743; public static final int NULL_12745 = 12745; - public static final int NULL_12747 = 12747; public static final int NULL_12758 = 12758; public static final int NULL_12760 = 12760; public static final int NULL_12762 = 12762; @@ -12416,7 +12415,6 @@ public final class NullItemID public static final int NULL_23456 = 23456; public static final int NULL_23457 = 23457; public static final int NULL_23459 = 23459; - public static final int NULL_23487 = 23487; public static final int NULL_23488 = 23488; public static final int NULL_23491 = 23491; public static final int NULL_23492 = 23492; @@ -12783,5 +12781,10 @@ public final class NullItemID public static final int NULL_24273 = 24273; public static final int NULL_24274 = 24274; public static final int NULL_24275 = 24275; + public static final int NULL_24278 = 24278; + public static final int NULL_24280 = 24280; + public static final int NULL_24282 = 24282; + public static final int NULL_24284 = 24284; + public static final int NULL_24286 = 24286; /* This file is automatically generated. Do not edit. */ } From 7ea44dd0d11520629a22893b1a1763b78648e17b Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 17 Oct 2019 10:32:58 +0000 Subject: [PATCH 21/26] Update Item variations to 2019-10-17-rev182 --- .../src/main/resources/item_variations.json | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/resources/item_variations.json b/runelite-client/src/main/resources/item_variations.json index d136d609c9..59493b2e79 100644 --- a/runelite-client/src/main/resources/item_variations.json +++ b/runelite-client/src/main/resources/item_variations.json @@ -8007,8 +8007,9 @@ 12725, 12726 ], - "mysterious emblem": [ + "archaic emblem": [ 12746, + 12747, 12748, 12749, 12750, @@ -8017,7 +8018,8 @@ 12753, 12754, 12755, - 12756 + 12756, + 23487 ], "rune pouch": [ 12791, @@ -9596,5 +9598,12 @@ "vs shield": [ 24265, 24266 + ], + "mysterious emblem": [ + 24277, + 24279, + 24281, + 24283, + 24285 ] } \ No newline at end of file From c9dc881e4929987ab46e8ab0d317a133c08d6872 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 17 Oct 2019 10:32:59 +0000 Subject: [PATCH 22/26] Update Object IDs to 2019-10-17-rev182 --- runelite-api/src/main/java/net/runelite/api/ObjectID.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index 6f56b79523..33a53e5f75 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -19383,5 +19383,6 @@ public final class ObjectID public static final int DOOR_37422 = 37422; public static final int THE_JORMUNGAND = 37424; public static final int ROUGH_WALL_37431 = 37431; + public static final int STREAK_INFO = 37434; /* This file is automatically generated. Do not edit. */ } From 6bb868cf1bc8e438ba93b4fd4365c6e564bd2ab9 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 17 Oct 2019 10:32:59 +0000 Subject: [PATCH 23/26] Update NPC IDs to 2019-10-17-rev182 --- runelite-api/src/main/java/net/runelite/api/NpcID.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index e9ee7b41e9..66e02eea3a 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -286,7 +286,6 @@ public final class NpcID public static final int DWARF = 290; public static final int CHAOS_DWARF = 291; public static final int DWARF_292 = 292; - public static final int DWARF_293 = 293; public static final int DWARF_294 = 294; public static final int DWARF_295 = 295; public static final int DWARF_296 = 296; @@ -301,14 +300,13 @@ public final class NpcID public static final int JENNIFER = 305; public static final int LUMBRIDGE_GUIDE = 306; public static final int DR_JEKYLL = 307; + public static final int EMBLEM_TRADER = 308; public static final int REACHER = 309; public static final int AYESHA = 310; public static final int ADAM = 311; public static final int FROG = 312; public static final int REACHER_313 = 313; public static final int DR_JEKYLL_314 = 314; - public static final int EMBLEM_TRADER = 315; - public static final int EMBLEM_TRADER_316 = 316; public static final int PAUL = 317; public static final int DARK_CORE = 318; public static final int CORPOREAL_BEAST = 319; @@ -7161,8 +7159,7 @@ public final class NpcID public static final int REVENANT_DARK_BEAST = 7938; public static final int REVENANT_KNIGHT = 7939; public static final int REVENANT_DRAGON = 7940; - public static final int EMBLEM_TRADER_7941 = 7941; - public static final int EMBLEM_TRADER_7942 = 7942; + public static final int EMBLEM_TRADER_7943 = 7943; public static final int FISHING_SPOT_7946 = 7946; public static final int FISHING_SPOT_7947 = 7947; public static final int CORSAIR_TRAITOR_HARD = 7948; From a0eedbe39f1e402ec4f4eef3b3ccd1f007ce9481 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 17 Oct 2019 10:33:04 +0000 Subject: [PATCH 24/26] Update Widget IDs to 2019-10-17-rev182 --- .../main/java/net/runelite/api/widgets/WidgetID.java | 10 +++++----- .../net/runelite/client/ui/overlay/WidgetOverlay.java | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 349d29721b..ea51c91626 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -735,11 +735,11 @@ public class WidgetID static class Pvp { - static final int BOUNTY_HUNTER_INFO = 18; - static final int KILLDEATH_RATIO = 15; - static final int SKULL_CONTAINER = 61; - static final int SAFE_ZONE = 63; - static final int WILDERNESS_LEVEL = 66; // this can also be the Deadman Mode "Protection" text + static final int BOUNTY_HUNTER_INFO = 6; + static final int KILLDEATH_RATIO = 33; + static final int SKULL_CONTAINER = 53; + static final int SAFE_ZONE = 55; + static final int WILDERNESS_LEVEL = 57; // this can also be the Deadman Mode "Protection" text } static class KourendFavour diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java index 87a4de12ac..17b43ce3d7 100644 --- a/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/WidgetOverlay.java @@ -50,7 +50,6 @@ public class WidgetOverlay extends Overlay .put(WidgetInfo.PEST_CONTROL_INFO, OverlayPosition.TOP_LEFT) .put(WidgetInfo.ZEAH_MESS_HALL_COOKING_DISPLAY, OverlayPosition.TOP_LEFT) .put(WidgetInfo.PVP_BOUNTY_HUNTER_INFO, OverlayPosition.TOP_RIGHT) - .put(WidgetInfo.PVP_KILLDEATH_COUNTER, OverlayPosition.TOP_LEFT) .put(WidgetInfo.SKOTIZO_CONTAINER, OverlayPosition.TOP_LEFT) .put(WidgetInfo.KOUREND_FAVOUR_OVERLAY, OverlayPosition.TOP_CENTER) .put(WidgetInfo.PYRAMID_PLUNDER_DATA, OverlayPosition.TOP_CENTER) From a924773edc7c36dded1e930f077bdbe52070aa7e Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 17 Oct 2019 13:40:53 +0000 Subject: [PATCH 25/26] [maven-release-plugin] prepare release runelite-parent-1.5.36 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 9e2da34d4c..419c01e9b3 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index c8c34e2059..924b12636e 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index e82ec87614..2035202d99 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index a0b31501c9..c0aa19736b 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 05b3b911f7..9ca27245dd 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 Web Service diff --git a/pom.xml b/pom.xml index 90b3bd9b60..23bd0b02b2 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.36 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 469eeffed9..587630ce8c 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index d548031afa..efcd793008 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 99f1450e45..98e46dfb2c 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index a87e7f816b..fe92c579df 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index da0cc3fc3e..4a0e904bd0 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36-SNAPSHOT + 1.5.36 script-assembler-plugin From 38e3cd1ed3ae6c2157941162b4c971318aa53724 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 17 Oct 2019 13:40:59 +0000 Subject: [PATCH 26/26] [maven-release-plugin] prepare for next development iteration --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- 11 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index 419c01e9b3..6a683c0e03 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 924b12636e..ca731fa5a2 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 2035202d99..95fcd5d703 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index c0aa19736b..3e232bdfa2 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 9ca27245dd..16b8e5144e 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index 23bd0b02b2..916d842e82 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.36 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 587630ce8c..c10f81c453 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index efcd793008..b687358a57 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 98e46dfb2c..021c41e297 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index fe92c579df..a35b5065da 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT client diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index 4a0e904bd0..e6219a3749 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.36 + 1.5.37-SNAPSHOT script-assembler-plugin