From e847edd33ea0acff53b941610a4ddcd17427fe92 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Fri, 13 Jan 2023 20:53:27 +0100 Subject: Code cleanup. --- .../reputationhelper/dailyquest/DailyQuestHelper.kt | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src/main/java/at/hannibal2') 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 c0be20536..58e8235ba 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 @@ -116,7 +116,6 @@ class DailyQuestHelper(private val reputationHelper: CrimsonIsleReputationHelper if (LorenzUtils.skyBlockIsland != IslandType.CRIMSON_ISLE) return val message = event.message - if (message == "§aYou completed your Dojo quest! Visit the Town Board to claim the rewards.") { val dojoQuest = getQuest() ?: return dojoQuest.state = QuestState.READY_TO_COLLECT @@ -124,9 +123,7 @@ class DailyQuestHelper(private val reputationHelper: CrimsonIsleReputationHelper } } - private inline fun getQuest(): T? { - return quests.filterIsInstance().firstOrNull() - } + private inline fun getQuest() = quests.filterIsInstance().firstOrNull() private fun checkInventoryForFetchItem() { val fetchQuest = getQuest() ?: return @@ -202,19 +199,15 @@ class DailyQuestHelper(private val reputationHelper: CrimsonIsleReputationHelper val sacksText = if (quest is FetchQuest && quest.state != QuestState.COLLECTED) { val name = quest.itemName.uppercase() - val amount = sacksCache.getOrDefault(name, -1) + val amount = sacksCache.getOrDefault(name, 0) val needAmount = quest.needAmount + val amountFormat = LorenzUtils.formatInteger(amount) val color = if (amount >= needAmount) { "§a" } else { "§c" } - val format = if (amount == -1L) { - "§c?" - } else { - color + LorenzUtils.formatInteger(amount) - } - " §f($format §fin sacks)" + " §f($color$amountFormat §fin sacks)" } else { "" } -- cgit