diff options
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), +} |