From aa7e2571afa328a688805ce983da32f10722a6c0 Mon Sep 17 00:00:00 2001 From: Linnea Gräf Date: Sun, 12 Jan 2025 15:35:11 +0100 Subject: fix: Resync pickaxe cooldowns from more sources --- src/main/kotlin/features/mining/PickaxeAbility.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main/kotlin') 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: .*/(?$SHORT_NUMBER_FORMAT)") val pickaxeAbilityCooldownPattern = Pattern.compile("Your pickaxe ability is on cooldown for (?$TIME_PATTERN)\\.") + val nowAvailable = Pattern.compile("(?[a-zA-Z0-9 ]+) is now available!") data class PickaxeAbilityData( val name: String, -- cgit