From d53e90e70252cb7012f52686234e66066683f4d4 Mon Sep 17 00:00:00 2001 From: Tooze Date: Fri, 20 Feb 2026 14:02:42 -0500 Subject: [PATCH] more barbass stuff --- .../minigame/barbassault/Barbassault.kt | 9 +++ .../barbassault/BarbassaultListeners.kt | 28 +++++---- .../barbassault/arena/BarbassaultGameArea.kt | 58 ++++++------------- .../barbassault/arena/BarbassaultSession.kt | 35 ++++++++--- .../barbassault/lobby/BarbassaultLobby.kt | 22 ++++--- 5 files changed, 80 insertions(+), 72 deletions(-) diff --git a/Server/src/main/content/minigame/barbassault/Barbassault.kt b/Server/src/main/content/minigame/barbassault/Barbassault.kt index a1ed33e0e..fc2f070c5 100644 --- a/Server/src/main/content/minigame/barbassault/Barbassault.kt +++ b/Server/src/main/content/minigame/barbassault/Barbassault.kt @@ -1,5 +1,8 @@ package content.minigame.barbassault +import content.minigame.barbassault.arena.ATTACKER_ICON +import content.minigame.barbassault.arena.HEALER_ICON +import core.api.removeItem import core.game.node.entity.player.Player enum class BarbRole { ATTACKER, COLLECTOR,DEFENDER, HEALER } @@ -173,4 +176,10 @@ fun BarbAssaultPoints.getPoints(role: BarbRole): Int = when (role) { BarbRole.COLLECTOR -> col BarbRole.DEFENDER -> def BarbRole.HEALER -> heal +} + +fun removeBarbassItems(player: Player){ + //check if we were in ba-instance last. if so then remove all BA Items (Horns icons runes,arrows) + removeItem(player, intArrayOf(ATTACKER_ICON, HEALER_ICON)) + } \ No newline at end of file diff --git a/Server/src/main/content/minigame/barbassault/BarbassaultListeners.kt b/Server/src/main/content/minigame/barbassault/BarbassaultListeners.kt index db4c25f49..a7a63fda7 100644 --- a/Server/src/main/content/minigame/barbassault/BarbassaultListeners.kt +++ b/Server/src/main/content/minigame/barbassault/BarbassaultListeners.kt @@ -4,6 +4,7 @@ package content.minigame.barbassault import content.minigame.barbassault.BarbassBlackBoard.Companion.updateBlackBoard import core.api.* import core.game.component.Component +import core.game.global.action.ClimbActionHandler import core.game.interaction.IntType import core.game.interaction.InteractionListener import core.game.interaction.InterfaceListener @@ -20,24 +21,23 @@ const val BARBASSAULT_SELECT_ROLE_493 = 493 class BarbassaultListeners : InteractionListener { override fun defineListeners() { + // addClimbDest(Location.create(2593, 5261, 0),Location.create(2593, 5261, 0)) on(Scenery.LADDER_20226, IntType.SCENERY, "Climb-down") { player, _ -> // if (GameWorld.settings?.enable_barbassault != true) return@on false //todo players are allowed to wear capes in to the lobby, But not the Wave Rooms //todo No summonings in lobby if (joinError(player)) return@on true val loc = Location(2593 , 5261 ) - teleport(player, loc) - //todo ladder code or add climb down animation. + ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_DOWN, loc) + face(player,Location(2593, 5262)) return@on true } on(Scenery.LADDER_20227, IntType.SCENERY, "Climb-up") { player, _ -> - //todo remove BarbassItems IE: Scroll val loc = Location(2535 , 3572 ) player.inventory.removeAll(Items.SCROLL_10512) - teleport(player, loc) // find ladder code latter - //todo ladder code or climb up animation - + ClimbActionHandler.climb(player, ClimbActionHandler.CLIMB_UP, loc) + face(player,Location(2533, 3572)) return@on true } @@ -62,12 +62,6 @@ class BarbassaultListeners : InteractionListener { } - private fun capeCheck(player: Player): String? { - val wornCape = getItemFromEquipment(player, EquipmentSlot.CAPE)?.id ?: -1 - if (wornCape != -1) return "Capes are not permitted." - //todo find authentic "no capes allowed" message - return null - } private fun forbiddenItemsCheck(player: Player): String? { val forbiddenRunes = setOf( Items.AIR_RUNE_556, @@ -96,14 +90,18 @@ class BarbassaultListeners : InteractionListener { for (item in player.inventory.toArray()) { if (item != null) { if (item.id in forbiddenRunes) { - return "no outside runes" + //todo find source for this message + return "You cannot take your own runes, ammunition, or potions into the game." } } } return null } private fun familiarCheck(player: Player): String? { - // if has pet or familiar, not allowed to enter. + if(player.familiarManager.hasFamiliar()) { + //todo find correct message + return "You cannot take your follower into the game." + } return null } @@ -111,7 +109,7 @@ class BarbassaultListeners : InteractionListener { private fun joinError(player: Player): Boolean { - val errorMessage = capeCheck(player) ?: forbiddenItemsCheck(player) ?: familiarCheck(player) ?: return false + val errorMessage = forbiddenItemsCheck(player) ?: familiarCheck(player) ?: return false player.sendMessage(errorMessage).also { return true } } } diff --git a/Server/src/main/content/minigame/barbassault/arena/BarbassaultGameArea.kt b/Server/src/main/content/minigame/barbassault/arena/BarbassaultGameArea.kt index a25ec3dab..3ff3f5d98 100644 --- a/Server/src/main/content/minigame/barbassault/arena/BarbassaultGameArea.kt +++ b/Server/src/main/content/minigame/barbassault/arena/BarbassaultGameArea.kt @@ -2,8 +2,8 @@ package content.minigame.barbassault.arena import content.minigame.barbassault.BarbRole import content.minigame.barbassault.BarbassaultTut -import content.minigame.barbassault.CaptainCainDialogue.Companion.TORSO_PRICE import content.minigame.barbassault.arena.BaHornSystem.HornHelper.getHealerHorn +import content.minigame.barbassault.arena.BarbassaultSession.AttackerStyle import content.minigame.barbassault.arena.scenery.EggCannon import content.minigame.barbassault.arena.scenery.EggCannon.Companion.loadEggHopper import content.minigame.barbassault.arena.scenery.EggCannon.Companion.loadHopperEggs @@ -11,28 +11,23 @@ import content.minigame.barbassault.arena.scenery.EggCannon.Companion.showEggHop import content.minigame.barbassault.getBarbLevels import content.minigame.barbassault.lobby.baSession import core.api.* -import core.game.component.Component -import content.minigame.barbassault.arena.BarbassaultSession.AttackerStyle - +import core.game.global.action.ClimbActionHandler +import core.game.global.action.DropListener import core.game.interaction.IntType import core.game.interaction.InteractionListener -import core.game.interaction.QueueStrength import core.game.node.Node import core.game.node.entity.Entity import core.game.node.entity.combat.BattleState import core.game.node.entity.combat.CombatStyle import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player -import core.game.node.entity.player.info.LogType -import core.game.node.entity.player.info.PlayerMonitor -import core.game.node.entity.player.info.login.PlayerParser -import core.game.node.item.GroundItemManager +import core.game.node.item.GroundItem import core.game.node.item.Item import core.game.system.task.Pulse import core.game.world.GameWorld +import core.game.world.GameWorld.Pulser import core.game.world.map.Direction import core.game.world.map.Location -import core.game.world.map.RegionManager import core.game.world.map.zone.ZoneBorders import core.game.world.update.flag.context.Animation import core.tools.Log @@ -161,13 +156,14 @@ class BarbassaultGameArea : InteractionListener, MapArea { playerChangeScenery(player,5417,node,Scenery.PENANCE_CAVE_20238,4) return@on true } - on(Scenery.LADDER_20194, IntType.SCENERY, "Climb-up") { player, _ -> sendDialogueOptions(player, "Are you sure you want to leave?", "Yes", "No") addDialogueAction(player) { _, buttonId -> if (buttonId == 2) { - //endGame - teleport(player, Location(2593 , 5261 )) + val animationDuration = animationDuration(ClimbActionHandler.CLIMB_UP) + player.lock(animationDuration) + player.animate(ClimbActionHandler.CLIMB_UP) + Pulser.submit(object : Pulse(animationDuration) { override fun pulse(): Boolean {player.baSession?.forfet(); return true }}) } } return@on true @@ -237,18 +233,22 @@ class BarbassaultGameArea : InteractionListener, MapArea { //if (getItemFromEquipment(player, EquipmentSlot.CAPE)?.id != DEFENDER_ICON) { return@on false } // only a defender can interact with lure food. val groundLureItem = findClosestLure(node.location) - removeLure(groundLureItem!!) + + if (groundLureItem == null) return@on true + removeLure(groundLureItem) + return@on true } on(LureItems, IntType.ITEM, "Drop") { player, node -> val dropedItem = node as Item + DropListener.drop(player, node.asItem()) sendMessage(player,dropedItem.name) //addItemNode(dropedItem,player.location,true) - lureDrop(player,dropedItem) - - //DropListener.drop(player,dropedItem) + val gItem = player.getAttribute("droppedItem:${node.id}") + addItemNode(gItem,player.location,true) + //DropListener.drop(player, dropedItem) //with values for good and bad. //structure table with intent of being looped trough by a runner to check distance, compared to it. //and to check if its good or bad when they get to that one. @@ -257,30 +257,6 @@ class BarbassaultGameArea : InteractionListener, MapArea { } } - private fun lureDrop(player: Player,item:Item){ - //val gi = GroundItemManager.create(GroundItem(item.dropItem,player.location,-1,null)) - //todo ask for help with this. - queueScript(player, strength = QueueStrength.SOFT) { - val current = player.inventory.get(item.slot) - if (current == null || current !== item) { - return@queueScript stopExecuting(player) - } - if (player.inventory.replace(null, item.slot) !== item) { - PlayerMonitor.log(player, LogType.DUPE_ALERT, "Potential exploit attempt when player ${player.name} tried to drop ${item.amount}x ${item.id}. The item has been lost and will need to be refunded to the player, but how did they get this to happen? @Barbass") - return@queueScript stopExecuting(player) - } - - val droppedItem = item.dropItem - val gi = GroundItemManager.create(droppedItem, player.location, player) - setAttribute(player, "droppedItem:${droppedItem.id}", getWorldTicks() + 2) - PlayerParser.save(player) - gi.forceVisible = true - addItemNode(gi,player.location,true) - - return@queueScript stopExecuting(player) - } - - } fun removeAll(player: Player, items: List, container: Container = Container.INVENTORY): Boolean { var removedAny = false diff --git a/Server/src/main/content/minigame/barbassault/arena/BarbassaultSession.kt b/Server/src/main/content/minigame/barbassault/arena/BarbassaultSession.kt index 9062b8376..666af74fd 100644 --- a/Server/src/main/content/minigame/barbassault/arena/BarbassaultSession.kt +++ b/Server/src/main/content/minigame/barbassault/arena/BarbassaultSession.kt @@ -5,6 +5,7 @@ import content.minigame.barbassault.BarbassaultActivity import content.minigame.barbassault.arena.scenery.EggCannon import content.minigame.barbassault.arena.scenery.GloryHorn import content.minigame.barbassault.lobby.BarbTeam +import content.minigame.barbassault.lobby.BarbTeamManager import content.minigame.barbassault.lobby.BarbassaultLobby import content.minigame.barbassault.lobby.baSession import core.api.* @@ -13,6 +14,7 @@ import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.game.node.item.GroundItem import core.game.node.item.Item +import core.game.system.communication.CommunicationInfo import core.game.system.task.Pulse import core.game.world.GameWorld import core.game.world.map.Direction @@ -24,7 +26,6 @@ import core.tools.Log import core.tools.secondsToTicks import core.tools.ticksToSeconds import org.rs09.consts.Components -import org.rs09.consts.Items import org.rs09.consts.Music.ASSAULT_AND_BATTERY_604 import org.rs09.consts.NPCs @@ -38,7 +39,6 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi lateinit var base: Location var currentWave = 1 var state: BarbassaultState = BarbassaultState.PARTY_CREATION - private set lateinit var team: BarbTeam val sessionNpcs = mutableListOf() val groundItems = mutableListOf() @@ -46,7 +46,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi val scoreManager = BarbScoreManager() val eventBus = BarbAssEventBus() val npcCaps = SpawnCaps(4,4,2,2)//wave 1 - + val endReason = "left" fun beginStartingPhase() { @@ -65,7 +65,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi player.baSession?.team?.getRoleForPlayer(player)?.let { equipBARoleIcon(player, it) } player.properties.teleportLocation = team.spawnLocationFor(player) //base.transform(36, 24, 0) - registerLogoutListener(player, "ba-logout") { handleLogout(player) } //todo make sure this works + registerLogoutListener(player, "ba-logout") { handleLogout(player) } } GameWorld.Pulser.submit(GamePulse()) @@ -149,22 +149,39 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi tracker.healerStats.wrongPoisonUsed++ } } - + fun forfet(){ + state = BarbassaultState.FORFEIT + } private inner class GamePulse : Pulse(1) { private var roleCallTicks = secondsToTicks(30) private var waveSpawns = secondsToTicks(6) override fun pulse(): Boolean { - if (state != BarbassaultState.IN_ARENA) return true + //if (state != BarbassaultState.IN_ARENA) return true if (state == BarbassaultState.FORFEIT){ + //team.getLeader()?.let { sendMessage(it.player,"end") } eventBus.clear() scoreManager.resetAll() BarbassaultLobby.TeamToLobby(team,team.wave) + state = BarbassaultState.PARTY_CREATION + for(player in team.allPlayers()) { + closeInterface(player) + openOverlay(player, 256) + sendMessage(player,"The game ended early because one of your team-mates $endReason.") + BarbTeamManager.updateTeam(player.baSession?.team!!) + } + return true } if (state == BarbassaultState.COMPLETE){ - //advance to next wave lobby! BarbassaultLobby.TeamToLobby(team,team.wave+1) + state = BarbassaultState.PARTY_CREATION + for(player in team.allPlayers()) { + closeInterface(player) + openOverlay(player, 256) + BarbTeamManager.updateTeam(player.baSession?.team!!) + } + return true // we do not have auto start next wave in 2009 } eventBus.processEvents() @@ -203,10 +220,10 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi region.remove(player) team.removePlayer(player) player.locks.unlockTeleport() - // player.properties.teleportLocation = Location.create(2593, 5264, 0) + player.location = Location.create(2593, 5264, 0) - if (team.allPlayers().isEmpty()) { + if (team.allPlayers().isEmpty()) { // might be redundant player.properties.teleportLocation = Location.create(2593, 5264, 0) endSession() } diff --git a/Server/src/main/content/minigame/barbassault/lobby/BarbassaultLobby.kt b/Server/src/main/content/minigame/barbassault/lobby/BarbassaultLobby.kt index 4bea7e04c..1d06f57f2 100644 --- a/Server/src/main/content/minigame/barbassault/lobby/BarbassaultLobby.kt +++ b/Server/src/main/content/minigame/barbassault/lobby/BarbassaultLobby.kt @@ -59,13 +59,21 @@ class BarbassaultLobby : InteractionListener, MapArea { for ((index, lobby) in waveLobbies.withIndex()) { if (lobby.insideBorder(location)) { if (lobby != MAIN_LOBBY) { // MAIN_LOBBY should not assign a wave number - entity.setAttribute("/save:barbass:wave", index + 1) + entity.setAttribute("/save:barbass:wave", index ) } return } } } - + private fun capeCheck(player: Player): Boolean { + val wornCape = getItemFromEquipment(player, EquipmentSlot.CAPE)?.id ?: -1 + if (wornCape != -1) { + //todo find authentic "no capes allowed" message + sendMessage(player,"Capes are not permitted.") + return false + } + return true + } //attacker 20561 : ch8 //defender 20566 : ch10 //collector 20563 : ch13 @@ -149,6 +157,7 @@ class BarbassaultLobby : InteractionListener, MapArea { return@on true } on(Scenery.DOOR_20209, IntType.SCENERY, "Pass") { player, node -> + if (capeCheck(player)) {} if (!QUICK_START.insideBorder(player.location)){ player.setAttribute("/save:barbass:wave", 1) handlePlayerOptionDoor(player) { role -> @@ -298,7 +307,7 @@ class BarbassaultLobby : InteractionListener, MapArea { player.inventory.removeAll(Items.SCROLL_10512) } else { openOverlay(player, iface) - player.sendMessage("you enter wave ${BARBWAVEDOOR[node.id]}") + // player.sendMessage("you enter wave ${BARBWAVEDOOR[node.id]}") } } } @@ -306,7 +315,7 @@ class BarbassaultLobby : InteractionListener, MapArea { companion object { fun TeamToLobby(team: BarbTeam, wave: Int) { - if (wave in 1..waveLobbies.size) { + if (wave in 0..waveLobbies.size) { val targetLobby = waveLobbies[wave] for (player in team.allPlayers()) { teleport(player, targetLobby.randomWalkableLoc) @@ -356,10 +365,9 @@ class BarbassaultLobby : InteractionListener, MapArea { WAVE_LOBBY10 ) val waveLobbies = listOf( - WAVE_LOBBY1, WAVE_LOBBY2, WAVE_LOBBY3, WAVE_LOBBY4, + MAIN_LOBBY,WAVE_LOBBY1, WAVE_LOBBY2, WAVE_LOBBY3, WAVE_LOBBY4, WAVE_LOBBY5, WAVE_LOBBY6, WAVE_LOBBY7, WAVE_LOBBY8, - WAVE_LOBBY9, WAVE_LOBBY10, - MAIN_LOBBY + WAVE_LOBBY9, WAVE_LOBBY10 ) val BARBDOORS = intArrayOf(