forked from 2009Scape/Server
Rewrote Alchemy spells to use pulse, repeating up to 30 times
This commit is contained in:
parent
bbaa4bbdbe
commit
6305e2a718
1 changed files with 36 additions and 18 deletions
|
|
@ -30,6 +30,8 @@ import org.rs09.consts.Items
|
|||
import org.rs09.consts.Scenery
|
||||
import org.rs09.consts.Sounds
|
||||
|
||||
import core.game.system.task.Pulse
|
||||
|
||||
class ModernListeners : SpellListener("modern"){
|
||||
override fun defineListeners() {
|
||||
onCast(Modern.HOME_TELEPORT, NONE){ player, _ ->
|
||||
|
|
@ -232,25 +234,41 @@ class ModernListeners : SpellListener("modern"){
|
|||
player.pulseManager.clear()
|
||||
}
|
||||
|
||||
if (explorersRing) {
|
||||
visualize(player, LOW_ALCH_ANIM, EXPLORERS_RING_GFX)
|
||||
} else {
|
||||
val weapon = getItemFromEquipment(player, EquipmentSlot.WEAPON)
|
||||
if (weapon != null && weapon.id in MagicStaff.FIRE_RUNE.staves) {
|
||||
visualize(player, if (high) HIGH_ALCH_STAFF_ANIM else LOW_ALCH_STAFF_ANIM, if (high) HIGH_ALCH_STAFF_GFX else LOW_ALCH_STAFF_GFX)
|
||||
} else {
|
||||
visualize(player, if (high) HIGH_ALCH_ANIM else LOW_ALCH_ANIM, if (high) HIGH_ALCH_GFX else LOW_ALCH_GFX)
|
||||
player.pulseManager.run(object : Pulse(){
|
||||
var counter = 0
|
||||
override fun pulse(): Boolean {
|
||||
if (amountInInventory(player, item.id) == 0 || counter >= 150)
|
||||
return true
|
||||
removeAttribute(player, "spell:runes")
|
||||
if (counter % 5 == 0) {
|
||||
if (explorersRing) {
|
||||
visualize(player, LOW_ALCH_ANIM, EXPLORERS_RING_GFX)
|
||||
} else {
|
||||
val weapon = getItemFromEquipment(player, EquipmentSlot.WEAPON)
|
||||
if (weapon != null && weapon.id in MagicStaff.FIRE_RUNE.staves) {
|
||||
visualize(player, if (high) HIGH_ALCH_STAFF_ANIM else LOW_ALCH_STAFF_ANIM, if (high) HIGH_ALCH_STAFF_GFX else LOW_ALCH_STAFF_GFX)
|
||||
} else {
|
||||
visualize(player, if (high) HIGH_ALCH_ANIM else LOW_ALCH_ANIM, if (high) HIGH_ALCH_GFX else LOW_ALCH_GFX)
|
||||
}
|
||||
}
|
||||
playAudio(player, if (high) Sounds.HIGH_ALCHEMY_97 else Sounds.LOW_ALCHEMY_98)
|
||||
player.dispatch(ItemAlchemizationEvent(item.id, high))
|
||||
if (high)
|
||||
requires(player,55, arrayOf(Item(Items.FIRE_RUNE_554,5),Item(Items.NATURE_RUNE_561,1)))
|
||||
else
|
||||
requires(player,21, arrayOf(Item(Items.FIRE_RUNE_554,3),Item(Items.NATURE_RUNE_561)))
|
||||
removeRunes(player, false)
|
||||
addXP(player, if (high) 65.0 else 31.0)
|
||||
if (player.inventory.remove(Item(item.id, 1)) && coins.amount > 0) {
|
||||
player.inventory.add(coins)
|
||||
}
|
||||
//showMagicTab(player)
|
||||
setDelay(player, 5)
|
||||
}
|
||||
counter++
|
||||
return false
|
||||
}
|
||||
}
|
||||
playAudio(player, if (high) Sounds.HIGH_ALCHEMY_97 else Sounds.LOW_ALCHEMY_98)
|
||||
player.dispatch(ItemAlchemizationEvent(item.id, high))
|
||||
if (player.inventory.remove(Item(item.id, 1)) && coins.amount > 0) {
|
||||
player.inventory.add(coins)
|
||||
}
|
||||
removeRunes(player)
|
||||
addXP(player, if (high) 65.0 else 31.0)
|
||||
showMagicTab(player)
|
||||
setDelay(player, 5)
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue