aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/misc
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-14 13:36:06 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-06-14 13:36:06 +0200
commit9f55fd15544e187491d78e2c5ecf2f2ed8ac76f1 (patch)
tree3db7b5a80d23714519ae45b8b5ee16e7c11f0da6 /src/main/java/at/hannibal2/skyhanni/features/misc
parent2f285d2944a00dfd2dab9bca8da2055a1506193e (diff)
downloadskyhanni-9f55fd15544e187491d78e2c5ecf2f2ed8ac76f1.tar.gz
skyhanni-9f55fd15544e187491d78e2c5ecf2f2ed8ac76f1.tar.bz2
skyhanni-9f55fd15544e187491d78e2c5ecf2f2ed8ac76f1.zip
creating and using Number.format()
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/misc')
-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.kt76
3 files changed, 42 insertions, 42 deletions
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..5d2abee6e 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
@@ -12,8 +12,8 @@ import at.hannibal2.skyhanni.utils.KeyboardManager
import at.hannibal2.skyhanni.utils.LorenzRarity
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.LorenzUtils.round
-import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
+import at.hannibal2.skyhanni.utils.NumberUtil.format
import at.hannibal2.skyhanni.utils.ReflectionUtils.makeAccessible
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetExp
import at.hannibal2.skyhanni.utils.StringUtils
@@ -54,7 +54,7 @@ object PetExpTooltip {
val addLegendaryColor = if (isBelowLegendary) "§6" else ""
event.toolTip.add(
index,
- "$progressBar §e${petExperience.addSeparators()}§6/§e${NumberUtil.format(maxXp)}"
+ "$progressBar §e${petExperience.addSeparators()}§6/§e${maxXp.format()}"
)
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..ce9304caa 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/EstimatedItemValue.kt
@@ -27,8 +27,8 @@ import at.hannibal2.skyhanni.utils.KeyboardManager.isKeyHeld
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.NEUInternalName
import at.hannibal2.skyhanni.utils.NEUItems.getItemStackOrNull
-import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
+import at.hannibal2.skyhanni.utils.NumberUtil.format
import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAndItems
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer
import net.minecraft.client.Minecraft
@@ -213,7 +213,7 @@ object EstimatedItemValue {
val numberFormat = if (config.exactPrice) {
totalPrice.roundToLong().addSeparators()
} else {
- NumberUtil.format(totalPrice)
+ totalPrice.format()
}
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..663b089b5 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.format
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.format()}§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.format()}§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.format() 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.format() + "§7)")
+ list.add(" §7Apply cost: (§6" + applyCost.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§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.format() + "§7)")
return price
}
@@ -442,11 +442,11 @@ object EstimatedItemValueCalculator {
val price = internalName.getPriceOrNull() ?: continue
totalPrice += price
- val format = NumberUtil.format(price)
+ val format = price.format()
map[" $name §7(§6$format§7)"] = price
}
if (map.isNotEmpty()) {
- list.add("§7Drill upgrades: §6" + NumberUtil.format(totalPrice))
+ list.add("§7Drill upgrades: §6" + totalPrice.format())
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.format() + "§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.format() + "§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.format() + "§7)")
return price
}
@@ -519,11 +519,11 @@ object EstimatedItemValueCalculator {
val price = internalName.getPriceOrNull() ?: continue
totalPrice += price
- val format = NumberUtil.format(price)
+ val format = price.format()
map[" $name §7(§6$format§7)"] = price
}
if (map.isNotEmpty()) {
- list.add("§7Ability Scrolls: §6" + NumberUtil.format(totalPrice))
+ list.add("§7Ability Scrolls: §6" + totalPrice.format())
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.format() + "§7)")
return price
}
@@ -615,14 +615,14 @@ object EstimatedItemValueCalculator {
val price = singlePrice * multiplier
totalPrice += price
- val format = NumberUtil.format(price)
+ val format = price.format()
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.format())
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.format()
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.format())
list += priceMap.sortedDesc().keys
}
return totalPrice
@@ -714,17 +714,17 @@ object EstimatedItemValueCalculator {
val splitSlot = slot.key.split("_") // eg. SAPPHIRE_1
val colorCode = SkyBlockItemModifierUtils.GemstoneSlotType.getColorCode(splitSlot[0])
- val formattedPrice = NumberUtil.format(totalPrice - previousTotal)
+ val formattedPrice = (totalPrice - previousTotal).format()
// eg. SAPPHIRE_1 -> Sapphire Slot 2
val displayName = splitSlot[0].lowercase(Locale.ENGLISH).replaceFirstChar(Char::uppercase) + " Slot" +
- // If the slot index is 0, we don't need to specify
- if (splitSlot[1] != "0") " " + (splitSlot[1].toInt() + 1) else ""
+ // If the slot index is 0, we don't need to specify
+ if (splitSlot[1] != "0") " " + (splitSlot[1].toInt() + 1) else ""
priceMap[" §$colorCode $displayName §7(§6$formattedPrice§7)"] = totalPrice - previousTotal
}
- list.add("§7Gemstone Slot Unlock Cost: §6" + NumberUtil.format(totalPrice))
+ list.add("§7Gemstone Slot Unlock Cost: §6" + totalPrice.format())
list += priceMap.sortedDesc().keys
return totalPrice
}