Instance related adjustments.

This commit is contained in:
MobiusDevelopment
2020-02-26 10:56:19 +00:00
parent 740acfdbd8
commit a6fc6eb2cd
81 changed files with 7566 additions and 6403 deletions

View File

@@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
cancelQuestTimers("attack"); cancelQuestTimer("attack", npc, null);
cancelQuestTimers("random_Target"); cancelQuestTimer("random_Target", npc, null);
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }

View File

@@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance
{ {
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.getParameters().set("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
npc.teleToLocation(BATTLE_LOC); npc.teleToLocation(BATTLE_LOC);
playMovie(world, Movie.SC_OCTABIS_OPENING); playMovie(world, Movie.SC_OCTABIS_OPENING);
getTimers().addTimer("START_STAGE_1", 26500, npc, null); getTimers().addTimer("START_STAGE_1", 26500, npc, null);

View File

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

View File

@@ -73,27 +73,6 @@ public class ChamberOfProphecies extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
if (event.equals("enterInstance"))
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
}
else if (player != null)
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (event) switch (event)
{ {
case "31639-01.html": case "31639-01.html":
@@ -106,6 +85,11 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33996-02.html": case "33996-02.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(ExShowUsm.USM_Q015_E); world.broadcastPacket(ExShowUsm.USM_Q015_E);
world.despawnGroup("q10753_16_instance_grail"); world.despawnGroup("q10753_16_instance_grail");
world.spawnGroup("q10753_16_instance_wizard"); world.spawnGroup("q10753_16_instance_wizard");
@@ -128,14 +112,53 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33980-05.html": case "33980-05.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup("q10753_16_instance_halter_2"); world.spawnGroup("q10753_16_instance_halter_2");
world.setStatus(6); world.setStatus(6);
startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); startQuestTimer("DESPAWN_WIZARD", 2000, npc, player);
htmltext = event; htmltext = event;
break; break;
} }
case "enterInstance":
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
break;
}
case "teleport":
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimer("CHECK_STATUS", npc, player);
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "status": case "status":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.isStatus(0)) if (world.isStatus(0))
{ {
htmltext = "31639-01.html"; htmltext = "31639-01.html";
@@ -144,18 +167,13 @@ public class ChamberOfProphecies extends AbstractInstance
htmltext = "31639-02.html"; htmltext = "31639-02.html";
break; break;
} }
case "teleport":
{
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimers("CHECK_STATUS");
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "CHECK_STATUS": case "CHECK_STATUS":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (world.getStatus()) switch (world.getStatus())
{ {
case 0: case 0:
@@ -223,6 +241,11 @@ public class ChamberOfProphecies extends AbstractInstance
case "ATTACK1": case "ATTACK1":
case "ATTACK2": case "ATTACK2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
npc.setRunning(); npc.setRunning();
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
@@ -242,7 +265,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR1": case "OPEN_DOOR1":
{ {
cancelQuestTimers("ATTACK"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK", npc, player);
world.setStatus(1); world.setStatus(1);
world.openCloseDoor(DOOR_2, true); world.openCloseDoor(DOOR_2, true);
world.spawnGroup("wof_room2"); world.spawnGroup("wof_room2");
@@ -250,7 +278,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR2": case "OPEN_DOOR2":
{ {
cancelQuestTimers("ATTACK1"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK1", npc, player);
startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true);
world.setStatus(3); world.setStatus(3);
world.spawnGroup("wof_room3"); world.spawnGroup("wof_room3");
@@ -337,23 +370,33 @@ public class ChamberOfProphecies extends AbstractInstance
if (npc.getId() == FERIN) if (npc.getId() == FERIN)
{ {
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player);
cancelQuestTimers("BROADCAST_TEXT"); cancelQuestTimer("BROADCAST_TEXT", npc, player);
} }
break; break;
} }
case "SEY_KAIN_4": case "SEY_KAIN_4":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(5); world.setStatus(5);
world.spawnGroup("q10753_16_instance_grail"); world.spawnGroup("q10753_16_instance_grail");
showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000);
world.openCloseDoor(DOOR_4, true); world.openCloseDoor(DOOR_4, true);
cancelQuestTimers("ATTACK2"); cancelQuestTimer("ATTACK2", npc, player);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player);
startQuestTimer("CLOSE", 15000, null, player); startQuestTimer("CLOSE", 15000, null, player);
break; break;
} }
case "CLOSE": case "CLOSE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
final Npc grail = world.getNpc(GRAIL); final Npc grail = world.getNpc(GRAIL);
if ((grail != null) && (player.calculateDistance2D(grail) < 390)) if ((grail != null) && (player.calculateDistance2D(grail) < 390))
{ {
@@ -369,13 +412,18 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "DESPAWN_WIZARD": case "DESPAWN_WIZARD":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.despawnGroup("q10753_16_instance_wizard"); world.despawnGroup("q10753_16_instance_wizard");
break; break;
} }
case "exit": case "exit":
{ {
startQuestTimer("finish", 3000, npc, player); startQuestTimer("finish", 3000, npc, player);
player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt((int) 1.0D)); player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt(1));
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null) if (qs != null)
{ {
@@ -385,11 +433,15 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "finish": case "finish":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.finishInstance(0); world.finishInstance(0);
break; break;
} }
} }
}
return htmltext; return htmltext;
} }

View File

@@ -17,10 +17,8 @@
package instances.DimensionalWrap; package instances.DimensionalWrap;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.CategoryType; import org.l2jmobius.gameserver.enums.CategoryType;
@@ -44,7 +42,7 @@ import instances.AbstractInstance;
* Dimensional Wrap instance * Dimensional Wrap instance
* @URL https://l2wiki.com/Dimensional_Warp * @URL https://l2wiki.com/Dimensional_Warp
* @Video https://www.youtube.com/watch?v=hOnzk0ELwIg * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg
* @author Gigi * @author Gigi, Mobius
* @date 2018-09-04 - [14:33:31] * @date 2018-09-04 - [14:33:31]
*/ */
public class DimensionalWrap extends AbstractInstance public class DimensionalWrap extends AbstractInstance
@@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance
23480, // Abyssal Harpy 23480, // Abyssal Harpy
23481, // Abyssal Binder 23481, // Abyssal Binder
23482, // Abyssal Archon 23482, // Abyssal Archon
23483 // Abyssal Golem 23483, // Abyssal Golem
}; };
private static final int[] TRAPS = private static final int[] TRAPS =
{ {
@@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance
19559, // Damage trap, power 1 19559, // Damage trap, power 1
19560, // Damage trap, power 2 19560, // Damage trap, power 2
19561, // Damage trap, power 3 19561, // Damage trap, power 3
19562 // Heal Trap 19562, // Heal Trap
}; };
// Location // Location
private static final Location TELEPORTS = new Location(-76136, -216216, 4040); private static final Location TELEPORTS = new Location(-76136, -216216, 4040);
private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360); private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360);
private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584); private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584);
private static final Location THRID_TELEPORT = new Location(-219813, 248484, 9928); private static final Location THIRD_TELEPORT = new Location(-219813, 248484, 9928);
private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984); private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984);
// Misc // Misc
private static final int TEMPLATE_ID = 250; private static final int TEMPLATE_ID = 250;
private static final int DIMENSIONAL_DARK_FORCES = 16415; private static final int DIMENSIONAL_DARK_FORCES = 16415;
private static final int WARP_CRYSTAL = 39597; private static final int WARP_CRYSTAL = 39597;
protected double _chance = 0;
protected int _count = 0;
public int _skilllevel = 1;
public int _worldState = 0;
protected ScheduledFuture<?> _debufTask;
public DimensionalWrap() public DimensionalWrap()
{ {
@@ -125,8 +118,10 @@ public class DimensionalWrap extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
final Instance world = npc.getInstanceWorld();
if (event.equals("enterInstance")) switch (event)
{
case "enterInstance":
{ {
if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{ {
@@ -155,11 +150,8 @@ public class DimensionalWrap extends AbstractInstance
} }
} }
} }
break;
} }
if (isInInstance(world))
{
switch (event)
{
case "33975-01.html": case "33975-01.html":
{ {
htmltext = event; htmltext = event;
@@ -167,10 +159,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "12_warp_crystals": case "12_warp_crystals":
{ {
_chance = 0.3; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.3);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 12; world.setParameter("count", 12);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -183,19 +181,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 6; world.setParameter("count", 6);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 4; world.setParameter("count", 4);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 3; world.setParameter("count", 3);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -204,10 +202,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "240_warp_crystals": case "240_warp_crystals":
{ {
_chance = 0.6; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.6);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 240; world.setParameter("count", 240);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -220,19 +224,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 120; world.setParameter("count", 120);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 80; world.setParameter("count", 80);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 60; world.setParameter("count", 60);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -241,10 +245,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "1200_warp_crystals": case "1200_warp_crystals":
{ {
_chance = 0.9; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.9);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 1200; world.setParameter("count", 1200);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -257,19 +267,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 600; world.setParameter("count", 600);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 400; world.setParameter("count", 400);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 300; world.setParameter("count", 300);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -278,7 +288,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_6_f": case "send_6_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -299,9 +315,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 5) if (world.getStatus() < 5)
{ {
world.setStatus(5); world.setStatus(5);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -311,7 +327,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_11_f": case "send_11_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -321,6 +343,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -331,9 +354,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 10) if (world.getStatus() < 10)
{ {
world.setStatus(10); world.setStatus(10);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -343,7 +366,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_16_f": case "send_16_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -353,6 +382,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -363,19 +393,25 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 15) if (world.getStatus() < 15)
{ {
world.setStatus(15); world.setStatus(15);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId());
} }
break; break;
} }
case "send_21_f": case "send_21_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -385,6 +421,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -395,9 +432,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 20) if (world.getStatus() < 20)
{ {
world.setStatus(20); world.setStatus(20);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -407,7 +444,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_26_f": case "send_26_f":
{ {
if (_worldState == 0) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -417,6 +460,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -427,9 +471,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 25) if (world.getStatus() < 25)
{ {
world.setStatus(25); world.setStatus(25);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -439,15 +483,25 @@ public class DimensionalWrap extends AbstractInstance
} }
case "jump_location": case "jump_location":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
player.teleToLocation(TELEPORTS, world.getTemplateId()); player.teleToLocation(TELEPORTS, world.getTemplateId());
break; break;
} }
case "SALAMANDRA_SPAWN": case "SALAMANDRA_SPAWN":
case "SALAMANDRA_SPAWN_DUMMY": case "SALAMANDRA_SPAWN_DUMMY":
{ {
if (getRandom(100) < (_worldState / 2)) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{ {
final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); return null;
}
if (getRandom(100) < (world.getParameters().getInt("worldState", 0) / 2))
{
final Npc salamandra = addSpawn(world.getParameters().getInt("worldState", 0) < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId());
salamandra.setRunning(); salamandra.setRunning();
World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p ->
{ {
@@ -461,36 +515,57 @@ public class DimensionalWrap extends AbstractInstance
} }
case "START_STAGE": case "START_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(world.getStatus() + 1); world.setStatus(world.getStatus() + 1);
_worldState = world.getStatus(); world.setParameter("worldState", world.getStatus());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus())));
startQuestTimer("FIRST_SPAWN", 1500, npc, null); startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer());
break; break;
} }
case "FIRST_SPAWN": case "FIRST_SPAWN":
{ {
world.spawnGroup(_worldState + "_first_spawn"); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("SECOND_SPAWN", 40000, npc, null);
_debufTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if ((_worldState > 0) && (_worldState <= 11)) return null;
{
_skilllevel = 1;
} }
else if ((_worldState > 11) && (_worldState <= 20)) final int worldState = world.getParameters().getInt("worldState", 0);
{ world.spawnGroup(worldState + "_first_spawn");
_skilllevel = 2; world.spawnGroup(worldState + "_trap_spawn");
startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer());
startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true);
break;
} }
else if ((_worldState > 20) && (_worldState <= 30)) case "DEBUFF_TASK":
{ {
_skilllevel = 3; final Instance world = player.getInstanceWorld();
} if (!isInInstance(world))
else if (_worldState > 30)
{ {
_skilllevel = 4; return null;
} }
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, _skilllevel); int skilllevel = 1;
final int worldState = world.getParameters().getInt("worldState", 0);
if ((worldState > 0) && (worldState <= 11))
{
skilllevel = 1;
}
else if ((worldState > 11) && (worldState <= 20))
{
skilllevel = 2;
}
else if ((worldState > 20) && (worldState <= 30))
{
skilllevel = 3;
}
else if (worldState > 30)
{
skilllevel = 4;
}
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, skilllevel);
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if ((p != null) && !p.isDead()) if ((p != null) && !p.isDead())
@@ -498,47 +573,71 @@ public class DimensionalWrap extends AbstractInstance
skill.applyEffects(p, p); skill.applyEffects(p, p);
} }
} }
}, 5000, 10000);
break; break;
} }
case "SECOND_SPAWN": case "SECOND_SPAWN":
{ {
world.spawnGroup(_worldState + "_second_spawn"); final Instance world = player.getInstanceWorld();
startQuestTimer("THRID_SPAWN", 40000, npc, null); if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn");
startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer());
break; break;
} }
case "THRID_SPAWN": case "THIRD_SPAWN":
{ {
world.spawnGroup(_worldState + "_thred_spawn"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn");
break; break;
} }
case "CHANGE_LOCATION": case "CHANGE_LOCATION":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe);
world.spawnGroup(_worldState + "_trap_spawn"); world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_trap_spawn");
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1430), null, world.getFirstPlayer());
break; break;
} }
case "SWITCH_STAGE": case "SWITCH_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getAliveNpcs(MONSTERS).isEmpty()) if (world.getAliveNpcs(MONSTERS).isEmpty())
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true));
world.broadcastPacket(new Earthquake(npc, 50, 5)); world.broadcastPacket(new Earthquake(npc, 50, 5));
world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true);
clean(); clean(world.getFirstPlayer());
if (_worldState < 35) if (world.getParameters().getInt("worldState", 0) < 35)
{ {
startQuestTimer("NEXT_STAGE", 5000, npc, null); startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer());
} }
} }
break; break;
} }
case "NEXT_STAGE": case "NEXT_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180)));
world.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); world.setDuration((int) ((world.getRemainingTime() / 60000) + 3));
startQuestTimer("START_STAGE", 8000, npc, null); startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer());
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -549,7 +648,6 @@ public class DimensionalWrap extends AbstractInstance
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world)) if (isInInstance(world))
{ {
if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < _chance)) if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < world.getParameters().getDouble("chance", 0)))
{ {
if (_worldState < 9) final int worldState = world.getParameters().getInt("worldState", 0);
if (worldState < 9)
{ {
addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId()); addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if ((_worldState >= 9) && (_worldState < 20)) else if ((worldState >= 9) && (worldState < 20))
{ {
addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId()); addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if (_worldState >= 20) else if (worldState >= 20)
{ {
addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId()); addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
@@ -581,7 +680,7 @@ public class DimensionalWrap extends AbstractInstance
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true));
world.finishInstance(3); world.finishInstance(3);
clean(); clean(world.getFirstPlayer());
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance
@Override @Override
public String onFirstTalk(Npc npc, PlayerInstance player) public String onFirstTalk(Npc npc, PlayerInstance player)
{ {
if (_worldState == 20) final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (world.getParameters().getInt("worldState", 0) == 20))
{ {
return "33975-04.html"; return "33975-04.html";
} }
@@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance
{ {
case SALAMANDRA_GENERATOR: case SALAMANDRA_GENERATOR:
{ {
startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true);
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer());
break; break;
} }
case SALAMANDRA_GENERATOR_DUMMY: case SALAMANDRA_GENERATOR_DUMMY:
{ {
startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true);
break; break;
} }
case DEMINSIONAL_INVISIBLE_FRAGMENT: case DEMINSIONAL_INVISIBLE_FRAGMENT:
{ {
startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true);
break; break;
} }
} }
@@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance
boolean canStart = true; boolean canStart = true;
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < _count) if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < world.getParameters().getInt("count", 0))
{ {
for (PlayerInstance ps : world.getPlayers()) for (PlayerInstance ps : world.getPlayers())
{ {
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
packet.setHtml(getHtm(ps, "33975-03.html")); packet.setHtml(getHtm(ps, "33975-03.html"));
packet.replace("%count%", Integer.toString(_count)); packet.replace("%count%", Integer.toString(world.getParameters().getInt("count", 0)));
ps.sendPacket(packet); ps.sendPacket(packet);
ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName()));
canStart = false; canStart = false;
} }
} }
} }
if (!canStart || (_worldState != 0)) if (!canStart || (world.getParameters().getInt("worldState", 0) != 0))
{ {
return; return;
} }
startQuestTimer("START_STAGE", 1000, npc, null); startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer());
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
takeItems(p, WARP_CRYSTAL, _count); takeItems(p, WARP_CRYSTAL, world.getParameters().getInt("count", 0));
} }
} }
protected void clean() protected void clean(PlayerInstance player)
{ {
cancelQuestTimers("SWITCH_STAGE"); cancelQuestTimer("SWITCH_STAGE", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN"); cancelQuestTimer("SALAMANDRA_SPAWN", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player);
cancelQuestTimers("CHANGE_LOCATION"); cancelQuestTimer("CHANGE_LOCATION", null, player);
if (_debufTask != null) cancelQuestTimer("DEBUFF_TASK", null, player);
{
_debufTask.cancel(false);
_debufTask = null;
}
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -34,7 +34,7 @@ import instances.AbstractInstance;
* Nornils Garden Instance * Nornils Garden Instance
* @URL https://l2wiki.com/Nornils_Garden * @URL https://l2wiki.com/Nornils_Garden
* @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs
* @author Gigi * @author Gigi, Mobius
* @date 2017-02-22 - [15:22:27] * @date 2017-02-22 - [15:22:27]
*/ */
public class NornilsGarden extends AbstractInstance public class NornilsGarden extends AbstractInstance
@@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200016, true); world.openCloseDoor(16200016, true);
cancelQuestTimers("stage2"); cancelQuestTimer("stage2", npc, null);
world.spawnGroup("wave_3"); world.spawnGroup("wave_3");
} }
break; break;
@@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200201, true); world.openCloseDoor(16200201, true);
cancelQuestTimers("stage3"); cancelQuestTimer("stage3", npc, null);
cancelQuestTimers("check_agrro");
} }
break; break;
} }
case "check_agrro": case "check_agrro":
{ {
if ((world != null) && !npc.isDead() && !npc.isInCombat()) if ((world != null) && !npc.isDead() && !npc.isInCombat() && !world.getDoor(16200201).isOpen())
{ {
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar ->
{ {
@@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar);
} }
}); });
startQuestTimer("check_agrro", 1000, npc, null);
} }
break; break;
} }
@@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance
{ {
if (npc.getId() == BOZ_STAGE1) if (npc.getId() == BOZ_STAGE1)
{ {
cancelQuestTimers("stage1_1"); cancelQuestTimer("stage1_1", npc, null);
world.openCloseDoor(16200015, true); world.openCloseDoor(16200015, true);
world.setStatus(1); world.setStatus(1);
} }
@@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null);
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }

View File

@@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
cancelQuestTimers("attack"); cancelQuestTimer("attack", npc, null);
cancelQuestTimers("random_Target"); cancelQuestTimer("random_Target", npc, null);
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }

View File

@@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance
{ {
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.getParameters().set("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
npc.teleToLocation(BATTLE_LOC); npc.teleToLocation(BATTLE_LOC);
playMovie(world, Movie.SC_OCTABIS_OPENING); playMovie(world, Movie.SC_OCTABIS_OPENING);
getTimers().addTimer("START_STAGE_1", 26500, npc, null); getTimers().addTimer("START_STAGE_1", 26500, npc, null);

View File

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

View File

@@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
} }
if (questGiver.getId() == 34097) // Adonius if (questGiver.getId() == 34097) // Adonius
{ {
world.getParameters().set("CAPTIVES", world.spawnGroup("captives")); world.setParameter("CAPTIVES", world.spawnGroup("captives"));
for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class)) for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class))
{ {
captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);

View File

@@ -73,27 +73,6 @@ public class ChamberOfProphecies extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
if (event.equals("enterInstance"))
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
}
else if (player != null)
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (event) switch (event)
{ {
case "31639-01.html": case "31639-01.html":
@@ -106,6 +85,11 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33996-02.html": case "33996-02.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(ExShowUsm.USM_Q015_E); world.broadcastPacket(ExShowUsm.USM_Q015_E);
world.despawnGroup("q10753_16_instance_grail"); world.despawnGroup("q10753_16_instance_grail");
world.spawnGroup("q10753_16_instance_wizard"); world.spawnGroup("q10753_16_instance_wizard");
@@ -128,14 +112,53 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33980-05.html": case "33980-05.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup("q10753_16_instance_halter_2"); world.spawnGroup("q10753_16_instance_halter_2");
world.setStatus(6); world.setStatus(6);
startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); startQuestTimer("DESPAWN_WIZARD", 2000, npc, player);
htmltext = event; htmltext = event;
break; break;
} }
case "enterInstance":
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
break;
}
case "teleport":
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimer("CHECK_STATUS", npc, player);
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "status": case "status":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.isStatus(0)) if (world.isStatus(0))
{ {
htmltext = "31639-01.html"; htmltext = "31639-01.html";
@@ -144,18 +167,13 @@ public class ChamberOfProphecies extends AbstractInstance
htmltext = "31639-02.html"; htmltext = "31639-02.html";
break; break;
} }
case "teleport":
{
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimers("CHECK_STATUS");
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "CHECK_STATUS": case "CHECK_STATUS":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (world.getStatus()) switch (world.getStatus())
{ {
case 0: case 0:
@@ -223,6 +241,11 @@ public class ChamberOfProphecies extends AbstractInstance
case "ATTACK1": case "ATTACK1":
case "ATTACK2": case "ATTACK2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
npc.setRunning(); npc.setRunning();
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
@@ -242,7 +265,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR1": case "OPEN_DOOR1":
{ {
cancelQuestTimers("ATTACK"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK", npc, player);
world.setStatus(1); world.setStatus(1);
world.openCloseDoor(DOOR_2, true); world.openCloseDoor(DOOR_2, true);
world.spawnGroup("wof_room2"); world.spawnGroup("wof_room2");
@@ -250,7 +278,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR2": case "OPEN_DOOR2":
{ {
cancelQuestTimers("ATTACK1"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK1", npc, player);
startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true);
world.setStatus(3); world.setStatus(3);
world.spawnGroup("wof_room3"); world.spawnGroup("wof_room3");
@@ -337,23 +370,33 @@ public class ChamberOfProphecies extends AbstractInstance
if (npc.getId() == FERIN) if (npc.getId() == FERIN)
{ {
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player);
cancelQuestTimers("BROADCAST_TEXT"); cancelQuestTimer("BROADCAST_TEXT", npc, player);
} }
break; break;
} }
case "SEY_KAIN_4": case "SEY_KAIN_4":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(5); world.setStatus(5);
world.spawnGroup("q10753_16_instance_grail"); world.spawnGroup("q10753_16_instance_grail");
showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000);
world.openCloseDoor(DOOR_4, true); world.openCloseDoor(DOOR_4, true);
cancelQuestTimers("ATTACK2"); cancelQuestTimer("ATTACK2", npc, player);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player);
startQuestTimer("CLOSE", 15000, null, player); startQuestTimer("CLOSE", 15000, null, player);
break; break;
} }
case "CLOSE": case "CLOSE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
final Npc grail = world.getNpc(GRAIL); final Npc grail = world.getNpc(GRAIL);
if ((grail != null) && (player.calculateDistance2D(grail) < 390)) if ((grail != null) && (player.calculateDistance2D(grail) < 390))
{ {
@@ -369,13 +412,18 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "DESPAWN_WIZARD": case "DESPAWN_WIZARD":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.despawnGroup("q10753_16_instance_wizard"); world.despawnGroup("q10753_16_instance_wizard");
break; break;
} }
case "exit": case "exit":
{ {
startQuestTimer("finish", 3000, npc, player); startQuestTimer("finish", 3000, npc, player);
player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt((int) 1.0D)); player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt(1));
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null) if (qs != null)
{ {
@@ -385,11 +433,15 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "finish": case "finish":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.finishInstance(0); world.finishInstance(0);
break; break;
} }
} }
}
return htmltext; return htmltext;
} }

View File

@@ -17,10 +17,8 @@
package instances.DimensionalWrap; package instances.DimensionalWrap;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.CategoryType; import org.l2jmobius.gameserver.enums.CategoryType;
@@ -44,7 +42,7 @@ import instances.AbstractInstance;
* Dimensional Wrap instance * Dimensional Wrap instance
* @URL https://l2wiki.com/Dimensional_Warp * @URL https://l2wiki.com/Dimensional_Warp
* @Video https://www.youtube.com/watch?v=hOnzk0ELwIg * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg
* @author Gigi * @author Gigi, Mobius
* @date 2018-09-04 - [14:33:31] * @date 2018-09-04 - [14:33:31]
*/ */
public class DimensionalWrap extends AbstractInstance public class DimensionalWrap extends AbstractInstance
@@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance
23480, // Abyssal Harpy 23480, // Abyssal Harpy
23481, // Abyssal Binder 23481, // Abyssal Binder
23482, // Abyssal Archon 23482, // Abyssal Archon
23483 // Abyssal Golem 23483, // Abyssal Golem
}; };
private static final int[] TRAPS = private static final int[] TRAPS =
{ {
@@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance
19559, // Damage trap, power 1 19559, // Damage trap, power 1
19560, // Damage trap, power 2 19560, // Damage trap, power 2
19561, // Damage trap, power 3 19561, // Damage trap, power 3
19562 // Heal Trap 19562, // Heal Trap
}; };
// Location // Location
private static final Location TELEPORTS = new Location(-76136, -216216, 4040); private static final Location TELEPORTS = new Location(-76136, -216216, 4040);
private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360); private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360);
private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584); private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584);
private static final Location THRID_TELEPORT = new Location(-219813, 248484, 9928); private static final Location THIRD_TELEPORT = new Location(-219813, 248484, 9928);
private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984); private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984);
// Misc // Misc
private static final int TEMPLATE_ID = 250; private static final int TEMPLATE_ID = 250;
private static final int DIMENSIONAL_DARK_FORCES = 16415; private static final int DIMENSIONAL_DARK_FORCES = 16415;
private static final int WARP_CRYSTAL = 39597; private static final int WARP_CRYSTAL = 39597;
protected double _chance = 0;
protected int _count = 0;
public int _skilllevel = 1;
public int _worldState = 0;
protected ScheduledFuture<?> _debufTask;
public DimensionalWrap() public DimensionalWrap()
{ {
@@ -125,8 +118,10 @@ public class DimensionalWrap extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
final Instance world = npc.getInstanceWorld();
if (event.equals("enterInstance")) switch (event)
{
case "enterInstance":
{ {
if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{ {
@@ -155,11 +150,8 @@ public class DimensionalWrap extends AbstractInstance
} }
} }
} }
break;
} }
if (isInInstance(world))
{
switch (event)
{
case "33975-01.html": case "33975-01.html":
{ {
htmltext = event; htmltext = event;
@@ -167,10 +159,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "12_warp_crystals": case "12_warp_crystals":
{ {
_chance = 0.3; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.3);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 12; world.setParameter("count", 12);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -183,19 +181,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 6; world.setParameter("count", 6);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 4; world.setParameter("count", 4);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 3; world.setParameter("count", 3);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -204,10 +202,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "240_warp_crystals": case "240_warp_crystals":
{ {
_chance = 0.6; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.6);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 240; world.setParameter("count", 240);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -220,19 +224,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 120; world.setParameter("count", 120);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 80; world.setParameter("count", 80);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 60; world.setParameter("count", 60);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -241,10 +245,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "1200_warp_crystals": case "1200_warp_crystals":
{ {
_chance = 0.9; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.9);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 1200; world.setParameter("count", 1200);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -257,19 +267,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 600; world.setParameter("count", 600);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 400; world.setParameter("count", 400);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 300; world.setParameter("count", 300);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -278,7 +288,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_6_f": case "send_6_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -299,9 +315,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 5) if (world.getStatus() < 5)
{ {
world.setStatus(5); world.setStatus(5);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -311,7 +327,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_11_f": case "send_11_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -321,6 +343,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -331,9 +354,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 10) if (world.getStatus() < 10)
{ {
world.setStatus(10); world.setStatus(10);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -343,7 +366,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_16_f": case "send_16_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -353,6 +382,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -363,19 +393,25 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 15) if (world.getStatus() < 15)
{ {
world.setStatus(15); world.setStatus(15);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId());
} }
break; break;
} }
case "send_21_f": case "send_21_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -385,6 +421,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -395,9 +432,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 20) if (world.getStatus() < 20)
{ {
world.setStatus(20); world.setStatus(20);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -407,7 +444,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_26_f": case "send_26_f":
{ {
if (_worldState == 0) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -417,6 +460,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -427,9 +471,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 25) if (world.getStatus() < 25)
{ {
world.setStatus(25); world.setStatus(25);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -439,15 +483,25 @@ public class DimensionalWrap extends AbstractInstance
} }
case "jump_location": case "jump_location":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
player.teleToLocation(TELEPORTS, world.getTemplateId()); player.teleToLocation(TELEPORTS, world.getTemplateId());
break; break;
} }
case "SALAMANDRA_SPAWN": case "SALAMANDRA_SPAWN":
case "SALAMANDRA_SPAWN_DUMMY": case "SALAMANDRA_SPAWN_DUMMY":
{ {
if (getRandom(100) < (_worldState / 2)) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{ {
final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); return null;
}
if (getRandom(100) < (world.getParameters().getInt("worldState", 0) / 2))
{
final Npc salamandra = addSpawn(world.getParameters().getInt("worldState", 0) < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId());
salamandra.setRunning(); salamandra.setRunning();
World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p ->
{ {
@@ -461,36 +515,57 @@ public class DimensionalWrap extends AbstractInstance
} }
case "START_STAGE": case "START_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(world.getStatus() + 1); world.setStatus(world.getStatus() + 1);
_worldState = world.getStatus(); world.setParameter("worldState", world.getStatus());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus())));
startQuestTimer("FIRST_SPAWN", 1500, npc, null); startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer());
break; break;
} }
case "FIRST_SPAWN": case "FIRST_SPAWN":
{ {
world.spawnGroup(_worldState + "_first_spawn"); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("SECOND_SPAWN", 40000, npc, null);
_debufTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if ((_worldState > 0) && (_worldState <= 11)) return null;
{
_skilllevel = 1;
} }
else if ((_worldState > 11) && (_worldState <= 20)) final int worldState = world.getParameters().getInt("worldState", 0);
{ world.spawnGroup(worldState + "_first_spawn");
_skilllevel = 2; world.spawnGroup(worldState + "_trap_spawn");
startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer());
startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true);
break;
} }
else if ((_worldState > 20) && (_worldState <= 30)) case "DEBUFF_TASK":
{ {
_skilllevel = 3; final Instance world = player.getInstanceWorld();
} if (!isInInstance(world))
else if (_worldState > 30)
{ {
_skilllevel = 4; return null;
} }
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, _skilllevel); int skilllevel = 1;
final int worldState = world.getParameters().getInt("worldState", 0);
if ((worldState > 0) && (worldState <= 11))
{
skilllevel = 1;
}
else if ((worldState > 11) && (worldState <= 20))
{
skilllevel = 2;
}
else if ((worldState > 20) && (worldState <= 30))
{
skilllevel = 3;
}
else if (worldState > 30)
{
skilllevel = 4;
}
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, skilllevel);
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if ((p != null) && !p.isDead()) if ((p != null) && !p.isDead())
@@ -498,47 +573,71 @@ public class DimensionalWrap extends AbstractInstance
skill.applyEffects(p, p); skill.applyEffects(p, p);
} }
} }
}, 5000, 10000);
break; break;
} }
case "SECOND_SPAWN": case "SECOND_SPAWN":
{ {
world.spawnGroup(_worldState + "_second_spawn"); final Instance world = player.getInstanceWorld();
startQuestTimer("THRID_SPAWN", 40000, npc, null); if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn");
startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer());
break; break;
} }
case "THRID_SPAWN": case "THIRD_SPAWN":
{ {
world.spawnGroup(_worldState + "_thred_spawn"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn");
break; break;
} }
case "CHANGE_LOCATION": case "CHANGE_LOCATION":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe);
world.spawnGroup(_worldState + "_trap_spawn"); world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_trap_spawn");
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1430), null, world.getFirstPlayer());
break; break;
} }
case "SWITCH_STAGE": case "SWITCH_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getAliveNpcs(MONSTERS).isEmpty()) if (world.getAliveNpcs(MONSTERS).isEmpty())
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true));
world.broadcastPacket(new Earthquake(npc, 50, 5)); world.broadcastPacket(new Earthquake(npc, 50, 5));
world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true);
clean(); clean(world.getFirstPlayer());
if (_worldState < 35) if (world.getParameters().getInt("worldState", 0) < 35)
{ {
startQuestTimer("NEXT_STAGE", 5000, npc, null); startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer());
} }
} }
break; break;
} }
case "NEXT_STAGE": case "NEXT_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180)));
world.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); world.setDuration((int) ((world.getRemainingTime() / 60000) + 3));
startQuestTimer("START_STAGE", 8000, npc, null); startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer());
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -549,7 +648,6 @@ public class DimensionalWrap extends AbstractInstance
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world)) if (isInInstance(world))
{ {
if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < _chance)) if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < world.getParameters().getDouble("chance", 0)))
{ {
if (_worldState < 9) final int worldState = world.getParameters().getInt("worldState", 0);
if (worldState < 9)
{ {
addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId()); addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if ((_worldState >= 9) && (_worldState < 20)) else if ((worldState >= 9) && (worldState < 20))
{ {
addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId()); addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if (_worldState >= 20) else if (worldState >= 20)
{ {
addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId()); addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
@@ -581,7 +680,7 @@ public class DimensionalWrap extends AbstractInstance
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true));
world.finishInstance(3); world.finishInstance(3);
clean(); clean(world.getFirstPlayer());
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance
@Override @Override
public String onFirstTalk(Npc npc, PlayerInstance player) public String onFirstTalk(Npc npc, PlayerInstance player)
{ {
if (_worldState == 20) final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (world.getParameters().getInt("worldState", 0) == 20))
{ {
return "33975-04.html"; return "33975-04.html";
} }
@@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance
{ {
case SALAMANDRA_GENERATOR: case SALAMANDRA_GENERATOR:
{ {
startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true);
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer());
break; break;
} }
case SALAMANDRA_GENERATOR_DUMMY: case SALAMANDRA_GENERATOR_DUMMY:
{ {
startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true);
break; break;
} }
case DEMINSIONAL_INVISIBLE_FRAGMENT: case DEMINSIONAL_INVISIBLE_FRAGMENT:
{ {
startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true);
break; break;
} }
} }
@@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance
boolean canStart = true; boolean canStart = true;
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < _count) if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < world.getParameters().getInt("count", 0))
{ {
for (PlayerInstance ps : world.getPlayers()) for (PlayerInstance ps : world.getPlayers())
{ {
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
packet.setHtml(getHtm(ps, "33975-03.html")); packet.setHtml(getHtm(ps, "33975-03.html"));
packet.replace("%count%", Integer.toString(_count)); packet.replace("%count%", Integer.toString(world.getParameters().getInt("count", 0)));
ps.sendPacket(packet); ps.sendPacket(packet);
ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName()));
canStart = false; canStart = false;
} }
} }
} }
if (!canStart || (_worldState != 0)) if (!canStart || (world.getParameters().getInt("worldState", 0) != 0))
{ {
return; return;
} }
startQuestTimer("START_STAGE", 1000, npc, null); startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer());
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
takeItems(p, WARP_CRYSTAL, _count); takeItems(p, WARP_CRYSTAL, world.getParameters().getInt("count", 0));
} }
} }
protected void clean() protected void clean(PlayerInstance player)
{ {
cancelQuestTimers("SWITCH_STAGE"); cancelQuestTimer("SWITCH_STAGE", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN"); cancelQuestTimer("SALAMANDRA_SPAWN", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player);
cancelQuestTimers("CHANGE_LOCATION"); cancelQuestTimer("CHANGE_LOCATION", null, player);
if (_debufTask != null) cancelQuestTimer("DEBUFF_TASK", null, player);
{
_debufTask.cancel(false);
_debufTask = null;
}
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti;
/** /**
* Mystic Tavern Tauti Instance * Mystic Tavern Tauti Instance
* @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk
* @author Gigi * @author Gigi, Mobius
*/ */
public class StoryOfTauti extends AbstractInstance public class StoryOfTauti extends AbstractInstance
{ {
@@ -93,14 +93,13 @@ public class StoryOfTauti extends AbstractInstance
private static final Location TELEPORT = new Location(153267, -148441, -11560); private static final Location TELEPORT = new Location(153267, -148441, -11560);
private static final int ZONE_1ST_TRIGER = 24137770; private static final int ZONE_1ST_TRIGER = 24137770;
private static final int SKILL_TRIGER = 24138880; private static final int SKILL_TRIGER = 24138880;
private static Npc _deton;
private static Npc _seal_device; private static Npc _seal_device;
protected int _count = 0; protected int _count = 0;
public StoryOfTauti() public StoryOfTauti()
{ {
super(TEMPLATE_ID); super(TEMPLATE_ID);
addSpawnId(DETON, SEAL_DEVICE, FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL); addSpawnId(FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL);
addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL); addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL);
addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL);
addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE);
@@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(1) || world.isStatus(4)) if (world.isStatus(1) || world.isStatus(4))
{ {
_deton.setTarget(player); world.getNpc(DETON).setTarget(player);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
} }
else else
{ {
@@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_status": case "check_status":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()))
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
startQuestTimer("msg_1", 7000, _deton, null); startQuestTimer("msg_1", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_1": case "msg_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW);
startQuestTimer("msg_2", 10000, _deton, null); startQuestTimer("msg_2", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_2": case "msg_2":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE);
startQuestTimer("msg_3", 10000, _deton, null); startQuestTimer("msg_3", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_3": case "msg_3":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME);
break; break;
} }
case "msg_4": case "msg_4":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE);
startQuestTimer("msg_5", 7000, _deton, null); startQuestTimer("msg_5", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_5": case "msg_5":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE);
startQuestTimer("msg_6", 10000, _deton, null); startQuestTimer("msg_6", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_6": case "msg_6":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE);
break; break;
} }
case "spawn_stacato": case "spawn_stacato":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_1", 50000, _deton, null); startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_1": case "spawn_stacato_1":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_2", 50000, _deton, null); startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_2": case "spawn_stacato_2":
@@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_flower": case "check_flower":
{ {
if (!npc.isDead()) if ((world != null) && !npc.isDead())
{ {
for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000))
{ {
if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0))
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, nearby.getLocation(), 23); addMoveToDesire(npc, nearby.getLocation(), 23);
if (npc.calculateDistance3D(nearby) < 100) if (npc.calculateDistance3D(nearby) < 100)
{ {
@@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
} }
startQuestTimer("check_flower", 3000, npc, null);
} }
break; break;
} }
@@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_7": case "msg_7":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN);
break; break;
} }
case "spawn_scorpion": case "spawn_scorpion":
{ {
world.spawnGroup("flame_scorpion"); world.spawnGroup("flame_scorpion");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE);
if (getRandom(10) < 5) if (getRandom(10) < 5)
{ {
world.spawnGroup("ifrit"); world.spawnGroup("ifrit");
@@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if ((pl != null) && !pl.isDead()) if ((pl != null) && !pl.isDead())
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23); addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23);
addAttackPlayerDesire(npc, pl); addAttackPlayerDesire(npc, pl);
} }
@@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_8": case "msg_8":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS);
startQuestTimer("msg_9", 8000, _deton, null); startQuestTimer("msg_9", 8000, world.getNpc(DETON), null);
break; break;
} }
case "msg_9": case "msg_9":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY);
startQuestTimer("msg_10", 10000, _deton, null); startQuestTimer("msg_10", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_10": case "msg_10":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING);
break; break;
} }
case "spawn_golem": case "spawn_golem":
{ {
world.spawnGroup("golem"); world.spawnGroup("golem");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away", 10000, _deton, null); startQuestTimer("run_away", 10000, world.getNpc(DETON), null);
break; break;
} }
case "run_away": case "run_away":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 3500, _deton, null); startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null);
break; break;
} }
case "delete_daton": case "delete_daton":
@@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_11": case "msg_11":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST);
break; break;
} }
case "msg_12": case "msg_12":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA);
startQuestTimer("msg_13", 9000, _deton, null); startQuestTimer("msg_13", 9000, world.getNpc(DETON), null);
break; break;
} }
case "msg_13": case "msg_13":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA);
break; break;
} }
case "spawn_scarab": case "spawn_scarab":
{ {
world.spawnGroup("flame_scarab"); world.spawnGroup("flame_scarab");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away_1", 8000, _deton, null); startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null);
break; break;
} }
case "run_away_1": case "run_away_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 5000, _deton, null); startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null);
break; break;
} }
case "switch_quest": case "switch_quest":
@@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance
} }
case "end_instance": case "end_instance":
{ {
cancelQuestTimers("check_flower");
_count = 0; _count = 0;
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
@@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (npc.isScriptValue(0)) if (npc.isScriptValue(0))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW);
npc.setScriptValue(1); npc.setScriptValue(1);
break; break;
} }
if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60))
{ {
_seal_device.setDisplayEffect(1); _seal_device.setDisplayEffect(1);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE);
npc.setScriptValue(2); npc.setScriptValue(2);
break; break;
} }
@@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30))
{ {
world.spawnGroup("last_deton"); world.spawnGroup("last_deton");
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3);
startQuestTimer("msg_12", 6000, _deton, null); startQuestTimer("msg_12", 6000, world.getNpc(DETON), null);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME);
world.setStatus(11); world.setStatus(11);
} }
if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5)) if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5))
@@ -603,7 +602,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
}); });
startQuestTimer("end_instance", 52000, _deton, null); startQuestTimer("end_instance", 52000, world.getNpc(DETON), null);
world.despawnGroup("last_deton"); world.despawnGroup("last_deton");
world.despawnGroup("last_archagel"); world.despawnGroup("last_archagel");
playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE); playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE);
@@ -627,21 +626,20 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
{ {
cancelQuestTimers("end_instance"); cancelQuestTimer("end_instance", world.getNpc(DETON), null);
cancelQuestTimers("check_flower");
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME)));
world.setStatus(4); world.setStatus(4);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL);
startQuestTimer("msg_7", 7000, _deton, null); startQuestTimer("msg_7", 7000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2)) if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("msg_8", 3000, _deton, null); startQuestTimer("msg_8", 3000, world.getNpc(DETON), null);
world.setStatus(6); world.setStatus(6);
} }
break; break;
@@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance
_seal_device.setDisplayEffect(3); _seal_device.setDisplayEffect(3);
_seal_device.doDie(npc); _seal_device.doDie(npc);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2);
startQuestTimer("msg_11", 3000, _deton, null); startQuestTimer("msg_11", 3000, world.getNpc(DETON), null);
break; break;
} }
case SEALED_ANGEL: case SEALED_ANGEL:
@@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance
if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1))
{ {
world.setStatus(2); world.setStatus(2);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
startQuestTimer("msg_4", 7000, _deton, null); startQuestTimer("msg_4", 7000, world.getNpc(DETON), null);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME)));
startQuestTimer("end_instance", 190000, _deton, null); startQuestTimer("end_instance", 190000, world.getNpc(DETON), null);
startQuestTimer("spawn_stacato", 5000, _deton, null); startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(0)) if (world.isStatus(0))
{ {
startQuestTimer("check_status", 21000, _deton, player); startQuestTimer("check_status", 21000, world.getNpc(DETON), player);
world.setStatus(1); world.setStatus(1);
} }
break; break;
@@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(4)) if (world.isStatus(4))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING);
startQuestTimer("spawn_scorpion", 5000, _deton, player); startQuestTimer("spawn_scorpion", 5000, world.getNpc(DETON), player);
world.setStatus(5); world.setStatus(5);
} }
break; break;
@@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY);
startQuestTimer("spawn_golem", 7000, _deton, player); startQuestTimer("spawn_golem", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT);
startQuestTimer("spawn_scarab", 7000, _deton, player); startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance
{ {
switch (npc.getId()) switch (npc.getId())
{ {
case DETON:
{
_deton = npc;
break;
}
case SEAL_DEVICE: case SEAL_DEVICE:
{ {
_seal_device = npc; _seal_device = npc;
@@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance
} }
case FLAME_STACATO: case FLAME_STACATO:
{ {
startQuestTimer("check_flower", 3000, npc, null, true); startQuestTimer("check_flower", 3000, npc, null);
break; break;
} }
case FLAME_SCORPION: case FLAME_SCORPION:

View File

@@ -34,7 +34,7 @@ import instances.AbstractInstance;
* Nornils Garden Instance * Nornils Garden Instance
* @URL https://l2wiki.com/Nornils_Garden * @URL https://l2wiki.com/Nornils_Garden
* @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs
* @author Gigi * @author Gigi, Mobius
* @date 2017-02-22 - [15:22:27] * @date 2017-02-22 - [15:22:27]
*/ */
public class NornilsGarden extends AbstractInstance public class NornilsGarden extends AbstractInstance
@@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200016, true); world.openCloseDoor(16200016, true);
cancelQuestTimers("stage2"); cancelQuestTimer("stage2", npc, null);
world.spawnGroup("wave_3"); world.spawnGroup("wave_3");
} }
break; break;
@@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200201, true); world.openCloseDoor(16200201, true);
cancelQuestTimers("stage3"); cancelQuestTimer("stage3", npc, null);
cancelQuestTimers("check_agrro");
} }
break; break;
} }
case "check_agrro": case "check_agrro":
{ {
if ((world != null) && !npc.isDead() && !npc.isInCombat()) if ((world != null) && !npc.isDead() && !npc.isInCombat() && !world.getDoor(16200201).isOpen())
{ {
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar ->
{ {
@@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar);
} }
}); });
startQuestTimer("check_agrro", 1000, npc, null);
} }
break; break;
} }
@@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance
{ {
if (npc.getId() == BOZ_STAGE1) if (npc.getId() == BOZ_STAGE1)
{ {
cancelQuestTimers("stage1_1"); cancelQuestTimer("stage1_1", npc, null);
world.openCloseDoor(16200015, true); world.openCloseDoor(16200015, true);
world.setStatus(1); world.setStatus(1);
} }
@@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null);
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }

View File

@@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
cancelQuestTimers("attack"); cancelQuestTimer("attack", npc, null);
cancelQuestTimers("random_Target"); cancelQuestTimer("random_Target", npc, null);
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }

View File

@@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance
{ {
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.getParameters().set("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
npc.teleToLocation(BATTLE_LOC); npc.teleToLocation(BATTLE_LOC);
playMovie(world, Movie.SC_OCTABIS_OPENING); playMovie(world, Movie.SC_OCTABIS_OPENING);
getTimers().addTimer("START_STAGE_1", 26500, npc, null); getTimers().addTimer("START_STAGE_1", 26500, npc, null);

View File

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

View File

@@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
} }
if (questGiver.getId() == 34097) // Adonius if (questGiver.getId() == 34097) // Adonius
{ {
world.getParameters().set("CAPTIVES", world.spawnGroup("captives")); world.setParameter("CAPTIVES", world.spawnGroup("captives"));
for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class)) for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class))
{ {
captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);

View File

@@ -73,27 +73,6 @@ public class ChamberOfProphecies extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
if (event.equals("enterInstance"))
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
}
else if (player != null)
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (event) switch (event)
{ {
case "31639-01.html": case "31639-01.html":
@@ -106,6 +85,11 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33996-02.html": case "33996-02.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(ExShowUsm.USM_Q015_E); world.broadcastPacket(ExShowUsm.USM_Q015_E);
world.despawnGroup("q10753_16_instance_grail"); world.despawnGroup("q10753_16_instance_grail");
world.spawnGroup("q10753_16_instance_wizard"); world.spawnGroup("q10753_16_instance_wizard");
@@ -128,14 +112,53 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33980-05.html": case "33980-05.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup("q10753_16_instance_halter_2"); world.spawnGroup("q10753_16_instance_halter_2");
world.setStatus(6); world.setStatus(6);
startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); startQuestTimer("DESPAWN_WIZARD", 2000, npc, player);
htmltext = event; htmltext = event;
break; break;
} }
case "enterInstance":
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
break;
}
case "teleport":
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimer("CHECK_STATUS", npc, player);
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "status": case "status":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.isStatus(0)) if (world.isStatus(0))
{ {
htmltext = "31639-01.html"; htmltext = "31639-01.html";
@@ -144,18 +167,13 @@ public class ChamberOfProphecies extends AbstractInstance
htmltext = "31639-02.html"; htmltext = "31639-02.html";
break; break;
} }
case "teleport":
{
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimers("CHECK_STATUS");
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "CHECK_STATUS": case "CHECK_STATUS":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (world.getStatus()) switch (world.getStatus())
{ {
case 0: case 0:
@@ -223,6 +241,11 @@ public class ChamberOfProphecies extends AbstractInstance
case "ATTACK1": case "ATTACK1":
case "ATTACK2": case "ATTACK2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
npc.setRunning(); npc.setRunning();
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
@@ -242,7 +265,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR1": case "OPEN_DOOR1":
{ {
cancelQuestTimers("ATTACK"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK", npc, player);
world.setStatus(1); world.setStatus(1);
world.openCloseDoor(DOOR_2, true); world.openCloseDoor(DOOR_2, true);
world.spawnGroup("wof_room2"); world.spawnGroup("wof_room2");
@@ -250,7 +278,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR2": case "OPEN_DOOR2":
{ {
cancelQuestTimers("ATTACK1"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK1", npc, player);
startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true);
world.setStatus(3); world.setStatus(3);
world.spawnGroup("wof_room3"); world.spawnGroup("wof_room3");
@@ -337,23 +370,33 @@ public class ChamberOfProphecies extends AbstractInstance
if (npc.getId() == FERIN) if (npc.getId() == FERIN)
{ {
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player);
cancelQuestTimers("BROADCAST_TEXT"); cancelQuestTimer("BROADCAST_TEXT", npc, player);
} }
break; break;
} }
case "SEY_KAIN_4": case "SEY_KAIN_4":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(5); world.setStatus(5);
world.spawnGroup("q10753_16_instance_grail"); world.spawnGroup("q10753_16_instance_grail");
showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000);
world.openCloseDoor(DOOR_4, true); world.openCloseDoor(DOOR_4, true);
cancelQuestTimers("ATTACK2"); cancelQuestTimer("ATTACK2", npc, player);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player);
startQuestTimer("CLOSE", 15000, null, player); startQuestTimer("CLOSE", 15000, null, player);
break; break;
} }
case "CLOSE": case "CLOSE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
final Npc grail = world.getNpc(GRAIL); final Npc grail = world.getNpc(GRAIL);
if ((grail != null) && (player.calculateDistance2D(grail) < 390)) if ((grail != null) && (player.calculateDistance2D(grail) < 390))
{ {
@@ -369,13 +412,18 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "DESPAWN_WIZARD": case "DESPAWN_WIZARD":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.despawnGroup("q10753_16_instance_wizard"); world.despawnGroup("q10753_16_instance_wizard");
break; break;
} }
case "exit": case "exit":
{ {
startQuestTimer("finish", 3000, npc, player); startQuestTimer("finish", 3000, npc, player);
player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt((int) 1.0D)); player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt(1));
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null) if (qs != null)
{ {
@@ -385,11 +433,15 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "finish": case "finish":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.finishInstance(0); world.finishInstance(0);
break; break;
} }
} }
}
return htmltext; return htmltext;
} }

View File

@@ -17,10 +17,8 @@
package instances.DimensionalWrap; package instances.DimensionalWrap;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.CategoryType; import org.l2jmobius.gameserver.enums.CategoryType;
@@ -44,7 +42,7 @@ import instances.AbstractInstance;
* Dimensional Wrap instance * Dimensional Wrap instance
* @URL https://l2wiki.com/Dimensional_Warp * @URL https://l2wiki.com/Dimensional_Warp
* @Video https://www.youtube.com/watch?v=hOnzk0ELwIg * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg
* @author Gigi * @author Gigi, Mobius
* @date 2018-09-04 - [14:33:31] * @date 2018-09-04 - [14:33:31]
*/ */
public class DimensionalWrap extends AbstractInstance public class DimensionalWrap extends AbstractInstance
@@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance
23480, // Abyssal Harpy 23480, // Abyssal Harpy
23481, // Abyssal Binder 23481, // Abyssal Binder
23482, // Abyssal Archon 23482, // Abyssal Archon
23483 // Abyssal Golem 23483, // Abyssal Golem
}; };
private static final int[] TRAPS = private static final int[] TRAPS =
{ {
@@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance
19559, // Damage trap, power 1 19559, // Damage trap, power 1
19560, // Damage trap, power 2 19560, // Damage trap, power 2
19561, // Damage trap, power 3 19561, // Damage trap, power 3
19562 // Heal Trap 19562, // Heal Trap
}; };
// Location // Location
private static final Location TELEPORTS = new Location(-76136, -216216, 4040); private static final Location TELEPORTS = new Location(-76136, -216216, 4040);
private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360); private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360);
private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584); private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584);
private static final Location THRID_TELEPORT = new Location(-219813, 248484, 9928); private static final Location THIRD_TELEPORT = new Location(-219813, 248484, 9928);
private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984); private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984);
// Misc // Misc
private static final int TEMPLATE_ID = 250; private static final int TEMPLATE_ID = 250;
private static final int DIMENSIONAL_DARK_FORCES = 16415; private static final int DIMENSIONAL_DARK_FORCES = 16415;
private static final int WARP_CRYSTAL = 39597; private static final int WARP_CRYSTAL = 39597;
protected double _chance = 0;
protected int _count = 0;
public int _skilllevel = 1;
public int _worldState = 0;
protected ScheduledFuture<?> _debufTask;
public DimensionalWrap() public DimensionalWrap()
{ {
@@ -125,8 +118,10 @@ public class DimensionalWrap extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
final Instance world = npc.getInstanceWorld();
if (event.equals("enterInstance")) switch (event)
{
case "enterInstance":
{ {
if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{ {
@@ -155,11 +150,8 @@ public class DimensionalWrap extends AbstractInstance
} }
} }
} }
break;
} }
if (isInInstance(world))
{
switch (event)
{
case "33975-01.html": case "33975-01.html":
{ {
htmltext = event; htmltext = event;
@@ -167,10 +159,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "12_warp_crystals": case "12_warp_crystals":
{ {
_chance = 0.3; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.3);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 12; world.setParameter("count", 12);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -183,19 +181,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 6; world.setParameter("count", 6);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 4; world.setParameter("count", 4);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 3; world.setParameter("count", 3);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -204,10 +202,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "240_warp_crystals": case "240_warp_crystals":
{ {
_chance = 0.6; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.6);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 240; world.setParameter("count", 240);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -220,19 +224,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 120; world.setParameter("count", 120);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 80; world.setParameter("count", 80);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 60; world.setParameter("count", 60);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -241,10 +245,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "1200_warp_crystals": case "1200_warp_crystals":
{ {
_chance = 0.9; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.9);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 1200; world.setParameter("count", 1200);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -257,19 +267,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 600; world.setParameter("count", 600);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 400; world.setParameter("count", 400);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 300; world.setParameter("count", 300);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -278,7 +288,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_6_f": case "send_6_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -299,9 +315,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 5) if (world.getStatus() < 5)
{ {
world.setStatus(5); world.setStatus(5);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -311,7 +327,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_11_f": case "send_11_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -321,6 +343,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -331,9 +354,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 10) if (world.getStatus() < 10)
{ {
world.setStatus(10); world.setStatus(10);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -343,7 +366,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_16_f": case "send_16_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -353,6 +382,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -363,19 +393,25 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 15) if (world.getStatus() < 15)
{ {
world.setStatus(15); world.setStatus(15);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId());
} }
break; break;
} }
case "send_21_f": case "send_21_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -385,6 +421,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -395,9 +432,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 20) if (world.getStatus() < 20)
{ {
world.setStatus(20); world.setStatus(20);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -407,7 +444,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_26_f": case "send_26_f":
{ {
if (_worldState == 0) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -417,6 +460,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -427,9 +471,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 25) if (world.getStatus() < 25)
{ {
world.setStatus(25); world.setStatus(25);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -439,15 +483,25 @@ public class DimensionalWrap extends AbstractInstance
} }
case "jump_location": case "jump_location":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
player.teleToLocation(TELEPORTS, world.getTemplateId()); player.teleToLocation(TELEPORTS, world.getTemplateId());
break; break;
} }
case "SALAMANDRA_SPAWN": case "SALAMANDRA_SPAWN":
case "SALAMANDRA_SPAWN_DUMMY": case "SALAMANDRA_SPAWN_DUMMY":
{ {
if (getRandom(100) < (_worldState / 2)) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{ {
final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); return null;
}
if (getRandom(100) < (world.getParameters().getInt("worldState", 0) / 2))
{
final Npc salamandra = addSpawn(world.getParameters().getInt("worldState", 0) < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId());
salamandra.setRunning(); salamandra.setRunning();
World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p ->
{ {
@@ -461,36 +515,57 @@ public class DimensionalWrap extends AbstractInstance
} }
case "START_STAGE": case "START_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(world.getStatus() + 1); world.setStatus(world.getStatus() + 1);
_worldState = world.getStatus(); world.setParameter("worldState", world.getStatus());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus())));
startQuestTimer("FIRST_SPAWN", 1500, npc, null); startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer());
break; break;
} }
case "FIRST_SPAWN": case "FIRST_SPAWN":
{ {
world.spawnGroup(_worldState + "_first_spawn"); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("SECOND_SPAWN", 40000, npc, null);
_debufTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if ((_worldState > 0) && (_worldState <= 11)) return null;
{
_skilllevel = 1;
} }
else if ((_worldState > 11) && (_worldState <= 20)) final int worldState = world.getParameters().getInt("worldState", 0);
{ world.spawnGroup(worldState + "_first_spawn");
_skilllevel = 2; world.spawnGroup(worldState + "_trap_spawn");
startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer());
startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true);
break;
} }
else if ((_worldState > 20) && (_worldState <= 30)) case "DEBUFF_TASK":
{ {
_skilllevel = 3; final Instance world = player.getInstanceWorld();
} if (!isInInstance(world))
else if (_worldState > 30)
{ {
_skilllevel = 4; return null;
} }
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, _skilllevel); int skilllevel = 1;
final int worldState = world.getParameters().getInt("worldState", 0);
if ((worldState > 0) && (worldState <= 11))
{
skilllevel = 1;
}
else if ((worldState > 11) && (worldState <= 20))
{
skilllevel = 2;
}
else if ((worldState > 20) && (worldState <= 30))
{
skilllevel = 3;
}
else if (worldState > 30)
{
skilllevel = 4;
}
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, skilllevel);
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if ((p != null) && !p.isDead()) if ((p != null) && !p.isDead())
@@ -498,47 +573,71 @@ public class DimensionalWrap extends AbstractInstance
skill.applyEffects(p, p); skill.applyEffects(p, p);
} }
} }
}, 5000, 10000);
break; break;
} }
case "SECOND_SPAWN": case "SECOND_SPAWN":
{ {
world.spawnGroup(_worldState + "_second_spawn"); final Instance world = player.getInstanceWorld();
startQuestTimer("THRID_SPAWN", 40000, npc, null); if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn");
startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer());
break; break;
} }
case "THRID_SPAWN": case "THIRD_SPAWN":
{ {
world.spawnGroup(_worldState + "_thred_spawn"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn");
break; break;
} }
case "CHANGE_LOCATION": case "CHANGE_LOCATION":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe);
world.spawnGroup(_worldState + "_trap_spawn"); world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_trap_spawn");
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1430), null, world.getFirstPlayer());
break; break;
} }
case "SWITCH_STAGE": case "SWITCH_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getAliveNpcs(MONSTERS).isEmpty()) if (world.getAliveNpcs(MONSTERS).isEmpty())
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true));
world.broadcastPacket(new Earthquake(npc, 50, 5)); world.broadcastPacket(new Earthquake(npc, 50, 5));
world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true);
clean(); clean(world.getFirstPlayer());
if (_worldState < 35) if (world.getParameters().getInt("worldState", 0) < 35)
{ {
startQuestTimer("NEXT_STAGE", 5000, npc, null); startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer());
} }
} }
break; break;
} }
case "NEXT_STAGE": case "NEXT_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180)));
world.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); world.setDuration((int) ((world.getRemainingTime() / 60000) + 3));
startQuestTimer("START_STAGE", 8000, npc, null); startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer());
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -549,7 +648,6 @@ public class DimensionalWrap extends AbstractInstance
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world)) if (isInInstance(world))
{ {
if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < _chance)) if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < world.getParameters().getDouble("chance", 0)))
{ {
if (_worldState < 9) final int worldState = world.getParameters().getInt("worldState", 0);
if (worldState < 9)
{ {
addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId()); addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if ((_worldState >= 9) && (_worldState < 20)) else if ((worldState >= 9) && (worldState < 20))
{ {
addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId()); addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if (_worldState >= 20) else if (worldState >= 20)
{ {
addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId()); addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
@@ -581,7 +680,7 @@ public class DimensionalWrap extends AbstractInstance
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true));
world.finishInstance(3); world.finishInstance(3);
clean(); clean(world.getFirstPlayer());
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance
@Override @Override
public String onFirstTalk(Npc npc, PlayerInstance player) public String onFirstTalk(Npc npc, PlayerInstance player)
{ {
if (_worldState == 20) final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (world.getParameters().getInt("worldState", 0) == 20))
{ {
return "33975-04.html"; return "33975-04.html";
} }
@@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance
{ {
case SALAMANDRA_GENERATOR: case SALAMANDRA_GENERATOR:
{ {
startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true);
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer());
break; break;
} }
case SALAMANDRA_GENERATOR_DUMMY: case SALAMANDRA_GENERATOR_DUMMY:
{ {
startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true);
break; break;
} }
case DEMINSIONAL_INVISIBLE_FRAGMENT: case DEMINSIONAL_INVISIBLE_FRAGMENT:
{ {
startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true);
break; break;
} }
} }
@@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance
boolean canStart = true; boolean canStart = true;
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < _count) if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < world.getParameters().getInt("count", 0))
{ {
for (PlayerInstance ps : world.getPlayers()) for (PlayerInstance ps : world.getPlayers())
{ {
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
packet.setHtml(getHtm(ps, "33975-03.html")); packet.setHtml(getHtm(ps, "33975-03.html"));
packet.replace("%count%", Integer.toString(_count)); packet.replace("%count%", Integer.toString(world.getParameters().getInt("count", 0)));
ps.sendPacket(packet); ps.sendPacket(packet);
ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName()));
canStart = false; canStart = false;
} }
} }
} }
if (!canStart || (_worldState != 0)) if (!canStart || (world.getParameters().getInt("worldState", 0) != 0))
{ {
return; return;
} }
startQuestTimer("START_STAGE", 1000, npc, null); startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer());
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
takeItems(p, WARP_CRYSTAL, _count); takeItems(p, WARP_CRYSTAL, world.getParameters().getInt("count", 0));
} }
} }
protected void clean() protected void clean(PlayerInstance player)
{ {
cancelQuestTimers("SWITCH_STAGE"); cancelQuestTimer("SWITCH_STAGE", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN"); cancelQuestTimer("SALAMANDRA_SPAWN", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player);
cancelQuestTimers("CHANGE_LOCATION"); cancelQuestTimer("CHANGE_LOCATION", null, player);
if (_debufTask != null) cancelQuestTimer("DEBUFF_TASK", null, player);
{
_debufTask.cancel(false);
_debufTask = null;
}
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti;
/** /**
* Mystic Tavern Tauti Instance * Mystic Tavern Tauti Instance
* @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk
* @author Gigi * @author Gigi, Mobius
*/ */
public class StoryOfTauti extends AbstractInstance public class StoryOfTauti extends AbstractInstance
{ {
@@ -93,14 +93,13 @@ public class StoryOfTauti extends AbstractInstance
private static final Location TELEPORT = new Location(153267, -148441, -11560); private static final Location TELEPORT = new Location(153267, -148441, -11560);
private static final int ZONE_1ST_TRIGER = 24137770; private static final int ZONE_1ST_TRIGER = 24137770;
private static final int SKILL_TRIGER = 24138880; private static final int SKILL_TRIGER = 24138880;
private static Npc _deton;
private static Npc _seal_device; private static Npc _seal_device;
protected int _count = 0; protected int _count = 0;
public StoryOfTauti() public StoryOfTauti()
{ {
super(TEMPLATE_ID); super(TEMPLATE_ID);
addSpawnId(DETON, SEAL_DEVICE, FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL); addSpawnId(FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL);
addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL); addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL);
addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL);
addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE);
@@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(1) || world.isStatus(4)) if (world.isStatus(1) || world.isStatus(4))
{ {
_deton.setTarget(player); world.getNpc(DETON).setTarget(player);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
} }
else else
{ {
@@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_status": case "check_status":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()))
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
startQuestTimer("msg_1", 7000, _deton, null); startQuestTimer("msg_1", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_1": case "msg_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW);
startQuestTimer("msg_2", 10000, _deton, null); startQuestTimer("msg_2", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_2": case "msg_2":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE);
startQuestTimer("msg_3", 10000, _deton, null); startQuestTimer("msg_3", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_3": case "msg_3":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME);
break; break;
} }
case "msg_4": case "msg_4":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE);
startQuestTimer("msg_5", 7000, _deton, null); startQuestTimer("msg_5", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_5": case "msg_5":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE);
startQuestTimer("msg_6", 10000, _deton, null); startQuestTimer("msg_6", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_6": case "msg_6":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE);
break; break;
} }
case "spawn_stacato": case "spawn_stacato":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_1", 50000, _deton, null); startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_1": case "spawn_stacato_1":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_2", 50000, _deton, null); startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_2": case "spawn_stacato_2":
@@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_flower": case "check_flower":
{ {
if (!npc.isDead()) if ((world != null) && !npc.isDead())
{ {
for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000))
{ {
if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0))
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, nearby.getLocation(), 23); addMoveToDesire(npc, nearby.getLocation(), 23);
if (npc.calculateDistance3D(nearby) < 100) if (npc.calculateDistance3D(nearby) < 100)
{ {
@@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
} }
startQuestTimer("check_flower", 3000, npc, null);
} }
break; break;
} }
@@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_7": case "msg_7":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN);
break; break;
} }
case "spawn_scorpion": case "spawn_scorpion":
{ {
world.spawnGroup("flame_scorpion"); world.spawnGroup("flame_scorpion");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE);
if (getRandom(10) < 5) if (getRandom(10) < 5)
{ {
world.spawnGroup("ifrit"); world.spawnGroup("ifrit");
@@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if ((pl != null) && !pl.isDead()) if ((pl != null) && !pl.isDead())
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23); addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23);
addAttackPlayerDesire(npc, pl); addAttackPlayerDesire(npc, pl);
} }
@@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_8": case "msg_8":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS);
startQuestTimer("msg_9", 8000, _deton, null); startQuestTimer("msg_9", 8000, world.getNpc(DETON), null);
break; break;
} }
case "msg_9": case "msg_9":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY);
startQuestTimer("msg_10", 10000, _deton, null); startQuestTimer("msg_10", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_10": case "msg_10":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING);
break; break;
} }
case "spawn_golem": case "spawn_golem":
{ {
world.spawnGroup("golem"); world.spawnGroup("golem");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away", 10000, _deton, null); startQuestTimer("run_away", 10000, world.getNpc(DETON), null);
break; break;
} }
case "run_away": case "run_away":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 3500, _deton, null); startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null);
break; break;
} }
case "delete_daton": case "delete_daton":
@@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_11": case "msg_11":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST);
break; break;
} }
case "msg_12": case "msg_12":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA);
startQuestTimer("msg_13", 9000, _deton, null); startQuestTimer("msg_13", 9000, world.getNpc(DETON), null);
break; break;
} }
case "msg_13": case "msg_13":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA);
break; break;
} }
case "spawn_scarab": case "spawn_scarab":
{ {
world.spawnGroup("flame_scarab"); world.spawnGroup("flame_scarab");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away_1", 8000, _deton, null); startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null);
break; break;
} }
case "run_away_1": case "run_away_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 5000, _deton, null); startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null);
break; break;
} }
case "switch_quest": case "switch_quest":
@@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance
} }
case "end_instance": case "end_instance":
{ {
cancelQuestTimers("check_flower");
_count = 0; _count = 0;
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
@@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (npc.isScriptValue(0)) if (npc.isScriptValue(0))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW);
npc.setScriptValue(1); npc.setScriptValue(1);
break; break;
} }
if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60))
{ {
_seal_device.setDisplayEffect(1); _seal_device.setDisplayEffect(1);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE);
npc.setScriptValue(2); npc.setScriptValue(2);
break; break;
} }
@@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30))
{ {
world.spawnGroup("last_deton"); world.spawnGroup("last_deton");
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3);
startQuestTimer("msg_12", 6000, _deton, null); startQuestTimer("msg_12", 6000, world.getNpc(DETON), null);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME);
world.setStatus(11); world.setStatus(11);
} }
if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5)) if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5))
@@ -603,7 +602,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
}); });
startQuestTimer("end_instance", 52000, _deton, null); startQuestTimer("end_instance", 52000, world.getNpc(DETON), null);
world.despawnGroup("last_deton"); world.despawnGroup("last_deton");
world.despawnGroup("last_archagel"); world.despawnGroup("last_archagel");
playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE); playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE);
@@ -627,21 +626,20 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
{ {
cancelQuestTimers("end_instance"); cancelQuestTimer("end_instance", world.getNpc(DETON), null);
cancelQuestTimers("check_flower");
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME)));
world.setStatus(4); world.setStatus(4);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL);
startQuestTimer("msg_7", 7000, _deton, null); startQuestTimer("msg_7", 7000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2)) if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("msg_8", 3000, _deton, null); startQuestTimer("msg_8", 3000, world.getNpc(DETON), null);
world.setStatus(6); world.setStatus(6);
} }
break; break;
@@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance
_seal_device.setDisplayEffect(3); _seal_device.setDisplayEffect(3);
_seal_device.doDie(npc); _seal_device.doDie(npc);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2);
startQuestTimer("msg_11", 3000, _deton, null); startQuestTimer("msg_11", 3000, world.getNpc(DETON), null);
break; break;
} }
case SEALED_ANGEL: case SEALED_ANGEL:
@@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance
if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1))
{ {
world.setStatus(2); world.setStatus(2);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
startQuestTimer("msg_4", 7000, _deton, null); startQuestTimer("msg_4", 7000, world.getNpc(DETON), null);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME)));
startQuestTimer("end_instance", 190000, _deton, null); startQuestTimer("end_instance", 190000, world.getNpc(DETON), null);
startQuestTimer("spawn_stacato", 5000, _deton, null); startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(0)) if (world.isStatus(0))
{ {
startQuestTimer("check_status", 21000, _deton, player); startQuestTimer("check_status", 21000, world.getNpc(DETON), player);
world.setStatus(1); world.setStatus(1);
} }
break; break;
@@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(4)) if (world.isStatus(4))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING);
startQuestTimer("spawn_scorpion", 5000, _deton, player); startQuestTimer("spawn_scorpion", 5000, world.getNpc(DETON), player);
world.setStatus(5); world.setStatus(5);
} }
break; break;
@@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY);
startQuestTimer("spawn_golem", 7000, _deton, player); startQuestTimer("spawn_golem", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT);
startQuestTimer("spawn_scarab", 7000, _deton, player); startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance
{ {
switch (npc.getId()) switch (npc.getId())
{ {
case DETON:
{
_deton = npc;
break;
}
case SEAL_DEVICE: case SEAL_DEVICE:
{ {
_seal_device = npc; _seal_device = npc;
@@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance
} }
case FLAME_STACATO: case FLAME_STACATO:
{ {
startQuestTimer("check_flower", 3000, npc, null, true); startQuestTimer("check_flower", 3000, npc, null);
break; break;
} }
case FLAME_SCORPION: case FLAME_SCORPION:

View File

@@ -34,7 +34,7 @@ import instances.AbstractInstance;
* Nornils Garden Instance * Nornils Garden Instance
* @URL https://l2wiki.com/Nornils_Garden * @URL https://l2wiki.com/Nornils_Garden
* @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs
* @author Gigi * @author Gigi, Mobius
* @date 2017-02-22 - [15:22:27] * @date 2017-02-22 - [15:22:27]
*/ */
public class NornilsGarden extends AbstractInstance public class NornilsGarden extends AbstractInstance
@@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200016, true); world.openCloseDoor(16200016, true);
cancelQuestTimers("stage2"); cancelQuestTimer("stage2", npc, null);
world.spawnGroup("wave_3"); world.spawnGroup("wave_3");
} }
break; break;
@@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200201, true); world.openCloseDoor(16200201, true);
cancelQuestTimers("stage3"); cancelQuestTimer("stage3", npc, null);
cancelQuestTimers("check_agrro");
} }
break; break;
} }
case "check_agrro": case "check_agrro":
{ {
if ((world != null) && !npc.isDead() && !npc.isInCombat()) if ((world != null) && !npc.isDead() && !npc.isInCombat() && !world.getDoor(16200201).isOpen())
{ {
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar ->
{ {
@@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar);
} }
}); });
startQuestTimer("check_agrro", 1000, npc, null);
} }
break; break;
} }
@@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance
{ {
if (npc.getId() == BOZ_STAGE1) if (npc.getId() == BOZ_STAGE1)
{ {
cancelQuestTimers("stage1_1"); cancelQuestTimer("stage1_1", npc, null);
world.openCloseDoor(16200015, true); world.openCloseDoor(16200015, true);
world.setStatus(1); world.setStatus(1);
} }
@@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null);
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }

View File

@@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
cancelQuestTimers("attack"); cancelQuestTimer("attack", npc, null);
cancelQuestTimers("random_Target"); cancelQuestTimer("random_Target", npc, null);
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }

View File

@@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance
{ {
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.getParameters().set("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
npc.teleToLocation(BATTLE_LOC); npc.teleToLocation(BATTLE_LOC);
playMovie(world, Movie.SC_OCTABIS_OPENING); playMovie(world, Movie.SC_OCTABIS_OPENING);
getTimers().addTimer("START_STAGE_1", 26500, npc, null); getTimers().addTimer("START_STAGE_1", 26500, npc, null);

View File

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

View File

@@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
} }
if (questGiver.getId() == 34097) // Adonius if (questGiver.getId() == 34097) // Adonius
{ {
world.getParameters().set("CAPTIVES", world.spawnGroup("captives")); world.setParameter("CAPTIVES", world.spawnGroup("captives"));
for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class)) for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class))
{ {
captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);

View File

@@ -73,27 +73,6 @@ public class ChamberOfProphecies extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
if (event.equals("enterInstance"))
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
}
else if (player != null)
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (event) switch (event)
{ {
case "31639-01.html": case "31639-01.html":
@@ -106,6 +85,11 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33996-02.html": case "33996-02.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(ExShowUsm.USM_Q015_E); world.broadcastPacket(ExShowUsm.USM_Q015_E);
world.despawnGroup("q10753_16_instance_grail"); world.despawnGroup("q10753_16_instance_grail");
world.spawnGroup("q10753_16_instance_wizard"); world.spawnGroup("q10753_16_instance_wizard");
@@ -128,14 +112,53 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33980-05.html": case "33980-05.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup("q10753_16_instance_halter_2"); world.spawnGroup("q10753_16_instance_halter_2");
world.setStatus(6); world.setStatus(6);
startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); startQuestTimer("DESPAWN_WIZARD", 2000, npc, player);
htmltext = event; htmltext = event;
break; break;
} }
case "enterInstance":
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
break;
}
case "teleport":
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimer("CHECK_STATUS", npc, player);
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "status": case "status":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.isStatus(0)) if (world.isStatus(0))
{ {
htmltext = "31639-01.html"; htmltext = "31639-01.html";
@@ -144,18 +167,13 @@ public class ChamberOfProphecies extends AbstractInstance
htmltext = "31639-02.html"; htmltext = "31639-02.html";
break; break;
} }
case "teleport":
{
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimers("CHECK_STATUS");
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "CHECK_STATUS": case "CHECK_STATUS":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (world.getStatus()) switch (world.getStatus())
{ {
case 0: case 0:
@@ -223,6 +241,11 @@ public class ChamberOfProphecies extends AbstractInstance
case "ATTACK1": case "ATTACK1":
case "ATTACK2": case "ATTACK2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
npc.setRunning(); npc.setRunning();
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
@@ -242,7 +265,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR1": case "OPEN_DOOR1":
{ {
cancelQuestTimers("ATTACK"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK", npc, player);
world.setStatus(1); world.setStatus(1);
world.openCloseDoor(DOOR_2, true); world.openCloseDoor(DOOR_2, true);
world.spawnGroup("wof_room2"); world.spawnGroup("wof_room2");
@@ -250,7 +278,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR2": case "OPEN_DOOR2":
{ {
cancelQuestTimers("ATTACK1"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK1", npc, player);
startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true);
world.setStatus(3); world.setStatus(3);
world.spawnGroup("wof_room3"); world.spawnGroup("wof_room3");
@@ -337,23 +370,33 @@ public class ChamberOfProphecies extends AbstractInstance
if (npc.getId() == FERIN) if (npc.getId() == FERIN)
{ {
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player);
cancelQuestTimers("BROADCAST_TEXT"); cancelQuestTimer("BROADCAST_TEXT", npc, player);
} }
break; break;
} }
case "SEY_KAIN_4": case "SEY_KAIN_4":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(5); world.setStatus(5);
world.spawnGroup("q10753_16_instance_grail"); world.spawnGroup("q10753_16_instance_grail");
showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000);
world.openCloseDoor(DOOR_4, true); world.openCloseDoor(DOOR_4, true);
cancelQuestTimers("ATTACK2"); cancelQuestTimer("ATTACK2", npc, player);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player);
startQuestTimer("CLOSE", 15000, null, player); startQuestTimer("CLOSE", 15000, null, player);
break; break;
} }
case "CLOSE": case "CLOSE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
final Npc grail = world.getNpc(GRAIL); final Npc grail = world.getNpc(GRAIL);
if ((grail != null) && (player.calculateDistance2D(grail) < 390)) if ((grail != null) && (player.calculateDistance2D(grail) < 390))
{ {
@@ -369,13 +412,18 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "DESPAWN_WIZARD": case "DESPAWN_WIZARD":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.despawnGroup("q10753_16_instance_wizard"); world.despawnGroup("q10753_16_instance_wizard");
break; break;
} }
case "exit": case "exit":
{ {
startQuestTimer("finish", 3000, npc, player); startQuestTimer("finish", 3000, npc, player);
player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt((int) 1.0D)); player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt(1));
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null) if (qs != null)
{ {
@@ -385,11 +433,15 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "finish": case "finish":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.finishInstance(0); world.finishInstance(0);
break; break;
} }
} }
}
return htmltext; return htmltext;
} }

View File

@@ -17,10 +17,8 @@
package instances.DimensionalWrap; package instances.DimensionalWrap;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.CategoryType; import org.l2jmobius.gameserver.enums.CategoryType;
@@ -44,7 +42,7 @@ import instances.AbstractInstance;
* Dimensional Wrap instance * Dimensional Wrap instance
* @URL https://l2wiki.com/Dimensional_Warp * @URL https://l2wiki.com/Dimensional_Warp
* @Video https://www.youtube.com/watch?v=hOnzk0ELwIg * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg
* @author Gigi * @author Gigi, Mobius
* @date 2018-09-04 - [14:33:31] * @date 2018-09-04 - [14:33:31]
*/ */
public class DimensionalWrap extends AbstractInstance public class DimensionalWrap extends AbstractInstance
@@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance
23480, // Abyssal Harpy 23480, // Abyssal Harpy
23481, // Abyssal Binder 23481, // Abyssal Binder
23482, // Abyssal Archon 23482, // Abyssal Archon
23483 // Abyssal Golem 23483, // Abyssal Golem
}; };
private static final int[] TRAPS = private static final int[] TRAPS =
{ {
@@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance
19559, // Damage trap, power 1 19559, // Damage trap, power 1
19560, // Damage trap, power 2 19560, // Damage trap, power 2
19561, // Damage trap, power 3 19561, // Damage trap, power 3
19562 // Heal Trap 19562, // Heal Trap
}; };
// Location // Location
private static final Location TELEPORTS = new Location(-76136, -216216, 4040); private static final Location TELEPORTS = new Location(-76136, -216216, 4040);
private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360); private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360);
private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584); private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584);
private static final Location THRID_TELEPORT = new Location(-219813, 248484, 9928); private static final Location THIRD_TELEPORT = new Location(-219813, 248484, 9928);
private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984); private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984);
// Misc // Misc
private static final int TEMPLATE_ID = 250; private static final int TEMPLATE_ID = 250;
private static final int DIMENSIONAL_DARK_FORCES = 16415; private static final int DIMENSIONAL_DARK_FORCES = 16415;
private static final int WARP_CRYSTAL = 39597; private static final int WARP_CRYSTAL = 39597;
protected double _chance = 0;
protected int _count = 0;
public int _skilllevel = 1;
public int _worldState = 0;
protected ScheduledFuture<?> _debufTask;
public DimensionalWrap() public DimensionalWrap()
{ {
@@ -125,8 +118,10 @@ public class DimensionalWrap extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
final Instance world = npc.getInstanceWorld();
if (event.equals("enterInstance")) switch (event)
{
case "enterInstance":
{ {
if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{ {
@@ -155,11 +150,8 @@ public class DimensionalWrap extends AbstractInstance
} }
} }
} }
break;
} }
if (isInInstance(world))
{
switch (event)
{
case "33975-01.html": case "33975-01.html":
{ {
htmltext = event; htmltext = event;
@@ -167,10 +159,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "12_warp_crystals": case "12_warp_crystals":
{ {
_chance = 0.3; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.3);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 12; world.setParameter("count", 12);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -183,19 +181,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 6; world.setParameter("count", 6);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 4; world.setParameter("count", 4);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 3; world.setParameter("count", 3);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -204,10 +202,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "240_warp_crystals": case "240_warp_crystals":
{ {
_chance = 0.6; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.6);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 240; world.setParameter("count", 240);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -220,19 +224,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 120; world.setParameter("count", 120);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 80; world.setParameter("count", 80);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 60; world.setParameter("count", 60);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -241,10 +245,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "1200_warp_crystals": case "1200_warp_crystals":
{ {
_chance = 0.9; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.9);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 1200; world.setParameter("count", 1200);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -257,19 +267,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 600; world.setParameter("count", 600);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 400; world.setParameter("count", 400);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 300; world.setParameter("count", 300);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -278,7 +288,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_6_f": case "send_6_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -299,9 +315,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 5) if (world.getStatus() < 5)
{ {
world.setStatus(5); world.setStatus(5);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -311,7 +327,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_11_f": case "send_11_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -321,6 +343,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -331,9 +354,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 10) if (world.getStatus() < 10)
{ {
world.setStatus(10); world.setStatus(10);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -343,7 +366,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_16_f": case "send_16_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -353,6 +382,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -363,19 +393,25 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 15) if (world.getStatus() < 15)
{ {
world.setStatus(15); world.setStatus(15);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId());
} }
break; break;
} }
case "send_21_f": case "send_21_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -385,6 +421,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -395,9 +432,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 20) if (world.getStatus() < 20)
{ {
world.setStatus(20); world.setStatus(20);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -407,7 +444,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_26_f": case "send_26_f":
{ {
if (_worldState == 0) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -417,6 +460,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -427,9 +471,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 25) if (world.getStatus() < 25)
{ {
world.setStatus(25); world.setStatus(25);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -439,15 +483,25 @@ public class DimensionalWrap extends AbstractInstance
} }
case "jump_location": case "jump_location":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
player.teleToLocation(TELEPORTS, world.getTemplateId()); player.teleToLocation(TELEPORTS, world.getTemplateId());
break; break;
} }
case "SALAMANDRA_SPAWN": case "SALAMANDRA_SPAWN":
case "SALAMANDRA_SPAWN_DUMMY": case "SALAMANDRA_SPAWN_DUMMY":
{ {
if (getRandom(100) < (_worldState / 2)) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{ {
final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); return null;
}
if (getRandom(100) < (world.getParameters().getInt("worldState", 0) / 2))
{
final Npc salamandra = addSpawn(world.getParameters().getInt("worldState", 0) < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId());
salamandra.setRunning(); salamandra.setRunning();
World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p ->
{ {
@@ -461,36 +515,57 @@ public class DimensionalWrap extends AbstractInstance
} }
case "START_STAGE": case "START_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(world.getStatus() + 1); world.setStatus(world.getStatus() + 1);
_worldState = world.getStatus(); world.setParameter("worldState", world.getStatus());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus())));
startQuestTimer("FIRST_SPAWN", 1500, npc, null); startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer());
break; break;
} }
case "FIRST_SPAWN": case "FIRST_SPAWN":
{ {
world.spawnGroup(_worldState + "_first_spawn"); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("SECOND_SPAWN", 40000, npc, null);
_debufTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if ((_worldState > 0) && (_worldState <= 11)) return null;
{
_skilllevel = 1;
} }
else if ((_worldState > 11) && (_worldState <= 20)) final int worldState = world.getParameters().getInt("worldState", 0);
{ world.spawnGroup(worldState + "_first_spawn");
_skilllevel = 2; world.spawnGroup(worldState + "_trap_spawn");
startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer());
startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true);
break;
} }
else if ((_worldState > 20) && (_worldState <= 30)) case "DEBUFF_TASK":
{ {
_skilllevel = 3; final Instance world = player.getInstanceWorld();
} if (!isInInstance(world))
else if (_worldState > 30)
{ {
_skilllevel = 4; return null;
} }
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, _skilllevel); int skilllevel = 1;
final int worldState = world.getParameters().getInt("worldState", 0);
if ((worldState > 0) && (worldState <= 11))
{
skilllevel = 1;
}
else if ((worldState > 11) && (worldState <= 20))
{
skilllevel = 2;
}
else if ((worldState > 20) && (worldState <= 30))
{
skilllevel = 3;
}
else if (worldState > 30)
{
skilllevel = 4;
}
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, skilllevel);
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if ((p != null) && !p.isDead()) if ((p != null) && !p.isDead())
@@ -498,47 +573,71 @@ public class DimensionalWrap extends AbstractInstance
skill.applyEffects(p, p); skill.applyEffects(p, p);
} }
} }
}, 5000, 10000);
break; break;
} }
case "SECOND_SPAWN": case "SECOND_SPAWN":
{ {
world.spawnGroup(_worldState + "_second_spawn"); final Instance world = player.getInstanceWorld();
startQuestTimer("THRID_SPAWN", 40000, npc, null); if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn");
startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer());
break; break;
} }
case "THRID_SPAWN": case "THIRD_SPAWN":
{ {
world.spawnGroup(_worldState + "_thred_spawn"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn");
break; break;
} }
case "CHANGE_LOCATION": case "CHANGE_LOCATION":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe);
world.spawnGroup(_worldState + "_trap_spawn"); world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_trap_spawn");
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1430), null, world.getFirstPlayer());
break; break;
} }
case "SWITCH_STAGE": case "SWITCH_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getAliveNpcs(MONSTERS).isEmpty()) if (world.getAliveNpcs(MONSTERS).isEmpty())
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true));
world.broadcastPacket(new Earthquake(npc, 50, 5)); world.broadcastPacket(new Earthquake(npc, 50, 5));
world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true);
clean(); clean(world.getFirstPlayer());
if (_worldState < 35) if (world.getParameters().getInt("worldState", 0) < 35)
{ {
startQuestTimer("NEXT_STAGE", 5000, npc, null); startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer());
} }
} }
break; break;
} }
case "NEXT_STAGE": case "NEXT_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180)));
world.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); world.setDuration((int) ((world.getRemainingTime() / 60000) + 3));
startQuestTimer("START_STAGE", 8000, npc, null); startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer());
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -549,7 +648,6 @@ public class DimensionalWrap extends AbstractInstance
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world)) if (isInInstance(world))
{ {
if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < _chance)) if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < world.getParameters().getDouble("chance", 0)))
{ {
if (_worldState < 9) final int worldState = world.getParameters().getInt("worldState", 0);
if (worldState < 9)
{ {
addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId()); addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if ((_worldState >= 9) && (_worldState < 20)) else if ((worldState >= 9) && (worldState < 20))
{ {
addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId()); addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if (_worldState >= 20) else if (worldState >= 20)
{ {
addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId()); addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
@@ -581,7 +680,7 @@ public class DimensionalWrap extends AbstractInstance
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true));
world.finishInstance(3); world.finishInstance(3);
clean(); clean(world.getFirstPlayer());
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance
@Override @Override
public String onFirstTalk(Npc npc, PlayerInstance player) public String onFirstTalk(Npc npc, PlayerInstance player)
{ {
if (_worldState == 20) final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (world.getParameters().getInt("worldState", 0) == 20))
{ {
return "33975-04.html"; return "33975-04.html";
} }
@@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance
{ {
case SALAMANDRA_GENERATOR: case SALAMANDRA_GENERATOR:
{ {
startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true);
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer());
break; break;
} }
case SALAMANDRA_GENERATOR_DUMMY: case SALAMANDRA_GENERATOR_DUMMY:
{ {
startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true);
break; break;
} }
case DEMINSIONAL_INVISIBLE_FRAGMENT: case DEMINSIONAL_INVISIBLE_FRAGMENT:
{ {
startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true);
break; break;
} }
} }
@@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance
boolean canStart = true; boolean canStart = true;
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < _count) if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < world.getParameters().getInt("count", 0))
{ {
for (PlayerInstance ps : world.getPlayers()) for (PlayerInstance ps : world.getPlayers())
{ {
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
packet.setHtml(getHtm(ps, "33975-03.html")); packet.setHtml(getHtm(ps, "33975-03.html"));
packet.replace("%count%", Integer.toString(_count)); packet.replace("%count%", Integer.toString(world.getParameters().getInt("count", 0)));
ps.sendPacket(packet); ps.sendPacket(packet);
ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName()));
canStart = false; canStart = false;
} }
} }
} }
if (!canStart || (_worldState != 0)) if (!canStart || (world.getParameters().getInt("worldState", 0) != 0))
{ {
return; return;
} }
startQuestTimer("START_STAGE", 1000, npc, null); startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer());
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
takeItems(p, WARP_CRYSTAL, _count); takeItems(p, WARP_CRYSTAL, world.getParameters().getInt("count", 0));
} }
} }
protected void clean() protected void clean(PlayerInstance player)
{ {
cancelQuestTimers("SWITCH_STAGE"); cancelQuestTimer("SWITCH_STAGE", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN"); cancelQuestTimer("SALAMANDRA_SPAWN", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player);
cancelQuestTimers("CHANGE_LOCATION"); cancelQuestTimer("CHANGE_LOCATION", null, player);
if (_debufTask != null) cancelQuestTimer("DEBUFF_TASK", null, player);
{
_debufTask.cancel(false);
_debufTask = null;
}
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti;
/** /**
* Mystic Tavern Tauti Instance * Mystic Tavern Tauti Instance
* @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk
* @author Gigi * @author Gigi, Mobius
*/ */
public class StoryOfTauti extends AbstractInstance public class StoryOfTauti extends AbstractInstance
{ {
@@ -93,14 +93,13 @@ public class StoryOfTauti extends AbstractInstance
private static final Location TELEPORT = new Location(153267, -148441, -11560); private static final Location TELEPORT = new Location(153267, -148441, -11560);
private static final int ZONE_1ST_TRIGER = 24137770; private static final int ZONE_1ST_TRIGER = 24137770;
private static final int SKILL_TRIGER = 24138880; private static final int SKILL_TRIGER = 24138880;
private static Npc _deton;
private static Npc _seal_device; private static Npc _seal_device;
protected int _count = 0; protected int _count = 0;
public StoryOfTauti() public StoryOfTauti()
{ {
super(TEMPLATE_ID); super(TEMPLATE_ID);
addSpawnId(DETON, SEAL_DEVICE, FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL); addSpawnId(FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL);
addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL); addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL);
addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL);
addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE);
@@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(1) || world.isStatus(4)) if (world.isStatus(1) || world.isStatus(4))
{ {
_deton.setTarget(player); world.getNpc(DETON).setTarget(player);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
} }
else else
{ {
@@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_status": case "check_status":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()))
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
startQuestTimer("msg_1", 7000, _deton, null); startQuestTimer("msg_1", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_1": case "msg_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW);
startQuestTimer("msg_2", 10000, _deton, null); startQuestTimer("msg_2", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_2": case "msg_2":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE);
startQuestTimer("msg_3", 10000, _deton, null); startQuestTimer("msg_3", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_3": case "msg_3":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME);
break; break;
} }
case "msg_4": case "msg_4":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE);
startQuestTimer("msg_5", 7000, _deton, null); startQuestTimer("msg_5", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_5": case "msg_5":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE);
startQuestTimer("msg_6", 10000, _deton, null); startQuestTimer("msg_6", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_6": case "msg_6":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE);
break; break;
} }
case "spawn_stacato": case "spawn_stacato":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_1", 50000, _deton, null); startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_1": case "spawn_stacato_1":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_2", 50000, _deton, null); startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_2": case "spawn_stacato_2":
@@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_flower": case "check_flower":
{ {
if (!npc.isDead()) if ((world != null) && !npc.isDead())
{ {
for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000))
{ {
if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0))
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, nearby.getLocation(), 23); addMoveToDesire(npc, nearby.getLocation(), 23);
if (npc.calculateDistance3D(nearby) < 100) if (npc.calculateDistance3D(nearby) < 100)
{ {
@@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
} }
startQuestTimer("check_flower", 3000, npc, null);
} }
break; break;
} }
@@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_7": case "msg_7":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN);
break; break;
} }
case "spawn_scorpion": case "spawn_scorpion":
{ {
world.spawnGroup("flame_scorpion"); world.spawnGroup("flame_scorpion");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE);
if (getRandom(10) < 5) if (getRandom(10) < 5)
{ {
world.spawnGroup("ifrit"); world.spawnGroup("ifrit");
@@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if ((pl != null) && !pl.isDead()) if ((pl != null) && !pl.isDead())
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23); addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23);
addAttackPlayerDesire(npc, pl); addAttackPlayerDesire(npc, pl);
} }
@@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_8": case "msg_8":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS);
startQuestTimer("msg_9", 8000, _deton, null); startQuestTimer("msg_9", 8000, world.getNpc(DETON), null);
break; break;
} }
case "msg_9": case "msg_9":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY);
startQuestTimer("msg_10", 10000, _deton, null); startQuestTimer("msg_10", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_10": case "msg_10":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING);
break; break;
} }
case "spawn_golem": case "spawn_golem":
{ {
world.spawnGroup("golem"); world.spawnGroup("golem");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away", 10000, _deton, null); startQuestTimer("run_away", 10000, world.getNpc(DETON), null);
break; break;
} }
case "run_away": case "run_away":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 3500, _deton, null); startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null);
break; break;
} }
case "delete_daton": case "delete_daton":
@@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_11": case "msg_11":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST);
break; break;
} }
case "msg_12": case "msg_12":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA);
startQuestTimer("msg_13", 9000, _deton, null); startQuestTimer("msg_13", 9000, world.getNpc(DETON), null);
break; break;
} }
case "msg_13": case "msg_13":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA);
break; break;
} }
case "spawn_scarab": case "spawn_scarab":
{ {
world.spawnGroup("flame_scarab"); world.spawnGroup("flame_scarab");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away_1", 8000, _deton, null); startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null);
break; break;
} }
case "run_away_1": case "run_away_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 5000, _deton, null); startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null);
break; break;
} }
case "switch_quest": case "switch_quest":
@@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance
} }
case "end_instance": case "end_instance":
{ {
cancelQuestTimers("check_flower");
_count = 0; _count = 0;
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
@@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (npc.isScriptValue(0)) if (npc.isScriptValue(0))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW);
npc.setScriptValue(1); npc.setScriptValue(1);
break; break;
} }
if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60))
{ {
_seal_device.setDisplayEffect(1); _seal_device.setDisplayEffect(1);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE);
npc.setScriptValue(2); npc.setScriptValue(2);
break; break;
} }
@@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30))
{ {
world.spawnGroup("last_deton"); world.spawnGroup("last_deton");
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3);
startQuestTimer("msg_12", 6000, _deton, null); startQuestTimer("msg_12", 6000, world.getNpc(DETON), null);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME);
world.setStatus(11); world.setStatus(11);
} }
if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5)) if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5))
@@ -603,7 +602,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
}); });
startQuestTimer("end_instance", 52000, _deton, null); startQuestTimer("end_instance", 52000, world.getNpc(DETON), null);
world.despawnGroup("last_deton"); world.despawnGroup("last_deton");
world.despawnGroup("last_archagel"); world.despawnGroup("last_archagel");
playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE); playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE);
@@ -627,21 +626,20 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
{ {
cancelQuestTimers("end_instance"); cancelQuestTimer("end_instance", world.getNpc(DETON), null);
cancelQuestTimers("check_flower");
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME)));
world.setStatus(4); world.setStatus(4);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL);
startQuestTimer("msg_7", 7000, _deton, null); startQuestTimer("msg_7", 7000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2)) if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("msg_8", 3000, _deton, null); startQuestTimer("msg_8", 3000, world.getNpc(DETON), null);
world.setStatus(6); world.setStatus(6);
} }
break; break;
@@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance
_seal_device.setDisplayEffect(3); _seal_device.setDisplayEffect(3);
_seal_device.doDie(npc); _seal_device.doDie(npc);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2);
startQuestTimer("msg_11", 3000, _deton, null); startQuestTimer("msg_11", 3000, world.getNpc(DETON), null);
break; break;
} }
case SEALED_ANGEL: case SEALED_ANGEL:
@@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance
if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1))
{ {
world.setStatus(2); world.setStatus(2);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
startQuestTimer("msg_4", 7000, _deton, null); startQuestTimer("msg_4", 7000, world.getNpc(DETON), null);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME)));
startQuestTimer("end_instance", 190000, _deton, null); startQuestTimer("end_instance", 190000, world.getNpc(DETON), null);
startQuestTimer("spawn_stacato", 5000, _deton, null); startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(0)) if (world.isStatus(0))
{ {
startQuestTimer("check_status", 21000, _deton, player); startQuestTimer("check_status", 21000, world.getNpc(DETON), player);
world.setStatus(1); world.setStatus(1);
} }
break; break;
@@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(4)) if (world.isStatus(4))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING);
startQuestTimer("spawn_scorpion", 5000, _deton, player); startQuestTimer("spawn_scorpion", 5000, world.getNpc(DETON), player);
world.setStatus(5); world.setStatus(5);
} }
break; break;
@@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY);
startQuestTimer("spawn_golem", 7000, _deton, player); startQuestTimer("spawn_golem", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT);
startQuestTimer("spawn_scarab", 7000, _deton, player); startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance
{ {
switch (npc.getId()) switch (npc.getId())
{ {
case DETON:
{
_deton = npc;
break;
}
case SEAL_DEVICE: case SEAL_DEVICE:
{ {
_seal_device = npc; _seal_device = npc;
@@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance
} }
case FLAME_STACATO: case FLAME_STACATO:
{ {
startQuestTimer("check_flower", 3000, npc, null, true); startQuestTimer("check_flower", 3000, npc, null);
break; break;
} }
case FLAME_SCORPION: case FLAME_SCORPION:

View File

@@ -34,7 +34,7 @@ import instances.AbstractInstance;
* Nornils Garden Instance * Nornils Garden Instance
* @URL https://l2wiki.com/Nornils_Garden * @URL https://l2wiki.com/Nornils_Garden
* @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs
* @author Gigi * @author Gigi, Mobius
* @date 2017-02-22 - [15:22:27] * @date 2017-02-22 - [15:22:27]
*/ */
public class NornilsGarden extends AbstractInstance public class NornilsGarden extends AbstractInstance
@@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200016, true); world.openCloseDoor(16200016, true);
cancelQuestTimers("stage2"); cancelQuestTimer("stage2", npc, null);
world.spawnGroup("wave_3"); world.spawnGroup("wave_3");
} }
break; break;
@@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200201, true); world.openCloseDoor(16200201, true);
cancelQuestTimers("stage3"); cancelQuestTimer("stage3", npc, null);
cancelQuestTimers("check_agrro");
} }
break; break;
} }
case "check_agrro": case "check_agrro":
{ {
if ((world != null) && !npc.isDead() && !npc.isInCombat()) if ((world != null) && !npc.isDead() && !npc.isInCombat() && !world.getDoor(16200201).isOpen())
{ {
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar ->
{ {
@@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar);
} }
}); });
startQuestTimer("check_agrro", 1000, npc, null);
} }
break; break;
} }
@@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance
{ {
if (npc.getId() == BOZ_STAGE1) if (npc.getId() == BOZ_STAGE1)
{ {
cancelQuestTimers("stage1_1"); cancelQuestTimer("stage1_1", npc, null);
world.openCloseDoor(16200015, true); world.openCloseDoor(16200015, true);
world.setStatus(1); world.setStatus(1);
} }
@@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null);
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }

View File

@@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
cancelQuestTimers("attack"); cancelQuestTimer("attack", npc, null);
cancelQuestTimers("random_Target"); cancelQuestTimer("random_Target", npc, null);
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }

View File

@@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance
{ {
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.getParameters().set("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
npc.teleToLocation(BATTLE_LOC); npc.teleToLocation(BATTLE_LOC);
playMovie(world, Movie.SC_OCTABIS_OPENING); playMovie(world, Movie.SC_OCTABIS_OPENING);
getTimers().addTimer("START_STAGE_1", 26500, npc, null); getTimers().addTimer("START_STAGE_1", 26500, npc, null);

View File

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

View File

@@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
} }
if (questGiver.getId() == 34097) // Adonius if (questGiver.getId() == 34097) // Adonius
{ {
world.getParameters().set("CAPTIVES", world.spawnGroup("captives")); world.setParameter("CAPTIVES", world.spawnGroup("captives"));
for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class)) for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class))
{ {
captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);

View File

@@ -73,27 +73,6 @@ public class ChamberOfProphecies extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
if (event.equals("enterInstance"))
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
}
else if (player != null)
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (event) switch (event)
{ {
case "31639-01.html": case "31639-01.html":
@@ -106,6 +85,11 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33996-02.html": case "33996-02.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(ExShowUsm.USM_Q015_E); world.broadcastPacket(ExShowUsm.USM_Q015_E);
world.despawnGroup("q10753_16_instance_grail"); world.despawnGroup("q10753_16_instance_grail");
world.spawnGroup("q10753_16_instance_wizard"); world.spawnGroup("q10753_16_instance_wizard");
@@ -128,14 +112,53 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33980-05.html": case "33980-05.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup("q10753_16_instance_halter_2"); world.spawnGroup("q10753_16_instance_halter_2");
world.setStatus(6); world.setStatus(6);
startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); startQuestTimer("DESPAWN_WIZARD", 2000, npc, player);
htmltext = event; htmltext = event;
break; break;
} }
case "enterInstance":
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
break;
}
case "teleport":
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimer("CHECK_STATUS", npc, player);
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "status": case "status":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.isStatus(0)) if (world.isStatus(0))
{ {
htmltext = "31639-01.html"; htmltext = "31639-01.html";
@@ -144,18 +167,13 @@ public class ChamberOfProphecies extends AbstractInstance
htmltext = "31639-02.html"; htmltext = "31639-02.html";
break; break;
} }
case "teleport":
{
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimers("CHECK_STATUS");
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "CHECK_STATUS": case "CHECK_STATUS":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (world.getStatus()) switch (world.getStatus())
{ {
case 0: case 0:
@@ -223,6 +241,11 @@ public class ChamberOfProphecies extends AbstractInstance
case "ATTACK1": case "ATTACK1":
case "ATTACK2": case "ATTACK2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
npc.setRunning(); npc.setRunning();
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
@@ -242,7 +265,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR1": case "OPEN_DOOR1":
{ {
cancelQuestTimers("ATTACK"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK", npc, player);
world.setStatus(1); world.setStatus(1);
world.openCloseDoor(DOOR_2, true); world.openCloseDoor(DOOR_2, true);
world.spawnGroup("wof_room2"); world.spawnGroup("wof_room2");
@@ -250,7 +278,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR2": case "OPEN_DOOR2":
{ {
cancelQuestTimers("ATTACK1"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK1", npc, player);
startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true);
world.setStatus(3); world.setStatus(3);
world.spawnGroup("wof_room3"); world.spawnGroup("wof_room3");
@@ -337,23 +370,33 @@ public class ChamberOfProphecies extends AbstractInstance
if (npc.getId() == FERIN) if (npc.getId() == FERIN)
{ {
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player);
cancelQuestTimers("BROADCAST_TEXT"); cancelQuestTimer("BROADCAST_TEXT", npc, player);
} }
break; break;
} }
case "SEY_KAIN_4": case "SEY_KAIN_4":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(5); world.setStatus(5);
world.spawnGroup("q10753_16_instance_grail"); world.spawnGroup("q10753_16_instance_grail");
showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000);
world.openCloseDoor(DOOR_4, true); world.openCloseDoor(DOOR_4, true);
cancelQuestTimers("ATTACK2"); cancelQuestTimer("ATTACK2", npc, player);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player);
startQuestTimer("CLOSE", 15000, null, player); startQuestTimer("CLOSE", 15000, null, player);
break; break;
} }
case "CLOSE": case "CLOSE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
final Npc grail = world.getNpc(GRAIL); final Npc grail = world.getNpc(GRAIL);
if ((grail != null) && (player.calculateDistance2D(grail) < 390)) if ((grail != null) && (player.calculateDistance2D(grail) < 390))
{ {
@@ -369,13 +412,18 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "DESPAWN_WIZARD": case "DESPAWN_WIZARD":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.despawnGroup("q10753_16_instance_wizard"); world.despawnGroup("q10753_16_instance_wizard");
break; break;
} }
case "exit": case "exit":
{ {
startQuestTimer("finish", 3000, npc, player); startQuestTimer("finish", 3000, npc, player);
player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MIN_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt((int) 1.0D)); player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MIN_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt(1));
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null) if (qs != null)
{ {
@@ -385,11 +433,15 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "finish": case "finish":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.finishInstance(0); world.finishInstance(0);
break; break;
} }
} }
}
return htmltext; return htmltext;
} }

View File

@@ -17,10 +17,8 @@
package instances.DimensionalWrap; package instances.DimensionalWrap;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.CategoryType; import org.l2jmobius.gameserver.enums.CategoryType;
@@ -44,7 +42,7 @@ import instances.AbstractInstance;
* Dimensional Wrap instance * Dimensional Wrap instance
* @URL https://l2wiki.com/Dimensional_Warp * @URL https://l2wiki.com/Dimensional_Warp
* @Video https://www.youtube.com/watch?v=hOnzk0ELwIg * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg
* @author Gigi * @author Gigi, Mobius
* @date 2018-09-04 - [14:33:31] * @date 2018-09-04 - [14:33:31]
*/ */
public class DimensionalWrap extends AbstractInstance public class DimensionalWrap extends AbstractInstance
@@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance
23480, // Abyssal Harpy 23480, // Abyssal Harpy
23481, // Abyssal Binder 23481, // Abyssal Binder
23482, // Abyssal Archon 23482, // Abyssal Archon
23483 // Abyssal Golem 23483, // Abyssal Golem
}; };
private static final int[] TRAPS = private static final int[] TRAPS =
{ {
@@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance
19559, // Damage trap, power 1 19559, // Damage trap, power 1
19560, // Damage trap, power 2 19560, // Damage trap, power 2
19561, // Damage trap, power 3 19561, // Damage trap, power 3
19562 // Heal Trap 19562, // Heal Trap
}; };
// Location // Location
private static final Location TELEPORTS = new Location(-76136, -216216, 4040); private static final Location TELEPORTS = new Location(-76136, -216216, 4040);
private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360); private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360);
private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584); private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584);
private static final Location THRID_TELEPORT = new Location(-219813, 248484, 9928); private static final Location THIRD_TELEPORT = new Location(-219813, 248484, 9928);
private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984); private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984);
// Misc // Misc
private static final int TEMPLATE_ID = 250; private static final int TEMPLATE_ID = 250;
private static final int DIMENSIONAL_DARK_FORCES = 16415; private static final int DIMENSIONAL_DARK_FORCES = 16415;
private static final int WARP_CRYSTAL = 39597; private static final int WARP_CRYSTAL = 39597;
protected double _chance = 0;
protected int _count = 0;
public int _skilllevel = 1;
public int _worldState = 0;
protected ScheduledFuture<?> _debufTask;
public DimensionalWrap() public DimensionalWrap()
{ {
@@ -125,8 +118,10 @@ public class DimensionalWrap extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
final Instance world = npc.getInstanceWorld();
if (event.equals("enterInstance")) switch (event)
{
case "enterInstance":
{ {
if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{ {
@@ -155,11 +150,8 @@ public class DimensionalWrap extends AbstractInstance
} }
} }
} }
break;
} }
if (isInInstance(world))
{
switch (event)
{
case "33975-01.html": case "33975-01.html":
{ {
htmltext = event; htmltext = event;
@@ -167,11 +159,17 @@ public class DimensionalWrap extends AbstractInstance
} }
case "12_warp_crystals": case "12_warp_crystals":
{ {
_chance = 0.3; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.3);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 12; world.setParameter("count", 12);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
else if (player.isInParty() && !player.getParty().isLeader(player)) else if (player.isInParty() && !player.getParty().isLeader(player))
@@ -183,20 +181,20 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 6; world.setParameter("count", 6);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 4; world.setParameter("count", 4);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 3; world.setParameter("count", 3);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
} }
@@ -204,11 +202,17 @@ public class DimensionalWrap extends AbstractInstance
} }
case "240_warp_crystals": case "240_warp_crystals":
{ {
_chance = 0.6; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.6);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 240; world.setParameter("count", 240);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
else if (player.isInParty() && !player.getParty().isLeader(player)) else if (player.isInParty() && !player.getParty().isLeader(player))
@@ -220,20 +224,20 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 120; world.setParameter("count", 120);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 80; world.setParameter("count", 80);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 60; world.setParameter("count", 60);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
} }
@@ -241,11 +245,17 @@ public class DimensionalWrap extends AbstractInstance
} }
case "1200_warp_crystals": case "1200_warp_crystals":
{ {
_chance = 0.9; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.9);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 1200; world.setParameter("count", 1200);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
else if (player.isInParty() && !player.getParty().isLeader(player)) else if (player.isInParty() && !player.getParty().isLeader(player))
@@ -257,20 +267,20 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 600; world.setParameter("count", 600);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 400; world.setParameter("count", 400);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 300; world.setParameter("count", 300);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
} }
@@ -278,7 +288,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_6_f": case "send_6_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -299,9 +315,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 5) if (world.getStatus() < 5)
{ {
world.setStatus(5); world.setStatus(5);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -311,7 +327,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_11_f": case "send_11_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -321,6 +343,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -331,9 +354,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 10) if (world.getStatus() < 10)
{ {
world.setStatus(10); world.setStatus(10);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -343,7 +366,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_16_f": case "send_16_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -353,6 +382,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -363,19 +393,25 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 15) if (world.getStatus() < 15)
{ {
world.setStatus(15); world.setStatus(15);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId());
} }
break; break;
} }
case "send_21_f": case "send_21_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -385,6 +421,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -395,9 +432,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 20) if (world.getStatus() < 20)
{ {
world.setStatus(20); world.setStatus(20);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -407,7 +444,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_26_f": case "send_26_f":
{ {
if (_worldState == 0) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -417,6 +460,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -427,9 +471,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 25) if (world.getStatus() < 25)
{ {
world.setStatus(25); world.setStatus(25);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -439,15 +483,25 @@ public class DimensionalWrap extends AbstractInstance
} }
case "jump_location": case "jump_location":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
player.teleToLocation(TELEPORTS, world.getTemplateId()); player.teleToLocation(TELEPORTS, world.getTemplateId());
break; break;
} }
case "SALAMANDRA_SPAWN": case "SALAMANDRA_SPAWN":
case "SALAMANDRA_SPAWN_DUMMY": case "SALAMANDRA_SPAWN_DUMMY":
{ {
if (getRandom(100) < (_worldState / 2)) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{ {
final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); return null;
}
if (getRandom(100) < (world.getParameters().getInt("worldState", 0) / 2))
{
final Npc salamandra = addSpawn(world.getParameters().getInt("worldState", 0) < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId());
salamandra.setRunning(); salamandra.setRunning();
World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p ->
{ {
@@ -461,36 +515,57 @@ public class DimensionalWrap extends AbstractInstance
} }
case "START_STAGE": case "START_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(world.getStatus() + 1); world.setStatus(world.getStatus() + 1);
_worldState = world.getStatus(); world.setParameter("worldState", world.getStatus());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus())));
startQuestTimer("FIRST_SPAWN", 1500, npc, null); startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer());
break; break;
} }
case "FIRST_SPAWN": case "FIRST_SPAWN":
{ {
world.spawnGroup(_worldState + "_first_spawn"); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("SECOND_SPAWN", 40000, npc, null);
_debufTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if ((_worldState > 0) && (_worldState <= 11)) return null;
{
_skilllevel = 1;
} }
else if ((_worldState > 11) && (_worldState <= 20)) final int worldState = world.getParameters().getInt("worldState", 0);
{ world.spawnGroup(worldState + "_first_spawn");
_skilllevel = 2; world.spawnGroup(worldState + "_trap_spawn");
startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer());
startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true);
break;
} }
else if ((_worldState > 20) && (_worldState <= 30)) case "DEBUFF_TASK":
{ {
_skilllevel = 3; final Instance world = player.getInstanceWorld();
} if (!isInInstance(world))
else if (_worldState > 30)
{ {
_skilllevel = 4; return null;
} }
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, _skilllevel); int skilllevel = 1;
final int worldState = world.getParameters().getInt("worldState", 0);
if ((worldState > 0) && (worldState <= 11))
{
skilllevel = 1;
}
else if ((worldState > 11) && (worldState <= 20))
{
skilllevel = 2;
}
else if ((worldState > 20) && (worldState <= 30))
{
skilllevel = 3;
}
else if (worldState > 30)
{
skilllevel = 4;
}
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, skilllevel);
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if ((p != null) && !p.isDead()) if ((p != null) && !p.isDead())
@@ -498,47 +573,71 @@ public class DimensionalWrap extends AbstractInstance
skill.applyEffects(p, p); skill.applyEffects(p, p);
} }
} }
}, 5000, 10000);
break; break;
} }
case "SECOND_SPAWN": case "SECOND_SPAWN":
{ {
world.spawnGroup(_worldState + "_second_spawn"); final Instance world = player.getInstanceWorld();
startQuestTimer("THRID_SPAWN", 40000, npc, null); if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn");
startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer());
break; break;
} }
case "THRID_SPAWN": case "THIRD_SPAWN":
{ {
world.spawnGroup(_worldState + "_thred_spawn"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn");
break; break;
} }
case "CHANGE_LOCATION": case "CHANGE_LOCATION":
{ {
world.getAliveNpcs(TRAPS).forEach(t -> t.deleteMe()); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); {
return null;
}
world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe);
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_trap_spawn");
startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1430), null, world.getFirstPlayer());
break; break;
} }
case "SWITCH_STAGE": case "SWITCH_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getAliveNpcs(MONSTERS).isEmpty()) if (world.getAliveNpcs(MONSTERS).isEmpty())
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true));
world.broadcastPacket(new Earthquake(npc, 50, 5)); world.broadcastPacket(new Earthquake(npc, 50, 5));
world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true);
Clean(); clean(world.getFirstPlayer());
if (_worldState < 35) if (world.getParameters().getInt("worldState", 0) < 35)
{ {
startQuestTimer("NEXT_STAGE", 5000, npc, null); startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer());
} }
} }
break; break;
} }
case "NEXT_STAGE": case "NEXT_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCE_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCE_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180)));
world.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); world.setDuration((int) ((world.getRemainingTime() / 60000) + 3));
startQuestTimer("START_STAGE", 8000, npc, null); startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer());
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -549,7 +648,6 @@ public class DimensionalWrap extends AbstractInstance
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world)) if (isInInstance(world))
{ {
if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < _chance)) if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < world.getParameters().getDouble("chance", 0)))
{ {
if (_worldState < 9) final int worldState = world.getParameters().getInt("worldState", 0);
if (worldState < 9)
{ {
addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId()); addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if ((_worldState >= 9) && (_worldState < 20)) else if ((worldState >= 9) && (worldState < 20))
{ {
addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId()); addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if (_worldState >= 20) else if (worldState >= 20)
{ {
addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId()); addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
@@ -581,7 +680,7 @@ public class DimensionalWrap extends AbstractInstance
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCE_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCE_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true));
world.finishInstance(3); world.finishInstance(3);
Clean(); clean(world.getFirstPlayer());
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance
@Override @Override
public String onFirstTalk(Npc npc, PlayerInstance player) public String onFirstTalk(Npc npc, PlayerInstance player)
{ {
if (_worldState == 20) final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (world.getParameters().getInt("worldState", 0) == 20))
{ {
return "33975-04.html"; return "33975-04.html";
} }
@@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance
{ {
case SALAMANDRA_GENERATOR: case SALAMANDRA_GENERATOR:
{ {
startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true);
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer());
break; break;
} }
case SALAMANDRA_GENERATOR_DUMMY: case SALAMANDRA_GENERATOR_DUMMY:
{ {
startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true);
break; break;
} }
case DEMINSIONAL_INVISIBLE_FRAGMENT: case DEMINSIONAL_INVISIBLE_FRAGMENT:
{ {
startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true);
break; break;
} }
} }
@@ -626,47 +726,43 @@ public class DimensionalWrap extends AbstractInstance
return super.onSpawn(npc); return super.onSpawn(npc);
} }
public void CheckCrystallCount(Instance world, PlayerInstance player, Npc npc) public void checkCrystallCount(Instance world, Npc npc)
{ {
boolean canStart = true; boolean canStart = true;
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < _count) if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < world.getParameters().getInt("count", 0))
{ {
for (PlayerInstance ps : world.getPlayers()) for (PlayerInstance ps : world.getPlayers())
{ {
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
packet.setHtml(getHtm(ps, "33975-03.html")); packet.setHtml(getHtm(ps, "33975-03.html"));
packet.replace("%count%", Integer.toString(_count)); packet.replace("%count%", Integer.toString(world.getParameters().getInt("count", 0)));
ps.sendPacket(packet); ps.sendPacket(packet);
ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName()));
canStart = false; canStart = false;
} }
} }
} }
if (!canStart || (_worldState != 0)) if (!canStart || (world.getParameters().getInt("worldState", 0) != 0))
{ {
return; return;
} }
startQuestTimer("START_STAGE", 1000, npc, null); startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer());
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
takeItems(p, WARP_CRYSTAL, _count); takeItems(p, WARP_CRYSTAL, world.getParameters().getInt("count", 0));
} }
} }
protected void Clean() protected void clean(PlayerInstance player)
{ {
cancelQuestTimers("SWITCH_STAGE"); cancelQuestTimer("SWITCH_STAGE", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN"); cancelQuestTimer("SALAMANDRA_SPAWN", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player);
cancelQuestTimers("CHANGE_LOCATION"); cancelQuestTimer("CHANGE_LOCATION", null, player);
if (_debufTask != null) cancelQuestTimer("DEBUFF_TASK", null, player);
{
_debufTask.cancel(false);
_debufTask = null;
}
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti;
/** /**
* Mystic Tavern Tauti Instance * Mystic Tavern Tauti Instance
* @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk
* @author Gigi * @author Gigi, Mobius
*/ */
public class StoryOfTauti extends AbstractInstance public class StoryOfTauti extends AbstractInstance
{ {
@@ -93,14 +93,13 @@ public class StoryOfTauti extends AbstractInstance
private static final Location TELEPORT = new Location(153267, -148441, -11560); private static final Location TELEPORT = new Location(153267, -148441, -11560);
private static final int ZONE_1ST_TRIGER = 24137770; private static final int ZONE_1ST_TRIGER = 24137770;
private static final int SKILL_TRIGER = 24138880; private static final int SKILL_TRIGER = 24138880;
private static Npc _deton;
private static Npc _seal_device; private static Npc _seal_device;
protected int _count = 0; protected int _count = 0;
public StoryOfTauti() public StoryOfTauti()
{ {
super(TEMPLATE_ID); super(TEMPLATE_ID);
addSpawnId(DETON, SEAL_DEVICE, FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL); addSpawnId(FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL);
addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL); addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL);
addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL);
addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE);
@@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(1) || world.isStatus(4)) if (world.isStatus(1) || world.isStatus(4))
{ {
_deton.setTarget(player); world.getNpc(DETON).setTarget(player);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
} }
else else
{ {
@@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_status": case "check_status":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()))
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
startQuestTimer("msg_1", 7000, _deton, null); startQuestTimer("msg_1", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_1": case "msg_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW);
startQuestTimer("msg_2", 10000, _deton, null); startQuestTimer("msg_2", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_2": case "msg_2":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE);
startQuestTimer("msg_3", 10000, _deton, null); startQuestTimer("msg_3", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_3": case "msg_3":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME);
break; break;
} }
case "msg_4": case "msg_4":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE);
startQuestTimer("msg_5", 7000, _deton, null); startQuestTimer("msg_5", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_5": case "msg_5":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE);
startQuestTimer("msg_6", 10000, _deton, null); startQuestTimer("msg_6", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_6": case "msg_6":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE);
break; break;
} }
case "spawn_stacato": case "spawn_stacato":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_1", 50000, _deton, null); startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_1": case "spawn_stacato_1":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_2", 50000, _deton, null); startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_2": case "spawn_stacato_2":
@@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_flower": case "check_flower":
{ {
if (!npc.isDead()) if ((world != null) && !npc.isDead())
{ {
for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000))
{ {
if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0))
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, nearby.getLocation(), 23); addMoveToDesire(npc, nearby.getLocation(), 23);
if (npc.calculateDistance3D(nearby) < 100) if (npc.calculateDistance3D(nearby) < 100)
{ {
@@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
} }
startQuestTimer("check_flower", 3000, npc, null);
} }
break; break;
} }
@@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_7": case "msg_7":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN);
break; break;
} }
case "spawn_scorpion": case "spawn_scorpion":
{ {
world.spawnGroup("flame_scorpion"); world.spawnGroup("flame_scorpion");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE);
if (getRandom(10) < 5) if (getRandom(10) < 5)
{ {
world.spawnGroup("ifrit"); world.spawnGroup("ifrit");
@@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if ((pl != null) && !pl.isDead()) if ((pl != null) && !pl.isDead())
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23); addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23);
addAttackPlayerDesire(npc, pl); addAttackPlayerDesire(npc, pl);
} }
@@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_8": case "msg_8":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS);
startQuestTimer("msg_9", 8000, _deton, null); startQuestTimer("msg_9", 8000, world.getNpc(DETON), null);
break; break;
} }
case "msg_9": case "msg_9":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY);
startQuestTimer("msg_10", 10000, _deton, null); startQuestTimer("msg_10", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_10": case "msg_10":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING);
break; break;
} }
case "spawn_golem": case "spawn_golem":
{ {
world.spawnGroup("golem"); world.spawnGroup("golem");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away", 10000, _deton, null); startQuestTimer("run_away", 10000, world.getNpc(DETON), null);
break; break;
} }
case "run_away": case "run_away":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 3500, _deton, null); startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null);
break; break;
} }
case "delete_daton": case "delete_daton":
@@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_11": case "msg_11":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST);
break; break;
} }
case "msg_12": case "msg_12":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA);
startQuestTimer("msg_13", 9000, _deton, null); startQuestTimer("msg_13", 9000, world.getNpc(DETON), null);
break; break;
} }
case "msg_13": case "msg_13":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA);
break; break;
} }
case "spawn_scarab": case "spawn_scarab":
{ {
world.spawnGroup("flame_scarab"); world.spawnGroup("flame_scarab");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away_1", 8000, _deton, null); startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null);
break; break;
} }
case "run_away_1": case "run_away_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 5000, _deton, null); startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null);
break; break;
} }
case "switch_quest": case "switch_quest":
@@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance
} }
case "end_instance": case "end_instance":
{ {
cancelQuestTimers("check_flower");
_count = 0; _count = 0;
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
@@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (npc.isScriptValue(0)) if (npc.isScriptValue(0))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW);
npc.setScriptValue(1); npc.setScriptValue(1);
break; break;
} }
if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60))
{ {
_seal_device.setDisplayEffect(1); _seal_device.setDisplayEffect(1);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE);
npc.setScriptValue(2); npc.setScriptValue(2);
break; break;
} }
@@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30))
{ {
world.spawnGroup("last_deton"); world.spawnGroup("last_deton");
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3);
startQuestTimer("msg_12", 6000, _deton, null); startQuestTimer("msg_12", 6000, world.getNpc(DETON), null);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME);
world.setStatus(11); world.setStatus(11);
} }
if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5)) if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5))
@@ -603,7 +602,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
}); });
startQuestTimer("end_instance", 52000, _deton, null); startQuestTimer("end_instance", 52000, world.getNpc(DETON), null);
world.despawnGroup("last_deton"); world.despawnGroup("last_deton");
world.despawnGroup("last_archagel"); world.despawnGroup("last_archagel");
playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE); playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE);
@@ -627,21 +626,20 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
{ {
cancelQuestTimers("end_instance"); cancelQuestTimer("end_instance", world.getNpc(DETON), null);
cancelQuestTimers("check_flower");
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME)));
world.setStatus(4); world.setStatus(4);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL);
startQuestTimer("msg_7", 7000, _deton, null); startQuestTimer("msg_7", 7000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2)) if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("msg_8", 3000, _deton, null); startQuestTimer("msg_8", 3000, world.getNpc(DETON), null);
world.setStatus(6); world.setStatus(6);
} }
break; break;
@@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance
_seal_device.setDisplayEffect(3); _seal_device.setDisplayEffect(3);
_seal_device.doDie(npc); _seal_device.doDie(npc);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2);
startQuestTimer("msg_11", 3000, _deton, null); startQuestTimer("msg_11", 3000, world.getNpc(DETON), null);
break; break;
} }
case SEALED_ANGEL: case SEALED_ANGEL:
@@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance
if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1))
{ {
world.setStatus(2); world.setStatus(2);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
startQuestTimer("msg_4", 7000, _deton, null); startQuestTimer("msg_4", 7000, world.getNpc(DETON), null);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME)));
startQuestTimer("end_instance", 190000, _deton, null); startQuestTimer("end_instance", 190000, world.getNpc(DETON), null);
startQuestTimer("spawn_stacato", 5000, _deton, null); startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(0)) if (world.isStatus(0))
{ {
startQuestTimer("check_status", 21000, _deton, player); startQuestTimer("check_status", 21000, world.getNpc(DETON), player);
world.setStatus(1); world.setStatus(1);
} }
break; break;
@@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(4)) if (world.isStatus(4))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING);
startQuestTimer("spawn_scorpion", 5000, _deton, player); startQuestTimer("spawn_scorpion", 5000, world.getNpc(DETON), player);
world.setStatus(5); world.setStatus(5);
} }
break; break;
@@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY);
startQuestTimer("spawn_golem", 7000, _deton, player); startQuestTimer("spawn_golem", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT);
startQuestTimer("spawn_scarab", 7000, _deton, player); startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance
{ {
switch (npc.getId()) switch (npc.getId())
{ {
case DETON:
{
_deton = npc;
break;
}
case SEAL_DEVICE: case SEAL_DEVICE:
{ {
_seal_device = npc; _seal_device = npc;
@@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance
} }
case FLAME_STACATO: case FLAME_STACATO:
{ {
startQuestTimer("check_flower", 3000, npc, null, true); startQuestTimer("check_flower", 3000, npc, null);
break; break;
} }
case FLAME_SCORPION: case FLAME_SCORPION:

View File

@@ -34,7 +34,7 @@ import instances.AbstractInstance;
* Nornils Garden Instance * Nornils Garden Instance
* @URL https://l2wiki.com/Nornils_Garden * @URL https://l2wiki.com/Nornils_Garden
* @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs
* @author Gigi * @author Gigi, Mobius
* @date 2017-02-22 - [15:22:27] * @date 2017-02-22 - [15:22:27]
*/ */
public class NornilsGarden extends AbstractInstance public class NornilsGarden extends AbstractInstance
@@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200016, true); world.openCloseDoor(16200016, true);
cancelQuestTimers("stage2"); cancelQuestTimer("stage2", npc, null);
world.spawnGroup("wave_3"); world.spawnGroup("wave_3");
} }
break; break;
@@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200201, true); world.openCloseDoor(16200201, true);
cancelQuestTimers("stage3"); cancelQuestTimer("stage3", npc, null);
cancelQuestTimers("check_agrro");
} }
break; break;
} }
case "check_agrro": case "check_agrro":
{ {
if ((world != null) && !npc.isDead() && !npc.isInCombat()) if ((world != null) && !npc.isDead() && !npc.isInCombat() && !world.getDoor(16200201).isOpen())
{ {
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar ->
{ {
@@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar);
} }
}); });
startQuestTimer("check_agrro", 1000, npc, null);
} }
break; break;
} }
@@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance
{ {
if (npc.getId() == BOZ_STAGE1) if (npc.getId() == BOZ_STAGE1)
{ {
cancelQuestTimers("stage1_1"); cancelQuestTimer("stage1_1", npc, null);
world.openCloseDoor(16200015, true); world.openCloseDoor(16200015, true);
world.setStatus(1); world.setStatus(1);
} }
@@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null);
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }

View File

@@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
cancelQuestTimers("attack"); cancelQuestTimer("attack", npc, null);
cancelQuestTimers("random_Target"); cancelQuestTimer("random_Target", npc, null);
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }

View File

@@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance
{ {
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.getParameters().set("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
npc.teleToLocation(BATTLE_LOC); npc.teleToLocation(BATTLE_LOC);
playMovie(world, Movie.SC_OCTABIS_OPENING); playMovie(world, Movie.SC_OCTABIS_OPENING);
getTimers().addTimer("START_STAGE_1", 26500, npc, null); getTimers().addTimer("START_STAGE_1", 26500, npc, null);

View File

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

View File

@@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
} }
if (questGiver.getId() == 34097) // Adonius if (questGiver.getId() == 34097) // Adonius
{ {
world.getParameters().set("CAPTIVES", world.spawnGroup("captives")); world.setParameter("CAPTIVES", world.spawnGroup("captives"));
for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class)) for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class))
{ {
captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);

View File

@@ -73,27 +73,6 @@ public class ChamberOfProphecies extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
if (event.equals("enterInstance"))
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
}
else if (player != null)
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (event) switch (event)
{ {
case "31639-01.html": case "31639-01.html":
@@ -106,6 +85,11 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33996-02.html": case "33996-02.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(ExShowUsm.USM_Q015_E); world.broadcastPacket(ExShowUsm.USM_Q015_E);
world.despawnGroup("q10753_16_instance_grail"); world.despawnGroup("q10753_16_instance_grail");
world.spawnGroup("q10753_16_instance_wizard"); world.spawnGroup("q10753_16_instance_wizard");
@@ -128,14 +112,53 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33980-05.html": case "33980-05.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup("q10753_16_instance_halter_2"); world.spawnGroup("q10753_16_instance_halter_2");
world.setStatus(6); world.setStatus(6);
startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); startQuestTimer("DESPAWN_WIZARD", 2000, npc, player);
htmltext = event; htmltext = event;
break; break;
} }
case "enterInstance":
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
break;
}
case "teleport":
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimer("CHECK_STATUS", npc, player);
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "status": case "status":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.isStatus(0)) if (world.isStatus(0))
{ {
htmltext = "31639-01.html"; htmltext = "31639-01.html";
@@ -144,18 +167,13 @@ public class ChamberOfProphecies extends AbstractInstance
htmltext = "31639-02.html"; htmltext = "31639-02.html";
break; break;
} }
case "teleport":
{
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimers("CHECK_STATUS");
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "CHECK_STATUS": case "CHECK_STATUS":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (world.getStatus()) switch (world.getStatus())
{ {
case 0: case 0:
@@ -223,6 +241,11 @@ public class ChamberOfProphecies extends AbstractInstance
case "ATTACK1": case "ATTACK1":
case "ATTACK2": case "ATTACK2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
npc.setRunning(); npc.setRunning();
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
@@ -242,7 +265,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR1": case "OPEN_DOOR1":
{ {
cancelQuestTimers("ATTACK"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK", npc, player);
world.setStatus(1); world.setStatus(1);
world.openCloseDoor(DOOR_2, true); world.openCloseDoor(DOOR_2, true);
world.spawnGroup("wof_room2"); world.spawnGroup("wof_room2");
@@ -250,7 +278,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR2": case "OPEN_DOOR2":
{ {
cancelQuestTimers("ATTACK1"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK1", npc, player);
startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true);
world.setStatus(3); world.setStatus(3);
world.spawnGroup("wof_room3"); world.spawnGroup("wof_room3");
@@ -337,23 +370,33 @@ public class ChamberOfProphecies extends AbstractInstance
if (npc.getId() == FERIN) if (npc.getId() == FERIN)
{ {
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player);
cancelQuestTimers("BROADCAST_TEXT"); cancelQuestTimer("BROADCAST_TEXT", npc, player);
} }
break; break;
} }
case "SEY_KAIN_4": case "SEY_KAIN_4":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(5); world.setStatus(5);
world.spawnGroup("q10753_16_instance_grail"); world.spawnGroup("q10753_16_instance_grail");
showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000);
world.openCloseDoor(DOOR_4, true); world.openCloseDoor(DOOR_4, true);
cancelQuestTimers("ATTACK2"); cancelQuestTimer("ATTACK2", npc, player);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player);
startQuestTimer("CLOSE", 15000, null, player); startQuestTimer("CLOSE", 15000, null, player);
break; break;
} }
case "CLOSE": case "CLOSE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
final Npc grail = world.getNpc(GRAIL); final Npc grail = world.getNpc(GRAIL);
if ((grail != null) && (player.calculateDistance2D(grail) < 390)) if ((grail != null) && (player.calculateDistance2D(grail) < 390))
{ {
@@ -369,13 +412,18 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "DESPAWN_WIZARD": case "DESPAWN_WIZARD":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.despawnGroup("q10753_16_instance_wizard"); world.despawnGroup("q10753_16_instance_wizard");
break; break;
} }
case "exit": case "exit":
{ {
startQuestTimer("finish", 3000, npc, player); startQuestTimer("finish", 3000, npc, player);
player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt((int) 1.0D)); player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt(1));
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null) if (qs != null)
{ {
@@ -385,11 +433,15 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "finish": case "finish":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.finishInstance(0); world.finishInstance(0);
break; break;
} }
} }
}
return htmltext; return htmltext;
} }

View File

@@ -17,10 +17,8 @@
package instances.DimensionalWrap; package instances.DimensionalWrap;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.CategoryType; import org.l2jmobius.gameserver.enums.CategoryType;
@@ -44,7 +42,7 @@ import instances.AbstractInstance;
* Dimensional Wrap instance * Dimensional Wrap instance
* @URL https://l2wiki.com/Dimensional_Warp * @URL https://l2wiki.com/Dimensional_Warp
* @Video https://www.youtube.com/watch?v=hOnzk0ELwIg * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg
* @author Gigi * @author Gigi, Mobius
* @date 2018-09-04 - [14:33:31] * @date 2018-09-04 - [14:33:31]
*/ */
public class DimensionalWrap extends AbstractInstance public class DimensionalWrap extends AbstractInstance
@@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance
23480, // Abyssal Harpy 23480, // Abyssal Harpy
23481, // Abyssal Binder 23481, // Abyssal Binder
23482, // Abyssal Archon 23482, // Abyssal Archon
23483 // Abyssal Golem 23483, // Abyssal Golem
}; };
private static final int[] TRAPS = private static final int[] TRAPS =
{ {
@@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance
19559, // Damage trap, power 1 19559, // Damage trap, power 1
19560, // Damage trap, power 2 19560, // Damage trap, power 2
19561, // Damage trap, power 3 19561, // Damage trap, power 3
19562 // Heal Trap 19562, // Heal Trap
}; };
// Location // Location
private static final Location TELEPORTS = new Location(-76136, -216216, 4040); private static final Location TELEPORTS = new Location(-76136, -216216, 4040);
private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360); private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360);
private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584); private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584);
private static final Location THRID_TELEPORT = new Location(-219813, 248484, 9928); private static final Location THIRD_TELEPORT = new Location(-219813, 248484, 9928);
private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984); private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984);
// Misc // Misc
private static final int TEMPLATE_ID = 250; private static final int TEMPLATE_ID = 250;
private static final int DIMENSIONAL_DARK_FORCES = 16415; private static final int DIMENSIONAL_DARK_FORCES = 16415;
private static final int WARP_CRYSTAL = 39597; private static final int WARP_CRYSTAL = 39597;
protected double _chance = 0;
protected int _count = 0;
public int _skilllevel = 1;
public int _worldState = 0;
protected ScheduledFuture<?> _debufTask;
public DimensionalWrap() public DimensionalWrap()
{ {
@@ -125,8 +118,10 @@ public class DimensionalWrap extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
final Instance world = npc.getInstanceWorld();
if (event.equals("enterInstance")) switch (event)
{
case "enterInstance":
{ {
if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{ {
@@ -155,11 +150,8 @@ public class DimensionalWrap extends AbstractInstance
} }
} }
} }
break;
} }
if (isInInstance(world))
{
switch (event)
{
case "33975-01.html": case "33975-01.html":
{ {
htmltext = event; htmltext = event;
@@ -167,11 +159,17 @@ public class DimensionalWrap extends AbstractInstance
} }
case "12_warp_crystals": case "12_warp_crystals":
{ {
_chance = 0.3; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.3);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 12; world.setParameter("count", 12);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
else if (player.isInParty() && !player.getParty().isLeader(player)) else if (player.isInParty() && !player.getParty().isLeader(player))
@@ -183,20 +181,20 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 6; world.setParameter("count", 6);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 4; world.setParameter("count", 4);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 3; world.setParameter("count", 3);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
} }
@@ -204,11 +202,17 @@ public class DimensionalWrap extends AbstractInstance
} }
case "240_warp_crystals": case "240_warp_crystals":
{ {
_chance = 0.6; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.6);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 240; world.setParameter("count", 240);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
else if (player.isInParty() && !player.getParty().isLeader(player)) else if (player.isInParty() && !player.getParty().isLeader(player))
@@ -220,20 +224,20 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 120; world.setParameter("count", 120);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 80; world.setParameter("count", 80);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 60; world.setParameter("count", 60);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
} }
@@ -241,11 +245,17 @@ public class DimensionalWrap extends AbstractInstance
} }
case "1200_warp_crystals": case "1200_warp_crystals":
{ {
_chance = 0.9; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.9);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 1200; world.setParameter("count", 1200);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
else if (player.isInParty() && !player.getParty().isLeader(player)) else if (player.isInParty() && !player.getParty().isLeader(player))
@@ -257,20 +267,20 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 600; world.setParameter("count", 600);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 400; world.setParameter("count", 400);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 300; world.setParameter("count", 300);
CheckCrystallCount(world, player, npc); checkCrystallCount(world, npc);
break; break;
} }
} }
@@ -278,7 +288,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_6_f": case "send_6_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -299,9 +315,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 5) if (world.getStatus() < 5)
{ {
world.setStatus(5); world.setStatus(5);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -311,7 +327,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_11_f": case "send_11_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -321,6 +343,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -331,9 +354,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 10) if (world.getStatus() < 10)
{ {
world.setStatus(10); world.setStatus(10);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -343,7 +366,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_16_f": case "send_16_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -353,6 +382,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -363,19 +393,25 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 15) if (world.getStatus() < 15)
{ {
world.setStatus(15); world.setStatus(15);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId());
} }
break; break;
} }
case "send_21_f": case "send_21_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -385,6 +421,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -395,9 +432,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 20) if (world.getStatus() < 20)
{ {
world.setStatus(20); world.setStatus(20);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -407,7 +444,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_26_f": case "send_26_f":
{ {
if (_worldState == 0) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -417,6 +460,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -427,9 +471,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 25) if (world.getStatus() < 25)
{ {
world.setStatus(25); world.setStatus(25);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -439,15 +483,25 @@ public class DimensionalWrap extends AbstractInstance
} }
case "jump_location": case "jump_location":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
player.teleToLocation(TELEPORTS, world.getTemplateId()); player.teleToLocation(TELEPORTS, world.getTemplateId());
break; break;
} }
case "SALAMANDRA_SPAWN": case "SALAMANDRA_SPAWN":
case "SALAMANDRA_SPAWN_DUMMY": case "SALAMANDRA_SPAWN_DUMMY":
{ {
if (getRandom(100) < (_worldState / 2)) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{ {
final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); return null;
}
if (getRandom(100) < (world.getParameters().getInt("worldState", 0) / 2))
{
final Npc salamandra = addSpawn(world.getParameters().getInt("worldState", 0) < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId());
salamandra.setRunning(); salamandra.setRunning();
World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p ->
{ {
@@ -461,36 +515,57 @@ public class DimensionalWrap extends AbstractInstance
} }
case "START_STAGE": case "START_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(world.getStatus() + 1); world.setStatus(world.getStatus() + 1);
_worldState = world.getStatus(); world.setParameter("worldState", world.getStatus());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus())));
startQuestTimer("FIRST_SPAWN", 1500, npc, null); startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer());
break; break;
} }
case "FIRST_SPAWN": case "FIRST_SPAWN":
{ {
world.spawnGroup(_worldState + "_first_spawn"); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("SECOND_SPAWN", 40000, npc, null);
_debufTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if ((_worldState > 0) && (_worldState <= 11)) return null;
{
_skilllevel = 1;
} }
else if ((_worldState > 11) && (_worldState <= 20)) final int worldState = world.getParameters().getInt("worldState", 0);
{ world.spawnGroup(worldState + "_first_spawn");
_skilllevel = 2; world.spawnGroup(worldState + "_trap_spawn");
startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer());
startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true);
break;
} }
else if ((_worldState > 20) && (_worldState <= 30)) case "DEBUFF_TASK":
{ {
_skilllevel = 3; final Instance world = player.getInstanceWorld();
} if (!isInInstance(world))
else if (_worldState > 30)
{ {
_skilllevel = 4; return null;
} }
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, _skilllevel); int skilllevel = 1;
final int worldState = world.getParameters().getInt("worldState", 0);
if ((worldState > 0) && (worldState <= 11))
{
skilllevel = 1;
}
else if ((worldState > 11) && (worldState <= 20))
{
skilllevel = 2;
}
else if ((worldState > 20) && (worldState <= 30))
{
skilllevel = 3;
}
else if (worldState > 30)
{
skilllevel = 4;
}
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, skilllevel);
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if ((p != null) && !p.isDead()) if ((p != null) && !p.isDead())
@@ -498,47 +573,71 @@ public class DimensionalWrap extends AbstractInstance
skill.applyEffects(p, p); skill.applyEffects(p, p);
} }
} }
}, 5000, 10000);
break; break;
} }
case "SECOND_SPAWN": case "SECOND_SPAWN":
{ {
world.spawnGroup(_worldState + "_second_spawn"); final Instance world = player.getInstanceWorld();
startQuestTimer("THRID_SPAWN", 40000, npc, null); if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn");
startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer());
break; break;
} }
case "THRID_SPAWN": case "THIRD_SPAWN":
{ {
world.spawnGroup(_worldState + "_thred_spawn"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn");
break; break;
} }
case "CHANGE_LOCATION": case "CHANGE_LOCATION":
{ {
world.getAliveNpcs(TRAPS).forEach(t -> t.deleteMe()); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); {
return null;
}
world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe);
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_trap_spawn");
startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1430), null, world.getFirstPlayer());
break; break;
} }
case "SWITCH_STAGE": case "SWITCH_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getAliveNpcs(MONSTERS).isEmpty()) if (world.getAliveNpcs(MONSTERS).isEmpty())
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true));
world.broadcastPacket(new Earthquake(npc, 50, 5)); world.broadcastPacket(new Earthquake(npc, 50, 5));
world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true);
Clean(); clean(world.getFirstPlayer());
if (_worldState < 35) if (world.getParameters().getInt("worldState", 0) < 35)
{ {
startQuestTimer("NEXT_STAGE", 5000, npc, null); startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer());
} }
} }
break; break;
} }
case "NEXT_STAGE": case "NEXT_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCE_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCE_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180)));
world.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); world.setDuration((int) ((world.getRemainingTime() / 60000) + 3));
startQuestTimer("START_STAGE", 8000, npc, null); startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer());
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -549,7 +648,6 @@ public class DimensionalWrap extends AbstractInstance
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world)) if (isInInstance(world))
{ {
if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < _chance)) if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < world.getParameters().getDouble("chance", 0)))
{ {
if (_worldState < 9) final int worldState = world.getParameters().getInt("worldState", 0);
if (worldState < 9)
{ {
addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId()); addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if ((_worldState >= 9) && (_worldState < 20)) else if ((worldState >= 9) && (worldState < 20))
{ {
addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId()); addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if (_worldState >= 20) else if (worldState >= 20)
{ {
addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId()); addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
@@ -581,7 +680,7 @@ public class DimensionalWrap extends AbstractInstance
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCE_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCE_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true));
world.finishInstance(3); world.finishInstance(3);
Clean(); clean(world.getFirstPlayer());
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance
@Override @Override
public String onFirstTalk(Npc npc, PlayerInstance player) public String onFirstTalk(Npc npc, PlayerInstance player)
{ {
if (_worldState == 20) final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (world.getParameters().getInt("worldState", 0) == 20))
{ {
return "33975-04.html"; return "33975-04.html";
} }
@@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance
{ {
case SALAMANDRA_GENERATOR: case SALAMANDRA_GENERATOR:
{ {
startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true);
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer());
break; break;
} }
case SALAMANDRA_GENERATOR_DUMMY: case SALAMANDRA_GENERATOR_DUMMY:
{ {
startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true);
break; break;
} }
case DEMINSIONAL_INVISIBLE_FRAGMENT: case DEMINSIONAL_INVISIBLE_FRAGMENT:
{ {
startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true);
break; break;
} }
} }
@@ -626,47 +726,43 @@ public class DimensionalWrap extends AbstractInstance
return super.onSpawn(npc); return super.onSpawn(npc);
} }
public void CheckCrystallCount(Instance world, PlayerInstance player, Npc npc) public void checkCrystallCount(Instance world, Npc npc)
{ {
boolean canStart = true; boolean canStart = true;
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < _count) if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < world.getParameters().getInt("count", 0))
{ {
for (PlayerInstance ps : world.getPlayers()) for (PlayerInstance ps : world.getPlayers())
{ {
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
packet.setHtml(getHtm(ps, "33975-03.html")); packet.setHtml(getHtm(ps, "33975-03.html"));
packet.replace("%count%", Integer.toString(_count)); packet.replace("%count%", Integer.toString(world.getParameters().getInt("count", 0)));
ps.sendPacket(packet); ps.sendPacket(packet);
ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName()));
canStart = false; canStart = false;
} }
} }
} }
if (!canStart || (_worldState != 0)) if (!canStart || (world.getParameters().getInt("worldState", 0) != 0))
{ {
return; return;
} }
startQuestTimer("START_STAGE", 1000, npc, null); startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer());
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
takeItems(p, WARP_CRYSTAL, _count); takeItems(p, WARP_CRYSTAL, world.getParameters().getInt("count", 0));
} }
} }
protected void Clean() protected void clean(PlayerInstance player)
{ {
cancelQuestTimers("SWITCH_STAGE"); cancelQuestTimer("SWITCH_STAGE", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN"); cancelQuestTimer("SALAMANDRA_SPAWN", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player);
cancelQuestTimers("CHANGE_LOCATION"); cancelQuestTimer("CHANGE_LOCATION", null, player);
if (_debufTask != null) cancelQuestTimer("DEBUFF_TASK", null, player);
{
_debufTask.cancel(false);
_debufTask = null;
}
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti;
/** /**
* Mystic Tavern Tauti Instance * Mystic Tavern Tauti Instance
* @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk
* @author Gigi * @author Gigi, Mobius
*/ */
public class StoryOfTauti extends AbstractInstance public class StoryOfTauti extends AbstractInstance
{ {
@@ -93,14 +93,13 @@ public class StoryOfTauti extends AbstractInstance
private static final Location TELEPORT = new Location(153267, -148441, -11560); private static final Location TELEPORT = new Location(153267, -148441, -11560);
private static final int ZONE_1ST_TRIGER = 24137770; private static final int ZONE_1ST_TRIGER = 24137770;
private static final int SKILL_TRIGER = 24138880; private static final int SKILL_TRIGER = 24138880;
private static Npc _deton;
private static Npc _seal_device; private static Npc _seal_device;
protected int _count = 0; protected int _count = 0;
public StoryOfTauti() public StoryOfTauti()
{ {
super(TEMPLATE_ID); super(TEMPLATE_ID);
addSpawnId(DETON, SEAL_DEVICE, FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL); addSpawnId(FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL);
addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL); addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL);
addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL);
addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE);
@@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(1) || world.isStatus(4)) if (world.isStatus(1) || world.isStatus(4))
{ {
_deton.setTarget(player); world.getNpc(DETON).setTarget(player);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
} }
else else
{ {
@@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_status": case "check_status":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()))
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
startQuestTimer("msg_1", 7000, _deton, null); startQuestTimer("msg_1", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_1": case "msg_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW);
startQuestTimer("msg_2", 10000, _deton, null); startQuestTimer("msg_2", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_2": case "msg_2":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE);
startQuestTimer("msg_3", 10000, _deton, null); startQuestTimer("msg_3", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_3": case "msg_3":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME);
break; break;
} }
case "msg_4": case "msg_4":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE);
startQuestTimer("msg_5", 7000, _deton, null); startQuestTimer("msg_5", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_5": case "msg_5":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE);
startQuestTimer("msg_6", 10000, _deton, null); startQuestTimer("msg_6", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_6": case "msg_6":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE);
break; break;
} }
case "spawn_stacato": case "spawn_stacato":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_1", 50000, _deton, null); startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_1": case "spawn_stacato_1":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_2", 50000, _deton, null); startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_2": case "spawn_stacato_2":
@@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_flower": case "check_flower":
{ {
if (!npc.isDead()) if ((world != null) && !npc.isDead())
{ {
for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000))
{ {
if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0))
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, nearby.getLocation(), 23); addMoveToDesire(npc, nearby.getLocation(), 23);
if (npc.calculateDistance3D(nearby) < 100) if (npc.calculateDistance3D(nearby) < 100)
{ {
@@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
} }
startQuestTimer("check_flower", 3000, npc, null);
} }
break; break;
} }
@@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_7": case "msg_7":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN);
break; break;
} }
case "spawn_scorpion": case "spawn_scorpion":
{ {
world.spawnGroup("flame_scorpion"); world.spawnGroup("flame_scorpion");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE);
if (getRandom(10) < 5) if (getRandom(10) < 5)
{ {
world.spawnGroup("ifrit"); world.spawnGroup("ifrit");
@@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if ((pl != null) && !pl.isDead()) if ((pl != null) && !pl.isDead())
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23); addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23);
addAttackPlayerDesire(npc, pl); addAttackPlayerDesire(npc, pl);
} }
@@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_8": case "msg_8":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS);
startQuestTimer("msg_9", 8000, _deton, null); startQuestTimer("msg_9", 8000, world.getNpc(DETON), null);
break; break;
} }
case "msg_9": case "msg_9":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY);
startQuestTimer("msg_10", 10000, _deton, null); startQuestTimer("msg_10", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_10": case "msg_10":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING);
break; break;
} }
case "spawn_golem": case "spawn_golem":
{ {
world.spawnGroup("golem"); world.spawnGroup("golem");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away", 10000, _deton, null); startQuestTimer("run_away", 10000, world.getNpc(DETON), null);
break; break;
} }
case "run_away": case "run_away":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 3500, _deton, null); startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null);
break; break;
} }
case "delete_daton": case "delete_daton":
@@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_11": case "msg_11":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST);
break; break;
} }
case "msg_12": case "msg_12":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA);
startQuestTimer("msg_13", 9000, _deton, null); startQuestTimer("msg_13", 9000, world.getNpc(DETON), null);
break; break;
} }
case "msg_13": case "msg_13":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA);
break; break;
} }
case "spawn_scarab": case "spawn_scarab":
{ {
world.spawnGroup("flame_scarab"); world.spawnGroup("flame_scarab");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away_1", 8000, _deton, null); startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null);
break; break;
} }
case "run_away_1": case "run_away_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 5000, _deton, null); startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null);
break; break;
} }
case "switch_quest": case "switch_quest":
@@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance
} }
case "end_instance": case "end_instance":
{ {
cancelQuestTimers("check_flower");
_count = 0; _count = 0;
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
@@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (npc.isScriptValue(0)) if (npc.isScriptValue(0))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW);
npc.setScriptValue(1); npc.setScriptValue(1);
break; break;
} }
if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60))
{ {
_seal_device.setDisplayEffect(1); _seal_device.setDisplayEffect(1);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE);
npc.setScriptValue(2); npc.setScriptValue(2);
break; break;
} }
@@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30))
{ {
world.spawnGroup("last_deton"); world.spawnGroup("last_deton");
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3);
startQuestTimer("msg_12", 6000, _deton, null); startQuestTimer("msg_12", 6000, world.getNpc(DETON), null);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME);
world.setStatus(11); world.setStatus(11);
} }
if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5)) if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5))
@@ -603,7 +602,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
}); });
startQuestTimer("end_instance", 52000, _deton, null); startQuestTimer("end_instance", 52000, world.getNpc(DETON), null);
world.despawnGroup("last_deton"); world.despawnGroup("last_deton");
world.despawnGroup("last_archagel"); world.despawnGroup("last_archagel");
playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE); playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE);
@@ -627,21 +626,20 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
{ {
cancelQuestTimers("end_instance"); cancelQuestTimer("end_instance", world.getNpc(DETON), null);
cancelQuestTimers("check_flower");
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME)));
world.setStatus(4); world.setStatus(4);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL);
startQuestTimer("msg_7", 7000, _deton, null); startQuestTimer("msg_7", 7000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2)) if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("msg_8", 3000, _deton, null); startQuestTimer("msg_8", 3000, world.getNpc(DETON), null);
world.setStatus(6); world.setStatus(6);
} }
break; break;
@@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance
_seal_device.setDisplayEffect(3); _seal_device.setDisplayEffect(3);
_seal_device.doDie(npc); _seal_device.doDie(npc);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2);
startQuestTimer("msg_11", 3000, _deton, null); startQuestTimer("msg_11", 3000, world.getNpc(DETON), null);
break; break;
} }
case SEALED_ANGEL: case SEALED_ANGEL:
@@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance
if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1))
{ {
world.setStatus(2); world.setStatus(2);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
startQuestTimer("msg_4", 7000, _deton, null); startQuestTimer("msg_4", 7000, world.getNpc(DETON), null);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME)));
startQuestTimer("end_instance", 190000, _deton, null); startQuestTimer("end_instance", 190000, world.getNpc(DETON), null);
startQuestTimer("spawn_stacato", 5000, _deton, null); startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(0)) if (world.isStatus(0))
{ {
startQuestTimer("check_status", 21000, _deton, player); startQuestTimer("check_status", 21000, world.getNpc(DETON), player);
world.setStatus(1); world.setStatus(1);
} }
break; break;
@@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(4)) if (world.isStatus(4))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING);
startQuestTimer("spawn_scorpion", 5000, _deton, player); startQuestTimer("spawn_scorpion", 5000, world.getNpc(DETON), player);
world.setStatus(5); world.setStatus(5);
} }
break; break;
@@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY);
startQuestTimer("spawn_golem", 7000, _deton, player); startQuestTimer("spawn_golem", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT);
startQuestTimer("spawn_scarab", 7000, _deton, player); startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance
{ {
switch (npc.getId()) switch (npc.getId())
{ {
case DETON:
{
_deton = npc;
break;
}
case SEAL_DEVICE: case SEAL_DEVICE:
{ {
_seal_device = npc; _seal_device = npc;
@@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance
} }
case FLAME_STACATO: case FLAME_STACATO:
{ {
startQuestTimer("check_flower", 3000, npc, null, true); startQuestTimer("check_flower", 3000, npc, null);
break; break;
} }
case FLAME_SCORPION: case FLAME_SCORPION:

View File

@@ -34,7 +34,7 @@ import instances.AbstractInstance;
* Nornils Garden Instance * Nornils Garden Instance
* @URL https://l2wiki.com/Nornils_Garden * @URL https://l2wiki.com/Nornils_Garden
* @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs
* @author Gigi * @author Gigi, Mobius
* @date 2017-02-22 - [15:22:27] * @date 2017-02-22 - [15:22:27]
*/ */
public class NornilsGarden extends AbstractInstance public class NornilsGarden extends AbstractInstance
@@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200016, true); world.openCloseDoor(16200016, true);
cancelQuestTimers("stage2"); cancelQuestTimer("stage2", npc, null);
world.spawnGroup("wave_3"); world.spawnGroup("wave_3");
} }
break; break;
@@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200201, true); world.openCloseDoor(16200201, true);
cancelQuestTimers("stage3"); cancelQuestTimer("stage3", npc, null);
cancelQuestTimers("check_agrro");
} }
break; break;
} }
case "check_agrro": case "check_agrro":
{ {
if ((world != null) && !npc.isDead() && !npc.isInCombat()) if ((world != null) && !npc.isDead() && !npc.isInCombat() && !world.getDoor(16200201).isOpen())
{ {
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar ->
{ {
@@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar);
} }
}); });
startQuestTimer("check_agrro", 1000, npc, null);
} }
break; break;
} }
@@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance
{ {
if (npc.getId() == BOZ_STAGE1) if (npc.getId() == BOZ_STAGE1)
{ {
cancelQuestTimers("stage1_1"); cancelQuestTimer("stage1_1", npc, null);
world.openCloseDoor(16200015, true); world.openCloseDoor(16200015, true);
world.setStatus(1); world.setStatus(1);
} }
@@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null);
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }

View File

@@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
cancelQuestTimers("attack"); cancelQuestTimer("attack", npc, null);
cancelQuestTimers("random_Target"); cancelQuestTimer("random_Target", npc, null);
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }

View File

@@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance
{ {
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.getParameters().set("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
npc.teleToLocation(BATTLE_LOC); npc.teleToLocation(BATTLE_LOC);
playMovie(world, Movie.SC_OCTABIS_OPENING); playMovie(world, Movie.SC_OCTABIS_OPENING);
getTimers().addTimer("START_STAGE_1", 26500, npc, null); getTimers().addTimer("START_STAGE_1", 26500, npc, null);

View File

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

View File

@@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
} }
if (questGiver.getId() == 34097) // Adonius if (questGiver.getId() == 34097) // Adonius
{ {
world.getParameters().set("CAPTIVES", world.spawnGroup("captives")); world.setParameter("CAPTIVES", world.spawnGroup("captives"));
for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class)) for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class))
{ {
captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);

View File

@@ -73,27 +73,6 @@ public class ChamberOfProphecies extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
if (event.equals("enterInstance"))
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
}
else if (player != null)
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (event) switch (event)
{ {
case "31639-01.html": case "31639-01.html":
@@ -106,6 +85,11 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33996-02.html": case "33996-02.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(ExShowUsm.USM_Q015_E); world.broadcastPacket(ExShowUsm.USM_Q015_E);
world.despawnGroup("q10753_16_instance_grail"); world.despawnGroup("q10753_16_instance_grail");
world.spawnGroup("q10753_16_instance_wizard"); world.spawnGroup("q10753_16_instance_wizard");
@@ -128,14 +112,53 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33980-05.html": case "33980-05.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup("q10753_16_instance_halter_2"); world.spawnGroup("q10753_16_instance_halter_2");
world.setStatus(6); world.setStatus(6);
startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); startQuestTimer("DESPAWN_WIZARD", 2000, npc, player);
htmltext = event; htmltext = event;
break; break;
} }
case "enterInstance":
{
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(16, true);
}
break;
}
case "teleport":
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimer("CHECK_STATUS", npc, player);
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "status": case "status":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.isStatus(0)) if (world.isStatus(0))
{ {
htmltext = "31639-01.html"; htmltext = "31639-01.html";
@@ -144,18 +167,13 @@ public class ChamberOfProphecies extends AbstractInstance
htmltext = "31639-02.html"; htmltext = "31639-02.html";
break; break;
} }
case "teleport":
{
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimers("CHECK_STATUS");
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "CHECK_STATUS": case "CHECK_STATUS":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (world.getStatus()) switch (world.getStatus())
{ {
case 0: case 0:
@@ -223,6 +241,11 @@ public class ChamberOfProphecies extends AbstractInstance
case "ATTACK1": case "ATTACK1":
case "ATTACK2": case "ATTACK2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
npc.setRunning(); npc.setRunning();
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
@@ -242,7 +265,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR1": case "OPEN_DOOR1":
{ {
cancelQuestTimers("ATTACK"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK", npc, player);
world.setStatus(1); world.setStatus(1);
world.openCloseDoor(DOOR_2, true); world.openCloseDoor(DOOR_2, true);
world.spawnGroup("wof_room2"); world.spawnGroup("wof_room2");
@@ -250,7 +278,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR2": case "OPEN_DOOR2":
{ {
cancelQuestTimers("ATTACK1"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK1", npc, player);
startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true);
world.setStatus(3); world.setStatus(3);
world.spawnGroup("wof_room3"); world.spawnGroup("wof_room3");
@@ -337,23 +370,33 @@ public class ChamberOfProphecies extends AbstractInstance
if (npc.getId() == FERIN) if (npc.getId() == FERIN)
{ {
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player);
cancelQuestTimers("BROADCAST_TEXT"); cancelQuestTimer("BROADCAST_TEXT", npc, player);
} }
break; break;
} }
case "SEY_KAIN_4": case "SEY_KAIN_4":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(5); world.setStatus(5);
world.spawnGroup("q10753_16_instance_grail"); world.spawnGroup("q10753_16_instance_grail");
showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000);
world.openCloseDoor(DOOR_4, true); world.openCloseDoor(DOOR_4, true);
cancelQuestTimers("ATTACK2"); cancelQuestTimer("ATTACK2", npc, player);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player);
startQuestTimer("CLOSE", 15000, null, player); startQuestTimer("CLOSE", 15000, null, player);
break; break;
} }
case "CLOSE": case "CLOSE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
final Npc grail = world.getNpc(GRAIL); final Npc grail = world.getNpc(GRAIL);
if ((grail != null) && (player.calculateDistance2D(grail) < 390)) if ((grail != null) && (player.calculateDistance2D(grail) < 390))
{ {
@@ -369,13 +412,18 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "DESPAWN_WIZARD": case "DESPAWN_WIZARD":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.despawnGroup("q10753_16_instance_wizard"); world.despawnGroup("q10753_16_instance_wizard");
break; break;
} }
case "exit": case "exit":
{ {
startQuestTimer("finish", 3000, npc, player); startQuestTimer("finish", 3000, npc, player);
player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt((int) 1.0D)); player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt(1));
final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName());
if (qs != null) if (qs != null)
{ {
@@ -385,11 +433,15 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "finish": case "finish":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.finishInstance(0); world.finishInstance(0);
break; break;
} }
} }
}
return htmltext; return htmltext;
} }

View File

@@ -17,10 +17,8 @@
package instances.DimensionalWrap; package instances.DimensionalWrap;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.CategoryType; import org.l2jmobius.gameserver.enums.CategoryType;
@@ -44,7 +42,7 @@ import instances.AbstractInstance;
* Dimensional Wrap instance * Dimensional Wrap instance
* @URL https://l2wiki.com/Dimensional_Warp * @URL https://l2wiki.com/Dimensional_Warp
* @Video https://www.youtube.com/watch?v=hOnzk0ELwIg * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg
* @author Gigi * @author Gigi, Mobius
* @date 2018-09-04 - [14:33:31] * @date 2018-09-04 - [14:33:31]
*/ */
public class DimensionalWrap extends AbstractInstance public class DimensionalWrap extends AbstractInstance
@@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance
23480, // Abyssal Harpy 23480, // Abyssal Harpy
23481, // Abyssal Binder 23481, // Abyssal Binder
23482, // Abyssal Archon 23482, // Abyssal Archon
23483 // Abyssal Golem 23483, // Abyssal Golem
}; };
private static final int[] TRAPS = private static final int[] TRAPS =
{ {
@@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance
19559, // Damage trap, power 1 19559, // Damage trap, power 1
19560, // Damage trap, power 2 19560, // Damage trap, power 2
19561, // Damage trap, power 3 19561, // Damage trap, power 3
19562 // Heal Trap 19562, // Heal Trap
}; };
// Location // Location
private static final Location TELEPORTS = new Location(-76136, -216216, 4040); private static final Location TELEPORTS = new Location(-76136, -216216, 4040);
private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360); private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360);
private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584); private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584);
private static final Location THRID_TELEPORT = new Location(-219813, 248484, 9928); private static final Location THIRD_TELEPORT = new Location(-219813, 248484, 9928);
private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984); private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984);
// Misc // Misc
private static final int TEMPLATE_ID = 250; private static final int TEMPLATE_ID = 250;
private static final int DIMENSIONAL_DARK_FORCES = 16415; private static final int DIMENSIONAL_DARK_FORCES = 16415;
private static final int WARP_CRYSTAL = 39597; private static final int WARP_CRYSTAL = 39597;
protected double _chance = 0;
protected int _count = 0;
public int _skilllevel = 1;
public int _worldState = 0;
protected ScheduledFuture<?> _debufTask;
public DimensionalWrap() public DimensionalWrap()
{ {
@@ -125,8 +118,10 @@ public class DimensionalWrap extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
final Instance world = npc.getInstanceWorld();
if (event.equals("enterInstance")) switch (event)
{
case "enterInstance":
{ {
if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{ {
@@ -155,11 +150,8 @@ public class DimensionalWrap extends AbstractInstance
} }
} }
} }
break;
} }
if (isInInstance(world))
{
switch (event)
{
case "33975-01.html": case "33975-01.html":
{ {
htmltext = event; htmltext = event;
@@ -167,10 +159,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "12_warp_crystals": case "12_warp_crystals":
{ {
_chance = 0.3; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.3);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 12; world.setParameter("count", 12);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -183,19 +181,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 6; world.setParameter("count", 6);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 4; world.setParameter("count", 4);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 3; world.setParameter("count", 3);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -204,10 +202,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "240_warp_crystals": case "240_warp_crystals":
{ {
_chance = 0.6; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.6);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 240; world.setParameter("count", 240);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -220,19 +224,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 120; world.setParameter("count", 120);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 80; world.setParameter("count", 80);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 60; world.setParameter("count", 60);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -241,10 +245,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "1200_warp_crystals": case "1200_warp_crystals":
{ {
_chance = 0.9; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.9);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 1200; world.setParameter("count", 1200);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -257,19 +267,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 600; world.setParameter("count", 600);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 400; world.setParameter("count", 400);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 300; world.setParameter("count", 300);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -278,7 +288,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_6_f": case "send_6_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -299,9 +315,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 5) if (world.getStatus() < 5)
{ {
world.setStatus(5); world.setStatus(5);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -311,7 +327,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_11_f": case "send_11_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -321,6 +343,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -331,9 +354,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 10) if (world.getStatus() < 10)
{ {
world.setStatus(10); world.setStatus(10);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -343,7 +366,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_16_f": case "send_16_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -353,6 +382,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -363,19 +393,25 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 15) if (world.getStatus() < 15)
{ {
world.setStatus(15); world.setStatus(15);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId());
} }
break; break;
} }
case "send_21_f": case "send_21_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -385,6 +421,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -395,9 +432,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 20) if (world.getStatus() < 20)
{ {
world.setStatus(20); world.setStatus(20);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -407,7 +444,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_26_f": case "send_26_f":
{ {
if (_worldState == 0) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -417,6 +460,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -427,9 +471,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 25) if (world.getStatus() < 25)
{ {
world.setStatus(25); world.setStatus(25);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -439,15 +483,25 @@ public class DimensionalWrap extends AbstractInstance
} }
case "jump_location": case "jump_location":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
player.teleToLocation(TELEPORTS, world.getTemplateId()); player.teleToLocation(TELEPORTS, world.getTemplateId());
break; break;
} }
case "SALAMANDRA_SPAWN": case "SALAMANDRA_SPAWN":
case "SALAMANDRA_SPAWN_DUMMY": case "SALAMANDRA_SPAWN_DUMMY":
{ {
if (getRandom(100) < (_worldState / 2)) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{ {
final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); return null;
}
if (getRandom(100) < (world.getParameters().getInt("worldState", 0) / 2))
{
final Npc salamandra = addSpawn(world.getParameters().getInt("worldState", 0) < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId());
salamandra.setRunning(); salamandra.setRunning();
World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p ->
{ {
@@ -461,36 +515,57 @@ public class DimensionalWrap extends AbstractInstance
} }
case "START_STAGE": case "START_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(world.getStatus() + 1); world.setStatus(world.getStatus() + 1);
_worldState = world.getStatus(); world.setParameter("worldState", world.getStatus());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus())));
startQuestTimer("FIRST_SPAWN", 1500, npc, null); startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer());
break; break;
} }
case "FIRST_SPAWN": case "FIRST_SPAWN":
{ {
world.spawnGroup(_worldState + "_first_spawn"); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("SECOND_SPAWN", 40000, npc, null);
_debufTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if ((_worldState > 0) && (_worldState <= 11)) return null;
{
_skilllevel = 1;
} }
else if ((_worldState > 11) && (_worldState <= 20)) final int worldState = world.getParameters().getInt("worldState", 0);
{ world.spawnGroup(worldState + "_first_spawn");
_skilllevel = 2; world.spawnGroup(worldState + "_trap_spawn");
startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer());
startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true);
break;
} }
else if ((_worldState > 20) && (_worldState <= 30)) case "DEBUFF_TASK":
{ {
_skilllevel = 3; final Instance world = player.getInstanceWorld();
} if (!isInInstance(world))
else if (_worldState > 30)
{ {
_skilllevel = 4; return null;
} }
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, _skilllevel); int skilllevel = 1;
final int worldState = world.getParameters().getInt("worldState", 0);
if ((worldState > 0) && (worldState <= 11))
{
skilllevel = 1;
}
else if ((worldState > 11) && (worldState <= 20))
{
skilllevel = 2;
}
else if ((worldState > 20) && (worldState <= 30))
{
skilllevel = 3;
}
else if (worldState > 30)
{
skilllevel = 4;
}
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, skilllevel);
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if ((p != null) && !p.isDead()) if ((p != null) && !p.isDead())
@@ -498,47 +573,71 @@ public class DimensionalWrap extends AbstractInstance
skill.applyEffects(p, p); skill.applyEffects(p, p);
} }
} }
}, 5000, 10000);
break; break;
} }
case "SECOND_SPAWN": case "SECOND_SPAWN":
{ {
world.spawnGroup(_worldState + "_second_spawn"); final Instance world = player.getInstanceWorld();
startQuestTimer("THRID_SPAWN", 40000, npc, null); if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn");
startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer());
break; break;
} }
case "THRID_SPAWN": case "THIRD_SPAWN":
{ {
world.spawnGroup(_worldState + "_thred_spawn"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn");
break; break;
} }
case "CHANGE_LOCATION": case "CHANGE_LOCATION":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe);
world.spawnGroup(_worldState + "_trap_spawn"); world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_trap_spawn");
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1430), null, world.getFirstPlayer());
break; break;
} }
case "SWITCH_STAGE": case "SWITCH_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getAliveNpcs(MONSTERS).isEmpty()) if (world.getAliveNpcs(MONSTERS).isEmpty())
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true));
world.broadcastPacket(new Earthquake(npc, 50, 5)); world.broadcastPacket(new Earthquake(npc, 50, 5));
world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true);
clean(); clean(world.getFirstPlayer());
if (_worldState < 35) if (world.getParameters().getInt("worldState", 0) < 35)
{ {
startQuestTimer("NEXT_STAGE", 5000, npc, null); startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer());
} }
} }
break; break;
} }
case "NEXT_STAGE": case "NEXT_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCED_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180)));
world.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); world.setDuration((int) ((world.getRemainingTime() / 60000) + 3));
startQuestTimer("START_STAGE", 8000, npc, null); startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer());
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -549,7 +648,6 @@ public class DimensionalWrap extends AbstractInstance
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world)) if (isInInstance(world))
{ {
if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < _chance)) if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < world.getParameters().getDouble("chance", 0)))
{ {
if (_worldState < 9) final int worldState = world.getParameters().getInt("worldState", 0);
if (worldState < 9)
{ {
addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId()); addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if ((_worldState >= 9) && (_worldState < 20)) else if ((worldState >= 9) && (worldState < 20))
{ {
addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId()); addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if (_worldState >= 20) else if (worldState >= 20)
{ {
addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId()); addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
@@ -581,7 +680,7 @@ public class DimensionalWrap extends AbstractInstance
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true));
world.finishInstance(3); world.finishInstance(3);
clean(); clean(world.getFirstPlayer());
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance
@Override @Override
public String onFirstTalk(Npc npc, PlayerInstance player) public String onFirstTalk(Npc npc, PlayerInstance player)
{ {
if (_worldState == 20) final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (world.getParameters().getInt("worldState", 0) == 20))
{ {
return "33975-04.html"; return "33975-04.html";
} }
@@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance
{ {
case SALAMANDRA_GENERATOR: case SALAMANDRA_GENERATOR:
{ {
startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true);
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer());
break; break;
} }
case SALAMANDRA_GENERATOR_DUMMY: case SALAMANDRA_GENERATOR_DUMMY:
{ {
startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true);
break; break;
} }
case DEMINSIONAL_INVISIBLE_FRAGMENT: case DEMINSIONAL_INVISIBLE_FRAGMENT:
{ {
startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true);
break; break;
} }
} }
@@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance
boolean canStart = true; boolean canStart = true;
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < _count) if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < world.getParameters().getInt("count", 0))
{ {
for (PlayerInstance ps : world.getPlayers()) for (PlayerInstance ps : world.getPlayers())
{ {
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
packet.setHtml(getHtm(ps, "33975-03.html")); packet.setHtml(getHtm(ps, "33975-03.html"));
packet.replace("%count%", Integer.toString(_count)); packet.replace("%count%", Integer.toString(world.getParameters().getInt("count", 0)));
ps.sendPacket(packet); ps.sendPacket(packet);
ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName()));
canStart = false; canStart = false;
} }
} }
} }
if (!canStart || (_worldState != 0)) if (!canStart || (world.getParameters().getInt("worldState", 0) != 0))
{ {
return; return;
} }
startQuestTimer("START_STAGE", 1000, npc, null); startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer());
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
takeItems(p, WARP_CRYSTAL, _count); takeItems(p, WARP_CRYSTAL, world.getParameters().getInt("count", 0));
} }
} }
protected void clean() protected void clean(PlayerInstance player)
{ {
cancelQuestTimers("SWITCH_STAGE"); cancelQuestTimer("SWITCH_STAGE", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN"); cancelQuestTimer("SALAMANDRA_SPAWN", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player);
cancelQuestTimers("CHANGE_LOCATION"); cancelQuestTimer("CHANGE_LOCATION", null, player);
if (_debufTask != null) cancelQuestTimer("DEBUFF_TASK", null, player);
{
_debufTask.cancel(false);
_debufTask = null;
}
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti;
/** /**
* Mystic Tavern Tauti Instance * Mystic Tavern Tauti Instance
* @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk
* @author Gigi * @author Gigi, Mobius
*/ */
public class StoryOfTauti extends AbstractInstance public class StoryOfTauti extends AbstractInstance
{ {
@@ -93,14 +93,13 @@ public class StoryOfTauti extends AbstractInstance
private static final Location TELEPORT = new Location(153267, -148441, -11560); private static final Location TELEPORT = new Location(153267, -148441, -11560);
private static final int ZONE_1ST_TRIGER = 24137770; private static final int ZONE_1ST_TRIGER = 24137770;
private static final int SKILL_TRIGER = 24138880; private static final int SKILL_TRIGER = 24138880;
private static Npc _deton;
private static Npc _seal_device; private static Npc _seal_device;
protected int _count = 0; protected int _count = 0;
public StoryOfTauti() public StoryOfTauti()
{ {
super(TEMPLATE_ID); super(TEMPLATE_ID);
addSpawnId(DETON, SEAL_DEVICE, FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL); addSpawnId(FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL);
addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL); addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL);
addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL);
addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE);
@@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(1) || world.isStatus(4)) if (world.isStatus(1) || world.isStatus(4))
{ {
_deton.setTarget(player); world.getNpc(DETON).setTarget(player);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
} }
else else
{ {
@@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_status": case "check_status":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()))
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
startQuestTimer("msg_1", 7000, _deton, null); startQuestTimer("msg_1", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_1": case "msg_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW);
startQuestTimer("msg_2", 10000, _deton, null); startQuestTimer("msg_2", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_2": case "msg_2":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE);
startQuestTimer("msg_3", 10000, _deton, null); startQuestTimer("msg_3", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_3": case "msg_3":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME);
break; break;
} }
case "msg_4": case "msg_4":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE);
startQuestTimer("msg_5", 7000, _deton, null); startQuestTimer("msg_5", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_5": case "msg_5":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE);
startQuestTimer("msg_6", 10000, _deton, null); startQuestTimer("msg_6", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_6": case "msg_6":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE);
break; break;
} }
case "spawn_stacato": case "spawn_stacato":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_1", 50000, _deton, null); startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_1": case "spawn_stacato_1":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_2", 50000, _deton, null); startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_2": case "spawn_stacato_2":
@@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_flower": case "check_flower":
{ {
if (!npc.isDead()) if ((world != null) && !npc.isDead())
{ {
for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000))
{ {
if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0))
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, nearby.getLocation(), 23); addMoveToDesire(npc, nearby.getLocation(), 23);
if (npc.calculateDistance3D(nearby) < 100) if (npc.calculateDistance3D(nearby) < 100)
{ {
@@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
} }
startQuestTimer("check_flower", 3000, npc, null);
} }
break; break;
} }
@@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_7": case "msg_7":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN);
break; break;
} }
case "spawn_scorpion": case "spawn_scorpion":
{ {
world.spawnGroup("flame_scorpion"); world.spawnGroup("flame_scorpion");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE);
if (getRandom(10) < 5) if (getRandom(10) < 5)
{ {
world.spawnGroup("ifrit"); world.spawnGroup("ifrit");
@@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if ((pl != null) && !pl.isDead()) if ((pl != null) && !pl.isDead())
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23); addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23);
addAttackPlayerDesire(npc, pl); addAttackPlayerDesire(npc, pl);
} }
@@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_8": case "msg_8":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS);
startQuestTimer("msg_9", 8000, _deton, null); startQuestTimer("msg_9", 8000, world.getNpc(DETON), null);
break; break;
} }
case "msg_9": case "msg_9":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY);
startQuestTimer("msg_10", 10000, _deton, null); startQuestTimer("msg_10", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_10": case "msg_10":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING);
break; break;
} }
case "spawn_golem": case "spawn_golem":
{ {
world.spawnGroup("golem"); world.spawnGroup("golem");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away", 10000, _deton, null); startQuestTimer("run_away", 10000, world.getNpc(DETON), null);
break; break;
} }
case "run_away": case "run_away":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 3500, _deton, null); startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null);
break; break;
} }
case "delete_daton": case "delete_daton":
@@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_11": case "msg_11":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST);
break; break;
} }
case "msg_12": case "msg_12":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA);
startQuestTimer("msg_13", 9000, _deton, null); startQuestTimer("msg_13", 9000, world.getNpc(DETON), null);
break; break;
} }
case "msg_13": case "msg_13":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA);
break; break;
} }
case "spawn_scarab": case "spawn_scarab":
{ {
world.spawnGroup("flame_scarab"); world.spawnGroup("flame_scarab");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away_1", 8000, _deton, null); startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null);
break; break;
} }
case "run_away_1": case "run_away_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 5000, _deton, null); startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null);
break; break;
} }
case "switch_quest": case "switch_quest":
@@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance
} }
case "end_instance": case "end_instance":
{ {
cancelQuestTimers("check_flower");
_count = 0; _count = 0;
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
@@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (npc.isScriptValue(0)) if (npc.isScriptValue(0))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW);
npc.setScriptValue(1); npc.setScriptValue(1);
break; break;
} }
if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60))
{ {
_seal_device.setDisplayEffect(1); _seal_device.setDisplayEffect(1);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE);
npc.setScriptValue(2); npc.setScriptValue(2);
break; break;
} }
@@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30))
{ {
world.spawnGroup("last_deton"); world.spawnGroup("last_deton");
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3);
startQuestTimer("msg_12", 6000, _deton, null); startQuestTimer("msg_12", 6000, world.getNpc(DETON), null);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME);
world.setStatus(11); world.setStatus(11);
} }
if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5)) if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5))
@@ -603,7 +602,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
}); });
startQuestTimer("end_instance", 52000, _deton, null); startQuestTimer("end_instance", 52000, world.getNpc(DETON), null);
world.despawnGroup("last_deton"); world.despawnGroup("last_deton");
world.despawnGroup("last_archagel"); world.despawnGroup("last_archagel");
playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE); playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE);
@@ -627,21 +626,20 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
{ {
cancelQuestTimers("end_instance"); cancelQuestTimer("end_instance", world.getNpc(DETON), null);
cancelQuestTimers("check_flower");
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME)));
world.setStatus(4); world.setStatus(4);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL);
startQuestTimer("msg_7", 7000, _deton, null); startQuestTimer("msg_7", 7000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2)) if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("msg_8", 3000, _deton, null); startQuestTimer("msg_8", 3000, world.getNpc(DETON), null);
world.setStatus(6); world.setStatus(6);
} }
break; break;
@@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance
_seal_device.setDisplayEffect(3); _seal_device.setDisplayEffect(3);
_seal_device.doDie(npc); _seal_device.doDie(npc);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2);
startQuestTimer("msg_11", 3000, _deton, null); startQuestTimer("msg_11", 3000, world.getNpc(DETON), null);
break; break;
} }
case SEALED_ANGEL: case SEALED_ANGEL:
@@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance
if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1))
{ {
world.setStatus(2); world.setStatus(2);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
startQuestTimer("msg_4", 7000, _deton, null); startQuestTimer("msg_4", 7000, world.getNpc(DETON), null);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME)));
startQuestTimer("end_instance", 190000, _deton, null); startQuestTimer("end_instance", 190000, world.getNpc(DETON), null);
startQuestTimer("spawn_stacato", 5000, _deton, null); startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(0)) if (world.isStatus(0))
{ {
startQuestTimer("check_status", 21000, _deton, player); startQuestTimer("check_status", 21000, world.getNpc(DETON), player);
world.setStatus(1); world.setStatus(1);
} }
break; break;
@@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(4)) if (world.isStatus(4))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING);
startQuestTimer("spawn_scorpion", 5000, _deton, player); startQuestTimer("spawn_scorpion", 5000, world.getNpc(DETON), player);
world.setStatus(5); world.setStatus(5);
} }
break; break;
@@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY);
startQuestTimer("spawn_golem", 7000, _deton, player); startQuestTimer("spawn_golem", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT);
startQuestTimer("spawn_scarab", 7000, _deton, player); startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance
{ {
switch (npc.getId()) switch (npc.getId())
{ {
case DETON:
{
_deton = npc;
break;
}
case SEAL_DEVICE: case SEAL_DEVICE:
{ {
_seal_device = npc; _seal_device = npc;
@@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance
} }
case FLAME_STACATO: case FLAME_STACATO:
{ {
startQuestTimer("check_flower", 3000, npc, null, true); startQuestTimer("check_flower", 3000, npc, null);
break; break;
} }
case FLAME_SCORPION: case FLAME_SCORPION:

View File

@@ -34,7 +34,7 @@ import instances.AbstractInstance;
* Nornils Garden Instance * Nornils Garden Instance
* @URL https://l2wiki.com/Nornils_Garden * @URL https://l2wiki.com/Nornils_Garden
* @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs
* @author Gigi * @author Gigi, Mobius
* @date 2017-02-22 - [15:22:27] * @date 2017-02-22 - [15:22:27]
*/ */
public class NornilsGarden extends AbstractInstance public class NornilsGarden extends AbstractInstance
@@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200016, true); world.openCloseDoor(16200016, true);
cancelQuestTimers("stage2"); cancelQuestTimer("stage2", npc, null);
world.spawnGroup("wave_3"); world.spawnGroup("wave_3");
} }
break; break;
@@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200201, true); world.openCloseDoor(16200201, true);
cancelQuestTimers("stage3"); cancelQuestTimer("stage3", npc, null);
cancelQuestTimers("check_agrro");
} }
break; break;
} }
case "check_agrro": case "check_agrro":
{ {
if ((world != null) && !npc.isDead() && !npc.isInCombat()) if ((world != null) && !npc.isDead() && !npc.isInCombat() && !world.getDoor(16200201).isOpen())
{ {
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar ->
{ {
@@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar);
} }
}); });
startQuestTimer("check_agrro", 1000, npc, null);
} }
break; break;
} }
@@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance
{ {
if (npc.getId() == BOZ_STAGE1) if (npc.getId() == BOZ_STAGE1)
{ {
cancelQuestTimers("stage1_1"); cancelQuestTimer("stage1_1", npc, null);
world.openCloseDoor(16200015, true); world.openCloseDoor(16200015, true);
world.setStatus(1); world.setStatus(1);
} }
@@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null);
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }

View File

@@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI
@Override @Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
cancelQuestTimers("attack"); cancelQuestTimer("attack", npc, null);
cancelQuestTimers("random_Target"); cancelQuestTimer("random_Target", npc, null);
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
} }

View File

@@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance
{ {
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.getParameters().set("TELEPORT_ACTIVE", true); world.setParameter("TELEPORT_ACTIVE", true);
npc.teleToLocation(BATTLE_LOC); npc.teleToLocation(BATTLE_LOC);
playMovie(world, Movie.SC_OCTABIS_OPENING); playMovie(world, Movie.SC_OCTABIS_OPENING);
getTimers().addTimer("START_STAGE_1", 26500, npc, null); getTimers().addTimer("START_STAGE_1", 26500, npc, null);

View File

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

View File

@@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance
} }
if (questGiver.getId() == 34097) // Adonius if (questGiver.getId() == 34097) // Adonius
{ {
world.getParameters().set("CAPTIVES", world.spawnGroup("captives")); world.setParameter("CAPTIVES", world.spawnGroup("captives"));
for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class)) for (Npc captive : world.getParameters().getList("CAPTIVES", Npc.class))
{ {
captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE);

View File

@@ -73,27 +73,6 @@ public class ChamberOfProphecies extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
if (event.equals("enterInstance"))
{
final QuestState qs = player.getQuestState(Q11027_PathOfDestinyOvercome.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(4, true);
}
}
else if (player != null)
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (event) switch (event)
{ {
case "31639-01.html": case "31639-01.html":
@@ -106,6 +85,11 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33996-02.html": case "33996-02.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(ExShowUsm.USM_Q015_E); world.broadcastPacket(ExShowUsm.USM_Q015_E);
world.despawnGroup("q10753_16_instance_grail"); world.despawnGroup("q10753_16_instance_grail");
world.spawnGroup("q10753_16_instance_wizard"); world.spawnGroup("q10753_16_instance_wizard");
@@ -128,14 +112,53 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "33980-05.html": case "33980-05.html":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup("q10753_16_instance_halter_2"); world.spawnGroup("q10753_16_instance_halter_2");
world.setStatus(6); world.setStatus(6);
startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); startQuestTimer("DESPAWN_WIZARD", 2000, npc, player);
htmltext = event; htmltext = event;
break; break;
} }
case "enterInstance":
{
final QuestState qs = player.getQuestState(Q11027_PathOfDestinyOvercome.class.getSimpleName());
if (qs != null)
{
enterInstance(player, npc, TEMPLATE_ID);
if (hasQuestItems(player, PROPHECY_MACHINE))
{
takeItems(player, PROPHECY_MACHINE, 1);
}
qs.setCond(4, true);
}
break;
}
case "teleport":
{
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimer("CHECK_STATUS", npc, player);
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "status": case "status":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.isStatus(0)) if (world.isStatus(0))
{ {
htmltext = "31639-01.html"; htmltext = "31639-01.html";
@@ -144,18 +167,13 @@ public class ChamberOfProphecies extends AbstractInstance
htmltext = "31639-02.html"; htmltext = "31639-02.html";
break; break;
} }
case "teleport":
{
world.getNpc(FERIN).deleteMe(); // probably needs another npc id for initial room
world.spawnGroup("q10753_16_instance_halter_1_1");
world.spawnGroup("wof_room1");
player.teleToLocation(FIRST_ROOM_LOC);
cancelQuestTimers("CHECK_STATUS");
startQuestTimer("CHECK_STATUS", 7000, world.getNpc(KAIN_VAN_HALTER), player);
break;
}
case "CHECK_STATUS": case "CHECK_STATUS":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
switch (world.getStatus()) switch (world.getStatus())
{ {
case 0: case 0:
@@ -223,6 +241,11 @@ public class ChamberOfProphecies extends AbstractInstance
case "ATTACK1": case "ATTACK1":
case "ATTACK2": case "ATTACK2":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
npc.setRunning(); npc.setRunning();
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
@@ -242,7 +265,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR1": case "OPEN_DOOR1":
{ {
cancelQuestTimers("ATTACK"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK", npc, player);
world.setStatus(1); world.setStatus(1);
world.openCloseDoor(DOOR_2, true); world.openCloseDoor(DOOR_2, true);
world.spawnGroup("wof_room2"); world.spawnGroup("wof_room2");
@@ -250,7 +278,12 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "OPEN_DOOR2": case "OPEN_DOOR2":
{ {
cancelQuestTimers("ATTACK1"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
cancelQuestTimer("ATTACK1", npc, player);
startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true);
world.setStatus(3); world.setStatus(3);
world.spawnGroup("wof_room3"); world.spawnGroup("wof_room3");
@@ -337,23 +370,33 @@ public class ChamberOfProphecies extends AbstractInstance
if (npc.getId() == FERIN) if (npc.getId() == FERIN)
{ {
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player);
cancelQuestTimers("BROADCAST_TEXT"); cancelQuestTimer("BROADCAST_TEXT", npc, player);
} }
break; break;
} }
case "SEY_KAIN_4": case "SEY_KAIN_4":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(5); world.setStatus(5);
world.spawnGroup("q10753_16_instance_grail"); world.spawnGroup("q10753_16_instance_grail");
showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000);
world.openCloseDoor(DOOR_4, true); world.openCloseDoor(DOOR_4, true);
cancelQuestTimers("ATTACK2"); cancelQuestTimer("ATTACK2", npc, player);
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player);
startQuestTimer("CLOSE", 15000, null, player); startQuestTimer("CLOSE", 15000, null, player);
break; break;
} }
case "CLOSE": case "CLOSE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
final Npc grail = world.getNpc(GRAIL); final Npc grail = world.getNpc(GRAIL);
if ((grail != null) && (player.calculateDistance2D(grail) < 390)) if ((grail != null) && (player.calculateDistance2D(grail) < 390))
{ {
@@ -369,13 +412,18 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "DESPAWN_WIZARD": case "DESPAWN_WIZARD":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.despawnGroup("q10753_16_instance_wizard"); world.despawnGroup("q10753_16_instance_wizard");
break; break;
} }
case "exit": case "exit":
{ {
startQuestTimer("finish", 3000, npc, player); startQuestTimer("finish", 3000, npc, player);
player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt((int) 1.0D)); player.sendPacket(new SystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES).addInt(1));
final QuestState qs = player.getQuestState(Q11027_PathOfDestinyOvercome.class.getSimpleName()); final QuestState qs = player.getQuestState(Q11027_PathOfDestinyOvercome.class.getSimpleName());
if (qs != null) if (qs != null)
{ {
@@ -385,11 +433,15 @@ public class ChamberOfProphecies extends AbstractInstance
} }
case "finish": case "finish":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.finishInstance(0); world.finishInstance(0);
break; break;
} }
} }
}
return htmltext; return htmltext;
} }

View File

@@ -17,10 +17,8 @@
package instances.DimensionalWrap; package instances.DimensionalWrap;
import java.util.List; import java.util.List;
import java.util.concurrent.ScheduledFuture;
import org.l2jmobius.Config; import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.enums.CategoryType; import org.l2jmobius.gameserver.enums.CategoryType;
@@ -44,7 +42,7 @@ import instances.AbstractInstance;
* Dimensional Wrap instance * Dimensional Wrap instance
* @URL https://l2wiki.com/Dimensional_Warp * @URL https://l2wiki.com/Dimensional_Warp
* @Video https://www.youtube.com/watch?v=hOnzk0ELwIg * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg
* @author Gigi * @author Gigi, Mobius
* @date 2018-09-04 - [14:33:31] * @date 2018-09-04 - [14:33:31]
*/ */
public class DimensionalWrap extends AbstractInstance public class DimensionalWrap extends AbstractInstance
@@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance
23480, // Abyssal Harpy 23480, // Abyssal Harpy
23481, // Abyssal Binder 23481, // Abyssal Binder
23482, // Abyssal Archon 23482, // Abyssal Archon
23483 // Abyssal Golem 23483, // Abyssal Golem
}; };
private static final int[] TRAPS = private static final int[] TRAPS =
{ {
@@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance
19559, // Damage trap, power 1 19559, // Damage trap, power 1
19560, // Damage trap, power 2 19560, // Damage trap, power 2
19561, // Damage trap, power 3 19561, // Damage trap, power 3
19562 // Heal Trap 19562, // Heal Trap
}; };
// Location // Location
private static final Location TELEPORTS = new Location(-76136, -216216, 4040); private static final Location TELEPORTS = new Location(-76136, -216216, 4040);
private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360); private static final Location FIRST_TELEPORT = new Location(-219544, 248776, 3360);
private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584); private static final Location SECOND_TELEPORT = new Location(-206756, 242009, 6584);
private static final Location THRID_TELEPORT = new Location(-219813, 248484, 9928); private static final Location THIRD_TELEPORT = new Location(-219813, 248484, 9928);
private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984); private static final Location FOURTH_TELEPORT = new Location(-87191, -210129, 6984);
// Misc // Misc
private static final int TEMPLATE_ID = 250; private static final int TEMPLATE_ID = 250;
private static final int DIMENSIONAL_DARK_FORCES = 16415; private static final int DIMENSIONAL_DARK_FORCES = 16415;
private static final int WARP_CRYSTAL = 39597; private static final int WARP_CRYSTAL = 39597;
protected double _chance = 0;
protected int _count = 0;
public int _skilllevel = 1;
public int _worldState = 0;
protected ScheduledFuture<?> _debufTask;
public DimensionalWrap() public DimensionalWrap()
{ {
@@ -125,8 +118,10 @@ public class DimensionalWrap extends AbstractInstance
public String onAdvEvent(String event, Npc npc, PlayerInstance player) public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{ {
String htmltext = null; String htmltext = null;
final Instance world = npc.getInstanceWorld();
if (event.equals("enterInstance")) switch (event)
{
case "enterInstance":
{ {
if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{ {
@@ -155,11 +150,8 @@ public class DimensionalWrap extends AbstractInstance
} }
} }
} }
break;
} }
if (isInInstance(world))
{
switch (event)
{
case "33975-01.html": case "33975-01.html":
{ {
htmltext = event; htmltext = event;
@@ -167,10 +159,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "12_warp_crystals": case "12_warp_crystals":
{ {
_chance = 0.3; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.3);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 12; world.setParameter("count", 12);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -183,19 +181,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 6; world.setParameter("count", 6);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 4; world.setParameter("count", 4);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 3; world.setParameter("count", 3);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -204,10 +202,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "240_warp_crystals": case "240_warp_crystals":
{ {
_chance = 0.6; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.6);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 240; world.setParameter("count", 240);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -220,19 +224,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 120; world.setParameter("count", 120);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 80; world.setParameter("count", 80);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 60; world.setParameter("count", 60);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -241,10 +245,16 @@ public class DimensionalWrap extends AbstractInstance
} }
case "1200_warp_crystals": case "1200_warp_crystals":
{ {
_chance = 0.9; final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setParameter("chance", 0.9);
if (!player.isInParty()) if (!player.isInParty())
{ {
_count = 1200; world.setParameter("count", 1200);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -257,19 +267,19 @@ public class DimensionalWrap extends AbstractInstance
{ {
case 2: case 2:
{ {
_count = 600; world.setParameter("count", 600);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 3: case 3:
{ {
_count = 400; world.setParameter("count", 400);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
case 4: case 4:
{ {
_count = 300; world.setParameter("count", 300);
checkCrystallCount(world, npc); checkCrystallCount(world, npc);
break; break;
} }
@@ -278,7 +288,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_6_f": case "send_6_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -299,9 +315,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 5) if (world.getStatus() < 5)
{ {
world.setStatus(5); world.setStatus(5);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -311,7 +327,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_11_f": case "send_11_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -321,6 +343,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -331,9 +354,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 10) if (world.getStatus() < 10)
{ {
world.setStatus(10); world.setStatus(10);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -343,7 +366,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_16_f": case "send_16_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -353,6 +382,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -363,19 +393,25 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 15) if (world.getStatus() < 15)
{ {
world.setStatus(15); world.setStatus(15);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId());
} }
break; break;
} }
case "send_21_f": case "send_21_f":
{ {
if (_worldState == 0) final Instance world = npc.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -385,6 +421,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -395,9 +432,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 20) if (world.getStatus() < 20)
{ {
world.setStatus(20); world.setStatus(20);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -407,7 +444,13 @@ public class DimensionalWrap extends AbstractInstance
} }
case "send_26_f": case "send_26_f":
{ {
if (_worldState == 0) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getParameters().getInt("worldState", 0) == 0)
{ {
htmltext = "33975-02.html"; htmltext = "33975-02.html";
break; break;
@@ -417,6 +460,7 @@ public class DimensionalWrap extends AbstractInstance
htmltext = "33975-05.html"; htmltext = "33975-05.html";
break; break;
} }
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -427,9 +471,9 @@ public class DimensionalWrap extends AbstractInstance
if (world.getStatus() < 25) if (world.getStatus() < 25)
{ {
world.setStatus(25); world.setStatus(25);
cancelQuestTimers("SECOND_SPAWN"); cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer());
cancelQuestTimers("THRID_SPAWN"); cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer());
startQuestTimer("START_STAGE", 5000, npc, null); startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer());
} }
for (PlayerInstance pl : world.getPlayers()) for (PlayerInstance pl : world.getPlayers())
{ {
@@ -439,15 +483,25 @@ public class DimensionalWrap extends AbstractInstance
} }
case "jump_location": case "jump_location":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
player.teleToLocation(TELEPORTS, world.getTemplateId()); player.teleToLocation(TELEPORTS, world.getTemplateId());
break; break;
} }
case "SALAMANDRA_SPAWN": case "SALAMANDRA_SPAWN":
case "SALAMANDRA_SPAWN_DUMMY": case "SALAMANDRA_SPAWN_DUMMY":
{ {
if (getRandom(100) < (_worldState / 2)) final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{ {
final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); return null;
}
if (getRandom(100) < (world.getParameters().getInt("worldState", 0) / 2))
{
final Npc salamandra = addSpawn(world.getParameters().getInt("worldState", 0) < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId());
salamandra.setRunning(); salamandra.setRunning();
World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p ->
{ {
@@ -461,36 +515,57 @@ public class DimensionalWrap extends AbstractInstance
} }
case "START_STAGE": case "START_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.setStatus(world.getStatus() + 1); world.setStatus(world.getStatus() + 1);
_worldState = world.getStatus(); world.setParameter("worldState", world.getStatus());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus())));
startQuestTimer("FIRST_SPAWN", 1500, npc, null); startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer());
break; break;
} }
case "FIRST_SPAWN": case "FIRST_SPAWN":
{ {
world.spawnGroup(_worldState + "_first_spawn"); final Instance world = player.getInstanceWorld();
world.spawnGroup(_worldState + "_trap_spawn"); if (!isInInstance(world))
startQuestTimer("SECOND_SPAWN", 40000, npc, null);
_debufTask = ThreadPool.scheduleAtFixedRate(() ->
{ {
if ((_worldState > 0) && (_worldState <= 11)) return null;
{
_skilllevel = 1;
} }
else if ((_worldState > 11) && (_worldState <= 20)) final int worldState = world.getParameters().getInt("worldState", 0);
{ world.spawnGroup(worldState + "_first_spawn");
_skilllevel = 2; world.spawnGroup(worldState + "_trap_spawn");
startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer());
startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true);
break;
} }
else if ((_worldState > 20) && (_worldState <= 30)) case "DEBUFF_TASK":
{ {
_skilllevel = 3; final Instance world = player.getInstanceWorld();
} if (!isInInstance(world))
else if (_worldState > 30)
{ {
_skilllevel = 4; return null;
} }
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, _skilllevel); int skilllevel = 1;
final int worldState = world.getParameters().getInt("worldState", 0);
if ((worldState > 0) && (worldState <= 11))
{
skilllevel = 1;
}
else if ((worldState > 11) && (worldState <= 20))
{
skilllevel = 2;
}
else if ((worldState > 20) && (worldState <= 30))
{
skilllevel = 3;
}
else if (worldState > 30)
{
skilllevel = 4;
}
final Skill skill = SkillData.getInstance().getSkill(DIMENSIONAL_DARK_FORCES, skilllevel);
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if ((p != null) && !p.isDead()) if ((p != null) && !p.isDead())
@@ -498,47 +573,71 @@ public class DimensionalWrap extends AbstractInstance
skill.applyEffects(p, p); skill.applyEffects(p, p);
} }
} }
}, 5000, 10000);
break; break;
} }
case "SECOND_SPAWN": case "SECOND_SPAWN":
{ {
world.spawnGroup(_worldState + "_second_spawn"); final Instance world = player.getInstanceWorld();
startQuestTimer("THRID_SPAWN", 40000, npc, null); if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn");
startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer());
break; break;
} }
case "THRID_SPAWN": case "THIRD_SPAWN":
{ {
world.spawnGroup(_worldState + "_thred_spawn"); final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn");
break; break;
} }
case "CHANGE_LOCATION": case "CHANGE_LOCATION":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe);
world.spawnGroup(_worldState + "_trap_spawn"); world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_trap_spawn");
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1430), null, world.getFirstPlayer());
break; break;
} }
case "SWITCH_STAGE": case "SWITCH_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
if (world.getAliveNpcs(MONSTERS).isEmpty()) if (world.getAliveNpcs(MONSTERS).isEmpty())
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true));
world.broadcastPacket(new Earthquake(npc, 50, 5)); world.broadcastPacket(new Earthquake(npc, 50, 5));
world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true);
clean(); clean(world.getFirstPlayer());
if (_worldState < 35) if (world.getParameters().getInt("worldState", 0) < 35)
{ {
startQuestTimer("NEXT_STAGE", 5000, npc, null); startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer());
} }
} }
break; break;
} }
case "NEXT_STAGE": case "NEXT_STAGE":
{ {
final Instance world = player.getInstanceWorld();
if (!isInInstance(world))
{
return null;
}
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCE_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180))); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.S1_SECONDS_HAVE_BEEN_ADDED_TO_THE_INSTANCE_ZONE_DURATION, ExShowScreenMessage.TOP_CENTER, 5000, true, String.valueOf(180)));
world.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); world.setDuration((int) ((world.getRemainingTime() / 60000) + 3));
startQuestTimer("START_STAGE", 8000, npc, null); startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer());
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
if (n.getId() != EINSTER) if (n.getId() != EINSTER)
@@ -549,7 +648,6 @@ public class DimensionalWrap extends AbstractInstance
break; break;
} }
} }
}
return htmltext; return htmltext;
} }
@@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (isInInstance(world)) if (isInInstance(world))
{ {
if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < _chance)) if (CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < world.getParameters().getDouble("chance", 0)))
{ {
if (_worldState < 9) final int worldState = world.getParameters().getInt("worldState", 0);
if (worldState < 9)
{ {
addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId()); addSpawn(DIMENSIONAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if ((_worldState >= 9) && (_worldState < 20)) else if ((worldState >= 9) && (worldState < 20))
{ {
addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId()); addSpawn(UNWORDLY_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.UNWORLDLY_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
} }
else if (_worldState >= 20) else if (worldState >= 20)
{ {
addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId()); addSpawn(ABYSSAL_IMP, npc, true, 0, false, world.getId());
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.ABYSSAL_IMP, ExShowScreenMessage.TOP_CENTER, 5000, true));
@@ -581,7 +680,7 @@ public class DimensionalWrap extends AbstractInstance
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_INSTANCED_ZONE_WILL_CLOSE_SOON, ExShowScreenMessage.TOP_CENTER, 10000, true));
world.finishInstance(3); world.finishInstance(3);
clean(); clean(world.getFirstPlayer());
} }
} }
return super.onKill(npc, killer, isSummon); return super.onKill(npc, killer, isSummon);
@@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance
@Override @Override
public String onFirstTalk(Npc npc, PlayerInstance player) public String onFirstTalk(Npc npc, PlayerInstance player)
{ {
if (_worldState == 20) final Instance world = npc.getInstanceWorld();
if (isInInstance(world) && (world.getParameters().getInt("worldState", 0) == 20))
{ {
return "33975-04.html"; return "33975-04.html";
} }
@@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance
{ {
case SALAMANDRA_GENERATOR: case SALAMANDRA_GENERATOR:
{ {
startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true);
startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer());
break; break;
} }
case SALAMANDRA_GENERATOR_DUMMY: case SALAMANDRA_GENERATOR_DUMMY:
{ {
startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true);
break; break;
} }
case DEMINSIONAL_INVISIBLE_FRAGMENT: case DEMINSIONAL_INVISIBLE_FRAGMENT:
{ {
startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true);
break; break;
} }
} }
@@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance
boolean canStart = true; boolean canStart = true;
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < _count) if (p.getInventory().getInventoryItemCount(WARP_CRYSTAL, -1) < world.getParameters().getInt("count", 0))
{ {
for (PlayerInstance ps : world.getPlayers()) for (PlayerInstance ps : world.getPlayers())
{ {
final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
packet.setHtml(getHtm(ps, "33975-03.html")); packet.setHtml(getHtm(ps, "33975-03.html"));
packet.replace("%count%", Integer.toString(_count)); packet.replace("%count%", Integer.toString(world.getParameters().getInt("count", 0)));
ps.sendPacket(packet); ps.sendPacket(packet);
ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); ps.sendPacket(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName()));
canStart = false; canStart = false;
} }
} }
} }
if (!canStart || (_worldState != 0)) if (!canStart || (world.getParameters().getInt("worldState", 0) != 0))
{ {
return; return;
} }
startQuestTimer("START_STAGE", 1000, npc, null); startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer());
for (PlayerInstance p : world.getPlayers()) for (PlayerInstance p : world.getPlayers())
{ {
takeItems(p, WARP_CRYSTAL, _count); takeItems(p, WARP_CRYSTAL, world.getParameters().getInt("count", 0));
} }
} }
protected void clean() protected void clean(PlayerInstance player)
{ {
cancelQuestTimers("SWITCH_STAGE"); cancelQuestTimer("SWITCH_STAGE", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN"); cancelQuestTimer("SALAMANDRA_SPAWN", null, player);
cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player);
cancelQuestTimers("CHANGE_LOCATION"); cancelQuestTimer("CHANGE_LOCATION", null, player);
if (_debufTask != null) cancelQuestTimer("DEBUFF_TASK", null, player);
{
_debufTask.cancel(false);
_debufTask = null;
}
} }
public static void main(String[] args) public static void main(String[] args)

View File

@@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti;
/** /**
* Mystic Tavern Tauti Instance * Mystic Tavern Tauti Instance
* @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk
* @author Gigi * @author Gigi, Mobius
*/ */
public class StoryOfTauti extends AbstractInstance public class StoryOfTauti extends AbstractInstance
{ {
@@ -93,14 +93,13 @@ public class StoryOfTauti extends AbstractInstance
private static final Location TELEPORT = new Location(153267, -148441, -11560); private static final Location TELEPORT = new Location(153267, -148441, -11560);
private static final int ZONE_1ST_TRIGER = 24137770; private static final int ZONE_1ST_TRIGER = 24137770;
private static final int SKILL_TRIGER = 24138880; private static final int SKILL_TRIGER = 24138880;
private static Npc _deton;
private static Npc _seal_device; private static Npc _seal_device;
protected int _count = 0; protected int _count = 0;
public StoryOfTauti() public StoryOfTauti()
{ {
super(TEMPLATE_ID); super(TEMPLATE_ID);
addSpawnId(DETON, SEAL_DEVICE, FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL); addSpawnId(FLAME_FLOWER, FLAME_STACATO, FLAME_SCORPION, FLAME_SCARAB, FLAME_GOLEM, NPC_1, SEAL_ARCHANGEL);
addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL); addAttackId(SEAL_TOMBSTONE, SEAL_ARCHANGEL);
addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL);
addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE);
@@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(1) || world.isStatus(4)) if (world.isStatus(1) || world.isStatus(4))
{ {
_deton.setTarget(player); world.getNpc(DETON).setTarget(player);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
} }
else else
{ {
@@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_status": case "check_status":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ARE_YOU_THE_ONES_WHO_WILL_BE_HELPING_OUT_WELCOME_I_VE_BEEN_WAITING_FOR_YOU);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()))
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
startQuestTimer("msg_1", 7000, _deton, null); startQuestTimer("msg_1", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_1": case "msg_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_HAD_A_HARD_TIME_WORKING_BY_MYSELF_I_M_GLAD_YOU_ARE_HERE_NOW);
startQuestTimer("msg_2", 10000, _deton, null); startQuestTimer("msg_2", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_2": case "msg_2":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE);
startQuestTimer("msg_3", 10000, _deton, null); startQuestTimer("msg_3", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_3": case "msg_3":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_M_GLAD_POWERFUL_PEOPLE_LIKE_YOU_GUYS_ARE_HELPING_ME);
break; break;
} }
case "msg_4": case "msg_4":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE);
startQuestTimer("msg_5", 7000, _deton, null); startQuestTimer("msg_5", 7000, world.getNpc(DETON), null);
break; break;
} }
case "msg_5": case "msg_5":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TO_SAVE_THE_FLAME_FLOWER_YOU_NEED_HEAL_WAIT_RADIANT_HEAL_YES_I_M_SURE);
startQuestTimer("msg_6", 10000, _deton, null); startQuestTimer("msg_6", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_6": case "msg_6":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELL_THERE_S_NOT_MUCH_DIFFERENCE_RIGHT_OR_IS_THERE);
break; break;
} }
case "spawn_stacato": case "spawn_stacato":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_1", 50000, _deton, null); startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_1": case "spawn_stacato_1":
{ {
world.spawnGroup("flame_stacato"); world.spawnGroup("flame_stacato");
startQuestTimer("spawn_stacato_2", 50000, _deton, null); startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null);
break; break;
} }
case "spawn_stacato_2": case "spawn_stacato_2":
@@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "check_flower": case "check_flower":
{ {
if (!npc.isDead()) if ((world != null) && !npc.isDead())
{ {
for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000))
{ {
if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0))
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, nearby.getLocation(), 23); addMoveToDesire(npc, nearby.getLocation(), 23);
if (npc.calculateDistance3D(nearby) < 100) if (npc.calculateDistance3D(nearby) < 100)
{ {
@@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
} }
startQuestTimer("check_flower", 3000, npc, null);
} }
break; break;
} }
@@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_7": case "msg_7":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.LET_S_HAVE_SOME_FUN);
break; break;
} }
case "spawn_scorpion": case "spawn_scorpion":
{ {
world.spawnGroup("flame_scorpion"); world.spawnGroup("flame_scorpion");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.EEK_SAVE_THIS_DWARF_I_M_JUST_AN_ARCHAEOLOGIST_I_LL_GIVE_YOU_EVERYTHING_I_HAVE);
if (getRandom(10) < 5) if (getRandom(10) < 5)
{ {
world.spawnGroup("ifrit"); world.spawnGroup("ifrit");
@@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if ((pl != null) && !pl.isDead()) if ((pl != null) && !pl.isDead())
{ {
_deton.setRunning(); world.getNpc(DETON).setRunning();
addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23); addMoveToDesire(npc, new Location(pl.getX() + getRandom(-40, 40), pl.getY() + getRandom(-40, 40), pl.getZ()), 23);
addAttackPlayerDesire(npc, pl); addAttackPlayerDesire(npc, pl);
} }
@@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_8": case "msg_8":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS);
startQuestTimer("msg_9", 8000, _deton, null); startQuestTimer("msg_9", 8000, world.getNpc(DETON), null);
break; break;
} }
case "msg_9": case "msg_9":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY);
startQuestTimer("msg_10", 10000, _deton, null); startQuestTimer("msg_10", 10000, world.getNpc(DETON), null);
break; break;
} }
case "msg_10": case "msg_10":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.BOTH_LOOK_PRETTY_BAD_BUT_WE_MUST_KEEP_GOING);
break; break;
} }
case "spawn_golem": case "spawn_golem":
{ {
world.spawnGroup("golem"); world.spawnGroup("golem");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_WHAT_ARE_THESE_MONSTERS_HOW_OLD_DO_YOU_HAVE_BE_TO_GET_THAT_BIG);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LOOK_AT_THAT_FLAME_GOLEM_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away", 10000, _deton, null); startQuestTimer("run_away", 10000, world.getNpc(DETON), null);
break; break;
} }
case "run_away": case "run_away":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_LL_LEAVE_THOSE_MONSTERS_TO_YOU_I_LL_GO_CHECK_OUT_SOMETHING_OVER_THERE_IT_S_VERY_IMPORTANT);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 3500, _deton, null); startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null);
break; break;
} }
case "delete_daton": case "delete_daton":
@@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance
} }
case "msg_11": case "msg_11":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YES_THE_SEAL_IS_GONE_WELL_YOU_GO_ON_AHEAD_I_LL_MAKE_SOME_RUBBED_COPIES_FIRST);
break; break;
} }
case "msg_12": case "msg_12":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.I_CAN_T_BELIEVE_YOU_ACTUALLY_FELL_FOR_THAT_I_WAS_JUST_USING_YOU_KAHAHA);
startQuestTimer("msg_13", 9000, _deton, null); startQuestTimer("msg_13", 9000, world.getNpc(DETON), null);
break; break;
} }
case "msg_13": case "msg_13":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.TAUTI_SO_THIS_IS_TAUTI_GIVE_ME_YOUR_POWER_YOU_ARE_MINE_KAHAHAHA);
break; break;
} }
case "spawn_scarab": case "spawn_scarab":
{ {
world.spawnGroup("flame_scarab"); world.spawnGroup("flame_scarab");
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WAHHH_THIS_WAY_WAS_DANGEROUS_TOO_SAVE_ME);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THAT_FLAME_SCARAB_IT_S_TERRIFYING, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("run_away_1", 8000, _deton, null); startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null);
break; break;
} }
case "run_away_1": case "run_away_1":
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1);
startQuestTimer("delete_daton", 5000, _deton, null); startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null);
break; break;
} }
case "switch_quest": case "switch_quest":
@@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance
} }
case "end_instance": case "end_instance":
{ {
cancelQuestTimers("check_flower");
_count = 0; _count = 0;
for (Npc n : world.getAliveNpcs()) for (Npc n : world.getAliveNpcs())
{ {
@@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (npc.isScriptValue(0)) if (npc.isScriptValue(0))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SEALED_TABLET_ATTACK_THE_FLAME_FLOWERS_OH_PLANT_THE_FLAME_FLOWERS_AROUND_THE_TABLET_AND_ATTACK_IT_NOW);
npc.setScriptValue(1); npc.setScriptValue(1);
break; break;
} }
if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60))
{ {
_seal_device.setDisplayEffect(1); _seal_device.setDisplayEffect(1);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YES_LOOK_AT_THAT_THE_SEAL_IS_BREAKING_JUST_A_LITTLE_MORE);
npc.setScriptValue(2); npc.setScriptValue(2);
break; break;
} }
@@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30))
{ {
world.spawnGroup("last_deton"); world.spawnGroup("last_deton");
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3);
startQuestTimer("msg_12", 6000, _deton, null); startQuestTimer("msg_12", 6000, world.getNpc(DETON), null);
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME);
world.setStatus(11); world.setStatus(11);
} }
if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5)) if (world.isStatus(11) && (npc.getCurrentHpPercent() < 5))
@@ -603,7 +602,7 @@ public class StoryOfTauti extends AbstractInstance
} }
} }
}); });
startQuestTimer("end_instance", 52000, _deton, null); startQuestTimer("end_instance", 52000, world.getNpc(DETON), null);
world.despawnGroup("last_deton"); world.despawnGroup("last_deton");
world.despawnGroup("last_archagel"); world.despawnGroup("last_archagel");
playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE); playMovie(world.getPlayers(), Movie.EPIC_TAUTI_SCENE);
@@ -627,21 +626,20 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) if (world.isStatus(3) && world.getAliveNpcs(MonsterInstance.class).isEmpty())
{ {
cancelQuestTimers("end_instance"); cancelQuestTimer("end_instance", world.getNpc(DETON), null);
cancelQuestTimers("check_flower");
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME)));
world.setStatus(4); world.setStatus(4);
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl ->
{ {
if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())
{ {
_deton.setTarget(pl); world.getNpc(DETON).setTarget(pl);
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl);
} }
}); });
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL);
startQuestTimer("msg_7", 7000, _deton, null); startQuestTimer("msg_7", 7000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2)) if (world.isStatus(5) && (world.getAliveNpcs(MonsterInstance.class).size() < 2))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LEFT_OR_RIGHT_WHICH_WAY, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
startQuestTimer("msg_8", 3000, _deton, null); startQuestTimer("msg_8", 3000, world.getNpc(DETON), null);
world.setStatus(6); world.setStatus(6);
} }
break; break;
@@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance
_seal_device.setDisplayEffect(3); _seal_device.setDisplayEffect(3);
_seal_device.doDie(npc); _seal_device.doDie(npc);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.LET_S_GO_DOWN_THIS_WAY_I_LL_BE_RIGHT_BEHIND_YOU, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.setRunning(); world.getNpc(DETON).setRunning();
_deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2);
startQuestTimer("msg_11", 3000, _deton, null); startQuestTimer("msg_11", 3000, world.getNpc(DETON), null);
break; break;
} }
case SEALED_ANGEL: case SEALED_ANGEL:
@@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance
if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1))
{ {
world.setStatus(2); world.setStatus(2);
_deton.setTarget(null); world.getNpc(DETON).setTarget(null);
_deton.stopMove(null); world.getNpc(DETON).stopMove(null);
startQuestTimer("msg_4", 7000, _deton, null); startQuestTimer("msg_4", 7000, world.getNpc(DETON), null);
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.IT_S_A_FLAME_FLOWER_THESE_SHOULD_COME_IN_HANDY_LATER_ON, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME)));
startQuestTimer("end_instance", 190000, _deton, null); startQuestTimer("end_instance", 190000, world.getNpc(DETON), null);
startQuestTimer("spawn_stacato", 5000, _deton, null); startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null);
} }
break; break;
} }
@@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(0)) if (world.isStatus(0))
{ {
startQuestTimer("check_status", 21000, _deton, player); startQuestTimer("check_status", 21000, world.getNpc(DETON), player);
world.setStatus(1); world.setStatus(1);
} }
break; break;
@@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance
if (world.isStatus(4)) if (world.isStatus(4))
{ {
world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false)); world.broadcastPacket(new ExShowScreenMessage(NpcStringId.A_CROSSROADS_I_DON_T_KNOW_WHICH_WAY_WE_SHOULD_TAKE, ExShowScreenMessage.BOTTOM_RIGHT, 10000, false));
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.HMM_WHAT_IS_THIS_I_DON_T_THINK_I_VE_BEEN_AROUND_HERE_BEFORE_THIS_EERIE_FEELING);
startQuestTimer("spawn_scorpion", 5000, _deton, player); startQuestTimer("spawn_scorpion", 5000, world.getNpc(DETON), player);
world.setStatus(5); world.setStatus(5);
} }
break; break;
@@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OKAY_IT_DOES_LOOK_BETTER_THAN_THE_OTHER_WAY_THE_AIR_FEELS_BETTER_ALREADY);
startQuestTimer("spawn_golem", 7000, _deton, player); startQuestTimer("spawn_golem", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance
{ {
if (world.isStatus(6)) if (world.isStatus(6))
{ {
_deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT);
startQuestTimer("spawn_scarab", 7000, _deton, player); startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player);
world.setStatus(7); world.setStatus(7);
} }
break; break;
@@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance
{ {
switch (npc.getId()) switch (npc.getId())
{ {
case DETON:
{
_deton = npc;
break;
}
case SEAL_DEVICE: case SEAL_DEVICE:
{ {
_seal_device = npc; _seal_device = npc;
@@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance
} }
case FLAME_STACATO: case FLAME_STACATO:
{ {
startQuestTimer("check_flower", 3000, npc, null, true); startQuestTimer("check_flower", 3000, npc, null);
break; break;
} }
case FLAME_SCORPION: case FLAME_SCORPION:

View File

@@ -34,7 +34,7 @@ import instances.AbstractInstance;
* Nornils Garden Instance * Nornils Garden Instance
* @URL https://l2wiki.com/Nornils_Garden * @URL https://l2wiki.com/Nornils_Garden
* @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs
* @author Gigi * @author Gigi, Mobius
* @date 2017-02-22 - [15:22:27] * @date 2017-02-22 - [15:22:27]
*/ */
public class NornilsGarden extends AbstractInstance public class NornilsGarden extends AbstractInstance
@@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200016, true); world.openCloseDoor(16200016, true);
cancelQuestTimers("stage2"); cancelQuestTimer("stage2", npc, null);
world.spawnGroup("wave_3"); world.spawnGroup("wave_3");
} }
break; break;
@@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance
if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty())
{ {
world.openCloseDoor(16200201, true); world.openCloseDoor(16200201, true);
cancelQuestTimers("stage3"); cancelQuestTimer("stage3", npc, null);
cancelQuestTimers("check_agrro");
} }
break; break;
} }
case "check_agrro": case "check_agrro":
{ {
if ((world != null) && !npc.isDead() && !npc.isInCombat()) if ((world != null) && !npc.isDead() && !npc.isInCombat() && !world.getDoor(16200201).isOpen())
{ {
World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar -> World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1500, knownChar ->
{ {
@@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar);
} }
}); });
startQuestTimer("check_agrro", 1000, npc, null);
} }
break; break;
} }
@@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance
{ {
if (npc.getId() == BOZ_STAGE1) if (npc.getId() == BOZ_STAGE1)
{ {
cancelQuestTimers("stage1_1"); cancelQuestTimer("stage1_1", npc, null);
world.openCloseDoor(16200015, true); world.openCloseDoor(16200015, true);
world.setStatus(1); world.setStatus(1);
} }
@@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance
if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId())))
{ {
((Attackable) npc).setCanReturnToSpawnPoint(false); ((Attackable) npc).setCanReturnToSpawnPoint(false);
startQuestTimer("check_agrro", 1000, npc, null, true); startQuestTimer("check_agrro", 1000, npc, null);
} }
return super.onSpawn(npc); return super.onSpawn(npc);
} }

View File

@@ -137,7 +137,7 @@ public class SSQDisciplesNecropolisPast extends AbstractInstance
{ {
anakimGroup.add(addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId())); anakimGroup.add(addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId()));
} }
world.getParameters().set("anakimGroup", anakimGroup); world.setParameter("anakimGroup", anakimGroup);
} }
private synchronized void checkDoors(Npc npc, InstanceWorld world) private synchronized void checkDoors(Npc npc, InstanceWorld world)

View File

@@ -1173,10 +1173,10 @@ public class FinalEmperialTomb extends AbstractInstance implements IXmlReader
case 27: case 27:
{ {
final Npc activeScarlet = _world.getParameters().getObject("activeScarlet", Npc.class); final Npc activeScarlet = _world.getParameters().getObject("activeScarlet", Npc.class);
_world.getParameters().set("scarlet_x", activeScarlet.getX()); _world.setParameter("scarlet_x", activeScarlet.getX());
_world.getParameters().set("scarlet_y", activeScarlet.getY()); _world.setParameter("scarlet_y", activeScarlet.getY());
_world.getParameters().set("scarlet_z", activeScarlet.getZ()); _world.setParameter("scarlet_z", activeScarlet.getZ());
_world.getParameters().set("scarlet_h", activeScarlet.getHeading()); _world.setParameter("scarlet_h", activeScarlet.getHeading());
final int scarlet_a; final int scarlet_a;
if (activeScarlet.getHeading() < 32768) if (activeScarlet.getHeading() < 32768)
{ {
@@ -1186,7 +1186,7 @@ public class FinalEmperialTomb extends AbstractInstance implements IXmlReader
{ {
scarlet_a = Math.abs(540 - (int) (activeScarlet.getHeading() / 182.044444444)); scarlet_a = Math.abs(540 - (int) (activeScarlet.getHeading() / 182.044444444));
} }
_world.getParameters().set("scarlet_a", scarlet_a); _world.setParameter("scarlet_a", scarlet_a);
broadCastPacket(_world, new SpecialCamera(activeScarlet, 250, scarlet_a, 12, 0, 1000, 0, 0, 1, 0, 0)); broadCastPacket(_world, new SpecialCamera(activeScarlet, 250, scarlet_a, 12, 0, 1000, 0, 0, 1, 0, 0));
broadCastPacket(_world, new SpecialCamera(activeScarlet, 250, scarlet_a, 12, 0, 10000, 0, 0, 1, 0, 0)); broadCastPacket(_world, new SpecialCamera(activeScarlet, 250, scarlet_a, 12, 0, 10000, 0, 0, 1, 0, 0));
ThreadPool.schedule(new IntroTask(_world, 28), 500); ThreadPool.schedule(new IntroTask(_world, 28), 500);

View File

@@ -137,7 +137,7 @@ public class SSQDisciplesNecropolisPast extends AbstractInstance
{ {
anakimGroup.add(addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId())); anakimGroup.add(addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId()));
} }
world.getParameters().set("anakimGroup", anakimGroup); world.setParameter("anakimGroup", anakimGroup);
} }
private synchronized void checkDoors(Npc npc, InstanceWorld world) private synchronized void checkDoors(Npc npc, InstanceWorld world)

View File

@@ -43,17 +43,17 @@ public class ResidenceOfKingIgnis extends AbstractInstance
private static final int FREYA = 29109; private static final int FREYA = 29109;
private static final int IGNIS = 29105; private static final int IGNIS = 29105;
// Skills // Skills
private static SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1); private static final SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1);
private static SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); private static final SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2);
private static SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); private static final SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3);
private static SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); private static final SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4);
private static SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); private static final SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5);
private static SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); private static final SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6);
private static SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); private static final SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7);
private static SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); private static final SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8);
private static SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); private static final SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9);
private static SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10); private static final SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10);
private static SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect private static final SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect
// Misc // Misc
private static final int TEMPLATE_ID = 195; private static final int TEMPLATE_ID = 195;
private static final Map<PlayerInstance, Integer> _playerFireRage = new ConcurrentHashMap<>(); private static final Map<PlayerInstance, Integer> _playerFireRage = new ConcurrentHashMap<>();

View File

@@ -18,9 +18,7 @@ package instances.ResidenceOfKingPetram;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.Skill;
@@ -28,7 +26,7 @@ import org.l2jmobius.gameserver.model.skills.Skill;
import instances.AbstractInstance; import instances.AbstractInstance;
/** /**
* @author RobikBobik * @author RobikBobik, Mobius
* @NOTE: Retail like working * @NOTE: Retail like working
* @TODO: Rewrite code to modern style. * @TODO: Rewrite code to modern style.
* @TODO: Petram Skills and minion skills * @TODO: Petram Skills and minion skills
@@ -41,17 +39,11 @@ public class ResidenceOfKingPetram extends AbstractInstance
private static final int PETRAM_PIECE = 29116; private static final int PETRAM_PIECE = 29116;
private static final int PETRAM_FRAGMENT = 29117; private static final int PETRAM_FRAGMENT = 29117;
// Skills // Skills
private static SkillHolder EARTh_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. private static final SkillHolder EARTH_ENERGY = new SkillHolder(50066, 1); // When spawn Minion.
private static SkillHolder EARTh_FURY = new SkillHolder(50059, 1); // When change invul state. private static final SkillHolder EARTH_FURY = new SkillHolder(50059, 1); // When change invul state.
private static SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID. private static final SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID.
// Misc // Misc
private static final int TEMPLATE_ID = 198; private static final int TEMPLATE_ID = 198;
private RaidBossInstance _petram = null;
private MonsterInstance _minion_1 = null;
private MonsterInstance _minion_2 = null;
private MonsterInstance _minion_3 = null;
private MonsterInstance _minion_4 = null;
private boolean _spawned_minions;
public ResidenceOfKingPetram() public ResidenceOfKingPetram()
{ {
@@ -70,54 +62,63 @@ public class ResidenceOfKingPetram extends AbstractInstance
case "ENTER": case "ENTER":
{ {
enterInstance(player, npc, TEMPLATE_ID); enterInstance(player, npc, TEMPLATE_ID);
if (player.getInstanceWorld() != null)
{
_petram = (RaidBossInstance) player.getInstanceWorld().getNpc(PETRAM);
}
break; break;
} }
case "SPAWN_MINION": case "SPAWN_MINION":
{ {
_petram.useMagic(EARTh_ENERGY.getSkill()); final Instance world = npc.getInstanceWorld();
if (world != null)
{
world.getNpc(PETRAM).doCast(EARTH_ENERGY.getSkill());
// Prevent to double or higher spawn when HP is between 68-70% + etc... // Prevent to double or higher spawn when HP is between 68-70% + etc...
if (!_spawned_minions) if (!world.getParameters().getBoolean("spawnedMinions", false))
{ {
_minion_1 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()); world.setParameter("minion1", addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()));
_minion_2 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()); world.setParameter("minion2", addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()));
_minion_3 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()); world.setParameter("minion3", addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()));
_minion_4 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()); world.setParameter("minion4", addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()));
_spawned_minions = true; world.getParameters().set("spawnedMinions", true);
} }
startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); startQuestTimer("SUPPORT_PETRAM", 3000, npc, null);
}
break; break;
} }
case "SUPPORT_PETRAM": case "SUPPORT_PETRAM":
{ {
_minion_1.setTarget(_petram); final Instance world = npc.getInstanceWorld();
_minion_1.useMagic(TEST.getSkill()); if (world != null)
_minion_2.setTarget(_petram); {
_minion_2.useMagic(TEST.getSkill()); world.getParameters().getObject("minion1", Npc.class).setTarget(world.getNpc(PETRAM));
_minion_3.setTarget(_petram); world.getParameters().getObject("minion1", Npc.class).doCast(TEST.getSkill());
_minion_3.useMagic(TEST.getSkill()); world.getParameters().getObject("minion2", Npc.class).setTarget(world.getNpc(PETRAM));
_minion_4.setTarget(_petram); world.getParameters().getObject("minion2", Npc.class).doCast(TEST.getSkill());
_minion_4.useMagic(TEST.getSkill()); world.getParameters().getObject("minion3", Npc.class).setTarget(world.getNpc(PETRAM));
world.getParameters().getObject("minion3", Npc.class).doCast(TEST.getSkill());
world.getParameters().getObject("minion4", Npc.class).setTarget(world.getNpc(PETRAM));
world.getParameters().getObject("minion4", Npc.class).doCast(TEST.getSkill());
startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100
}
break; break;
} }
case "INVUL_MODE": case "INVUL_MODE":
{ {
_petram.useMagic(EARTh_FURY.getSkill()); final Instance world = npc.getInstanceWorld();
if (_petram.isInvul()) if (world != null)
{ {
_petram.setInvul(false); final Npc petram = world.getNpc(PETRAM);
_petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); petram.doCast(EARTH_FURY.getSkill());
if (petram.isInvul())
{
petram.setInvul(false);
petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo...");
} }
else else
{ {
_petram.setInvul(true); petram.setInvul(true);
_petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!");
}
} }
break; break;
} }
@@ -156,19 +157,21 @@ public class ResidenceOfKingPetram extends AbstractInstance
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
if (npc.getId() == PETRAM)
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (world != null) if (world == null)
{
return null;
}
if (npc.getId() == PETRAM)
{ {
world.finishInstance(); world.finishInstance();
} }
} else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead()) && (world.getParameters().getObject("minion4", Npc.class).isDead()))
else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead()))
{ {
startQuestTimer("INVUL_MODE", 3000, _petram, null); startQuestTimer("INVUL_MODE", 3000, world.getNpc(PETRAM), null);
_spawned_minions = false; world.getParameters().set("spawnedMinions", false);
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, player, isSummon);
} }

View File

@@ -17,9 +17,7 @@
package instances.ResidenceOfKingProcella; package instances.ResidenceOfKingProcella;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.model.skills.SkillCaster; import org.l2jmobius.gameserver.model.skills.SkillCaster;
@@ -27,7 +25,7 @@ import org.l2jmobius.gameserver.model.skills.SkillCaster;
import instances.AbstractInstance; import instances.AbstractInstance;
/** /**
* @author RobikBobik * @author RobikBobik, Mobius
* @NOTE: Retail like working * @NOTE: Retail like working
* @TODO: Rewrite code to modern style. * @TODO: Rewrite code to modern style.
*/ */
@@ -46,12 +44,7 @@ public class ResidenceOfKingProcella extends AbstractInstance
private static final SkillHolder HURRICANE_BOLT_LV_1 = new SkillHolder(50043, 1); // When player in Radius + para private static final SkillHolder HURRICANE_BOLT_LV_1 = new SkillHolder(50043, 1); // When player in Radius + para
// Misc // Misc
private static final int TEMPLATE_ID = 197; private static final int TEMPLATE_ID = 197;
private static int STORM_MAX_COUNT = 16; // TODO: Max is limit ? private static final int STORM_MAX_COUNT = 16; // TODO: Max is limit ?
private int _procellaStormCount;
private RaidBossInstance _procella;
private MonsterInstance _minion1;
private MonsterInstance _minion2;
private MonsterInstance _minion3;
public ResidenceOfKingProcella() public ResidenceOfKingProcella()
{ {
@@ -69,46 +62,56 @@ public class ResidenceOfKingProcella extends AbstractInstance
case "ENTER": case "ENTER":
{ {
enterInstance(player, npc, TEMPLATE_ID); enterInstance(player, npc, TEMPLATE_ID);
_procella = (RaidBossInstance) addSpawn(PROCELLA, 212862, 179828, -15489, 49151, false, 0, true, player.getInstanceId()); final Instance world = player.getInstanceWorld();
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); if (world != null)
startQuestTimer("SPAWN_STORM", 5000, _procella, player); {
_procellaStormCount = 0; final Npc procella = addSpawn(PROCELLA, 212862, 179828, -15489, 49151, false, 0, true, player.getInstanceId());
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), procella, player);
startQuestTimer("SPAWN_STORM", 5000, procella, player);
world.setParameter("stormCount", 0);
}
break; break;
} }
case "SPAWN_MINION": case "SPAWN_MINION":
{ {
if (npc.getId() == PROCELLA) final Instance world = npc.getInstanceWorld();
if ((world != null) && (npc.getId() == PROCELLA))
{ {
_minion1 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId()); world.setParameter("minion1", addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId()));
_minion2 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, true, 0, true, npc.getInstanceId()); world.setParameter("minion2", addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, true, 0, true, npc.getInstanceId()));
_minion3 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_3, 212558, 179974, -15486, 12311, true, 0, true, npc.getInstanceId()); world.setParameter("minion3", addSpawn(PROCELLA_GUARDIAN_3, 212558, 179974, -15486, 12311, true, 0, true, npc.getInstanceId()));
startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null);
} }
break; break;
} }
case "SPAWN_STORM": case "SPAWN_STORM":
{ {
if (_procellaStormCount < STORM_MAX_COUNT) final Instance world = npc.getInstanceWorld();
if ((world != null) && (world.getParameters().getInt("stormCount", 0) < STORM_MAX_COUNT))
{ {
_procella.useMagic(HURRICANE_SUMMON.getSkill()); world.getNpc(PROCELLA).doCast(HURRICANE_SUMMON.getSkill());
final Npc procellaStorm = addSpawn(PROCELLA_STORM, _procella.getX() + getRandom(-500, 500), _procella.getY() + getRandom(-500, 500), _procella.getZ(), 31011, true, 0, true, npc.getInstanceId()); final Npc procellaStorm = addSpawn(PROCELLA_STORM, world.getNpc(PROCELLA).getX() + getRandom(-500, 500), world.getNpc(PROCELLA).getY() + getRandom(-500, 500), world.getNpc(PROCELLA).getZ(), 31011, true, 0, true, npc.getInstanceId());
procellaStorm.setRandomWalking(true); procellaStorm.setRandomWalking(true);
_procellaStormCount++; world.getParameters().increaseInt("stormCount", 1);
startQuestTimer("SPAWN_STORM", 60000, _procella, null); startQuestTimer("SPAWN_STORM", 60000, world.getNpc(PROCELLA), null);
startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking
} }
break; break;
} }
case "HIDE_PROCELLA": case "HIDE_PROCELLA":
{ {
if (_procella.isInvisible()) final Instance world = npc.getInstanceWorld();
if (world != null)
{ {
_procella.setInvisible(false); if (world.getNpc(PROCELLA).isInvisible())
{
world.getNpc(PROCELLA).setInvisible(false);
} }
else else
{ {
_procella.setInvisible(true); world.getNpc(PROCELLA).setInvisible(true);
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), world.getNpc(PROCELLA), player);
}
} }
break; break;
} }
@@ -150,22 +153,25 @@ public class ResidenceOfKingProcella extends AbstractInstance
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
if (npc.getId() == PROCELLA)
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (world != null) if (world == null)
{
return null;
}
if (npc.getId() == PROCELLA)
{ {
cancelQuestTimer("SPAWN_MINION", npc, player); cancelQuestTimer("SPAWN_MINION", npc, player);
cancelQuestTimer("SPAWN_STORM", npc, player); cancelQuestTimer("SPAWN_STORM", npc, player);
cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player);
world.finishInstance(); world.finishInstance();
} }
} else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead()))
else if ((_minion1.isDead()) && (_minion2.isDead()) && (_minion3.isDead()))
{ {
startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null);
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, player, isSummon);
} }

View File

@@ -41,12 +41,12 @@ public class ResidenceOfQueenNebula extends AbstractInstance
private static final int WATER_SLIME = 29111; private static final int WATER_SLIME = 29111;
// Skills // Skills
private static final int AQUA_RAGE = 50036; private static final int AQUA_RAGE = 50036;
private static SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); private static final SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1);
private static SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); private static final SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2);
private static SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); private static final SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3);
private static SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); private static final SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4);
private static SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); private static final SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5);
private static SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); private static final SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1);
// Misc // Misc
private static final int TEMPLATE_ID = 196; private static final int TEMPLATE_ID = 196;

View File

@@ -47,10 +47,10 @@ public class SevenSignsRBs extends AbstractInstance
private static final int ANAKIM_TEMPLATE_ID = 200; private static final int ANAKIM_TEMPLATE_ID = 200;
private static final int LILITH_TEMPLATE_ID = 199; private static final int LILITH_TEMPLATE_ID = 199;
private static int MAX_PLAYERS_IN_ZONE = 300; private static final int MAX_PLAYERS_IN_ZONE = 300;
private static final NoRestartZone _anakim_zone = ZoneManager.getInstance().getZoneById(70052, NoRestartZone.class); private static final NoRestartZone ANAKIM_ZONE = ZoneManager.getInstance().getZoneById(70052, NoRestartZone.class);
private static final NoRestartZone _lilith_zone = ZoneManager.getInstance().getZoneById(70053, NoRestartZone.class); private static final NoRestartZone LILITH_ZONE = ZoneManager.getInstance().getZoneById(70053, NoRestartZone.class);
// TELEPORTS // TELEPORTS
private static final Location[] TELEPORT_TO_DARK_ELVEN = private static final Location[] TELEPORT_TO_DARK_ELVEN =
@@ -89,7 +89,7 @@ public class SevenSignsRBs extends AbstractInstance
final boolean isInCC = party.isInCommandChannel(); final boolean isInCC = party.isInCommandChannel();
final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers();
if (members.size() > (MAX_PLAYERS_IN_ZONE - _anakim_zone.getPlayersInside().size())) if (members.size() > (MAX_PLAYERS_IN_ZONE - ANAKIM_ZONE.getPlayersInside().size()))
{ {
player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now."); player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now.");
} }
@@ -128,7 +128,7 @@ public class SevenSignsRBs extends AbstractInstance
final boolean isInCC = party.isInCommandChannel(); final boolean isInCC = party.isInCommandChannel();
final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers();
if (members.size() > (MAX_PLAYERS_IN_ZONE - _lilith_zone.getPlayersInside().size())) if (members.size() > (MAX_PLAYERS_IN_ZONE - LILITH_ZONE.getPlayersInside().size()))
{ {
player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now."); player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now.");
} }
@@ -161,7 +161,7 @@ public class SevenSignsRBs extends AbstractInstance
} }
case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM": case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM":
{ {
for (Creature charInside : _anakim_zone.getCharactersInside()) for (Creature charInside : ANAKIM_ZONE.getCharactersInside())
{ {
if ((charInside != null) && charInside.isPlayer()) if ((charInside != null) && charInside.isPlayer())
{ {
@@ -172,7 +172,7 @@ public class SevenSignsRBs extends AbstractInstance
} }
case "REMOVE_PLAYERS_FROM_ZONE_LILITH": case "REMOVE_PLAYERS_FROM_ZONE_LILITH":
{ {
for (Creature charInside : _lilith_zone.getCharactersInside()) for (Creature charInside : LILITH_ZONE.getCharactersInside())
{ {
if ((charInside != null) && charInside.isPlayer()) if ((charInside != null) && charInside.isPlayer())
{ {

View File

@@ -43,17 +43,17 @@ public class ResidenceOfKingIgnis extends AbstractInstance
private static final int FREYA = 29109; private static final int FREYA = 29109;
private static final int IGNIS = 29105; private static final int IGNIS = 29105;
// Skills // Skills
private static SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1); private static final SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1);
private static SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); private static final SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2);
private static SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); private static final SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3);
private static SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); private static final SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4);
private static SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); private static final SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5);
private static SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); private static final SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6);
private static SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); private static final SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7);
private static SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); private static final SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8);
private static SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); private static final SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9);
private static SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10); private static final SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10);
private static SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect private static final SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect
// Misc // Misc
private static final int TEMPLATE_ID = 195; private static final int TEMPLATE_ID = 195;
private static final Map<PlayerInstance, Integer> _playerFireRage = new ConcurrentHashMap<>(); private static final Map<PlayerInstance, Integer> _playerFireRage = new ConcurrentHashMap<>();

View File

@@ -18,9 +18,7 @@ package instances.ResidenceOfKingPetram;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.Skill;
@@ -28,7 +26,7 @@ import org.l2jmobius.gameserver.model.skills.Skill;
import instances.AbstractInstance; import instances.AbstractInstance;
/** /**
* @author RobikBobik * @author RobikBobik, Mobius
* @NOTE: Retail like working * @NOTE: Retail like working
* @TODO: Rewrite code to modern style. * @TODO: Rewrite code to modern style.
* @TODO: Petram Skills and minion skills * @TODO: Petram Skills and minion skills
@@ -41,17 +39,11 @@ public class ResidenceOfKingPetram extends AbstractInstance
private static final int PETRAM_PIECE = 29116; private static final int PETRAM_PIECE = 29116;
private static final int PETRAM_FRAGMENT = 29117; private static final int PETRAM_FRAGMENT = 29117;
// Skills // Skills
private static SkillHolder EARTh_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. private static final SkillHolder EARTH_ENERGY = new SkillHolder(50066, 1); // When spawn Minion.
private static SkillHolder EARTh_FURY = new SkillHolder(50059, 1); // When change invul state. private static final SkillHolder EARTH_FURY = new SkillHolder(50059, 1); // When change invul state.
private static SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID. private static final SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID.
// Misc // Misc
private static final int TEMPLATE_ID = 198; private static final int TEMPLATE_ID = 198;
private RaidBossInstance _petram = null;
private MonsterInstance _minion_1 = null;
private MonsterInstance _minion_2 = null;
private MonsterInstance _minion_3 = null;
private MonsterInstance _minion_4 = null;
private boolean _spawned_minions;
public ResidenceOfKingPetram() public ResidenceOfKingPetram()
{ {
@@ -70,54 +62,63 @@ public class ResidenceOfKingPetram extends AbstractInstance
case "ENTER": case "ENTER":
{ {
enterInstance(player, npc, TEMPLATE_ID); enterInstance(player, npc, TEMPLATE_ID);
if (player.getInstanceWorld() != null)
{
_petram = (RaidBossInstance) player.getInstanceWorld().getNpc(PETRAM);
}
break; break;
} }
case "SPAWN_MINION": case "SPAWN_MINION":
{ {
_petram.useMagic(EARTh_ENERGY.getSkill()); final Instance world = npc.getInstanceWorld();
if (world != null)
{
world.getNpc(PETRAM).doCast(EARTH_ENERGY.getSkill());
// Prevent to double or higher spawn when HP is between 68-70% + etc... // Prevent to double or higher spawn when HP is between 68-70% + etc...
if (!_spawned_minions) if (!world.getParameters().getBoolean("spawnedMinions", false))
{ {
_minion_1 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()); world.setParameter("minion1", addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()));
_minion_2 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()); world.setParameter("minion2", addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()));
_minion_3 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()); world.setParameter("minion3", addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()));
_minion_4 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()); world.setParameter("minion4", addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()));
_spawned_minions = true; world.getParameters().set("spawnedMinions", true);
} }
startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); startQuestTimer("SUPPORT_PETRAM", 3000, npc, null);
}
break; break;
} }
case "SUPPORT_PETRAM": case "SUPPORT_PETRAM":
{ {
_minion_1.setTarget(_petram); final Instance world = npc.getInstanceWorld();
_minion_1.useMagic(TEST.getSkill()); if (world != null)
_minion_2.setTarget(_petram); {
_minion_2.useMagic(TEST.getSkill()); world.getParameters().getObject("minion1", Npc.class).setTarget(world.getNpc(PETRAM));
_minion_3.setTarget(_petram); world.getParameters().getObject("minion1", Npc.class).doCast(TEST.getSkill());
_minion_3.useMagic(TEST.getSkill()); world.getParameters().getObject("minion2", Npc.class).setTarget(world.getNpc(PETRAM));
_minion_4.setTarget(_petram); world.getParameters().getObject("minion2", Npc.class).doCast(TEST.getSkill());
_minion_4.useMagic(TEST.getSkill()); world.getParameters().getObject("minion3", Npc.class).setTarget(world.getNpc(PETRAM));
world.getParameters().getObject("minion3", Npc.class).doCast(TEST.getSkill());
world.getParameters().getObject("minion4", Npc.class).setTarget(world.getNpc(PETRAM));
world.getParameters().getObject("minion4", Npc.class).doCast(TEST.getSkill());
startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100
}
break; break;
} }
case "INVUL_MODE": case "INVUL_MODE":
{ {
_petram.useMagic(EARTh_FURY.getSkill()); final Instance world = npc.getInstanceWorld();
if (_petram.isInvul()) if (world != null)
{ {
_petram.setInvul(false); final Npc petram = world.getNpc(PETRAM);
_petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); petram.doCast(EARTH_FURY.getSkill());
if (petram.isInvul())
{
petram.setInvul(false);
petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo...");
} }
else else
{ {
_petram.setInvul(true); petram.setInvul(true);
_petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!");
}
} }
break; break;
} }
@@ -156,19 +157,21 @@ public class ResidenceOfKingPetram extends AbstractInstance
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
if (npc.getId() == PETRAM)
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (world != null) if (world == null)
{
return null;
}
if (npc.getId() == PETRAM)
{ {
world.finishInstance(); world.finishInstance();
} }
} else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead()) && (world.getParameters().getObject("minion4", Npc.class).isDead()))
else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead()))
{ {
startQuestTimer("INVUL_MODE", 3000, _petram, null); startQuestTimer("INVUL_MODE", 3000, world.getNpc(PETRAM), null);
_spawned_minions = false; world.getParameters().set("spawnedMinions", false);
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, player, isSummon);
} }

View File

@@ -17,9 +17,7 @@
package instances.ResidenceOfKingProcella; package instances.ResidenceOfKingProcella;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.model.skills.SkillCaster; import org.l2jmobius.gameserver.model.skills.SkillCaster;
@@ -27,7 +25,7 @@ import org.l2jmobius.gameserver.model.skills.SkillCaster;
import instances.AbstractInstance; import instances.AbstractInstance;
/** /**
* @author RobikBobik * @author RobikBobik, Mobius
* @NOTE: Retail like working * @NOTE: Retail like working
* @TODO: Rewrite code to modern style. * @TODO: Rewrite code to modern style.
*/ */
@@ -46,12 +44,7 @@ public class ResidenceOfKingProcella extends AbstractInstance
private static final SkillHolder HURRICANE_BOLT_LV_1 = new SkillHolder(50043, 1); // When player in Radius + para private static final SkillHolder HURRICANE_BOLT_LV_1 = new SkillHolder(50043, 1); // When player in Radius + para
// Misc // Misc
private static final int TEMPLATE_ID = 197; private static final int TEMPLATE_ID = 197;
private static int STORM_MAX_COUNT = 16; // TODO: Max is limit ? private static final int STORM_MAX_COUNT = 16; // TODO: Max is limit ?
private int _procellaStormCount;
private RaidBossInstance _procella;
private MonsterInstance _minion1;
private MonsterInstance _minion2;
private MonsterInstance _minion3;
public ResidenceOfKingProcella() public ResidenceOfKingProcella()
{ {
@@ -69,46 +62,56 @@ public class ResidenceOfKingProcella extends AbstractInstance
case "ENTER": case "ENTER":
{ {
enterInstance(player, npc, TEMPLATE_ID); enterInstance(player, npc, TEMPLATE_ID);
_procella = (RaidBossInstance) addSpawn(PROCELLA, 212862, 179828, -15489, 49151, false, 0, true, player.getInstanceId()); final Instance world = player.getInstanceWorld();
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); if (world != null)
startQuestTimer("SPAWN_STORM", 5000, _procella, player); {
_procellaStormCount = 0; final Npc procella = addSpawn(PROCELLA, 212862, 179828, -15489, 49151, false, 0, true, player.getInstanceId());
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), procella, player);
startQuestTimer("SPAWN_STORM", 5000, procella, player);
world.setParameter("stormCount", 0);
}
break; break;
} }
case "SPAWN_MINION": case "SPAWN_MINION":
{ {
if (npc.getId() == PROCELLA) final Instance world = npc.getInstanceWorld();
if ((world != null) && (npc.getId() == PROCELLA))
{ {
_minion1 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId()); world.setParameter("minion1", addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId()));
_minion2 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, true, 0, true, npc.getInstanceId()); world.setParameter("minion2", addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, true, 0, true, npc.getInstanceId()));
_minion3 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_3, 212558, 179974, -15486, 12311, true, 0, true, npc.getInstanceId()); world.setParameter("minion3", addSpawn(PROCELLA_GUARDIAN_3, 212558, 179974, -15486, 12311, true, 0, true, npc.getInstanceId()));
startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null);
} }
break; break;
} }
case "SPAWN_STORM": case "SPAWN_STORM":
{ {
if (_procellaStormCount < STORM_MAX_COUNT) final Instance world = npc.getInstanceWorld();
if ((world != null) && (world.getParameters().getInt("stormCount", 0) < STORM_MAX_COUNT))
{ {
_procella.useMagic(HURRICANE_SUMMON.getSkill()); world.getNpc(PROCELLA).doCast(HURRICANE_SUMMON.getSkill());
final Npc procellaStorm = addSpawn(PROCELLA_STORM, _procella.getX() + getRandom(-500, 500), _procella.getY() + getRandom(-500, 500), _procella.getZ(), 31011, true, 0, true, npc.getInstanceId()); final Npc procellaStorm = addSpawn(PROCELLA_STORM, world.getNpc(PROCELLA).getX() + getRandom(-500, 500), world.getNpc(PROCELLA).getY() + getRandom(-500, 500), world.getNpc(PROCELLA).getZ(), 31011, true, 0, true, npc.getInstanceId());
procellaStorm.setRandomWalking(true); procellaStorm.setRandomWalking(true);
_procellaStormCount++; world.getParameters().increaseInt("stormCount", 1);
startQuestTimer("SPAWN_STORM", 60000, _procella, null); startQuestTimer("SPAWN_STORM", 60000, world.getNpc(PROCELLA), null);
startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking
} }
break; break;
} }
case "HIDE_PROCELLA": case "HIDE_PROCELLA":
{ {
if (_procella.isInvisible()) final Instance world = npc.getInstanceWorld();
if (world != null)
{ {
_procella.setInvisible(false); if (world.getNpc(PROCELLA).isInvisible())
{
world.getNpc(PROCELLA).setInvisible(false);
} }
else else
{ {
_procella.setInvisible(true); world.getNpc(PROCELLA).setInvisible(true);
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), world.getNpc(PROCELLA), player);
}
} }
break; break;
} }
@@ -150,22 +153,25 @@ public class ResidenceOfKingProcella extends AbstractInstance
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
if (npc.getId() == PROCELLA)
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (world != null) if (world == null)
{
return null;
}
if (npc.getId() == PROCELLA)
{ {
cancelQuestTimer("SPAWN_MINION", npc, player); cancelQuestTimer("SPAWN_MINION", npc, player);
cancelQuestTimer("SPAWN_STORM", npc, player); cancelQuestTimer("SPAWN_STORM", npc, player);
cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player);
world.finishInstance(); world.finishInstance();
} }
} else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead()))
else if ((_minion1.isDead()) && (_minion2.isDead()) && (_minion3.isDead()))
{ {
startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null);
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, player, isSummon);
} }

View File

@@ -41,12 +41,12 @@ public class ResidenceOfQueenNebula extends AbstractInstance
private static final int WATER_SLIME = 29111; private static final int WATER_SLIME = 29111;
// Skills // Skills
private static final int AQUA_RAGE = 50036; private static final int AQUA_RAGE = 50036;
private static SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); private static final SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1);
private static SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); private static final SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2);
private static SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); private static final SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3);
private static SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); private static final SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4);
private static SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); private static final SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5);
private static SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); private static final SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1);
// Misc // Misc
private static final int TEMPLATE_ID = 196; private static final int TEMPLATE_ID = 196;

View File

@@ -47,10 +47,10 @@ public class SevenSignsRBs extends AbstractInstance
private static final int ANAKIM_TEMPLATE_ID = 200; private static final int ANAKIM_TEMPLATE_ID = 200;
private static final int LILITH_TEMPLATE_ID = 199; private static final int LILITH_TEMPLATE_ID = 199;
private static int MAX_PLAYERS_IN_ZONE = 300; private static final int MAX_PLAYERS_IN_ZONE = 300;
private static final NoRestartZone _anakim_zone = ZoneManager.getInstance().getZoneById(70052, NoRestartZone.class); private static final NoRestartZone ANAKIM_ZONE = ZoneManager.getInstance().getZoneById(70052, NoRestartZone.class);
private static final NoRestartZone _lilith_zone = ZoneManager.getInstance().getZoneById(70053, NoRestartZone.class); private static final NoRestartZone LILITH_ZONE = ZoneManager.getInstance().getZoneById(70053, NoRestartZone.class);
// TELEPORTS // TELEPORTS
private static final Location[] TELEPORT_TO_DARK_ELVEN = private static final Location[] TELEPORT_TO_DARK_ELVEN =
@@ -89,7 +89,7 @@ public class SevenSignsRBs extends AbstractInstance
final boolean isInCC = party.isInCommandChannel(); final boolean isInCC = party.isInCommandChannel();
final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers();
if (members.size() > (MAX_PLAYERS_IN_ZONE - _anakim_zone.getPlayersInside().size())) if (members.size() > (MAX_PLAYERS_IN_ZONE - ANAKIM_ZONE.getPlayersInside().size()))
{ {
player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now."); player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now.");
} }
@@ -128,7 +128,7 @@ public class SevenSignsRBs extends AbstractInstance
final boolean isInCC = party.isInCommandChannel(); final boolean isInCC = party.isInCommandChannel();
final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers();
if (members.size() > (MAX_PLAYERS_IN_ZONE - _lilith_zone.getPlayersInside().size())) if (members.size() > (MAX_PLAYERS_IN_ZONE - LILITH_ZONE.getPlayersInside().size()))
{ {
player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now."); player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now.");
} }
@@ -161,7 +161,7 @@ public class SevenSignsRBs extends AbstractInstance
} }
case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM": case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM":
{ {
for (Creature charInside : _anakim_zone.getCharactersInside()) for (Creature charInside : ANAKIM_ZONE.getCharactersInside())
{ {
if ((charInside != null) && charInside.isPlayer()) if ((charInside != null) && charInside.isPlayer())
{ {
@@ -172,7 +172,7 @@ public class SevenSignsRBs extends AbstractInstance
} }
case "REMOVE_PLAYERS_FROM_ZONE_LILITH": case "REMOVE_PLAYERS_FROM_ZONE_LILITH":
{ {
for (Creature charInside : _lilith_zone.getCharactersInside()) for (Creature charInside : LILITH_ZONE.getCharactersInside())
{ {
if ((charInside != null) && charInside.isPlayer()) if ((charInside != null) && charInside.isPlayer())
{ {

View File

@@ -18,7 +18,6 @@ package instances.GolbergRoom;
import org.l2jmobius.gameserver.model.Party; import org.l2jmobius.gameserver.model.Party;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
@@ -26,7 +25,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
import instances.AbstractInstance; import instances.AbstractInstance;
/** /**
* @author RobikBobik * @author RobikBobik, Mobius
* @NOTE: Party instance retail like work. * @NOTE: Party instance retail like work.
* @TODO: Find what all drops from GOLBERG_TREASURE_CHEST * @TODO: Find what all drops from GOLBERG_TREASURE_CHEST
* @TODO: Golberg skills * @TODO: Golberg skills
@@ -42,9 +41,6 @@ public class GolbergRoom extends AbstractInstance
// Misc // Misc
private static final int TEMPLATE_ID = 207; private static final int TEMPLATE_ID = 207;
private MonsterInstance _golberg;
private int _treasureCounter;
public GolbergRoom() public GolbergRoom()
{ {
super(TEMPLATE_ID); super(TEMPLATE_ID);
@@ -82,8 +78,7 @@ public class GolbergRoom extends AbstractInstance
} }
member.teleToLocation(player, 10, world); member.teleToLocation(player, 10, world);
} }
_golberg = (MonsterInstance) player.getInstanceWorld().getNpc(18359); startQuestTimer("GOLBERG_MOVE", 5000, world.getNpc(GOLBERG), player);
startQuestTimer("GOLBERG_MOVE", 5000, _golberg, player);
} }
break; break;
} }
@@ -93,7 +88,7 @@ public class GolbergRoom extends AbstractInstance
if (world != null) if (world != null)
{ {
player.sendPacket(new ExShowScreenMessage("Rats have become kings while I've been dormant.", 5000)); player.sendPacket(new ExShowScreenMessage("Rats have become kings while I've been dormant.", 5000));
startQuestTimer("NEXT_TEXT", 7000, _golberg, player); startQuestTimer("NEXT_TEXT", 7000, world.getNpc(GOLBERG), player);
} }
npc.moveToLocation(11711, -86508, -10928, 0); npc.moveToLocation(11711, -86508, -10928, 0);
break; break;
@@ -104,7 +99,7 @@ public class GolbergRoom extends AbstractInstance
if (world != null) if (world != null)
{ {
player.sendPacket(new ExShowScreenMessage("Zaken or whatever is going wild all over the southern sea.", 5000)); player.sendPacket(new ExShowScreenMessage("Zaken or whatever is going wild all over the southern sea.", 5000));
startQuestTimer("NEXT_TEXT_2", 7000, _golberg, player); startQuestTimer("NEXT_TEXT_2", 7000, world.getNpc(GOLBERG), player);
} }
break; break;
} }
@@ -119,13 +114,19 @@ public class GolbergRoom extends AbstractInstance
} }
case "SPAWN_TRESURE": case "SPAWN_TRESURE":
{ {
final Instance world = player.getInstanceWorld();
if (world == null)
{
return null;
}
if (player.isGM()) if (player.isGM())
{ {
if (_treasureCounter <= 27) if (world.getParameters().getInt("treasureCounter", 0) <= 27)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
} }
else if (player.getParty() != null) else if (player.getParty() != null)
@@ -134,81 +135,81 @@ public class GolbergRoom extends AbstractInstance
{ {
case 2: case 2:
{ {
if (_treasureCounter <= 1) if (world.getParameters().getInt("treasureCounter", 0) <= 1)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
break; break;
} }
case 3: case 3:
{ {
if (_treasureCounter <= 2) if (world.getParameters().getInt("treasureCounter", 0) <= 2)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
break; break;
} }
case 4: case 4:
{ {
if (_treasureCounter <= 4) if (world.getParameters().getInt("treasureCounter", 0) <= 4)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
break; break;
} }
case 5: case 5:
{ {
if (_treasureCounter <= 7) if (world.getParameters().getInt("treasureCounter", 0) <= 7)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
break; break;
} }
case 6: case 6:
{ {
if (_treasureCounter <= 10) if (world.getParameters().getInt("treasureCounter", 0) <= 10)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
break; break;
} }
case 7: case 7:
{ {
if (_treasureCounter <= 13) if (world.getParameters().getInt("treasureCounter", 0) <= 13)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
break; break;
} }
case 8: case 8:
{ {
if (_treasureCounter <= 16) if (world.getParameters().getInt("treasureCounter", 0) <= 16)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
break; break;
} }
case 9: case 9:
{ {
if (_treasureCounter <= 27) if (world.getParameters().getInt("treasureCounter", 0) <= 27)
{ {
addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId()); addSpawn(GOLBERG_TREASURE_CHEST, 11708 + getRandom(-1000, 1000), -86505 + getRandom(-1000, 1000), -10928, 0, true, -1, true, player.getInstanceId());
startQuestTimer("SPAWN_TRESURE", 1000, npc, player); startQuestTimer("SPAWN_TRESURE", 1000, npc, player);
_treasureCounter++; world.getParameters().increaseInt("treasureCounter", 1);
} }
break; break;
} }

View File

@@ -43,17 +43,17 @@ public class ResidenceOfKingIgnis extends AbstractInstance
private static final int FREYA = 29109; private static final int FREYA = 29109;
private static final int IGNIS = 29105; private static final int IGNIS = 29105;
// Skills // Skills
private static SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1); private static final SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1);
private static SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); private static final SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2);
private static SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); private static final SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3);
private static SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); private static final SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4);
private static SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); private static final SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5);
private static SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); private static final SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6);
private static SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); private static final SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7);
private static SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); private static final SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8);
private static SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); private static final SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9);
private static SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10); private static final SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10);
private static SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect private static final SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect
// Misc // Misc
private static final int TEMPLATE_ID = 195; private static final int TEMPLATE_ID = 195;
private static final Map<PlayerInstance, Integer> _playerFireRage = new ConcurrentHashMap<>(); private static final Map<PlayerInstance, Integer> _playerFireRage = new ConcurrentHashMap<>();

View File

@@ -18,9 +18,7 @@ package instances.ResidenceOfKingPetram;
import org.l2jmobius.gameserver.enums.ChatType; import org.l2jmobius.gameserver.enums.ChatType;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.model.skills.Skill; import org.l2jmobius.gameserver.model.skills.Skill;
@@ -28,7 +26,7 @@ import org.l2jmobius.gameserver.model.skills.Skill;
import instances.AbstractInstance; import instances.AbstractInstance;
/** /**
* @author RobikBobik * @author RobikBobik, Mobius
* @NOTE: Retail like working * @NOTE: Retail like working
* @TODO: Rewrite code to modern style. * @TODO: Rewrite code to modern style.
* @TODO: Petram Skills and minion skills * @TODO: Petram Skills and minion skills
@@ -41,17 +39,11 @@ public class ResidenceOfKingPetram extends AbstractInstance
private static final int PETRAM_PIECE = 29116; private static final int PETRAM_PIECE = 29116;
private static final int PETRAM_FRAGMENT = 29117; private static final int PETRAM_FRAGMENT = 29117;
// Skills // Skills
private static SkillHolder EARTh_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. private static final SkillHolder EARTH_ENERGY = new SkillHolder(50066, 1); // When spawn Minion.
private static SkillHolder EARTh_FURY = new SkillHolder(50059, 1); // When change invul state. private static final SkillHolder EARTH_FURY = new SkillHolder(50059, 1); // When change invul state.
private static SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID. private static final SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID.
// Misc // Misc
private static final int TEMPLATE_ID = 198; private static final int TEMPLATE_ID = 198;
private RaidBossInstance _petram = null;
private MonsterInstance _minion_1 = null;
private MonsterInstance _minion_2 = null;
private MonsterInstance _minion_3 = null;
private MonsterInstance _minion_4 = null;
private boolean _spawned_minions;
public ResidenceOfKingPetram() public ResidenceOfKingPetram()
{ {
@@ -70,54 +62,63 @@ public class ResidenceOfKingPetram extends AbstractInstance
case "ENTER": case "ENTER":
{ {
enterInstance(player, npc, TEMPLATE_ID); enterInstance(player, npc, TEMPLATE_ID);
if (player.getInstanceWorld() != null)
{
_petram = (RaidBossInstance) player.getInstanceWorld().getNpc(PETRAM);
}
break; break;
} }
case "SPAWN_MINION": case "SPAWN_MINION":
{ {
_petram.useMagic(EARTh_ENERGY.getSkill()); final Instance world = npc.getInstanceWorld();
if (world != null)
{
world.getNpc(PETRAM).doCast(EARTH_ENERGY.getSkill());
// Prevent to double or higher spawn when HP is between 68-70% + etc... // Prevent to double or higher spawn when HP is between 68-70% + etc...
if (!_spawned_minions) if (!world.getParameters().getBoolean("spawnedMinions", false))
{ {
_minion_1 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()); world.setParameter("minion1", addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()));
_minion_2 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()); world.setParameter("minion2", addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()));
_minion_3 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()); world.setParameter("minion3", addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()));
_minion_4 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()); world.setParameter("minion4", addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()));
_spawned_minions = true; world.setParameter("spawnedMinions", true);
} }
startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); startQuestTimer("SUPPORT_PETRAM", 3000, npc, null);
}
break; break;
} }
case "SUPPORT_PETRAM": case "SUPPORT_PETRAM":
{ {
_minion_1.setTarget(_petram); final Instance world = npc.getInstanceWorld();
_minion_1.useMagic(TEST.getSkill()); if (world != null)
_minion_2.setTarget(_petram); {
_minion_2.useMagic(TEST.getSkill()); world.getParameters().getObject("minion1", Npc.class).setTarget(world.getNpc(PETRAM));
_minion_3.setTarget(_petram); world.getParameters().getObject("minion1", Npc.class).doCast(TEST.getSkill());
_minion_3.useMagic(TEST.getSkill()); world.getParameters().getObject("minion2", Npc.class).setTarget(world.getNpc(PETRAM));
_minion_4.setTarget(_petram); world.getParameters().getObject("minion2", Npc.class).doCast(TEST.getSkill());
_minion_4.useMagic(TEST.getSkill()); world.getParameters().getObject("minion3", Npc.class).setTarget(world.getNpc(PETRAM));
world.getParameters().getObject("minion3", Npc.class).doCast(TEST.getSkill());
world.getParameters().getObject("minion4", Npc.class).setTarget(world.getNpc(PETRAM));
world.getParameters().getObject("minion4", Npc.class).doCast(TEST.getSkill());
startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100
}
break; break;
} }
case "INVUL_MODE": case "INVUL_MODE":
{ {
_petram.useMagic(EARTh_FURY.getSkill()); final Instance world = npc.getInstanceWorld();
if (_petram.isInvul()) if (world != null)
{ {
_petram.setInvul(false); final Npc petram = world.getNpc(PETRAM);
_petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); petram.doCast(EARTH_FURY.getSkill());
if (petram.isInvul())
{
petram.setInvul(false);
petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo...");
} }
else else
{ {
_petram.setInvul(true); petram.setInvul(true);
_petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!");
}
} }
break; break;
} }
@@ -156,19 +157,21 @@ public class ResidenceOfKingPetram extends AbstractInstance
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
if (npc.getId() == PETRAM)
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (world != null) if (world == null)
{
return null;
}
if (npc.getId() == PETRAM)
{ {
world.finishInstance(); world.finishInstance();
} }
} else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead()) && (world.getParameters().getObject("minion4", Npc.class).isDead()))
else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead()))
{ {
startQuestTimer("INVUL_MODE", 3000, _petram, null); startQuestTimer("INVUL_MODE", 3000, world.getNpc(PETRAM), null);
_spawned_minions = false; world.setParameter("spawnedMinions", false);
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, player, isSummon);
} }

View File

@@ -17,9 +17,7 @@
package instances.ResidenceOfKingProcella; package instances.ResidenceOfKingProcella;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance;
import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.holders.SkillHolder;
import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.instancezone.Instance;
import org.l2jmobius.gameserver.model.skills.SkillCaster; import org.l2jmobius.gameserver.model.skills.SkillCaster;
@@ -27,7 +25,7 @@ import org.l2jmobius.gameserver.model.skills.SkillCaster;
import instances.AbstractInstance; import instances.AbstractInstance;
/** /**
* @author RobikBobik * @author RobikBobik, Mobius
* @NOTE: Retail like working * @NOTE: Retail like working
* @TODO: Rewrite code to modern style. * @TODO: Rewrite code to modern style.
*/ */
@@ -46,12 +44,7 @@ public class ResidenceOfKingProcella extends AbstractInstance
private static final SkillHolder HURRICANE_BOLT_LV_1 = new SkillHolder(50043, 1); // When player in Radius + para private static final SkillHolder HURRICANE_BOLT_LV_1 = new SkillHolder(50043, 1); // When player in Radius + para
// Misc // Misc
private static final int TEMPLATE_ID = 197; private static final int TEMPLATE_ID = 197;
private static int STORM_MAX_COUNT = 16; // TODO: Max is limit ? private static final int STORM_MAX_COUNT = 16; // TODO: Max is limit ?
private int _procellaStormCount;
private RaidBossInstance _procella;
private MonsterInstance _minion1;
private MonsterInstance _minion2;
private MonsterInstance _minion3;
public ResidenceOfKingProcella() public ResidenceOfKingProcella()
{ {
@@ -69,46 +62,56 @@ public class ResidenceOfKingProcella extends AbstractInstance
case "ENTER": case "ENTER":
{ {
enterInstance(player, npc, TEMPLATE_ID); enterInstance(player, npc, TEMPLATE_ID);
_procella = (RaidBossInstance) addSpawn(PROCELLA, 212862, 179828, -15489, 49151, false, 0, true, player.getInstanceId()); final Instance world = player.getInstanceWorld();
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); if (world != null)
startQuestTimer("SPAWN_STORM", 5000, _procella, player); {
_procellaStormCount = 0; final Npc procella = addSpawn(PROCELLA, 212862, 179828, -15489, 49151, false, 0, true, player.getInstanceId());
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), procella, player);
startQuestTimer("SPAWN_STORM", 5000, procella, player);
world.setParameter("stormCount", 0);
}
break; break;
} }
case "SPAWN_MINION": case "SPAWN_MINION":
{ {
if (npc.getId() == PROCELLA) final Instance world = npc.getInstanceWorld();
if ((world != null) && (npc.getId() == PROCELLA))
{ {
_minion1 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId()); world.setParameter("minion1", addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId()));
_minion2 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, true, 0, true, npc.getInstanceId()); world.setParameter("minion2", addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, true, 0, true, npc.getInstanceId()));
_minion3 = (MonsterInstance) addSpawn(PROCELLA_GUARDIAN_3, 212558, 179974, -15486, 12311, true, 0, true, npc.getInstanceId()); world.setParameter("minion3", addSpawn(PROCELLA_GUARDIAN_3, 212558, 179974, -15486, 12311, true, 0, true, npc.getInstanceId()));
startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null);
} }
break; break;
} }
case "SPAWN_STORM": case "SPAWN_STORM":
{ {
if (_procellaStormCount < STORM_MAX_COUNT) final Instance world = npc.getInstanceWorld();
if ((world != null) && (world.getParameters().getInt("stormCount", 0) < STORM_MAX_COUNT))
{ {
_procella.useMagic(HURRICANE_SUMMON.getSkill()); world.getNpc(PROCELLA).doCast(HURRICANE_SUMMON.getSkill());
final Npc procellaStorm = addSpawn(PROCELLA_STORM, _procella.getX() + getRandom(-500, 500), _procella.getY() + getRandom(-500, 500), _procella.getZ(), 31011, true, 0, true, npc.getInstanceId()); final Npc procellaStorm = addSpawn(PROCELLA_STORM, world.getNpc(PROCELLA).getX() + getRandom(-500, 500), world.getNpc(PROCELLA).getY() + getRandom(-500, 500), world.getNpc(PROCELLA).getZ(), 31011, true, 0, true, npc.getInstanceId());
procellaStorm.setRandomWalking(true); procellaStorm.setRandomWalking(true);
_procellaStormCount++; world.getParameters().increaseInt("stormCount", 1);
startQuestTimer("SPAWN_STORM", 60000, _procella, null); startQuestTimer("SPAWN_STORM", 60000, world.getNpc(PROCELLA), null);
startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking
} }
break; break;
} }
case "HIDE_PROCELLA": case "HIDE_PROCELLA":
{ {
if (_procella.isInvisible()) final Instance world = npc.getInstanceWorld();
if (world != null)
{ {
_procella.setInvisible(false); if (world.getNpc(PROCELLA).isInvisible())
{
world.getNpc(PROCELLA).setInvisible(false);
} }
else else
{ {
_procella.setInvisible(true); world.getNpc(PROCELLA).setInvisible(true);
startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), world.getNpc(PROCELLA), player);
}
} }
break; break;
} }
@@ -150,22 +153,25 @@ public class ResidenceOfKingProcella extends AbstractInstance
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
if (npc.getId() == PROCELLA)
{ {
final Instance world = npc.getInstanceWorld(); final Instance world = npc.getInstanceWorld();
if (world != null) if (world == null)
{
return null;
}
if (npc.getId() == PROCELLA)
{ {
cancelQuestTimer("SPAWN_MINION", npc, player); cancelQuestTimer("SPAWN_MINION", npc, player);
cancelQuestTimer("SPAWN_STORM", npc, player); cancelQuestTimer("SPAWN_STORM", npc, player);
cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player);
world.finishInstance(); world.finishInstance();
} }
} else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead()))
else if ((_minion1.isDead()) && (_minion2.isDead()) && (_minion3.isDead()))
{ {
startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null);
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, player, isSummon);
} }

View File

@@ -41,12 +41,12 @@ public class ResidenceOfQueenNebula extends AbstractInstance
private static final int WATER_SLIME = 29111; private static final int WATER_SLIME = 29111;
// Skills // Skills
private static final int AQUA_RAGE = 50036; private static final int AQUA_RAGE = 50036;
private static SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); private static final SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1);
private static SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); private static final SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2);
private static SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); private static final SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3);
private static SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); private static final SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4);
private static SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); private static final SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5);
private static SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); private static final SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1);
// Misc // Misc
private static final int TEMPLATE_ID = 196; private static final int TEMPLATE_ID = 196;

View File

@@ -47,10 +47,10 @@ public class SevenSignsRBs extends AbstractInstance
private static final int ANAKIM_TEMPLATE_ID = 200; private static final int ANAKIM_TEMPLATE_ID = 200;
private static final int LILITH_TEMPLATE_ID = 199; private static final int LILITH_TEMPLATE_ID = 199;
private static int MAX_PLAYERS_IN_ZONE = 300; private static final int MAX_PLAYERS_IN_ZONE = 300;
private static final NoRestartZone _anakim_zone = ZoneManager.getInstance().getZoneById(70052, NoRestartZone.class); private static final NoRestartZone ANAKIM_ZONE = ZoneManager.getInstance().getZoneById(70052, NoRestartZone.class);
private static final NoRestartZone _lilith_zone = ZoneManager.getInstance().getZoneById(70053, NoRestartZone.class); private static final NoRestartZone LILITH_ZONE = ZoneManager.getInstance().getZoneById(70053, NoRestartZone.class);
// TELEPORTS // TELEPORTS
private static final Location[] TELEPORT_TO_DARK_ELVEN = private static final Location[] TELEPORT_TO_DARK_ELVEN =
@@ -89,7 +89,7 @@ public class SevenSignsRBs extends AbstractInstance
final boolean isInCC = party.isInCommandChannel(); final boolean isInCC = party.isInCommandChannel();
final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers();
if (members.size() > (MAX_PLAYERS_IN_ZONE - _anakim_zone.getPlayersInside().size())) if (members.size() > (MAX_PLAYERS_IN_ZONE - ANAKIM_ZONE.getPlayersInside().size()))
{ {
player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now."); player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now.");
} }
@@ -128,7 +128,7 @@ public class SevenSignsRBs extends AbstractInstance
final boolean isInCC = party.isInCommandChannel(); final boolean isInCC = party.isInCommandChannel();
final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); final List<PlayerInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers();
if (members.size() > (MAX_PLAYERS_IN_ZONE - _lilith_zone.getPlayersInside().size())) if (members.size() > (MAX_PLAYERS_IN_ZONE - LILITH_ZONE.getPlayersInside().size()))
{ {
player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now."); player.sendMessage("Lilith Sanctum reached 300 players. You cannot enter now.");
} }
@@ -161,7 +161,7 @@ public class SevenSignsRBs extends AbstractInstance
} }
case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM": case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM":
{ {
for (Creature charInside : _anakim_zone.getCharactersInside()) for (Creature charInside : ANAKIM_ZONE.getCharactersInside())
{ {
if ((charInside != null) && charInside.isPlayer()) if ((charInside != null) && charInside.isPlayer())
{ {
@@ -172,7 +172,7 @@ public class SevenSignsRBs extends AbstractInstance
} }
case "REMOVE_PLAYERS_FROM_ZONE_LILITH": case "REMOVE_PLAYERS_FROM_ZONE_LILITH":
{ {
for (Creature charInside : _lilith_zone.getCharactersInside()) for (Creature charInside : LILITH_ZONE.getCharactersInside())
{ {
if ((charInside != null) && charInside.isPlayer()) if ((charInside != null) && charInside.isPlayer())
{ {