RuneHive-Game
Loading...
Searching...
No Matches
GenieEvent.java
Go to the documentation of this file.
1package com.runehive.content.activity.randomevent.impl;
2
3
4import com.runehive.net.packet.out.SendMessage;
5import com.runehive.game.Animation;
6import com.runehive.game.world.entity.mob.player.Player;
7import com.runehive.content.activity.randomevent.RandomEvent;
8import com.runehive.content.event.impl.NpcInteractionEvent;
9import com.runehive.game.world.items.Item;
10
11/**
12 * The Genie random event.
13 *
14 * @author Daniel
15 */
16public class GenieEvent extends RandomEvent {
17
18 /** Constructs a new <code>GenieEvent</code>. */
20 super(player, 20);
21 }
22
23 /** Creates a new Genie event. */
24 public static GenieEvent create(Player player) {
25 GenieEvent event = new GenieEvent(player);
26 event.add(player);
27 return event;
28 }
29
30 @Override
32 if (event.getNpc().id != eventNpcIdentification())
33 return false;
34 if (!event.getNpc().owner.equals(player))
35 return false;
36 if (angered) {
37 player.dialogueFactory.sendNpcChat(eventNpcIdentification(), "You had your chance...").execute();
38 return true;
39 }
40 if (event.getOpcode() == 0) {
41 int id = eventNpcIdentification();
42 player.dialogueFactory.sendNpcChat(id, "Take this lamp as a token of appreciation for playing", "osroyale.").onAction(() -> {
43 player.dialogueFactory.clear();
44 player.inventory.addOrDrop(new Item(2528, 1));
46 }).execute();
47 } else if (event.getOpcode() == 1) {
48 angered = true;
49 player.send(new SendMessage("You have dismissed the genie random event."));
50 player.animate(new Animation(863));
51 player.interact(eventNpc);
53 }
54 return true;
55 }
56
57 @Override
58 protected String[] eventNpcShout() {
59 return new String[]{
60 "Hello %name, I'm here to grant you a wish!",
61 "Are you there %name? I have something for you!",
62 "C'mon %name, I don't have all day!",
63 "I guess you didn't want a free wish! Had your chance!"
64 };
65 }
66
67 @Override
68 protected int eventNpcIdentification() {
69 return 326;
70 }
71}
final void finishCooldown()
Sets the cooldown flag to FINISH.
boolean angered
Flag if the event is angered.
RandomEvent(Player player, int cooldown)
Constructs a new RandomEvent.
static GenieEvent create(Player player)
Creates a new Genie event.
String[] eventNpcShout()
The event npc shout messages.
GenieEvent(Player player)
Constructs a new GenieEvent.
int eventNpcIdentification()
The event npc identification.
boolean clickNpc(Player player, NpcInteractionEvent event)
Class that models a single animation used by an entity.
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
The OutgoingPacket that sends a message to a Players chatbox in the client.