mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-22 19:05:11 -06:00
Moved HornHelper in to HornListeners
This commit is contained in:
parent
ddf426d4ee
commit
f28e607142
2 changed files with 51 additions and 59 deletions
|
|
@ -1,59 +0,0 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import core.api.*
|
||||
import core.game.node.entity.player.Player
|
||||
import org.rs09.consts.Items
|
||||
|
||||
object HornHelper {
|
||||
fun getAttackerHorn(player: Player): AttackerHorn? {
|
||||
return AttackerHorn.values().firstOrNull { inInventory(player, it.itemId) }
|
||||
}
|
||||
|
||||
fun getHealerHorn(player: Player): HealerHorn? {
|
||||
return HealerHorn.values().firstOrNull { inInventory(player, it.itemId) }
|
||||
}
|
||||
|
||||
fun getCollectorBag(player: Player): CollectionBag? {
|
||||
return CollectionBag.values().firstOrNull { inInventory(player, it.itemId) }
|
||||
}
|
||||
}
|
||||
enum class AttackerHorn(val itemId: Int) {
|
||||
LEVEL_ONE(Items.ATTACKER_HORN_10516),
|
||||
LEVEL_TWO(Items.ATTACKER_HORN_10517),
|
||||
LEVEL_THREE(Items.ATTACKER_HORN_10518),
|
||||
LEVEL_FOUR(Items.ATTACKER_HORN_10519),
|
||||
LEVEL_FIVE(Items.ATTACKER_HORN_10520);
|
||||
|
||||
companion object {
|
||||
private val map = values().associateBy(AttackerHorn::itemId)
|
||||
|
||||
fun fromId(id: Int): AttackerHorn? = map[id]
|
||||
}
|
||||
}
|
||||
enum class HealerHorn(val itemId: Int) {
|
||||
LEVEL_ONE(Items.HEALER_HORN_10526),
|
||||
LEVEL_TWO(Items.HEALER_HORN_10527),
|
||||
LEVEL_THREE(Items.HEALER_HORN_10528),
|
||||
LEVEL_FOUR(Items.HEALER_HORN_10529),
|
||||
LEVEL_FIVE(Items.HEALER_HORN_10530);
|
||||
|
||||
companion object {
|
||||
private val map = values().associateBy(HealerHorn::itemId)
|
||||
|
||||
fun fromId(id: Int): HealerHorn? = map[id]
|
||||
}
|
||||
}
|
||||
enum class CollectionBag(val itemId: Int) {
|
||||
LEVEL_ONE(Items.COLLECTION_BAG_10521),
|
||||
LEVEL_TWO(Items.COLLECTION_BAG_10522),
|
||||
LEVEL_THREE(Items.COLLECTION_BAG_10523),
|
||||
LEVEL_FOUR(Items.COLLECTION_BAG_10524),
|
||||
LEVEL_FIVE(Items.COLLECTION_BAG_10525);
|
||||
|
||||
companion object {
|
||||
private val map = values().associateBy(CollectionBag::itemId)
|
||||
|
||||
fun fromId(id: Int): CollectionBag? = map[id]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import core.api.inInventory
|
||||
import core.api.sendChat
|
||||
import core.api.sendMessage
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.node.entity.player.Player
|
||||
import org.rs09.consts.Items
|
||||
|
||||
class HornListeners : InteractionListener {
|
||||
|
|
@ -106,4 +108,53 @@ class HornListeners : InteractionListener {
|
|||
return@on true
|
||||
}
|
||||
}
|
||||
object HornHelper {
|
||||
fun getAttackerHorn(player: Player): AttackerHorn? {
|
||||
return AttackerHorn.values().firstOrNull { inInventory(player, it.itemId) }
|
||||
}
|
||||
|
||||
fun getHealerHorn(player: Player): HealerHorn? {
|
||||
return HealerHorn.values().firstOrNull { inInventory(player, it.itemId) }
|
||||
}
|
||||
|
||||
fun getCollectorBag(player: Player): CollectionBag? {
|
||||
return CollectionBag.values().firstOrNull { inInventory(player, it.itemId) }
|
||||
}
|
||||
}
|
||||
enum class AttackerHorn(val itemId: Int) {
|
||||
LEVEL_ONE(Items.ATTACKER_HORN_10516),
|
||||
LEVEL_TWO(Items.ATTACKER_HORN_10517),
|
||||
LEVEL_THREE(Items.ATTACKER_HORN_10518),
|
||||
LEVEL_FOUR(Items.ATTACKER_HORN_10519),
|
||||
LEVEL_FIVE(Items.ATTACKER_HORN_10520);
|
||||
|
||||
companion object {
|
||||
private val map = values().associateBy(AttackerHorn::itemId)
|
||||
fun fromId(id: Int): AttackerHorn? = map[id]
|
||||
}
|
||||
}
|
||||
enum class HealerHorn(val itemId: Int) {
|
||||
LEVEL_ONE(Items.HEALER_HORN_10526),
|
||||
LEVEL_TWO(Items.HEALER_HORN_10527),
|
||||
LEVEL_THREE(Items.HEALER_HORN_10528),
|
||||
LEVEL_FOUR(Items.HEALER_HORN_10529),
|
||||
LEVEL_FIVE(Items.HEALER_HORN_10530);
|
||||
|
||||
companion object {
|
||||
private val map = values().associateBy(HealerHorn::itemId)
|
||||
fun fromId(id: Int): HealerHorn? = map[id]
|
||||
}
|
||||
}
|
||||
enum class CollectionBag(val itemId: Int) {
|
||||
LEVEL_ONE(Items.COLLECTION_BAG_10521),
|
||||
LEVEL_TWO(Items.COLLECTION_BAG_10522),
|
||||
LEVEL_THREE(Items.COLLECTION_BAG_10523),
|
||||
LEVEL_FOUR(Items.COLLECTION_BAG_10524),
|
||||
LEVEL_FIVE(Items.COLLECTION_BAG_10525);
|
||||
|
||||
companion object {
|
||||
private val map = values().associateBy(CollectionBag::itemId)
|
||||
fun fromId(id: Int): CollectionBag? = map[id]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue