mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-25 20:35:10 -06:00
Quick Start now starts a game
This commit is contained in:
parent
cbf8b85767
commit
6498d1874e
2 changed files with 34 additions and 18 deletions
|
|
@ -46,14 +46,14 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
val eventBus = BarbAssEventBus()
|
||||
val npcCaps = SpawnCaps(4,4,2,2)//wave 1
|
||||
val endReason = "left"
|
||||
private val countDoown = if(GameWorld.settings?.isDevMode == true) 4 else 60
|
||||
|
||||
|
||||
fun beginStartingPhase(quickStart: Boolean = false) {
|
||||
if (state != BarbassaultState.PARTY_CREATION) return
|
||||
state = BarbassaultState.STARTING
|
||||
createArena()
|
||||
if (quickStart){ enterArena(); rollNewRoleCalls(); return }
|
||||
startCountdown()
|
||||
startCountdown(quickStart)
|
||||
}
|
||||
|
||||
private fun enterArena() {
|
||||
|
|
@ -92,11 +92,10 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
player.properties.teleportLocation = Location.create(2593, 5264, 0)
|
||||
}
|
||||
|
||||
private fun startCountdown() {
|
||||
var ticks = secondsToTicks(4)//60
|
||||
|
||||
team.allPlayers().forEach { openOverlay(it, 494);setInterfaceText(it, "60", 494, 0) }
|
||||
GameWorld.Pulser.submit(object : Pulse(1) {
|
||||
private fun startCountdown(quickStart: Boolean) {
|
||||
var ticks = secondsToTicks(countDoown)//60
|
||||
if(!quickStart){ team.allPlayers().forEach { openOverlay(it, 494);setInterfaceText(it, "60", 494, 0) } }
|
||||
GameWorld.Pulser.submit(object : Pulse(1) {
|
||||
override fun pulse(): Boolean {
|
||||
if (state != BarbassaultState.STARTING) return true
|
||||
ticks--
|
||||
|
|
@ -112,10 +111,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
val secondsLeft = ticksToSeconds(ticks)
|
||||
val display = secondsLeft.toString().padStart(2, '0')
|
||||
|
||||
team.allPlayers().forEach {
|
||||
setInterfaceText(it, display, 494, 0)
|
||||
//it.sendMessage("Barbarian Assault starts in $display seconds.")
|
||||
}
|
||||
team.allPlayers().forEach { setInterfaceText(it, display, 494, 0) }
|
||||
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import core.game.activity.ActivityPlugin
|
|||
import core.game.node.entity.Entity
|
||||
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.zone.ZoneRestriction
|
||||
import core.plugin.Initializable
|
||||
|
|
@ -84,7 +86,7 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr
|
|||
}
|
||||
|
||||
private fun createQuickTeam(players: List<WaitingPlayer>) {
|
||||
waitingPlayers.removeAll { wp -> players.any { it.player == wp.player } }
|
||||
players.forEach { removeQuickQue(it.player)}
|
||||
var teamLeader: Player? = null
|
||||
for (wp in players) {
|
||||
if (giveScroll(wp.player)) {
|
||||
|
|
@ -92,7 +94,7 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr
|
|||
break
|
||||
}
|
||||
}
|
||||
//IF BY CHANCE no one had free inventory space KICK THEM ALL FROM QUEUE!
|
||||
//IF BY CHANCE no one had free inventory space KICK THEM ALL FROM QuickLobby!
|
||||
if (teamLeader == null) {
|
||||
players.forEach {
|
||||
sendMessage(it.player, "You could not hold a Scroll and have been removed from queue")
|
||||
|
|
@ -105,14 +107,32 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr
|
|||
val session = teamLeader.baSession
|
||||
val team = session?.team ?: return
|
||||
|
||||
players.forEach {
|
||||
val role = it.role!!
|
||||
team.setRoleForPlayer(it.player, role)
|
||||
//todo find authentic message for Quick Start Team Formed BarbAssault
|
||||
sendMessage(it.player, "A team has been formed! Your role: ${role.name}")
|
||||
players.forEachIndexed { index, wrapper ->
|
||||
wrapper?.let { playerWrapper ->
|
||||
if (index != 0) {
|
||||
playerWrapper.player.baSession = session
|
||||
team.addPlayer(playerWrapper.player)
|
||||
}
|
||||
playerWrapper.role?.let { role ->
|
||||
team.setRoleForPlayer(playerWrapper.player, role)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
session.beginStartingPhase(true)
|
||||
}
|
||||
override fun configure() {
|
||||
GameWorld.Pulser.submit(
|
||||
object : Pulse(25) {
|
||||
override fun pulse(): Boolean {
|
||||
if (waitingPlayers.isNotEmpty()) {
|
||||
tryCreateTeamFromQueue()
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun death(e: Entity?, killer: Entity?): Boolean {
|
||||
val ename = e?.name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue