RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
BloodMoneyChest.java
1package com.osroyale.content.bloodmoney;
2
3import com.osroyale.content.puzzle.PuzzleType;
4import com.osroyale.game.world.World;
5import com.osroyale.game.world.entity.mob.npc.Npc;
6import com.osroyale.game.world.entity.mob.player.Player;
7import com.osroyale.game.world.items.Item;
8import com.osroyale.game.world.object.CustomGameObject;
9import com.osroyale.net.discord.DiscordPlugin;
10import com.osroyale.util.Stopwatch;
11import com.osroyale.util.Utility;
12
51
52public class BloodMoneyChest {
54 public static boolean active;
55
57 private static Player viewer;
58
60 public static CustomGameObject chest;
61
63 public static Npc guardian;
64
66 public static BloodMoneyPosition data;
67
69 public static final Stopwatch stopwatch = Stopwatch.start();
70
72 public static void spawn() {
74
75 chest = new CustomGameObject(27290, data.position);
76 chest.rotate(data.direction);
77 chest.register();
78
79 guardian = new Npc(8066, data.position);
80 guardian.boundaries = Utility.getInnerBoundaries(data.position, 5, 5);
81 guardian.walkingRadius = 3;
82 guardian.register();
83
84 active = true;
85
86 World.sendMessage("<icon=0><col=FF0000> Blood money chest has spawned at: " + data.name + ".");
87 DiscordPlugin.sendSimpleMessage("Blood money chest has spawned at " + data.name + "!");
88 }
89
91 public static void finish(boolean unlocked) {
92 active = false;
93 chest.unregister();
94 if (guardian != null && guardian.isRegistered()) {
95 guardian.unregister();
96 }
97
98 if (viewer != null) {
99 if (unlocked) {
100 World.sendMessage("<icon=0><col=FF0000> Blood money chest was unlocked by " + viewer.getName() + "!");
101 DiscordPlugin.sendSimpleMessage("Blood money chest has been unlocked by " + viewer.getName() + "!");
102 viewer.inventory.addOrDrop(new Item(20608));
103 }
104
105 viewer.interfaceManager.close(4543);
106 viewer = null;
107 return;
108 }
109 World.sendMessage("<icon=0><col=FF0000> Blood money chest has vanished!");
110 }
111
113 public static void open(Player player) {
114 if (guardian != null) {
115 player.dialogueFactory.sendStatement("The stone guardian must be killed!").execute();
116 return;
117 }
118
119 if (viewer != null) {
120 if (!viewer.interfaceManager.isInterfaceOpen(4543)) {
121 viewer = null;
122 } else {
123 player.dialogueFactory.sendStatement("There is already someone unlocking the chest!").execute();
124 return;
125 }
126 }
127
128 viewer = player;
129 player.puzzle.open(PuzzleType.BLOOD_MONEY);
130 }
131
133 public static String getInformation() {
134 return !active ? "Not Active" : data.name;
135 }
136}
final DialogueFactory sendStatement(String... lines)
static void sendMessage(String... messages)
Definition World.java:433
static< T > T randomElement(Collection< T > collection)
Definition Utility.java:285