diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-08 15:27:57 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-08 15:27:57 +0200 |
commit | 5cabbcd9bc250c1d7b4f16c31ffd9aac4095a221 (patch) | |
tree | 73426680a41971928a9f2c85f2cd5813a6d8e778 /src/main/java | |
parent | 79ca9b0494f88fed8030911fe994165a1c072f2f (diff) | |
download | skyhanni-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')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt | 15 |
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) |