aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/nether/reputationhelper/dailyquest/DailyQuestHelper.kt27
1 files 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<TrophyFishQuest>() ?: 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<TrophyFishQuest>() ?: 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 <reified T : Quest> getQuest() = quests.filterIsInstance<T>().firstOrNull()