Update NPC Plugins Layout To Put Click Actions Per NPC Plugin

(cherry picked from commit 156d864bfd)
This commit is contained in:
Dark98
2021-10-31 02:42:38 +00:00
parent 8ee88848a3
commit 8d0000de0b
3 changed files with 34 additions and 9 deletions
@@ -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<NpcFirstClickEvent> {
class FirstClick : EventSubscriber<NpcFirstClickEvent> {
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())
}
}
}
}
}
@@ -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<NpcFirstClickEvent> {
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)))
}
}
}
@@ -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 ->