mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-22 02:45:10 -06:00
BarbassaultPlayerExtensions moving stuff around
This commit is contained in:
parent
2507ed00e7
commit
ddb8df4a94
25 changed files with 210 additions and 241 deletions
|
|
@ -1,18 +0,0 @@
|
|||
package content.minigame.barbassault
|
||||
|
||||
import core.api.MapArea
|
||||
import core.api.getRegionBorders
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneType
|
||||
|
||||
class BarbAssaultArea : MapArea {
|
||||
override fun defineAreaBorders(): Array<ZoneBorders> {
|
||||
return arrayOf(getRegionBorders(7509))
|
||||
}
|
||||
|
||||
override fun areaEnter(entity: Entity) {
|
||||
zone.zoneType = ZoneType.SAFE.id
|
||||
super.areaEnter(entity)
|
||||
}
|
||||
}
|
||||
|
|
@ -13,80 +13,7 @@ data class BarbAssaultPoints( val atk: Int = 0, val col: Int = 0, val def: Int =
|
|||
operator fun plus(other: BarbAssaultPoints): BarbAssaultPoints = BarbAssaultPoints(atk + other.atk,col + other.col,def + other.def,heal + other.heal).clamped()
|
||||
fun clamped(): BarbAssaultPoints = BarbAssaultPoints(atk.coerceIn(0, 500), col.coerceIn(0, 500), def.coerceIn(0, 500), heal.coerceIn(0, 500) )
|
||||
}
|
||||
/**
|
||||
* Retrieves the player's current Barbarian Assault points.
|
||||
*
|
||||
* @return [BarbAssaultPoints] representing the player's stored points in each role:
|
||||
* - `atk`: Attacker points
|
||||
* - `col`: Collector points
|
||||
* - `def`: Defender points
|
||||
* - `heal`: Healer points
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* val points = player.getBarbPoints()
|
||||
* println("Attacker points: ${points.atk}")
|
||||
* ```
|
||||
*/
|
||||
fun Player.getBarbPoints(): BarbAssaultPoints = BarbAssaultPoints(
|
||||
getAttribute("barbass:atk-points", 0),
|
||||
getAttribute("barbass:col-points", 0),
|
||||
getAttribute("barbass:def-points", 0),
|
||||
getAttribute("barbass:heal-points", 0)
|
||||
)
|
||||
/**
|
||||
* Sets the player's Barbarian Assault role points, clamping each to the allowed range (0 to 500)
|
||||
* and saving them to persistent storage.
|
||||
*
|
||||
* @param points [BarbAssaultPoints] containing the new point values for each role:
|
||||
* - `atk`: Attacker points
|
||||
* - `col`: Collector points
|
||||
* - `def`: Defender points
|
||||
* - `heal`: Healer points
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* val newPoints = BarbAssaultPoints(atk = 120, col = 80, def = 200, heal = 0)
|
||||
* player.setBarbPoints(newPoints)
|
||||
* ```
|
||||
*/
|
||||
fun Player.setBarbPoints(points: BarbAssaultPoints) {
|
||||
val rolePoints = points.clamped()
|
||||
setAttribute("/save:barbass:atk-points", rolePoints.atk)
|
||||
setAttribute("/save:barbass:col-points", rolePoints.col)
|
||||
setAttribute("/save:barbass:def-points", rolePoints.def)
|
||||
setAttribute("/save:barbass:heal-points", rolePoints.heal)
|
||||
}
|
||||
/**
|
||||
* Adds Barbarian Assault points to the player.
|
||||
*
|
||||
* @param additional The points to be added to the player's current Barbarian Assault points.
|
||||
* Values will be automatically clamped between 0 and 500.
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* // Give the player 30 attacker points and 10 collector points
|
||||
* player.addBarbPoints(BarbAssaultPoints(atk = 30, col = 10, def = 0, heal = 0))
|
||||
* ```
|
||||
*/
|
||||
fun Player.addBarbPoints(additional: BarbAssaultPoints) {
|
||||
setBarbPoints(getBarbPoints() + additional)
|
||||
}
|
||||
/**
|
||||
* Removes Barbarian Assault points from the player.
|
||||
*
|
||||
* @param toRemove The points to be subtracted from the player's current Barbarian Assault points.
|
||||
* Values will be clamped so that no role goes below 0.
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* // Remove 15 attacker points and 5 defender points
|
||||
* player.removeBarbPoints(BarbAssaultPoints(atk = 15, col = 0, def = 5, heal = 0))
|
||||
* ```
|
||||
*/
|
||||
fun Player.removeBarbPoints(toRemove: BarbAssaultPoints) {
|
||||
setBarbPoints(getBarbPoints() - toRemove)
|
||||
}
|
||||
|
||||
|
||||
data class BarbAssaultLevels(val atk: Int, val col: Int, val def: Int, val heal: Int) {
|
||||
fun clamped(): BarbAssaultLevels = BarbAssaultLevels(
|
||||
|
|
@ -94,76 +21,6 @@ data class BarbAssaultLevels(val atk: Int, val col: Int, val def: Int, val heal:
|
|||
)
|
||||
}
|
||||
|
||||
fun Player.hasQueenKill(): Boolean = getAttribute("barbass:queen-kill", 0) > 0
|
||||
/**
|
||||
* Retrieves the player's Barbarian Assault role levels from their saved attributes.
|
||||
* Defaults to level 1 for any role if not previously set.
|
||||
*
|
||||
* @return [BarbAssaultLevels] containing the level for each role:
|
||||
* - `atk`: Attacker level
|
||||
* - `col`: Collector level
|
||||
* - `def`: Defender level
|
||||
* - `heal`: Healer level
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* val levels = player.getBarbLevels()
|
||||
* println("Attacker Level: ${levels.atk}")
|
||||
* ```
|
||||
*/
|
||||
fun Player.getBarbLevels(): BarbAssaultLevels = BarbAssaultLevels(
|
||||
getAttribute("barbass:atk-level", 1),
|
||||
getAttribute("barbass:col-level", 1),
|
||||
getAttribute("barbass:def-level", 1),
|
||||
getAttribute("barbass:heal-level", 1)
|
||||
)
|
||||
/**
|
||||
* Sets the player's Barbarian Assault role levels and saves them to persistent attributes.
|
||||
*
|
||||
* @param levels The [BarbAssaultLevels] object containing levels for each role:
|
||||
* - `atk`: Attacker level (1–5)
|
||||
* - `col`: Collector level (1–5)
|
||||
* - `def`: Defender level (1–5)
|
||||
* - `heal`: Healer level (1–5)
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* val newLevels = BarbAssaultLevels(atk = 2, col = 1, def = 3, heal = 1)
|
||||
* player.setBarbLevels(newLevels)
|
||||
* ```
|
||||
*/
|
||||
fun Player.setBarbLevels(levels: BarbAssaultLevels) {
|
||||
setAttribute("/save:barbass:atk-level", levels.atk)
|
||||
setAttribute("/save:barbass:col-level", levels.col)
|
||||
setAttribute("/save:barbass:def-level", levels.def)
|
||||
setAttribute("/save:barbass:heal-level", levels.heal)
|
||||
}
|
||||
/**
|
||||
* Increases the level of the specified Barbarian Assault role by 1, up to a maximum of 5.
|
||||
*
|
||||
* Only one role can be increased at a time. The result is clamped to ensure the level does not exceed 5.
|
||||
*
|
||||
* @param role The [BarbRole] to increase the level of. Must be one of:
|
||||
* - `BarbRole.ATTACKER`
|
||||
* - `BarbRole.COLLECTOR`
|
||||
* - `BarbRole.DEFENDER`
|
||||
* - `BarbRole.HEALER`
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* player.increaseBarbRoleLevel(BarbRole.ATTACKER)
|
||||
* ```
|
||||
*/
|
||||
fun Player.increaseBarbRoleLevel(role: BarbRole) {
|
||||
val current = getBarbLevels()
|
||||
val newLevels = when (role) {
|
||||
BarbRole.ATTACKER -> current.copy(atk = current.atk + 1)
|
||||
BarbRole.COLLECTOR -> current.copy(col = current.col + 1)
|
||||
BarbRole.DEFENDER -> current.copy(def = current.def + 1)
|
||||
BarbRole.HEALER -> current.copy(heal = current.heal + 1)
|
||||
}.clamped()
|
||||
setBarbLevels(newLevels)
|
||||
}
|
||||
fun BarbAssaultLevels.getLevel(role: BarbRole): Int = when (role) {
|
||||
BarbRole.ATTACKER -> atk
|
||||
BarbRole.COLLECTOR -> col
|
||||
|
|
|
|||
|
|
@ -0,0 +1,185 @@
|
|||
package content.minigame.barbassault
|
||||
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import core.game.node.entity.player.Player
|
||||
|
||||
private const val BA_SESSION_KEY = "ba-session"
|
||||
/**
|
||||
* Gets or sets the player's current Barbarian Assault session.
|
||||
*
|
||||
* This property provides convenient access to the player's active
|
||||
* [BarbassaultSession], if one exists.
|
||||
*
|
||||
* When setting:
|
||||
* - Assigning a non-null value will store the session on the player.
|
||||
* - Assigning `null` will remove the session attribute entirely.
|
||||
*
|
||||
* @return The current [BarbassaultSession] if the player is in a session,
|
||||
* or `null` if they are not participating in Barbarian Assault.
|
||||
*/
|
||||
var Player.baSession: BarbassaultSession?
|
||||
get() = getAttribute(BA_SESSION_KEY)
|
||||
set(value) {
|
||||
if (value == null) removeAttribute(BA_SESSION_KEY)
|
||||
else setAttribute(BA_SESSION_KEY, value)
|
||||
}
|
||||
|
||||
fun Player.isBAHealer(): Boolean {
|
||||
return baSession?.team?.isHealer(this) == true
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the player's current Barbarian Assault points.
|
||||
*
|
||||
* @return [BarbAssaultPoints] representing the player's stored points in each role:
|
||||
* - `atk`: Attacker points
|
||||
* - `col`: Collector points
|
||||
* - `def`: Defender points
|
||||
* - `heal`: Healer points
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* val points = player.getBarbPoints()
|
||||
* println("Attacker points: ${points.atk}")
|
||||
* ```
|
||||
*/
|
||||
fun Player.getBarbPoints(): BarbAssaultPoints = BarbAssaultPoints(
|
||||
getAttribute("barbass:atk-points", 0),
|
||||
getAttribute("barbass:col-points", 0),
|
||||
getAttribute("barbass:def-points", 0),
|
||||
getAttribute("barbass:heal-points", 0)
|
||||
)
|
||||
/**
|
||||
* Sets the player's Barbarian Assault role points, clamping each to the allowed range (0 to 500)
|
||||
* and saving them to persistent storage.
|
||||
*
|
||||
* @param points [BarbAssaultPoints] containing the new point values for each role:
|
||||
* - `atk`: Attacker points
|
||||
* - `col`: Collector points
|
||||
* - `def`: Defender points
|
||||
* - `heal`: Healer points
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* val newPoints = BarbAssaultPoints(atk = 120, col = 80, def = 200, heal = 0)
|
||||
* player.setBarbPoints(newPoints)
|
||||
* ```
|
||||
*/
|
||||
fun Player.setBarbPoints(points: BarbAssaultPoints) {
|
||||
val rolePoints = points.clamped()
|
||||
setAttribute("/save:barbass:atk-points", rolePoints.atk)
|
||||
setAttribute("/save:barbass:col-points", rolePoints.col)
|
||||
setAttribute("/save:barbass:def-points", rolePoints.def)
|
||||
setAttribute("/save:barbass:heal-points", rolePoints.heal)
|
||||
}
|
||||
/**
|
||||
* Adds Barbarian Assault points to the player.
|
||||
*
|
||||
* @param additional The points to be added to the player's current Barbarian Assault points.
|
||||
* Values will be automatically clamped between 0 and 500.
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* // Give the player 30 attacker points and 10 collector points
|
||||
* player.addBarbPoints(BarbAssaultPoints(atk = 30, col = 10, def = 0, heal = 0))
|
||||
* ```
|
||||
*/
|
||||
fun Player.addBarbPoints(additional: BarbAssaultPoints) {
|
||||
setBarbPoints(getBarbPoints() + additional)
|
||||
}
|
||||
/**
|
||||
* Removes Barbarian Assault points from the player.
|
||||
*
|
||||
* @param toRemove The points to be subtracted from the player's current Barbarian Assault points.
|
||||
* Values will be clamped so that no role goes below 0.
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* // Remove 15 attacker points and 5 defender points
|
||||
* player.removeBarbPoints(BarbAssaultPoints(atk = 15, col = 0, def = 5, heal = 0))
|
||||
* ```
|
||||
*/
|
||||
fun Player.removeBarbPoints(toRemove: BarbAssaultPoints) {
|
||||
setBarbPoints(getBarbPoints() - toRemove)
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the player has defeated the Penance Queen at least once.
|
||||
*
|
||||
* This is determined by the `"barbass:queen-kill"` attribute,
|
||||
* which tracks the number of successful Queen kills.
|
||||
*
|
||||
* @return `true` if the player has one or more Queen kills,
|
||||
* otherwise `false`.
|
||||
*/
|
||||
fun Player.hasQueenKill(): Boolean = getAttribute("barbass:queen-kill", 0) > 0
|
||||
|
||||
/**
|
||||
* Retrieves the player's Barbarian Assault role levels from their saved attributes.
|
||||
* Defaults to level 1 for any role if not previously set.
|
||||
*
|
||||
* @return [BarbAssaultLevels] containing the level for each role:
|
||||
* - `atk`: Attacker level
|
||||
* - `col`: Collector level
|
||||
* - `def`: Defender level
|
||||
* - `heal`: Healer level
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* val levels = player.getBarbLevels()
|
||||
* println("Attacker Level: ${levels.atk}")
|
||||
* ```
|
||||
*/
|
||||
fun Player.getBarbLevels(): BarbAssaultLevels = BarbAssaultLevels(
|
||||
getAttribute("barbass:atk-level", 1),
|
||||
getAttribute("barbass:col-level", 1),
|
||||
getAttribute("barbass:def-level", 1),
|
||||
getAttribute("barbass:heal-level", 1)
|
||||
)
|
||||
/**
|
||||
* Sets the player's Barbarian Assault role levels and saves them to persistent attributes.
|
||||
*
|
||||
* @param levels The [BarbAssaultLevels] object containing levels for each role:
|
||||
* - `atk`: Attacker level (1–5)
|
||||
* - `col`: Collector level (1–5)
|
||||
* - `def`: Defender level (1–5)
|
||||
* - `heal`: Healer level (1–5)
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* val newLevels = BarbAssaultLevels(atk = 2, col = 1, def = 3, heal = 1)
|
||||
* player.setBarbLevels(newLevels)
|
||||
* ```
|
||||
*/
|
||||
fun Player.setBarbLevels(levels: BarbAssaultLevels) {
|
||||
setAttribute("/save:barbass:atk-level", levels.atk)
|
||||
setAttribute("/save:barbass:col-level", levels.col)
|
||||
setAttribute("/save:barbass:def-level", levels.def)
|
||||
setAttribute("/save:barbass:heal-level", levels.heal)
|
||||
}
|
||||
/**
|
||||
* Increases the level of the specified Barbarian Assault role by 1, up to a maximum of 5.
|
||||
*
|
||||
* Only one role can be increased at a time. The result is clamped to ensure the level does not exceed 5.
|
||||
*
|
||||
* @param role The [BarbRole] to increase the level of. Must be one of:
|
||||
* - `BarbRole.ATTACKER`
|
||||
* - `BarbRole.COLLECTOR`
|
||||
* - `BarbRole.DEFENDER`
|
||||
* - `BarbRole.HEALER`
|
||||
*
|
||||
* Example usage:
|
||||
* ```
|
||||
* player.increaseBarbRoleLevel(BarbRole.ATTACKER)
|
||||
* ```
|
||||
*/
|
||||
fun Player.increaseBarbRoleLevel(role: BarbRole) {
|
||||
val current = getBarbLevels()
|
||||
val newLevels = when (role) {
|
||||
BarbRole.ATTACKER -> current.copy(atk = current.atk + 1)
|
||||
BarbRole.COLLECTOR -> current.copy(col = current.col + 1)
|
||||
BarbRole.DEFENDER -> current.copy(def = current.def + 1)
|
||||
BarbRole.HEALER -> current.copy(heal = current.heal + 1)
|
||||
}.clamped()
|
||||
setBarbLevels(newLevels)
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.inInventory
|
||||
import core.api.sendChat
|
||||
import core.api.sendMessage
|
||||
|
|
|
|||
|
|
@ -2,23 +2,17 @@ package content.minigame.barbassault
|
|||
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.arena.BarbassaultState
|
||||
import content.minigame.barbassault.lobby.BarbassaultLobby
|
||||
import content.minigame.barbassault.lobby.BarbassaultLobby.Companion.waveLobbies
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import core.api.log
|
||||
import core.api.sendMessage
|
||||
import core.game.activity.ActivityManager
|
||||
import core.game.activity.ActivityPlugin
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.combat.CombatStyle
|
||||
import core.game.node.entity.impl.PulseManager
|
||||
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.ZoneRestriction
|
||||
import core.game.world.map.zone.ZoneType
|
||||
import core.plugin.Initializable
|
||||
import core.tools.Log
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,9 @@ 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
|
||||
import content.minigame.barbassault.arena.scenery.EggCannon.Companion.showEggHopperCount
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.getBarbLevels
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.isBAHealer
|
||||
import core.api.*
|
||||
import core.game.global.action.ClimbActionHandler
|
||||
import core.game.global.action.DropListener
|
||||
|
|
@ -168,12 +169,12 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
//you healed $heal.count hitpoints.
|
||||
//You've been healed $amount hitpoints and your poison cured.
|
||||
on(Scenery.HEALER_SPRING_20150, IntType.SCENERY, "Drink-from") { player, _ ->
|
||||
//you need to be a healer to drink from spring
|
||||
if (getItemFromEquipment(player, EquipmentSlot.CAPE)?.id == 10559) {
|
||||
if (player.isBAHealer()) {
|
||||
player.animate(Animation(5407))
|
||||
player.lock(5)
|
||||
GameWorld.Pulser.submit(object : Pulse(3, player) {
|
||||
override fun pulse(): Boolean {
|
||||
//todo switch to Healer level instead of Horn in inv
|
||||
val healAmount = getHealerHorn(player)?.healAmount ?: 10
|
||||
//Should also restore run energy Amount
|
||||
heal(player, healAmount)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ 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.baSession
|
||||
import content.minigame.barbassault.getBarbLevels
|
||||
import content.minigame.barbassault.lobby.*
|
||||
import core.api.*
|
||||
|
|
@ -149,7 +150,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
state = BarbassaultState.FORFEIT
|
||||
}
|
||||
|
||||
fun isBarbAssaultGame() = state == BarbassaultState.IN_ARENA
|
||||
fun isInBarbAssaultGame() = state == BarbassaultState.IN_ARENA
|
||||
|
||||
fun endGame(endReason: String){
|
||||
eventBus.clear()
|
||||
|
|
|
|||
|
|
@ -1,11 +1,8 @@
|
|||
package content.minigame.barbassault.arena
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.lobby.BarbTeam
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import core.api.sendItemZoomOnInterface
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.setComponentVisibility
|
||||
import core.api.setInterfaceModel
|
||||
import core.api.setInterfaceText
|
||||
import core.game.component.Component
|
||||
import core.game.component.ComponentDefinition
|
||||
|
|
|
|||
|
|
@ -1,16 +1,13 @@
|
|||
package content.minigame.barbassault.arenas.monsters
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.arena.BaHornSystem
|
||||
import content.minigame.barbassault.arena.BarbAssEvent
|
||||
import content.minigame.barbassault.arena.BarbAssaultCombat
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.*
|
||||
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.combat.ImpactHandler
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.npc.NPCBehavior
|
||||
import core.game.node.entity.player.Player
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package content.minigame.barbassault.arena.monsters
|
|||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.arena.BarbAssEvent
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.npc.NPCBehavior
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package content.minigame.barbassault.arena.monsters
|
|||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.arena.BarbAssEvent
|
||||
import content.minigame.barbassault.arena.BarbAssaultCombat
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.*
|
||||
import core.api.getItemFromEquipment
|
||||
import core.game.node.entity.Entity
|
||||
|
|
|
|||
|
|
@ -4,16 +4,14 @@ import content.minigame.barbassault.BarbRole
|
|||
import core.game.node.entity.Entity
|
||||
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 content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.forceWalk
|
||||
import core.api.removeGroundItem
|
||||
import core.api.sendChat
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.GroundItem
|
||||
import core.game.node.item.GroundItemManager
|
||||
|
||||
|
||||
val PENANCE_RUNNER_IDS = listOf(
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
package content.minigame.barbassault.arena.scenery
|
||||
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.arena.monsters.PENANCE_RUNNER_IDS
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
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
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package content.minigame.barbassault.arena.scenery
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.*
|
||||
import core.game.component.CloseEvent
|
||||
import core.game.component.Component
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ package content.minigame.barbassault.arena.scenery
|
|||
|
||||
import content.minigame.barbassault.arena.BaHornSystem.BaCall
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.*
|
||||
import core.game.component.Component
|
||||
import core.game.component.ComponentDefinition
|
||||
|
|
|
|||
|
|
@ -1,18 +1,11 @@
|
|||
package content.minigame.barbassault.bots
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.game.interaction.MovementPulse
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import core.tools.RandomFunction
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.launch
|
||||
import content.minigame.pestcontrol.PestControlHelper.GATE_ENTRIES
|
||||
import content.minigame.pestcontrol.PestControlHelper.getMyPestControlSession1
|
||||
import core.game.world.GameWorld
|
||||
import java.util.*
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import content.minigame.barbassault.lobby.BarbassQuickWaveActivity.Companion.add
|
|||
import content.minigame.barbassault.lobby.BarbassaultLobby.Companion.MAIN_LOBBY
|
||||
import content.minigame.barbassault.lobby.BarbassaultLobby.Companion.QUICK_START
|
||||
import content.minigame.barbassault.lobby.BarbassaultLobby.Companion.waveLobbies
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.forceMove
|
||||
import core.api.getRegionBorders
|
||||
import core.game.bots.CombatBotAssembler
|
||||
|
|
@ -15,7 +15,6 @@ import core.game.global.action.EquipHandler
|
|||
import core.game.node.item.Item
|
||||
import core.game.world.map.Location
|
||||
import org.rs09.consts.Scenery
|
||||
import java.util.*
|
||||
|
||||
class BarbassBot(l: Location) : PvMBots(legitimizeLocation(l)){
|
||||
init {
|
||||
|
|
|
|||
|
|
@ -1,13 +1,10 @@
|
|||
package content.minigame.barbassault.lobby
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.abandonTeam
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.joinTeam
|
||||
import content.minigame.barbassault.lobby.CurrentTeam.ROLE_MODEL_MAP
|
||||
import content.minigame.barbassault.lobby.CurrentTeam.modelZoom
|
||||
import core.api.closeInterface
|
||||
import core.api.sendMessage
|
||||
import core.api.setInterfaceModel
|
||||
import core.api.setInterfaceText
|
||||
import core.game.component.Component
|
||||
import core.game.component.ComponentDefinition
|
||||
|
|
|
|||
|
|
@ -4,39 +4,12 @@ import content.minigame.barbassault.BarbRole
|
|||
import content.minigame.barbassault.BarbassaultActivity
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.arena.BarbassaultState
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.getBarbLevels
|
||||
import core.api.clearLogoutListener
|
||||
import core.api.sendMessage
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.world.map.Location
|
||||
|
||||
|
||||
/*
|
||||
Player
|
||||
└─ attribute "ba-session"
|
||||
└─ BarbassaultSession : MapArea
|
||||
└─ team : BarbTeam
|
||||
└─ slots → Players
|
||||
*/
|
||||
|
||||
private const val BA_SESSION_KEY = "ba-session"
|
||||
|
||||
var Player.baSession: BarbassaultSession?
|
||||
get() = getAttribute(BA_SESSION_KEY)
|
||||
set(value) {
|
||||
if (value == null) removeAttribute(BA_SESSION_KEY)
|
||||
else setAttribute(BA_SESSION_KEY, value)
|
||||
}
|
||||
|
||||
/**
|
||||
private val playerTeams = mutableMapOf<Player, BarbTeam>()
|
||||
var Player.team: BarbTeam?
|
||||
get() = playerTeams[this]
|
||||
set(value) {
|
||||
if (value == null) playerTeams.remove(this)
|
||||
else playerTeams[this] = value
|
||||
}*/
|
||||
|
||||
data class PartySlot( val index: Int, val player: Player, var role: BarbRole? = null )
|
||||
data class PendingRecruit( var player: Player, var role: BarbRole? = null,var accept:Boolean = false ) {
|
||||
fun roleLevel(): Int = when (role) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package content.minigame.barbassault.lobby
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.createTeam
|
||||
import core.api.*
|
||||
import core.game.activity.ActivityManager
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package content.minigame.barbassault.lobby
|
|||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.arena.BarbassaultState
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.abandonTeam
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.createTeam
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.disbandTeam
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
package content.minigame.barbassault.lobby
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.baSession
|
||||
import content.minigame.barbassault.lobby.CurrentTeam.ROLE_MODEL_MAP
|
||||
import content.minigame.barbassault.lobby.CurrentTeam.modelZoom
|
||||
import core.api.sendMessage
|
||||
import core.api.setInterfaceModel
|
||||
import core.api.setInterfaceText
|
||||
import core.game.component.Component
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package content.minigame.barbassault.lobby
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.lobby.BarbTeamManager.joinTeam
|
||||
import content.minigame.barbassault.baSession
|
||||
import core.api.*
|
||||
import core.game.component.Component
|
||||
import core.game.component.ComponentDefinition
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package core.game.node.entity.combat;
|
|||
|
||||
import content.data.EnchantedJewellery;
|
||||
import content.minigame.barbassault.arena.BarbassaultSession;
|
||||
import content.minigame.barbassault.arena.BarbassaultState;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.summoning.familiar.Familiar;
|
||||
|
|
@ -208,7 +207,7 @@ public final class ImpactHandler {
|
|||
if (hit > 0) {
|
||||
BarbassaultSession session = p.getAttribute("ba-session");
|
||||
if (session != null) {
|
||||
if (session.getState() == BarbassaultState.IN_ARENA) {
|
||||
if (session.isInBarbAssaultGame()) {
|
||||
session.updateBarbHealerIfaceHPOfPlayer(p);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,12 +2,10 @@ package core.game.node.entity.player.link.prayer;
|
|||
|
||||
import content.data.Quests;
|
||||
import content.minigame.barbassault.arena.BarbassaultSession;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.skill.SkillBonus;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.world.map.zone.ZoneBorders;
|
||||
import core.tools.StringUtils;
|
||||
import core.game.event.*;
|
||||
import org.rs09.consts.Sounds;
|
||||
|
|
@ -225,7 +223,7 @@ public enum PrayerType {
|
|||
public boolean permitted(final Player player) {
|
||||
BarbassaultSession session = player.getAttribute("ba-session");
|
||||
if (session != null) {
|
||||
if (session.isBarbAssaultGame()) {
|
||||
if (session.isInBarbAssaultGame()) {
|
||||
//todo find correct message here
|
||||
sendMessage(player, "The barbarians do not allow the use of prayer in the arena.");
|
||||
toggle(player,false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue