diff options
author | Brandon <brandon.wamboldt@gmail.com> | 2023-12-11 15:45:21 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-11 20:45:21 +0100 |
commit | 1a78f938c11be89a82db8221324826dfa614668b (patch) | |
tree | 6412083fa8dd8a9e9f25a5592ce54eefa4bda11a /src/main | |
parent | c1ccf0ef9b7e3672bc295f9aa124d4415ed8588e (diff) | |
download | skyhanni-1a78f938c11be89a82db8221324826dfa614668b.tar.gz skyhanni-1a78f938c11be89a82db8221324826dfa614668b.tar.bz2 skyhanni-1a78f938c11be89a82db8221324826dfa614668b.zip |
Show breakdown of sharks caught during festivals (#757)
Show breakdown of different shark types caught during festivals. #757
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt index bc9cb9724..1721661e0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/SharkFishCounter.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class SharkFishCounter { - private var counter = 0 + private var counter = mutableListOf(0, 0, 0, 0) private var display = "" private var hasWaterRodInHand = false @@ -20,8 +20,18 @@ class SharkFishCounter { if (!SkyHanniMod.feature.fishing.sharkFishCounter) return if (event.seaCreature.name.contains("Shark")) { - counter += if (event.doubleHook) 2 else 1 - display = "§7Sharks caught: §e${counter.addSeparators()}" + val index = + if (event.seaCreature.name.contains("Blue")) { + 1 + } else if (event.seaCreature.name.contains("Tiger")) { + 2 + } else if (event.seaCreature.name.contains("Great")) { + 3 + } else { + 0 + } + counter[index] += if (event.doubleHook) 2 else 1 + display = "§7Sharks caught: §e${counter.sum().addSeparators()} §7(§a${counter[0]} §9${counter[1]} §5${counter[2]} §6${counter[3]}§7)" } } @@ -38,18 +48,20 @@ class SharkFishCounter { @SubscribeEvent fun onChatMessage(event: LorenzChatEvent) { if (event.message == "§b§lFISHING FESTIVAL §r§eThe festival has concluded! Time to dry off and repair your rods!") { + val count = counter.sum() val funnyComment = when { - counter == 0 -> return - counter < 50 -> "Well done!" - counter < 100 -> "Nice!" - counter < 150 -> "Really nice!" - counter < 200 -> "Super cool!" - counter < 250 -> "Mega cool!" - counter < 350 -> "Like a pro!" + count == 0 -> return + count < 50 -> "Well done!" + count < 100 -> "Nice!" + count < 150 -> "Really nice!" + count < 200 -> "Super cool!" + count < 250 -> "Mega cool!" + count < 350 -> "Like a pro!" else -> "How???" } - LorenzUtils.chat("You caught ${counter.addSeparators()} sharks during this fishing contest. $funnyComment") - counter = 0 + LorenzUtils.chat("You caught ${count.addSeparators()} §f(§a${counter[0]} §9${counter[1]} §5${counter[2]} §6${counter[3]}§f) sharks during this fishing contest. $funnyComment") + counter = mutableListOf(0, 0, 0, 0) + display = "" } } |