Implemented the varrock teleport destination swap reward for easy diary completion
Fixed the bug with accessing ned's achievement dialogue while one of his quests was in progress
This commit is contained in:
@@ -134,4 +134,12 @@ abstract class DialogueFile {
|
||||
player?.dialogueInterpreter?.sendDialogue(*messages)
|
||||
}
|
||||
|
||||
fun showTopics(vararg topics: Topic<*>) {
|
||||
val validTopics = ArrayList<String>()
|
||||
topics.filter { if(it is IfTopic) it.showCondition else true }.forEach {
|
||||
topic -> interpreter!!.activeTopics.add(topic)
|
||||
validTopics.add(topic.text)
|
||||
}
|
||||
options(*validTopics.toTypedArray())
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package rs09.game.content.dialogue
|
||||
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
|
||||
/**
|
||||
* Topic/IfTopic system backported from my personal project
|
||||
* @author Ceikry
|
||||
*/
|
||||
open class Topic<T>(val expr: FacialExpression, val text: String, val toStage: T) {
|
||||
constructor(text: String, toStage: T) : this(FacialExpression.ASKING, text, toStage)
|
||||
}
|
||||
class IfTopic<T>(expr: FacialExpression, text: String, toStage: T, val showCondition: Boolean) : Topic<T>(expr, text, toStage) {
|
||||
constructor(text: String, toStage: T, showCondition: Boolean) : this(FacialExpression.ASKING, text, toStage, showCondition)
|
||||
}
|
||||
@@ -7,7 +7,10 @@ import core.game.node.entity.player.link.diary.AchievementDiary
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.item.GroundItemManager
|
||||
import core.game.node.item.Item
|
||||
import rs09.game.content.dialogue.IfTopic
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.game.content.quest.free.princealirescue.NedPARDialogue
|
||||
import rs09.game.node.entity.player.link.diary.dialogues.NedDiaryDialogue
|
||||
import rs09.game.world.GameWorld.settings
|
||||
import rs09.tools.DIALOGUE_INITIAL_OPTIONS_HANDLE
|
||||
import rs09.tools.END_DIALOGUE
|
||||
@@ -30,60 +33,28 @@ class NedDialogue(player: Player? = null) : DialoguePlugin(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?"
|
||||
)
|
||||
}
|
||||
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"
|
||||
val dSlayerStage = player.questRepository.getStage("Dragon Slayer")
|
||||
val parStage = player.questRepository.getStage("Prince Ali Rescue")
|
||||
showTopics(
|
||||
IfTopic("I'd like to talk about Dragon Slayer.", NedDSDialogue(dSlayerStage), dSlayerStage == 20 || dSlayerStage == 30),
|
||||
IfTopic("I'd like to talk about Prince Ali Rescue.", NedPARDialogue(parStage), parStage == 20 || parStage == 30 || parStage == 40 || parStage == 50),
|
||||
Topic("Yes, I would like some rope.", 10),
|
||||
Topic("No thanks Ned, I don't need any.", END_DIALOGUE),
|
||||
Topic("I'd like to ask about my Achievement Diary.", NedDiaryDialogue())
|
||||
)
|
||||
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",
|
||||
@@ -218,123 +189,6 @@ class NedDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
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 medium tasks in my Lumbridge", "Achievement Diary.")
|
||||
stage = 950
|
||||
}
|
||||
else 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
|
||||
}
|
||||
else {
|
||||
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
|
||||
}
|
||||
|
||||
+127
@@ -0,0 +1,127 @@
|
||||
package rs09.game.node.entity.player.link.diary.dialogues
|
||||
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
|
||||
class NedDiaryDialogue : DialogueFile() {
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
val diary = player!!.achievementDiaryManager.getDiary(DiaryType.LUMBRIDGE)
|
||||
val level = 2
|
||||
when(stage) {
|
||||
0 -> {
|
||||
if (diary.isComplete(level, true) && !diary.isLevelRewarded(level)) {
|
||||
player("I've done all the medium tasks in my Lumbridge", "Achievement Diary.")
|
||||
stage = 50
|
||||
}
|
||||
else 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 = 60
|
||||
}
|
||||
else {
|
||||
options(
|
||||
"What is the Achievement Diary?",
|
||||
"What are the rewards?",
|
||||
"How do I claim the rewards?",
|
||||
"See you later."
|
||||
)
|
||||
stage = 1
|
||||
}
|
||||
}
|
||||
1 -> when (buttonID) {
|
||||
1 -> {
|
||||
player("What is the Achievement Diary?")
|
||||
stage = 10
|
||||
}
|
||||
2 -> {
|
||||
player("What are the rewards?")
|
||||
stage = 20
|
||||
}
|
||||
3 -> {
|
||||
player("How do I claim the rewards?")
|
||||
stage = 30
|
||||
}
|
||||
4 -> {
|
||||
player("See you later!")
|
||||
stage = 40
|
||||
}
|
||||
}
|
||||
10 -> {
|
||||
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++
|
||||
}
|
||||
11 -> {
|
||||
npc("Eventually with enough exploration you will be", "rewarded for your explorative efforts.")
|
||||
stage++
|
||||
}
|
||||
12 -> {
|
||||
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 = 0
|
||||
}
|
||||
20 -> {
|
||||
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++
|
||||
}
|
||||
21 -> {
|
||||
npc("This ring will become increasingly useful with each", "section of the diary that you complete.")
|
||||
stage = 0
|
||||
}
|
||||
30 -> {
|
||||
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++
|
||||
}
|
||||
31 -> {
|
||||
npc(
|
||||
"To claim the explorer's ring speak to Explorer Jack in ",
|
||||
"Lumbridge, Bob in Bob's Axes in Lumbridge, or myself."
|
||||
)
|
||||
stage = 0
|
||||
}
|
||||
40 -> end()
|
||||
50 -> {
|
||||
npc("Yes I see that, you'll be wanting your", "reward then I assume?")
|
||||
stage++
|
||||
}
|
||||
51 -> {
|
||||
player("Yes please.")
|
||||
stage++
|
||||
}
|
||||
52 -> {
|
||||
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++
|
||||
}
|
||||
53 -> {
|
||||
player("Wow, thanks!")
|
||||
stage = 0
|
||||
}
|
||||
60 -> {
|
||||
player!!.inventory.add(diary.type.getRewards(level)[0], player)
|
||||
npc("You better be more careful this time.")
|
||||
stage = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
package rs09.game.node.entity.player.link.diary.dialogues
|
||||
|
||||
import api.addItemOrDrop
|
||||
import api.getAttribute
|
||||
import api.setAttribute
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.game.content.dialogue.IfTopic
|
||||
import rs09.game.content.dialogue.Topic
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
class RatBurgissDiaryDialogue : DialogueFile() {
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
val diary = player!!.achievementDiaryManager.getDiary(DiaryType.VARROCK)
|
||||
val easyDiaryComplete = diary.isComplete(0)
|
||||
val alternateTeleport = getAttribute(player!!, "diaries:varrock:alttele", false)
|
||||
when(stage) {
|
||||
0 -> {
|
||||
if (easyDiaryComplete && !diary.isLevelRewarded(0)) {
|
||||
playerl(FacialExpression.FRIENDLY, "I think I've finished all of the tasks in my Varrock Achievement Diary.")
|
||||
stage = 40
|
||||
return
|
||||
}
|
||||
else if (diary.isLevelRewarded(0) && !player!!.hasItem(diary.type.getRewards(0)[0])) {
|
||||
playerl(FacialExpression.ANNOYED, "I seem to have lost my armor.")
|
||||
stage = 50
|
||||
return
|
||||
}
|
||||
|
||||
showTopics(
|
||||
Topic("What is the Achievement Diary?", 10),
|
||||
IfTopic("Can I change my Varrock Teleport point?", 100, easyDiaryComplete),
|
||||
Topic("What are the rewards?", 20),
|
||||
Topic("How do I claim the rewards?", 30),
|
||||
Topic(FacialExpression.NEUTRAL, "See you later.", END_DIALOGUE)
|
||||
)
|
||||
}
|
||||
|
||||
10 -> npcl(FacialExpression.FRIENDLY, "It's a diary that helps you keep track of particular achievements. Here in Varrock it can help you discover some quite useful things. Eventually, with enough exploration, the people of Varrock will reward").also { stage++ }
|
||||
11 -> npcl(FacialExpression.FRIENDLY, "you. You can see what tasks you have listed by clicking on the green button in the Quest List.").also { stage = 0 }
|
||||
|
||||
20 -> npcl(FacialExpression.FRIENDLY, "Well, there's three different levels of Varrock Armour, which match up with the three levels of difficulty. Each has the same rewards as the previous level, and an additional one too... but I").also { stage++ }
|
||||
21 -> npcl(FacialExpression.FRIENDLY, "won't spoil your surprise. Rest assured, the people of Varrock are happy to see you visiting the land.").also { stage = 0 }
|
||||
|
||||
30 -> npcl(FacialExpression.FRIENDLY, "Just complete the tasks so they're all ticked off, then you can claim your reward. Most of them are straightforward; you might find some require quests to be started, if not finished.").also { stage++ }
|
||||
31 -> npcl(FacialExpression.FRIENDLY, "To claim the different Varrock Armour, speak to Vannaka, Reldo, and myself.").also { stage = 0 }
|
||||
|
||||
40 -> npcl(FacialExpression.FRIENDLY, "You have? Excellent! Well done.").also { stage++ }
|
||||
41 -> playerl(FacialExpression.FRIENDLY, "Thank you. Uh... can I have the reward?").also { stage++ }
|
||||
42 -> npcl(FacialExpression.FRIENDLY, "Reward? Ah yes! Of course. Your reward, it's right here.").also { stage++ }
|
||||
43 -> {
|
||||
diary.setLevelRewarded(0)
|
||||
diary.type.getRewards(0).forEach { addItemOrDrop(player!!, it.id, it.amount) }
|
||||
npcl(FacialExpression.FRIENDLY, "Now, this body armour is magically enhanced to help you with your Smithing and Mining. There is a furnace, not far from here, in Edgeville. Use this armour there and, when smelting ores up to and")
|
||||
stage++
|
||||
}
|
||||
44 -> npcl(FacialExpression.FRIENDLY, "including steel, you will have a chance of making an extra bar every time. Also, when you mine with this armour on, you will have a chance of Mining extra ores from rocks up to and including coal.").also { stage++ }
|
||||
45 -> npcl(FacialExpression.FRIENDLY, "Bear in mind that you will need to be wearing the armour for either of these to work. I will speak to the shopkeepers around Varrock who sell armour and weapons to get you better prices when you are").also { stage++ }
|
||||
46 -> npcl(FacialExpression.FRIENDLY, "wearing it. I can also change your Varrock Teleport spell so that it takes you to the Grand Exchange, if you'd find that more convenient.").also { stage++ }
|
||||
47 -> npcl(FacialExpression.FRIENDLY, "As an extra reward, you can also have this old magical lamp to help you with your skills. I was going to use it myself, but I don't really need it.").also { stage++ }
|
||||
48 -> playerl(FacialExpression.FRIENDLY, "Wow, thanks!").also { stage++ }
|
||||
49 -> npcl(FacialExpression.FRIENDLY, "If you should lose this armour, come back and see me for another set.").also { stage = 0 }
|
||||
|
||||
50 -> {
|
||||
addItemOrDrop(player!!, diary.type.getRewards(0)[0].id, 1)
|
||||
npcl(FacialExpression.ANNOYED, "You better be more careful this time.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
|
||||
100 -> showTopics(
|
||||
IfTopic("I'd like to teleport to the Grand Exchange.", 101, easyDiaryComplete && !alternateTeleport),
|
||||
IfTopic("I'd like to teleport to the city square.", 102, easyDiaryComplete && alternateTeleport),
|
||||
Topic("Nevermind.", END_DIALOGUE)
|
||||
)
|
||||
|
||||
101 -> {
|
||||
npcl(FacialExpression.FRIENDLY, "There you are, your Varrock teleport will now take you to the Grand Exchange.")
|
||||
setAttribute(player!!, "/save:diaries:varrock:alttele", true)
|
||||
stage = 0
|
||||
}
|
||||
102 -> {
|
||||
npcl(FacialExpression.FRIENDLY, "There you are, your Varrock teleport will now take you to the city square.")
|
||||
setAttribute(player!!, "/save:diaries:varrock:alttele", false)
|
||||
stage = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package rs09.game.node.entity.skill.magic
|
||||
|
||||
import api.getAttribute
|
||||
import core.game.content.activity.mta.impl.GraveyardZone
|
||||
import core.game.content.global.Bones
|
||||
import core.game.node.entity.Entity
|
||||
@@ -62,7 +63,9 @@ class ModernListeners : SpellListener("modern"){
|
||||
onCast(Modern.VARROCK_TELEPORT,NONE){player, _->
|
||||
requires(player,25, arrayOf(Item(Items.FIRE_RUNE_554),Item(Items.AIR_RUNE_556,3),Item(Items.LAW_RUNE_563)))
|
||||
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK,1, 13)
|
||||
sendTeleport(player,35.0,Location.create(3213, 3424, 0))
|
||||
val alternateTeleport = getAttribute(player, "diaries:varrock:alttele", false)
|
||||
val dest = if(alternateTeleport) Location.create(3165, 3472, 0) else Location.create(3213, 3424, 0)
|
||||
sendTeleport(player,35.0, dest)
|
||||
}
|
||||
|
||||
onCast(Modern.LUMBRIDGE_TELEPORT,NONE){player,_ ->
|
||||
|
||||
Reference in New Issue
Block a user