RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.skill.impl.construction.House Class Reference
Collaboration diagram for com.runehive.content.skill.impl.construction.House:

Public Member Functions

void construct ()
void enter ()
void enter (String name)
int getHeight ()
BuildableMap getMap ()
List< ConstructionObjectgetObjects ()
 House (Player player)
boolean isInside ()
void leave ()
void location (BuildableMap newMap)
void purchase ()
void setMap (BuildableMap map)
void setObject (List< ConstructionObject > object)
boolean toolkit (GameObject object)

Private Attributes

int height
boolean inside
BuildableMap map
List< ConstructionObjectOBJECT = new ArrayList<ConstructionObject>()
Player player

Detailed Description

Definition at line 24 of file House.java.

Constructor & Destructor Documentation

◆ House()

com.runehive.content.skill.impl.construction.House.House ( Player player)

Definition at line 36 of file House.java.

36 {
37 this.player = player;
38 this.height = /* player.getPlayerAssistant().instance() */0;
39 }

References player.

Referenced by enter().

Here is the caller graph for this function:

Member Function Documentation

◆ construct()

void com.runehive.content.skill.impl.construction.House.construct ( )

Definition at line 207 of file House.java.

207 {
208 BuildableObject object = player.attributes.get("CONSTRUCTION_BUILDOBJECT_KEY", BuildableObject.class);
209
210 if (player.skills.getLevel(Skill.CONSTRUCTION) < object.getLevel()) {
211 player.send(new SendMessage("You need a construction level of " + object.getLevel() + " to build this."));
212 return;
213 }
214
215 // if (!player.inventory.contains(object.getItems())) {
216 // player.send(new SendMessage("You do not have the required item to
217 // build this."));
218 // return;
219 // }
220
221 player.interfaceManager.close();
222 player.animate(new Animation(898));
223 player.inventory.removeAll(object.getItems());
224 CustomGameObject gameObject = new CustomGameObject(object.getObject(), player.getPosition().copy());
225
226 World.schedule(5, () -> {
227 gameObject.register();
228 player.skills.addExperience(Skill.CONSTRUCTION, object.getExperience());
229 OBJECT.add(new ConstructionObject(gameObject.getId(), 0, gameObject.getPosition()));
230 player.send(new SendMessage("You have successfully constructed " + Utility.getAOrAn(gameObject.getName()) + " " + gameObject.getName() + "."));
231 });
232 }

References com.runehive.game.world.entity.skill.Skill.CONSTRUCTION, com.runehive.util.Utility.getAOrAn(), com.runehive.game.world.object.GameObject.getId(), com.runehive.game.world.object.CustomGameObject.getName(), com.runehive.game.world.entity.Entity.getPosition(), OBJECT, player, com.runehive.game.world.object.CustomGameObject.register(), and com.runehive.game.world.World.schedule().

Here is the call graph for this function:

◆ enter() [1/2]

void com.runehive.content.skill.impl.construction.House.enter ( )

Definition at line 84 of file House.java.

84 {
85 if (map == null) {
86 player.dialogueFactory.sendStatement("You need to purchase a house first.", "Speak to the agent to purchase one.").execute();
87 return;
88 }
89
90 player.send(new SendString("Please wait as your house data is loaded...", 12285));
91 player.send(new SendMinimapState(MinimapState.HIDDEN));
92 player.interfaceManager.open(12283);
93 player.move(new Position(map.getPosition().getX(), map.getPosition().getY(), height));
94 map.execute(player);
95
96 for (ConstructionObject aOBJECT : OBJECT) {
97 new CustomGameObject(aOBJECT.getObject(), aOBJECT.getPosition()).register();
98 }
99
100 World.schedule(2500, () -> {
101 player.send(new SendMinimapState(MinimapState.NORMAL));
102 player.interfaceManager.close();
103 player.send(new SendMessage("Welcome to your house! To start building please click on the world map to enter the", MessageColor.DARK_GREEN));
104 player.send(new SendMessage("Construction Builder itemcontainer. To leave your house please click on the portal.", MessageColor.DARK_GREEN));
105 player.send(new SendString("[CONSTRUCTION_MAP]", 0));
106 });
107
108 inside = true;
109 }

References com.runehive.util.MessageColor.DARK_GREEN, height, com.runehive.net.packet.out.SendMinimapState.MinimapState.HIDDEN, inside, map, com.runehive.net.packet.out.SendMinimapState.MinimapState.NORMAL, OBJECT, player, com.runehive.game.world.object.CustomGameObject.register(), and com.runehive.game.world.World.schedule().

Here is the call graph for this function:

◆ enter() [2/2]

void com.runehive.content.skill.impl.construction.House.enter ( String name)

Definition at line 111 of file House.java.

111 {
112 if (!ProfileRepository.exist(name)) {
113 player.dialogueFactory.sendStatement("According to our data base, this player does not exist.").execute();
114 return;
115 }
116
117 if (!World.search(name).isPresent()) {
118 player.dialogueFactory.sendStatement(Utility.formatName(name) + " is not currently online.").execute();
119 return;
120 }
121
122 Player other = World.search(name).get();
123 House otherHouse = other.house;
124
125 if (otherHouse.getMap() == null) {
126 player.dialogueFactory.sendStatement(Utility.formatName(name) + " does not have a house for you to visit.").execute();
127 return;
128 }
129
130 if (!otherHouse.isInside()) {
131 player.dialogueFactory.sendStatement(Utility.formatName(name) + " must be in their house for you to visit.").execute();
132 }
133
134 player.send(new SendString("Please wait as your friend's house data is loaded...", 12285));
135 player.send(new SendMinimapState(MinimapState.HIDDEN));
136 player.interfaceManager.open(12283);
137 player.move(new Position(other.house.getMap().getPosition().getX(), otherHouse.getMap().getPosition().getY(), otherHouse.getHeight()));
138 otherHouse.getMap().execute(player);
139
140 for (int index = 0; index < otherHouse.getObjects().size(); index++) {
141 new CustomGameObject(otherHouse.getObjects().get(index).getObject(), otherHouse.getObjects().get(index).getPosition()).register();
142 }
143
144 World.schedule(2500, () -> {
145 player.send(new SendMinimapState(MinimapState.NORMAL));
146 player.interfaceManager.close();
147 player.send(new SendMessage("Welcome to your friend's house.", MessageColor.DARK_GREEN));
148 });
149
150 inside = true;
151 }
val index

References com.runehive.util.MessageColor.DARK_GREEN, com.runehive.util.generic.GenericVoid< T >.execute(), com.runehive.game.world.entity.mob.player.profile.ProfileRepository.exist(), com.runehive.util.Utility.formatName(), getHeight(), getMap(), getObjects(), com.runehive.content.skill.impl.construction.BuildableMap.getPosition(), com.runehive.game.world.position.Position.getX(), com.runehive.game.world.position.Position.getY(), com.runehive.net.packet.out.SendMinimapState.MinimapState.HIDDEN, House(), com.runehive.game.world.entity.mob.player.Player.house, inside, isInside(), com.runehive.net.packet.out.SendMinimapState.MinimapState.NORMAL, player, com.runehive.game.world.object.CustomGameObject.register(), com.runehive.game.world.World.schedule(), and com.runehive.game.world.World.search().

Here is the call graph for this function:

◆ getHeight()

int com.runehive.content.skill.impl.construction.House.getHeight ( )

Definition at line 254 of file House.java.

254 {
255 return height;
256 }

References height.

Referenced by enter().

Here is the caller graph for this function:

◆ getMap()

BuildableMap com.runehive.content.skill.impl.construction.House.getMap ( )

Definition at line 234 of file House.java.

234 {
235 return map;
236 }

References map.

Referenced by enter().

Here is the caller graph for this function:

◆ getObjects()

List< ConstructionObject > com.runehive.content.skill.impl.construction.House.getObjects ( )

Definition at line 242 of file House.java.

242 {
243 return OBJECT;
244 }

References OBJECT.

Referenced by enter().

Here is the caller graph for this function:

◆ isInside()

boolean com.runehive.content.skill.impl.construction.House.isInside ( )

Definition at line 250 of file House.java.

250 {
251 return inside;
252 }

References inside.

Referenced by enter().

Here is the caller graph for this function:

◆ leave()

void com.runehive.content.skill.impl.construction.House.leave ( )

Definition at line 153 of file House.java.

153 {
154 if (inside) {
155 inside = false;
156 player.move(new Position(3079, 3484, 0));
157 player.send(new SendString("[NORMAL_MAP]", 0));
158 }
159 }

References inside, and player.

◆ location()

void com.runehive.content.skill.impl.construction.House.location ( BuildableMap newMap)

Definition at line 57 of file House.java.

57 {
58 if (map == null) {
59 player.dialogueFactory.sendStatement("Please purchase a house first.").execute();
60 return;
61 }
62
63 if (map == newMap) {
64 player.dialogueFactory.sendStatement("Your house is already set to this location.").execute();
65 return;
66 }
67
68 if (player.skills.getLevel(Skill.CONSTRUCTION) < newMap.getLevel()) {
69 player.dialogueFactory.sendStatement("You need a construction level of " + newMap.getLevel() + " to build this.").execute();
70 return;
71 }
72
73 if (!player.inventory.contains(new Item(995, newMap.getCost()))) {
74 player.dialogueFactory.sendStatement("You need " + newMap.getCost() + " royale tokens to purchase this map.").execute();
75 return;
76 }
77
78 map = newMap;
79 OBJECT.clear();
80 player.inventory.remove(new Item(995, newMap.getCost()));
81 player.dialogueFactory.sendStatement("You have successfully purchased the " + newMap.getName() + " map.").execute();
82 }

References com.runehive.game.world.entity.skill.Skill.CONSTRUCTION, com.runehive.content.skill.impl.construction.BuildableMap.getCost(), com.runehive.content.skill.impl.construction.BuildableMap.getLevel(), com.runehive.content.skill.impl.construction.BuildableMap.getName(), map, OBJECT, and player.

Referenced by com.runehive.content.dialogue.impl.ConstructionDialogue.sendDialogues().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ purchase()

void com.runehive.content.skill.impl.construction.House.purchase ( )

Definition at line 41 of file House.java.

41 {
42 if (map != null) {
43 player.dialogueFactory.sendStatement("You already have a house purchased!").execute();
44 return;
45 }
46
47 if (!player.inventory.contains(new Item(995, 1000000))) {
48 player.dialogueFactory.sendStatement("You need 1,000,000 royale tokens to purchase a house.").execute();
49 return;
50 }
51
52 map = BuildableMap.SMALL_CAVE;
53 player.inventory.remove(new Item(995, 1000000));
54 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();
55 }

References map, player, and com.runehive.content.skill.impl.construction.BuildableMap.SMALL_CAVE.

Referenced by com.runehive.content.dialogue.impl.ConstructionDialogue.sendDialogues().

Here is the caller graph for this function:

◆ setMap()

void com.runehive.content.skill.impl.construction.House.setMap ( BuildableMap map)

Definition at line 238 of file House.java.

238 {
239 this.map = map;
240 }

References map.

◆ setObject()

void com.runehive.content.skill.impl.construction.House.setObject ( List< ConstructionObject > object)

Definition at line 246 of file House.java.

246 {
247 OBJECT = object;
248 }

References OBJECT.

◆ toolkit()

boolean com.runehive.content.skill.impl.construction.House.toolkit ( GameObject object)

Definition at line 161 of file House.java.

161 {
162 if (!inside) {
163 return false;
164 }
165
166 ConstructionObject constructionObject = null;
167
168 for (int index = 0; index < OBJECT.size(); index++) {
169 if (OBJECT.get(index).getObject() == object.getId() && OBJECT.get(index).getPosition().equals(object.getPosition())) {
170 constructionObject = new ConstructionObject(object.getId(), OBJECT.get(index).getRotation(), object.getPosition());
171 break;
172 }
173 }
174
175 if (constructionObject == null) {
176 return false;
177 }
178
179 player.dialogueFactory.sendOption("Remove object", () -> {
180 // OBJECT.withdraw(constructionObject);
181 object.unregister();
182 }, "Change rotation", () -> {
183 player.dialogueFactory.onAction(() -> {
184 player.dialogueFactory.sendStatement("Please select the rotation direction").sendOption("North", () -> {
185 object.unregister();
186 new CustomGameObject(object.getId(), object.getPosition(), ObjectDirection.NORTH, ObjectType.GENERAL_PROP).register();
187 }, "East", () -> {
188 object.unregister();
189 new CustomGameObject(object.getId(), object.getPosition(), ObjectDirection.EAST, ObjectType.GENERAL_PROP).register();
190 }, "West", () -> {
191 object.unregister();
192 new CustomGameObject(object.getId(), object.getPosition(), ObjectDirection.WEST, ObjectType.GENERAL_PROP).register();
193 }, "South", () -> {
194 object.unregister();
195 new CustomGameObject(object.getId(), object.getPosition(), ObjectDirection.SOUTH, ObjectType.GENERAL_PROP).register();
196 }, "Nevermind", () -> {
197 player.interfaceManager.close();
198 }).execute();
199
200 });
201 }, "Nevermind", () -> {
202 player.interfaceManager.close();
203 }).execute();
204 return true;
205 }

References com.runehive.game.world.object.ObjectDirection.EAST, com.runehive.game.world.object.ObjectType.GENERAL_PROP, inside, com.runehive.game.world.object.ObjectDirection.NORTH, OBJECT, player, com.runehive.game.world.object.CustomGameObject.register(), com.runehive.game.world.object.ObjectDirection.SOUTH, and com.runehive.game.world.object.ObjectDirection.WEST.

Here is the call graph for this function:

Member Data Documentation

◆ height

int com.runehive.content.skill.impl.construction.House.height
private

Definition at line 34 of file House.java.

Referenced by enter(), and getHeight().

◆ inside

boolean com.runehive.content.skill.impl.construction.House.inside
private

Definition at line 32 of file House.java.

Referenced by enter(), enter(), isInside(), leave(), and toolkit().

◆ map

BuildableMap com.runehive.content.skill.impl.construction.House.map
private

Definition at line 28 of file House.java.

Referenced by enter(), getMap(), location(), purchase(), and setMap().

◆ OBJECT

List<ConstructionObject> com.runehive.content.skill.impl.construction.House.OBJECT = new ArrayList<ConstructionObject>()
private

Definition at line 30 of file House.java.

Referenced by construct(), enter(), getObjects(), location(), setObject(), and toolkit().

◆ player

Player com.runehive.content.skill.impl.construction.House.player
private

Definition at line 26 of file House.java.

Referenced by construct(), enter(), enter(), House(), leave(), location(), purchase(), and toolkit().


The documentation for this class was generated from the following file:
  • java/com/runehive/content/skill/impl/construction/House.java