From 940f557330e3696391a5fb2e59d67dddc1d288fb Mon Sep 17 00:00:00 2001 From: Vixid <52578495+VixidDev@users.noreply.github.com> Date: Sat, 10 Aug 2024 08:49:27 +0100 Subject: Fix: Lore on books with Compressed format + Regex Fix (#2301) --- .../features/misc/items/enchants/EnchantParser.kt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/main/java/at/hannibal2') diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt index 530cd4886..a1aacfb0c 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/items/enchants/EnchantParser.kt @@ -38,7 +38,7 @@ object EnchantParser { val patternGroup = RepoPattern.group("misc.items.enchantparsing") val enchantmentPattern by patternGroup.pattern( - "enchants", "(?[A-Za-z][A-Za-z -]+) (?[IVXLCDM]+)(?, |\$| \\d{1,3}(,\\d{3})*)" + "enchants", "(?[A-Za-z][A-Za-z '-]+) (?[IVXLCDM]+)(?, |\$| \\d{1,3}(,\\d{3})*)" ) private val grayEnchantPattern by patternGroup.pattern( "grayenchants", "^(Respiration|Aqua Affinity|Depth Strider|Efficiency).*" @@ -315,11 +315,18 @@ object EnchantParser { val comma = if (commaFormat == CommaFormat.COPY_ENCHANT) ", " else "ยง9, " builder.append(orderedEnchant.getFormattedString()) - if (i % 3 != 2) { - builder.append(comma) - } else { + + if (itemIsBook() && maxEnchantsPerLine == 1) { insertEnchants.add(builder.toString()) + insertEnchants.addAll(orderedEnchant.getLore()) builder = StringBuilder() + } else { + if (i % 3 != 2) { + builder.append(comma) + } else { + insertEnchants.add(builder.toString()) + builder = StringBuilder() + } } } -- cgit