aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2024-07-12 00:43:06 +1000
committerGitHub <noreply@github.com>2024-07-11 16:43:06 +0200
commit98f4f6140ab8371f1fd18846f5489318af2b2252 (patch)
tree7f7d514b995303a155ef06cdcaa78a4accc25127
parentd16616fb8b68c5b7aa06254d96f0cd0885d9a329 (diff)
downloadnotenoughupdates-98f4f6140ab8371f1fd18846f5489318af2b2252.tar.gz
notenoughupdates-98f4f6140ab8371f1fd18846f5489318af2b2252.tar.bz2
notenoughupdates-98f4f6140ab8371f1fd18846f5489318af2b2252.zip
meta: Fix god potion todo not working with hours and minutes (#1234)
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java26
1 files changed, 21 insertions, 5 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
index 0067aea1..96260e7f 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java
@@ -86,7 +86,7 @@ public class TimersOverlay extends TextTabOverlay {
"\u00a7r\u00a79\u1805 \u00a7r\u00a7fYou've earned \u00a7r\u00a7d.+ Gemstone Powder \u00a7r\u00a7ffrom mining your first Gemstone of the day!\u00a7r");
private static final Pattern DAILY_SHOP_LIMIT = Pattern.compile(
"\u00a7r\u00a7cYou may only buy up to 6,?400? of this item each day!\u00a7r");
- private static final Pattern GOD_POTION_TIME = Pattern.compile(" God Potion: ([1-5][0-9]|[0-9])([dhms])");
+ private static final Pattern GOD_POTION_TIME = Pattern.compile(" God Potion: ([1-5][0-9]|[0-9])([dhms])(:? ([1-5][0-9]|[0-9])([dhms]))?");
@SubscribeEvent
public void onClickItem(SlotClickEvent event) {
@@ -494,6 +494,8 @@ public class TimersOverlay extends TextTabOverlay {
}
godpotRemainingTime = Integer.parseInt(activeEffectsMatcher.group(i));
godpotRemainingTimeType = activeEffectsMatcher.group(i + 1);
+ godPotDuration +=
+ CookieWarning.getEffectRemainingInMilliseconds(godpotRemainingTimeType, godpotRemainingTime);
}
} catch (Exception e) {
if (!hasErrorMessage) {
@@ -505,12 +507,26 @@ public class TimersOverlay extends TextTabOverlay {
}
} else if (godPotionMatcher.matches()) {
foundGodPotText = true;
- godpotRemainingTime = Integer.parseInt(godPotionMatcher.group(1));
- godpotRemainingTimeType = godPotionMatcher.group(2);
+ try {
+ for (int i = 1; i < godPotionMatcher.groupCount(); i += 2) {
+ if (godPotionMatcher.group(i) == null) {
+ continue;
+ }
+ godpotRemainingTime = Integer.parseInt(godPotionMatcher.group(i));
+ godpotRemainingTimeType = godPotionMatcher.group(i + 1);
+ godPotDuration +=
+ CookieWarning.getEffectRemainingInMilliseconds(godpotRemainingTimeType, godpotRemainingTime);
+ }
+ } catch (Exception e) {
+ if (!hasErrorMessage) {
+ Utils.addChatMessage(EnumChatFormatting.YELLOW + "[NEU] Unable to work out your god pot timer");
+ e.printStackTrace();
+ hasErrorMessage = true;
+ }
+ break;
+ }
}
if (godpotRemainingTimeType != null) {
- godPotDuration +=
- CookieWarning.getEffectRemainingInMilliseconds(godpotRemainingTimeType, godpotRemainingTime);
hidden.godPotionDuration = godPotDuration;
}
}