mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-28 05:45:10 -06:00
Player.getBarbWave()
This commit is contained in:
parent
6105a32d0f
commit
04bb8d51ab
6 changed files with 21 additions and 8 deletions
|
|
@ -96,10 +96,9 @@ class BarbassBlackBoard {
|
|||
}
|
||||
|
||||
fun updateBlackBoard(player: Player) {
|
||||
val wave = player.getAttribute("barbass:wave", 1)
|
||||
player.interfaceManager.open(Component(Components.BARBASSAULT_PLAYERSTAT_490))
|
||||
setInterfaceText(player, player.username, Components.BARBASSAULT_PLAYERSTAT_490, PLAYER_NAME)
|
||||
setInterfaceText(player, wave.toString(), Components.BARBASSAULT_PLAYERSTAT_490, CURRENT_WAVE)
|
||||
setInterfaceText(player, player.getBarbWave().toString(), Components.BARBASSAULT_PLAYERSTAT_490, CURRENT_WAVE)
|
||||
|
||||
val playerLevel = player.getBarbLevels()
|
||||
val playerPoints = player.getBarbPoints()
|
||||
|
|
|
|||
|
|
@ -182,4 +182,16 @@ fun Player.increaseBarbRoleLevel(role: BarbRole) {
|
|||
BarbRole.HEALER -> current.copy(heal = current.heal + 1)
|
||||
}.clamped()
|
||||
setBarbLevels(newLevels)
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the player's current Barbarian Assault wave.
|
||||
*
|
||||
* This value is stored under the `"barbass:wave"` attribute and
|
||||
* represents the wave the player is currently on in a session.
|
||||
*
|
||||
* @return The current wave number. Defaults to `1` if no value is set.
|
||||
*/
|
||||
fun Player.getBarbWave(): Int? {
|
||||
return this.getAttribute("barbass:wave", 1)
|
||||
}
|
||||
|
|
@ -77,7 +77,7 @@ class CommanderConnad(player: Player? = null) : DialoguePlugin(player) {
|
|||
77 -> npcl(FacialExpression.ASKING,"I can change it down to wave 1, Are you sure you want that?").also { stage++ }
|
||||
78 -> showTopics(
|
||||
Topic(FacialExpression.FRIENDLY, "Yes, reset my wave to one.",79),
|
||||
Topic(FacialExpression.FRIENDLY, "No, I want to stay on wave ${player!!.getAttribute<Int>("barbass:wave")}.",10)
|
||||
Topic(FacialExpression.FRIENDLY, "No, I want to stay on wave ${player?.getBarbWave()}.",10)
|
||||
)
|
||||
79 -> {
|
||||
npcl(FacialExpression.ASKING,"Very well.").also { stage = END_DIALOGUE }
|
||||
|
|
@ -98,8 +98,7 @@ class CommanderConnad(player: Player? = null) : DialoguePlugin(player) {
|
|||
return 50
|
||||
}
|
||||
private fun areWaveOne(player: Player?): Int {
|
||||
val currentWave = player!!.getAttribute<Int>("barbass:wave")
|
||||
if (currentWave != 1) return 77
|
||||
if (player?.getBarbWave() != 1) return 77
|
||||
return 75
|
||||
}
|
||||
override fun getIds(): IntArray {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import content.minigame.barbassault.arena.scenery.EggCannon
|
|||
import content.minigame.barbassault.arena.scenery.GloryHorn
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.getBarbLevels
|
||||
import content.minigame.barbassault.getBarbWave
|
||||
import content.minigame.barbassault.lobby.*
|
||||
import core.api.*
|
||||
import core.game.node.entity.Entity
|
||||
|
|
@ -283,7 +284,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
log(this::class.java, Log.FINE, "ENTERED Barbassault Arena")
|
||||
|
||||
val player = entity as? Player ?: return
|
||||
val waveNum = player.getAttribute("barbass:wave", 1)
|
||||
val waveNum = player.getBarbWave()
|
||||
val wornIconId = getItemFromEquipment(player, EquipmentSlot.CAPE)?.id
|
||||
val interfaceId = getIconInterfaceId(wornIconId ?: -1)
|
||||
player.fullRestore()
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package content.minigame.barbassault.lobby
|
||||
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.getBarbWave
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.abandonTeam
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.joinTeam
|
||||
import core.api.closeInterface
|
||||
|
|
@ -47,7 +48,7 @@ class AcceptRoleInterface : ComponentPlugin() {
|
|||
|
||||
if (slotPlayer != null) {
|
||||
val formattedRole = slotPlayer.baSession?.team?.getRoleForPlayer(slotPlayer)?.toString()?.lowercase()?.replaceFirstChar { it.uppercase() }?: AcceptRole.defaultText
|
||||
val wave = slotPlayer.getAttribute("barbass:wave", 1) ?: 0
|
||||
val wave = slotPlayer.getBarbWave()
|
||||
setInterfaceText(player, slotPlayer.name.capitalizeWords(), AcceptRole.ID, uiSlot.name )
|
||||
setInterfaceText(player, formattedRole, AcceptRole.ID, uiSlot.role )
|
||||
setInterfaceText(player, wave.toString(), AcceptRole.ID, uiSlot.wave )
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import content.minigame.barbassault.arena.BarbassaultSession
|
|||
import content.minigame.barbassault.arena.BarbassaultState
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.getBarbLevels
|
||||
import content.minigame.barbassault.getBarbWave
|
||||
import core.api.sendMessage
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.world.map.Location
|
||||
|
|
@ -34,7 +35,7 @@ class BarbTeam(val session: BarbassaultSession, leader: Player) {
|
|||
|
||||
init {
|
||||
slots[LEADER_SLOT] = PartySlot(LEADER_SLOT, leader)
|
||||
wave = leader.getAttribute("barbass:wave", 1)
|
||||
wave = leader.getBarbWave()!!
|
||||
}
|
||||
|
||||
fun slotOf(player: Player): Int =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue