aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/garden
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-14 15:56:08 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-14 15:56:08 +0200
commit34e2d19a32f36ddef298668788447aed01c62703 (patch)
tree65db564add674443a43bf65e71091e9d965f117a /src/main/java/at/hannibal2/skyhanni/features/garden
parenta996d8150ef2367e7c839f3565d60bdb68d2125d (diff)
downloadskyhanni-34e2d19a32f36ddef298668788447aed01c62703.tar.gz
skyhanni-34e2d19a32f36ddef298668788447aed01c62703.tar.bz2
skyhanni-34e2d19a32f36ddef298668788447aed01c62703.zip
fixing and using shortFormat()
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/garden')
-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
15 files changed, 54 insertions, 52 deletions
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)})")