added probably more authentic equip timing
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
package rs09.game.content.global.action
|
||||
|
||||
import core.game.container.impl.EquipmentContainer
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.combat.equipment.WeaponInterface
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.audio.Audio
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.plugin.Plugin
|
||||
import rs09.game.interaction.OptionListener
|
||||
import rs09.game.system.config.ItemConfigParser
|
||||
import rs09.game.world.GameWorld.ticks
|
||||
import rs09.game.world.GameWorld
|
||||
import rs09.tools.Items
|
||||
|
||||
/**
|
||||
@@ -22,17 +24,31 @@ class EquipHandler : OptionListener() {
|
||||
override fun defineListeners() {
|
||||
|
||||
on(ITEM,"equip","wield","wear"){player,node ->
|
||||
GameWorld.Pulser.submit(object : Pulse(){
|
||||
override fun pulse(): Boolean {
|
||||
handleEquip(player,node)
|
||||
return true
|
||||
}
|
||||
})
|
||||
return@on true
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
fun handleEquip(player: Player,node: Node){
|
||||
val item = node.asItem()
|
||||
|
||||
if(item == null || player.inventory[item.slot] != item){
|
||||
return@on true
|
||||
return
|
||||
}
|
||||
|
||||
val equipStateListener = item.definition.getConfiguration<Plugin<Any>>("equipment", null)
|
||||
if(equipStateListener != null){
|
||||
val bool = equipStateListener.fireEvent("equip",player,item)
|
||||
if(bool != true){
|
||||
return@on true
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,9 +57,8 @@ class EquipHandler : OptionListener() {
|
||||
if (lock.message != null) {
|
||||
player.packetDispatch.sendMessage(lock.message)
|
||||
}
|
||||
return@on true
|
||||
return
|
||||
}
|
||||
player.setAttribute("equipLock:" + item.id, ticks + 2)
|
||||
|
||||
if (player.equipment.add(item, item.slot, true, true)) {
|
||||
//check if a brawling glove is being equipped and register it
|
||||
@@ -65,11 +80,6 @@ class EquipHandler : OptionListener() {
|
||||
wif.openAutocastSelect()
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
Reference in New Issue
Block a user