mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-12-06 19:01:23 +00:00
- Updated NpcFirstClickEvent to include npcIndex for better handling of NPC interactions. - Enhanced Npc and NpcHandler classes to support new interaction logic and ensure NPCs face players correctly. - Refined packet handling for NPC clicks and button actions to integrate new dialogue and interaction flows.
37 lines
1.3 KiB
Kotlin
37 lines
1.3 KiB
Kotlin
package plugin.area.alkharid
|
|
|
|
import com.rs2.event.EventContext
|
|
import com.rs2.event.EventSubscriber
|
|
import com.rs2.event.SubscribesTo
|
|
import com.rs2.event.impl.ObjectFirstClickEvent
|
|
import com.rs2.game.players.Player
|
|
import plugin.area.alkharid.AlKharidGateUtil.GATE_NORTH
|
|
import plugin.area.alkharid.AlKharidGateUtil.GATE_SOUTH
|
|
import plugin.area.alkharid.AlKharidGateUtil.hasCompletedPrinceAli
|
|
import plugin.area.alkharid.AlKharidGateUtil.isNearGate
|
|
import plugin.area.alkharid.AlKharidGateUtil.passThroughGate
|
|
|
|
@SubscribesTo(ObjectFirstClickEvent::class)
|
|
class AlKharidGateFirstClick : EventSubscriber<ObjectFirstClickEvent> {
|
|
|
|
override fun subscribe(context: EventContext, player: Player, event: ObjectFirstClickEvent) {
|
|
val objectId = event.gameObject
|
|
if (objectId != GATE_NORTH && objectId != GATE_SOUTH) {
|
|
return
|
|
}
|
|
|
|
if (!isNearGate(player)) {
|
|
player.packetSender.sendMessage("You need to be closer to the gate to use it.")
|
|
return
|
|
}
|
|
|
|
if (player.hasCompletedPrinceAli()) {
|
|
player.packetSender.sendMessage("The guards recognize you as a friend of Al-Kharid and let you pass.")
|
|
passThroughGate(player)
|
|
return
|
|
}
|
|
|
|
player.packetSender.sendMessage("You need to talk to the border guard.")
|
|
}
|
|
}
|