Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Skill Display #1058

Merged
merged 5 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/at/hannibal2/skyhanni/api/SkillAPI.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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()
}
}

Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,4 +407,4 @@ interface Renderable {
}
}
}
}
}
Loading