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

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

View File

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

View File

@@ -483,7 +483,7 @@ public class LastImperialTomb extends AbstractInstance
}
case "SCARLET_SECOND_MORPH":
{
final Instance world = npc.getInstanceWorld();
final Instance world = player.getInstanceWorld();
disablePlayers(world);
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.abortAttack();
@@ -492,39 +492,39 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills();
playRandomSong(world);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, npc, null, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_1", 2000, null, player, false);
break;
}
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);
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, 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;
}
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);
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));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, npc, null, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_3", 3000, null, player, false);
break;
}
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);
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;
}
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 Location scarletLocation = activeScarlet.getLocation();
int newHeading = 0;
@@ -540,30 +540,30 @@ public class LastImperialTomb extends AbstractInstance
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, 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;
}
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 int newHeading = world.getParameters().getInt("newHeading");
activeScarlet.doDie(activeScarlet);
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_7", 7200, npc, null, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_6", 6250, null, player, false);
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_7", 7200, null, player, false);
break;
}
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);
activeScarlet.deleteMe();
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_7":
{
final Instance world = npc.getInstanceWorld();
final Instance world = player.getInstanceWorld();
final int newHeading = world.getParameters().getInt("newHeading");
final Location scarletLocation = world.getParameters().getLocation("scarletLocation");
final Npc activeScarlet = addSpawn(SCARLET2, scarletLocation, false, 0, false, world.getId());
@@ -573,24 +573,22 @@ public class LastImperialTomb extends AbstractInstance
activeScarlet.setImmobilized(true);
activeScarlet.disableAllSkills();
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;
}
case "SCARLET_SECOND_MORPH_CAMERA_8":
{
final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
broadcastPacket(world, new SocialAction(activeScarlet.getObjectId(), 2));
broadcastPacket(world, new SocialAction(npc.getObjectId(), 2));
startQuestTimer("SCARLET_SECOND_MORPH_CAMERA_9", 9000, npc, null, false);
break;
}
case "SCARLET_SECOND_MORPH_CAMERA_9":
{
final Instance world = npc.getInstanceWorld();
final Npc activeScarlet = world.getParameters().getObject("activeScarlet", Npc.class);
activeScarlet.setInvul(false);
activeScarlet.setImmobilized(false);
activeScarlet.enableAllSkills();
npc.setInvul(false);
npc.setImmobilized(false);
npc.enableAllSkills();
enablePlayers(world);
break;
}
@@ -702,7 +700,7 @@ public class LastImperialTomb extends AbstractInstance
if (npc.isScriptValue(1) && (npc.getCurrentHp() < (npc.getMaxHp() * 0.20)))
{
npc.setScriptValue(2);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, npc, null, false);
startQuestTimer("SCARLET_SECOND_MORPH", 1000, null, attacker, false);
}
}
if (skill != null)