aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java41
1 files changed, 21 insertions, 20 deletions
diff --git a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java
index e6ea19a..30f14fa 100644
--- a/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java
+++ b/src/main/java/com/thatgravyboat/skyblockhud/playerstats/ActionBarParsing.java
@@ -19,22 +19,22 @@ public class ActionBarParsing {
public static String lastLowActionBar = "";
private static IChatComponent lastLowEditedActionBar = null; //\u1750
- private static final Pattern HealthRegex = Pattern.compile("(([0-9](,[0-9])*)+)/(([0-9](,[0-9])*)+)\u2764");
- // private static final Pattern HealingRegex = Pattern.compile("\\+(([0-9](,[0-9])*)+)[\u2586\u2585\u2584\u2583\u2582\u2581]");
- private static final Pattern DefenseRegex = Pattern.compile("(([0-9](,[0-9])*)+)\u2748 Defense");
- private static final Pattern ManaRegex = Pattern.compile("(([0-9](,[0-9])*)+)/(([0-9](,[0-9])*)+)\u270E Mana");
- private static final Pattern ManaOverflowRegex = Pattern.compile("(([0-9](,[0-9])*)+)/(([0-9](,[0-9])*)+)\u270E (([0-9](,[0-9])*)+)\u02AC");
- private static final Pattern ManaDecreaseRegex = Pattern.compile("-(([0-9](,[0-9])*)+) Mana \\(");
+ private static final Pattern HealthRegex = Pattern.compile("([0-9]+)/([0-9]+)\u2764");
+ // private static final Pattern HealingRegex = Pattern.compile("\\+([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]");
+ private static final Pattern DefenseRegex = Pattern.compile("([0-9]+)\u2748 Defense");
+ private static final Pattern ManaRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E Mana");
+ private static final Pattern ManaOverflowRegex = Pattern.compile("([0-9]+)/([0-9]+)\u270E ([0-9]+)\u02AC");
+ private static final Pattern ManaDecreaseRegex = Pattern.compile("-([0-9]+) Mana \\(");
private static final Pattern DrillFuelRegex = Pattern.compile("([0-9,]+)/([0-9,]+k) Drill Fuel");
private static final Pattern XpGainRegex = Pattern.compile("\\+(\\d*\\.?\\d*) (Farming|Mining|Combat|Foraging|Fishing|Enchanting|Alchemy|Carpentry|Runecrafting|Social) \\((\\d*\\.?\\d*)%\\)");
- // private static final Pattern DominusRegex = Pattern.compile("(([0-9](,[0-9])*)+)\u1750");
+ // private static final Pattern DominusRegex = Pattern.compile("([0-9]+)\u1750");
- private static final Pattern HealthReplaceRegex = Pattern.compile("\u00A7c(([0-9](,[0-9])*)+)/(([0-9](,[0-9])*)+)\u2764");
- // private static final Pattern HealingReplaceRegex = Pattern.compile("\\+\u00A7c(([0-9](,[0-9])*)+)[\u2586\u2585\u2584\u2583\u2582\u2581]");
- private static final Pattern HealthAbsorptionReplaceRegex = Pattern.compile("\u00A76(([0-9](,[0-9])*)+)/(([0-9](,[0-9])*)+)\u2764");
- private static final Pattern DefenseReplaceRegex = Pattern.compile("\u00A7a(([0-9](,[0-9])*)+)\u00A7a\u2748 Defense");
- private static final Pattern ManaReplaceRegex = Pattern.compile("\u00A7b(([0-9](,[0-9])*)+)/(([0-9](,[0-9])*)+)\u270E Mana");
- private static final Pattern ManaOverflowReplaceRegex = Pattern.compile("\u00A7b(([0-9](,[0-9])*)+)/(([0-9](,[0-9])*)+)\u270E \u00A73(([0-9](,[0-9])*)+)\u02AC");
+ private static final Pattern HealthReplaceRegex = Pattern.compile("\u00A7c([0-9]+)/([0-9]+)\u2764");
+ // private static final Pattern HealingReplaceRegex = Pattern.compile("\\+\u00A7c([0-9]+)[\u2586\u2585\u2584\u2583\u2582\u2581]");
+ private static final Pattern HealthAbsorptionReplaceRegex = Pattern.compile("\u00A76([0-9]+)/([0-9]+)\u2764");
+ private static final Pattern DefenseReplaceRegex = Pattern.compile("\u00A7a([0-9]+)\u00A7a\u2748 Defense");
+ private static final Pattern ManaReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E Mana");
+ private static final Pattern ManaOverflowReplaceRegex = Pattern.compile("\u00A7b([0-9]+)/([0-9]+)\u270E \u00A73([0-9]+)\u02AC");
private static final Pattern DrillFuelReplaceRegex = Pattern.compile("\u00A72([0-9,]+)/([0-9,]+k) Drill Fuel");
private static int ticksSinceLastPrediction = 0;
@@ -62,7 +62,7 @@ public class ActionBarParsing {
Matcher DrillFuelMatcher = DrillFuelRegex.matcher(bar);
if (DrillFuelMatcher.find()) {
try {
- MiningHud.setFuel(Integer.parseInt(DrillFuelMatcher.group(1).replace(",", "")), Integer.parseInt(DrillFuelMatcher.group(2).replace("k", "")) * 1000);
+ MiningHud.setFuel(Integer.parseInt(DrillFuelMatcher.group(1)), Integer.parseInt(DrillFuelMatcher.group(2).replace("k", "")) * 1000);
} catch (Exception ignored) {
MiningHud.setFuel(0, 0);
}
@@ -101,6 +101,7 @@ public class ActionBarParsing {
if (!lastActionBar.equals(input)) {
lastActionBar = input;
String bar = Utils.removeColor(input);
+ bar = bar.replaceAll(",", "");
Matcher HealthMatcher = HealthRegex.matcher(bar);
Matcher DefenseMatcher = DefenseRegex.matcher(bar);
@@ -120,19 +121,19 @@ public class ActionBarParsing {
if (healthFound) {
try {
- RPGHud.updateHealth(Integer.parseInt(HealthMatcher.group(1).replace(",", "")), Integer.parseInt(HealthMatcher.group(2).replace(",", "")));
+ RPGHud.updateHealth(Integer.parseInt(HealthMatcher.group(1)), Integer.parseInt(HealthMatcher.group(2)));
} catch (Exception ignored) {}
}
if (defenseFound) {
try {
- RPGHud.updateDefense(Integer.parseInt(DefenseMatcher.group(1).replace(",", "")));
+ RPGHud.updateDefense(Integer.parseInt(DefenseMatcher.group(1)));
} catch (Exception ignored) {}
} else if (!xpFound && !manaUseFound) {
RPGHud.updateDefense(0);
}
if (manaFound) {
try {
- RPGHud.updateMana(Integer.parseInt(ManaMatcher.group(1).replace(",", "")), Integer.parseInt(ManaMatcher.group(2).replace(",", "")));
+ RPGHud.updateMana(Integer.parseInt(ManaMatcher.group(1)), Integer.parseInt(ManaMatcher.group(2)));
} catch (Exception ignored) {}
}
// if (dominusFound) {
@@ -141,14 +142,14 @@ public class ActionBarParsing {
// }
if (!manaFound && manaOverflowFound) {
try {
- RPGHud.updateMana(Integer.parseInt(ManaOverflowMatcher.group(1).replace(",", "")), Integer.parseInt(ManaOverflowMatcher.group(2).replace(",", "")));
- RPGHud.updateOverflow(Integer.parseInt(ManaOverflowMatcher.group(3).replace(",", "")));
+ RPGHud.updateMana(Integer.parseInt(ManaOverflowMatcher.group(1)), Integer.parseInt(ManaOverflowMatcher.group(2)));
+ RPGHud.updateOverflow(Integer.parseInt(ManaOverflowMatcher.group(3)));
} catch (Exception ignored) {}
}
if (!manaFound) {
if (manaUseFound) {
try {
- RPGHud.manaPredictionUpdate(false, Integer.parseInt(ManaUseMatcher.group(1).replace(",", "")));
+ RPGHud.manaPredictionUpdate(false, Integer.parseInt(ManaUseMatcher.group(1)));
} catch (Exception ignored) {}
}
RPGHud.manaPredictionUpdate(true, 0);