summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorNopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com>2024-04-15 07:09:37 +1000
committerGitHub <noreply@github.com>2024-04-14 23:09:37 +0200
commit377fd979821296cde9d6ceb2fa4b365e4637232a (patch)
treef89e2cbc22ec01155c8a48dcbc9661ed05e96cab /src/main/java/at/hannibal2/skyhanni/utils
parent161ed783e0e4e0d5d57e358f9939c08f934aee1d (diff)
downloadskyhanni-377fd979821296cde9d6ceb2fa4b365e4637232a.tar.gz
skyhanni-377fd979821296cde9d6ceb2fa4b365e4637232a.tar.bz2
skyhanni-377fd979821296cde9d6ceb2fa4b365e4637232a.zip
Fix skill issue (#1446)
Co-authored-by: Cal <cwolfson58@gmail.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt
index 31bfe4416..362654807 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/CombatUtils.kt
@@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils
import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostCounter
import at.hannibal2.skyhanni.features.combat.ghostcounter.GhostData
+import at.hannibal2.skyhanni.mixins.transformers.MixinXPInformation
import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils
import io.github.moulberry.notenoughupdates.util.XPInformation
@@ -25,6 +26,16 @@ object CombatUtils {
private var gainTimer = 0
var _isKilling = false
+ private fun getSkillInfo(xpInformation: XPInformation.SkillInfo?): Float {
+ return try {
+ val a = xpInformation as? MixinXPInformation
+ a!!.getTotalXp().toFloat()
+ } catch (e: Exception) {
+ val xpInfo = xpInformation ?: return -1f
+ xpInfo.totalXp
+ }
+ }
+
/**
* Taken from NotEnoughUpdates
*/
@@ -33,7 +44,7 @@ object CombatUtils {
xpGainHourLast = xpGainHour
skillInfoLast = skillInfo
skillInfo = XPInformation.getInstance().getSkillInfo(SKILL_TYPE) ?: return
- val totalXp: Float = skillInfo!!.totalXp
+ val totalXp = getSkillInfo(skillInfo)
if (lastTotalXp > 0) {
val delta: Float = totalXp - lastTotalXp