Battle with Balok.

Contributed by Serenitty.
This commit is contained in:
MobiusDevelopment
2023-01-06 22:06:12 +00:00
parent 6b6ffe3fd7
commit 81d27511f9
38 changed files with 3234 additions and 8 deletions

View File

@@ -57,3 +57,13 @@ IntervalOfZakenSpawn = 168
# Random interval. Range 1-192
RandomOfZakenSpawn = 48
# ---------------------------------------------------------------------------
# Battle for Balok
# ---------------------------------------------------------------------------
# Time Battle for Balok starts.
BalokTime = 20:30
# Number of points that a player earns for defeating a monster.
BalokPointsPerMonster = 10

View File

@@ -0,0 +1,654 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.bosses.Balok;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicReference;
import org.l2jmobius.Config;
import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.xml.SpawnData;
import org.l2jmobius.gameserver.enums.MailType;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Message;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.ListenerRegisterType;
import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
import org.l2jmobius.gameserver.model.itemcontainer.Mail;
import org.l2jmobius.gameserver.model.spawns.SpawnGroup;
import org.l2jmobius.gameserver.model.spawns.SpawnTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.model.zone.ZoneType;
import org.l2jmobius.gameserver.network.NpcStringId;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarBossInfo;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarHud;
import org.l2jmobius.gameserver.util.Broadcast;
import ai.AbstractNpcAI;
/**
* @author Serenitty
*/
public class Balok extends AbstractNpcAI
{
// Monsters
private static final int SCORPION = 22416;
private static final Set<Integer> NORMAL_MOBS = new HashSet<>();
static
{
NORMAL_MOBS.add(22413);
NORMAL_MOBS.add(22415);
NORMAL_MOBS.add(22414);
NORMAL_MOBS.add(22416);
}
// Intermid bosses
private static final int KESMA = 25956;
private static final int PRAIS = 25957;
private static final int VIRA = 25958;
private static final int HEEDER = 25959;
private static final int HEARAK = 25960;
private static final Set<Integer> INTERMID_BOSSES = new HashSet<>();
static
{
INTERMID_BOSSES.add(KESMA);
INTERMID_BOSSES.add(PRAIS);
INTERMID_BOSSES.add(VIRA);
INTERMID_BOSSES.add(HEEDER);
INTERMID_BOSSES.add(HEARAK);
}
// Final boss
private static final int BALOK1 = 29157; // Balok red normal
private static final int BALOK2 = 29161; // Balok aqua
private static final int BALOK3 = 29165; // Balok yellow
private static final int LORD_BALOK = 29169;
private static final Set<Integer> FINAL_BOSSES = new HashSet<>();
static
{
FINAL_BOSSES.add(BALOK1);
FINAL_BOSSES.add(BALOK2);
FINAL_BOSSES.add(BALOK3);
FINAL_BOSSES.add(LORD_BALOK);
}
// Locations
private static final Location KESMA_LOC = new Location(-17370, 184479, -3991, 49942);
private static final Location PRAIS_LOC = new Location(-21765, 178790, -4077, 7662);
private static final Location VIRA_LOC = new Location(-21375, 182516, -3969, 58095);
private static final Location HEEDER_LOC = new Location(-15210, 178553, -4277, 25134);
private static final Location HEARAK_LOC = new Location(-13947, 181909, -4348, 32883);
private static final Location BALOK_LOC = new Location(-18392, 181079, -3845, 48678);
// Zone
private static final ZoneType BALOK_BATTLE_ZONE = ZoneManager.getInstance().getZoneByName("balok_area");
// Misc
private static final AtomicReference<SpawnTemplate> NORMAL_BATTLE_MOBS = new AtomicReference<>();
private static final Set<Npc> BOSS_SPAWNED = ConcurrentHashMap.newKeySet();
private static final int BATTLE_TIME = 1800000; // 30 min
private static final int PREPARATION_TIME = 1200000; // 20 min
private static final int REWARD_TIME = 2400000; // 40 min
private int _status = 0;
private int _stage = 0;
private int _globalPoints = 0;
private int _midbossDefeatCount = 0;
private int _kesmaStatus = 1;
private int _praisStatus = 1;
private int _viraStatus = 1;
private int _heederStatus = 0;
private int _hearakStatus = 0;
private int _finalBalokType = 1;
private int _finalBalokStatus = 1;
private boolean _inProgress = false;
private boolean _balokKilled = false;
private boolean _firstWaveKilled = false;
private boolean _secondWaveKilled = false;
private boolean _midBossFirstSpawn = false;
private boolean _midBossSecondSpawn = false;
private int _firstKillBalokId = 0;
ScheduledFuture<?> _rewardTask;
private Balok()
{
addKillId(VIRA, KESMA, PRAIS, HEEDER, HEARAK);
addKillId(FINAL_BOSSES);
addKillId(NORMAL_MOBS);
addExitZoneId(BALOK_BATTLE_ZONE.getId());
addEnterZoneId(BALOK_BATTLE_ZONE.getId());
final long currentTime = System.currentTimeMillis();
final Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.HOUR_OF_DAY, Config.BALOK_HOUR);
startTime.set(Calendar.MINUTE, Config.BALOK_MINUTE);
startTime.set(Calendar.SECOND, 0);
if (startTime.getTimeInMillis() < currentTime)
{
startTime.add(Calendar.DAY_OF_YEAR, 1);
}
ThreadPool.scheduleAtFixedRate(this::startEvent, startTime.getTimeInMillis() - currentTime, 86400000); // 86400000 = 1 day
}
private void startEvent()
{
GlobalVariablesManager.getInstance().set(GlobalVariablesManager.BALOK_REMAIN_TIME, System.currentTimeMillis() + PREPARATION_TIME);
BattleWithBalokManager.getInstance().setGlobalStatus(_globalPoints);
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
setInProgress(true);
inPreparation();
}
private void inPreparation()
{
setStatus(1);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, 0));
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BATTLE_WITH_BALOK_STARTS_IN_20_MIN));
ThreadPool.schedule(this::inPreparation10, 600000); // 10 minutes
}
private void inPreparation10()
{
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BATTLE_WITH_BALOK_STARTS_IN_10_MIN));
NORMAL_BATTLE_MOBS.set(SpawnData.getInstance().getSpawns().stream().filter(t -> t.getName() != null).filter(t -> t.getName().contains("NormalMobsBattle")).findAny().orElse(null));
ThreadPool.schedule(this::inPreparationSoon, 540000); // 9 minutes
}
private void inPreparationSoon()
{
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BATTLE_WITH_BALOK_IS_STARTING_SOON));
ThreadPool.schedule(this::startSpawnMobs, 60000); // 1 minute
}
private void startSpawnMobs()
{
GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.BALOK_REMAIN_TIME);
_stage = 1;
setStatus(2);
BattleWithBalokManager.getInstance().setInBattle(true);
GlobalVariablesManager.getInstance().set(GlobalVariablesManager.BALOK_REMAIN_TIME, System.currentTimeMillis() + BATTLE_TIME);
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.MONSTERS_ARE_SPAWNING_ON_THE_BALOK_BATTLEGROUND));
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
NORMAL_BATTLE_MOBS.get().getGroups().forEach(SpawnGroup::spawnAll);
_rewardTask = ThreadPool.schedule(this::finishAndReward, BATTLE_TIME); // 30 minutes
}
private void spawnInterBossesFirstWave()
{
if (!_midBossFirstSpawn && !_firstWaveKilled)
{
BOSS_SPAWNED.add(addSpawn(KESMA, KESMA_LOC));
BOSS_SPAWNED.add(addSpawn(PRAIS, PRAIS_LOC));
BOSS_SPAWNED.add(addSpawn(VIRA, VIRA_LOC));
setMidBossFirstSpawn(true);
BALOK_BATTLE_ZONE.broadcastPacket(new SystemMessage(SystemMessageId.THREE_BOSSES_HAVE_SPAWNED));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
}
private void spawnInterBossesSecondWave()
{
if (!_midBossSecondSpawn && !_secondWaveKilled)
{
BOSS_SPAWNED.add(addSpawn(HEARAK, HEARAK_LOC));
BOSS_SPAWNED.add(addSpawn(HEEDER, HEEDER_LOC));
setMidBossSecondSpawn(true);
_heederStatus = 1;
_hearakStatus = 1;
BALOK_BATTLE_ZONE.broadcastPacket(new SystemMessage(SystemMessageId.TWO_BOSSES_HAVE_SPAWNED));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
}
private void bypassRandomStage()
{
if (!_midBossSecondSpawn && (getRandom(100) < 3))
{
finalBossPlus();
_stage = 5;
}
else
{
finalBoss();
_stage = 4;
}
BOSS_SPAWNED.clear();
setSecondWaveKilled(true);
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
private void interBossesStatus()
{
if (_midbossDefeatCount == 3)
{
setFirstWaveKilled(true);
}
if (_midbossDefeatCount == 5)
{
setFirstWaveKilled(true);
}
if (_stage < 4)
{
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
}
private void spawnBalok()
{
final int random = getRandom(100);
int balokType = -1;
if (random < 50)
{
balokType = BALOK3;
setFinalBaloktype(BALOK3); // Yellow Balok
}
else if (random < 75)
{
balokType = BALOK2;
setFinalBaloktype(BALOK2); // Aqua Balok
}
else
{
balokType = BALOK1;
setFinalBaloktype(BALOK1);
}
BOSS_SPAWNED.add(addSpawn(balokType, BALOK_LOC));
setFinalBalokStatus(1);
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BALOK_IS_HERE));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
private void finalBoss()
{
if (((_stage == 4) && (getMidbossDefeatCount() == 5) && (_firstKillBalokId == KESMA)) || (_globalPoints > 1500000))
{
finalBossPlus();
}
else
{
spawnBalok();
}
}
private void finalBossPlus()
{
_stage = 5;
setFinalBaloktype(LORD_BALOK);
setFinalBalokStatus(1);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.LORD_BALOK_IS_HERE));
addSpawn(LORD_BALOK, BALOK_LOC, false);
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
private void rewardType()
{
int rewardId = -1;
if (_stage < 4)
{
rewardId = 91641; // Sayha's Blessing, consolation item reward.
}
if ((_stage <= 5) && !_balokKilled)
{
rewardId = 91641; // Sayha's Blessing, consolation item reward
}
if ((_stage == 5) && _balokKilled)
{
rewardId = 97087; // Lord Balok's Treasure Chest
}
if ((_stage == 4) && _balokKilled)
{
rewardId = (Rnd.get(97075, 97086)); // Balok's Treasure Chest
}
BattleWithBalokManager.getInstance().setReward(rewardId);
}
private void lastHitRewardMonsters(Player player)
{
final int rnd = Rnd.get(100);
int reward = 0;
if (rnd < 5)
{
reward = 33809; // Improved Scroll: Enchant A-grade Weapon
BALOK_BATTLE_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_RECEIVES_SCROLL_ENCHANT_WEAPON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false, player.getName()));
}
else if (rnd < 15)
{
reward = 729; // Scroll: Enchant A-grade Weapon
BALOK_BATTLE_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_RECEIVES_SCROLL_ENCHANT_WEAPON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false, player.getName()));
}
else
{
reward = 730; // Scroll: Enchant A-grade Armor
BALOK_BATTLE_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_RECEIVES_SCROLL_ENCHANT_ARMOR, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false, player.getName()));
}
player.addItem("Balok Last Hit Reward", reward, 1, player, true);
}
private void lastHitRewardBalok(Npc npc, Player player)
{
int reward = 0;
if (FINAL_BOSSES.contains(npc.getId()))
{
reward = 33809; // Improved Scroll: Enchant A-grade Weapon
}
if (reward > 0)
{
player.addItem("Balok Last Hit Reward", reward, 1, player, true);
}
BALOK_BATTLE_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_RECEIVES_SCROLL_ENCHANT_WEAPON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false, player.getName()));
}
private void setInProgress(boolean value)
{
_inProgress = value;
}
private void setBalokKilled(boolean value)
{
_balokKilled = value;
}
private void setFirstWaveKilled(boolean value)
{
_firstWaveKilled = value;
}
private void setSecondWaveKilled(boolean value)
{
_secondWaveKilled = value;
}
private void setMidBossFirstSpawn(boolean value)
{
_midBossFirstSpawn = value;
}
public boolean midBossSpawn()
{
return _midBossFirstSpawn;
}
private void setMidBossSecondSpawn(boolean value)
{
_midBossSecondSpawn = value;
}
public boolean midBossSecondSpawn()
{
return _midBossSecondSpawn;
}
private void setStatus(int value)
{
_status = value;
}
private void addGlobalPoints(int value)
{
_globalPoints += value;
}
private int getMidbossDefeatCount()
{
return _midbossDefeatCount;
}
private void addMidbossDefeatCount(int value)
{
_midbossDefeatCount += value;
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
private void setFinalBaloktype(int value)
{
_finalBalokType = value;
}
private void setFinalBalokStatus(int value)
{
_finalBalokStatus = value;
}
@Override
public String onKill(Npc npc, Player player, boolean isSummon)
{
if (NORMAL_MOBS.contains(npc.getId()))
{
BattleWithBalokManager.getInstance().addPointsForPlayer(player, npc.getId() == SCORPION);
addGlobalPoints(npc.getId() == SCORPION ? Config.BALOK_POINTS_PER_MONSTER * 10 : Config.BALOK_POINTS_PER_MONSTER);
BattleWithBalokManager.getInstance().setGlobalPoints(_globalPoints);
}
if (INTERMID_BOSSES.contains(npc.getId()) && (_firstKillBalokId == 0)) // to lord balok plus
{
_firstKillBalokId = npc.getId();
}
if (FINAL_BOSSES.contains(npc.getId()))
{
if (_stage == 5)
{
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.YOU_VE_WON_THE_BATTLE_WITH_LORD_BALOK));
}
else
{
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.YOU_VE_WON_THE_BATTLE_WITH_BALOK));
}
setFinalBalokStatus(2);
setBalokKilled(true);
lastHitRewardBalok(npc, player);
finishAndReward();
}
if (npc.getId() == KESMA)
{
addMidbossDefeatCount(1);
_kesmaStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if (npc.getId() == PRAIS)
{
addMidbossDefeatCount(1);
_praisStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if (npc.getId() == VIRA)
{
addMidbossDefeatCount(1);
_viraStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if (npc.getId() == HEARAK)
{
addMidbossDefeatCount(1);
_hearakStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if (npc.getId() == HEEDER)
{
addMidbossDefeatCount(1);
_heederStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if ((_stage == 1) && (_globalPoints >= 250000))
{
_stage = 2;
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
if ((_stage == 2) && (_globalPoints >= 320000) && !_firstWaveKilled && !_midBossFirstSpawn)
{
spawnInterBossesFirstWave();
}
if ((_stage == 2) && (_midbossDefeatCount == 3) && _firstWaveKilled)
{
_stage = 3;
BOSS_SPAWNED.clear();
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
if ((_stage == 3) && (_globalPoints >= 800000) && !_secondWaveKilled && !_midBossSecondSpawn)
{
spawnInterBossesSecondWave();
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
if ((_stage == 3) && (_midbossDefeatCount == 5))
{
_stage = 4;
BOSS_SPAWNED.clear();
setSecondWaveKilled(true);
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
finalBoss();
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
if ((_stage == 1) && (_globalPoints < 3000) && (getRandom(5000) < 10))
{
bypassRandomStage();
}
return super.onKill(npc, player, isSummon);
}
public void finishAndReward()
{
_status = 3;
rewardType();
GlobalVariablesManager.getInstance().set(GlobalVariablesManager.BALOK_REMAIN_TIME, System.currentTimeMillis() + REWARD_TIME);
NORMAL_BATTLE_MOBS.get().getGroups().forEach(SpawnGroup::despawnAll);
BOSS_SPAWNED.stream().forEach(Npc::deleteMe);
BOSS_SPAWNED.clear();
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
if (!_balokKilled && (_stage == 4))
{
_finalBalokStatus = 3;
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.YOU_VE_LOST_THE_BATTLE_WITH_BALOK));
}
if (!_balokKilled && (_stage == 5))
{
_finalBalokStatus = 3;
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.YOU_VE_LOST_THE_BATTLE_WITH_LORD_BALOK));
}
if (_kesmaStatus != 2)
{
_kesmaStatus = 3;
}
if (_praisStatus != 2)
{
_praisStatus = 3;
}
if (_viraStatus != 2)
{
_viraStatus = 3;
}
if ((_heederStatus != 2) && (_stage >= 3) && (_globalPoints >= 800000))
{
_heederStatus = 3;
}
if ((_hearakStatus != 2) && (_stage >= 3) && (_globalPoints >= 800000))
{
_hearakStatus = 3;
}
interBossesStatus();
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
for (Player player : World.getInstance().getPlayers())
{
if (BattleWithBalokManager.getInstance().getMonsterPoints(player) < 1000)
{
return;
}
player.getVariables().set(PlayerVariables.BALOK_AVAILABLE_REWARD, 1);
}
if (_rewardTask != null)
{
_rewardTask.cancel(true);
}
ThreadPool.schedule(this::topRankingRewardFinish, 2400000); // 40 minutes
}
public void sendRankingReward()
{
for (Entry<Integer, Integer> ranker : BattleWithBalokManager.getInstance().getTopPlayers(30).entrySet())
{
if (ranker == null)
{
return;
}
final int charId = ranker.getKey();
final Message mail = new Message(charId, "Battle with Balok Ranker Special Reward", "A special Reward given to rankers who contributed greatly in the balok Battle.", MailType.BALOK_RANKING_REWARD);
final Mail attachement = mail.createAttachments();
attachement.addItem("Battle with Balok", 91690, 100, null, null); // Special HP Recovery Potion
MailManager.getInstance().sendMessage(mail);
}
}
private void topRankingRewardFinish()
{
sendRankingReward();
GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.BALOK_REMAIN_TIME);
}
@RegisterEvent(EventType.ON_PLAYER_LOGIN)
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
public void onPlayerLogin(OnPlayerLogin event)
{
final Player player = event.getPlayer();
if (player == null)
{
return;
}
if (!_inProgress)
{
return;
}
player.sendPacket(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
public static void main(String[] args)
{
new Balok();
}
}

View File

@@ -0,0 +1,277 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/spawns.xsd">
<spawn name="NormalMobsBattle" spawnByDefault="false">
<group>
<npc id="22413" x="-17925" y="178540" z="-4120" heading="28729" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18434" y="178747" z="-4100" heading="28729" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-18899" y="178913" z="-4083" heading="29239" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19363" y="179084" z="-4071" heading="29007" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-19651" y="179333" z="-4065" heading="24722" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20010" y="179672" z="-4060" heading="25446" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-20262" y="179885" z="-4057" heading="25446" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20390" y="180375" z="-4034" heading="16444" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-20502" y="180672" z="-4005" heading="21995" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20422" y="181070" z="-3953" heading="6684" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20184" y="181508" z="-3923" heading="15666" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-20176" y="181618" z="-3922" heading="15666" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20046" y="182203" z="-3935" heading="1606" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19584" y="182316" z="-3899" heading="10574" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-19584" y="182316" z="-3899" heading="10574" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19294" y="182781" z="-3940" heading="10574" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-18901" y="183047" z="-3965" heading="65009" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-18846" y="183045" z="-3964" heading="65009" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18357" y="183073" z="-3953" heading="5208" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-18116" y="183205" z="-3953" heading="5208" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17658" y="183505" z="-3967" heading="6967" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-17463" y="183474" z="-3980" heading="61361" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16942" y="183337" z="-4030" heading="65145" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16834" y="183333" z="-4046" heading="65145" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16291" y="183360" z="-4116" heading="1133" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16183" y="183372" z="-4129" heading="1133" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15677" y="183239" z="-4193" heading="47445" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15703" y="183076" z="-4190" heading="47445" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15869" y="182556" z="-4170" heading="44896" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15891" y="182505" z="-4167" heading="44896" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15862" y="181995" z="-4170" heading="52889" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15823" y="181892" z="-4174" heading="52889" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15514" y="181454" z="-4216" heading="57338" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15372" y="181165" z="-4228" heading="52267" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15330" y="180625" z="-4231" heading="48414" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15524" y="180649" z="-4203" heading="33316" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15606" y="180546" z="-4200" heading="42531" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22413" x="-15715" y="180423" z="-4200" heading="40936" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16163" y="180018" z="-4200" heading="39790" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16196" y="179654" z="-4210" heading="49450" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16168" y="179214" z="-4224" heading="49935" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16164" y="179160" z="-4226" heading="49935" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16242" y="178620" z="-4224" heading="42579" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16306" y="178531" z="-4222" heading="42579" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16720" y="178269" z="-4208" heading="32484" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16775" y="178271" z="-4206" heading="32484" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17234" y="178597" z="-4147" heading="24087" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-17251" y="178648" z="-4139" heading="19735" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17468" y="179075" z="-4073" heading="24448" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17861" y="179448" z="-4013" heading="28591" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-17911" y="179469" z="-4008" heading="28591" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18361" y="179673" z="-3988" heading="28116" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-18890" y="179813" z="-3990" heading="30563" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-19051" y="179847" z="-3990" heading="30563" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19640" y="179979" z="-4009" heading="30307" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20174" y="180079" z="-4018" heading="33029" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-20721" y="180063" z="-4019" heading="33096" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22413" x="-21051" y="180053" z="-4020" heading="33096" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-21600" y="180035" z="-4030" heading="33096" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-22104" y="180253" z="-4017" heading="28501" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-22232" y="180309" z="-4013" heading="28501" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-22176" y="180521" z="-3993" heading="13715" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-22148" y="180627" z="-3983" heading="13715" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-21969" y="181042" z="-3974" heading="9935" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-21873" y="181176" z="-3971" heading="9935" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-21439" y="181478" z="-3964" heading="4179" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-20951" y="181730" z="-3950" heading="5334" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20579" y="181964" z="-3942" heading="6436" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20061" y="182274" z="-3934" heading="4962" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19573" y="182525" z="-3919" heading="4962" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19501" y="182563" z="-3917" heading="4962" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-18923" y="183492" z="-3998" heading="10869" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18728" y="183884" z="-4011" heading="12472" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-18513" y="184263" z="-4007" heading="9535" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18310" y="184711" z="-4002" heading="58245" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17978" y="184420" z="-3996" heading="57982" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16290" y="183416" z="-4116" heading="60359" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16290" y="183416" z="-4116" heading="64482" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-15273" y="183868" z="-4251" heading="20580" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15303" y="183938" z="-4248" heading="55333" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15006" y="183614" z="-4265" heading="52830" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15071" y="183073" z="-4266" heading="47228" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15115" y="182635" z="-4294" heading="51861" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-14914" y="181782" z="-4330" heading="52407" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14826" y="181352" z="-4329" heading="50687" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-14800" y="181188" z="-4328" heading="50228" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14742" y="180640" z="-4314" heading="50306" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-14700" y="180147" z="-4305" heading="49006" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14750" y="179674" z="-4291" heading="38229" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15183" y="179523" z="-4267" heading="27600" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-15376" y="179624" z="-4246" heading="27795" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15868" y="179682" z="-4213" heading="37272" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16390" y="179567" z="-4176" heading="32730" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-16550" y="179585" z="-4156" heading="29358" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17020" y="179667" z="-4084" heading="34245" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17544" y="179648" z="-3984" heading="28713" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-17896" y="179797" z="-3956" heading="28400" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18392" y="180026" z="-3922" heading="28465" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-18643" y="180136" z="-3912" heading="28465" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19167" y="180287" z="-3939" heading="30432" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19606" y="180504" z="-3964" heading="10372" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-19615" y="180684" z="-3925" heading="24076" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20012" y="181058" z="-3928" heading="25667" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20519" y="181177" z="-3949" heading="32346" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-20627" y="181174" z="-3949" heading="33902" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22413" x="-20737" y="181162" z="-3949" heading="33902" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-21212" y="181041" z="-3950" heading="37308" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-21574" y="180923" z="-3957" heading="34689" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-22168" y="180813" z="-3975" heading="34689" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-22002" y="181080" z="-3960" heading="10071" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-18549" y="184142" z="-4025" heading="64095" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18220" y="184097" z="-4017" heading="64731" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17850" y="184011" z="-4003" heading="59204" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-17815" y="183469" z="-3989" heading="48707" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-17599" y="183028" z="-3945" heading="55011" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-17282" y="182634" z="-3930" heading="53172" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16971" y="182191" z="-3959" heading="57308" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17053" y="181826" z="-3945" heading="48100" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16955" y="181343" z="-3962" heading="51800" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22413" x="-16879" y="181264" z="-3975" heading="57164" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22414" x="-16417" y="180743" z="-4073" heading="48725" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-16324" y="180494" z="-4114" heading="56654" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15951" y="180174" z="-4178" heading="61069" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15713" y="180370" z="-4196" heading="2688" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15230" y="180481" z="-4209" heading="2297" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15230" y="180482" z="-4210" heading="2297" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-14353" y="184129" z="-4180" heading="20581" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14324" y="184535" z="-4175" heading="18971" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-14422" y="184727" z="-4174" heading="22853" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14859" y="184789" z="-4170" heading="30663" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15054" y="184879" z="-4162" heading="26863" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15261" y="185244" z="-4158" heading="19595" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15596" y="185366" z="-4143" heading="30375" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16003" y="185212" z="-4123" heading="56627" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22413" x="-15930" y="184899" z="-4135" heading="49205" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15835" y="184415" z="-4174" heading="52397" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15669" y="184006" z="-4202" heading="53590" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15443" y="183505" z="-4224" heading="53566" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15246" y="183068" z="-4256" heading="53566" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-21935" y="180493" z="-3977" heading="26289" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-22211" y="180890" z="-3973" heading="22922" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-22388" y="181198" z="-3960" heading="9729" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-22243" y="181493" z="-3966" heading="12099" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-21891" y="181790" z="-3972" heading="330" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-14239" y="184075" z="-4180" heading="8578" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14409" y="183901" z="-4201" heading="33891" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-14837" y="184024" z="-4220" heading="24434" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15087" y="184310" z="-4210" heading="23005" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15361" y="184682" z="-4181" heading="23005" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-18985" y="179818" z="-3976" heading="45865" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18985" y="179818" z="-3976" heading="45865" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19157" y="179413" z="-3991" heading="44950" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19158" y="179412" z="-3992" heading="44950" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19569" y="179683" z="-4016" heading="26704" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-19922" y="180025" z="-4040" heading="24508" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19922" y="180025" z="-4040" heading="24508" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20206" y="180356" z="-4040" heading="23717" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-20355" y="180843" z="-4010" heading="17711" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-20360" y="180876" z="-4008" heading="17711" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-20247" y="181133" z="-3994" heading="12063" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20247" y="181133" z="-3994" heading="12063" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19945" y="181411" z="-3905" heading="19773" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19935" y="181745" z="-3900" heading="12669" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19799" y="182136" z="-3897" heading="16125" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-19603" y="182840" z="-3969" heading="4488" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19603" y="182840" z="-3969" heading="4488" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19549" y="182732" z="-3969" heading="10141" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19549" y="182732" z="-3969" heading="10166" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19110" y="183613" z="-4024" heading="12105" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-18719" y="183614" z="-4036" heading="20170" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18719" y="183614" z="-4036" heading="20170" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-18398" y="183408" z="-4014" heading="57592" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-18167" y="183174" z="-3980" heading="52969" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-18026" y="182766" z="-3905" heading="52477" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-15771" y="182776" z="-4172" heading="33189" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15771" y="182776" z="-4172" heading="33189" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16081" y="182699" z="-4121" heading="32715" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16442" y="182650" z="-4052" heading="39221" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16589" y="182546" z="-4021" heading="39221" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-16543" y="182043" z="-4036" heading="23173" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16543" y="182043" z="-4036" heading="23173" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16316" y="181975" z="-4091" heading="53434" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16168" y="181680" z="-4121" heading="56795" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15936" y="181378" z="-4161" heading="57072" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-15501" y="181425" z="-4238" heading="19739" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15501" y="181425" z="-4238" heading="19739" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15702" y="181060" z="-4191" heading="47546" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15966" y="180987" z="-4146" heading="28138" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16170" y="181084" z="-4113" heading="28138" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22415" x="-16068" y="180741" z="-4134" heading="38613" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16082" y="178812" z="-4260" heading="57623" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16082" y="178812" z="-4260" heading="39425" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16326" y="178631" z="-4230" heading="30119" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16723" y="178795" z="-4203" heading="25994" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16931" y="178953" z="-4192" heading="25994" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-17771" y="179029" z="-4084" heading="43794" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17771" y="179029" z="-4084" heading="43464" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-18106" y="178683" z="-4094" heading="36775" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-18473" y="178583" z="-4094" heading="34288" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-18906" y="178513" z="-4109" heading="34283" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-19586" y="177922" z="-4114" heading="28190" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19586" y="177922" z="-4114" heading="28190" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19627" y="178387" z="-4122" heading="15270" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19627" y="178387" z="-4122" heading="12976" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19664" y="178615" z="-4112" heading="28321" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-20140" y="178685" z="-4075" heading="5151" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20140" y="178685" z="-4075" heading="5151" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20395" y="178885" z="-4067" heading="32500" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-20393" y="179004" z="-4067" heading="28544" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-20744" y="179239" z="-4054" heading="28544" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-22988" y="179086" z="-4089" heading="12530" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-22988" y="179086" z="-4089" heading="19100" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-22895" y="179597" z="-4063" heading="10290" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-22902" y="180004" z="-4043" heading="19834" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-22958" y="180166" z="-4035" heading="19834" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-22684" y="181877" z="-3967" heading="58754" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-22684" y="181877" z="-3967" heading="58754" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-22283" y="181585" z="-3967" heading="58978" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-21964" y="181435" z="-3968" heading="64811" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-21494" y="181338" z="-3960" heading="62755" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-16874" y="180551" z="-4034" heading="54927" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16874" y="180551" z="-4034" heading="54927" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16934" y="180286" z="-4073" heading="56722" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16658" y="179975" z="-4168" heading="214" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16485" y="179871" z="-4186" heading="51665" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-13957" y="184206" z="-4174" heading="26181" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-13957" y="184206" z="-4174" heading="26181" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-14413" y="184267" z="-4174" heading="24597" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-14668" y="184574" z="-4175" heading="16383" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-14794" y="184702" z="-4172" heading="32172" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-15768" y="185896" z="-4150" heading="51691" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15768" y="185896" z="-4150" heading="51691" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16013" y="185692" z="-4125" heading="30810" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16028" y="185671" z="-4125" heading="58555" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15778" y="185455" z="-4143" heading="58555" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-20436" y="179495" z="-4057" heading="61611" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20436" y="179495" z="-4057" heading="60005" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20064" y="179171" z="-4063" heading="61140" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19666" y="178992" z="-4084" heading="58772" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19263" y="178705" z="-4111" heading="59331" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="34328" x="-21362" y="178620" z="-4078" heading="28318" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21367" y="178955" z="-4078" heading="36467" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21593" y="179213" z="-4078" heading="45432" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21940" y="179200" z="-4077" heading="52273" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-22189" y="178959" z="-4078" heading="61861" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21591" y="178357" z="-4077" heading="18973" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21797" y="182345" z="-3969" heading="5372" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21550" y="182111" z="-3969" heading="12415" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21207" y="182094" z="-3969" heading="20607" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-20960" y="182340" z="-3969" heading="27931" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-20966" y="182691" z="-3969" heading="37674" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21213" y="182942" z="-3969" heading="45831" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-16939" y="184927" z="-3991" heading="35881" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-16941" y="184573" z="-3991" heading="28756" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-17192" y="184319" z="-3991" heading="20469" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-17538" y="184335" z="-3991" heading="12760" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-17806" y="184565" z="-3991" heading="4391" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-17785" y="184920" z="-3992" heading="61275" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-13755" y="181484" z="-4347" heading="20352" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14109" y="181477" z="-4347" heading="10378" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14318" y="181750" z="-4348" heading="4191" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14362" y="182088" z="-4347" heading="61009" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14108" y="182327" z="-4347" heading="52752" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-13762" y="182327" z="-4348" heading="45968" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14787" y="178728" z="-4277" heading="36405" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15030" y="178978" z="-4277" heading="45337" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15386" y="178985" z="-4277" heading="53147" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15621" y="178722" z="-4277" heading="61426" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15620" y="178381" z="-4277" heading="4384" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15374" y="178143" z="-4278" heading="11505" respawnTime="60sec" /> <!-- Demon Priest -->
</group>
</spawn>
</list>

View File

@@ -8222,4 +8222,11 @@
<node X="11773" Y="183287" />
<node X="11994" Y="183055" />
</zone>
<!-- Battle with Balok -->
<zone name="balok_area" type="ConditionZone" shape="Cuboid" minZ="-2000" maxZ="-4600">
<stat name="NoBookmark" val="true" />
<node X="-9095" Y="191592" />
<node X="-26826" Y="176629" />
</zone>
</list>

View File

@@ -986,6 +986,11 @@ public class Config
public static int ZAKEN_SPAWN_INTERVAL;
public static int ZAKEN_SPAWN_RANDOM;
// Balok
public static int BALOK_HOUR;
public static int BALOK_MINUTE;
public static int BALOK_POINTS_PER_MONSTER;
// Gracia Seeds Settings
public static int SOD_TIAT_KILL_COUNT;
public static long SOD_STAGE_2_LENGTH;
@@ -2681,6 +2686,10 @@ public class Config
QUEEN_ANT_SPAWN_RANDOM = grandBossConfig.getInt("RandomOfQueenAntSpawn", 17);
ZAKEN_SPAWN_INTERVAL = grandBossConfig.getInt("IntervalOfZakenSpawn", 168);
ZAKEN_SPAWN_RANDOM = grandBossConfig.getInt("RandomOfZakenSpawn", 48);
final String[] balokTime = grandBossConfig.getString("BalokTime", "20:30").trim().split(":");
BALOK_HOUR = Integer.parseInt(balokTime[0]);
BALOK_MINUTE = Integer.parseInt(balokTime[1]);
BALOK_POINTS_PER_MONSTER = grandBossConfig.getInt("BalokPointsPerMonster", 10);
// Load HuntPass (if exists)
final PropertiesParser huntPassConfig = new PropertiesParser(HUNT_PASS_CONFIG_FILE);

View File

@@ -30,5 +30,6 @@ public enum MailType
MENTOR_NPC,
PRIME_SHOP_GIFT,
PURGE_REWARD,
BALOK_RANKING_REWARD,
PLEDGE_DONATION_CRITICAL_SUCCESS
}

View File

@@ -0,0 +1,133 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Player;
/**
* @author Serenitty, Index
*/
public class BattleWithBalokManager
{
private final Map<Integer, Integer> _playerPoints = new ConcurrentHashMap<>();
private boolean _inBattle = false;
private int _reward = 0;
private int _globalPoints = 0;
private int _globalStage = 0;
private int _globalStatus = 0;
public BattleWithBalokManager()
{
}
public void addPointsForPlayer(Player player, boolean isScorpion)
{
final int pointsToAdd = isScorpion ? Config.BALOK_POINTS_PER_MONSTER * 10 : Config.BALOK_POINTS_PER_MONSTER;
final int currentPoints = _playerPoints.computeIfAbsent(player.getObjectId(), pts -> 0);
int sum = pointsToAdd + currentPoints;
_playerPoints.put(player.getObjectId(), sum);
}
public Map<Integer, Integer> getTopPlayers(int count)
{
return _playerPoints.entrySet().stream().sorted(Entry.comparingByValue(Comparator.reverseOrder())).limit(count).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
public int getPlayerRank(Player player)
{
if (!_playerPoints.containsKey(player.getObjectId()))
{
return 0;
}
final Map<Integer, Integer> sorted = _playerPoints.entrySet().stream().sorted(Entry.comparingByValue(Comparator.reverseOrder())).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
return sorted.keySet().stream().toList().indexOf(player.getObjectId()) + 1;
}
public int getMonsterPoints(Player player)
{
return _playerPoints.computeIfAbsent(player.getObjectId(), pts -> 0);
}
public int getReward()
{
return _reward;
}
public void setReward(int value)
{
_reward = value;
}
public boolean getInBattle()
{
return _inBattle;
}
public void setInBattle(boolean value)
{
_inBattle = value;
}
public int getGlobalPoints()
{
return _globalPoints;
}
public void setGlobalPoints(int value)
{
_globalPoints = value;
}
public int getGlobalStage()
{
return _globalStage;
}
public void setGlobalStage(int value)
{
_globalStage = value;
}
public int getGlobalStatus()
{
return _globalStatus;
}
public void setGlobalStatus(int value)
{
_globalStatus = value;
}
public static BattleWithBalokManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final BattleWithBalokManager INSTANCE = new BattleWithBalokManager();
}
}

View File

@@ -47,6 +47,7 @@ public class GlobalVariablesManager extends AbstractVariables
public static final String RANKING_POWER_COOLDOWN = "RANKING_POWER_COOLDOWN";
public static final String RANKING_POWER_LOCATION = "RANKING_POWER_LOCATION";
public static final String PURGE_REWARD_TIME = "PURGE_REWARD_TIME";
public static final String BALOK_REMAIN_TIME = "BALOK_REMAIN_TIME";
protected GlobalVariablesManager()
{

View File

@@ -92,6 +92,7 @@ public class PlayerVariables extends AbstractVariables
public static final String DYE_POTENTIAL_DAILY_STEP = "DYE_POTENTIAL_DAILY_STEP";
public static final String DYE_POTENTIAL_DAILY_COUNT = "DYE_POTENTIAL_DAILY_COUNT";
public static final String MISSION_LEVEL_PROGRESS = "MISSION_LEVEL_PROGRESS_";
public static final String BALOK_AVAILABLE_REWARD = "BALOK_AVAILABLE_REWARD";
private final int _objectId;

View File

@@ -40,6 +40,10 @@ import org.l2jmobius.gameserver.network.clientpackets.autopeel.ExRequestReadyIte
import org.l2jmobius.gameserver.network.clientpackets.autopeel.ExRequestStopItemAutoPeel;
import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExAutoPlaySetting;
import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExRequestActivateAutoShortcut;
import org.l2jmobius.gameserver.network.clientpackets.balok.ExBalrogWarGetReward;
import org.l2jmobius.gameserver.network.clientpackets.balok.ExBalrogWarShowRanking;
import org.l2jmobius.gameserver.network.clientpackets.balok.ExBalrogWarShowUI;
import org.l2jmobius.gameserver.network.clientpackets.balok.ExBalrogWarTeleport;
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionCancel;
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionEnchant;
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionPutItem;
@@ -796,10 +800,10 @@ public enum ExClientPackets
EX_WORLDCASTLEWAR_CASTLE_SIEGE_ALL_RANKING_INFO(0x235, null, ConnectionState.IN_GAME),
EX_MISSION_LEVEL_REWARD_LIST(0x236, RequestMissionRewardList::new, ConnectionState.IN_GAME),
EX_MISSION_LEVEL_RECEIVE_REWARD(0x237, RequestMissionLevelReceiveReward::new, ConnectionState.IN_GAME),
EX_BALROGWAR_TELEPORT(0x238, null, ConnectionState.IN_GAME),
EX_BALROGWAR_SHOW_UI(0x239, null, ConnectionState.IN_GAME),
EX_BALROGWAR_SHOW_RANKING(0x23A, null, ConnectionState.IN_GAME),
EX_BALROGWAR_GET_REWARD(0x23B, null, ConnectionState.IN_GAME),
EX_BALROGWAR_TELEPORT(0x238, ExBalrogWarTeleport::new, ConnectionState.IN_GAME),
EX_BALROGWAR_SHOW_UI(0x239, ExBalrogWarShowUI::new, ConnectionState.IN_GAME),
EX_BALROGWAR_SHOW_RANKING(0x23A, ExBalrogWarShowRanking::new, ConnectionState.IN_GAME),
EX_BALROGWAR_GET_REWARD(0x23B, ExBalrogWarGetReward::new, ConnectionState.IN_GAME),
EX_USER_RESTART_LOCKER_UPDATE(0x23C, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_ITEM_LIST(0x23D, ExWorldExchangeItemList::new, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_REGI_ITEM(0x23E, ExWorldExchangeRegisterItem::new, ConnectionState.IN_GAME),

View File

@@ -0,0 +1,58 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.balok;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarGetReward;
/**
* @author Serenitty
*/
public class ExBalrogWarGetReward implements ClientPacket
{
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final int availableReward = player.getVariables().getInt(PlayerVariables.BALOK_AVAILABLE_REWARD, 0);
if (availableReward != 1)
{
return;
}
int count = 1;
final int globalStage = BattleWithBalokManager.getInstance().getGlobalStage();
if (globalStage < 4)
{
count = 30; // sayha potion sealed
}
final int reward = BattleWithBalokManager.getInstance().getReward();
player.addItem("Battle with Balok", reward, count, player, true);
player.getVariables().set(PlayerVariables.BALOK_AVAILABLE_REWARD, -1);
player.sendPacket(new BalrogWarGetReward(true));
}
}

View File

@@ -0,0 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.balok;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarShowRanking;
/**
* @author Serenitty
*/
public class ExBalrogWarShowRanking implements ClientPacket
{
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
if (!BattleWithBalokManager.getInstance().getInBattle())
{
return;
}
player.sendPacket(new BalrogWarShowRanking());
}
}

View File

@@ -0,0 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.balok;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarShowUI;
/**
* @author Serenitty
*/
public class ExBalrogWarShowUI implements ClientPacket
{
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
player.sendPacket(new BalrogWarShowUI(player));
}
}

View File

@@ -0,0 +1,88 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.balok;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectFlag;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
/**
* @author Serenitty
*/
public class ExBalrogWarTeleport implements ClientPacket
{
private static final Location BALOK_LOCATION = new Location(-18414, 180442, -3862);
private static final int TELEPORT_COST = 50000;
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
// Dead characters cannot use teleports.
if (player.isDead())
{
player.sendPacket(SystemMessageId.DEAD_CHARACTERS_CANNOT_USE_TELEPORTS);
return;
}
// Players should not be able to teleport if in a special location.
if ((player.getMovieHolder() != null) || player.isFishing() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
return;
}
// Cannot teleport in combat.
if ((player.isInCombat() || player.isCastingNow()))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_WHILE_IN_COMBAT_MODE);
return;
}
// Cannot escape effect.
if (player.isAffected(EffectFlag.CANNOT_ESCAPE))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
return;
}
// Take teleport fee.
if (!player.destroyItemByItemId("Battle with Balok Teleport", 57, TELEPORT_COST, player, true))
{
player.sendPacket(SystemMessageId.NOT_ENOUGH_MONEY_TO_USE_THE_FUNCTION);
return;
}
// Stop moving.
player.abortCast();
player.stopMove(null);
// Teleport to Balok location.
player.setTeleportLocation(BALOK_LOCATION);
player.doCast(CommonSkill.TELEPORT.getSkill());
}
}

View File

@@ -0,0 +1,93 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Serenitty, NasSeKa
*/
public class BalrogWarBossInfo extends ServerPacket
{
private final int _bossState1;
private final int _bossState2;
private final int _bossState3;
private final int _bossState4;
private final int _bossState5;
private final int _finalBossId;
private final int _finalState;
public BalrogWarBossInfo(int balokid, int balokstatus, int boss1, int boss2, int boss3, int boss4, int boss5)
{
_finalBossId = balokid + 1000000;
_finalState = balokstatus;
_bossState1 = boss1;
_bossState2 = boss2;
_bossState3 = boss3;
_bossState4 = boss4;
_bossState5 = boss5;
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_BOSSINFO.writeId(this);
final long globalpoints = BattleWithBalokManager.getInstance().getGlobalPoints();
final int globalstage = BattleWithBalokManager.getInstance().getGlobalStage();
if ((globalpoints < 320000) && (globalstage <= 2))
{
writeInt(1);
writeInt(1);
writeInt(1);
writeInt(1);
writeInt(1);
writeInt(0);
writeInt(0);
writeInt(0);
writeInt(0);
writeInt(0);
}
else
{
final int bossId1 = 25956 + 1000000;
final int bossId2 = 25957 + 1000000;
final int bossId3 = 25958 + 1000000;
int bossId4 = 0;
int bossId5 = 0;
if ((globalpoints >= 800000) && (globalstage >= 3))
{
bossId4 = 25959 + 1000000;
bossId5 = 25960 + 1000000;
}
writeInt(bossId1);
writeInt(bossId2);
writeInt(bossId3);
writeInt(bossId4);
writeInt(bossId5);
writeInt(_bossState1);
writeInt(_bossState2);
writeInt(_bossState3);
writeInt(_bossState4);
writeInt(_bossState5);
writeInt(_finalBossId);
writeInt(_finalState);
}
}
}

View File

@@ -0,0 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Serenitty
*/
public class BalrogWarGetReward extends ServerPacket
{
private final boolean _available;
public BalrogWarGetReward(boolean available)
{
_available = available;
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_GET_REWARD.writeId(this);
writeByte(_available);
}
}

View File

@@ -0,0 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import java.util.concurrent.TimeUnit;
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Mobius, Serenitty
*/
public class BalrogWarHud extends ServerPacket
{
private final int _state;
private final int _stage;
public BalrogWarHud(int state, int stage)
{
_state = state;
_stage = stage;
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_HUD.writeId(this);
final long remainTime = GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.BALOK_REMAIN_TIME, 0);
final long currentTime = System.currentTimeMillis();
writeInt(_state); // State
writeInt(_stage); // Progress Step
writeInt((int) TimeUnit.MILLISECONDS.toSeconds(remainTime - currentTime)); // Time (in seconds)
}
}

View File

@@ -0,0 +1,53 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import java.util.Map;
import java.util.Map.Entry;
import org.l2jmobius.gameserver.data.sql.CharNameTable;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Serenitty, Index
*/
public class BalrogWarShowRanking extends ServerPacket
{
private final Map<Integer, Integer> _rankingData;
public BalrogWarShowRanking()
{
_rankingData = BattleWithBalokManager.getInstance().getTopPlayers(150);
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_SHOW_RANKING.writeId(this);
writeInt(_rankingData.size());
int rank = 0;
for (Entry<Integer, Integer> entry : _rankingData.entrySet())
{
rank++;
writeInt(rank); // Rank
writeSizedString(CharNameTable.getInstance().getNameById(entry.getKey())); // Name
writeInt(entry.getValue()); // Score
}
}
}

View File

@@ -0,0 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Serenitty
*/
public class BalrogWarShowUI extends ServerPacket
{
private final Player _player;
public BalrogWarShowUI(Player player)
{
_player = player;
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_SHOW_UI.writeId(this);
final int personalPoints = BattleWithBalokManager.getInstance().getMonsterPoints(_player);
writeInt(personalPoints < 1 ? 0 : BattleWithBalokManager.getInstance().getPlayerRank(_player)); // personal rank
writeInt(personalPoints); // personal points
writeLong(BattleWithBalokManager.getInstance().getGlobalPoints()); // total points of players
writeInt(_player.getVariables().getInt(PlayerVariables.BALOK_AVAILABLE_REWARD, 0)); // reward activated or not
writeInt(BattleWithBalokManager.getInstance().getReward()); // RewardItemID
writeLong(1); // unknown
}
}

View File

@@ -57,3 +57,13 @@ IntervalOfZakenSpawn = 168
# Random interval. Range 1-192
RandomOfZakenSpawn = 48
# ---------------------------------------------------------------------------
# Battle for Balok
# ---------------------------------------------------------------------------
# Time Battle for Balok starts.
BalokTime = 20:30
# Number of points that a player earns for defeating a monster.
BalokPointsPerMonster = 10

View File

@@ -0,0 +1,654 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package ai.bosses.Balok;
import java.util.Calendar;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.atomic.AtomicReference;
import org.l2jmobius.Config;
import org.l2jmobius.commons.threads.ThreadPool;
import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.data.xml.SpawnData;
import org.l2jmobius.gameserver.enums.MailType;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import org.l2jmobius.gameserver.instancemanager.MailManager;
import org.l2jmobius.gameserver.instancemanager.ZoneManager;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.Message;
import org.l2jmobius.gameserver.model.World;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.events.EventType;
import org.l2jmobius.gameserver.model.events.ListenerRegisterType;
import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
import org.l2jmobius.gameserver.model.events.impl.creature.player.OnPlayerLogin;
import org.l2jmobius.gameserver.model.itemcontainer.Mail;
import org.l2jmobius.gameserver.model.spawns.SpawnGroup;
import org.l2jmobius.gameserver.model.spawns.SpawnTemplate;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.model.zone.ZoneType;
import org.l2jmobius.gameserver.network.NpcStringId;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarBossInfo;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarHud;
import org.l2jmobius.gameserver.util.Broadcast;
import ai.AbstractNpcAI;
/**
* @author Serenitty
*/
public class Balok extends AbstractNpcAI
{
// Monsters
private static final int SCORPION = 22416;
private static final Set<Integer> NORMAL_MOBS = new HashSet<>();
static
{
NORMAL_MOBS.add(22413);
NORMAL_MOBS.add(22415);
NORMAL_MOBS.add(22414);
NORMAL_MOBS.add(22416);
}
// Intermid bosses
private static final int KESMA = 25956;
private static final int PRAIS = 25957;
private static final int VIRA = 25958;
private static final int HEEDER = 25959;
private static final int HEARAK = 25960;
private static final Set<Integer> INTERMID_BOSSES = new HashSet<>();
static
{
INTERMID_BOSSES.add(KESMA);
INTERMID_BOSSES.add(PRAIS);
INTERMID_BOSSES.add(VIRA);
INTERMID_BOSSES.add(HEEDER);
INTERMID_BOSSES.add(HEARAK);
}
// Final boss
private static final int BALOK1 = 29157; // Balok red normal
private static final int BALOK2 = 29161; // Balok aqua
private static final int BALOK3 = 29165; // Balok yellow
private static final int LORD_BALOK = 29169;
private static final Set<Integer> FINAL_BOSSES = new HashSet<>();
static
{
FINAL_BOSSES.add(BALOK1);
FINAL_BOSSES.add(BALOK2);
FINAL_BOSSES.add(BALOK3);
FINAL_BOSSES.add(LORD_BALOK);
}
// Locations
private static final Location KESMA_LOC = new Location(-17370, 184479, -3991, 49942);
private static final Location PRAIS_LOC = new Location(-21765, 178790, -4077, 7662);
private static final Location VIRA_LOC = new Location(-21375, 182516, -3969, 58095);
private static final Location HEEDER_LOC = new Location(-15210, 178553, -4277, 25134);
private static final Location HEARAK_LOC = new Location(-13947, 181909, -4348, 32883);
private static final Location BALOK_LOC = new Location(-18392, 181079, -3845, 48678);
// Zone
private static final ZoneType BALOK_BATTLE_ZONE = ZoneManager.getInstance().getZoneByName("balok_area");
// Misc
private static final AtomicReference<SpawnTemplate> NORMAL_BATTLE_MOBS = new AtomicReference<>();
private static final Set<Npc> BOSS_SPAWNED = ConcurrentHashMap.newKeySet();
private static final int BATTLE_TIME = 1800000; // 30 min
private static final int PREPARATION_TIME = 1200000; // 20 min
private static final int REWARD_TIME = 2400000; // 40 min
private int _status = 0;
private int _stage = 0;
private int _globalPoints = 0;
private int _midbossDefeatCount = 0;
private int _kesmaStatus = 1;
private int _praisStatus = 1;
private int _viraStatus = 1;
private int _heederStatus = 0;
private int _hearakStatus = 0;
private int _finalBalokType = 1;
private int _finalBalokStatus = 1;
private boolean _inProgress = false;
private boolean _balokKilled = false;
private boolean _firstWaveKilled = false;
private boolean _secondWaveKilled = false;
private boolean _midBossFirstSpawn = false;
private boolean _midBossSecondSpawn = false;
private int _firstKillBalokId = 0;
ScheduledFuture<?> _rewardTask;
private Balok()
{
addKillId(VIRA, KESMA, PRAIS, HEEDER, HEARAK);
addKillId(FINAL_BOSSES);
addKillId(NORMAL_MOBS);
addExitZoneId(BALOK_BATTLE_ZONE.getId());
addEnterZoneId(BALOK_BATTLE_ZONE.getId());
final long currentTime = System.currentTimeMillis();
final Calendar startTime = Calendar.getInstance();
startTime.set(Calendar.HOUR_OF_DAY, Config.BALOK_HOUR);
startTime.set(Calendar.MINUTE, Config.BALOK_MINUTE);
startTime.set(Calendar.SECOND, 0);
if (startTime.getTimeInMillis() < currentTime)
{
startTime.add(Calendar.DAY_OF_YEAR, 1);
}
ThreadPool.scheduleAtFixedRate(this::startEvent, startTime.getTimeInMillis() - currentTime, 86400000); // 86400000 = 1 day
}
private void startEvent()
{
GlobalVariablesManager.getInstance().set(GlobalVariablesManager.BALOK_REMAIN_TIME, System.currentTimeMillis() + PREPARATION_TIME);
BattleWithBalokManager.getInstance().setGlobalStatus(_globalPoints);
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
setInProgress(true);
inPreparation();
}
private void inPreparation()
{
setStatus(1);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, 0));
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BATTLE_WITH_BALOK_STARTS_IN_20_MIN));
ThreadPool.schedule(this::inPreparation10, 600000); // 10 minutes
}
private void inPreparation10()
{
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BATTLE_WITH_BALOK_STARTS_IN_10_MIN));
NORMAL_BATTLE_MOBS.set(SpawnData.getInstance().getSpawns().stream().filter(t -> t.getName() != null).filter(t -> t.getName().contains("NormalMobsBattle")).findAny().orElse(null));
ThreadPool.schedule(this::inPreparationSoon, 540000); // 9 minutes
}
private void inPreparationSoon()
{
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BATTLE_WITH_BALOK_IS_STARTING_SOON));
ThreadPool.schedule(this::startSpawnMobs, 60000); // 1 minute
}
private void startSpawnMobs()
{
GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.BALOK_REMAIN_TIME);
_stage = 1;
setStatus(2);
BattleWithBalokManager.getInstance().setInBattle(true);
GlobalVariablesManager.getInstance().set(GlobalVariablesManager.BALOK_REMAIN_TIME, System.currentTimeMillis() + BATTLE_TIME);
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.MONSTERS_ARE_SPAWNING_ON_THE_BALOK_BATTLEGROUND));
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
NORMAL_BATTLE_MOBS.get().getGroups().forEach(SpawnGroup::spawnAll);
_rewardTask = ThreadPool.schedule(this::finishAndReward, BATTLE_TIME); // 30 minutes
}
private void spawnInterBossesFirstWave()
{
if (!_midBossFirstSpawn && !_firstWaveKilled)
{
BOSS_SPAWNED.add(addSpawn(KESMA, KESMA_LOC));
BOSS_SPAWNED.add(addSpawn(PRAIS, PRAIS_LOC));
BOSS_SPAWNED.add(addSpawn(VIRA, VIRA_LOC));
setMidBossFirstSpawn(true);
BALOK_BATTLE_ZONE.broadcastPacket(new SystemMessage(SystemMessageId.THREE_BOSSES_HAVE_SPAWNED));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
}
private void spawnInterBossesSecondWave()
{
if (!_midBossSecondSpawn && !_secondWaveKilled)
{
BOSS_SPAWNED.add(addSpawn(HEARAK, HEARAK_LOC));
BOSS_SPAWNED.add(addSpawn(HEEDER, HEEDER_LOC));
setMidBossSecondSpawn(true);
_heederStatus = 1;
_hearakStatus = 1;
BALOK_BATTLE_ZONE.broadcastPacket(new SystemMessage(SystemMessageId.TWO_BOSSES_HAVE_SPAWNED));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
}
private void bypassRandomStage()
{
if (!_midBossSecondSpawn && (getRandom(100) < 3))
{
finalBossPlus();
_stage = 5;
}
else
{
finalBoss();
_stage = 4;
}
BOSS_SPAWNED.clear();
setSecondWaveKilled(true);
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
private void interBossesStatus()
{
if (_midbossDefeatCount == 3)
{
setFirstWaveKilled(true);
}
if (_midbossDefeatCount == 5)
{
setFirstWaveKilled(true);
}
if (_stage < 4)
{
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
}
private void spawnBalok()
{
final int random = getRandom(100);
int balokType = -1;
if (random < 50)
{
balokType = BALOK3;
setFinalBaloktype(BALOK3); // Yellow Balok
}
else if (random < 75)
{
balokType = BALOK2;
setFinalBaloktype(BALOK2); // Aqua Balok
}
else
{
balokType = BALOK1;
setFinalBaloktype(BALOK1);
}
BOSS_SPAWNED.add(addSpawn(balokType, BALOK_LOC));
setFinalBalokStatus(1);
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.BALOK_IS_HERE));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
private void finalBoss()
{
if (((_stage == 4) && (getMidbossDefeatCount() == 5) && (_firstKillBalokId == KESMA)) || (_globalPoints > 1500000))
{
finalBossPlus();
}
else
{
spawnBalok();
}
}
private void finalBossPlus()
{
_stage = 5;
setFinalBaloktype(LORD_BALOK);
setFinalBalokStatus(1);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.LORD_BALOK_IS_HERE));
addSpawn(LORD_BALOK, BALOK_LOC, false);
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
private void rewardType()
{
int rewardId = -1;
if (_stage < 4)
{
rewardId = 91641; // Sayha's Blessing, consolation item reward.
}
if ((_stage <= 5) && !_balokKilled)
{
rewardId = 91641; // Sayha's Blessing, consolation item reward
}
if ((_stage == 5) && _balokKilled)
{
rewardId = 97087; // Lord Balok's Treasure Chest
}
if ((_stage == 4) && _balokKilled)
{
rewardId = (Rnd.get(97075, 97086)); // Balok's Treasure Chest
}
BattleWithBalokManager.getInstance().setReward(rewardId);
}
private void lastHitRewardMonsters(Player player)
{
final int rnd = Rnd.get(100);
int reward = 0;
if (rnd < 5)
{
reward = 33809; // Improved Scroll: Enchant A-grade Weapon
BALOK_BATTLE_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_RECEIVES_SCROLL_ENCHANT_WEAPON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false, player.getName()));
}
else if (rnd < 15)
{
reward = 729; // Scroll: Enchant A-grade Weapon
BALOK_BATTLE_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_RECEIVES_SCROLL_ENCHANT_WEAPON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false, player.getName()));
}
else
{
reward = 730; // Scroll: Enchant A-grade Armor
BALOK_BATTLE_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_RECEIVES_SCROLL_ENCHANT_ARMOR, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false, player.getName()));
}
player.addItem("Balok Last Hit Reward", reward, 1, player, true);
}
private void lastHitRewardBalok(Npc npc, Player player)
{
int reward = 0;
if (FINAL_BOSSES.contains(npc.getId()))
{
reward = 33809; // Improved Scroll: Enchant A-grade Weapon
}
if (reward > 0)
{
player.addItem("Balok Last Hit Reward", reward, 1, player, true);
}
BALOK_BATTLE_ZONE.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_RECEIVES_SCROLL_ENCHANT_WEAPON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false, player.getName()));
}
private void setInProgress(boolean value)
{
_inProgress = value;
}
private void setBalokKilled(boolean value)
{
_balokKilled = value;
}
private void setFirstWaveKilled(boolean value)
{
_firstWaveKilled = value;
}
private void setSecondWaveKilled(boolean value)
{
_secondWaveKilled = value;
}
private void setMidBossFirstSpawn(boolean value)
{
_midBossFirstSpawn = value;
}
public boolean midBossSpawn()
{
return _midBossFirstSpawn;
}
private void setMidBossSecondSpawn(boolean value)
{
_midBossSecondSpawn = value;
}
public boolean midBossSecondSpawn()
{
return _midBossSecondSpawn;
}
private void setStatus(int value)
{
_status = value;
}
private void addGlobalPoints(int value)
{
_globalPoints += value;
}
private int getMidbossDefeatCount()
{
return _midbossDefeatCount;
}
private void addMidbossDefeatCount(int value)
{
_midbossDefeatCount += value;
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
private void setFinalBaloktype(int value)
{
_finalBalokType = value;
}
private void setFinalBalokStatus(int value)
{
_finalBalokStatus = value;
}
@Override
public String onKill(Npc npc, Player player, boolean isSummon)
{
if (NORMAL_MOBS.contains(npc.getId()))
{
BattleWithBalokManager.getInstance().addPointsForPlayer(player, npc.getId() == SCORPION);
addGlobalPoints(npc.getId() == SCORPION ? Config.BALOK_POINTS_PER_MONSTER * 10 : Config.BALOK_POINTS_PER_MONSTER);
BattleWithBalokManager.getInstance().setGlobalPoints(_globalPoints);
}
if (INTERMID_BOSSES.contains(npc.getId()) && (_firstKillBalokId == 0)) // to lord balok plus
{
_firstKillBalokId = npc.getId();
}
if (FINAL_BOSSES.contains(npc.getId()))
{
if (_stage == 5)
{
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.YOU_VE_WON_THE_BATTLE_WITH_LORD_BALOK));
}
else
{
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.YOU_VE_WON_THE_BATTLE_WITH_BALOK));
}
setFinalBalokStatus(2);
setBalokKilled(true);
lastHitRewardBalok(npc, player);
finishAndReward();
}
if (npc.getId() == KESMA)
{
addMidbossDefeatCount(1);
_kesmaStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if (npc.getId() == PRAIS)
{
addMidbossDefeatCount(1);
_praisStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if (npc.getId() == VIRA)
{
addMidbossDefeatCount(1);
_viraStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if (npc.getId() == HEARAK)
{
addMidbossDefeatCount(1);
_hearakStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if (npc.getId() == HEEDER)
{
addMidbossDefeatCount(1);
_heederStatus = 2;
interBossesStatus();
lastHitRewardMonsters(player);
}
if ((_stage == 1) && (_globalPoints >= 250000))
{
_stage = 2;
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
if ((_stage == 2) && (_globalPoints >= 320000) && !_firstWaveKilled && !_midBossFirstSpawn)
{
spawnInterBossesFirstWave();
}
if ((_stage == 2) && (_midbossDefeatCount == 3) && _firstWaveKilled)
{
_stage = 3;
BOSS_SPAWNED.clear();
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
if ((_stage == 3) && (_globalPoints >= 800000) && !_secondWaveKilled && !_midBossSecondSpawn)
{
spawnInterBossesSecondWave();
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
if ((_stage == 3) && (_midbossDefeatCount == 5))
{
_stage = 4;
BOSS_SPAWNED.clear();
setSecondWaveKilled(true);
BattleWithBalokManager.getInstance().setGlobalStage(_stage);
finalBoss();
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
if ((_stage == 1) && (_globalPoints < 3000) && (getRandom(5000) < 10))
{
bypassRandomStage();
}
return super.onKill(npc, player, isSummon);
}
public void finishAndReward()
{
_status = 3;
rewardType();
GlobalVariablesManager.getInstance().set(GlobalVariablesManager.BALOK_REMAIN_TIME, System.currentTimeMillis() + REWARD_TIME);
NORMAL_BATTLE_MOBS.get().getGroups().forEach(SpawnGroup::despawnAll);
BOSS_SPAWNED.stream().forEach(Npc::deleteMe);
BOSS_SPAWNED.clear();
Broadcast.toAllOnlinePlayers(new BalrogWarHud(_status, _stage));
if (!_balokKilled && (_stage == 4))
{
_finalBalokStatus = 3;
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.YOU_VE_LOST_THE_BATTLE_WITH_BALOK));
}
if (!_balokKilled && (_stage == 5))
{
_finalBalokStatus = 3;
Broadcast.toAllOnlinePlayers(new SystemMessage(SystemMessageId.YOU_VE_LOST_THE_BATTLE_WITH_LORD_BALOK));
}
if (_kesmaStatus != 2)
{
_kesmaStatus = 3;
}
if (_praisStatus != 2)
{
_praisStatus = 3;
}
if (_viraStatus != 2)
{
_viraStatus = 3;
}
if ((_heederStatus != 2) && (_stage >= 3) && (_globalPoints >= 800000))
{
_heederStatus = 3;
}
if ((_hearakStatus != 2) && (_stage >= 3) && (_globalPoints >= 800000))
{
_hearakStatus = 3;
}
interBossesStatus();
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
for (Player player : World.getInstance().getPlayers())
{
if (BattleWithBalokManager.getInstance().getMonsterPoints(player) < 1000)
{
return;
}
player.getVariables().set(PlayerVariables.BALOK_AVAILABLE_REWARD, 1);
}
if (_rewardTask != null)
{
_rewardTask.cancel(true);
}
ThreadPool.schedule(this::topRankingRewardFinish, 2400000); // 40 minutes
}
public void sendRankingReward()
{
for (Entry<Integer, Integer> ranker : BattleWithBalokManager.getInstance().getTopPlayers(30).entrySet())
{
if (ranker == null)
{
return;
}
final int charId = ranker.getKey();
final Message mail = new Message(charId, "Battle with Balok Ranker Special Reward", "A special Reward given to rankers who contributed greatly in the balok Battle.", MailType.BALOK_RANKING_REWARD);
final Mail attachement = mail.createAttachments();
attachement.addItem("Battle with Balok", 91690, 100, null, null); // Special HP Recovery Potion
MailManager.getInstance().sendMessage(mail);
}
}
private void topRankingRewardFinish()
{
sendRankingReward();
GlobalVariablesManager.getInstance().remove(GlobalVariablesManager.BALOK_REMAIN_TIME);
}
@RegisterEvent(EventType.ON_PLAYER_LOGIN)
@RegisterType(ListenerRegisterType.GLOBAL_PLAYERS)
public void onPlayerLogin(OnPlayerLogin event)
{
final Player player = event.getPlayer();
if (player == null)
{
return;
}
if (!_inProgress)
{
return;
}
player.sendPacket(new BalrogWarHud(_status, _stage));
Broadcast.toAllOnlinePlayers(new BalrogWarBossInfo(_finalBalokType, _finalBalokStatus, _kesmaStatus, _praisStatus, _viraStatus, _hearakStatus, _heederStatus));
}
public static void main(String[] args)
{
new Balok();
}
}

View File

@@ -0,0 +1,277 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../xsd/spawns.xsd">
<spawn name="NormalMobsBattle" spawnByDefault="false">
<group>
<npc id="22413" x="-17925" y="178540" z="-4120" heading="28729" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18434" y="178747" z="-4100" heading="28729" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-18899" y="178913" z="-4083" heading="29239" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19363" y="179084" z="-4071" heading="29007" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-19651" y="179333" z="-4065" heading="24722" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20010" y="179672" z="-4060" heading="25446" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-20262" y="179885" z="-4057" heading="25446" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20390" y="180375" z="-4034" heading="16444" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-20502" y="180672" z="-4005" heading="21995" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20422" y="181070" z="-3953" heading="6684" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20184" y="181508" z="-3923" heading="15666" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-20176" y="181618" z="-3922" heading="15666" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20046" y="182203" z="-3935" heading="1606" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19584" y="182316" z="-3899" heading="10574" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-19584" y="182316" z="-3899" heading="10574" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19294" y="182781" z="-3940" heading="10574" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-18901" y="183047" z="-3965" heading="65009" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-18846" y="183045" z="-3964" heading="65009" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18357" y="183073" z="-3953" heading="5208" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-18116" y="183205" z="-3953" heading="5208" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17658" y="183505" z="-3967" heading="6967" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-17463" y="183474" z="-3980" heading="61361" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16942" y="183337" z="-4030" heading="65145" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16834" y="183333" z="-4046" heading="65145" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16291" y="183360" z="-4116" heading="1133" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16183" y="183372" z="-4129" heading="1133" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15677" y="183239" z="-4193" heading="47445" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15703" y="183076" z="-4190" heading="47445" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15869" y="182556" z="-4170" heading="44896" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15891" y="182505" z="-4167" heading="44896" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15862" y="181995" z="-4170" heading="52889" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15823" y="181892" z="-4174" heading="52889" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15514" y="181454" z="-4216" heading="57338" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15372" y="181165" z="-4228" heading="52267" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15330" y="180625" z="-4231" heading="48414" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15524" y="180649" z="-4203" heading="33316" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15606" y="180546" z="-4200" heading="42531" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22413" x="-15715" y="180423" z="-4200" heading="40936" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16163" y="180018" z="-4200" heading="39790" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16196" y="179654" z="-4210" heading="49450" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16168" y="179214" z="-4224" heading="49935" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16164" y="179160" z="-4226" heading="49935" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16242" y="178620" z="-4224" heading="42579" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16306" y="178531" z="-4222" heading="42579" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16720" y="178269" z="-4208" heading="32484" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16775" y="178271" z="-4206" heading="32484" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17234" y="178597" z="-4147" heading="24087" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-17251" y="178648" z="-4139" heading="19735" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17468" y="179075" z="-4073" heading="24448" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17861" y="179448" z="-4013" heading="28591" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-17911" y="179469" z="-4008" heading="28591" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18361" y="179673" z="-3988" heading="28116" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-18890" y="179813" z="-3990" heading="30563" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-19051" y="179847" z="-3990" heading="30563" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19640" y="179979" z="-4009" heading="30307" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20174" y="180079" z="-4018" heading="33029" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-20721" y="180063" z="-4019" heading="33096" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22413" x="-21051" y="180053" z="-4020" heading="33096" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-21600" y="180035" z="-4030" heading="33096" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-22104" y="180253" z="-4017" heading="28501" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-22232" y="180309" z="-4013" heading="28501" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-22176" y="180521" z="-3993" heading="13715" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-22148" y="180627" z="-3983" heading="13715" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-21969" y="181042" z="-3974" heading="9935" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-21873" y="181176" z="-3971" heading="9935" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-21439" y="181478" z="-3964" heading="4179" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-20951" y="181730" z="-3950" heading="5334" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20579" y="181964" z="-3942" heading="6436" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20061" y="182274" z="-3934" heading="4962" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19573" y="182525" z="-3919" heading="4962" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19501" y="182563" z="-3917" heading="4962" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-18923" y="183492" z="-3998" heading="10869" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18728" y="183884" z="-4011" heading="12472" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-18513" y="184263" z="-4007" heading="9535" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18310" y="184711" z="-4002" heading="58245" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17978" y="184420" z="-3996" heading="57982" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16290" y="183416" z="-4116" heading="60359" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16290" y="183416" z="-4116" heading="64482" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-15273" y="183868" z="-4251" heading="20580" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15303" y="183938" z="-4248" heading="55333" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15006" y="183614" z="-4265" heading="52830" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15071" y="183073" z="-4266" heading="47228" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15115" y="182635" z="-4294" heading="51861" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-14914" y="181782" z="-4330" heading="52407" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14826" y="181352" z="-4329" heading="50687" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-14800" y="181188" z="-4328" heading="50228" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14742" y="180640" z="-4314" heading="50306" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-14700" y="180147" z="-4305" heading="49006" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14750" y="179674" z="-4291" heading="38229" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15183" y="179523" z="-4267" heading="27600" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-15376" y="179624" z="-4246" heading="27795" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15868" y="179682" z="-4213" heading="37272" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16390" y="179567" z="-4176" heading="32730" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-16550" y="179585" z="-4156" heading="29358" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17020" y="179667" z="-4084" heading="34245" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17544" y="179648" z="-3984" heading="28713" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-17896" y="179797" z="-3956" heading="28400" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18392" y="180026" z="-3922" heading="28465" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-18643" y="180136" z="-3912" heading="28465" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19167" y="180287" z="-3939" heading="30432" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19606" y="180504" z="-3964" heading="10372" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-19615" y="180684" z="-3925" heading="24076" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20012" y="181058" z="-3928" heading="25667" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20519" y="181177" z="-3949" heading="32346" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-20627" y="181174" z="-3949" heading="33902" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22413" x="-20737" y="181162" z="-3949" heading="33902" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-21212" y="181041" z="-3950" heading="37308" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-21574" y="180923" z="-3957" heading="34689" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-22168" y="180813" z="-3975" heading="34689" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-22002" y="181080" z="-3960" heading="10071" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-18549" y="184142" z="-4025" heading="64095" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18220" y="184097" z="-4017" heading="64731" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17850" y="184011" z="-4003" heading="59204" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-17815" y="183469" z="-3989" heading="48707" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-17599" y="183028" z="-3945" heading="55011" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-17282" y="182634" z="-3930" heading="53172" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16971" y="182191" z="-3959" heading="57308" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-17053" y="181826" z="-3945" heading="48100" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16955" y="181343" z="-3962" heading="51800" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22413" x="-16879" y="181264" z="-3975" heading="57164" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22414" x="-16417" y="180743" z="-4073" heading="48725" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22413" x="-16324" y="180494" z="-4114" heading="56654" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15951" y="180174" z="-4178" heading="61069" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15713" y="180370" z="-4196" heading="2688" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15230" y="180481" z="-4209" heading="2297" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15230" y="180482" z="-4210" heading="2297" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-14353" y="184129" z="-4180" heading="20581" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14324" y="184535" z="-4175" heading="18971" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-14422" y="184727" z="-4174" heading="22853" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14859" y="184789" z="-4170" heading="30663" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-15054" y="184879" z="-4162" heading="26863" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15261" y="185244" z="-4158" heading="19595" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15596" y="185366" z="-4143" heading="30375" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16003" y="185212" z="-4123" heading="56627" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22413" x="-15930" y="184899" z="-4135" heading="49205" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15835" y="184415" z="-4174" heading="52397" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15669" y="184006" z="-4202" heading="53590" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15443" y="183505" z="-4224" heading="53566" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15246" y="183068" z="-4256" heading="53566" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-21935" y="180493" z="-3977" heading="26289" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-22211" y="180890" z="-3973" heading="22922" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-22388" y="181198" z="-3960" heading="9729" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-22243" y="181493" z="-3966" heading="12099" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-21891" y="181790" z="-3972" heading="330" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-14239" y="184075" z="-4180" heading="8578" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-14409" y="183901" z="-4201" heading="33891" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-14837" y="184024" z="-4220" heading="24434" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15087" y="184310" z="-4210" heading="23005" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15361" y="184682" z="-4181" heading="23005" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-18985" y="179818" z="-3976" heading="45865" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18985" y="179818" z="-3976" heading="45865" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19157" y="179413" z="-3991" heading="44950" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19158" y="179412" z="-3992" heading="44950" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19569" y="179683" z="-4016" heading="26704" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-19922" y="180025" z="-4040" heading="24508" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19922" y="180025" z="-4040" heading="24508" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20206" y="180356" z="-4040" heading="23717" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-20355" y="180843" z="-4010" heading="17711" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-20360" y="180876" z="-4008" heading="17711" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-20247" y="181133" z="-3994" heading="12063" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20247" y="181133" z="-3994" heading="12063" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19945" y="181411" z="-3905" heading="19773" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19935" y="181745" z="-3900" heading="12669" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19799" y="182136" z="-3897" heading="16125" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-19603" y="182840" z="-3969" heading="4488" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19603" y="182840" z="-3969" heading="4488" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19549" y="182732" z="-3969" heading="10141" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19549" y="182732" z="-3969" heading="10166" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19110" y="183613" z="-4024" heading="12105" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-18719" y="183614" z="-4036" heading="20170" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-18719" y="183614" z="-4036" heading="20170" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-18398" y="183408" z="-4014" heading="57592" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-18167" y="183174" z="-3980" heading="52969" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-18026" y="182766" z="-3905" heading="52477" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-15771" y="182776" z="-4172" heading="33189" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15771" y="182776" z="-4172" heading="33189" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16081" y="182699" z="-4121" heading="32715" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16442" y="182650" z="-4052" heading="39221" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16589" y="182546" z="-4021" heading="39221" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-16543" y="182043" z="-4036" heading="23173" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16543" y="182043" z="-4036" heading="23173" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16316" y="181975" z="-4091" heading="53434" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16168" y="181680" z="-4121" heading="56795" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15936" y="181378" z="-4161" heading="57072" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-15501" y="181425" z="-4238" heading="19739" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15501" y="181425" z="-4238" heading="19739" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-15702" y="181060" z="-4191" heading="47546" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-15966" y="180987" z="-4146" heading="28138" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16170" y="181084" z="-4113" heading="28138" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22415" x="-16068" y="180741" z="-4134" heading="38613" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22413" x="-16082" y="178812" z="-4260" heading="57623" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16082" y="178812" z="-4260" heading="39425" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16326" y="178631" z="-4230" heading="30119" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16723" y="178795" z="-4203" heading="25994" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16931" y="178953" z="-4192" heading="25994" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-17771" y="179029" z="-4084" heading="43794" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-17771" y="179029" z="-4084" heading="43464" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-18106" y="178683" z="-4094" heading="36775" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-18473" y="178583" z="-4094" heading="34288" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-18906" y="178513" z="-4109" heading="34283" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-19586" y="177922" z="-4114" heading="28190" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-19586" y="177922" z="-4114" heading="28190" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-19627" y="178387" z="-4122" heading="15270" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19627" y="178387" z="-4122" heading="12976" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19664" y="178615" z="-4112" heading="28321" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-20140" y="178685" z="-4075" heading="5151" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20140" y="178685" z="-4075" heading="5151" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20395" y="178885" z="-4067" heading="32500" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-20393" y="179004" z="-4067" heading="28544" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-20744" y="179239" z="-4054" heading="28544" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-22988" y="179086" z="-4089" heading="12530" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-22988" y="179086" z="-4089" heading="19100" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-22895" y="179597" z="-4063" heading="10290" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-22902" y="180004" z="-4043" heading="19834" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-22958" y="180166" z="-4035" heading="19834" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-22684" y="181877" z="-3967" heading="58754" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-22684" y="181877" z="-3967" heading="58754" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-22283" y="181585" z="-3967" heading="58978" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-21964" y="181435" z="-3968" heading="64811" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-21494" y="181338" z="-3960" heading="62755" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-16874" y="180551" z="-4034" heading="54927" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-16874" y="180551" z="-4034" heading="54927" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16934" y="180286" z="-4073" heading="56722" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16658" y="179975" z="-4168" heading="214" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-16485" y="179871" z="-4186" heading="51665" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-13957" y="184206" z="-4174" heading="26181" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-13957" y="184206" z="-4174" heading="26181" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-14413" y="184267" z="-4174" heading="24597" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-14668" y="184574" z="-4175" heading="16383" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-14794" y="184702" z="-4172" heading="32172" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-15768" y="185896" z="-4150" heading="51691" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-15768" y="185896" z="-4150" heading="51691" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-16013" y="185692" z="-4125" heading="30810" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-16028" y="185671" z="-4125" heading="58555" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-15778" y="185455" z="-4143" heading="58555" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="22413" x="-20436" y="179495" z="-4057" heading="61611" respawnTime="60sec" /> <!-- Demonic Reaper -->
<npc id="22415" x="-20436" y="179495" z="-4057" heading="60005" respawnTime="60sec" /> <!-- Demonic Knight -->
<npc id="22414" x="-20064" y="179171" z="-4063" heading="61140" respawnTime="60sec" /> <!-- Demon Warrior -->
<npc id="22417" x="-19666" y="178992" z="-4084" heading="58772" respawnTime="60sec" /> <!-- Rattling Skeleton -->
<npc id="22416" x="-19263" y="178705" z="-4111" heading="59331" respawnTime="60sec" /> <!-- Earth Scorpion -->
<npc id="34328" x="-21362" y="178620" z="-4078" heading="28318" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21367" y="178955" z="-4078" heading="36467" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21593" y="179213" z="-4078" heading="45432" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21940" y="179200" z="-4077" heading="52273" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-22189" y="178959" z="-4078" heading="61861" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21591" y="178357" z="-4077" heading="18973" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21797" y="182345" z="-3969" heading="5372" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21550" y="182111" z="-3969" heading="12415" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21207" y="182094" z="-3969" heading="20607" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-20960" y="182340" z="-3969" heading="27931" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-20966" y="182691" z="-3969" heading="37674" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-21213" y="182942" z="-3969" heading="45831" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-16939" y="184927" z="-3991" heading="35881" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-16941" y="184573" z="-3991" heading="28756" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-17192" y="184319" z="-3991" heading="20469" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-17538" y="184335" z="-3991" heading="12760" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-17806" y="184565" z="-3991" heading="4391" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-17785" y="184920" z="-3992" heading="61275" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-13755" y="181484" z="-4347" heading="20352" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14109" y="181477" z="-4347" heading="10378" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14318" y="181750" z="-4348" heading="4191" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14362" y="182088" z="-4347" heading="61009" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14108" y="182327" z="-4347" heading="52752" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-13762" y="182327" z="-4348" heading="45968" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-14787" y="178728" z="-4277" heading="36405" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15030" y="178978" z="-4277" heading="45337" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15386" y="178985" z="-4277" heading="53147" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15621" y="178722" z="-4277" heading="61426" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15620" y="178381" z="-4277" heading="4384" respawnTime="60sec" /> <!-- Demon Priest -->
<npc id="34328" x="-15374" y="178143" z="-4278" heading="11505" respawnTime="60sec" /> <!-- Demon Priest -->
</group>
</spawn>
</list>

View File

@@ -8222,4 +8222,11 @@
<node X="11773" Y="183287" />
<node X="11994" Y="183055" />
</zone>
<!-- Battle with Balok -->
<zone name="balok_area" type="ConditionZone" shape="Cuboid" minZ="-2000" maxZ="-4600">
<stat name="NoBookmark" val="true" />
<node X="-9095" Y="191592" />
<node X="-26826" Y="176629" />
</zone>
</list>

View File

@@ -986,6 +986,11 @@ public class Config
public static int ZAKEN_SPAWN_INTERVAL;
public static int ZAKEN_SPAWN_RANDOM;
// Balok
public static int BALOK_HOUR;
public static int BALOK_MINUTE;
public static int BALOK_POINTS_PER_MONSTER;
// Gracia Seeds Settings
public static int SOD_TIAT_KILL_COUNT;
public static long SOD_STAGE_2_LENGTH;
@@ -2681,6 +2686,10 @@ public class Config
QUEEN_ANT_SPAWN_RANDOM = grandBossConfig.getInt("RandomOfQueenAntSpawn", 17);
ZAKEN_SPAWN_INTERVAL = grandBossConfig.getInt("IntervalOfZakenSpawn", 168);
ZAKEN_SPAWN_RANDOM = grandBossConfig.getInt("RandomOfZakenSpawn", 48);
final String[] balokTime = grandBossConfig.getString("BalokTime", "20:30").trim().split(":");
BALOK_HOUR = Integer.parseInt(balokTime[0]);
BALOK_MINUTE = Integer.parseInt(balokTime[1]);
BALOK_POINTS_PER_MONSTER = grandBossConfig.getInt("BalokPointsPerMonster", 10);
// Load HuntPass (if exists)
final PropertiesParser huntPassConfig = new PropertiesParser(HUNT_PASS_CONFIG_FILE);

View File

@@ -30,5 +30,6 @@ public enum MailType
MENTOR_NPC,
PRIME_SHOP_GIFT,
PURGE_REWARD,
BALOK_RANKING_REWARD,
PLEDGE_DONATION_CRITICAL_SUCCESS
}

View File

@@ -0,0 +1,133 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.instancemanager;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Player;
/**
* @author Serenitty, Index
*/
public class BattleWithBalokManager
{
private final Map<Integer, Integer> _playerPoints = new ConcurrentHashMap<>();
private boolean _inBattle = false;
private int _reward = 0;
private int _globalPoints = 0;
private int _globalStage = 0;
private int _globalStatus = 0;
public BattleWithBalokManager()
{
}
public void addPointsForPlayer(Player player, boolean isScorpion)
{
final int pointsToAdd = isScorpion ? Config.BALOK_POINTS_PER_MONSTER * 10 : Config.BALOK_POINTS_PER_MONSTER;
final int currentPoints = _playerPoints.computeIfAbsent(player.getObjectId(), pts -> 0);
int sum = pointsToAdd + currentPoints;
_playerPoints.put(player.getObjectId(), sum);
}
public Map<Integer, Integer> getTopPlayers(int count)
{
return _playerPoints.entrySet().stream().sorted(Entry.comparingByValue(Comparator.reverseOrder())).limit(count).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
}
public int getPlayerRank(Player player)
{
if (!_playerPoints.containsKey(player.getObjectId()))
{
return 0;
}
final Map<Integer, Integer> sorted = _playerPoints.entrySet().stream().sorted(Entry.comparingByValue(Comparator.reverseOrder())).collect(Collectors.toMap(Entry::getKey, Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new));
return sorted.keySet().stream().toList().indexOf(player.getObjectId()) + 1;
}
public int getMonsterPoints(Player player)
{
return _playerPoints.computeIfAbsent(player.getObjectId(), pts -> 0);
}
public int getReward()
{
return _reward;
}
public void setReward(int value)
{
_reward = value;
}
public boolean getInBattle()
{
return _inBattle;
}
public void setInBattle(boolean value)
{
_inBattle = value;
}
public int getGlobalPoints()
{
return _globalPoints;
}
public void setGlobalPoints(int value)
{
_globalPoints = value;
}
public int getGlobalStage()
{
return _globalStage;
}
public void setGlobalStage(int value)
{
_globalStage = value;
}
public int getGlobalStatus()
{
return _globalStatus;
}
public void setGlobalStatus(int value)
{
_globalStatus = value;
}
public static BattleWithBalokManager getInstance()
{
return SingletonHolder.INSTANCE;
}
private static class SingletonHolder
{
protected static final BattleWithBalokManager INSTANCE = new BattleWithBalokManager();
}
}

View File

@@ -47,6 +47,7 @@ public class GlobalVariablesManager extends AbstractVariables
public static final String RANKING_POWER_COOLDOWN = "RANKING_POWER_COOLDOWN";
public static final String RANKING_POWER_LOCATION = "RANKING_POWER_LOCATION";
public static final String PURGE_REWARD_TIME = "PURGE_REWARD_TIME";
public static final String BALOK_REMAIN_TIME = "BALOK_REMAIN_TIME";
protected GlobalVariablesManager()
{

View File

@@ -92,6 +92,7 @@ public class PlayerVariables extends AbstractVariables
public static final String DYE_POTENTIAL_DAILY_STEP = "DYE_POTENTIAL_DAILY_STEP";
public static final String DYE_POTENTIAL_DAILY_COUNT = "DYE_POTENTIAL_DAILY_COUNT";
public static final String MISSION_LEVEL_PROGRESS = "MISSION_LEVEL_PROGRESS_";
public static final String BALOK_AVAILABLE_REWARD = "BALOK_AVAILABLE_REWARD";
private final int _objectId;

View File

@@ -40,6 +40,10 @@ import org.l2jmobius.gameserver.network.clientpackets.autopeel.ExRequestReadyIte
import org.l2jmobius.gameserver.network.clientpackets.autopeel.ExRequestStopItemAutoPeel;
import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExAutoPlaySetting;
import org.l2jmobius.gameserver.network.clientpackets.autoplay.ExRequestActivateAutoShortcut;
import org.l2jmobius.gameserver.network.clientpackets.balok.ExBalrogWarGetReward;
import org.l2jmobius.gameserver.network.clientpackets.balok.ExBalrogWarShowRanking;
import org.l2jmobius.gameserver.network.clientpackets.balok.ExBalrogWarShowUI;
import org.l2jmobius.gameserver.network.clientpackets.balok.ExBalrogWarTeleport;
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionCancel;
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionEnchant;
import org.l2jmobius.gameserver.network.clientpackets.blessing.RequestBlessOptionPutItem;
@@ -800,10 +804,10 @@ public enum ExClientPackets
EX_WORLDCASTLEWAR_CASTLE_SIEGE_ALL_RANKING_INFO(0x236, null, ConnectionState.IN_GAME),
EX_MISSION_LEVEL_REWARD_LIST(0x237, RequestMissionRewardList::new, ConnectionState.IN_GAME),
EX_MISSION_LEVEL_RECEIVE_REWARD(0x238, RequestMissionLevelReceiveReward::new, ConnectionState.IN_GAME),
EX_BALROGWAR_TELEPORT(0x239, null, ConnectionState.IN_GAME),
EX_BALROGWAR_SHOW_UI(0x23A, null, ConnectionState.IN_GAME),
EX_BALROGWAR_SHOW_RANKING(0x23B, null, ConnectionState.IN_GAME),
EX_BALROGWAR_GET_REWARD(0x23C, null, ConnectionState.IN_GAME),
EX_BALROGWAR_TELEPORT(0x239, ExBalrogWarTeleport::new, ConnectionState.IN_GAME),
EX_BALROGWAR_SHOW_UI(0x23A, ExBalrogWarShowUI::new, ConnectionState.IN_GAME),
EX_BALROGWAR_SHOW_RANKING(0x23B, ExBalrogWarShowRanking::new, ConnectionState.IN_GAME),
EX_BALROGWAR_GET_REWARD(0x23C, ExBalrogWarGetReward::new, ConnectionState.IN_GAME),
EX_USER_RESTART_LOCKER_UPDATE(0x23D, null, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_ITEM_LIST(0x23E, ExWorldExchangeItemList::new, ConnectionState.IN_GAME),
EX_WORLD_EXCHANGE_REGI_ITEM(0x23F, ExWorldExchangeRegisterItem::new, ConnectionState.IN_GAME),

View File

@@ -0,0 +1,58 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.balok;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarGetReward;
/**
* @author Serenitty
*/
public class ExBalrogWarGetReward implements ClientPacket
{
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
final int availableReward = player.getVariables().getInt(PlayerVariables.BALOK_AVAILABLE_REWARD, 0);
if (availableReward != 1)
{
return;
}
int count = 1;
final int globalStage = BattleWithBalokManager.getInstance().getGlobalStage();
if (globalStage < 4)
{
count = 30; // sayha potion sealed
}
final int reward = BattleWithBalokManager.getInstance().getReward();
player.addItem("Battle with Balok", reward, count, player, true);
player.getVariables().set(PlayerVariables.BALOK_AVAILABLE_REWARD, -1);
player.sendPacket(new BalrogWarGetReward(true));
}
}

View File

@@ -0,0 +1,46 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.balok;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarShowRanking;
/**
* @author Serenitty
*/
public class ExBalrogWarShowRanking implements ClientPacket
{
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
if (!BattleWithBalokManager.getInstance().getInBattle())
{
return;
}
player.sendPacket(new BalrogWarShowRanking());
}
}

View File

@@ -0,0 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.balok;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
import org.l2jmobius.gameserver.network.serverpackets.balok.BalrogWarShowUI;
/**
* @author Serenitty
*/
public class ExBalrogWarShowUI implements ClientPacket
{
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
player.sendPacket(new BalrogWarShowUI(player));
}
}

View File

@@ -0,0 +1,88 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.clientpackets.balok;
import org.l2jmobius.gameserver.model.Location;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.EffectFlag;
import org.l2jmobius.gameserver.model.skill.CommonSkill;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.GameClient;
import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.network.clientpackets.ClientPacket;
/**
* @author Serenitty
*/
public class ExBalrogWarTeleport implements ClientPacket
{
private static final Location BALOK_LOCATION = new Location(-18414, 180442, -3862);
private static final int TELEPORT_COST = 50000;
@Override
public void run(GameClient client)
{
final Player player = client.getPlayer();
if (player == null)
{
return;
}
// Dead characters cannot use teleports.
if (player.isDead())
{
player.sendPacket(SystemMessageId.DEAD_CHARACTERS_CANNOT_USE_TELEPORTS);
return;
}
// Players should not be able to teleport if in a special location.
if ((player.getMovieHolder() != null) || player.isFishing() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
return;
}
// Cannot teleport in combat.
if ((player.isInCombat() || player.isCastingNow()))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_WHILE_IN_COMBAT);
return;
}
// Cannot escape effect.
if (player.isAffected(EffectFlag.CANNOT_ESCAPE))
{
player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW);
return;
}
// Take teleport fee.
if (!player.destroyItemByItemId("Battle with Balok Teleport", 57, TELEPORT_COST, player, true))
{
player.sendPacket(SystemMessageId.NOT_ENOUGH_MONEY_TO_USE_THE_FUNCTION);
return;
}
// Stop moving.
player.abortCast();
player.stopMove(null);
// Teleport to Balok location.
player.setTeleportLocation(BALOK_LOCATION);
player.doCast(CommonSkill.TELEPORT.getSkill());
}
}

View File

@@ -0,0 +1,93 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Serenitty, NasSeKa
*/
public class BalrogWarBossInfo extends ServerPacket
{
private final int _bossState1;
private final int _bossState2;
private final int _bossState3;
private final int _bossState4;
private final int _bossState5;
private final int _finalBossId;
private final int _finalState;
public BalrogWarBossInfo(int balokid, int balokstatus, int boss1, int boss2, int boss3, int boss4, int boss5)
{
_finalBossId = balokid + 1000000;
_finalState = balokstatus;
_bossState1 = boss1;
_bossState2 = boss2;
_bossState3 = boss3;
_bossState4 = boss4;
_bossState5 = boss5;
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_BOSSINFO.writeId(this);
final long globalpoints = BattleWithBalokManager.getInstance().getGlobalPoints();
final int globalstage = BattleWithBalokManager.getInstance().getGlobalStage();
if ((globalpoints < 320000) && (globalstage <= 2))
{
writeInt(1);
writeInt(1);
writeInt(1);
writeInt(1);
writeInt(1);
writeInt(0);
writeInt(0);
writeInt(0);
writeInt(0);
writeInt(0);
}
else
{
final int bossId1 = 25956 + 1000000;
final int bossId2 = 25957 + 1000000;
final int bossId3 = 25958 + 1000000;
int bossId4 = 0;
int bossId5 = 0;
if ((globalpoints >= 800000) && (globalstage >= 3))
{
bossId4 = 25959 + 1000000;
bossId5 = 25960 + 1000000;
}
writeInt(bossId1);
writeInt(bossId2);
writeInt(bossId3);
writeInt(bossId4);
writeInt(bossId5);
writeInt(_bossState1);
writeInt(_bossState2);
writeInt(_bossState3);
writeInt(_bossState4);
writeInt(_bossState5);
writeInt(_finalBossId);
writeInt(_finalState);
}
}
}

View File

@@ -0,0 +1,40 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Serenitty
*/
public class BalrogWarGetReward extends ServerPacket
{
private final boolean _available;
public BalrogWarGetReward(boolean available)
{
_available = available;
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_GET_REWARD.writeId(this);
writeByte(_available);
}
}

View File

@@ -0,0 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import java.util.concurrent.TimeUnit;
import org.l2jmobius.gameserver.instancemanager.GlobalVariablesManager;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Mobius, Serenitty
*/
public class BalrogWarHud extends ServerPacket
{
private final int _state;
private final int _stage;
public BalrogWarHud(int state, int stage)
{
_state = state;
_stage = stage;
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_HUD.writeId(this);
final long remainTime = GlobalVariablesManager.getInstance().getLong(GlobalVariablesManager.BALOK_REMAIN_TIME, 0);
final long currentTime = System.currentTimeMillis();
writeInt(_state); // State
writeInt(_stage); // Progress Step
writeInt((int) TimeUnit.MILLISECONDS.toSeconds(remainTime - currentTime)); // Time (in seconds)
}
}

View File

@@ -0,0 +1,53 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import java.util.Map;
import java.util.Map.Entry;
import org.l2jmobius.gameserver.data.sql.CharNameTable;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Serenitty, Index
*/
public class BalrogWarShowRanking extends ServerPacket
{
private final Map<Integer, Integer> _rankingData;
public BalrogWarShowRanking()
{
_rankingData = BattleWithBalokManager.getInstance().getTopPlayers(150);
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_SHOW_RANKING.writeId(this);
writeInt(_rankingData.size());
int rank = 0;
for (Entry<Integer, Integer> entry : _rankingData.entrySet())
{
rank++;
writeInt(rank); // Rank
writeSizedString(CharNameTable.getInstance().getNameById(entry.getKey())); // Name
writeInt(entry.getValue()); // Score
}
}
}

View File

@@ -0,0 +1,49 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.network.serverpackets.balok;
import org.l2jmobius.gameserver.instancemanager.BattleWithBalokManager;
import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.variables.PlayerVariables;
import org.l2jmobius.gameserver.network.ServerPackets;
import org.l2jmobius.gameserver.network.serverpackets.ServerPacket;
/**
* @author Serenitty
*/
public class BalrogWarShowUI extends ServerPacket
{
private final Player _player;
public BalrogWarShowUI(Player player)
{
_player = player;
}
@Override
public void write()
{
ServerPackets.EX_BALROGWAR_SHOW_UI.writeId(this);
final int personalPoints = BattleWithBalokManager.getInstance().getMonsterPoints(_player);
writeInt(personalPoints < 1 ? 0 : BattleWithBalokManager.getInstance().getPlayerRank(_player)); // personal rank
writeInt(personalPoints); // personal points
writeLong(BattleWithBalokManager.getInstance().getGlobalPoints()); // total points of players
writeInt(_player.getVariables().getInt(PlayerVariables.BALOK_AVAILABLE_REWARD, 0)); // reward activated or not
writeInt(BattleWithBalokManager.getInstance().getReward()); // RewardItemID
writeLong(1); // unknown
}
}