aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal002@users.noreply.github.com>2024-02-22 21:54:12 +0100
committerGitHub <noreply@github.com>2024-02-22 21:54:12 +0100
commit7bde14535264d20e37c5c085f8a03db3275044b5 (patch)
tree7b5a2852057fd89dd1a1622f2f25c1808938677c /src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
parent3994a15d86eee42023e3715a671c85de243ea226 (diff)
downloadskyhanni-7bde14535264d20e37c5c085f8a03db3275044b5.tar.gz
skyhanni-7bde14535264d20e37c5c085f8a03db3275044b5.tar.bz2
skyhanni-7bde14535264d20e37c5c085f8a03db3275044b5.zip
Removed duplicate pet level detection logic. #1027
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt15
1 files changed, 2 insertions, 13 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
index ab0d695fd..80939e492 100644
--- a/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
+++ b/src/main/java/at/hannibal2/skyhanni/utils/ItemUtils.kt
@@ -29,15 +29,6 @@ object ItemUtils {
private val itemNameCache = mutableMapOf<NEUInternalName, String>() // internal name -> item name
- private val ignoredPetStrings = listOf(
- "Archer",
- "Berserk",
- "Mage",
- "Tank",
- "Healer",
- "➡",
- )
-
fun ItemStack.cleanName() = this.displayName.removeColor()
fun isSack(stack: ItemStack) = stack.getInternalName().endsWith("_SACK") && stack.cleanName().endsWith(" Sack")
@@ -64,8 +55,6 @@ object ItemUtils {
fun isRecombobulated(stack: ItemStack) = stack.isRecombobulated()
- fun isPet(name: String): Boolean = UtilsPatterns.petLevelPattern.matches(name) && !ignoredPetStrings.any { name.contains(it) }
-
fun maxPetLevel(name: String) = if (name.contains("Golden Dragon")) 200 else 100
fun getItemsInInventory(withCursorItem: Boolean = false): List<ItemStack> {
@@ -217,7 +206,7 @@ object ItemUtils {
val name = this.name ?: ""
val cleanName = this.cleanName()
- if (isPet(cleanName)) {
+ if (PetAPI.hasPetName(cleanName)) {
return getPetRarity(this) to ItemCategory.PET
}
@@ -260,7 +249,7 @@ object ItemUtils {
private fun getItemCategory(itemCategory: String, name: String, cleanName: String = name.removeColor()) =
if (itemCategory.isEmpty()) when {
UtilsPatterns.abiPhonePattern.matches(name) -> ItemCategory.ABIPHONE
- isPet(cleanName) -> ItemCategory.PET
+ PetAPI.hasPetName(cleanName) -> ItemCategory.PET
UtilsPatterns.enchantedBookPattern.matches(name) -> ItemCategory.ENCHANTED_BOOK
UtilsPatterns.potionPattern.matches(name) -> ItemCategory.POTION
UtilsPatterns.sackPattern.matches(name) -> ItemCategory.SACK