mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-23 11:25:11 -06:00
session
This commit is contained in:
parent
f376945ebc
commit
dd49dd4db8
8 changed files with 420 additions and 13 deletions
|
|
@ -1,13 +1,18 @@
|
|||
package content.minigame.barbassault
|
||||
|
||||
import core.api.animateScenery
|
||||
import core.api.getScenery
|
||||
import core.api.replaceScenery
|
||||
import core.api.sendMessage
|
||||
|
||||
import core.game.node.item.Item
|
||||
import core.game.node.scenery.SceneryBuilder
|
||||
import core.game.system.command.Privilege
|
||||
import core.game.system.command.sets.CommandSet
|
||||
import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Scenery
|
||||
|
||||
@Initializable
|
||||
class BarbassDevHelper : CommandSet(Privilege.ADMIN) {
|
||||
|
|
@ -28,6 +33,19 @@ class BarbassDevHelper : CommandSet(Privilege.ADMIN) {
|
|||
player.teleport(Location.create(1885, 5403, 0))
|
||||
}
|
||||
|
||||
define("trap"){ player,args->
|
||||
var thistrap = Location.create(1901, 5474, 0)
|
||||
var thistrapscen = core.game.node.scenery.Scenery(Scenery.RUNNER_TRAP2_20135, Location(1901, 5474))
|
||||
// RUNNER_TRAP2_20135
|
||||
// RUNNER_TRAP1_20230
|
||||
// BROKEN_TRAP0_20231
|
||||
val scenery = getScenery(thistrap)
|
||||
val emoteId = args[1].toIntOrNull()
|
||||
animateScenery(scenery!!, emoteId!!)//5076
|
||||
|
||||
//replaceScenery(getScenery(thistrap)!!,Scenery.RUNNER_TRAP1_20230,40,thistrap)
|
||||
}
|
||||
|
||||
define("rolekit", Privilege.ADMIN, "<role> <level>", "Gives Barbarian Assault kit") { player, args ->
|
||||
data class RoleKit(
|
||||
val horns: IntArray? = null,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
package content.minigame.barbassault
|
||||
|
||||
import content.minigame.fishingtrawler.FishingTrawlerActivity
|
||||
import core.api.MapArea
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.build.DynamicRegion
|
||||
import core.game.world.map.zone.ZoneRestriction
|
||||
import core.plugin.Initializable
|
||||
import core.tools.ticksToSeconds
|
||||
import core.game.activity.ActivityManager
|
||||
import core.game.activity.ActivityPlugin
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.tools.colorize
|
||||
|
||||
private var activity: BarbassaultActivity? = null
|
||||
@Initializable
|
||||
class BarbassaultActivity : ActivityPlugin("barbassault",false,false,true,ZoneRestriction.CANNON,ZoneRestriction.FIRES,ZoneRestriction.FOLLOWERS,ZoneRestriction.RANDOM_EVENTS), MapArea {
|
||||
|
||||
init {
|
||||
activity = this
|
||||
}
|
||||
override fun configure() {
|
||||
}
|
||||
|
||||
override fun start(player: Player?, login: Boolean, vararg args: Any?): Boolean {
|
||||
player ?: return false
|
||||
//waitingPlayers.add(player)
|
||||
return true
|
||||
}
|
||||
|
||||
fun addPlayer(player: Player){
|
||||
|
||||
}
|
||||
|
||||
fun removePlayer(player: Player){
|
||||
// waitingPlayers.remove(player)
|
||||
}
|
||||
|
||||
override fun newInstance(p: Player?): ActivityPlugin {
|
||||
ActivityManager.register(this)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun getSpawnLocation(): Location {
|
||||
return Location.create(2667, 3161, 0)
|
||||
}
|
||||
|
||||
override fun defineAreaBorders(): Array<ZoneBorders> {
|
||||
return arrayOf(ZoneBorders(2668, 3165, 2675, 3184))
|
||||
}
|
||||
|
||||
override fun getRestrictions(): Array<ZoneRestriction> {
|
||||
return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.TELEPORT)
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +1,29 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.BarbassaultTut
|
||||
import content.minigame.barbassault.arena.scenery.DefenderTrap
|
||||
import core.api.*
|
||||
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.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.GroundItem
|
||||
import core.game.node.item.GroundItemManager
|
||||
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.update.flag.context.Animation
|
||||
import core.game.worldevents.holiday.easter.EasterEvent.Companion.EGG_SPAWN_TIME
|
||||
import core.game.worldevents.holiday.easter.EasterEvent.Companion.eggs
|
||||
import core.tools.Log
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
|
|
@ -27,12 +41,13 @@ import org.rs09.consts.Scenery
|
|||
|
||||
//should be multicombat
|
||||
class BarbassaultGameArea : InteractionListener, MapArea {
|
||||
|
||||
val ATTACKER_ICON = 10556
|
||||
val DEFENDER_ICON = 10558
|
||||
val COLLECTOR_ICON = 10557
|
||||
val HEALER_ICON = 10559
|
||||
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)
|
||||
|
||||
override fun defineAreaBorders(): Array<ZoneBorders> {
|
||||
//block standard teleports.
|
||||
|
|
@ -46,25 +61,46 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
//sendMessage(player,----- Wave: $Num -----")
|
||||
openOverlay(player, interfaceId)
|
||||
}
|
||||
/*BarbassaultTut.BarbassTutNPCs.forEach {
|
||||
BarbassaultTut.BarbassTutNPCs.forEach {
|
||||
npc -> npc.init()
|
||||
npc.isWalks = false
|
||||
|
||||
}
|
||||
BarbassaultTut.spawnItems()
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun areaLeave(entity: Entity, logout: Boolean) {
|
||||
val player = entity as? Player ?: return
|
||||
|
||||
closeOverlay(player)
|
||||
exitMiniGame(player)
|
||||
log(this::class.java, Log.FINE, "EXITED BARBASS")
|
||||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
on(Fix_trap_IDs, IntType.SCENERY, "Fix") { player, node ->
|
||||
if (checkHasTools(player)) { return@on true }
|
||||
playerChangeScenery(player,5416,node,Scenery.RUNNER_TRAP2_20135,5,"You fixed the Penance Runner trap.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Scenery.PENANCE_CAVE_20237, IntType.SCENERY, "block") { player, node ->
|
||||
if (checkHasTools(player)) { return@on true }
|
||||
playerChangeScenery(player,5417,node,Scenery.PENANCE_CAVE_20238,4)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Scenery.PENANCE_CAVE_20238, IntType.SCENERY, "demolish") { player, node ->
|
||||
playerChangeScenery(player,5418,node,Scenery.PENANCE_CAVE_20239,5)
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Scenery.PENANCE_CAVE_20239, IntType.SCENERY, "fix") { player, node ->
|
||||
if (checkHasTools(player)) { return@on true }
|
||||
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")
|
||||
|
|
@ -72,11 +108,11 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
if (buttonId == 2) {
|
||||
//endGame
|
||||
teleport(player, Location(2593 , 5261 ))
|
||||
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(Scenery.HEALER_SPRING_20150, IntType.SCENERY, "Drink-from") { player, _ ->
|
||||
if (getItemFromEquipment(player, EquipmentSlot.CAPE)?.id == 10559) {
|
||||
player.animate(Animation(5407))
|
||||
|
|
@ -91,8 +127,8 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
})
|
||||
}
|
||||
return@on true
|
||||
|
||||
}
|
||||
|
||||
on(Scenery.HEALER_SPRING_20150, IntType.SCENERY, "Take-from") { player, _ ->
|
||||
//emote 5400
|
||||
/* HEALING_VIAL_10546 -- empty
|
||||
|
|
@ -101,11 +137,8 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
HEALING_VIAL3_10543
|
||||
HEALING_VIAL4_10542 // 4
|
||||
*/
|
||||
|
||||
return@on true
|
||||
|
||||
}
|
||||
|
||||
//CATALYTIC_RUNE_12851, ELEMENTAL_RUNE_12850
|
||||
|
||||
onUnequip(ROLE_ICON) { player, _ ->
|
||||
|
|
@ -127,8 +160,31 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
}
|
||||
return@onEquip true
|
||||
}
|
||||
on(LureItems, IntType.GROUNDITEM, "Take") { player, node ->
|
||||
//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!!)
|
||||
return@on true
|
||||
}
|
||||
on(LureItems, IntType.ITEM, "Drop") { player, node ->
|
||||
val dropedItem = node as Item
|
||||
sendMessage(player,dropedItem.name)
|
||||
//addItemNode(dropedItem,player.location,true)
|
||||
lureDrop(player,dropedItem)
|
||||
|
||||
//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.
|
||||
//delete from ground as runner "eats"
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private fun exitMiniGame(player: Player) {
|
||||
openOverlay(player,493) // work around to actually close interfaces.
|
||||
player.interfaceManager.closeOverlay()//maybe im doing this wrong.
|
||||
|
|
@ -149,6 +205,31 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
//award points, set Tp location to next wave
|
||||
//or lost game Send back to wave room
|
||||
|
||||
}
|
||||
private fun lureDrop(player: Player,item:Item){
|
||||
//val gi = GroundItemManager.create(GroundItem(item.dropItem,player.location,-1,null))
|
||||
|
||||
|
||||
|
||||
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<Int>, container: Container = Container.INVENTORY): Boolean {
|
||||
|
|
@ -170,6 +251,35 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
else -> null
|
||||
}
|
||||
}
|
||||
fun playerChangeScenery(player: Player,anim: Int ,node: Node, newSceneryId: Int, pulseDelay: Int = 3, message: String = "") {
|
||||
|
||||
player.animate(Animation(anim))
|
||||
player.lock(pulseDelay)
|
||||
|
||||
GameWorld.Pulser.submit(object : Pulse(pulseDelay, player) {
|
||||
override fun pulse(): Boolean {
|
||||
player.unlock()
|
||||
val scenryNode = node as core.game.node.scenery.Scenery
|
||||
replaceScenery( scenryNode,newSceneryId ,-1 ,node.location )
|
||||
sendMessage(player, message)
|
||||
if ( node.id == Scenery.PENANCE_CAVE_20238) {return true}
|
||||
removeItem(player,Items.LOGS_11760)
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
fun checkHasTools(player: Player): Boolean{
|
||||
if (getItemFromEquipment(player, EquipmentSlot.CAPE)?.id != DEFENDER_ICON) {return true}
|
||||
val requiredItems = listOf(Items.HAMMER_2347, Items.LOGS_11760)
|
||||
for (item in requiredItems) {
|
||||
if (!inInventory(player, item)) {
|
||||
sendMessage(player, "You need a ${getItemName(item)}")
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
fun spawnPartyMembers(){
|
||||
//1
|
||||
|
|
@ -182,8 +292,13 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
val RedLeader4 = Location.create(1884, 5456, 0)
|
||||
val RedLeader5 = Location.create(1888, 5456, 0)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
object BA_ARENA {
|
||||
const val MAIN = 7509
|
||||
const val QUEEN = 7508
|
||||
val all = listOf(MAIN, QUEEN)
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,123 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.arena.LureItem
|
||||
import core.api.*
|
||||
import core.game.component.Component
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.GameWorld
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.build.DynamicRegion
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneRestriction
|
||||
import core.tools.Log
|
||||
import core.tools.RandomFunction
|
||||
import core.tools.secondsToTicks
|
||||
import org.rs09.consts.NPCs
|
||||
import kotlin.math.ceil
|
||||
|
||||
class BarbassaultSession(val activity: BarbassaultSession? = null) : MapArea {
|
||||
constructor(region: DynamicRegion, activity: BarbassaultSession) : this(activity) {this.region = region; this.base = region.baseLocation}
|
||||
var players: ArrayList<Player> = ArrayList()
|
||||
val LureItemNodes = mutableListOf<LureItem>()
|
||||
lateinit var region: DynamicRegion
|
||||
lateinit var base: Location
|
||||
var isActive = false
|
||||
val npcs = ArrayList<NPC>()
|
||||
var inactiveTicks = 0
|
||||
var timeLeft = secondsToTicks(600)
|
||||
|
||||
|
||||
fun start(pl: ArrayList<Player>){
|
||||
region.setMusicId(434)
|
||||
// region.setMusicId(51)
|
||||
this.players.addAll(pl)
|
||||
isActive = true
|
||||
|
||||
GameWorld.Pulser.submit(BarbassPulse(this))
|
||||
for(player in pl){
|
||||
//player.interfaceManager.openOverlay(Component(OVERLAY_ID))
|
||||
//player.interfaceManager.open(Component(TUTORIAL_ID))
|
||||
//updateOverlay(player)
|
||||
player.properties.teleportLocation = base.transform(36,24,0)
|
||||
player.setAttribute("ba-session",this)
|
||||
registerLogoutListener(player, "ba-logout") {
|
||||
val session = player.getAttribute<BarbassaultSession?>("ba-session",null) ?: return@registerLogoutListener
|
||||
player.location = Location.create(2667, 3161, 0) //return to
|
||||
session.players.remove(player)
|
||||
player.locks.unlockTeleport()
|
||||
}
|
||||
}
|
||||
zone.register(getRegionBorders(region.id))
|
||||
}
|
||||
|
||||
class BarbassPulse(val session: BarbassaultSession) : Pulse(){
|
||||
var ticks = 0
|
||||
override fun pulse(): Boolean {
|
||||
ticks++
|
||||
session.timeLeft--
|
||||
//session.zone.unregister(getRegionBorders(session.region.id))
|
||||
|
||||
if(session.timeLeft <= 0){
|
||||
session.isActive = false
|
||||
for(player in session.players){
|
||||
player.interfaceManager.closeOverlay()
|
||||
player.properties.teleportLocation = Location.create(2666, 3162, 0) // return to
|
||||
// player.incrementAttribute("/save:$STATS_BASE:$FISHING_TRAWLER_GAMES_WON")
|
||||
player.removeAttribute("ba-session")
|
||||
clearLogoutListener(player, "ba-logout")
|
||||
}
|
||||
session.zone.unregister(getRegionBorders(session.region.id))
|
||||
}
|
||||
|
||||
for(player in session.players){
|
||||
//session.updateOverlay(player)
|
||||
if(session.timeLeft <= 1) {
|
||||
lockInteractions(player, 2)
|
||||
}
|
||||
}
|
||||
return !session.isActive
|
||||
}
|
||||
}
|
||||
|
||||
fun clearNPCs(){
|
||||
npcs.forEach {
|
||||
it.clear()
|
||||
}
|
||||
npcs.clear()
|
||||
}
|
||||
|
||||
fun initCannons(){
|
||||
// NPC.create(NPCs.EGG_LAUNCHER_5026, Location.create(1896, 5474, 0), Direction.NORTH),
|
||||
// NPC.create(NPCs.EGG_LAUNCHER_5026, Location.create(1877, 5474, 0), Direction.NORTH)
|
||||
for(loc in arrayOf(base.transform(38,17,0),
|
||||
base.transform(33,18,0))){
|
||||
val npc = NPC(NPCs.EGG_LAUNCHER_5026)
|
||||
npc.location = loc
|
||||
npcs.add(npc)
|
||||
npc.isRespawn = false
|
||||
npc.isWalks = false
|
||||
npc.init()
|
||||
}
|
||||
}
|
||||
|
||||
override fun defineAreaBorders(): Array<ZoneBorders> {
|
||||
return arrayOf()
|
||||
}
|
||||
|
||||
override fun getRestrictions(): Array<ZoneRestriction> {
|
||||
return arrayOf(ZoneRestriction.CANNON, ZoneRestriction.FIRES, ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.TELEPORT)
|
||||
}
|
||||
|
||||
override fun areaEnter(entity: Entity) {
|
||||
super.areaEnter(entity)
|
||||
log(this::class.java, Log.FINE, "ENTERED BarbAssault")
|
||||
}
|
||||
|
||||
override fun areaLeave(entity: Entity, logout: Boolean) {
|
||||
super.areaLeave(entity, logout)
|
||||
log(this::class.java, Log.FINE, "EXITED BarbAssault")
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import core.game.node.Node
|
||||
import core.game.node.item.GroundItem
|
||||
import core.game.node.item.Item
|
||||
import core.game.world.map.Location
|
||||
import org.rs09.consts.Items
|
||||
|
||||
|
||||
data class LureItem(val item: Node, val location: Location, val isGood: Boolean)
|
||||
|
||||
val LureItems = intArrayOf(Items.WORMS_10515, Items.CRACKERS_10513, Items.TOFU_10514)
|
||||
val LureItemNodes = mutableListOf<LureItem>()
|
||||
//todo make this part of miniGame instance instead of global.
|
||||
|
||||
fun addItemNode(item: GroundItem, location: Location, isGood: Boolean) {
|
||||
LureItemNodes.add(LureItem(item, location, isGood))
|
||||
}
|
||||
|
||||
fun findClosestLure(target: Location): LureItem? {
|
||||
return LureItemNodes.minByOrNull { node ->
|
||||
val dx = node.location.x - target.x
|
||||
val dy = node.location.y - target.y
|
||||
Math.abs(dx) + Math.abs(dy)
|
||||
}
|
||||
}
|
||||
|
||||
fun removeLure(lure: LureItem) {
|
||||
LureItemNodes.remove(lure)
|
||||
}
|
||||
|
||||
fun removeLureAtLocation(item: Item, location: Location): Boolean {
|
||||
return LureItemNodes.removeIf { it.item == item && it.location == location }
|
||||
}
|
||||
|
|
@ -5,6 +5,13 @@ import core.game.node.entity.npc.NPC
|
|||
import core.game.node.entity.npc.NPCBehavior
|
||||
import core.game.world.map.Location
|
||||
import org.rs09.consts.NPCs
|
||||
import content.minigame.barbassault.arena.*
|
||||
import core.api.forceWalk
|
||||
import core.api.removeGroundItem
|
||||
import core.api.sendChat
|
||||
import core.game.node.item.GroundItem
|
||||
import core.game.node.item.GroundItemManager
|
||||
|
||||
|
||||
val PENANCE_RUNNER_IDS = listOf(
|
||||
NPCs.PENANCE_RUNNER_5042,
|
||||
|
|
@ -18,7 +25,7 @@ val PENANCE_RUNNER_IDS = listOf(
|
|||
NPCs.PENANCE_RUNNER_5227,
|
||||
NPCs.PENANCE_RUNNER_5228,
|
||||
)
|
||||
class PenanceRunnerNPC : NPCBehavior(*PENANCE_RANGER_IDS.toIntArray()) {
|
||||
class PenanceRunnerNPC : NPCBehavior(*PENANCE_RUNNER_IDS.toIntArray()) {
|
||||
val GOOD_EAT = "Chomp, chomp"
|
||||
val BAD_EAT = "Blurghh"
|
||||
val TRAP_HIT = "Urghhh!"
|
||||
|
|
@ -29,12 +36,31 @@ class PenanceRunnerNPC : NPCBehavior(*PENANCE_RANGER_IDS.toIntArray()) {
|
|||
override fun onCreation(self: NPC) {
|
||||
self.isWalks = true
|
||||
self.walkRadius = 22
|
||||
self.destinationFlag
|
||||
|
||||
}
|
||||
|
||||
override fun tick(self: NPC): Boolean {
|
||||
val gotohere = findClosestLure(self.location)
|
||||
if (gotohere != null) {
|
||||
forceWalk(self,gotohere.location ,"DUMB")
|
||||
if (self.location == gotohere.location) {
|
||||
sendChat(self,if (gotohere.isGood) GOOD_EAT else BAD_EAT)
|
||||
removeGroundItem(gotohere.item as GroundItem)
|
||||
//GroundItemManager.destroy(gotohere.item)
|
||||
removeLure(gotohere)
|
||||
self.resetWalk()
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
fun seekFood(){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
package content.minigame.barbassault.arena.scenery
|
||||
|
||||
import content.minigame.barbassault.arena.machines.ItemMachine.Companion.addArrayOfItems
|
||||
import content.minigame.barbassault.arena.monsters.PENANCE_RUNNER_IDS
|
||||
import core.api.*
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
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 org.rs09.consts.Items
|
||||
import org.rs09.consts.Scenery
|
||||
|
||||
|
||||
// RUNNER_TRAP2_20135
|
||||
|
|
@ -55,25 +61,47 @@ class DefenderTrap : MapArea {
|
|||
}
|
||||
|
||||
fun killRunner(entity: Entity){
|
||||
entity.sendChat(TRAP_HIT)
|
||||
entity.startDeath(entity)
|
||||
var thistrap = Location.create(1901, 5474, 0)
|
||||
val scenery = getScenery(thistrap)
|
||||
//animateScenery(scenery!!, 5076)//5076
|
||||
|
||||
}
|
||||
|
||||
|
||||
//step on to trap area, if good food "chomp chomp" stay in location
|
||||
//set trap off
|
||||
|
||||
fun updateTrap(location: Location) {
|
||||
var thistrap = Location.create(1901, 5474, 0)
|
||||
val scenery = getScenery(thistrap)
|
||||
animateScenery(scenery!!, 5076)//5076
|
||||
GameWorld.Pulser.submit(object : Pulse(3, scenery) {
|
||||
override fun pulse(): Boolean {
|
||||
replaceScenery(scenery,Scenery.RUNNER_TRAP1_20230,-1,thistrap)
|
||||
return true
|
||||
}
|
||||
})
|
||||
|
||||
//replaceScenery(getScenery(thistrap)!!,Scenery.RUNNER_TRAP1_20230,-1,thistrap)
|
||||
if (TRAPS.contains(location)){
|
||||
// replaceScenery(getScenery(location)!!,Scenery.RUNNER_TRAP1_20230,40,location)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fun sendMessageArea(){
|
||||
playersInArea.forEach { player ->
|
||||
sendMessage(player,"Entered Trap Area")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//you fixed the Penance Runner trap.
|
||||
//sendMessage(player,"A Penance Runner broke a trap to the east/west!") //When a runner dies to trap announce to Defenders
|
||||
//replaceScenery()
|
||||
//animateScenery
|
||||
//5076
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ import core.game.node.item.Item
|
|||
import core.game.system.task.Pulse
|
||||
import core.game.world.GameWorld.ticks
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import core.game.world.map.build.DynamicRegion
|
||||
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Scenery
|
||||
|
|
@ -123,6 +125,9 @@ class BarbassaultLobby : InteractionListener, MapArea {
|
|||
on(Scenery.LADDER_20193, IntType.SCENERY, "Climb-down") { player, _ ->
|
||||
closeOverlay(player) // close party,
|
||||
openOverlay(player, 494)// open countdown, Make a Count DownHandler
|
||||
//start a session
|
||||
// val session = BarbassaultSession(DynamicRegion.create(8011), activity!!)
|
||||
// session.start(intArrayOf(player))
|
||||
return@on true
|
||||
}
|
||||
on(Scenery.DOOR_20209, IntType.SCENERY, "Pass") { player, node ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue