64 private static Map<Integer, Boolean> state =
new HashMap<>();
72 for (ObeliskData location : ObeliskData.values()) {
73 state.put(location.objectId,
false);
77 public void open(
Player player,
int obj) {
79 player.dialogueFactory.
sendStatement(
"You need to be a super donator to use this feature!").
execute();
82 player.attributes.set(
"OBELISK", obj);
84 player.send(
new SendString(
"Wilderness Obelisk", 51002));
85 player.send(
new SendString(
"Click on the obelisk you would like to teleport too", 51003));
86 player.interfaceManager.
open(51000);
89 public boolean activate(
Player player,
int objectId) {
90 ObeliskData location = ObeliskData.forObject(objectId);
91 return location !=
null && activate(player, objectId, ObeliskData.getRandom(location));
94 public boolean activate(
Player player,
int objectId, ObeliskData destination) {
95 ObeliskData location = ObeliskData.forObject(objectId);
100 boolean active = state.get(objectId);
103 player.send(
new SendMessage(
"The obelisk is already active, please wait."));
107 state.put(objectId,
true);
108 int x = location.getBoundaries().getMinimumX();
109 int y = location.getBoundaries().getMinimumY();
118 player.attributes.set(
"OBELISK", -1);
122 protected void execute() {
123 state.put(location.objectId,
false);
124 Boundary boundary =
new Boundary(location.boundary.getMinimumX() + 1, location.boundary.getMinimumY() + 1, location.boundary.getMinimumX() + 3, location.boundary.getMinimumY() + 3);
125 List<Player> players =
Boundary.getPlayers(boundary);
127 if (players.size() > 0) {
128 for (
Player p : players) {
131 int x = destination.getBoundaries().getMinimumX() + 1;
132 int y = destination.getBoundaries().getMinimumY() + 1;
143public enum ObeliskData {
144 LEVEL_13(14829,
new Boundary(3154, 3618, 3158, 3622)),
145 LEVEL_19(14830,
new Boundary(3225, 3665, 3229, 3669)),
146 LEVEL_27(14827,
new Boundary(3033, 3730, 3037, 3734)),
147 LEVEL_35(14828,
new Boundary(3104, 3792, 3108, 3796)),
148 LEVEL_44(14826,
new Boundary(2978, 3864, 2982, 3868)),
149 LEVEL_50(14831,
new Boundary(3305, 3914, 3309, 3918));
151 private final int objectId;
154 ObeliskData(
int objectId,
Boundary boundary) {
155 this.objectId = objectId;
156 this.boundary = boundary;
163 static ObeliskData forObject(
int objectId) {
164 for (ObeliskData l : values()) {
165 if (l.objectId == objectId) {
172 static ObeliskData getRandom(ObeliskData exclude) {
173 ArrayList<ObeliskData> locations =
new ArrayList<>(Arrays.asList(values()));
174 locations.remove(exclude);
175 return locations.get(
Utility.random(locations.size() - 1));
final DialogueFactory sendStatement(String... lines)
final DialogueFactory execute()