Fixed Octavis onKill method starting timers with dead NPCs.

This commit is contained in:
MobiusDevelopment
2020-04-05 00:44:30 +00:00
parent 8e942892a9
commit f912c49c83
8 changed files with 1896 additions and 1360 deletions

View File

@@ -154,21 +154,25 @@ public class OctavisWarzone extends AbstractInstance
@Override @Override
public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player) public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player)
{ {
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
{
final StatSet npcVars = npc.getVariables();
final StatSet npcParams = npc.getParameters();
switch (event) switch (event)
{ {
case "SECOND_DOOR_OPEN": case "SECOND_DOOR_OPEN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, true); world.openCloseDoor(MAIN_DOOR_2, true);
break; break;
} }
case "CLOSE_DOORS": case "CLOSE_DOORS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_2, false);
world.openCloseDoor(MAIN_DOOR_1, false); world.openCloseDoor(MAIN_DOOR_1, false);
world.setParameter("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
@@ -179,6 +183,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "START_STAGE_1": case "START_STAGE_1":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_1"); world.spawnGroup("STAGE_1");
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
@@ -199,6 +208,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "FOLLOW_BEASTS": case "FOLLOW_BEASTS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
addMoveToDesire(npc, beasts.getLocation(), 23); addMoveToDesire(npc, beasts.getLocation(), 23);
@@ -208,6 +222,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_CHECK_HP": case "BEASTS_CHECK_HP":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final int hpPer = npc.getCurrentHpPercent(); final int hpPer = npc.getCurrentHpPercent();
if ((hpPer < 50) && npc.isScriptValue(0)) if ((hpPer < 50) && npc.isScriptValue(0))
{ {
@@ -229,39 +249,75 @@ public class OctavisWarzone extends AbstractInstance
} }
case "END_STAGE_1": case "END_STAGE_1":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_A); playMovie(world, Movie.SC_OCTABIS_PHASECH_A);
getTimers().addTimer("START_STAGE_2", 12000, npc, null); getTimers().addTimer("START_STAGE_2", 12000, null, player);
break; break;
} }
case "START_STAGE_2": case "START_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_2": case "END_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_B); playMovie(world, Movie.SC_OCTABIS_PHASECH_B);
getTimers().addTimer("START_STAGE_3", 15000, npc, null); getTimers().addTimer("START_STAGE_3", 15000, null, player);
break; break;
} }
case "START_STAGE_3": case "START_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_3": case "END_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_ENDING); playMovie(world, Movie.SC_OCTABIS_ENDING);
getTimers().addTimer("USM_SCENE_TIMER", 40000, npc, null); getTimers().addTimer("USM_SCENE_TIMER", 40000, null, player);
break; break;
} }
case "USM_SCENE_TIMER": case "USM_SCENE_TIMER":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END); world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END);
break; break;
} }
case "GLADIATOR_START_SPAWN": case "GLADIATOR_START_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcVars = npc.getVariables();
final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1); final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1);
if (spawnIndex < 7) if (spawnIndex < 7)
{ {
@@ -280,6 +336,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "GLADIATOR_MOVING": case "GLADIATOR_MOVING":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcParams = npc.getParameters();
final int moveX = npcParams.getInt("Move_to_X", 0); final int moveX = npcParams.getInt("Move_to_X", 0);
final int moveY = npcParams.getInt("Move_to_Y", 0); final int moveY = npcParams.getInt("Move_to_Y", 0);
if ((moveX != 0) && (moveY != 0)) if ((moveX != 0) && (moveY != 0))
@@ -291,6 +353,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_MINIONS_SPAWN": case "BEASTS_MINIONS_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
for (int i = 0; i < getRandom(10); i++) for (int i = 0; i < getRandom(10); i++)
{ {
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId()); final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
@@ -337,7 +405,6 @@ public class OctavisWarzone extends AbstractInstance
} }
} }
} }
}
@Override @Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -423,7 +490,7 @@ public class OctavisWarzone extends AbstractInstance
beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16 beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16
beast.deleteMe(); beast.deleteMe();
}); });
getTimers().addTimer("END_STAGE_1", 1000, npc, null); getTimers().addTimer("END_STAGE_1", 1000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId()))
{ {
@@ -440,12 +507,12 @@ public class OctavisWarzone extends AbstractInstance
{ {
world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1")); world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1"));
} }
getTimers().addTimer("END_STAGE_2", 3000, npc, null); getTimers().addTimer("END_STAGE_2", 3000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId()))
{ {
world.finishInstance(); world.finishInstance();
getTimers().addTimer("END_STAGE_3", 2000, npc, null); getTimers().addTimer("END_STAGE_3", 2000, null, killer);
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -497,17 +564,17 @@ public class OctavisWarzone extends AbstractInstance
return super.onSpellFinished(npc, player, skill); return super.onSpellFinished(npc, player, skill);
} }
public void onCreatureSee(OnCreatureSee event) private void onCreatureSee(OnCreatureSee event)
{ {
final Creature creature = event.getSeen(); final Creature creature = event.getSeen();
final Npc npc = (Npc) event.getSeer(); final Npc npc = (Npc) event.getSeer();
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0)) if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0))
{ {
npc.setScriptValue(1);
world.openCloseDoor(MAIN_DOOR_1, true); world.openCloseDoor(MAIN_DOOR_1, true);
getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null); getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null);
getTimers().addTimer("CLOSE_DOORS", 60000, npc, null); getTimers().addTimer("CLOSE_DOORS", 60000, npc, null);
npc.setScriptValue(1);
} }
} }

View File

@@ -154,21 +154,25 @@ public class OctavisWarzone extends AbstractInstance
@Override @Override
public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player) public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player)
{ {
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
{
final StatSet npcVars = npc.getVariables();
final StatSet npcParams = npc.getParameters();
switch (event) switch (event)
{ {
case "SECOND_DOOR_OPEN": case "SECOND_DOOR_OPEN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, true); world.openCloseDoor(MAIN_DOOR_2, true);
break; break;
} }
case "CLOSE_DOORS": case "CLOSE_DOORS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_2, false);
world.openCloseDoor(MAIN_DOOR_1, false); world.openCloseDoor(MAIN_DOOR_1, false);
world.setParameter("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
@@ -179,6 +183,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "START_STAGE_1": case "START_STAGE_1":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_1"); world.spawnGroup("STAGE_1");
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
@@ -199,6 +208,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "FOLLOW_BEASTS": case "FOLLOW_BEASTS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
addMoveToDesire(npc, beasts.getLocation(), 23); addMoveToDesire(npc, beasts.getLocation(), 23);
@@ -208,6 +222,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_CHECK_HP": case "BEASTS_CHECK_HP":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final int hpPer = npc.getCurrentHpPercent(); final int hpPer = npc.getCurrentHpPercent();
if ((hpPer < 50) && npc.isScriptValue(0)) if ((hpPer < 50) && npc.isScriptValue(0))
{ {
@@ -229,39 +249,75 @@ public class OctavisWarzone extends AbstractInstance
} }
case "END_STAGE_1": case "END_STAGE_1":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_A); playMovie(world, Movie.SC_OCTABIS_PHASECH_A);
getTimers().addTimer("START_STAGE_2", 12000, npc, null); getTimers().addTimer("START_STAGE_2", 12000, null, player);
break; break;
} }
case "START_STAGE_2": case "START_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_2": case "END_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_B); playMovie(world, Movie.SC_OCTABIS_PHASECH_B);
getTimers().addTimer("START_STAGE_3", 15000, npc, null); getTimers().addTimer("START_STAGE_3", 15000, null, player);
break; break;
} }
case "START_STAGE_3": case "START_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_3": case "END_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_ENDING); playMovie(world, Movie.SC_OCTABIS_ENDING);
getTimers().addTimer("USM_SCENE_TIMER", 40000, npc, null); getTimers().addTimer("USM_SCENE_TIMER", 40000, null, player);
break; break;
} }
case "USM_SCENE_TIMER": case "USM_SCENE_TIMER":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END); world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END);
break; break;
} }
case "GLADIATOR_START_SPAWN": case "GLADIATOR_START_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcVars = npc.getVariables();
final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1); final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1);
if (spawnIndex < 7) if (spawnIndex < 7)
{ {
@@ -280,6 +336,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "GLADIATOR_MOVING": case "GLADIATOR_MOVING":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcParams = npc.getParameters();
final int moveX = npcParams.getInt("Move_to_X", 0); final int moveX = npcParams.getInt("Move_to_X", 0);
final int moveY = npcParams.getInt("Move_to_Y", 0); final int moveY = npcParams.getInt("Move_to_Y", 0);
if ((moveX != 0) && (moveY != 0)) if ((moveX != 0) && (moveY != 0))
@@ -291,6 +353,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_MINIONS_SPAWN": case "BEASTS_MINIONS_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
for (int i = 0; i < getRandom(10); i++) for (int i = 0; i < getRandom(10); i++)
{ {
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId()); final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
@@ -337,7 +405,6 @@ public class OctavisWarzone extends AbstractInstance
} }
} }
} }
}
@Override @Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -423,7 +490,7 @@ public class OctavisWarzone extends AbstractInstance
beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16 beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16
beast.deleteMe(); beast.deleteMe();
}); });
getTimers().addTimer("END_STAGE_1", 1000, npc, null); getTimers().addTimer("END_STAGE_1", 1000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId()))
{ {
@@ -440,12 +507,12 @@ public class OctavisWarzone extends AbstractInstance
{ {
world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1")); world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1"));
} }
getTimers().addTimer("END_STAGE_2", 3000, npc, null); getTimers().addTimer("END_STAGE_2", 3000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId()))
{ {
world.finishInstance(); world.finishInstance();
getTimers().addTimer("END_STAGE_3", 2000, npc, null); getTimers().addTimer("END_STAGE_3", 2000, null, killer);
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -497,17 +564,17 @@ public class OctavisWarzone extends AbstractInstance
return super.onSpellFinished(npc, player, skill); return super.onSpellFinished(npc, player, skill);
} }
public void onCreatureSee(OnCreatureSee event) private void onCreatureSee(OnCreatureSee event)
{ {
final Creature creature = event.getSeen(); final Creature creature = event.getSeen();
final Npc npc = (Npc) event.getSeer(); final Npc npc = (Npc) event.getSeer();
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0)) if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0))
{ {
npc.setScriptValue(1);
world.openCloseDoor(MAIN_DOOR_1, true); world.openCloseDoor(MAIN_DOOR_1, true);
getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null); getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null);
getTimers().addTimer("CLOSE_DOORS", 60000, npc, null); getTimers().addTimer("CLOSE_DOORS", 60000, npc, null);
npc.setScriptValue(1);
} }
} }

View File

@@ -154,21 +154,25 @@ public class OctavisWarzone extends AbstractInstance
@Override @Override
public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player) public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player)
{ {
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
{
final StatSet npcVars = npc.getVariables();
final StatSet npcParams = npc.getParameters();
switch (event) switch (event)
{ {
case "SECOND_DOOR_OPEN": case "SECOND_DOOR_OPEN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, true); world.openCloseDoor(MAIN_DOOR_2, true);
break; break;
} }
case "CLOSE_DOORS": case "CLOSE_DOORS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_2, false);
world.openCloseDoor(MAIN_DOOR_1, false); world.openCloseDoor(MAIN_DOOR_1, false);
world.setParameter("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
@@ -179,6 +183,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "START_STAGE_1": case "START_STAGE_1":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_1"); world.spawnGroup("STAGE_1");
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
@@ -199,6 +208,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "FOLLOW_BEASTS": case "FOLLOW_BEASTS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
addMoveToDesire(npc, beasts.getLocation(), 23); addMoveToDesire(npc, beasts.getLocation(), 23);
@@ -208,6 +222,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_CHECK_HP": case "BEASTS_CHECK_HP":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final int hpPer = npc.getCurrentHpPercent(); final int hpPer = npc.getCurrentHpPercent();
if ((hpPer < 50) && npc.isScriptValue(0)) if ((hpPer < 50) && npc.isScriptValue(0))
{ {
@@ -229,39 +249,75 @@ public class OctavisWarzone extends AbstractInstance
} }
case "END_STAGE_1": case "END_STAGE_1":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_A); playMovie(world, Movie.SC_OCTABIS_PHASECH_A);
getTimers().addTimer("START_STAGE_2", 12000, npc, null); getTimers().addTimer("START_STAGE_2", 12000, null, player);
break; break;
} }
case "START_STAGE_2": case "START_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_2": case "END_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_B); playMovie(world, Movie.SC_OCTABIS_PHASECH_B);
getTimers().addTimer("START_STAGE_3", 15000, npc, null); getTimers().addTimer("START_STAGE_3", 15000, null, player);
break; break;
} }
case "START_STAGE_3": case "START_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_3": case "END_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_ENDING); playMovie(world, Movie.SC_OCTABIS_ENDING);
getTimers().addTimer("USM_SCENE_TIMER", 40000, npc, null); getTimers().addTimer("USM_SCENE_TIMER", 40000, null, player);
break; break;
} }
case "USM_SCENE_TIMER": case "USM_SCENE_TIMER":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END); world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END);
break; break;
} }
case "GLADIATOR_START_SPAWN": case "GLADIATOR_START_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcVars = npc.getVariables();
final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1); final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1);
if (spawnIndex < 7) if (spawnIndex < 7)
{ {
@@ -280,6 +336,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "GLADIATOR_MOVING": case "GLADIATOR_MOVING":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcParams = npc.getParameters();
final int moveX = npcParams.getInt("Move_to_X", 0); final int moveX = npcParams.getInt("Move_to_X", 0);
final int moveY = npcParams.getInt("Move_to_Y", 0); final int moveY = npcParams.getInt("Move_to_Y", 0);
if ((moveX != 0) && (moveY != 0)) if ((moveX != 0) && (moveY != 0))
@@ -291,6 +353,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_MINIONS_SPAWN": case "BEASTS_MINIONS_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
for (int i = 0; i < getRandom(10); i++) for (int i = 0; i < getRandom(10); i++)
{ {
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId()); final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
@@ -337,7 +405,6 @@ public class OctavisWarzone extends AbstractInstance
} }
} }
} }
}
@Override @Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -423,7 +490,7 @@ public class OctavisWarzone extends AbstractInstance
beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16 beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16
beast.deleteMe(); beast.deleteMe();
}); });
getTimers().addTimer("END_STAGE_1", 1000, npc, null); getTimers().addTimer("END_STAGE_1", 1000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId()))
{ {
@@ -440,12 +507,12 @@ public class OctavisWarzone extends AbstractInstance
{ {
world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1")); world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1"));
} }
getTimers().addTimer("END_STAGE_2", 3000, npc, null); getTimers().addTimer("END_STAGE_2", 3000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId()))
{ {
world.finishInstance(); world.finishInstance();
getTimers().addTimer("END_STAGE_3", 2000, npc, null); getTimers().addTimer("END_STAGE_3", 2000, null, killer);
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -497,17 +564,17 @@ public class OctavisWarzone extends AbstractInstance
return super.onSpellFinished(npc, player, skill); return super.onSpellFinished(npc, player, skill);
} }
public void onCreatureSee(OnCreatureSee event) private void onCreatureSee(OnCreatureSee event)
{ {
final Creature creature = event.getSeen(); final Creature creature = event.getSeen();
final Npc npc = (Npc) event.getSeer(); final Npc npc = (Npc) event.getSeer();
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0)) if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0))
{ {
npc.setScriptValue(1);
world.openCloseDoor(MAIN_DOOR_1, true); world.openCloseDoor(MAIN_DOOR_1, true);
getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null); getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null);
getTimers().addTimer("CLOSE_DOORS", 60000, npc, null); getTimers().addTimer("CLOSE_DOORS", 60000, npc, null);
npc.setScriptValue(1);
} }
} }

View File

@@ -154,21 +154,25 @@ public class OctavisWarzone extends AbstractInstance
@Override @Override
public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player) public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player)
{ {
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
{
final StatSet npcVars = npc.getVariables();
final StatSet npcParams = npc.getParameters();
switch (event) switch (event)
{ {
case "SECOND_DOOR_OPEN": case "SECOND_DOOR_OPEN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, true); world.openCloseDoor(MAIN_DOOR_2, true);
break; break;
} }
case "CLOSE_DOORS": case "CLOSE_DOORS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_2, false);
world.openCloseDoor(MAIN_DOOR_1, false); world.openCloseDoor(MAIN_DOOR_1, false);
world.setParameter("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
@@ -179,6 +183,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "START_STAGE_1": case "START_STAGE_1":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_1"); world.spawnGroup("STAGE_1");
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
@@ -199,6 +208,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "FOLLOW_BEASTS": case "FOLLOW_BEASTS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
addMoveToDesire(npc, beasts.getLocation(), 23); addMoveToDesire(npc, beasts.getLocation(), 23);
@@ -208,6 +222,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_CHECK_HP": case "BEASTS_CHECK_HP":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final int hpPer = npc.getCurrentHpPercent(); final int hpPer = npc.getCurrentHpPercent();
if ((hpPer < 50) && npc.isScriptValue(0)) if ((hpPer < 50) && npc.isScriptValue(0))
{ {
@@ -229,39 +249,75 @@ public class OctavisWarzone extends AbstractInstance
} }
case "END_STAGE_1": case "END_STAGE_1":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_A); playMovie(world, Movie.SC_OCTABIS_PHASECH_A);
getTimers().addTimer("START_STAGE_2", 12000, npc, null); getTimers().addTimer("START_STAGE_2", 12000, null, player);
break; break;
} }
case "START_STAGE_2": case "START_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_2": case "END_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_B); playMovie(world, Movie.SC_OCTABIS_PHASECH_B);
getTimers().addTimer("START_STAGE_3", 15000, npc, null); getTimers().addTimer("START_STAGE_3", 15000, null, player);
break; break;
} }
case "START_STAGE_3": case "START_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_3": case "END_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_ENDING); playMovie(world, Movie.SC_OCTABIS_ENDING);
getTimers().addTimer("USM_SCENE_TIMER", 40000, npc, null); getTimers().addTimer("USM_SCENE_TIMER", 40000, null, player);
break; break;
} }
case "USM_SCENE_TIMER": case "USM_SCENE_TIMER":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END); world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END);
break; break;
} }
case "GLADIATOR_START_SPAWN": case "GLADIATOR_START_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcVars = npc.getVariables();
final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1); final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1);
if (spawnIndex < 7) if (spawnIndex < 7)
{ {
@@ -280,6 +336,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "GLADIATOR_MOVING": case "GLADIATOR_MOVING":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcParams = npc.getParameters();
final int moveX = npcParams.getInt("Move_to_X", 0); final int moveX = npcParams.getInt("Move_to_X", 0);
final int moveY = npcParams.getInt("Move_to_Y", 0); final int moveY = npcParams.getInt("Move_to_Y", 0);
if ((moveX != 0) && (moveY != 0)) if ((moveX != 0) && (moveY != 0))
@@ -291,6 +353,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_MINIONS_SPAWN": case "BEASTS_MINIONS_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
for (int i = 0; i < getRandom(10); i++) for (int i = 0; i < getRandom(10); i++)
{ {
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId()); final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
@@ -337,7 +405,6 @@ public class OctavisWarzone extends AbstractInstance
} }
} }
} }
}
@Override @Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -423,7 +490,7 @@ public class OctavisWarzone extends AbstractInstance
beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16 beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16
beast.deleteMe(); beast.deleteMe();
}); });
getTimers().addTimer("END_STAGE_1", 1000, npc, null); getTimers().addTimer("END_STAGE_1", 1000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId()))
{ {
@@ -440,12 +507,12 @@ public class OctavisWarzone extends AbstractInstance
{ {
world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1")); world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1"));
} }
getTimers().addTimer("END_STAGE_2", 3000, npc, null); getTimers().addTimer("END_STAGE_2", 3000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId()))
{ {
world.finishInstance(); world.finishInstance();
getTimers().addTimer("END_STAGE_3", 2000, npc, null); getTimers().addTimer("END_STAGE_3", 2000, null, killer);
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -497,17 +564,17 @@ public class OctavisWarzone extends AbstractInstance
return super.onSpellFinished(npc, player, skill); return super.onSpellFinished(npc, player, skill);
} }
public void onCreatureSee(OnCreatureSee event) private void onCreatureSee(OnCreatureSee event)
{ {
final Creature creature = event.getSeen(); final Creature creature = event.getSeen();
final Npc npc = (Npc) event.getSeer(); final Npc npc = (Npc) event.getSeer();
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0)) if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0))
{ {
npc.setScriptValue(1);
world.openCloseDoor(MAIN_DOOR_1, true); world.openCloseDoor(MAIN_DOOR_1, true);
getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null); getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null);
getTimers().addTimer("CLOSE_DOORS", 60000, npc, null); getTimers().addTimer("CLOSE_DOORS", 60000, npc, null);
npc.setScriptValue(1);
} }
} }

View File

@@ -154,21 +154,25 @@ public class OctavisWarzone extends AbstractInstance
@Override @Override
public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player) public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player)
{ {
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
{
final StatSet npcVars = npc.getVariables();
final StatSet npcParams = npc.getParameters();
switch (event) switch (event)
{ {
case "SECOND_DOOR_OPEN": case "SECOND_DOOR_OPEN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, true); world.openCloseDoor(MAIN_DOOR_2, true);
break; break;
} }
case "CLOSE_DOORS": case "CLOSE_DOORS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_2, false);
world.openCloseDoor(MAIN_DOOR_1, false); world.openCloseDoor(MAIN_DOOR_1, false);
world.setParameter("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
@@ -179,6 +183,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "START_STAGE_1": case "START_STAGE_1":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_1"); world.spawnGroup("STAGE_1");
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
@@ -199,6 +208,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "FOLLOW_BEASTS": case "FOLLOW_BEASTS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
addMoveToDesire(npc, beasts.getLocation(), 23); addMoveToDesire(npc, beasts.getLocation(), 23);
@@ -208,6 +222,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_CHECK_HP": case "BEASTS_CHECK_HP":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final int hpPer = npc.getCurrentHpPercent(); final int hpPer = npc.getCurrentHpPercent();
if ((hpPer < 50) && npc.isScriptValue(0)) if ((hpPer < 50) && npc.isScriptValue(0))
{ {
@@ -229,39 +249,75 @@ public class OctavisWarzone extends AbstractInstance
} }
case "END_STAGE_1": case "END_STAGE_1":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_A); playMovie(world, Movie.SC_OCTABIS_PHASECH_A);
getTimers().addTimer("START_STAGE_2", 12000, npc, null); getTimers().addTimer("START_STAGE_2", 12000, null, player);
break; break;
} }
case "START_STAGE_2": case "START_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_2": case "END_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_B); playMovie(world, Movie.SC_OCTABIS_PHASECH_B);
getTimers().addTimer("START_STAGE_3", 15000, npc, null); getTimers().addTimer("START_STAGE_3", 15000, null, player);
break; break;
} }
case "START_STAGE_3": case "START_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_3": case "END_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_ENDING); playMovie(world, Movie.SC_OCTABIS_ENDING);
getTimers().addTimer("USM_SCENE_TIMER", 40000, npc, null); getTimers().addTimer("USM_SCENE_TIMER", 40000, null, player);
break; break;
} }
case "USM_SCENE_TIMER": case "USM_SCENE_TIMER":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END); world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END);
break; break;
} }
case "GLADIATOR_START_SPAWN": case "GLADIATOR_START_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcVars = npc.getVariables();
final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1); final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1);
if (spawnIndex < 7) if (spawnIndex < 7)
{ {
@@ -280,6 +336,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "GLADIATOR_MOVING": case "GLADIATOR_MOVING":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcParams = npc.getParameters();
final int moveX = npcParams.getInt("Move_to_X", 0); final int moveX = npcParams.getInt("Move_to_X", 0);
final int moveY = npcParams.getInt("Move_to_Y", 0); final int moveY = npcParams.getInt("Move_to_Y", 0);
if ((moveX != 0) && (moveY != 0)) if ((moveX != 0) && (moveY != 0))
@@ -291,6 +353,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_MINIONS_SPAWN": case "BEASTS_MINIONS_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
for (int i = 0; i < getRandom(10); i++) for (int i = 0; i < getRandom(10); i++)
{ {
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId()); final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
@@ -337,7 +405,6 @@ public class OctavisWarzone extends AbstractInstance
} }
} }
} }
}
@Override @Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -423,7 +490,7 @@ public class OctavisWarzone extends AbstractInstance
beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16 beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16
beast.deleteMe(); beast.deleteMe();
}); });
getTimers().addTimer("END_STAGE_1", 1000, npc, null); getTimers().addTimer("END_STAGE_1", 1000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId()))
{ {
@@ -440,12 +507,12 @@ public class OctavisWarzone extends AbstractInstance
{ {
world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1")); world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1"));
} }
getTimers().addTimer("END_STAGE_2", 3000, npc, null); getTimers().addTimer("END_STAGE_2", 3000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId()))
{ {
world.finishInstance(); world.finishInstance();
getTimers().addTimer("END_STAGE_3", 2000, npc, null); getTimers().addTimer("END_STAGE_3", 2000, null, killer);
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -497,17 +564,17 @@ public class OctavisWarzone extends AbstractInstance
return super.onSpellFinished(npc, player, skill); return super.onSpellFinished(npc, player, skill);
} }
public void onCreatureSee(OnCreatureSee event) private void onCreatureSee(OnCreatureSee event)
{ {
final Creature creature = event.getSeen(); final Creature creature = event.getSeen();
final Npc npc = (Npc) event.getSeer(); final Npc npc = (Npc) event.getSeer();
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0)) if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0))
{ {
npc.setScriptValue(1);
world.openCloseDoor(MAIN_DOOR_1, true); world.openCloseDoor(MAIN_DOOR_1, true);
getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null); getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null);
getTimers().addTimer("CLOSE_DOORS", 60000, npc, null); getTimers().addTimer("CLOSE_DOORS", 60000, npc, null);
npc.setScriptValue(1);
} }
} }

View File

@@ -154,21 +154,25 @@ public class OctavisWarzone extends AbstractInstance
@Override @Override
public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player) public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player)
{ {
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
{
final StatSet npcVars = npc.getVariables();
final StatSet npcParams = npc.getParameters();
switch (event) switch (event)
{ {
case "SECOND_DOOR_OPEN": case "SECOND_DOOR_OPEN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, true); world.openCloseDoor(MAIN_DOOR_2, true);
break; break;
} }
case "CLOSE_DOORS": case "CLOSE_DOORS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_2, false);
world.openCloseDoor(MAIN_DOOR_1, false); world.openCloseDoor(MAIN_DOOR_1, false);
world.setParameter("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
@@ -179,6 +183,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "START_STAGE_1": case "START_STAGE_1":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_1"); world.spawnGroup("STAGE_1");
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
@@ -199,6 +208,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "FOLLOW_BEASTS": case "FOLLOW_BEASTS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
addMoveToDesire(npc, beasts.getLocation(), 23); addMoveToDesire(npc, beasts.getLocation(), 23);
@@ -208,6 +222,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_CHECK_HP": case "BEASTS_CHECK_HP":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final int hpPer = npc.getCurrentHpPercent(); final int hpPer = npc.getCurrentHpPercent();
if ((hpPer < 50) && npc.isScriptValue(0)) if ((hpPer < 50) && npc.isScriptValue(0))
{ {
@@ -229,39 +249,75 @@ public class OctavisWarzone extends AbstractInstance
} }
case "END_STAGE_1": case "END_STAGE_1":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_A); playMovie(world, Movie.SC_OCTABIS_PHASECH_A);
getTimers().addTimer("START_STAGE_2", 12000, npc, null); getTimers().addTimer("START_STAGE_2", 12000, null, player);
break; break;
} }
case "START_STAGE_2": case "START_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_2": case "END_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_B); playMovie(world, Movie.SC_OCTABIS_PHASECH_B);
getTimers().addTimer("START_STAGE_3", 15000, npc, null); getTimers().addTimer("START_STAGE_3", 15000, null, player);
break; break;
} }
case "START_STAGE_3": case "START_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_3": case "END_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_ENDING); playMovie(world, Movie.SC_OCTABIS_ENDING);
getTimers().addTimer("USM_SCENE_TIMER", 40000, npc, null); getTimers().addTimer("USM_SCENE_TIMER", 40000, null, player);
break; break;
} }
case "USM_SCENE_TIMER": case "USM_SCENE_TIMER":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END); world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END);
break; break;
} }
case "GLADIATOR_START_SPAWN": case "GLADIATOR_START_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcVars = npc.getVariables();
final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1); final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1);
if (spawnIndex < 7) if (spawnIndex < 7)
{ {
@@ -280,6 +336,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "GLADIATOR_MOVING": case "GLADIATOR_MOVING":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcParams = npc.getParameters();
final int moveX = npcParams.getInt("Move_to_X", 0); final int moveX = npcParams.getInt("Move_to_X", 0);
final int moveY = npcParams.getInt("Move_to_Y", 0); final int moveY = npcParams.getInt("Move_to_Y", 0);
if ((moveX != 0) && (moveY != 0)) if ((moveX != 0) && (moveY != 0))
@@ -291,6 +353,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_MINIONS_SPAWN": case "BEASTS_MINIONS_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
for (int i = 0; i < getRandom(10); i++) for (int i = 0; i < getRandom(10); i++)
{ {
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId()); final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
@@ -337,7 +405,6 @@ public class OctavisWarzone extends AbstractInstance
} }
} }
} }
}
@Override @Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -423,7 +490,7 @@ public class OctavisWarzone extends AbstractInstance
beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16 beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16
beast.deleteMe(); beast.deleteMe();
}); });
getTimers().addTimer("END_STAGE_1", 1000, npc, null); getTimers().addTimer("END_STAGE_1", 1000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId()))
{ {
@@ -440,12 +507,12 @@ public class OctavisWarzone extends AbstractInstance
{ {
world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1")); world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1"));
} }
getTimers().addTimer("END_STAGE_2", 3000, npc, null); getTimers().addTimer("END_STAGE_2", 3000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId()))
{ {
world.finishInstance(); world.finishInstance();
getTimers().addTimer("END_STAGE_3", 2000, npc, null); getTimers().addTimer("END_STAGE_3", 2000, null, killer);
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -497,17 +564,17 @@ public class OctavisWarzone extends AbstractInstance
return super.onSpellFinished(npc, player, skill); return super.onSpellFinished(npc, player, skill);
} }
public void onCreatureSee(OnCreatureSee event) private void onCreatureSee(OnCreatureSee event)
{ {
final Creature creature = event.getSeen(); final Creature creature = event.getSeen();
final Npc npc = (Npc) event.getSeer(); final Npc npc = (Npc) event.getSeer();
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0)) if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0))
{ {
npc.setScriptValue(1);
world.openCloseDoor(MAIN_DOOR_1, true); world.openCloseDoor(MAIN_DOOR_1, true);
getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null); getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null);
getTimers().addTimer("CLOSE_DOORS", 60000, npc, null); getTimers().addTimer("CLOSE_DOORS", 60000, npc, null);
npc.setScriptValue(1);
} }
} }

View File

@@ -154,21 +154,25 @@ public class OctavisWarzone extends AbstractInstance
@Override @Override
public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player) public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player)
{ {
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
{
final StatSet npcVars = npc.getVariables();
final StatSet npcParams = npc.getParameters();
switch (event) switch (event)
{ {
case "SECOND_DOOR_OPEN": case "SECOND_DOOR_OPEN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, true); world.openCloseDoor(MAIN_DOOR_2, true);
break; break;
} }
case "CLOSE_DOORS": case "CLOSE_DOORS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_2, false);
world.openCloseDoor(MAIN_DOOR_1, false); world.openCloseDoor(MAIN_DOOR_1, false);
world.setParameter("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
@@ -179,6 +183,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "START_STAGE_1": case "START_STAGE_1":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_1"); world.spawnGroup("STAGE_1");
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
@@ -199,6 +208,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "FOLLOW_BEASTS": case "FOLLOW_BEASTS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
addMoveToDesire(npc, beasts.getLocation(), 23); addMoveToDesire(npc, beasts.getLocation(), 23);
@@ -208,6 +222,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_CHECK_HP": case "BEASTS_CHECK_HP":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final int hpPer = npc.getCurrentHpPercent(); final int hpPer = npc.getCurrentHpPercent();
if ((hpPer < 50) && npc.isScriptValue(0)) if ((hpPer < 50) && npc.isScriptValue(0))
{ {
@@ -229,39 +249,75 @@ public class OctavisWarzone extends AbstractInstance
} }
case "END_STAGE_1": case "END_STAGE_1":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_A); playMovie(world, Movie.SC_OCTABIS_PHASECH_A);
getTimers().addTimer("START_STAGE_2", 12000, npc, null); getTimers().addTimer("START_STAGE_2", 12000, null, player);
break; break;
} }
case "START_STAGE_2": case "START_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_2": case "END_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_B); playMovie(world, Movie.SC_OCTABIS_PHASECH_B);
getTimers().addTimer("START_STAGE_3", 15000, npc, null); getTimers().addTimer("START_STAGE_3", 15000, null, player);
break; break;
} }
case "START_STAGE_3": case "START_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_3": case "END_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_ENDING); playMovie(world, Movie.SC_OCTABIS_ENDING);
getTimers().addTimer("USM_SCENE_TIMER", 40000, npc, null); getTimers().addTimer("USM_SCENE_TIMER", 40000, null, player);
break; break;
} }
case "USM_SCENE_TIMER": case "USM_SCENE_TIMER":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END); world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END);
break; break;
} }
case "GLADIATOR_START_SPAWN": case "GLADIATOR_START_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcVars = npc.getVariables();
final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1); final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1);
if (spawnIndex < 7) if (spawnIndex < 7)
{ {
@@ -280,6 +336,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "GLADIATOR_MOVING": case "GLADIATOR_MOVING":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcParams = npc.getParameters();
final int moveX = npcParams.getInt("Move_to_X", 0); final int moveX = npcParams.getInt("Move_to_X", 0);
final int moveY = npcParams.getInt("Move_to_Y", 0); final int moveY = npcParams.getInt("Move_to_Y", 0);
if ((moveX != 0) && (moveY != 0)) if ((moveX != 0) && (moveY != 0))
@@ -291,6 +353,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_MINIONS_SPAWN": case "BEASTS_MINIONS_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
for (int i = 0; i < getRandom(10); i++) for (int i = 0; i < getRandom(10); i++)
{ {
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId()); final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
@@ -337,7 +405,6 @@ public class OctavisWarzone extends AbstractInstance
} }
} }
} }
}
@Override @Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -423,7 +490,7 @@ public class OctavisWarzone extends AbstractInstance
beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16 beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16
beast.deleteMe(); beast.deleteMe();
}); });
getTimers().addTimer("END_STAGE_1", 1000, npc, null); getTimers().addTimer("END_STAGE_1", 1000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId()))
{ {
@@ -440,12 +507,12 @@ public class OctavisWarzone extends AbstractInstance
{ {
world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1")); world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1"));
} }
getTimers().addTimer("END_STAGE_2", 3000, npc, null); getTimers().addTimer("END_STAGE_2", 3000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId()))
{ {
world.finishInstance(); world.finishInstance();
getTimers().addTimer("END_STAGE_3", 2000, npc, null); getTimers().addTimer("END_STAGE_3", 2000, null, killer);
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -497,17 +564,17 @@ public class OctavisWarzone extends AbstractInstance
return super.onSpellFinished(npc, player, skill); return super.onSpellFinished(npc, player, skill);
} }
public void onCreatureSee(OnCreatureSee event) private void onCreatureSee(OnCreatureSee event)
{ {
final Creature creature = event.getSeen(); final Creature creature = event.getSeen();
final Npc npc = (Npc) event.getSeer(); final Npc npc = (Npc) event.getSeer();
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0)) if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0))
{ {
npc.setScriptValue(1);
world.openCloseDoor(MAIN_DOOR_1, true); world.openCloseDoor(MAIN_DOOR_1, true);
getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null); getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null);
getTimers().addTimer("CLOSE_DOORS", 60000, npc, null); getTimers().addTimer("CLOSE_DOORS", 60000, npc, null);
npc.setScriptValue(1);
} }
} }

View File

@@ -154,21 +154,25 @@ public class OctavisWarzone extends AbstractInstance
@Override @Override
public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player) public void onTimerEvent(String event, StatSet params, Npc npc, PlayerInstance player)
{ {
final Instance world = npc.getInstanceWorld();
if (isInInstance(world))
{
final StatSet npcVars = npc.getVariables();
final StatSet npcParams = npc.getParameters();
switch (event) switch (event)
{ {
case "SECOND_DOOR_OPEN": case "SECOND_DOOR_OPEN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, true); world.openCloseDoor(MAIN_DOOR_2, true);
break; break;
} }
case "CLOSE_DOORS": case "CLOSE_DOORS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_2, false);
world.openCloseDoor(MAIN_DOOR_1, false); world.openCloseDoor(MAIN_DOOR_1, false);
world.setParameter("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
@@ -179,6 +183,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "START_STAGE_1": case "START_STAGE_1":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_1"); world.spawnGroup("STAGE_1");
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
@@ -199,6 +208,11 @@ public class OctavisWarzone extends AbstractInstance
} }
case "FOLLOW_BEASTS": case "FOLLOW_BEASTS":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.getAliveNpcs(BEASTS).forEach(beasts -> world.getAliveNpcs(BEASTS).forEach(beasts ->
{ {
addMoveToDesire(npc, beasts.getLocation(), 23); addMoveToDesire(npc, beasts.getLocation(), 23);
@@ -208,6 +222,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_CHECK_HP": case "BEASTS_CHECK_HP":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final int hpPer = npc.getCurrentHpPercent(); final int hpPer = npc.getCurrentHpPercent();
if ((hpPer < 50) && npc.isScriptValue(0)) if ((hpPer < 50) && npc.isScriptValue(0))
{ {
@@ -229,39 +249,75 @@ public class OctavisWarzone extends AbstractInstance
} }
case "END_STAGE_1": case "END_STAGE_1":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_A); playMovie(world, Movie.SC_OCTABIS_PHASECH_A);
getTimers().addTimer("START_STAGE_2", 12000, npc, null); getTimers().addTimer("START_STAGE_2", 12000, null, player);
break; break;
} }
case "START_STAGE_2": case "START_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_2").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_2": case "END_STAGE_2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_PHASECH_B); playMovie(world, Movie.SC_OCTABIS_PHASECH_B);
getTimers().addTimer("START_STAGE_3", 15000, npc, null); getTimers().addTimer("START_STAGE_3", 15000, null, player);
break; break;
} }
case "START_STAGE_3": case "START_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false)); world.spawnGroup("STAGE_3").forEach(octavis -> ((Attackable) octavis).setCanReturnToSpawnPoint(false));
break; break;
} }
case "END_STAGE_3": case "END_STAGE_3":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
playMovie(world, Movie.SC_OCTABIS_ENDING); playMovie(world, Movie.SC_OCTABIS_ENDING);
getTimers().addTimer("USM_SCENE_TIMER", 40000, npc, null); getTimers().addTimer("USM_SCENE_TIMER", 40000, null, player);
break; break;
} }
case "USM_SCENE_TIMER": case "USM_SCENE_TIMER":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END); world.broadcastPacket(ExShowUsm.OCTAVIS_INSTANCE_END);
break; break;
} }
case "GLADIATOR_START_SPAWN": case "GLADIATOR_START_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcVars = npc.getVariables();
final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1); final int spawnIndex = npcVars.getInt("SPAWN_INDEX", 1);
if (spawnIndex < 7) if (spawnIndex < 7)
{ {
@@ -280,6 +336,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "GLADIATOR_MOVING": case "GLADIATOR_MOVING":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
final StatSet npcParams = npc.getParameters();
final int moveX = npcParams.getInt("Move_to_X", 0); final int moveX = npcParams.getInt("Move_to_X", 0);
final int moveY = npcParams.getInt("Move_to_Y", 0); final int moveY = npcParams.getInt("Move_to_Y", 0);
if ((moveX != 0) && (moveY != 0)) if ((moveX != 0) && (moveY != 0))
@@ -291,6 +353,12 @@ public class OctavisWarzone extends AbstractInstance
} }
case "BEASTS_MINIONS_SPAWN": case "BEASTS_MINIONS_SPAWN":
{ {
final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return;
}
for (int i = 0; i < getRandom(10); i++) for (int i = 0; i < getRandom(10); i++)
{ {
final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId()); final Npc beast = addSpawn((!isExtremeMode(world) ? BEASTS_MINIONS[0] : BEASTS_MINIONS[1]), getRandomEntry(BEASTS_MINIONS_LOC), false, 0, false, world.getId());
@@ -337,7 +405,6 @@ public class OctavisWarzone extends AbstractInstance
} }
} }
} }
}
@Override @Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon) public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
@@ -423,7 +490,7 @@ public class OctavisWarzone extends AbstractInstance
beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16 beast.teleToLocation(new Location(-113360, -244676, -15536)); // Don't even ask, it's pure hack. - St3eT 2k16
beast.deleteMe(); beast.deleteMe();
}); });
getTimers().addTimer("END_STAGE_1", 1000, npc, null); getTimers().addTimer("END_STAGE_1", 1000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_2, npc.getId()))
{ {
@@ -440,12 +507,12 @@ public class OctavisWarzone extends AbstractInstance
{ {
world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1")); world.despawnGroup(isExtremeMode(world) ? ("magmeld4_2621_gro" + i + "m1") : ("magmeld4_2621_gmo" + i + "m1"));
} }
getTimers().addTimer("END_STAGE_2", 3000, npc, null); getTimers().addTimer("END_STAGE_2", 3000, null, killer);
} }
else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId())) else if (CommonUtil.contains(OCTAVIS_STAGE_3, npc.getId()))
{ {
world.finishInstance(); world.finishInstance();
getTimers().addTimer("END_STAGE_3", 2000, npc, null); getTimers().addTimer("END_STAGE_3", 2000, null, killer);
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -497,17 +564,17 @@ public class OctavisWarzone extends AbstractInstance
return super.onSpellFinished(npc, player, skill); return super.onSpellFinished(npc, player, skill);
} }
public void onCreatureSee(OnCreatureSee event) private void onCreatureSee(OnCreatureSee event)
{ {
final Creature creature = event.getSeen(); final Creature creature = event.getSeen();
final Npc npc = (Npc) event.getSeer(); final Npc npc = (Npc) event.getSeer();
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0)) if (isInInstance(world) && creature.isPlayer() && npc.isScriptValue(0))
{ {
npc.setScriptValue(1);
world.openCloseDoor(MAIN_DOOR_1, true); world.openCloseDoor(MAIN_DOOR_1, true);
getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null); getTimers().addTimer("SECOND_DOOR_OPEN", 3000, npc, null);
getTimers().addTimer("CLOSE_DOORS", 60000, npc, null); getTimers().addTimer("CLOSE_DOORS", 60000, npc, null);
npc.setScriptValue(1);
} }
} }