From 3ef22687c728ac77235c6f48ef55479d909962f5 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 24 Jul 2023 15:30:45 +0200 Subject: Fixed error with detecting hit phase during eman slayer in damage indicator --- .../features/damageindicator/DamageIndicatorManager.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features') diff --git a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt index ece8bb32f..41d30a331 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/damageindicator/DamageIndicatorManager.kt @@ -623,7 +623,15 @@ class DamageIndicatorManager { else -> 100 } val name = armorStandHits.name.removeColor() - val hits = name.between("Seraph ", " Hit").toInt() + + // TODO replace this super ugly workaround with regex + val text = name.between("Seraph ", " Hit") + val hits = try { + text.toInt() + } catch (e: NumberFormatException) { + text.substring(2).toInt() + } + return NumberUtil.percentageColor(hits.toLong(), maxHits.toLong()).getChatColor() + "$hits Hits" } -- cgit