diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-26 11:04:31 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-11-26 11:04:31 +0100 |
commit | dfa7e8daa75d24ab1f854ae74acea3d6d691d088 (patch) | |
tree | efcdfaaaecdbf148e4b9770aade8d69279971e99 /src/main | |
parent | 7caf2d6a8e33a14df567a78e78c0b4d1273a2971 (diff) | |
download | skyhanni-dfa7e8daa75d24ab1f854ae74acea3d6d691d088.tar.gz skyhanni-dfa7e8daa75d24ab1f854ae74acea3d6d691d088.tar.bz2 skyhanni-dfa7e8daa75d24ab1f854ae74acea3d6d691d088.zip |
Added PestType enum
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt | 16 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt | 16 |
2 files changed, 20 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt index 2824676bf..5a3249ea3 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/combat/damageindicator/MobFinder.kt @@ -4,6 +4,7 @@ import at.hannibal2.skyhanni.data.IslandType import at.hannibal2.skyhanni.features.dungeon.DungeonAPI import at.hannibal2.skyhanni.features.dungeon.DungeonLividFinder import at.hannibal2.skyhanni.features.garden.GardenAPI +import at.hannibal2.skyhanni.features.garden.pests.PestType import at.hannibal2.skyhanni.features.rift.RiftAPI import at.hannibal2.skyhanni.utils.EntityUtils import at.hannibal2.skyhanni.utils.EntityUtils.hasBossHealth @@ -121,18 +122,9 @@ class MobFinder { private fun tryAddGardenPest(entity: EntityLivingBase): EntityResult? { if (!GardenAPI.inGarden()) return null - if (entity.hasNameTagWith(3, "Beetle")) return EntityResult(bossType = BossType.GARDEN_PEST_BEETLE) - if (entity.hasNameTagWith(3, "Cricket")) return EntityResult(bossType = BossType.GARDEN_PEST_CRICKET) - if (entity.hasNameTagWith(3, "Fly")) return EntityResult(bossType = BossType.GARDEN_PEST_FLY) - if (entity.hasNameTagWith(3, "Locust")) return EntityResult(bossType = BossType.GARDEN_PEST_LOCUST) - if (entity.hasNameTagWith(3, "Mite")) return EntityResult(bossType = BossType.GARDEN_PEST_MITE) - if (entity.hasNameTagWith(3, "Mosquito")) return EntityResult(bossType = BossType.GARDEN_PEST_MOSQUITO) - if (entity.hasNameTagWith(3, "Moth")) return EntityResult(bossType = BossType.GARDEN_PEST_MOTH) - if (entity.hasNameTagWith(3, "Rat")) return EntityResult(bossType = BossType.GARDEN_PEST_RAT) - if (entity.hasNameTagWith(3, "Slug")) return EntityResult(bossType = BossType.GARDEN_PEST_SLUG) - if (entity.hasNameTagWith(3, "Earthworm")) return EntityResult(bossType = BossType.GARDEN_PEST_EARTHWORM) - - return null + return PestType.entries + .firstOrNull { entity.hasNameTagWith(3, it.displayName) } + ?.let { EntityResult(bossType = it.damageIndicatorBoss) } } private fun tryAddDungeon(entity: EntityLivingBase) = when { diff --git a/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt new file mode 100644 index 000000000..4a32f7f6c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/features/garden/pests/PestType.kt @@ -0,0 +1,16 @@ +package at.hannibal2.skyhanni.features.garden.pests + +import at.hannibal2.skyhanni.features.combat.damageindicator.BossType + +enum class PestType(val displayName: String, val damageIndicatorBoss: BossType) { + BEETLE("Beetle", BossType.GARDEN_PEST_BEETLE), + CRICKET("Cricket", BossType.GARDEN_PEST_CRICKET), + EARTHWORM("Earthworm", BossType.GARDEN_PEST_EARTHWORM), + FLY("Fly", BossType.GARDEN_PEST_FLY), + LOCTUS("Loctus", BossType.GARDEN_PEST_LOCUST), + MITE("Mite", BossType.GARDEN_PEST_MITE), + MOSQUITO("Mosquito", BossType.GARDEN_PEST_MOSQUITO), + MOTH("Moth", BossType.GARDEN_PEST_MOTH), + RAT("Rat", BossType.GARDEN_PEST_RAT), + SLUG("Slug", BossType.GARDEN_PEST_SLUG), +} |