Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Show breakdown of sharks caught during festivals #757

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading