diff options
author | hannibal2 <24389977+hannibal002@users.noreply.github.com> | 2024-06-05 14:43:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-05 14:43:18 +0200 |
commit | 18456c6d9d56b555252f43f753aac3caebec9914 (patch) | |
tree | fde33ea33802e652ac3ce2a1f4bc320a73efc137 /src | |
parent | 406eaec8bd9e7ca630d1f79ffe2ddda8493778eb (diff) | |
download | skyhanni-18456c6d9d56b555252f43f753aac3caebec9914.tar.gz skyhanni-18456c6d9d56b555252f43f753aac3caebec9914.tar.bz2 skyhanni-18456c6d9d56b555252f43f753aac3caebec9914.zip |
Improvement: using tab widgets in quest faction detection (#1989)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src')
2 files changed, 9 insertions, 39 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt index e2d368c6f..b1edb0142 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt @@ -4,13 +4,14 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.data.SackAPI.getAmountInSacksOrNull +import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.GuiContainerEvent import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.events.LorenzChatEvent import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.SecondPassedEvent -import at.hannibal2.skyhanni.events.TabListUpdateEvent +import at.hannibal2.skyhanni.events.WidgetUpdateEvent import at.hannibal2.skyhanni.features.nether.kuudra.KuudraTier import at.hannibal2.skyhanni.features.nether.reputationhelper.CrimsonIsleReputationHelper import at.hannibal2.skyhanni.features.nether.reputationhelper.FactionType @@ -85,32 +86,14 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } } - // TODO use WidgetUpdateEvent once its merged @SubscribeEvent - fun onTabListUpdate(event: TabListUpdateEvent) { - if (!isEnabled()) return - - questLoader.loadFromTabList() + fun onTabListWidgetUpdate(event: WidgetUpdateEvent) { + if (event.isWidget(TabWidget.FACTION_QUESTS)) { + if (!isEnabled()) return + questLoader.loadFromTabList() + } } -// @SubscribeEvent -// fun onTabListWidgetUpdate(event: WidgetUpdateEvent.NewValues) { -// if (!isEnabled()) return -// if (event.isWidget(TabWidget.FACTION_QUESTS)) { -// println("WidgetUpdateEvent.NewValues") -// questLoader.loadFromTabList(event.lines) -// } -// } -// -// @SubscribeEvent -// fun onTabListWidgetUpdate(event: WidgetUpdateEvent.Clear) { -// if (!isEnabled()) return -// if (event.isWidget(TabWidget.FACTION_QUESTS)) { -// println("WidgetUpdateEvent.Clear") -// questLoader.loadFromTabList(emptyList()) -// } -// } - @SubscribeEvent fun onSecondPassed(event: SecondPassedEvent) { if (!isEnabled()) return diff --git a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt index fa1115f81..0cd1a1888 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/QuestLoader.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest import at.hannibal2.skyhanni.config.storage.ProfileSpecificStorage import at.hannibal2.skyhanni.data.jsonobjects.repo.CrimsonIsleReputationJson.ReputationQuest +import at.hannibal2.skyhanni.data.model.TabWidget import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.DojoQuest import at.hannibal2.skyhanni.features.nether.reputationhelper.dailyquest.quest.FetchQuest @@ -35,29 +36,15 @@ class QuestLoader(private val dailyQuestHelper: DailyQuestHelper) { } } - // TODO use WidgetUpdateEvent once its merged - // fun loadFromTabList(lines: List<String>) { fun loadFromTabList() { - var i = -1 dailyQuestHelper.greatSpook = false var found = 0 - for (line in TabListData.getTabList()) { -// for (line in lines) { - if (line == "§5§lFaction Quests:") { - i = 0 - continue - } - if (i == -1) continue - - i++ + for (line in TabWidget.FACTION_QUESTS.lines) { readQuest(line) found++ if (dailyQuestHelper.greatSpook) return - if (i == 5) { - break - } } dailyQuestHelper.reputationHelper.tabListQuestsMissing = found == 0 |