mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-23 03:15:10 -06:00
Horn of glory!
This commit is contained in:
parent
5d21ec1660
commit
cac879eb4f
5 changed files with 117 additions and 87 deletions
|
|
@ -64,10 +64,10 @@ class BaHornSystem : InteractionListener {
|
|||
if (optionClicked == "drop") { sendMessage(player, "I need that!"); return@on false }
|
||||
|
||||
val styleCallMap = mapOf(
|
||||
"tell-style1" to (BarbassaultSession.AttackerStyle.Style_1 to BaCall.ATTACKER_STYLE_1),
|
||||
"tell-style2" to (BarbassaultSession.AttackerStyle.Style_2 to BaCall.ATTACKER_STYLE_2),
|
||||
"tell-style3" to (BarbassaultSession.AttackerStyle.Style_3 to BaCall.ATTACKER_STYLE_3),
|
||||
"tell-style4" to (BarbassaultSession.AttackerStyle.Style_4 to BaCall.ATTACKER_STYLE_4),
|
||||
"tell-style1" to (BarbassaultSession.AttackerStyle.STYLE_1 to BaCall.ATTACKER_STYLE_1),
|
||||
"tell-style2" to (BarbassaultSession.AttackerStyle.STYLE_2 to BaCall.ATTACKER_STYLE_2),
|
||||
"tell-style3" to (BarbassaultSession.AttackerStyle.STYLE_3 to BaCall.ATTACKER_STYLE_3),
|
||||
"tell-style4" to (BarbassaultSession.AttackerStyle.STYLE_4 to BaCall.ATTACKER_STYLE_4),
|
||||
"medic" to (null to BaCall.MEDIC) )
|
||||
|
||||
val pair = styleCallMap[optionClicked] ?: return@on false
|
||||
|
|
|
|||
|
|
@ -1,14 +1,10 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.BarbassaultTut
|
||||
import content.minigame.barbassault.BarbassaultTut.Companion.TutorialItemSpawn
|
||||
import content.minigame.barbassault.arena.BaHornSystem.HornHelper.getHealerHorn
|
||||
import content.minigame.barbassault.arena.scenery.DefenderTrap
|
||||
import content.minigame.barbassault.getBarbLevels
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import core.api.*
|
||||
import core.game.global.action.DropListener
|
||||
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
|
|
@ -19,7 +15,6 @@ import core.game.node.entity.player.Player
|
|||
import core.game.node.entity.player.info.LogType
|
||||
import core.game.node.entity.player.info.PlayerMonitor
|
||||
import core.game.node.entity.player.info.login.PlayerParser
|
||||
import core.game.node.item.GroundItem
|
||||
import core.game.node.item.GroundItemManager
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
|
|
@ -28,10 +23,7 @@ import core.game.world.map.Direction
|
|||
import core.game.world.map.Location
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.worldevents.holiday.easter.EasterEvent.Companion.EGG_SPAWN_TIME
|
||||
import core.game.worldevents.holiday.easter.EasterEvent.Companion.eggs
|
||||
import core.tools.Log
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Scenery
|
||||
|
||||
|
|
@ -63,14 +55,14 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
arenaItems(Items.LOGS_11760,30,46,0),
|
||||
arenaItems(Items.LOGS_11760,29,47,0)
|
||||
)
|
||||
enum class pennanceNPC { runner, healer, fighter, ranger }
|
||||
enum class pennanceNPC { RUNNER, HEALER, FIGHTER, RANGER }
|
||||
data class npcSpawnLoc(val tunnel:pennanceNPC, val x: Int,val y: Int,val z: Int,val direction: Direction)
|
||||
val npcSpawns: List<npcSpawnLoc> = listOf(
|
||||
npcSpawnLoc(pennanceNPC.runner,42,45,0,Direction.SOUTH),
|
||||
npcSpawnLoc(pennanceNPC.healer,36,46,0,Direction.SOUTH),
|
||||
npcSpawnLoc(pennanceNPC.RUNNER,42,45,0,Direction.SOUTH),
|
||||
npcSpawnLoc(pennanceNPC.HEALER,36,46,0,Direction.SOUTH),
|
||||
|
||||
npcSpawnLoc(pennanceNPC.fighter,24,46,0,Direction.SOUTH),
|
||||
npcSpawnLoc(pennanceNPC.ranger,36,46,0,Direction.SOUTH),
|
||||
npcSpawnLoc(pennanceNPC.FIGHTER,24,46,0,Direction.SOUTH),
|
||||
npcSpawnLoc(pennanceNPC.RANGER,36,46,0,Direction.SOUTH),
|
||||
)
|
||||
|
||||
override fun defineAreaBorders(): Array<ZoneBorders> {
|
||||
|
|
|
|||
|
|
@ -2,33 +2,24 @@ package content.minigame.barbassault.arena
|
|||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.BarbassaultActivity
|
||||
import content.minigame.barbassault.BarbassaultTut
|
||||
import content.minigame.barbassault.arena.scenery.GloryHorn
|
||||
import content.minigame.barbassault.lobby.BarbTeam
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager
|
||||
import content.minigame.barbassault.lobby.SelectRole
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import core.api.*
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.build.DynamicRegion
|
||||
import core.game.world.map.zone.MapZone
|
||||
import core.game.world.map.zone.Zone
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneRestriction
|
||||
import core.tools.Log
|
||||
import core.tools.secondsToTicks
|
||||
import core.tools.ticksToSeconds
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.NPCs
|
||||
import org.rs09.consts.Music
|
||||
import org.rs09.consts.Music.ASSAULT_AND_BATTERY_604
|
||||
import org.rs09.consts.Music.PIRATES_OF_PENANCE_211
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
/*
|
||||
Player
|
||||
|
|
@ -248,26 +239,27 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
|
|||
val role = team.getRoleForPlayer(player) ?: return@forEach
|
||||
val call = roleCalls[role] ?: return@forEach
|
||||
|
||||
|
||||
when (role) {
|
||||
BarbRole.ATTACKER -> {
|
||||
//make sure wave is using wring childid.
|
||||
setInterfaceText(player, "Wave $wave" , Components.BARBASSAULT_OVER_ATT_485, 1)
|
||||
updateAttackerUI(player, call as AttackerCall)
|
||||
setInterfaceText(player, "Wave $wave" , Components.BARBASSAULT_OVER_ATT_485, 2)
|
||||
setInterfaceText(player, call.crossRoleDisplay(), Components.BARBASSAULT_OVER_ATT_485, 7)
|
||||
}
|
||||
BarbRole.COLLECTOR -> {
|
||||
setInterfaceText(player, "Wave $wave" , Components.BARBASSAULT_OVER_ATT_485, 1)
|
||||
updateOtherRoleUI(player, call, Components.BARBASSAULT_OVER_COL_486, 4)
|
||||
setInterfaceText(player, "Wave $wave" , Components.BARBASSAULT_OVER_COL_486, 2)
|
||||
setInterfaceText(player, call.crossRoleDisplay(), Components.BARBASSAULT_OVER_COL_486, 6)
|
||||
}
|
||||
BarbRole.DEFENDER -> {
|
||||
setInterfaceText(player, "Wave $wave" , Components.BARBASSAULT_OVER_ATT_485, 1)
|
||||
updateOtherRoleUI(player, call, Components.BARBASSAULT_OVER_DEF_487, 3)
|
||||
setInterfaceText(player, "Wave $wave" , Components.BARBASSAULT_OVER_DEF_487, 1)
|
||||
setInterfaceText(player, call.crossRoleDisplay(), Components.BARBASSAULT_OVER_DEF_487, 5)
|
||||
}
|
||||
BarbRole.HEALER -> {
|
||||
setInterfaceText(player, "Wave $wave" , Components.BARBASSAULT_OVER_ATT_485, 1)
|
||||
updateOtherRoleUI(player, call, Components.BARBASSAULT_OVER_HEAL_488, 31)
|
||||
setInterfaceText(player, "Wave $wave" , Components.BARBASSAULT_OVER_HEAL_488, 29)
|
||||
setInterfaceText(player, call.crossRoleDisplay(), Components.BARBASSAULT_OVER_HEAL_488, 33)
|
||||
}
|
||||
}
|
||||
|
|
@ -294,7 +286,23 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
|
|||
roleCalls[BarbRole.HEALER]?.toCall = roleCalls[BarbRole.DEFENDER]?.required
|
||||
roleCalls[BarbRole.DEFENDER]?.toCall = roleCalls[BarbRole.HEALER]?.required
|
||||
updateRoleUI()
|
||||
updateGloryHornUI()
|
||||
}
|
||||
|
||||
fun updateGloryHornUI(){
|
||||
team.allPlayers().forEach { player ->
|
||||
val atkCallText = (roleCalls[BarbRole.COLLECTOR]?.toCall as? AttackerStyle)?.let { "${it.top} ${it.bottom}" } ?: GloryHorn.CallOut.defaultText
|
||||
val colCallText = (roleCalls[BarbRole.ATTACKER]?.toCall as? HasUIText)?.ui ?: GloryHorn.CallOut.defaultText
|
||||
val defCallText = (roleCalls[BarbRole.HEALER]?.toCall as? HasUIText)?.ui ?: GloryHorn.CallOut.defaultText
|
||||
val healCallText = (roleCalls[BarbRole.DEFENDER]?.toCall as? HasUIText)?.ui ?: GloryHorn.CallOut.defaultText
|
||||
|
||||
setInterfaceText(player, atkCallText, Components.BARBASSAULT_HORN_484, GloryHorn.CallOut.attacker)
|
||||
setInterfaceText(player, colCallText, Components.BARBASSAULT_HORN_484, GloryHorn.CallOut.collector)
|
||||
setInterfaceText(player, defCallText, Components.BARBASSAULT_HORN_484, GloryHorn.CallOut.defender)
|
||||
setInterfaceText(player, healCallText, Components.BARBASSAULT_HORN_484, GloryHorn.CallOut.healer)
|
||||
}
|
||||
}
|
||||
|
||||
private val hornTargets = mapOf(
|
||||
BarbRole.COLLECTOR to BarbRole.ATTACKER,
|
||||
BarbRole.ATTACKER to BarbRole.COLLECTOR ,
|
||||
|
|
@ -322,10 +330,10 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
|
|||
val roleCalls: MutableMap<BarbRole, RoleCall<*>> = mutableMapOf()
|
||||
interface HasUIText { val ui: String }
|
||||
enum class AttackerStyle(val top: String, val bottom: String) : HasUIText {
|
||||
Style_1("Controlled/","Bronze/Wind"),
|
||||
Style_2("Accurate/","Iron/Water"),
|
||||
Style_3("Aggressive/","Steel/Earth"),
|
||||
Style_4("Defensive/","Mithril/Fire");
|
||||
STYLE_1("Controlled/","Bronze/Wind"),
|
||||
STYLE_2("Accurate/","Iron/Water"),
|
||||
STYLE_3("Aggressive/","Steel/Earth"),
|
||||
STYLE_4("Defensive/","Mithril/Fire");
|
||||
override val ui: String get() = top
|
||||
}
|
||||
enum class EggColor(override val ui: String): HasUIText { RED("Red Eggs"), GREEN("Green Eggs"),BLUE("Blue Eggs") }
|
||||
|
|
|
|||
|
|
@ -1,82 +1,112 @@
|
|||
package content.minigame.barbassault.arena.scenery
|
||||
|
||||
import core.api.sendMessage
|
||||
import content.minigame.barbassault.arena.BaHornSystem.BaCall
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import core.api.*
|
||||
import core.game.component.Component
|
||||
import core.game.component.ComponentDefinition
|
||||
import core.game.component.ComponentPlugin
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Scenery
|
||||
|
||||
@Initializable
|
||||
class HornOfGlory : ComponentPlugin() , InteractionListener {
|
||||
companion object {
|
||||
val QUEEN_ARRIVE = "The Queen has arrived and you can no longer use the horn of glory!"
|
||||
//attacker
|
||||
val CONTROLED_BRONZE_WIND = 0
|
||||
val ACCURATE_IRON_WATER = 1
|
||||
val AGGRISSIVE_STEEL_EARTH = 2
|
||||
val DEFENSIVE_MITHRIL_FIRE = 3
|
||||
//defender
|
||||
val FOOD_TOFU = 0
|
||||
val FOOD_CRACKERS = 1
|
||||
val FOOD_WORMS = 2
|
||||
//collector
|
||||
val RED_EGG = 0
|
||||
val GREEN_EGG = 1
|
||||
val BLUE_EGG = 2
|
||||
//healer
|
||||
val POISON_TOFU = 0
|
||||
val POISON_WORMS = 1
|
||||
val POISON_MEAT = 2
|
||||
var hornCallLock = false
|
||||
val CallMap = mapOf(
|
||||
GloryHorn.CONTROLED_BRONZE_WIND to (BarbassaultSession.AttackerStyle.STYLE_1 to BaCall.ATTACKER_STYLE_1),
|
||||
GloryHorn.ACCURATE_IRON_WATER to (BarbassaultSession.AttackerStyle.STYLE_2 to BaCall.ATTACKER_STYLE_2),
|
||||
GloryHorn.AGGRISSIVE_STEEL_EARTH to (BarbassaultSession.AttackerStyle.STYLE_3 to BaCall.ATTACKER_STYLE_3),
|
||||
GloryHorn.DEFENSIVE_MITHRIL_FIRE to (BarbassaultSession.AttackerStyle.STYLE_4 to BaCall.ATTACKER_STYLE_4),
|
||||
|
||||
val CALL_BUTTON = mapOf(
|
||||
16 to CONTROLED_BRONZE_WIND,
|
||||
17 to ACCURATE_IRON_WATER,
|
||||
18 to AGGRISSIVE_STEEL_EARTH,
|
||||
19 to DEFENSIVE_MITHRIL_FIRE,
|
||||
GloryHorn.POISON_TOFU to (BarbassaultSession.PoisonFood.TOFU to BaCall.HEALER_TOFU),
|
||||
GloryHorn.POISON_WORMS to (BarbassaultSession.PoisonFood.WORMS to BaCall.HEALER_WORMS),
|
||||
GloryHorn.POISON_MEAT to (BarbassaultSession.PoisonFood.MEAT to BaCall.HEALER_MEAT),
|
||||
|
||||
20 to FOOD_TOFU,
|
||||
22 to FOOD_CRACKERS,
|
||||
21 to FOOD_WORMS,
|
||||
|
||||
13 to RED_EGG,
|
||||
14 to GREEN_EGG,
|
||||
15 to BLUE_EGG,
|
||||
|
||||
23 to POISON_TOFU,
|
||||
24 to POISON_WORMS,
|
||||
25 to POISON_MEAT
|
||||
|
||||
)
|
||||
}
|
||||
GloryHorn.RED_EGG to (BarbassaultSession.EggColor.RED to BaCall.COLLECTOR_RED),
|
||||
GloryHorn.GREEN_EGG to (BarbassaultSession.EggColor.GREEN to BaCall.COLLECTOR_GREEN),
|
||||
GloryHorn.BLUE_EGG to (BarbassaultSession.EggColor.BLUE to BaCall.COLLECTOR_BLUE),
|
||||
|
||||
GloryHorn.FOOD_TOFU to (BarbassaultSession.LureFood.TOFU to BaCall.DEFENDER_TOFU),
|
||||
GloryHorn.FOOD_CRACKERS to (BarbassaultSession.LureFood.CRACKERS to BaCall.DEFENDER_CRACKERS),
|
||||
GloryHorn.FOOD_WORMS to (BarbassaultSession.LureFood.WORMS to BaCall.DEFENDER_WORMS),
|
||||
)
|
||||
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
ComponentDefinition.forId(Components.BARBASSAULT_HORN_484).plugin = this
|
||||
ComponentDefinition.forId(484).plugin = this
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(
|
||||
player: Player?,
|
||||
component: Component?,
|
||||
opcode: Int,
|
||||
button: Int,
|
||||
slot: Int,
|
||||
itemId: Int
|
||||
): Boolean {
|
||||
sendMessage(player!!,"Button " +button )
|
||||
override fun handle(player: Player?,component: Component?, opcode: Int, button: Int, slot: Int, itemId: Int ): Boolean {
|
||||
player ?: return true
|
||||
val pair = CallMap[button] ?: return true
|
||||
val role = pair.first
|
||||
val call = pair.second
|
||||
if(!hornCallLock) {
|
||||
player.baSession?.onHornCall(player, role)
|
||||
sendChat(player, call.text)
|
||||
player.animate(Animation(5436))
|
||||
player.lock(6)
|
||||
hornCallLock = true
|
||||
GameWorld.Pulser.submit(object : Pulse(6, player) {
|
||||
override fun pulse(): Boolean {
|
||||
player.unlock()
|
||||
hornCallLock = false
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun open(player: Player?, component: Component?) {
|
||||
super.open(player, component)
|
||||
player ?: return
|
||||
}
|
||||
override fun defineListeners() {
|
||||
on(Scenery.HORN_OF_GLORY_20247, IntType.SCENERY, "Call") { player, _ ->
|
||||
//emote 5438
|
||||
player.interfaceManager.open(Component(484))
|
||||
player.interfaceManager.open(Component(GloryHorn.ID))
|
||||
return@on true
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object GloryHorn {
|
||||
val ID = 484
|
||||
//collector
|
||||
val RED_EGG = 13
|
||||
val GREEN_EGG = 14
|
||||
val BLUE_EGG = 15
|
||||
//attacker
|
||||
val CONTROLED_BRONZE_WIND = 16
|
||||
val ACCURATE_IRON_WATER = 17
|
||||
val AGGRISSIVE_STEEL_EARTH = 18
|
||||
val DEFENSIVE_MITHRIL_FIRE = 19
|
||||
//defender
|
||||
val FOOD_TOFU = 20
|
||||
val FOOD_WORMS = 21
|
||||
val FOOD_CRACKERS = 22
|
||||
//healer
|
||||
val POISON_TOFU = 23
|
||||
val POISON_WORMS = 24
|
||||
val POISON_MEAT = 25
|
||||
object CallOut {
|
||||
val defaultText = "---------------------"
|
||||
const val attacker = 5
|
||||
const val defender = 6
|
||||
const val collector = 7
|
||||
const val healer = 8
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ class ItemMachine: InteractionListener {
|
|||
if (!hasCape(player, capeId)) return
|
||||
player.animate(Animation(5419))
|
||||
player.lock(5)
|
||||
|
||||
// theres two emotes for the machine and lock duration
|
||||
GameWorld.Pulser.submit(object : Pulse(3, player) {
|
||||
override fun pulse(): Boolean {
|
||||
addArrayOfItems(player,items,amount)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue