1package com.osroyale.content.activity.impl.fightcaves;
3import com.osroyale.content.ActivityLog;
4import com.osroyale.content.activity.Activity;
5import com.osroyale.content.activity.ActivityDeathType;
6import com.osroyale.content.activity.ActivityListener;
7import com.osroyale.content.activity.ActivityType;
8import com.osroyale.content.activity.panel.ActivityPanel;
9import com.osroyale.content.pet.PetData;
10import com.osroyale.content.pet.Pets;
11import com.osroyale.game.Animation;
12import com.osroyale.game.Graphic;
13import com.osroyale.game.world.World;
14import com.osroyale.game.world.entity.mob.Mob;
15import com.osroyale.game.world.entity.mob.npc.Npc;
16import com.osroyale.game.world.entity.mob.npc.NpcDeath;
17import com.osroyale.game.world.entity.mob.player.Player;
18import com.osroyale.game.world.items.Item;
19import com.osroyale.game.world.position.Area;
20import com.osroyale.game.world.position.Position;
21import com.osroyale.net.packet.out.SendMessage;
22import com.osroyale.util.RandomUtils;
23import com.osroyale.util.Utility;
25import java.util.HashSet;
26import java.util.Optional;
70 private final Player player;
73 private boolean completed;
79 public final Set<Npc>
npcs =
new HashSet<>();
88 private FightCaves(
Player player,
int instance) {
97 player.dialogueFactory.
sendNpcChat(2180,
"Welcome to the Fight Caves, #name.",
"There are a total of 15 waves, Tz-Tok Jad being the last.",
"Use your activity panel (bottom left tab) for wave information.",
"Good luck!").
execute();
100 player.gameRecord.start();
105 void handleDeath(
Mob dead) {
106 if (dead.
isPlayer() && dead.equals(player)) {
110 if (dead.
isNpc() &&
npcs.contains(dead)) {
111 if (dead.id == 2191) {
114 for (
int index = 0; index < 2; index++) {
116 Npc TzKet =
new Npc(2192, position);
119 TzKet.getCombat().attack(player);
126 tokkuls += Utility.random(100, 500);
127 if (
npcs.isEmpty()) {
128 wave = TzhaarData.WaveData.getNext(wave.ordinal());
131 player.send(
new SendMessage(
"You have finished the activity!"));
133 player.send(
new SendMessage(
"The next wave will commence soon."));
147 if (player.locking.locked()) {
154 for (
int id : wave.getMonster()) {
155 Npc npc =
new Npc(
id, RandomUtils.random(boundaries));
171 mob.graphic(
Graphic.RESET,
true);
182 long time = player.gameRecord.end(
ActivityType.FIGHT_CAVES);
183 player.dialogueFactory.sendNpcChat(2180,
"You have defeated Tztok-Jad, I am most impressed!",
"Please accept this gift, young thug.").execute();
185 player.inventory.addOrDrop(
new Item(6570));
187 player.send(
new SendMessage(
"You have completed the Fight Caves activity. Final time: @red@" +
Utility.
getTime(time) +
"</col>."));
188 player.activityLogger.add(
ActivityLog.FIGHT_CAVES);
195 player.inventory.addOrDrop(
new Item(6529, tokkuls));
196 player.dialogueFactory.sendNpcChat(2180,
"Better luck next time!",
"Take these tokkuls as a reward.").execute();
203 npcs.forEach(this::remove);
209 ActivityPanel.
update(player, 100,
"Fight Caves",
new Item(6570),
"Congratulations, you have",
"completed the Fight Caves",
"activity!");
213 if (progress >= 100 && !completed)
225 if (!
Area.inFightCaves(player)) {
248 public Optional<? extends ActivityListener<? extends Activity>>
getListener() {
249 return Optional.of(listener);
final void resetCooldown()
Activity(int cooldown, int instance)
void onLogout(Player player)
void onRegionChange(Player player)
boolean canTeleport(Player player)
Optional<? extends ActivityListener<? extends Activity > > getListener()
static void clear(Player player)
static void update(Player player, int amount, String title, String footer, String... strings)
final DialogueFactory sendNpcChat(int id, String... lines)
final DialogueFactory execute()
static void onReward(Player player, int item, int chance)
static void schedule(Task task)
void move(Position position)
Combat< Npc > getCombat()
static String formatDigits(final int amount)
static double getPercentageAmount(int progress, int total)