Files
2006Scape/2006Scape Server/plugins/plugin/area/alkharid/AlKharidGateFirstClick.kt
T
Dark98 9570a35bae Rewrite Al-Kharid gate interactions and border guard dialogues closes (#661)
- 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.
2026-11-10 02:52:33 +00:00

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.")
}
}