corrected some horn of glory texts. Egg cannon started.

BlinkySwitch eastegg message :D
This commit is contained in:
Tooze 2026-02-01 15:48:27 -05:00
parent cac879eb4f
commit 8a2b160df1
4 changed files with 249 additions and 17 deletions

View file

@ -2,9 +2,13 @@ package content.minigame.barbassault.arena
import content.minigame.barbassault.BarbassaultTut
import content.minigame.barbassault.arena.BaHornSystem.HornHelper.getHealerHorn
import content.minigame.barbassault.arena.scenery.EggCannon
import content.minigame.barbassault.arena.scenery.EggCannon.Companion.loadEggHopper
import content.minigame.barbassault.arena.scenery.EggCannon.Companion.showEggHopperCount
import content.minigame.barbassault.getBarbLevels
import content.minigame.barbassault.lobby.baSession
import core.api.*
import core.game.component.Component
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
@ -47,7 +51,6 @@ class BarbassaultGameArea : InteractionListener, MapArea {
val ROLE_ICON = intArrayOf( ATTACKER_ICON, DEFENDER_ICON, COLLECTOR_ICON, HEALER_ICON )
val Fix_trap_IDs = intArrayOf( Scenery.RUNNER_TRAP1_20230, Scenery.BROKEN_TRAP0_20231 )
object BA_ARENA { val MAIN = 7509; val QUEEN = 7508; val all = listOf(MAIN, QUEEN) }
//base.transform(0,0,0)
data class arenaItems(val id: Int,val x: Int, val y: Int, val z: Int)
val arenaItemSpawn: List<arenaItems> = listOf(
@ -55,6 +58,14 @@ class BarbassaultGameArea : InteractionListener, MapArea {
arenaItems(Items.LOGS_11760,30,46,0),
arenaItems(Items.LOGS_11760,29,47,0)
)
enum class EggCannonSide { WEST, EAST }
data class EggCannonLoc( val side: EggCannonSide, val x: Int, val y: Int, val z: Int, val direction: Direction )
val eggCannons: List<EggCannonLoc> = listOf(
EggCannonLoc(EggCannonSide.WEST, 21, 34, 0, Direction.SOUTH),
EggCannonLoc(EggCannonSide.EAST, 40, 34, 0, Direction.SOUTH) )
enum class pennanceNPC { RUNNER, HEALER, FIGHTER, RANGER }
data class npcSpawnLoc(val tunnel:pennanceNPC, val x: Int,val y: Int,val z: Int,val direction: Direction)
val npcSpawns: List<npcSpawnLoc> = listOf(
@ -71,7 +82,7 @@ class BarbassaultGameArea : InteractionListener, MapArea {
}
override fun areaEnter(entity: Entity) {
val player = entity as? Player ?: return
//change this for tut latter
BarbassaultTut.BarbassTutNPCs.forEach {
npc -> npc.init()
npc.isWalks = false
@ -90,6 +101,24 @@ class BarbassaultGameArea : InteractionListener, MapArea {
}
override fun defineListeners() {
on(Scenery.EGG_LAUNCHER_20133, IntType.SCENERY, "Shoot") { player, node ->
EggCannon.openTurretIface(player)
return@on true
}
setDest(IntType.SCENERY,Scenery.EGG_HOPPER_20264){ player,node ->
return@setDest Location.create(player.location.x, player.location.y-1, 0)
}
on(Scenery.EGG_HOPPER_20264, IntType.SCENERY, "Load","Look-in") { player, node ->
val optionClicked = player.getAttribute<String>("interact:option")?.lowercase() ?: return@on false
when(optionClicked){
"Load" -> loadEggHopper(player)
"Look-in" -> showEggHopperCount(player)
}
return@on true
}
on(Fix_trap_IDs, IntType.SCENERY, "Fix") { player, node ->
if (hasTools(player)) { return@on true }
playerChangeScenery(player,5416,node,Scenery.RUNNER_TRAP2_20135,5,"You fixed the Penance Runner trap.")
@ -123,7 +152,7 @@ class BarbassaultGameArea : InteractionListener, MapArea {
}
return@on true
}
//You've been healed $amount hitpoints and your poison cured.
on(Scenery.HEALER_SPRING_20150, IntType.SCENERY, "Drink-from") { player, _ ->
if (getItemFromEquipment(player, EquipmentSlot.CAPE)?.id == 10559) {
player.animate(Animation(5407))
@ -245,7 +274,7 @@ class BarbassaultGameArea : InteractionListener, MapArea {
player.animate(Animation(anim))
player.lock(pulseDelay)
//if trap send message "You fixed the Penance Runner trap."
GameWorld.Pulser.submit(object : Pulse(pulseDelay, player) {
override fun pulse(): Boolean {
player.unlock()
@ -296,6 +325,8 @@ fun exitMiniGame(player: Player) {
/*
the game ended early becasue one of your team mates died.
484 = horn of glory!
Barricaded entrances will only slow down, not stop, Penance from entering the battlefield.
Players are allowed to use normal potions; however, potions mixed using Barbarian training may not be brought into the arena.

View file

@ -2,15 +2,19 @@ package content.minigame.barbassault.arena
import content.minigame.barbassault.BarbRole
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.baSession
import core.api.*
import core.game.node.entity.Entity
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.task.Pulse
import core.game.world.GameWorld
import core.game.world.map.Direction
import core.game.world.map.Location
import core.game.world.map.build.DynamicRegion
import core.game.world.map.zone.ZoneBorders
@ -20,6 +24,7 @@ import core.tools.secondsToTicks
import core.tools.ticksToSeconds
import org.rs09.consts.Components
import org.rs09.consts.Music.ASSAULT_AND_BATTERY_604
import org.rs09.consts.NPCs
/*
Player
@ -42,10 +47,13 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
lateinit var region: DynamicRegion
lateinit var base: Location
var currentWave = 1
var state: BarbassaultState = BarbassaultState.PARTY_CREATION
private set
lateinit var team: BarbTeam
val sessionNpcs = mutableListOf<NPC>()
val groundItems = mutableListOf<GroundItem>()
val eggHopper = EggCannon.EggHopperCount()
fun beginStartingPhase() {
@ -96,6 +104,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
enterArena()
rollNewRoleCalls()
//giveplayerHorns
return true
}
@ -133,6 +142,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
region = DynamicRegion.create(BarbassaultGameArea.BA_ARENA.MAIN)
base = region.baseLocation
zone.register(getRegionBorders(region.id))
spawnEggCannons()
}
private fun destroyArena() {
@ -188,6 +198,17 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
//exitMiniGame(player)
removeTimer(player, "teleblock")
}
fun sessionNPCSpawn(id: Int, location: Location, direction: Direction, vararg objects: Any): NPC? {
val npc = NPC.create(id, location, direction, *objects)
npc.init()
sessionNpcs.add(npc)
return npc
}
fun spawnEggCannons() {
sessionNPCSpawn( NPCs.EGG_LAUNCHER_5026, base.transform(21, 34, 0), Direction.NORTH )
if (currentWave == 10) return
sessionNPCSpawn( NPCs.EGG_LAUNCHER_5026, base.transform(40, 34, 0), Direction.NORTH )
}
private val BA_ROLE_CAPE = mapOf( BarbRole.ATTACKER to 10556, BarbRole.DEFENDER to 10558, BarbRole.COLLECTOR to 10557, BarbRole.HEALER to 10559 )
private fun equipBARoleIcon(player: Player, role: BarbRole) {
@ -274,7 +295,6 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
BarbRole.HEALER -> Components.BARBASSAULT_OVER_HEAL_488
}
}
fun rollNewRoleCalls() {
roleCalls[BarbRole.ATTACKER] = AttackerCall(AttackerStyle.values().random())
roleCalls[BarbRole.HEALER] = HealerCall(PoisonFood.values().random())
@ -291,7 +311,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) : MapArea
fun updateGloryHornUI(){
team.allPlayers().forEach { player ->
val atkCallText = (roleCalls[BarbRole.COLLECTOR]?.toCall as? AttackerStyle)?.let { "${it.top} ${it.bottom}" } ?: GloryHorn.CallOut.defaultText
val atkCallText = (roleCalls[BarbRole.COLLECTOR]?.toCall as? AttackerStyle)?.let { "${it.top}${it.bottom}" } ?: GloryHorn.CallOut.defaultText
val colCallText = (roleCalls[BarbRole.ATTACKER]?.toCall as? HasUIText)?.ui ?: GloryHorn.CallOut.defaultText
val defCallText = (roleCalls[BarbRole.HEALER]?.toCall as? HasUIText)?.ui ?: GloryHorn.CallOut.defaultText
val healCallText = (roleCalls[BarbRole.DEFENDER]?.toCall as? HasUIText)?.ui ?: GloryHorn.CallOut.defaultText

View file

@ -1,7 +1,77 @@
package content.minigame.barbassault.arena.scenery
class EggCannon {
import content.minigame.barbassault.arena.BarbassaultSession
import content.minigame.barbassault.lobby.CurrentTeam
import content.minigame.barbassault.lobby.baSession
import core.api.sendChat
import core.api.sendDialogueLines
import core.api.sendMessage
import core.api.setInterfaceText
import core.game.component.CloseEvent
import core.game.component.Component
import core.game.component.ComponentDefinition
import core.game.component.ComponentPlugin
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.plugin.Initializable
import core.plugin.Plugin
import org.rs09.consts.Components
import org.rs09.consts.Items
//Egg hoppper scenrey item updates based on eggs in hopper
// empty -> EGG_HOPPER_20264
// half -> EGG_HOPPER_20265
// full -> EGG_HOPPER_20266
//varbit 3268
@Initializable
class EggCannon : ComponentPlugin() {
//Easter Egg "Blinky Switch"
private val currentSequence = mutableListOf<Int>()
private val easterEggSequence = listOf(56, 38, 26, 26, 56, 56)
fun checkEasterEgg(player: Player,button: Int) {
currentSequence.add(button)
println("Current sequence: $currentSequence + $button")
while(currentSequence.size > easterEggSequence.size) {
currentSequence.removeAt(0)
}
if(currentSequence.takeLast(easterEggSequence.size) == easterEggSequence) {
sendMessage(player, "[BlickySwitch] Activated!")
//does nothing, just a silly message
currentSequence.clear()
}
}
//END BINKY//
data class EggHopperCount(var red: Int = 0,var blue: Int = 0, var green: Int = 0, var yellow: Int = 0 ){
fun addEggs(redToAdd: Int = 0, blueToAdd: Int = 0, greenToAdd: Int = 0, yellowToAdd: Int = 0): Map<String, Int> {
val added = mutableMapOf<String, Int>()
val newRed = (red + redToAdd).coerceAtMost(5)
added["red"] = newRed - red
red = newRed
val newBlue = (blue + blueToAdd).coerceAtMost(5)
added["blue"] = newBlue - blue
blue = newBlue
val newGreen = (green + greenToAdd).coerceAtMost(5)
added["green"] = newGreen - green
green = newGreen
val newYellow = (yellow + yellowToAdd).coerceAtMost(5)
added["yellow"] = newYellow - yellow
yellow = newYellow
return added
}
}
override fun newInstance(arg: Any?): Plugin<Any> {
ComponentDefinition.forId(EggTurret.ID).plugin = this
ComponentDefinition.forId(EggTurret.ID).isWalkable = false;
return this
}
///stun(entity: Entity, ticks: Int)
///isStunned(entity: Entity)
//applyPoison (entity: Entity, source: Entity, severity: Int)
@ -9,13 +79,125 @@ class EggCannon {
//spawnProjectile
//face()
override fun open(player: Player?, component: Component?) {
super.open(player, component)
player ?: return
Component(EggTurret.ID).setCloseEvent(CloseEvent {p, _ -> closeTurretIface(p);return@CloseEvent true})
updateCannonUI(player)
}
//error message CHATBOX "[bold]all of the _PENANCE_ have been killed!"
//error messageif out of range CHATBOX "There are no targetable _PENANCE_ within fireing range."
override fun handle(player: Player?, component: Component?, opcode: Int, button: Int, slot: Int, itemId: Int ): Boolean {
player ?: return true
checkEasterEgg(player, button)
when(button){
EggTurret.close -> closeTurretIface(player)
EggTurret.queenBtn -> sendMessage(player,"Shoot Omega at Queen")
else -> shootNormalEggs(button, player)
}
return true
}
fun shootNormalEggs(button: Int,player: Player?) {
player ?: return
val penanceSets = listOf(
"Penance Healer" to EggTurret.pHealerBtns,
"Penance Runner" to EggTurret.pRunnerBtns,
"Penance Fighter" to EggTurret.pFighterBtns,
"Penance Ranger" to EggTurret.pRangerBtns
)
for ((name, colors) in penanceSets) {
when(button) {
colors.green -> { sendMessage(player, "Shoot poison at $name.");return }
colors.red -> { sendMessage(player, "Shoot Explosive at $name.");return }
colors.blue -> { sendMessage(player, "Shoot Stun at $name.");return }
}
}
}
fun updateCannonUI(player: Player?){
player ?: return
val eggHopper = player.baSession?.eggHopper ?: return
val penances = listOf( EggTurret.pHealer, EggTurret.pRunner, EggTurret.pRanger, EggTurret.pFighter )
penances.forEach { penance ->
val colors = listOf( "green" to penance.green," red" to penance.red, "blue" to penance.blue)
colors.forEach { (colorName, componentId) ->
val value = when(colorName) {
"green" -> eggHopper.green
"red" -> eggHopper.red
"blue" -> eggHopper.blue
else -> 0
}
setInterfaceText(player, value.toString(), EggTurret.ID, componentId)
}
}
setInterfaceText(player,eggHopper.yellow.toString(),EggTurret.ID,EggTurret.OMEGA)
}
private fun closeTurretIface(player: Player?){
player ?: return
player.interfaceManager.restoreTabs()
player.interfaceManager.openTab(3,Component(149))
}
companion object {
fun openTurretIface(player: Player?) {
player ?: return
val sesion = player.baSession
//get hopper count, if not 0 open else CHATBOXmessage "There are no eggs in the hopper."
player.interfaceManager.openTab(3,Component(495))
player.interfaceManager.setViewedTab(3)
player.interfaceManager.removeTabs(0, 1, 2, 4, 5, 6,7,8,9,11, 12,13)
}
fun loadEggHopper(player: Player?){
player ?: return
val session = player.baSession
//get player inventory
val eggsAdded = session?.eggHopper?.addEggs(greenToAdd = 0, redToAdd = 0, blueToAdd = 0, yellowToAdd = 0)
//remove eggs based on eggsAdded from inventory
//Load hopper emote, Same as place table??
}
fun showEggHopperCount(player: Player?){
player ?: return
val eggsCount = player.baSession?.eggHopper
sendDialogueLines(player,"$eggsCount")
}
}
}
data class EggColors(val green: Int, val red: Int, val blue: Int)
object EggTurret {
const val ID = 495
val pHealer = EggColors(57, 58, 59)
val pHealerBtns = EggColors(11, 12, 13)
val pRunner = EggColors(60, 61, 62)
val pRunnerBtns = EggColors(24, 25, 26)
val pFighter = EggColors(63, 64, 65)
val pFighterBtns = EggColors(37, 38, 39)
val pRanger = EggColors(66, 67, 68)
val pRangerBtns = EggColors(50, 51, 52)
const val OMEGA = 69
const val queenBtn = 56
val close = 72
}
//emote 5428 maybe
/* GOLD I TELL YOU GOLD!!!!
/*
https://youtu.be/_EipqTK3Qak?t=106
https://www.youtube.com/watch?v=OJ2BDEM03Dw
entity.interfaceManager.removeTabs(0, 1, 2, 3, 4, 5, 6, 12)
entity.interfaceManager.restoreTabs()
//hide all tabs but invtenory bag and clan chat tab
//egg explosion 20727

View file

@ -26,13 +26,13 @@ class HornOfGlory : ComponentPlugin() , InteractionListener {
GloryHorn.AGGRISSIVE_STEEL_EARTH to (BarbassaultSession.AttackerStyle.STYLE_3 to BaCall.ATTACKER_STYLE_3),
GloryHorn.DEFENSIVE_MITHRIL_FIRE to (BarbassaultSession.AttackerStyle.STYLE_4 to BaCall.ATTACKER_STYLE_4),
GloryHorn.POISON_TOFU to (BarbassaultSession.PoisonFood.TOFU to BaCall.HEALER_TOFU),
GloryHorn.POISON_WORMS to (BarbassaultSession.PoisonFood.WORMS to BaCall.HEALER_WORMS),
GloryHorn.POISON_MEAT to (BarbassaultSession.PoisonFood.MEAT to BaCall.HEALER_MEAT),
GloryHorn.POISON_TOFU to ("Poison tofu" to BaCall.HEALER_TOFU),
GloryHorn.POISON_WORMS to ("Poison worms" to BaCall.HEALER_WORMS),
GloryHorn.POISON_MEAT to ("Poison meat" to BaCall.HEALER_MEAT),
GloryHorn.RED_EGG to (BarbassaultSession.EggColor.RED to BaCall.COLLECTOR_RED),
GloryHorn.GREEN_EGG to (BarbassaultSession.EggColor.GREEN to BaCall.COLLECTOR_GREEN),
GloryHorn.BLUE_EGG to (BarbassaultSession.EggColor.BLUE to BaCall.COLLECTOR_BLUE),
GloryHorn.RED_EGG to ("Red egg" to BaCall.COLLECTOR_RED),
GloryHorn.GREEN_EGG to ("Green egg" to BaCall.COLLECTOR_GREEN),
GloryHorn.BLUE_EGG to ("Blue egg" to BaCall.COLLECTOR_BLUE),
GloryHorn.FOOD_TOFU to (BarbassaultSession.LureFood.TOFU to BaCall.DEFENDER_TOFU),
GloryHorn.FOOD_CRACKERS to (BarbassaultSession.LureFood.CRACKERS to BaCall.DEFENDER_CRACKERS),
@ -55,6 +55,7 @@ class HornOfGlory : ComponentPlugin() , InteractionListener {
player.animate(Animation(5436))
player.lock(6)
hornCallLock = true
//i should replace these with script ques, yes?
GameWorld.Pulser.submit(object : Pulse(6, player) {
override fun pulse(): Boolean {
player.unlock()
@ -63,7 +64,6 @@ class HornOfGlory : ComponentPlugin() , InteractionListener {
}
})
}
return true
}
@ -73,7 +73,6 @@ class HornOfGlory : ComponentPlugin() , InteractionListener {
}
override fun defineListeners() {
on(Scenery.HORN_OF_GLORY_20247, IntType.SCENERY, "Call") { player, _ ->
//emote 5438
player.interfaceManager.open(Component(GloryHorn.ID))
return@on true