diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-02 13:04:30 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-02 13:04:30 +0200 |
commit | e246c086141740668923f5b8c6d3b0ca5b0ea042 (patch) | |
tree | d2c80d0df582255aa9d9752642a7055463e82cda /src/main/java/at/hannibal2/skyhanni/features/itemabilities | |
parent | b2b0a4794341885f52111f8fd6d863915b6d460d (diff) | |
download | skyhanni-e246c086141740668923f5b8c6d3b0ca5b0ea042.tar.gz skyhanni-e246c086141740668923f5b8c6d3b0ca5b0ea042.tar.bz2 skyhanni-e246c086141740668923f5b8c6d3b0ca5b0ea042.zip |
using NEUInternalName in more places
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/itemabilities')
2 files changed, 17 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt index 81ce2ac2d..2e17e07ff 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbility.kt @@ -2,6 +2,8 @@ package at.hannibal2.skyhanni.features.itemabilities.abilitycooldown import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.NEUInternalName +import at.hannibal2.skyhanni.utils.NEUInternalName.Companion.asInternalName enum class ItemAbility( val abilityName: String, @@ -51,7 +53,7 @@ enum class ItemAbility( ECHO("Echo", 3, "Ancestral Spade"); var newVariant = false - var internalNames = mutableListOf<String>() + var internalNames = mutableListOf<NEUInternalName>() constructor( cooldownInSeconds: Int, @@ -59,8 +61,10 @@ enum class ItemAbility( alternativePosition: Boolean = false, ) : this("no name", cooldownInSeconds, actionBarDetection = false, alternativePosition = alternativePosition) { newVariant = true - internalNames.addAll(alternateInternalNames) - internalNames.add(name) + alternateInternalNames.forEach { + internalNames.add(it.asInternalName()) + } + internalNames.add(name.asInternalName()) } fun activate(color: LorenzColor? = null, customCooldown: Int = (cooldownInSeconds * 1000)) { @@ -92,7 +96,7 @@ enum class ItemAbility( } companion object { - fun getByInternalName(internalName: String): ItemAbility? { + fun getByInternalName(internalName: NEUInternalName): ItemAbility? { return entries.firstOrNull { it.newVariant && internalName in it.internalNames } } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt index f09e86164..a0fd45a13 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/itemabilities/abilitycooldown/ItemAbilityCooldown.kt @@ -6,7 +6,7 @@ import at.hannibal2.skyhanni.events.* import at.hannibal2.skyhanni.utils.InventoryUtils import at.hannibal2.skyhanni.utils.ItemUtils import at.hannibal2.skyhanni.utils.ItemUtils.cleanName -import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName_old +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName import at.hannibal2.skyhanni.utils.LorenzColor import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.between @@ -46,8 +46,12 @@ class ItemAbilityCooldown { ItemAbility.GYROKINETIC_WAND_LEFT.sound() } if (event.pitch == 1f && event.volume == 1f) { - val internalName = InventoryUtils.getItemInHand()?.getInternalName_old() ?: return - if (!internalName.equalsOneOf("SHADOW_FURY", "STARRED_SHADOW_FURY")) return + val internalName = InventoryUtils.getItemInHand()?.getInternalName() ?: return + if (!internalName.equalsOneOf( + "SHADOW_FURY".asInternalName(), + "STARRED_SHADOW_FURY".asInternalName() + ) + ) return ItemAbility.SHADOW_FURY.sound() } @@ -157,7 +161,7 @@ class ItemAbilityCooldown { private fun handleItemClick(itemInHand: ItemStack?) { if (!LorenzUtils.inSkyBlock) return - itemInHand?.getInternalName_old()?.run { + itemInHand?.getInternalName()?.run { ItemAbility.getByInternalName(this)?.setItemClick() } } @@ -321,7 +325,7 @@ class ItemAbilityCooldown { private fun hasAbility(stack: ItemStack): MutableList<ItemAbility> { val itemName: String = stack.cleanName() - val internalName = stack.getInternalName_old() + val internalName = stack.getInternalName() val list = mutableListOf<ItemAbility>() for (ability in ItemAbility.entries) { |