diff options
author | GrowlingGrizzly <52770460+GrowlingGrizzly@users.noreply.github.com> | 2024-04-30 00:34:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-30 14:34:47 +1000 |
commit | cc454c394f44f3dd1029ed7943e043cbe569ae0f (patch) | |
tree | 55a2a1aa28ef98fa9d36dcba9afba94535c616a1 | |
parent | 369a12a39723d4c1de780e228ee3a2c83b49f28d (diff) | |
download | NotEnoughUpdates-cc454c394f44f3dd1029ed7943e043cbe569ae0f.tar.gz NotEnoughUpdates-cc454c394f44f3dd1029ed7943e043cbe569ae0f.tar.bz2 NotEnoughUpdates-cc454c394f44f3dd1029ed7943e043cbe569ae0f.zip |
Add bz stack multi to individual gemstone purities (#1126)
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java | 20 |
1 files 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: §.(?<amount>[\\d,]+)§.\\/.*"); + private static final Pattern GEMSTONE_STORED_AMOUNT = Pattern.compile( + ".*Amount: §.(?<amount>[\\d,]+)"); + private static final Pattern COMPOSTER_STORED_AMOUNT = Pattern.compile( ".*Compost Available: §.(?<amount>[\\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 + |