Skip to content

Commit

Permalink
Show breakdown of sharks caught during festivals (#757)
Browse files Browse the repository at this point in the history
Show breakdown of different shark types caught during festivals. #757
  • Loading branch information
brandonwamboldt authored Dec 11, 2023
1 parent c1ccf0e commit 1a78f93
Showing 1 changed file with 24 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)"
}
}

Expand All @@ -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 = ""
}
}

Expand Down

0 comments on commit 1a78f93

Please sign in to comment.