1package com.osroyale.content.teleport;
3import com.osroyale.content.activity.impl.barrows.Barrows;
4import com.osroyale.content.activity.impl.godwars.GodwarsActivity;
5import com.osroyale.content.activity.impl.warriorguild.WarriorGuild;
6import com.osroyale.content.activity.inferno.Inferno;
7import com.osroyale.content.dialogue.DialogueFactory;
8import com.osroyale.content.skill.impl.magic.teleport.TeleportType;
9import com.osroyale.content.skill.impl.magic.teleport.Teleportation;
10import com.osroyale.game.world.entity.mob.player.Player;
11import com.osroyale.game.world.entity.mob.player.PlayerRight;
12import com.osroyale.game.world.items.Item;
13import com.osroyale.game.world.position.Position;
14import com.osroyale.net.packet.out.*;
15import com.osroyale.util.Utility;
17import java.util.ArrayList;
65 private static final String[] TITLES = {
"Favorites",
"Minigames",
"Skilling",
"Monster Killing",
"Player Killing",
"Boss Killing"};
74 open(player, type, 0);
80 player.attributes.set(
"TELEPORT_TYPE_KEY", type);
81 if (player.attributes.get(
"TELEPORT_INDEX_KEY", Integer.class) ==
null)
82 player.attributes.set(
"TELEPORT_INDEX_KEY", 0);
83 int size = teleports.size();
84 for (
int index = 0,
string = 58009; index < 6; index++) {
85 String color =
"<col=" + (type.ordinal() == index ?
"ffffff" :
"ff9933") +
">";
86 player.send(
new SendString(color + TITLES[index],
string));
89 for (
int index = 0,
string = 58052; index < (size < 9 ? 9 : size); index++,
string += 2) {
95 String prefex = teleportIndex == index ?
"<col=ffffff>" :
"</col>";
96 String
favorite = player.favoriteTeleport.contains(
teleport) ?
"<clan=6> " :
"";
102 display(player, teleports.get(teleportIndex));
104 player.send(
new SendScrollbar(58050, size <= 9 ? 225 : (size * 25)));
105 player.interfaceManager.
open(58000);
110 player.attributes.set(
"TELEPORT",
teleport);
114 Item items[] =
new Item[3];
115 for (
int index = 0, count = 0; index <
teleport.getDisplay().length; index++, count++) {
116 if (
teleport.getDisplay()[index] == -1) {
120 Item item =
new Item(
teleport.getDisplay()[index]);
121 if (item.isStackable())
122 item.setAmount(50000);
135 player.send(
new SendString(
"You do not have any teleport selected", 58032));
150 int index = getOrdinal(button);
151 player.attributes.set(
"TELEPORT_INDEX_KEY", index);
152 open(player, type, index);
153 if (index < teleports.size()) {
154 display(player, teleports.get(index));
161 player.send(
new SendMessage(
"You can't teleport past 20 wilderness!"));
168 player.send(
new SendMessage(
"You have not selected a destination to teleport to!"));
172 if (
teleport.getName() ==
"Inferno") {
174 player.message(
"Welcome To Inferno " + player.getUsername());
188 player.send(
new SendMessage(
"You have not selected a teleport to favorite!"));
192 boolean isFavorite = player.favoriteTeleport.contains(
teleport);
193 int index = player.attributes.get(
"TELEPORT_INDEX_KEY", Integer.class);
199 player.favoriteTeleport.remove(
teleport);
202 player.favoriteTeleport.add(
teleport);
205 isFavorite = player.favoriteTeleport.contains(
teleport);
206 player.send(
new SendConfig(348, isFavorite ? 0 : 1));
207 player.send(
new SendMessage(
"You have " + (isFavorite ?
"" :
"un-") +
"favorited the " +
teleport.getName() +
" teleport."));
209 open(player, type, index);
215 if (player.isTeleblocked()) {
216 player.message(
"You are currently under the affects of a teleblock spell and can not teleport!");
226 player.message(
true,
"You have teleported to the Catherby farming area.");
227 },
"Ardougne", () -> {
229 player.message(
true,
"You have teleported to the Ardougne farming area.");
230 },
"Falador", () -> {
232 player.message(
true,
"You have teleported to the Falador farming area.");
233 },
"Phasmatys", () -> {
235 player.message(
true,
"You have teleported to the Phasmatys farming area.");
239 factory.
sendOption(
"Gnome agility course (Level 1 agility req.)", () -> {
241 player.send(
new SendMessage(
"You have teleported to the Gnome agility course.",
true));
242 },
"Barbarian agility course (Level 35 agility req.)", () -> {
244 player.send(
new SendMessage(
"You have teleported to the Barbarian agility course.",
true));
245 },
"Wilderness agility course (Level 49 agility req.)", () -> {
247 player.send(
new SendMessage(
"You have teleported to the Wilderness agility course.",
true));
248 },
"Rooftop courses", () -> {
251 player.send(
new SendMessage(
"You have teleported to the Seer's Village rooftop agility course.",
true));
252 },
"Ardougne rooftop course (Level 90 agility req.)", () -> {
254 player.send(
new SendMessage(
"You have teleported to the Ardougne rooftop agility course.",
true));
256 },
"Nevermind", factory::clear).execute();
261 player.send(
new SendMessage(
"You have teleported to the varrock mining area.",
true));
262 },
"Falador", () -> {
264 player.send(
new SendMessage(
"You have teleported to the falador mining area.",
true));
265 },
"Rune Essence", () -> {
267 player.send(
new SendMessage(
"You have teleported to the rune essence mining area.",
true));
268 },
"Shilo Village", () -> {
270 player.send(
new SendMessage(
"You have teleported to the shilo village mining area.",
true));
271 },
"Nevermind", factory::clear).execute();
276 player.send(
new SendMessage(
"You have teleported to the abyss area.",
true));
277 },
"Astral Altar", () -> {
279 player.send(
new SendMessage(
"You have teleported to the astral altar.",
true));
280 },
"Wrath Altar", () -> {
282 player.send(
new SendMessage(
"You have teleported to the wrath altar.",
true));
283 },
"Ournia Altar", () -> {
285 player.send(
new SendMessage(
"You have teleported to the ournia altar.",
true));
286 },
"Nevermind", factory::clear).execute();
291 player.send(
new SendMessage(
"You have teleported to the camelot woodcutting area.",
true));
292 },
"Woodcutting Guild", () -> {
294 player.send(
new SendMessage(
"You have teleported to the woodcutting guild.",
true));
295 },
"Nevermind", factory::clear).execute();
301 player.send(
new SendMessage(
"You have teleported to the puro puro hunter area.",
true));
302 },
"Nevermind", factory::clear).execute();
307 player.send(
new SendMessage(
"You have teleported to the catherby fishing area.",
true));
308 },
"Fishing Guild", () -> {
309 if(player.skills.
getLevel(10) >= 68) {
311 player.send(
new SendMessage(
"You have teleported to the fishing guild.",
true));
313 player.send(
new SendMessage(
"You need 68 fishing to access the fishing guild."));
316 },
"Nevermind", factory::clear).execute();
346 private static List<Teleport> getTeleports(
TeleportType type) {
347 List<Teleport> list =
new ArrayList<>();
349 if (t.getType() == type) list.add(t);
355 private static int getOrdinal(
int button) {
356 int base_button = -7484;
357 int ordinal = Math.abs((base_button - button) / 2);
static GodwarsActivity create(Player player)
static WarriorGuild create(Player player)
final DialogueFactory sendStatement(String... lines)
final DialogueFactory sendOption(String option1, Runnable action1, String option2, Runnable action2)
static void favorite(Player player)
static void open(Player player, TeleportType type)
static void open(Player player)
static void special(Player player, Teleport teleport)
static void open(Player player, TeleportType type, int teleportIndex)
static void click(Player player, int button)
static void display(Player player, Teleport teleport)
static void teleport(Player player)
void open(int identification)
static< T > T randomElement(Collection< T > collection)
static boolean isAdministrator(Player player)