diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-05 23:10:10 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-03-05 23:10:10 +0100 |
commit | ac3a1ccc0e77da14870a9be8fa041ae083284ac1 (patch) | |
tree | 7776175456588316ef1bc535936d9ff9fabc4976 /src/main | |
parent | 0144f643678b8e2a7d472b8df1de87b865e753e7 (diff) | |
download | skyhanni-ac3a1ccc0e77da14870a9be8fa041ae083284ac1.tar.gz skyhanni-ac3a1ccc0e77da14870a9be8fa041ae083284ac1.tar.bz2 skyhanni-ac3a1ccc0e77da14870a9be8fa041ae083284ac1.zip |
Fixed wrong overlay numbers for tier 0 collections in collection inventory.
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt | 7 |
1 files changed, 6 insertions, 1 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 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<String>) = lore.map { collectionTier0Pattern.matcher(it) }.any { it.matches() } + private fun grabSackName(name: String): String { val split = name.split(" ") val text = split[0] |