mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-22 10:55:13 -06:00
Healer Iface for team HP and "medic" horn call to flash red cross in healer iface
This commit is contained in:
parent
6a9cd16f52
commit
efa2310dec
2 changed files with 56 additions and 26 deletions
|
|
@ -376,13 +376,20 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
}
|
||||
}
|
||||
fun broadcastToRole(role: BarbRole, message: String) {
|
||||
team.allPlayers()
|
||||
.filter { team.getRoleForPlayer(it) == role }
|
||||
.forEach { sendMessage(it, message) }
|
||||
team.allPlayers().filter {
|
||||
team.getRoleForPlayer(it) == role
|
||||
}.forEach {
|
||||
sendMessage(it, message)
|
||||
}
|
||||
}
|
||||
fun alertHealers(player:Player){
|
||||
//alert healers UI you asked ro help ( Flashing cross next to name)
|
||||
team.allPlayers().filter {
|
||||
team.getRoleForPlayer(it) == BarbRole.HEALER
|
||||
}.forEach {
|
||||
HealerIfaceMedicHelp(it,player)
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAttackerUI(player: Player, call: AttackerCall) {
|
||||
val style = call.called
|
||||
if (style == null) {
|
||||
|
|
@ -526,3 +533,4 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.lobby.CurrentTeam
|
||||
import content.minigame.barbassault.lobby.CurrentTeam.modelZoom
|
||||
import core.api.sendItemOnInterface
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import core.api.sendItemZoomOnInterface
|
||||
import core.api.setComponentVisibility
|
||||
import core.api.setInterfaceModel
|
||||
import core.api.setInterfaceText
|
||||
import core.game.component.Component
|
||||
|
|
@ -25,27 +24,51 @@ class HealerInterface : ComponentPlugin() {
|
|||
override fun open(player: Player?, component: Component?) {
|
||||
super.open(player, component)
|
||||
player ?: return
|
||||
val uiSlot = CurrentTeam.team[1]
|
||||
// setInterfaceText(player, "nameText", CurrentTeam.ID, uiSlot.name)
|
||||
setInterfaceText(player, "7", HealerIface.ID, 7)
|
||||
// setInterfaceText(player, "slot1name", HealerIface.ID, 3)//slot1name
|
||||
// setInterfaceText(player, "slot2name", HealerIface.ID, 9)//slot2Name
|
||||
// setInterfaceText(player, "slot3name", HealerIface.ID, 14)//slot3Name
|
||||
// setInterfaceText(player, "slot4name", HealerIface.ID, 19)//slot4Name
|
||||
setInterfaceText(player, "11", HealerIface.ID, 11)
|
||||
setInterfaceText(player, "12", HealerIface.ID, 12)
|
||||
// setInterfaceText(player, "6", CurrentTeam.ID, 6)
|
||||
|
||||
setInterfaceModel(player, 20578, HealerIface.ID, 24, modelZoom,572,0)
|
||||
sendItemZoomOnInterface(player, HealerIface.ID, 24, 10559,1940)
|
||||
//player.packetDispatch.sendRepositionOnInterface(HealerIface.ID, 24, 45, 46)
|
||||
setHealerTeamIfaceSlot(player,0)
|
||||
setHealerTeamIfaceSlot(player,1)
|
||||
setHealerTeamIfaceSlot(player,2)
|
||||
setHealerTeamIfaceSlot(player,3)
|
||||
|
||||
}
|
||||
|
||||
override fun handle( player: Player?, component: Component?, opcode: Int, button: Int, slot: Int, itemId: Int): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
fun setHealerTeamIfaceSlot(player: Player,slot: Int){
|
||||
val slotIface = HealerIface.team[slot]
|
||||
val others = player.baSession?.team?.allPlayers()?.filter { it != player }
|
||||
val slotPlayer = others?.get(slot)
|
||||
|
||||
val slotHealth = HealerIface.formatHp(slotPlayer?.skills?.lifepoints ,slotPlayer?.skills?.maximumLifepoints)
|
||||
|
||||
//todo find a way to crop the model.
|
||||
//20578 is the correct model
|
||||
//setInterfaceModel(player, 20578, HealerIface.ID, slotIface.roleChild, HealerIface.modelZoom,572,0) // role Icon
|
||||
setInterfaceText(player, slotPlayer?.username.toString(), HealerIface.ID, slotIface.nameChild) //Name
|
||||
setInterfaceText(player, slotHealth, HealerIface.ID, slotIface.hpChild)// Health
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun HealerIfaceMedicHelp(player: Player, other: Player) {
|
||||
if (player == other) return
|
||||
|
||||
val team = player.baSession?.team ?: return
|
||||
val mySlot = team.slotOf(player)
|
||||
val otherSlot = team.slotOf(other)
|
||||
|
||||
val uiIndex = if (otherSlot > mySlot) otherSlot - 1 else otherSlot
|
||||
if (uiIndex !in HealerIface.team.indices) return
|
||||
|
||||
val slotIface = HealerIface.team[uiIndex]
|
||||
setComponentVisibility(player, HealerIface.ID, slotIface.helpChild, false)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
object HealerIface {
|
||||
const val ID = Components.BARBASSAULT_OVER_HEAL_488
|
||||
|
|
@ -53,10 +76,9 @@ object HealerIface {
|
|||
val ROLE_MODEL_MAP = mapOf(BarbRole.ATTACKER to 20561, BarbRole.COLLECTOR to 20563, BarbRole.DEFENDER to 20566, BarbRole.HEALER to 20569)
|
||||
data class Slot(val roleChild: Int, val nameChild: Int, val hpChild:Int, val helpChild: Int)
|
||||
val team = listOf(
|
||||
Slot(16, 3,4,5),
|
||||
Slot(17, 9,10,8),
|
||||
Slot(18, 14,15,13),
|
||||
Slot(19, 19,20,18),
|
||||
)
|
||||
fun formatHp(current: Int, max: Int) = "HP $current/$max"
|
||||
Slot(16, 3, 4, 5),
|
||||
Slot(17, 9, 10, 8),
|
||||
Slot(18, 14, 15, 13),
|
||||
Slot(19, 19, 20, 18))
|
||||
fun formatHp(current: Int?, max: Int?) = "HP $current/$max"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue