diff --git a/Server/src/main/java/Server/core/game/node/entity/player/link/diary/DiaryType.java b/Server/src/main/java/Server/core/game/node/entity/player/link/diary/DiaryType.java
index ce80fe232..d12408166 100644
--- a/Server/src/main/java/Server/core/game/node/entity/player/link/diary/DiaryType.java
+++ b/Server/src/main/java/Server/core/game/node/entity/player/link/diary/DiaryType.java
@@ -97,7 +97,7 @@ public enum DiaryType {
"Give a stray dog a bone",
"Spin a bowl on the pottery wheel and fire it in the oven in
Barbarian Village",
"Enter Edgeville Dungeon using the entrance to the south of
Edgeville",
- "Move our player-owned house portal to a different location
using the Varrock estate agent",
+ "Move your player-owned house portal to a different location
using the Varrock estate agent",
"Speak to Haig Halen after obtaining at least 50 kudos", //TODO need to implement kudos
"Enter the Earth Altar using an earth tiara or talisman",
"Have Elsie tell you a story",
@@ -137,7 +137,7 @@ public enum DiaryType {
"Speak to Orlando Smith when you have achieved 153 kudos", // TODO need to implement kudos
"Talk to Romily Weaklax and give him a wild pie",
"Craft an air battlestaff",
- "Give your player-owned house a fancy stone or tropical wood
finish at the Varrock estate agent's",
+ "Give your player-owned house a tropical wood or fancy stone
finish at the Varrock estate agent's",
"Make a Varrock teleport tablet on a mahogany lectern",
"Obtain a new set of Family Crest gauntlets from Dimintheis", // TODO need family crest
"Make a Waka Canoe near Edgeville",
diff --git a/Server/src/main/java/Server/core/game/node/entity/skill/construction/EstateAgentDialogue.java b/Server/src/main/java/Server/core/game/node/entity/skill/construction/EstateAgentDialogue.java
deleted file mode 100644
index c322aa6d5..000000000
--- a/Server/src/main/java/Server/core/game/node/entity/skill/construction/EstateAgentDialogue.java
+++ /dev/null
@@ -1,442 +0,0 @@
-package core.game.node.entity.skill.construction;
-
-import core.game.node.entity.player.link.diary.DiaryType;
-import core.game.content.dialogue.DialoguePlugin;
-import core.game.content.dialogue.FacialExpression;
-import core.game.content.global.Skillcape;
-import core.game.node.entity.skill.Skills;
-import core.game.node.entity.npc.NPC;
-import core.game.node.entity.player.Player;
-import core.game.node.item.Item;
-import core.game.world.GameWorld;
-import core.game.world.map.Location;
-import core.plugin.Initializable;
-
-/**
- * Represents the estate agent dialogue.
- *
- * @author 'Vexia
- * @version 1.0
- */
-@Initializable
-public final class EstateAgentDialogue extends DialoguePlugin {
-
- /**
- * Represents the book item.
- */
- private static final Item BOOK = new Item(8463, 1);
- private static HouseLocation moveLoc;
-
- /**
- * Constructs a new {@code EstateAgentDialogue} {@code Object}.
- */
- public EstateAgentDialogue() {
- /**
- * empty.
- */
- }
-
- /**
- * Constructs a new {@code EstateAgentDialogue} {@code Object}.
- *
- * @param player the player.
- */
- public EstateAgentDialogue(Player player) {
- super(player);
- }
-
- @Override
- public DialoguePlugin newInstance(Player player) {
- return new EstateAgentDialogue(player);
- }
-
- @Override
- public boolean open(Object... args) {
- npc = (NPC) args[0];
- npc("Hello. Welcome to the " + GameWorld.getSettings().getName() + " Housing Agency! What", "can I do for you?");
- stage = 0;
- return true;
- }
-
- @Override
- public boolean handle(int interfaceId, int buttonId) {
- switch (stage) {
- case 0:
- if (player.getHouseManager().hasHouse()) {
- options("Can you move my house please?", "Can you redecorate my house please?", "Could I have a Construction guidebook?", "Tell me about houses.", "Tell me about that skillcape you're wearing.");
- stage = 1;
- } else {
- options("How can I get a house?", "Tell me about houses.");
- stage = 2;
- }
- break;
-
- //Options for when a player has a house
- case 1:
- switch (buttonId) {
- case 1:
- player("Can you move my house please?");
- stage = 10;
- break;
- case 2:
- player("Can you redecorate my house please?");
- stage = 30;
- break;
- case 3:
- player("Could I have a Construction guidebook?");
- stage = 50;
- break;
- case 4:
- player("Tell me about houses!");
- stage = 90;
- break;
- case 5:
- player("Tell me about that skillcape you're wearing!");
- stage = Skillcape.isMaster(player, Skills.CONSTRUCTION) ? 102 : 100;
- break;
- }
- break;
-
- //Option for when a player does not have a house
- case 2:
- switch (buttonId) {
- case 1:
- player("How can I get a house?");
- stage = 3;
- break;
- case 2:
- player("Tell me about houses.");
- stage = 90;
- break;
- }
- break;
-
- //Real Estate Agent offering a house
- case 3:
- npc("I can sell you a starting house in Rimmington for", "1000 coins. As you increase your construction skill you", "will be able to have your house moved to other areas", "and redecorated in other styles.");
- stage++;
- break;
- case 4:
- npc("Do you want to buy a starter house?");
- stage++;
- break;
- case 5:
- options("Yes please!", "No thanks.");
- stage++;
- break;
- case 6:
- switch (buttonId) {
- case 1:
- player("Yes please!");
- stage = 7;
- break;
- case 2:
- player("No thanks.");
- stage = 150;
- break;
- }
- break;
-
- //Estate Agent Dialogue after house purchase
- case 7:
- if (player.getInventory().contains(995, 1000)) {
- player.getInventory().remove(new Item(995, 1000));
- player.getHouseManager().create(HouseLocation.RIMMINGTON);
- npc("Thank you. Go through the Rimmington house portal", "and you will find your house ready for you to start", "building in it.");
- stage = 150;
- } else {
- npc("You don't have enough money to buy a house,", "come back when you can afford one.");
- stage = 150;
- }
- break;
-
- //Move House Dialogue
- case 10:
- npc("Certainly. Where would you like it moved to?");
- stage++;
- break;
- case 11:
- options("Rimmington (5,000)", "Taverley (5,000)", "Pollnivneach (7,500)", "Rellekka (10,000)", "More...");
- stage++;
- break;
- case 12:
- switch (buttonId) {
- case 1:
- player("To Rimmington please!");
- stage = 15;
- break;
- case 2:
- player("To Taverly please!");
- stage = 16;
- break;
- case 3:
- player("To Pollnivneach please!");
- stage = 17;
- break;
- case 4:
- player("To Rellekka please!");
- stage = 18;
- break;
- case 5:
- options("Brimhaven (15,000)", "Yanille (25,000)", "...Previous");
- stage = 13;
- break;
- }
- break;
- case 13:
- switch (buttonId) {
- case 1:
- player("To Brimhaven please!");
- stage = 19;
- break;
- case 2:
- player("To Yanille please!");
- stage = 20;
- break;
- case 3:
- options("Rimmington (5,000)", "Taverley (5,000)", "Pollnivneach (7,500)", "Rellekka (10,000)", "More...");
- stage = 12;
- break;
- }
- break;
- case 15:
- configureMove(HouseLocation.RIMMINGTON);
- break;
- case 16:
- configureMove(HouseLocation.TAVERLY);
- break;
- case 17:
- configureMove(HouseLocation.POLLNIVNEACH);
- break;
- case 18:
- configureMove(HouseLocation.RELLEKKA);
- break;
- case 19:
- configureMove(HouseLocation.BRIMHAVEN);
- break;
- case 20:
- configureMove(HouseLocation.YANILLE);
- break;
-
-
- //Redecorate House
- case 30:
- npc("Certainly. My magic can rebuild the house in a", "completely new style! What style would you like?");
- stage++;
- break;
- case 31:
- options("Basic wood (5,000)", "Basic stone (5,000)", "Whitewashed stone (7,500)", "Fremennik-style wood (10,000)", "More...");
- stage++;
- break;
- case 32:
- switch (buttonId) {
- case 1:
- player("Basic wood please!");
- stage = 35;
- break;
- case 2:
- player("Basic stone please!");
- stage = 36;
- break;
- case 3:
- player("Whitewashed stone please!");
- stage = 37;
- break;
- case 4:
- player("Fremennik-style wood please!");
- stage = 38;
- break;
- case 5:
- options("Tropical wood (15,000)", "Fancy stone (25,000)", "Previous...");
- stage = 33;
- break;
- }
- break;
- case 33:
- switch (buttonId) {
- case 1:
- player("Tropical wood please!");
- stage = 39;
- break;
- case 2:
- player("Fancy stone please!");
- stage = 40;
- break;
- case 3:
- options("Basic wood (5,000)", "Basic stone (5,000)", "Whitewashed stone (7,500)", "Fremennik-style wood (10,000)", "More...");
- stage = 32;
- break;
- }
- break;
- case 35:
- redecorate(HousingStyle.BASIC_WOOD);
- break;
- case 36:
- redecorate(HousingStyle.BASIC_STONE);
- break;
- case 37:
- redecorate(HousingStyle.WHITEWASHED_STONE);
- break;
- case 38:
- redecorate(HousingStyle.FREMENNIK_STYLE_WOOD);
- break;
- case 39:
- redecorate(HousingStyle.TROPICAL_WOOD);
- // Give your player-owned house a fancy stone or tropical wood
finish at the Varrock estate agent's
- if (player.getLocation().withinDistance(Location.create(3239, 3474, 0))) {
- player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 2, 7);
- }
- break;
- case 40:
- redecorate(HousingStyle.FANCY_STONE);
- // Give your player-owned house a fancy stone or tropical wood
finish at the Varrock estate agent's
- if (player.getLocation().withinDistance(Location.create(3239, 3474, 0))) {
- player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 2, 7);
- }
- break;
-
- //Asking for a Construction Book
- case 50:
- if (!player.hasItem(BOOK)) {
- npc("Certainly.");
- player.getInventory().add(BOOK);
- stage = 150;
- break;
- } else {
- npc("You've already got one!");
- stage = 150;
- break;
- }
-
- //More Information on houses
- case 60:
- npc("It all came out of the wizards' experiments. They found", "a way to fold space, so that they could pack many", "acres of land into an area only a foot across.");
- stage++;
- break;
- case 61:
- npc("They created several folded-space regions across", "" + GameWorld.getSettings().getName() + ". Each one contains hundreds of small plots", "where people can build houses.");
- stage++;
- break;
- case 62:
- player("Ah, so that's how everyone can have a house without", "them cluttering up the world!");
- stage++;
- break;
- case 63:
- npc("Quite. The wizards didn't want to get bogged down", "in the business side of things so they ", "hired me to sell the houses.");
- stage++;
- break;
- case 64:
- npc("There are various other people across " + GameWorld.getSettings().getName() + " who can", "help you furnish your house. You should start buying", "planks from the sawmill operator in Varrock.");
- stage = 150;
- break;
-
- //Skillcape Dialogue for players without Level 99 Construction
- case 100:
- npc("As you may know, skillcapes are only available to masters", "in a skill. I have spent my entire life building houses and", "now I spend my time selling them! As a sign of my abilites", "I wear this Skillcape of Construction. If you ever have");
- stage = 101;
- break;
- case 101:
- npc("enough skill to build a demonic throne, come and talk to", "me and I'll sell you a skillcape like mine.");
- stage = 150;
- break;
-
- //Skillcape Dialogue for players with Level 99 Construction
- case 102:
- interpreter.sendDialogues(npc, FacialExpression.JOLLY, "I see you have recently achieved 99 construction.", "Would you like to buy a cape for 99,0000 gp?");
- stage++;
- break;
- case 103:
- options("Yes, I'll pay the 99k", "No thanks, maybe later.");
- stage++;
- break;
- case 104:
- switch (buttonId) {
- case 1:
- if (Skillcape.purchase(player, Skills.CONSTRUCTION)) {
- npc("Here you go lad, enjoy!");
- }
- stage = 150;
- break;
- case 2:
- player("No thanks, maybe later.");
- stage = 150;
- break;
- }
- break;
-
- //End
- case 150:
- end();
- break;
- }
- return true;
- }
-
- /**
- * Configures the move.
- *
- * @param location The house location.
- */
- private void configureMove(HouseLocation location) {
- if (location == player.getHouseManager().getLocation()) {
- npc("Your house is already there!");
- stage = 11;
- return;
- }
- if (location.getLevelRequirement() > player.getSkills().getStaticLevel(Skills.CONSTRUCTION)) {
- npc("I'm afraid you don't have a high enough construction", "level to move there. You need to have level " + location.getLevelRequirement() + ".");
- stage = 11;
- return;
- }
- if (!player.getInventory().contains(995, location.getCost())) {
- npc("Hmph. Come back when you have " + location.getCost() + " coins.");
- stage = 150;
- return;
- }
- player.getInventory().remove(new Item(995, location.getCost()));
- player.getHouseManager().setLocation(location);
- npc("Your house has been moved to " + location.getName() + ".");
- stage = 150;
- if (player.getLocation().withinDistance(Location.create(3239, 3474, 0))) {
- player.getAchievementDiaryManager().finishTask(player, DiaryType.VARROCK, 0, 11);
- }
- }
-
- /**
- * Redecorates the player's house.
- *
- * @param style The house style.
- */
- private void redecorate(HousingStyle style) {
- boolean diary = false;//player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(0);
- if (style == player.getHouseManager().getStyle()) {
- npc("Your house is already in that style!");
- stage = 31;
- return;
- }
- if (style.getLevel() > player.getSkills().getStaticLevel(Skills.CONSTRUCTION)) {
- npc("You need a Construction level of " + style.getLevel() + " to buy this style.");
- stage = 31;
- return;
- }
- if (!player.getInventory().contains(995, style.getCost()) && !diary) {
- npc("Hmph. Come back when you have " + style.getCost() + " coins.");
- stage = 150;
- return;
- }
- if (!diary) {
- player.getInventory().remove(new Item(995, style.getCost()));
- }
- player.getHouseManager().redecorate(style);
- npc("Your house has been redecorated.");
- if (player.getLocation().withinDistance(new Location(2982, 3370))) {
- //player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).updateTask(player, 1, 5, true);
- }
- stage = 150;
- }
-
- @Override
- public int[] getIds() {
- return new int[]{4247};
- }
-}
\ No newline at end of file
diff --git a/Server/src/main/java/Server/core/game/node/entity/skill/construction/EstateAgentDialogue.kt b/Server/src/main/java/Server/core/game/node/entity/skill/construction/EstateAgentDialogue.kt
new file mode 100644
index 000000000..9bb50b7dd
--- /dev/null
+++ b/Server/src/main/java/Server/core/game/node/entity/skill/construction/EstateAgentDialogue.kt
@@ -0,0 +1,469 @@
+package core.game.node.entity.skill.construction
+
+import core.game.content.dialogue.DialoguePlugin
+import core.game.content.dialogue.FacialExpression
+import core.game.content.global.Skillcape
+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.game.world.GameWorld.settings
+import core.plugin.Initializable
+import core.tools.END_DIALOGUE
+import core.tools.Items
+import core.tools.START_DIALOGUE
+
+/**
+ * Represents the estate agent dialogue.
+ *
+ * @author Woah
+ */
+@Initializable
+class EstateAgentDialogue : DialoguePlugin {
+
+ /**
+ * Constructs a new `EstateAgentDialogue` `Object`.
+ */
+ constructor() {
+ /**
+ * empty.
+ */
+ }
+
+ /**
+ * Constructs a new `EstateAgentDialogue` `Object`.
+ *
+ * @param player the player.
+ */
+ constructor(player: Player?) : super(player)
+
+ override fun newInstance(player: Player): DialoguePlugin {
+ return EstateAgentDialogue(player)
+ }
+
+ override fun open(vararg args: Any): Boolean {
+ npc = args[0] as NPC
+ npc("Hello. Welcome to the " + settings!!.name + " Housing Agency! What", "can I do for you?")
+ stage = START_DIALOGUE
+ return true
+ }
+
+ override fun handle(interfaceId: Int, buttonId: Int): Boolean {
+ when (stage) {
+
+ START_DIALOGUE -> {
+ if (player.houseManager.hasHouse()) {
+ options(
+ "Can you move my house please?",
+ "Can you redecorate my house please?",
+ "Could I have a Construction guidebook?",
+ "Tell me about houses.",
+ "Tell me about that skillcape you're wearing.")
+ stage = 1
+ } else {
+ options("How can I get a house?", "Tell me about houses.")
+ stage = 2
+ }
+ }
+
+ 1 -> when (buttonId) {
+ 1 -> {
+ player("Can you move my house please?")
+ stage = 10
+ }
+ 2 -> {
+ player("Can you redecorate my house please?")
+ stage = 30
+ }
+ 3 -> {
+ player("Could I have a Construction guidebook?")
+ stage = 50
+ }
+ 4 -> {
+ player("Tell me about houses!")
+ stage = 60
+ }
+ 5 -> {
+ player("Tell me about that skillcape you're wearing!")
+ stage = if (Skillcape.isMaster(player, Skills.CONSTRUCTION)) 102 else 100
+ }
+ }
+
+ 2 -> when (buttonId) {
+ 1 -> {
+ player("How can I get a house?")
+ stage = 3
+ }
+ 2 -> {
+ player("Tell me about houses.")
+ stage = 60
+ }
+ }
+
+ 3 -> {
+ npc(
+ "I can sell you a starting house in Rimmington for",
+ "1000 coins. As you increase your construction skill you",
+ "will be able to have your house moved to other areas",
+ "and redecorated in other styles."
+ )
+ stage++
+ }
+
+ 4 -> {
+ npc("Do you want to buy a starter house?")
+ stage++
+ }
+
+ 5 -> {
+ options("Yes please!", "No thanks.")
+ stage++
+ }
+
+ 6 -> when (buttonId) {
+ 1 -> {
+ player("Yes please!")
+ stage = 7
+ }
+ 2 -> {
+ player("No thanks.")
+ stage = END_DIALOGUE
+ }
+ }
+
+ 7 -> {
+ if (player.inventory.contains(995, 1000)) {
+ player.inventory.remove(Item(995, 1000))
+ player.houseManager.create(HouseLocation.RIMMINGTON)
+ npc(
+ "Thank you. Go through the Rimmington house portal",
+ "and you will find your house ready for you to start",
+ "building in it."
+ )
+ } else {
+ npc("You don't have enough money to buy a house,", "come back when you can afford one.")
+ }
+ stage = END_DIALOGUE
+ }
+
+ 10 -> {
+ npc("Certainly. Where would you like it moved to?")
+ stage++
+ }
+
+ 11 -> {
+ options(
+ "Rimmington (5,000)",
+ "Taverley (5,000)",
+ "Pollnivneach (7,500)",
+ "Rellekka (10,000)",
+ "More..." )
+ stage++
+ }
+
+ 12 -> when (buttonId) {
+ 1 -> {
+ player("To Rimmington please!")
+ stage = 15
+ }
+ 2 -> {
+ player("To Taverly please!")
+ stage = 16
+ }
+ 3 -> {
+ player("To Pollnivneach please!")
+ stage = 17
+ }
+ 4 -> {
+ player("To Rellekka please!")
+ stage = 18
+ }
+ 5 -> {
+ options("Brimhaven (15,000)", "Yanille (25,000)", "...Previous", "Back")
+ stage = 13
+ }
+ }
+
+ 13 -> when (buttonId) {
+ 1 -> {
+ player("To Brimhaven please!")
+ stage = 19
+ }
+ 2 -> {
+ player("To Yanille please!")
+ stage = 20
+ }
+ 3 -> {
+ options(
+ "Rimmington (5,000)",
+ "Taverley (5,000)",
+ "Pollnivneach (7,500)",
+ "Rellekka (10,000)",
+ "More..."
+ )
+ stage = 12
+ }
+ }
+
+ 15 -> configureMove(HouseLocation.RIMMINGTON)
+ 16 -> configureMove(HouseLocation.TAVERLY)
+ 17 -> configureMove(HouseLocation.POLLNIVNEACH)
+ 18 -> configureMove(HouseLocation.RELLEKKA)
+ 19 -> configureMove(HouseLocation.BRIMHAVEN)
+ 20 -> configureMove(HouseLocation.YANILLE)
+ 30 -> {
+ npc(
+ "Certainly. My magic can rebuild the house in a",
+ "completely new style! What style would you like?" )
+ stage++
+ }
+ 31 -> {
+ options(
+ "Basic wood (5,000)",
+ "Basic stone (5,000)",
+ "Whitewashed stone (7,500)",
+ "Fremennik-style wood (10,000)",
+ "More..."
+ )
+ stage++
+ }
+ 32 -> when (buttonId) {
+ 1 -> {
+ player("Basic wood please!")
+ stage = 35
+ }
+ 2 -> {
+ player("Basic stone please!")
+ stage = 36
+ }
+ 3 -> {
+ player("Whitewashed stone please!")
+ stage = 37
+ }
+ 4 -> {
+ player("Fremennik-style wood please!")
+ stage = 38
+ }
+ 5 -> {
+ options("Tropical wood (15,000)", "Fancy stone (25,000)", "Previous...", "Back")
+ stage = 33
+ }
+ }
+ 33 -> when (buttonId) {
+ 1 -> {
+ player("Tropical wood please!")
+ stage = 39
+ }
+ 2 -> {
+ player("Fancy stone please!")
+ stage = 40
+ }
+ 3 -> {
+ options(
+ "Basic wood (5,000)",
+ "Basic stone (5,000)",
+ "Whitewashed stone (7,500)",
+ "Fremennik-style wood (10,000)",
+ "More..."
+ )
+ stage = 32
+ }
+ }
+
+ 35 -> redecorate(HousingStyle.BASIC_WOOD)
+ 36 -> redecorate(HousingStyle.BASIC_STONE)
+ 37 -> redecorate(HousingStyle.WHITEWASHED_STONE)
+ 38 -> redecorate(HousingStyle.FREMENNIK_STYLE_WOOD)
+ 39 -> redecorate(HousingStyle.TROPICAL_WOOD)
+ 40 -> redecorate(HousingStyle.FANCY_STONE)
+
+ 50 -> {
+ if (player.hasItem(CONSTRUCTION_GUIDE_8463)) {
+ npc("You've already got one!")
+ } else {
+ npc("Certainly.")
+ player.inventory.add(CONSTRUCTION_GUIDE_8463)
+ }
+ stage = END_DIALOGUE
+ }
+ 60 -> {
+ npc(
+ "It all came out of the wizards' experiments. They found",
+ "a way to fold space, so that they could pack many",
+ "acres of land into an area only a foot across."
+ )
+ stage++
+ }
+ 61 -> {
+ npc(
+ "They created several folded-space regions across",
+ "" + settings!!.name + ". Each one contains hundreds of small plots",
+ "where people can build houses."
+ )
+ stage++
+ }
+ 62 -> {
+ player("Ah, so that's how everyone can have a house without", "them cluttering up the world!")
+ stage++
+ }
+ 63 -> {
+ npc(
+ "Quite. The wizards didn't want to get bogged down",
+ "in the business side of things so they ",
+ "hired me to sell the houses."
+ )
+ stage++
+ }
+ 64 -> {
+ npc(
+ "There are various other people across " + settings!!.name + " who can",
+ "help you furnish your house. You should start buying",
+ "planks from the sawmill operator in Varrock."
+ )
+ stage = END_DIALOGUE
+ }
+ 100 -> {
+ npc(
+ "As you may know, skillcapes are only available to masters",
+ "in a skill. I have spent my entire life building houses and",
+ "now I spend my time selling them! As a sign of my abilites",
+ "I wear this Skillcape of Construction. If you ever have"
+ )
+ stage = 101
+ }
+ 101 -> {
+ npc(
+ "enough skill to build a demonic throne, come and talk to",
+ "me and I'll sell you a skillcape like mine."
+ )
+ stage = END_DIALOGUE
+ }
+ 102 -> {
+ interpreter.sendDialogues(
+ npc,
+ FacialExpression.JOLLY,
+ "I see you have recently achieved 99 construction.",
+ "Would you like to buy a cape for 99,0000 gp?"
+ )
+ stage++
+ }
+ 103 -> {
+ options("Yes, I'll pay the 99k", "No thanks, maybe later.")
+ stage++
+ }
+ 104 -> when (buttonId) {
+ 1 -> {
+ if (Skillcape.purchase(player, Skills.CONSTRUCTION)) {
+ npc("Here you go lad, enjoy!")
+ }
+ stage = END_DIALOGUE
+ }
+ 2 -> {
+ player("No thanks, maybe later.")
+ stage = END_DIALOGUE
+ }
+ }
+ END_DIALOGUE -> end()
+ }
+ return true
+ }
+
+ /**
+ * Configures the move.
+ *
+ * @param location The house location.
+ */
+ private fun configureMove(location: HouseLocation) {
+ //Achievement completion checks
+ val completedVarrockHouseMove = player.achievementDiaryManager.hasCompletedTask(DiaryType.VARROCK,0,11)
+ when {
+ //Player does not have required construction level
+ !location.hasLevel(player) -> {
+ npc(
+ "I'm afraid you don't have a high enough construction",
+ "level to move there. You need to have level " + location.levelRequirement + "." )
+ stage = 11
+ return
+ }
+ //Player's house location is already where they selected
+ location == player.houseManager.location -> {
+ npc("Your house is already there!")
+ stage = 11
+ return
+ }
+ //Player does not have enough coins to buy a house move
+ !player.inventory.contains(Items.COINS_995, location.cost) -> {
+ npc("Hmph. Come back when you have " + location.cost + " coins.")
+ stage = END_DIALOGUE
+ return
+ }
+ //Player meets all above requirements + check for achievement unlocks
+ else -> {
+ player.inventory.remove(Item(Items.COINS_995, location.cost))
+ player.houseManager.location = location
+ npc("Your house has been moved to " + location.getName() + ".")
+
+ if (player.location.isInRegion(REGION_VARROCK_NE) && !completedVarrockHouseMove) {
+
+ player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 0, 11)
+ }
+ stage = END_DIALOGUE
+ }
+ }
+ }
+
+ /**
+ * Redecorates the player's house.
+ *
+ * @param style The house style.
+ */
+ private fun redecorate(style: HousingStyle) {
+ //Achievement completion checks
+ val completedVarrockHouseRedecorate = player.achievementDiaryManager.hasCompletedTask(DiaryType.VARROCK,2,7)
+ when {
+ //Player does not have required construction level
+ !style.hasLevel(player) -> {
+ npc("You need a Construction level of " + style.level + " to buy this style.")
+ stage = 31
+ return
+ }
+ //Player's house location is already where they selected
+ style == player.houseManager.style -> {
+ npc("Your house is already in that style!")
+ stage = 31
+ return
+ }
+
+ //Player does not have enough coins to buy a house move
+ !player.inventory.contains(Items.COINS_995, style.cost) -> {
+ npc("Hmph. Come back when you have " + style.cost + " coins.")
+ stage = END_DIALOGUE
+ return
+ }
+
+ //Player meets all above requirements + check for achievement unlocks
+ else -> {
+ player.inventory.remove(Item(Items.COINS_995, style.cost))
+ player.houseManager.redecorate(style)
+ npc("Your house has been redecorated.")
+
+ // Give your player-owned house a fancy stone or tropical wood
finish at the Varrock estate agent's
+ if (player.location.isInRegion(REGION_VARROCK_NE) && !completedVarrockHouseRedecorate) {
+ player.achievementDiaryManager.finishTask(player, DiaryType.VARROCK, 2, 7)
+ }
+ stage = END_DIALOGUE
+ }
+ }
+ }
+
+ override fun getIds(): IntArray {
+ return intArrayOf(4247)
+ }
+
+ //Items
+ private val CONSTRUCTION_GUIDE_8463 = Item(Items.CONSTRUCTION_GUIDE_8463, 1)
+
+ //Region to check
+ private val REGION_VARROCK_NE = 12854
+}
\ No newline at end of file
diff --git a/Server/src/main/java/Server/core/game/node/entity/skill/construction/HousingStyle.java b/Server/src/main/java/Server/core/game/node/entity/skill/construction/HousingStyle.java
index d228cc79a..f945c3c5c 100644
--- a/Server/src/main/java/Server/core/game/node/entity/skill/construction/HousingStyle.java
+++ b/Server/src/main/java/Server/core/game/node/entity/skill/construction/HousingStyle.java
@@ -1,5 +1,8 @@
package core.game.node.entity.skill.construction;
+import core.game.node.entity.player.Player;
+import core.game.node.entity.skill.Skills;
+
/**
* The styles of houses.
* @author Emperor
@@ -17,7 +20,7 @@ public enum HousingStyle {
/**
* The level required.
*/
- private final int level;
+ private final int levelRequirement;
/**
* The cost.
@@ -53,7 +56,17 @@ public enum HousingStyle {
* The window style
*/
private final Decoration window;
-
+
+ /**
+ * Checks if the player has the level.
+ *
+ * @param player the player.
+ * @return {@code True} if so.
+ */
+ public boolean hasLevel(Player player) {
+ return player.getSkills().getStaticLevel(Skills.CONSTRUCTION) >= levelRequirement;
+ }
+
/**
* Constructs a new {@code HousingStyle} {@code Object}
* @param level The level required.
@@ -63,7 +76,7 @@ public enum HousingStyle {
* @param doorId The door object id used in this style.
*/
private HousingStyle(int level, int cost, int regionId, int plane, int doorId, int secondDoorId, int wallId, Decoration window) {
- this.level = level;
+ this.levelRequirement = level;
this.cost = cost;
this.regionId = regionId;
this.plane = plane;
@@ -78,7 +91,7 @@ public enum HousingStyle {
* @return the level
*/
public int getLevel() {
- return level;
+ return levelRequirement;
}
/**
diff --git a/Server/src/main/java/Server/core/game/node/entity/skill/hunter/tracking/HunterTracking.kt b/Server/src/main/java/Server/core/game/node/entity/skill/hunter/tracking/HunterTracking.kt
index 6f20fc2af..18a3a71cd 100644
--- a/Server/src/main/java/Server/core/game/node/entity/skill/hunter/tracking/HunterTracking.kt
+++ b/Server/src/main/java/Server/core/game/node/entity/skill/hunter/tracking/HunterTracking.kt
@@ -92,7 +92,7 @@ abstract class HunterTracking : OptionHandler(){
val possibleTrails = ArrayList()
for(trail in linkingTrails){
val invTrail = getTrailInverse(trail,false)
- if(invTrail.type == TrailType.TUNNEL && previousTrail.endLocation.withinDistanceProper(invTrail.startLocation,5) && !previousTrail.endLocation.equals(invTrail.startLocation) && previousTrail.offset != trail.offset){
+ if(invTrail.type == TrailType.TUNNEL && previousTrail.endLocation.withinDistance(invTrail.startLocation,5) && !previousTrail.endLocation.equals(invTrail.startLocation) && previousTrail.offset != trail.offset){
possibleTrails.add(trail)
}
}
diff --git a/Server/src/main/java/Server/core/game/world/map/Location.java b/Server/src/main/java/Server/core/game/world/map/Location.java
index fd5590e16..c0bb753c1 100644
--- a/Server/src/main/java/Server/core/game/world/map/Location.java
+++ b/Server/src/main/java/Server/core/game/world/map/Location.java
@@ -6,8 +6,6 @@ import core.game.world.map.path.Path;
import core.game.world.map.path.Pathfinder;
import core.tools.RandomFunction;
-import java.nio.ByteBuffer;
-
/**
* Represents a location on the world map.
* @author Emperor
@@ -132,24 +130,6 @@ public final class Location extends Node {
return this;
}
- /**
- * Saves the location to a buffer.
- * @param buffer the buffer.
- * @return the buffer.
- */
- public ByteBuffer save(ByteBuffer buffer) {
- return buffer.putShort((short) getX()).putShort((short) getY()).put((byte) getZ());
- }
-
- /**
- * Parses a location from the buffer.
- * @param buffer the buffer.
- * @return the location.
- */
- public static Location parse(ByteBuffer buffer) {
- return Location.create(buffer.getShort(), buffer.getShort(), buffer.get());
- }
-
/**
* Checks if this location is right next to the node (assuming the node is
* size 1x1).
@@ -176,6 +156,14 @@ public final class Location extends Node {
return (x >> 6) << 8 | (y >> 6);
}
+ /**
+ * Compares the users region with the one given
+ * @return True if user is in given region
+ */
+ public boolean isInRegion(int region) {
+ return getRegionId() == region;
+ }
+
/**
* Gets the location incremented by the given coordinates.
* @param dir The direction to transform this location.
@@ -224,21 +212,13 @@ public final class Location extends Node {
return withinDistance(other, MapDistance.RENDERING.getDistance());
}
- /**
- * Returns if a player is within a specified distance.
- * @param other The other location.
- * @param dist The amount of distance.
- * @return If you're within the other distance.
- */
- public boolean withinDistance(Location other, int dist) {
- if (other.z != z) {
- return false;
- }
- int deltaX = other.x - x, deltaY = other.y - y;
- return deltaX <= dist && deltaX >= -dist && deltaY <= dist && deltaY >= -dist;
- }
-
- public boolean withinDistanceProper(Location other, int dist){
+ /**
+ * Returns if a player is within a specified distance.
+ * @param other The other location.
+ * @param dist The amount of distance.
+ * @return If you're within the other distance.
+ */
+ public boolean withinDistance(Location other, int dist){
int a = (other.x - x);
int b = (other.y - y);
double product = Math.sqrt((a*a) + (b*b));