mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-23 03:15:10 -06:00
egg hopper related messages
This commit is contained in:
parent
e0e8f63dd4
commit
d2d50bb8c8
2 changed files with 12 additions and 7 deletions
|
|
@ -108,7 +108,7 @@ class BarbassaultGameArea : InteractionListener, MapArea {
|
|||
}
|
||||
on(Scenery.EGG_HOPPER_20264, IntType.SCENERY, "Load","Look-in") { player, node ->
|
||||
val loc = player.location
|
||||
//sendMessage(player,"You need to be a Collector to load eggs.")
|
||||
|
||||
val optionClicked = player.getAttribute<String>("interact:option")?.lowercase() ?: return@on false
|
||||
when(optionClicked){
|
||||
"load" -> loadEggHopper(player)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package content.minigame.barbassault.arena.scenery
|
||||
|
||||
import content.minigame.barbassault.BarbRole
|
||||
import content.minigame.barbassault.arena.BarbassaultSession
|
||||
import content.minigame.barbassault.lobby.CurrentTeam
|
||||
import content.minigame.barbassault.lobby.baSession
|
||||
|
|
@ -52,6 +53,7 @@ class EggCannon : ComponentPlugin() {
|
|||
//END BINKY//
|
||||
|
||||
data class EggHopperCount(var red: Int = 0,var blue: Int = 0, var green: Int = 0, var yellow: Int = 0 ){
|
||||
fun totalCount(): Int = red + blue + green + yellow
|
||||
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)
|
||||
|
|
@ -157,8 +159,8 @@ class EggCannon : ComponentPlugin() {
|
|||
return
|
||||
}
|
||||
}
|
||||
updateCannonUI(player)
|
||||
}
|
||||
updateCannonUI(player)
|
||||
}
|
||||
|
||||
fun updateCannonUI(player: Player?){
|
||||
|
|
@ -191,8 +193,10 @@ class EggCannon : ComponentPlugin() {
|
|||
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."
|
||||
if (player.baSession?.eggHopper?.totalCount() == 0) {
|
||||
sendDialogueLines(player,"There are no eggs in the hopper.")
|
||||
return
|
||||
}
|
||||
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)
|
||||
|
|
@ -200,8 +204,10 @@ class EggCannon : ComponentPlugin() {
|
|||
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)
|
||||
val role =session?.team?.getRoleForPlayer(player)
|
||||
if (role != BarbRole.COLLECTOR) {sendMessage(player,"You need to be a Collector to load eggs.");return}
|
||||
//get player inv eggs
|
||||
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??
|
||||
sendMessage(player,"Loading hopper")
|
||||
|
|
@ -213,7 +219,6 @@ class EggCannon : ComponentPlugin() {
|
|||
val explosive = eggsCount?.red
|
||||
val stun = eggsCount?.blue
|
||||
sendDialogueLines(player,"The hopper contains:","$poison poison eggs, $explosive explosive eggs","and $stun stun eggs.")
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue