62 private List<ConstructionObject> OBJECT =
new ArrayList<ConstructionObject>();
64 private boolean inside;
68 public House(
Player player) {
73 public void purchase() {
75 player.dialogueFactory.sendStatement(
"You already have a house purchased!").execute();
79 if (!player.inventory.contains(
new Item(995, 1000000))) {
80 player.dialogueFactory.sendStatement(
"You need 1,000,000 royale tokens to purchase a house.").execute();
85 player.inventory.remove(
new Item(995, 1000000));
86 player.dialogueFactory.sendStatement(
"You have successfully purchased a house for 1,000,000 royale tokens.",
"Your house has been set to the default location.").execute();
91 player.dialogueFactory.sendStatement(
"Please purchase a house first.").execute();
96 player.dialogueFactory.sendStatement(
"Your house is already set to this location.").execute();
101 player.dialogueFactory.sendStatement(
"You need a construction level of " + newMap.getLevel() +
" to build this.").execute();
105 if (!player.inventory.contains(
new Item(995, newMap.getCost()))) {
106 player.dialogueFactory.sendStatement(
"You need " + newMap.getCost() +
" royale tokens to purchase this map.").execute();
112 player.inventory.remove(
new Item(995, newMap.getCost()));
113 player.dialogueFactory.sendStatement(
"You have successfully purchased the " + newMap.getName() +
" map.").execute();
116 public void enter() {
118 player.dialogueFactory.sendStatement(
"You need to purchase a house first.",
"Speak to the agent to purchase one.").execute();
122 player.send(
new SendString(
"Please wait as your house data is loaded...", 12285));
124 player.interfaceManager.open(12283);
125 player.move(
new Position(map.getPosition().getX(), map.getPosition().getY(), height));
134 player.interfaceManager.close();
135 player.send(
new SendMessage(
"Welcome to your house! To start building please click on the world map to enter the",
MessageColor.DARK_GREEN));
136 player.send(
new SendMessage(
"Construction Builder itemcontainer. To leave your house please click on the portal.",
MessageColor.DARK_GREEN));
137 player.send(
new SendString(
"[CONSTRUCTION_MAP]", 0));
143 public void enter(String name) {
145 player.dialogueFactory.sendStatement(
"According to our data base, this player does not exist.").execute();
150 player.dialogueFactory.sendStatement(
Utility.formatName(name) +
" is not currently online.").execute();
155 House otherHouse = other.house;
157 if (otherHouse.getMap() ==
null) {
158 player.dialogueFactory.sendStatement(
Utility.formatName(name) +
" does not have a house for you to visit.").execute();
162 if (!otherHouse.isInside()) {
163 player.dialogueFactory.sendStatement(
Utility.formatName(name) +
" must be in their house for you to visit.").execute();
166 player.send(
new SendString(
"Please wait as your friend's house data is loaded...", 12285));
168 player.interfaceManager.open(12283);
169 player.move(
new Position(other.house.getMap().getPosition().
getX(), otherHouse.getMap().getPosition().
getY(), otherHouse.getHeight()));
170 otherHouse.getMap().execute(player);
172 for (
int index = 0; index < otherHouse.getObjects().size(); index++) {
173 new CustomGameObject(otherHouse.getObjects().get(index).getObject(), otherHouse.getObjects().get(index).getPosition()).
register();
178 player.interfaceManager.close();
185 public void leave() {
188 player.move(
new Position(3079, 3484, 0));
189 player.send(
new SendString(
"[NORMAL_MAP]", 0));
200 for (
int index = 0; index < OBJECT.size(); index++) {
201 if (OBJECT.get(index).getObject() ==
object.getId() && OBJECT.get(index).getPosition().equals(
object.getPosition())) {
202 constructionObject =
new ConstructionObject(
object.getId(), OBJECT.get(index).getRotation(),
object.getPosition());
207 if (constructionObject ==
null) {
211 player.dialogueFactory.sendOption(
"Remove object", () -> {
214 },
"Change rotation", () -> {
215 player.dialogueFactory.onAction(() -> {
216 player.dialogueFactory.sendStatement(
"Please select the rotation direction").sendOption(
"North", () -> {
228 },
"Nevermind", () -> {
229 player.interfaceManager.close();
233 },
"Nevermind", () -> {
234 player.interfaceManager.close();
239 public void construct() {
243 player.send(
new SendMessage(
"You need a construction level of " +
object.getLevel() +
" to build this."));
253 player.interfaceManager.close();
255 player.inventory.removeAll(
object.getItems());
274 public List<ConstructionObject> getObjects() {
278 public void setObject(List<ConstructionObject>
object) {
282 public boolean isInside() {
286 public int getHeight() {