aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/data/SlayerAPI.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/bingo/card/nextstephelper/steps/CollectionStep.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/BestiaryData.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/DamageIndicatorManager.kt19
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/endernodetracker/EnderNodeTracker.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/combat/ghostcounter/GhostUtil.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/diana/DianaProfitTracker.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/hoppity/HoppityEggsCompactChat.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/event/jerry/frozentreasure/FrozenTreasureTracker.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt23
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/tracker/FishingProfitTracker.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fishing/trophy/TrophyFishFillet.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/AnitaMedalProfit.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterInventoryNumbers.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/ComposterOverlay.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/composter/GardenComposterInventoryFeatures.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/farming/CropMoneyDisplay.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/fortuneguide/pages/UpgradePage.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/AnitaExtraFarmingFortune.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/GardenCropMilestoneInventory.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/SkyMartCopperPrice.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/inventory/plots/GardenNextPlotPrice.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestProfitTracker.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorDropStatistics.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/garden/visitor/VisitorRewardWarning.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboardUtils.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ChestValue.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/PowerStoneGuideFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/SackDisplay.kt10
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/BazaarBestSellMethod.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/bazaar/CraftMaterialsFromBazaar.kt13
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/chocolatefactory/ChocolateShopPrice.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/wardrobe/WardrobeAPI.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ExcavatorProfitTracker.kt12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/GlacitePowderFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/fossilexcavator/ProfitPerExcavation.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/mining/mineshaft/MineshaftCorpseProfitPer.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValueCalculator.kt72
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/rift/everywhere/motes/ShowMotesNpcSellPrice.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt16
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/tracker/SkyHanniItemTracker.kt9
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> {
- val mobKillCoinsFormat = NumberUtil.format(item.totalAmount)
+ val mobKillCoinsFormat = item.totalAmount.shortFormat()
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 e0aaa5719..c52721bde 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.shortFormat
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${NumberUtil.format(filletPrice)}§7)")
+ event.toolTip.add("§7Fillet: §8${filletValue.addSeparators()} Magmafish §7(§6${filletPrice.shortFormat()}§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 191dc125a..3c34c262c 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
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
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 = NumberUtil.format(profit)
+ val profitFormat = profit.shortFormat()
val color = if (profit > 0) "§6" else "§c"
val hover = listOf(
itemName,
"",
- "§7Item price: §6${NumberUtil.format(itemPrice)} ",
+ "§7Item price: §6${itemPrice.shortFormat()} ",
// TODO add more exact material cost breakdown
- "§7Material cost: §6${NumberUtil.format(fullCost)} ",
+ "§7Material cost: §6${fullCost.shortFormat()} ",
"§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 1067312de..88993d42d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/garden/GardenLevelDisplay.kt
@@ -17,9 +17,9 @@ import at.hannibal2.skyhanni.utils.InventoryUtils
import at.hannibal2.skyhanni.utils.ItemUtils.getLore
import at.hannibal2.skyhanni.utils.ItemUtils.name
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.shortFormat
import at.hannibal2.skyhanni.utils.NumberUtil.toRoman
import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
@@ -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${format(needForOnlyNextLvl)}")
+ iterator.set("$progressBar §e${overflow.addSeparators()}§6/§e${needForOnlyNextLvl.shortFormat()}")
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 352c7137e..c0b26114c 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,9 +5,9 @@ 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.formatInt
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
@@ -52,7 +52,7 @@ object ComposterInventoryNumbers {
if (slotNumber == 46 || slotNumber == 52) {
stack.getLore().matchFirst(valuePattern) {
val having = group("having").removeColor().formatInt()
- val havingFormat = NumberUtil.format(having)
+ val havingFormat = having.shortFormat()
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 b198b3e3a..b12b8f190 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,9 +38,9 @@ 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.romanToDecimalIfNecessary
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.SimpleTimeMark
@@ -369,9 +369,9 @@ object ComposterOverlay {
val totalCostPreview = (fuelPricePerPreview + organicMatterPricePerPreview) * timeMultiplierPreview
val materialCostFormatPreview =
- if (totalCost != totalCostPreview) " §c➜ §6" + NumberUtil.format(totalCostPreview) else ""
+ if (totalCost != totalCostPreview) " §c➜ §6" + totalCostPreview.shortFormat() else ""
val materialCostFormat =
- " §7Material costs per $timeText: §6${NumberUtil.format(totalCost)}$materialCostFormatPreview"
+ " §7Material costs per $timeText: §6${totalCost.shortFormat()}$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" + NumberUtil.format(profitPreview) else ""
- val profitFormat = " §7Profit per $timeText: §6${NumberUtil.format(profit)}$profitFormatPreview"
+ val profitFormatPreview = if (profit != profitPreview) " §c➜ §6" + profitPreview.shortFormat() else ""
+ val profitFormat = " §7Profit per $timeText: §6${profit.shortFormat()}$profitFormatPreview"
newList.addAsSingletonList(profitFormat)
newList.addAsSingletonList("")
@@ -465,17 +465,19 @@ object ComposterOverlay {
itemsNeeded: Double,
onClick: (NEUInternalName) -> Unit,
) {
- val format = NumberUtil.format(totalPrice)
+ val format = totalPrice.shortFormat()
val selected = if (internalName == currentOrganicMatterItem || internalName == currentFuelItem) "§n" else ""
val rawItemName = itemName.removeColor()
val name = itemName.substring(0, 2) + selected + rawItemName
- list.add(Renderable.link("$name §8x${itemsNeeded.addSeparators()} §7(§6$format§7)") {
- onClick(internalName)
- if (KeyboardManager.isModifierKeyDown() && lastAttemptTime.passedSince() > 500.milliseconds) {
- lastAttemptTime = SimpleTimeMark.now()
- retrieveMaterials(internalName, itemName, itemsNeeded.toInt())
+ list.add(
+ Renderable.link("$name §8x${itemsNeeded.addSeparators()} §7(§6$format§7)") {
+ onClick(internalName)
+ if (KeyboardManager.isModifierKeyDown() && lastAttemptTime.passedSince() > 500.milliseconds) {
+ lastAttemptTime = SimpleTimeMark.now()
+ retrieveMaterials(internalName, itemName, itemsNeeded.toInt())
+ }
}
- })
+ )
}
private fun retrieveMaterials(internalName: NEUInternalName, itemName: String, itemsNeeded: Int) {
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 99fb3f147..eb6dc41e0 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
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
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 = NumberUtil.format(price)
+ val format = price.shortFormat()
list[i] = list[i] + " §7(§6$format§7)"
amountItems++
}
}
if (amountItems > 1) {
- val format = NumberUtil.format(fullPrice)
+ val format = fullPrice.shortFormat()
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 b149dedad..bea005d76 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.shortFormat
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) {
- NumberUtil.format(moneyPerHour)
+ moneyPerHour.shortFormat()
} 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 2323b5e30..f91a25f77 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
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
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 { NumberUtil.format(it) },
+ "§6" + costPerFF?.let { it.shortFormat() },
horizontalAlign = HorizontalAlignment.CENTER,
verticalAlign = VerticalAlignment.CENTER
)
)
add(
Renderable.string(
- "§6" + cost?.let { NumberUtil.format(it) },
+ "§6" + cost?.let { it.shortFormat() },
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 42b8b5d35..afebbda4d 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,9 +11,9 @@ 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.formatDouble
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -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${NumberUtil.format(price)} coins")
+ event.toolTip.add(index, " §7Price: §6${price.shortFormat()} 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 c9759cd58..7a2f8d415 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.shortFormat
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${NumberUtil.format(maxCounter)}")
+ event.toolTip.add(index, "$progressBar §e${counter.addSeparators()}§6/§e${maxCounter.shortFormat()}")
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 625216f85..b2575c88d 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,9 +16,9 @@ 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.formatInt
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RenderUtils.renderRenderables
import at.hannibal2.skyhanni.utils.renderables.Renderable
@@ -61,17 +61,17 @@ object SkyMartCopperPrice {
val profit = itemPrice - (otherItemsPrice ?: 0.0)
val factor = profit / copper
- val perFormat = NumberUtil.format(factor)
+ val perFormat = factor.shortFormat()
val itemName = item.itemName
val hover = buildList {
add(itemName)
add("")
- add("§7Item price: §6${NumberUtil.format(itemPrice)} ")
+ add("§7Item price: §6${itemPrice.shortFormat()} ")
otherItemsPrice?.let {
- add("§7Additional cost: §6${NumberUtil.format(it)} ")
+ add("§7Additional cost: §6${it.shortFormat()} ")
}
- add("§7Profit per purchase: §6${NumberUtil.format(profit)} ")
+ add("§7Profit per purchase: §6${profit.shortFormat()} ")
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 157f05c30..8ee3acedd 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
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
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 = NumberUtil.format(price)
+ val format = price.shortFormat()
list[i] = list[i] + " §7(§6$format§7)"
} ?: run {
ErrorManager.logErrorStateWithData(
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 62ddfb5f8..5f630335b 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.shortFormat
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 = NumberUtil.format(item.totalAmount)
+ val pestsCoinsFormat = item.totalAmount.shortFormat()
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 bd344bb51..386f3808f 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,9 +19,9 @@ 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.formatInt
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.SimpleTimeMark
@@ -224,7 +224,7 @@ object GardenVisitorDropStatistics {
fun format(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/garden/visitor/GardenVisitorFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/visitor/GardenVisitorFeatures.kt
index 98230dfcf..4d7c45cd0 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,9 +47,9 @@ 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.formatInt
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RenderUtils.drawString
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
@@ -204,7 +204,7 @@ object GardenVisitorFeatures {
if (config.shoppingList.showPrice) {
val price = internalName.getPrice() * amount
totalPrice += price
- val format = NumberUtil.format(price)
+ val format = price.shortFormat()
list.add(" §7(§6$format§7)")
}
@@ -213,7 +213,7 @@ object GardenVisitorFeatures {
add(list)
}
if (totalPrice > 0) {
- val format = NumberUtil.format(totalPrice)
+ val format = totalPrice.shortFormat()
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 = NumberUtil.format((totalPrice / gardenExp).toInt())
+ val pricePerCopper = (totalPrice / gardenExp).toInt().shortFormat()
finalList.set(index, "$formattedLine §7(§6$pricePerCopper §7per)")
}
}
copperPattern.matchMatcher(formattedLine) {
val copper = group("amount").formatInt()
- val pricePerCopper = NumberUtil.format((totalPrice / copper).toInt())
+ val pricePerCopper = (totalPrice / copper).toInt().shortFormat()
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 = NumberUtil.format(price)
+ val format = price.shortFormat()
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 05041df18..56e85b582 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
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
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 { NumberUtil.format(it) }
+ val pricePerCopper = visitor.pricePerCopper?.let { it.shortFormat() }
// TODO remove !! - best by creating new class LoadedVisitor without any nullable objects
val loss = visitor.totalPrice!! - visitor.totalReward!!
- val formattedLoss = NumberUtil.format(loss.absoluteValue)
+ val formattedLoss = loss.absoluteValue.shortFormat()
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 8aae8fe55..25199518b 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,9 +5,9 @@ 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.formatDouble
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeResets
import at.hannibal2.skyhanni.utils.StringUtils.trimWhiteSpace
@@ -34,7 +34,7 @@ object CustomScoreboardUtils {
}
internal fun Number.formatNum(): String = when (displayConfig.numberFormat) {
- DisplayConfig.NumberFormat.SHORT -> NumberUtil.format(this)
+ DisplayConfig.NumberFormat.SHORT -> this.shortFormat()
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 5825436b8..26f5c028b 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.shortFormat
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.renderables.Renderable
@@ -202,9 +202,8 @@ object ChestValue {
private fun Double.formatPrice(): String {
return when (config.formatType) {
- NumberFormatEntry.SHORT -> if (this > 1_000_000_000) NumberUtil.format(this, true) else NumberUtil.format(
- this
- )
+ NumberFormatEntry.SHORT -> if (this > 1_000_000_000) this.shortFormat(true) else this
+ .shortFormat()
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 21defeadc..324227248 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -39,10 +39,10 @@ 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
import at.hannibal2.skyhanni.utils.NumberUtil.formatLong
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal
import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getBottleOfJyrreSeconds
@@ -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${NumberUtil.format(rank)}"
+ if (rank < 10000) return "§6${rank.shortFormat()}"
}
}
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 5423aa396..e64e92b67 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
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
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${NumberUtil.format(totalPrice)}")
+ event.toolTip.add(5, "9x from Bazaar: §6${totalPrice.shortFormat()}")
}
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 6fb1caaa2..81e277fd6 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.shortFormat
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${NumberUtil.format(total)}")
+ addAlignedNumber("§b${total.shortFormat()}")
}
NumberFormatEntry.FORMATTED -> {
- addAlignedNumber("$colorCode${NumberUtil.format(stored)}")
+ addAlignedNumber("$colorCode${stored.shortFormat()}")
addString("§7/")
- addAlignedNumber("§b${NumberUtil.format(total)}")
+ addAlignedNumber("§b${total.shortFormat()}")
}
NumberFormatEntry.UNFORMATTED -> {
@@ -285,7 +285,7 @@ object SackDisplay {
}
private fun format(price: Long) = if (config.priceFormat == PriceFormatEntry.FORMATTED) {
- NumberUtil.format(price)
+ price.shortFormat()
} 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 631ee8175..ab2dd76f5 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
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
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 = NumberUtil.format(totalDiff.toInt())
+ val result = totalDiff.toInt().shortFormat()
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 009a972d0..adc932cce 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.shortFormat
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${NumberUtil.format(totalPrice)}§7)"))
+ add(Renderable.string("§7Craft $recipeName §7(§6${totalPrice.shortFormat()}§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${NumberUtil.format(material.getPrice() * amount)}"
+ text += " §6${(material.getPrice() * amount).shortFormat()}"
}
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${NumberUtil.format(material.getPrice() * priceMultiplier)}"
+ " §6${(material.getPrice() * priceMultiplier).shortFormat(false)}"
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 + NumberUtil.format(calculateTotalPrice(neededMaterials, m))
+ val price = priceColor + calculateTotalPrice(neededMaterials, m).shortFormat()
val text = "${nameColor}Mulitply x$m $price"
if (!isThisMultiply) {
add(
@@ -141,7 +141,8 @@ object CraftMaterialsFromBazaar {
onClick = {
multiplier = m
updateBazaarDisplay()
- })
+ }
+ )
)
} else {
addString(text)
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 8d8ea540f..957685d10 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,10 +15,10 @@ 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.formatLong
import at.hannibal2.skyhanni.utils.NumberUtil.million
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.groupOrNull
import at.hannibal2.skyhanni.utils.RegexUtils.matchFirst
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
@@ -118,19 +118,19 @@ object ChocolateShopPrice {
val profit = product.itemPrice - (product.otherItemPrice ?: 0.0)
val factor = (profit / product.chocolate) * multiplier
- val perFormat = NumberUtil.format(factor)
+ val perFormat = factor.shortFormat()
val hover = buildList {
add(product.name)
add("")
- add("§7Item price: §6${NumberUtil.format(product.itemPrice)} ")
+ add("§7Item price: §6${product.itemPrice.shortFormat()} ")
product.otherItemPrice?.let {
- add("§7Additional cost: §6${NumberUtil.format(it)} ")
+ add("§7Additional cost: §6${it.shortFormat()} ")
}
- add("§7Profit per purchase: §6${NumberUtil.format(profit)} ")
+ add("§7Profit per purchase: §6${profit.shortFormat()} ")
add("")
- add("§7Chocolate amount: §c${NumberUtil.format(product.chocolate)} ")
+ add("§7Chocolate amount: §c${product.chocolate.shortFormat()} ")
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 75515717e..b49ba106a 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,8 +11,8 @@ 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
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.repopatterns.RepoPattern
@@ -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${NumberUtil.format(price)}")
+ add(" §7- ${stack.name}: §6${price.shortFormat()}")
totalPrice += price
}
- if (totalPrice != 0.0) add(" §aTotal Value: §6§l${NumberUtil.format(totalPrice)} coins")
+ if (totalPrice != 0.0) add(" §aTotal Value: §6§l${totalPrice.shortFormat()} 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 fb6e9054a..4477f509d 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.shortFormat
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${NumberUtil.format(fossilDustGained)}x §fFossil Dust§7: §6${NumberUtil.format(fossilDustPrice)}",
+ "§7${fossilDustGained.shortFormat()}x §fFossil Dust§7: §6${fossilDustPrice.shortFormat()}",
listOf(
- "§7You gained §6${NumberUtil.format(fossilDustPrice)} coins §7in total",
+ "§7You gained §6${fossilDustPrice.shortFormat()} coins §7in total",
"§7for all §e$fossilDustGained §fFossil Dust",
"§7you have collected.",
"",
- "§7Price Per Fossil Dust: §6${NumberUtil.format(pricePer)}"
+ "§7Price Per Fossil Dust: §6${pricePer.shortFormat()}"
)
)
)
@@ -142,9 +142,9 @@ object ExcavatorProfitTracker {
val name = StringUtils.pluralize(timesExcavated.toInt(), scrapItem.itemName)
addAsSingletonList(
Renderable.hoverTips(
- "$name §7price: §c-${NumberUtil.format(scrapPrice)}",
+ "$name §7price: §c-${scrapPrice.shortFormat()}",
listOf(
- "§7You paid §c${NumberUtil.format(scrapPrice)} coins §7in total",
+ "§7You paid §c${scrapPrice.shortFormat()} 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 161330da5..d3c6de977 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,8 +4,8 @@ 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
import at.hannibal2.skyhanni.utils.NumberUtil.formatLong
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.repopatterns.RepoPattern
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
@@ -27,7 +27,7 @@ object GlacitePowderFeatures {
glacitePowderPattern.matchMatcher(event.stack.cleanName()) {
val powder = group("amount").formatLong()
- event.stackTip = "§b${NumberUtil.format(powder)}"
+ event.stackTip = "§b${powder.shortFormat()}"
}
}
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 ee2b5fab2..5bdc5388b 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.shortFormat
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${NumberUtil.format(profit)}§7)"
+ val text = "§eFound $name §8${amount.addSeparators()}x §7(§6${profit.shortFormat()}§7)"
map[text] = profit
totalProfit += profit
}
@@ -38,12 +38,12 @@ object ProfitPerExcavation {
val scrapItem = FossilExcavatorAPI.scrapItem
val scrapPrice = scrapItem.getPrice()
- map["${scrapItem.itemName}: §c-${NumberUtil.format(scrapPrice)}"] = -scrapPrice
+ map["${scrapItem.itemName}: §c-${scrapPrice.shortFormat()}"] = -scrapPrice
totalProfit -= scrapPrice
val hover = map.sortedDesc().keys.toMutableList()
val profitPrefix = if (totalProfit < 0) "§c" else "§6"
- val totalMessage = "Profit this excavation: $profitPrefix${NumberUtil.format(totalProfit)}"
+ val totalMessage = "Profit this excavation: $profitPrefix${totalProfit.shortFormat()}"
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 73771d354..102391b87 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.shortFormat
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${NumberUtil.format(profit)}§7)"
+ val text = "§eFound $name §8${amount.addSeparators()}x §7(§6${profit.shortFormat()}§7)"
map[text] = profit
totalProfit += profit
}
@@ -42,13 +42,13 @@ object MineshaftCorpseProfitPer {
val keyName = it.itemName
val price = it.getPrice()
- map["$keyName: §c-${NumberUtil.format(price)}"] = -price
+ map["$keyName: §c-${price.shortFormat()}"] = -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${NumberUtil.format(totalProfit)}"
+ val totalMessage = "Profit for $name Corpse§e: $profitPrefix${totalProfit.shortFormat()}"
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 55f34be5c..3a7cf784a 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.shortFormat
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${NumberUtil.format(maxXp)}"
+ "$progressBar §e${petExperience.addSeparators()}§6/§e${maxXp.shortFormat()}"
)
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 a2ed65ee7..724583e20 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.shortFormat
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 {
- NumberUtil.format(totalPrice)
+ totalPrice.shortFormat()
}
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 be83ff917..fa4dc9006 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
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
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${NumberUtil.format(price)}§7)",)
+ list.add("§7Attribute §9$name ${attributes[0].second}§7: (§6${price.shortFormat()}§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${NumberUtil.format(comboPrice)}§7)")
+ list.add("§7Attribute Combo: ($color${comboPrice.shortFormat()}§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) NumberUtil.format(price) else "Unknown"}",
+ } ${attr.second}§7: $priceColor${if (price != null) price.shortFormat() 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" + NumberUtil.format(reforgeStonePrice) + "§7)")
- list.add(" §7Apply cost: (§6" + NumberUtil.format(applyCost) + "§7)")
+ list.add(" §7Stone $reforgeStoneName §7(§6" + reforgeStonePrice.shortFormat() + "§7)")
+ list.add(" §7Apply cost: (§6" + applyCost.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Recombobulated: §a§l✔ §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Jalapeno Book: §a§l✔ §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Etherwarp: §a§l✔ §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Wood Singularity: §a§l✔ §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7The Art of War: §a§l✔ §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Book of Stats: §a§l✔ §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7The Art Of Peace: §a§l✔ §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(hpbPrice) + "§7)")
+ list.add("§7HPB's: §e$hpb§7/§e10 §7(§6" + hpbPrice.shortFormat() + "§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" + NumberUtil.format(fumingPrice) + "§7)")
+ list.add("§7Fuming: §e$fuming§7/§e5 §7(§6" + fumingPrice.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Farming for Dummies: §e$count§7/§e5 §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Polarvoid: §e$count§7/§e5 §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Bookworm's Favorite Book: §e$count§7/§e5 §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Silex: §e$tier§7/§e$maxTier §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Transmission Tuners: §e$count§7/§e4 §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Mana Disintegrators: §e$count§7/§e10 §7(§6" + price.shortFormat() + "§7)")
return price
}
@@ -428,7 +428,7 @@ object EstimatedItemValueCalculator {
}
}
- list.add("§7Master Stars: §e$masterStars§7/§e5 §7(§6" + NumberUtil.format(price) + "§7)")
+ list.add("§7Master Stars: §e$masterStars§7/§e5 §7(§6" + price.shortFormat() + "§7)")
return price
}
@@ -442,11 +442,11 @@ object EstimatedItemValueCalculator {
val price = internalName.getPriceOrNull() ?: continue
totalPrice += price
- val format = NumberUtil.format(price)
+ val format = price.shortFormat()
map[" $name §7(§6$format§7)"] = price
}
if (map.isNotEmpty()) {
- list.add("§7Drill upgrades: §6" + NumberUtil.format(totalPrice))
+ list.add("§7Drill upgrades: §6" + totalPrice.shortFormat())
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" + NumberUtil.format(price) + "§7)")
+ list.add("§7$name: §a§l✔ §7(§6" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7$label: $displayname §7($color" + price.shortFormat() + "§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" + NumberUtil.format(price) + "§7)")
+ list.add("§7Enrichment: $name §7(§6" + price.shortFormat() + "§7)")
return price
}
@@ -519,11 +519,11 @@ object EstimatedItemValueCalculator {
val price = internalName.getPriceOrNull() ?: continue
totalPrice += price
- val format = NumberUtil.format(price)
+ val format = price.shortFormat()
map[" $name §7(§6$format§7)"] = price
}
if (map.isNotEmpty()) {
- list.add("§7Ability Scrolls: §6" + NumberUtil.format(totalPrice))
+ list.add("§7Ability Scrolls: §6" + totalPrice.shortFormat())
list += map.sortedDesc().keys
}
return totalPrice
@@ -542,7 +542,7 @@ object EstimatedItemValueCalculator {
return 0.0
}
- list.add("§7Base item: $name §7(§6" + NumberUtil.format(price) + "§7)")
+ list.add("§7Base item: $name §7(§6" + price.shortFormat() + "§7)")
return price
}
@@ -615,14 +615,14 @@ object EstimatedItemValueCalculator {
val price = singlePrice * multiplier
totalPrice += price
- val format = NumberUtil.format(price)
+ val format = price.shortFormat()
map[" $name §7(§6$format§7)"] = price
}
val enchantmentsCap: Int = config.enchantmentsCap.get()
if (map.isNotEmpty()) {
- list.add("§7Enchantments: §6" + NumberUtil.format(totalPrice))
+ list.add("§7Enchantments: §6" + totalPrice.shortFormat())
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 = NumberUtil.format(price)
+ val format = price.shortFormat()
val text = if (amount == 1) {
" $name §7(§6$format§7)"
@@ -666,7 +666,7 @@ object EstimatedItemValueCalculator {
}
if (priceMap.isNotEmpty()) {
- list.add("§7Gemstones: §6" + NumberUtil.format(totalPrice))
+ list.add("§7Gemstones: §6" + totalPrice.shortFormat())
list += priceMap.sortedDesc().keys
}
return totalPrice
@@ -714,7 +714,7 @@ object EstimatedItemValueCalculator {
val splitSlot = slot.key.split("_") // eg. SAPPHIRE_1
val colorCode = SkyBlockItemModifierUtils.GemstoneSlotType.getColorCode(splitSlot[0])
- val formattedPrice = NumberUtil.format(totalPrice - previousTotal)
+ val formattedPrice = (totalPrice - previousTotal).shortFormat()
// eg. SAPPHIRE_1 -> Sapphire Slot 2
val displayName = splitSlot[0].lowercase(Locale.ENGLISH).replaceFirstChar(Char::uppercase) + " Slot" +
@@ -724,7 +724,7 @@ object EstimatedItemValueCalculator {
priceMap[" §$colorCode $displayName §7(§6$formattedPrice§7)"] = totalPrice - previousTotal
}
- list.add("§7Gemstone Slot Unlock Cost: §6" + NumberUtil.format(totalPrice))
+ list.add("§7Gemstone Slot Unlock Cost: §6" + totalPrice.shortFormat())
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 df91766cc..50ce7f2dc 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.shortFormat
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 -> NumberUtil.format(this)
+ NumberFormatEntry.SHORT -> this.shortFormat()
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 36f63647f..92c76e493 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/slayer/SlayerProfitTracker.kt
@@ -18,9 +18,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.formatDouble
+import at.hannibal2.skyhanni.utils.NumberUtil.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.StringUtils.removeColor
import at.hannibal2.skyhanni.utils.renderables.Renderable
@@ -75,7 +75,7 @@ object SlayerProfitTracker {
override fun getCoinName(item: TrackedItem) = "§6Mob Kill Coins"
override fun getCoinDescription(item: TrackedItem): List<String> {
- val mobKillCoinsFormat = NumberUtil.format(item.totalAmount)
+ val mobKillCoinsFormat = item.totalAmount.shortFormat()
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 = NumberUtil.format(slayerSpawnCost)
+ val mobKillCoinsFormat = slayerSpawnCost.shortFormat()
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 = NumberUtil.format(item.totalAmount)
+ val mobKillCoinsFormat = item.totalAmount.shortFormat()
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 8194e7b6d..8c1f254ca 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/summonings/SummoningMobManager.kt
@@ -17,6 +17,7 @@ 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.shortFormat
import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher
import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import at.hannibal2.skyhanni.utils.getLorenzVec
@@ -147,8 +148,8 @@ object SummoningMobManager {
val maxHealth = entityLiving.baseMaxHealth
val color = NumberUtil.percentageColor(currentHealth.toLong(), maxHealth.toLong()).getChatColor()
- val currentFormat = NumberUtil.format(currentHealth)
- val maxFormat = NumberUtil.format(maxHealth)
+ val currentFormat = currentHealth.shortFormat()
+ val maxFormat = maxHealth.shortFormat()
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 742bc3654..1ee34699c 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/NumberUtil.kt
@@ -36,19 +36,25 @@ object NumberUtil {
)
)
+ @Deprecated("outdated", ReplaceWith("value.shortFormat(preciseBillions)"))
+ fun format(value: Number, preciseBillions: Boolean = false): String = value.shortFormat(preciseBillions)
+
+ // 1234 -> 1.2k
+ fun Number.shortFormat(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
*/
-
- @JvmStatic
- fun format(value: Number, preciseBillions: Boolean = false): String {
+ private fun compactFormat(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 format(Long.MIN_VALUE + 1, preciseBillions)
- if (value < 0) return "-" + format(-value, preciseBillions)
+ if (value == Long.MIN_VALUE) return compactFormat(Long.MIN_VALUE + 1, preciseBillions)
+ if (value < 0) return "-" + compactFormat(-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 57595c1c1..f7bafb7f3 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.shortFormat
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 = NumberUtil.format(price)
+ val priceFormat = price.shortFormat()
val hidden = itemProfit.hidden
val newDrop = itemProfit.lastTimeUpdated.passedSince() < 10.seconds && config.showRecentDrops
val numberColor = if (newDrop) "§a§l" else "§7"
@@ -127,7 +127,8 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
}
val lore = buildLore(data, itemProfit, hidden, newDrop, internalName)
- val renderable = if (isInventoryOpen()) Renderable.clickAndHover(displayName, lore,
+ val renderable = if (isInventoryOpen()) Renderable.clickAndHover(
+ displayName, lore,
onClick = {
if (KeyboardManager.isModifierKeyDown()) {
data.items.remove(internalName)
@@ -183,7 +184,7 @@ class SkyHanniItemTracker<Data : ItemTrackerData>(
val tips = if (totalAmount > 0) {
val profitPerCatch = profit / totalAmount
- val profitPerCatchFormat = NumberUtil.format(profitPerCatch)
+ val profitPerCatchFormat = profitPerCatch.shortFormat()
listOf("§7Profit per $action: $profitPrefix$profitPerCatchFormat")
} else emptyList()