summaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-08-18 09:27:08 +0200
committerGitHub <noreply@github.com>2024-08-18 09:27:08 +0200
commitdbc70970b2e5f5a79cc2d18c8c33059e57b9b1eb (patch)
treee889205eb5ce9bf3ae4e05d30cb69e03ccd96b8a /src/main/java/at/hannibal2/skyhanni/utils
parentb2bc0f3c44192af4a20a18917c4d8cef7835723b (diff)
downloadskyhanni-dbc70970b2e5f5a79cc2d18c8c33059e57b9b1eb.tar.gz
skyhanni-dbc70970b2e5f5a79cc2d18c8c33059e57b9b1eb.tar.bz2
skyhanni-dbc70970b2e5f5a79cc2d18c8c33059e57b9b1eb.zip
Fix: Obfuscated and Shard (#2363)
Co-authored-by: hannibal2 <24389977+hannibal00212@users.noreply.github.com>
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt22
1 files changed, 21 insertions, 1 deletions
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<String, Int>? {
+ 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"