From 5f24050d4b11c35e8c290dd2cbbc87fb0984933a Mon Sep 17 00:00:00 2001 From: Bishop Date: Thu, 18 Jun 2026 22:12:16 -0500 Subject: [PATCH] SirReniteeDialogue.kt and CrestType.kt --- .../global/skill/construction/CrestType.java | 117 --- .../global/skill/construction/CrestType.kt | 35 + .../falador/dialogue/SirReniteeDialogue.java | 469 ----------- .../falador/dialogue/SirReniteeDialogue.kt | 776 ++++++++++++++++++ 4 files changed, 811 insertions(+), 586 deletions(-) delete mode 100644 Server/src/main/content/global/skill/construction/CrestType.java create mode 100644 Server/src/main/content/global/skill/construction/CrestType.kt delete mode 100644 Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.java create mode 100644 Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt diff --git a/Server/src/main/content/global/skill/construction/CrestType.java b/Server/src/main/content/global/skill/construction/CrestType.java deleted file mode 100644 index 277c77231..000000000 --- a/Server/src/main/content/global/skill/construction/CrestType.java +++ /dev/null @@ -1,117 +0,0 @@ -package content.global.skill.construction; - -import core.game.node.entity.player.Player; -import org.rs09.consts.Items; -import core.game.node.entity.skill.Skills; -import content.data.Quests; - -/** - * Family crest types. - * - * @author Emperor - * >ORDINAL BOUND< - */ -public enum CrestType implements CrestRequirement { - - ARRAV("the Shield of Arrav symbol") { // requires Shield of Arrav - - @Override - public boolean eligible(Player player) { - return player.getQuestRepository().isComplete(Quests.SHIELD_OF_ARRAV); - } - }, - ASGARNIA("the symbol of Asgarnia"), // no requirements - DORGESHUUN("the Dorgeshuun brooch") { // requires The Lost Tribe - - @Override - public boolean eligible(Player player) { - return player.getQuestRepository().isComplete(Quests.THE_LOST_TRIBE); - } - }, - DRAGON("a dragon") { // requires Dragon Slayer - - @Override - public boolean eligible(Player player) { - return player.getQuestRepository().isComplete(Quests.DRAGON_SLAYER); - } - }, - FAIRY("a fairy") { // requries Lost City - - @Override - public boolean eligible(Player player) { - return player.getQuestRepository().isComplete(Quests.LOST_CITY); - } - }, - GUTHIX("the symbol of Guthix") { // Requires 70+ Prayer - - @Override - public boolean eligible(Player player) { - return player.getSkills().hasLevel(Skills.PRAYER, 70); - } - }, - HAM("the symbol of the HAM cult."), // no requirements - HORSE("a horse") { // requires Toy Horsey in inventory - - @Override - public boolean eligible(Player player) { - return player.getInventory().containsAtLeastOneItem(new int[]{ - Items.TOY_HORSEY_2524, - Items.TOY_HORSEY_2520, - Items.TOY_HORSEY_2526, - Items.TOY_HORSEY_2522 - }); - } - }, - JOGRE("Jiggig"), // no requirements - KANDARIN("the symbol of Kandarin"), // no requirements - MISTHALIN("the symbol of Misthalin"), // no requirements - MONEY("a bag of money", 500000), // Costs 500k - SARADOMIN("the symbol of Saradomin") { // Requires 70+ Prayer - - @Override - public boolean eligible(Player player) { - return player.getSkills().hasLevel(Skills.PRAYER, 70); - } - }, - SKULL("a skull") { // requires Skulled while talking to Herald - - @Override - public boolean eligible(Player player) { - return player.getSkullManager().isSkulled(); - } - }, - VARROCK("the symbol of Varrock"), // no requirements - ZAMORAK("the symbol of Zamorak") { // Requires 70+ Prayer - - @Override - public boolean eligible(Player player) { - return player.getSkills().hasLevel(Skills.PRAYER, 70); - } - }; - - private String name; - private int cost; - - CrestType(String name, int cost) { - this.name = name; - this.cost = cost; - } - - CrestType(String name) { - this(name, 5000); - } - - public String getName() { - return this.name; - } - - public int getCost() { - return this.cost; - } -} - -interface CrestRequirement { - default boolean eligible(Player player) { - return true; - } -} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/construction/CrestType.kt b/Server/src/main/content/global/skill/construction/CrestType.kt new file mode 100644 index 000000000..550480f40 --- /dev/null +++ b/Server/src/main/content/global/skill/construction/CrestType.kt @@ -0,0 +1,35 @@ +package content.global.skill.construction + +import content.data.Quests +import core.game.node.entity.player.Player +import core.game.node.entity.skill.Skills +import org.rs09.consts.Items + +/** + * >ORDINAL BOUND< + */ +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) }), + 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) }), + 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) + ) + }), + 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) }), + SKULL("a skull", requirement = { it.skullManager.isSkulled }), + VARROCK("the symbol of Varrock"), + ZAMORAK("the symbol of Zamorak", requirement = { it.skills.hasLevel(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.java b/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.java deleted file mode 100644 index f8f9695c9..000000000 --- a/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.java +++ /dev/null @@ -1,469 +0,0 @@ -package content.region.asgarnia.falador.dialogue; - -import core.ServerConstants; -import core.Util; -import core.game.dialogue.DialoguePlugin; -import core.game.dialogue.FacialExpression; -import core.plugin.Initializable; -import org.rs09.consts.Items; -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.item.Item; -import core.tools.RandomFunction; -import core.game.node.entity.skill.Skills; -import content.global.skill.construction.CrestType; - -/** - * Represents the dialogue to handle Sir Renitee - * - * @author afaroutdude - */ -@Initializable -public class SirReniteeDialogue extends DialoguePlugin { - /** - * Constructs a new {@code SirReniteeDialogue} {@code Object}. - */ - public SirReniteeDialogue() { - } - - public SirReniteeDialogue(Player player) { - super(player); - } - - @Override - public boolean open(Object... args) { - npc = (NPC) args[0]; - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Hmm? What's that, young " + (player.getAppearance().isMale() ? "man" : "woman") + "? What can I do for", "you?"); - stage = 0; - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - switch (stage) { - case 0: - interpreter.sendOptions("Select an Option", "I don't know, what can you do for me?", "Nothing, thanks"); - stage = 10; - break; - case 10: - switch (buttonId) { - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I don't know, what can you do for me?"); - stage = 100; - break; - case 2: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Nothing, thanks."); - stage = 30; - break; - } - break; - case 30: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Mmm, well, see you some other time maybe."); - stage = 40; - break; - case 40: - end(); - break; - case 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; - break; - case 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; - break; - case 120: - interpreter.sendOptions("Select an Option", "Can you see if I have a family crest?", "Can I buy a painting?"); - stage = 130; - break; - case 130: - switch (buttonId) { - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Can you see if I have a family crest?"); - stage = 200; - break; - case 2: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Can I buy a painting?"); - stage = 500; - break; - } - break; - case 200: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "What is your name?"); - stage = 210; - break; - case 210: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, player.getUsername() + "."); - stage = 220; - break; - case 220: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Mmm, " + player.getUsername() + ", let me see..."); - stage = 230; - break; - case 230: - if (player.getSkills().hasLevel(Skills.CONSTRUCTION, 16)) { - if (player.getAttribute("sir-renitee-assigned-crest", false)) { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "According to my records, your crest is ", player.getHouseManager().getCrest().getName() + "."); - } else { - final int c = RandomFunction.random(4); - final CrestType[] crests = {CrestType.VARROCK, CrestType.ASGARNIA, CrestType.KANDARIN, CrestType.MISTHALIN}; - final CrestType crest = crests[c]; - player.getHouseManager().setCrest(crest); - player.setAttribute("/save:sir-renitee-assigned-crest", true); - String 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.getHouseManager().getCrest().name()) + ",", " so " + message + " crest."); - } - if (!player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(0,4)) { - player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).updateTask(player,0,4,true); - } - stage = 240; - } else { - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, - "First thing's first, young " + (player.getAppearance().isMale() ? "man" : "woman") + "! There is not much point", - "in having a family crest if you cannot display it."); - stage = 235; - } - break; - case 235: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You should train construction until you can build a wall", "decoration in your dining room."); - stage = 40; - break; - case 240: - interpreter.sendOptions("Select an Option", "I don't like that crest. Can I have a different one?", "Thanks!"); - stage = 250; - break; - case 250: - switch (buttonId) { - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I don't like that crest. Can I have a different one?"); - stage = 300; - break; - case 2: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "Thanks!"); - stage = 260; - break; - } - break; - case 260: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "You're welcome, my " + (player.getAppearance().isMale() ? "boy." : "girl.")); - stage = 40; - break; - case 300: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Mmm, very well. Changing your crest will cost", "5,000 coins."); - if (player.getInventory().getAmount(Items.COINS_995) < 5000) { - stage = 302; - } else { - stage = 305; - } - break; - case 302: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "I'll have to go and get some money then."); - stage = 40; - break; - case 305: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "There are sixteen different symbols;", "which one would you like?"); - stage = 310; - break; - case 310: - interpreter.sendOptions("Select an Option", "Shield of Arrav", "Asgarnia", "Dorgeshuun Symbol", "Dragon", "More..."); - stage = 320; - break; - case 320: - switch (buttonId) { - case 1: { - CrestType c = CrestType.ARRAV; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 2: { - CrestType c = CrestType.ASGARNIA; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 3: { - CrestType c = CrestType.DORGESHUUN; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 4: { - CrestType c = CrestType.DRAGON; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 5: - interpreter.sendOptions("Select an option", "Fairy", "Guthix", "HAM", "Horse", "More..."); - stage = 330; - break; - } - break; - case 330: - switch (buttonId) { - case 1: { - CrestType c = CrestType.FAIRY; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 2: { - CrestType c = CrestType.GUTHIX; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 3: { - CrestType c = CrestType.HAM; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 4: { - CrestType c = CrestType.HORSE; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 5: - interpreter.sendOptions("Select an option", "Jogre", "Kandarin", "Misthalin", "Money", "More..."); - stage = 340; - break; - } - break; - case 340: - switch (buttonId) { - case 1: { - CrestType c = CrestType.JOGRE; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 2: { - CrestType c = CrestType.KANDARIN; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 3: { - CrestType c = CrestType.MISTHALIN; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 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; - break; - case 5: - interpreter.sendOptions("Select an option", "Saradomin", "Skull", "Varrock", "Zamorak", "More..."); - stage = 350; - break; - } - break; - case 341: - interpreter.sendOptions("Select an option", "All right.", "No way!"); - stage = 342; - break; - case 342: - switch (buttonId) { - case 1: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "All right."); - CrestType c = CrestType.MONEY; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost()) { - stage = 343; - } else { - stage = 302; - } - break; - case 2: - interpreter.sendDialogues(player, FacialExpression.HALF_GUILTY, "No way!"); - stage = 344; - break; - } - break; - case 343: { - CrestType c = CrestType.MONEY; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 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; - break; - case 350: - switch (buttonId) { - case 1: { - CrestType c = CrestType.SARADOMIN; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(2,1)) { - player.getAchievementDiaryManager().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; - } - break; - } - case 2: { - CrestType c = CrestType.SKULL; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(c); - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "Of, of course you can have a skull symbol, " + (player.getAppearance().isMale() ? "sir!" : "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; - } - break; - } - case 3: { - CrestType c = CrestType.VARROCK; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 4: { - CrestType c = CrestType.ZAMORAK; - if (c.eligible(player) && player.getInventory().getAmount(Items.COINS_995) > c.getCost() - && player.getInventory().remove(new Item(Items.COINS_995, c.getCost()))) { - player.getHouseManager().setCrest(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; - } - break; - } - case 5: - interpreter.sendOptions("Select an Option", "Shield of Arrav", "Asgarnia", "Dorgeshuun Symbol", "Dragon", "More..."); - stage = 320; - break; - } - break; - case 500: - interpreter.sendDialogues(npc, FacialExpression.HALF_GUILTY, "[MISSING DIALOGUE - UNIMPLIMENTED]"); - stage = 40; - } - return true; - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new SirReniteeDialogue(player); - } - - @Override - public int[] getIds() { - return new int[]{4249}; - } - -} diff --git a/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt b/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt new file mode 100644 index 000000000..3276943a6 --- /dev/null +++ b/Server/src/main/content/region/asgarnia/falador/dialogue/SirReniteeDialogue.kt @@ -0,0 +1,776 @@ +package content.region.asgarnia.falador.dialogue + +import content.global.skill.construction.CrestType +import core.ServerConstants +import core.Util +import core.api.getAttribute +import core.game.dialogue.DialoguePlugin +import core.game.dialogue.FacialExpression +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 + } + } + return true + } + + override fun newInstance(player: Player?): DialoguePlugin { + return SirReniteeDialogue(player) + } + + override fun getIds(): IntArray { + return intArrayOf(NPCs.SIR_RENITEE_4249) + } +}