From bc34ae9dd4174bd07505cff44866f9545a981769 Mon Sep 17 00:00:00 2001 From: Lorenz Date: Sat, 23 Jul 2022 12:11:46 +0200 Subject: changed sea creature format --- .../java/at/hannibal2/skyhanni/fishing/SeaCreature.kt | 8 ++++++-- .../at/hannibal2/skyhanni/fishing/SeaCreatureManager.kt | 15 +++++++++------ 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/fishing/SeaCreature.kt b/src/main/java/at/hannibal2/skyhanni/fishing/SeaCreature.kt index 887d703e4..935d415f3 100644 --- a/src/main/java/at/hannibal2/skyhanni/fishing/SeaCreature.kt +++ b/src/main/java/at/hannibal2/skyhanni/fishing/SeaCreature.kt @@ -4,11 +4,15 @@ data class SeaCreature( val displayName: String, val fishingExperience: Int, val chatColor: String, - val special: Boolean, + val rare: Boolean, ) { override fun toString(): String { - return chatColor + displayName + return chatColor + rare() + displayName + } + + private fun rare(): String { + return if (rare) "§l" else "" } } diff --git a/src/main/java/at/hannibal2/skyhanni/fishing/SeaCreatureManager.kt b/src/main/java/at/hannibal2/skyhanni/fishing/SeaCreatureManager.kt index d901abe5d..d26c999bd 100644 --- a/src/main/java/at/hannibal2/skyhanni/fishing/SeaCreatureManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/fishing/SeaCreatureManager.kt @@ -16,13 +16,16 @@ class SeaCreatureManager { for (variant in data.entrySet().map { it.value.asJsonObject }) { val chatColor = variant["chat_color"].asString - for (seaCreature in variant["sea_creatures"].asJsonArray.map { it.asJsonObject }) { - val displayName = seaCreature["display_name"].asString - val chatMessage = seaCreature["chat_message"].asString - val fishingExperience = seaCreature["fishing_experience"].asInt - val special = seaCreature["special"].asBoolean + for ((displayName, v) in variant["sea_creatures"].asJsonObject.entrySet()) { + val value = v.asJsonObject + val chatMessage = value["chat_message"].asString + val fishingExperience = value["fishing_experience"].asInt - seaCreatureMap[chatMessage] = SeaCreature(displayName, fishingExperience, chatColor, special) + val rare = if (value.has("rare")) { + value["rare"].asBoolean + } else false + + seaCreatureMap[chatMessage] = SeaCreature(displayName, fishingExperience, chatColor, rare) counter++ } } -- cgit