mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-21 18:35:11 -06:00
Fill healer vials with USE vails on Spring
This commit is contained in:
parent
f44ec73f95
commit
2cea22e8d1
1 changed files with 33 additions and 24 deletions
|
|
@ -16,6 +16,7 @@ import core.api.*
|
|||
import core.game.global.action.ClimbActionHandler
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.InteractionListeners
|
||||
import core.game.interaction.QueueStrength
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.Entity
|
||||
|
|
@ -33,6 +34,7 @@ import core.game.world.map.Direction
|
|||
import core.game.world.map.Location
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.game.world.update.flag.context.Graphics
|
||||
import org.rs09.consts.Animations
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Scenery
|
||||
|
||||
|
|
@ -149,45 +151,40 @@ class BarbassaultArenaListener : InteractionListener {
|
|||
}
|
||||
|
||||
onUseWithPlayer(*All_HEALING_VIALS) { player, _, target ->
|
||||
//todo quescirpt this and emote
|
||||
target as Player
|
||||
//todo find Healing sound
|
||||
if (target.skills.lifepoints >= target.skills.maximumLifepoints) {
|
||||
sendMessage(player, "The player's hitpoints are full.")
|
||||
return@onUseWithPlayer true
|
||||
}
|
||||
|
||||
val current = All_HEALING_VIALS.firstOrNull { player.inventory.containsAtLeastOneItem(it) }?: return@onUseWithPlayer true
|
||||
val index = All_HEALING_VIALS.indexOf(current)
|
||||
|
||||
if (index > 0) {
|
||||
val session = getBASession(player)
|
||||
val next = All_HEALING_VIALS[index - 1]
|
||||
player.inventory.remove(Item(current))
|
||||
player.inventory.add(Item(next))
|
||||
queueScript(player, 0) {
|
||||
val session = getBASession(player)
|
||||
val next = All_HEALING_VIALS[index - 1]
|
||||
player.inventory.remove(Item(current))
|
||||
player.inventory.add(Item(next))
|
||||
|
||||
val restoreAmount = minOf(getHealerHealAmount(player) ,target.skills.maximumLifepoints - target.skills.lifepoints)
|
||||
sendMessage(target,"You've been healed $restoreAmount hitpoints.")
|
||||
sendMessage(player,"You healed $restoreAmount hitpoints.")
|
||||
heal(target, restoreAmount)
|
||||
target.settings.updateRunEnergy((-restoreAmount).toDouble())
|
||||
session?.updateBarbHealerIfaceHPOfPlayer(target)
|
||||
val restoreAmount =
|
||||
minOf(getHealerHealAmount(player), target.skills.maximumLifepoints - target.skills.lifepoints)
|
||||
sendMessage(target, "You've been healed $restoreAmount hitpoints.")
|
||||
sendMessage(player, "You healed $restoreAmount hitpoints.")
|
||||
player.animate(Animation(537))
|
||||
heal(target, restoreAmount)
|
||||
target.settings.updateRunEnergy((-restoreAmount).toDouble())
|
||||
session?.updateBarbHealerIfaceHPOfPlayer(target)
|
||||
session?.eventBus?.emit(HitpointsHealed(player, restoreAmount))
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
|
||||
session?.eventBus?.emit(HitpointsHealed(player,restoreAmount))
|
||||
}
|
||||
|
||||
return@onUseWithPlayer true
|
||||
}
|
||||
on(Scenery.HEALER_SPRING_20150, IntType.SCENERY, "Take-from") { player, _ ->
|
||||
//todo quescript this
|
||||
player.animate(Animation(5400))
|
||||
if (player.inventory.containsAtLeastOneItem(All_HEALING_VIALS)) {
|
||||
val current = All_HEALING_VIALS.firstOrNull { player.inventory.containsAtLeastOneItem(it) } ?: return@on true
|
||||
player.inventory.remove(Item(current))
|
||||
player.inventory.add(Item(Items.HEALING_VIAL4_10542))
|
||||
sendMessage(player,"You filled the vial.")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
on(Scenery.HEALER_SPRING_20150, IntType.SCENERY, "Take-from") { player, _ -> fillHealerVial(player); return@on true }
|
||||
onUseAnyWith( IntType.SCENERY,Scenery.HEALER_SPRING_20150,*All_HEALING_VIALS) { player, used, with -> fillHealerVial(player); return@onUseAnyWith true}
|
||||
|
||||
onUnequip(ROLE_ICON) { player, _ ->
|
||||
if (getBASession(player)?.state == BarbassaultState.IN_ARENA){
|
||||
|
|
@ -314,6 +311,18 @@ class BarbassaultArenaListener : InteractionListener {
|
|||
val level = getBALevels(player).heal
|
||||
return healerHealAmounts.getOrElse(level) { healerHealAmounts.last() }
|
||||
}
|
||||
fun fillHealerVial(player: Player){
|
||||
queueScript(player,1, QueueStrength.STRONG) {
|
||||
if (player.inventory.containsAtLeastOneItem(All_HEALING_VIALS)) {
|
||||
val current = All_HEALING_VIALS.firstOrNull { player.inventory.containsAtLeastOneItem(it) } ?: return@queueScript stopExecuting(player)
|
||||
player.animate(Animation(5400))
|
||||
player.inventory.remove(Item(current))
|
||||
player.inventory.add(Item(Items.HEALING_VIAL4_10542))
|
||||
sendMessage(player, "You filled the vial.")
|
||||
}
|
||||
return@queueScript stopExecuting(player)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object BACombatValidation {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue