diff options
Diffstat (limited to 'src/main/java/at/hannibal2')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt index 25a899942..87e279b2d 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -20,6 +20,7 @@ class ItemDisplayOverlayFeatures { private val wishingCompassPattern = "§7Remaining Uses: §e(.*)§8/§e3".toPattern() private val rangerBootsSpeedCapPattern = "§7Current Speed Cap: §a(.*)".toPattern() + private val petLevelPattern = "\\[Lvl (?<level>.*)] (?:.*)".toPattern() @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { @@ -69,9 +70,12 @@ class ItemDisplayOverlayFeatures { val chestName = InventoryUtils.openInventoryName() if (!chestName.endsWith("Sea Creature Guide")) { if (ItemUtils.isPet(itemName)) { - val level = itemName.between("Lvl ", "] ").toInt() - if (level != ItemUtils.maxPetLevel(itemName)) { - return "$level" + val matcher = petLevelPattern.matcher(itemName) + if (matcher.matches()) { + val level = matcher.group("level").toInt() + if (level != ItemUtils.maxPetLevel(itemName)) { + return "$level" + } } } } |