diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
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 |