aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/dulkirmod/overlays/SlayerTracker.kt
blob: dc1e956103ba866a47f9783d83fb8fc9e8d584df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package dulkirmod.overlays

import cc.polyfrost.oneconfig.hud.TextHud
import dulkirmod.utils.SlayerTrackerUtil.averageBossesPerHour
import dulkirmod.utils.SlayerTrackerUtil.averageSpawnKillTime
import dulkirmod.utils.SlayerTrackerUtil.averageXPPerHour
import dulkirmod.utils.SlayerTrackerUtil.currentSlayerType
import dulkirmod.utils.SlayerTrackerUtil.sessionXP
import java.text.NumberFormat

class SlayerTracker : TextHud(false) {
    override fun getLines(lines: MutableList<String>?, example: Boolean) {
        if (currentSlayerType != "" && !example) {
            val trimmedSlayer = if (currentSlayerType == "Endermen") {
                "Enderman"
            } else {
                currentSlayerType.trimEnd('s')
            }
            lines?.add("Slayer: $trimmedSlayer")
            lines?.add("Session XP: ${NumberFormat.getInstance().format(sessionXP)}")
            lines?.add("Average Spawn + Kill Time: ${"%.2f".format(averageSpawnKillTime)}s")
            lines?.add("Average Bosses Per Hour: ${"%.1f".format(averageBossesPerHour)}")
            lines?.add("Average XP Per Hour: ${NumberFormat.getInstance().format(averageXPPerHour)}")
        }
    }
}