From cc454c394f44f3dd1029ed7943e043cbe569ae0f Mon Sep 17 00:00:00 2001 From: GrowlingGrizzly <52770460+GrowlingGrizzly@users.noreply.github.com> Date: Tue, 30 Apr 2024 00:34:47 -0400 Subject: Add bz stack multi to individual gemstone purities (#1126) --- .../notenoughupdates/ItemPriceInformation.java | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index 9a43db0b..705db3fe 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -61,6 +61,9 @@ public class ItemPriceInformation { private static final Pattern SACK_STORED_AMOUNT = Pattern.compile( ".*Stored: §.(?[\\d,]+)§.\\/.*"); + private static final Pattern GEMSTONE_STORED_AMOUNT = Pattern.compile( + ".*Amount: §.(?[\\d,]+)"); + private static final Pattern COMPOSTER_STORED_AMOUNT = Pattern.compile( ".*Compost Available: §.(?[\\d,]+)"); @@ -138,8 +141,10 @@ public class ItemPriceInformation { shiftStackMultiplier = stack.getTagCompound().getInteger(STACKSIZE_OVERRIDE); } int stackMultiplier = 1; + boolean foundMulti = false; for (int i = 1; i < tooltip.size(); i++) { - for (Pattern pattern : new Pattern[]{SACK_STORED_AMOUNT, COMPOSTER_STORED_AMOUNT}) { + if (foundMulti) break; + for (Pattern pattern : new Pattern[]{SACK_STORED_AMOUNT, GEMSTONE_STORED_AMOUNT, COMPOSTER_STORED_AMOUNT}) { val matcher = pattern.matcher(tooltip.get(i)); if (matcher.matches()) { String amountString = matcher.group("amount").replace(",", ""); @@ -147,6 +152,7 @@ public class ItemPriceInformation { int parsedValue = Integer.parseInt(amountString); if (parsedValue != 0) { shiftStackMultiplier = parsedValue; + foundMulti = true; } } catch (NumberFormatException e) { e.printStackTrace(); @@ -232,7 +238,7 @@ public class ItemPriceInformation { tooltip.add(""); added = true; } - + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Insta-Buys (Hourly): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + @@ -245,7 +251,7 @@ public class ItemPriceInformation { tooltip.add(""); added = true; } - + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Insta-Sells (Hourly): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + @@ -258,7 +264,7 @@ public class ItemPriceInformation { tooltip.add(""); added = true; } - + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Insta-Buys (Daily): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + @@ -271,7 +277,7 @@ public class ItemPriceInformation { tooltip.add(""); added = true; } - + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Insta-Sells (Daily): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + @@ -284,7 +290,7 @@ public class ItemPriceInformation { tooltip.add(""); added = true; } - + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Insta-Buys (Weekly): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + @@ -297,7 +303,7 @@ public class ItemPriceInformation { tooltip.add(""); added = true; } - + tooltip.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "Insta-Sells (Weekly): " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + -- cgit