From cc291932906c38943e20cee29ee591695a9875b5 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sun, 23 Jun 2024 18:13:52 +0200 Subject: Backend: Usage of TabWidget (#1240) Co-authored-by: Cal Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/combat') diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt index 31b85ddd0..c30299e4f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/FerocityDisplay.kt @@ -1,8 +1,9 @@ package at.hannibal2.skyhanni.features.combat import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.GuiRenderEvent -import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.events.WidgetUpdateEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst @@ -20,16 +21,18 @@ object FerocityDisplay { */ private val ferocityPattern by RepoPattern.pattern( "combat.ferocity.tab", - " Ferocity: §r§c⫽(?.*)" + " Ferocity: §r§c⫽(?.*)", ) private var display = "" @SubscribeEvent - fun onTabListUpdate(event: TabListUpdateEvent) { + fun onTabListUpdate(event: WidgetUpdateEvent) { if (!isEnabled()) return + if (!event.isWidget(TabWidget.STATS, TabWidget.DUNGEON_SKILLS_AND_STATS)) return display = "" - val stat = event.tabList.matchFirst(ferocityPattern) { + if (event.isClear()) return + val stat = event.lines.matchFirst(ferocityPattern) { group("stat") } ?: return -- cgit