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/bingo/BingoAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt21
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoGoal.kt (renamed from src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoGoals.kt)3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/GoalType.kt7
4 files changed, 22 insertions, 15 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
index 468adc0df..517b6e418 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoAPI.kt
@@ -4,13 +4,15 @@ import at.hannibal2.skyhanni.data.jsonobjects.repo.BingoJson
import at.hannibal2.skyhanni.data.jsonobjects.repo.BingoRanksJson
import at.hannibal2.skyhanni.events.RepositoryReloadEvent
import at.hannibal2.skyhanni.features.bingo.card.BingoGoal
+import at.hannibal2.skyhanni.features.bingo.card.GoalType
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
object BingoAPI {
private var ranks = mapOf<String, Int>()
var tips: Map<String, BingoJson.BingoTip> = emptyMap()
- val personalGoals = mutableListOf<BingoGoal>()
- val communityGoals = mutableListOf<BingoGoal>()
+ val bingoGoals = mutableListOf<BingoGoal>()
+ val personalGoals get() = bingoGoals.filter { it.type == GoalType.PERSONAL }
+ val communityGoals get() = bingoGoals.filter { it.type == GoalType.COMMUNITY }
@SubscribeEvent
fun onRepoReload(event: RepositoryReloadEvent) {
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 2dc3ca5a6..e0a2c7638 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/BingoCardDisplay.kt
@@ -9,6 +9,7 @@ import at.hannibal2.skyhanni.events.InventoryFullyOpenedEvent
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.features.bingo.card.BingoGoal
+import at.hannibal2.skyhanni.features.bingo.card.GoalType
import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
@@ -54,8 +55,7 @@ class BingoCardDisplay {
}
private fun reload() {
- BingoAPI.personalGoals.clear()
- BingoAPI.communityGoals.clear()
+ BingoAPI.bingoGoals.clear()
}
fun toggleCommand() {
@@ -86,8 +86,7 @@ class BingoCardDisplay {
if (!config.enabled) return
if (event.inventoryName != "Bingo Card") return
- BingoAPI.personalGoals.clear()
- BingoAPI.communityGoals.clear()
+ 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") }
@@ -114,9 +113,9 @@ class BingoCardDisplay {
val done = stack.getLore().any { it.contains("GOAL REACHED") }
if (isPersonalGoal) {
- BingoAPI.personalGoals.add(getPersonalGoal(name, description, slot, done))
+ BingoAPI.bingoGoals.add(getPersonalGoal(name, description, slot, done))
} else {
- BingoAPI.communityGoals.add(getCommunityGoal(name, description, slot, done))
+ BingoAPI.bingoGoals.add(getCommunityGoal(name, description, slot, done))
}
}
lastBingoCardOpenTime = SimpleTimeMark.now()
@@ -133,11 +132,11 @@ class BingoCardDisplay {
if (!done) {
personalHiddenGoalPattern.matchMatcher(description) {
BingoAPI.tips[name]?.let {
- return BingoGoal(name, it.getDescriptionLine(), slot, false)
+ return BingoGoal(name, it.getDescriptionLine(), GoalType.PERSONAL, slot, false)
}
}
}
- return BingoGoal(name, description, slot, done)
+ return BingoGoal(name, description, GoalType.PERSONAL, slot, done)
}
private fun getCommunityGoal(
@@ -148,10 +147,10 @@ class BingoCardDisplay {
): BingoGoal {
if (description == "§7This goal will be revealed §7when it hits Tier IV.") {
BingoAPI.getCommunityTip(name)?.let {
- return BingoGoal(name, it.getDescriptionLine(), slot, done)
+ return BingoGoal(name, it.getDescriptionLine(), GoalType.COMMUNITY, slot, done)
}
}
- return BingoGoal(name, description, slot, done)
+ return BingoGoal(name, description, GoalType.COMMUNITY, slot, done)
}
@SubscribeEvent
@@ -170,7 +169,7 @@ class BingoCardDisplay {
private fun drawDisplay(): MutableList<String> {
val newList = mutableListOf<String>()
- if (BingoAPI.communityGoals.isEmpty()) {
+ if (BingoAPI.bingoGoals.isEmpty()) {
newList.add("§6Bingo Goals:")
newList.add("§cOpen the §e/bingo §ccard.")
} else {
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoGoals.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoGoal.kt
index 87a408714..c999e15ae 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoGoals.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/BingoGoal.kt
@@ -1,4 +1,3 @@
package at.hannibal2.skyhanni.features.bingo.card
-
-class BingoGoal(val displayName: String, val description: String, val slot: Int, var done: Boolean)
+class BingoGoal(val displayName: String, val description: String, val type: GoalType, val slot: Int, var done: Boolean)
diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/GoalType.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/GoalType.kt
new file mode 100644
index 000000000..01b59e610
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/GoalType.kt
@@ -0,0 +1,7 @@
+package at.hannibal2.skyhanni.features.bingo.card
+
+enum class GoalType {
+ COMMUNITY,
+ PERSONAL,
+ ;
+}