aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java28
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt2
2 files changed, 23 insertions, 7 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
index aefe8ff8..8b12026d 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java
@@ -44,9 +44,11 @@ import org.lwjgl.util.vector.Vector2f;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.function.Supplier;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -230,8 +232,8 @@ public class MiningOverlay extends TextTabOverlay {
"\\xA77Time Remaining: \\xA7a((?<Completed>Completed!)|(((?<days>[0-9]+)d)? ?((?<hours>[0-9]+)h)? ?((?<minutes>[0-9]+)m)? ?((?<seconds>[0-9]+)s)?))");
private static final Pattern timeRemainingTab = Pattern.compile(
".*[1-5]\\) (?<ItemName>.*): ((?<Ready>Ready!)|(((?<days>[0-9]+)d)? ?((?<hours>[0-9]+)h)? ?((?<minutes>[0-9]+)m)? ?((?<seconds>[0-9]+)s)?))");
- private static final Pattern forgesHeaderPattern = Pattern.compile(
- "\\xa7r\\xa79\\xa7lForges \\xa7r(?:\\xa7f\\(\\+1 more\\)\\xa7r)?");
+ private static final Pattern forgeIntPattern = Pattern.compile(
+ "[^)]*([1-5])\\).*");
@Override
public boolean isEnabled() {
@@ -280,8 +282,6 @@ public class MiningOverlay extends TextTabOverlay {
String gemstonePowder = "";
String glacitePowder = "";
- int forgeInt = 0;
-
List<String> powderLines = getTabLinesOrAddWarning(1, TablistAPI.WidgetNames.POWDER);
getTabLinesOrAddWarning(2, TablistAPI.WidgetNames.POWDER);
getTabLinesOrAddWarning(6, TablistAPI.WidgetNames.POWDER);
@@ -300,6 +300,8 @@ public class MiningOverlay extends TextTabOverlay {
List<String> tabForgeLines = getTabLinesOrAddWarning(3, TablistAPI.WidgetNames.FORGE);
+ Set<Integer> foundForges = new HashSet<>();
+
for (String name : tabForgeLines) {
String cleanName = StringUtils.cleanColour(name);
if (cleanName.startsWith(" ") && profileConfig != null) {
@@ -307,7 +309,14 @@ public class MiningOverlay extends TextTabOverlay {
if (firstChar < '0' || firstChar > '9') {
break;
} else {
-
+ int forgeInt;
+ Matcher forgeIntMatcher = forgeIntPattern.matcher(cleanName);
+ if (forgeIntMatcher.matches()) {
+ forgeInt = Integer.parseInt(forgeIntMatcher.group(1)) - 1;
+ foundForges.add(forgeInt);
+ } else {
+ continue;
+ }
if (name.contains("LOCKED")) {
ForgeItem item = new ForgeItem(forgeInt, 1, true);
replaceForgeOrAdd(item, profileConfig.forgeItems, true);
@@ -354,10 +363,17 @@ public class MiningOverlay extends TextTabOverlay {
}
}
}
- forgeInt++;
}
}
}
+
+ if (profileConfig != null)
+ for (int i = 0; i < 5; i++) {
+ if (foundForges.contains(i)) continue;
+ ForgeItem item = new ForgeItem(i, 0, true);
+ replaceForgeOrAdd(item, profileConfig.forgeItems, true);
+ }
+
List<String> tabCommissionLines = getTabLinesOrAddWarning(0, TablistAPI.WidgetNames.COMMISSIONS);
for (String name : tabCommissionLines) {
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt
index 5c493108..7ff2f3a3 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/tablisttutorial/TablistAPI.kt
@@ -124,7 +124,7 @@ object TablistAPI {
COMMISSIONS(null),
SKILLS(null),
TRAPPER(null),
- FORGE(Regex.fromLiteral("Forges:")),
+ FORGE(Regex("Forges:( \\(\\d/\\d\\))?")),
POWDER(Regex.fromLiteral("Powders:")),
PROFILE(Regex("Profile: ([A-Za-z]+)( .*)?"))
;