Barbteam is now created when a player Writes-Role option on scroll.

This commit is contained in:
Tooze 2026-02-22 22:38:46 -05:00
parent 7b02c88338
commit 99a91b1627
2 changed files with 11 additions and 9 deletions

View file

@ -181,6 +181,7 @@ object BarbTeamManager {
it.sendMessage("Your leader has left the room and therefore cleared the team!")
it.removeAttribute("ba-session")
updateCurrentTeam(it)
//todo Do not forget to remove this latter.
if (session.state == BarbassaultState.STARTING) {
it.properties.teleportLocation = Location.create(2593, 5264, 0)
}

View file

@ -188,9 +188,9 @@ class BarbassaultLobby : InteractionListener, MapArea {
when (buttonId) {
2 -> {
if (player.inventory.add(Item(Items.SCROLL_10512, 1))) {
if (createTeam(player)){
// if (createTeam(player)){
player.sendMessage("You take scroll from table")
}
// }
} else {
player.sendMessage("You dont have enough inventory space")
}
@ -252,12 +252,14 @@ class BarbassaultLobby : InteractionListener, MapArea {
fun writeRole(player: Player, buttonId: Int) {
if (buttonId == 6) return
val playerRole = getRoleFromButton(buttonId) ?: return
if (player.baSession?.team != null) {
player.baSession?.team?.setRoleForPlayer(player, playerRole)
BarbTeamManager.updateTeam(player.baSession?.team!!)
sendMessage(player, "You've set your role to ${playerRole.name.lowercase().replaceFirstChar { it.uppercase() }}"
)
}
if (player.baSession == null) {createTeam(player)}
val team = player.baSession?.team ?: return
team.setRoleForPlayer(player, playerRole)
BarbTeamManager.updateTeam(team)
sendMessage(player, "You've set your role to ${playerRole.name.lowercase().replaceFirstChar { it.uppercase() }}")
}
fun handlePlayerOptionDoor(player: Player, roomRoleOptions:(RoomRole) -> Unit){
@ -307,7 +309,6 @@ class BarbassaultLobby : InteractionListener, MapArea {
//player.baSession = null
abandonTeam(player)
closeOverlay(player)
player.inventory.removeAll(Items.SCROLL_10512)
} else {
openOverlay(player, iface)
// player.sendMessage("you enter wave ${BARBWAVEDOOR[node.id]}")