RuneHive-Game
Loading...
Searching...
No Matches
Emote.java
Go to the documentation of this file.
1package com.runehive.content.emote;
2
3import com.runehive.game.action.impl.EmoteAction;
4import com.runehive.game.world.entity.mob.player.Player;
5import com.runehive.game.world.items.Item;
6import com.runehive.game.world.items.containers.equipment.Equipment;
7import com.runehive.net.packet.out.SendMessage;
8import com.runehive.util.generic.BooleanInterface;
9
10import java.util.Arrays;
11import java.util.Optional;
12
13/**
14 * Holds all the emote data.
15 *
16 * @author Daniel
17 */
18public enum Emote implements BooleanInterface<Player> {
19 YES(168, 855, -1, -1) {
20 @Override
21 public boolean activated(Player player) {
22 return true;
23 }
24 },
25 NO(169, 856, -1, -1) {
26 @Override
27 public boolean activated(Player player) {
28 return true;
29 }
30 },
31 BOW(164, 858, -1, -1) {
32 @Override
33 public boolean activated(Player player) {
34 return true;
35 }
36 },
37 ANGRY(167, 864, -1, -1) {
38 @Override
39 public boolean activated(Player player) {
40 return true;
41 }
42 },
43 THINK(162, 857, -1, -1) {
44 @Override
45 public boolean activated(Player player) {
46 return true;
47 }
48 },
49 WAVE(163, 863, -1, -1) {
50 @Override
51 public boolean activated(Player player) {
52 return true;
53 }
54 },
55 SHRUG(13370, 2113, -1, -1) {
56 @Override
57 public boolean activated(Player player) {
58 return true;
59 }
60 },
61 CHEER(171, 862, -1, -1) {
62 @Override
63 public boolean activated(Player player) {
64 return true;
65 }
66 },
67 BECKON(165, 859, -1, -1) {
68 @Override
69 public boolean activated(Player player) {
70 return true;
71 }
72 },
73 LAUGH(170, 861, -1, -1) {
74 @Override
75 public boolean activated(Player player) {
76 return true;
77 }
78 },
79 JUMP_FOR_JOY(13366, 2109, -1, -1) {
80 @Override
81 public boolean activated(Player player) {
82 return true;
83 }
84 },
85 YAWN(13368, 2111, -1, -1) {
86 @Override
87 public boolean activated(Player player) {
88 return true;
89 }
90 },
91 DANCE(166, 866, -1, -1) {
92 @Override
93 public boolean activated(Player player) {
94 return true;
95 }
96 },
97 JIG(13363, 2106, -1, -1) {
98 @Override
99 public boolean activated(Player player) {
100 return true;
101 }
102 },
103 TWIRL(13364, 2107, -1, -1) {
104 @Override
105 public boolean activated(Player player) {
106 return true;
107 }
108 },
109 HEADBANG(13365, 2108, -1, -1) {
110 @Override
111 public boolean activated(Player player) {
112 return true;
113 }
114 },
115 CRY(161, 860, -1, -1) {
116 @Override
117 public boolean activated(Player player) {
118 return true;
119 }
120 },
121 BLOW_KISS(11100, 0x558, -1, -1) {
122 @Override
123 public boolean activated(Player player) {
124 return true;
125 }
126 },
127 PANIC(13362, 2105, -1, -1) {
128 @Override
129 public boolean activated(Player player) {
130 return true;
131 }
132 },
133 RASBERRY(13367, 2110, -1, -1) {
134 @Override
135 public boolean activated(Player player) {
136 return true;
137 }
138 },
139 CLAP(172, 865, -1, -1) {
140 @Override
141 public boolean activated(Player player) {
142 return true;
143 }
144 },
145 SALUTE(13369, 2112, -1, -1) {
146 @Override
147 public boolean activated(Player player) {
148 return true;
149 }
150 },
151 GOBLIN_BOW(13383, 0x84F, -1, -1) {
152 @Override
153 public boolean activated(Player player) {
154 return true;
155 }
156 },
157 GOBLIN_SALUTE(13384, 0x850, -1, -1) {
158 @Override
159 public boolean activated(Player player) {
160 return true;
161 }
162 },
163
164 GLASS_BOX(18717, 0x46B, -1, 1117) {
165 @Override
166 public boolean activated(Player player) {
167 return player.emoteUnlockable.contains(EmoteUnlockable.GLASS_BOX);
168 }
169 },
170 CLIMB_ROPE(18718, 0x46A, -1, 1118) {
171 @Override
172 public boolean activated(Player player) {
173 return player.emoteUnlockable.contains(EmoteUnlockable.CLIMB_ROPE);
174 }
175 },
176 LEAN(18719, 0x469, -1, 1119) {
177 @Override
178 public boolean activated(Player player) {
179 return player.emoteUnlockable.contains(EmoteUnlockable.LEAN);
180 }
181 },
182 GLASS_WALL(18720, 0x468, -1, 1120) {
183 @Override
184 public boolean activated(Player player) {
185 return player.emoteUnlockable.contains(EmoteUnlockable.GLASS_WALL);
186 }
187 },
188
189 IDEA(18700, 4276, 712, 1100) {
190 @Override
191 public boolean activated(Player player) {
192 return player.emoteUnlockable.contains(EmoteUnlockable.IDEA);
193 }
194 },
195 STOMP(18701, 4278, -1, 1101) {
196 @Override
197 public boolean activated(Player player) {
198 return player.emoteUnlockable.contains(EmoteUnlockable.STOMP);
199 }
200 },
201 FLAP(18702, 4280, -1, 1102) {
202 @Override
203 public boolean activated(Player player) {
204 return player.emoteUnlockable.contains(EmoteUnlockable.FLAP);
205 }
206 },
207 SLAP_HEAD(18703, 4275, -1, 1103) {
208 @Override
209 public boolean activated(Player player) {
210 return player.emoteUnlockable.contains(EmoteUnlockable.SLAP);
211 }
212 },
213 ZOMBIE_WALK(18704, 3544, -1, 1104) {
214 @Override
215 public boolean activated(Player player) {
216 return player.emoteUnlockable.contains(EmoteUnlockable.ZOMBIE_WALK);
217 }
218 },
219 ZOMBIE_DANCE(18705, 3543, -1, 1105) {
220 @Override
221 public boolean activated(Player player) {
222 return player.emoteUnlockable.contains(EmoteUnlockable.ZOMBIE_DANCE);
223 }
224 },
225 SCARED(18706, 2836, -1, 1106) {
226 @Override
227 public boolean activated(Player player) {
228 return player.emoteUnlockable.contains(EmoteUnlockable.SCARED);
229 }
230 },
231 RABBIT_HOP(18707, 6111, -1, 1107) {
232 @Override
233 public boolean activated(Player player) {
234 return player.emoteUnlockable.contains(EmoteUnlockable.BUNNY_HOP);
235 }
236 },
237 SIT_UP(18708, 2763, -1, 1108) {
238 @Override
239 public boolean activated(Player player) {
240 return player.emoteUnlockable.contains(EmoteUnlockable.SIT_UP);
241 }
242 },
243 PUSH_UP(18709, 2756, -1, 1109) {
244 @Override
245 public boolean activated(Player player) {
246 return player.emoteUnlockable.contains(EmoteUnlockable.PUSH_UP);
247 }
248 },
249 STAR_JUMP(18710, 2761, -1, 1110) {
250 @Override
251 public boolean activated(Player player) {
252 return player.emoteUnlockable.contains(EmoteUnlockable.JUMPING_JACK);
253 }
254 },
255 JOG(18711, 2764, -1, 1111) {
256 @Override
257 public boolean activated(Player player) {
258 return player.emoteUnlockable.contains(EmoteUnlockable.JOG);
259 }
260 },
261 ZOMBIE_HAND(18712, 4513, 320, 1112) {
262 @Override
263 public boolean activated(Player player) {
264 return player.emoteUnlockable.contains(EmoteUnlockable.DEMON_HAND);
265 }
266 },
267 HYPERMOBILE_DRINKER(18713, 7131, -1, 1113) {
268 @Override
269 public boolean activated(Player player) {
270 return player.emoteUnlockable.contains(EmoteUnlockable.DRINK);
271 }
272 },
273 AIR_GUITAR(18715, -1, 1239, 1115) {
274 @Override
275 public boolean activated(Player player) {
276 return player.emoteUnlockable.contains(EmoteUnlockable.GUITAR);
277 }
278 },
279 URI_TRANSFORM(18716, -1, -1, 1116) {
280 @Override
281 public boolean activated(Player player) {
282 return player.emoteUnlockable.contains(EmoteUnlockable.URI);
283 }
284 };
285
286 /** The button identification. */
287 private final int button;
288
289 /** The emote animation. */
290 private final int animation;
291
292 /** The emote graphic. */
293 private final int graphic;
294
295 /** The emote configuration. */
296 private final int config;
297
298 /** Constructs a new <code>Emote<code>. */
299 Emote(int button, int animation, int graphic, int config) {
300 this.button = button;
301 this.animation = animation;
302 this.graphic = graphic;
303 this.config = config;
304 }
305
306 public static void skillcape(Player player) {
307 Item item = player.equipment.get(Equipment.CAPE_SLOT);
308
309 if (item == null) {
310 player.send(new SendMessage("You must be wearing a skillcape to perform this emote!"));
311 return;
312 }
313
315
316 if (skillcape == null) {
317 player.send(new SendMessage("You must be wearing a skillcape to perform this emote!"));
318 return;
319 }
320 player.locking.lock(30);
321 execute(player, skillcape.getAnimation(), skillcape.getGraphic());
322 player.locking.unlock();
323 }
324
325 public static void execute(Player player, int animation, int graphic) {
326 player.locking.lock(30);
327 player.action.execute(new EmoteAction(player, animation, graphic), false);
328 player.locking.unlock();
329 }
330
331 /** Gets the button identification of the emote. */
332 public int getButton() {
333 return button;
334 }
335
336 /** Gets the animation of the the emote. */
337 public int getAnimation() {
338 return animation;
339 }
340
341 /** Gets the graphic of the emote. */
342 public int getGraphic() {
343 return graphic;
344 }
345
346 /** Gets the config of the emote. */
347 public int getConfig() {
348 return config;
349 }
350
351 /** Gets emote data corresponding the the button identification. */
352 public static Optional<Emote> forId(int button) {
353 return Arrays.stream(values()).filter(a -> a.button == button).findAny();
354 }
355}
public< A extends Action<?> > void execute(A action)
Handles performing an emote action.
This class represents a character controlled by a player.
Definition Player.java:125
The container class that represents an item that can be interacted with.
Definition Item.java:21
final int getId()
Gets the identification of this item.
Definition Item.java:324
final Item get(int index)
Gets the Item located on index.
The container that manages the equipment for a player.
The OutgoingPacket that sends a message to a Players chatbox in the client.
final int config
The emote configuration.
Definition Emote.java:296
int getConfig()
Gets the config of the emote.
Definition Emote.java:347
int getGraphic()
Gets the graphic of the emote.
Definition Emote.java:342
final int graphic
The emote graphic.
Definition Emote.java:293
Emote(int button, int animation, int graphic, int config)
Constructs a new Emote.
Definition Emote.java:299
final int animation
The emote animation.
Definition Emote.java:290
final int button
The button identification.
Definition Emote.java:287
int getButton()
Gets the button identification of the emote.
Definition Emote.java:332
static void skillcape(Player player)
Definition Emote.java:306
static void execute(Player player, int animation, int graphic)
Definition Emote.java:325
int getAnimation()
Gets the animation of the the emote.
Definition Emote.java:337
static Optional< Emote > forId(int button)
Gets emote data corresponding the the button identification.
Definition Emote.java:352
Holds the data for skillcape emotes.
static Skillcape forId(int id)