aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/combat
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/combat
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/combat')
-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
4 files changed, 20 insertions, 19 deletions
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("&", "§")