RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
GenieEvent.java
1package com.osroyale.content.activity.randomevent.impl;
2
3
4import com.osroyale.net.packet.out.SendMessage;
5import com.osroyale.game.Animation;
6import com.osroyale.game.world.entity.mob.player.Player;
7import com.osroyale.content.activity.randomevent.RandomEvent;
8import com.osroyale.content.event.impl.NpcInteractionEvent;
9import com.osroyale.game.world.items.Item;
10
47
48public class GenieEvent extends RandomEvent {
49
51 private GenieEvent(Player player) {
52 super(player, 20);
53 }
54
56 public static GenieEvent create(Player player) {
57 GenieEvent event = new GenieEvent(player);
58 event.add(player);
59 return event;
60 }
61
62 @Override
63 protected boolean clickNpc(Player player, NpcInteractionEvent event) {
64 if (event.getNpc().id != eventNpcIdentification())
65 return false;
66 if (!event.getNpc().owner.equals(player))
67 return false;
68 if (angered) {
69 player.dialogueFactory.sendNpcChat(eventNpcIdentification(), "You had your chance...").execute();
70 return true;
71 }
72 if (event.getOpcode() == 0) {
73 int id = eventNpcIdentification();
74 player.dialogueFactory.sendNpcChat(id, "Take this lamp as a token of appreciation for playing", "Tarnish.").onAction(() -> {
75 player.dialogueFactory.clear();
76 player.inventory.addOrDrop(new Item(2528, 1));
78 }).execute();
79 } else if (event.getOpcode() == 1) {
80 angered = true;
81 player.send(new SendMessage("You have dismissed the genie random event."));
82 player.animate(new Animation(863));
85 }
86 return true;
87 }
88
89 @Override
90 protected String[] eventNpcShout() {
91 return new String[]{
92 "Hello %name, I'm here to grant you a wish!",
93 "Are you there %name? I have something for you!",
94 "C'mon %name, I don't have all day!",
95 "I guess you didn't want a free wish! Had your chance!"
96 };
97 }
98
99 @Override
100 protected int eventNpcIdentification() {
101 return 326;
102 }
103}
final DialogueFactory onAction(Runnable action)
final DialogueFactory sendNpcChat(int id, String... lines)