Fixed Elsie dialogue logic and formatting

This commit is contained in:
Regenleif 2022-03-26 04:09:02 +00:00 committed by Ryan
parent 4460adac49
commit 3bbe96e3a0

View file

@ -10,12 +10,13 @@ import org.rs09.consts.Items
/** /**
* Elsie * Elsie
* @author afaroutdude * @author afaroutdude
* @author Regenleif
*/ */
@Initializable @Initializable
class ElsieDialogue(player: Player? = null) : DialoguePlugin(player) { class ElsieDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
when (player.inventory.containsAtLeastOneItem(Items.CUP_OF_TEA_712)) { when (player.inventory.containsAtLeastOneItem(Items.CUP_OF_TEA_712)) {
true -> npc("Ooh - that looks like a lovely cup of tea, dearie. Is it for", "me?").also { stage = 100 } true -> npc("Ooh - that looks like a lovely cup of tea, dearie.", "Is it for me?").also { stage = 100 }
false -> npc("Hello dearie! What can old Elsie do for you?").also { stage = 10 } false -> npc("Hello dearie! What can old Elsie do for you?").also { stage = 10 }
} }
return true return true
@ -28,40 +29,36 @@ class ElsieDialogue(player: Player? = null) : DialoguePlugin(player) {
10 -> interpreter.sendOptions("What would you like to say?", "What are you making?", "Can you tell me a story?", "Can you tell me how to get rich?").also { stage++ } 10 -> interpreter.sendOptions("What would you like to say?", "What are you making?", "Can you tell me a story?", "Can you tell me how to get rich?").also { stage++ }
11 -> 11 ->
when (buttonId) { when (buttonId) {
1 -> player("What are you making?").also { stage = 20 } 1 -> player("What are you making?").also { stage = 21 }
2 -> player("Can you tell me a story?").also { stage = 30 } 2 -> player("Can you tell me a story?").also { stage = 31 }
3 -> player("Can you tell me how to get rich?").also { stage = 40 } 3 -> player("Can you tell me how to get rich?").also { stage = 41 }
} }
20 -> player("What are you making?").also { stage++ }
21 -> npc("I'm knitting a new stole for Father Lawrence", "downstairs. He could do with something to keep his", "neck warm, standing in that draughty old church", "all day.").also { stage++ } 21 -> npc("I'm knitting a new stole for Father Lawrence", "downstairs. He could do with something to keep his", "neck warm, standing in that draughty old church", "all day.").also { stage++ }
22 -> interpreter.sendOptions("What would you like to say?", "Can you tell me a story?", "Can you tell me how to get rich?").also { stage++ } 22 -> interpreter.sendOptions("What would you like to say?", "Can you tell me a story?", "Can you tell me how to get rich?").also { stage++ }
23 -> 23 ->
when (buttonId) { when (buttonId) {
1 -> player("Can you tell me a story?").also { stage = 30 } 1 -> player("Can you tell me a story?").also { stage = 31 }
2 -> player("Can you tell me how to get rich?").also { stage = 40 } 2 -> player("Can you tell me how to get rich?").also { stage = 41 }
} }
30 -> player("Can you tell me a story?").also { stage++ }
31 -> npc("Maybe I could tell you a story if you'd fetch me", "a nice cup of tea.").also { stage++ } 31 -> npc("Maybe I could tell you a story if you'd fetch me", "a nice cup of tea.").also { stage++ }
32 -> player("I'll think about it.").also { stage == 999 } 32 -> player("I'll think about it.").also { stage = 999 }
40 -> player("Can you tell me how to get rich??").also { stage++ } 41 -> npc("Well, dearie, I'm probably not the best person to", "ask about money, but I think the best thing would", "be for you to get a good trade. If you've got a trade", "you can earn your way, that's what my old father told me.").also { stage++ }
41 -> npc("Well, dearie, I'm probably not the best person to ask about money, but I think the best thing would be for you to get a good trade. If you've got a trade you can earn your way, that's what my old father told me,").also { stage++ } 42 -> npc("Saradomin rest his soul. I hear people try to get", "rich by fighting in the Wilderness north of here or", "the Duel Arena in the south, but that's no way for honest", "folks to earn a living! So get yourself a good trade, and").also { stage++ }
42 -> npc("Saradomin rest his soul. I hear people try to get rich by fighting in the Wilderness north of here or the Duel Arena in the south, but that's no way for honest folks to earn a living! So get yourself a good trade, and keep").also { stage++ } 43 -> npc("keep working at it. There's always folks wanting", "to buy ore and food around here.").also { stage++ }
43 -> npc("working at it. There's always folks wanting to buy ore and food around here.").also { stage++ }
44 -> player("Thanks, old woman.").also { stage++ } 44 -> player("Thanks, old woman.").also { stage++ }
45 -> interpreter.sendOptions("What would you like to say?", "What are you making?", "Can you tell me a story?").also { stage++ } 45 -> interpreter.sendOptions("What would you like to say?", "What are you making?", "Can you tell me a story?").also { stage++ }
46 -> 46 ->
when (buttonId) { when (buttonId) {
1 -> player("What are you making?").also { stage = 20 } 1 -> player("What are you making?").also { stage = 21 }
2 -> player("Can you tell me a story?").also { stage = 30 } 2 -> player("Can you tell me a story?").also { stage = 31 }
} }
100 -> interpreter.sendOptions("What would you like to say?", "Yes, you can have it.", "No, keep your hands off my tea.").also { stage++ } 100 -> interpreter.sendOptions("What would you like to say?", "Yes, you can have it.", "No, keep your hands off my tea.").also { stage++ }
101 -> 101 ->
when (buttonId) { when (buttonId) {
1 -> player("Yes, you can have it.").also { stage++ } 1 -> player("Yes, you can have it.").also { stage = 103 }
2 -> player("No, keep your hands off my tea.").also { stage = 120 } 2 -> player("No, keep your hands off my tea.").also { stage = 120 }
} }
102 -> player("Yes, you can have it.").also { stage++ }
103 -> npc("Ahh, there's nothing like a nice cuppa tea. I know what,", "I'll tell you a story to thank you for the lovely tea...").also { 103 -> npc("Ahh, there's nothing like a nice cuppa tea. I know what,", "I'll tell you a story to thank you for the lovely tea...").also {
player.inventory.remove(Item(Items.CUP_OF_TEA_712)) player.inventory.remove(Item(Items.CUP_OF_TEA_712))
player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 0, 14) player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 0, 14)
@ -75,14 +72,16 @@ class ElsieDialogue(player: Player? = null) : DialoguePlugin(player) {
109 -> npc("Dissy left town after that, saying he wanted to see the", "world. It was such a shame, he had the most handsome", "shoulders...").also { stage++ } 109 -> npc("Dissy left town after that, saying he wanted to see the", "world. It was such a shame, he had the most handsome", "shoulders...").also { stage++ }
110 -> npc("A young man came here looking for stories about Dissy", "- of course, that's not his proper name, but his friends", "called him Dissy - and I told him that one. He said", "Dissy had become a really famous man and there was").also { stage++ } 110 -> npc("A young man came here looking for stories about Dissy", "- of course, that's not his proper name, but his friends", "called him Dissy - and I told him that one. He said", "Dissy had become a really famous man and there was").also { stage++ }
111 -> npc("going to be a book about him. Well, that's all good, but I", "do wish Dissy had just come back to Varrock. I did", "miss him so much... well, until I met my Freddie and", "we got married, but that's another story.").also { stage++ } 111 -> npc("going to be a book about him. Well, that's all good, but I", "do wish Dissy had just come back to Varrock. I did", "miss him so much... well, until I met my Freddie and", "we got married, but that's another story.").also { stage++ }
112 -> player("Thank you. I'll leave you to your knitting now.").also { stage = 999 } 112 -> player("Thank you. I'll leave you to", "your knitting now.").also { stage = 999 }
120 -> npc("Aww. Maybe another time. Anyway, what can old Elsie do for you?").also { stage++ } 120 -> npc("Aww. Maybe another time.", "Anyway, what can old Elsie do for you?").also { stage++ }
121 -> 121 -> interpreter.sendOptions("What would you like to say?", "What are you making?", "Can you tell me a story?", "Can you tell me how to get rich?").also { stage++ }
122 ->
when (buttonId) { when (buttonId) {
1 -> player("What are you making?").also { stage = 20 } 1 -> player("What are you making?").also { stage = 21 }
2 -> player("Can you tell me a story?").also { stage = 122 } 2 -> player("Can you tell me a story?").also { stage = 123 }
3 -> player("Can you tell me how to get rich?").also { stage = 41 }
} }
122 -> npc("Well, maybe I could tell a story if you'd give me that lovely cup of tea you've got there.").also { stage = 100 } 123 -> npc("Well, maybe I could tell a story if you'd give", "me that lovely cup of tea you've got there.").also { stage = 100 }
} }
return true; return true;
} }
@ -95,4 +94,4 @@ class ElsieDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun getIds(): IntArray { override fun getIds(): IntArray {
return intArrayOf(5915) return intArrayOf(5915)
} }
} }