diff options
Diffstat (limited to 'src')
2 files changed, 28 insertions, 36 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 c13d9907e..48854884e 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 @@ -38,7 +38,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { tick++ if (tick % 20 == 0) { loader.checkInventory() - checkInventory() + checkInventoryForTrophyFish() } if (tick % 60 == 0) { @@ -51,7 +51,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } } - private fun checkInventory() { + private fun checkInventoryForTrophyFish() { val fishQuest = getQuest<TrophyFishQuest>() ?: return if (fishQuest.state != QuestState.ACCEPTED && fishQuest.state != QuestState.READY_TO_COLLECT) return @@ -67,9 +67,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { } val diff = currentlyInInventory - latestTrophyFishInInventory if (diff < 1) return - LorenzUtils.debug("diff: $diff") latestTrophyFishInInventory = currentlyInInventory - updateProcessQuest(fishQuest, fishQuest.haveAmount + diff) } @@ -174,16 +172,14 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { updateProcessQuest(fetchQuest, count) } - private fun updateProcessQuest( - quest: ProgressQuest, - newAmount: Int - ) { + private fun updateProcessQuest(quest: ProgressQuest, newAmount: Int) { var count = newAmount val needAmount = quest.needAmount if (count > needAmount) { count = needAmount } if (quest.haveAmount == count) return + LorenzUtils.chat("§e[SkyHanni] ${quest.displayName} progress: $count/$needAmount") quest.haveAmount = count quest.state = if (count == needAmount) QuestState.READY_TO_COLLECT else QuestState.ACCEPTED @@ -276,6 +272,7 @@ class DailyQuestHelper(val reputationHelper: CrimsonIsleReputationHelper) { fun loadConfig() { loader.loadConfig() + latestTrophyFishInInventory = SkyHanniMod.feature.hidden.crimsonIsleLatestTrophyFishInInventory } fun saveConfig() { 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 b4a8e4200..069ab033c 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 @@ -66,11 +66,7 @@ class QuestLoader(val dailyQuestHelper: DailyQuestHelper) { dailyQuestHelper.quests.add(addQuest(name, state, needAmount)) } - private fun addQuest( - name: String, - state: QuestState, - needAmount: Int - ): Quest { + private fun addQuest(name: String, state: QuestState, needAmount: Int): Quest { for (miniBoss in dailyQuestHelper.reputationHelper.miniBossHelper.miniBosses) { if (name == miniBoss.displayName) { return MiniBossQuest(miniBoss, state, needAmount) @@ -79,7 +75,6 @@ class QuestLoader(val dailyQuestHelper: DailyQuestHelper) { for (entry in dailyQuestHelper.reputationHelper.repoData.entrySet()) { val category = entry.key - for (element in entry.value.asJsonArray) { val entryName = element.asString @@ -118,30 +113,30 @@ class QuestLoader(val dailyQuestHelper: DailyQuestHelper) { for (quest in dailyQuestHelper.quests) { val categoryName = quest.category.name - if (categoryName.equals(name, ignoreCase = true)) { - for (slot in chest.inventorySlots) { - if (slot == null) continue - if (slot.slotNumber != slot.slotIndex) continue - - // Only checking the middle slot - if (slot.slotNumber != 22) continue - - val stack = slot.stack ?: continue - - val completed = stack.getLore().any { it.contains("Completed!") } - if (completed) { - if (quest.state != QuestState.COLLECTED) { - quest.state = QuestState.COLLECTED - dailyQuestHelper.update() - } + if (!categoryName.equals(name, ignoreCase = true)) continue + + for (slot in chest.inventorySlots) { + if (slot == null) continue + if (slot.slotNumber != slot.slotIndex) continue + + // Only checking the middle slot + if (slot.slotNumber != 22) continue + + val stack = slot.stack ?: continue + + val completed = stack.getLore().any { it.contains("Completed!") } + if (completed) { + if (quest.state != QuestState.COLLECTED) { + quest.state = QuestState.COLLECTED + dailyQuestHelper.update() } + } - val accepted = !stack.getLore().any { it.contains("Click to start!") } - if (accepted) { - if (quest.state == QuestState.NOT_ACCEPTED) { - quest.state = QuestState.ACCEPTED - dailyQuestHelper.update() - } + val accepted = !stack.getLore().any { it.contains("Click to start!") } + if (accepted) { + if (quest.state == QuestState.NOT_ACCEPTED) { + quest.state = QuestState.ACCEPTED + dailyQuestHelper.update() } } } |