aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-04-09 19:16:36 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2024-04-09 19:16:36 +0200
commit1f19a29b67cdcaa19d2a1c61da7098b27d808446 (patch)
tree1f30b58da455ba916458ec51cfa35ea9eec90290 /src/main/java
parentf41a77e74500ac4123dd3e47e2bd2c2ea6d6e63f (diff)
downloadskyhanni-1f19a29b67cdcaa19d2a1c61da7098b27d808446.tar.gz
skyhanni-1f19a29b67cdcaa19d2a1c61da7098b27d808446.tar.bz2
skyhanni-1f19a29b67cdcaa19d2a1c61da7098b27d808446.zip
code cleanup
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt6
3 files changed, 10 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
index a39396bc1..117dcf8e4 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/HideNotClickableItems.kt
@@ -29,7 +29,7 @@ import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzUtils
import at.hannibal2.skyhanni.utils.MultiFilter
import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName
-import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getExtraAttributes
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isMuseumDonated
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftExportable
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.isRiftTransferable
import at.hannibal2.skyhanni.utils.StringUtils.matchMatcher
@@ -486,6 +486,7 @@ class HideNotClickableItems {
hideReason = "This item should not be salvaged! (Recombobulated)"
return true
}
+ // TODO replace with rarity check
for (line in stack.getLore()) {
if (line.contains("LEGENDARY DUNGEON")) {
hideReason = "This item should not be salvaged! (Legendary)"
@@ -493,8 +494,7 @@ class HideNotClickableItems {
}
}
- val museumDonated = stack.getExtraAttributes()?.getBoolean("donated_museum") ?: false
- if (museumDonated) {
+ if (stack.isMuseumDonated()) {
hideReason = "This item cannot be salvaged! (Donated to Museum)"
return true
}
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 2a899117d..bebac7d45 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/inventory/ItemDisplayOverlayFeatures.kt
@@ -43,7 +43,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.getExtraAttributes
+import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getNewYearCake
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getPetLevel
import at.hannibal2.skyhanni.utils.SkyBlockItemModifierUtils.getRanchersSpeed
import at.hannibal2.skyhanni.utils.StringUtils.matchFirst
@@ -120,7 +120,7 @@ object ItemDisplayOverlayFeatures {
}
if (NEW_YEAR_CAKE.isSelected() && internalName == "NEW_YEAR_CAKE".asInternalName()) {
- val year = item.getExtraAttributes()?.getInteger("new_years_cake")?.toString() ?: ""
+ val year = item.getNewYearCake()?.toString() ?: ""
return "§b$year"
}
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
index ebc0313c7..756d87d13 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/SkyBlockItemModifierUtils.kt
@@ -175,12 +175,16 @@ object SkyBlockItemModifierUtils {
fun ItemStack.hasArtOfPeace() = getAttributeBoolean("artOfPeaceApplied")
+ fun ItemStack.isMuseumDonated() = getAttributeBoolean("donated_museum")
+
fun ItemStack.getLivingMetalProgress() = getAttributeInt("lm_evo")
fun ItemStack.getBottleOfJyrreSeconds() = getAttributeInt("bottle_of_jyrre_seconds")
fun ItemStack.getEdition() = getAttributeInt("edition")
+ fun ItemStack.getNewYearCake() = getAttributeInt("new_years_cake")
+
fun ItemStack.getEnchantments() = getExtraAttributes()?.takeIf { it.hasKey("enchantments") }?.run {
val enchantments = this.getCompoundTag("enchantments")
enchantments.keySet.associateWith { enchantments.getInteger(it) }
@@ -251,7 +255,7 @@ object SkyBlockItemModifierUtils {
getExtraAttributes()?.getLong(label)?.takeUnless { it == 0L }
private fun ItemStack.getAttributeBoolean(label: String): Boolean {
- return getExtraAttributes()?.hasKey(label) ?: false
+ return getExtraAttributes()?.getBoolean(label) ?: false
}
fun ItemStack.getExtraAttributes() = tagCompound?.getCompoundTag("ExtraAttributes")