From 50cbf42bbf7d05a50e6a2ec10f5936667f0ef6f1 Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 18 Sep 2024 09:27:05 +0200 Subject: Fix: Update Ghost Bestiary Tiers (#2533) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../skyhanni/config/ConfigUpdaterMigrator.kt | 2 +- .../textformatting/BestiaryFormattingConfig.java | 2 +- .../features/combat/ghostcounter/GhostCounter.kt | 49 +++++++++++----------- .../features/combat/ghostcounter/GhostData.kt | 32 +++++++------- .../combat/ghostcounter/GhostFormatting.kt | 2 +- .../features/combat/ghostcounter/GhostUtil.kt | 2 +- 6 files changed, 43 insertions(+), 46 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt index c881cc578..8eb47d394 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt @@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive object ConfigUpdaterMigrator { val logger = LorenzLogger("ConfigMigration") - const val CONFIG_VERSION = 57 + const val CONFIG_VERSION = 58 fun JsonElement.at(chain: List, init: Boolean): JsonElement? { if (chain.isEmpty()) return this if (this !is JsonObject) return null diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/textformatting/BestiaryFormattingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/textformatting/BestiaryFormattingConfig.java index 46a02e9b2..ac9f6e0b2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/textformatting/BestiaryFormattingConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/combat/ghostcounter/textformatting/BestiaryFormattingConfig.java @@ -30,7 +30,7 @@ public class BestiaryFormattingConfig { @ConfigOption(name = "Progress to Max", desc = "Text to show progress when the §eMaxed Bestiary §7option is §aON\n" + "§e%currentKill% §7is replaced with your current total kill.") @ConfigEditorText - public String showMax_progress = "%currentKill%/250k (%percentNumber%%)"; + public String showMax_progress = "%currentKill%/100k (%percentNumber%%)"; @Expose @ConfigOption(name = "Progress", desc = "Text to show progress when the §eMaxed Bestiary §7option is §cOFF\n" + diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt index 3bc3c85d4..664acbc97 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostCounter.kt @@ -55,6 +55,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern +import com.google.gson.JsonPrimitive import io.github.moulberry.notenoughupdates.util.Utils import io.github.moulberry.notenoughupdates.util.XPInformation import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -76,27 +77,27 @@ object GhostCounter { private val patternGroup = RepoPattern.group("combat.ghostcounter") private val skillXPPattern by patternGroup.pattern( "skillxp", - "[+](?[0-9,.]+) \\((?[0-9,.]+)(?:/(?[0-9,.]+))?\\)" + "[+](?[0-9,.]+) \\((?[0-9,.]+)(?:/(?[0-9,.]+))?\\)", ) private val combatSectionPattern by patternGroup.pattern( "combatsection", - ".*[+](?[0-9,.]+) (?[A-Za-z]+) \\((?(?[0-9.,]+)/(?[0-9.,]+)|(?[0-9.]+)%)\\).*" + ".*[+](?[0-9,.]+) (?[A-Za-z]+) \\((?(?[0-9.,]+)/(?[0-9.,]+)|(?[0-9.]+)%)\\).*", ) private val killComboExpiredPattern by patternGroup.pattern( "killcomboexpired", - "§cYour Kill Combo has expired! You reached a (?.*) Kill Combo!" + "§cYour Kill Combo has expired! You reached a (?.*) Kill Combo!", ) private val ghostXPPattern by patternGroup.pattern( "ghostxp", - "(?\\d+(?:\\.\\d+)?(?:,\\d+)?[kK]?)/(?\\d+(?:\\.\\d+)?(?:,\\d+)?[kKmM]?)" + "(?\\d+(?:\\.\\d+)?(?:,\\d+)?[kK]?)/(?\\d+(?:\\.\\d+)?(?:,\\d+)?[kKmM]?)", ) private val bestiaryPattern by patternGroup.pattern( "bestiary", - ".*(?:§\\d|§\\w)+BESTIARY (?:§\\d|§\\w)+Ghost (?:§\\d|§\\w)(?\\d+)➜(?:§\\d|§\\w)(?\\d+).*" + ".*(?:§\\d|§\\w)+BESTIARY (?:§\\d|§\\w)+Ghost (?:§\\d|§\\w)(?\\d+)➜(?:§\\d|§\\w)(?\\d+).*", ) private val skillLevelPattern by patternGroup.pattern( "skilllevel", - ".*§e§lSkills: §r§a(?.*) (?\\d+).*" + ".*§e§lSkills: §r§a(?.*) (?\\d+).*", ) private val format = NumberFormat.getInstance() @@ -127,7 +128,7 @@ object GhostCounter { config.position.renderStringsAndItems( display, extraSpace = config.extraSpace, - posLabel = "Ghost Counter" + posLabel = "Ghost Counter", ) } @@ -205,7 +206,7 @@ object GhostCounter { val etaFormatting = textFormatting.etaFormatting val remaining: Int = when (config.showMax) { - true -> 250_000 - bestiaryCurrentKill + true -> 100_000 - bestiaryCurrentKill false -> killNeeded - currentKill } @@ -222,7 +223,7 @@ object GhostCounter { "%days%" to "days", "%hours%" to "hours", "%minutes%" to "minutes", - "%seconds%" to "seconds" + "%seconds%" to "seconds", ) for ((format, key) in formatMap) { if (etaFormatting.time.contains(format)) { @@ -255,8 +256,7 @@ object GhostCounter { addAsSingletonList(textFormatting.highestKillComboFormat.formatText(Option.MAXKILLCOMBO)) addAsSingletonList(textFormatting.skillXPGainFormat.formatText(Option.SKILLXPGAINED)) addAsSingletonList( - bestiaryFormatting.base.preFormat(bestiary, nextLevel - 1, nextLevel) - .formatBestiary(currentKill, killNeeded) + bestiaryFormatting.base.preFormat(bestiary, nextLevel - 1, nextLevel).formatBestiary(currentKill, killNeeded), ) addAsSingletonList(xpHourFormatting.base.formatText(xp)) @@ -275,7 +275,7 @@ object GhostCounter { 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) + Triple("Ghostly Boots", Option.GHOSTLYBOOTS.getInt(), 77_777), ) val moneyMadeTips = buildList { for ((name, count, value) in priceMap) { @@ -288,7 +288,7 @@ object GhostCounter { val moneyMadeWithClickableTips = Renderable.clickAndHover( textFormatting.moneyMadeFormat.formatText(moneyMade.addSeparators()), moneyMadeTips, - onClick = { OSUtils.copyToClipboard(moneyMadeTips.joinToString("\n").removeColor()) } + onClick = { OSUtils.copyToClipboard(moneyMadeTips.joinToString("\n").removeColor()) }, ) addAsSingletonList(textFormatting.moneyHourFormat.formatText(final)) addAsSingletonList(moneyMadeWithClickableTips) @@ -327,7 +327,7 @@ object GhostCounter { }, "§eClick to import data!", prefixColor = "§6", - oneTimeClick = true + oneTimeClick = true, ) } } @@ -365,9 +365,8 @@ object GhostCounter { var parse = true if (skillPercent) { percent = nf.parse(group("percent")).toFloat() - val level = - if (currentSkill == "Combat" && currentSkillLevel != -1) currentSkillLevel else XPInformation.getInstance() - .getSkillInfo(skillName)?.level ?: 0 + val level = if (currentSkill == "Combat" && currentSkillLevel != -1) currentSkillLevel else XPInformation.getInstance() + .getSkillInfo(skillName)?.level ?: 0 if (level > 0) { totalSkillXp = SkillExperience.getExpForNextLevel(level) currentSkillXp = totalSkillXp * percent / 100 @@ -419,11 +418,10 @@ object GhostCounter { Option.SORROWCOUNT, Option.VOLTACOUNT, Option.PLASMACOUNT, Option.GHOSTLYBOOTS -> { opt.add(1.0) opt.add(1.0, true) - storage?.totalMF = storage?.totalMF?.plus(group("mf").substring(4).toDouble()) - ?: group("mf").substring(4).toDouble() + storage?.totalMF = + storage?.totalMF?.plus(group("mf").substring(4).toDouble()) ?: group("mf").substring(4).toDouble() Option.TOTALDROPS.add(1.0) - if (opt == Option.SORROWCOUNT) - Option.GHOSTSINCESORROW.set(0.0) + if (opt == Option.SORROWCOUNT) Option.GHOSTSINCESORROW.set(0.0) update() } @@ -459,7 +457,7 @@ object GhostCounter { when (val nextLevel = if (currentLevel >= 25) 26 else currentLevel + 1) { 26 -> { storage?.bestiaryNextLevel = 26.0 - storage?.bestiaryCurrentKill = 250_000.0 + storage?.bestiaryCurrentKill = 100_000.0 storage?.bestiaryKillNeeded = 0.0 } @@ -491,8 +489,7 @@ object GhostCounter { val stacks = event.inventoryItems val ghostStack = stacks.values.find { it.displayName.contains("Ghost") } ?: return val bestiaryNextLevel = - if ("§\\wGhost".toRegex().matches(ghostStack.displayName)) 1 else ghostStack.displayName.substring(8) - .romanToDecimal() + 1 + if ("§\\wGhost".toRegex().matches(ghostStack.displayName)) 1 else ghostStack.displayName.substring(8).romanToDecimal() + 1 storage?.bestiaryNextLevel = bestiaryNextLevel.toDouble() var kills = 0.0 for (line in ghostStack.getLore()) { @@ -523,6 +520,10 @@ object GhostCounter { event.transform(11, "combat.ghostCounter.ghostDisplayText") { element -> ConfigUtils.migrateIntArrayListToEnumArrayList(element, GhostDisplayEntry::class.java) } + + event.transform(58, "combat.ghostCounter.textFormatting.bestiaryFormatting.showMax_progress") { + JsonPrimitive("%currentKill%/100k (%percentNumber%%)") + } } fun isEnabled() = IslandType.DWARVEN_MINES.isInIsland() && config.enabled diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostData.kt index abcf2dbba..fde0f51da 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostData.kt @@ -18,27 +18,23 @@ object GhostData { Option.SKILLXPGAINED to 0.0 ) + // TODO repo val bestiaryData = mutableMapOf().apply { for (i in 1..25) { this[i] = when (i) { - 1 -> 5 - 2 -> 5 - 3 -> 5 - 4 -> 10 - 5 -> 25 - 6 -> 50 - 7 -> 100 - 8 -> 150 - 9 -> 150 - 10 -> 250 - 11 -> 750 - 12 -> 1_500 - 13 -> 2_000 - 14, 15, 16, 17 -> 2_500 - 18 -> 3_000 - 19, 20 -> 3_500 - 21 -> 25_000 - 22, 23, 24, 25 -> 50_000 + 1, 2, 3, 4, 5 -> 4 + 6 -> 20 + 7 -> 40 + 8, 9 -> 60 + 10 -> 100 + 11 -> 300 + 12 -> 600 + 13 -> 800 + 14, 15, 16, 17 -> 1_000 + 18 -> 1_200 + 19, 20 -> 1_400 + 21 -> 10_000 + 22, 23, 24, 25 -> 20_000 else -> 0 } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostFormatting.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostFormatting.kt index 183753e51..b58201899 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostFormatting.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostFormatting.kt @@ -160,7 +160,7 @@ object GhostFormatting { base = " &6Bestiary %currentLevel%->%nextLevel%: &b%value%" openMenu = "§cOpen Bestiary Menu !" maxed = "%currentKill% (&c&lMaxed!)" - showMax_progress = "%currentKill%/250k (%percentNumber%%)" + showMax_progress = "%currentKill%/100k (%percentNumber%%)" progress = "%currentKill%/%killNeeded%" } with(killHourFormatting) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt index baacbfa43..6cf777b48 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt @@ -141,5 +141,5 @@ object GhostUtil { } private fun percent(number: Double) = - 100.0.coerceAtMost(((number / 250_000) * 100).roundToPrecision(4)).toString() + 100.0.coerceAtMost(((number / 100_000) * 100).roundToPrecision(4)).toString() } -- cgit