From dbc70970b2e5f5a79cc2d18c8c33059e57b9b1eb Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal002@users.noreply.github.com> Date: Sun, 18 Aug 2024 09:27:08 +0200 Subject: Fix: Obfuscated and Shard (#2363) Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com> --- .../java/at/hannibal2/skyhanni/utils/ItemUtils.kt | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src/main/java/at/hannibal2/skyhanni/utils') diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt index 59a718d6c..09f77ebce 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.utils import at.hannibal2.skyhanni.data.PetAPI import at.hannibal2.skyhanni.events.DebugDataCollectEvent +import at.hannibal2.skyhanni.features.misc.items.EstimatedItemValueCalculator.getAttributeName import at.hannibal2.skyhanni.skyhannimodule.SkyHanniModule import at.hannibal2.skyhanni.test.command.ErrorManager import at.hannibal2.skyhanni.utils.CollectionUtils.addOrPut @@ -12,6 +13,7 @@ import at.hannibal2.skyhanni.utils.NumberUtil.formatInt import at.hannibal2.skyhanni.utils.RegexUtils.matchMatcher import at.hannibal2.skyhanni.utils.RegexUtils.matches import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.cachedData +import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getAttributes import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getEnchantments import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRecombobulated import at.hannibal2.skyhanni.utils.StringUtils.removeColor @@ -343,7 +345,20 @@ object ItemUtils { // use when showing the item name to the user (in guis, chat message, etc.), not for comparing val ItemStack.itemName: String - get() = getInternalName().itemName + get() { + getAttributeFromShard()?.let { + return it.getAttributeName() + } + return getInternalName().itemName + } + + + fun ItemStack.getAttributeFromShard(): Pair? { + if (getInternalName().asString() != "ATTRIBUTE_SHARD") return null + val attributes = getAttributes() ?: return null + return attributes.firstOrNull() + } + val ItemStack.itemNameWithoutColor: String get() = itemName.removeColor() @@ -382,6 +397,11 @@ object ItemUtils { return name.replace("Enchanted Book", itemStack.getLore()[0].removeColor()) } + // obfuscated trophy fish + if (name.contains("§kObfuscated")) { + return name.replace("§kObfuscated", "Obfuscated") + } + // hide pet level PetAPI.getCleanName(name)?.let { return "$it Pet" -- cgit