Corrected and simplified NPC spawning methods.
This commit is contained in:
@@ -916,12 +916,10 @@ public class Antharas extends Quest
|
||||
@Override
|
||||
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();
|
||||
/*
|
||||
* if (GrandBossManager.getInstance().getBossStatus(_antharas.getNpcId()) != FIGHTING) { _Zone.oustAllPlayers(); } else
|
||||
*/if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null))
|
||||
if (!FWA_OLDANTHARAS && (_mobsSpawnTask == null))
|
||||
{
|
||||
startMinionSpawns(npc.getNpcId());
|
||||
}
|
||||
@@ -960,17 +958,14 @@ public class Antharas extends Quest
|
||||
{
|
||||
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);
|
||||
final long respawnTime = (Config.ANTHARAS_RESP_FIRST + Rnd.get(Config.ANTHARAS_RESP_SECOND)) * 3600000;
|
||||
ThreadPool.schedule(new UnlockAntharas(npc.getNpcId()), respawnTime);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(npc.getNpcId());
|
||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||
GrandBossManager.getInstance().setStatSet(npc.getNpcId(), info);
|
||||
}
|
||||
_cubeSpawnTask = ThreadPool.schedule(new CubeSpawn(0), 10000);
|
||||
GrandBossManager.getInstance().setBossStatus(npc.getNpcId(), DEAD);
|
||||
final long respawnTime = (Config.ANTHARAS_RESP_FIRST + Rnd.get(Config.ANTHARAS_RESP_SECOND)) * 3600000;
|
||||
ThreadPool.schedule(new UnlockAntharas(npc.getNpcId()), respawnTime);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(npc.getNpcId());
|
||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||
GrandBossManager.getInstance().setStatSet(npc.getNpcId(), info);
|
||||
}
|
||||
else if (npc.getNpcId() == 29069)
|
||||
{
|
||||
|
@@ -206,10 +206,7 @@ public class Baium extends Quest
|
||||
// start monitoring baium's inactivity
|
||||
_lastAttackVsBaiumTime = System.currentTimeMillis();
|
||||
|
||||
if (!npc.getSpawn().isCustomBossInstance())
|
||||
{
|
||||
startQuestTimer("baium_despawn", 60000, npc, null, true);
|
||||
}
|
||||
startQuestTimer("baium_despawn", 60000, npc, null, true);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
@@ -420,20 +417,17 @@ public class Baium extends Quest
|
||||
{
|
||||
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)
|
||||
addSpawn(29055, 115203, 16620, 10078, 0, false, 900000); // //should we teleport everyone out if the cubic despawns??
|
||||
// "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]
|
||||
final long respawnTime = (Config.BAIUM_RESP_FIRST + Rnd.get(Config.BAIUM_RESP_SECOND)) * 3600000;
|
||||
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, DEAD);
|
||||
startQuestTimer("baium_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(LIVE_BAIUM);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(LIVE_BAIUM, info);
|
||||
}
|
||||
cancelQuestTimer("baium_despawn", npc, null);
|
||||
// spawn the "Teleportation Cubic" for 15 minutes (to allow players to exit the lair)
|
||||
addSpawn(29055, 115203, 16620, 10078, 0, false, 900000); // //should we teleport everyone out if the cubic despawns??
|
||||
// "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]
|
||||
final long respawnTime = (Config.BAIUM_RESP_FIRST + Rnd.get(Config.BAIUM_RESP_SECOND)) * 3600000;
|
||||
GrandBossManager.getInstance().setBossStatus(LIVE_BAIUM, DEAD);
|
||||
startQuestTimer("baium_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(LIVE_BAIUM);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(LIVE_BAIUM, info);
|
||||
|
||||
for (NpcInstance minion : _minions)
|
||||
{
|
||||
|
@@ -230,21 +230,18 @@ public class Core extends Quest
|
||||
npc.broadcastPacket(new CreatureSay(npc.getObjectId(), 0, name, "......"));
|
||||
_firstAttacked = false;
|
||||
|
||||
if (!npc.getSpawn().isCustomBossInstance())
|
||||
{
|
||||
addSpawn(31842, 16502, 110165, -6394, 0, false, 900000);
|
||||
addSpawn(31842, 18948, 110166, -6397, 0, false, 900000);
|
||||
GrandBossManager.getInstance().setBossStatus(CORE, DEAD);
|
||||
// Calculate Min and Max respawn times randomly.
|
||||
final long respawnTime = (Config.CORE_RESP_FIRST + Rnd.get(Config.CORE_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("core_unlock", respawnTime, null, null);
|
||||
// Also save the respawn time so that the info is maintained past reboots.
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(CORE);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(CORE, info);
|
||||
startQuestTimer("despawn_minions", 20000, null, null);
|
||||
cancelQuestTimers("spawn_minion");
|
||||
}
|
||||
addSpawn(31842, 16502, 110165, -6394, 0, false, 900000);
|
||||
addSpawn(31842, 18948, 110166, -6397, 0, false, 900000);
|
||||
GrandBossManager.getInstance().setBossStatus(CORE, DEAD);
|
||||
// Calculate Min and Max respawn times randomly.
|
||||
final long respawnTime = (Config.CORE_RESP_FIRST + Rnd.get(Config.CORE_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("core_unlock", respawnTime, null, null);
|
||||
// Also save the respawn time so that the info is maintained past reboots.
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(CORE);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(CORE, info);
|
||||
startQuestTimer("despawn_minions", 20000, null, null);
|
||||
cancelQuestTimers("spawn_minion");
|
||||
}
|
||||
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))
|
||||
{
|
||||
if (!npc.getSpawn().isCustomBossInstance())
|
||||
{
|
||||
// cancelQuestTimer("loc_check");
|
||||
cancelQuestTimer("spawn_minion", npc, null);
|
||||
cancelQuestTimer("frintezza_despawn", null, null);
|
||||
startQuestTimer("clean", 30000, npc, null);
|
||||
startQuestTimer("close", 30000, npc, null);
|
||||
startQuestTimer("room3_del", 60000, npc, null);
|
||||
startQuestTimer("minions_despawn", 60000, npc, null);
|
||||
startQuestTimer("remove_players", 900000, npc, null);
|
||||
// cancelQuestTimer("loc_check");
|
||||
cancelQuestTimer("spawn_minion", npc, null);
|
||||
cancelQuestTimer("frintezza_despawn", null, null);
|
||||
startQuestTimer("clean", 30000, npc, null);
|
||||
startQuestTimer("close", 30000, npc, null);
|
||||
startQuestTimer("room3_del", 60000, npc, null);
|
||||
startQuestTimer("minions_despawn", 60000, npc, null);
|
||||
startQuestTimer("remove_players", 900000, npc, null);
|
||||
|
||||
GrandBossManager.getInstance().setBossStatus(FRINTEZZA, DEAD);
|
||||
final long respawnTime = (Config.FRINTEZZA_RESP_FIRST + Rnd.get(Config.FRINTEZZA_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("frintezza_unlock", respawnTime, npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(FRINTEZZA);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(FRINTEZZA, info);
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(FRINTEZZA, DEAD);
|
||||
final long respawnTime = (Config.FRINTEZZA_RESP_FIRST + Rnd.get(Config.FRINTEZZA_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("frintezza_unlock", respawnTime, npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(FRINTEZZA);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(FRINTEZZA, info);
|
||||
}
|
||||
else if (npc.getNpcId() == 18328)
|
||||
{
|
||||
|
@@ -150,7 +150,7 @@ public class Orfen extends Quest
|
||||
break;
|
||||
}
|
||||
double hp = -1;
|
||||
if ((npc.getNpcId() == ORFEN) && !npc.getSpawn().isCustomBossInstance())
|
||||
if (npc.getNpcId() == ORFEN)
|
||||
{
|
||||
hp = GrandBossManager.getInstance().getStatSet(ORFEN).getDouble("currentHP");
|
||||
if (hp < npc.getCurrentHp())
|
||||
@@ -237,18 +237,15 @@ public class Orfen extends Quest
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||
|
||||
if (!npc.getSpawn().isCustomBossInstance())
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(ORFEN, DEAD);
|
||||
// time is 48hour +/- 20hour
|
||||
final long respawnTime = (Config.ORFEN_RESP_FIRST + Rnd.get(Config.ORFEN_RESP_SECOND)) * 3600000;
|
||||
cancelQuestTimer("ORFEN_REFRESH", npc, null);
|
||||
startQuestTimer("ORFEN_SPAWN", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ORFEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ORFEN, info);
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(ORFEN, DEAD);
|
||||
// time is 48hour +/- 20hour
|
||||
final long respawnTime = (Config.ORFEN_RESP_FIRST + Rnd.get(Config.ORFEN_RESP_SECOND)) * 3600000;
|
||||
cancelQuestTimer("ORFEN_REFRESH", npc, null);
|
||||
startQuestTimer("ORFEN_SPAWN", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ORFEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ORFEN, info);
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isPet);
|
||||
|
@@ -368,24 +368,21 @@ public class QueenAnt extends Quest
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||
|
||||
if (!npc.getSpawn().isCustomBossInstance())
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(QUEEN, DEAD);
|
||||
// time is 36hour +/- 17hour
|
||||
final long respawnTime = (Config.QA_RESP_FIRST + Rnd.get(Config.QA_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("QUEEN_SPAWN", respawnTime, null, null);
|
||||
startQuestTimer("LARVA_DESPAWN", 4 * 60 * 60 * 1000, null, null);
|
||||
cancelQuestTimer("ACTION", npc, null);
|
||||
cancelQuestTimer("SPAWN_ROYAL", npc, null);
|
||||
cancelQuestTimer("CHECK_MINIONS_ZONE", npc, null);
|
||||
cancelQuestTimer("CHECK_NURSE_ALIVE", npc, null);
|
||||
cancelQuestTimer("HEAL", null, null);
|
||||
// cancelQuestTimer("CHECK_QA_ZONE", npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(QUEEN, info);
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(QUEEN, DEAD);
|
||||
// time is 36hour +/- 17hour
|
||||
final long respawnTime = (Config.QA_RESP_FIRST + Rnd.get(Config.QA_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("QUEEN_SPAWN", respawnTime, null, null);
|
||||
startQuestTimer("LARVA_DESPAWN", 4 * 60 * 60 * 1000, null, null);
|
||||
cancelQuestTimer("ACTION", npc, null);
|
||||
cancelQuestTimer("SPAWN_ROYAL", npc, null);
|
||||
cancelQuestTimer("CHECK_MINIONS_ZONE", npc, null);
|
||||
cancelQuestTimer("CHECK_NURSE_ALIVE", npc, null);
|
||||
cancelQuestTimer("HEAL", null, null);
|
||||
// cancelQuestTimer("CHECK_QA_ZONE", npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(QUEEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(QUEEN, info);
|
||||
|
||||
startQuestTimer("DESPAWN_MINIONS", 10000, null, null);
|
||||
}
|
||||
|
@@ -178,8 +178,7 @@ public class Valakas extends Quest
|
||||
|
||||
temp = (System.currentTimeMillis() - lastAttackTime);
|
||||
|
||||
if ((status == FIGHTING) && !npc.getSpawn().isCustomBossInstance() // if it's a custom spawn, dnt despawn it for inactivity
|
||||
&& (temp > (Config.VALAKAS_DESPAWN_TIME * 60000))) // 15 mins by default
|
||||
if ((status == FIGHTING) && (temp > (Config.VALAKAS_DESPAWN_TIME * 60000))) // 15 mins by default
|
||||
{
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
|
||||
|
||||
@@ -320,19 +319,15 @@ public class Valakas extends Quest
|
||||
else if (event.equals("1117"))
|
||||
{
|
||||
npc.broadcastPacket(new SpecialCamera(npc.getObjectId(), 1700, 10, 0, 3000, 250));
|
||||
|
||||
if (!npc.getSpawn().isCustomBossInstance())
|
||||
addSpawn(31759, 212852, -114842, -1632, 0, false, 900000);
|
||||
final int radius = 1500;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
addSpawn(31759, 212852, -114842, -1632, 0, false, 900000);
|
||||
final int radius = 1500;
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
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);
|
||||
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);
|
||||
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));
|
||||
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;
|
||||
|
||||
startQuestTimer("valakas_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(VALAKAS);
|
||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||
GrandBossManager.getInstance().setStatSet(VALAKAS, info);
|
||||
}
|
||||
final long respawnTime = (Config.VALAKAS_RESP_FIRST + Rnd.get(Config.VALAKAS_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("valakas_unlock", respawnTime, null, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(VALAKAS);
|
||||
info.set("respawn_time", (System.currentTimeMillis() + respawnTime));
|
||||
GrandBossManager.getInstance().setStatSet(VALAKAS, info);
|
||||
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
@@ -1016,8 +1007,7 @@ public class Valakas extends Quest
|
||||
int i1 = 0;
|
||||
|
||||
final Integer status = GrandBossManager.getInstance().getBossStatus(VALAKAS);
|
||||
|
||||
if ((status == FIGHTING) || npc.getSpawn().isCustomBossInstance())
|
||||
if (status == FIGHTING)
|
||||
{
|
||||
if (npc.getCurrentHp() > ((npc.getMaxHp() * 1) / 4))
|
||||
{
|
||||
@@ -1524,7 +1514,7 @@ public class Valakas extends Quest
|
||||
i_quest4 = ((1 * 1000) + Rnd.get(3000));
|
||||
c_quest4 = player;
|
||||
}
|
||||
if ((status == FIGHTING) || (npc.getSpawn().isCustomBossInstance() && !npc.isInvul()))
|
||||
if (status == FIGHTING)
|
||||
{
|
||||
getRandomSkill(npc);
|
||||
}
|
||||
|
@@ -860,19 +860,16 @@ public class Zaken extends Quest
|
||||
{
|
||||
npc.broadcastPacket(new PlaySound(1, "BS02_D", npc));
|
||||
|
||||
if (!npc.getSpawn().isCustomBossInstance())
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(ZAKEN, DEAD);
|
||||
// time is 36hour +/- 17hour
|
||||
final long respawnTime = (Config.ZAKEN_RESP_FIRST + Rnd.get(Config.ZAKEN_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("zaken_unlock", respawnTime, null, null);
|
||||
cancelQuestTimer("1001", npc, null);
|
||||
cancelQuestTimer("1003", npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ZAKEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ZAKEN, info);
|
||||
}
|
||||
GrandBossManager.getInstance().setBossStatus(ZAKEN, DEAD);
|
||||
// time is 36hour +/- 17hour
|
||||
final long respawnTime = (Config.ZAKEN_RESP_FIRST + Rnd.get(Config.ZAKEN_RESP_SECOND)) * 3600000;
|
||||
startQuestTimer("zaken_unlock", respawnTime, null, null);
|
||||
cancelQuestTimer("1001", npc, null);
|
||||
cancelQuestTimer("1003", npc, null);
|
||||
// also save the respawn time so that the info is maintained past reboots
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(ZAKEN);
|
||||
info.set("respawn_time", System.currentTimeMillis() + respawnTime);
|
||||
GrandBossManager.getInstance().setStatSet(ZAKEN, info);
|
||||
}
|
||||
else if (status == ALIVE)
|
||||
{
|
||||
|
@@ -276,7 +276,7 @@ public class SpawnTable
|
||||
{
|
||||
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(2, spawn.getAmount());
|
||||
statement.setInt(3, spawn.getNpcId());
|
||||
@@ -324,7 +324,7 @@ public class SpawnTable
|
||||
{
|
||||
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.execute();
|
||||
statement.close();
|
||||
|
@@ -43,7 +43,39 @@ public class AdminDelete implements IAdminCommandHandler
|
||||
{
|
||||
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;
|
||||
@@ -54,43 +86,4 @@ public class AdminDelete implements IAdminCommandHandler
|
||||
{
|
||||
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.logging.Logger;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.datatables.sql.NpcTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.SpawnTable;
|
||||
import org.l2jmobius.gameserver.datatables.sql.TeleportLocationTable;
|
||||
@@ -297,10 +296,6 @@ public class AdminSpawn implements IAdminCommandHandler
|
||||
try
|
||||
{
|
||||
final Spawn spawn = new Spawn(template1);
|
||||
if (Config.SAVE_GMSPAWN_ON_CUSTOM)
|
||||
{
|
||||
spawn.setCustom(true);
|
||||
}
|
||||
spawn.setX(target.getX());
|
||||
spawn.setY(target.getY());
|
||||
spawn.setZ(target.getZ());
|
||||
@@ -310,11 +305,8 @@ public class AdminSpawn implements IAdminCommandHandler
|
||||
|
||||
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, "It will be spawned but not saved on Database");
|
||||
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
|
||||
BuilderUtil.sendSysMessage(activeChar, "Another spawn of " + template1.getName() + " is already present in the database.");
|
||||
return;
|
||||
}
|
||||
|
||||
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.enums.TeleportWhereType;
|
||||
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.World;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
@@ -585,11 +587,8 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
if (obj instanceof NpcInstance)
|
||||
{
|
||||
final NpcInstance target = (NpcInstance) obj;
|
||||
|
||||
final int monsterTemplate = target.getTemplate().getNpcId();
|
||||
|
||||
final NpcTemplate template1 = NpcTable.getInstance().getTemplate(monsterTemplate);
|
||||
|
||||
if (template1 == null)
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "Incorrect monster template.");
|
||||
@@ -598,7 +597,6 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
}
|
||||
|
||||
Spawn spawn = target.getSpawn();
|
||||
|
||||
if (spawn == null)
|
||||
{
|
||||
BuilderUtil.sendSysMessage(activeChar, "Incorrect monster spawn.");
|
||||
@@ -606,14 +604,18 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
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 boolean custom_boss_spawn = spawn.isCustomBossInstance();
|
||||
|
||||
target.deleteMe();
|
||||
spawn.stopRespawn();
|
||||
|
||||
// check to avoid that recalling a custom raid it will be saved into database
|
||||
SpawnTable.getInstance().deleteSpawn(spawn, !custom_boss_spawn);
|
||||
SpawnTable.getInstance().deleteSpawn(spawn, true);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -624,7 +626,7 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
spawn.setAmount(1);
|
||||
spawn.setHeading(activeChar.getHeading());
|
||||
spawn.setRespawnDelay(respawnTime);
|
||||
SpawnTable.getInstance().addNewSpawn(spawn, !custom_boss_spawn);
|
||||
SpawnTable.getInstance().addNewSpawn(spawn, true);
|
||||
spawn.init();
|
||||
|
||||
BuilderUtil.sendSysMessage(activeChar, "Created " + template1.getName() + " on " + target.getObjectId() + ".");
|
||||
|
@@ -85,10 +85,7 @@ public class GrandBossInstance extends MonsterInstance
|
||||
public void onSpawn()
|
||||
{
|
||||
super.onSpawn();
|
||||
if (!getSpawn().isCustomBossInstance())
|
||||
{
|
||||
GrandBossManager.getInstance().addBoss(this);
|
||||
}
|
||||
GrandBossManager.getInstance().addBoss(this);
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
|
@@ -298,45 +298,6 @@ public class Spawn
|
||||
_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>
|
||||
* <BR>
|
||||
|
Reference in New Issue
Block a user