aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-01-21 21:04:45 +0100
committerLinnea Gräf <nea@nea.moe>2024-01-21 21:04:45 +0100
commit25f9d15716d8afa6ec1d7b58f2e80f0561388a75 (patch)
tree145af137cf4975ced68fff9238f5f93de86ab503
parent3710093b9d386e4f161ba2539c888cab27544928 (diff)
downloadNotEnoughUpdates-25f9d15716d8afa6ec1d7b58f2e80f0561388a75.tar.gz
NotEnoughUpdates-25f9d15716d8afa6ec1d7b58f2e80f0561388a75.tar.bz2
NotEnoughUpdates-25f9d15716d8afa6ec1d7b58f2e80f0561388a75.zip
Fix RNG Meter Progress
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
index 7c10b86e..d2e647b9 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipRngListener.java
@@ -40,6 +40,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -55,8 +56,9 @@ public class ItemTooltipRngListener {
private final Pattern ODDS_PATTERN = Pattern.compile("§5§o§7Odds: (.+) §7\\(§7(.*)%\\)");
private final Pattern ODDS_SELECTED_PATTERN = Pattern.compile("§5§o§7Odds: (.+) §7\\(§8§m(.*)%§r §7(.+)%\\)");
- private final Pattern RUNS_PATTERN = Pattern.compile("§5§o§7(Dungeon Score|Slayer XP): §d(.*)§5/§d(.+)");
- private final Pattern RUNS_SELECTED_PATTERN = Pattern.compile("§5§o§d-(.+)- §d(.*)§5/§d(.+)");
+ private final Pattern RUNS_PATTERN = Pattern.compile("§5§o§7(?:Dungeon Score|Slayer XP): §d(.*)§5/§d(.+)");
+ private final Pattern RUNS_SELECTED_PATTERN = Pattern.compile(
+ "(?:§5§o)?§d§l§m *§f§l§m *§r §d([1-9,]+)§5/§d([0-9kKmM,.]+)");
private final Pattern SLAYER_INVENTORY_TITLE_PATTERN = Pattern.compile("(.+) RNG Meter");
@@ -73,7 +75,9 @@ public class ItemTooltipRngListener {
public void onItemTooltip(ItemTooltipEvent event) {
if (!neu.isOnSkyblock()) return;
if (event.toolTip == null) return;
- if (!Utils.getOpenChestName().endsWith(" RNG Meter") && !slayerData.containsKey(Utils.getOpenChestName())) return;
+ if (!Utils.getOpenChestName().endsWith(" RNG Meter")
+ && !slayerData.containsKey(Utils.getOpenChestName())
+ && !ItemUtils.getLore(event.itemStack).contains("§dRNG Meter")) return;
List<String> newToolTip = new ArrayList<>();
@@ -100,14 +104,14 @@ public class ItemTooltipRngListener {
if (m != null) {
int having;
try {
- having = Calculator.calculate(m.group(2).replace(",", "")).intValue();
+ having = Calculator.calculate(m.group(1).replace(",", "").toLowerCase(Locale.ROOT)).intValue();
} catch (Calculator.CalculatorException e) {
having = -1;
}
int needed;
try {
- needed = Calculator.calculate(m.group(3).replace(",", "")).intValue();
+ needed = Calculator.calculate(m.group(2).replace(",", "").toLowerCase(Locale.ROOT)).intValue();
} catch (Calculator.CalculatorException e) {
needed = -1;
}
@@ -140,7 +144,14 @@ public class ItemTooltipRngListener {
event.toolTip.addAll(newToolTip);
}
- private String getFormatCoinsPer(ItemStack stack, int needed, int multiplier, int amountPerTier, int cost, String label) {
+ private String getFormatCoinsPer(
+ ItemStack stack,
+ int needed,
+ int multiplier,
+ int amountPerTier,
+ int cost,
+ String label
+ ) {
String internalName = neu.manager.createItemResolutionQuery().withItemStack(stack).resolveInternalName();
double profit = neu.manager.auctionManager.getBazaarOrBin(internalName, false) * amountPerTier;
if (profit <= 0) return null;
@@ -227,7 +238,6 @@ public class ItemTooltipRngListener {
return;
}
-
List<Integer> defaultSlayerExp = new ArrayList<>();
for (JsonElement element : leveling.get("slayer_boss_xp").getAsJsonArray()) {
defaultSlayerExp.add(element.getAsInt());