diff --git a/Server/src/main/content/global/skill/construction/CrestType.kt b/Server/src/main/content/global/skill/construction/CrestType.kt index 550480f40..99d03f3fd 100644 --- a/Server/src/main/content/global/skill/construction/CrestType.kt +++ b/Server/src/main/content/global/skill/construction/CrestType.kt @@ -1,6 +1,7 @@ package content.global.skill.construction import content.data.Quests +import core.api.* import core.game.node.entity.player.Player import core.game.node.entity.skill.Skills import org.rs09.consts.Items @@ -10,26 +11,22 @@ import org.rs09.consts.Items */ enum class CrestType(val crestName: String, val cost: Int = 5000, private val requirement: (Player) -> Boolean = { true }) { - ARRAV("the Shield of Arrav symbol", requirement = { it.questRepository.isComplete(Quests.SHIELD_OF_ARRAV) }), + ARRAV("the Shield of Arrav symbol", requirement = { isQuestComplete(it, Quests.SHIELD_OF_ARRAV) }), ASGARNIA("the symbol of Asgarnia"), - DORGESHUUN("the Dorgeshuun brooch", requirement = { it.questRepository.isComplete(Quests.THE_LOST_TRIBE) }), - DRAGON("a dragon", requirement = { it.questRepository.isComplete(Quests.DRAGON_SLAYER) }), - FAIRY("a fairy", requirement = { it.questRepository.isComplete(Quests.LOST_CITY) }), - GUTHIX("the symbol of Guthix", requirement = { it.skills.hasLevel(Skills.PRAYER, 70) }), + DORGESHUUN("the Dorgeshuun brooch", requirement = { isQuestComplete(it, Quests.THE_LOST_TRIBE) }), + DRAGON("a dragon", requirement = { isQuestComplete(it, Quests.DRAGON_SLAYER) }), + FAIRY("a fairy", requirement = { isQuestComplete(it, Quests.LOST_CITY) }), + GUTHIX("the symbol of Guthix", requirement = { hasLevelStat(it, Skills.PRAYER, 70) }), HAM("the symbol of the HAM cult."), - HORSE("a horse", requirement = { player -> - player.inventory.containsAtLeastOneItem( - intArrayOf(Items.TOY_HORSEY_2524, Items.TOY_HORSEY_2520, Items.TOY_HORSEY_2526, Items.TOY_HORSEY_2522) - ) - }), + HORSE("a horse", requirement = { anyInInventory(it, Items.TOY_HORSEY_2524, Items.TOY_HORSEY_2520, Items.TOY_HORSEY_2526, Items.TOY_HORSEY_2522) }), JOGRE("Jiggig"), KANDARIN("the symbol of Kandarin"), MISTHALIN("the symbol of Misthalin"), MONEY("a bag of money", cost = 500000), - SARADOMIN("the symbol of Saradomin", requirement = { it.skills.hasLevel(Skills.PRAYER, 70) }), + SARADOMIN("the symbol of Saradomin", requirement = { hasLevelStat(it, Skills.PRAYER, 70) }), SKULL("a skull", requirement = { it.skullManager.isSkulled }), VARROCK("the symbol of Varrock"), - ZAMORAK("the symbol of Zamorak", requirement = { it.skills.hasLevel(Skills.PRAYER, 70) }); + ZAMORAK("the symbol of Zamorak", requirement = { hasLevelStat(it, Skills.PRAYER, 70) }); fun eligible(player: Player): Boolean = requirement(player) } \ No newline at end of file diff --git a/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt b/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt index 3276943a6..a5d2139ee 100644 --- a/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt +++ b/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt @@ -3,774 +3,553 @@ package content.region.asgarnia.falador.dialogue import content.global.skill.construction.CrestType import core.ServerConstants import core.Util +import core.api.amountInInventory import core.api.getAttribute -import core.game.dialogue.DialoguePlugin -import core.game.dialogue.FacialExpression +import core.api.hasLevelStat +import core.api.removeItem +import core.api.setAttribute +import core.game.dialogue.ChatAnim +import core.game.dialogue.DialogueLabeller +import core.game.dialogue.DialogueOption +import core.game.interaction.IntType +import core.game.interaction.InteractionListener import core.game.node.entity.npc.NPC -import core.game.node.entity.player.Player import core.game.node.entity.player.link.diary.DiaryType import core.game.node.entity.skill.Skills import core.game.node.item.Item -import core.plugin.Initializable import core.tools.RandomFunction import org.rs09.consts.Items.COINS_995 import org.rs09.consts.NPCs -/** - * Represents the dialogue to handle Sir Renitee - * - * @author afaroutdude - */ -@Initializable -class SirReniteeDialogue : DialoguePlugin { - /** - * Constructs a new `SirReniteeDialogue` `Object`. - */ - constructor() - - constructor(player: Player?) : super(player) - - override fun open(vararg args: Any?): Boolean { - npc = args[0] as NPC? - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Hmm? What's that, young " + (if (player.appearance - .isMale - ) "man" else "woman") + "? What can I do for", - "you?" - ) - stage = 0 - return true - } - - override fun handle(interfaceId: Int, buttonId: Int): Boolean { - when (stage) { - 0 -> { - interpreter.sendOptions("Select an Option", "I don't know, what can you do for me?", "Nothing, thanks") - stage = 10 - } - - 10 -> when (buttonId) { - 1 -> { - interpreter.sendDialogues( - player, - FacialExpression.HALF_GUILTY, - "I don't know, what can you do for me?" - ) - stage = 100 - } - - 2 -> { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Nothing, thanks.") - stage = 30 - } - } - - 30 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Mmm, well, see you some other time maybe." - ) - stage = 40 - } - - 40 -> end() - 100 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Hmm, well, mmm, do you have a family crest? I keep", - "track of every " + ServerConstants.SERVER_NAME + " family, you know, so I might", - "be able to find yours." - ) - stage = 110 - } - - 110 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "I'm also something of an, mmm, a painter. If you've", - "met any important persons or visited any nice places I", - "could paint them for you." - ) - stage = 120 - } - - 120 -> { - interpreter.sendOptions( - "Select an Option", - "Can you see if I have a family crest?", - "Can I buy a painting?" - ) - stage = 130 - } - - 130 -> when (buttonId) { - 1 -> { - interpreter.sendDialogues( - player, - FacialExpression.HALF_GUILTY, - "Can you see if I have a family crest?" - ) - stage = 200 - } - - 2 -> { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Can I buy a painting?") - stage = 500 - } - } - - 200 -> { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "What is your name?") - stage = 210 - } - - 210 -> { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, player.username + ".") - stage = 220 - } - - 220 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Mmm, " + player.username + ", let me see..." - ) - stage = 230 - } - - 230 -> if (player.getSkills().hasLevel(Skills.CONSTRUCTION, 16)) { - if (getAttribute(player, "sir-renitee-assigned-crest", false)) { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "According to my records, your crest is ", - player.houseManager.crest.crestName + "." - ) - } else { - val c = RandomFunction.random(4) - val crests = arrayOf( - CrestType.VARROCK, - CrestType.ASGARNIA, - CrestType.KANDARIN, - CrestType.MISTHALIN - ) - val crest = crests[c] - player.houseManager.crest = crest - player.setAttribute("/save:sir-renitee-assigned-crest", true) - var message = "that can be your" - if (crest === CrestType.VARROCK) { - message = "you can use that city's" - } - interpreter.sendDialogues( - npc, FacialExpression.HALF_GUILTY, "Well, I don't think you have any noble blood,", - "but I see that your ancestors came from " + Util.enumToString( - player.houseManager.crest.name - ) + ",", " so $message crest." - ) - } - if (!player.achievementDiaryManager.getDiary(DiaryType.FALADOR).isComplete(0, 4)) { - player.achievementDiaryManager.getDiary(DiaryType.FALADOR).updateTask(player, 0, 4, true) - } - stage = 240 - } else { - interpreter.sendDialogues( - npc, FacialExpression.HALF_GUILTY, - "First thing's first, young " + (if (player.appearance.isMale - ) "man" else "woman") + "! There is not much point", - "in having a family crest if you cannot display it." - ) - stage = 235 - } - - 235 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "You should train construction until you can build a wall", - "decoration in your dining room." - ) - stage = 40 - } - - 240 -> { - interpreter.sendOptions( - "Select an Option", - "I don't like that crest. Can I have a different one?", - "Thanks!" - ) - stage = 250 - } - - 250 -> when (buttonId) { - 1 -> { - interpreter.sendDialogues( - player, - FacialExpression.HALF_GUILTY, - "I don't like that crest. Can I have a different one?" - ) - stage = 300 - } - - 2 -> { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Thanks!") - stage = 260 - } - } - - 260 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "You're welcome, my " + (if (player.appearance.isMale) "boy." else "girl.") - ) - stage = 40 - } - - 300 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Mmm, very well. Changing your crest will cost", - "5,000 coins." - ) - if (player.inventory.getAmount(COINS_995) < 5000) { - stage = 302 - } else { - stage = 305 - } - } - - 302 -> { - interpreter.sendDialogues( - player, - FacialExpression.HALF_GUILTY, - "I'll have to go and get some money then." - ) - stage = 40 - } - - 305 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "There are sixteen different symbols;", - "which one would you like?" - ) - stage = 310 - } - - 310 -> { - interpreter.sendOptions( - "Select an Option", - "Shield of Arrav", - "Asgarnia", - "Dorgeshuun Symbol", - "Dragon", - "More..." - ) - stage = 320 - } - - 320 -> when (buttonId) { - 1 -> { - val c = CrestType.ARRAV - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Ah yes, the shield that you helped to retrieve. You have", - "certainly earned the right to wear its symbol." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 2 -> { - val c = CrestType.ASGARNIA - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Ah, splendid, splendid. There is no better symbol", - "than that of our fair land!" - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 3 -> { - val c = CrestType.DORGESHUUN - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Ah yes, our new neighbours under Lumbridge. I hear", - "you were the one who made contact with them, jolly good." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Hmm, have you ever even met the Dorgeshuun? I don't", - "think you should wear their symbol until you have", - "made contact with that lost tribe." - ) - stage = 310 - } - } - - 4 -> { - val c = CrestType.DRAGON - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "I see you are a mighty dragon-slayer! You have", - "certainly earned the right to wear a dragon symbol." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 5 -> { - interpreter.sendOptions("Select an option", "Fairy", "Guthix", "HAM", "Horse", "More...") - stage = 330 - } - } - - 330 -> when (buttonId) { - 1 -> { - val c = CrestType.FAIRY - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Hmm, mmm, yes, everyone likes pretty fairies." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 2 -> { - val c = CrestType.GUTHIX - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Guthix, god of balance! I'm a Saradominist myself,", - "you know, but we all find meaning in our own way, what?" - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "You do not seem to be very devoted to any god.", - "I will not let you have a divine symbol", - "unless you have level 70 prayer." - ) - stage = 310 - } - } - - 3 -> { - val c = CrestType.HAM - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Hmm, I'm not sure I like that HAM group, their", - "beliefs are a little extreme for me.", - "But if that's what you want." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 4 -> { - val c = CrestType.HORSE - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, FacialExpression.HALF_GUILTY, "Ah, I see you've brought a toy horse for me to see. An", - "interesting beast. Certainly you can use that as your", - "crest if you like, although it seems a bit strange to me." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "A horse? I know people talk about them, but I'm not at all sure", - "they ever existed. I don't think I could let you use as", - "your symbol unless you can fetch me some kind of model of one." - ) - stage = 310 - } - } - - 5 -> { - interpreter.sendOptions("Select an option", "Jogre", "Kandarin", "Misthalin", "Money", "More...") - stage = 340 - } - } - - 340 -> when (buttonId) { - 1 -> { - val c = CrestType.JOGRE - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "A Jungle Ogre, eh? Odd beast, very odd." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 2 -> { - val c = CrestType.KANDARIN - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Our neighbours in the west? Very good, very good." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 3 -> { - val c = CrestType.MISTHALIN - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Ah, the fair land of Lumbridge and Varrock." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 4 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "You wish to represent yourself by a moneybag?", - "I think to make that meaningful I should increase", - "the price to 500,000 coins. Do you agree?" - ) - stage = 342 - } - - 5 -> { - interpreter.sendOptions("Select an option", "Saradomin", "Skull", "Varrock", "Zamorak", "More...") - stage = 350 - } - } - - 341 -> { - interpreter.sendOptions("Select an option", "All right.", "No way!") - stage = 342 - } - - 342 -> when (buttonId) { - 1 -> { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "All right.") - val c = CrestType.MONEY - if (c.eligible(player) && player.inventory.getAmount(COINS_995) > c.cost) { - stage = 343 - } else { - stage = 302 - } - } - - 2 -> { - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No way!") - stage = 344 - } - } - - 343 -> { - val c = CrestType.MONEY - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Thank you very much! You may now use a money-bag", - "as your symbol." - ) - stage = 40 - } else { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") - stage = 310 - } - } - - 344 -> { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Well we can't have just any pauper using a money-bag", - "as a symbol, can we? You'll have to choose a", - "different symbol." - ) - stage = 310 - } - - 350 -> when (buttonId) { - 1 -> { - val c = CrestType.SARADOMIN - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Ah, the great god Saradomin! May he smile on your house", - "as you adorn it with his symbol!" - ) - if (!player.achievementDiaryManager.getDiary(DiaryType.FALADOR).isComplete(2, 1)) { - player.achievementDiaryManager.getDiary(DiaryType.FALADOR) - .updateTask(player, 2, 1, true) - } - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "You do not seem to be very devoted to any god.", - "I will not let you have a divine symbol", - "unless you have level 70 prayer." - ) - stage = 310 - } - } - - 2 -> { - val c = CrestType.SKULL - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "Of, of course you can have a skull symbol, " + (if (player.appearance - .isMale - ) "sir!" else "madam!") - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "A symbol of death? You do not seem like a killer to me;", - "perhaps some other symbol would suit you better." - ) - stage = 310 - } - } - - 3 -> { - val c = CrestType.VARROCK - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Ah, Varrock, a fine city!") - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "[MISSING DIALOGUE - NOT ELIGIBLE]" - ) - stage = 310 - } - } - - 4 -> { - val c = CrestType.ZAMORAK - if (c.eligible(player) && player.inventory - .getAmount(COINS_995) > c.cost && player.inventory.remove( - Item(COINS_995, c.cost) - ) - ) { - player.houseManager.crest = c - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "The god of Chaos? It is a terrible thing to worship", - "that evil being. But if that is what you wish..." - ) - stage = 40 - } else { - interpreter.sendDialogues( - npc, - FacialExpression.HALF_GUILTY, - "You do not seem to be very devoted to any god.", - "I will not let you have a divine symbol", - "unless you have level 70 prayer." - ) - stage = 310 - } - } - - 5 -> { - interpreter.sendOptions( - "Select an Option", - "Shield of Arrav", - "Asgarnia", - "Dorgeshuun Symbol", - "Dragon", - "More..." - ) - stage = 320 - } - } - - 500 -> { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "[MISSING DIALOGUE - UNIMPLIMENTED]") - stage = 40 - } +class SirReniteeDialogue : InteractionListener { + override fun defineListeners() { + on(NPCs.SIR_RENITEE_4249, IntType.NPC, "talk-to") { player, node -> + DialogueLabeller.open(player, SirReniteeDialogueFile(), node as NPC) + return@on true } - return true - } - - override fun newInstance(player: Player?): DialoguePlugin { - return SirReniteeDialogue(player) - } - - override fun getIds(): IntArray { - return intArrayOf(NPCs.SIR_RENITEE_4249) } } + +class SirReniteeDialogueFile : DialogueLabeller() { + + private companion object { + const val attributeCrest = "/save:sir-renitee-assigned-crest" + + const val labelNothing = "nothing" + const val labelIntro = "intro" + const val labelFamilyCrest = "family-crest" + const val labelNoConstructionLevel = "no-construction-level" + const val labelHasConstructionLevel = "has-construction-level" + const val labelShowExistingCrest = "show-existing-crest" + const val labelShowNewCrest = "show-new-crest" + const val labelCrestOptions = "crest-options" + const val labelThanks = "thanks" + const val labelChangeCrest = "change-crest" + const val labelNoMoney = "no-money" + const val labelChooseSymbol = "choose-symbol" + const val labelCrestPage1 = "crest-page1" + const val labelCrestPage2 = "crest-page2" + const val labelCrestPage3 = "crest-page3" + const val labelCrestPage4 = "crest-page4" + const val labelCrestArrav = "crest-arrav" + const val labelCrestArravOk = "crest-arrav-ok" + const val labelCrestArravFail = "crest-arrav-fail" + const val labelCrestAsgarnia = "crest-asgarnia" + const val labelCrestAsgarniaOk = "crest-asgarnia-ok" + const val labelCrestAsgarniaFail = "crest-asgarnia-fail" + const val labelCrestDorgeshuun = "crest-dorgeshuun" + const val labelCrestDorgeshuunOk = "crest-dorgeshuun-ok" + const val labelCrestDorgeshuunFail = "crest-dorgeshuun-fail" + const val labelCrestDragon = "crest-dragon" + const val labelCrestDragonOk = "crest-dragon-ok" + const val labelCrestDragonFail = "crest-dragon-fail" + const val labelCrestFairy = "crest-fairy" + const val labelCrestFairyOk = "crest-fairy-ok" + const val labelCrestFairyFail = "crest-fairy-fail" + const val labelCrestGuthix = "crest-guthix" + const val labelCrestGuthixOk = "crest-guthix-ok" + const val labelCrestGuthixFail = "crest-guthix-fail" + const val labelCrestHam = "crest-ham" + const val labelCrestHamOk = "crest-ham-ok" + const val labelCrestHamFail = "crest-ham-fail" + const val labelCrestHorse = "crest-horse" + const val labelCrestHorseOk = "crest-horse-ok" + const val labelCrestHorseFail = "crest-horse-fail" + const val labelCrestJogre = "crest-jogre" + const val labelCrestJogreOk = "crest-jogre-ok" + const val labelCrestJogreFail = "crest-jogre-fail" + const val labelCrestKandarin = "crest-kandarin" + const val labelCrestKandarinOk = "crest-kandarin-ok" + const val labelCrestKandarinFail = "crest-kandarin-fail" + const val labelCrestMisthalin = "crest-misthalin" + const val labelCrestMisthalinOk = "crest-misthalin-ok" + const val labelCrestMisthalinFail = "crest-misthalin-fail" + const val labelCrestMoney = "crest-money" + const val labelMoneyAgree = "money-agree" + const val labelMoneyOk = "money-ok" + const val labelMoneyRefuse = "money-refuse" + const val labelCrestSaradomin = "crest-saradomin" + const val labelCrestSaradominOk = "crest-saradomin-ok" + const val labelCrestSaradominFail = "crest-saradomin-fail" + const val labelCrestSkull = "crest-skull" + const val labelCrestSkullOk = "crest-skull-ok" + const val labelCrestSkullFail = "crest-skull-fail" + const val labelCrestVarrock = "crest-varrock" + const val labelCrestVarrockOk = "crest-varrock-ok" + const val labelCrestVarrockFail = "crest-varrock-fail" + const val labelCrestZamorak = "crest-zamorak" + const val labelCrestZamorakOk = "crest-zamorak-ok" + const val labelCrestZamorakFail = "crest-zamorak-fail" + const val labelPainting = "painting" + } + + override fun addConversation() { + npc(ChatAnim.HALF_GUILTY, "Hmm? What's that, young ${if (player!!.isMale) "man" else "woman"}? What can I do for", "you?") + options( + DialogueOption(labelIntro, "I don't know, what can you do for me?", expression = ChatAnim.HALF_GUILTY), + DialogueOption(labelNothing, "Nothing, thanks", spokenText = "Nothing, thanks.", expression = ChatAnim.HALF_GUILTY), + ) + + label(labelNothing) + npc(ChatAnim.HALF_GUILTY, "Mmm, well, see you some other time maybe.") + + label(labelIntro) + npc(ChatAnim.HALF_GUILTY, "Hmm, well, mmm, do you have a family crest? I keep", + "track of every ${ServerConstants.SERVER_NAME} family, you know, so I might", "be able to find yours.") + npc(ChatAnim.HALF_GUILTY, "I'm also something of an, mmm, a painter. If you've", + "met any important persons or visited any nice places I", "could paint them for you.") + options( + DialogueOption(labelFamilyCrest, "Can you see if I have a family crest?", expression = ChatAnim.HALF_GUILTY), + DialogueOption(labelPainting, "Can I buy a painting?", expression = ChatAnim.HALF_GUILTY), + ) + + label(labelFamilyCrest) + npc(ChatAnim.HALF_GUILTY, "What is your name?") + player(ChatAnim.HALF_GUILTY, "${player!!.username}.") + npc(ChatAnim.HALF_GUILTY, "Mmm, ${player!!.username}, let me see...") + exec { player, _ -> + if (hasLevelStat(player, Skills.CONSTRUCTION, 16)) { + loadLabel(player, labelHasConstructionLevel) + } else { + loadLabel(player, labelNoConstructionLevel) + } + } + + label(labelNoConstructionLevel) + npc(ChatAnim.HALF_GUILTY, "First thing's first, young ${if (player!!.isMale) "man" else "woman"}! There is not much point", + "in having a family crest if you cannot display it.") + npc(ChatAnim.HALF_GUILTY, "You should train construction until you can build a wall", + "decoration in your dining room.") + + label(labelHasConstructionLevel) + exec { player, _ -> + if (getAttribute(player, attributeCrest, false)) { + loadLabel(player, labelShowExistingCrest) + } else { + val crests = arrayOf(CrestType.VARROCK, CrestType.ASGARNIA, CrestType.KANDARIN, CrestType.MISTHALIN) + player.houseManager.crest = crests[RandomFunction.random(4)] + setAttribute(player, attributeCrest, true) + loadLabel(player, labelShowNewCrest) + } + if (!player.achievementDiaryManager.getDiary(DiaryType.FALADOR).isComplete(0, 4)) { + player.achievementDiaryManager.getDiary(DiaryType.FALADOR).updateTask(player, 0, 4, true) + } + } + + label(labelShowExistingCrest) + npc(ChatAnim.HALF_GUILTY, "According to my records, your crest is ", + "${player!!.houseManager.crest.crestName}.") + goto(labelCrestOptions) + + label(labelShowNewCrest) + npc(ChatAnim.HALF_GUILTY, "Well, I don't think you have any noble blood,", + "but I see that your ancestors came from ${Util.enumToString(player!!.houseManager.crest.name)},", + "so ${if (player!!.houseManager.crest == CrestType.VARROCK) "you can use that city's" else "that can be your"} crest.") + goto(labelCrestOptions) + + label(labelCrestOptions) + options( + DialogueOption(labelChangeCrest, "I don't like that crest. Can I have a different one?", expression = ChatAnim.HALF_GUILTY), + DialogueOption(labelThanks, "Thanks!", expression = ChatAnim.HALF_GUILTY), + ) + + label(labelThanks) + npc(ChatAnim.HALF_GUILTY, "You're welcome, my ${if (player!!.isMale) "boy" else "girl"}.") + + label(labelChangeCrest) + npc(ChatAnim.HALF_GUILTY, "Mmm, very well. Changing your crest will cost", "5,000 coins.") + exec { player, _ -> + if (amountInInventory(player, COINS_995) < 5000) { + loadLabel(player, labelNoMoney) + } else { + loadLabel(player, labelChooseSymbol) + } + } + + label(labelNoMoney) + player(ChatAnim.HALF_GUILTY, "I'll have to go and get some money then.") + + label(labelChooseSymbol) + npc(ChatAnim.HALF_GUILTY, "There are sixteen different symbols;", "which one would you like?") + goto(labelCrestPage1) + + label(labelCrestPage1) + options( + DialogueOption(labelCrestArrav, "Shield of Arrav", skipPlayer = true), + DialogueOption(labelCrestAsgarnia, "Asgarnia", skipPlayer = true), + DialogueOption(labelCrestDorgeshuun, "Dorgeshuun Symbol", skipPlayer = true), + DialogueOption(labelCrestDragon, "Dragon", skipPlayer = true), + DialogueOption(labelCrestPage2, "More...", skipPlayer = true), + ) + + label(labelCrestPage2) + options( + DialogueOption(labelCrestFairy, "Fairy", skipPlayer = true), + DialogueOption(labelCrestGuthix, "Guthix", skipPlayer = true), + DialogueOption(labelCrestHam, "HAM", skipPlayer = true), + DialogueOption(labelCrestHorse, "Horse", skipPlayer = true), + DialogueOption(labelCrestPage3, "More...", skipPlayer = true), + ) + + label(labelCrestPage3) + options( + DialogueOption(labelCrestJogre, "Jogre", skipPlayer = true), + DialogueOption(labelCrestKandarin, "Kandarin", skipPlayer = true), + DialogueOption(labelCrestMisthalin, "Misthalin", skipPlayer = true), + DialogueOption(labelCrestMoney, "Money", skipPlayer = true), + DialogueOption(labelCrestPage4, "More...", skipPlayer = true), + ) + + label(labelCrestPage4) + options( + DialogueOption(labelCrestSaradomin, "Saradomin", skipPlayer = true), + DialogueOption(labelCrestSkull, "Skull", skipPlayer = true), + DialogueOption(labelCrestVarrock, "Varrock", skipPlayer = true), + DialogueOption(labelCrestZamorak, "Zamorak", skipPlayer = true), + DialogueOption(labelCrestPage1, "More...", skipPlayer = true), + ) + + /** + * CREST HANDLERS + */ + + label(labelCrestArrav) + exec { player, _ -> + val c = CrestType.ARRAV + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestArravOk) + } else { + loadLabel(player, labelCrestArravFail) + } + } + + label(labelCrestArravOk) + npc(ChatAnim.HALF_GUILTY, "Ah yes, the shield that you helped to retrieve. You have", + "certainly earned the right to wear its symbol.") + + label(labelCrestArravFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestAsgarnia) + exec { player, _ -> + val c = CrestType.ASGARNIA + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestAsgarniaOk) + } else { + loadLabel(player, labelCrestAsgarniaFail) + } + } + + label(labelCrestAsgarniaOk) + npc(ChatAnim.HALF_GUILTY, "Ah, splendid, splendid. There is no better symbol", + "than that of our fair land!") + + label(labelCrestAsgarniaFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestDorgeshuun) + exec { player, _ -> + val c = CrestType.DORGESHUUN + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestDorgeshuunOk) + } else { + loadLabel(player, labelCrestDorgeshuunFail) + } + } + + label(labelCrestDorgeshuunOk) + npc(ChatAnim.HALF_GUILTY, "Ah yes, our new neighbours under Lumbridge. I hear", + "you were the one who made contact with them, jolly good.") + + label(labelCrestDorgeshuunFail) + npc(ChatAnim.HALF_GUILTY, "Hmm, have you ever even met the Dorgeshuun? I don't", + "think you should wear their symbol until you have", "made contact with that lost tribe.") + goto(labelCrestPage1) + + label(labelCrestDragon) + exec { player, _ -> + val c = CrestType.DRAGON + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestDragonOk) + } else { + loadLabel(player, labelCrestDragonFail) + } + } + + label(labelCrestDragonOk) + npc(ChatAnim.HALF_GUILTY, "I see you are a mighty dragon-slayer! You have", + "certainly earned the right to wear a dragon symbol.") + + label(labelCrestDragonFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestFairy) + exec { player, _ -> + val c = CrestType.FAIRY + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestFairyOk) + } else { + loadLabel(player, labelCrestFairyFail) + } + } + + label(labelCrestFairyOk) + npc(ChatAnim.HALF_GUILTY, "Hmm, mmm, yes, everyone likes pretty fairies.") + + label(labelCrestFairyFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestGuthix) + exec { player, _ -> + val c = CrestType.GUTHIX + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestGuthixOk) + } else { + loadLabel(player, labelCrestGuthixFail) + } + } + + label(labelCrestGuthixOk) + npc(ChatAnim.HALF_GUILTY, "Guthix, god of balance! I'm a Saradominist myself,", + "you know, but we all find meaning in our own way, what?") + + label(labelCrestGuthixFail) + npc(ChatAnim.HALF_GUILTY, "You do not seem to be very devoted to any god.", + "I will not let you have a divine symbol", "unless you have level 70 prayer.") + goto(labelCrestPage1) + + label(labelCrestHam) + exec { player, _ -> + val c = CrestType.HAM + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestHamOk) + } else { + loadLabel(player, labelCrestHamFail) + } + } + + label(labelCrestHamOk) + npc(ChatAnim.HALF_GUILTY, "Hmm, I'm not sure I like that HAM group, their", + "beliefs are a little extreme for me.", "But if that's what you want.") + + label(labelCrestHamFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestHorse) + exec { player, _ -> + val c = CrestType.HORSE + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestHorseOk) + } else { + loadLabel(player, labelCrestHorseFail) + } + } + + label(labelCrestHorseOk) + npc(ChatAnim.HALF_GUILTY, "Ah, I see you've brought a toy horse for me to see. An", + "interesting beast. Certainly you can use that as your", + "crest if you like, although it seems a bit strange to me.") + + label(labelCrestHorseFail) + npc(ChatAnim.HALF_GUILTY, "A horse? I know people talk about them, but I'm not at all sure", + "they ever existed. I don't think I could let you use as", + "your symbol unless you can fetch me some kind of model of one.") + goto(labelCrestPage1) + + label(labelCrestJogre) + exec { player, _ -> + val c = CrestType.JOGRE + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestJogreOk) + } else { + loadLabel(player, labelCrestJogreFail) + } + } + + label(labelCrestJogreOk) + npc(ChatAnim.HALF_GUILTY, "A Jungle Ogre, eh? Odd beast, very odd.") + + label(labelCrestJogreFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestKandarin) + exec { player, _ -> + val c = CrestType.KANDARIN + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestKandarinOk) + } else { + loadLabel(player, labelCrestKandarinFail) + } + } + + label(labelCrestKandarinOk) + npc(ChatAnim.HALF_GUILTY, "Our neighbours in the west? Very good, very good.") + + label(labelCrestKandarinFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestMisthalin) + exec { player, _ -> + val c = CrestType.MISTHALIN + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestMisthalinOk) + } else { + loadLabel(player, labelCrestMisthalinFail) + } + } + + label(labelCrestMisthalinOk) + npc(ChatAnim.HALF_GUILTY, "Ah, the fair land of Lumbridge and Varrock.") + + label(labelCrestMisthalinFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestMoney) + npc(ChatAnim.HALF_GUILTY, "You wish to represent yourself by a moneybag?", + "I think to make that meaningful I should increase", "the price to 500,000 coins. Do you agree?") + options( + DialogueOption(labelMoneyAgree, "All right.", expression = ChatAnim.HALF_GUILTY), + DialogueOption(labelMoneyRefuse, "No way!", expression = ChatAnim.HALF_GUILTY), + ) + + label(labelMoneyAgree) + exec { player, _ -> + val c = CrestType.MONEY + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelMoneyOk) + } else { + loadLabel(player, labelNoMoney) + } + } + + label(labelMoneyOk) + npc(ChatAnim.HALF_GUILTY, "Thank you very much! You may now use a money-bag", "as your symbol.") + + label(labelMoneyRefuse) + npc(ChatAnim.HALF_GUILTY, "Well we can't have just any pauper using a money-bag", + "as a symbol, can we? You'll have to choose a", "different symbol.") + goto(labelCrestPage1) + + label(labelCrestSaradomin) + exec { player, _ -> + val c = CrestType.SARADOMIN + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + if (!player.achievementDiaryManager.getDiary(DiaryType.FALADOR).isComplete(2, 1)) { + player.achievementDiaryManager.getDiary(DiaryType.FALADOR).updateTask(player, 2, 1, true) + } + loadLabel(player, labelCrestSaradominOk) + } else { + loadLabel(player, labelCrestSaradominFail) + } + } + + label(labelCrestSaradominOk) + npc(ChatAnim.HALF_GUILTY, "Ah, the great god Saradomin! May he smile on your house", + "as you adorn it with his symbol!") + + label(labelCrestSaradominFail) + npc(ChatAnim.HALF_GUILTY, "You do not seem to be very devoted to any god.", + "I will not let you have a divine symbol", "unless you have level 70 prayer.") + goto(labelCrestPage1) + + label(labelCrestSkull) + exec { player, _ -> + val c = CrestType.SKULL + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestSkullOk) + } else { + loadLabel(player, labelCrestSkullFail) + } + } + + label(labelCrestSkullOk) + npc(ChatAnim.HALF_GUILTY, "Of, of course you can have a skull symbol, ${if (player!!.isMale) "sir" else "madam"}!") + + label(labelCrestSkullFail) + npc(ChatAnim.HALF_GUILTY, "A symbol of death? You do not seem like a killer to me;", "perhaps some other symbol would suit you better.") + goto(labelCrestPage1) + + label(labelCrestVarrock) + exec { player, _ -> + val c = CrestType.VARROCK + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestVarrockOk) + } else { + loadLabel(player, labelCrestVarrockFail) + } + } + + label(labelCrestVarrockOk) + npc(ChatAnim.HALF_GUILTY, "Ah, Varrock, a fine city!") + + label(labelCrestVarrockFail) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - NOT ELIGIBLE]") + goto(labelCrestPage1) + + label(labelCrestZamorak) + exec { player, _ -> + val c = CrestType.ZAMORAK + if (c.eligible(player) && amountInInventory(player, COINS_995) > c.cost && removeItem(player, Item(COINS_995, c.cost))) { + player.houseManager.crest = c + loadLabel(player, labelCrestZamorakOk) + } else { + loadLabel(player, labelCrestZamorakFail) + } + } + + label(labelCrestZamorakOk) + npc(ChatAnim.HALF_GUILTY, "The god of Chaos? It is a terrible thing to worship", + "that evil being. But if that is what you wish...") + + label(labelCrestZamorakFail) + npc(ChatAnim.HALF_GUILTY, "You do not seem to be very devoted to any god.", + "I will not let you have a divine symbol", "unless you have level 70 prayer.") + goto(labelCrestPage1) + + label(labelPainting) + npc(ChatAnim.HALF_GUILTY, "[MISSING DIALOGUE - UNIMPLIMENTED]") + } +} \ No newline at end of file