Improved Ned's dialogue

This commit is contained in:
Ceikry
2021-03-10 16:06:42 -06:00
parent d6ca92c082
commit 4f7b9bac57
7 changed files with 576 additions and 611 deletions
@@ -11,6 +11,8 @@ abstract class DialogueFile {
var npc: NPC? = null var npc: NPC? = null
var interpreter: DialogueInterpreter? = null var interpreter: DialogueInterpreter? = null
open var stage = START_DIALOGUE open var stage = START_DIALOGUE
var dialoguePlugin: DialoguePlugin? = null
abstract fun handle(componentID: Int, buttonID: Int) abstract fun handle(componentID: Int, buttonID: Int)
fun load(player: Player, npc: NPC, interpreter: DialogueInterpreter): DialogueFile{ fun load(player: Player, npc: NPC, interpreter: DialogueInterpreter): DialogueFile{
this.player = player this.player = player
@@ -71,6 +73,16 @@ abstract class DialogueFile {
} }
/**
* Return to the default dialogue plugin at the given stage.
* Should be used in place of setting a new stage. I.E. instead of "stage = END_DIALOGUE" use "returnAtStage(whatever stage)"
* @param stage The stage to return to.
*/
fun returnAtStage(toStage: Int){
dialoguePlugin!!.file = null
dialoguePlugin!!.stage = toStage
}
/** /**
* Use when you've entered a DialogueFile but current state does not match any possible conditionals. * Use when you've entered a DialogueFile but current state does not match any possible conditionals.
* Sort-of a fail-safe in a sense. * Sort-of a fail-safe in a sense.
@@ -84,4 +96,8 @@ abstract class DialogueFile {
return stage return stage
} }
fun Int.substage(stage: Int): Int{
return this + stage
}
} }
@@ -277,6 +277,7 @@ public abstract class DialoguePlugin implements Plugin<Player> {
*/ */
public void loadFile(DialogueFile file){ public void loadFile(DialogueFile file){
this.file = file.load(player,npc,interpreter); this.file = file.load(player,npc,interpreter);
this.file.setDialoguePlugin(this);
stage = START_DIALOGUE; stage = START_DIALOGUE;
} }
@@ -12,6 +12,7 @@ import core.game.content.dialogue.DukeHoracioDialogue
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.item.Item import core.game.node.item.Item
import core.tools.DIALOGUE_INITIAL_OPTIONS_HANDLE
import core.tools.END_DIALOGUE import core.tools.END_DIALOGUE
/** /**
@@ -42,8 +43,13 @@ class DukeHoracioDialogue(player: Player? = null) : DialoguePlugin(player) {
} }
override fun handle(interfaceId: Int, buttonId: Int): Boolean { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
val quest = player.questRepository.getQuest("Rune Mysteries")
when (stage) { when (stage) {
DIALOGUE_INITIAL_OPTIONS_HANDLE -> {
npc("Greetings. Welcome to my castle.")
loadFile(optionFiles[buttonId - 1])
}
0 -> { 0 -> {
interpreter.sendOptions("Select an Option", "Have you any quests for me?", "Where can I find money?") interpreter.sendOptions("Select an Option", "Have you any quests for me?", "Where can I find money?")
stage = 1 stage = 1
@@ -10,7 +10,7 @@ import core.tools.START_DIALOGUE
class DukeHoracioDSDialogue(val questStage: Int) : DialogueFile() { class DukeHoracioDSDialogue(val questStage: Int) : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) { override fun handle(componentID: Int, buttonID: Int) {
if(questStage >= 20 && !hasShield(player!!)){ if(questStage in 20..99 && !hasShield(player!!)){
when(stage){ when(stage){
START_DIALOGUE -> player("I seek a shield that will protect me from dragonbreath.").also { stage++ } START_DIALOGUE -> player("I seek a shield that will protect me from dragonbreath.").also { stage++ }
@@ -0,0 +1,106 @@
package core.game.content.quest.free.dragonslayer
import core.game.content.dialogue.DialogueFile
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
private const val SHIP_DIALOGUE = 2000
class NedDSDialogue(val questStage: Int) : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
if(stage >= SHIP_DIALOGUE){
when(stage){
SHIP_DIALOGUE -> {
if (player!!.getSavedData().questData.getDragonSlayerAttribute("ship")) {
player("It's the Lady Lumbridge, in Port Sarim.")
stage++
} else {
player("I'm still looking...")
stage = END_DIALOGUE
}
}
//It's the lady lumbridge
2001 -> npc("That old pile of junk? Last I heard, she wasn't", "seaworthy.").also { stage++ }
2002 -> {
stage = if (player!!.savedData.questData.getDragonSlayerAttribute("repaired")) {
player("I fixed her up!")
stage + 1
} else {
player("Oh, I better go inspect her.")
END_DIALOGUE
}
}
//I fixed her up
2003 -> npc("You did? Excellent!").also { stage++ }
2004 -> npc("Just show me the map and we can get ready to go!").also { stage++ }
2005 -> {
if (player!!.inventory.containsItem(DragonSlayer.CRANDOR_MAP)) {
player("Here you go.")
stage++
} else {
player!!.packetDispatch.sendMessage("You don't have the map to Crandor.")
stage = END_DIALOGUE
}
}
2006 -> {
if (player!!.inventory.remove(DragonSlayer.CRANDOR_MAP)) {
interpreter!!.sendItemMessage(DragonSlayer.CRANDOR_MAP.id, "You hand the map to Ned.")
player!!.questRepository.getQuest("Dragon Slayer").setStage(player, 30)
stage++
} else stage = END_DIALOGUE
}
2007 -> npc("Excellent! I'll meet you at the ship, then.").also { stage = END_DIALOGUE }
}
}
else if(questStage == 20 && player!!.savedData.questData.getDragonSlayerAttribute("ned")){
when(stage){
START_DIALOGUE -> player("Will you take me to Crandor now, then?").also{ stage++ }
1 -> npc("I Said I would and old Ned is a man of his word!").also { stage++ }
2 -> npc("So, where's your ship?").also { stage = SHIP_DIALOGUE }
}
}
else if(questStage == 20){
when(stage){
START_DIALOGUE -> player("You're a sailor? Could you take me to Crandor?").also { stage++ }
1 -> npc(
"Well, I was a sailor. I've not been able to get work at",
"sea these days, though. They say I'm too old."
).also { stage++ }
2 -> npc("Sorry, where was it you said you wanted to go?").also { stage++ }
3 -> player("To the island of Crandor.").also { stage++ }
4 -> npc("Crandor? You've got to be out of your mind!").also { stage++ }
5 -> npc(
"But... It would be a chance to sail a ship once more.",
"I'd sail anywhere if it was a chance to sail again."
).also { stage++ }
6 -> npc("Then again, no captain in his right mind would sail to", "that island...").also { stage++ }
7 -> {
npc("Ah, you only live once! I'll do it!")
player!!.savedData.questData.setDragonSlayerAttribute("ned", true)
stage++
}
8 -> npc("So, where's your ship?").also { stage = SHIP_DIALOGUE }
}
}
else if(questStage == 30){
when(stage){
START_DIALOGUE -> player("So will you take me to Crandor now then?").also { stage++ }
1 -> npc(
"I Said I would and old Ned is a man of his word! I'll",
"meet you on board the Lady Lumbridge in Port Sarim."
).also { stage = END_DIALOGUE }
}
}
}
}
@@ -1,624 +1,359 @@
package core.game.content.quest.free.dragonslayer; package core.game.content.quest.free.dragonslayer
import core.game.content.dialogue.DialoguePlugin; import core.game.world.GameWorld.settings
import core.game.node.entity.npc.NPC; import core.game.content.dialogue.DialoguePlugin
import core.game.node.entity.player.Player; import core.game.node.entity.player.link.diary.AchievementDiary
import core.game.node.entity.player.link.diary.AchievementDiary; import core.game.content.quest.free.princealirescue.NedPARDialogue
import core.game.node.entity.player.link.diary.DiaryType; import core.game.node.entity.npc.NPC
import core.game.node.entity.player.link.quest.Quest; import core.game.node.entity.player.Player
import core.game.node.item.GroundItemManager; import core.game.node.item.GroundItemManager
import core.game.node.item.Item; import core.game.node.entity.player.link.diary.DiaryType
import core.game.world.GameWorld; import core.game.node.item.Item
import core.tools.DIALOGUE_INITIAL_OPTIONS_HANDLE
import core.tools.END_DIALOGUE
/** /**
* Represents the dialogue to handle the transcript of hed. * Core dialogue plugin for Ned.
* @author 'Vexia * @author Ceikry
* @date 31/12/2013
*/ */
public final class NedDialogue extends DialoguePlugin { class NedDialogue(player: Player? = null) : DialoguePlugin(player) {
/**
* The achievement diary.
*/
private var diary: AchievementDiary? = null
private val level = 2
override fun newInstance(player: Player): DialoguePlugin {
return NedDialogue(player)
}
override fun open(vararg args: Any): Boolean {
npc = args[0] as NPC
val dSlayerStage = player.questRepository.getStage("Dragon Slayer")
val parStage = player.questRepository.getStage("Prince Ali Rescue")
if (dSlayerStage == 20 || dSlayerStage == 30) {
addOption("Dragon Slayer", NedDSDialogue(dSlayerStage))
}
if (parStage == 20 || parStage == 30 || parStage == 40 || parStage == 50) {
addOption("Prince Ali Rescue", NedPARDialogue(parStage))
}
if (!sendChoices()) {
npc(
"Why, hello there, lad. Me friends call me Ned. I was a",
"man of the sea, but it's past me now. Could I be",
"making or selling you some rope?"
)
}
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) {
DIALOGUE_INITIAL_OPTIONS_HANDLE -> {
npc(
"Why, hello there, lad. Me friends call me Ned. I was a",
"man of the sea, but it's past me now. Could I be",
"making or selling you some rope?"
)
loadFile(optionFiles[buttonId - 1])
}
0 -> {
options(
"Yes, I would like some rope.",
"No thanks Ned, I don't need any.",
"Ask about Achievement Diaries"
)
stage = 1
}
1 -> when (buttonId) {
1 -> {
player("Yes, I would like some rope.")
stage = 10
}
2 -> {
player("No thanks Ned, I don't need any.")
stage = END_DIALOGUE
}
3 -> {
player("I'd like to talk about Achievement Diaries.")
stage = 900
}
}
10 -> {
npc(
"Well, I can sell you some rope for 15 coins. Or I can",
"be making you some if you gets me 4 balls of wool. I",
"strands them together I does, makes em strong."
)
stage = 11
}
11 -> {
player("You make rope from wool?")
stage = 12
}
12 -> {
npc("Of course you can!")
stage = 13
}
13 -> {
player("I thought you needed hemp or jute.")
stage = 14
}
14 -> {
npc("Do you want some rope or not?")
stage = 15
}
15 -> stage = if (!player.inventory.containsItem(WOOL)) {
options(
"Okay, please sell me some rope.",
"That's a little more than I want to pay.",
"I will go and get some wool."
)
16
} else {
options(
"Okay, please sell me some rope.",
"I have some balls of wool. Could you make me some rope?",
"That's a little more than I want to pay."
)
17
}
17 -> when (buttonId) {
1 -> {
player("Okay, please sell me some rope.")
stage = 100
}
2 -> {
player("I have some balls of wool.", "Could you make me some rope?")
stage = 120
}
3 -> {
player("That's a little more than I want to pay.")
stage = 200
}
}
16 -> when (buttonId) {
1 -> {
player("Okay, please sell me some rope.")
stage = 100
}
2 -> {
player("That's a little more than I want to pay.")
stage = 200
}
3 -> {
player("I will go and get some wool.")
stage = 300
}
}
40 -> when (buttonId) {
1 -> {
player("Ned could you make other things from wool?")
stage = 41
}
2 -> {
player("Yes, I would like some rope.")
stage = 10
}
3 -> {
player("No thanks Ned, I don't need any.")
stage = 20
}
}
100 -> {
npc("There you go, finest rope in " + settings!!.name + ".")
stage = 101
}
101 -> {
interpreter.sendDialogue("You hand Ned 15 coins. Ned gives you a coil of rope.")
stage = 102
}
102 -> {
if (player.inventory.remove(COINS)) {
if (!player.inventory.add(ROPE)) {
GroundItemManager.create(ROPE, player)
}
} else {
player.packetDispatch.sendMessage("You don't have enough coins to pay for rope.")
}
end()
}
120 -> {
interpreter.sendDialogues(npc, null, "Sure I can.")
stage = 121
}
121 -> {
interpreter.sendDialogue("You hand over 4 balls of wool. Ned gives you a coil of rope.")
stage = 122
}
122 -> {
if (player.inventory.remove(WOOL)) {
player.inventory.add(ROPE)
}
end()
}
200 -> {
npc(
"Well, if you ever need rope that's the price. Sorry.",
"An old sailor needs money for a little drop o' rum."
)
stage = 201
}
201 -> end()
300 -> {
npc("Aye, you do that. Remember, it takes 4 balls of wool to", "make strong rope.")
stage = 301
}
301 -> end()
20 -> {
npc(
"Well, old Neddy is always here if you do. Tell your",
"friends. I can always be using the business."
)
stage = 21
}
21 -> end()
900 -> {
if (diary == null) {
diary = player.achievementDiaryManager.getDiary(DiaryType.LUMBRIDGE)
}
if (diary!!.isComplete(level, true) && !diary!!.isLevelRewarded(level)) {
player("I've done all the hard tasks in my Lumbridge", "Achievement Diary.")
stage = 950
}
if (diary!!.isLevelRewarded(level) && diary!!.isComplete(level, true) && !player.hasItem(diary!!.type.getRewards(level)[0])) {
player("I've seemed to have lost my explorer's ring...")
stage = 960
}
options(
"What is the Achievement Diary?",
"What are the rewards?",
"How do I claim the rewards?",
"See you later."
)
stage = 901
}
901 -> when (buttonId) {
1 -> {
player("What is the Achievement Diary?")
stage = 910
}
2 -> {
player("What are the rewards?")
stage = 920
}
3 -> {
player("How do I claim the rewards?")
stage = 930
}
4 -> {
player("See you later!")
stage = 940
}
}
910 -> {
npc(
"Ah, well it's a diary that helps you keep track of",
"particular achievements you've made in the world of",
"2009Scape. In Lumbridge and Draynor i can help you",
"discover some very useful things indeed."
)
stage++
}
911 -> {
npc("Eventually with enough exploration you will be", "rewarded for your explorative efforts.")
stage++
}
912 -> {
npc(
"You can access your Achievement Diary by going to",
"the Quest Journal. When you've opened the Quest",
"Journal click on the green star icon on the top right",
"hand corner. This will open the diary."
)
stage = 900
}
920 -> {
npc(
"Ah, well there are different rewards for each",
"Achievement Diary. For completing the Lumbridge and",
"Draynor diary you are presented with an explorer's",
"ring."
)
stage++
}
921 -> {
npc("This ring will become increasingly useful with each", "section of the diary that you complete.")
stage = 900
}
930 -> {
npc(
"You need to complete the task so that they're all ticked",
"off then you can claim your reward. Most of them are",
"straightforward although you might find some required",
"quests to be started, if not finished."
)
stage++
}
931 -> {
npc(
"To claim the explorer's ring speak to Explorer Jack in ",
"Lumbridge, Bob in Bob's Axes in Lumbridge, or myself."
)
stage = 900
}
940 -> end()
950 -> {
npc("Yes I see that, you'll be wanting your", "reward then I assume?")
stage++
}
951 -> {
player("Yes please.")
stage++
}
952 -> {
diary!!.setLevelRewarded(level)
for (i in diary!!.type.getRewards(level)) {
player.inventory.add(i, player)
}
npc("This ring is a representation of the adventures you", "went on to complete your tasks.")
stage++
}
953 -> {
player("Wow, thanks!")
stage = 900
}
960 -> {
player.inventory.add(diary!!.type.getRewards(level)[0], player)
npc("You better be more careful this time.")
stage = 900
}
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(743)
}
companion object {
/** /**
* Represents the coins item to remove. * Represents the coins item to remove.
*/ */
private static final Item COINS = new Item(995, 15); private val COINS = Item(995, 15)
/** /**
* Represents the rope item to add. * Represents the rope item to add.
*/ */
private static final Item ROPE = new Item(954); private val ROPE = Item(954)
/** /**
* Represents the ball of wool item. * Represents the ball of wool item.
*/ */
private static final Item WOOL = new Item(1759, 4); private val WOOL = Item(1759, 4)
/**
* Represents the wool item needed to make a wig.
*/
private static final Item WIG_WOOL = new Item(1759, 3);
/**
* Represents the undyed wig item.
*/
private static final Item WIG = new Item(2421);
/**
* Represents the quest instance.
*/
private Quest quest;
/**
* What quest option to use.
*/
private String q;
/**
* The achievement diary.
*/
private AchievementDiary diary;
private final int level = 2;
/**
* Constructs a new {@code NedDialogue} {@code Object}.
*/
public NedDialogue() {
/**
* empty.
*/
}
/**
* Constructs a new {@code NedDialogue} {@code Object}.
* @param player the player.
*/
public NedDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new NedDialogue(player);
}
@Override
public boolean open(Object... args) {
npc = (NPC) args[0];
quest = player.getQuestRepository().getQuest("Prince Ali Rescue");
if (player.getQuestRepository().getQuest("Dragon Slayer").isStarted(player) && player.getQuestRepository().getQuest("Prince Ali Rescue").isStarted(player)) {
options("Dragon Slayer", "Prince Ali Rescue");
stage = -400;
return true;
}
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 20) {
if (player.getSavedData().getQuestData().getDragonSlayerAttribute("ned")) {
player("Will you take me to Crandor now, then?");
stage = 520;
return true;
}
npc("Why, hello there, lad. Me friends call me Ned. I was a", "man of the sea, but it's past me now. Could I be", "making or selling you some rope?");
stage = 499;
return true;
}
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 30) {
player("Will you take me to Crandor now, then?");
stage = 520;
return true;
}
switch (quest.getStage(player)) {
case 20:// wig
case 30:
case 40:
case 50:
options("Ned, could you make other things from wool?", "Yes, I would like some rope.", "No thanks Ned, I don't need any.");
stage = 40;
break;
default:
npc("Why, hello there, lad. Me friends call me Ned. I was a", "man of the sea, but it's past me now. Could I be", "making or selling you some rope?");
stage = 0;
break;
}
return true;
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (stage) {
case -400:
switch (buttonId) {
case 1:
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 20) {
if (player.getSavedData().getQuestData().getDragonSlayerAttribute("ned")) {
player("Will you take me to Crandor now, then?");
stage = 520;
return true;
}
npc("Why, hello there, lad. Me friends call me Ned. I was a", "man of the sea, but it's past me now. Could I be", "making or selling you some rope?");
stage = 499;
return true;
}
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 30) {
player("Will you take me to Crandor now, then?");
stage = 520;
return true;
}
q = "dSlayer";
return true;
case 2:
switch (quest.getStage(player)) {
case 40:
case 50:
case 20:// wig
case 30:
options("Ned, could you make other things from wool?", "Yes, I would like some rope.", "No thanks Ned, I don't need any.");
stage = 40;
break;
default:
npc("Why, hello there, lad. Me friends call me Ned. I was a", "man of the sea, but it's past me now. Could I be", "making or selling you some rope?");
stage = 0;
break;
}
q = "ali";
return true;
}
}
if ((q == null || q.equals("dSlayer")) && (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 20 || (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 30) && player.getSavedData().getQuestData().getDragonSlayerAttribute("repaired"))) {
switch (stage) {
case 499:
player("You're a sailor? Could you take me to Crandor?");
stage = 500;
break;
case 500:
npc("Well, I was a sailor. I've not been able to get work at", "sea these days, though. They say I'm too old.");
stage = 501;
break;
case 501:
npc("Sorry, where was it you said you wanted to go?");
stage = 502;
break;
case 502:
player("To the island of Crandor.");
stage = 503;
break;
case 503:
npc("Crandor? You've got to be out of your mind!");
stage = 504;
break;
case 504:
npc("But... It would be a chance to sail a ship once more.", "I'd sail anywhere if it was a chance to sail again.");
stage = 505;
break;
case 505:
npc("Then again, no captain in his right mind would sail to", "that island...");
stage = 506;
break;
case 506:
npc("Ah, you only live once! I'll do it!");
player.getSavedData().getQuestData().setDragonSlayerAttribute("ned", true);
stage = 507;
break;
case 507:
npc("So, where's your ship?");
stage = 508;
break;
case 508:
if (player.getSavedData().getQuestData().getDragonSlayerAttribute("ship")) {
player("It's the Lady Lumbridge, in Port Sarim.");
stage = 509;
} else {
player("I'm still looking...");
stage = 511;
}
break;
case 509:
npc("That old pile of junk? Last I heard, she wasn't", "seaworthy.");
stage = 510;
break;
case 510:
if (player.getSavedData().getQuestData().getDragonSlayerAttribute("repaired")) {
player("I fixed her up!");
stage = 512;
} else {
player("Oh, I better go inspect her.");
stage = 511;
}
break;
case 511:
end();
break;
case 512:
npc("You did? Excellent!");
stage = 513;
break;
case 513:
npc("Just show me the map and we can get ready to go!");
stage = 514;
break;
case 514:
if (player.getInventory().containsItem(DragonSlayer.CRANDOR_MAP)) {
player("Here you go.");
stage = 515;
} else {
player.getPacketDispatch().sendMessage("You don't have the map to Crandor.");
end();
}
break;
case 515:
if (player.getInventory().remove(DragonSlayer.CRANDOR_MAP)) {
interpreter.sendItemMessage(DragonSlayer.CRANDOR_MAP.getId(), "You hand the map to Ned.");
player.getQuestRepository().getQuest("Dragon Slayer").setStage(player, 30);
stage = 516;
}
break;
case 516:
npc("Excellent! I'll meet you at the ship, then.");
stage = 517;
break;
case 517:
end();
break;
case 520:
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 30) {
npc("I Said I would and old Ned is a man of his word! I'll", "meet you on board the Lady Lumbridge in Port Sarim.");
stage = 517;
return true;
}
npc("I Said I would and old Ned is a man of his word!");
stage = 521;
break;
case 521:
npc("So, where's your ship?");
stage = 508;
break;
}
return true;
}
switch (stage) {
case 0:
options("Yes, I would like some rope.", "No thanks Ned, I don't need any.", "Ask about Achievement Diaries");
stage = 1;
break;
case 1:
switch (buttonId) {
case 1:
player("Yes, I would like some rope.");
stage = 10;
break;
case 2:
player("No thanks Ned, I don't need any.");
stage = 20;
break;
case 3:
player("I'd like to talk about Achievement Diaries.");
stage = 900;
break;
}
break;
case 10:
npc("Well, I can sell you some rope for 15 coins. Or I can", "be making you some if you gets me 4 balls of wool. I", "strands them together I does, makes em strong.");
stage = 11;
break;
case 11:
player("You make rope from wool?");
stage = 12;
break;
case 12:
npc("Of course you can!");
stage = 13;
break;
case 13:
player("I thought you needed hemp or jute.");
stage = 14;
break;
case 14:
npc("Do you want some rope or not?");
stage = 15;
break;
case 15:
if (!player.getInventory().containsItem(WOOL)) {
options("Okay, please sell me some rope.", "That's a little more than I want to pay.", "I will go and get some wool.");
stage = 16;
} else {
options("Okay, please sell me some rope.", "I have some balls of wool. Could you make me some rope?", "That's a little more than I want to pay.");
stage = 17;
}
break;
case 17:
switch (buttonId) {
case 1:
player("Okay, please sell me some rope.");
stage = 100;
break;
case 2:
player("I have some balls of wool.", "Could you make me some rope?");
stage = 120;
break;
case 3:
player("That's a little more than I want to pay.");
stage = 200;
break;
}
break;
case 16:
switch (buttonId) {
case 1:
player("Okay, please sell me some rope.");
stage = 100;
break;
case 2:
player("That's a little more than I want to pay.");
stage = 200;
break;
case 3:
player("I will go and get some wool.");
stage = 300;
break;
}
break;
case 40:
switch (buttonId) {
case 1:
player("Ned could you make other things from wool?");
stage = 41;
break;
case 2:
player("Yes, I would like some rope.");
stage = 10;
break;
case 3:
player("No thanks Ned, I don't need any.");
stage = 20;
break;
}
break;
case 41:
npc("I am sure I can. What are you thinking of?");
stage = 42;
break;
case 42:
options("Could you knit me a sweater?", "How about some sort of wig?", "Could you repair the arrow holes in the back of my shirt?");
stage = 43;
break;
case 43:
switch (buttonId) {
case 1:
player("Could you knit me a sweater?");
stage = 44;
break;
case 2:
player("How about some sort of wig?");
stage = 50;
break;
case 3:
player("Could you repair the arrow holes in the", "back of my shirt?");
stage = 4;
break;
case 4:
npc("Ah yes, it's a tough world these days. There's a few", "brave enough to attack from 10 metres away.");
stage = 47;
break;
}
break;
case 44:
npc("Do I look like a member of a sewing circle?", "Be off wi' you. I have fought monsters.", "that would turn your hair blue.");
stage = 45;
break;
case 45:
npc("I dont't need to be laughted at just 'cos I am getting", "a bit old.");
stage = 46;
break;
case 46:
end();
break;
case 47:
sendDialogue("Ned pulls out a nettle and attacks your shirt.");
stage = 48;
break;
case 48:
npc("There you go, good as new.");
stage = 46;
break;
case 50:
npc("Well... That's an interesting thought. Yes, I think I", "could do something. Give me 3 balls of wool and I", "might be able to do it.");
stage = 51;
break;
case 51:
options("I have that now. Please, make me a wig.", "I will come back when I need you to make me one.");
stage = 52;
break;
case 52:
switch (buttonId) {
case 1:
player("I have that now. Please, make me a wig.");
stage = 53;
break;
case 2:
player("I will come back when I need you to make me one.");
stage = 46;
break;
}
break;
case 53:
if (!player.getInventory().containsItem(WIG_WOOL)) {
player("Oh, I seem to have forgotten my wool.");
stage = 46;
return true;
}
npc("Okay, I will have a go.");
stage = 54;
break;
case 54:
sendDialogue("You hand Ned 3 balls of wool. Ned works with the wool", "His hands move with a speed you couldn't imagine.");
stage = 55;
break;
case 55:
if (player.getInventory().remove(WIG_WOOL)) {
if (!player.getInventory().add(WIG)) {
GroundItemManager.create(WIG, player);
}
}
npc("Here you go, how's that for a quick effort?", "Not bad I think!");
stage = 56;
break;
case 56:
interpreter.sendDialogue("Ned gives you a pretty good wig.");
stage = 57;
break;
case 57:
player("Thanks Ned, there's more to you than meets the eye.");
stage = 46;
break;
case 100:
npc("There you go, finest rope in " + GameWorld.getSettings().getName() + ".");
stage = 101;
break;
case 101:
interpreter.sendDialogue("You hand Ned 15 coins. Ned gives you a coil of rope.");
stage = 102;
break;
case 102:
if (player.getInventory().remove(COINS)) {
if (!player.getInventory().add(ROPE)) {
GroundItemManager.create(ROPE, player);
}
} else {
player.getPacketDispatch().sendMessage("You don't have enough coins to pay for rope.");
}
end();
break;
case 120:
interpreter.sendDialogues(npc, null, "Sure I can.");
stage = 121;
break;
case 121:
interpreter.sendDialogue("You hand over 4 balls of wool. Ned gives you a coil of rope.");
stage = 122;
break;
case 122:
if (player.getInventory().remove(WOOL)) {
player.getInventory().add(ROPE);
}
end();
break;
case 200:
npc("Well, if you ever need rope that's the price. Sorry.", "An old sailor needs money for a little drop o' rum.");
stage = 201;
break;
case 201:
end();
break;
case 300:
npc("Aye, you do that. Remember, it takes 4 balls of wool to", "make strong rope.");
stage = 301;
break;
case 301:
end();
break;
case 20:
npc("Well, old Neddy is always here if you do. Tell your", "friends. I can always be using the business.");
stage = 21;
break;
case 21:
end();
break;
case 900:
if (diary == null) {
diary = player.getAchievementDiaryManager().getDiary(DiaryType.LUMBRIDGE);
}
if (diary.isComplete(level, true) && !diary.isLevelRewarded(level)) {
player("I've done all the hard tasks in my Lumbridge", "Achievement Diary.");
stage = 950;
break;
}
if (diary.isLevelRewarded(level) && diary.isComplete(level, true) && !player.hasItem(diary.getType().getRewards(level)[0])) {
player("I've seemed to have lost my explorer's ring...");
stage = 960;
break;
}
options("What is the Achievement Diary?", "What are the rewards?", "How do I claim the rewards?", "See you later.");
stage = 901;
break;
case 901:
switch (buttonId) {
case 1:
player("What is the Achievement Diary?");
stage = 910;
break;
case 2:
player("What are the rewards?");
stage = 920;
break;
case 3:
player("How do I claim the rewards?");
stage = 930;
break;
case 4:
player("See you later!");
stage = 940;
break;
}
break;
case 910:
npc("Ah, well it's a diary that helps you keep track of", "particular achievements you've made in the world of", "2009Scape. In Lumbridge and Draynor i can help you", "discover some very useful things indeed.");
stage++;
break;
case 911:
npc("Eventually with enough exploration you will be", "rewarded for your explorative efforts.");
stage++;
break;
case 912:
npc("You can access your Achievement Diary by going to", "the Quest Journal. When you've opened the Quest", "Journal click on the green star icon on the top right", "hand corner. This will open the diary.");
stage = 900;
break;
case 920:
npc("Ah, well there are different rewards for each", "Achievement Diary. For completing the Lumbridge and", "Draynor diary you are presented with an explorer's", "ring.");
stage++;
break;
case 921:
npc("This ring will become increasingly useful with each", "section of the diary that you complete.");
stage = 900;
break;
case 930:
npc("You need to complete the task so that they're all ticked", "off then you can claim your reward. Most of them are", "straightforward although you might find some required", "quests to be started, if not finished.");
stage++;
break;
case 931:
npc("To claim the explorer's ring speak to Explorer Jack in ", "Lumbridge, Bob in Bob's Axes in Lumbridge, or myself.");
stage = 900;
break;
case 940:
end();
break;
case 950:
npc("Yes I see that, you'll be wanting your", "reward then I assume?");
stage++;
break;
case 951:
player("Yes please.");
stage++;
break;
case 952:
diary.setLevelRewarded(level);
for (Item i : diary.getType().getRewards(level)) {
player.getInventory().add(i, player);
}
npc("This ring is a representation of the adventures you", "went on to complete your tasks.");
stage ++;
break;
case 953:
player("Wow, thanks!");
stage = 900;
break;
case 960:
player.getInventory().add(diary.getType().getRewards(level)[0], player);
npc("You better be more careful this time.");
stage = 900;
break;
}
return true;
}
@Override
public int[] getIds() {
return new int[] { 743 };
} }
} }
@@ -0,0 +1,101 @@
package core.game.content.quest.free.princealirescue
import core.game.content.dialogue.DialogueFile
import core.game.node.item.GroundItemManager
import core.game.node.item.Item
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
private const val STAGE_KNIT_SWEATER = 10
private const val STAGE_KNIT_WIG = 20
private const val STAGE_REPAIR_HOLES = 30
class NedPARDialogue(val questStage: Int) : DialogueFile() {
private val WIG_WOOL = Item(1759, 3)
private val WIG = Item(2421)
override fun handle(componentID: Int, buttonID: Int) {
when(stage){
START_DIALOGUE -> options(
"Ned, could you make other things from wool?",
"Yes, I would like some rope.",
"No thanks Ned, I don't need any."
).also { stage++ }
1 -> when(buttonID){
1 -> player("Ned could you make other things from wool?").also { stage++ }
2 -> {
player("Yes, I would like some rope.")
returnAtStage(10)
}
3 -> player("No thanks Ned, I don't need any.").also { stage = END_DIALOGUE }
}
2 -> npc("I am sure I can. What are you thinking of?").also { stage++ }
3 -> options(
"Could you knit me a sweater?",
"How about some sort of wig?",
"Could you repair the arrow holes in the back of my shirt?"
).also { stage++ }
4 -> when(buttonID){
1 -> player("Could you knit me a sweater?").also { stage = STAGE_KNIT_SWEATER }
2 -> player("How about some sort of wig?").also { stage = STAGE_KNIT_WIG }
3 -> player("Could you repair the arrow holes in the","back of my shirt?").also { stage = STAGE_REPAIR_HOLES }
}
//Knit Sweater
STAGE_KNIT_SWEATER -> npc(
"Do I look like a member of a sewing circle?",
"Be off wi' you. I have fought monsters.",
"that would turn your hair blue."
).also { stage++ }
STAGE_KNIT_SWEATER.substage(1) -> npc(
"I dont't need to be laughted at just 'cos I am getting",
"a bit old."
).also { stage = END_DIALOGUE }
//Knit Wig
STAGE_KNIT_WIG -> npc(
"Well... That's an interesting thought. Yes, I think I",
"could do something. Give me 3 balls of wool and I",
"might be able to do it."
).also { stage++ }
STAGE_KNIT_WIG.substage(1) -> options(
"I have that now. Please, make me a wig.",
"I will come back when I need you to make me one."
).also { stage++ }
STAGE_KNIT_WIG.substage(2) -> when(buttonID){
1 -> player("I have that now. Please, make me a wig.").also { stage++ }
2 -> player("I will come back when I need you to make me one.").also { stage = END_DIALOGUE }
}
STAGE_KNIT_WIG.substage(3) -> {
if(!player!!.inventory.containsItem(WIG_WOOL)){
player("Oh, I seem to have forgotten my wool.")
stage = END_DIALOGUE
} else {
npc("Okay, I will have a go.")
stage++
}
}
STAGE_KNIT_WIG.substage(4) -> interpreter!!.sendDialogue("You hand Ned 3 balls of wool. Ned works with the wool", "His hands move with a speed you couldn't imagine.").also { stage++ }
STAGE_KNIT_WIG.substage(5) -> {
if (player!!.inventory.remove(WIG_WOOL)) {
if (!player!!.inventory.add(WIG)) {
GroundItemManager.create(WIG, player)
}
}
npc("Here you go, how's that for a quick effort?", "Not bad I think!")
stage++
}
STAGE_KNIT_WIG.substage(6) -> interpreter!!.sendDialogue("Ned gives you a pretty good wig.").also { stage++ }
STAGE_KNIT_WIG.substage(7) -> player("Thanks Ned, there's more to you than meets the eye.").also { stage = END_DIALOGUE }
STAGE_REPAIR_HOLES -> interpreter!!.sendDialogue("Ned pulls out a nettle and attacks your shirt.").also { stage++ }
STAGE_REPAIR_HOLES.substage(1) -> npc("There you go, good as new.").also { stage = END_DIALOGUE }
}
}
}