diff options
Diffstat (limited to 'src/main/java')
49 files changed, 184 insertions, 195 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt index 64a2e9387..93870b119 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.format +import at.hannibal2.skyhanni.utils.NumberUtil 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 = totalPrice.format() + val format = NumberUtil.format(totalPrice) 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 9689481d5..d3f33a27d 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.format +import at.hannibal2.skyhanni.utils.NumberUtil class CollectionStep(collectionName: String, amountNeeded: Int) : - ProgressionStep(amountNeeded.format() + " $collectionName Collection", amountNeeded.toLong()) { + ProgressionStep(NumberUtil.format(amountNeeded) + " $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 9eb6483a3..864f4926d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt @@ -17,8 +17,8 @@ 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.format import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision @@ -477,7 +477,7 @@ object BestiaryData { } private fun Long.formatNumber(): String = when (config.numberFormat) { - BestiaryConfig.NumberFormatEntry.SHORT -> this.format() + BestiaryConfig.NumberFormatEntry.SHORT -> NumberUtil.format(this) 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 8f759415a..8632f9d03 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,7 +38,6 @@ 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.format import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.drawDynamicText import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -232,8 +231,8 @@ object DamageIndicatorManager { val currentDamage = data.damageCounter.currentDamage val currentHealing = data.damageCounter.currentHealing if (currentDamage != 0L || currentHealing != 0L) { - val formatDamage = "§c" + currentDamage.format() - val formatHealing = "§a+" + currentHealing.format() + val formatDamage = "§c" + NumberUtil.format(currentDamage) + val formatHealing = "§a+" + NumberUtil.format(currentHealing) val finalResult = if (currentHealing == 0L) { formatDamage } else if (currentDamage == 0L) { @@ -251,8 +250,8 @@ object DamageIndicatorManager { diff += 9f } for (damage in data.damageCounter.oldDamages) { - val formatDamage = "§c" + damage.damage.format() + "/s" - val formatHealing = "§a+" + damage.healing.format() + "/s" + val formatDamage = "§c" + NumberUtil.format(damage.damage) + "/s" + val formatHealing = "§a+" + NumberUtil.format(damage.healing) + "/s" val finalResult = if (damage.healing == 0L) { formatDamage } else if (damage.damage == 0L) { @@ -379,7 +378,7 @@ object DamageIndicatorManager { entityData.healthText = customHealthText } else { val color = NumberUtil.percentageColor(health, maxHealth) - entityData.healthText = color.getChatColor() + health.format() + entityData.healthText = color.getChatColor() + NumberUtil.format(health) } entityData.timeLastTick = System.currentTimeMillis() return entity.uniqueID to entityData @@ -533,7 +532,7 @@ object DamageIndicatorManager { return NumberUtil.percentageColor( calcHealth.toLong(), calcMaxHealth.toLong(), - ).getChatColor() + calcHealth.format() + ).getChatColor() + NumberUtil.format(calcHealth) } private fun checkMagmaCube( @@ -552,7 +551,7 @@ object DamageIndicatorManager { else -> { val color = NumberUtil.percentageColor(health.toLong(), 10_000_000) entityData.namePrefix = "§a6/6" - return color.getChatColor() + health.format() + return color.getChatColor() + NumberUtil.format(health) } } + " §f" @@ -596,7 +595,7 @@ object DamageIndicatorManager { if (calcHealth == -1) return null val color = NumberUtil.percentageColor(calcHealth.toLong(), maxHealth.toLong()) - return color.getChatColor() + calcHealth.format() + return color.getChatColor() + NumberUtil.format(calcHealth) } private fun checkEnderSlayer( @@ -654,7 +653,7 @@ object DamageIndicatorManager { } var result = NumberUtil.percentageColor( calcHealth.toLong(), calcMaxHealth.toLong(), - ).getChatColor() + calcHealth.format() + ).getChatColor() + NumberUtil.format(calcHealth) 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 b9d60f507..2cac59010 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 @@ -216,13 +216,13 @@ object EnderNodeTracker { addAsSingletonList("§5§lEnder Node Tracker") addAsSingletonList("§d${data.totalNodesMined.addSeparators()} Ender Nodes mined") - addAsSingletonList("§6${lootProfit.values.sum().format()} Coins made") + addAsSingletonList("§6${format(lootProfit.values.sum())} 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 = (lootProfit[item] ?: 0.0).format() + val profit = format(lootProfit[item] ?: 0.0) 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${(totalEnderArmor * 10_000).format()}§7)" + "§7(§6${format(totalEnderArmor * 10_000)}§7)" ) for (item in EnderNode.entries.subList(11, 16)) { val count = (data.lootCount[item] ?: 0).addSeparators() - val profit = (lootProfit[item] ?: 0.0).format() + val profit = format(lootProfit[item] ?: 0.0) 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 = EnderNode.entries.subList(16, 21).sumOf { lootProfit[it] ?: 0.0 }.format() + val profit = format(EnderNode.entries.subList(16, 21).sumOf { lootProfit[it] ?: 0.0 }) 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 d5e632d49..61e03cf97 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,8 +4,8 @@ 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.format import at.hannibal2.skyhanni.utils.NumberUtil.roundToPrecision 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%", killNeeded.format()) + .replace("%killNeeded%", NumberUtil.format(killNeeded)) .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 ddd59ec0c..9fe716328 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,8 +11,8 @@ 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.format import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -67,7 +67,7 @@ object DianaProfitTracker { override fun getCoinName(item: TrackedItem) = "§6Dug Out Coins" override fun getCoinDescription(item: TrackedItem): List<String> { - val burrowDugCoinsFormat = item.totalAmount.format() + val burrowDugCoinsFormat = NumberUtil.format(item.totalAmount) 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 8050b3471..dc0c3b6ff 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.format +import at.hannibal2.skyhanni.utils.NumberUtil 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 { it.format() } ?: "?" + val format = lastDuplicateAmount?.let { NumberUtil.format(it) } ?: "?" 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 7cfbaad60..e01c0386d 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.format 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 amount.format() + if (amount is Long) return NumberUtil.format(amount) 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 98f2b999a..c707e2209 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.format import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.RenderUtils.highlight @@ -167,7 +167,7 @@ object CityProjectFeatures { }) { inInventory && !NEUItems.neuHasFocus() }) val price = internalName.getPrice(false) * amount - val format = price.format() + val format = NumberUtil.format(price) 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 7f0fd1c59..a9dba3cc1 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,8 +18,8 @@ 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.format import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark @@ -71,7 +71,7 @@ object FishingProfitTracker { override fun getCoinName(item: TrackedItem) = "§6Fished Coins" override fun getCoinDescription(item: TrackedItem): List<String> { - val mobKillCoinsFormat = item.totalAmount.format() + val mobKillCoinsFormat = NumberUtil.format(item.totalAmount) return listOf( "§7You fished up §6$mobKillCoinsFormat coins §7already." ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt index 5920ec977..e0aaa5719 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt @@ -10,8 +10,8 @@ import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName 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.format import net.minecraftforge.fml.common.eventhandler.SubscribeEvent import org.lwjgl.input.Keyboard @@ -32,7 +32,7 @@ object TrophyFishFillet { val filletValue = info.getFilletValue(rarity) * multiplier // TODO use magma fish member val filletPrice = filletValue * "MAGMA_FISH".asInternalName().getPrice() - event.toolTip.add("§7Fillet: §8${filletValue.addSeparators()} Magmafish §7(§6${filletPrice.format()}§7)") + event.toolTip.add("§7Fillet: §8${filletValue.addSeparators()} Magmafish §7(§6${NumberUtil.format(filletPrice)}§7)") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt index 90c413576..191dc125a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt @@ -20,7 +20,7 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.renderables.Renderable import net.minecraft.item.ItemStack @@ -97,15 +97,15 @@ object AnitaMedalProfit { if (itemPrice < 0) return val profit = itemPrice - fullCost - val profitFormat = profit.format() + val profitFormat = NumberUtil.format(profit) val color = if (profit > 0) "§6" else "§c" val hover = listOf( itemName, "", - "§7Item price: §6${itemPrice.format()} ", + "§7Item price: §6${NumberUtil.format(itemPrice)} ", // TODO add more exact material cost breakdown - "§7Material cost: §6${fullCost.format()} ", + "§7Material cost: §6${NumberUtil.format(fullCost)} ", "§7Final profit: §6${profitFormat} ", ) table.add( diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt index ec4c42119..1067312de 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt @@ -173,7 +173,7 @@ object GardenLevelDisplay { if (next && line.contains(" ")) { val progress = overflow / needForOnlyNextLvl val progressBar = StringUtils.progressBar(progress, 20) - iterator.set("$progressBar §e${overflow.addSeparators()}§6/§e${needForOnlyNextLvl.format()}") + iterator.set("$progressBar §e${overflow.addSeparators()}§6/§e${format(needForOnlyNextLvl)}") iterator.add("") iterator.add("§b§lOVERFLOW XP:") iterator.add("§7▸ ${overflowTotal.addSeparators()}") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt index 0d63b579b..352c7137e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt @@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.events.RenderInventoryItemTipEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -52,7 +52,7 @@ object ComposterInventoryNumbers { if (slotNumber == 46 || slotNumber == 52) { stack.getLore().matchFirst(valuePattern) { val having = group("having").removeColor().formatInt() - val havingFormat = having.format() + val havingFormat = NumberUtil.format(having) val total = group("total").removeColor() val color = if (slotNumber == 46) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt index f9fd08f1f..b198b3e3a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt @@ -38,8 +38,8 @@ import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName 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.format import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems @@ -369,9 +369,9 @@ object ComposterOverlay { val totalCostPreview = (fuelPricePerPreview + organicMatterPricePerPreview) * timeMultiplierPreview val materialCostFormatPreview = - if (totalCost != totalCostPreview) " §c➜ §6" + totalCostPreview.format() else "" + if (totalCost != totalCostPreview) " §c➜ §6" + NumberUtil.format(totalCostPreview) else "" val materialCostFormat = - " §7Material costs per $timeText: §6${totalCost.format()}$materialCostFormatPreview" + " §7Material costs per $timeText: §6${NumberUtil.format(totalCost)}$materialCostFormatPreview" newList.addAsSingletonList(materialCostFormat) val priceCompost = COMPOST.getPrice() @@ -379,8 +379,8 @@ object ComposterOverlay { val profitPreview = ((priceCompost * multiDropFactorPreview) - (fuelPricePerPreview + organicMatterPricePerPreview)) * timeMultiplierPreview - val profitFormatPreview = if (profit != profitPreview) " §c➜ §6" + profitPreview.format() else "" - val profitFormat = " §7Profit per $timeText: §6${profit.format()}$profitFormatPreview" + val profitFormatPreview = if (profit != profitPreview) " §c➜ §6" + NumberUtil.format(profitPreview) else "" + val profitFormat = " §7Profit per $timeText: §6${NumberUtil.format(profit)}$profitFormatPreview" newList.addAsSingletonList(profitFormat) newList.addAsSingletonList("") @@ -465,7 +465,7 @@ object ComposterOverlay { itemsNeeded: Double, onClick: (NEUInternalName) -> Unit, ) { - val format = totalPrice.format() + val format = NumberUtil.format(totalPrice) val selected = if (internalName == currentOrganicMatterItem || internalName == currentFuelItem) "§n" else "" val rawItemName = itemName.removeColor() val name = itemName.substring(0, 2) + selected + rawItemName diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt index d48ffb1dc..99fb3f147 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraft.client.gui.inventory.GuiChest import net.minecraft.inventory.ContainerChest @@ -68,14 +68,14 @@ object GardenComposterInventoryFeatures { val lowestBin = internalName.getPrice() val price = lowestBin * amount fullPrice += price - val format = price.format() + val format = NumberUtil.format(price) list[i] = list[i] + " §7(§6$format§7)" amountItems++ } } if (amountItems > 1) { - val format = fullPrice.format() + val format = NumberUtil.format(fullPrice) list[indexFullCost] = list[indexFullCost] + " §7(§6$format§7)" } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt index cc9ca42ef..b149dedad 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt @@ -34,8 +34,8 @@ import at.hannibal2.skyhanni.utils.NEUItems.getItemStack import at.hannibal2.skyhanni.utils.NEUItems.getNpcPrice 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.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getReforgeName import kotlinx.coroutines.launch @@ -281,7 +281,7 @@ object CropMoneyDisplay { } private fun format(moneyPerHour: Double) = if (config.compactPrice) { - moneyPerHour.format() + NumberUtil.format(moneyPerHour) } else { moneyPerHour.toLong().addSeparators() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt index 0c0990ced..2323b5e30 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.features.garden.fortuneguide.FortuneUpgrade import at.hannibal2.skyhanni.features.garden.fortuneguide.FortuneUpgrades import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment import at.hannibal2.skyhanni.utils.RenderUtils.VerticalAlignment import at.hannibal2.skyhanni.utils.guide.GuideScrollPage @@ -86,14 +86,14 @@ class UpgradePage(val crop0: () -> CropType?, sizeX: Int, sizeY: Int, paddingX: ) // TODO cleaner formating add( Renderable.string( - "§6" + costPerFF?.let { it.format() }, + "§6" + costPerFF?.let { NumberUtil.format(it) }, horizontalAlign = HorizontalAlignment.CENTER, verticalAlign = VerticalAlignment.CENTER ) ) add( Renderable.string( - "§6" + cost?.let { it.format() }, + "§6" + cost?.let { NumberUtil.format(it) }, horizontalAlign = HorizontalAlignment.CENTER, verticalAlign = VerticalAlignment.CENTER ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt index fec669858..42b8b5d35 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt @@ -11,8 +11,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.indexOfFirst import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName 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.format import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -64,7 +64,7 @@ object AnitaExtraFarmingFortune { // TODO: maybe only show the price when playing classic // if (!LorenzUtils.noTradeMode) { val price = jacobTickets * "JACOBS_TICKET".asInternalName().getPrice() - event.toolTip.add(index, " §7Price: §6${price.format()} coins") + event.toolTip.add(index, " §7Price: §6${NumberUtil.format(price)} coins") // } event.toolTip.add(index, "§aJacob Tickets §8x${jacobTickets.addSeparators()}") event.toolTip.add(index, "§6Gold medals: §8x$goldMedals") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt index 38d24d967..c9759cd58 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt @@ -13,8 +13,8 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.CollectionUtils.indexOfFirst import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.StringUtils import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -77,7 +77,7 @@ object GardenCropMilestoneInventory { event.toolTip.add(index, " ") val progressBar = StringUtils.progressBar(percentage, 19) - event.toolTip.add(index, "$progressBar §e${counter.addSeparators()}§6/§e${maxCounter.format()}") + event.toolTip.add(index, "$progressBar §e${counter.addSeparators()}§6/§e${NumberUtil.format(maxCounter)}") event.toolTip.add(index, "§7Progress to Tier $maxTier: §e$percentageFormat") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt index d18746e67..625216f85 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt @@ -16,8 +16,8 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables @@ -61,17 +61,17 @@ object SkyMartCopperPrice { val profit = itemPrice - (otherItemsPrice ?: 0.0) val factor = profit / copper - val perFormat = factor.format() + val perFormat = NumberUtil.format(factor) val itemName = item.itemName val hover = buildList { add(itemName) add("") - add("§7Item price: §6${itemPrice.format()} ") + add("§7Item price: §6${NumberUtil.format(itemPrice)} ") otherItemsPrice?.let { - add("§7Additional cost: §6${it.format()} ") + add("§7Additional cost: §6${NumberUtil.format(it)} ") } - add("§7Profit per purchase: §6${profit.format()} ") + add("§7Profit per purchase: §6${NumberUtil.format(profit)} ") add("") add("§7Copper amount: §c${copper.addSeparators()} ") add("§7Profit per copper: §6${perFormat} ") diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt index c809541ee..157f05c30 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt @@ -9,7 +9,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -40,7 +40,7 @@ object GardenNextPlotPrice { val (itemName, amount) = it val lowestBin = NEUInternalName.fromItemName(itemName).getPrice() val price = lowestBin * amount - val format = price.format() + val format = NumberUtil.format(price) list[i] = list[i] + " §7(§6$format§7)" } ?: run { ErrorManager.logErrorStateWithData( diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleLine.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleLine.kt index f2aabc22b..e81486ecd 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleLine.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestParticleLine.kt @@ -7,8 +7,6 @@ import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent import at.hannibal2.skyhanni.events.ReceiveParticleEvent import at.hannibal2.skyhanni.features.garden.GardenAPI import at.hannibal2.skyhanni.features.garden.GardenPlotAPI -import at.hannibal2.skyhanni.features.garden.GardenPlotAPI.isBarn -import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboardUtils.formatNum import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.LocationUtils @@ -98,7 +96,6 @@ object PestParticleLine { private fun showMiddle(event: LorenzRenderWorldEvent) { if (locations.size <= 0) return val plot = GardenPlotAPI.getCurrentPlot() ?: return - if (plot.isBarn()) return val middle = plot.middle.copy(y = LocationUtils.playerLocation().y) if (middle.distanceToPlayer() > 15) return @@ -107,7 +104,6 @@ object PestParticleLine { } private fun draw(event: LorenzRenderWorldEvent, list: List<ParticleLocation>) { - 3.formatNum() val color = LorenzColor.YELLOW.toColor() for ((prev, next) in list.asSequence().zipWithNext()) { // TODO time in config diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt index fc45950c7..62ddfb5f8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt @@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule 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.format import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.SimpleTimeMark import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -63,7 +63,7 @@ object PestProfitTracker { override fun getCoinName(item: TrackedItem) = "§6Pest Kill Coins" override fun getCoinDescription(item: TrackedItem): List<String> { - val pestsCoinsFormat = item.totalAmount.format() + val pestsCoinsFormat = NumberUtil.format(item.totalAmount) return listOf( "§7Killing pests gives you coins.", "§7You got §6$pestsCoinsFormat coins §7that way." diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt index af3582630..bd344bb51 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt @@ -19,8 +19,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut import at.hannibal2.skyhanni.utils.CollectionUtils.editCopy import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems @@ -224,7 +224,7 @@ object GardenVisitorDropStatistics { fun format(amount: Number): String { if (amount is Int) return amount.addSeparators() - if (amount is Long) return amount.format() + if (amount is Long) return NumberUtil.format(amount) return "$amount" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt index eb4fd7bc0..98230dfcf 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt @@ -47,8 +47,8 @@ import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.allIngredients 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.format import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.drawString @@ -204,7 +204,7 @@ object GardenVisitorFeatures { if (config.shoppingList.showPrice) { val price = internalName.getPrice() * amount totalPrice += price - val format = price.format() + val format = NumberUtil.format(price) list.add(" §7(§6$format§7)") } @@ -213,7 +213,7 @@ object GardenVisitorFeatures { add(list) } if (totalPrice > 0) { - val format = totalPrice.format() + val format = NumberUtil.format(totalPrice) this[0] = listOf("§7Visitor Shopping List: §7(§6$format§7)") } } @@ -401,14 +401,14 @@ object GardenVisitorFeatures { if (config.inventory.experiencePrice) { gardenExperiencePattern.matchMatcher(formattedLine) { val gardenExp = group("amount").formatInt() - val pricePerCopper = (totalPrice / gardenExp).toInt().format() + val pricePerCopper = NumberUtil.format((totalPrice / gardenExp).toInt()) finalList.set(index, "$formattedLine §7(§6$pricePerCopper §7per)") } } copperPattern.matchMatcher(formattedLine) { val copper = group("amount").formatInt() - val pricePerCopper = (totalPrice / copper).toInt().format() + val pricePerCopper = NumberUtil.format((totalPrice / copper).toInt()) visitor.pricePerCopper = (totalPrice / copper).toInt() visitor.totalPrice = totalPrice // Estimate could be changed to most value per copper item, instead of green thumb @@ -434,7 +434,7 @@ object GardenVisitorFeatures { val price = internalName.getPrice() * amount if (config.inventory.showPrice) { - val format = price.format() + val format = NumberUtil.format(price) finalList[index] = "$formattedLine §7(§6$format§7)" } if (!readingShoppingList) continue diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt index 848e38799..05041df18 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt @@ -14,7 +14,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzColor -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.drawBorder import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -124,10 +124,10 @@ object VisitorRewardWarning { } blockedToolTip.add("") - val pricePerCopper = visitor.pricePerCopper?.let { it.format() } + val pricePerCopper = visitor.pricePerCopper?.let { NumberUtil.format(it) } // TODO remove !! - best by creating new class LoadedVisitor without any nullable objects val loss = visitor.totalPrice!! - visitor.totalReward!! - val formattedLoss = loss.absoluteValue.format() + val formattedLoss = NumberUtil.format(loss.absoluteValue) blockedToolTip.add(blockDescription(blockReason, pricePerCopper, loss, formattedLoss)) blockedToolTip.add(" §7(Bypass by holding ${KeyboardManager.getKeyName(config.bypassKey)})") diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt index 6e6f9e609..8aae8fe55 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt @@ -5,8 +5,8 @@ import at.hannibal2.skyhanni.data.HypixelData import at.hannibal2.skyhanni.data.ScoreboardData import at.hannibal2.skyhanni.features.bingo.BingoAPI import at.hannibal2.skyhanni.features.gui.customscoreboard.CustomScoreboard.displayConfig +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeResets @@ -34,7 +34,7 @@ object CustomScoreboardUtils { } internal fun Number.formatNum(): String = when (displayConfig.numberFormat) { - DisplayConfig.NumberFormat.SHORT -> this.format() + DisplayConfig.NumberFormat.SHORT -> NumberUtil.format(this) DisplayConfig.NumberFormat.LONG -> this.addSeparators() else -> "0" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt index 04041bba1..5825436b8 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt @@ -24,8 +24,8 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addButton import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -202,8 +202,9 @@ object ChestValue { private fun Double.formatPrice(): String { return when (config.formatType) { - NumberFormatEntry.SHORT -> if (this > 1_000_000_000) this.format(true) else this - .format() + NumberFormatEntry.SHORT -> if (this > 1_000_000_000) NumberUtil.format(this, true) else NumberUtil.format( + this + ) NumberFormatEntry.LONG -> this.addSeparators() else -> "0" diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 03778e510..21defeadc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -39,7 +39,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary @@ -263,7 +263,7 @@ object ItemDisplayOverlayFeatures { if (BINGO_GOAL_RANK.isSelected() && chestName == "Bingo Card" && lore.lastOrNull() == "§aGOAL REACHED") { lore.matchFirst(bingoGoalRankPattern) { val rank = group("rank").formatLong() - if (rank < 10000) return "§6${rank.format()}" + if (rank < 10000) return "§6${NumberUtil.format(rank)}" } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt index a6a7e860b..5423aa396 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt @@ -13,7 +13,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.highlight import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -71,7 +71,7 @@ object PowerStoneGuideFeatures { val internalName = missing[event.slot.slotNumber] ?: return val totalPrice = internalName.getPrice() * 9 - event.toolTip.add(5, "9x from Bazaar: §6${totalPrice.format()}") + event.toolTip.add(5, "9x from Bazaar: §6${NumberUtil.format(totalPrice)}") } fun isEnabled() = LorenzUtils.inSkyBlock && SkyHanniMod.feature.inventory.powerStoneGuide diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt index ea48f4136..6fb1caaa2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt @@ -22,8 +22,8 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName import at.hannibal2.skyhanni.utils.NEUItems +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RenderUtils.highlight import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -112,13 +112,13 @@ object SackDisplay { NumberFormatEntry.DEFAULT -> { addAlignedNumber("$colorCode${stored.addSeparators()}") addString("§7/") - addAlignedNumber("§b${total.format()}") + addAlignedNumber("§b${NumberUtil.format(total)}") } NumberFormatEntry.FORMATTED -> { - addAlignedNumber("$colorCode${stored.format()}") + addAlignedNumber("$colorCode${NumberUtil.format(stored)}") addString("§7/") - addAlignedNumber("§b${total.format()}") + addAlignedNumber("§b${NumberUtil.format(total)}") } NumberFormatEntry.UNFORMATTED -> { @@ -285,7 +285,7 @@ object SackDisplay { } private fun format(price: Long) = if (config.priceFormat == PriceFormatEntry.FORMATTED) { - price.format() + NumberUtil.format(price) } else { price.addSeparators() } diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt index 04ccdb18e..631ee8175 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt @@ -12,7 +12,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.item.ItemStack import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -60,7 +60,7 @@ object BazaarBestSellMethod { val data = internalName.getBazaarDataOrError() val totalDiff = (data.sellOfferPrice - data.instantBuyPrice) * having - val result = totalDiff.toInt().format() + val result = NumberUtil.format(totalDiff.toInt()) val name = internalName.itemName return "$name§7 sell difference: §6$result coins" diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt index 55cfef5e2..009a972d0 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt @@ -13,8 +13,8 @@ import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName 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.format import at.hannibal2.skyhanni.utils.PrimitiveItemStack import at.hannibal2.skyhanni.utils.PrimitiveItemStack.Companion.makePrimitiveStack import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -61,14 +61,14 @@ object CraftMaterialsFromBazaar { val neededMaterials = mutableListOf<PrimitiveItemStack>() display = buildList { val totalPrice = calculateTotalPrice(recipeMaterials, 1) - add(Renderable.string("§7Craft $recipeName §7(§6${totalPrice.format()}§7)")) + add(Renderable.string("§7Craft $recipeName §7(§6${NumberUtil.format(totalPrice)}§7)")) for (item in recipeMaterials) { val material = item.internalName val amount = item.amount var text = "§8${amount.addSeparators()}x " + material.itemName if (material.isBazaarItem()) { neededMaterials.add(item) - text += " §6${(material.getPrice() * amount).format()}" + text += " §6${NumberUtil.format(material.getPrice() * amount)}" } add(Renderable.string(text)) } @@ -108,7 +108,7 @@ object CraftMaterialsFromBazaar { for ((material, amount) in neededMaterials) { val priceMultiplier = amount * multiplier val text = "§8${priceMultiplier.addSeparators()}x " + material.itemName + - " §6${(material.getPrice() * priceMultiplier).format()}" + " §6${NumberUtil.format(material.getPrice() * priceMultiplier)}" add(Renderable.optionalLink(text, onClick = { BazaarApi.searchForBazaarItem(material, priceMultiplier) })) @@ -131,7 +131,7 @@ object CraftMaterialsFromBazaar { val isThisMultiply = m == multiplier val nameColor = if (isThisMultiply) "§a" else "§e" val priceColor = if (isThisMultiply) "§6" else "§7" - val price = priceColor + calculateTotalPrice(neededMaterials, m).format() + val price = priceColor + NumberUtil.format(calculateTotalPrice(neededMaterials, m)) val text = "${nameColor}Mulitply x$m $price" if (!isThisMultiply) { add( diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt index 79a416c07..8d8ea540f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt @@ -15,8 +15,8 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.NumberUtil.million import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull @@ -118,19 +118,19 @@ object ChocolateShopPrice { val profit = product.itemPrice - (product.otherItemPrice ?: 0.0) val factor = (profit / product.chocolate) * multiplier - val perFormat = factor.format() + val perFormat = NumberUtil.format(factor) val hover = buildList { add(product.name) add("") - add("§7Item price: §6${product.itemPrice.format()} ") + add("§7Item price: §6${NumberUtil.format(product.itemPrice)} ") product.otherItemPrice?.let { - add("§7Additional cost: §6${it.format()} ") + add("§7Additional cost: §6${NumberUtil.format(it)} ") } - add("§7Profit per purchase: §6${profit.format()} ") + add("§7Profit per purchase: §6${NumberUtil.format(profit)} ") add("") - add("§7Chocolate amount: §c${product.chocolate.format()} ") + add("§7Chocolate amount: §c${NumberUtil.format(product.chocolate)} ") add("§7Profit per million chocolate: §6${perFormat} ") add("") val formattedTimeUntilGoal = ChocolateAmount.CURRENT.formattedTimeUntilGoal(product.chocolate) diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt index 876759e92..75515717e 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt @@ -11,7 +11,7 @@ import at.hannibal2.skyhanni.utils.DelayedRun import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches @@ -96,10 +96,10 @@ object WardrobeAPI { var totalPrice = 0.0 for (stack in slot.armor.filterNotNull()) { val price = EstimatedItemValueCalculator.getTotalPrice(stack) - add(" §7- ${stack.name}: §6${price.format()}") + add(" §7- ${stack.name}: §6${NumberUtil.format(price)}") totalPrice += price } - if (totalPrice != 0.0) add(" §aTotal Value: §6§l${totalPrice.format()} coins") + if (totalPrice != 0.0) add(" §aTotal Value: §6§l${NumberUtil.format(totalPrice)} coins") } @SubscribeEvent diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt index 358f79efa..fb6e9054a 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt @@ -13,8 +13,8 @@ import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.isInIsland import at.hannibal2.skyhanni.utils.NEUInternalName 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.format import at.hannibal2.skyhanni.utils.StringUtils import at.hannibal2.skyhanni.utils.renderables.Renderable import at.hannibal2.skyhanni.utils.tracker.ItemTrackerData @@ -105,13 +105,13 @@ object ExcavatorProfitTracker { val fossilDustPrice = pricePer * fossilDustGained addAsSingletonList( Renderable.hoverTips( - "§7${fossilDustGained.format()}x §fFossil Dust§7: §6${fossilDustPrice.format()}", + "§7${NumberUtil.format(fossilDustGained)}x §fFossil Dust§7: §6${NumberUtil.format(fossilDustPrice)}", listOf( - "§7You gained §6${fossilDustPrice.format()} coins §7in total", + "§7You gained §6${NumberUtil.format(fossilDustPrice)} coins §7in total", "§7for all §e$fossilDustGained §fFossil Dust", "§7you have collected.", "", - "§7Price Per Fossil Dust: §6${pricePer.format()}" + "§7Price Per Fossil Dust: §6${NumberUtil.format(pricePer)}" ) ) ) @@ -142,9 +142,9 @@ object ExcavatorProfitTracker { val name = StringUtils.pluralize(timesExcavated.toInt(), scrapItem.itemName) addAsSingletonList( Renderable.hoverTips( - "$name §7price: §c-${scrapPrice.format()}", + "$name §7price: §c-${NumberUtil.format(scrapPrice)}", listOf( - "§7You paid §c${scrapPrice.format()} coins §7in total", + "§7You paid §c${NumberUtil.format(scrapPrice)} coins §7in total", "§7for all §e$timesExcavated $name", "§7you have used." ) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt index 2884ffb98..161330da5 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt @@ -4,7 +4,7 @@ import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.utils.ItemUtils.cleanName -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.formatLong import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern @@ -27,7 +27,7 @@ object GlacitePowderFeatures { glacitePowderPattern.matchMatcher(event.stack.cleanName()) { val powder = group("amount").formatLong() - event.stackTip = "§b${powder.format()}" + event.stackTip = "§b${NumberUtil.format(powder)}" } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt index 4ad79da5c..ee2b5fab2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt @@ -8,8 +8,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.NEUInternalName 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.format import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -29,7 +29,7 @@ object ProfitPerExcavation { val pricePer = it.getPrice() if (pricePer == -1.0) continue val profit = amount * pricePer - val text = "§eFound $name §8${amount.addSeparators()}x §7(§6${profit.format()}§7)" + val text = "§eFound $name §8${amount.addSeparators()}x §7(§6${NumberUtil.format(profit)}§7)" map[text] = profit totalProfit += profit } @@ -38,12 +38,12 @@ object ProfitPerExcavation { val scrapItem = FossilExcavatorAPI.scrapItem val scrapPrice = scrapItem.getPrice() - map["${scrapItem.itemName}: §c-${scrapPrice.format()}"] = -scrapPrice + map["${scrapItem.itemName}: §c-${NumberUtil.format(scrapPrice)}"] = -scrapPrice totalProfit -= scrapPrice val hover = map.sortedDesc().keys.toMutableList() val profitPrefix = if (totalProfit < 0) "§c" else "§6" - val totalMessage = "Profit this excavation: $profitPrefix${totalProfit.format()}" + val totalMessage = "Profit this excavation: $profitPrefix${NumberUtil.format(totalProfit)}" hover.add("") hover.add("§e$totalMessage") ChatUtils.hoverableChat(totalMessage, hover) diff --git a/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt b/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt index 417a531c0..73771d354 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt @@ -8,8 +8,8 @@ import at.hannibal2.skyhanni.utils.CollectionUtils.sortedDesc import at.hannibal2.skyhanni.utils.ItemUtils.itemName import at.hannibal2.skyhanni.utils.NEUInternalName 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.format import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @SkyHanniModule @@ -29,7 +29,7 @@ object MineshaftCorpseProfitPer { val pricePer = it.getPrice() if (pricePer == -1.0) continue val profit = amount * pricePer - val text = "§eFound $name §8${amount.addSeparators()}x §7(§6${profit.format()}§7)" + val text = "§eFound $name §8${amount.addSeparators()}x §7(§6${NumberUtil.format(profit)}§7)" map[text] = profit totalProfit += profit } @@ -42,13 +42,13 @@ object MineshaftCorpseProfitPer { val keyName = it.itemName val price = it.getPrice() - map["$keyName: §c-${price.format()}"] = -price + map["$keyName: §c-${NumberUtil.format(price)}"] = -price totalProfit -= price } val hover = map.sortedDesc().keys.toMutableList() val profitPrefix = if (totalProfit < 0) "§c" else "§6" - val totalMessage = "Profit for $name Corpse§e: $profitPrefix${totalProfit.format()}" + val totalMessage = "Profit for $name Corpse§e: $profitPrefix${NumberUtil.format(totalProfit)}" hover.add("") hover.add("§e$totalMessage") ChatUtils.hoverableChat(totalMessage, hover) diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt index 5d2abee6e..55f34be5c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt @@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzRarity import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.round +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetExp import at.hannibal2.skyhanni.utils.StringUtils @@ -54,7 +54,7 @@ object PetExpTooltip { val addLegendaryColor = if (isBelowLegendary) "§6" else "" event.toolTip.add( index, - "$progressBar §e${petExperience.addSeparators()}§6/§e${maxXp.format()}" + "$progressBar §e${petExperience.addSeparators()}§6/§e${NumberUtil.format(maxXp)}" ) event.toolTip.add(index, "§7Progress to ${addLegendaryColor}Level $maxLevel: §e$percentageFormat") } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt index ce9304caa..a2ed65ee7 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt @@ -27,8 +27,8 @@ import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer import net.minecraft.client.Minecraft @@ -213,7 +213,7 @@ object EstimatedItemValue { val numberFormat = if (config.exactPrice) { totalPrice.roundToLong().addSeparators() } else { - totalPrice.format() + NumberUtil.format(totalPrice) } list.add("§aTotal: §6§l$numberFormat coins") diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt index 663b089b5..be83ff917 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt @@ -17,7 +17,7 @@ import at.hannibal2.skyhanni.utils.NEUItems import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull import at.hannibal2.skyhanni.utils.NEUItems.getPrice import at.hannibal2.skyhanni.utils.NEUItems.getPriceOrNull -import at.hannibal2.skyhanni.utils.NumberUtil.format +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAbilityScrolls import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getArmorDye @@ -121,7 +121,7 @@ object EstimatedItemValueCalculator { ) if (price != null) { val name = attributes[0].first.fixMending().allLettersFirstUppercase() - list.add("§7Attribute §9$name ${attributes[0].second}§7: (§6${price.format()}§7)",) + list.add("§7Attribute §9$name ${attributes[0].second}§7: (§6${NumberUtil.format(price)}§7)",) return price } } @@ -134,7 +134,7 @@ object EstimatedItemValueCalculator { if (comboPrice != null) { val useless = isUselessAttribute(combo) val color = if (comboPrice > basePrice && !useless) "§6" else "§7" - list.add("§7Attribute Combo: ($color${comboPrice.format()}§7)") + list.add("§7Attribute Combo: ($color${NumberUtil.format(comboPrice)}§7)") if (!useless) { subTotal += addAttributePrice(comboPrice, basePrice) } @@ -159,7 +159,7 @@ object EstimatedItemValueCalculator { list.add( " $nameColor${ displayName.allLettersFirstUppercase() - } ${attr.second}§7: $priceColor${if (price != null) price.format() else "Unknown"}", + } ${attr.second}§7: $priceColor${if (price != null) NumberUtil.format(price) else "Unknown"}", ) } // Adding 0.1 so that we always show the estimated item value overlay @@ -214,8 +214,8 @@ object EstimatedItemValueCalculator { val applyCost = getReforgeStoneApplyCost(stack, reforge.reforgeCosts, internalName) ?: return 0.0 list.add("§7Reforge: §9${reforge.reforgeName}") - list.add(" §7Stone $reforgeStoneName §7(§6" + reforgeStonePrice.format() + "§7)") - list.add(" §7Apply cost: (§6" + applyCost.format() + "§7)") + list.add(" §7Stone $reforgeStoneName §7(§6" + NumberUtil.format(reforgeStonePrice) + "§7)") + list.add(" §7Apply cost: (§6" + NumberUtil.format(applyCost) + "§7)") return reforgeStonePrice + applyCost } @@ -264,7 +264,7 @@ object EstimatedItemValueCalculator { if (!stack.isRecombobulated()) return 0.0 val price = "RECOMBOBULATOR_3000".asInternalName().getPrice() - list.add("§7Recombobulated: §a§l✔ §7(§6" + price.format() + "§7)") + list.add("§7Recombobulated: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -272,7 +272,7 @@ object EstimatedItemValueCalculator { if (!stack.hasJalapenoBook()) return 0.0 val price = "JALAPENO_BOOK".asInternalName().getPrice() - list.add("§7Jalapeno Book: §a§l✔ §7(§6" + price.format() + "§7)") + list.add("§7Jalapeno Book: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -282,7 +282,7 @@ object EstimatedItemValueCalculator { val wtfHardcodedConduit = "ETHERWARP_CONDUIT".asInternalName() val wtfHardcodedMerger = "ETHERWARP_MERGER".asInternalName() val price = wtfHardcodedConduit.getPrice() + wtfHardcodedMerger.getPrice() - list.add("§7Etherwarp: §a§l✔ §7(§6" + price.format() + "§7)") + list.add("§7Etherwarp: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -290,7 +290,7 @@ object EstimatedItemValueCalculator { if (!stack.hasWoodSingularity()) return 0.0 val price = "WOOD_SINGULARITY".asInternalName().getPrice() - list.add("§7Wood Singularity: §a§l✔ §7(§6" + price.format() + "§7)") + list.add("§7Wood Singularity: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -298,7 +298,7 @@ object EstimatedItemValueCalculator { if (!stack.hasArtOfWar()) return 0.0 val price = "THE_ART_OF_WAR".asInternalName().getPrice() - list.add("§7The Art of War: §a§l✔ §7(§6" + price.format() + "§7)") + list.add("§7The Art of War: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -306,7 +306,7 @@ object EstimatedItemValueCalculator { if (!stack.hasBookOfStats()) return 0.0 val price = "BOOK_OF_STATS".asInternalName().getPrice() - list.add("§7Book of Stats: §a§l✔ §7(§6" + price.format() + "§7)") + list.add("§7Book of Stats: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -315,7 +315,7 @@ object EstimatedItemValueCalculator { if (!stack.hasArtOfPeace()) return 0.0 val price = "THE_ART_OF_PEACE".asInternalName().getPrice() - list.add("§7The Art Of Peace: §a§l✔ §7(§6" + price.format() + "§7)") + list.add("§7The Art Of Peace: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -336,13 +336,13 @@ object EstimatedItemValueCalculator { val wtfHardcodedHpb = "HOT_POTATO_BOOK".asInternalName() val hpbPrice = wtfHardcodedHpb.getPrice() * hpb - list.add("§7HPB's: §e$hpb§7/§e10 §7(§6" + hpbPrice.format() + "§7)") + list.add("§7HPB's: §e$hpb§7/§e10 §7(§6" + NumberUtil.format(hpbPrice) + "§7)") totalPrice += hpbPrice if (fuming > 0) { val wtfHardcodedFuming = "FUMING_POTATO_BOOK".asInternalName() val fumingPrice = wtfHardcodedFuming.getPrice() * fuming - list.add("§7Fuming: §e$fuming§7/§e5 §7(§6" + fumingPrice.format() + "§7)") + list.add("§7Fuming: §e$fuming§7/§e5 §7(§6" + NumberUtil.format(fumingPrice) + "§7)") totalPrice += fumingPrice } @@ -354,7 +354,7 @@ object EstimatedItemValueCalculator { val wtfHardcodedDumbFarmers = "FARMING_FOR_DUMMIES".asInternalName() val price = wtfHardcodedDumbFarmers.getPrice() * count - list.add("§7Farming for Dummies: §e$count§7/§e5 §7(§6" + price.format() + "§7)") + list.add("§7Farming for Dummies: §e$count§7/§e5 §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -363,7 +363,7 @@ object EstimatedItemValueCalculator { val broDilloMiningSoBad = "POLARVOID_BOOK".asInternalName() val price = broDilloMiningSoBad.getPrice() * count - list.add("§7Polarvoid: §e$count§7/§e5 §7(§6" + price.format() + "§7)") + list.add("§7Polarvoid: §e$count§7/§e5 §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -372,7 +372,7 @@ object EstimatedItemValueCalculator { val tfHardcodedItemAgain = "BOOKWORM_BOOK".asInternalName() val price = tfHardcodedItemAgain.getPrice() * count - list.add("§7Bookworm's Favorite Book: §e$count§7/§e5 §7(§6" + price.format() + "§7)") + list.add("§7Bookworm's Favorite Book: §e$count§7/§e5 §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -384,7 +384,7 @@ object EstimatedItemValueCalculator { val wtfHardcodedSilex = "SIL_EX".asInternalName() val price = wtfHardcodedSilex.getPrice() * tier - list.add("§7Silex: §e$tier§7/§e$maxTier §7(§6" + price.format() + "§7)") + list.add("§7Silex: §e$tier§7/§e$maxTier §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -393,7 +393,7 @@ object EstimatedItemValueCalculator { val wtfHardcodedTuner = "TRANSMISSION_TUNER".asInternalName() val price = wtfHardcodedTuner.getPrice() * count - list.add("§7Transmission Tuners: §e$count§7/§e4 §7(§6" + price.format() + "§7)") + list.add("§7Transmission Tuners: §e$count§7/§e4 §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -402,7 +402,7 @@ object EstimatedItemValueCalculator { val wtfHardcodedTuner = "MANA_DISINTEGRATOR".asInternalName() val price = wtfHardcodedTuner.getPrice() * count - list.add("§7Mana Disintegrators: §e$count§7/§e10 §7(§6" + price.format() + "§7)") + list.add("§7Mana Disintegrators: §e$count§7/§e10 §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -428,7 +428,7 @@ object EstimatedItemValueCalculator { } } - list.add("§7Master Stars: §e$masterStars§7/§e5 §7(§6" + price.format() + "§7)") + list.add("§7Master Stars: §e$masterStars§7/§e5 §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -442,11 +442,11 @@ object EstimatedItemValueCalculator { val price = internalName.getPriceOrNull() ?: continue totalPrice += price - val format = price.format() + val format = NumberUtil.format(price) map[" $name §7(§6$format§7)"] = price } if (map.isNotEmpty()) { - list.add("§7Drill upgrades: §6" + totalPrice.format()) + list.add("§7Drill upgrades: §6" + NumberUtil.format(totalPrice)) list += map.sortedDesc().keys } return totalPrice @@ -457,7 +457,7 @@ object EstimatedItemValueCalculator { val price = internalName.getPrice() val name = internalName.itemNameWithoutColor - list.add("§7$name: §a§l✔ §7(§6" + price.format() + "§7)") + list.add("§7$name: §a§l✔ §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -481,7 +481,7 @@ object EstimatedItemValueCalculator { val name = internalName.getNameOrRepoError() val displayname = name ?: "§c${internalName.asString()}" val color = if (shouldIgnorePrice) "§7" else "§6" - list.add("§7$label: $displayname §7($color" + price.format() + "§7)") + list.add("§7$label: $displayname §7($color" + NumberUtil.format(price) + "§7)") if (name == null) { list.add(" §8(Not yet in NEU Repo)") } @@ -496,7 +496,7 @@ object EstimatedItemValueCalculator { val price = internalName.getPrice() val name = internalName.itemName - list.add("§7Enrichment: $name §7(§6" + price.format() + "§7)") + list.add("§7Enrichment: $name §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -519,11 +519,11 @@ object EstimatedItemValueCalculator { val price = internalName.getPriceOrNull() ?: continue totalPrice += price - val format = price.format() + val format = NumberUtil.format(price) map[" $name §7(§6$format§7)"] = price } if (map.isNotEmpty()) { - list.add("§7Ability Scrolls: §6" + totalPrice.format()) + list.add("§7Ability Scrolls: §6" + NumberUtil.format(totalPrice)) list += map.sortedDesc().keys } return totalPrice @@ -542,7 +542,7 @@ object EstimatedItemValueCalculator { return 0.0 } - list.add("§7Base item: $name §7(§6" + price.format() + "§7)") + list.add("§7Base item: $name §7(§6" + NumberUtil.format(price) + "§7)") return price } @@ -615,14 +615,14 @@ object EstimatedItemValueCalculator { val price = singlePrice * multiplier totalPrice += price - val format = price.format() + val format = NumberUtil.format(price) map[" $name §7(§6$format§7)"] = price } val enchantmentsCap: Int = config.enchantmentsCap.get() if (map.isNotEmpty()) { - list.add("§7Enchantments: §6" + totalPrice.format()) + list.add("§7Enchantments: §6" + NumberUtil.format(totalPrice)) var i = 0 for (entry in map.sortedDesc().keys) { if (i == enchantmentsCap) { @@ -655,7 +655,7 @@ object EstimatedItemValueCalculator { val price = internalName.getPrice() * amount totalPrice += price - val format = price.format() + val format = NumberUtil.format(price) val text = if (amount == 1) { " $name §7(§6$format§7)" @@ -666,7 +666,7 @@ object EstimatedItemValueCalculator { } if (priceMap.isNotEmpty()) { - list.add("§7Gemstones: §6" + totalPrice.format()) + list.add("§7Gemstones: §6" + NumberUtil.format(totalPrice)) list += priceMap.sortedDesc().keys } return totalPrice @@ -714,17 +714,17 @@ object EstimatedItemValueCalculator { val splitSlot = slot.key.split("_") // eg. SAPPHIRE_1 val colorCode = SkyBlockItemModifierUtils.GemstoneSlotType.getColorCode(splitSlot[0]) - val formattedPrice = (totalPrice - previousTotal).format() + val formattedPrice = NumberUtil.format(totalPrice - previousTotal) // eg. SAPPHIRE_1 -> Sapphire Slot 2 val displayName = splitSlot[0].lowercase(Locale.ENGLISH).replaceFirstChar(Char::uppercase) + " Slot" + - // If the slot index is 0, we don't need to specify - if (splitSlot[1] != "0") " " + (splitSlot[1].toInt() + 1) else "" + // If the slot index is 0, we don't need to specify + if (splitSlot[1] != "0") " " + (splitSlot[1].toInt() + 1) else "" priceMap[" §$colorCode $displayName §7(§6$formattedPrice§7)"] = totalPrice - previousTotal } - list.add("§7Gemstone Slot Unlock Cost: §6" + totalPrice.format()) + list.add("§7Gemstone Slot Unlock Cost: §6" + NumberUtil.format(totalPrice)) list += priceMap.sortedDesc().keys return totalPrice } diff --git a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt index f8d8bc3ef..df91766cc 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt @@ -19,8 +19,8 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector import at.hannibal2.skyhanni.utils.NEUInternalName import at.hannibal2.skyhanni.utils.NEUItems.getItemStack +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems import at.hannibal2.skyhanni.utils.renderables.Renderable @@ -180,7 +180,7 @@ object ShowMotesNpcSellPrice { } private fun Double.formatPrice(): String = when (config.inventoryValue.formatType) { - NumberFormatEntry.SHORT -> this.format() + NumberFormatEntry.SHORT -> NumberUtil.format(this) NumberFormatEntry.LONG -> this.addSeparators() else -> "0" } diff --git a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt index ee0bed48e..36f63647f 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt @@ -18,8 +18,8 @@ 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.format import at.hannibal2.skyhanni.utils.NumberUtil.formatDouble import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -75,7 +75,7 @@ object SlayerProfitTracker { override fun getCoinName(item: TrackedItem) = "§6Mob Kill Coins" override fun getCoinDescription(item: TrackedItem): List<String> { - val mobKillCoinsFormat = item.totalAmount.format() + val mobKillCoinsFormat = NumberUtil.format(item.totalAmount) return listOf( "§7Killing mobs gives you coins (more with scavenger).", "§7You got §6$mobKillCoinsFormat coins §7that way." @@ -176,7 +176,7 @@ object SlayerProfitTracker { var profit = tracker.drawItems(data, { true }, this) val slayerSpawnCost = data.slayerSpawnCost if (slayerSpawnCost != 0L) { - val mobKillCoinsFormat = slayerSpawnCost.format() + val mobKillCoinsFormat = NumberUtil.format(slayerSpawnCost) addAsSingletonList( Renderable.hoverTips( " §7Slayer Spawn Costs: §c$mobKillCoinsFormat", @@ -200,7 +200,7 @@ object SlayerProfitTracker { } val coinFormat: (ItemTrackerData.TrackedItem) -> Pair<String, List<String>> = { item -> - val mobKillCoinsFormat = item.totalAmount.format() + val mobKillCoinsFormat = NumberUtil.format(item.totalAmount) val text = " §6Mob kill coins§7: §6$mobKillCoinsFormat" val lore = listOf( "§7Killing mobs gives you coins (more with scavenger)", diff --git a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt index d232189ce..8194e7b6d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt @@ -17,7 +17,6 @@ import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth import at.hannibal2.skyhanni.utils.NumberUtil -import at.hannibal2.skyhanni.utils.NumberUtil.format import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings import at.hannibal2.skyhanni.utils.getLorenzVec @@ -148,8 +147,8 @@ object SummoningMobManager { val maxHealth = entityLiving.baseMaxHealth val color = NumberUtil.percentageColor(currentHealth.toLong(), maxHealth.toLong()).getChatColor() - val currentFormat = currentHealth.format() - val maxFormat = maxHealth.format() + val currentFormat = NumberUtil.format(currentHealth) + val maxFormat = NumberUtil.format(maxHealth) summoningMob.lastDisplayName = "§a$name $color$currentFormat/$maxFormat" } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt index c5ce8cea0..742bc3654 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt @@ -36,25 +36,19 @@ object NumberUtil { ) ) - @Deprecated("outdated", ReplaceWith("value.format(preciseBillions)")) - fun format(value: Number, preciseBillions: Boolean = false): String = value.format(preciseBillions) - - // 1234 -> 1.2k - fun Number.format(preciseBillions: Boolean = false): String { - return compactFormat(this, preciseBillions) - } - /** * This code was modified and taken under CC BY-SA 3.0 license * @link https://stackoverflow.com/a/30661479 * @author assylias */ - private fun compactFormat(value: Number, preciseBillions: Boolean = false): String { + + @JvmStatic + fun format(value: Number, preciseBillions: Boolean = false): String { @Suppress("NAME_SHADOWING") val value = value.toLong() // Long.MIN_VALUE == -Long.MIN_VALUE, so we need an adjustment here - if (value == Long.MIN_VALUE) return compactFormat(Long.MIN_VALUE + 1, preciseBillions) - if (value < 0) return "-" + compactFormat(-value, preciseBillions) + if (value == Long.MIN_VALUE) return format(Long.MIN_VALUE + 1, preciseBillions) + if (value < 0) return "-" + format(-value, preciseBillions) if (value < 1000) return value.toString() // deal with small numbers diff --git a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt index 2e8b990a9..57595c1c1 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt @@ -13,8 +13,8 @@ import at.hannibal2.skyhanni.utils.KeyboardManager import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.addSelector 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.format import at.hannibal2.skyhanni.utils.StringUtils.removeColor import at.hannibal2.skyhanni.utils.renderables.Renderable import kotlin.time.Duration.Companion.seconds @@ -106,7 +106,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>( internalName.itemName } - val priceFormat = price.format() + val priceFormat = NumberUtil.format(price) val hidden = itemProfit.hidden val newDrop = itemProfit.lastTimeUpdated.passedSince() < 10.seconds && config.showRecentDrops val numberColor = if (newDrop) "§a§l" else "§7" @@ -183,7 +183,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>( val tips = if (totalAmount > 0) { val profitPerCatch = profit / totalAmount - val profitPerCatchFormat = profitPerCatch.format() + val profitPerCatchFormat = NumberUtil.format(profitPerCatch) listOf("§7Profit per $action: $profitPrefix$profitPerCatchFormat") } else emptyList() |