fix: Resync pickaxe cooldowns from more sources
This commit is contained in:
@@ -156,10 +156,21 @@ object PickaxeAbility : FirmamentFeature {
|
|||||||
fun onChatMessage(it: ProcessChatEvent) {
|
fun onChatMessage(it: ProcessChatEvent) {
|
||||||
abilityUsePattern.useMatch(it.unformattedString) {
|
abilityUsePattern.useMatch(it.unformattedString) {
|
||||||
lastUsage[group("name")] = TimeMark.now()
|
lastUsage[group("name")] = TimeMark.now()
|
||||||
|
abilityOverride = group("name")
|
||||||
}
|
}
|
||||||
abilitySwitchPattern.useMatch(it.unformattedString) {
|
abilitySwitchPattern.useMatch(it.unformattedString) {
|
||||||
abilityOverride = group("ability")
|
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
|
@Subscribe
|
||||||
@@ -179,6 +190,7 @@ object PickaxeAbility : FirmamentFeature {
|
|||||||
val fuelPattern = Pattern.compile("Fuel: .*/(?<maxFuel>$SHORT_NUMBER_FORMAT)")
|
val fuelPattern = Pattern.compile("Fuel: .*/(?<maxFuel>$SHORT_NUMBER_FORMAT)")
|
||||||
val pickaxeAbilityCooldownPattern =
|
val pickaxeAbilityCooldownPattern =
|
||||||
Pattern.compile("Your pickaxe ability is on cooldown for (?<remainingCooldown>$TIME_PATTERN)\\.")
|
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(
|
data class PickaxeAbilityData(
|
||||||
val name: String,
|
val name: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user