diff options
| author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-06-14 15:56:08 +0200 |
|---|---|---|
| committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-06-14 15:56:08 +0200 |
| commit | 34e2d19a32f36ddef298668788447aed01c62703 (patch) | |
| tree | 65db564add674443a43bf65e71091e9d965f117a /src | |
| parent | a996d8150ef2367e7c839f3565d60bdb68d2125d (diff) | |
| download | skyhanni-34e2d19a32f36ddef298668788447aed01c62703.tar.gz skyhanni-34e2d19a32f36ddef298668788447aed01c62703.tar.bz2 skyhanni-34e2d19a32f36ddef298668788447aed01c62703.zip | |
fixing and using shortFormat()
Diffstat (limited to 'src')
48 files changed, 215 insertions, 199 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index 93870b119..3c3c0d90b 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull import at.hannibal2.skyhanni.utils.NEUItems.getPrice -import at.hannibal2.skyhanni.utils.NumberUtil +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RecalculatingValue import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.TimeLimitedCache @@ -46,7 +46,7 @@ object SlayerAPI { val maxPrice = npcPrice.coerceAtLeast(price) val totalPrice = maxPrice * amount - val format = NumberUtil.format(totalPrice) + val format = totalPrice.shortFormat() val priceFormat = " §7(§6$format coins§7)" "$amountFormat$displayName$priceFormat" to totalPrice diff --git a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt index d3f33a27d..7871ae28d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt @@ -1,10 +1,10 @@ package at.hannibal2.skyhanni.features.bingo.card.nextstephelper.steps import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NumberUtil +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat class CollectionStep(collectionName: String, amountNeeded: Int) : - ProgressionStep(NumberUtil.format(amountNeeded) + " $collectionName Collection", amountNeeded.toLong()) { + ProgressionStep(amountNeeded.shortFormat() + " $collectionName Collection", amountNeeded.toLong()) { val internalName by lazy { NEUInternalName.fromItemName(if (collectionName == "Mushroom") "Red Mushroom" else collectionName) } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt index 864f4926d..5d056f456 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -17,11 +17,11 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addButton -import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.NumberUtil.toRoman import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -477,7 +477,7 @@ object BestiaryData { } private fun Long.formatNumber(): String = when (config.numberFormat) { - BestiaryConfig.NumberFormatEntry.SHORT -> NumberUtil.format(this) + BestiaryConfig.NumberFormatEntry.SHORT -> this.shortFormat() BestiaryConfig.NumberFormatEntry.LONG -> this.addSeparators() else -> "0" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt index 8632f9d03..fb549e7c2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt @@ -38,6 +38,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.LorenzVec import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -231,8 +232,8 @@ object DamageIndicatorManager { val currentDamage = data.damageCounter.currentDamage val currentHealing = data.damageCounter.currentHealing if (currentDamage != 0L || currentHealing != 0L) { - val formatDamage = "§c" + NumberUtil.format(currentDamage) - val formatHealing = "§a+" + NumberUtil.format(currentHealing) + val formatDamage = "§c" + currentDamage.shortFormat() + val formatHealing = "§a+" + currentHealing.shortFormat() val finalResult = if (currentHealing == 0L) { formatDamage } else if (currentDamage == 0L) { @@ -250,8 +251,8 @@ object DamageIndicatorManager { diff += 9f } for (damage in data.damageCounter.oldDamages) { - val formatDamage = "§c" + NumberUtil.format(damage.damage) + "/s" - val formatHealing = "§a+" + NumberUtil.format(damage.healing) + "/s" + val formatDamage = "§c" + damage.damage.shortFormat() + "/s" + val formatHealing = "§a+" + damage.healing.shortFormat() + "/s" val finalResult = if (damage.healing == 0L) { formatDamage } else if (damage.damage == 0L) { @@ -378,7 +379,7 @@ object DamageIndicatorManager { entityData.healthText = customHealthText } else { val color = NumberUtil.percentageColor(health, maxHealth) - entityData.healthText = color.getChatColor() + NumberUtil.format(health) + entityData.healthText = color.getChatColor() + health.shortFormat() } entityData.timeLastTick = System.currentTimeMillis() return entity.uniqueID to entityData @@ -532,7 +533,7 @@ object DamageIndicatorManager { return NumberUtil.percentageColor( calcHealth.toLong(), calcMaxHealth.toLong(), - ).getChatColor() + NumberUtil.format(calcHealth) + ).getChatColor() + calcHealth.shortFormat() } private fun checkMagmaCube( @@ -551,7 +552,7 @@ object DamageIndicatorManager { else -> { val color = NumberUtil.percentageColor(health.toLong(), 10_000_000) entityData.namePrefix = "§a6/6" - return color.getChatColor() + NumberUtil.format(health) + return color.getChatColor() + health.shortFormat() } } + " §f" @@ -595,7 +596,7 @@ object DamageIndicatorManager { if (calcHealth == -1) return null val color = NumberUtil.percentageColor(calcHealth.toLong(), maxHealth.toLong()) - return color.getChatColor() + NumberUtil.format(calcHealth) + return color.getChatColor() + calcHealth.shortFormat() } private fun checkEnderSlayer( @@ -653,7 +654,7 @@ object DamageIndicatorManager { } var result = NumberUtil.percentageColor( calcHealth.toLong(), calcMaxHealth.toLong(), - ).getChatColor() + NumberUtil.format(calcHealth) + ).getChatColor() + calcHealth.shortFormat() if (!SkyHanniMod.feature.slayer.endermen.phaseDisplay) { result = "" diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt index 2cac59010..9012f0223 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt @@ -25,7 +25,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUItems.getNpcPriceOrNull import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.tracker.SkyHanniTracker import at.hannibal2.skyhanni.utils.tracker.TrackerData import com.google.gson.annotations.Expose @@ -216,13 +216,13 @@ object EnderNodeTracker { addAsSingletonList("§5§lEnder Node Tracker") addAsSingletonList("§d${data.totalNodesMined.addSeparators()} Ender Nodes mined") - addAsSingletonList("§6${format(lootProfit.values.sum())} Coins made") + addAsSingletonList("§6${lootProfit.values.sum().shortFormat()} Coins made") addAsSingletonList(" ") addAsSingletonList("§b${data.totalEndermiteNests.addSeparators()} §cEndermite Nest") for (item in EnderNode.entries.subList(0, 11)) { val count = (data.lootCount[item] ?: 0).addSeparators() - val profit = format(lootProfit[item] ?: 0.0) + val profit = (lootProfit[item] ?: 0.0).shortFormat() addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)") } addAsSingletonList(" ") @@ -230,16 +230,16 @@ object EnderNodeTracker { val totalEnderArmor = calculateEnderArmor(data) addAsSingletonList( "§b${totalEnderArmor.addSeparators()} §5Ender Armor " + - "§7(§6${format(totalEnderArmor * 10_000)}§7)" + "§7(§6${(totalEnderArmor * 10_000).shortFormat()}§7)" ) for (item in EnderNode.entries.subList(11, 16)) { val count = (data.lootCount[item] ?: 0).addSeparators() - val profit = format(lootProfit[item] ?: 0.0) + val profit = (lootProfit[item] ?: 0.0).shortFormat() addAsSingletonList("§b$count ${item.displayName} §7(§6$profit§7)") } // enderman pet rarities val (c, u, r, e, l) = EnderNode.entries.subList(16, 21).map { (data.lootCount[it] ?: 0).addSeparators() } - val profit = format(EnderNode.entries.subList(16, 21).sumOf { lootProfit[it] ?: 0.0 }) + val profit = EnderNode.entries.subList(16, 21).sumOf { lootProfit[it] ?: 0.0 }.shortFormat() addAsSingletonList("§f$c§7-§a$u§7-§9$r§7-§5$e§7-§6$l §fEnderman Pet §7(§6$profit§7)") } 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 61e03cf97..7da6d6704 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 @@ -4,9 +4,9 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigManager import at.hannibal2.skyhanni.data.ProfileStorageData import at.hannibal2.skyhanni.utils.ChatUtils -import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import io.github.moulberry.notenoughupdates.util.Utils import java.io.FileReader @@ -132,7 +132,7 @@ object GhostUtil { if (GhostCounter.config.showMax) GhostCounter.bestiaryCurrentKill.addSeparators() else currentKill.addSeparators() ) .replace("%percentNumber%", percent(GhostCounter.bestiaryCurrentKill.toDouble())) - .replace("%killNeeded%", NumberUtil.format(killNeeded)) + .replace("%killNeeded%", killNeeded.shortFormat()) .replace("%currentLevel%", currentLevel) .replace("%nextLevel%", nextLevel) .replace("&", "§") diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt index 9fe716328..1ba2724c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt @@ -11,9 +11,9 @@ import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatInt +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -67,7 +67,7 @@ object DianaProfitTracker { override fun getCoinName(item: TrackedItem) = "§6Dug Out Coins" override fun getCoinDescription(item: TrackedItem): List<String> { - val burrowDugCoinsFormat = NumberUtil.format(item.totalAmount) + val burrowDugCoinsFormat = item.totalAmount.shortFormat() return listOf( "§7Digging treasures gave you", "§6$burrowDugCoinsFormat coins §7in total." diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt index dc0c3b6ff..bd90777b3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt @@ -5,7 +5,7 @@ import at.hannibal2.skyhanni.features.event.hoppity.HoppityEggsManager.getEggTyp import at.hannibal2.skyhanni.features.inventory.chocolatefactory.ChocolateFactoryAPI import at.hannibal2.skyhanni.utils.ChatUtils import at.hannibal2.skyhanni.utils.DelayedRun -import at.hannibal2.skyhanni.utils.NumberUtil +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark.Companion.fromNow @@ -60,7 +60,7 @@ object HoppityEggsCompactChat { val mealName = lastChatMeal?.coloredName ?: "" return if (duplicate) { - val format = lastDuplicateAmount?.let { NumberUtil.format(it) } ?: "?" + val format = lastDuplicateAmount?.let { it.shortFormat() } ?: "?" val timeFormatted = lastDuplicateAmount?.let { ChocolateFactoryAPI.timeUntilNeed(it).format(maxUnits = 2) } ?: "?" diff --git a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt index e01c0386d..7547f1bc2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt @@ -15,8 +15,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addAsSingletonList import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland -import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -154,7 +154,7 @@ object FrozenTreasureTracker { fun formatNumber(amount: Number): String { if (amount is Int) return amount.addSeparators() - if (amount is Long) return NumberUtil.format(amount) + if (amount is Long) return amount.shortFormat() return "$amount" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt index c707e2209..c411951c3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt @@ -23,8 +23,8 @@ import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.NEUItems.getPrice -import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils.highlight @@ -158,16 +158,21 @@ object CityProjectFeatures { list.add(" §7- ") list.add(stack) - list.add(Renderable.optionalLink("$name §ex${amount.addSeparators()}", { - if (Minecraft.getMinecraft().currentScreen is GuiEditSign) { - LorenzUtils.setTextIntoSign("$amount") - } else { - BazaarApi.searchForBazaarItem(name, amount) - } - }) { inInventory && !NEUItems.neuHasFocus() }) + list.add( + Renderable.optionalLink( + "$name §ex${amount.addSeparators()}", + { + if (Minecraft.getMinecraft().currentScreen is GuiEditSign) { + LorenzUtils.setTextIntoSign("$amount") + } else { + BazaarApi.searchForBazaarItem(name, amount) + } + } + ) { inInventory && !NEUItems.neuHasFocus() } + ) val price = internalName.getPrice(false) * amount - val format = NumberUtil.format(price) + val format = price.shortFormat() list.add(" §7(§6$format§7)") add(list) } diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt index a9dba3cc1..b99c03ff5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt @@ -18,9 +18,9 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName -import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.NumberUtil.formatInt +import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.StringUtils @@ -71,7 +71,7 @@ object FishingProfitTracker { override fun getCoinName(item: TrackedItem) = "§6Fished Coins" override fun getCoinDescription(item: TrackedItem): List<String> { - |
