diff --git a/Server/src/main/content/minigame/barbassault/bots/BACombatState.kt b/Server/src/main/content/minigame/barbassault/bots/BACombatState.kt index 39d74e312..1947f3337 100644 --- a/Server/src/main/content/minigame/barbassault/bots/BACombatState.kt +++ b/Server/src/main/content/minigame/barbassault/bots/BACombatState.kt @@ -1,5 +1,7 @@ package content.minigame.barbassault.bots +import content.minigame.barbassault.BarbRole +import content.minigame.barbassault.lobby.baSession import core.game.interaction.MovementPulse import core.game.node.Node import core.game.node.entity.npc.NPC @@ -17,6 +19,7 @@ import java.util.* class BACombatState(val bot: BarbassBot) { private val Random = Random() + private val krng = kotlin.random.Random.Default val randomtype = Random().nextInt(100) @@ -24,6 +27,32 @@ class BACombatState(val bot: BarbassBot) { bot.customState = "Fight NPCs" bot.AttackNpcsInRadius(25) } + fun handleDefender() { + bot.customState = "Lure Runners" + //bot.AttackNpcsInRadius(25) + } + fun handleCollector() { + bot.customState = "Collecting Eggs" + //bot.AttackNpcsInRadius(25) + } + fun handleHealer() { + bot.customState = "Healer Idling" + //bot.AttackNpcsInRadius(25) + } + + fun chatter() { + bot.sendChat("LETS GOO!") + if (krng.nextInt(200) != 0) return + val role = bot.baSession?.team?.getRoleForPlayer(bot) + val messages = when (role) { + BarbRole.ATTACKER -> listOf("Call pls", "Wrong style?", "Attacking!") + BarbRole.HEALER -> listOf("Need poison", "Healing!", "Healer here","Call pls") + BarbRole.DEFENDER -> listOf("Dropping food", "Come here runners","Call pls") + BarbRole.COLLECTOR -> listOf("Eggs!", "Wrong egg?","Call pls") + else -> listOf("Lag...", "Nice", "Oops") + } + bot.sendChat(messages.random(krng)) + } fun randomWalkTo(loc: Location, radius: Int) { var newloc = loc.transform(RandomFunction.random(radius, -radius), diff --git a/Server/src/main/content/minigame/barbassault/lobby/BarbassLobbyActivity.kt b/Server/src/main/content/minigame/barbassault/lobby/BarbassQuickWaveActivity.kt similarity index 84% rename from Server/src/main/content/minigame/barbassault/lobby/BarbassLobbyActivity.kt rename to Server/src/main/content/minigame/barbassault/lobby/BarbassQuickWaveActivity.kt index f8d8ab7bf..47242ab4a 100644 --- a/Server/src/main/content/minigame/barbassault/lobby/BarbassLobbyActivity.kt +++ b/Server/src/main/content/minigame/barbassault/lobby/BarbassQuickWaveActivity.kt @@ -2,9 +2,7 @@ package content.minigame.barbassault.lobby import content.minigame.barbassault.BarbRole import content.minigame.barbassault.lobby.BarbTeamManager.createTeam -import core.api.log -import core.api.sendMessage -import core.api.setInterfaceText +import core.api.* import core.game.activity.ActivityManager import core.game.activity.ActivityPlugin import core.game.node.entity.Entity @@ -13,19 +11,14 @@ 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.ZoneBorders import core.game.world.map.zone.ZoneRestriction import core.plugin.Initializable import core.tools.Log import org.rs09.consts.Items +private var activity: BarbassQuickWaveActivity? = null -//Idea: Everyone in the lobby is under this activity. -// Why? If for somereason you DIE! your still protected. -// And will use for Quick Start wave room. - -private var activity: BarbassLobbyActivity? = null - -sealed class QueueRole { data class Specific(val role: BarbRole) : QueueRole(); object Any : QueueRole() } data class WaitingPlayer(val player: Player, val role: BarbRole?,val joinTime: Long = System.currentTimeMillis()) private val waitingPlayers = mutableListOf() @@ -34,10 +27,10 @@ private var waitingAnyCount = 0 @Initializable -open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, true, - ZoneRestriction.CANNON, ZoneRestriction.FIRES, ZoneRestriction.FOLLOWERS, ZoneRestriction.RANDOM_EVENTS) { +open class BarbassQuickWaveActivity : ActivityPlugin("BarbassQuickWave",false, false, true, + ZoneRestriction.CANNON, ZoneRestriction.FIRES, ZoneRestriction.FOLLOWERS, ZoneRestriction.RANDOM_EVENTS), MapArea { - init { activity = this } + init { activity = this; this.safeRespawn = Location.create(2593, 5264, 0) } private fun tryCreateTeamFromQueue(): Boolean { @@ -89,19 +82,18 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr // if(player == null) {removeQuickQue(player);return} var teamLeader: Player? = null for (wp in players) { - // if(wp.player.isArtificial) continue //only players can lead a party. + if(wp.player.isArtificial) continue //only players can lead a party. if (giveScroll(wp.player)) { teamLeader = wp.player break } } //IF BY CHANCE no one had free inventory space KICK THEM ALL FROM QuickLobby! - // I should just return them to the que, at the end XD - //orr maybe allow them one game. and party disbands upon finshing the wave. + // I should just return them to the que, at the end instead if (teamLeader == null) { players.forEach { sendMessage(it.player, "You could not hold a Scroll and have been removed from queue") - player.teleport(Location.create(2602, 5279, 0)) + it.player.teleport(Location.create(2602, 5279, 0)) } return } @@ -113,8 +105,8 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr val team = session?.team ?: return players.forEachIndexed { index, wrapper -> - wrapper?.let { playerWrapper -> - if (index != 0) { + wrapper.let { playerWrapper -> + if (wrapper.player != teamLeader) { playerWrapper.player.baSession = session team.addPlayer(playerWrapper.player) } @@ -126,8 +118,8 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr session.beginStartingPhase(true) } - } + override fun configure() { GameWorld.Pulser.submit( object : Pulse(25) { @@ -196,4 +188,23 @@ open class BarbassLobbyActivity : ActivityPlugin("BarbassLobby",false, false, tr } } } +/* override fun areaEnter(entity: Entity) { + enter(entity) + } + + override fun areaLeave(entity: Entity, logout: Boolean) { + leave(entity,logout) + super.areaLeave(entity, logout) + } + + override fun enter(e: Entity?): Boolean { + return super.enter(e) + } + + override fun leave(e: Entity?, logout: Boolean): Boolean { + return super.leave(e, logout) + }*/ + override fun defineAreaBorders(): Array { + return arrayOf(getRegionBorders(10322)) + } } \ No newline at end of file