aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-07 23:05:09 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-08-07 23:05:09 +0200
commit5238d190d81eb56e793f40224972e9405512217a (patch)
tree33bb9f470ae77499ca3fdf29cb2ca00992fad91c
parent5e46db6182fcae4ca339ad13839c1eebb88ae20d (diff)
downloadskyhanni-5238d190d81eb56e793f40224972e9405512217a.tar.gz
skyhanni-5238d190d81eb56e793f40224972e9405512217a.tar.bz2
skyhanni-5238d190d81eb56e793f40224972e9405512217a.zip
created more compact formatText feature
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt10
2 files changed, 16 insertions, 14 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
index 8abf8f961..82f80a044 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostCounter.kt
@@ -193,19 +193,19 @@ object GhostCounter {
}
addAsSingletonList(Utils.chromaStringByColourCode(textFormatting.titleFormat.replace("&", "§")))
- addAsSingletonList(textFormatting.ghostKilledFormat.formatText(KILLS.getInt(), KILLS.getInt(true)))
- addAsSingletonList(textFormatting.sorrowsFormat.formatText(SORROWCOUNT.getInt(), SORROWCOUNT.getInt(true)))
+ addAsSingletonList(textFormatting.ghostKilledFormat.formatText(KILLS))
+ addAsSingletonList(textFormatting.sorrowsFormat.formatText(SORROWCOUNT))
addAsSingletonList(textFormatting.ghostSinceSorrowFormat.formatText(GHOSTSINCESORROW.getInt()))
addAsSingletonList(textFormatting.ghostKillPerSorrowFormat.formatText(ghostKillPerSorrow))
- addAsSingletonList(textFormatting.voltasFormat.formatText(VOLTACOUNT.getInt(), VOLTACOUNT.getInt(true)))
- addAsSingletonList(textFormatting.plasmasFormat.formatText(PLASMACOUNT.getInt(), PLASMACOUNT.getInt(true)))
- addAsSingletonList(textFormatting.ghostlyBootsFormat.formatText(GHOSTLYBOOTS.getInt(), GHOSTLYBOOTS.getInt(true)))
- addAsSingletonList(textFormatting.bagOfCashFormat.formatText(BAGOFCASH.getInt(), BAGOFCASH.getInt(true)))
+ addAsSingletonList(textFormatting.voltasFormat.formatText(VOLTACOUNT))
+ addAsSingletonList(textFormatting.plasmasFormat.formatText(PLASMACOUNT))
+ addAsSingletonList(textFormatting.ghostlyBootsFormat.formatText(GHOSTLYBOOTS))
+ addAsSingletonList(textFormatting.bagOfCashFormat.formatText(BAGOFCASH))
addAsSingletonList(textFormatting.avgMagicFindFormat.formatText(avgMagicFind))
- addAsSingletonList(textFormatting.scavengerCoinsFormat.formatText(SCAVENGERCOINS.getInt(), SCAVENGERCOINS.getInt(true)))
- addAsSingletonList(textFormatting.killComboFormat.formatText(KILLCOMBO.getInt(), MAXKILLCOMBO.getInt(true)))
- addAsSingletonList(textFormatting.highestKillComboFormat.formatText(MAXKILLCOMBO.getInt(), MAXKILLCOMBO.getInt(true)))
- addAsSingletonList(textFormatting.skillXPGainFormat.formatText(SKILLXPGAINED.get(), SKILLXPGAINED.get(true)))
+ addAsSingletonList(textFormatting.scavengerCoinsFormat.formatText(SCAVENGERCOINS))
+ addAsSingletonList(textFormatting.killComboFormat.formatText(MAXKILLCOMBO))
+ addAsSingletonList(textFormatting.highestKillComboFormat.formatText(MAXKILLCOMBO))
+ addAsSingletonList(textFormatting.skillXPGainFormat.formatText(SKILLXPGAINED))
addAsSingletonList(bestiaryFormatting.base.preFormat(bestiary, nextLevel - 1, nextLevel).formatBestiary(currentKill, killNeeded))
addAsSingletonList(xpHourFormatting.base.formatText(xp))
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt
index 436cbcd53..b04ce9287 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ghostcounter/GhostUtil.kt
@@ -75,11 +75,13 @@ object GhostUtil {
LorenzUtils.chat("§e[SkyHanni] §cGhostCounterV3 ChatTriggers module not found!")
}
- fun String.formatText(value: Int, session: Int = -1): String {
- return Utils.chromaStringByColourCode(this.replace("%value%", value.addSeparators())
+ fun String.formatText(option: GhostData.Option) = formatText(option.getInt(), option.getInt(true))
+
+ fun String.formatText(value: Int, session: Int = -1) = Utils.chromaStringByColourCode(
+ replace("%value%", value.addSeparators())
.replace("%session%", session.addSeparators())
- .replace("&", "§"))
- }
+ .replace("&", "§")
+ )
fun String.formatText(t: String): String {
return Utils.chromaStringByColourCode(this.replace("%value%", t)