Caution deleting NPCs with active quest timers.

This commit is contained in:
MobiusDevelopment 2020-04-04 21:55:10 +00:00
parent 98e76d2817
commit 3ced75d22f
93 changed files with 379 additions and 383 deletions

View File

@ -474,8 +474,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -484,6 +483,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -169,9 +169,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -189,9 +189,9 @@ public class Alarm extends AbstractNpcAI
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -222,9 +222,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackPlayerDesire(spawned, player); addAttackPlayerDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -104,8 +104,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -60,8 +60,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -258,8 +258,8 @@ public class AltarOfShilen extends AbstractInstance
} }
world.setStatus(7); world.setStatus(7);
onStatusChanged(world); onStatusChanged(world);
npc.deleteMe();
cancelQuestTimer("check_player", npc, null); cancelQuestTimer("check_player", npc, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -474,8 +474,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -484,6 +483,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -169,9 +169,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -189,9 +189,9 @@ public class Alarm extends AbstractNpcAI
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -222,9 +222,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackPlayerDesire(spawned, player); addAttackPlayerDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -104,8 +104,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -60,8 +60,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -258,8 +258,8 @@ public class AltarOfShilen extends AbstractInstance
} }
world.setStatus(7); world.setStatus(7);
onStatusChanged(world); onStatusChanged(world);
npc.deleteMe();
cancelQuestTimer("check_player", npc, null); cancelQuestTimer("check_player", npc, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -474,8 +474,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -484,6 +483,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -169,9 +169,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -189,9 +189,9 @@ public class Alarm extends AbstractNpcAI
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -222,9 +222,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackPlayerDesire(spawned, player); addAttackPlayerDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -104,8 +104,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -60,8 +60,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -258,8 +258,8 @@ public class AltarOfShilen extends AbstractInstance
} }
world.setStatus(7); world.setStatus(7);
onStatusChanged(world); onStatusChanged(world);
npc.deleteMe();
cancelQuestTimer("check_player", npc, null); cancelQuestTimer("check_player", npc, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -474,8 +474,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -484,6 +483,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -169,9 +169,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -189,9 +189,9 @@ public class Alarm extends AbstractNpcAI
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -222,9 +222,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackPlayerDesire(spawned, player); addAttackPlayerDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -104,8 +104,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -60,8 +60,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -259,8 +259,8 @@ public class AltarOfShilen extends AbstractInstance
} }
world.setStatus(7); world.setStatus(7);
onStatusChanged(world); onStatusChanged(world);
npc.deleteMe();
cancelQuestTimer("check_player", npc, null); cancelQuestTimer("check_player", npc, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -474,8 +474,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -484,6 +483,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -169,9 +169,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -189,9 +189,9 @@ public class Alarm extends AbstractNpcAI
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -222,9 +222,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackPlayerDesire(spawned, player); addAttackPlayerDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -104,8 +104,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -60,8 +60,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -259,8 +259,8 @@ public class AltarOfShilen extends AbstractInstance
} }
world.setStatus(7); world.setStatus(7);
onStatusChanged(world); onStatusChanged(world);
npc.deleteMe();
cancelQuestTimer("check_player", npc, null); cancelQuestTimer("check_player", npc, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -474,8 +474,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -484,6 +483,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -169,9 +169,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -189,9 +189,9 @@ public class Alarm extends AbstractNpcAI
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -222,9 +222,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackPlayerDesire(spawned, player); addAttackPlayerDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -104,8 +104,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -60,8 +60,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -259,8 +259,8 @@ public class AltarOfShilen extends AbstractInstance
} }
world.setStatus(7); world.setStatus(7);
onStatusChanged(world); onStatusChanged(world);
npc.deleteMe();
cancelQuestTimer("check_player", npc, null); cancelQuestTimer("check_player", npc, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -474,8 +474,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -484,6 +483,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -169,9 +169,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -189,9 +189,9 @@ public class Alarm extends AbstractNpcAI
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -222,9 +222,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackPlayerDesire(spawned, player); addAttackPlayerDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -104,8 +104,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -60,8 +60,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -259,8 +259,8 @@ public class AltarOfShilen extends AbstractInstance
} }
world.setStatus(7); world.setStatus(7);
onStatusChanged(world); onStatusChanged(world);
npc.deleteMe();
cancelQuestTimer("check_player", npc, null); cancelQuestTimer("check_player", npc, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -474,8 +474,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -484,6 +483,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -222,9 +222,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackPlayerDesire(spawned, player); addAttackPlayerDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -197,7 +197,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -206,6 +205,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -104,8 +104,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -60,8 +60,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -259,8 +259,8 @@ public class AltarOfShilen extends AbstractInstance
} }
world.setStatus(7); world.setStatus(7);
onStatusChanged(world); onStatusChanged(world);
npc.deleteMe();
cancelQuestTimer("check_player", npc, null); cancelQuestTimer("check_player", npc, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -168,9 +168,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -186,9 +186,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -168,8 +168,8 @@ public class Natives extends AbstractNpcAI
else if (event.equalsIgnoreCase("delete_me")) else if (event.equalsIgnoreCase("delete_me"))
{ {
npc.setBusy(false); // TODO: Does it really need? npc.setBusy(false); // TODO: Does it really need?
npc.deleteMe();
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
} }
} }
return htmltext; return htmltext;

View File

@ -120,9 +120,9 @@ public class Quarry extends AbstractNpcAI
} }
} }
npc.setAutoAttackable(false); npc.setAutoAttackable(false);
npc.deleteMe();
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
HellboundEngine.getInstance().updateTrust(TRUST, true); HellboundEngine.getInstance().updateTrust(TRUST, true);
npc.deleteMe();
} }
} }
} }

View File

@ -466,7 +466,6 @@ public class TowerOfNaia extends AbstractNpcAI
{ {
htmltext = null; htmltext = null;
_sporeSpawn.remove(npc); _sporeSpawn.remove(npc);
npc.deleteMe();
if (npcId == SPORE_BASIC) if (npcId == SPORE_BASIC)
{ {
@ -488,6 +487,8 @@ public class TowerOfNaia extends AbstractNpcAI
startQuestTimer("despawn_total", 60000, null, null); startQuestTimer("despawn_total", 60000, null, null);
} }
} }
npc.deleteMe();
} }
else if (event.equalsIgnoreCase("18492-05.htm")) else if (event.equalsIgnoreCase("18492-05.htm"))
{ {

View File

@ -749,8 +749,8 @@ public class TullyWorkshop extends AbstractNpcAI
{ {
if ((npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST) && (npc.getCurrentHp() == npc.getMaxHp())) if ((npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST) && (npc.getCurrentHp() == npc.getMaxHp()))
{ {
npc.deleteMe();
allowServantSpawn = true; allowServantSpawn = true;
npc.deleteMe();
} }
else else
{ {
@ -759,9 +759,9 @@ public class TullyWorkshop extends AbstractNpcAI
} }
else if (event.equalsIgnoreCase("despawn_agent")) else if (event.equalsIgnoreCase("despawn_agent"))
{ {
npc.deleteMe();
allowServantSpawn = true; allowServantSpawn = true;
allowAgentSpawn = true; allowAgentSpawn = true;
npc.deleteMe();
} }
else if (event.equalsIgnoreCase("despawn_agent_7")) else if (event.equalsIgnoreCase("despawn_agent_7"))
{ {
@ -787,8 +787,8 @@ public class TullyWorkshop extends AbstractNpcAI
} }
}); });
npc.deleteMe();
startQuestTimer("start_7th_floor_spawn", 120000, null, null); startQuestTimer("start_7th_floor_spawn", 120000, null, null);
npc.deleteMe();
} }
if (player == null) if (player == null)
@ -1000,7 +1000,6 @@ public class TullyWorkshop extends AbstractNpcAI
else if (event.equalsIgnoreCase("refuse") && !allowAgentSpawn_7th) else if (event.equalsIgnoreCase("refuse") && !allowAgentSpawn_7th)
{ {
allowAgentSpawn_7th = true; allowAgentSpawn_7th = true;
npc.deleteMe();
spawnedAgent = null; spawnedAgent = null;
for (MonsterInstance monster : spawnedFollowers) for (MonsterInstance monster : spawnedFollowers)
{ {
@ -1026,6 +1025,8 @@ public class TullyWorkshop extends AbstractNpcAI
is7thFloorAttackBegan = true; is7thFloorAttackBegan = true;
startQuestTimer("end_7th_floor_attack", 1200000, null, null); startQuestTimer("end_7th_floor_attack", 1200000, null, null);
} }
npc.deleteMe();
} }
} }
else if (event.equalsIgnoreCase("teleport") && (npcId == DWARVEN_GHOST)) else if (event.equalsIgnoreCase("teleport") && (npcId == DWARVEN_GHOST))

View File

@ -219,9 +219,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackDesire(spawned, player); addAttackDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -202,7 +202,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -212,6 +211,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, null); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, null);
startQuestTimer("SOCIAL_ACTION", 10000, _baium, player); startQuestTimer("SOCIAL_ACTION", 10000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -120,12 +120,12 @@ public class DrChaos extends AbstractNpcAI
{ {
if ((npc.getId() == CHAOS_GOLEM) && ((_lastAttackVsGolem + 1800000) < System.currentTimeMillis())) if ((npc.getId() == CHAOS_GOLEM) && ((_lastAttackVsGolem + 1800000) < System.currentTimeMillis()))
{ {
final Npc chaos = addSpawn(DOCTOR_CHAOS, 96320, -110912, -3328, 8191, false, 0, false); // spawn Dr. Chaos
GrandBossManager.getInstance().setBossStatus(CHAOS_GOLEM, NORMAL); // mark Dr. Chaos is not crazy any more
cancelQuestTimer("golem_despawn", chaos, null);
// Despawn the war golem. // Despawn the war golem.
npc.deleteMe(); npc.deleteMe();
addSpawn(DOCTOR_CHAOS, 96320, -110912, -3328, 8191, false, 0, false); // spawn Dr. Chaos
GrandBossManager.getInstance().setBossStatus(CHAOS_GOLEM, NORMAL); // mark Dr. Chaos is not crazy any more
cancelQuestTimer("golem_despawn", npc, null);
} }
} }
else if (event.equalsIgnoreCase("1")) else if (event.equalsIgnoreCase("1"))
@ -148,20 +148,19 @@ public class DrChaos extends AbstractNpcAI
} }
else if (event.equalsIgnoreCase("5")) else if (event.equalsIgnoreCase("5"))
{ {
// Delete Dr. Chaos && spawn the war golem.
npc.deleteMe();
final GrandBossInstance golem = (GrandBossInstance) addSpawn(CHAOS_GOLEM, 96080, -110822, -3343, 0, false, 0, false); final GrandBossInstance golem = (GrandBossInstance) addSpawn(CHAOS_GOLEM, 96080, -110822, -3343, 0, false, 0, false);
GrandBossManager.getInstance().addBoss(golem); GrandBossManager.getInstance().addBoss(golem);
// The "npc" variable attribution is now for the golem. golem.broadcastPacket(new SpecialCamera(npc, 30, 200, 20, 6000, 700, 8000, 0, 0, 0, 0, 0));
npc = golem; golem.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
npc.broadcastPacket(new SpecialCamera(npc, 30, 200, 20, 6000, 700, 8000, 0, 0, 0, 0, 0)); golem.broadcastPacket(new PlaySound(1, "Rm03_A", 0, 0, 0, 0, 0));
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
npc.broadcastPacket(new PlaySound(1, "Rm03_A", 0, 0, 0, 0, 0));
// start monitoring Dr. Chaos's inactivity // start monitoring Dr. Chaos's inactivity
_lastAttackVsGolem = System.currentTimeMillis(); _lastAttackVsGolem = System.currentTimeMillis();
startQuestTimer("golem_despawn", 60000, npc, null, true); startQuestTimer("golem_despawn", 60000, golem, null, true);
// Delete Dr. Chaos after spawned the war golem.
npc.deleteMe();
} }
// Check every sec if someone is in range, if found, launch one task to decrease the timer. // Check every sec if someone is in range, if found, launch one task to decrease the timer.
else if (event.equalsIgnoreCase("paranoia_activity") && (GrandBossManager.getInstance().getBossStatus(CHAOS_GOLEM) == NORMAL)) else if (event.equalsIgnoreCase("paranoia_activity") && (GrandBossManager.getInstance().getBossStatus(CHAOS_GOLEM) == NORMAL))

View File

@ -58,8 +58,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -168,9 +168,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, ART_OF_PERSUASION_ID, 4); setMemoState(player, ART_OF_PERSUASION_ID, 4);
htmltext = "32367-184_09.html"; htmltext = "32367-184_09.html";
npc.deleteMe();
} }
else else
{ {
@ -186,9 +186,9 @@ public class Alarm extends AbstractNpcAI
{ {
npc0.getVariables().set("SPAWNED", false); npc0.getVariables().set("SPAWNED", false);
} }
npc.deleteMe();
setMemoState(player, NIKOLAS_COOPERATION_ID, 4); setMemoState(player, NIKOLAS_COOPERATION_ID, 4);
htmltext = "32367-185_09.html"; htmltext = "32367-185_09.html";
npc.deleteMe();
} }
else else
{ {

View File

@ -168,8 +168,8 @@ public class Natives extends AbstractNpcAI
else if (event.equalsIgnoreCase("delete_me")) else if (event.equalsIgnoreCase("delete_me"))
{ {
npc.setBusy(false); // TODO: Does it really need? npc.setBusy(false); // TODO: Does it really need?
npc.deleteMe();
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
} }
} }
return htmltext; return htmltext;

View File

@ -120,9 +120,9 @@ public class Quarry extends AbstractNpcAI
} }
} }
npc.setAutoAttackable(false); npc.setAutoAttackable(false);
npc.deleteMe();
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
HellboundEngine.getInstance().updateTrust(TRUST, true); HellboundEngine.getInstance().updateTrust(TRUST, true);
npc.deleteMe();
} }
} }
} }

View File

@ -466,7 +466,6 @@ public class TowerOfNaia extends AbstractNpcAI
{ {
htmltext = null; htmltext = null;
_sporeSpawn.remove(npc); _sporeSpawn.remove(npc);
npc.deleteMe();
if (npcId == SPORE_BASIC) if (npcId == SPORE_BASIC)
{ {
@ -488,6 +487,8 @@ public class TowerOfNaia extends AbstractNpcAI
startQuestTimer("despawn_total", 60000, null, null); startQuestTimer("despawn_total", 60000, null, null);
} }
} }
npc.deleteMe();
} }
else if (event.equalsIgnoreCase("18492-05.htm")) else if (event.equalsIgnoreCase("18492-05.htm"))
{ {

View File

@ -749,8 +749,8 @@ public class TullyWorkshop extends AbstractNpcAI
{ {
if ((npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST) && (npc.getCurrentHp() == npc.getMaxHp())) if ((npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) && (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_CAST) && (npc.getCurrentHp() == npc.getMaxHp()))
{ {
npc.deleteMe();
allowServantSpawn = true; allowServantSpawn = true;
npc.deleteMe();
} }
else else
{ {
@ -759,9 +759,9 @@ public class TullyWorkshop extends AbstractNpcAI
} }
else if (event.equalsIgnoreCase("despawn_agent")) else if (event.equalsIgnoreCase("despawn_agent"))
{ {
npc.deleteMe();
allowServantSpawn = true; allowServantSpawn = true;
allowAgentSpawn = true; allowAgentSpawn = true;
npc.deleteMe();
} }
else if (event.equalsIgnoreCase("despawn_agent_7")) else if (event.equalsIgnoreCase("despawn_agent_7"))
{ {
@ -787,8 +787,8 @@ public class TullyWorkshop extends AbstractNpcAI
} }
}); });
npc.deleteMe();
startQuestTimer("start_7th_floor_spawn", 120000, null, null); startQuestTimer("start_7th_floor_spawn", 120000, null, null);
npc.deleteMe();
} }
if (player == null) if (player == null)
@ -1000,7 +1000,6 @@ public class TullyWorkshop extends AbstractNpcAI
else if (event.equalsIgnoreCase("refuse") && !allowAgentSpawn_7th) else if (event.equalsIgnoreCase("refuse") && !allowAgentSpawn_7th)
{ {
allowAgentSpawn_7th = true; allowAgentSpawn_7th = true;
npc.deleteMe();
spawnedAgent = null; spawnedAgent = null;
for (MonsterInstance monster : spawnedFollowers) for (MonsterInstance monster : spawnedFollowers)
{ {
@ -1026,6 +1025,8 @@ public class TullyWorkshop extends AbstractNpcAI
is7thFloorAttackBegan = true; is7thFloorAttackBegan = true;
startQuestTimer("end_7th_floor_attack", 1200000, null, null); startQuestTimer("end_7th_floor_attack", 1200000, null, null);
} }
npc.deleteMe();
} }
} }
else if (event.equalsIgnoreCase("teleport") && (npcId == DWARVEN_GHOST)) else if (event.equalsIgnoreCase("teleport") && (npcId == DWARVEN_GHOST))

View File

@ -219,9 +219,9 @@ public class StakatoNest extends AbstractNpcAI
if (npcId > 0) if (npcId > 0)
{ {
npc.getSpawn().decreaseCount(npc); npc.getSpawn().decreaseCount(npc);
npc.deleteMe();
final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true); final Npc spawned = addSpawn(npcId, npc.getX(), npc.getY(), npc.getZ(), npc.getHeading(), false, 0, true);
addAttackDesire(spawned, player); addAttackDesire(spawned, player);
npc.deleteMe();
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);
} }

View File

@ -202,7 +202,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -212,6 +211,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, null); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, null);
startQuestTimer("SOCIAL_ACTION", 10000, _baium, player); startQuestTimer("SOCIAL_ACTION", 10000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -120,12 +120,12 @@ public class DrChaos extends AbstractNpcAI
{ {
if ((npc.getId() == CHAOS_GOLEM) && ((_lastAttackVsGolem + 1800000) < System.currentTimeMillis())) if ((npc.getId() == CHAOS_GOLEM) && ((_lastAttackVsGolem + 1800000) < System.currentTimeMillis()))
{ {
final Npc chaos = addSpawn(DOCTOR_CHAOS, 96320, -110912, -3328, 8191, false, 0, false); // spawn Dr. Chaos
GrandBossManager.getInstance().setBossStatus(CHAOS_GOLEM, NORMAL); // mark Dr. Chaos is not crazy any more
cancelQuestTimer("golem_despawn", chaos, null);
// Despawn the war golem. // Despawn the war golem.
npc.deleteMe(); npc.deleteMe();
addSpawn(DOCTOR_CHAOS, 96320, -110912, -3328, 8191, false, 0, false); // spawn Dr. Chaos
GrandBossManager.getInstance().setBossStatus(CHAOS_GOLEM, NORMAL); // mark Dr. Chaos is not crazy any more
cancelQuestTimer("golem_despawn", npc, null);
} }
} }
else if (event.equalsIgnoreCase("1")) else if (event.equalsIgnoreCase("1"))
@ -148,20 +148,19 @@ public class DrChaos extends AbstractNpcAI
} }
else if (event.equalsIgnoreCase("5")) else if (event.equalsIgnoreCase("5"))
{ {
// Delete Dr. Chaos && spawn the war golem.
npc.deleteMe();
final GrandBossInstance golem = (GrandBossInstance) addSpawn(CHAOS_GOLEM, 96080, -110822, -3343, 0, false, 0, false); final GrandBossInstance golem = (GrandBossInstance) addSpawn(CHAOS_GOLEM, 96080, -110822, -3343, 0, false, 0, false);
GrandBossManager.getInstance().addBoss(golem); GrandBossManager.getInstance().addBoss(golem);
// The "npc" variable attribution is now for the golem. golem.broadcastPacket(new SpecialCamera(npc, 30, 200, 20, 6000, 700, 8000, 0, 0, 0, 0, 0));
npc = golem; golem.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
npc.broadcastPacket(new SpecialCamera(npc, 30, 200, 20, 6000, 700, 8000, 0, 0, 0, 0, 0)); golem.broadcastPacket(new PlaySound(1, "Rm03_A", 0, 0, 0, 0, 0));
npc.broadcastPacket(new SocialAction(npc.getObjectId(), 1));
npc.broadcastPacket(new PlaySound(1, "Rm03_A", 0, 0, 0, 0, 0));
// start monitoring Dr. Chaos's inactivity // start monitoring Dr. Chaos's inactivity
_lastAttackVsGolem = System.currentTimeMillis(); _lastAttackVsGolem = System.currentTimeMillis();
startQuestTimer("golem_despawn", 60000, npc, null, true); startQuestTimer("golem_despawn", 60000, golem, null, true);
// Delete Dr. Chaos after spawned the war golem.
npc.deleteMe();
} }
// Check every sec if someone is in range, if found, launch one task to decrease the timer. // Check every sec if someone is in range, if found, launch one task to decrease the timer.
else if (event.equalsIgnoreCase("paranoia_activity") && (GrandBossManager.getInstance().getBossStatus(CHAOS_GOLEM) == NORMAL)) else if (event.equalsIgnoreCase("paranoia_activity") && (GrandBossManager.getInstance().getBossStatus(CHAOS_GOLEM) == NORMAL))

View File

@ -58,8 +58,8 @@ public class QueenShyeed extends AbstractNpcAI
{ {
if (!npc.isDead()) if (!npc.isDead())
{ {
npc.deleteMe();
startRespawn(); startRespawn();
npc.deleteMe();
} }
break; break;
} }

View File

@ -109,8 +109,8 @@ public class IceQueensCastle extends AbstractInstance
if (npc != null) if (npc != null)
{ {
playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT); playMovie(player, Movie.SC_BOSS_FREYA_FORCED_DEFEAT);
startQuestTimer("TIMER_PC_LEAVE", 24000, null, player);
npc.deleteMe(); npc.deleteMe();
startQuestTimer("TIMER_PC_LEAVE", 24000, npc, player);
} }
break; break;
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -83,7 +83,6 @@ public class LastImperialTomb extends AbstractInstance
18337, 18337,
18338, 18338,
18339 18339
}; };
// Items // Items
private static final int FIRST_SCARLET_WEAPON = 8204; private static final int FIRST_SCARLET_WEAPON = 8204;
@ -485,7 +484,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -494,39 +493,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -542,30 +541,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -575,24 +574,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -704,7 +701,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -83,7 +83,6 @@ public class LastImperialTomb extends AbstractInstance
18337, 18337,
18338, 18338,
18339 18339
}; };
// Items // Items
private static final int FIRST_SCARLET_WEAPON = 8204; private static final int FIRST_SCARLET_WEAPON = 8204;
@ -485,7 +484,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -494,39 +493,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -542,30 +541,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -575,24 +574,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -704,7 +701,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)

View File

@ -469,8 +469,7 @@ public class FeedableBeasts extends AbstractNpcAI
{ {
_feedInfo.remove(npc.getObjectId()); _feedInfo.remove(npc.getObjectId());
} }
// despawn the mad cow
npc.deleteMe();
// spawn the new mob // spawn the new mob
final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc); final Attackable nextNpc = (Attackable) addSpawn(MAD_COW_POLYMORPH.get(npc.getId()), npc);
@ -479,6 +478,9 @@ public class FeedableBeasts extends AbstractNpcAI
nextNpc.setRunning(); nextNpc.setRunning();
nextNpc.addDamageHate(player, 0, 99999); nextNpc.addDamageHate(player, 0, 99999);
nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player); nextNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, player);
// despawn the mad cow
npc.deleteMe();
} }
} }
return super.onAdvEvent(event, npc, player); return super.onAdvEvent(event, npc, player);

View File

@ -204,7 +204,6 @@ public class Baium extends AbstractNpcAI
{ {
if (getStatus() == ALIVE) if (getStatus() == ALIVE)
{ {
npc.deleteMe();
setStatus(IN_FIGHT); setStatus(IN_FIGHT);
_baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0); _baium = (GrandBossInstance) addSpawn(BAIUM, BAIUM_LOC, false, 0);
_baium.disableCoreAI(true); _baium.disableCoreAI(true);
@ -213,6 +212,7 @@ public class Baium extends AbstractNpcAI
startQuestTimer("WAKEUP_ACTION", 50, _baium, null); startQuestTimer("WAKEUP_ACTION", 50, _baium, null);
startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player); startQuestTimer("MANAGE_EARTHQUAKE", 2000, _baium, player);
startQuestTimer("CHECK_ATTACK", 60000, _baium, null); startQuestTimer("CHECK_ATTACK", 60000, _baium, null);
npc.deleteMe();
} }
break; break;
} }

View File

@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
} }
case "SCARLET_SECOND_MORPH": case "SCARLET_SECOND_MORPH":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
disablePlayers(world); disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack(); activeScarlet.abortAttack();
@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
playRandomSong(world); playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_1": case "SCARLET_SECOND_MORPH_CAMERA_1":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4)); broadcastPacket(world, new SocialAction(frintezza.getObjectId(), 4));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 250, 120, 15, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_2", 7000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_2": case "SCARLET_SECOND_MORPH_CAMERA_2":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0)); broadcastPacket(world, new MagicSkillUse(frintezza, frintezza, 5006, 1, 34000, 0));
broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 500, 70, 15, 3000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_3": case "SCARLET_SECOND_MORPH_CAMERA_3":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class); final Npc frintezza = world.getParameters().getObject("frintezza", Npc.class);
broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(frintezza, 2500, 90, 12, 6000, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_4", 3000, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_4": case "SCARLET_SECOND_MORPH_CAMERA_4":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final Location scarletLocation = activeScarlet.getLocation(); final Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0; int newHeading = 0;
@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
world.setParameter("newHeading", newHeading); world.setParameter("newHeading", newHeading);
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 1000, 0, 0, 1, 0, 0));
broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 250, newHeading, 12, 0, 10000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_5", 500, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_5": case "SCARLET_SECOND_MORPH_CAMERA_5":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet); activeScarlet.doDie(activeScarlet);
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 14, 8000, 8000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_6": case "SCARLET_SECOND_MORPH_CAMERA_6":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.deleteMe(); activeScarlet.deleteMe();
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_7": case "SCARLET_SECOND_MORPH_CAMERA_7":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading"); final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation"); final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId()); final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true); activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills(); activeScarlet.disableAllSkills();
broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0)); broadcastPacket(world, new SpecialCamera(activeScarlet, 450, newHeading, 12, 500, 14000, 0, 0, 1, 0, 0));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_8", 8100, activeScarlet, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_8": case "SCARLET_SECOND_MORPH_CAMERA_8":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break; break;
} }
case "SCARLET_SECOND_MORPH_CAMERA_9": case "SCARLET_SECOND_MORPH_CAMERA_9":
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class); npc.setInvul(false);
activeScarlet.setInvul(false); npc.setImmobilized(false);
activeScarlet.setImmobilized(false); npc.enableAllSkills();
activeScarlet.enableAllSkills();
enablePlayers(world); enablePlayers(world);
break; break;
} }
@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20))) if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{ {
npc.setScriptValue(2); npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false); startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
} }
} }
if (skill != null) if (skill != null)