aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt98
1 files changed, 43 insertions, 55 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
index 074edf217..611a40853 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
@@ -15,20 +15,8 @@ import at.hannibal2.skyhanni.events.PurseChangeCause
import at.hannibal2.skyhanni.events.PurseChangeEvent
import at.hannibal2.skyhanni.events.TabListUpdateEvent
import at.hannibal2.skyhanni.features.bazaar.BazaarApi.Companion.getBazaarData
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.BAGOFCASH
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.GHOSTLYBOOTS
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.GHOSTSINCESORROW
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.KILLCOMBO
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.KILLCOMBOCOINS
+import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option
import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.KILLS
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.MAXKILLCOMBO
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.PLASMACOUNT
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.SCAVENGERCOINS
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.SKILLXPGAINED
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.SORROWCOUNT
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.TOTALDROPS
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.VOLTACOUNT
-import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.Option.entries
import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostData.bestiaryData
import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostUtil.formatBestiary
import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostUtil.formatText
@@ -133,13 +121,13 @@ object GhostCounter {
private fun drawDisplay() = buildList<List<Any>> {
val textFormatting = config.textFormatting
- val ghostKillPerSorrow: Int = when (SORROWCOUNT.get()) {
+ val ghostKillPerSorrow: Int = when (Option.SORROWCOUNT.get()) {
0.0 -> 0
- else -> "${((((KILLS.get() / SORROWCOUNT.get()) + Math.ulp(1.0)) * 100) / 100).roundToInt()}".toInt()
+ else -> "${((((KILLS.get() / Option.SORROWCOUNT.get()) + Math.ulp(1.0)) * 100) / 100).roundToInt()}".toInt()
}
- val avgMagicFind = when (TOTALDROPS.get()) {
+ val avgMagicFind = when (Option.TOTALDROPS.get()) {
0.0 -> "0"
- else -> "${((((hidden?.totalMF!! / TOTALDROPS.get()) + Math.ulp(1.0)) * 100) / 100).roundToPrecision(2)}"
+ else -> "${((((hidden?.totalMF!! / Option.TOTALDROPS.get()) + Math.ulp(1.0)) * 100) / 100).roundToPrecision(2)}"
}
val xpHourFormatting = textFormatting.xpHourFormatting
@@ -226,18 +214,18 @@ object GhostCounter {
addAsSingletonList(Utils.chromaStringByColourCode(textFormatting.titleFormat.replace("&", "ยง")))
addAsSingletonList(textFormatting.ghostKilledFormat.formatText(KILLS))
- addAsSingletonList(textFormatting.sorrowsFormat.formatText(SORROWCOUNT))
- addAsSingletonList(textFormatting.ghostSinceSorrowFormat.formatText(GHOSTSINCESORROW.getInt()))
+ addAsSingletonList(textFormatting.sorrowsFormat.formatText(Option.SORROWCOUNT))
+ addAsSingletonList(textFormatting.ghostSinceSorrowFormat.formatText(Option.GHOSTSINCESORROW.getInt()))
addAsSingletonList(textFormatting.ghostKillPerSorrowFormat.formatText(ghostKillPerSorrow))
- addAsSingletonList(textFormatting.voltasFormat.formatText(VOLTACOUNT))
- addAsSingletonList(textFormatting.plasmasFormat.formatText(PLASMACOUNT))
- addAsSingletonList(textFormatting.ghostlyBootsFormat.formatText(GHOSTLYBOOTS))
- addAsSingletonList(textFormatting.bagOfCashFormat.formatText(BAGOFCASH))
+ addAsSingletonList(textFormatting.voltasFormat.formatText(Option.VOLTACOUNT))
+ addAsSingletonList(textFormatting.plasmasFormat.formatText(Option.PLASMACOUNT))
+ addAsSingletonList(textFormatting.ghostlyBootsFormat.formatText(Option.GHOSTLYBOOTS))
+ addAsSingletonList(textFormatting.bagOfCashFormat.formatText(Option.BAGOFCASH))
addAsSingletonList(textFormatting.avgMagicFindFormat.formatText(avgMagicFind))
- addAsSingletonList(textFormatting.scavengerCoinsFormat.formatText(SCAVENGERCOINS))
- addAsSingletonList(textFormatting.killComboFormat.formatText(MAXKILLCOMBO))
- addAsSingletonList(textFormatting.highestKillComboFormat.formatText(MAXKILLCOMBO))
- addAsSingletonList(textFormatting.skillXPGainFormat.formatText(SKILLXPGAINED))
+ addAsSingletonList(textFormatting.scavengerCoinsFormat.formatText(Option.SCAVENGERCOINS))
+ addAsSingletonList(textFormatting.killComboFormat.formatText(Option.MAXKILLCOMBO))
+ addAsSingletonList(textFormatting.highestKillComboFormat.formatText(Option.MAXKILLCOMBO))
+ addAsSingletonList(textFormatting.skillXPGainFormat.formatText(Option.SKILLXPGAINED))
addAsSingletonList(
bestiaryFormatting.base.preFormat(bestiary, nextLevel - 1, nextLevel)
.formatBestiary(currentKill, killNeeded)
@@ -254,12 +242,12 @@ object GhostCounter {
val voltaValue = VOLTA.getBazaarData()?.buyPrice?.toLong() ?: 0L
var moneyMade: Long = 0
val priceMap = listOf(
- Triple("Sorrow", SORROWCOUNT.getInt(), sorrowValue),
- Triple("Plasma", PLASMACOUNT.getInt(), plasmaValue),
- Triple("Volta", VOLTACOUNT.getInt(), voltaValue),
- Triple("Bag Of Cash", BAGOFCASH.getInt(), 1_000_000),
- Triple("Scavenger Coins", SCAVENGERCOINS.getInt(), 1),
- Triple("Ghostly Boots", GHOSTLYBOOTS.getInt(), 77_777)
+ Triple("Sorrow", Option.SORROWCOUNT.getInt(), sorrowValue),
+ Triple("Plasma", Option.PLASMACOUNT.getInt(), plasmaValue),
+ Triple("Volta", Option.VOLTACOUNT.getInt(), voltaValue),
+ Triple("Bag Of Cash", Option.BAGOFCASH.getInt(), 1_000_000),
+ Triple("Scavenger Coins", Option.SCAVENGERCOINS.getInt(), 1),
+ Triple("Ghostly Boots", Option.GHOSTLYBOOTS.getInt(), 77_777)
)
val moneyMadeTips = buildList {
for ((name, count, value) in priceMap) {
@@ -293,10 +281,10 @@ object GhostCounter {
if (num >= 0) {
KILLS.add(num)
KILLS.add(num, true)
- GHOSTSINCESORROW.add(num)
- KILLCOMBO.add(num)
- SKILLXPGAINED.add(gained * num.roundToLong())
- SKILLXPGAINED.add(gained * num.roundToLong(), true)
+ Option.GHOSTSINCESORROW.add(num)
+ Option.KILLCOMBO.add(num)
+ Option.SKILLXPGAINED.add(gained * num.roundToLong())
+ Option.SKILLXPGAINED.add(gained * num.roundToLong(), true)
hidden?.bestiaryCurrentKill = hidden?.bestiaryCurrentKill?.plus(num) ?: num
}
}
@@ -394,29 +382,29 @@ object GhostCounter {
fun onChat(event: LorenzChatEvent) {
if (!isEnabled()) return
if (LorenzUtils.skyBlockIsland != IslandType.DWARVEN_MINES) return
- for (opt in entries) {
+ for (opt in Option.entries) {
val pattern = opt.pattern ?: continue
pattern.matchMatcher(event.message) {
when (opt) {
- SORROWCOUNT, VOLTACOUNT, PLASMACOUNT, GHOSTLYBOOTS -> {
+ Option.SORROWCOUNT, Option.VOLTACOUNT, Option.PLASMACOUNT, Option.GHOSTLYBOOTS -> {
opt.add(1.0)
opt.add(1.0, true)
hidden?.totalMF = hidden?.totalMF?.plus(group("mf").substring(4).toDouble())
?: group("mf").substring(4).toDouble()
- TOTALDROPS.add(1.0)
- if (opt == SORROWCOUNT)
- GHOSTSINCESORROW.set(0.0)
+ Option.TOTALDROPS.add(1.0)
+ if (opt == Option.SORROWCOUNT)
+ Option.GHOSTSINCESORROW.set(0.0)
update()
}
- BAGOFCASH -> {
- BAGOFCASH.add(1.0)
- BAGOFCASH.add(1.0, true)
+ Option.BAGOFCASH -> {
+ Option.BAGOFCASH.add(1.0)
+ Option.BAGOFCASH.add(1.0, true)
update()
}
- KILLCOMBOCOINS -> {
- KILLCOMBOCOINS.set(KILLCOMBOCOINS.get() + group("coin").toDouble())
+ Option.KILLCOMBOCOINS -> {
+ Option.KILLCOMBOCOINS.set(Option.KILLCOMBOCOINS.get() + group("coin").toDouble())
update()
}
@@ -425,14 +413,14 @@ object GhostCounter {
}
}
killComboExpiredPattern.matchMatcher(event.message) {
- if (KILLCOMBO.getInt() > MAXKILLCOMBO.getInt()) {
- MAXKILLCOMBO.set(group("combo").formatNumber().toDouble())
+ if (Option.KILLCOMBO.getInt() > Option.MAXKILLCOMBO.getInt()) {
+ Option.MAXKILLCOMBO.set(group("combo").formatNumber().toDouble())
}
- if (KILLCOMBO.getInt() > MAXKILLCOMBO.getInt(true)) {
- MAXKILLCOMBO.set(group("combo").formatNumber().toDouble(), true)
+ if (Option.KILLCOMBO.getInt() > Option.MAXKILLCOMBO.getInt(true)) {
+ Option.MAXKILLCOMBO.set(group("combo").formatNumber().toDouble(), true)
}
- KILLCOMBOCOINS.set(0.0)
- KILLCOMBO.set(0.0)
+ Option.KILLCOMBOCOINS.set(0.0)
+ Option.KILLCOMBO.set(0.0)
update()
}
//replace with BestiaryLevelUpEvent ?
@@ -461,8 +449,8 @@ object GhostCounter {
if (!isEnabled()) return
if (LorenzUtils.skyBlockArea != "The Mist") return
if (event.reason != PurseChangeCause.GAIN_MOB_KILL) return
- SCAVENGERCOINS.add(event.coins, true)
- SCAVENGERCOINS.add(event.coins)
+ Option.SCAVENGERCOINS.add(event.coins, true)
+ Option.SCAVENGERCOINS.add(event.coins)
}
@SubscribeEvent