aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features/skillprogress
diff options
context:
space:
mode:
authorDavid Cole <40234707+DavidArthurCole@users.noreply.github.com>2024-10-11 12:42:33 -0400
committerGitHub <noreply@github.com>2024-10-11 18:42:33 +0200
commit7c2d4ed566246513bc438272e436627412147d62 (patch)
treeedf8d3d01a49bd7c4f5993bae6367613c32fcaac /src/main/java/at/hannibal2/skyhanni/features/skillprogress
parent0671e35163d55ab0f940aa6806a0d7bfb2876429 (diff)
downloadskyhanni-7c2d4ed566246513bc438272e436627412147d62.tar.gz
skyhanni-7c2d4ed566246513bc438272e436627412147d62.tar.bz2
skyhanni-7c2d4ed566246513bc438272e436627412147d62.zip
Backend: Detekt Fixes Part 6 (#2657)
Co-authored-by: Cal <cwolfson58@gmail.com> Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/skillprogress')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt104
1 files changed, 56 insertions, 48 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt
index 9a01a9729..ffee3eda4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt
@@ -297,16 +297,19 @@ object SkillProgress {
add("§6Total XP: §b${totalXp.addSeparators()}")
}
val nameColor = if (skill == activeSkill) "§2" else "§a"
- Renderable.hoverTips(buildString {
- append("$nameColor${skill.displayName} $level ")
- append("§7(")
- append("§b${currentXp.addSeparators()}")
- if (currentXpMax != 0L) {
- append("§6/")
- append("§b${currentXpMax.addSeparators()}")
- }
- append("§7)")
- }, tips)
+ Renderable.hoverTips(
+ buildString {
+ append("$nameColor${skill.displayName} $level ")
+ append("§7(")
+ append("§b${currentXp.addSeparators()}")
+ if (currentXpMax != 0L) {
+ append("§6/")
+ append("§b${currentXpMax.addSeparators()}")
+ }
+ append("§7)")
+ },
+ tips
+ )
}
}
}
@@ -376,7 +379,8 @@ object SkillProgress {
val session = xpInfo.timeActive.seconds.format(TimeUnit.HOUR)
add(
- Renderable.clickAndHover("§7Session: §e$session ${if (xpInfo.sessionTimerActive) "" else "§c(PAUSED)"}",
+ Renderable.clickAndHover(
+ "§7Session: §e$session ${if (xpInfo.sessionTimerActive) "" else "§c(PAUSED)"}",
listOf("§eClick to reset!"),
onClick = {
xpInfo.sessionTimerActive = false
@@ -421,45 +425,49 @@ object SkillProgress {
add(Renderable.itemStack(activeSkill.item, 1.0))
}
- add(Renderable.string(buildString {
- append("§b+${skill.lastGain} ")
-
- if (config.useSkillName.get())
- append("${activeSkill.displayName} ")
-
- val (barCurrent, barMax) =
- if (useCustomGoalLevel && customGoalConfig.enableInProgressBar)
- Pair(have, need)
- else if (config.overflowConfig.enableInProgressBar.get())
- Pair(skill.overflowCurrentXp, skill.overflowCurrentXpMax)
- else
- Pair(skill.currentXp, skill.currentXpMax)
-
- val barPercent = if (barMax == 0L) 100F else 100F * barCurrent / barMax
- skillExpPercentage = (barPercent.toDouble() / 100)
-
- val percent = if (currentXpMax == 0L) 100F else 100F * currentXp / currentXpMax
-
- if (config.usePercentage.get())
- append("§7(§6${percent.roundTo(2)}%§7)")
- else {
- if (currentXpMax == 0L)
- append("§7(§6${currentXp.addSeparators()}§7)")
- else
- append("§7(§6${currentXp.addSeparators()}§7/§6${currentXpMax.addSeparators()}§7)")
- }
+ add(
+ Renderable.string(
+ buildString {
+ append("§b+${skill.lastGain} ")
+
+ if (config.useSkillName.get())
+ append("${activeSkill.displayName} ")
+
+ val (barCurrent, barMax) =
+ if (useCustomGoalLevel && customGoalConfig.enableInProgressBar)
+ Pair(have, need)
+ else if (config.overflowConfig.enableInProgressBar.get())
+ Pair(skill.overflowCurrentXp, skill.overflowCurrentXpMax)
+ else
+ Pair(skill.currentXp, skill.currentXpMax)
+
+ val barPercent = if (barMax == 0L) 100F else 100F * barCurrent / barMax
+ skillExpPercentage = (barPercent.toDouble() / 100)
+
+ val percent = if (currentXpMax == 0L) 100F else 100F * currentXp / currentXpMax
+
+ if (config.usePercentage.get())
+ append("§7(§6${percent.roundTo(2)}%§7)")
+ else {
+ if (currentXpMax == 0L)
+ append("§7(§6${currentXp.addSeparators()}§7)")
+ else
+ append("§7(§6${currentXp.addSeparators()}§7/§6${currentXpMax.addSeparators()}§7)")
+ }
- if (config.showActionLeft.get() && percent != 100f) {
- append(" - ")
- val gain = skill.lastGain.formatDouble()
- val actionLeft = (ceil(currentXpMax.toDouble() - currentXp) / gain).toLong().addSeparators()
- if (skill.lastGain != "" && !actionLeft.contains("-")) {
- append("§6$actionLeft Left")
- } else {
- append("§6∞ Left")
+ if (config.showActionLeft.get() && percent != 100f) {
+ append(" - ")
+ val gain = skill.lastGain.formatDouble()
+ val actionLeft = (ceil(currentXpMax.toDouble() - currentXp) / gain).toLong().addSeparators()
+ if (skill.lastGain != "" && !actionLeft.contains("-")) {
+ append("§6$actionLeft Left")
+ } else {
+ append("§6∞ Left")
+ }
+ }
}
- }
- }))
+ )
+ )
}
private fun updateSkillInfo() {