From 04e7a2736b117f43843912cc3bf141afe4bc2616 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Mon, 4 Dec 2023 15:04:44 +0100 Subject: code cleanup --- .../at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt | 2 +- .../at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt index e7306756e..98ac19a76 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt @@ -117,7 +117,7 @@ class BingoCardDisplay { var hiddenGoals = 0 var nextTip = 7.days for (goal in todo.toList()) { - val hiddenGoalData = goal.hiddenGoalData ?: continue + val hiddenGoalData = goal.hiddenGoalData if (hiddenGoalData.unknownTip) { hiddenGoals++ todo.remove(goal) diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt index 2c7e8cb8b..5c9c7aa5b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoCardReader.kt @@ -33,9 +33,11 @@ class BingoCardReader { BingoAPI.bingoGoals.clear() for ((slot, stack) in event.inventoryItems) { - val isPersonalGoal = stack.getLore().any { it.endsWith("Personal Goal") } - val isCommunityGoal = stack.getLore().any { it.endsWith("Community Goal") } - if (!isPersonalGoal && !isCommunityGoal) continue + val goalType = when { + stack.getLore().any { it.endsWith("Personal Goal") } -> GoalType.PERSONAL + stack.getLore().any { it.endsWith("Community Goal") } -> GoalType.COMMUNITY + else -> continue + } val name = stack.name?.removeColor() ?: continue val lore = stack.getLore() var index = 0 @@ -58,7 +60,6 @@ class BingoCardReader { val done = stack.getLore().any { it.contains("GOAL REACHED") } - val goalType = if (isPersonalGoal) GoalType.PERSONAL else GoalType.COMMUNITY val hiddenGoalData = getHiddenGoalData(name, description, goalType) val visualDescription = hiddenGoalData.tipNote -- cgit