From 156d864bfdd4dff7f3f020d99037d434adaa8348 Mon Sep 17 00:00:00 2001 From: Dark98 Date: Sun, 31 Oct 2021 02:42:38 +0000 Subject: [PATCH] Update NPC Plugins Layout To Put Click Actions Per NPC Plugin --- .../banker/FirstClick.kt} | 13 ++++----- .../plugins/plugin/npc/manwoman/FirstClick.kt | 28 +++++++++++++++++++ .../plugin/npc/manwoman/ManWomanDialogue.kt | 2 +- 3 files changed, 34 insertions(+), 9 deletions(-) rename 2006Scape Server/plugins/plugin/{click/npc/NpcFirstClick.kt => npc/banker/FirstClick.kt} (74%) create mode 100644 2006Scape Server/plugins/plugin/npc/manwoman/FirstClick.kt diff --git a/2006Scape Server/plugins/plugin/click/npc/NpcFirstClick.kt b/2006Scape Server/plugins/plugin/npc/banker/FirstClick.kt similarity index 74% rename from 2006Scape Server/plugins/plugin/click/npc/NpcFirstClick.kt rename to 2006Scape Server/plugins/plugin/npc/banker/FirstClick.kt index 17886fac..4ef37f67 100644 --- a/2006Scape Server/plugins/plugin/click/npc/NpcFirstClick.kt +++ b/2006Scape Server/plugins/plugin/npc/banker/FirstClick.kt @@ -1,4 +1,4 @@ -package plugin.click.npc +package plugin.npc.banker import com.rs2.event.EventContext import com.rs2.event.EventSubscriber @@ -12,24 +12,21 @@ import plugin.npc.manwoman.ManWomanDialogue @SubscribesTo(NpcFirstClickEvent::class) -class NpcFirstClick : EventSubscriber { +class FirstClick : EventSubscriber { override fun subscribe(context: EventContext, player: Player, event: NpcFirstClickEvent) { if (player.playerRights >= 3) { - player.packetSender.sendMessage("[click= npc], [type = first], [id= ${event.npc}], [Type= ${event.npc}]"); + player.packetSender.sendMessage("[click= npc], [type = first], [id= ${event.npc}], [Type= ${event.npc}]") } when(event.npc) { - - // Man or Woman - 1,2,3,4,5,6 -> player.dialogueFactory.sendDialogue(ManWomanDialogue(Misc.random(22))) - // Banker (NOT INCLUDING GHOST BANKER IN PORT PHASMATYS) - 166, 494, 495, 496, 497, 498, 499, 953, 1036, 1360, 2163, 2164, 2354, 2355, 2568, 2569, 2570 -> + 166, 494, 495, 496, 497, 498, 499, 953, 1036, 1360, 2163, 2164, 2354, 2355, 2568, 2569, 2570 -> { if (!SkillHandler.isSkilling(player)) { player.dialogueFactory.sendDialogue(BankerDialogue()) } + } } } } \ No newline at end of file diff --git a/2006Scape Server/plugins/plugin/npc/manwoman/FirstClick.kt b/2006Scape Server/plugins/plugin/npc/manwoman/FirstClick.kt new file mode 100644 index 00000000..baec78e8 --- /dev/null +++ b/2006Scape Server/plugins/plugin/npc/manwoman/FirstClick.kt @@ -0,0 +1,28 @@ +package plugin.npc.manwoman + +import com.rs2.event.EventContext +import com.rs2.event.EventSubscriber +import com.rs2.event.SubscribesTo +import com.rs2.event.impl.NpcFirstClickEvent +import com.rs2.game.content.skills.SkillHandler +import com.rs2.game.players.Player +import com.rs2.util.Misc +import plugin.npc.banker.BankerDialogue +import plugin.npc.manwoman.ManWomanDialogue + + +@SubscribesTo(NpcFirstClickEvent::class) +class FirstClick : EventSubscriber { + + override fun subscribe(context: EventContext, player: Player, event: NpcFirstClickEvent) { + + if (player.playerRights >= 3) { + player.packetSender.sendMessage("[click= npc], [type = first], [id= ${event.npc}], [Type= ${event.npc}]") + } + + when(event.npc) { + // Man or Woman + 1,2,3,4,5,6 -> player.dialogueFactory.sendDialogue(ManWomanDialogue(Misc.random(22))) + } + } +} \ No newline at end of file diff --git a/2006Scape Server/plugins/plugin/npc/manwoman/ManWomanDialogue.kt b/2006Scape Server/plugins/plugin/npc/manwoman/ManWomanDialogue.kt index 08ce5f3f..e6918658 100644 --- a/2006Scape Server/plugins/plugin/npc/manwoman/ManWomanDialogue.kt +++ b/2006Scape Server/plugins/plugin/npc/manwoman/ManWomanDialogue.kt @@ -13,7 +13,7 @@ class ManWomanDialogue(private val randomDialogue: Int) : DialoguePlugin() { override fun sendDialogues(factory: DialogueFactoryPlugin) { // Since Man and Woman NPCs provide a random dialogue every interaction, use a switch statement - // There are 23 dialogues, but a random number is rolled between 0 and 22 in the NpcFirstClick.kt file + // There are 23 dialogues, but a random number is rolled between 0 and 22 in the FirstClick.kt file // as part of the calling process when(randomDialogue) { 0 ->