From 7c2d4ed566246513bc438272e436627412147d62 Mon Sep 17 00:00:00 2001 From: David Cole <40234707+DavidArthurCole@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:42:33 -0400 Subject: Backend: Detekt Fixes Part 6 (#2657) Co-authored-by: Cal Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../features/skillprogress/SkillProgress.kt | 104 +++++++++++---------- 1 file changed, 56 insertions(+), 48 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/features/skillprogress') 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() { -- cgit