diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-15 13:08:31 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-15 13:08:31 +0200 |
commit | 85d7ae90e5e299972f4ff288686d08bb671e72bf (patch) | |
tree | e45e4140238ef10507f5b01ecb59106617c1e7e4 /src/main/java/at/hannibal2/skyhanni | |
parent | b26814bc3b7559c999dbbb11d0aec11f6ecb2be3 (diff) | |
download | skyhanni-85d7ae90e5e299972f4ff288686d08bb671e72bf.tar.gz skyhanni-85d7ae90e5e299972f4ff288686d08bb671e72bf.tar.bz2 skyhanni-85d7ae90e5e299972f4ff288686d08bb671e72bf.zip |
Fixed pet exp tooltip doesn't show in pet inventory or Hypixel profile viewer (right-click a player).
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt | 23 |
1 files changed, 17 insertions, 6 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 7a96c86d2..35ed88534 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt @@ -4,10 +4,10 @@ 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.LorenzUtils.indexOfFirst import at.hannibal2.skyhanni.utils.LorenzUtils.round import at.hannibal2.skyhanni.utils.NumberUtil.addSeparators import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetExp +import io.github.moulberry.notenoughupdates.NotEnoughUpdates import net.minecraftforge.event.entity.player.ItemTooltipEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -25,11 +25,7 @@ class PetExpTooltip { val petExperience = itemStack.getPetExp()?.round(1) ?: return val name = itemStack.name ?: return - val index = event.toolTip.indexOfFirst( - "§5§o§7§eClick to summon!", - "§5§o§7§cClick to despawn!", - "§5§o§7§eRight-click to add this pet to", - ) ?: return + val index = findIndex(event.toolTip) ?: return val maxLevel = ItemUtils.maxPetLevel(name) val maxXp = maxPetExp(name) // lvl 100 legendary @@ -49,6 +45,21 @@ class PetExpTooltip { } } + private fun findIndex(toolTip: List<String>): Int? { + var index = toolTip.indexOfFirst { it.contains("MAX LEVEL") } + if (index != -1) { + return index + 2 + } + + index = toolTip.indexOfFirst { it.contains("Progress to Level") } + if (index != -1) { + val offset = if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) 4 else 3 + return index + offset + } + + 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 |