From a6fc6eb2cd297f1f94c93fc71800ae5d6253a31b Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 26 Feb 2020 10:56:19 +0000 Subject: [PATCH] Instance related adjustments. --- .../bosses/Frintezza/ScarletVanHalisha.java | 4 +- .../ai/bosses/Octavis/OctavisWarzone.java | 2 +- .../AltarOfShilen/AltarOfShilen.java | 2 +- .../ChamberOfProphecies.java | 576 ++++++----- .../DimensionalWrap/DimensionalWrap.java | 898 ++++++++++-------- .../NornilsGarden/NornilsGarden.java | 14 +- .../bosses/Frintezza/ScarletVanHalisha.java | 4 +- .../ai/bosses/Octavis/OctavisWarzone.java | 2 +- .../AltarOfShilen/AltarOfShilen.java | 2 +- .../AshenShadowRevolutionaries.java | 2 +- .../ChamberOfProphecies.java | 576 ++++++----- .../DimensionalWrap/DimensionalWrap.java | 898 ++++++++++-------- .../StoryOfTauti/StoryOfTauti.java | 171 ++-- .../NornilsGarden/NornilsGarden.java | 14 +- .../bosses/Frintezza/ScarletVanHalisha.java | 4 +- .../ai/bosses/Octavis/OctavisWarzone.java | 2 +- .../AltarOfShilen/AltarOfShilen.java | 2 +- .../AshenShadowRevolutionaries.java | 2 +- .../ChamberOfProphecies.java | 576 ++++++----- .../DimensionalWrap/DimensionalWrap.java | 898 ++++++++++-------- .../StoryOfTauti/StoryOfTauti.java | 171 ++-- .../NornilsGarden/NornilsGarden.java | 14 +- .../bosses/Frintezza/ScarletVanHalisha.java | 4 +- .../ai/bosses/Octavis/OctavisWarzone.java | 2 +- .../AltarOfShilen/AltarOfShilen.java | 2 +- .../AshenShadowRevolutionaries.java | 2 +- .../ChamberOfProphecies.java | 576 ++++++----- .../DimensionalWrap/DimensionalWrap.java | 898 ++++++++++-------- .../StoryOfTauti/StoryOfTauti.java | 171 ++-- .../NornilsGarden/NornilsGarden.java | 14 +- .../bosses/Frintezza/ScarletVanHalisha.java | 4 +- .../ai/bosses/Octavis/OctavisWarzone.java | 2 +- .../AltarOfShilen/AltarOfShilen.java | 2 +- .../AshenShadowRevolutionaries.java | 2 +- .../ChamberOfProphecies.java | 576 ++++++----- .../DimensionalWrap/DimensionalWrap.java | 894 +++++++++-------- .../StoryOfTauti/StoryOfTauti.java | 171 ++-- .../NornilsGarden/NornilsGarden.java | 14 +- .../bosses/Frintezza/ScarletVanHalisha.java | 4 +- .../ai/bosses/Octavis/OctavisWarzone.java | 2 +- .../AltarOfShilen/AltarOfShilen.java | 2 +- .../AshenShadowRevolutionaries.java | 2 +- .../ChamberOfProphecies.java | 576 ++++++----- .../DimensionalWrap/DimensionalWrap.java | 894 +++++++++-------- .../StoryOfTauti/StoryOfTauti.java | 171 ++-- .../NornilsGarden/NornilsGarden.java | 14 +- .../bosses/Frintezza/ScarletVanHalisha.java | 4 +- .../ai/bosses/Octavis/OctavisWarzone.java | 2 +- .../AltarOfShilen/AltarOfShilen.java | 2 +- .../AshenShadowRevolutionaries.java | 2 +- .../ChamberOfProphecies.java | 576 ++++++----- .../DimensionalWrap/DimensionalWrap.java | 898 ++++++++++-------- .../StoryOfTauti/StoryOfTauti.java | 171 ++-- .../NornilsGarden/NornilsGarden.java | 14 +- .../bosses/Frintezza/ScarletVanHalisha.java | 4 +- .../ai/bosses/Octavis/OctavisWarzone.java | 2 +- .../AltarOfShilen/AltarOfShilen.java | 2 +- .../AshenShadowRevolutionaries.java | 2 +- .../ChamberOfProphecies.java | 576 ++++++----- .../DimensionalWrap/DimensionalWrap.java | 898 ++++++++++-------- .../StoryOfTauti/StoryOfTauti.java | 171 ++-- .../NornilsGarden/NornilsGarden.java | 14 +- .../SSQDisciplesNecropolisPast.java | 2 +- .../FinalEmperialTomb/FinalEmperialTomb.java | 10 +- .../SSQDisciplesNecropolisPast.java | 2 +- .../ResidenceOfKingIgnis.java | 22 +- .../ResidenceOfKingPetram.java | 109 +-- .../ResidenceOfKingProcella.java | 86 +- .../ResidenceOfQueenNebula.java | 12 +- .../SevenSignsRBs/SevenSignsRBs.java | 14 +- .../ResidenceOfKingIgnis.java | 22 +- .../ResidenceOfKingPetram.java | 109 +-- .../ResidenceOfKingProcella.java | 86 +- .../ResidenceOfQueenNebula.java | 12 +- .../SevenSignsRBs/SevenSignsRBs.java | 14 +- .../instances/GolbergRoom/GolbergRoom.java | 55 +- .../ResidenceOfKingIgnis.java | 22 +- .../ResidenceOfKingPetram.java | 109 +-- .../ResidenceOfKingProcella.java | 86 +- .../ResidenceOfQueenNebula.java | 12 +- .../SevenSignsRBs/SevenSignsRBs.java | 14 +- 81 files changed, 7566 insertions(+), 6403 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java index 59a416f01e..15679fe90f 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java @@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - cancelQuestTimers("attack"); - cancelQuestTimers("random_Target"); + cancelQuestTimer("attack", npc, null); + cancelQuestTimer("random_Target", npc, null); return super.onKill(npc, killer, isSummon); } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java index fc11f466be..b85aad2397 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java @@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance { world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_1, false); - world.getParameters().set("TELEPORT_ACTIVE", true); + world.setParameter("TELEPORT_ACTIVE", true); npc.teleToLocation(BATTLE_LOC); playMovie(world, Movie.SC_OCTABIS_OPENING); getTimers().addTimer("START_STAGE_1", 26500, npc, null); diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java index 3ba11e3a8e..880c7382c9 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java @@ -251,7 +251,7 @@ public class AltarOfShilen extends AbstractInstance world.setStatus(7); onStatusChanged(world); npc.deleteMe(); - cancelQuestTimers("check_player"); + cancelQuestTimer("check_player", npc, null); } break; } diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java index c4431a7532..0f47b580e9 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java @@ -73,321 +73,373 @@ public class ChamberOfProphecies extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - if (event.equals("enterInstance")) + switch (event) { - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) + case "31639-01.html": + case "33996-01.html": + case "33980-01.html": + case "33980-02.html": { - enterInstance(player, npc, TEMPLATE_ID); - if (hasQuestItems(player, PROPHECY_MACHINE)) - { - takeItems(player, PROPHECY_MACHINE, 1); - } - qs.setCond(16, true); + htmltext = event; + break; } - } - else if (player != null) - { - final Instance world = player.getInstanceWorld(); - if (!isInInstance(world)) + case "33996-02.html": { - return null; + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.broadcastPacket(ExShowUsm.USM_Q015_E); + world.despawnGroup("q10753_16_instance_grail"); + world.spawnGroup("q10753_16_instance_wizard"); + giveItems(player, ATELIA, 1); + showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; } - - switch (event) + case "33980-03.html": { - case "31639-01.html": - case "33996-01.html": - case "33980-01.html": - case "33980-02.html": + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-04.html": + { + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-05.html": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; - break; + return null; } - case "33996-02.html": + world.spawnGroup("q10753_16_instance_halter_2"); + world.setStatus(6); + startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); + htmltext = event; + break; + } + case "enterInstance": + { + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) { - world.broadcastPacket(ExShowUsm.USM_Q015_E); - world.despawnGroup("q10753_16_instance_grail"); - world.spawnGroup("q10753_16_instance_wizard"); - giveItems(player, ATELIA, 1); - showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-03.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-04.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-05.html": - { - world.spawnGroup("q10753_16_instance_halter_2"); - world.setStatus(6); - startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); - htmltext = event; - break; - } - case "status": - { - if (world.isStatus(0)) + enterInstance(player, npc, TEMPLATE_ID); + if (hasQuestItems(player, PROPHECY_MACHINE)) { - htmltext = "31639-01.html"; + 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": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.isStatus(0)) + { + htmltext = "31639-01.html"; + break; + } + htmltext = "31639-02.html"; + break; + } + case "CHECK_STATUS": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + switch (world.getStatus()) + { + case 0: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); + startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); + startQuestTimer("OPEN_DOOR1", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); break; } - htmltext = "31639-02.html"; - 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": - { - switch (world.getStatus()) + case 1: { - case 0: + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); - startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); - startQuestTimer("OPEN_DOOR1", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 1: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.spawnGroup("wof_room2_1"); - world.setStatus(2); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 2: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); - startQuestTimer("OPEN_DOOR2", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 3: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(4); - world.spawnGroup("wof_room3_2"); - world.openCloseDoor(DOOR_3, false); - startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 4: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(5); - world.spawnGroup("wof_room4"); - startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); - startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); - } - else - { - startQuestTimer("CHECK_STATUS", 7000, npc, player); - } - break; + world.spawnGroup("wof_room2_1"); + world.setStatus(2); } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; } - break; - } - case "ATTACK": - case "ATTACK1": - case "ATTACK2": - { - npc.setRunning(); - ((Attackable) npc).setCanReturnToSpawnPoint(false); - if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) + case 2: { - npc.setTarget(player); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - addAttackDesire(npc, monster); - return; - }); + startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); + startQuestTimer("OPEN_DOOR2", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 3: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(4); + world.spawnGroup("wof_room3_2"); + world.openCloseDoor(DOOR_3, false); + startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 4: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(5); + world.spawnGroup("wof_room4"); + startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); + startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); + } + else + { + startQuestTimer("CHECK_STATUS", 7000, npc, player); + } + break; } - break; } - case "OPEN_DOOR1": + break; + } + case "ATTACK": + case "ATTACK1": + case "ATTACK2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - cancelQuestTimers("ATTACK"); - world.setStatus(1); - world.openCloseDoor(DOOR_2, true); - world.spawnGroup("wof_room2"); - break; + return null; } - case "OPEN_DOOR2": - { - cancelQuestTimers("ATTACK1"); - startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); - world.setStatus(3); - world.spawnGroup("wof_room3"); - world.openCloseDoor(DOOR_3, true); - break; - } - case "BROADCAST_TEXT": + npc.setRunning(); + ((Attackable) npc).setCanReturnToSpawnPoint(false); + if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) { npc.setTarget(player); - npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); - break; } - case "SEY2": + else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { - if (npc.getId() == FERIN) + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); - } - break; + addAttackDesire(npc, monster); + return; + }); } - case "SEY_KAIN": + break; + } + case "OPEN_DOOR1": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == VAN_HALTER) - { - startQuestTimer("ATTACK1", 200, npc, player, true); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY3": + cancelQuestTimer("ATTACK", npc, player); + world.setStatus(1); + world.openCloseDoor(DOOR_2, true); + world.spawnGroup("wof_room2"); + break; + } + case "OPEN_DOOR2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY_KAIN_1": + cancelQuestTimer("ATTACK1", npc, player); + startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); + world.setStatus(3); + world.spawnGroup("wof_room3"); + world.openCloseDoor(DOOR_3, true); + break; + } + case "BROADCAST_TEXT": + { + npc.setTarget(player); + npc.setRunning(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); + break; + } + case "SEY2": + { + if (npc.getId() == FERIN) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_2": + break; + } + case "SEY_KAIN": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); - startQuestTimer("SEY_KAIN_3", 7000, npc, player); - } - break; + startQuestTimer("ATTACK1", 200, npc, player, true); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); } - case "SEY4": + break; + } + case "SEY3": + { + if (npc.getId() == FERIN) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); - startQuestTimer("REST", 5000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_3": + break; + } + case "SEY_KAIN_1": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); - startQuestTimer("SEY_KAIN_4", 1000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); } - case "REST": + break; + } + case "SEY_KAIN_2": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == FERIN) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); - cancelQuestTimers("BROADCAST_TEXT"); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); + startQuestTimer("SEY_KAIN_3", 7000, npc, player); } - case "SEY_KAIN_4": + break; + } + case "SEY4": + { + if (npc.getId() == FERIN) { - world.setStatus(5); - world.spawnGroup("q10753_16_instance_grail"); - showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); - world.openCloseDoor(DOOR_4, true); - cancelQuestTimers("ATTACK2"); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); - startQuestTimer("CLOSE", 15000, null, player); - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); + startQuestTimer("REST", 5000, npc, player); + npc.setScriptValue(1); } - case "CLOSE": + break; + } + case "SEY_KAIN_3": + { + if (npc.getId() == VAN_HALTER) { - final Npc grail = world.getNpc(GRAIL); - if ((grail != null) && (player.calculateDistance2D(grail) < 390)) - { - world.openCloseDoor(DOOR_4, false); - world.despawnGroup("q10753_16_instance_halter_1_1"); - world.despawnGroup("wof_room4"); - } - else - { - startQuestTimer("CLOSE", 3000, npc, player); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); + startQuestTimer("SEY_KAIN_4", 1000, npc, player); + npc.setScriptValue(1); } - case "DESPAWN_WIZARD": + break; + } + case "REST": + { + if (npc.getId() == FERIN) { - world.despawnGroup("q10753_16_instance_wizard"); - break; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); + cancelQuestTimer("BROADCAST_TEXT", npc, player); } - case "exit": + break; + } + case "SEY_KAIN_4": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - 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)); - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) - { - qs.setCond(17, true); - } - break; + return null; } - case "finish": + world.setStatus(5); + world.spawnGroup("q10753_16_instance_grail"); + showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); + world.openCloseDoor(DOOR_4, true); + cancelQuestTimer("ATTACK2", npc, player); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); + startQuestTimer("CLOSE", 15000, null, player); + break; + } + case "CLOSE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - world.finishInstance(0); - break; + return null; } + final Npc grail = world.getNpc(GRAIL); + if ((grail != null) && (player.calculateDistance2D(grail) < 390)) + { + world.openCloseDoor(DOOR_4, false); + world.despawnGroup("q10753_16_instance_halter_1_1"); + world.despawnGroup("wof_room4"); + } + else + { + startQuestTimer("CLOSE", 3000, npc, player); + } + break; + } + case "DESPAWN_WIZARD": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.despawnGroup("q10753_16_instance_wizard"); + break; + } + case "exit": + { + 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(1)); + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) + { + qs.setCond(17, true); + } + break; + } + case "finish": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.finishInstance(0); + break; } } return htmltext; diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java index a1077a8e4d..263d5e3991 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java @@ -17,10 +17,8 @@ package instances.DimensionalWrap; import java.util.List; -import java.util.concurrent.ScheduledFuture; import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.enums.CategoryType; @@ -44,7 +42,7 @@ import instances.AbstractInstance; * Dimensional Wrap instance * @URL https://l2wiki.com/Dimensional_Warp * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg - * @author Gigi + * @author Gigi, Mobius * @date 2018-09-04 - [14:33:31] */ public class DimensionalWrap extends AbstractInstance @@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance 23480, // Abyssal Harpy 23481, // Abyssal Binder 23482, // Abyssal Archon - 23483 // Abyssal Golem + 23483, // Abyssal Golem }; private static final int[] TRAPS = { @@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance 19559, // Damage trap, power 1 19560, // Damage trap, power 2 19561, // Damage trap, power 3 - 19562 // Heal Trap + 19562, // Heal Trap }; // Location 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 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); // Misc private static final int TEMPLATE_ID = 250; private static final int DIMENSIONAL_DARK_FORCES = 16415; 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() { @@ -125,429 +118,534 @@ public class DimensionalWrap extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - final Instance world = npc.getInstanceWorld(); - if (event.equals("enterInstance")) + + switch (event) { - if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + case "enterInstance": { - htmltext = "no_awakened.html"; + if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + htmltext = "no_awakened.html"; + } + else if (!player.isInParty()) + { + enterInstance(player, npc, TEMPLATE_ID); + } + else if (player.isInParty()) + { + if (!player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + } + else + { + final Party party = player.getParty(); + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) + { + enterInstance(member, npc, TEMPLATE_ID); + } + } + } + } + break; } - else if (!player.isInParty()) + case "33975-01.html": { - enterInstance(player, npc, TEMPLATE_ID); + htmltext = event; + break; } - else if (player.isInParty()) + case "12_warp_crystals": { - if (!player.getParty().isLeader(player)) + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.3); + if (!player.isInParty()) + { + world.setParameter("count", 12); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; } - else + switch (player.getParty().getMemberCount()) { - final Party party = player.getParty(); - final List members = party.getMembers(); - for (PlayerInstance member : members) + case 2: { - if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) - { - enterInstance(member, npc, TEMPLATE_ID); - } + world.setParameter("count", 6); + checkCrystallCount(world, npc); + break; + } + case 3: + { + world.setParameter("count", 4); + checkCrystallCount(world, npc); + break; + } + case 4: + { + world.setParameter("count", 3); + checkCrystallCount(world, npc); + break; } } + break; } - } - if (isInInstance(world)) - { - switch (event) + case "240_warp_crystals": { - case "33975-01.html": + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; + return null; + } + + world.setParameter("chance", 0.6); + if (!player.isInParty()) + { + world.setParameter("count", 240); + checkCrystallCount(world, npc); break; } - case "12_warp_crystals": + else if (player.isInParty() && !player.getParty().isLeader(player)) { - _chance = 0.3; - if (!player.isInParty()) + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - _count = 12; + world.setParameter("count", 120); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 3: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 6; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 4; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 3; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "240_warp_crystals": - { - _chance = 0.6; - if (!player.isInParty()) - { - _count = 240; + world.setParameter("count", 80); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 4: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 120; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 80; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 60; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "1200_warp_crystals": - { - _chance = 0.9; - if (!player.isInParty()) - { - _count = 1200; + world.setParameter("count", 60); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + } + break; + } + case "1200_warp_crystals": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.9); + if (!player.isInParty()) + { + world.setParameter("count", 1200); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 600); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 3: { - case 2: - { - _count = 600; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 400; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 300; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "send_6_f": - { - if (_worldState == 0) - { - htmltext = "33975-02.html"; + world.setParameter("count", 400); + checkCrystallCount(world, npc); break; } - if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + case 4: { - htmltext = "33975-05.html"; + world.setParameter("count", 300); + checkCrystallCount(world, npc); break; } - - for (Npc n : world.getAliveNpcs()) + } + break; + } + case "send_6_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) + n.deleteMe(); + } + } + if (world.getStatus() < 5) + { + world.setStatus(5); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_11_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 10) + { + world.setStatus(10); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_16_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 15) + { + world.setStatus(15); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_21_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 20) + { + world.setStatus(20); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(TELEPORTS, world.getTemplateId()); + } + break; + } + case "send_26_f": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 25) + { + world.setStatus(25); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); + } + break; + } + case "jump_location": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + player.teleToLocation(TELEPORTS, world.getTemplateId()); + break; + } + case "SALAMANDRA_SPAWN": + case "SALAMANDRA_SPAWN_DUMMY": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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(); + World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> + { + if ((p != null) && !p.isDead()) { - n.deleteMe(); + addAttackPlayerDesire(salamandra, p); } - } - if (world.getStatus() < 5) - { - world.setStatus(5); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); - } - break; + }); } - case "send_11_f": + break; + } + case "START_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 10) - { - world.setStatus(10); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_16_f": + world.setStatus(world.getStatus() + 1); + world.setParameter("worldState", world.getStatus()); + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); + startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer()); + break; + } + case "FIRST_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 15) - { - world.setStatus(15); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_21_f": + final int worldState = world.getParameters().getInt("worldState", 0); + world.spawnGroup(worldState + "_first_spawn"); + world.spawnGroup(worldState + "_trap_spawn"); + startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer()); + startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true); + break; + } + case "DEBUFF_TASK": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 20) - { - world.setStatus(20); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(TELEPORTS, world.getTemplateId()); - } - break; + return null; } - case "send_26_f": + int skilllevel = 1; + final int worldState = world.getParameters().getInt("worldState", 0); + if ((worldState > 0) && (worldState <= 11)) { - if (_worldState == 0) + 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()) + { + if ((p != null) && !p.isDead()) { - htmltext = "33975-02.html"; - break; + skill.applyEffects(p, p); } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + } + break; + } + case "SECOND_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn"); + startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer()); + break; + } + case "THIRD_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn"); + break; + } + case "CHANGE_LOCATION": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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; + } + case "SWITCH_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.getAliveNpcs(MONSTERS).isEmpty()) + { + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); + world.broadcastPacket(new Earthquake(npc, 50, 5)); + world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true); + clean(world.getFirstPlayer()); + if (world.getParameters().getInt("worldState", 0) < 35) { - htmltext = "33975-05.html"; - break; + startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer()); } - for (Npc n : world.getAliveNpcs()) + } + break; + } + 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.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); + startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer()); + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } + n.deleteMe(); } - if (world.getStatus() < 25) - { - world.setStatus(25); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); - } - break; - } - case "jump_location": - { - player.teleToLocation(TELEPORTS, world.getTemplateId()); - break; - } - case "SALAMANDRA_SPAWN": - case "SALAMANDRA_SPAWN_DUMMY": - { - if (getRandom(100) < (_worldState / 2)) - { - final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); - salamandra.setRunning(); - World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> - { - if ((p != null) && !p.isDead()) - { - addAttackPlayerDesire(salamandra, p); - } - }); - } - break; - } - case "START_STAGE": - { - world.setStatus(world.getStatus() + 1); - _worldState = 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); - break; - } - case "FIRST_SPAWN": - { - world.spawnGroup(_worldState + "_first_spawn"); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("SECOND_SPAWN", 40000, npc, null); - _debufTask = ThreadPool.scheduleAtFixedRate(() -> - { - 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()) - { - if ((p != null) && !p.isDead()) - { - skill.applyEffects(p, p); - } - } - }, 5000, 10000); - break; - } - case "SECOND_SPAWN": - { - world.spawnGroup(_worldState + "_second_spawn"); - startQuestTimer("THRID_SPAWN", 40000, npc, null); - break; - } - case "THRID_SPAWN": - { - world.spawnGroup(_worldState + "_thred_spawn"); - break; - } - case "CHANGE_LOCATION": - { - world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); - break; - } - case "SWITCH_STAGE": - { - if (world.getAliveNpcs(MONSTERS).isEmpty()) - { - world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); - world.broadcastPacket(new Earthquake(npc, 50, 5)); - world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); - clean(); - if (_worldState < 35) - { - startQuestTimer("NEXT_STAGE", 5000, npc, null); - } - } - break; - } - case "NEXT_STAGE": - { - 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)); - startQuestTimer("START_STAGE", 8000, npc, null); - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - break; } + break; } } return htmltext; @@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance final Instance world = npc.getInstanceWorld(); 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()); 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()); 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()); 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.finishInstance(3); - clean(); + clean(world.getFirstPlayer()); } } return super.onKill(npc, killer, isSummon); @@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance @Override 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"; } @@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance { case SALAMANDRA_GENERATOR: { - startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); + startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true); + startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer()); break; } case SALAMANDRA_GENERATOR_DUMMY: { - startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); + startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true); break; } case DEMINSIONAL_INVISIBLE_FRAGMENT: { - startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); + startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true); break; } } @@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance boolean canStart = true; 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()) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); 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(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); canStart = false; } } } - if (!canStart || (_worldState != 0)) + if (!canStart || (world.getParameters().getInt("worldState", 0) != 0)) { return; } - startQuestTimer("START_STAGE", 1000, npc, null); + startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer()); 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"); - cancelQuestTimers("SALAMANDRA_SPAWN"); - cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); - cancelQuestTimers("CHANGE_LOCATION"); - if (_debufTask != null) - { - _debufTask.cancel(false); - _debufTask = null; - } + cancelQuestTimer("SWITCH_STAGE", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player); + cancelQuestTimer("CHANGE_LOCATION", null, player); + cancelQuestTimer("DEBUFF_TASK", null, player); } public static void main(String[] args) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 72d5e30e36..e53345de20 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -34,7 +34,7 @@ import instances.AbstractInstance; * Nornils Garden Instance * @URL https://l2wiki.com/Nornils_Garden * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs - * @author Gigi + * @author Gigi, Mobius * @date 2017-02-22 - [15:22:27] */ public class NornilsGarden extends AbstractInstance @@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200016, true); - cancelQuestTimers("stage2"); + cancelQuestTimer("stage2", npc, null); world.spawnGroup("wave_3"); } break; @@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200201, true); - cancelQuestTimers("stage3"); - cancelQuestTimers("check_agrro"); + cancelQuestTimer("stage3", npc, null); } break; } 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 -> { @@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); } }); + startQuestTimer("check_agrro", 1000, npc, null); } break; } @@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance { if (npc.getId() == BOZ_STAGE1) { - cancelQuestTimers("stage1_1"); + cancelQuestTimer("stage1_1", npc, null); world.openCloseDoor(16200015, true); world.setStatus(1); } @@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) { ((Attackable) npc).setCanReturnToSpawnPoint(false); - startQuestTimer("check_agrro", 1000, npc, null, true); + startQuestTimer("check_agrro", 1000, npc, null); } return super.onSpawn(npc); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java index 59a416f01e..15679fe90f 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java @@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - cancelQuestTimers("attack"); - cancelQuestTimers("random_Target"); + cancelQuestTimer("attack", npc, null); + cancelQuestTimer("random_Target", npc, null); return super.onKill(npc, killer, isSummon); } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java index fc11f466be..b85aad2397 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java @@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance { world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_1, false); - world.getParameters().set("TELEPORT_ACTIVE", true); + world.setParameter("TELEPORT_ACTIVE", true); npc.teleToLocation(BATTLE_LOC); playMovie(world, Movie.SC_OCTABIS_OPENING); getTimers().addTimer("START_STAGE_1", 26500, npc, null); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java index 3ba11e3a8e..880c7382c9 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java @@ -251,7 +251,7 @@ public class AltarOfShilen extends AbstractInstance world.setStatus(7); onStatusChanged(world); npc.deleteMe(); - cancelQuestTimers("check_player"); + cancelQuestTimer("check_player", npc, null); } break; } diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java index 809462089e..ba07db28a2 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java @@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance } 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)) { captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java index c4431a7532..0f47b580e9 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java @@ -73,321 +73,373 @@ public class ChamberOfProphecies extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - if (event.equals("enterInstance")) + switch (event) { - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) + case "31639-01.html": + case "33996-01.html": + case "33980-01.html": + case "33980-02.html": { - enterInstance(player, npc, TEMPLATE_ID); - if (hasQuestItems(player, PROPHECY_MACHINE)) - { - takeItems(player, PROPHECY_MACHINE, 1); - } - qs.setCond(16, true); + htmltext = event; + break; } - } - else if (player != null) - { - final Instance world = player.getInstanceWorld(); - if (!isInInstance(world)) + case "33996-02.html": { - return null; + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.broadcastPacket(ExShowUsm.USM_Q015_E); + world.despawnGroup("q10753_16_instance_grail"); + world.spawnGroup("q10753_16_instance_wizard"); + giveItems(player, ATELIA, 1); + showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; } - - switch (event) + case "33980-03.html": { - case "31639-01.html": - case "33996-01.html": - case "33980-01.html": - case "33980-02.html": + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-04.html": + { + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-05.html": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; - break; + return null; } - case "33996-02.html": + world.spawnGroup("q10753_16_instance_halter_2"); + world.setStatus(6); + startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); + htmltext = event; + break; + } + case "enterInstance": + { + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) { - world.broadcastPacket(ExShowUsm.USM_Q015_E); - world.despawnGroup("q10753_16_instance_grail"); - world.spawnGroup("q10753_16_instance_wizard"); - giveItems(player, ATELIA, 1); - showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-03.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-04.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-05.html": - { - world.spawnGroup("q10753_16_instance_halter_2"); - world.setStatus(6); - startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); - htmltext = event; - break; - } - case "status": - { - if (world.isStatus(0)) + enterInstance(player, npc, TEMPLATE_ID); + if (hasQuestItems(player, PROPHECY_MACHINE)) { - htmltext = "31639-01.html"; + 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": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.isStatus(0)) + { + htmltext = "31639-01.html"; + break; + } + htmltext = "31639-02.html"; + break; + } + case "CHECK_STATUS": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + switch (world.getStatus()) + { + case 0: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); + startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); + startQuestTimer("OPEN_DOOR1", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); break; } - htmltext = "31639-02.html"; - 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": - { - switch (world.getStatus()) + case 1: { - case 0: + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); - startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); - startQuestTimer("OPEN_DOOR1", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 1: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.spawnGroup("wof_room2_1"); - world.setStatus(2); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 2: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); - startQuestTimer("OPEN_DOOR2", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 3: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(4); - world.spawnGroup("wof_room3_2"); - world.openCloseDoor(DOOR_3, false); - startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 4: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(5); - world.spawnGroup("wof_room4"); - startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); - startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); - } - else - { - startQuestTimer("CHECK_STATUS", 7000, npc, player); - } - break; + world.spawnGroup("wof_room2_1"); + world.setStatus(2); } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; } - break; - } - case "ATTACK": - case "ATTACK1": - case "ATTACK2": - { - npc.setRunning(); - ((Attackable) npc).setCanReturnToSpawnPoint(false); - if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) + case 2: { - npc.setTarget(player); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - addAttackDesire(npc, monster); - return; - }); + startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); + startQuestTimer("OPEN_DOOR2", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 3: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(4); + world.spawnGroup("wof_room3_2"); + world.openCloseDoor(DOOR_3, false); + startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 4: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(5); + world.spawnGroup("wof_room4"); + startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); + startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); + } + else + { + startQuestTimer("CHECK_STATUS", 7000, npc, player); + } + break; } - break; } - case "OPEN_DOOR1": + break; + } + case "ATTACK": + case "ATTACK1": + case "ATTACK2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - cancelQuestTimers("ATTACK"); - world.setStatus(1); - world.openCloseDoor(DOOR_2, true); - world.spawnGroup("wof_room2"); - break; + return null; } - case "OPEN_DOOR2": - { - cancelQuestTimers("ATTACK1"); - startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); - world.setStatus(3); - world.spawnGroup("wof_room3"); - world.openCloseDoor(DOOR_3, true); - break; - } - case "BROADCAST_TEXT": + npc.setRunning(); + ((Attackable) npc).setCanReturnToSpawnPoint(false); + if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) { npc.setTarget(player); - npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); - break; } - case "SEY2": + else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { - if (npc.getId() == FERIN) + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); - } - break; + addAttackDesire(npc, monster); + return; + }); } - case "SEY_KAIN": + break; + } + case "OPEN_DOOR1": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == VAN_HALTER) - { - startQuestTimer("ATTACK1", 200, npc, player, true); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY3": + cancelQuestTimer("ATTACK", npc, player); + world.setStatus(1); + world.openCloseDoor(DOOR_2, true); + world.spawnGroup("wof_room2"); + break; + } + case "OPEN_DOOR2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY_KAIN_1": + cancelQuestTimer("ATTACK1", npc, player); + startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); + world.setStatus(3); + world.spawnGroup("wof_room3"); + world.openCloseDoor(DOOR_3, true); + break; + } + case "BROADCAST_TEXT": + { + npc.setTarget(player); + npc.setRunning(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); + break; + } + case "SEY2": + { + if (npc.getId() == FERIN) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_2": + break; + } + case "SEY_KAIN": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); - startQuestTimer("SEY_KAIN_3", 7000, npc, player); - } - break; + startQuestTimer("ATTACK1", 200, npc, player, true); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); } - case "SEY4": + break; + } + case "SEY3": + { + if (npc.getId() == FERIN) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); - startQuestTimer("REST", 5000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_3": + break; + } + case "SEY_KAIN_1": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); - startQuestTimer("SEY_KAIN_4", 1000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); } - case "REST": + break; + } + case "SEY_KAIN_2": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == FERIN) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); - cancelQuestTimers("BROADCAST_TEXT"); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); + startQuestTimer("SEY_KAIN_3", 7000, npc, player); } - case "SEY_KAIN_4": + break; + } + case "SEY4": + { + if (npc.getId() == FERIN) { - world.setStatus(5); - world.spawnGroup("q10753_16_instance_grail"); - showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); - world.openCloseDoor(DOOR_4, true); - cancelQuestTimers("ATTACK2"); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); - startQuestTimer("CLOSE", 15000, null, player); - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); + startQuestTimer("REST", 5000, npc, player); + npc.setScriptValue(1); } - case "CLOSE": + break; + } + case "SEY_KAIN_3": + { + if (npc.getId() == VAN_HALTER) { - final Npc grail = world.getNpc(GRAIL); - if ((grail != null) && (player.calculateDistance2D(grail) < 390)) - { - world.openCloseDoor(DOOR_4, false); - world.despawnGroup("q10753_16_instance_halter_1_1"); - world.despawnGroup("wof_room4"); - } - else - { - startQuestTimer("CLOSE", 3000, npc, player); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); + startQuestTimer("SEY_KAIN_4", 1000, npc, player); + npc.setScriptValue(1); } - case "DESPAWN_WIZARD": + break; + } + case "REST": + { + if (npc.getId() == FERIN) { - world.despawnGroup("q10753_16_instance_wizard"); - break; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); + cancelQuestTimer("BROADCAST_TEXT", npc, player); } - case "exit": + break; + } + case "SEY_KAIN_4": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - 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)); - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) - { - qs.setCond(17, true); - } - break; + return null; } - case "finish": + world.setStatus(5); + world.spawnGroup("q10753_16_instance_grail"); + showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); + world.openCloseDoor(DOOR_4, true); + cancelQuestTimer("ATTACK2", npc, player); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); + startQuestTimer("CLOSE", 15000, null, player); + break; + } + case "CLOSE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - world.finishInstance(0); - break; + return null; } + final Npc grail = world.getNpc(GRAIL); + if ((grail != null) && (player.calculateDistance2D(grail) < 390)) + { + world.openCloseDoor(DOOR_4, false); + world.despawnGroup("q10753_16_instance_halter_1_1"); + world.despawnGroup("wof_room4"); + } + else + { + startQuestTimer("CLOSE", 3000, npc, player); + } + break; + } + case "DESPAWN_WIZARD": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.despawnGroup("q10753_16_instance_wizard"); + break; + } + case "exit": + { + 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(1)); + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) + { + qs.setCond(17, true); + } + break; + } + case "finish": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.finishInstance(0); + break; } } return htmltext; diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java index a1077a8e4d..263d5e3991 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java @@ -17,10 +17,8 @@ package instances.DimensionalWrap; import java.util.List; -import java.util.concurrent.ScheduledFuture; import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.enums.CategoryType; @@ -44,7 +42,7 @@ import instances.AbstractInstance; * Dimensional Wrap instance * @URL https://l2wiki.com/Dimensional_Warp * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg - * @author Gigi + * @author Gigi, Mobius * @date 2018-09-04 - [14:33:31] */ public class DimensionalWrap extends AbstractInstance @@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance 23480, // Abyssal Harpy 23481, // Abyssal Binder 23482, // Abyssal Archon - 23483 // Abyssal Golem + 23483, // Abyssal Golem }; private static final int[] TRAPS = { @@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance 19559, // Damage trap, power 1 19560, // Damage trap, power 2 19561, // Damage trap, power 3 - 19562 // Heal Trap + 19562, // Heal Trap }; // Location 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 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); // Misc private static final int TEMPLATE_ID = 250; private static final int DIMENSIONAL_DARK_FORCES = 16415; 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() { @@ -125,429 +118,534 @@ public class DimensionalWrap extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - final Instance world = npc.getInstanceWorld(); - if (event.equals("enterInstance")) + + switch (event) { - if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + case "enterInstance": { - htmltext = "no_awakened.html"; + if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + htmltext = "no_awakened.html"; + } + else if (!player.isInParty()) + { + enterInstance(player, npc, TEMPLATE_ID); + } + else if (player.isInParty()) + { + if (!player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + } + else + { + final Party party = player.getParty(); + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) + { + enterInstance(member, npc, TEMPLATE_ID); + } + } + } + } + break; } - else if (!player.isInParty()) + case "33975-01.html": { - enterInstance(player, npc, TEMPLATE_ID); + htmltext = event; + break; } - else if (player.isInParty()) + case "12_warp_crystals": { - if (!player.getParty().isLeader(player)) + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.3); + if (!player.isInParty()) + { + world.setParameter("count", 12); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; } - else + switch (player.getParty().getMemberCount()) { - final Party party = player.getParty(); - final List members = party.getMembers(); - for (PlayerInstance member : members) + case 2: { - if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) - { - enterInstance(member, npc, TEMPLATE_ID); - } + world.setParameter("count", 6); + checkCrystallCount(world, npc); + break; + } + case 3: + { + world.setParameter("count", 4); + checkCrystallCount(world, npc); + break; + } + case 4: + { + world.setParameter("count", 3); + checkCrystallCount(world, npc); + break; } } + break; } - } - if (isInInstance(world)) - { - switch (event) + case "240_warp_crystals": { - case "33975-01.html": + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; + return null; + } + + world.setParameter("chance", 0.6); + if (!player.isInParty()) + { + world.setParameter("count", 240); + checkCrystallCount(world, npc); break; } - case "12_warp_crystals": + else if (player.isInParty() && !player.getParty().isLeader(player)) { - _chance = 0.3; - if (!player.isInParty()) + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - _count = 12; + world.setParameter("count", 120); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 3: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 6; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 4; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 3; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "240_warp_crystals": - { - _chance = 0.6; - if (!player.isInParty()) - { - _count = 240; + world.setParameter("count", 80); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 4: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 120; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 80; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 60; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "1200_warp_crystals": - { - _chance = 0.9; - if (!player.isInParty()) - { - _count = 1200; + world.setParameter("count", 60); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + } + break; + } + case "1200_warp_crystals": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.9); + if (!player.isInParty()) + { + world.setParameter("count", 1200); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 600); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 3: { - case 2: - { - _count = 600; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 400; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 300; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "send_6_f": - { - if (_worldState == 0) - { - htmltext = "33975-02.html"; + world.setParameter("count", 400); + checkCrystallCount(world, npc); break; } - if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + case 4: { - htmltext = "33975-05.html"; + world.setParameter("count", 300); + checkCrystallCount(world, npc); break; } - - for (Npc n : world.getAliveNpcs()) + } + break; + } + case "send_6_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) + n.deleteMe(); + } + } + if (world.getStatus() < 5) + { + world.setStatus(5); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_11_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 10) + { + world.setStatus(10); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_16_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 15) + { + world.setStatus(15); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_21_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 20) + { + world.setStatus(20); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(TELEPORTS, world.getTemplateId()); + } + break; + } + case "send_26_f": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 25) + { + world.setStatus(25); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); + } + break; + } + case "jump_location": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + player.teleToLocation(TELEPORTS, world.getTemplateId()); + break; + } + case "SALAMANDRA_SPAWN": + case "SALAMANDRA_SPAWN_DUMMY": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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(); + World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> + { + if ((p != null) && !p.isDead()) { - n.deleteMe(); + addAttackPlayerDesire(salamandra, p); } - } - if (world.getStatus() < 5) - { - world.setStatus(5); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); - } - break; + }); } - case "send_11_f": + break; + } + case "START_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 10) - { - world.setStatus(10); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_16_f": + world.setStatus(world.getStatus() + 1); + world.setParameter("worldState", world.getStatus()); + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); + startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer()); + break; + } + case "FIRST_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 15) - { - world.setStatus(15); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_21_f": + final int worldState = world.getParameters().getInt("worldState", 0); + world.spawnGroup(worldState + "_first_spawn"); + world.spawnGroup(worldState + "_trap_spawn"); + startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer()); + startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true); + break; + } + case "DEBUFF_TASK": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 20) - { - world.setStatus(20); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(TELEPORTS, world.getTemplateId()); - } - break; + return null; } - case "send_26_f": + int skilllevel = 1; + final int worldState = world.getParameters().getInt("worldState", 0); + if ((worldState > 0) && (worldState <= 11)) { - if (_worldState == 0) + 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()) + { + if ((p != null) && !p.isDead()) { - htmltext = "33975-02.html"; - break; + skill.applyEffects(p, p); } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + } + break; + } + case "SECOND_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn"); + startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer()); + break; + } + case "THIRD_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn"); + break; + } + case "CHANGE_LOCATION": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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; + } + case "SWITCH_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.getAliveNpcs(MONSTERS).isEmpty()) + { + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); + world.broadcastPacket(new Earthquake(npc, 50, 5)); + world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true); + clean(world.getFirstPlayer()); + if (world.getParameters().getInt("worldState", 0) < 35) { - htmltext = "33975-05.html"; - break; + startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer()); } - for (Npc n : world.getAliveNpcs()) + } + break; + } + 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.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); + startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer()); + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } + n.deleteMe(); } - if (world.getStatus() < 25) - { - world.setStatus(25); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); - } - break; - } - case "jump_location": - { - player.teleToLocation(TELEPORTS, world.getTemplateId()); - break; - } - case "SALAMANDRA_SPAWN": - case "SALAMANDRA_SPAWN_DUMMY": - { - if (getRandom(100) < (_worldState / 2)) - { - final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); - salamandra.setRunning(); - World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> - { - if ((p != null) && !p.isDead()) - { - addAttackPlayerDesire(salamandra, p); - } - }); - } - break; - } - case "START_STAGE": - { - world.setStatus(world.getStatus() + 1); - _worldState = 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); - break; - } - case "FIRST_SPAWN": - { - world.spawnGroup(_worldState + "_first_spawn"); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("SECOND_SPAWN", 40000, npc, null); - _debufTask = ThreadPool.scheduleAtFixedRate(() -> - { - 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()) - { - if ((p != null) && !p.isDead()) - { - skill.applyEffects(p, p); - } - } - }, 5000, 10000); - break; - } - case "SECOND_SPAWN": - { - world.spawnGroup(_worldState + "_second_spawn"); - startQuestTimer("THRID_SPAWN", 40000, npc, null); - break; - } - case "THRID_SPAWN": - { - world.spawnGroup(_worldState + "_thred_spawn"); - break; - } - case "CHANGE_LOCATION": - { - world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); - break; - } - case "SWITCH_STAGE": - { - if (world.getAliveNpcs(MONSTERS).isEmpty()) - { - world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); - world.broadcastPacket(new Earthquake(npc, 50, 5)); - world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); - clean(); - if (_worldState < 35) - { - startQuestTimer("NEXT_STAGE", 5000, npc, null); - } - } - break; - } - case "NEXT_STAGE": - { - 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)); - startQuestTimer("START_STAGE", 8000, npc, null); - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - break; } + break; } } return htmltext; @@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance final Instance world = npc.getInstanceWorld(); 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()); 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()); 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()); 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.finishInstance(3); - clean(); + clean(world.getFirstPlayer()); } } return super.onKill(npc, killer, isSummon); @@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance @Override 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"; } @@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance { case SALAMANDRA_GENERATOR: { - startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); + startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true); + startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer()); break; } case SALAMANDRA_GENERATOR_DUMMY: { - startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); + startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true); break; } case DEMINSIONAL_INVISIBLE_FRAGMENT: { - startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); + startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true); break; } } @@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance boolean canStart = true; 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()) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); 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(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); canStart = false; } } } - if (!canStart || (_worldState != 0)) + if (!canStart || (world.getParameters().getInt("worldState", 0) != 0)) { return; } - startQuestTimer("START_STAGE", 1000, npc, null); + startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer()); 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"); - cancelQuestTimers("SALAMANDRA_SPAWN"); - cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); - cancelQuestTimers("CHANGE_LOCATION"); - if (_debufTask != null) - { - _debufTask.cancel(false); - _debufTask = null; - } + cancelQuestTimer("SWITCH_STAGE", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player); + cancelQuestTimer("CHANGE_LOCATION", null, player); + cancelQuestTimer("DEBUFF_TASK", null, player); } public static void main(String[] args) diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java index c44c3a56c4..d0f7507655 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java @@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti; /** * Mystic Tavern Tauti Instance * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk - * @author Gigi + * @author Gigi, Mobius */ 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 int ZONE_1ST_TRIGER = 24137770; private static final int SKILL_TRIGER = 24138880; - private static Npc _deton; private static Npc _seal_device; protected int _count = 0; public StoryOfTauti() { 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); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); @@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(1) || world.isStatus(4)) { - _deton.setTarget(player); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + world.getNpc(DETON).setTarget(player); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } else { @@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance } 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 -> { if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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; } case "msg_1": { - _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); + 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, world.getNpc(DETON), null); break; } case "msg_2": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); - startQuestTimer("msg_3", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); + startQuestTimer("msg_3", 10000, world.getNpc(DETON), null); break; } 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; } case "msg_4": { - _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); - startQuestTimer("msg_5", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); + startQuestTimer("msg_5", 7000, world.getNpc(DETON), null); break; } case "msg_5": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_stacato": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_1", 50000, _deton, null); + startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_1": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_2", 50000, _deton, null); + startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_2": @@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance } case "check_flower": { - if (!npc.isDead()) + if ((world != null) && !npc.isDead()) { for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) { if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) { - _deton.setRunning(); + world.getNpc(DETON).setRunning(); addMoveToDesire(npc, nearby.getLocation(), 23); if (npc.calculateDistance3D(nearby) < 100) { @@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance } } } + startQuestTimer("check_flower", 3000, npc, null); } break; } @@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "spawn_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) { world.spawnGroup("ifrit"); @@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance { 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); addAttackPlayerDesire(npc, pl); } @@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance } case "msg_8": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); - startQuestTimer("msg_9", 8000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); + startQuestTimer("msg_9", 8000, world.getNpc(DETON), null); break; } case "msg_9": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); - startQuestTimer("msg_10", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); + startQuestTimer("msg_10", 10000, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away", 10000, _deton, null); + startQuestTimer("run_away", 10000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 3500, _deton, null); + 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); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null); break; } case "delete_daton": @@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "msg_12": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away_1", 8000, _deton, null); + startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 5000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null); break; } case "switch_quest": @@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance } case "end_instance": { - cancelQuestTimers("check_flower"); _count = 0; for (Npc n : world.getAliveNpcs()) { @@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance { 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); break; } if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) { _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); break; } @@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) { world.spawnGroup("last_deton"); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); - startQuestTimer("msg_12", 6000, _deton, null); - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); + startQuestTimer("msg_12", 6000, world.getNpc(DETON), null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.setStatus(11); } 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_archagel"); 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()) { - cancelQuestTimers("end_instance"); - cancelQuestTimers("check_flower"); + cancelQuestTimer("end_instance", world.getNpc(DETON), null); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.setStatus(4); World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> { if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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); - startQuestTimer("msg_7", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); + startQuestTimer("msg_7", 7000, world.getNpc(DETON), null); } break; } @@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance 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)); - startQuestTimer("msg_8", 3000, _deton, null); + startQuestTimer("msg_8", 3000, world.getNpc(DETON), null); world.setStatus(6); } break; @@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance _seal_device.setDisplayEffect(3); _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)); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); - startQuestTimer("msg_11", 3000, _deton, null); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); + startQuestTimer("msg_11", 3000, world.getNpc(DETON), null); break; } case SEALED_ANGEL: @@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) { world.setStatus(2); - _deton.setTarget(null); - _deton.stopMove(null); - startQuestTimer("msg_4", 7000, _deton, null); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(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.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); - startQuestTimer("end_instance", 190000, _deton, null); - startQuestTimer("spawn_stacato", 5000, _deton, null); + startQuestTimer("end_instance", 190000, world.getNpc(DETON), null); + startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null); } break; } @@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(0)) { - startQuestTimer("check_status", 21000, _deton, player); + startQuestTimer("check_status", 21000, world.getNpc(DETON), player); world.setStatus(1); } break; @@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance 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)); - _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); + 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, world.getNpc(DETON), player); world.setStatus(5); } break; @@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _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); + 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, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); - startQuestTimer("spawn_scarab", 7000, _deton, player); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); + startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance { switch (npc.getId()) { - case DETON: - { - _deton = npc; - break; - } case SEAL_DEVICE: { _seal_device = npc; @@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance } case FLAME_STACATO: { - startQuestTimer("check_flower", 3000, npc, null, true); + startQuestTimer("check_flower", 3000, npc, null); break; } case FLAME_SCORPION: diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 72d5e30e36..e53345de20 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -34,7 +34,7 @@ import instances.AbstractInstance; * Nornils Garden Instance * @URL https://l2wiki.com/Nornils_Garden * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs - * @author Gigi + * @author Gigi, Mobius * @date 2017-02-22 - [15:22:27] */ public class NornilsGarden extends AbstractInstance @@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200016, true); - cancelQuestTimers("stage2"); + cancelQuestTimer("stage2", npc, null); world.spawnGroup("wave_3"); } break; @@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200201, true); - cancelQuestTimers("stage3"); - cancelQuestTimers("check_agrro"); + cancelQuestTimer("stage3", npc, null); } break; } 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 -> { @@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); } }); + startQuestTimer("check_agrro", 1000, npc, null); } break; } @@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance { if (npc.getId() == BOZ_STAGE1) { - cancelQuestTimers("stage1_1"); + cancelQuestTimer("stage1_1", npc, null); world.openCloseDoor(16200015, true); world.setStatus(1); } @@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) { ((Attackable) npc).setCanReturnToSpawnPoint(false); - startQuestTimer("check_agrro", 1000, npc, null, true); + startQuestTimer("check_agrro", 1000, npc, null); } return super.onSpawn(npc); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java index 59a416f01e..15679fe90f 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java @@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - cancelQuestTimers("attack"); - cancelQuestTimers("random_Target"); + cancelQuestTimer("attack", npc, null); + cancelQuestTimer("random_Target", npc, null); return super.onKill(npc, killer, isSummon); } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java index fc11f466be..b85aad2397 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java @@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance { world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_1, false); - world.getParameters().set("TELEPORT_ACTIVE", true); + world.setParameter("TELEPORT_ACTIVE", true); npc.teleToLocation(BATTLE_LOC); playMovie(world, Movie.SC_OCTABIS_OPENING); getTimers().addTimer("START_STAGE_1", 26500, npc, null); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java index 3ba11e3a8e..880c7382c9 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java @@ -251,7 +251,7 @@ public class AltarOfShilen extends AbstractInstance world.setStatus(7); onStatusChanged(world); npc.deleteMe(); - cancelQuestTimers("check_player"); + cancelQuestTimer("check_player", npc, null); } break; } diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java index 809462089e..ba07db28a2 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java @@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance } 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)) { captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java index c4431a7532..0f47b580e9 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java @@ -73,321 +73,373 @@ public class ChamberOfProphecies extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - if (event.equals("enterInstance")) + switch (event) { - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) + case "31639-01.html": + case "33996-01.html": + case "33980-01.html": + case "33980-02.html": { - enterInstance(player, npc, TEMPLATE_ID); - if (hasQuestItems(player, PROPHECY_MACHINE)) - { - takeItems(player, PROPHECY_MACHINE, 1); - } - qs.setCond(16, true); + htmltext = event; + break; } - } - else if (player != null) - { - final Instance world = player.getInstanceWorld(); - if (!isInInstance(world)) + case "33996-02.html": { - return null; + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.broadcastPacket(ExShowUsm.USM_Q015_E); + world.despawnGroup("q10753_16_instance_grail"); + world.spawnGroup("q10753_16_instance_wizard"); + giveItems(player, ATELIA, 1); + showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; } - - switch (event) + case "33980-03.html": { - case "31639-01.html": - case "33996-01.html": - case "33980-01.html": - case "33980-02.html": + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-04.html": + { + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-05.html": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; - break; + return null; } - case "33996-02.html": + world.spawnGroup("q10753_16_instance_halter_2"); + world.setStatus(6); + startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); + htmltext = event; + break; + } + case "enterInstance": + { + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) { - world.broadcastPacket(ExShowUsm.USM_Q015_E); - world.despawnGroup("q10753_16_instance_grail"); - world.spawnGroup("q10753_16_instance_wizard"); - giveItems(player, ATELIA, 1); - showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-03.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-04.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-05.html": - { - world.spawnGroup("q10753_16_instance_halter_2"); - world.setStatus(6); - startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); - htmltext = event; - break; - } - case "status": - { - if (world.isStatus(0)) + enterInstance(player, npc, TEMPLATE_ID); + if (hasQuestItems(player, PROPHECY_MACHINE)) { - htmltext = "31639-01.html"; + 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": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.isStatus(0)) + { + htmltext = "31639-01.html"; + break; + } + htmltext = "31639-02.html"; + break; + } + case "CHECK_STATUS": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + switch (world.getStatus()) + { + case 0: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); + startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); + startQuestTimer("OPEN_DOOR1", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); break; } - htmltext = "31639-02.html"; - 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": - { - switch (world.getStatus()) + case 1: { - case 0: + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); - startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); - startQuestTimer("OPEN_DOOR1", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 1: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.spawnGroup("wof_room2_1"); - world.setStatus(2); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 2: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); - startQuestTimer("OPEN_DOOR2", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 3: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(4); - world.spawnGroup("wof_room3_2"); - world.openCloseDoor(DOOR_3, false); - startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 4: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(5); - world.spawnGroup("wof_room4"); - startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); - startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); - } - else - { - startQuestTimer("CHECK_STATUS", 7000, npc, player); - } - break; + world.spawnGroup("wof_room2_1"); + world.setStatus(2); } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; } - break; - } - case "ATTACK": - case "ATTACK1": - case "ATTACK2": - { - npc.setRunning(); - ((Attackable) npc).setCanReturnToSpawnPoint(false); - if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) + case 2: { - npc.setTarget(player); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - addAttackDesire(npc, monster); - return; - }); + startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); + startQuestTimer("OPEN_DOOR2", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 3: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(4); + world.spawnGroup("wof_room3_2"); + world.openCloseDoor(DOOR_3, false); + startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 4: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(5); + world.spawnGroup("wof_room4"); + startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); + startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); + } + else + { + startQuestTimer("CHECK_STATUS", 7000, npc, player); + } + break; } - break; } - case "OPEN_DOOR1": + break; + } + case "ATTACK": + case "ATTACK1": + case "ATTACK2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - cancelQuestTimers("ATTACK"); - world.setStatus(1); - world.openCloseDoor(DOOR_2, true); - world.spawnGroup("wof_room2"); - break; + return null; } - case "OPEN_DOOR2": - { - cancelQuestTimers("ATTACK1"); - startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); - world.setStatus(3); - world.spawnGroup("wof_room3"); - world.openCloseDoor(DOOR_3, true); - break; - } - case "BROADCAST_TEXT": + npc.setRunning(); + ((Attackable) npc).setCanReturnToSpawnPoint(false); + if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) { npc.setTarget(player); - npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); - break; } - case "SEY2": + else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { - if (npc.getId() == FERIN) + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); - } - break; + addAttackDesire(npc, monster); + return; + }); } - case "SEY_KAIN": + break; + } + case "OPEN_DOOR1": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == VAN_HALTER) - { - startQuestTimer("ATTACK1", 200, npc, player, true); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY3": + cancelQuestTimer("ATTACK", npc, player); + world.setStatus(1); + world.openCloseDoor(DOOR_2, true); + world.spawnGroup("wof_room2"); + break; + } + case "OPEN_DOOR2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY_KAIN_1": + cancelQuestTimer("ATTACK1", npc, player); + startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); + world.setStatus(3); + world.spawnGroup("wof_room3"); + world.openCloseDoor(DOOR_3, true); + break; + } + case "BROADCAST_TEXT": + { + npc.setTarget(player); + npc.setRunning(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); + break; + } + case "SEY2": + { + if (npc.getId() == FERIN) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_2": + break; + } + case "SEY_KAIN": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); - startQuestTimer("SEY_KAIN_3", 7000, npc, player); - } - break; + startQuestTimer("ATTACK1", 200, npc, player, true); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); } - case "SEY4": + break; + } + case "SEY3": + { + if (npc.getId() == FERIN) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); - startQuestTimer("REST", 5000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_3": + break; + } + case "SEY_KAIN_1": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); - startQuestTimer("SEY_KAIN_4", 1000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); } - case "REST": + break; + } + case "SEY_KAIN_2": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == FERIN) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); - cancelQuestTimers("BROADCAST_TEXT"); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); + startQuestTimer("SEY_KAIN_3", 7000, npc, player); } - case "SEY_KAIN_4": + break; + } + case "SEY4": + { + if (npc.getId() == FERIN) { - world.setStatus(5); - world.spawnGroup("q10753_16_instance_grail"); - showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); - world.openCloseDoor(DOOR_4, true); - cancelQuestTimers("ATTACK2"); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); - startQuestTimer("CLOSE", 15000, null, player); - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); + startQuestTimer("REST", 5000, npc, player); + npc.setScriptValue(1); } - case "CLOSE": + break; + } + case "SEY_KAIN_3": + { + if (npc.getId() == VAN_HALTER) { - final Npc grail = world.getNpc(GRAIL); - if ((grail != null) && (player.calculateDistance2D(grail) < 390)) - { - world.openCloseDoor(DOOR_4, false); - world.despawnGroup("q10753_16_instance_halter_1_1"); - world.despawnGroup("wof_room4"); - } - else - { - startQuestTimer("CLOSE", 3000, npc, player); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); + startQuestTimer("SEY_KAIN_4", 1000, npc, player); + npc.setScriptValue(1); } - case "DESPAWN_WIZARD": + break; + } + case "REST": + { + if (npc.getId() == FERIN) { - world.despawnGroup("q10753_16_instance_wizard"); - break; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); + cancelQuestTimer("BROADCAST_TEXT", npc, player); } - case "exit": + break; + } + case "SEY_KAIN_4": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - 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)); - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) - { - qs.setCond(17, true); - } - break; + return null; } - case "finish": + world.setStatus(5); + world.spawnGroup("q10753_16_instance_grail"); + showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); + world.openCloseDoor(DOOR_4, true); + cancelQuestTimer("ATTACK2", npc, player); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); + startQuestTimer("CLOSE", 15000, null, player); + break; + } + case "CLOSE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - world.finishInstance(0); - break; + return null; } + final Npc grail = world.getNpc(GRAIL); + if ((grail != null) && (player.calculateDistance2D(grail) < 390)) + { + world.openCloseDoor(DOOR_4, false); + world.despawnGroup("q10753_16_instance_halter_1_1"); + world.despawnGroup("wof_room4"); + } + else + { + startQuestTimer("CLOSE", 3000, npc, player); + } + break; + } + case "DESPAWN_WIZARD": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.despawnGroup("q10753_16_instance_wizard"); + break; + } + case "exit": + { + 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(1)); + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) + { + qs.setCond(17, true); + } + break; + } + case "finish": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.finishInstance(0); + break; } } return htmltext; diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java index a1077a8e4d..263d5e3991 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java @@ -17,10 +17,8 @@ package instances.DimensionalWrap; import java.util.List; -import java.util.concurrent.ScheduledFuture; import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.enums.CategoryType; @@ -44,7 +42,7 @@ import instances.AbstractInstance; * Dimensional Wrap instance * @URL https://l2wiki.com/Dimensional_Warp * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg - * @author Gigi + * @author Gigi, Mobius * @date 2018-09-04 - [14:33:31] */ public class DimensionalWrap extends AbstractInstance @@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance 23480, // Abyssal Harpy 23481, // Abyssal Binder 23482, // Abyssal Archon - 23483 // Abyssal Golem + 23483, // Abyssal Golem }; private static final int[] TRAPS = { @@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance 19559, // Damage trap, power 1 19560, // Damage trap, power 2 19561, // Damage trap, power 3 - 19562 // Heal Trap + 19562, // Heal Trap }; // Location 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 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); // Misc private static final int TEMPLATE_ID = 250; private static final int DIMENSIONAL_DARK_FORCES = 16415; 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() { @@ -125,429 +118,534 @@ public class DimensionalWrap extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - final Instance world = npc.getInstanceWorld(); - if (event.equals("enterInstance")) + + switch (event) { - if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + case "enterInstance": { - htmltext = "no_awakened.html"; + if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + htmltext = "no_awakened.html"; + } + else if (!player.isInParty()) + { + enterInstance(player, npc, TEMPLATE_ID); + } + else if (player.isInParty()) + { + if (!player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + } + else + { + final Party party = player.getParty(); + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) + { + enterInstance(member, npc, TEMPLATE_ID); + } + } + } + } + break; } - else if (!player.isInParty()) + case "33975-01.html": { - enterInstance(player, npc, TEMPLATE_ID); + htmltext = event; + break; } - else if (player.isInParty()) + case "12_warp_crystals": { - if (!player.getParty().isLeader(player)) + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.3); + if (!player.isInParty()) + { + world.setParameter("count", 12); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; } - else + switch (player.getParty().getMemberCount()) { - final Party party = player.getParty(); - final List members = party.getMembers(); - for (PlayerInstance member : members) + case 2: { - if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) - { - enterInstance(member, npc, TEMPLATE_ID); - } + world.setParameter("count", 6); + checkCrystallCount(world, npc); + break; + } + case 3: + { + world.setParameter("count", 4); + checkCrystallCount(world, npc); + break; + } + case 4: + { + world.setParameter("count", 3); + checkCrystallCount(world, npc); + break; } } + break; } - } - if (isInInstance(world)) - { - switch (event) + case "240_warp_crystals": { - case "33975-01.html": + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; + return null; + } + + world.setParameter("chance", 0.6); + if (!player.isInParty()) + { + world.setParameter("count", 240); + checkCrystallCount(world, npc); break; } - case "12_warp_crystals": + else if (player.isInParty() && !player.getParty().isLeader(player)) { - _chance = 0.3; - if (!player.isInParty()) + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - _count = 12; + world.setParameter("count", 120); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 3: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 6; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 4; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 3; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "240_warp_crystals": - { - _chance = 0.6; - if (!player.isInParty()) - { - _count = 240; + world.setParameter("count", 80); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 4: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 120; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 80; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 60; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "1200_warp_crystals": - { - _chance = 0.9; - if (!player.isInParty()) - { - _count = 1200; + world.setParameter("count", 60); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + } + break; + } + case "1200_warp_crystals": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.9); + if (!player.isInParty()) + { + world.setParameter("count", 1200); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 600); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 3: { - case 2: - { - _count = 600; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 400; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 300; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "send_6_f": - { - if (_worldState == 0) - { - htmltext = "33975-02.html"; + world.setParameter("count", 400); + checkCrystallCount(world, npc); break; } - if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + case 4: { - htmltext = "33975-05.html"; + world.setParameter("count", 300); + checkCrystallCount(world, npc); break; } - - for (Npc n : world.getAliveNpcs()) + } + break; + } + case "send_6_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) + n.deleteMe(); + } + } + if (world.getStatus() < 5) + { + world.setStatus(5); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_11_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 10) + { + world.setStatus(10); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_16_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 15) + { + world.setStatus(15); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_21_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 20) + { + world.setStatus(20); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(TELEPORTS, world.getTemplateId()); + } + break; + } + case "send_26_f": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 25) + { + world.setStatus(25); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); + } + break; + } + case "jump_location": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + player.teleToLocation(TELEPORTS, world.getTemplateId()); + break; + } + case "SALAMANDRA_SPAWN": + case "SALAMANDRA_SPAWN_DUMMY": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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(); + World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> + { + if ((p != null) && !p.isDead()) { - n.deleteMe(); + addAttackPlayerDesire(salamandra, p); } - } - if (world.getStatus() < 5) - { - world.setStatus(5); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); - } - break; + }); } - case "send_11_f": + break; + } + case "START_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 10) - { - world.setStatus(10); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_16_f": + world.setStatus(world.getStatus() + 1); + world.setParameter("worldState", world.getStatus()); + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); + startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer()); + break; + } + case "FIRST_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 15) - { - world.setStatus(15); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_21_f": + final int worldState = world.getParameters().getInt("worldState", 0); + world.spawnGroup(worldState + "_first_spawn"); + world.spawnGroup(worldState + "_trap_spawn"); + startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer()); + startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true); + break; + } + case "DEBUFF_TASK": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 20) - { - world.setStatus(20); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(TELEPORTS, world.getTemplateId()); - } - break; + return null; } - case "send_26_f": + int skilllevel = 1; + final int worldState = world.getParameters().getInt("worldState", 0); + if ((worldState > 0) && (worldState <= 11)) { - if (_worldState == 0) + 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()) + { + if ((p != null) && !p.isDead()) { - htmltext = "33975-02.html"; - break; + skill.applyEffects(p, p); } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + } + break; + } + case "SECOND_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn"); + startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer()); + break; + } + case "THIRD_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn"); + break; + } + case "CHANGE_LOCATION": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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; + } + case "SWITCH_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.getAliveNpcs(MONSTERS).isEmpty()) + { + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); + world.broadcastPacket(new Earthquake(npc, 50, 5)); + world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true); + clean(world.getFirstPlayer()); + if (world.getParameters().getInt("worldState", 0) < 35) { - htmltext = "33975-05.html"; - break; + startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer()); } - for (Npc n : world.getAliveNpcs()) + } + break; + } + 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.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); + startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer()); + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } + n.deleteMe(); } - if (world.getStatus() < 25) - { - world.setStatus(25); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); - } - break; - } - case "jump_location": - { - player.teleToLocation(TELEPORTS, world.getTemplateId()); - break; - } - case "SALAMANDRA_SPAWN": - case "SALAMANDRA_SPAWN_DUMMY": - { - if (getRandom(100) < (_worldState / 2)) - { - final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); - salamandra.setRunning(); - World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> - { - if ((p != null) && !p.isDead()) - { - addAttackPlayerDesire(salamandra, p); - } - }); - } - break; - } - case "START_STAGE": - { - world.setStatus(world.getStatus() + 1); - _worldState = 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); - break; - } - case "FIRST_SPAWN": - { - world.spawnGroup(_worldState + "_first_spawn"); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("SECOND_SPAWN", 40000, npc, null); - _debufTask = ThreadPool.scheduleAtFixedRate(() -> - { - 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()) - { - if ((p != null) && !p.isDead()) - { - skill.applyEffects(p, p); - } - } - }, 5000, 10000); - break; - } - case "SECOND_SPAWN": - { - world.spawnGroup(_worldState + "_second_spawn"); - startQuestTimer("THRID_SPAWN", 40000, npc, null); - break; - } - case "THRID_SPAWN": - { - world.spawnGroup(_worldState + "_thred_spawn"); - break; - } - case "CHANGE_LOCATION": - { - world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); - break; - } - case "SWITCH_STAGE": - { - if (world.getAliveNpcs(MONSTERS).isEmpty()) - { - world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); - world.broadcastPacket(new Earthquake(npc, 50, 5)); - world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); - clean(); - if (_worldState < 35) - { - startQuestTimer("NEXT_STAGE", 5000, npc, null); - } - } - break; - } - case "NEXT_STAGE": - { - 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)); - startQuestTimer("START_STAGE", 8000, npc, null); - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - break; } + break; } } return htmltext; @@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance final Instance world = npc.getInstanceWorld(); 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()); 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()); 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()); 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.finishInstance(3); - clean(); + clean(world.getFirstPlayer()); } } return super.onKill(npc, killer, isSummon); @@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance @Override 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"; } @@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance { case SALAMANDRA_GENERATOR: { - startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); + startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true); + startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer()); break; } case SALAMANDRA_GENERATOR_DUMMY: { - startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); + startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true); break; } case DEMINSIONAL_INVISIBLE_FRAGMENT: { - startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); + startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true); break; } } @@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance boolean canStart = true; 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()) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); 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(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); canStart = false; } } } - if (!canStart || (_worldState != 0)) + if (!canStart || (world.getParameters().getInt("worldState", 0) != 0)) { return; } - startQuestTimer("START_STAGE", 1000, npc, null); + startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer()); 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"); - cancelQuestTimers("SALAMANDRA_SPAWN"); - cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); - cancelQuestTimers("CHANGE_LOCATION"); - if (_debufTask != null) - { - _debufTask.cancel(false); - _debufTask = null; - } + cancelQuestTimer("SWITCH_STAGE", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player); + cancelQuestTimer("CHANGE_LOCATION", null, player); + cancelQuestTimer("DEBUFF_TASK", null, player); } public static void main(String[] args) diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java index c44c3a56c4..d0f7507655 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java @@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti; /** * Mystic Tavern Tauti Instance * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk - * @author Gigi + * @author Gigi, Mobius */ 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 int ZONE_1ST_TRIGER = 24137770; private static final int SKILL_TRIGER = 24138880; - private static Npc _deton; private static Npc _seal_device; protected int _count = 0; public StoryOfTauti() { 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); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); @@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(1) || world.isStatus(4)) { - _deton.setTarget(player); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + world.getNpc(DETON).setTarget(player); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } else { @@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance } 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 -> { if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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; } case "msg_1": { - _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); + 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, world.getNpc(DETON), null); break; } case "msg_2": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); - startQuestTimer("msg_3", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); + startQuestTimer("msg_3", 10000, world.getNpc(DETON), null); break; } 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; } case "msg_4": { - _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); - startQuestTimer("msg_5", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); + startQuestTimer("msg_5", 7000, world.getNpc(DETON), null); break; } case "msg_5": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_stacato": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_1", 50000, _deton, null); + startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_1": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_2", 50000, _deton, null); + startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_2": @@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance } case "check_flower": { - if (!npc.isDead()) + if ((world != null) && !npc.isDead()) { for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) { if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) { - _deton.setRunning(); + world.getNpc(DETON).setRunning(); addMoveToDesire(npc, nearby.getLocation(), 23); if (npc.calculateDistance3D(nearby) < 100) { @@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance } } } + startQuestTimer("check_flower", 3000, npc, null); } break; } @@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "spawn_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) { world.spawnGroup("ifrit"); @@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance { 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); addAttackPlayerDesire(npc, pl); } @@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance } case "msg_8": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); - startQuestTimer("msg_9", 8000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); + startQuestTimer("msg_9", 8000, world.getNpc(DETON), null); break; } case "msg_9": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); - startQuestTimer("msg_10", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); + startQuestTimer("msg_10", 10000, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away", 10000, _deton, null); + startQuestTimer("run_away", 10000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 3500, _deton, null); + 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); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null); break; } case "delete_daton": @@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "msg_12": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away_1", 8000, _deton, null); + startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 5000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null); break; } case "switch_quest": @@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance } case "end_instance": { - cancelQuestTimers("check_flower"); _count = 0; for (Npc n : world.getAliveNpcs()) { @@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance { 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); break; } if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) { _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); break; } @@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) { world.spawnGroup("last_deton"); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); - startQuestTimer("msg_12", 6000, _deton, null); - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); + startQuestTimer("msg_12", 6000, world.getNpc(DETON), null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.setStatus(11); } 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_archagel"); 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()) { - cancelQuestTimers("end_instance"); - cancelQuestTimers("check_flower"); + cancelQuestTimer("end_instance", world.getNpc(DETON), null); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.setStatus(4); World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> { if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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); - startQuestTimer("msg_7", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); + startQuestTimer("msg_7", 7000, world.getNpc(DETON), null); } break; } @@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance 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)); - startQuestTimer("msg_8", 3000, _deton, null); + startQuestTimer("msg_8", 3000, world.getNpc(DETON), null); world.setStatus(6); } break; @@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance _seal_device.setDisplayEffect(3); _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)); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); - startQuestTimer("msg_11", 3000, _deton, null); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); + startQuestTimer("msg_11", 3000, world.getNpc(DETON), null); break; } case SEALED_ANGEL: @@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) { world.setStatus(2); - _deton.setTarget(null); - _deton.stopMove(null); - startQuestTimer("msg_4", 7000, _deton, null); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(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.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); - startQuestTimer("end_instance", 190000, _deton, null); - startQuestTimer("spawn_stacato", 5000, _deton, null); + startQuestTimer("end_instance", 190000, world.getNpc(DETON), null); + startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null); } break; } @@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(0)) { - startQuestTimer("check_status", 21000, _deton, player); + startQuestTimer("check_status", 21000, world.getNpc(DETON), player); world.setStatus(1); } break; @@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance 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)); - _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); + 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, world.getNpc(DETON), player); world.setStatus(5); } break; @@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _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); + 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, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); - startQuestTimer("spawn_scarab", 7000, _deton, player); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); + startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance { switch (npc.getId()) { - case DETON: - { - _deton = npc; - break; - } case SEAL_DEVICE: { _seal_device = npc; @@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance } case FLAME_STACATO: { - startQuestTimer("check_flower", 3000, npc, null, true); + startQuestTimer("check_flower", 3000, npc, null); break; } case FLAME_SCORPION: diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 72d5e30e36..e53345de20 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -34,7 +34,7 @@ import instances.AbstractInstance; * Nornils Garden Instance * @URL https://l2wiki.com/Nornils_Garden * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs - * @author Gigi + * @author Gigi, Mobius * @date 2017-02-22 - [15:22:27] */ public class NornilsGarden extends AbstractInstance @@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200016, true); - cancelQuestTimers("stage2"); + cancelQuestTimer("stage2", npc, null); world.spawnGroup("wave_3"); } break; @@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200201, true); - cancelQuestTimers("stage3"); - cancelQuestTimers("check_agrro"); + cancelQuestTimer("stage3", npc, null); } break; } 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 -> { @@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); } }); + startQuestTimer("check_agrro", 1000, npc, null); } break; } @@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance { if (npc.getId() == BOZ_STAGE1) { - cancelQuestTimers("stage1_1"); + cancelQuestTimer("stage1_1", npc, null); world.openCloseDoor(16200015, true); world.setStatus(1); } @@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) { ((Attackable) npc).setCanReturnToSpawnPoint(false); - startQuestTimer("check_agrro", 1000, npc, null, true); + startQuestTimer("check_agrro", 1000, npc, null); } return super.onSpawn(npc); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java index 59a416f01e..15679fe90f 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java @@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - cancelQuestTimers("attack"); - cancelQuestTimers("random_Target"); + cancelQuestTimer("attack", npc, null); + cancelQuestTimer("random_Target", npc, null); return super.onKill(npc, killer, isSummon); } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java index fc11f466be..b85aad2397 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java @@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance { world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_1, false); - world.getParameters().set("TELEPORT_ACTIVE", true); + world.setParameter("TELEPORT_ACTIVE", true); npc.teleToLocation(BATTLE_LOC); playMovie(world, Movie.SC_OCTABIS_OPENING); getTimers().addTimer("START_STAGE_1", 26500, npc, null); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java index 5560b81d40..de7cc1efbf 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java @@ -252,7 +252,7 @@ public class AltarOfShilen extends AbstractInstance world.setStatus(7); onStatusChanged(world); npc.deleteMe(); - cancelQuestTimers("check_player"); + cancelQuestTimer("check_player", npc, null); } break; } diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java index 809462089e..ba07db28a2 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java @@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance } 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)) { captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java index c4431a7532..0f47b580e9 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java @@ -73,321 +73,373 @@ public class ChamberOfProphecies extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - if (event.equals("enterInstance")) + switch (event) { - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) + case "31639-01.html": + case "33996-01.html": + case "33980-01.html": + case "33980-02.html": { - enterInstance(player, npc, TEMPLATE_ID); - if (hasQuestItems(player, PROPHECY_MACHINE)) - { - takeItems(player, PROPHECY_MACHINE, 1); - } - qs.setCond(16, true); + htmltext = event; + break; } - } - else if (player != null) - { - final Instance world = player.getInstanceWorld(); - if (!isInInstance(world)) + case "33996-02.html": { - return null; + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.broadcastPacket(ExShowUsm.USM_Q015_E); + world.despawnGroup("q10753_16_instance_grail"); + world.spawnGroup("q10753_16_instance_wizard"); + giveItems(player, ATELIA, 1); + showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; } - - switch (event) + case "33980-03.html": { - case "31639-01.html": - case "33996-01.html": - case "33980-01.html": - case "33980-02.html": + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-04.html": + { + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-05.html": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; - break; + return null; } - case "33996-02.html": + world.spawnGroup("q10753_16_instance_halter_2"); + world.setStatus(6); + startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); + htmltext = event; + break; + } + case "enterInstance": + { + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) { - world.broadcastPacket(ExShowUsm.USM_Q015_E); - world.despawnGroup("q10753_16_instance_grail"); - world.spawnGroup("q10753_16_instance_wizard"); - giveItems(player, ATELIA, 1); - showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-03.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-04.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-05.html": - { - world.spawnGroup("q10753_16_instance_halter_2"); - world.setStatus(6); - startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); - htmltext = event; - break; - } - case "status": - { - if (world.isStatus(0)) + enterInstance(player, npc, TEMPLATE_ID); + if (hasQuestItems(player, PROPHECY_MACHINE)) { - htmltext = "31639-01.html"; + 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": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.isStatus(0)) + { + htmltext = "31639-01.html"; + break; + } + htmltext = "31639-02.html"; + break; + } + case "CHECK_STATUS": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + switch (world.getStatus()) + { + case 0: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); + startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); + startQuestTimer("OPEN_DOOR1", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); break; } - htmltext = "31639-02.html"; - 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": - { - switch (world.getStatus()) + case 1: { - case 0: + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); - startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); - startQuestTimer("OPEN_DOOR1", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 1: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.spawnGroup("wof_room2_1"); - world.setStatus(2); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 2: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); - startQuestTimer("OPEN_DOOR2", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 3: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(4); - world.spawnGroup("wof_room3_2"); - world.openCloseDoor(DOOR_3, false); - startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 4: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(5); - world.spawnGroup("wof_room4"); - startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); - startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); - } - else - { - startQuestTimer("CHECK_STATUS", 7000, npc, player); - } - break; + world.spawnGroup("wof_room2_1"); + world.setStatus(2); } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; } - break; - } - case "ATTACK": - case "ATTACK1": - case "ATTACK2": - { - npc.setRunning(); - ((Attackable) npc).setCanReturnToSpawnPoint(false); - if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) + case 2: { - npc.setTarget(player); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - addAttackDesire(npc, monster); - return; - }); + startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); + startQuestTimer("OPEN_DOOR2", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 3: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(4); + world.spawnGroup("wof_room3_2"); + world.openCloseDoor(DOOR_3, false); + startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 4: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(5); + world.spawnGroup("wof_room4"); + startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); + startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); + } + else + { + startQuestTimer("CHECK_STATUS", 7000, npc, player); + } + break; } - break; } - case "OPEN_DOOR1": + break; + } + case "ATTACK": + case "ATTACK1": + case "ATTACK2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - cancelQuestTimers("ATTACK"); - world.setStatus(1); - world.openCloseDoor(DOOR_2, true); - world.spawnGroup("wof_room2"); - break; + return null; } - case "OPEN_DOOR2": - { - cancelQuestTimers("ATTACK1"); - startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); - world.setStatus(3); - world.spawnGroup("wof_room3"); - world.openCloseDoor(DOOR_3, true); - break; - } - case "BROADCAST_TEXT": + npc.setRunning(); + ((Attackable) npc).setCanReturnToSpawnPoint(false); + if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) { npc.setTarget(player); - npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); - break; } - case "SEY2": + else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { - if (npc.getId() == FERIN) + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); - } - break; + addAttackDesire(npc, monster); + return; + }); } - case "SEY_KAIN": + break; + } + case "OPEN_DOOR1": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == VAN_HALTER) - { - startQuestTimer("ATTACK1", 200, npc, player, true); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY3": + cancelQuestTimer("ATTACK", npc, player); + world.setStatus(1); + world.openCloseDoor(DOOR_2, true); + world.spawnGroup("wof_room2"); + break; + } + case "OPEN_DOOR2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY_KAIN_1": + cancelQuestTimer("ATTACK1", npc, player); + startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); + world.setStatus(3); + world.spawnGroup("wof_room3"); + world.openCloseDoor(DOOR_3, true); + break; + } + case "BROADCAST_TEXT": + { + npc.setTarget(player); + npc.setRunning(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); + break; + } + case "SEY2": + { + if (npc.getId() == FERIN) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_2": + break; + } + case "SEY_KAIN": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); - startQuestTimer("SEY_KAIN_3", 7000, npc, player); - } - break; + startQuestTimer("ATTACK1", 200, npc, player, true); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); } - case "SEY4": + break; + } + case "SEY3": + { + if (npc.getId() == FERIN) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); - startQuestTimer("REST", 5000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_3": + break; + } + case "SEY_KAIN_1": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); - startQuestTimer("SEY_KAIN_4", 1000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); } - case "REST": + break; + } + case "SEY_KAIN_2": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == FERIN) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); - cancelQuestTimers("BROADCAST_TEXT"); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); + startQuestTimer("SEY_KAIN_3", 7000, npc, player); } - case "SEY_KAIN_4": + break; + } + case "SEY4": + { + if (npc.getId() == FERIN) { - world.setStatus(5); - world.spawnGroup("q10753_16_instance_grail"); - showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); - world.openCloseDoor(DOOR_4, true); - cancelQuestTimers("ATTACK2"); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); - startQuestTimer("CLOSE", 15000, null, player); - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); + startQuestTimer("REST", 5000, npc, player); + npc.setScriptValue(1); } - case "CLOSE": + break; + } + case "SEY_KAIN_3": + { + if (npc.getId() == VAN_HALTER) { - final Npc grail = world.getNpc(GRAIL); - if ((grail != null) && (player.calculateDistance2D(grail) < 390)) - { - world.openCloseDoor(DOOR_4, false); - world.despawnGroup("q10753_16_instance_halter_1_1"); - world.despawnGroup("wof_room4"); - } - else - { - startQuestTimer("CLOSE", 3000, npc, player); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); + startQuestTimer("SEY_KAIN_4", 1000, npc, player); + npc.setScriptValue(1); } - case "DESPAWN_WIZARD": + break; + } + case "REST": + { + if (npc.getId() == FERIN) { - world.despawnGroup("q10753_16_instance_wizard"); - break; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); + cancelQuestTimer("BROADCAST_TEXT", npc, player); } - case "exit": + break; + } + case "SEY_KAIN_4": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - 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)); - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) - { - qs.setCond(17, true); - } - break; + return null; } - case "finish": + world.setStatus(5); + world.spawnGroup("q10753_16_instance_grail"); + showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); + world.openCloseDoor(DOOR_4, true); + cancelQuestTimer("ATTACK2", npc, player); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); + startQuestTimer("CLOSE", 15000, null, player); + break; + } + case "CLOSE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - world.finishInstance(0); - break; + return null; } + final Npc grail = world.getNpc(GRAIL); + if ((grail != null) && (player.calculateDistance2D(grail) < 390)) + { + world.openCloseDoor(DOOR_4, false); + world.despawnGroup("q10753_16_instance_halter_1_1"); + world.despawnGroup("wof_room4"); + } + else + { + startQuestTimer("CLOSE", 3000, npc, player); + } + break; + } + case "DESPAWN_WIZARD": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.despawnGroup("q10753_16_instance_wizard"); + break; + } + case "exit": + { + 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(1)); + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) + { + qs.setCond(17, true); + } + break; + } + case "finish": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.finishInstance(0); + break; } } return htmltext; diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java index a1077a8e4d..263d5e3991 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java @@ -17,10 +17,8 @@ package instances.DimensionalWrap; import java.util.List; -import java.util.concurrent.ScheduledFuture; import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.enums.CategoryType; @@ -44,7 +42,7 @@ import instances.AbstractInstance; * Dimensional Wrap instance * @URL https://l2wiki.com/Dimensional_Warp * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg - * @author Gigi + * @author Gigi, Mobius * @date 2018-09-04 - [14:33:31] */ public class DimensionalWrap extends AbstractInstance @@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance 23480, // Abyssal Harpy 23481, // Abyssal Binder 23482, // Abyssal Archon - 23483 // Abyssal Golem + 23483, // Abyssal Golem }; private static final int[] TRAPS = { @@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance 19559, // Damage trap, power 1 19560, // Damage trap, power 2 19561, // Damage trap, power 3 - 19562 // Heal Trap + 19562, // Heal Trap }; // Location 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 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); // Misc private static final int TEMPLATE_ID = 250; private static final int DIMENSIONAL_DARK_FORCES = 16415; 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() { @@ -125,429 +118,534 @@ public class DimensionalWrap extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - final Instance world = npc.getInstanceWorld(); - if (event.equals("enterInstance")) + + switch (event) { - if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + case "enterInstance": { - htmltext = "no_awakened.html"; + if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + htmltext = "no_awakened.html"; + } + else if (!player.isInParty()) + { + enterInstance(player, npc, TEMPLATE_ID); + } + else if (player.isInParty()) + { + if (!player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + } + else + { + final Party party = player.getParty(); + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) + { + enterInstance(member, npc, TEMPLATE_ID); + } + } + } + } + break; } - else if (!player.isInParty()) + case "33975-01.html": { - enterInstance(player, npc, TEMPLATE_ID); + htmltext = event; + break; } - else if (player.isInParty()) + case "12_warp_crystals": { - if (!player.getParty().isLeader(player)) + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.3); + if (!player.isInParty()) + { + world.setParameter("count", 12); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; } - else + switch (player.getParty().getMemberCount()) { - final Party party = player.getParty(); - final List members = party.getMembers(); - for (PlayerInstance member : members) + case 2: { - if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) - { - enterInstance(member, npc, TEMPLATE_ID); - } + world.setParameter("count", 6); + checkCrystallCount(world, npc); + break; + } + case 3: + { + world.setParameter("count", 4); + checkCrystallCount(world, npc); + break; + } + case 4: + { + world.setParameter("count", 3); + checkCrystallCount(world, npc); + break; } } + break; } - } - if (isInInstance(world)) - { - switch (event) + case "240_warp_crystals": { - case "33975-01.html": + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; + return null; + } + + world.setParameter("chance", 0.6); + if (!player.isInParty()) + { + world.setParameter("count", 240); + checkCrystallCount(world, npc); break; } - case "12_warp_crystals": + else if (player.isInParty() && !player.getParty().isLeader(player)) { - _chance = 0.3; - if (!player.isInParty()) + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - _count = 12; + world.setParameter("count", 120); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 3: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 6; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 4; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 3; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "240_warp_crystals": - { - _chance = 0.6; - if (!player.isInParty()) - { - _count = 240; + world.setParameter("count", 80); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 4: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 120; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 80; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 60; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "1200_warp_crystals": - { - _chance = 0.9; - if (!player.isInParty()) - { - _count = 1200; + world.setParameter("count", 60); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + } + break; + } + case "1200_warp_crystals": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.9); + if (!player.isInParty()) + { + world.setParameter("count", 1200); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 600); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 3: { - case 2: - { - _count = 600; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 400; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 300; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "send_6_f": - { - if (_worldState == 0) - { - htmltext = "33975-02.html"; + world.setParameter("count", 400); + checkCrystallCount(world, npc); break; } - if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + case 4: { - htmltext = "33975-05.html"; + world.setParameter("count", 300); + checkCrystallCount(world, npc); break; } - - for (Npc n : world.getAliveNpcs()) + } + break; + } + case "send_6_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) + n.deleteMe(); + } + } + if (world.getStatus() < 5) + { + world.setStatus(5); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_11_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 10) + { + world.setStatus(10); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_16_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 15) + { + world.setStatus(15); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_21_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 20) + { + world.setStatus(20); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(TELEPORTS, world.getTemplateId()); + } + break; + } + case "send_26_f": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 25) + { + world.setStatus(25); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); + } + break; + } + case "jump_location": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + player.teleToLocation(TELEPORTS, world.getTemplateId()); + break; + } + case "SALAMANDRA_SPAWN": + case "SALAMANDRA_SPAWN_DUMMY": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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(); + World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> + { + if ((p != null) && !p.isDead()) { - n.deleteMe(); + addAttackPlayerDesire(salamandra, p); } - } - if (world.getStatus() < 5) - { - world.setStatus(5); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); - } - break; + }); } - case "send_11_f": + break; + } + case "START_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 10) - { - world.setStatus(10); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_16_f": + world.setStatus(world.getStatus() + 1); + world.setParameter("worldState", world.getStatus()); + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); + startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer()); + break; + } + case "FIRST_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 15) - { - world.setStatus(15); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_21_f": + final int worldState = world.getParameters().getInt("worldState", 0); + world.spawnGroup(worldState + "_first_spawn"); + world.spawnGroup(worldState + "_trap_spawn"); + startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer()); + startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true); + break; + } + case "DEBUFF_TASK": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 20) - { - world.setStatus(20); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(TELEPORTS, world.getTemplateId()); - } - break; + return null; } - case "send_26_f": + int skilllevel = 1; + final int worldState = world.getParameters().getInt("worldState", 0); + if ((worldState > 0) && (worldState <= 11)) { - if (_worldState == 0) + 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()) + { + if ((p != null) && !p.isDead()) { - htmltext = "33975-02.html"; - break; + skill.applyEffects(p, p); } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + } + break; + } + case "SECOND_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn"); + startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer()); + break; + } + case "THIRD_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn"); + break; + } + case "CHANGE_LOCATION": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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; + } + case "SWITCH_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.getAliveNpcs(MONSTERS).isEmpty()) + { + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); + world.broadcastPacket(new Earthquake(npc, 50, 5)); + world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true); + clean(world.getFirstPlayer()); + if (world.getParameters().getInt("worldState", 0) < 35) { - htmltext = "33975-05.html"; - break; + startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer()); } - for (Npc n : world.getAliveNpcs()) + } + break; + } + 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.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); + startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer()); + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } + n.deleteMe(); } - if (world.getStatus() < 25) - { - world.setStatus(25); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); - } - break; - } - case "jump_location": - { - player.teleToLocation(TELEPORTS, world.getTemplateId()); - break; - } - case "SALAMANDRA_SPAWN": - case "SALAMANDRA_SPAWN_DUMMY": - { - if (getRandom(100) < (_worldState / 2)) - { - final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); - salamandra.setRunning(); - World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> - { - if ((p != null) && !p.isDead()) - { - addAttackPlayerDesire(salamandra, p); - } - }); - } - break; - } - case "START_STAGE": - { - world.setStatus(world.getStatus() + 1); - _worldState = 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); - break; - } - case "FIRST_SPAWN": - { - world.spawnGroup(_worldState + "_first_spawn"); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("SECOND_SPAWN", 40000, npc, null); - _debufTask = ThreadPool.scheduleAtFixedRate(() -> - { - 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()) - { - if ((p != null) && !p.isDead()) - { - skill.applyEffects(p, p); - } - } - }, 5000, 10000); - break; - } - case "SECOND_SPAWN": - { - world.spawnGroup(_worldState + "_second_spawn"); - startQuestTimer("THRID_SPAWN", 40000, npc, null); - break; - } - case "THRID_SPAWN": - { - world.spawnGroup(_worldState + "_thred_spawn"); - break; - } - case "CHANGE_LOCATION": - { - world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); - break; - } - case "SWITCH_STAGE": - { - if (world.getAliveNpcs(MONSTERS).isEmpty()) - { - world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); - world.broadcastPacket(new Earthquake(npc, 50, 5)); - world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); - clean(); - if (_worldState < 35) - { - startQuestTimer("NEXT_STAGE", 5000, npc, null); - } - } - break; - } - case "NEXT_STAGE": - { - 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)); - startQuestTimer("START_STAGE", 8000, npc, null); - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - break; } + break; } } return htmltext; @@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance final Instance world = npc.getInstanceWorld(); 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()); 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()); 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()); 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.finishInstance(3); - clean(); + clean(world.getFirstPlayer()); } } return super.onKill(npc, killer, isSummon); @@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance @Override 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"; } @@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance { case SALAMANDRA_GENERATOR: { - startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); + startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true); + startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer()); break; } case SALAMANDRA_GENERATOR_DUMMY: { - startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); + startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true); break; } case DEMINSIONAL_INVISIBLE_FRAGMENT: { - startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); + startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true); break; } } @@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance boolean canStart = true; 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()) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); 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(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); canStart = false; } } } - if (!canStart || (_worldState != 0)) + if (!canStart || (world.getParameters().getInt("worldState", 0) != 0)) { return; } - startQuestTimer("START_STAGE", 1000, npc, null); + startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer()); 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"); - cancelQuestTimers("SALAMANDRA_SPAWN"); - cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); - cancelQuestTimers("CHANGE_LOCATION"); - if (_debufTask != null) - { - _debufTask.cancel(false); - _debufTask = null; - } + cancelQuestTimer("SWITCH_STAGE", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player); + cancelQuestTimer("CHANGE_LOCATION", null, player); + cancelQuestTimer("DEBUFF_TASK", null, player); } public static void main(String[] args) diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java index c44c3a56c4..d0f7507655 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java @@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti; /** * Mystic Tavern Tauti Instance * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk - * @author Gigi + * @author Gigi, Mobius */ 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 int ZONE_1ST_TRIGER = 24137770; private static final int SKILL_TRIGER = 24138880; - private static Npc _deton; private static Npc _seal_device; protected int _count = 0; public StoryOfTauti() { 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); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); @@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(1) || world.isStatus(4)) { - _deton.setTarget(player); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + world.getNpc(DETON).setTarget(player); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } else { @@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance } 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 -> { if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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; } case "msg_1": { - _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); + 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, world.getNpc(DETON), null); break; } case "msg_2": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); - startQuestTimer("msg_3", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); + startQuestTimer("msg_3", 10000, world.getNpc(DETON), null); break; } 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; } case "msg_4": { - _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); - startQuestTimer("msg_5", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); + startQuestTimer("msg_5", 7000, world.getNpc(DETON), null); break; } case "msg_5": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_stacato": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_1", 50000, _deton, null); + startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_1": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_2", 50000, _deton, null); + startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_2": @@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance } case "check_flower": { - if (!npc.isDead()) + if ((world != null) && !npc.isDead()) { for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) { if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) { - _deton.setRunning(); + world.getNpc(DETON).setRunning(); addMoveToDesire(npc, nearby.getLocation(), 23); if (npc.calculateDistance3D(nearby) < 100) { @@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance } } } + startQuestTimer("check_flower", 3000, npc, null); } break; } @@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "spawn_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) { world.spawnGroup("ifrit"); @@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance { 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); addAttackPlayerDesire(npc, pl); } @@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance } case "msg_8": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); - startQuestTimer("msg_9", 8000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); + startQuestTimer("msg_9", 8000, world.getNpc(DETON), null); break; } case "msg_9": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); - startQuestTimer("msg_10", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); + startQuestTimer("msg_10", 10000, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away", 10000, _deton, null); + startQuestTimer("run_away", 10000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 3500, _deton, null); + 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); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null); break; } case "delete_daton": @@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "msg_12": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away_1", 8000, _deton, null); + startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 5000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null); break; } case "switch_quest": @@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance } case "end_instance": { - cancelQuestTimers("check_flower"); _count = 0; for (Npc n : world.getAliveNpcs()) { @@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance { 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); break; } if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) { _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); break; } @@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) { world.spawnGroup("last_deton"); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); - startQuestTimer("msg_12", 6000, _deton, null); - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); + startQuestTimer("msg_12", 6000, world.getNpc(DETON), null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.setStatus(11); } 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_archagel"); 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()) { - cancelQuestTimers("end_instance"); - cancelQuestTimers("check_flower"); + cancelQuestTimer("end_instance", world.getNpc(DETON), null); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.setStatus(4); World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> { if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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); - startQuestTimer("msg_7", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); + startQuestTimer("msg_7", 7000, world.getNpc(DETON), null); } break; } @@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance 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)); - startQuestTimer("msg_8", 3000, _deton, null); + startQuestTimer("msg_8", 3000, world.getNpc(DETON), null); world.setStatus(6); } break; @@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance _seal_device.setDisplayEffect(3); _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)); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); - startQuestTimer("msg_11", 3000, _deton, null); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); + startQuestTimer("msg_11", 3000, world.getNpc(DETON), null); break; } case SEALED_ANGEL: @@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) { world.setStatus(2); - _deton.setTarget(null); - _deton.stopMove(null); - startQuestTimer("msg_4", 7000, _deton, null); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(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.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); - startQuestTimer("end_instance", 190000, _deton, null); - startQuestTimer("spawn_stacato", 5000, _deton, null); + startQuestTimer("end_instance", 190000, world.getNpc(DETON), null); + startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null); } break; } @@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(0)) { - startQuestTimer("check_status", 21000, _deton, player); + startQuestTimer("check_status", 21000, world.getNpc(DETON), player); world.setStatus(1); } break; @@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance 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)); - _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); + 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, world.getNpc(DETON), player); world.setStatus(5); } break; @@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _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); + 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, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); - startQuestTimer("spawn_scarab", 7000, _deton, player); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); + startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance { switch (npc.getId()) { - case DETON: - { - _deton = npc; - break; - } case SEAL_DEVICE: { _seal_device = npc; @@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance } case FLAME_STACATO: { - startQuestTimer("check_flower", 3000, npc, null, true); + startQuestTimer("check_flower", 3000, npc, null); break; } case FLAME_SCORPION: diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 72d5e30e36..e53345de20 100644 --- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -34,7 +34,7 @@ import instances.AbstractInstance; * Nornils Garden Instance * @URL https://l2wiki.com/Nornils_Garden * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs - * @author Gigi + * @author Gigi, Mobius * @date 2017-02-22 - [15:22:27] */ public class NornilsGarden extends AbstractInstance @@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200016, true); - cancelQuestTimers("stage2"); + cancelQuestTimer("stage2", npc, null); world.spawnGroup("wave_3"); } break; @@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200201, true); - cancelQuestTimers("stage3"); - cancelQuestTimers("check_agrro"); + cancelQuestTimer("stage3", npc, null); } break; } 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 -> { @@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); } }); + startQuestTimer("check_agrro", 1000, npc, null); } break; } @@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance { if (npc.getId() == BOZ_STAGE1) { - cancelQuestTimers("stage1_1"); + cancelQuestTimer("stage1_1", npc, null); world.openCloseDoor(16200015, true); world.setStatus(1); } @@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) { ((Attackable) npc).setCanReturnToSpawnPoint(false); - startQuestTimer("check_agrro", 1000, npc, null, true); + startQuestTimer("check_agrro", 1000, npc, null); } return super.onSpawn(npc); } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java index 59a416f01e..15679fe90f 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java @@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - cancelQuestTimers("attack"); - cancelQuestTimers("random_Target"); + cancelQuestTimer("attack", npc, null); + cancelQuestTimer("random_Target", npc, null); return super.onKill(npc, killer, isSummon); } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java index fc11f466be..b85aad2397 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java @@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance { world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_1, false); - world.getParameters().set("TELEPORT_ACTIVE", true); + world.setParameter("TELEPORT_ACTIVE", true); npc.teleToLocation(BATTLE_LOC); playMovie(world, Movie.SC_OCTABIS_OPENING); getTimers().addTimer("START_STAGE_1", 26500, npc, null); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java index 5560b81d40..de7cc1efbf 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java @@ -252,7 +252,7 @@ public class AltarOfShilen extends AbstractInstance world.setStatus(7); onStatusChanged(world); npc.deleteMe(); - cancelQuestTimers("check_player"); + cancelQuestTimer("check_player", npc, null); } break; } diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java index 809462089e..ba07db28a2 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java @@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance } 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)) { captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java index b1f3aaf196..403b3b4204 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java @@ -73,321 +73,373 @@ public class ChamberOfProphecies extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - if (event.equals("enterInstance")) + switch (event) { - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) + case "31639-01.html": + case "33996-01.html": + case "33980-01.html": + case "33980-02.html": { - enterInstance(player, npc, TEMPLATE_ID); - if (hasQuestItems(player, PROPHECY_MACHINE)) - { - takeItems(player, PROPHECY_MACHINE, 1); - } - qs.setCond(16, true); + htmltext = event; + break; } - } - else if (player != null) - { - final Instance world = player.getInstanceWorld(); - if (!isInInstance(world)) + case "33996-02.html": { - return null; + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.broadcastPacket(ExShowUsm.USM_Q015_E); + world.despawnGroup("q10753_16_instance_grail"); + world.spawnGroup("q10753_16_instance_wizard"); + giveItems(player, ATELIA, 1); + showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; } - - switch (event) + case "33980-03.html": { - case "31639-01.html": - case "33996-01.html": - case "33980-01.html": - case "33980-02.html": + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-04.html": + { + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-05.html": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; - break; + return null; } - case "33996-02.html": + world.spawnGroup("q10753_16_instance_halter_2"); + world.setStatus(6); + startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); + htmltext = event; + break; + } + case "enterInstance": + { + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) { - world.broadcastPacket(ExShowUsm.USM_Q015_E); - world.despawnGroup("q10753_16_instance_grail"); - world.spawnGroup("q10753_16_instance_wizard"); - giveItems(player, ATELIA, 1); - showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-03.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-04.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-05.html": - { - world.spawnGroup("q10753_16_instance_halter_2"); - world.setStatus(6); - startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); - htmltext = event; - break; - } - case "status": - { - if (world.isStatus(0)) + enterInstance(player, npc, TEMPLATE_ID); + if (hasQuestItems(player, PROPHECY_MACHINE)) { - htmltext = "31639-01.html"; + 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": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.isStatus(0)) + { + htmltext = "31639-01.html"; + break; + } + htmltext = "31639-02.html"; + break; + } + case "CHECK_STATUS": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + switch (world.getStatus()) + { + case 0: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); + startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); + startQuestTimer("OPEN_DOOR1", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); break; } - htmltext = "31639-02.html"; - 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": - { - switch (world.getStatus()) + case 1: { - case 0: + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); - startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); - startQuestTimer("OPEN_DOOR1", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 1: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.spawnGroup("wof_room2_1"); - world.setStatus(2); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 2: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); - startQuestTimer("OPEN_DOOR2", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 3: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(4); - world.spawnGroup("wof_room3_2"); - world.openCloseDoor(DOOR_3, false); - startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 4: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(5); - world.spawnGroup("wof_room4"); - startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); - startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); - } - else - { - startQuestTimer("CHECK_STATUS", 7000, npc, player); - } - break; + world.spawnGroup("wof_room2_1"); + world.setStatus(2); } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; } - break; - } - case "ATTACK": - case "ATTACK1": - case "ATTACK2": - { - npc.setRunning(); - ((Attackable) npc).setCanReturnToSpawnPoint(false); - if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) + case 2: { - npc.setTarget(player); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - addAttackDesire(npc, monster); - return; - }); + startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); + startQuestTimer("OPEN_DOOR2", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 3: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(4); + world.spawnGroup("wof_room3_2"); + world.openCloseDoor(DOOR_3, false); + startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 4: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(5); + world.spawnGroup("wof_room4"); + startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); + startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); + } + else + { + startQuestTimer("CHECK_STATUS", 7000, npc, player); + } + break; } - break; } - case "OPEN_DOOR1": + break; + } + case "ATTACK": + case "ATTACK1": + case "ATTACK2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - cancelQuestTimers("ATTACK"); - world.setStatus(1); - world.openCloseDoor(DOOR_2, true); - world.spawnGroup("wof_room2"); - break; + return null; } - case "OPEN_DOOR2": - { - cancelQuestTimers("ATTACK1"); - startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); - world.setStatus(3); - world.spawnGroup("wof_room3"); - world.openCloseDoor(DOOR_3, true); - break; - } - case "BROADCAST_TEXT": + npc.setRunning(); + ((Attackable) npc).setCanReturnToSpawnPoint(false); + if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) { npc.setTarget(player); - npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); - break; } - case "SEY2": + else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { - if (npc.getId() == FERIN) + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); - } - break; + addAttackDesire(npc, monster); + return; + }); } - case "SEY_KAIN": + break; + } + case "OPEN_DOOR1": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == VAN_HALTER) - { - startQuestTimer("ATTACK1", 200, npc, player, true); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY3": + cancelQuestTimer("ATTACK", npc, player); + world.setStatus(1); + world.openCloseDoor(DOOR_2, true); + world.spawnGroup("wof_room2"); + break; + } + case "OPEN_DOOR2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY_KAIN_1": + cancelQuestTimer("ATTACK1", npc, player); + startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); + world.setStatus(3); + world.spawnGroup("wof_room3"); + world.openCloseDoor(DOOR_3, true); + break; + } + case "BROADCAST_TEXT": + { + npc.setTarget(player); + npc.setRunning(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); + break; + } + case "SEY2": + { + if (npc.getId() == FERIN) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_2": + break; + } + case "SEY_KAIN": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); - startQuestTimer("SEY_KAIN_3", 7000, npc, player); - } - break; + startQuestTimer("ATTACK1", 200, npc, player, true); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); } - case "SEY4": + break; + } + case "SEY3": + { + if (npc.getId() == FERIN) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); - startQuestTimer("REST", 5000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_3": + break; + } + case "SEY_KAIN_1": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); - startQuestTimer("SEY_KAIN_4", 1000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); } - case "REST": + break; + } + case "SEY_KAIN_2": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == FERIN) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); - cancelQuestTimers("BROADCAST_TEXT"); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); + startQuestTimer("SEY_KAIN_3", 7000, npc, player); } - case "SEY_KAIN_4": + break; + } + case "SEY4": + { + if (npc.getId() == FERIN) { - world.setStatus(5); - world.spawnGroup("q10753_16_instance_grail"); - showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); - world.openCloseDoor(DOOR_4, true); - cancelQuestTimers("ATTACK2"); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); - startQuestTimer("CLOSE", 15000, null, player); - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); + startQuestTimer("REST", 5000, npc, player); + npc.setScriptValue(1); } - case "CLOSE": + break; + } + case "SEY_KAIN_3": + { + if (npc.getId() == VAN_HALTER) { - final Npc grail = world.getNpc(GRAIL); - if ((grail != null) && (player.calculateDistance2D(grail) < 390)) - { - world.openCloseDoor(DOOR_4, false); - world.despawnGroup("q10753_16_instance_halter_1_1"); - world.despawnGroup("wof_room4"); - } - else - { - startQuestTimer("CLOSE", 3000, npc, player); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); + startQuestTimer("SEY_KAIN_4", 1000, npc, player); + npc.setScriptValue(1); } - case "DESPAWN_WIZARD": + break; + } + case "REST": + { + if (npc.getId() == FERIN) { - world.despawnGroup("q10753_16_instance_wizard"); - break; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); + cancelQuestTimer("BROADCAST_TEXT", npc, player); } - case "exit": + break; + } + case "SEY_KAIN_4": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - 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)); - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) - { - qs.setCond(17, true); - } - break; + return null; } - case "finish": + world.setStatus(5); + world.spawnGroup("q10753_16_instance_grail"); + showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); + world.openCloseDoor(DOOR_4, true); + cancelQuestTimer("ATTACK2", npc, player); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); + startQuestTimer("CLOSE", 15000, null, player); + break; + } + case "CLOSE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - world.finishInstance(0); - break; + return null; } + final Npc grail = world.getNpc(GRAIL); + if ((grail != null) && (player.calculateDistance2D(grail) < 390)) + { + world.openCloseDoor(DOOR_4, false); + world.despawnGroup("q10753_16_instance_halter_1_1"); + world.despawnGroup("wof_room4"); + } + else + { + startQuestTimer("CLOSE", 3000, npc, player); + } + break; + } + case "DESPAWN_WIZARD": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.despawnGroup("q10753_16_instance_wizard"); + break; + } + case "exit": + { + 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(1)); + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) + { + qs.setCond(17, true); + } + break; + } + case "finish": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.finishInstance(0); + break; } } return htmltext; diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java index d755f1c55b..4d1cd6c982 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java @@ -17,10 +17,8 @@ package instances.DimensionalWrap; import java.util.List; -import java.util.concurrent.ScheduledFuture; import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.enums.CategoryType; @@ -44,7 +42,7 @@ import instances.AbstractInstance; * Dimensional Wrap instance * @URL https://l2wiki.com/Dimensional_Warp * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg - * @author Gigi + * @author Gigi, Mobius * @date 2018-09-04 - [14:33:31] */ public class DimensionalWrap extends AbstractInstance @@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance 23480, // Abyssal Harpy 23481, // Abyssal Binder 23482, // Abyssal Archon - 23483 // Abyssal Golem + 23483, // Abyssal Golem }; private static final int[] TRAPS = { @@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance 19559, // Damage trap, power 1 19560, // Damage trap, power 2 19561, // Damage trap, power 3 - 19562 // Heal Trap + 19562, // Heal Trap }; // Location 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 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); // Misc private static final int TEMPLATE_ID = 250; private static final int DIMENSIONAL_DARK_FORCES = 16415; 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() { @@ -125,429 +118,534 @@ public class DimensionalWrap extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - final Instance world = npc.getInstanceWorld(); - if (event.equals("enterInstance")) + + switch (event) { - if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + case "enterInstance": { - htmltext = "no_awakened.html"; + if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + htmltext = "no_awakened.html"; + } + else if (!player.isInParty()) + { + enterInstance(player, npc, TEMPLATE_ID); + } + else if (player.isInParty()) + { + if (!player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + } + else + { + final Party party = player.getParty(); + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) + { + enterInstance(member, npc, TEMPLATE_ID); + } + } + } + } + break; } - else if (!player.isInParty()) + case "33975-01.html": { - enterInstance(player, npc, TEMPLATE_ID); + htmltext = event; + break; } - else if (player.isInParty()) + case "12_warp_crystals": { - if (!player.getParty().isLeader(player)) + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.3); + if (!player.isInParty()) + { + world.setParameter("count", 12); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; } - else + switch (player.getParty().getMemberCount()) { - final Party party = player.getParty(); - final List members = party.getMembers(); - for (PlayerInstance member : members) + case 2: { - if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) - { - enterInstance(member, npc, TEMPLATE_ID); - } + world.setParameter("count", 6); + checkCrystallCount(world, npc); + break; + } + case 3: + { + world.setParameter("count", 4); + checkCrystallCount(world, npc); + break; + } + case 4: + { + world.setParameter("count", 3); + checkCrystallCount(world, npc); + break; } } + break; } - } - if (isInInstance(world)) - { - switch (event) + case "240_warp_crystals": { - case "33975-01.html": + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; + return null; + } + + world.setParameter("chance", 0.6); + if (!player.isInParty()) + { + world.setParameter("count", 240); + checkCrystallCount(world, npc); break; } - case "12_warp_crystals": + else if (player.isInParty() && !player.getParty().isLeader(player)) { - _chance = 0.3; - if (!player.isInParty()) + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - _count = 12; - CheckCrystallCount(world, player, npc); + world.setParameter("count", 120); + checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 3: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 80); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 4: { - case 2: - { - _count = 6; - CheckCrystallCount(world, player, npc); - break; - } - case 3: - { - _count = 4; - CheckCrystallCount(world, player, npc); - break; - } - case 4: - { - _count = 3; - CheckCrystallCount(world, player, npc); - break; - } - } - break; - } - case "240_warp_crystals": - { - _chance = 0.6; - if (!player.isInParty()) - { - _count = 240; - CheckCrystallCount(world, player, npc); + world.setParameter("count", 60); + checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + } + break; + } + case "1200_warp_crystals": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.9); + if (!player.isInParty()) + { + world.setParameter("count", 1200); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 600); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 3: { - case 2: - { - _count = 120; - CheckCrystallCount(world, player, npc); - break; - } - case 3: - { - _count = 80; - CheckCrystallCount(world, player, npc); - break; - } - case 4: - { - _count = 60; - CheckCrystallCount(world, player, npc); - break; - } - } - break; - } - case "1200_warp_crystals": - { - _chance = 0.9; - if (!player.isInParty()) - { - _count = 1200; - CheckCrystallCount(world, player, npc); + world.setParameter("count", 400); + checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 4: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 300); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 600; - CheckCrystallCount(world, player, npc); - break; - } - case 3: - { - _count = 400; - CheckCrystallCount(world, player, npc); - break; - } - case 4: - { - _count = 300; - CheckCrystallCount(world, player, npc); - break; - } - } - break; } - case "send_6_f": + break; + } + case "send_6_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - htmltext = "33975-02.html"; - break; + n.deleteMe(); } - if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + } + if (world.getStatus() < 5) + { + world.setStatus(5); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_11_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - htmltext = "33975-05.html"; - break; + n.deleteMe(); } - - for (Npc n : world.getAliveNpcs()) + } + if (world.getStatus() < 10) + { + world.setStatus(10); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_16_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) + n.deleteMe(); + } + } + if (world.getStatus() < 15) + { + world.setStatus(15); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_21_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 20) + { + world.setStatus(20); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(TELEPORTS, world.getTemplateId()); + } + break; + } + case "send_26_f": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 25) + { + world.setStatus(25); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); + } + break; + } + case "jump_location": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + player.teleToLocation(TELEPORTS, world.getTemplateId()); + break; + } + case "SALAMANDRA_SPAWN": + case "SALAMANDRA_SPAWN_DUMMY": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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(); + World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> + { + if ((p != null) && !p.isDead()) { - n.deleteMe(); + addAttackPlayerDesire(salamandra, p); } - } - if (world.getStatus() < 5) - { - world.setStatus(5); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); - } - break; + }); } - case "send_11_f": + break; + } + case "START_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 10) - { - world.setStatus(10); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_16_f": + world.setStatus(world.getStatus() + 1); + world.setParameter("worldState", world.getStatus()); + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); + startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer()); + break; + } + case "FIRST_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 15) - { - world.setStatus(15); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_21_f": + final int worldState = world.getParameters().getInt("worldState", 0); + world.spawnGroup(worldState + "_first_spawn"); + world.spawnGroup(worldState + "_trap_spawn"); + startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer()); + startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true); + break; + } + case "DEBUFF_TASK": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 20) - { - world.setStatus(20); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(TELEPORTS, world.getTemplateId()); - } - break; + return null; } - case "send_26_f": + int skilllevel = 1; + final int worldState = world.getParameters().getInt("worldState", 0); + if ((worldState > 0) && (worldState <= 11)) { - if (_worldState == 0) + 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()) + { + if ((p != null) && !p.isDead()) { - htmltext = "33975-02.html"; - break; + skill.applyEffects(p, p); } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + } + break; + } + case "SECOND_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn"); + startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer()); + break; + } + case "THIRD_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn"); + break; + } + case "CHANGE_LOCATION": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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; + } + case "SWITCH_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.getAliveNpcs(MONSTERS).isEmpty()) + { + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); + world.broadcastPacket(new Earthquake(npc, 50, 5)); + world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true); + clean(world.getFirstPlayer()); + if (world.getParameters().getInt("worldState", 0) < 35) { - htmltext = "33975-05.html"; - break; + startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer()); } - for (Npc n : world.getAliveNpcs()) + } + break; + } + 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.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); + startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer()); + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } + n.deleteMe(); } - if (world.getStatus() < 25) - { - world.setStatus(25); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); - } - break; - } - case "jump_location": - { - player.teleToLocation(TELEPORTS, world.getTemplateId()); - break; - } - case "SALAMANDRA_SPAWN": - case "SALAMANDRA_SPAWN_DUMMY": - { - if (getRandom(100) < (_worldState / 2)) - { - final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); - salamandra.setRunning(); - World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> - { - if ((p != null) && !p.isDead()) - { - addAttackPlayerDesire(salamandra, p); - } - }); - } - break; - } - case "START_STAGE": - { - world.setStatus(world.getStatus() + 1); - _worldState = 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); - break; - } - case "FIRST_SPAWN": - { - world.spawnGroup(_worldState + "_first_spawn"); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("SECOND_SPAWN", 40000, npc, null); - _debufTask = ThreadPool.scheduleAtFixedRate(() -> - { - 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()) - { - if ((p != null) && !p.isDead()) - { - skill.applyEffects(p, p); - } - } - }, 5000, 10000); - break; - } - case "SECOND_SPAWN": - { - world.spawnGroup(_worldState + "_second_spawn"); - startQuestTimer("THRID_SPAWN", 40000, npc, null); - break; - } - case "THRID_SPAWN": - { - world.spawnGroup(_worldState + "_thred_spawn"); - break; - } - case "CHANGE_LOCATION": - { - world.getAliveNpcs(TRAPS).forEach(t -> t.deleteMe()); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); - break; - } - case "SWITCH_STAGE": - { - if (world.getAliveNpcs(MONSTERS).isEmpty()) - { - world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); - world.broadcastPacket(new Earthquake(npc, 50, 5)); - world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); - Clean(); - if (_worldState < 35) - { - startQuestTimer("NEXT_STAGE", 5000, npc, null); - } - } - break; - } - case "NEXT_STAGE": - { - 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)); - startQuestTimer("START_STAGE", 8000, npc, null); - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - break; } + break; } } return htmltext; @@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance final Instance world = npc.getInstanceWorld(); 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()); 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()); 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()); 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.finishInstance(3); - Clean(); + clean(world.getFirstPlayer()); } } return super.onKill(npc, killer, isSummon); @@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance @Override 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"; } @@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance { case SALAMANDRA_GENERATOR: { - startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); + startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true); + startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer()); break; } case SALAMANDRA_GENERATOR_DUMMY: { - startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); + startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true); break; } case DEMINSIONAL_INVISIBLE_FRAGMENT: { - startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); + startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true); break; } } @@ -626,47 +726,43 @@ public class DimensionalWrap extends AbstractInstance return super.onSpawn(npc); } - public void CheckCrystallCount(Instance world, PlayerInstance player, Npc npc) + public void checkCrystallCount(Instance world, Npc npc) { boolean canStart = true; 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()) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); 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(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); canStart = false; } } } - if (!canStart || (_worldState != 0)) + if (!canStart || (world.getParameters().getInt("worldState", 0) != 0)) { return; } - startQuestTimer("START_STAGE", 1000, npc, null); + startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer()); 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"); - cancelQuestTimers("SALAMANDRA_SPAWN"); - cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); - cancelQuestTimers("CHANGE_LOCATION"); - if (_debufTask != null) - { - _debufTask.cancel(false); - _debufTask = null; - } + cancelQuestTimer("SWITCH_STAGE", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player); + cancelQuestTimer("CHANGE_LOCATION", null, player); + cancelQuestTimer("DEBUFF_TASK", null, player); } public static void main(String[] args) diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java index c44c3a56c4..d0f7507655 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java @@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti; /** * Mystic Tavern Tauti Instance * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk - * @author Gigi + * @author Gigi, Mobius */ 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 int ZONE_1ST_TRIGER = 24137770; private static final int SKILL_TRIGER = 24138880; - private static Npc _deton; private static Npc _seal_device; protected int _count = 0; public StoryOfTauti() { 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); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); @@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(1) || world.isStatus(4)) { - _deton.setTarget(player); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + world.getNpc(DETON).setTarget(player); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } else { @@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance } 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 -> { if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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; } case "msg_1": { - _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); + 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, world.getNpc(DETON), null); break; } case "msg_2": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); - startQuestTimer("msg_3", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); + startQuestTimer("msg_3", 10000, world.getNpc(DETON), null); break; } 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; } case "msg_4": { - _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); - startQuestTimer("msg_5", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); + startQuestTimer("msg_5", 7000, world.getNpc(DETON), null); break; } case "msg_5": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_stacato": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_1", 50000, _deton, null); + startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_1": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_2", 50000, _deton, null); + startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_2": @@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance } case "check_flower": { - if (!npc.isDead()) + if ((world != null) && !npc.isDead()) { for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) { if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) { - _deton.setRunning(); + world.getNpc(DETON).setRunning(); addMoveToDesire(npc, nearby.getLocation(), 23); if (npc.calculateDistance3D(nearby) < 100) { @@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance } } } + startQuestTimer("check_flower", 3000, npc, null); } break; } @@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "spawn_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) { world.spawnGroup("ifrit"); @@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance { 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); addAttackPlayerDesire(npc, pl); } @@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance } case "msg_8": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); - startQuestTimer("msg_9", 8000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); + startQuestTimer("msg_9", 8000, world.getNpc(DETON), null); break; } case "msg_9": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); - startQuestTimer("msg_10", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); + startQuestTimer("msg_10", 10000, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away", 10000, _deton, null); + startQuestTimer("run_away", 10000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 3500, _deton, null); + 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); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null); break; } case "delete_daton": @@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "msg_12": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away_1", 8000, _deton, null); + startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 5000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null); break; } case "switch_quest": @@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance } case "end_instance": { - cancelQuestTimers("check_flower"); _count = 0; for (Npc n : world.getAliveNpcs()) { @@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance { 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); break; } if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) { _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); break; } @@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) { world.spawnGroup("last_deton"); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); - startQuestTimer("msg_12", 6000, _deton, null); - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); + startQuestTimer("msg_12", 6000, world.getNpc(DETON), null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.setStatus(11); } 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_archagel"); 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()) { - cancelQuestTimers("end_instance"); - cancelQuestTimers("check_flower"); + cancelQuestTimer("end_instance", world.getNpc(DETON), null); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.setStatus(4); World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> { if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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); - startQuestTimer("msg_7", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); + startQuestTimer("msg_7", 7000, world.getNpc(DETON), null); } break; } @@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance 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)); - startQuestTimer("msg_8", 3000, _deton, null); + startQuestTimer("msg_8", 3000, world.getNpc(DETON), null); world.setStatus(6); } break; @@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance _seal_device.setDisplayEffect(3); _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)); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); - startQuestTimer("msg_11", 3000, _deton, null); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); + startQuestTimer("msg_11", 3000, world.getNpc(DETON), null); break; } case SEALED_ANGEL: @@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) { world.setStatus(2); - _deton.setTarget(null); - _deton.stopMove(null); - startQuestTimer("msg_4", 7000, _deton, null); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(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.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); - startQuestTimer("end_instance", 190000, _deton, null); - startQuestTimer("spawn_stacato", 5000, _deton, null); + startQuestTimer("end_instance", 190000, world.getNpc(DETON), null); + startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null); } break; } @@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(0)) { - startQuestTimer("check_status", 21000, _deton, player); + startQuestTimer("check_status", 21000, world.getNpc(DETON), player); world.setStatus(1); } break; @@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance 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)); - _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); + 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, world.getNpc(DETON), player); world.setStatus(5); } break; @@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _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); + 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, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); - startQuestTimer("spawn_scarab", 7000, _deton, player); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); + startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance { switch (npc.getId()) { - case DETON: - { - _deton = npc; - break; - } case SEAL_DEVICE: { _seal_device = npc; @@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance } case FLAME_STACATO: { - startQuestTimer("check_flower", 3000, npc, null, true); + startQuestTimer("check_flower", 3000, npc, null); break; } case FLAME_SCORPION: diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 26fb421e67..021f4ecc3e 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -34,7 +34,7 @@ import instances.AbstractInstance; * Nornils Garden Instance * @URL https://l2wiki.com/Nornils_Garden * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs - * @author Gigi + * @author Gigi, Mobius * @date 2017-02-22 - [15:22:27] */ public class NornilsGarden extends AbstractInstance @@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200016, true); - cancelQuestTimers("stage2"); + cancelQuestTimer("stage2", npc, null); world.spawnGroup("wave_3"); } break; @@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200201, true); - cancelQuestTimers("stage3"); - cancelQuestTimers("check_agrro"); + cancelQuestTimer("stage3", npc, null); } break; } 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 -> { @@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); } }); + startQuestTimer("check_agrro", 1000, npc, null); } break; } @@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance { if (npc.getId() == BOZ_STAGE1) { - cancelQuestTimers("stage1_1"); + cancelQuestTimer("stage1_1", npc, null); world.openCloseDoor(16200015, true); world.setStatus(1); } @@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) { ((Attackable) npc).setCanReturnToSpawnPoint(false); - startQuestTimer("check_agrro", 1000, npc, null, true); + startQuestTimer("check_agrro", 1000, npc, null); } return super.onSpawn(npc); } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java index 59a416f01e..15679fe90f 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java @@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - cancelQuestTimers("attack"); - cancelQuestTimers("random_Target"); + cancelQuestTimer("attack", npc, null); + cancelQuestTimer("random_Target", npc, null); return super.onKill(npc, killer, isSummon); } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java index fc11f466be..b85aad2397 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java @@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance { world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_1, false); - world.getParameters().set("TELEPORT_ACTIVE", true); + world.setParameter("TELEPORT_ACTIVE", true); npc.teleToLocation(BATTLE_LOC); playMovie(world, Movie.SC_OCTABIS_OPENING); getTimers().addTimer("START_STAGE_1", 26500, npc, null); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java index 5560b81d40..de7cc1efbf 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java @@ -252,7 +252,7 @@ public class AltarOfShilen extends AbstractInstance world.setStatus(7); onStatusChanged(world); npc.deleteMe(); - cancelQuestTimers("check_player"); + cancelQuestTimer("check_player", npc, null); } break; } diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java index 809462089e..ba07db28a2 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java @@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance } 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)) { captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java index c4431a7532..0f47b580e9 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java @@ -73,321 +73,373 @@ public class ChamberOfProphecies extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - if (event.equals("enterInstance")) + switch (event) { - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) + case "31639-01.html": + case "33996-01.html": + case "33980-01.html": + case "33980-02.html": { - enterInstance(player, npc, TEMPLATE_ID); - if (hasQuestItems(player, PROPHECY_MACHINE)) - { - takeItems(player, PROPHECY_MACHINE, 1); - } - qs.setCond(16, true); + htmltext = event; + break; } - } - else if (player != null) - { - final Instance world = player.getInstanceWorld(); - if (!isInInstance(world)) + case "33996-02.html": { - return null; + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.broadcastPacket(ExShowUsm.USM_Q015_E); + world.despawnGroup("q10753_16_instance_grail"); + world.spawnGroup("q10753_16_instance_wizard"); + giveItems(player, ATELIA, 1); + showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; } - - switch (event) + case "33980-03.html": { - case "31639-01.html": - case "33996-01.html": - case "33980-01.html": - case "33980-02.html": + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-04.html": + { + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-05.html": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; - break; + return null; } - case "33996-02.html": + world.spawnGroup("q10753_16_instance_halter_2"); + world.setStatus(6); + startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); + htmltext = event; + break; + } + case "enterInstance": + { + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) { - world.broadcastPacket(ExShowUsm.USM_Q015_E); - world.despawnGroup("q10753_16_instance_grail"); - world.spawnGroup("q10753_16_instance_wizard"); - giveItems(player, ATELIA, 1); - showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-03.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-04.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-05.html": - { - world.spawnGroup("q10753_16_instance_halter_2"); - world.setStatus(6); - startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); - htmltext = event; - break; - } - case "status": - { - if (world.isStatus(0)) + enterInstance(player, npc, TEMPLATE_ID); + if (hasQuestItems(player, PROPHECY_MACHINE)) { - htmltext = "31639-01.html"; + 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": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.isStatus(0)) + { + htmltext = "31639-01.html"; + break; + } + htmltext = "31639-02.html"; + break; + } + case "CHECK_STATUS": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + switch (world.getStatus()) + { + case 0: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); + startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); + startQuestTimer("OPEN_DOOR1", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); break; } - htmltext = "31639-02.html"; - 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": - { - switch (world.getStatus()) + case 1: { - case 0: + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); - startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); - startQuestTimer("OPEN_DOOR1", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 1: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.spawnGroup("wof_room2_1"); - world.setStatus(2); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 2: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); - startQuestTimer("OPEN_DOOR2", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 3: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(4); - world.spawnGroup("wof_room3_2"); - world.openCloseDoor(DOOR_3, false); - startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 4: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(5); - world.spawnGroup("wof_room4"); - startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); - startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); - } - else - { - startQuestTimer("CHECK_STATUS", 7000, npc, player); - } - break; + world.spawnGroup("wof_room2_1"); + world.setStatus(2); } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; } - break; - } - case "ATTACK": - case "ATTACK1": - case "ATTACK2": - { - npc.setRunning(); - ((Attackable) npc).setCanReturnToSpawnPoint(false); - if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) + case 2: { - npc.setTarget(player); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - addAttackDesire(npc, monster); - return; - }); + startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); + startQuestTimer("OPEN_DOOR2", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 3: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(4); + world.spawnGroup("wof_room3_2"); + world.openCloseDoor(DOOR_3, false); + startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 4: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(5); + world.spawnGroup("wof_room4"); + startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); + startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); + } + else + { + startQuestTimer("CHECK_STATUS", 7000, npc, player); + } + break; } - break; } - case "OPEN_DOOR1": + break; + } + case "ATTACK": + case "ATTACK1": + case "ATTACK2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - cancelQuestTimers("ATTACK"); - world.setStatus(1); - world.openCloseDoor(DOOR_2, true); - world.spawnGroup("wof_room2"); - break; + return null; } - case "OPEN_DOOR2": - { - cancelQuestTimers("ATTACK1"); - startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); - world.setStatus(3); - world.spawnGroup("wof_room3"); - world.openCloseDoor(DOOR_3, true); - break; - } - case "BROADCAST_TEXT": + npc.setRunning(); + ((Attackable) npc).setCanReturnToSpawnPoint(false); + if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) { npc.setTarget(player); - npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); - break; } - case "SEY2": + else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { - if (npc.getId() == FERIN) + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); - } - break; + addAttackDesire(npc, monster); + return; + }); } - case "SEY_KAIN": + break; + } + case "OPEN_DOOR1": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == VAN_HALTER) - { - startQuestTimer("ATTACK1", 200, npc, player, true); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY3": + cancelQuestTimer("ATTACK", npc, player); + world.setStatus(1); + world.openCloseDoor(DOOR_2, true); + world.spawnGroup("wof_room2"); + break; + } + case "OPEN_DOOR2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY_KAIN_1": + cancelQuestTimer("ATTACK1", npc, player); + startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); + world.setStatus(3); + world.spawnGroup("wof_room3"); + world.openCloseDoor(DOOR_3, true); + break; + } + case "BROADCAST_TEXT": + { + npc.setTarget(player); + npc.setRunning(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); + break; + } + case "SEY2": + { + if (npc.getId() == FERIN) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_2": + break; + } + case "SEY_KAIN": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); - startQuestTimer("SEY_KAIN_3", 7000, npc, player); - } - break; + startQuestTimer("ATTACK1", 200, npc, player, true); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); } - case "SEY4": + break; + } + case "SEY3": + { + if (npc.getId() == FERIN) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); - startQuestTimer("REST", 5000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_3": + break; + } + case "SEY_KAIN_1": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); - startQuestTimer("SEY_KAIN_4", 1000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); } - case "REST": + break; + } + case "SEY_KAIN_2": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == FERIN) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); - cancelQuestTimers("BROADCAST_TEXT"); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); + startQuestTimer("SEY_KAIN_3", 7000, npc, player); } - case "SEY_KAIN_4": + break; + } + case "SEY4": + { + if (npc.getId() == FERIN) { - world.setStatus(5); - world.spawnGroup("q10753_16_instance_grail"); - showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); - world.openCloseDoor(DOOR_4, true); - cancelQuestTimers("ATTACK2"); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); - startQuestTimer("CLOSE", 15000, null, player); - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); + startQuestTimer("REST", 5000, npc, player); + npc.setScriptValue(1); } - case "CLOSE": + break; + } + case "SEY_KAIN_3": + { + if (npc.getId() == VAN_HALTER) { - final Npc grail = world.getNpc(GRAIL); - if ((grail != null) && (player.calculateDistance2D(grail) < 390)) - { - world.openCloseDoor(DOOR_4, false); - world.despawnGroup("q10753_16_instance_halter_1_1"); - world.despawnGroup("wof_room4"); - } - else - { - startQuestTimer("CLOSE", 3000, npc, player); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); + startQuestTimer("SEY_KAIN_4", 1000, npc, player); + npc.setScriptValue(1); } - case "DESPAWN_WIZARD": + break; + } + case "REST": + { + if (npc.getId() == FERIN) { - world.despawnGroup("q10753_16_instance_wizard"); - break; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); + cancelQuestTimer("BROADCAST_TEXT", npc, player); } - case "exit": + break; + } + case "SEY_KAIN_4": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - 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)); - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) - { - qs.setCond(17, true); - } - break; + return null; } - case "finish": + world.setStatus(5); + world.spawnGroup("q10753_16_instance_grail"); + showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); + world.openCloseDoor(DOOR_4, true); + cancelQuestTimer("ATTACK2", npc, player); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); + startQuestTimer("CLOSE", 15000, null, player); + break; + } + case "CLOSE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - world.finishInstance(0); - break; + return null; } + final Npc grail = world.getNpc(GRAIL); + if ((grail != null) && (player.calculateDistance2D(grail) < 390)) + { + world.openCloseDoor(DOOR_4, false); + world.despawnGroup("q10753_16_instance_halter_1_1"); + world.despawnGroup("wof_room4"); + } + else + { + startQuestTimer("CLOSE", 3000, npc, player); + } + break; + } + case "DESPAWN_WIZARD": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.despawnGroup("q10753_16_instance_wizard"); + break; + } + case "exit": + { + 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(1)); + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) + { + qs.setCond(17, true); + } + break; + } + case "finish": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.finishInstance(0); + break; } } return htmltext; diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java index d755f1c55b..4d1cd6c982 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java @@ -17,10 +17,8 @@ package instances.DimensionalWrap; import java.util.List; -import java.util.concurrent.ScheduledFuture; import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.enums.CategoryType; @@ -44,7 +42,7 @@ import instances.AbstractInstance; * Dimensional Wrap instance * @URL https://l2wiki.com/Dimensional_Warp * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg - * @author Gigi + * @author Gigi, Mobius * @date 2018-09-04 - [14:33:31] */ public class DimensionalWrap extends AbstractInstance @@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance 23480, // Abyssal Harpy 23481, // Abyssal Binder 23482, // Abyssal Archon - 23483 // Abyssal Golem + 23483, // Abyssal Golem }; private static final int[] TRAPS = { @@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance 19559, // Damage trap, power 1 19560, // Damage trap, power 2 19561, // Damage trap, power 3 - 19562 // Heal Trap + 19562, // Heal Trap }; // Location 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 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); // Misc private static final int TEMPLATE_ID = 250; private static final int DIMENSIONAL_DARK_FORCES = 16415; 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() { @@ -125,429 +118,534 @@ public class DimensionalWrap extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - final Instance world = npc.getInstanceWorld(); - if (event.equals("enterInstance")) + + switch (event) { - if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + case "enterInstance": { - htmltext = "no_awakened.html"; + if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + htmltext = "no_awakened.html"; + } + else if (!player.isInParty()) + { + enterInstance(player, npc, TEMPLATE_ID); + } + else if (player.isInParty()) + { + if (!player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + } + else + { + final Party party = player.getParty(); + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) + { + enterInstance(member, npc, TEMPLATE_ID); + } + } + } + } + break; } - else if (!player.isInParty()) + case "33975-01.html": { - enterInstance(player, npc, TEMPLATE_ID); + htmltext = event; + break; } - else if (player.isInParty()) + case "12_warp_crystals": { - if (!player.getParty().isLeader(player)) + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.3); + if (!player.isInParty()) + { + world.setParameter("count", 12); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; } - else + switch (player.getParty().getMemberCount()) { - final Party party = player.getParty(); - final List members = party.getMembers(); - for (PlayerInstance member : members) + case 2: { - if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) - { - enterInstance(member, npc, TEMPLATE_ID); - } + world.setParameter("count", 6); + checkCrystallCount(world, npc); + break; + } + case 3: + { + world.setParameter("count", 4); + checkCrystallCount(world, npc); + break; + } + case 4: + { + world.setParameter("count", 3); + checkCrystallCount(world, npc); + break; } } + break; } - } - if (isInInstance(world)) - { - switch (event) + case "240_warp_crystals": { - case "33975-01.html": + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; + return null; + } + + world.setParameter("chance", 0.6); + if (!player.isInParty()) + { + world.setParameter("count", 240); + checkCrystallCount(world, npc); break; } - case "12_warp_crystals": + else if (player.isInParty() && !player.getParty().isLeader(player)) { - _chance = 0.3; - if (!player.isInParty()) + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - _count = 12; - CheckCrystallCount(world, player, npc); + world.setParameter("count", 120); + checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 3: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 80); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 4: { - case 2: - { - _count = 6; - CheckCrystallCount(world, player, npc); - break; - } - case 3: - { - _count = 4; - CheckCrystallCount(world, player, npc); - break; - } - case 4: - { - _count = 3; - CheckCrystallCount(world, player, npc); - break; - } - } - break; - } - case "240_warp_crystals": - { - _chance = 0.6; - if (!player.isInParty()) - { - _count = 240; - CheckCrystallCount(world, player, npc); + world.setParameter("count", 60); + checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + } + break; + } + case "1200_warp_crystals": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.9); + if (!player.isInParty()) + { + world.setParameter("count", 1200); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 600); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 3: { - case 2: - { - _count = 120; - CheckCrystallCount(world, player, npc); - break; - } - case 3: - { - _count = 80; - CheckCrystallCount(world, player, npc); - break; - } - case 4: - { - _count = 60; - CheckCrystallCount(world, player, npc); - break; - } - } - break; - } - case "1200_warp_crystals": - { - _chance = 0.9; - if (!player.isInParty()) - { - _count = 1200; - CheckCrystallCount(world, player, npc); + world.setParameter("count", 400); + checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 4: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 300); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 600; - CheckCrystallCount(world, player, npc); - break; - } - case 3: - { - _count = 400; - CheckCrystallCount(world, player, npc); - break; - } - case 4: - { - _count = 300; - CheckCrystallCount(world, player, npc); - break; - } - } - break; } - case "send_6_f": + break; + } + case "send_6_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - htmltext = "33975-02.html"; - break; + n.deleteMe(); } - if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + } + if (world.getStatus() < 5) + { + world.setStatus(5); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_11_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - htmltext = "33975-05.html"; - break; + n.deleteMe(); } - - for (Npc n : world.getAliveNpcs()) + } + if (world.getStatus() < 10) + { + world.setStatus(10); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_16_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) + n.deleteMe(); + } + } + if (world.getStatus() < 15) + { + world.setStatus(15); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_21_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 20) + { + world.setStatus(20); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(TELEPORTS, world.getTemplateId()); + } + break; + } + case "send_26_f": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 25) + { + world.setStatus(25); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); + } + break; + } + case "jump_location": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + player.teleToLocation(TELEPORTS, world.getTemplateId()); + break; + } + case "SALAMANDRA_SPAWN": + case "SALAMANDRA_SPAWN_DUMMY": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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(); + World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> + { + if ((p != null) && !p.isDead()) { - n.deleteMe(); + addAttackPlayerDesire(salamandra, p); } - } - if (world.getStatus() < 5) - { - world.setStatus(5); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); - } - break; + }); } - case "send_11_f": + break; + } + case "START_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 10) - { - world.setStatus(10); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_16_f": + world.setStatus(world.getStatus() + 1); + world.setParameter("worldState", world.getStatus()); + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); + startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer()); + break; + } + case "FIRST_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 15) - { - world.setStatus(15); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_21_f": + final int worldState = world.getParameters().getInt("worldState", 0); + world.spawnGroup(worldState + "_first_spawn"); + world.spawnGroup(worldState + "_trap_spawn"); + startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer()); + startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true); + break; + } + case "DEBUFF_TASK": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 20) - { - world.setStatus(20); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(TELEPORTS, world.getTemplateId()); - } - break; + return null; } - case "send_26_f": + int skilllevel = 1; + final int worldState = world.getParameters().getInt("worldState", 0); + if ((worldState > 0) && (worldState <= 11)) { - if (_worldState == 0) + 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()) + { + if ((p != null) && !p.isDead()) { - htmltext = "33975-02.html"; - break; + skill.applyEffects(p, p); } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + } + break; + } + case "SECOND_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn"); + startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer()); + break; + } + case "THIRD_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn"); + break; + } + case "CHANGE_LOCATION": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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; + } + case "SWITCH_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.getAliveNpcs(MONSTERS).isEmpty()) + { + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); + world.broadcastPacket(new Earthquake(npc, 50, 5)); + world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true); + clean(world.getFirstPlayer()); + if (world.getParameters().getInt("worldState", 0) < 35) { - htmltext = "33975-05.html"; - break; + startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer()); } - for (Npc n : world.getAliveNpcs()) + } + break; + } + 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.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); + startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer()); + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } + n.deleteMe(); } - if (world.getStatus() < 25) - { - world.setStatus(25); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); - } - break; - } - case "jump_location": - { - player.teleToLocation(TELEPORTS, world.getTemplateId()); - break; - } - case "SALAMANDRA_SPAWN": - case "SALAMANDRA_SPAWN_DUMMY": - { - if (getRandom(100) < (_worldState / 2)) - { - final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); - salamandra.setRunning(); - World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> - { - if ((p != null) && !p.isDead()) - { - addAttackPlayerDesire(salamandra, p); - } - }); - } - break; - } - case "START_STAGE": - { - world.setStatus(world.getStatus() + 1); - _worldState = 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); - break; - } - case "FIRST_SPAWN": - { - world.spawnGroup(_worldState + "_first_spawn"); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("SECOND_SPAWN", 40000, npc, null); - _debufTask = ThreadPool.scheduleAtFixedRate(() -> - { - 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()) - { - if ((p != null) && !p.isDead()) - { - skill.applyEffects(p, p); - } - } - }, 5000, 10000); - break; - } - case "SECOND_SPAWN": - { - world.spawnGroup(_worldState + "_second_spawn"); - startQuestTimer("THRID_SPAWN", 40000, npc, null); - break; - } - case "THRID_SPAWN": - { - world.spawnGroup(_worldState + "_thred_spawn"); - break; - } - case "CHANGE_LOCATION": - { - world.getAliveNpcs(TRAPS).forEach(t -> t.deleteMe()); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); - break; - } - case "SWITCH_STAGE": - { - if (world.getAliveNpcs(MONSTERS).isEmpty()) - { - world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); - world.broadcastPacket(new Earthquake(npc, 50, 5)); - world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); - Clean(); - if (_worldState < 35) - { - startQuestTimer("NEXT_STAGE", 5000, npc, null); - } - } - break; - } - case "NEXT_STAGE": - { - 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)); - startQuestTimer("START_STAGE", 8000, npc, null); - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - break; } + break; } } return htmltext; @@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance final Instance world = npc.getInstanceWorld(); 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()); 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()); 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()); 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.finishInstance(3); - Clean(); + clean(world.getFirstPlayer()); } } return super.onKill(npc, killer, isSummon); @@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance @Override 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"; } @@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance { case SALAMANDRA_GENERATOR: { - startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); + startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true); + startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer()); break; } case SALAMANDRA_GENERATOR_DUMMY: { - startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); + startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true); break; } case DEMINSIONAL_INVISIBLE_FRAGMENT: { - startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); + startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true); break; } } @@ -626,47 +726,43 @@ public class DimensionalWrap extends AbstractInstance return super.onSpawn(npc); } - public void CheckCrystallCount(Instance world, PlayerInstance player, Npc npc) + public void checkCrystallCount(Instance world, Npc npc) { boolean canStart = true; 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()) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); 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(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); canStart = false; } } } - if (!canStart || (_worldState != 0)) + if (!canStart || (world.getParameters().getInt("worldState", 0) != 0)) { return; } - startQuestTimer("START_STAGE", 1000, npc, null); + startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer()); 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"); - cancelQuestTimers("SALAMANDRA_SPAWN"); - cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); - cancelQuestTimers("CHANGE_LOCATION"); - if (_debufTask != null) - { - _debufTask.cancel(false); - _debufTask = null; - } + cancelQuestTimer("SWITCH_STAGE", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player); + cancelQuestTimer("CHANGE_LOCATION", null, player); + cancelQuestTimer("DEBUFF_TASK", null, player); } public static void main(String[] args) diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java index c44c3a56c4..d0f7507655 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java @@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti; /** * Mystic Tavern Tauti Instance * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk - * @author Gigi + * @author Gigi, Mobius */ 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 int ZONE_1ST_TRIGER = 24137770; private static final int SKILL_TRIGER = 24138880; - private static Npc _deton; private static Npc _seal_device; protected int _count = 0; public StoryOfTauti() { 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); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); @@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(1) || world.isStatus(4)) { - _deton.setTarget(player); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + world.getNpc(DETON).setTarget(player); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } else { @@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance } 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 -> { if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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; } case "msg_1": { - _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); + 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, world.getNpc(DETON), null); break; } case "msg_2": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); - startQuestTimer("msg_3", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); + startQuestTimer("msg_3", 10000, world.getNpc(DETON), null); break; } 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; } case "msg_4": { - _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); - startQuestTimer("msg_5", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); + startQuestTimer("msg_5", 7000, world.getNpc(DETON), null); break; } case "msg_5": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_stacato": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_1", 50000, _deton, null); + startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_1": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_2", 50000, _deton, null); + startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_2": @@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance } case "check_flower": { - if (!npc.isDead()) + if ((world != null) && !npc.isDead()) { for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) { if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) { - _deton.setRunning(); + world.getNpc(DETON).setRunning(); addMoveToDesire(npc, nearby.getLocation(), 23); if (npc.calculateDistance3D(nearby) < 100) { @@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance } } } + startQuestTimer("check_flower", 3000, npc, null); } break; } @@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "spawn_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) { world.spawnGroup("ifrit"); @@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance { 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); addAttackPlayerDesire(npc, pl); } @@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance } case "msg_8": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); - startQuestTimer("msg_9", 8000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); + startQuestTimer("msg_9", 8000, world.getNpc(DETON), null); break; } case "msg_9": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); - startQuestTimer("msg_10", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); + startQuestTimer("msg_10", 10000, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away", 10000, _deton, null); + startQuestTimer("run_away", 10000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 3500, _deton, null); + 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); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null); break; } case "delete_daton": @@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "msg_12": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away_1", 8000, _deton, null); + startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 5000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null); break; } case "switch_quest": @@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance } case "end_instance": { - cancelQuestTimers("check_flower"); _count = 0; for (Npc n : world.getAliveNpcs()) { @@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance { 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); break; } if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) { _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); break; } @@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) { world.spawnGroup("last_deton"); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); - startQuestTimer("msg_12", 6000, _deton, null); - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); + startQuestTimer("msg_12", 6000, world.getNpc(DETON), null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.setStatus(11); } 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_archagel"); 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()) { - cancelQuestTimers("end_instance"); - cancelQuestTimers("check_flower"); + cancelQuestTimer("end_instance", world.getNpc(DETON), null); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.setStatus(4); World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> { if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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); - startQuestTimer("msg_7", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); + startQuestTimer("msg_7", 7000, world.getNpc(DETON), null); } break; } @@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance 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)); - startQuestTimer("msg_8", 3000, _deton, null); + startQuestTimer("msg_8", 3000, world.getNpc(DETON), null); world.setStatus(6); } break; @@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance _seal_device.setDisplayEffect(3); _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)); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); - startQuestTimer("msg_11", 3000, _deton, null); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); + startQuestTimer("msg_11", 3000, world.getNpc(DETON), null); break; } case SEALED_ANGEL: @@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) { world.setStatus(2); - _deton.setTarget(null); - _deton.stopMove(null); - startQuestTimer("msg_4", 7000, _deton, null); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(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.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); - startQuestTimer("end_instance", 190000, _deton, null); - startQuestTimer("spawn_stacato", 5000, _deton, null); + startQuestTimer("end_instance", 190000, world.getNpc(DETON), null); + startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null); } break; } @@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(0)) { - startQuestTimer("check_status", 21000, _deton, player); + startQuestTimer("check_status", 21000, world.getNpc(DETON), player); world.setStatus(1); } break; @@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance 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)); - _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); + 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, world.getNpc(DETON), player); world.setStatus(5); } break; @@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _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); + 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, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); - startQuestTimer("spawn_scarab", 7000, _deton, player); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); + startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance { switch (npc.getId()) { - case DETON: - { - _deton = npc; - break; - } case SEAL_DEVICE: { _seal_device = npc; @@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance } case FLAME_STACATO: { - startQuestTimer("check_flower", 3000, npc, null, true); + startQuestTimer("check_flower", 3000, npc, null); break; } case FLAME_SCORPION: diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 72d5e30e36..e53345de20 100644 --- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -34,7 +34,7 @@ import instances.AbstractInstance; * Nornils Garden Instance * @URL https://l2wiki.com/Nornils_Garden * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs - * @author Gigi + * @author Gigi, Mobius * @date 2017-02-22 - [15:22:27] */ public class NornilsGarden extends AbstractInstance @@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200016, true); - cancelQuestTimers("stage2"); + cancelQuestTimer("stage2", npc, null); world.spawnGroup("wave_3"); } break; @@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200201, true); - cancelQuestTimers("stage3"); - cancelQuestTimers("check_agrro"); + cancelQuestTimer("stage3", npc, null); } break; } 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 -> { @@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); } }); + startQuestTimer("check_agrro", 1000, npc, null); } break; } @@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance { if (npc.getId() == BOZ_STAGE1) { - cancelQuestTimers("stage1_1"); + cancelQuestTimer("stage1_1", npc, null); world.openCloseDoor(16200015, true); world.setStatus(1); } @@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) { ((Attackable) npc).setCanReturnToSpawnPoint(false); - startQuestTimer("check_agrro", 1000, npc, null, true); + startQuestTimer("check_agrro", 1000, npc, null); } return super.onSpawn(npc); } diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java index 59a416f01e..15679fe90f 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java @@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - cancelQuestTimers("attack"); - cancelQuestTimers("random_Target"); + cancelQuestTimer("attack", npc, null); + cancelQuestTimer("random_Target", npc, null); return super.onKill(npc, killer, isSummon); } diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java index fc11f466be..b85aad2397 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java @@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance { world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_1, false); - world.getParameters().set("TELEPORT_ACTIVE", true); + world.setParameter("TELEPORT_ACTIVE", true); npc.teleToLocation(BATTLE_LOC); playMovie(world, Movie.SC_OCTABIS_OPENING); getTimers().addTimer("START_STAGE_1", 26500, npc, null); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java index 5560b81d40..de7cc1efbf 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java @@ -252,7 +252,7 @@ public class AltarOfShilen extends AbstractInstance world.setStatus(7); onStatusChanged(world); npc.deleteMe(); - cancelQuestTimers("check_player"); + cancelQuestTimer("check_player", npc, null); } break; } diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java index 809462089e..ba07db28a2 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java @@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance } 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)) { captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java index c4431a7532..0f47b580e9 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java @@ -73,321 +73,373 @@ public class ChamberOfProphecies extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - if (event.equals("enterInstance")) + switch (event) { - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) + case "31639-01.html": + case "33996-01.html": + case "33980-01.html": + case "33980-02.html": { - enterInstance(player, npc, TEMPLATE_ID); - if (hasQuestItems(player, PROPHECY_MACHINE)) - { - takeItems(player, PROPHECY_MACHINE, 1); - } - qs.setCond(16, true); + htmltext = event; + break; } - } - else if (player != null) - { - final Instance world = player.getInstanceWorld(); - if (!isInInstance(world)) + case "33996-02.html": { - return null; + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.broadcastPacket(ExShowUsm.USM_Q015_E); + world.despawnGroup("q10753_16_instance_grail"); + world.spawnGroup("q10753_16_instance_wizard"); + giveItems(player, ATELIA, 1); + showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; } - - switch (event) + case "33980-03.html": { - case "31639-01.html": - case "33996-01.html": - case "33980-01.html": - case "33980-02.html": + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-04.html": + { + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-05.html": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; - break; + return null; } - case "33996-02.html": + world.spawnGroup("q10753_16_instance_halter_2"); + world.setStatus(6); + startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); + htmltext = event; + break; + } + case "enterInstance": + { + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) { - world.broadcastPacket(ExShowUsm.USM_Q015_E); - world.despawnGroup("q10753_16_instance_grail"); - world.spawnGroup("q10753_16_instance_wizard"); - giveItems(player, ATELIA, 1); - showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-03.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-04.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-05.html": - { - world.spawnGroup("q10753_16_instance_halter_2"); - world.setStatus(6); - startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); - htmltext = event; - break; - } - case "status": - { - if (world.isStatus(0)) + enterInstance(player, npc, TEMPLATE_ID); + if (hasQuestItems(player, PROPHECY_MACHINE)) { - htmltext = "31639-01.html"; + 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": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.isStatus(0)) + { + htmltext = "31639-01.html"; + break; + } + htmltext = "31639-02.html"; + break; + } + case "CHECK_STATUS": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + switch (world.getStatus()) + { + case 0: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); + startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); + startQuestTimer("OPEN_DOOR1", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); break; } - htmltext = "31639-02.html"; - 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": - { - switch (world.getStatus()) + case 1: { - case 0: + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); - startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); - startQuestTimer("OPEN_DOOR1", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 1: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.spawnGroup("wof_room2_1"); - world.setStatus(2); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 2: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); - startQuestTimer("OPEN_DOOR2", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 3: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(4); - world.spawnGroup("wof_room3_2"); - world.openCloseDoor(DOOR_3, false); - startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 4: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(5); - world.spawnGroup("wof_room4"); - startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); - startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); - } - else - { - startQuestTimer("CHECK_STATUS", 7000, npc, player); - } - break; + world.spawnGroup("wof_room2_1"); + world.setStatus(2); } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; } - break; - } - case "ATTACK": - case "ATTACK1": - case "ATTACK2": - { - npc.setRunning(); - ((Attackable) npc).setCanReturnToSpawnPoint(false); - if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) + case 2: { - npc.setTarget(player); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - addAttackDesire(npc, monster); - return; - }); + startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); + startQuestTimer("OPEN_DOOR2", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 3: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(4); + world.spawnGroup("wof_room3_2"); + world.openCloseDoor(DOOR_3, false); + startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 4: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(5); + world.spawnGroup("wof_room4"); + startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); + startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); + } + else + { + startQuestTimer("CHECK_STATUS", 7000, npc, player); + } + break; } - break; } - case "OPEN_DOOR1": + break; + } + case "ATTACK": + case "ATTACK1": + case "ATTACK2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - cancelQuestTimers("ATTACK"); - world.setStatus(1); - world.openCloseDoor(DOOR_2, true); - world.spawnGroup("wof_room2"); - break; + return null; } - case "OPEN_DOOR2": - { - cancelQuestTimers("ATTACK1"); - startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); - world.setStatus(3); - world.spawnGroup("wof_room3"); - world.openCloseDoor(DOOR_3, true); - break; - } - case "BROADCAST_TEXT": + npc.setRunning(); + ((Attackable) npc).setCanReturnToSpawnPoint(false); + if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) { npc.setTarget(player); - npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); - break; } - case "SEY2": + else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { - if (npc.getId() == FERIN) + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); - } - break; + addAttackDesire(npc, monster); + return; + }); } - case "SEY_KAIN": + break; + } + case "OPEN_DOOR1": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == VAN_HALTER) - { - startQuestTimer("ATTACK1", 200, npc, player, true); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY3": + cancelQuestTimer("ATTACK", npc, player); + world.setStatus(1); + world.openCloseDoor(DOOR_2, true); + world.spawnGroup("wof_room2"); + break; + } + case "OPEN_DOOR2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY_KAIN_1": + cancelQuestTimer("ATTACK1", npc, player); + startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); + world.setStatus(3); + world.spawnGroup("wof_room3"); + world.openCloseDoor(DOOR_3, true); + break; + } + case "BROADCAST_TEXT": + { + npc.setTarget(player); + npc.setRunning(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); + break; + } + case "SEY2": + { + if (npc.getId() == FERIN) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_2": + break; + } + case "SEY_KAIN": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); - startQuestTimer("SEY_KAIN_3", 7000, npc, player); - } - break; + startQuestTimer("ATTACK1", 200, npc, player, true); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); } - case "SEY4": + break; + } + case "SEY3": + { + if (npc.getId() == FERIN) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); - startQuestTimer("REST", 5000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_3": + break; + } + case "SEY_KAIN_1": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); - startQuestTimer("SEY_KAIN_4", 1000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); } - case "REST": + break; + } + case "SEY_KAIN_2": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == FERIN) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); - cancelQuestTimers("BROADCAST_TEXT"); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); + startQuestTimer("SEY_KAIN_3", 7000, npc, player); } - case "SEY_KAIN_4": + break; + } + case "SEY4": + { + if (npc.getId() == FERIN) { - world.setStatus(5); - world.spawnGroup("q10753_16_instance_grail"); - showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); - world.openCloseDoor(DOOR_4, true); - cancelQuestTimers("ATTACK2"); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); - startQuestTimer("CLOSE", 15000, null, player); - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); + startQuestTimer("REST", 5000, npc, player); + npc.setScriptValue(1); } - case "CLOSE": + break; + } + case "SEY_KAIN_3": + { + if (npc.getId() == VAN_HALTER) { - final Npc grail = world.getNpc(GRAIL); - if ((grail != null) && (player.calculateDistance2D(grail) < 390)) - { - world.openCloseDoor(DOOR_4, false); - world.despawnGroup("q10753_16_instance_halter_1_1"); - world.despawnGroup("wof_room4"); - } - else - { - startQuestTimer("CLOSE", 3000, npc, player); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); + startQuestTimer("SEY_KAIN_4", 1000, npc, player); + npc.setScriptValue(1); } - case "DESPAWN_WIZARD": + break; + } + case "REST": + { + if (npc.getId() == FERIN) { - world.despawnGroup("q10753_16_instance_wizard"); - break; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); + cancelQuestTimer("BROADCAST_TEXT", npc, player); } - case "exit": + break; + } + case "SEY_KAIN_4": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - 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)); - final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); - if (qs != null) - { - qs.setCond(17, true); - } - break; + return null; } - case "finish": + world.setStatus(5); + world.spawnGroup("q10753_16_instance_grail"); + showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); + world.openCloseDoor(DOOR_4, true); + cancelQuestTimer("ATTACK2", npc, player); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); + startQuestTimer("CLOSE", 15000, null, player); + break; + } + case "CLOSE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - world.finishInstance(0); - break; + return null; } + final Npc grail = world.getNpc(GRAIL); + if ((grail != null) && (player.calculateDistance2D(grail) < 390)) + { + world.openCloseDoor(DOOR_4, false); + world.despawnGroup("q10753_16_instance_halter_1_1"); + world.despawnGroup("wof_room4"); + } + else + { + startQuestTimer("CLOSE", 3000, npc, player); + } + break; + } + case "DESPAWN_WIZARD": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.despawnGroup("q10753_16_instance_wizard"); + break; + } + case "exit": + { + 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(1)); + final QuestState qs = player.getQuestState(Q10753_WindsOfFateChoices.class.getSimpleName()); + if (qs != null) + { + qs.setCond(17, true); + } + break; + } + case "finish": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.finishInstance(0); + break; } } return htmltext; diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java index a1077a8e4d..263d5e3991 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java @@ -17,10 +17,8 @@ package instances.DimensionalWrap; import java.util.List; -import java.util.concurrent.ScheduledFuture; import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.enums.CategoryType; @@ -44,7 +42,7 @@ import instances.AbstractInstance; * Dimensional Wrap instance * @URL https://l2wiki.com/Dimensional_Warp * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg - * @author Gigi + * @author Gigi, Mobius * @date 2018-09-04 - [14:33:31] */ public class DimensionalWrap extends AbstractInstance @@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance 23480, // Abyssal Harpy 23481, // Abyssal Binder 23482, // Abyssal Archon - 23483 // Abyssal Golem + 23483, // Abyssal Golem }; private static final int[] TRAPS = { @@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance 19559, // Damage trap, power 1 19560, // Damage trap, power 2 19561, // Damage trap, power 3 - 19562 // Heal Trap + 19562, // Heal Trap }; // Location 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 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); // Misc private static final int TEMPLATE_ID = 250; private static final int DIMENSIONAL_DARK_FORCES = 16415; 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() { @@ -125,429 +118,534 @@ public class DimensionalWrap extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - final Instance world = npc.getInstanceWorld(); - if (event.equals("enterInstance")) + + switch (event) { - if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + case "enterInstance": { - htmltext = "no_awakened.html"; + if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + htmltext = "no_awakened.html"; + } + else if (!player.isInParty()) + { + enterInstance(player, npc, TEMPLATE_ID); + } + else if (player.isInParty()) + { + if (!player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + } + else + { + final Party party = player.getParty(); + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) + { + enterInstance(member, npc, TEMPLATE_ID); + } + } + } + } + break; } - else if (!player.isInParty()) + case "33975-01.html": { - enterInstance(player, npc, TEMPLATE_ID); + htmltext = event; + break; } - else if (player.isInParty()) + case "12_warp_crystals": { - if (!player.getParty().isLeader(player)) + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.3); + if (!player.isInParty()) + { + world.setParameter("count", 12); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; } - else + switch (player.getParty().getMemberCount()) { - final Party party = player.getParty(); - final List members = party.getMembers(); - for (PlayerInstance member : members) + case 2: { - if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) - { - enterInstance(member, npc, TEMPLATE_ID); - } + world.setParameter("count", 6); + checkCrystallCount(world, npc); + break; + } + case 3: + { + world.setParameter("count", 4); + checkCrystallCount(world, npc); + break; + } + case 4: + { + world.setParameter("count", 3); + checkCrystallCount(world, npc); + break; } } + break; } - } - if (isInInstance(world)) - { - switch (event) + case "240_warp_crystals": { - case "33975-01.html": + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; + return null; + } + + world.setParameter("chance", 0.6); + if (!player.isInParty()) + { + world.setParameter("count", 240); + checkCrystallCount(world, npc); break; } - case "12_warp_crystals": + else if (player.isInParty() && !player.getParty().isLeader(player)) { - _chance = 0.3; - if (!player.isInParty()) + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - _count = 12; + world.setParameter("count", 120); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 3: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 6; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 4; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 3; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "240_warp_crystals": - { - _chance = 0.6; - if (!player.isInParty()) - { - _count = 240; + world.setParameter("count", 80); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 4: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 120; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 80; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 60; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "1200_warp_crystals": - { - _chance = 0.9; - if (!player.isInParty()) - { - _count = 1200; + world.setParameter("count", 60); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + } + break; + } + case "1200_warp_crystals": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.9); + if (!player.isInParty()) + { + world.setParameter("count", 1200); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 600); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 3: { - case 2: - { - _count = 600; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 400; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 300; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "send_6_f": - { - if (_worldState == 0) - { - htmltext = "33975-02.html"; + world.setParameter("count", 400); + checkCrystallCount(world, npc); break; } - if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + case 4: { - htmltext = "33975-05.html"; + world.setParameter("count", 300); + checkCrystallCount(world, npc); break; } - - for (Npc n : world.getAliveNpcs()) + } + break; + } + case "send_6_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) + n.deleteMe(); + } + } + if (world.getStatus() < 5) + { + world.setStatus(5); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_11_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 10) + { + world.setStatus(10); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_16_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 15) + { + world.setStatus(15); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_21_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 20) + { + world.setStatus(20); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(TELEPORTS, world.getTemplateId()); + } + break; + } + case "send_26_f": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 25) + { + world.setStatus(25); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); + } + break; + } + case "jump_location": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + player.teleToLocation(TELEPORTS, world.getTemplateId()); + break; + } + case "SALAMANDRA_SPAWN": + case "SALAMANDRA_SPAWN_DUMMY": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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(); + World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> + { + if ((p != null) && !p.isDead()) { - n.deleteMe(); + addAttackPlayerDesire(salamandra, p); } - } - if (world.getStatus() < 5) - { - world.setStatus(5); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); - } - break; + }); } - case "send_11_f": + break; + } + case "START_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 10) - { - world.setStatus(10); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_16_f": + world.setStatus(world.getStatus() + 1); + world.setParameter("worldState", world.getStatus()); + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); + startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer()); + break; + } + case "FIRST_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 15) - { - world.setStatus(15); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_21_f": + final int worldState = world.getParameters().getInt("worldState", 0); + world.spawnGroup(worldState + "_first_spawn"); + world.spawnGroup(worldState + "_trap_spawn"); + startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer()); + startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true); + break; + } + case "DEBUFF_TASK": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 20) - { - world.setStatus(20); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(TELEPORTS, world.getTemplateId()); - } - break; + return null; } - case "send_26_f": + int skilllevel = 1; + final int worldState = world.getParameters().getInt("worldState", 0); + if ((worldState > 0) && (worldState <= 11)) { - if (_worldState == 0) + 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()) + { + if ((p != null) && !p.isDead()) { - htmltext = "33975-02.html"; - break; + skill.applyEffects(p, p); } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + } + break; + } + case "SECOND_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn"); + startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer()); + break; + } + case "THIRD_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn"); + break; + } + case "CHANGE_LOCATION": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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; + } + case "SWITCH_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.getAliveNpcs(MONSTERS).isEmpty()) + { + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); + world.broadcastPacket(new Earthquake(npc, 50, 5)); + world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true); + clean(world.getFirstPlayer()); + if (world.getParameters().getInt("worldState", 0) < 35) { - htmltext = "33975-05.html"; - break; + startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer()); } - for (Npc n : world.getAliveNpcs()) + } + break; + } + 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.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); + startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer()); + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } + n.deleteMe(); } - if (world.getStatus() < 25) - { - world.setStatus(25); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); - } - break; - } - case "jump_location": - { - player.teleToLocation(TELEPORTS, world.getTemplateId()); - break; - } - case "SALAMANDRA_SPAWN": - case "SALAMANDRA_SPAWN_DUMMY": - { - if (getRandom(100) < (_worldState / 2)) - { - final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); - salamandra.setRunning(); - World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> - { - if ((p != null) && !p.isDead()) - { - addAttackPlayerDesire(salamandra, p); - } - }); - } - break; - } - case "START_STAGE": - { - world.setStatus(world.getStatus() + 1); - _worldState = 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); - break; - } - case "FIRST_SPAWN": - { - world.spawnGroup(_worldState + "_first_spawn"); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("SECOND_SPAWN", 40000, npc, null); - _debufTask = ThreadPool.scheduleAtFixedRate(() -> - { - 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()) - { - if ((p != null) && !p.isDead()) - { - skill.applyEffects(p, p); - } - } - }, 5000, 10000); - break; - } - case "SECOND_SPAWN": - { - world.spawnGroup(_worldState + "_second_spawn"); - startQuestTimer("THRID_SPAWN", 40000, npc, null); - break; - } - case "THRID_SPAWN": - { - world.spawnGroup(_worldState + "_thred_spawn"); - break; - } - case "CHANGE_LOCATION": - { - world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); - break; - } - case "SWITCH_STAGE": - { - if (world.getAliveNpcs(MONSTERS).isEmpty()) - { - world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); - world.broadcastPacket(new Earthquake(npc, 50, 5)); - world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); - clean(); - if (_worldState < 35) - { - startQuestTimer("NEXT_STAGE", 5000, npc, null); - } - } - break; - } - case "NEXT_STAGE": - { - 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)); - startQuestTimer("START_STAGE", 8000, npc, null); - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - break; } + break; } } return htmltext; @@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance final Instance world = npc.getInstanceWorld(); 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()); 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()); 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()); 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.finishInstance(3); - clean(); + clean(world.getFirstPlayer()); } } return super.onKill(npc, killer, isSummon); @@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance @Override 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"; } @@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance { case SALAMANDRA_GENERATOR: { - startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); + startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true); + startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer()); break; } case SALAMANDRA_GENERATOR_DUMMY: { - startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); + startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true); break; } case DEMINSIONAL_INVISIBLE_FRAGMENT: { - startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); + startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true); break; } } @@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance boolean canStart = true; 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()) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); 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(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); canStart = false; } } } - if (!canStart || (_worldState != 0)) + if (!canStart || (world.getParameters().getInt("worldState", 0) != 0)) { return; } - startQuestTimer("START_STAGE", 1000, npc, null); + startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer()); 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"); - cancelQuestTimers("SALAMANDRA_SPAWN"); - cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); - cancelQuestTimers("CHANGE_LOCATION"); - if (_debufTask != null) - { - _debufTask.cancel(false); - _debufTask = null; - } + cancelQuestTimer("SWITCH_STAGE", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player); + cancelQuestTimer("CHANGE_LOCATION", null, player); + cancelQuestTimer("DEBUFF_TASK", null, player); } public static void main(String[] args) diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java index c44c3a56c4..d0f7507655 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java @@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti; /** * Mystic Tavern Tauti Instance * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk - * @author Gigi + * @author Gigi, Mobius */ 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 int ZONE_1ST_TRIGER = 24137770; private static final int SKILL_TRIGER = 24138880; - private static Npc _deton; private static Npc _seal_device; protected int _count = 0; public StoryOfTauti() { 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); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); @@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(1) || world.isStatus(4)) { - _deton.setTarget(player); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + world.getNpc(DETON).setTarget(player); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } else { @@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance } 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 -> { if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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; } case "msg_1": { - _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); + 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, world.getNpc(DETON), null); break; } case "msg_2": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); - startQuestTimer("msg_3", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); + startQuestTimer("msg_3", 10000, world.getNpc(DETON), null); break; } 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; } case "msg_4": { - _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); - startQuestTimer("msg_5", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); + startQuestTimer("msg_5", 7000, world.getNpc(DETON), null); break; } case "msg_5": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_stacato": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_1", 50000, _deton, null); + startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_1": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_2", 50000, _deton, null); + startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_2": @@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance } case "check_flower": { - if (!npc.isDead()) + if ((world != null) && !npc.isDead()) { for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) { if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) { - _deton.setRunning(); + world.getNpc(DETON).setRunning(); addMoveToDesire(npc, nearby.getLocation(), 23); if (npc.calculateDistance3D(nearby) < 100) { @@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance } } } + startQuestTimer("check_flower", 3000, npc, null); } break; } @@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "spawn_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) { world.spawnGroup("ifrit"); @@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance { 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); addAttackPlayerDesire(npc, pl); } @@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance } case "msg_8": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); - startQuestTimer("msg_9", 8000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); + startQuestTimer("msg_9", 8000, world.getNpc(DETON), null); break; } case "msg_9": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); - startQuestTimer("msg_10", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); + startQuestTimer("msg_10", 10000, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away", 10000, _deton, null); + startQuestTimer("run_away", 10000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 3500, _deton, null); + 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); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null); break; } case "delete_daton": @@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "msg_12": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away_1", 8000, _deton, null); + startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 5000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null); break; } case "switch_quest": @@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance } case "end_instance": { - cancelQuestTimers("check_flower"); _count = 0; for (Npc n : world.getAliveNpcs()) { @@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance { 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); break; } if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) { _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); break; } @@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) { world.spawnGroup("last_deton"); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); - startQuestTimer("msg_12", 6000, _deton, null); - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); + startQuestTimer("msg_12", 6000, world.getNpc(DETON), null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.setStatus(11); } 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_archagel"); 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()) { - cancelQuestTimers("end_instance"); - cancelQuestTimers("check_flower"); + cancelQuestTimer("end_instance", world.getNpc(DETON), null); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.setStatus(4); World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> { if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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); - startQuestTimer("msg_7", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); + startQuestTimer("msg_7", 7000, world.getNpc(DETON), null); } break; } @@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance 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)); - startQuestTimer("msg_8", 3000, _deton, null); + startQuestTimer("msg_8", 3000, world.getNpc(DETON), null); world.setStatus(6); } break; @@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance _seal_device.setDisplayEffect(3); _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)); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); - startQuestTimer("msg_11", 3000, _deton, null); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); + startQuestTimer("msg_11", 3000, world.getNpc(DETON), null); break; } case SEALED_ANGEL: @@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) { world.setStatus(2); - _deton.setTarget(null); - _deton.stopMove(null); - startQuestTimer("msg_4", 7000, _deton, null); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(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.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); - startQuestTimer("end_instance", 190000, _deton, null); - startQuestTimer("spawn_stacato", 5000, _deton, null); + startQuestTimer("end_instance", 190000, world.getNpc(DETON), null); + startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null); } break; } @@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(0)) { - startQuestTimer("check_status", 21000, _deton, player); + startQuestTimer("check_status", 21000, world.getNpc(DETON), player); world.setStatus(1); } break; @@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance 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)); - _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); + 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, world.getNpc(DETON), player); world.setStatus(5); } break; @@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _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); + 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, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); - startQuestTimer("spawn_scarab", 7000, _deton, player); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); + startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance { switch (npc.getId()) { - case DETON: - { - _deton = npc; - break; - } case SEAL_DEVICE: { _seal_device = npc; @@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance } case FLAME_STACATO: { - startQuestTimer("check_flower", 3000, npc, null, true); + startQuestTimer("check_flower", 3000, npc, null); break; } case FLAME_SCORPION: diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 72d5e30e36..e53345de20 100644 --- a/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -34,7 +34,7 @@ import instances.AbstractInstance; * Nornils Garden Instance * @URL https://l2wiki.com/Nornils_Garden * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs - * @author Gigi + * @author Gigi, Mobius * @date 2017-02-22 - [15:22:27] */ public class NornilsGarden extends AbstractInstance @@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200016, true); - cancelQuestTimers("stage2"); + cancelQuestTimer("stage2", npc, null); world.spawnGroup("wave_3"); } break; @@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200201, true); - cancelQuestTimers("stage3"); - cancelQuestTimers("check_agrro"); + cancelQuestTimer("stage3", npc, null); } break; } 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 -> { @@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); } }); + startQuestTimer("check_agrro", 1000, npc, null); } break; } @@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance { if (npc.getId() == BOZ_STAGE1) { - cancelQuestTimers("stage1_1"); + cancelQuestTimer("stage1_1", npc, null); world.openCloseDoor(16200015, true); world.setStatus(1); } @@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) { ((Attackable) npc).setCanReturnToSpawnPoint(false); - startQuestTimer("check_agrro", 1000, npc, null, true); + startQuestTimer("check_agrro", 1000, npc, null); } return super.onSpawn(npc); } diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java index 59a416f01e..15679fe90f 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Frintezza/ScarletVanHalisha.java @@ -100,8 +100,8 @@ public class ScarletVanHalisha extends AbstractNpcAI @Override public String onKill(Npc npc, PlayerInstance killer, boolean isSummon) { - cancelQuestTimers("attack"); - cancelQuestTimers("random_Target"); + cancelQuestTimer("attack", npc, null); + cancelQuestTimer("random_Target", npc, null); return super.onKill(npc, killer, isSummon); } diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java index fc11f466be..b85aad2397 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/ai/bosses/Octavis/OctavisWarzone.java @@ -171,7 +171,7 @@ public class OctavisWarzone extends AbstractInstance { world.openCloseDoor(MAIN_DOOR_2, false); world.openCloseDoor(MAIN_DOOR_1, false); - world.getParameters().set("TELEPORT_ACTIVE", true); + world.setParameter("TELEPORT_ACTIVE", true); npc.teleToLocation(BATTLE_LOC); playMovie(world, Movie.SC_OCTABIS_OPENING); getTimers().addTimer("START_STAGE_1", 26500, npc, null); diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java index 5560b81d40..de7cc1efbf 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/AltarOfShilen/AltarOfShilen.java @@ -252,7 +252,7 @@ public class AltarOfShilen extends AbstractInstance world.setStatus(7); onStatusChanged(world); npc.deleteMe(); - cancelQuestTimers("check_player"); + cancelQuestTimer("check_player", npc, null); } break; } diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java index 809462089e..ba07db28a2 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/AshenShadowRevolutionaries/AshenShadowRevolutionaries.java @@ -192,7 +192,7 @@ public class AshenShadowRevolutionaries extends AbstractInstance } 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)) { captive.getEffectList().startAbnormalVisualEffect(AbnormalVisualEffect.FLESH_STONE); diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java index 00d469835f..996b9ff6bf 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/ChamberOfProphecies/ChamberOfProphecies.java @@ -73,321 +73,373 @@ public class ChamberOfProphecies extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - if (event.equals("enterInstance")) + switch (event) { - final QuestState qs = player.getQuestState(Q11027_PathOfDestinyOvercome.class.getSimpleName()); - if (qs != null) + case "31639-01.html": + case "33996-01.html": + case "33980-01.html": + case "33980-02.html": { - enterInstance(player, npc, TEMPLATE_ID); - if (hasQuestItems(player, PROPHECY_MACHINE)) - { - takeItems(player, PROPHECY_MACHINE, 1); - } - qs.setCond(4, true); + htmltext = event; + break; } - } - else if (player != null) - { - final Instance world = player.getInstanceWorld(); - if (!isInInstance(world)) + case "33996-02.html": { - return null; + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.broadcastPacket(ExShowUsm.USM_Q015_E); + world.despawnGroup("q10753_16_instance_grail"); + world.spawnGroup("q10753_16_instance_wizard"); + giveItems(player, ATELIA, 1); + showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; } - - switch (event) + case "33980-03.html": { - case "31639-01.html": - case "33996-01.html": - case "33980-01.html": - case "33980-02.html": + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-04.html": + { + showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); + htmltext = event; + break; + } + case "33980-05.html": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; - break; + return null; } - case "33996-02.html": + world.spawnGroup("q10753_16_instance_halter_2"); + world.setStatus(6); + startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); + htmltext = event; + break; + } + case "enterInstance": + { + final QuestState qs = player.getQuestState(Q11027_PathOfDestinyOvercome.class.getSimpleName()); + if (qs != null) { - world.broadcastPacket(ExShowUsm.USM_Q015_E); - world.despawnGroup("q10753_16_instance_grail"); - world.spawnGroup("q10753_16_instance_wizard"); - giveItems(player, ATELIA, 1); - showOnScreenMsg(player, NpcStringId.TALK_TO_THE_MYSTERIOUS_WIZARD, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-03.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-04.html": - { - showOnScreenMsg(player, NpcStringId.THIS_CHOICE_CANNOT_BE_REVERSED, ExShowScreenMessage.TOP_CENTER, 6000); - htmltext = event; - break; - } - case "33980-05.html": - { - world.spawnGroup("q10753_16_instance_halter_2"); - world.setStatus(6); - startQuestTimer("DESPAWN_WIZARD", 2000, npc, player); - htmltext = event; - break; - } - case "status": - { - if (world.isStatus(0)) + enterInstance(player, npc, TEMPLATE_ID); + if (hasQuestItems(player, PROPHECY_MACHINE)) { - htmltext = "31639-01.html"; + 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": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.isStatus(0)) + { + htmltext = "31639-01.html"; + break; + } + htmltext = "31639-02.html"; + break; + } + case "CHECK_STATUS": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + switch (world.getStatus()) + { + case 0: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); + startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); + startQuestTimer("OPEN_DOOR1", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); break; } - htmltext = "31639-02.html"; - 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": - { - switch (world.getStatus()) + case 1: { - case 0: + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY2", 14000, world.getNpc(FERIN), player); - startQuestTimer("SEY_KAIN", 24000, world.getNpc(VAN_HALTER), player); - startQuestTimer("OPEN_DOOR1", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 1: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.spawnGroup("wof_room2_1"); - world.setStatus(2); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 2: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); - startQuestTimer("OPEN_DOOR2", 5000, npc, player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 3: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(4); - world.spawnGroup("wof_room3_2"); - world.openCloseDoor(DOOR_3, false); - startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); - } - startQuestTimer("CHECK_STATUS", 7000, npc, player); - break; - } - case 4: - { - if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) - { - world.setStatus(5); - world.spawnGroup("wof_room4"); - startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); - startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); - } - else - { - startQuestTimer("CHECK_STATUS", 7000, npc, player); - } - break; + world.spawnGroup("wof_room2_1"); + world.setStatus(2); } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; } - break; - } - case "ATTACK": - case "ATTACK1": - case "ATTACK2": - { - npc.setRunning(); - ((Attackable) npc).setCanReturnToSpawnPoint(false); - if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) + case 2: { - npc.setTarget(player); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - } - else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) - { - World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) { - addAttackDesire(npc, monster); - return; - }); + startQuestTimer("SEY3", 8000, world.getNpc(FERIN), player); + startQuestTimer("OPEN_DOOR2", 5000, npc, player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 3: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(4); + world.spawnGroup("wof_room3_2"); + world.openCloseDoor(DOOR_3, false); + startQuestTimer("SEY_KAIN_1", 5000, world.getNpc(VAN_HALTER), player); + } + startQuestTimer("CHECK_STATUS", 7000, npc, player); + break; + } + case 4: + { + if (world.getAliveNpcs(MonsterInstance.class).isEmpty()) + { + world.setStatus(5); + world.spawnGroup("wof_room4"); + startQuestTimer("SEY_KAIN_2", 3000, world.getNpc(VAN_HALTER), player); + startQuestTimer("SEY4", 7000, world.getNpc(FERIN), player); + } + else + { + startQuestTimer("CHECK_STATUS", 7000, npc, player); + } + break; } - break; } - case "OPEN_DOOR1": + break; + } + case "ATTACK": + case "ATTACK1": + case "ATTACK2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - cancelQuestTimers("ATTACK"); - world.setStatus(1); - world.openCloseDoor(DOOR_2, true); - world.spawnGroup("wof_room2"); - break; + return null; } - case "OPEN_DOOR2": - { - cancelQuestTimers("ATTACK1"); - startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); - world.setStatus(3); - world.spawnGroup("wof_room3"); - world.openCloseDoor(DOOR_3, true); - break; - } - case "BROADCAST_TEXT": + npc.setRunning(); + ((Attackable) npc).setCanReturnToSpawnPoint(false); + if (npc.isScriptValue(0) && world.getAliveNpcs(MonsterInstance.class).isEmpty()) { npc.setTarget(player); - npc.setRunning(); npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); - break; } - case "SEY2": + else if (npc.getAI().getIntention() != CtrlIntention.AI_INTENTION_ATTACK) { - if (npc.getId() == FERIN) + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, 3000, monster -> { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); - } - break; + addAttackDesire(npc, monster); + return; + }); } - case "SEY_KAIN": + break; + } + case "OPEN_DOOR1": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == VAN_HALTER) - { - startQuestTimer("ATTACK1", 200, npc, player, true); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY3": + cancelQuestTimer("ATTACK", npc, player); + world.setStatus(1); + world.openCloseDoor(DOOR_2, true); + world.spawnGroup("wof_room2"); + break; + } + case "OPEN_DOOR2": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); - player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); - } - break; + return null; } - case "SEY_KAIN_1": + cancelQuestTimer("ATTACK1", npc, player); + startQuestTimer("ATTACK2", 200, world.getNpc(VAN_HALTER), player, true); + world.setStatus(3); + world.spawnGroup("wof_room3"); + world.openCloseDoor(DOOR_3, true); + break; + } + case "BROADCAST_TEXT": + { + npc.setTarget(player); + npc.setRunning(); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_GUY_KAIN_HAS_A_SMARMY_FACE)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_7", 0, 0, 0, 0, 0)); + break; + } + case "SEY2": + { + if (npc.getId() == FERIN) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.YOU_CAN_T_DIE_HERE_I_DIDN_T_LEARN_RESURRECT_YET)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_4", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_2": + break; + } + case "SEY_KAIN": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); - player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); - startQuestTimer("SEY_KAIN_3", 7000, npc, player); - } - break; + startQuestTimer("ATTACK1", 200, npc, player, true); + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GISELLE_WAS_SUCH_A_SWEET_CHILD)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_1", 0, 0, 0, 0, 0)); } - case "SEY4": + break; + } + case "SEY3": + { + if (npc.getId() == FERIN) { - if (npc.getId() == FERIN) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); - startQuestTimer("REST", 5000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.DO_YOU_THINK_I_LL_GROW_TALLER_IF_I_EAT_LOTS_AND_LOTS)); + player.sendPacket(new PlaySound(3, "Npcdialog1.apple_quest_6", 0, 0, 0, 0, 0)); } - case "SEY_KAIN_3": + break; + } + case "SEY_KAIN_1": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == VAN_HALTER) - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); - startQuestTimer("SEY_KAIN_4", 1000, npc, player); - npc.setScriptValue(1); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.SUCH_MONSTERS_IN_A_PLACE_LIKE_THIS_UNBELIEVABLE)); } - case "REST": + break; + } + case "SEY_KAIN_2": + { + if (npc.getId() == VAN_HALTER) { - if (npc.getId() == FERIN) - { - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); - cancelQuestTimers("BROADCAST_TEXT"); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.THAT_S_THE_MONSTER_THAT_ATTACKED_FAERON_YOU_RE_OUTMATCHED_HERE_GO_AHEAD_I_LL_CATCH_UP)); + player.sendPacket(new PlaySound(3, "Npcdialog1.holter_quest_6", 0, 0, 0, 0, 0)); + startQuestTimer("SEY_KAIN_3", 7000, npc, player); } - case "SEY_KAIN_4": + break; + } + case "SEY4": + { + if (npc.getId() == FERIN) { - world.setStatus(5); - world.spawnGroup("q10753_16_instance_grail"); - showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); - world.openCloseDoor(DOOR_4, true); - cancelQuestTimers("ATTACK2"); - npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); - startQuestTimer("CLOSE", 15000, null, player); - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.GO_NOW_KAIN_CAN_HANDLE_THIS)); + startQuestTimer("REST", 5000, npc, player); + npc.setScriptValue(1); } - case "CLOSE": + break; + } + case "SEY_KAIN_3": + { + if (npc.getId() == VAN_HALTER) { - final Npc grail = world.getNpc(GRAIL); - if ((grail != null) && (player.calculateDistance2D(grail) < 390)) - { - world.openCloseDoor(DOOR_4, false); - world.despawnGroup("q10753_16_instance_halter_1_1"); - world.despawnGroup("wof_room4"); - } - else - { - startQuestTimer("CLOSE", 3000, npc, player); - } - break; + npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, npc.getId(), NpcStringId.LEAVE_THIS_TO_ME_GO)); + startQuestTimer("SEY_KAIN_4", 1000, npc, player); + npc.setScriptValue(1); } - case "DESPAWN_WIZARD": + break; + } + case "REST": + { + if (npc.getId() == FERIN) { - world.despawnGroup("q10753_16_instance_wizard"); - break; + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, player); + cancelQuestTimer("BROADCAST_TEXT", npc, player); } - case "exit": + break; + } + case "SEY_KAIN_4": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - 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)); - final QuestState qs = player.getQuestState(Q11027_PathOfDestinyOvercome.class.getSimpleName()); - if (qs != null) - { - qs.setCond(5, true); - } - break; + return null; } - case "finish": + world.setStatus(5); + world.spawnGroup("q10753_16_instance_grail"); + showOnScreenMsg(player, NpcStringId.LEAVE_THIS_PLACE_TO_KAIN_NGO_TO_THE_NEXT_ROOM, ExShowScreenMessage.TOP_CENTER, 6000); + world.openCloseDoor(DOOR_4, true); + cancelQuestTimer("ATTACK2", npc, player); + npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE, player); + startQuestTimer("CLOSE", 15000, null, player); + break; + } + case "CLOSE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - world.finishInstance(0); - break; + return null; } + final Npc grail = world.getNpc(GRAIL); + if ((grail != null) && (player.calculateDistance2D(grail) < 390)) + { + world.openCloseDoor(DOOR_4, false); + world.despawnGroup("q10753_16_instance_halter_1_1"); + world.despawnGroup("wof_room4"); + } + else + { + startQuestTimer("CLOSE", 3000, npc, player); + } + break; + } + case "DESPAWN_WIZARD": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.despawnGroup("q10753_16_instance_wizard"); + break; + } + case "exit": + { + 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(1)); + final QuestState qs = player.getQuestState(Q11027_PathOfDestinyOvercome.class.getSimpleName()); + if (qs != null) + { + qs.setCond(5, true); + } + break; + } + case "finish": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.finishInstance(0); + break; } } return htmltext; diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java index 7974ad1cf7..de5eb62657 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/DimensionalWrap/DimensionalWrap.java @@ -17,10 +17,8 @@ package instances.DimensionalWrap; import java.util.List; -import java.util.concurrent.ScheduledFuture; import org.l2jmobius.Config; -import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.CommonUtil; import org.l2jmobius.gameserver.data.xml.impl.SkillData; import org.l2jmobius.gameserver.enums.CategoryType; @@ -44,7 +42,7 @@ import instances.AbstractInstance; * Dimensional Wrap instance * @URL https://l2wiki.com/Dimensional_Warp * @Video https://www.youtube.com/watch?v=hOnzk0ELwIg - * @author Gigi + * @author Gigi, Mobius * @date 2018-09-04 - [14:33:31] */ public class DimensionalWrap extends AbstractInstance @@ -82,7 +80,7 @@ public class DimensionalWrap extends AbstractInstance 23480, // Abyssal Harpy 23481, // Abyssal Binder 23482, // Abyssal Archon - 23483 // Abyssal Golem + 23483, // Abyssal Golem }; private static final int[] TRAPS = { @@ -92,23 +90,18 @@ public class DimensionalWrap extends AbstractInstance 19559, // Damage trap, power 1 19560, // Damage trap, power 2 19561, // Damage trap, power 3 - 19562 // Heal Trap + 19562, // Heal Trap }; // Location 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 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); // Misc private static final int TEMPLATE_ID = 250; private static final int DIMENSIONAL_DARK_FORCES = 16415; 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() { @@ -125,429 +118,534 @@ public class DimensionalWrap extends AbstractInstance public String onAdvEvent(String event, Npc npc, PlayerInstance player) { String htmltext = null; - final Instance world = npc.getInstanceWorld(); - if (event.equals("enterInstance")) + + switch (event) { - if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + case "enterInstance": { - htmltext = "no_awakened.html"; + if (!player.isInCategory(CategoryType.SIXTH_CLASS_GROUP)) + { + htmltext = "no_awakened.html"; + } + else if (!player.isInParty()) + { + enterInstance(player, npc, TEMPLATE_ID); + } + else if (player.isInParty()) + { + if (!player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + } + else + { + final Party party = player.getParty(); + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) + { + enterInstance(member, npc, TEMPLATE_ID); + } + } + } + } + break; } - else if (!player.isInParty()) + case "33975-01.html": { - enterInstance(player, npc, TEMPLATE_ID); + htmltext = event; + break; } - else if (player.isInParty()) + case "12_warp_crystals": { - if (!player.getParty().isLeader(player)) + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.3); + if (!player.isInParty()) + { + world.setParameter("count", 12); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) { player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; } - else + switch (player.getParty().getMemberCount()) { - final Party party = player.getParty(); - final List members = party.getMembers(); - for (PlayerInstance member : members) + case 2: { - if (member.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE)) - { - enterInstance(member, npc, TEMPLATE_ID); - } + world.setParameter("count", 6); + checkCrystallCount(world, npc); + break; + } + case 3: + { + world.setParameter("count", 4); + checkCrystallCount(world, npc); + break; + } + case 4: + { + world.setParameter("count", 3); + checkCrystallCount(world, npc); + break; } } + break; } - } - if (isInInstance(world)) - { - switch (event) + case "240_warp_crystals": { - case "33975-01.html": + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) { - htmltext = event; + return null; + } + + world.setParameter("chance", 0.6); + if (!player.isInParty()) + { + world.setParameter("count", 240); + checkCrystallCount(world, npc); break; } - case "12_warp_crystals": + else if (player.isInParty() && !player.getParty().isLeader(player)) { - _chance = 0.3; - if (!player.isInParty()) + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - _count = 12; + world.setParameter("count", 120); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 3: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 6; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 4; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 3; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "240_warp_crystals": - { - _chance = 0.6; - if (!player.isInParty()) - { - _count = 240; + world.setParameter("count", 80); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + case 4: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); - break; - } - switch (player.getParty().getMemberCount()) - { - case 2: - { - _count = 120; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 80; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 60; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "1200_warp_crystals": - { - _chance = 0.9; - if (!player.isInParty()) - { - _count = 1200; + world.setParameter("count", 60); checkCrystallCount(world, npc); break; } - else if (player.isInParty() && !player.getParty().isLeader(player)) + } + break; + } + case "1200_warp_crystals": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + world.setParameter("chance", 0.9); + if (!player.isInParty()) + { + world.setParameter("count", 1200); + checkCrystallCount(world, npc); + break; + } + else if (player.isInParty() && !player.getParty().isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + break; + } + switch (player.getParty().getMemberCount()) + { + case 2: { - player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + world.setParameter("count", 600); + checkCrystallCount(world, npc); break; } - switch (player.getParty().getMemberCount()) + case 3: { - case 2: - { - _count = 600; - checkCrystallCount(world, npc); - break; - } - case 3: - { - _count = 400; - checkCrystallCount(world, npc); - break; - } - case 4: - { - _count = 300; - checkCrystallCount(world, npc); - break; - } - } - break; - } - case "send_6_f": - { - if (_worldState == 0) - { - htmltext = "33975-02.html"; + world.setParameter("count", 400); + checkCrystallCount(world, npc); break; } - if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + case 4: { - htmltext = "33975-05.html"; + world.setParameter("count", 300); + checkCrystallCount(world, npc); break; } - - for (Npc n : world.getAliveNpcs()) + } + break; + } + case "send_6_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) + n.deleteMe(); + } + } + if (world.getStatus() < 5) + { + world.setStatus(5); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_11_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 10) + { + world.setStatus(10); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_16_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 15) + { + world.setStatus(15); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(THIRD_TELEPORT, world.getTemplateId()); + } + break; + } + case "send_21_f": + { + final Instance world = npc.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 20) + { + world.setStatus(20); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(TELEPORTS, world.getTemplateId()); + } + break; + } + case "send_26_f": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + + if (world.getParameters().getInt("worldState", 0) == 0) + { + htmltext = "33975-02.html"; + break; + } + if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + { + htmltext = "33975-05.html"; + break; + } + + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) + { + n.deleteMe(); + } + } + if (world.getStatus() < 25) + { + world.setStatus(25); + cancelQuestTimer("SECOND_SPAWN", null, world.getFirstPlayer()); + cancelQuestTimer("THIRD_SPAWN", null, world.getFirstPlayer()); + startQuestTimer("START_STAGE", 5000, null, world.getFirstPlayer()); + } + for (PlayerInstance pl : world.getPlayers()) + { + pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); + } + break; + } + case "jump_location": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + player.teleToLocation(TELEPORTS, world.getTemplateId()); + break; + } + case "SALAMANDRA_SPAWN": + case "SALAMANDRA_SPAWN_DUMMY": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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(); + World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> + { + if ((p != null) && !p.isDead()) { - n.deleteMe(); + addAttackPlayerDesire(salamandra, p); } - } - if (world.getStatus() < 5) - { - world.setStatus(5); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FIRST_TELEPORT, world.getTemplateId()); - } - break; + }); } - case "send_11_f": + break; + } + case "START_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 2)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 10) - { - world.setStatus(10); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(SECOND_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_16_f": + world.setStatus(world.getStatus() + 1); + world.setParameter("worldState", world.getStatus()); + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.DIMENSIONAL_WARP_LV_S1, ExShowScreenMessage.TOP_CENTER, 10000, true, String.valueOf(world.getStatus()))); + startQuestTimer("FIRST_SPAWN", 1500, null, world.getFirstPlayer()); + break; + } + case "FIRST_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 3)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 15) - { - world.setStatus(15); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(THRID_TELEPORT, world.getTemplateId()); - } - break; + return null; } - case "send_21_f": + final int worldState = world.getParameters().getInt("worldState", 0); + world.spawnGroup(worldState + "_first_spawn"); + world.spawnGroup(worldState + "_trap_spawn"); + startQuestTimer("SECOND_SPAWN", 40000, null, world.getFirstPlayer()); + startQuestTimer("DEBUFF_TASK", 10000, null, world.getFirstPlayer(), true); + break; + } + case "DEBUFF_TASK": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) { - if (_worldState == 0) - { - htmltext = "33975-02.html"; - break; - } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 4)) - { - htmltext = "33975-05.html"; - break; - } - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - if (world.getStatus() < 20) - { - world.setStatus(20); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(TELEPORTS, world.getTemplateId()); - } - break; + return null; } - case "send_26_f": + int skilllevel = 1; + final int worldState = world.getParameters().getInt("worldState", 0); + if ((worldState > 0) && (worldState <= 11)) { - if (_worldState == 0) + 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()) + { + if ((p != null) && !p.isDead()) { - htmltext = "33975-02.html"; - break; + skill.applyEffects(p, p); } - if ((player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL", 0) == 0) || (player.getVariables().getInt("DIMENSIONAL_WRAP_LEVEL") < 5)) + } + break; + } + case "SECOND_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_second_spawn"); + startQuestTimer("THIRD_SPAWN", 40000, null, world.getFirstPlayer()); + break; + } + case "THIRD_SPAWN": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + world.spawnGroup(world.getParameters().getInt("worldState", 0) + "_thred_spawn"); + break; + } + case "CHANGE_LOCATION": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + 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; + } + case "SWITCH_STAGE": + { + final Instance world = player.getInstanceWorld(); + if (!isInInstance(world)) + { + return null; + } + if (world.getAliveNpcs(MONSTERS).isEmpty()) + { + world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); + world.broadcastPacket(new Earthquake(npc, 50, 5)); + world.openCloseDoor(world.getTemplateParameters().getInt(world.getParameters().getInt("worldState", 0) + "_st_door"), true); + clean(world.getFirstPlayer()); + if (world.getParameters().getInt("worldState", 0) < 35) { - htmltext = "33975-05.html"; - break; + startQuestTimer("NEXT_STAGE", 5000, null, world.getFirstPlayer()); } - for (Npc n : world.getAliveNpcs()) + } + break; + } + 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.setDuration((int) ((world.getRemainingTime() / 60000) + 3)); + startQuestTimer("START_STAGE", 8000, null, world.getFirstPlayer()); + for (Npc n : world.getAliveNpcs()) + { + if (n.getId() != EINSTER) { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } + n.deleteMe(); } - if (world.getStatus() < 25) - { - world.setStatus(25); - cancelQuestTimers("SECOND_SPAWN"); - cancelQuestTimers("THRID_SPAWN"); - startQuestTimer("START_STAGE", 5000, npc, null); - } - for (PlayerInstance pl : world.getPlayers()) - { - pl.teleToLocation(FOURTH_TELEPORT, world.getTemplateId()); - } - break; - } - case "jump_location": - { - player.teleToLocation(TELEPORTS, world.getTemplateId()); - break; - } - case "SALAMANDRA_SPAWN": - case "SALAMANDRA_SPAWN_DUMMY": - { - if (getRandom(100) < (_worldState / 2)) - { - final Npc salamandra = addSpawn(_worldState < 17 ? DIMENSIONAL_SALAMANDRA : UNWORDLY_SALAMANDER, npc, false, 0, false, world.getId()); - salamandra.setRunning(); - World.getInstance().forEachVisibleObjectInRange(salamandra, PlayerInstance.class, 2500, p -> - { - if ((p != null) && !p.isDead()) - { - addAttackPlayerDesire(salamandra, p); - } - }); - } - break; - } - case "START_STAGE": - { - world.setStatus(world.getStatus() + 1); - _worldState = 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); - break; - } - case "FIRST_SPAWN": - { - world.spawnGroup(_worldState + "_first_spawn"); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("SECOND_SPAWN", 40000, npc, null); - _debufTask = ThreadPool.scheduleAtFixedRate(() -> - { - 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()) - { - if ((p != null) && !p.isDead()) - { - skill.applyEffects(p, p); - } - } - }, 5000, 10000); - break; - } - case "SECOND_SPAWN": - { - world.spawnGroup(_worldState + "_second_spawn"); - startQuestTimer("THRID_SPAWN", 40000, npc, null); - break; - } - case "THRID_SPAWN": - { - world.spawnGroup(_worldState + "_thred_spawn"); - break; - } - case "CHANGE_LOCATION": - { - world.getAliveNpcs(TRAPS).forEach(Npc::deleteMe); - world.spawnGroup(_worldState + "_trap_spawn"); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1430), npc, null); - break; - } - case "SWITCH_STAGE": - { - if (world.getAliveNpcs(MONSTERS).isEmpty()) - { - world.broadcastPacket(new ExShowScreenMessage(NpcStringId.THE_SURROUNDING_ENERGY_HAS_DISSIPATED, ExShowScreenMessage.TOP_CENTER, 5000, true)); - world.broadcastPacket(new Earthquake(npc, 50, 5)); - world.openCloseDoor(world.getTemplateParameters().getInt(_worldState + "_st_door"), true); - clean(); - if (_worldState < 35) - { - startQuestTimer("NEXT_STAGE", 5000, npc, null); - } - } - break; - } - case "NEXT_STAGE": - { - 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)); - startQuestTimer("START_STAGE", 8000, npc, null); - for (Npc n : world.getAliveNpcs()) - { - if (n.getId() != EINSTER) - { - n.deleteMe(); - } - } - break; } + break; } } return htmltext; @@ -559,19 +657,20 @@ public class DimensionalWrap extends AbstractInstance final Instance world = npc.getInstanceWorld(); 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()); 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()); 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()); 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.finishInstance(3); - clean(); + clean(world.getFirstPlayer()); } } return super.onKill(npc, killer, isSummon); @@ -590,7 +689,8 @@ public class DimensionalWrap extends AbstractInstance @Override 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"; } @@ -607,18 +707,18 @@ public class DimensionalWrap extends AbstractInstance { case SALAMANDRA_GENERATOR: { - startQuestTimer("SALAMANDRA_SPAWN", 25000, npc, null, true); - startQuestTimer("CHANGE_LOCATION", 60000 - (_worldState * 1300), npc, null); + startQuestTimer("SALAMANDRA_SPAWN", 25000, null, world.getFirstPlayer(), true); + startQuestTimer("CHANGE_LOCATION", 60000 - (world.getParameters().getInt("worldState", 0) * 1300), null, world.getFirstPlayer()); break; } case SALAMANDRA_GENERATOR_DUMMY: { - startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, npc, null, true); + startQuestTimer("SALAMANDRA_SPAWN_DUMMY", 20000, null, world.getFirstPlayer(), true); break; } case DEMINSIONAL_INVISIBLE_FRAGMENT: { - startQuestTimer("SWITCH_STAGE", 5000, npc, null, true); + startQuestTimer("SWITCH_STAGE", 5000, null, world.getFirstPlayer(), true); break; } } @@ -631,42 +731,38 @@ public class DimensionalWrap extends AbstractInstance boolean canStart = true; 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()) { final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId()); 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(new SystemMessage(SystemMessageId.C1_S_ITEM_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addString(ps.getName())); canStart = false; } } } - if (!canStart || (_worldState != 0)) + if (!canStart || (world.getParameters().getInt("worldState", 0) != 0)) { return; } - startQuestTimer("START_STAGE", 1000, npc, null); + startQuestTimer("START_STAGE", 1000, null, world.getFirstPlayer()); 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"); - cancelQuestTimers("SALAMANDRA_SPAWN"); - cancelQuestTimers("SALAMANDRA_SPAWN_DUMMY"); - cancelQuestTimers("CHANGE_LOCATION"); - if (_debufTask != null) - { - _debufTask.cancel(false); - _debufTask = null; - } + cancelQuestTimer("SWITCH_STAGE", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN", null, player); + cancelQuestTimer("SALAMANDRA_SPAWN_DUMMY", null, player); + cancelQuestTimer("CHANGE_LOCATION", null, player); + cancelQuestTimer("DEBUFF_TASK", null, player); } public static void main(String[] args) diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java index c44c3a56c4..d0f7507655 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/MysticTavern/StoryOfTauti/StoryOfTauti.java @@ -55,7 +55,7 @@ import quests.Q00833_DevilsTreasureTauti.Q00833_DevilsTreasureTauti; /** * Mystic Tavern Tauti Instance * @VIDEO https://www.youtube.com/watch?v=uPXWZ1ZCtFk - * @author Gigi + * @author Gigi, Mobius */ 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 int ZONE_1ST_TRIGER = 24137770; private static final int SKILL_TRIGER = 24138880; - private static Npc _deton; private static Npc _seal_device; protected int _count = 0; public StoryOfTauti() { 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); addKillId(FLAME_STACATO, FLAME_SCORPION, SEAL_TOMBSTONE, SEALED_ANGEL); addSkillSeeId(FLAME_FLOWER, SEAL_TOMBSTONE); @@ -142,9 +141,9 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(1) || world.isStatus(4)) { - _deton.setTarget(player); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); + world.getNpc(DETON).setTarget(player); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player); } else { @@ -155,64 +154,64 @@ public class StoryOfTauti extends AbstractInstance } 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 -> { if ((pl != null) && ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM())) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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; } case "msg_1": { - _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); + 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, world.getNpc(DETON), null); break; } case "msg_2": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); - startQuestTimer("msg_3", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DON_T_WORRY_ABOUT_THE_REWARD_WE_LL_FIND_THAT_TREASURE); + startQuestTimer("msg_3", 10000, world.getNpc(DETON), null); break; } 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; } case "msg_4": { - _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); - startQuestTimer("msg_5", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_I_M_SURE_I_VE_SEEN_THIS_BEFORE_YES_THAT_MEANS_THE_STAKATOS); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE); + startQuestTimer("msg_5", 7000, world.getNpc(DETON), null); break; } case "msg_5": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_stacato": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_1", 50000, _deton, null); + startQuestTimer("spawn_stacato_1", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_1": { world.spawnGroup("flame_stacato"); - startQuestTimer("spawn_stacato_2", 50000, _deton, null); + startQuestTimer("spawn_stacato_2", 50000, world.getNpc(DETON), null); break; } case "spawn_stacato_2": @@ -223,13 +222,13 @@ public class StoryOfTauti extends AbstractInstance } case "check_flower": { - if (!npc.isDead()) + if ((world != null) && !npc.isDead()) { for (Npc nearby : World.getInstance().getVisibleObjectsInRange(npc, FriendlyNpcInstance.class, 1000)) { if ((nearby.getId() == FLAME_FLOWER) && npc.isScriptValue(0) && nearby.isScriptValue(0)) { - _deton.setRunning(); + world.getNpc(DETON).setRunning(); addMoveToDesire(npc, nearby.getLocation(), 23); if (npc.calculateDistance3D(nearby) < 100) { @@ -245,6 +244,7 @@ public class StoryOfTauti extends AbstractInstance } } } + startQuestTimer("check_flower", 3000, npc, null); } break; } @@ -255,13 +255,13 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "spawn_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) { world.spawnGroup("ifrit"); @@ -275,7 +275,7 @@ public class StoryOfTauti extends AbstractInstance { 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); addAttackPlayerDesire(npc, pl); } @@ -288,36 +288,36 @@ public class StoryOfTauti extends AbstractInstance } case "msg_8": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); - startQuestTimer("msg_9", 8000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.OH_YOU_TRULY_ARE_AMAZING_YOU_ACTUALLY_DEFEATED_THOSE_NASTY_GUYS); + startQuestTimer("msg_9", 8000, world.getNpc(DETON), null); break; } case "msg_9": { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); - startQuestTimer("msg_10", 10000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THE_PATH_SPLITS_NOW_WELL_LET_S_GO_WHICH_WAY); + startQuestTimer("msg_10", 10000, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away", 10000, _deton, null); + startQuestTimer("run_away", 10000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 3500, _deton, null); + 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); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 3500, world.getNpc(DETON), null); break; } case "delete_daton": @@ -328,35 +328,35 @@ public class StoryOfTauti extends AbstractInstance } 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; } case "msg_12": { - _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); + 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, world.getNpc(DETON), null); break; } 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; } case "spawn_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)); - startQuestTimer("run_away_1", 8000, _deton, null); + startQuestTimer("run_away_1", 8000, world.getNpc(DETON), null); break; } 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); - _deton.setTarget(null); - _deton.stopMove(null); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); - startQuestTimer("delete_daton", 5000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.DO_SOMETHING_ABOUT_THESE_MONSTERS_SHOW_ME_YOUR_STRENGTH_I_LL_BE_WAITING_OVER_THERE); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(null); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_1); + startQuestTimer("delete_daton", 5000, world.getNpc(DETON), null); break; } case "switch_quest": @@ -496,7 +496,6 @@ public class StoryOfTauti extends AbstractInstance } case "end_instance": { - cancelQuestTimers("check_flower"); _count = 0; for (Npc n : world.getAliveNpcs()) { @@ -521,14 +520,14 @@ public class StoryOfTauti extends AbstractInstance { 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); break; } if (npc.isScriptValue(1) && (npc.getCurrentHpPercent() < 60)) { _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); break; } @@ -569,10 +568,10 @@ public class StoryOfTauti extends AbstractInstance if (world.isStatus(10) && (npc.getCurrentHpPercent() < 30)) { world.spawnGroup("last_deton"); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); - startQuestTimer("msg_12", 6000, _deton, null); - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_3); + startQuestTimer("msg_12", 6000, world.getNpc(DETON), null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.NICE_NICE_I_SEE_THAT_EVERYONE_S_FIGHTING_HARD_FOR_ME); world.setStatus(11); } 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_archagel"); 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()) { - cancelQuestTimers("end_instance"); - cancelQuestTimers("check_flower"); + cancelQuestTimer("end_instance", world.getNpc(DETON), null); world.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, true, true, 0, 0, NpcStringId.ELAPSED_TIME))); world.setStatus(4); World.getInstance().forEachVisibleObjectInRange(npc, PlayerInstance.class, 1000, pl -> { if ((pl.isInParty() && pl.getParty().isLeader(pl)) || pl.isGM()) { - _deton.setTarget(pl); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, pl); + world.getNpc(DETON).setTarget(pl); + world.getNpc(DETON).setRunning(); + 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); - startQuestTimer("msg_7", 7000, _deton, null); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ANYWAY_THE_STAKATOS_WILL_NOT_COME_OUT_ANYMORE_WHY_WELL); + startQuestTimer("msg_7", 7000, world.getNpc(DETON), null); } break; } @@ -650,7 +648,7 @@ public class StoryOfTauti extends AbstractInstance 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)); - startQuestTimer("msg_8", 3000, _deton, null); + startQuestTimer("msg_8", 3000, world.getNpc(DETON), null); world.setStatus(6); } break; @@ -660,9 +658,9 @@ public class StoryOfTauti extends AbstractInstance _seal_device.setDisplayEffect(3); _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)); - _deton.setRunning(); - _deton.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); - startQuestTimer("msg_11", 3000, _deton, null); + world.getNpc(DETON).setRunning(); + world.getNpc(DETON).getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, DETON_MOVE_2); + startQuestTimer("msg_11", 3000, world.getNpc(DETON), null); break; } case SEALED_ANGEL: @@ -690,13 +688,13 @@ public class StoryOfTauti extends AbstractInstance if (((player.isInParty() && player.getParty().isLeader(player)) || player.isGM()) && world.isStatus(1)) { world.setStatus(2); - _deton.setTarget(null); - _deton.stopMove(null); - startQuestTimer("msg_4", 7000, _deton, null); + world.getNpc(DETON).setTarget(null); + world.getNpc(DETON).stopMove(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.getPlayers().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 180, 0, NpcStringId.ELAPSED_TIME))); - startQuestTimer("end_instance", 190000, _deton, null); - startQuestTimer("spawn_stacato", 5000, _deton, null); + startQuestTimer("end_instance", 190000, world.getNpc(DETON), null); + startQuestTimer("spawn_stacato", 5000, world.getNpc(DETON), null); } break; } @@ -704,7 +702,7 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(0)) { - startQuestTimer("check_status", 21000, _deton, player); + startQuestTimer("check_status", 21000, world.getNpc(DETON), player); world.setStatus(1); } break; @@ -714,8 +712,8 @@ public class StoryOfTauti extends AbstractInstance 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)); - _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); + 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, world.getNpc(DETON), player); world.setStatus(5); } break; @@ -724,8 +722,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _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); + 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, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -753,8 +751,8 @@ public class StoryOfTauti extends AbstractInstance { if (world.isStatus(6)) { - _deton.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); - startQuestTimer("spawn_scarab", 7000, _deton, player); + world.getNpc(DETON).broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THIS_WAY_FEELS_MUCH_SAFER_GOOD_CHOICE_THE_AIR_FEELS_DIFFERENT); + startQuestTimer("spawn_scarab", 7000, world.getNpc(DETON), player); world.setStatus(7); } break; @@ -773,11 +771,6 @@ public class StoryOfTauti extends AbstractInstance { switch (npc.getId()) { - case DETON: - { - _deton = npc; - break; - } case SEAL_DEVICE: { _seal_device = npc; @@ -798,7 +791,7 @@ public class StoryOfTauti extends AbstractInstance } case FLAME_STACATO: { - startQuestTimer("check_flower", 3000, npc, null, true); + startQuestTimer("check_flower", 3000, npc, null); break; } case FLAME_SCORPION: diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index 72d5e30e36..e53345de20 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -34,7 +34,7 @@ import instances.AbstractInstance; * Nornils Garden Instance * @URL https://l2wiki.com/Nornils_Garden * @Video https://www.youtube.com/watch?v=6QKzzmJ5GUs - * @author Gigi + * @author Gigi, Mobius * @date 2017-02-22 - [15:22:27] */ public class NornilsGarden extends AbstractInstance @@ -120,7 +120,7 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(5) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200016, true); - cancelQuestTimers("stage2"); + cancelQuestTimer("stage2", npc, null); world.spawnGroup("wave_3"); } break; @@ -130,14 +130,13 @@ public class NornilsGarden extends AbstractInstance if (world.isStatus(6) && world.getAliveNpcs(ATTACABLE_MONSTERS).isEmpty()) { world.openCloseDoor(16200201, true); - cancelQuestTimers("stage3"); - cancelQuestTimers("check_agrro"); + cancelQuestTimer("stage3", npc, null); } break; } 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 -> { @@ -148,6 +147,7 @@ public class NornilsGarden extends AbstractInstance npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, knownChar); } }); + startQuestTimer("check_agrro", 1000, npc, null); } break; } @@ -209,7 +209,7 @@ public class NornilsGarden extends AbstractInstance { if (npc.getId() == BOZ_STAGE1) { - cancelQuestTimers("stage1_1"); + cancelQuestTimer("stage1_1", npc, null); world.openCloseDoor(16200015, true); world.setStatus(1); } @@ -301,7 +301,7 @@ public class NornilsGarden extends AbstractInstance if (isInInstance(world) && (CommonUtil.contains(ATTACABLE_MONSTERS, npc.getId()))) { ((Attackable) npc).setCanReturnToSpawnPoint(false); - startQuestTimer("check_agrro", 1000, npc, null, true); + startQuestTimer("check_agrro", 1000, npc, null); } return super.onSpawn(npc); } diff --git a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/instances/SSQDisciplesNecropolisPast/SSQDisciplesNecropolisPast.java b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/instances/SSQDisciplesNecropolisPast/SSQDisciplesNecropolisPast.java index 7f5f7a3e40..56b807f372 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/instances/SSQDisciplesNecropolisPast/SSQDisciplesNecropolisPast.java +++ b/L2J_Mobius_CT_2.4_Epilogue/dist/game/data/scripts/instances/SSQDisciplesNecropolisPast/SSQDisciplesNecropolisPast.java @@ -137,7 +137,7 @@ public class SSQDisciplesNecropolisPast extends AbstractInstance { 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) diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java index 19ba7adb05..b797b24607 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java @@ -1173,10 +1173,10 @@ public class FinalEmperialTomb extends AbstractInstance implements IXmlReader case 27: { final Npc activeScarlet = _world.getParameters().getObject("activeScarlet", Npc.class); - _world.getParameters().set("scarlet_x", activeScarlet.getX()); - _world.getParameters().set("scarlet_y", activeScarlet.getY()); - _world.getParameters().set("scarlet_z", activeScarlet.getZ()); - _world.getParameters().set("scarlet_h", activeScarlet.getHeading()); + _world.setParameter("scarlet_x", activeScarlet.getX()); + _world.setParameter("scarlet_y", activeScarlet.getY()); + _world.setParameter("scarlet_z", activeScarlet.getZ()); + _world.setParameter("scarlet_h", activeScarlet.getHeading()); final int scarlet_a; 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)); } - _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, 10000, 0, 0, 1, 0, 0)); ThreadPool.schedule(new IntroTask(_world, 28), 500); diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/SSQDisciplesNecropolisPast/SSQDisciplesNecropolisPast.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/SSQDisciplesNecropolisPast/SSQDisciplesNecropolisPast.java index 7f5f7a3e40..56b807f372 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/SSQDisciplesNecropolisPast/SSQDisciplesNecropolisPast.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/instances/SSQDisciplesNecropolisPast/SSQDisciplesNecropolisPast.java @@ -137,7 +137,7 @@ public class SSQDisciplesNecropolisPast extends AbstractInstance { 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) diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java index 9e96a6c534..483c25da9e 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java @@ -43,17 +43,17 @@ public class ResidenceOfKingIgnis extends AbstractInstance private static final int FREYA = 29109; private static final int IGNIS = 29105; // Skills - private static SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1); - private static SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); - private static SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); - private static SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); - private static SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); - private static SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); - private static SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); - private static SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); - private static SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); - private static 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 FIRE_RAG_1 = new SkillHolder(50050, 1); + private static final SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); + private static final SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); + private static final SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); + private static final SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); + private static final SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); + private static final SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); + private static final SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); + private static final SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); + private static final SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10); + private static final SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect // Misc private static final int TEMPLATE_ID = 195; private static final Map _playerFireRage = new ConcurrentHashMap<>(); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java index 07464caee8..a4ef09a813 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java @@ -18,9 +18,7 @@ package instances.ResidenceOfKingPetram; import org.l2jmobius.gameserver.enums.ChatType; 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.RaidBossInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.skills.Skill; @@ -28,7 +26,7 @@ import org.l2jmobius.gameserver.model.skills.Skill; import instances.AbstractInstance; /** - * @author RobikBobik + * @author RobikBobik, Mobius * @NOTE: Retail like working * @TODO: Rewrite code to modern style. * @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_FRAGMENT = 29117; // Skills - private static 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 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 EARTH_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. + private static final SkillHolder EARTH_FURY = new SkillHolder(50059, 1); // When change invul state. + 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 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() { @@ -70,54 +62,63 @@ public class ResidenceOfKingPetram extends AbstractInstance case "ENTER": { enterInstance(player, npc, TEMPLATE_ID); - if (player.getInstanceWorld() != null) - { - _petram = (RaidBossInstance) player.getInstanceWorld().getNpc(PETRAM); - } break; } case "SPAWN_MINION": { - _petram.useMagic(EARTh_ENERGY.getSkill()); - - // Prevent to double or higher spawn when HP is between 68-70% + etc... - if (!_spawned_minions) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _minion_1 = (MonsterInstance) 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()); - _minion_3 = (MonsterInstance) 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()); - _spawned_minions = true; + world.getNpc(PETRAM).doCast(EARTH_ENERGY.getSkill()); + + // Prevent to double or higher spawn when HP is between 68-70% + etc... + if (!world.getParameters().getBoolean("spawnedMinions", false)) + { + world.setParameter("minion1", addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId())); + world.setParameter("minion2", addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId())); + world.setParameter("minion3", addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId())); + world.setParameter("minion4", addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId())); + world.getParameters().set("spawnedMinions", true); + } + + startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); } - - startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); break; } case "SUPPORT_PETRAM": { - _minion_1.setTarget(_petram); - _minion_1.useMagic(TEST.getSkill()); - _minion_2.setTarget(_petram); - _minion_2.useMagic(TEST.getSkill()); - _minion_3.setTarget(_petram); - _minion_3.useMagic(TEST.getSkill()); - _minion_4.setTarget(_petram); - _minion_4.useMagic(TEST.getSkill()); - startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 + final Instance world = npc.getInstanceWorld(); + if (world != null) + { + world.getParameters().getObject("minion1", Npc.class).setTarget(world.getNpc(PETRAM)); + world.getParameters().getObject("minion1", Npc.class).doCast(TEST.getSkill()); + world.getParameters().getObject("minion2", Npc.class).setTarget(world.getNpc(PETRAM)); + world.getParameters().getObject("minion2", Npc.class).doCast(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 + } break; } case "INVUL_MODE": { - _petram.useMagic(EARTh_FURY.getSkill()); - if (_petram.isInvul()) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _petram.setInvul(false); - _petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); - } - else - { - _petram.setInvul(true); - _petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + final Npc petram = world.getNpc(PETRAM); + petram.doCast(EARTH_FURY.getSkill()); + if (petram.isInvul()) + { + petram.setInvul(false); + petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); + } + else + { + petram.setInvul(true); + petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + } } break; } @@ -157,18 +158,20 @@ public class ResidenceOfKingPetram extends AbstractInstance @Override public String onKill(Npc npc, PlayerInstance player, boolean isSummon) { + final Instance world = npc.getInstanceWorld(); + if (world == null) + { + return null; + } + if (npc.getId() == PETRAM) { - final Instance world = npc.getInstanceWorld(); - if (world != null) - { - world.finishInstance(); - } + world.finishInstance(); } - else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead())) + 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())) { - startQuestTimer("INVUL_MODE", 3000, _petram, null); - _spawned_minions = false; + startQuestTimer("INVUL_MODE", 3000, world.getNpc(PETRAM), null); + world.getParameters().set("spawnedMinions", false); } return super.onKill(npc, player, isSummon); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java index 037761ceeb..afbf78b2c4 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java @@ -17,9 +17,7 @@ package instances.ResidenceOfKingProcella; 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.RaidBossInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.skills.SkillCaster; @@ -27,7 +25,7 @@ import org.l2jmobius.gameserver.model.skills.SkillCaster; import instances.AbstractInstance; /** - * @author RobikBobik + * @author RobikBobik, Mobius * @NOTE: Retail like working * @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 // Misc private static final int TEMPLATE_ID = 197; - private static int STORM_MAX_COUNT = 16; // TODO: Max is limit ? - private int _procellaStormCount; - private RaidBossInstance _procella; - private MonsterInstance _minion1; - private MonsterInstance _minion2; - private MonsterInstance _minion3; + private static final int STORM_MAX_COUNT = 16; // TODO: Max is limit ? public ResidenceOfKingProcella() { @@ -69,46 +62,56 @@ public class ResidenceOfKingProcella extends AbstractInstance case "ENTER": { enterInstance(player, npc, TEMPLATE_ID); - _procella = (RaidBossInstance) 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); - _procellaStormCount = 0; + final Instance world = player.getInstanceWorld(); + if (world != null) + { + 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; } 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()); - _minion2 = (MonsterInstance) 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()); - startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); + world.setParameter("minion1", addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId())); + world.setParameter("minion2", addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, 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, world.getNpc(PROCELLA), null); } break; } 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()); - final Npc procellaStorm = addSpawn(PROCELLA_STORM, _procella.getX() + getRandom(-500, 500), _procella.getY() + getRandom(-500, 500), _procella.getZ(), 31011, true, 0, true, npc.getInstanceId()); + world.getNpc(PROCELLA).doCast(HURRICANE_SUMMON.getSkill()); + 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); - _procellaStormCount++; - startQuestTimer("SPAWN_STORM", 60000, _procella, null); + world.getParameters().increaseInt("stormCount", 1); + startQuestTimer("SPAWN_STORM", 60000, world.getNpc(PROCELLA), null); startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking } break; } case "HIDE_PROCELLA": { - if (_procella.isInvisible()) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _procella.setInvisible(false); - } - else - { - _procella.setInvisible(true); - startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); + if (world.getNpc(PROCELLA).isInvisible()) + { + world.getNpc(PROCELLA).setInvisible(false); + } + else + { + world.getNpc(PROCELLA).setInvisible(true); + startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), world.getNpc(PROCELLA), player); + } } break; } @@ -151,21 +154,24 @@ public class ResidenceOfKingProcella extends AbstractInstance @Override public String onKill(Npc npc, PlayerInstance player, boolean isSummon) { + final Instance world = npc.getInstanceWorld(); + if (world == null) + { + return null; + } + if (npc.getId() == PROCELLA) { - final Instance world = npc.getInstanceWorld(); - if (world != null) - { - cancelQuestTimer("SPAWN_MINION", npc, player); - cancelQuestTimer("SPAWN_STORM", npc, player); - cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); - world.finishInstance(); - } + cancelQuestTimer("SPAWN_MINION", npc, player); + cancelQuestTimer("SPAWN_STORM", npc, player); + cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); + world.finishInstance(); } - else if ((_minion1.isDead()) && (_minion2.isDead()) && (_minion3.isDead())) + else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead())) { - startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); + startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null); } + return super.onKill(npc, player, isSummon); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java index d94006962b..e8629219b7 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java @@ -41,12 +41,12 @@ public class ResidenceOfQueenNebula extends AbstractInstance private static final int WATER_SLIME = 29111; // Skills private static final int AQUA_RAGE = 50036; - private static SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); - private static SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); - private static SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); - private static SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); - private static SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); - private static SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); + private static final SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); + private static final SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); + private static final SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); + private static final SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); + private static final SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); + private static final SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); // Misc private static final int TEMPLATE_ID = 196; diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java index 3ec9af0c75..ae782e450b 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java @@ -47,10 +47,10 @@ public class SevenSignsRBs extends AbstractInstance private static final int ANAKIM_TEMPLATE_ID = 200; 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 _lilith_zone = ZoneManager.getInstance().getZoneById(70053, 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); // TELEPORTS private static final Location[] TELEPORT_TO_DARK_ELVEN = @@ -89,7 +89,7 @@ public class SevenSignsRBs extends AbstractInstance final boolean isInCC = party.isInCommandChannel(); final List 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."); } @@ -128,7 +128,7 @@ public class SevenSignsRBs extends AbstractInstance final boolean isInCC = party.isInCommandChannel(); final List 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."); } @@ -161,7 +161,7 @@ public class SevenSignsRBs extends AbstractInstance } case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM": { - for (Creature charInside : _anakim_zone.getCharactersInside()) + for (Creature charInside : ANAKIM_ZONE.getCharactersInside()) { if ((charInside != null) && charInside.isPlayer()) { @@ -172,7 +172,7 @@ public class SevenSignsRBs extends AbstractInstance } case "REMOVE_PLAYERS_FROM_ZONE_LILITH": { - for (Creature charInside : _lilith_zone.getCharactersInside()) + for (Creature charInside : LILITH_ZONE.getCharactersInside()) { if ((charInside != null) && charInside.isPlayer()) { diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java index 9e96a6c534..483c25da9e 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java @@ -43,17 +43,17 @@ public class ResidenceOfKingIgnis extends AbstractInstance private static final int FREYA = 29109; private static final int IGNIS = 29105; // Skills - private static SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1); - private static SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); - private static SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); - private static SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); - private static SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); - private static SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); - private static SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); - private static SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); - private static SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); - private static 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 FIRE_RAG_1 = new SkillHolder(50050, 1); + private static final SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); + private static final SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); + private static final SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); + private static final SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); + private static final SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); + private static final SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); + private static final SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); + private static final SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); + private static final SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10); + private static final SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect // Misc private static final int TEMPLATE_ID = 195; private static final Map _playerFireRage = new ConcurrentHashMap<>(); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java index 07464caee8..a4ef09a813 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java @@ -18,9 +18,7 @@ package instances.ResidenceOfKingPetram; import org.l2jmobius.gameserver.enums.ChatType; 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.RaidBossInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.skills.Skill; @@ -28,7 +26,7 @@ import org.l2jmobius.gameserver.model.skills.Skill; import instances.AbstractInstance; /** - * @author RobikBobik + * @author RobikBobik, Mobius * @NOTE: Retail like working * @TODO: Rewrite code to modern style. * @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_FRAGMENT = 29117; // Skills - private static 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 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 EARTH_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. + private static final SkillHolder EARTH_FURY = new SkillHolder(50059, 1); // When change invul state. + 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 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() { @@ -70,54 +62,63 @@ public class ResidenceOfKingPetram extends AbstractInstance case "ENTER": { enterInstance(player, npc, TEMPLATE_ID); - if (player.getInstanceWorld() != null) - { - _petram = (RaidBossInstance) player.getInstanceWorld().getNpc(PETRAM); - } break; } case "SPAWN_MINION": { - _petram.useMagic(EARTh_ENERGY.getSkill()); - - // Prevent to double or higher spawn when HP is between 68-70% + etc... - if (!_spawned_minions) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _minion_1 = (MonsterInstance) 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()); - _minion_3 = (MonsterInstance) 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()); - _spawned_minions = true; + world.getNpc(PETRAM).doCast(EARTH_ENERGY.getSkill()); + + // Prevent to double or higher spawn when HP is between 68-70% + etc... + if (!world.getParameters().getBoolean("spawnedMinions", false)) + { + world.setParameter("minion1", addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId())); + world.setParameter("minion2", addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId())); + world.setParameter("minion3", addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId())); + world.setParameter("minion4", addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId())); + world.getParameters().set("spawnedMinions", true); + } + + startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); } - - startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); break; } case "SUPPORT_PETRAM": { - _minion_1.setTarget(_petram); - _minion_1.useMagic(TEST.getSkill()); - _minion_2.setTarget(_petram); - _minion_2.useMagic(TEST.getSkill()); - _minion_3.setTarget(_petram); - _minion_3.useMagic(TEST.getSkill()); - _minion_4.setTarget(_petram); - _minion_4.useMagic(TEST.getSkill()); - startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 + final Instance world = npc.getInstanceWorld(); + if (world != null) + { + world.getParameters().getObject("minion1", Npc.class).setTarget(world.getNpc(PETRAM)); + world.getParameters().getObject("minion1", Npc.class).doCast(TEST.getSkill()); + world.getParameters().getObject("minion2", Npc.class).setTarget(world.getNpc(PETRAM)); + world.getParameters().getObject("minion2", Npc.class).doCast(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 + } break; } case "INVUL_MODE": { - _petram.useMagic(EARTh_FURY.getSkill()); - if (_petram.isInvul()) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _petram.setInvul(false); - _petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); - } - else - { - _petram.setInvul(true); - _petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + final Npc petram = world.getNpc(PETRAM); + petram.doCast(EARTH_FURY.getSkill()); + if (petram.isInvul()) + { + petram.setInvul(false); + petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); + } + else + { + petram.setInvul(true); + petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + } } break; } @@ -157,18 +158,20 @@ public class ResidenceOfKingPetram extends AbstractInstance @Override public String onKill(Npc npc, PlayerInstance player, boolean isSummon) { + final Instance world = npc.getInstanceWorld(); + if (world == null) + { + return null; + } + if (npc.getId() == PETRAM) { - final Instance world = npc.getInstanceWorld(); - if (world != null) - { - world.finishInstance(); - } + world.finishInstance(); } - else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead())) + 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())) { - startQuestTimer("INVUL_MODE", 3000, _petram, null); - _spawned_minions = false; + startQuestTimer("INVUL_MODE", 3000, world.getNpc(PETRAM), null); + world.getParameters().set("spawnedMinions", false); } return super.onKill(npc, player, isSummon); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java index 037761ceeb..afbf78b2c4 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java @@ -17,9 +17,7 @@ package instances.ResidenceOfKingProcella; 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.RaidBossInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.skills.SkillCaster; @@ -27,7 +25,7 @@ import org.l2jmobius.gameserver.model.skills.SkillCaster; import instances.AbstractInstance; /** - * @author RobikBobik + * @author RobikBobik, Mobius * @NOTE: Retail like working * @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 // Misc private static final int TEMPLATE_ID = 197; - private static int STORM_MAX_COUNT = 16; // TODO: Max is limit ? - private int _procellaStormCount; - private RaidBossInstance _procella; - private MonsterInstance _minion1; - private MonsterInstance _minion2; - private MonsterInstance _minion3; + private static final int STORM_MAX_COUNT = 16; // TODO: Max is limit ? public ResidenceOfKingProcella() { @@ -69,46 +62,56 @@ public class ResidenceOfKingProcella extends AbstractInstance case "ENTER": { enterInstance(player, npc, TEMPLATE_ID); - _procella = (RaidBossInstance) 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); - _procellaStormCount = 0; + final Instance world = player.getInstanceWorld(); + if (world != null) + { + 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; } 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()); - _minion2 = (MonsterInstance) 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()); - startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); + world.setParameter("minion1", addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId())); + world.setParameter("minion2", addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, 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, world.getNpc(PROCELLA), null); } break; } 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()); - final Npc procellaStorm = addSpawn(PROCELLA_STORM, _procella.getX() + getRandom(-500, 500), _procella.getY() + getRandom(-500, 500), _procella.getZ(), 31011, true, 0, true, npc.getInstanceId()); + world.getNpc(PROCELLA).doCast(HURRICANE_SUMMON.getSkill()); + 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); - _procellaStormCount++; - startQuestTimer("SPAWN_STORM", 60000, _procella, null); + world.getParameters().increaseInt("stormCount", 1); + startQuestTimer("SPAWN_STORM", 60000, world.getNpc(PROCELLA), null); startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking } break; } case "HIDE_PROCELLA": { - if (_procella.isInvisible()) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _procella.setInvisible(false); - } - else - { - _procella.setInvisible(true); - startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); + if (world.getNpc(PROCELLA).isInvisible()) + { + world.getNpc(PROCELLA).setInvisible(false); + } + else + { + world.getNpc(PROCELLA).setInvisible(true); + startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), world.getNpc(PROCELLA), player); + } } break; } @@ -151,21 +154,24 @@ public class ResidenceOfKingProcella extends AbstractInstance @Override public String onKill(Npc npc, PlayerInstance player, boolean isSummon) { + final Instance world = npc.getInstanceWorld(); + if (world == null) + { + return null; + } + if (npc.getId() == PROCELLA) { - final Instance world = npc.getInstanceWorld(); - if (world != null) - { - cancelQuestTimer("SPAWN_MINION", npc, player); - cancelQuestTimer("SPAWN_STORM", npc, player); - cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); - world.finishInstance(); - } + cancelQuestTimer("SPAWN_MINION", npc, player); + cancelQuestTimer("SPAWN_STORM", npc, player); + cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); + world.finishInstance(); } - else if ((_minion1.isDead()) && (_minion2.isDead()) && (_minion3.isDead())) + else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead())) { - startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); + startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null); } + return super.onKill(npc, player, isSummon); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java index d94006962b..e8629219b7 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java @@ -41,12 +41,12 @@ public class ResidenceOfQueenNebula extends AbstractInstance private static final int WATER_SLIME = 29111; // Skills private static final int AQUA_RAGE = 50036; - private static SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); - private static SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); - private static SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); - private static SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); - private static SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); - private static SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); + private static final SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); + private static final SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); + private static final SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); + private static final SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); + private static final SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); + private static final SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); // Misc private static final int TEMPLATE_ID = 196; diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java index 3ec9af0c75..ae782e450b 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java @@ -47,10 +47,10 @@ public class SevenSignsRBs extends AbstractInstance private static final int ANAKIM_TEMPLATE_ID = 200; 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 _lilith_zone = ZoneManager.getInstance().getZoneById(70053, 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); // TELEPORTS private static final Location[] TELEPORT_TO_DARK_ELVEN = @@ -89,7 +89,7 @@ public class SevenSignsRBs extends AbstractInstance final boolean isInCC = party.isInCommandChannel(); final List 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."); } @@ -128,7 +128,7 @@ public class SevenSignsRBs extends AbstractInstance final boolean isInCC = party.isInCommandChannel(); final List 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."); } @@ -161,7 +161,7 @@ public class SevenSignsRBs extends AbstractInstance } case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM": { - for (Creature charInside : _anakim_zone.getCharactersInside()) + for (Creature charInside : ANAKIM_ZONE.getCharactersInside()) { if ((charInside != null) && charInside.isPlayer()) { @@ -172,7 +172,7 @@ public class SevenSignsRBs extends AbstractInstance } case "REMOVE_PLAYERS_FROM_ZONE_LILITH": { - for (Creature charInside : _lilith_zone.getCharactersInside()) + for (Creature charInside : LILITH_ZONE.getCharactersInside()) { if ((charInside != null) && charInside.isPlayer()) { diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/GolbergRoom/GolbergRoom.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/GolbergRoom/GolbergRoom.java index 55811db24f..80eeefc057 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/GolbergRoom/GolbergRoom.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/GolbergRoom/GolbergRoom.java @@ -18,7 +18,6 @@ package instances.GolbergRoom; import org.l2jmobius.gameserver.model.Party; 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.instancezone.Instance; import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; @@ -26,7 +25,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage; import instances.AbstractInstance; /** - * @author RobikBobik + * @author RobikBobik, Mobius * @NOTE: Party instance retail like work. * @TODO: Find what all drops from GOLBERG_TREASURE_CHEST * @TODO: Golberg skills @@ -42,9 +41,6 @@ public class GolbergRoom extends AbstractInstance // Misc private static final int TEMPLATE_ID = 207; - private MonsterInstance _golberg; - private int _treasureCounter; - public GolbergRoom() { super(TEMPLATE_ID); @@ -82,8 +78,7 @@ public class GolbergRoom extends AbstractInstance } member.teleToLocation(player, 10, world); } - _golberg = (MonsterInstance) player.getInstanceWorld().getNpc(18359); - startQuestTimer("GOLBERG_MOVE", 5000, _golberg, player); + startQuestTimer("GOLBERG_MOVE", 5000, world.getNpc(GOLBERG), player); } break; } @@ -93,7 +88,7 @@ public class GolbergRoom extends AbstractInstance if (world != null) { 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); break; @@ -104,7 +99,7 @@ public class GolbergRoom extends AbstractInstance if (world != null) { 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; } @@ -119,13 +114,19 @@ public class GolbergRoom extends AbstractInstance } case "SPAWN_TRESURE": { + final Instance world = player.getInstanceWorld(); + if (world == null) + { + return null; + } + 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } } else if (player.getParty() != null) @@ -134,81 +135,81 @@ public class GolbergRoom extends AbstractInstance { 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } break; } 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } break; } 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } break; } 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } break; } 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } break; } 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } break; } 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } break; } 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()); startQuestTimer("SPAWN_TRESURE", 1000, npc, player); - _treasureCounter++; + world.getParameters().increaseInt("treasureCounter", 1); } break; } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java index 9e96a6c534..483c25da9e 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingIgnis/ResidenceOfKingIgnis.java @@ -43,17 +43,17 @@ public class ResidenceOfKingIgnis extends AbstractInstance private static final int FREYA = 29109; private static final int IGNIS = 29105; // Skills - private static SkillHolder FIRE_RAG_1 = new SkillHolder(50050, 1); - private static SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); - private static SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); - private static SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); - private static SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); - private static SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); - private static SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); - private static SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); - private static SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); - private static 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 FIRE_RAG_1 = new SkillHolder(50050, 1); + private static final SkillHolder FIRE_RAG_2 = new SkillHolder(50050, 2); + private static final SkillHolder FIRE_RAG_3 = new SkillHolder(50050, 3); + private static final SkillHolder FIRE_RAG_4 = new SkillHolder(50050, 4); + private static final SkillHolder FIRE_RAG_5 = new SkillHolder(50050, 5); + private static final SkillHolder FIRE_RAG_6 = new SkillHolder(50050, 6); + private static final SkillHolder FIRE_RAG_7 = new SkillHolder(50050, 7); + private static final SkillHolder FIRE_RAG_8 = new SkillHolder(50050, 8); + private static final SkillHolder FIRE_RAG_9 = new SkillHolder(50050, 9); + private static final SkillHolder FIRE_RAG_10 = new SkillHolder(50050, 10); + private static final SkillHolder FREYA_SAFETY_ZONE = new SkillHolder(50052, 1); // Just for an effect // Misc private static final int TEMPLATE_ID = 195; private static final Map _playerFireRage = new ConcurrentHashMap<>(); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java index 07464caee8..e09d8a2d15 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java @@ -18,9 +18,7 @@ package instances.ResidenceOfKingPetram; import org.l2jmobius.gameserver.enums.ChatType; 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.RaidBossInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.skills.Skill; @@ -28,7 +26,7 @@ import org.l2jmobius.gameserver.model.skills.Skill; import instances.AbstractInstance; /** - * @author RobikBobik + * @author RobikBobik, Mobius * @NOTE: Retail like working * @TODO: Rewrite code to modern style. * @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_FRAGMENT = 29117; // Skills - private static 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 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 EARTH_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. + private static final SkillHolder EARTH_FURY = new SkillHolder(50059, 1); // When change invul state. + 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 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() { @@ -70,54 +62,63 @@ public class ResidenceOfKingPetram extends AbstractInstance case "ENTER": { enterInstance(player, npc, TEMPLATE_ID); - if (player.getInstanceWorld() != null) - { - _petram = (RaidBossInstance) player.getInstanceWorld().getNpc(PETRAM); - } break; } case "SPAWN_MINION": { - _petram.useMagic(EARTh_ENERGY.getSkill()); - - // Prevent to double or higher spawn when HP is between 68-70% + etc... - if (!_spawned_minions) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _minion_1 = (MonsterInstance) 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()); - _minion_3 = (MonsterInstance) 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()); - _spawned_minions = true; + world.getNpc(PETRAM).doCast(EARTH_ENERGY.getSkill()); + + // Prevent to double or higher spawn when HP is between 68-70% + etc... + if (!world.getParameters().getBoolean("spawnedMinions", false)) + { + world.setParameter("minion1", addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId())); + world.setParameter("minion2", addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId())); + world.setParameter("minion3", addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId())); + world.setParameter("minion4", addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId())); + world.setParameter("spawnedMinions", true); + } + + startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); } - - startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); break; } case "SUPPORT_PETRAM": { - _minion_1.setTarget(_petram); - _minion_1.useMagic(TEST.getSkill()); - _minion_2.setTarget(_petram); - _minion_2.useMagic(TEST.getSkill()); - _minion_3.setTarget(_petram); - _minion_3.useMagic(TEST.getSkill()); - _minion_4.setTarget(_petram); - _minion_4.useMagic(TEST.getSkill()); - startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 + final Instance world = npc.getInstanceWorld(); + if (world != null) + { + world.getParameters().getObject("minion1", Npc.class).setTarget(world.getNpc(PETRAM)); + world.getParameters().getObject("minion1", Npc.class).doCast(TEST.getSkill()); + world.getParameters().getObject("minion2", Npc.class).setTarget(world.getNpc(PETRAM)); + world.getParameters().getObject("minion2", Npc.class).doCast(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 + } break; } case "INVUL_MODE": { - _petram.useMagic(EARTh_FURY.getSkill()); - if (_petram.isInvul()) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _petram.setInvul(false); - _petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); - } - else - { - _petram.setInvul(true); - _petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + final Npc petram = world.getNpc(PETRAM); + petram.doCast(EARTH_FURY.getSkill()); + if (petram.isInvul()) + { + petram.setInvul(false); + petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); + } + else + { + petram.setInvul(true); + petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + } } break; } @@ -157,18 +158,20 @@ public class ResidenceOfKingPetram extends AbstractInstance @Override public String onKill(Npc npc, PlayerInstance player, boolean isSummon) { + final Instance world = npc.getInstanceWorld(); + if (world == null) + { + return null; + } + if (npc.getId() == PETRAM) { - final Instance world = npc.getInstanceWorld(); - if (world != null) - { - world.finishInstance(); - } + world.finishInstance(); } - else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead())) + 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())) { - startQuestTimer("INVUL_MODE", 3000, _petram, null); - _spawned_minions = false; + startQuestTimer("INVUL_MODE", 3000, world.getNpc(PETRAM), null); + world.setParameter("spawnedMinions", false); } return super.onKill(npc, player, isSummon); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java index 037761ceeb..afbf78b2c4 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingProcella/ResidenceOfKingProcella.java @@ -17,9 +17,7 @@ package instances.ResidenceOfKingProcella; 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.RaidBossInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.model.skills.SkillCaster; @@ -27,7 +25,7 @@ import org.l2jmobius.gameserver.model.skills.SkillCaster; import instances.AbstractInstance; /** - * @author RobikBobik + * @author RobikBobik, Mobius * @NOTE: Retail like working * @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 // Misc private static final int TEMPLATE_ID = 197; - private static int STORM_MAX_COUNT = 16; // TODO: Max is limit ? - private int _procellaStormCount; - private RaidBossInstance _procella; - private MonsterInstance _minion1; - private MonsterInstance _minion2; - private MonsterInstance _minion3; + private static final int STORM_MAX_COUNT = 16; // TODO: Max is limit ? public ResidenceOfKingProcella() { @@ -69,46 +62,56 @@ public class ResidenceOfKingProcella extends AbstractInstance case "ENTER": { enterInstance(player, npc, TEMPLATE_ID); - _procella = (RaidBossInstance) 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); - _procellaStormCount = 0; + final Instance world = player.getInstanceWorld(); + if (world != null) + { + 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; } 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()); - _minion2 = (MonsterInstance) 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()); - startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); + world.setParameter("minion1", addSpawn(PROCELLA_GUARDIAN_1, 212663, 179421, -15486, 31011, true, 0, true, npc.getInstanceId())); + world.setParameter("minion2", addSpawn(PROCELLA_GUARDIAN_2, 213258, 179822, -15486, 12001, 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, world.getNpc(PROCELLA), null); } break; } 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()); - final Npc procellaStorm = addSpawn(PROCELLA_STORM, _procella.getX() + getRandom(-500, 500), _procella.getY() + getRandom(-500, 500), _procella.getZ(), 31011, true, 0, true, npc.getInstanceId()); + world.getNpc(PROCELLA).doCast(HURRICANE_SUMMON.getSkill()); + 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); - _procellaStormCount++; - startQuestTimer("SPAWN_STORM", 60000, _procella, null); + world.getParameters().increaseInt("stormCount", 1); + startQuestTimer("SPAWN_STORM", 60000, world.getNpc(PROCELLA), null); startQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", 100, procellaStorm, player); // All time checking } break; } case "HIDE_PROCELLA": { - if (_procella.isInvisible()) + final Instance world = npc.getInstanceWorld(); + if (world != null) { - _procella.setInvisible(false); - } - else - { - _procella.setInvisible(true); - startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), _procella, player); + if (world.getNpc(PROCELLA).isInvisible()) + { + world.getNpc(PROCELLA).setInvisible(false); + } + else + { + world.getNpc(PROCELLA).setInvisible(true); + startQuestTimer("SPAWN_MINION", 300000 + getRandom(-15000, 15000), world.getNpc(PROCELLA), player); + } } break; } @@ -151,21 +154,24 @@ public class ResidenceOfKingProcella extends AbstractInstance @Override public String onKill(Npc npc, PlayerInstance player, boolean isSummon) { + final Instance world = npc.getInstanceWorld(); + if (world == null) + { + return null; + } + if (npc.getId() == PROCELLA) { - final Instance world = npc.getInstanceWorld(); - if (world != null) - { - cancelQuestTimer("SPAWN_MINION", npc, player); - cancelQuestTimer("SPAWN_STORM", npc, player); - cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); - world.finishInstance(); - } + cancelQuestTimer("SPAWN_MINION", npc, player); + cancelQuestTimer("SPAWN_STORM", npc, player); + cancelQuestTimer("CHECK_CHAR_INSIDE_RADIUS_NPC", npc, player); + world.finishInstance(); } - else if ((_minion1.isDead()) && (_minion2.isDead()) && (_minion3.isDead())) + else if ((world.getParameters().getObject("minion1", Npc.class).isDead()) && (world.getParameters().getObject("minion2", Npc.class).isDead()) && (world.getParameters().getObject("minion3", Npc.class).isDead())) { - startQuestTimer("HIDE_PROCELLA", 1000, _procella, null); + startQuestTimer("HIDE_PROCELLA", 1000, world.getNpc(PROCELLA), null); } + return super.onKill(npc, player, isSummon); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java index d94006962b..e8629219b7 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfQueenNebula/ResidenceOfQueenNebula.java @@ -41,12 +41,12 @@ public class ResidenceOfQueenNebula extends AbstractInstance private static final int WATER_SLIME = 29111; // Skills private static final int AQUA_RAGE = 50036; - private static SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); - private static SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); - private static SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); - private static SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); - private static SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); - private static SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); + private static final SkillHolder AQUA_RAGE_1 = new SkillHolder(AQUA_RAGE, 1); + private static final SkillHolder AQUA_RAGE_2 = new SkillHolder(AQUA_RAGE, 2); + private static final SkillHolder AQUA_RAGE_3 = new SkillHolder(AQUA_RAGE, 3); + private static final SkillHolder AQUA_RAGE_4 = new SkillHolder(AQUA_RAGE, 4); + private static final SkillHolder AQUA_RAGE_5 = new SkillHolder(AQUA_RAGE, 5); + private static final SkillHolder AQUA_SUMMON = new SkillHolder(50037, 1); // Misc private static final int TEMPLATE_ID = 196; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java index 3ec9af0c75..ae782e450b 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/SevenSignsRBs/SevenSignsRBs.java @@ -47,10 +47,10 @@ public class SevenSignsRBs extends AbstractInstance private static final int ANAKIM_TEMPLATE_ID = 200; 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 _lilith_zone = ZoneManager.getInstance().getZoneById(70053, 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); // TELEPORTS private static final Location[] TELEPORT_TO_DARK_ELVEN = @@ -89,7 +89,7 @@ public class SevenSignsRBs extends AbstractInstance final boolean isInCC = party.isInCommandChannel(); final List 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."); } @@ -128,7 +128,7 @@ public class SevenSignsRBs extends AbstractInstance final boolean isInCC = party.isInCommandChannel(); final List 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."); } @@ -161,7 +161,7 @@ public class SevenSignsRBs extends AbstractInstance } case "REMOVE_PLAYERS_FROM_ZONE_ANAKIM": { - for (Creature charInside : _anakim_zone.getCharactersInside()) + for (Creature charInside : ANAKIM_ZONE.getCharactersInside()) { if ((charInside != null) && charInside.isPlayer()) { @@ -172,7 +172,7 @@ public class SevenSignsRBs extends AbstractInstance } case "REMOVE_PLAYERS_FROM_ZONE_LILITH": { - for (Creature charInside : _lilith_zone.getCharactersInside()) + for (Creature charInside : LILITH_ZONE.getCharactersInside()) { if ((charInside != null) && charInside.isPlayer()) {