diff options
author | Linnea Gräf <nea@nea.moe> | 2025-06-22 19:50:31 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-06-22 19:50:31 +0200 |
commit | 05ca14b623bd02260f22198151a6868f8ef48b9e (patch) | |
tree | a3464413bc56807816d246d7e07ab0b447e6dcb1 /src/main/kotlin/features/debug | |
parent | 9bdbf28a58b45a50d0a1f4fb4c3fbcb318bcbcb0 (diff) | |
download | Firmament-05ca14b623bd02260f22198151a6868f8ef48b9e.tar.gz Firmament-05ca14b623bd02260f22198151a6868f8ef48b9e.tar.bz2 Firmament-05ca14b623bd02260f22198151a6868f8ef48b9e.zip |
feat: Hide dungeon score from item exporter
Diffstat (limited to 'src/main/kotlin/features/debug')
-rw-r--r-- | src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt index f9d57d4..1e9a4e9 100644 --- a/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt +++ b/src/main/kotlin/features/debug/itemeditor/LegacyItemExporter.kt @@ -18,6 +18,7 @@ import moe.nea.firmament.Firmament import moe.nea.firmament.annotations.Subscribe import moe.nea.firmament.events.ClientStartedEvent import moe.nea.firmament.features.debug.ExportedTestConstantMeta +import moe.nea.firmament.repo.SBItemStack import moe.nea.firmament.util.HypixelPetInfo import moe.nea.firmament.util.LegacyTagWriter.Companion.toLegacyString import moe.nea.firmament.util.StringUtil.words @@ -68,6 +69,9 @@ class LegacyItemExporter private constructor(var itemStack: ItemStack) { if (rarityIdx >= 0) { lore = lore.subList(0, rarityIdx + 1) } + + trimStats() + deleteLineUntilNextSpace { it.startsWith("Held Item: ") } deleteLineUntilNextSpace { it.startsWith("Progress to Level ") } deleteLineUntilNextSpace { it.startsWith("MAX LEVEL") } @@ -80,6 +84,24 @@ class LegacyItemExporter private constructor(var itemStack: ItemStack) { } } + private fun trimStats() { + val lore = this.lore.toMutableList() + for (index in lore.indices) { + val value = lore[index] + val statLine = SBItemStack.parseStatLine(value) + if (statLine == null) break + val v = value.copy() + require(value.directLiteralStringContent == "") + v.siblings.removeIf { it.directLiteralStringContent!!.contains("(") } + val last = v.siblings.last() + v.siblings[v.siblings.lastIndex] = + Text.literal(last.directLiteralStringContent!!.trimEnd()) + .setStyle(last.style) + lore[index] = v + } + this.lore = lore + } + fun collapseWhitespaces() { lore = (listOf(null as Text?) + lore).zipWithNext() .filter { !it.first?.unformattedString.isNullOrBlank() || !it.second?.unformattedString.isNullOrBlank() } |