aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-08 15:27:57 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-10-08 15:27:57 +0200
commit5cabbcd9bc250c1d7b4f16c31ffd9aac4095a221 (patch)
tree73426680a41971928a9f2c85f2cd5813a6d8e778 /src/main/java/at/hannibal2/skyhanni/features
parent79ca9b0494f88fed8030911fe994165a1c072f2f (diff)
downloadskyhanni-5cabbcd9bc250c1d7b4f16c31ffd9aac4095a221.tar.gz
skyhanni-5cabbcd9bc250c1d7b4f16c31ffd9aac4095a221.tar.bz2
skyhanni-5cabbcd9bc250c1d7b4f16c31ffd9aac4095a221.zip
Fixed a crash with future NEU versions because of renamed code.
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
index c43215d6b..4870e2e6d 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt
@@ -5,6 +5,7 @@ import at.hannibal2.skyhanni.utils.ItemUtils.getItemRarityOrNull
import at.hannibal2.skyhanni.utils.ItemUtils.name
import at.hannibal2.skyhanni.utils.LorenzRarity
import at.hannibal2.skyhanni.utils.LorenzUtils
+import at.hannibal2.skyhanni.utils.LorenzUtils.makeAccessible
import at.hannibal2.skyhanni.utils.LorenzUtils.round
import at.hannibal2.skyhanni.utils.NumberUtil
import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators
@@ -58,13 +59,25 @@ class PetExpTooltip {
index = toolTip.indexOfFirst { it.contains("Progress to Level") }
if (index != -1) {
- val offset = if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) 4 else 3
+
+ val offset = if (isNeuExtendedExpEnabled) 4 else 3
return index + offset
}
return null
}
+ private val isNeuExtendedExpEnabled get() = fieldPetExtendExp.get(objectNeuTooltipTweaks) as Boolean
+
+ private val objectNeuTooltipTweaks by lazy {
+ val field = NotEnoughUpdates.INSTANCE.config.javaClass.getDeclaredField("tooltipTweaks")
+ field.makeAccessible().get(NotEnoughUpdates.INSTANCE.config)
+ }
+
+ private val fieldPetExtendExp by lazy {
+ objectNeuTooltipTweaks.javaClass.getDeclaredField("petExtendExp").makeAccessible()
+ }
+
private fun getMaxValues(petName: String, petExperience: Double): Pair<Int, Int> {
val useGoldenDragonLevels =
petName.contains("Golden Dragon") && (!config.showGoldenDragonEgg || petExperience >= level100Legendary)