Corrected and simplified NPC spawning methods.
This commit is contained in:
@@ -916,12 +916,10 @@ public class Antharas extends Quest
|
|||||||
@Override
|
@Override
|
||||||
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
public String onAttack(NpcInstance npc, PlayerInstance attacker, int damage, boolean isPet)
|
||||||
{
|
{
|
||||||
if (((npc.getSpawn() != null) && !npc.getSpawn().isCustomBossInstance() && (npc.getNpcId() == 29019)) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
|
if ((npc.getNpcId() == 29019) || (npc.getNpcId() == 29066) || (npc.getNpcId() == 29067) || (npc.getNpcId() == 29068))
|
||||||
{
|
{
|
||||||
_LastAction = System.currentTimeMillis();
|
_LastAction = System.currentTimeMillis();
|
||||||
/*
|
if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null))
|
||||||
* if (GrandBossManager.getInstance().getBossStatus(_antharas.getNpcId()) != FIGHTING) { _Zone.oustAllPlayers(); } else
|
|
||||||
*/if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null))
|
|
||||||
{
|
{
|
||||||
startMinionSpawns(npc.getNpcId());
|
startMinionSpawns(npc.getNpcId());
|
||||||
}
|
}
|
||||||
@@ -960,17 +958,14 @@ public class Antharas extends Quest
|
|||||||
{
|
{
|
||||||
npc.broadcastPacket(new PlaySound(1, "BS01_D", npc));
|
npc.broadcastPacket(new PlaySound(1, "BS01_D", npc));
|
||||||
|
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
_cubeSpawnTask = ThreadPool.schedule(new CubeSpawn(0), 10000);
|
||||||
{
|
GrandBossManager.getInstance().setBossStatus(npc.getNpcId(), DEAD);
|
||||||
_cubeSpawnTask = ThreadPool.schedule(new CubeSpawn(0), 10000);
|
final long respawnTime = (Config.ANTHARAS_RESP_FIRST + Rnd.get(Config.ANTHARAS_RESP_SECOND)) * 3600000;
|
||||||
GrandBossManager.getInstance().setBossStatus(npc.getNpcId(), DEAD);
|
ThreadPool.schedule(new UnlockAntharas(npc.getNpcId()), respawnTime);
|
||||||
final long respawnTime = (Config.ANTHARAS_RESP_FIRST + Rnd.get(Config.ANTHARAS_RESP_SECOND)) * 3600000;
|
// also save the respawn time so that the info is maintained past reboots
|
||||||
ThreadPool.schedule(new UnlockAntharas(npc.getNpcId()), respawnTime);
|
final StatSet info = GrandBossManager.getInstance().getStatSet(npc.getNpcId());
|
||||||
// also save the respawn time so that the info is maintained past reboots
|
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||||
final StatSet info = GrandBossManager.getInstance().getStatSet(npc.getNpcId());
|
GrandBossManager.getInstance().setStatSet(npc.getNpcId(), info);
|
||||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
|
||||||
GrandBossManager.getInstance().setStatSet(npc.getNpcId(), info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (npc.getNpcId() == 29069)
|
else if (npc.getNpcId() == 29069)
|
||||||
{
|
{
|
||||||
|
@@ -206,10 +206,7 @@ public class Baium extends Quest
|
|||||||
// start monitoring baium's inactivity
|
// start monitoring baium's inactivity
|
||||||
_lastAttackVsBaiumTime = System.currentTimeMillis();
|
_lastAttackVsBaiumTime = System.currentTimeMillis();
|
||||||
|
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
startQuestTimer("baium_despawn", 60000, npc, null, true);
|
||||||
{
|
|
||||||
startQuestTimer("baium_despawn", 60000, npc, null, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player != null)
|
if (player != null)
|
||||||
{
|
{
|
||||||
@@ -420,20 +417,17 @@ public class Baium extends Quest
|
|||||||
{
|
{
|
||||||
npc.broadcastPacket(new PlaySound(1, "BS01_D", npc));
|
npc.broadcastPacket(new PlaySound(1, "BS01_D", npc));
|
||||||
|
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
cancelQuestTimer("baium_despawn", npc, null);
|
||||||
{
|
// spawn the "Teleportation Cubic" for 15 minutes (to allow players to exit the lair)
|
||||||
cancelQuestTimer("baium_despawn", npc, null);
|
addSpawn(29055, 115203, 16620, 10078, 0, false, 900000); // //should we teleport everyone out if the cubic despawns??
|
||||||
// spawn the "Teleportation Cubic" for 15 minutes (to allow players to exit the lair)
|
// "lock" baium for 5 days and 1 to 8 hours [i.e. 432,000,000 + 1*3,600,000 + random-less-than(8*3,600,000) millisecs]
|
||||||
addSpawn(29055, 115203, 16620, 10078, 0, false, 900000); // //should we teleport everyone out if the cubic despawns??
|
final long respawnTime = (Config.BAIUM_RESP_FIRST + Rnd.get(Config.BAIUM_RESP_SECOND)) * 3600000;
|
||||||
// "lock" baium for 5 days and 1 to 8 hours [i.e. 432,000,000 + 1*3,600,000 + random-less-than(8*3,600,000) millisecs]
|
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, DEAD);
|
||||||
final long respawnTime = (Config.BAIUM_RESP_FIRST + Rnd.get(Config.BAIUM_RESP_SECOND)) * 3600000;
|
startQuestTimer("baium_unlock", respawnTime, null, null);
|
||||||
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, DEAD);
|
// also save the respawn time so that the info is maintained past reboots
|
||||||
startQuestTimer("baium_unlock", respawnTime, null, null);
|
final StatSet info = GrandBossManager.getInstance().getStatSet(LIVE_BAIUM);
|
||||||
// also save the respawn time so that the info is maintained past reboots
|
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||||
final StatSet info = GrandBossManager.getInstance().getStatSet(LIVE_BAIUM);
|
GrandBossManager.getInstance().setStatSet(LIVE_BAIUM, info);
|
||||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
|
||||||
GrandBossManager.getInstance().setStatSet(LIVE_BAIUM, info);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (NpcInstance minion : _minions)
|
for (NpcInstance minion : _minions)
|
||||||
{
|
{
|
||||||
|
@@ -230,21 +230,18 @@ public class Core extends Quest
|
|||||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, name, "......"));
|
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, name, "......"));
|
||||||
_firstAttacked = false;
|
_firstAttacked = false;
|
||||||
|
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
addSpawn(31842, 16502, 110165, -6394, 0, false, 900000);
|
||||||
{
|
addSpawn(31842, 18948, 110166, -6397, 0, false, 900000);
|
||||||
addSpawn(31842, 16502, 110165, -6394, 0, false, 900000);
|
GrandBossManager.getInstance().setBossStatus(CORE, DEAD);
|
||||||
addSpawn(31842, 18948, 110166, -6397, 0, false, 900000);
|
// Calculate Min and Max respawn times randomly.
|
||||||
GrandBossManager.getInstance().setBossStatus(CORE, DEAD);
|
final long respawnTime = (Config.CORE_RESP_FIRST + Rnd.get(Config.CORE_RESP_SECOND)) * 3600000;
|
||||||
// Calculate Min and Max respawn times randomly.
|
startQuestTimer("core_unlock", respawnTime, null, null);
|
||||||
final long respawnTime = (Config.CORE_RESP_FIRST + Rnd.get(Config.CORE_RESP_SECOND)) * 3600000;
|
// Also save the respawn time so that the info is maintained past reboots.
|
||||||
startQuestTimer("core_unlock", respawnTime, null, null);
|
final StatSet info = GrandBossManager.getInstance().getStatSet(CORE);
|
||||||
// Also save the respawn time so that the info is maintained past reboots.
|
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||||
final StatSet info = GrandBossManager.getInstance().getStatSet(CORE);
|
GrandBossManager.getInstance().setStatSet(CORE, info);
|
||||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
startQuestTimer("despawn_minions", 20000, null, null);
|
||||||
GrandBossManager.getInstance().setStatSet(CORE, info);
|
cancelQuestTimers("spawn_minion");
|
||||||
startQuestTimer("despawn_minions", 20000, null, null);
|
|
||||||
cancelQuestTimers("spawn_minion");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if ((GrandBossManager.getInstance().getBossStatus(CORE) == ALIVE) && _minions.contains(npc))
|
else if ((GrandBossManager.getInstance().getBossStatus(CORE) == ALIVE) && _minions.contains(npc))
|
||||||
{
|
{
|
||||||
|
@@ -1726,25 +1726,22 @@ public class Frintezza extends Quest
|
|||||||
}
|
}
|
||||||
else if ((npc.getNpcId() == SCARLET2) && (_onCheck == 1) && (status == FIGHTING))
|
else if ((npc.getNpcId() == SCARLET2) && (_onCheck == 1) && (status == FIGHTING))
|
||||||
{
|
{
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
// cancelQuestTimer("loc_check");
|
||||||
{
|
cancelQuestTimer("spawn_minion", npc, null);
|
||||||
// cancelQuestTimer("loc_check");
|
cancelQuestTimer("frintezza_despawn", null, null);
|
||||||
cancelQuestTimer("spawn_minion", npc, null);
|
startQuestTimer("clean", 30000, npc, null);
|
||||||
cancelQuestTimer("frintezza_despawn", null, null);
|
startQuestTimer("close", 30000, npc, null);
|
||||||
startQuestTimer("clean", 30000, npc, null);
|
startQuestTimer("room3_del", 60000, npc, null);
|
||||||
startQuestTimer("close", 30000, npc, null);
|
startQuestTimer("minions_despawn", 60000, npc, null);
|
||||||
startQuestTimer("room3_del", 60000, npc, null);
|
startQuestTimer("remove_players", 900000, npc, null);
|
||||||
startQuestTimer("minions_despawn", 60000, npc, null);
|
|
||||||
startQuestTimer("remove_players", 900000, npc, null);
|
|
||||||
|
|
||||||
GrandBossManager.getInstance().setBossStatus(FRINTEZZA, DEAD);
|
GrandBossManager.getInstance().setBossStatus(FRINTEZZA, DEAD);
|
||||||
final long respawnTime = (Config.FRINTEZZA_RESP_FIRST + Rnd.get(Config.FRINTEZZA_RESP_SECOND)) * 3600000;
|
final long respawnTime = (Config.FRINTEZZA_RESP_FIRST + Rnd.get(Config.FRINTEZZA_RESP_SECOND)) * 3600000;
|
||||||
startQuestTimer("frintezza_unlock", respawnTime, npc, null);
|
startQuestTimer("frintezza_unlock", respawnTime, npc, null);
|
||||||
// also save the respawn time so that the info is maintained past reboots
|
// also save the respawn time so that the info is maintained past reboots
|
||||||
final StatSet info = GrandBossManager.getInstance().getStatSet(FRINTEZZA);
|
final StatSet info = GrandBossManager.getInstance().getStatSet(FRINTEZZA);
|
||||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||||
GrandBossManager.getInstance().setStatSet(FRINTEZZA, info);
|
GrandBossManager.getInstance().setStatSet(FRINTEZZA, info);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (npc.getNpcId() == 18328)
|
else if (npc.getNpcId() == 18328)
|
||||||
{
|
{
|
||||||
|
@@ -150,7 +150,7 @@ public class Orfen extends Quest
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
double hp = -1;
|
double hp = -1;
|
||||||
if ((npc.getNpcId() == ORFEN) && !npc.getSpawn().isCustomBossInstance())
|
if (npc.getNpcId() == ORFEN)
|
||||||
{
|
{
|
||||||
hp = GrandBossManager.getInstance().getStatSet(ORFEN).getDouble("currentHP");
|
hp = GrandBossManager.getInstance().getStatSet(ORFEN).getDouble("currentHP");
|
||||||
if (hp < npc.getCurrentHp())
|
if (hp < npc.getCurrentHp())
|
||||||
@@ -237,18 +237,15 @@ public class Orfen extends Quest
|
|||||||
{
|
{
|
||||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||||
|
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
GrandBossManager.getInstance().setBossStatus(ORFEN, DEAD);
|
||||||
{
|
// time is 48hour +/- 20hour
|
||||||
GrandBossManager.getInstance().setBossStatus(ORFEN, DEAD);
|
final long respawnTime = (Config.ORFEN_RESP_FIRST + Rnd.get(Config.ORFEN_RESP_SECOND)) * 3600000;
|
||||||
// time is 48hour +/- 20hour
|
cancelQuestTimer("ORFEN_REFRESH", npc, null);
|
||||||
final long respawnTime = (Config.ORFEN_RESP_FIRST + Rnd.get(Config.ORFEN_RESP_SECOND)) * 3600000;
|
startQuestTimer("ORFEN_SPAWN", respawnTime, null, null);
|
||||||
cancelQuestTimer("ORFEN_REFRESH", npc, null);
|
// also save the respawn time so that the info is maintained past reboots
|
||||||
startQuestTimer("ORFEN_SPAWN", respawnTime, null, null);
|
final StatSet info = GrandBossManager.getInstance().getStatSet(ORFEN);
|
||||||
// also save the respawn time so that the info is maintained past reboots
|
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ORFEN);
|
GrandBossManager.getInstance().setStatSet(ORFEN, info);
|
||||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
|
||||||
GrandBossManager.getInstance().setStatSet(ORFEN, info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.onKill(npc, killer, isPet);
|
return super.onKill(npc, killer, isPet);
|
||||||
|
@@ -368,24 +368,21 @@ public class QueenAnt extends Quest
|
|||||||
{
|
{
|
||||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||||
|
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
GrandBossManager.getInstance().setBossStatus(QUEEN, DEAD);
|
||||||
{
|
// time is 36hour +/- 17hour
|
||||||
GrandBossManager.getInstance().setBossStatus(QUEEN, DEAD);
|
final long respawnTime = (Config.QA_RESP_FIRST + Rnd.get(Config.QA_RESP_SECOND)) * 3600000;
|
||||||
// time is 36hour +/- 17hour
|
startQuestTimer("QUEEN_SPAWN", respawnTime, null, null);
|
||||||
final long respawnTime = (Config.QA_RESP_FIRST + Rnd.get(Config.QA_RESP_SECOND)) * 3600000;
|
startQuestTimer("LARVA_DESPAWN", 4 * 60 * 60 * 1000, null, null);
|
||||||
startQuestTimer("QUEEN_SPAWN", respawnTime, null, null);
|
cancelQuestTimer("ACTION", npc, null);
|
||||||
startQuestTimer("LARVA_DESPAWN", 4 * 60 * 60 * 1000, null, null);
|
cancelQuestTimer("SPAWN_ROYAL", npc, null);
|
||||||
cancelQuestTimer("ACTION", npc, null);
|
cancelQuestTimer("CHECK_MINIONS_ZONE", npc, null);
|
||||||
cancelQuestTimer("SPAWN_ROYAL", npc, null);
|
cancelQuestTimer("CHECK_NURSE_ALIVE", npc, null);
|
||||||
cancelQuestTimer("CHECK_MINIONS_ZONE", npc, null);
|
cancelQuestTimer("HEAL", null, null);
|
||||||
cancelQuestTimer("CHECK_NURSE_ALIVE", npc, null);
|
// cancelQuestTimer("CHECK_QA_ZONE", npc, null);
|
||||||
cancelQuestTimer("HEAL", null, null);
|
// also save the respawn time so that the info is maintained past reboots
|
||||||
// cancelQuestTimer("CHECK_QA_ZONE", npc, null);
|
final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
|
||||||
// also save the respawn time so that the info is maintained past reboots
|
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||||
final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
|
GrandBossManager.getInstance().setStatSet(QUEEN, info);
|
||||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
|
||||||
GrandBossManager.getInstance().setStatSet(QUEEN, info);
|
|
||||||
}
|
|
||||||
|
|
||||||
startQuestTimer("DESPAWN_MINIONS", 10000, null, null);
|
startQuestTimer("DESPAWN_MINIONS", 10000, null, null);
|
||||||
}
|
}
|
||||||
|
@@ -178,8 +178,7 @@ public class Valakas extends Quest
|
|||||||
|
|
||||||
temp = (System.currentTimeMillis() - lastAttackTime);
|
temp = (System.currentTimeMillis() - lastAttackTime);
|
||||||
|
|
||||||
if ((status == FIGHTING) && !npc.getSpawn().isCustomBossInstance() // if it's a custom spawn, dnt despawn it for inactivity
|
if ((status == FIGHTING) && (temp > (Config.VALAKAS_DESPAWN_TIME * 60000))) // 15 mins by default
|
||||||
&& (temp > (Config.VALAKAS_DESPAWN_TIME * 60000))) // 15 mins by default
|
|
||||||
{
|
{
|
||||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||||
|
|
||||||
@@ -320,19 +319,15 @@ public class Valakas extends Quest
|
|||||||
else if (event.equals("1117"))
|
else if (event.equals("1117"))
|
||||||
{
|
{
|
||||||
npc.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 10, 0, 3000, 250));
|
npc.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 10, 0, 3000, 250));
|
||||||
|
addSpawn(31759, 212852, -114842, -1632, 0, false, 900000);
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
final int radius = 1500;
|
||||||
|
for (int i = 0; i < 20; i++)
|
||||||
{
|
{
|
||||||
addSpawn(31759, 212852, -114842, -1632, 0, false, 900000);
|
final int x = (int) (radius * Math.cos(i * .331)); // .331~2pi/19
|
||||||
final int radius = 1500;
|
final int y = (int) (radius * Math.sin(i * .331));
|
||||||
for (int i = 0; i < 20; i++)
|
addSpawn(31759, 212852 + x, -114842 + y, -1632, 0, false, 900000);
|
||||||
{
|
|
||||||
final int x = (int) (radius * Math.cos(i * .331)); // .331~2pi/19
|
|
||||||
final int y = (int) (radius * Math.sin(i * .331));
|
|
||||||
addSpawn(31759, 212852 + x, -114842 + y, -1632, 0, false, 900000);
|
|
||||||
}
|
|
||||||
startQuestTimer("remove_players", 900000, null, null);
|
|
||||||
}
|
}
|
||||||
|
startQuestTimer("remove_players", 900000, null, null);
|
||||||
cancelQuestTimer("check_activity_and_do_actions", npc, null);
|
cancelQuestTimer("check_activity_and_do_actions", npc, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -602,18 +597,14 @@ public class Valakas extends Quest
|
|||||||
npc.broadcastPacket(new PlaySound(1, "B03_D", npc));
|
npc.broadcastPacket(new PlaySound(1, "B03_D", npc));
|
||||||
startQuestTimer("1111", 500, npc, null);
|
startQuestTimer("1111", 500, npc, null);
|
||||||
|
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
GrandBossManager.getInstance().setBossStatus(VALAKAS, DEAD);
|
||||||
{
|
|
||||||
GrandBossManager.getInstance().setBossStatus(VALAKAS, DEAD);
|
|
||||||
|
|
||||||
final long respawnTime = (Config.VALAKAS_RESP_FIRST + Rnd.get(Config.VALAKAS_RESP_SECOND)) * 3600000;
|
final long respawnTime = (Config.VALAKAS_RESP_FIRST + Rnd.get(Config.VALAKAS_RESP_SECOND)) * 3600000;
|
||||||
|
startQuestTimer("valakas_unlock", respawnTime, null, null);
|
||||||
startQuestTimer("valakas_unlock", respawnTime, null, null);
|
// also save the respawn time so that the info is maintained past reboots
|
||||||
// also save the respawn time so that the info is maintained past reboots
|
final StatSet info = GrandBossManager.getInstance().getStatSet(VALAKAS);
|
||||||
final StatSet info = GrandBossManager.getInstance().getStatSet(VALAKAS);
|
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
GrandBossManager.getInstance().setStatSet(VALAKAS, info);
|
||||||
GrandBossManager.getInstance().setStatSet(VALAKAS, info);
|
|
||||||
}
|
|
||||||
|
|
||||||
return super.onKill(npc, killer, isPet);
|
return super.onKill(npc, killer, isPet);
|
||||||
}
|
}
|
||||||
@@ -1016,8 +1007,7 @@ public class Valakas extends Quest
|
|||||||
int i1 = 0;
|
int i1 = 0;
|
||||||
|
|
||||||
final Integer status = GrandBossManager.getInstance().getBossStatus(VALAKAS);
|
final Integer status = GrandBossManager.getInstance().getBossStatus(VALAKAS);
|
||||||
|
if (status == FIGHTING)
|
||||||
if ((status == FIGHTING) || npc.getSpawn().isCustomBossInstance())
|
|
||||||
{
|
{
|
||||||
if (npc.getCurrentHp() > ((npc.getMaxHp() * 1) / 4))
|
if (npc.getCurrentHp() > ((npc.getMaxHp() * 1) / 4))
|
||||||
{
|
{
|
||||||
@@ -1524,7 +1514,7 @@ public class Valakas extends Quest
|
|||||||
i_quest4 = ((1 * 1000) + Rnd.get(3000));
|
i_quest4 = ((1 * 1000) + Rnd.get(3000));
|
||||||
c_quest4 = player;
|
c_quest4 = player;
|
||||||
}
|
}
|
||||||
if ((status == FIGHTING) || (npc.getSpawn().isCustomBossInstance() && !npc.isInvul()))
|
if (status == FIGHTING)
|
||||||
{
|
{
|
||||||
getRandomSkill(npc);
|
getRandomSkill(npc);
|
||||||
}
|
}
|
||||||
|
@@ -860,19 +860,16 @@ public class Zaken extends Quest
|
|||||||
{
|
{
|
||||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||||
|
|
||||||
if (!npc.getSpawn().isCustomBossInstance())
|
GrandBossManager.getInstance().setBossStatus(ZAKEN, DEAD);
|
||||||
{
|
// time is 36hour +/- 17hour
|
||||||
GrandBossManager.getInstance().setBossStatus(ZAKEN, DEAD);
|
final long respawnTime = (Config.ZAKEN_RESP_FIRST + Rnd.get(Config.ZAKEN_RESP_SECOND)) * 3600000;
|
||||||
// time is 36hour +/- 17hour
|
startQuestTimer("zaken_unlock", respawnTime, null, null);
|
||||||
final long respawnTime = (Config.ZAKEN_RESP_FIRST + Rnd.get(Config.ZAKEN_RESP_SECOND)) * 3600000;
|
cancelQuestTimer("1001", npc, null);
|
||||||
startQuestTimer("zaken_unlock", respawnTime, null, null);
|
cancelQuestTimer("1003", npc, null);
|
||||||
cancelQuestTimer("1001", npc, null);
|
// also save the respawn time so that the info is maintained past reboots
|
||||||
cancelQuestTimer("1003", npc, null);
|
final StatSet info = GrandBossManager.getInstance().getStatSet(ZAKEN);
|
||||||
// also save the respawn time so that the info is maintained past reboots
|
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ZAKEN);
|
GrandBossManager.getInstance().setStatSet(ZAKEN, info);
|
||||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
|
||||||
GrandBossManager.getInstance().setStatSet(ZAKEN, info);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (status == ALIVE)
|
else if (status == ALIVE)
|
||||||
{
|
{
|
||||||
|
@@ -276,7 +276,7 @@ public class SpawnTable
|
|||||||
{
|
{
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
final PreparedStatement statement = con.prepareStatement("INSERT INTO " + (spawn.isCustom() ? "custom_spawnlist" : "spawnlist") + "(id,count,npc_templateid,locx,locy,locz,heading,respawn_delay,loc_id) values(?,?,?,?,?,?,?,?,?)");
|
final PreparedStatement statement = con.prepareStatement("INSERT INTO " + (Config.SAVE_GMSPAWN_ON_CUSTOM ? "custom_spawnlist" : "spawnlist") + "(id,count,npc_templateid,locx,locy,locz,heading,respawn_delay,loc_id) values(?,?,?,?,?,?,?,?,?)");
|
||||||
statement.setInt(1, spawn.getId());
|
statement.setInt(1, spawn.getId());
|
||||||
statement.setInt(2, spawn.getAmount());
|
statement.setInt(2, spawn.getAmount());
|
||||||
statement.setInt(3, spawn.getNpcId());
|
statement.setInt(3, spawn.getNpcId());
|
||||||
@@ -324,7 +324,7 @@ public class SpawnTable
|
|||||||
{
|
{
|
||||||
try (Connection con = DatabaseFactory.getConnection())
|
try (Connection con = DatabaseFactory.getConnection())
|
||||||
{
|
{
|
||||||
final PreparedStatement statement = con.prepareStatement("DELETE FROM " + (spawn.isCustom() ? "custom_spawnlist" : "spawnlist") + " WHERE id=?");
|
final PreparedStatement statement = con.prepareStatement("DELETE FROM " + (Config.SAVE_GMSPAWN_ON_CUSTOM ? "custom_spawnlist" : "spawnlist") + " WHERE id=?");
|
||||||
statement.setInt(1, spawn.getId());
|
statement.setInt(1, spawn.getId());
|
||||||
statement.execute();
|
statement.execute();
|
||||||
statement.close();
|
statement.close();
|
||||||
|
@@ -43,7 +43,39 @@ public class AdminDelete implements IAdminCommandHandler
|
|||||||
{
|
{
|
||||||
if (command.equals("admin_delete"))
|
if (command.equals("admin_delete"))
|
||||||
{
|
{
|
||||||
handleDelete(activeChar);
|
final WorldObject obj = activeChar.getTarget();
|
||||||
|
if (obj instanceof NpcInstance)
|
||||||
|
{
|
||||||
|
final NpcInstance target = (NpcInstance) obj;
|
||||||
|
target.deleteMe();
|
||||||
|
|
||||||
|
final Spawn spawn = target.getSpawn();
|
||||||
|
if (spawn != null)
|
||||||
|
{
|
||||||
|
if (GrandBossManager.getInstance().isDefined(spawn.getNpcId()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You cannot delete a grandboss.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
spawn.stopRespawn();
|
||||||
|
|
||||||
|
if (RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcId()))
|
||||||
|
{
|
||||||
|
RaidBossSpawnManager.getInstance().deleteSpawn(spawn, true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SpawnTable.getInstance().deleteSpawn(spawn, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "Deleted " + target.getName() + " from " + target.getObjectId() + ".");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -54,43 +86,4 @@ public class AdminDelete implements IAdminCommandHandler
|
|||||||
{
|
{
|
||||||
return ADMIN_COMMANDS;
|
return ADMIN_COMMANDS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: add possibility to delete any WorldObject (except PlayerInstance)
|
|
||||||
private void handleDelete(PlayerInstance activeChar)
|
|
||||||
{
|
|
||||||
final WorldObject obj = activeChar.getTarget();
|
|
||||||
|
|
||||||
if (obj instanceof NpcInstance)
|
|
||||||
{
|
|
||||||
final NpcInstance target = (NpcInstance) obj;
|
|
||||||
target.deleteMe();
|
|
||||||
|
|
||||||
final Spawn spawn = target.getSpawn();
|
|
||||||
if (spawn != null)
|
|
||||||
{
|
|
||||||
spawn.stopRespawn();
|
|
||||||
|
|
||||||
if (RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcId()) && !spawn.isCustomBossInstance())
|
|
||||||
{
|
|
||||||
RaidBossSpawnManager.getInstance().deleteSpawn(spawn, true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
boolean update = true;
|
|
||||||
if (GrandBossManager.getInstance().isDefined(spawn.getNpcId()) && spawn.isCustomBossInstance())
|
|
||||||
{
|
|
||||||
update = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
SpawnTable.getInstance().deleteSpawn(spawn, update);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Deleted " + target.getName() + " from " + target.getObjectId() + ".");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -23,7 +23,6 @@ import java.util.NoSuchElementException;
|
|||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
|
||||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||||
import org.l2jmobius.gameserver.datatables.sql.TeleportLocationTable;
|
import org.l2jmobius.gameserver.datatables.sql.TeleportLocationTable;
|
||||||
@@ -297,10 +296,6 @@ public class AdminSpawn implements IAdminCommandHandler
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
final Spawn spawn = new Spawn(template1);
|
final Spawn spawn = new Spawn(template1);
|
||||||
if (Config.SAVE_GMSPAWN_ON_CUSTOM)
|
|
||||||
{
|
|
||||||
spawn.setCustom(true);
|
|
||||||
}
|
|
||||||
spawn.setX(target.getX());
|
spawn.setX(target.getX());
|
||||||
spawn.setY(target.getY());
|
spawn.setY(target.getY());
|
||||||
spawn.setZ(target.getZ());
|
spawn.setZ(target.getZ());
|
||||||
@@ -310,11 +305,8 @@ public class AdminSpawn implements IAdminCommandHandler
|
|||||||
|
|
||||||
if (RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcId()) || GrandBossManager.getInstance().isDefined(spawn.getNpcId()))
|
if (RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcId()) || GrandBossManager.getInstance().isDefined(spawn.getNpcId()))
|
||||||
{
|
{
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Another instance of " + template1.getName() + " already present into database:");
|
BuilderUtil.sendSysMessage(activeChar, "Another spawn of " + template1.getName() + " is already present in the database.");
|
||||||
BuilderUtil.sendSysMessage(activeChar, "It will be spawned but not saved on Database");
|
return;
|
||||||
BuilderUtil.sendSysMessage(activeChar, "After server restart or raid dead, the spawned npc will desappear");
|
|
||||||
permanent = false;
|
|
||||||
spawn.setCustomBossInstance(true); // for raids, this value is used in order to segnalate to not save respawn time - status for custom instance
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RaidBossSpawnManager.getInstance().getValidTemplate(spawn.getNpcId()) != null)
|
if (RaidBossSpawnManager.getInstance().getValidTemplate(spawn.getNpcId()) != null)
|
||||||
|
@@ -25,6 +25,8 @@ import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
|||||||
import org.l2jmobius.gameserver.datatables.xml.MapRegionData;
|
import org.l2jmobius.gameserver.datatables.xml.MapRegionData;
|
||||||
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
import org.l2jmobius.gameserver.enums.TeleportWhereType;
|
||||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||||
|
import org.l2jmobius.gameserver.instancemanager.GrandBossManager;
|
||||||
|
import org.l2jmobius.gameserver.instancemanager.RaidBossSpawnManager;
|
||||||
import org.l2jmobius.gameserver.model.Location;
|
import org.l2jmobius.gameserver.model.Location;
|
||||||
import org.l2jmobius.gameserver.model.World;
|
import org.l2jmobius.gameserver.model.World;
|
||||||
import org.l2jmobius.gameserver.model.WorldObject;
|
import org.l2jmobius.gameserver.model.WorldObject;
|
||||||
@@ -585,11 +587,8 @@ public class AdminTeleport implements IAdminCommandHandler
|
|||||||
if (obj instanceof NpcInstance)
|
if (obj instanceof NpcInstance)
|
||||||
{
|
{
|
||||||
final NpcInstance target = (NpcInstance) obj;
|
final NpcInstance target = (NpcInstance) obj;
|
||||||
|
|
||||||
final int monsterTemplate = target.getTemplate().getNpcId();
|
final int monsterTemplate = target.getTemplate().getNpcId();
|
||||||
|
|
||||||
final NpcTemplate template1 = NpcTable.getInstance().getTemplate(monsterTemplate);
|
final NpcTemplate template1 = NpcTable.getInstance().getTemplate(monsterTemplate);
|
||||||
|
|
||||||
if (template1 == null)
|
if (template1 == null)
|
||||||
{
|
{
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Incorrect monster template.");
|
BuilderUtil.sendSysMessage(activeChar, "Incorrect monster template.");
|
||||||
@@ -598,7 +597,6 @@ public class AdminTeleport implements IAdminCommandHandler
|
|||||||
}
|
}
|
||||||
|
|
||||||
Spawn spawn = target.getSpawn();
|
Spawn spawn = target.getSpawn();
|
||||||
|
|
||||||
if (spawn == null)
|
if (spawn == null)
|
||||||
{
|
{
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Incorrect monster spawn.");
|
BuilderUtil.sendSysMessage(activeChar, "Incorrect monster spawn.");
|
||||||
@@ -606,14 +604,18 @@ public class AdminTeleport implements IAdminCommandHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RaidBossSpawnManager.getInstance().isDefined(spawn.getNpcId()) || GrandBossManager.getInstance().isDefined(spawn.getNpcId()))
|
||||||
|
{
|
||||||
|
BuilderUtil.sendSysMessage(activeChar, "You cannot recall a boss instance.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final int respawnTime = spawn.getRespawnDelay() / 1000;
|
final int respawnTime = spawn.getRespawnDelay() / 1000;
|
||||||
final boolean custom_boss_spawn = spawn.isCustomBossInstance();
|
|
||||||
|
|
||||||
target.deleteMe();
|
target.deleteMe();
|
||||||
spawn.stopRespawn();
|
spawn.stopRespawn();
|
||||||
|
|
||||||
// check to avoid that recalling a custom raid it will be saved into database
|
SpawnTable.getInstance().deleteSpawn(spawn, true);
|
||||||
SpawnTable.getInstance().deleteSpawn(spawn, !custom_boss_spawn);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -624,7 +626,7 @@ public class AdminTeleport implements IAdminCommandHandler
|
|||||||
spawn.setAmount(1);
|
spawn.setAmount(1);
|
||||||
spawn.setHeading(activeChar.getHeading());
|
spawn.setHeading(activeChar.getHeading());
|
||||||
spawn.setRespawnDelay(respawnTime);
|
spawn.setRespawnDelay(respawnTime);
|
||||||
SpawnTable.getInstance().addNewSpawn(spawn, !custom_boss_spawn);
|
SpawnTable.getInstance().addNewSpawn(spawn, true);
|
||||||
spawn.init();
|
spawn.init();
|
||||||
|
|
||||||
BuilderUtil.sendSysMessage(activeChar, "Created " + template1.getName() + " on " + target.getObjectId() + ".");
|
BuilderUtil.sendSysMessage(activeChar, "Created " + template1.getName() + " on " + target.getObjectId() + ".");
|
||||||
|
@@ -85,10 +85,7 @@ public class GrandBossInstance extends MonsterInstance
|
|||||||
public void onSpawn()
|
public void onSpawn()
|
||||||
{
|
{
|
||||||
super.onSpawn();
|
super.onSpawn();
|
||||||
if (!getSpawn().isCustomBossInstance())
|
GrandBossManager.getInstance().addBoss(this);
|
||||||
{
|
|
||||||
GrandBossManager.getInstance().addBoss(this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@@ -95,10 +95,7 @@ public class RaidBossInstance extends MonsterInstance
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getSpawn().isCustomBossInstance())
|
RaidBossSpawnManager.getInstance().updateStatus(this, true);
|
||||||
{
|
|
||||||
RaidBossSpawnManager.getInstance().updateStatus(this, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@@ -298,45 +298,6 @@ public class Spawn
|
|||||||
_heading = heading;
|
_heading = heading;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Kidzor Set the spawn as custom.
|
|
||||||
* @param custom
|
|
||||||
*/
|
|
||||||
public void setCustom(boolean custom)
|
|
||||||
{
|
|
||||||
_customSpawn = custom;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Kidzor Return type of spawn.
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public boolean isCustom()
|
|
||||||
{
|
|
||||||
return _customSpawn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** If true then spawn is custom */
|
|
||||||
private boolean _customSpawn;
|
|
||||||
|
|
||||||
private boolean _customBossInstance = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return the _customBossInstance
|
|
||||||
*/
|
|
||||||
public boolean isCustomBossInstance()
|
|
||||||
{
|
|
||||||
return _customBossInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param customBossInstance the _customBossInstance to set
|
|
||||||
*/
|
|
||||||
public void setCustomBossInstance(boolean customBossInstance)
|
|
||||||
{
|
|
||||||
_customBossInstance = customBossInstance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrease the current number of NpcInstance of this Spawn and if necessary create a SpawnTask to launch after the respawn Delay.<BR>
|
* Decrease the current number of NpcInstance of this Spawn and if necessary create a SpawnTask to launch after the respawn Delay.<BR>
|
||||||
* <BR>
|
* <BR>
|
||||||
|
Reference in New Issue
Block a user