mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-22 10:55:13 -06:00
giveRoleItems() for entering a game session
This commit is contained in:
parent
4e0c144bda
commit
5380fbe9ed
1 changed files with 71 additions and 12 deletions
|
|
@ -4,10 +4,8 @@ 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.BarbTeamManager
|
||||
import content.minigame.barbassault.lobby.BarbassaultLobby
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
import content.minigame.barbassault.getBarbLevels
|
||||
import content.minigame.barbassault.lobby.*
|
||||
import core.api.*
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.impl.PulseManager
|
||||
|
|
@ -26,6 +24,7 @@ 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
|
||||
|
||||
|
|
@ -62,8 +61,10 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
|
||||
for (player in team.allPlayers()) {
|
||||
zone.enter(player)
|
||||
player.baSession?.team?.getRoleForPlayer(player)?.let { equipBARoleIcon(player, it) }
|
||||
val pRole = player.baSession?.team?.getRoleForPlayer(player)
|
||||
equipBARoleIcon(player, pRole!!)
|
||||
player.properties.teleportLocation = team.spawnLocationFor(player) //base.transform(36, 24, 0)
|
||||
giveRoleItems(player,pRole)
|
||||
|
||||
registerLogoutListener(player, "ba-logout") { handleLogout(player) }
|
||||
}
|
||||
|
|
@ -103,8 +104,6 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
if (ticks <= 0) {
|
||||
enterArena()
|
||||
rollNewRoleCalls()
|
||||
//giveplayerHorns
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -145,7 +144,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
tracker.healerStats.wrongPoisonUsed++
|
||||
}
|
||||
}
|
||||
fun forfet(){
|
||||
fun forfeit(){
|
||||
state = BarbassaultState.FORFEIT
|
||||
}
|
||||
|
||||
|
|
@ -226,10 +225,28 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
region.flagInactive()
|
||||
|
||||
}
|
||||
val barbassItems = arrayOf(
|
||||
Item(ATTACKER_ICON),
|
||||
Item(Items.ATTACKER_HORN_10516), Item(Items.ATTACKER_HORN_10517), Item(Items.ATTACKER_HORN_10518), Item(Items.ATTACKER_HORN_10519), Item(Items.ATTACKER_HORN_10520),
|
||||
|
||||
Item(DEFENDER_ICON),
|
||||
Item(Items.WORMS_10515),Item(Items.CRACKERS_10513), Item(Items.TOFU_10514),
|
||||
Item(Items.LOGS_11760),Item(Items.HAMMER_2347),
|
||||
Item(Items.DEFENDER_HORN_10538),
|
||||
|
||||
Item(HEALER_ICON),
|
||||
Item(Items.HEALING_VIAL_10546),Item(Items.HEALING_VIAL1_10545),Item(Items.HEALING_VIAL2_10544),Item(Items.HEALING_VIAL3_10543),Item(Items.HEALING_VIAL4_10542),
|
||||
Item(Items.HEALER_HORN_10526),Item(Items.HEALER_HORN_10527),Item(Items.HEALER_HORN_10528),Item(Items.HEALER_HORN_10529),Item(Items.HEALER_HORN_10530),
|
||||
Item(Items.POISONED_WORMS_10540),Item(Items.POISONED_TOFU_10539),Item(Items.POISONED_MEAT_10541),
|
||||
|
||||
Item(COLLECTOR_ICON),
|
||||
Item(Items.COLLECTOR_HORN_10560),
|
||||
Item(Items.COLLECTION_BAG_10521),Item(Items.COLLECTION_BAG_10522),Item(Items.COLLECTION_BAG_10523),Item(Items.COLLECTION_BAG_10524),Item(Items.COLLECTION_BAG_10525),
|
||||
Item(Items.BLUE_EGG_10533),Item(Items.RED_EGG_10532),Item(Items.GREEN_EGG_10531),
|
||||
)
|
||||
private fun handleLogout(player: Player) {
|
||||
state = BarbassaultState.FORFEIT
|
||||
zone.cleanItems(player,arrayOf(Item(ATTACKER_ICON),Item(DEFENDER_ICON),Item(COLLECTOR_ICON),Item(HEALER_ICON)))
|
||||
zone.cleanItems(player,barbassItems)
|
||||
region.remove(player)
|
||||
team.removePlayer(player)
|
||||
player.locks.unlockTeleport()
|
||||
|
|
@ -264,6 +281,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
val wornIconId = getItemFromEquipment(player, EquipmentSlot.CAPE)?.id
|
||||
val interfaceId = getIconInterfaceId(wornIconId ?: -1)
|
||||
//waveLobbies[waveNum].randomWalkableLoc
|
||||
//todo consolidate logic.
|
||||
interfaceId?.let {
|
||||
sendMessage(player, "----- Wave: $waveNum -----")
|
||||
openOverlay(player, it)
|
||||
|
|
@ -276,8 +294,7 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
var player = entity as Player
|
||||
//exitMiniGame(player)
|
||||
removeTimer(player, "teleblock")
|
||||
zone.cleanItems(player,arrayOf(Item(ATTACKER_ICON),Item(DEFENDER_ICON),Item(COLLECTOR_ICON),Item(HEALER_ICON)))
|
||||
//region.remove(player)
|
||||
zone.cleanItems(player,barbassItems)//region.remove(player)
|
||||
clearLogoutListener(player, "ba-logout")
|
||||
|
||||
destroyArena()
|
||||
|
|
@ -295,8 +312,50 @@ class BarbassaultSession( val activity: BarbassaultActivity ? = null) :LogoutLi
|
|||
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 giveRoleItems(player: Player, role: BarbRole) {
|
||||
val levels = player.getBarbLevels()
|
||||
|
||||
val items = when (role) {
|
||||
BarbRole.ATTACKER -> when (levels.atk) {
|
||||
1 -> intArrayOf(Items.ATTACKER_HORN_10516)
|
||||
2 -> intArrayOf(Items.ATTACKER_HORN_10517)
|
||||
3 -> intArrayOf(Items.ATTACKER_HORN_10518)
|
||||
4 -> intArrayOf(Items.ATTACKER_HORN_10519)
|
||||
5 -> intArrayOf(Items.ATTACKER_HORN_10520)
|
||||
else -> intArrayOf(Items.ATTACKER_HORN_10516)
|
||||
}
|
||||
|
||||
BarbRole.DEFENDER -> when (levels.def) {
|
||||
|
||||
else -> intArrayOf(Items.DEFENDER_HORN_10538)
|
||||
}
|
||||
|
||||
BarbRole.HEALER -> when (levels.heal) {
|
||||
1 -> intArrayOf(Items.HEALER_HORN_10526)
|
||||
2 -> intArrayOf(Items.HEALER_HORN_10527)
|
||||
3 -> intArrayOf(Items.HEALER_HORN_10528)
|
||||
4 -> intArrayOf(Items.HEALER_HORN_10529)
|
||||
5 -> intArrayOf(Items.HEALER_HORN_10530)
|
||||
else -> intArrayOf(Items.HEALER_HORN_10526)
|
||||
}
|
||||
|
||||
BarbRole.COLLECTOR -> when (levels.col) {
|
||||
1 -> intArrayOf(Items.COLLECTION_BAG_10521,Items.COLLECTOR_HORN_10560)
|
||||
2 -> intArrayOf(Items.COLLECTION_BAG_10522,Items.COLLECTOR_HORN_10560)
|
||||
3 -> intArrayOf(Items.COLLECTION_BAG_10523,Items.COLLECTOR_HORN_10560)
|
||||
4 -> intArrayOf(Items.COLLECTION_BAG_10524,Items.COLLECTOR_HORN_10560)
|
||||
5 -> intArrayOf(Items.COLLECTION_BAG_10525,Items.COLLECTOR_HORN_10560)
|
||||
else -> intArrayOf(Items.COLLECTION_BAG_10521,Items.COLLECTOR_HORN_10560)
|
||||
}
|
||||
}
|
||||
|
||||
items.forEach { id ->
|
||||
player.inventory.add(Item(id, 1))
|
||||
}
|
||||
}
|
||||
private fun equipBARoleIcon(player: Player, role: BarbRole) {
|
||||
val BA_ROLE_CAPE = mapOf( BarbRole.ATTACKER to 10556, BarbRole.DEFENDER to 10558, BarbRole.COLLECTOR to 10557, BarbRole.HEALER to 10559 )
|
||||
val itemId = BA_ROLE_CAPE[role] ?: return
|
||||
player.equipment.add(Item(itemId),true,false)
|
||||
//player.getEquipment().add(Item(itemId), true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue