diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-26 08:23:45 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-26 08:23:45 +0200 |
commit | 04b753d7ffe03e7418a4f657ab8affe53b940d0e (patch) | |
tree | 0d60a7e042edce59cc86e76d564e39075e9ac6ae /src/main/java/at/hannibal2 | |
parent | 02910648df3f49abeef2b71aa688415a807ea964 (diff) | |
download | skyhanni-04b753d7ffe03e7418a4f657ab8affe53b940d0e.tar.gz skyhanni-04b753d7ffe03e7418a4f657ab8affe53b940d0e.tar.bz2 skyhanni-04b753d7ffe03e7418a4f657ab8affe53b940d0e.zip |
Changed the option in pet experience tooltip to show progress to level 100 for golden dragon eggs (can be disabled)
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java | 4 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt | 29 |
2 files changed, 24 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index f2176badc..10bae9f74 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -45,9 +45,9 @@ public class MiscConfig { public boolean showAlways = false; @Expose - @ConfigOption(name = "GDrag 200", desc = "Show for Golden Dragon the exp needed for level 200.") + @ConfigOption(name = "Dragon Egg", desc = "For an Golden Dragon Egg, show progress to level 100 instead of 200.") @ConfigEditorBoolean - public boolean goldenDragon200 = true; + public boolean showGoldenDragonEgg = true; } 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 35ed88534..c43215d6b 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt @@ -1,12 +1,15 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod -import at.hannibal2.skyhanni.utils.* 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.round +import at.hannibal2.skyhanni.utils.NumberUtil import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetExp +import at.hannibal2.skyhanni.utils.StringUtils import io.github.moulberry.notenoughupdates.NotEnoughUpdates import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority @@ -14,6 +17,9 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class PetExpTooltip { private val config get() = SkyHanniMod.feature.misc.petExperienceToolTip + private val level100Common = 5_624_785 + private val level100Legendary = 25_353_230 + private val level200 = 210_255_385 @SubscribeEvent(priority = EventPriority.LOWEST) fun onItemTooltipLow(event: ItemTooltipEvent) { @@ -27,8 +33,7 @@ class PetExpTooltip { val index = findIndex(event.toolTip) ?: return - val maxLevel = ItemUtils.maxPetLevel(name) - val maxXp = maxPetExp(name) // lvl 100 legendary + val (maxLevel, maxXp) = getMaxValues(name, petExperience) val percentage = petExperience / maxXp val percentageFormat = LorenzUtils.formatPercentage(percentage) @@ -60,10 +65,20 @@ class PetExpTooltip { return null } - private fun maxPetExp(petName: String) = when { - petName.contains("Golden Dragon") && config.goldenDragon200 -> 210_255_385 // lvl 200 legendary - petName.contains("Bingo") -> 5_624_785 // lvl 100 common + private fun getMaxValues(petName: String, petExperience: Double): Pair<Int, Int> { + val useGoldenDragonLevels = + petName.contains("Golden Dragon") && (!config.showGoldenDragonEgg || petExperience >= level100Legendary) - else -> 25_353_230 // lvl 100 legendary + val maxLevel = if (useGoldenDragonLevels) 200 else 100 + + val maxXp = when { + useGoldenDragonLevels -> level200 // lvl 200 legendary + petName.contains("Bingo") -> level100Common + + else -> level100Legendary + } + + return Pair(maxLevel, maxXp) } + } |