aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PetExpTooltip.kt23
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