mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-04 16:49:04 +00:00
Astraeus Dialogue System Port (#512)
* - Marked As Deprecated - Reorganized DialogueOptions.java so that option buttons are grouped with each interface - Added temporary Dialogue Executor to make new Dialogue System function - Remove Man, Woman, and Banker Dialogue and Dialogue Options * - Refactored Dialogue.java into DialoguePacket.java - Moved DialoguePacket.java into impl packets package - Added Astraeus dialogue executor * - Removed useless file - Reorganized the Misc.java file * - Ported Astraeus Dialogue System - Rewrote Man, Woman, and Banker Dialogues - Added line splitter in AstraeusDialogueFactory.java * - Renamed Astraeus* classes to *Plugin - Fixed an issue where the Dialogue Option buttons were not executed through the Kotlin file
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package plugin.buttons
|
||||
|
||||
import com.rs2.event.SubscribesTo
|
||||
import com.rs2.event.impl.ButtonActionEvent
|
||||
import com.rs2.game.dialogues.DialoguePlugin
|
||||
import com.rs2.game.players.Player
|
||||
import plugin.buttons.ButtonClick
|
||||
|
||||
@SubscribesTo(ButtonActionEvent::class)
|
||||
class DialogueOptionButtons : ButtonClick() {
|
||||
|
||||
override fun execute(player: Player, event: ButtonActionEvent) {
|
||||
|
||||
when (event.button) {
|
||||
|
||||
// First Option (Option Interfaces 2, 3, 4, and 5)
|
||||
9157, 9167, 9178, 9190 ->
|
||||
player.dialogueFactory.executeOption(0, player.optionDialogue)
|
||||
|
||||
// Second Option (Option Interfaces 2, 3, 4, and 5)
|
||||
9158, 9168, 9179, 9191 ->
|
||||
player.dialogueFactory.executeOption(1, player.optionDialogue)
|
||||
|
||||
// Third Option (Option Interfaces 3, 4, and 5)
|
||||
9169, 9180, 9192 ->
|
||||
player.dialogueFactory.executeOption(2, player.optionDialogue)
|
||||
|
||||
// Fourth Option (Option Interfaces 4 and 5)
|
||||
9181, 9193 ->
|
||||
player.dialogueFactory.executeOption(3, player.optionDialogue)
|
||||
|
||||
// Fifth Option (Option Interface 5)
|
||||
9194 ->
|
||||
player.dialogueFactory.executeOption(4, player.optionDialogue)
|
||||
}
|
||||
}
|
||||
|
||||
override fun test(event: ButtonActionEvent): Boolean {
|
||||
return DialoguePlugin.isDialogueButton(event.button)
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,14 @@
|
||||
package plugin.click.npc
|
||||
|
||||
import com.rs2.GameConstants
|
||||
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.npcs.Npc
|
||||
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)
|
||||
@@ -18,18 +19,17 @@ class NpcFirstClick : EventSubscriber<NpcFirstClickEvent> {
|
||||
if (player.playerRights >= 3) {
|
||||
player.packetSender.sendMessage("[click= npc], [type = first], [id= ${event.npc}], [Type= ${event.npc}]");
|
||||
}
|
||||
|
||||
|
||||
when(event.npc) {
|
||||
|
||||
1,2,3,4,5,6 -> if (Misc.random(10) <= 5) {
|
||||
player.dialogueHandler.sendDialogues(3869, player.npcType)
|
||||
} else {
|
||||
player.dialogueHandler.sendDialogues(3872, player.npcType)
|
||||
}
|
||||
// Man or Woman
|
||||
1,2,3,4,5,6 -> player.dialogueFactory.sendDialogue(ManWomanDialogue(Misc.random(22)))
|
||||
|
||||
//else ->
|
||||
// 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 ->
|
||||
if (!SkillHandler.isSkilling(player)) {
|
||||
player.dialogueFactory.sendDialogue(BankerDialogue())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package plugin.npc.banker
|
||||
|
||||
import com.rs2.game.dialogues.DialoguePlugin
|
||||
import com.rs2.game.dialogues.DialogueFactoryPlugin
|
||||
import com.rs2.game.dialogues.ExpressionPlugin
|
||||
|
||||
/**
|
||||
* The Dialogue Class for Gnome and Human Banker NPCs
|
||||
* Does NOT include dialogue for Ghost Bankers
|
||||
* @author Qweqker
|
||||
*/
|
||||
class BankerDialogue : DialoguePlugin() {
|
||||
|
||||
override fun sendDialogues(factory: DialogueFactoryPlugin) {
|
||||
|
||||
factory
|
||||
.sendNPCChat(ExpressionPlugin.HAPPY, "Good day. How may I help you?")
|
||||
.sendOption("I'd like to access my bank account, please.", {
|
||||
factory
|
||||
.onAction {
|
||||
factory.player.packetSender.openUpBank()
|
||||
}
|
||||
}, "I'd like to check my PIN settings.", {
|
||||
factory
|
||||
.onAction {
|
||||
factory.player.bankPin.bankPinSettings()
|
||||
}
|
||||
}, "What is this place?") {
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT,"What is this place?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT,"This is the bank of <servername>. We have many branches in many towns.")
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT,"And what do you do?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT,"We will look after your items and money for you. Leave your valuables with us if you want to keep them safe.")
|
||||
}
|
||||
.execute()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package plugin.npc.manwoman
|
||||
|
||||
import com.rs2.game.dialogues.DialoguePlugin
|
||||
import com.rs2.game.dialogues.DialogueFactoryPlugin
|
||||
import com.rs2.game.dialogues.ExpressionPlugin
|
||||
|
||||
/**
|
||||
* The Dialogue Class for Man and Woman NPCs
|
||||
* @author Qweqker
|
||||
*/
|
||||
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
|
||||
// as part of the calling process
|
||||
when(randomDialogue) {
|
||||
0 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "Not too bad, but I'm a little worried about the increase of goblins these days.")
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Don't worry, I'll kill them.")
|
||||
.execute()
|
||||
1 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "How can I help you?")
|
||||
.sendOption("Do you want to trade? ", {
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT,"Do you want to trade?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT,"No, I have nothing I wish to get rid of. If you want to do some trading, there are plenty of shops and market stalls around though.")
|
||||
}, "I'm in search of a quest.", {
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT,"I'm in search of a quest.")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT,"I'm sorry I can't help you there.")
|
||||
}, "I'm in search of enemies to kill.") {
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "I'm in search of enemies to kill.")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT,"I've heard there are many fearsome creatures that dwell under the ground...")
|
||||
}
|
||||
.execute()
|
||||
2 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.ANNOYED, "Get out of my way, I'm in a hurry!")
|
||||
.execute()
|
||||
3 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.HAPPY, "I'm fine, how are you?")
|
||||
.sendPlayerChat(ExpressionPlugin.HAPPY, "Very well thank you.")
|
||||
.execute()
|
||||
4 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.HAPPY, "Hello there! Nice weather we've been having.")
|
||||
.execute()
|
||||
5 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.HAPPY, "I'm very well thank you.")
|
||||
.execute()
|
||||
6 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "Who are you?")
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "I'm a bold adventurer.")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "Ah, a very noble profession.")
|
||||
.execute()
|
||||
7 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.ANNOYED, "Do I know you? I'm in a hurry!")
|
||||
.execute()
|
||||
8 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "I think we need a new king. The one we've got isn't very good.")
|
||||
.execute()
|
||||
9 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "Not too bad thanks.")
|
||||
.execute()
|
||||
10 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "Are you asking for a fight?")
|
||||
/* TODO: Have NPC Attack Player
|
||||
.onAction {
|
||||
|
||||
}*/
|
||||
.execute()
|
||||
11 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "I'm busy right now.")
|
||||
.execute()
|
||||
12 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "Hello.")
|
||||
.execute()
|
||||
13 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "None of your business.")
|
||||
.execute()
|
||||
14 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT,"Do you wish to trade?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "No, I have nothing I wish to get rid of. If you want to do some trading, there are plenty of shops and market stalls around though.")
|
||||
.execute()
|
||||
15 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT,"I'm in search of a quest.")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "I'm sorry I can't help you there.")
|
||||
.execute()
|
||||
16 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT,"I'm in search of enemies to kill.")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "I've heard there are many fearsome creatures that dwell under the ground...")
|
||||
.execute()
|
||||
17 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.ANNOYED, "No I don't have any spare change.")
|
||||
.execute()
|
||||
18 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DISTRESSED, "I'm a little worried - I've heard there's lots of people going about, killing citizens at random.")
|
||||
.execute()
|
||||
19 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DISTRESSED, "No, I don't want to buy anything!")
|
||||
.execute()
|
||||
20 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "That is classified information.")
|
||||
.execute()
|
||||
21 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "Have this flyer...")
|
||||
.onAction {
|
||||
factory.player.itemAssistant.addOrDropItem(956, 1)
|
||||
}
|
||||
.execute()
|
||||
22 ->
|
||||
factory
|
||||
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||
.sendNPCChat(ExpressionPlugin.DEFAULT, "Yo, wassup!")
|
||||
.execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user