aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-01-12 15:35:11 +0100
committerLinnea Gräf <nea@nea.moe>2025-01-12 15:35:11 +0100
commitaa7e2571afa328a688805ce983da32f10722a6c0 (patch)
treecb454768d3f45395149053bae944bc7d4035e8cd
parentdb269a6bfb53755efe9b12e0d4e1152adba5ad5b (diff)
downloadFirmament-aa7e2571afa328a688805ce983da32f10722a6c0.tar.gz
Firmament-aa7e2571afa328a688805ce983da32f10722a6c0.tar.bz2
Firmament-aa7e2571afa328a688805ce983da32f10722a6c0.zip
fix: Resync pickaxe cooldowns from more sources
-rw-r--r--src/main/kotlin/features/mining/PickaxeAbility.kt12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/kotlin/features/mining/PickaxeAbility.kt b/src/main/kotlin/features/mining/PickaxeAbility.kt
index 94b49f9..1737969 100644
--- a/src/main/kotlin/features/mining/PickaxeAbility.kt
+++ b/src/main/kotlin/features/mining/PickaxeAbility.kt
@@ -156,10 +156,21 @@ object PickaxeAbility : FirmamentFeature {
fun onChatMessage(it: ProcessChatEvent) {
abilityUsePattern.useMatch(it.unformattedString) {
lastUsage[group("name")] = TimeMark.now()
+ abilityOverride = group("name")
}
abilitySwitchPattern.useMatch(it.unformattedString) {
abilityOverride = group("ability")
}
+ pickaxeAbilityCooldownPattern.useMatch(it.unformattedString) {
+ val ability = abilityOverride ?: return@useMatch
+ val remainingCooldown = parseTimePattern(group("remainingCooldown"))
+ val length = defaultAbilityDurations[ability] ?: return@useMatch
+ lastUsage[ability] = TimeMark.ago(length - remainingCooldown)
+ }
+ nowAvailable.useMatch(it.unformattedString) {
+ val ability = group("name")
+ lastUsage[ability] = TimeMark.farPast()
+ }
}
@Subscribe
@@ -179,6 +190,7 @@ object PickaxeAbility : FirmamentFeature {
val fuelPattern = Pattern.compile("Fuel: .*/(?<maxFuel>$SHORT_NUMBER_FORMAT)")
val pickaxeAbilityCooldownPattern =
Pattern.compile("Your pickaxe ability is on cooldown for (?<remainingCooldown>$TIME_PATTERN)\\.")
+ val nowAvailable = Pattern.compile("(?<name>[a-zA-Z0-9 ]+) is now available!")
data class PickaxeAbilityData(
val name: String,