diff options
author | HiZe <super@hize.be> | 2024-02-25 20:41:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-25 20:41:02 +0100 |
commit | ea2a886070f6105e4600f604ffd685e78f8ce101 (patch) | |
tree | 1c1e2b3bdb8cb6358d8f87e790a7498d73d5ea32 /src/main/java/at/hannibal2/skyhanni | |
parent | ce3ab82ad811dc76781d3113765325461045efbd (diff) | |
download | skyhanni-ea2a886070f6105e4600f604ffd685e78f8ce101.tar.gz skyhanni-ea2a886070f6105e4600f604ffd685e78f8ce101.tar.bz2 skyhanni-ea2a886070f6105e4600f604ffd685e78f8ce101.zip |
Fixed skill display stuff #1058
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
3 files changed, 28 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt index 45480aa4e..b21c10d41 100644 --- a/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt @@ -403,7 +403,7 @@ object SkillAPI { val level = getLevel(xp) ChatUtils.chat("With §b${xp.addSeparators()} §eXP you would be level §b$level") } else { - val (overflowLevel, current, needed, _) = calculateOverFlow(xp) + val (overflowLevel, current, needed, _) = calculateOverFlow((xp) - XP_NEEDED_FOR_60) ChatUtils.chat( "With §b${xp.addSeparators()} §eXP you would be level §b$overflowLevel " + "§ewith progress (§b${current.addSeparators()}§e/§b${needed.addSeparators()}§e) XP" @@ -423,7 +423,7 @@ object SkillAPI { ChatUtils.chat("You need §b${neededXp.addSeparators()} §eXP to be level §b${level.toDouble()}") } else { val base = levelingMap.values.sum().toLong() - val neededXP = xpRequiredForLevel(level.toDouble()) + base + val neededXP = xpRequiredForLevel(level.toDouble()) ChatUtils.chat("You need §b${neededXP.addSeparators()} §eXP to be level §b${level.toDouble()}") } return 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 0c88e7633..684d65c82 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/skillprogress/SkillProgress.kt @@ -115,8 +115,9 @@ object SkillProgress { } else { maxWidth = barConfig.regularBar.width + val factor = skillExpPercentage.coerceAtMost(1.0) Renderable.progressBar( - percent = skillExpPercentage, + percent = factor, startColor = Color(SpecialColour.specialToChromaRGB(barConfig.barStartColor)), endColor = Color(SpecialColour.specialToChromaRGB(barConfig.barStartColor)), width = maxWidth, @@ -312,13 +313,18 @@ object SkillProgress { val useCustomGoalLevel = skillInfo.customGoalLevel != 0 && skillInfo.customGoalLevel > skillInfo.overflowLevel && customGoalConfig.enableInETADisplay var targetLevel = if (useCustomGoalLevel) skillInfo.customGoalLevel else level + 1 if (targetLevel <= level || targetLevel > 400) targetLevel = (level + 1) - val currentLevelNeededXp = SkillUtil.xpRequiredForLevel(level.toDouble()) + skillInfo.overflowCurrentXp + + val need = skillInfo.overflowCurrentXpMax + val have = skillInfo.overflowCurrentXp + + val currentLevelNeededXp = SkillUtil.xpRequiredForLevel(level.toDouble()) + have val targetNeededXp = SkillUtil.xpRequiredForLevel(targetLevel.toDouble()) - var remaining = if (useCustomGoalLevel) targetNeededXp - currentLevelNeededXp else skillInfo.overflowCurrentXpMax - skillInfo.overflowCurrentXp - if (!useCustomGoalLevel) { + var remaining = if (useCustomGoalLevel) targetNeededXp - currentLevelNeededXp else need - have + + if (!useCustomGoalLevel && have < need) { if (skillInfo.overflowCurrentXpMax == skillInfoLast.overflowCurrentXpMax) { - remaining = interpolate(remaining.toFloat(), (skillInfoLast.overflowCurrentXpMax - skillInfoLast.overflowCurrentXp).toFloat(), lastGainUpdate.toMillis()).toLong() + remaining = interpolate(remaining.toFloat(), (need - have).toFloat(), lastGainUpdate.toMillis()).toLong() } } @@ -328,7 +334,10 @@ object SkillProgress { add(Renderable.string("§7Needed XP: §e${remaining.addSeparators()}")) var xpInterp = xpInfo.xpGainHour - if (xpInfo.xpGainHour < 1000) { + + if (have > need){ + add(Renderable.string("§7In §cIncrease level cap!")) + } else if (xpInfo.xpGainHour < 1000) { add(Renderable.string("§7In §cN/A")) } else { val duration = ((remaining) * 1000 * 60 * 60 / xpInterp.toLong()).milliseconds @@ -441,6 +450,16 @@ object SkillProgress { if (xpInfo.lastTotalXp > 0) { val delta = totalXp - xpInfo.lastTotalXp if (delta > 0 && delta < 1000) { + + xpInfo.timer = when (SkillAPI.activeSkill) { + SkillType.FARMING -> etaConfig.farmingPauseTime + SkillType.MINING -> etaConfig.miningPauseTime + SkillType.COMBAT -> etaConfig.combatPauseTime + SkillType.FORAGING -> etaConfig.foragingPauseTime + SkillType.FISHING -> etaConfig.fishingPauseTime + else -> 3 + } + xpInfo.xpGainQueue.add(0, delta) calculateXPHour(xpInfo) diff --git a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt index c1b382ba8..106743a2c 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/renderables/Renderable.kt @@ -407,4 +407,4 @@ interface Renderable { } } } -}
\ No newline at end of file +} |