aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/com/ambientaddons/utils/Extensions.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/com/ambientaddons/utils/Extensions.kt')
-rw-r--r--src/main/kotlin/com/ambientaddons/utils/Extensions.kt15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/main/kotlin/com/ambientaddons/utils/Extensions.kt b/src/main/kotlin/com/ambientaddons/utils/Extensions.kt
index ef4bcf1..62c8c37 100644
--- a/src/main/kotlin/com/ambientaddons/utils/Extensions.kt
+++ b/src/main/kotlin/com/ambientaddons/utils/Extensions.kt
@@ -55,6 +55,21 @@ object Extensions {
return it.getString("id")
}
+ val ItemStack.itemQuality: Int?
+ get() = this.extraAttributes?.let {
+ if (!it.hasKey("baseStatBoostPercentage", 3)) return null
+ return it.getInteger("baseStatBoostPercentage")
+ }
+
+ val ItemStack.stars: Int?
+ get() = this.extraAttributes?.let {
+ return when {
+ it.hasKey("dungeon_item_level", 3) -> it.getInteger("dungeon_item_level")
+ it.hasKey("upgrade_level", 3) -> it.getInteger("upgrade_level")
+ else -> null
+ }
+ }
+
val ItemStack.enchants: Map<String, Int>?
get() = this.extraAttributes?.let { extraAttributes ->
if (!extraAttributes.hasKey("enchantments", 10)) return null