From ac3a1ccc0e77da14870a9be8fa041ae083284ac1 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 5 Mar 2023 23:10:10 +0100 Subject: Fixed wrong overlay numbers for tier 0 collections in collection inventory. --- .../skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java') 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 2fe34d105..4bbd64276 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -18,6 +18,7 @@ import java.util.regex.Pattern class ItemDisplayOverlayFeatures { private val wishingCompassPattern = Pattern.compile("§7Remaining Uses: §e(.*)§8/§e3") + private val collectionTier0Pattern = Pattern.compile("§7Progress to .* I: .*") @SubscribeEvent fun onRenderItemTip(event: RenderItemTipEvent) { @@ -134,8 +135,10 @@ class ItemDisplayOverlayFeatures { if (SkyHanniMod.feature.inventory.itemNumberAsStackSize.contains(10)) { if (InventoryUtils.openInventoryName().endsWith(" Collections")) { - if (item.getLore().any { it.contains("Click to view!") }) { + val lore = item.getLore() + if (lore.any { it.contains("Click to view!") }) { item.name?.let { + if (isCollectionTier0(lore)) return "0" if (it.startsWith("§e")) { val text = it.split(" ").last() return "" + text.romanToDecimalIfNeeded() @@ -147,6 +150,8 @@ class ItemDisplayOverlayFeatures { return "" } + private fun isCollectionTier0(lore: List) = lore.map { collectionTier0Pattern.matcher(it) }.any { it.matches() } + private fun grabSackName(name: String): String { val split = name.split(" ") val text = split[0] -- cgit