From ed3209e70866950759fe8f70dfd2ce50cba52a55 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Fri, 8 Mar 2024 21:51:40 +0100 Subject: [PATCH 01/25] init --- .../skyhanni/data/model/TabWidget.kt | 22 +++++++++++++++++++ .../skyhanni/events/TabWidgetUpdate.kt | 8 +++++++ 2 files changed, 30 insertions(+) create mode 100644 src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt create mode 100644 src/main/java/at/hannibal2/skyhanni/events/TabWidgetUpdate.kt diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt new file mode 100644 index 000000000000..9e2e39ddd4ca --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt @@ -0,0 +1,22 @@ +package at.hannibal2.skyhanni.data.model + +import at.hannibal2.skyhanni.events.TabWidgetUpdate +import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern + +enum class TabWidget(pattern0: String) { + + ; + + val pattern by RepoPattern.pattern("tab.widget.$name", pattern0) + + fun postEvent(lines: List) = TabWidgetUpdate(this, lines).postAndCatch() + + fun isEventForThis(event: TabWidgetUpdate) = event.widget == this + + companion object { + init { + entries.forEach { it.pattern } + + } + } +} diff --git a/src/main/java/at/hannibal2/skyhanni/events/TabWidgetUpdate.kt b/src/main/java/at/hannibal2/skyhanni/events/TabWidgetUpdate.kt new file mode 100644 index 000000000000..9bb9d5b58514 --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/events/TabWidgetUpdate.kt @@ -0,0 +1,8 @@ +package at.hannibal2.skyhanni.events + +import at.hannibal2.skyhanni.data.model.TabWidget + +class TabWidgetUpdate( + val widget: TabWidget, + val lines: List, +) : LorenzEvent() From 6a43b1e391bac1cf1fb6bcc191436b21ca440328 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:32:40 +0100 Subject: [PATCH 02/25] added all widgets --- .../java/at/hannibal2/skyhanni/SkyHanniMod.kt | 2 + .../skyhanni/data/model/TabWidget.kt | 135 +++++++++++++++++- 2 files changed, 135 insertions(+), 2 deletions(-) diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt index 6c05aadbda3c..03f55167b177 100644 --- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt +++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt @@ -50,6 +50,7 @@ import at.hannibal2.skyhanni.data.TrackerManager import at.hannibal2.skyhanni.data.jsonobjects.local.FriendsJson import at.hannibal2.skyhanni.data.jsonobjects.local.JacobContestsJson import at.hannibal2.skyhanni.data.jsonobjects.local.KnownFeaturesJson +import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.data.repo.RepoManager import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.events.PreInitFinishedEvent @@ -469,6 +470,7 @@ class SkyHanniMod { loadModule(BossbarData) loadModule(EntityUtils) loadModule(ChatUtils) + loadModule(TabWidget) // APIs loadModule(BazaarApi()) diff --git a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt index 9e2e39ddd4ca..3430f11014c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/model/TabWidget.kt @@ -1,22 +1,153 @@ package at.hannibal2.skyhanni.data.model +import at.hannibal2.skyhanni.events.TabListUpdateEvent import at.hannibal2.skyhanni.events.TabWidgetUpdate +import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy +import at.hannibal2.skyhanni.utils.CollectionUtils.getOrNull +import at.hannibal2.skyhanni.utils.ConditionalUtils.transformIf +import at.hannibal2.skyhanni.utils.StringUtils.matches import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import io.github.moulberry.moulconfig.observer.Property +import net.minecraftforge.fml.common.eventhandler.EventPriority +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent -enum class TabWidget(pattern0: String) { +enum class TabWidget( + pattern0: String +) { + PLAYER_LIST("(?:§.)*Players (?:§.)*\\(\\d+\\)"), + INFO("(?:§.)*Info"), + AREA("(?:§.)*(Area|Dungeon): (?:§.)*(?.*)"), + SERVER( + "Server: (?:§.)*(?.*)" + ), + GEMS("Gems: (?:§.)*(?.*)"), + FAIRY_SOULS("Fairy Souls: (?:§.)*(?\\d+)(?:§.)*\\/(?:§.)*(?\\d+)"), + PROFILE("(?:§.)*Profile: (?:§.)*(?\\S+) .*"), + SB_LEVEL( + "SB Level(?:§.)*: (?:§.)*\\[(?:§.)*(?\\d+)(?:§.)*\\] (?:§.)*(?\\d+).*" + ), + BANK("Bank: (?:§.)*(?[^§]+)(?:\\(?:§.)*/(?:§.)*(?.*))?"), + INTEREST("Interest: (?:§.)*(?