mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-26 21:05:17 -06:00
Healer interface Health update when team member takes damage
This commit is contained in:
parent
efa2310dec
commit
dc1b13363a
5 changed files with 62 additions and 28 deletions
|
|
@ -175,6 +175,8 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
when(state){
|
||||
BarbassaultState.IN_ARENA -> {
|
||||
eventBus.processEvents() // process events such as npc died to scoring
|
||||
|
||||
|
||||
roleCallTicks--
|
||||
waveSpawnTicks--
|
||||
if (roleCallTicks <= 0) {
|
||||
|
|
@ -296,6 +298,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
removeTimer(player, "teleblock")
|
||||
zone.cleanItems(player,barbassItems)//region.remove(player)
|
||||
clearLogoutListener(player, "ba-logout")
|
||||
player.fullRestore()
|
||||
|
||||
destroyArena()
|
||||
}
|
||||
|
|
@ -382,10 +385,13 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
sendMessage(it, message)
|
||||
}
|
||||
}
|
||||
fun updateBarbHealerIfaceHPOfPlayer(player: Player){
|
||||
team.allPlayers().filter { team.getRoleForPlayer(it) == BarbRole.HEALER }.forEach {
|
||||
HealerIfaceHPUpdatePlayer(it,player)
|
||||
}
|
||||
}
|
||||
fun alertHealers(player:Player){
|
||||
team.allPlayers().filter {
|
||||
team.getRoleForPlayer(it) == BarbRole.HEALER
|
||||
}.forEach {
|
||||
team.allPlayers().filter { team.getRoleForPlayer(it) == BarbRole.HEALER }.forEach {
|
||||
HealerIfaceMedicHelp(it,player)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.lobby.BarbTeam
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import core.api.sendItemZoomOnInterface
|
||||
import core.api.setComponentVisibility
|
||||
|
|
@ -36,24 +37,27 @@ class HealerInterface : ComponentPlugin() {
|
|||
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) {
|
||||
fun setHealerTeamIfaceSlot(player: Player,slot: Int){
|
||||
val slotIface = HealerIface.team[slot]
|
||||
val slotPlayer = getPlayerHealerIfaceSlot(player,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 getPlayerHealerIfaceSlot(player:Player,slot: Int): Player? {
|
||||
val team = player.baSession?.team
|
||||
val others = team?.allPlayers()?.filter { it != player }
|
||||
return others?.get(slot)
|
||||
}
|
||||
|
||||
fun HealerIfaceMedicHelp(player: Player, other: Player, toggle: Boolean = false) {
|
||||
if (player == other) return
|
||||
|
||||
val team = player.baSession?.team ?: return
|
||||
|
|
@ -64,15 +68,25 @@ fun HealerIfaceMedicHelp(player: Player, other: Player) {
|
|||
if (uiIndex !in HealerIface.team.indices) return
|
||||
|
||||
val slotIface = HealerIface.team[uiIndex]
|
||||
setComponentVisibility(player, HealerIface.ID, slotIface.helpChild, false)
|
||||
setComponentVisibility(player, HealerIface.ID, slotIface.helpChild, toggle)
|
||||
}
|
||||
fun HealerIfaceHPUpdatePlayer(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
|
||||
setHealerTeamIfaceSlot(player,uiIndex)
|
||||
|
||||
}
|
||||
|
||||
object HealerIface {
|
||||
const val ID = Components.BARBASSAULT_OVER_HEAL_488
|
||||
val modelZoom = 2372//1940
|
||||
//these are not the correct models for this Iface, but we could use them
|
||||
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(
|
||||
|
|
|
|||
|
|
@ -67,17 +67,15 @@ class BarbTeam(val session: BarbassaultSession, leader: Player) {
|
|||
fun slotOf(player: Player): Int =
|
||||
slots.indexOfFirst { it?.player == player }
|
||||
|
||||
fun getSlot(index: Int): PartySlot? =
|
||||
slots.getOrNull(index)
|
||||
fun getSlot(index: Int): PartySlot? = slots.getOrNull(index)
|
||||
|
||||
fun allPlayers(): List<Player> =
|
||||
slots.filterNotNull().map { it.player }
|
||||
fun allPlayers(): List<Player> = slots.filterNotNull().map { it.player }
|
||||
|
||||
fun isLeader(player: Player): Boolean =
|
||||
slotOf(player) == LEADER_SLOT
|
||||
fun isLeader(player: Player): Boolean = slotOf(player) == LEADER_SLOT
|
||||
|
||||
fun isFull(): Boolean =
|
||||
slots.all { it != null }
|
||||
fun isHealer(player: Player): Boolean = getRoleForPlayer(player) == BarbRole.HEALER
|
||||
|
||||
fun isFull(): Boolean = slots.all { it != null }
|
||||
|
||||
fun addRecruit(player: Player): Boolean {
|
||||
recruit = PendingRecruit(player)
|
||||
|
|
@ -118,6 +116,10 @@ class BarbTeam(val session: BarbassaultSession, leader: Player) {
|
|||
return true
|
||||
}
|
||||
|
||||
fun getAllRole(barbRole: BarbRole): List<Player> {
|
||||
return slots.filterNotNull().map { it.player }.filter { getRoleForPlayer(it) == barbRole }
|
||||
}
|
||||
|
||||
fun getRoleForPlayer(player: Player): BarbRole? {
|
||||
val idx = slotOf(player)
|
||||
return slots.getOrNull(idx)?.role
|
||||
|
|
@ -156,6 +158,7 @@ class BarbTeam(val session: BarbassaultSession, leader: Player) {
|
|||
val (x, y) = PartySpawns[idx]
|
||||
return session.base.transform(x, y, 0)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data class RoleCounts(val att: Int, val def: Int, val coll: Int, val heal: Int )
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ class BarbassaultLobby : InteractionListener, MapArea {
|
|||
on(Scenery.DOOR_20209, IntType.SCENERY, "Pass") { player, node ->
|
||||
//todo find authentic message no capes
|
||||
// if (capeCheck(player)) { sendMessage(player,"Your not allowed to wear capes."); return@on true }
|
||||
//todo Not allowed to enter QuickStart with Scroll
|
||||
if (!QUICK_START.insideBorder(player.location)){
|
||||
player.setAttribute("/save:barbass:wave", 1)
|
||||
handlePlayerOptionDoor(player) { role ->
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package core.game.node.entity.combat;
|
||||
|
||||
import content.data.EnchantedJewellery;
|
||||
import content.minigame.barbassault.arena.BarbassaultSession;
|
||||
import content.minigame.barbassault.arena.BarbassaultState;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.summoning.familiar.Familiar;
|
||||
|
|
@ -203,6 +205,14 @@ public final class ImpactHandler {
|
|||
if (p.getAttribute("godMode", false)) {
|
||||
p.getSkills().heal(10000);
|
||||
}
|
||||
if (hit > 0) {
|
||||
BarbassaultSession session = p.getAttribute("ba-session");
|
||||
if (session != null) {
|
||||
if (session.getState() == BarbassaultState.IN_ARENA) {
|
||||
session.updateBarbHealerIfaceHPOfPlayer(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Impact impact = new Impact(source, hit, style, type);
|
||||
impactQueue.add(impact);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue