From e3fb64e83b9c1e6ffea03ac1b30099eec5e4dfe3 Mon Sep 17 00:00:00 2001 From: Serhan Date: Sat, 23 Sep 2023 14:26:43 +0300 Subject: crimson rep helper trophy fish chat message #491 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Crimson Reputation Helper doesn't count trophy fish when sacks e… --- .../dailyquest/DailyQuestHelper.kt | 27 ++++++++-------------- 1 file changed, 10 insertions(+), 17 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 424f51653..6be7eae2e 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 @@ -51,28 +51,11 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { fun onTick(event: LorenzTickEvent) { if (!isEnabled()) return - if (event.repeatSeconds(1)) { - checkInventoryForTrophyFish() - } - if (event.repeatSeconds(3)) { checkInventoryForFetchItem() } } - // TODO use OwnInventoryItemUpdateEvent - private fun checkInventoryForTrophyFish() { - val fishQuest = getQuest() ?: return - if (fishQuest.state != QuestState.ACCEPTED && fishQuest.state != QuestState.READY_TO_COLLECT) return - - val fishName = fishQuest.fishName - val currentlyInInventory = InventoryUtils.countItemsInLowerInventory { it.name?.contains(fishName) ?: false } - val diff = currentlyInInventory - latestTrophyFishInInventory - if (diff < 1) return - latestTrophyFishInInventory = currentlyInInventory - updateProcessQuest(fishQuest, fishQuest.haveAmount + diff) - } - fun update() { reputationHelper.update() } @@ -148,6 +131,16 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { rescueMissionQuest.state = QuestState.READY_TO_COLLECT update() } + + if (message.contains("§6§lTROPHY FISH! §r§bYou caught a")) { + val fishQuest = getQuest() ?: return + if (fishQuest.state != QuestState.ACCEPTED && fishQuest.state != QuestState.READY_TO_COLLECT) return + val fishName = fishQuest.fishName + + if (message.contains(fishName)) { + updateProcessQuest(fishQuest, fishQuest.haveAmount + 1) + } + } } inline fun getQuest() = quests.filterIsInstance().firstOrNull() -- cgit