From 1a78f938c11be89a82db8221324826dfa614668b Mon Sep 17 00:00:00 2001 From: Brandon Date: Mon, 11 Dec 2023 15:45:21 -0400 Subject: Show breakdown of sharks caught during festivals (#757) Show breakdown of different shark types caught during festivals. #757 --- .../skyhanni/features/fishing/SharkFishCounter.kt | 36 ++++++++++++++-------- 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'src') 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 = "" } } -- cgit