From 641e965951d645c39d2d3877fc684e89d0271c80 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:22:11 +0100 Subject: Fixed Purse Pattern (#1017) * Updated pattern * Update PurseAPI.kt --- src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt index 184d41567..8e3f486f0 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt @@ -15,7 +15,7 @@ object PurseAPI { private val patternGroup = RepoPattern.group("data.purse") private val coinsPattern by patternGroup.pattern( "coins", - "(Piggy|Purse): §6(?[\\d,]+).*" + "(§.)*(Piggy|Purse): §6(?[\\d,]+(\\.\\d)?)( ?(§.)*\\([+-](?[\\w,.]+)\\)?|.*)?$" ) val piggyPattern by patternGroup.pattern( "piggy", -- cgit From e4854980b5dad328a524393286329c9f4d7e5095 Mon Sep 17 00:00:00 2001 From: J10a1n15 <45315647+j10a1n15@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:34:43 +0100 Subject: Change: Smaller Purse Pattern fix (#1019) * Updated pattern * Update PurseAPI.kt * Small change --- src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt index 8e3f486f0..a9c18c60c 100644 --- a/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt +++ b/src/main/java/at/hannibal2/skyhanni/data/PurseAPI.kt @@ -15,7 +15,7 @@ object PurseAPI { private val patternGroup = RepoPattern.group("data.purse") private val coinsPattern by patternGroup.pattern( "coins", - "(§.)*(Piggy|Purse): §6(?[\\d,]+(\\.\\d)?)( ?(§.)*\\([+-](?[\\w,.]+)\\)?|.*)?$" + "(§.)*(Piggy|Purse): §6(?[\\d,.]+)( ?(§.)*\\([+-](?[\\d,.]+)\\)?|.*)?$" ) val piggyPattern by patternGroup.pattern( "piggy", -- cgit From 128b8db7ad7e8633af231d6f547aca1eed3c1e95 Mon Sep 17 00:00:00 2001 From: Thunderblade73 <85900443+Thunderblade73@users.noreply.github.com> Date: Sat, 17 Feb 2024 00:45:13 +0100 Subject: Fix: Pet Level pattern and stack size (#1018) * Fix: Pet Level pattern and stack size * removed empty line --- .../features/inventory/ItemDisplayOverlayFeatures.kt | 16 +++++++--------- .../java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt | 2 +- 2 files changed, 8 insertions(+), 10 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 d768bb844..75a4063a2 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt @@ -25,10 +25,12 @@ import at.hannibal2.skyhanni.events.RenderItemTipEvent import at.hannibal2.skyhanni.features.garden.pests.PestAPI import at.hannibal2.skyhanni.utils.ConfigUtils import at.hannibal2.skyhanni.utils.InventoryUtils +import at.hannibal2.skyhanni.utils.ItemCategory import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.ItemUtils.getInternalNameOrNull +import at.hannibal2.skyhanni.utils.ItemUtils.getItemCategoryOrNull import at.hannibal2.skyhanni.utils.ItemUtils.getLore import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LorenzUtils.between @@ -39,6 +41,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimal import at.hannibal2.skyhanni.utils.NumberUtil.romanToDecimalIfNecessary import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getBottleOfJyrreSeconds import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEdition +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRanchersSpeed import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -120,15 +123,10 @@ object ItemDisplayOverlayFeatures { } if (PET_LEVEL.isSelected()) { - val containerName = InventoryUtils.openInventoryName() - if (!containerName.endsWith("Sea Creature Guide") && ItemUtils.isPet(itemName)) { - petLevelPattern.matchMatcher(itemName) { - val rawLevel = group("level") - val level = rawLevel.toIntOrNull() - ?: throw IllegalStateException("pet level not found for item name '$itemName'") - if (level != ItemUtils.maxPetLevel(itemName)) { - return "$level" - } + if (item.getItemCategoryOrNull() == ItemCategory.PET) { + val level = item.getPetLevel() + if (level != ItemUtils.maxPetLevel(itemName)) { + return level.toString() } } } diff --git a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt index 5f466f33f..20a4f3db4 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/UtilsPatterns.kt @@ -43,7 +43,7 @@ object UtilsPatterns { ) val petLevelPattern by patternGroup.pattern( "item.petlevel", - "(?:§f§f)?§7\\[Lvl (?\\d+)] .*" + "(?:§f§f)?(?:§7)?\\[Lvl (?\\d+)] .*" ) val readAmountBeforePattern by patternGroup.pattern( "item.amount.front", -- cgit