diff --git a/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml b/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml index 0bfa972c4bdf53cb43899ede401d10b6bd52296e..6459dac93cd0c907e7e12f2f1e12048b1ecac693 100644 --- a/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml +++ b/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml @@ -4,4 +4,9 @@ <allowSummon val="false"/> <showTimer val="true" increase="true" text="Elapsed Time :" /> <spawnPoint spawnX="52212" spawnY="218998" spawnZ="-3208" /> + <reenter additionStyle="ON_INSTANCE_FINISH" > + <reset day="Monday" hour="6" minute="30" /> + <reset day="Wednesday" hour="6" minute="30" /> + <reset day="Friday" hour="6" minute="30" /> + </reenter> </instance> diff --git a/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml b/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml index 0694c48d15b94a16870f46c099c46ffea548de2d..7b9eb20e4cbedde4b7f8d0a5d4319757a968b6ee 100644 --- a/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml +++ b/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml @@ -4,4 +4,9 @@ <allowSummon val="false"/> <showTimer val="true" increase="true" text="Elapsed Time :" /> <spawnPoint spawnX="52212" spawnY="218998" spawnZ="-3208" /> -</instance> + <reenter additionStyle="ON_INSTANCE_FINISH" > + <reset day="Monday" hour="6" minute="30" /> + <reset day="Wednesday" hour="6" minute="30" /> + <reset day="Friday" hour="6" minute="30" /> + </reenter> +</instance> \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/instances/CrystalCaverns.xml b/L2J_DataPack/dist/game/data/instances/CrystalCaverns.xml index 24533659f08332050573579d0d91aaf11f9a5fa5..96498a1b6265e6b328b1dd7dd06430dfd684cd8c 100644 --- a/L2J_DataPack/dist/game/data/instances/CrystalCaverns.xml +++ b/L2J_DataPack/dist/game/data/instances/CrystalCaverns.xml @@ -4,6 +4,9 @@ <allowSummon val="false" /> <emptyDestroyTime val="1200" /> <spawnPoint spawnX="149442" spawnY="173520" spawnZ="-5024" /> + <reenter additionStyle="ON_INSTANCE_ENTER" > + <reset time="86400000" /> + </reenter> <doorlist> <door doorId="24220001" /> <door doorId="24220002" /> diff --git a/L2J_DataPack/dist/game/data/instances/DemonPrince.xml b/L2J_DataPack/dist/game/data/instances/DemonPrince.xml index dd01992078c68c48a01e20d40975185f98018b6c..c05daa72a4ecd8e28faeb489a446f9bba092eb92 100644 --- a/L2J_DataPack/dist/game/data/instances/DemonPrince.xml +++ b/L2J_DataPack/dist/game/data/instances/DemonPrince.xml @@ -4,6 +4,10 @@ <allowSummon val="false" /> <emptyDestroyTime val="600" /> <spawnPoint spawnX="-22213" spawnY="277138" spawnZ="-9930" /> + <reenter additionStyle="ON_INSTANCE_FINISH" > + <reset day="Wednesday" hour="6" minute="30" /> + <reset day="Saturday" hour="6" minute="30" /> + </reenter> <spawnlist> <group name="general"> <spawn npcId="25540" x="-22199" y="278407" z="-8264" heading="0" respawn="0" /> diff --git a/L2J_DataPack/dist/game/data/instances/DisciplesNecropolisPast.xml b/L2J_DataPack/dist/game/data/instances/DisciplesNecropolisPast.xml index b6290bae712aaa080814cec1d407a43af01413d3..45bc3b8a209dc1856417163a3e1218916291afde 100644 --- a/L2J_DataPack/dist/game/data/instances/DisciplesNecropolisPast.xml +++ b/L2J_DataPack/dist/game/data/instances/DisciplesNecropolisPast.xml @@ -4,6 +4,7 @@ <allowSummon val="false" /> <emptyDestroyTime val="900" /> <spawnPoint spawnX="171895" spawnY="-17501" spawnZ="-4903" /> + <removeBuffs type="ALL" /> <doorlist> <door doorId="17240101" /> <door doorId="17240102" /> diff --git a/L2J_DataPack/dist/game/data/instances/FinalEmperialTomb.xml b/L2J_DataPack/dist/game/data/instances/FinalEmperialTomb.xml index 1b4de4bdc60fa5cae20f79cf3e2ac475dbdeccb5..0866bf125cc7170c092e6e981c7fda6cd20efeb9 100644 --- a/L2J_DataPack/dist/game/data/instances/FinalEmperialTomb.xml +++ b/L2J_DataPack/dist/game/data/instances/FinalEmperialTomb.xml @@ -4,6 +4,10 @@ <allowSummon val="false" /> <emptyDestroyTime val="1800" /> <spawnPoint spawnX="181381" spawnY="-80883" spawnZ="-2730" /> + <reenter additionStyle="NONE" > + <reset day="Wednesday" hour="6" minute="30" /> + <reset day="Saturday" hour="6" minute="30" /> + </reenter> <doorlist> <door doorId="17130045" /> <door doorId="17130051" /> diff --git a/L2J_DataPack/dist/game/data/instances/HideoutOfTheDawn.xml b/L2J_DataPack/dist/game/data/instances/HideoutOfTheDawn.xml index 7cac997f5318b8a01eda50cf486eee06cb37146a..8e4d8fbd2080777700f65d69bd318b4eb1e0b1e6 100644 --- a/L2J_DataPack/dist/game/data/instances/HideoutOfTheDawn.xml +++ b/L2J_DataPack/dist/game/data/instances/HideoutOfTheDawn.xml @@ -4,6 +4,7 @@ <allowSummon val="false" /> <emptyDestroyTime val="30" /> <spawnPoint spawnX="147072" spawnY="23743" spawnZ="-1984" /> + <removeBuffs type="ALL" /> <spawnlist> <group name="general"> <!-- Franz --> diff --git a/L2J_DataPack/dist/game/data/instances/IceQueensCastleNormalBattle.xml b/L2J_DataPack/dist/game/data/instances/IceQueensCastleNormalBattle.xml index 982c1c7da29103678228f32fa7cbe1608107f6cf..af7eb7ab2e47c13b0046228c291eaa384011e59e 100644 --- a/L2J_DataPack/dist/game/data/instances/IceQueensCastleNormalBattle.xml +++ b/L2J_DataPack/dist/game/data/instances/IceQueensCastleNormalBattle.xml @@ -4,6 +4,10 @@ <allowSummon val="false" /> <emptyDestroyTime val="600" /> <spawnPoint spawnX="115717" spawnY="-125734" spawnZ="-3392" /> + <reenter additionStyle="ON_INSTANCE_FINISH" > + <reset day="Wednesday" hour="6" minute="30" /> + <reset day="Saturday" hour="6" minute="30" /> + </reenter> <doorlist> <door doorId="23140101" /> </doorlist> diff --git a/L2J_DataPack/dist/game/data/instances/MonasteryOfSilence.xml b/L2J_DataPack/dist/game/data/instances/MonasteryOfSilence.xml index f5d01c284b3564d7ec4e56bc10d0aef0f7d7e5f4..a0feb48c722c8e3ee3933ec58de773e2d9a4cf8c 100644 --- a/L2J_DataPack/dist/game/data/instances/MonasteryOfSilence.xml +++ b/L2J_DataPack/dist/game/data/instances/MonasteryOfSilence.xml @@ -4,6 +4,7 @@ <allowSummon val="false" /> <emptyDestroyTime val="1" /> <spawnPoint spawnX="115983" spawnY="-87351" spawnZ="-3397" /> + <removeBuffs type="ALL" /> <spawnlist> <group name="general"> <!-- Eris's Evil Thoughts --> diff --git a/L2J_DataPack/dist/game/data/instances/NornilsGarden.xml b/L2J_DataPack/dist/game/data/instances/NornilsGarden.xml index 9bb7251ae5c0c5cfc8c2b06ef544040436aa2fdf..e33d9c943bb2392de2870b7dde07b5cbeca05964 100644 --- a/L2J_DataPack/dist/game/data/instances/NornilsGarden.xml +++ b/L2J_DataPack/dist/game/data/instances/NornilsGarden.xml @@ -4,6 +4,7 @@ <allowSummon val="false" /> <emptyDestroyTime val="3000" /> <spawnPoint spawnX="-84757" spawnY="60009" spawnZ="-2581" /> + <removeBuffs type="ALL" /> <doorlist> <door doorId="16200001" /> <door doorId="16200002" /> diff --git a/L2J_DataPack/dist/game/data/instances/Ranku.xml b/L2J_DataPack/dist/game/data/instances/Ranku.xml index f75fe34e11724c752a43e7b45e8f73a7f4578880..f8aa5483e837e54e2369e8ebb08885cfc8ddd273 100644 --- a/L2J_DataPack/dist/game/data/instances/Ranku.xml +++ b/L2J_DataPack/dist/game/data/instances/Ranku.xml @@ -4,6 +4,10 @@ <allowSummon val="false" /> <emptyDestroyTime val="600" /> <spawnPoint spawnX="-19006" spawnY="277065" spawnZ="-13383" /> + <reenter additionStyle="ON_INSTANCE_FINISH" > + <reset day="Wednesday" hour="6" minute="30" /> + <reset day="Saturday" hour="6" minute="30" /> + </reenter> <spawnlist> <group name="general"> <spawn npcId="25542" x="-19056" y="278732" z="-15000" heading="0" respawn="0" /> diff --git a/L2J_DataPack/dist/game/data/scripts.cfg b/L2J_DataPack/dist/game/data/scripts.cfg index 61ba29834b84d7c516854f2bc590fc2a3a037192..806a58f24cc5408001f30bb06c520ee51e883149 100644 --- a/L2J_DataPack/dist/game/data/scripts.cfg +++ b/L2J_DataPack/dist/game/data/scripts.cfg @@ -170,35 +170,9 @@ village_master/KamaelChange1/KamaelChange1.java village_master/KamaelChange2/KamaelChange2.java village_master/orc_occupation_change_1/__init__.py village_master/orc_occupation_change_2/__init__.py - -# Instance Dungeons Section -instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java -instances/ChambersOfDelusion/ChamberOfDelusionEast.java -instances/ChambersOfDelusion/ChamberOfDelusionNorth.java -instances/ChambersOfDelusion/ChamberOfDelusionSouth.java -instances/ChambersOfDelusion/ChamberOfDelusionWest.java -instances/ChambersOfDelusion/ChamberOfDelusionSquare.java -instances/ChambersOfDelusion/ChamberOfDelusionTower.java -instances/CrystalCaverns/CrystalCaverns.java -instances/DarkCloudMansion/DarkCloudMansion.java -instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java -instances/ElcadiasTent/ElcadiasTent.java -instances/FinalEmperialTomb/FinalEmperialTomb.java -instances/HideoutOfTheDawn/HideoutOfTheDawn.java -instances/IceQueensCastle/IceQueensCastle.java -instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java -instances/JiniaGuildHideout1/JiniaGuildHideout1.java -instances/JiniaGuildHideout2/JiniaGuildHideout2.java -instances/JiniaGuildHideout3/JiniaGuildHideout3.java -instances/JiniaGuildHideout4/JiniaGuildHideout4.java -instances/LibraryOfSages/LibraryOfSages.java -instances/Kamaloka/Kamaloka.java -instances/MithrilMine/MithrilMine.java -instances/MonasteryOfSilence1/MonasteryOfSilence1.java -instances/NornilsGarden/NornilsGarden.java -instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java -instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java -instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java + +# Instance Section +instances/InstanceLoader.java # Gracia Section gracia/GraciaLoader.java diff --git a/L2J_DataPack/dist/game/data/scripts/gracia/instances/SecretArea/SecretArea.java b/L2J_DataPack/dist/game/data/scripts/gracia/instances/SecretArea/SecretArea.java index ee8d26bf58574f60258914813f7ba57e718af9ca..85ad3bd649c51ea9d6cfe3144b6a89a2bce71396 100644 --- a/L2J_DataPack/dist/game/data/scripts/gracia/instances/SecretArea/SecretArea.java +++ b/L2J_DataPack/dist/game/data/scripts/gracia/instances/SecretArea/SecretArea.java @@ -67,7 +67,7 @@ public final class SecretArea extends Quest teleportPlayer(player, TELEPORTS[ENTER], world.getInstanceId()); return; } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); + player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return; } diff --git a/L2J_DataPack/dist/game/data/scripts/gracia/instances/SeedOfDestruction/Stage1.java b/L2J_DataPack/dist/game/data/scripts/gracia/instances/SeedOfDestruction/Stage1.java index 3ef1ad65d6f77c97837e45871f65afb79ff495c6..60fa297c86ed2f9379cdff4a4891412e98b362cc 100644 --- a/L2J_DataPack/dist/game/data/scripts/gracia/instances/SeedOfDestruction/Stage1.java +++ b/L2J_DataPack/dist/game/data/scripts/gracia/instances/SeedOfDestruction/Stage1.java @@ -495,14 +495,14 @@ public final class Stage1 extends Quest { if (partyMember.getLevel() < 75) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } if (!Util.checkIfInRange(1000, player, partyMember, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -510,7 +510,7 @@ public final class Stage1 extends Quest Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), INSTANCEID); if (System.currentTimeMillis() < reentertime) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -529,7 +529,7 @@ public final class Stage1 extends Quest { if (!(world instanceof SOD1World)) { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); + player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return 0; } teleportPlayer(player, loc, world.getInstanceId(), false); @@ -771,7 +771,7 @@ public final class Stage1 extends Quest } } - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_FROM_HERE_S1_S_ENTRY_HAS_BEEN_RESTRICTED); sm.addInstanceName(INSTANCEID); // set instance reenter time for all allowed players diff --git a/L2J_DataPack/dist/game/data/scripts/gracia/instances/SeedOfInfinity/HallOfSuffering/HallOfSuffering.java b/L2J_DataPack/dist/game/data/scripts/gracia/instances/SeedOfInfinity/HallOfSuffering/HallOfSuffering.java index a012a0897f1e37543d49ea1bab67117cf1b3f165..61a5e58feb939fc7da80601de9d87aee6cf456a8 100644 --- a/L2J_DataPack/dist/game/data/scripts/gracia/instances/SeedOfInfinity/HallOfSuffering/HallOfSuffering.java +++ b/L2J_DataPack/dist/game/data/scripts/gracia/instances/SeedOfInfinity/HallOfSuffering/HallOfSuffering.java @@ -221,14 +221,14 @@ public final class HallOfSuffering extends AbstractNpcAI { if (partyMember.getLevel() < MIN_LEVEL) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; } if (!Util.checkIfInRange(1000, player, partyMember, true)) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -236,7 +236,7 @@ public final class HallOfSuffering extends AbstractNpcAI final long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID); if (System.currentTimeMillis() < reentertime) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -254,7 +254,7 @@ public final class HallOfSuffering extends AbstractNpcAI { if (!(world instanceof HSWorld)) { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); + player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return; } teleportPlayer(player, loc, world.getInstanceId()); @@ -544,7 +544,7 @@ public final class HallOfSuffering extends AbstractNpcAI Calendar reenter = Calendar.getInstance(); reenter.add(Calendar.HOUR, INSTANCE_PENALTY); - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_FROM_HERE_S1_S_ENTRY_HAS_BEEN_RESTRICTED); sm.addInstanceName(tmpworld.getTemplateId()); // set instance reenter time for all allowed players diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/CallPc.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/CallPc.java index 5178ca2244f051b8ae3ae70a6b2002ba081624d1..86ec76a757ab95641e173a3fa29275199eb84d2c 100644 --- a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/CallPc.java +++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/CallPc.java @@ -156,7 +156,7 @@ public final class CallPc extends AbstractEffect if (activeChar.getInstanceId() > 0) { Instance summonerInstance = InstanceManager.getInstance().getInstance(activeChar.getInstanceId()); - if (!Config.ALLOW_SUMMON_TO_INSTANCE || !summonerInstance.isSummonAllowed()) + if (!Config.ALLOW_SUMMON_IN_INSTANCE || !summonerInstance.isSummonAllowed()) { activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION); return false; diff --git a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java index 6a097efe11bc90a6ed9f407878dc1c7b9479a0e6..b5df927681d3758986eb547df6a8961bf3a92f57 100644 --- a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java +++ b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java @@ -18,14 +18,12 @@ */ package hellbound.Instances.DemonPrinceFloor; -import java.util.Calendar; - -import ai.npc.AbstractNpcAI; +import instances.AbstractInstance; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2Party; -import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.Location; +import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; @@ -38,7 +36,7 @@ import com.l2jserver.gameserver.util.Util; * Demon Prince Floor instance zone. * @author GKR */ -public final class DemonPrinceFloor extends AbstractNpcAI +public final class DemonPrinceFloor extends AbstractInstance { protected class DPFWorld extends InstanceWorld { @@ -51,20 +49,18 @@ public final class DemonPrinceFloor extends AbstractNpcAI private static final int DEMON_PRINCE = 25540; // Item private static final int SEAL_BREAKER_5 = 15515; - // Misc - private static final int TEMPLATE_ID = 142; - private static final int RESET_HOUR = 6; - private static final int RESET_MIN = 30; + // Locations private static final Location ENTRY_POINT = new Location(-22208, 277056, -8239); private static final Location EXIT_POINT = new Location(-19024, 277122, -8256); + // Misc + private static final int TEMPLATE_ID = 142; + private static final int MIN_LV = 78; public DemonPrinceFloor() { super(DemonPrinceFloor.class.getSimpleName(), "hellbound/Instances"); - addStartNpc(GK_4); - addStartNpc(CUBE); - addTalkId(GK_4); - addTalkId(CUBE); + addStartNpc(GK_4, CUBE); + addTalkId(GK_4, CUBE); addKillId(DEMON_PRINCE); } @@ -74,16 +70,26 @@ public final class DemonPrinceFloor extends AbstractNpcAI String htmltext = null; if (npc.getId() == GK_4) { - htmltext = checkConditions(player); + if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) + { + if (player.getParty() == null) + { + htmltext = "gk-noparty.htm"; + } + else if (!player.getParty().isLeader(player)) + { + htmltext = "gk-noleader.htm"; + } + } if (htmltext == null) { - enterInstance(player, "DemonPrince.xml"); + enterInstance(player, new DPFWorld(), "DemonPrince.xml", TEMPLATE_ID); } } else if (npc.getId() == CUBE) { - InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if (world instanceof DPFWorld) { world.removeAllowed(player.getObjectId()); @@ -99,51 +105,27 @@ public final class DemonPrinceFloor extends AbstractNpcAI final int instanceId = npc.getInstanceId(); if (instanceId > 0) { - Instance inst = InstanceManager.getInstance().getInstance(instanceId); - InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final Instance inst = InstanceManager.getInstance().getInstance(instanceId); + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); inst.setSpawnLoc(EXIT_POINT); - // Terminate instance in 10 min - if ((inst.getInstanceEndTime() - System.currentTimeMillis()) > 600000) - { - inst.setDuration(600000); - } - - inst.setEmptyDestroyTime(0); - - if (world instanceof DPFWorld) - { - setReenterTime(world); - } + finishInstance(world); addSpawn(CUBE, -22144, 278744, -8239, 0, false, 0, false, instanceId); } return super.onKill(npc, killer, isSummon); } - private String checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { - if (player.getParty() == null) + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { - return "gk-noparty.htm"; - } - else if (!player.getParty().isLeader(player)) - { - return "gk-noleader.htm"; + return true; } - return null; - } - - private boolean checkTeleport(L2PcInstance player) - { final L2Party party = player.getParty(); - if (party == null) - { - return false; - } - - if (!party.isLeader(player)) + if ((party == null) || !party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; @@ -151,125 +133,64 @@ public final class DemonPrinceFloor extends AbstractNpcAI for (L2PcInstance partyMember : party.getMembers()) { - if (partyMember.getLevel() < 78) + if (partyMember.getLevel() < MIN_LV) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } if (!Util.checkIfInRange(500, player, partyMember, true)) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember)); return false; } if (InstanceManager.getInstance().getPlayerWorld(player) != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember)); return false; } - Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID); + final Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID); if (System.currentTimeMillis() < reentertime) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(partyMember)); return false; } if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_5, -1, false) < 1) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_QUEST_REQUIREMENT_NOT_SUFFICIENT); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } } return true; } - private void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - - if (world != null) + if (firstEntrance) { - if (world instanceof DPFWorld) + if (player.getParty() == null) { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); - return; - } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; - } - - if (!checkTeleport(player)) - { - return; - } - - world = new DPFWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.addAllowed(player.getObjectId()); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); - - _log.info("Tower of Infinitum - Demon Prince floor started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - - for (L2PcInstance partyMember : player.getParty().getMembers()) - { - teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); - partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true); - world.addAllowed(partyMember.getObjectId()); - } - } - - public void setReenterTime(InstanceWorld world) - { - if (world instanceof DPFWorld) - { - // Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable - Calendar reenter; - Calendar now = Calendar.getInstance(); - Calendar reenterPointWed = (Calendar) now.clone(); - reenterPointWed.set(Calendar.AM_PM, Calendar.AM); - reenterPointWed.set(Calendar.MINUTE, RESET_MIN); - reenterPointWed.set(Calendar.HOUR_OF_DAY, RESET_HOUR); - reenterPointWed.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); - Calendar reenterPointSat = (Calendar) reenterPointWed.clone(); - reenterPointSat.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); - - if (now.after(reenterPointSat)) - { - reenterPointWed.add(Calendar.WEEK_OF_MONTH, 1); - reenter = (Calendar) reenterPointWed.clone(); + player.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true); + world.addAllowed(player.getObjectId()); } else { - reenter = (Calendar) reenterPointSat.clone(); - } - - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); - sm.addInstanceName(world.getTemplateId()); - // set instance reenter time for all allowed players - for (int objectId : world.getAllowed()) - { - L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if ((player != null) && player.isOnline()) + for (L2PcInstance partyMember : player.getParty().getMembers()) { - InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis()); - player.sendPacket(sm); + teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); + partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true); + world.addAllowed(partyMember.getObjectId()); } } } + else + { + teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); + } } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java index ada8c5c73c857156c8d966685f1e3a54432b2a39..b1b4a5758ee0238ae8e84b2b4cbed4a5bee56eb9 100644 --- a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java +++ b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java @@ -18,14 +18,12 @@ */ package hellbound.Instances.RankuFloor; -import java.util.Calendar; - -import ai.npc.AbstractNpcAI; +import instances.AbstractInstance; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2Party; -import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.Location; +import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; @@ -38,7 +36,7 @@ import com.l2jserver.gameserver.util.Util; * Tower of Infinitum (10th Floor) instance zone. * @author GKR */ -public final class RankuFloor extends AbstractNpcAI +public final class RankuFloor extends AbstractInstance { protected class RFWorld extends InstanceWorld { @@ -51,20 +49,18 @@ public final class RankuFloor extends AbstractNpcAI private static final int RANKU = 25542; // Item private static final int SEAL_BREAKER_10 = 15516; - // Misc - private static final int TEMPLATE_ID = 143; - private static final int RESET_HOUR = 6; - private static final int RESET_MIN = 30; + // Locations private static final Location ENTRY_POINT = new Location(-19008, 277024, -15000); private static final Location EXIT_POINT = new Location(-19008, 277122, -13376); + // Misc + private static final int TEMPLATE_ID = 143; + private static final int MIN_LV = 78; public RankuFloor() { super(RankuFloor.class.getSimpleName(), "hellbound/Instances"); - addStartNpc(GK_9); - addStartNpc(CUBE); - addTalkId(GK_9); - addTalkId(CUBE); + addStartNpc(GK_9, CUBE); + addTalkId(GK_9, CUBE); addKillId(RANKU); } @@ -75,11 +71,21 @@ public final class RankuFloor extends AbstractNpcAI if (npc.getId() == GK_9) { - htmltext = checkConditions(player); + if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) + { + if (player.getParty() == null) + { + htmltext = "gk-noparty.htm"; + } + else if (!player.getParty().isLeader(player)) + { + htmltext = "gk-noleader.htm"; + } + } if (htmltext == null) { - enterInstance(player, "Ranku.xml"); + enterInstance(player, new RFWorld(), "Ranku.xml", TEMPLATE_ID); } } else if (npc.getId() == CUBE) @@ -87,7 +93,6 @@ public final class RankuFloor extends AbstractNpcAI final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if (world instanceof RFWorld) { - world.removeAllowed(player.getObjectId()); teleportPlayer(player, EXIT_POINT, 0); } } @@ -97,55 +102,29 @@ public final class RankuFloor extends AbstractNpcAI @Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { - int instanceId = npc.getInstanceId(); + final int instanceId = npc.getInstanceId(); if (instanceId > 0) { - Instance inst = InstanceManager.getInstance().getInstance(instanceId); - InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final Instance inst = InstanceManager.getInstance().getInstance(instanceId); + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); inst.setSpawnLoc(EXIT_POINT); - - // Terminate instance in 10 min - if ((inst.getInstanceEndTime() - System.currentTimeMillis()) > 600000) - { - inst.setDuration(600000); - } - - inst.setEmptyDestroyTime(0); - - if (world instanceof RFWorld) - { - setReenterTime(world); - } - + finishInstance(world); addSpawn(CUBE, -19056, 278732, -15000, 0, false, 0, false, instanceId); } return super.onKill(npc, killer, isSummon); } - private String checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { - if (player.getParty() == null) - { - return "gk-noparty.htm"; - } - else if (player.getParty().getLeaderObjectId() != player.getObjectId()) + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { - return "gk-noleader.htm"; + return true; } - return null; - } - - private boolean checkTeleport(L2PcInstance player) - { final L2Party party = player.getParty(); - if (party == null) - { - return false; - } - - if (!party.isLeader(player)) + if ((party == null) || !party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; @@ -153,125 +132,64 @@ public final class RankuFloor extends AbstractNpcAI for (L2PcInstance partyMember : party.getMembers()) { - if (partyMember.getLevel() < 78) + if (partyMember.getLevel() < MIN_LV) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } if (!Util.checkIfInRange(500, player, partyMember, true)) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember)); return false; } if (InstanceManager.getInstance().getPlayerWorld(player) != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember)); return false; } final Long reenterTime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID); if (System.currentTimeMillis() < reenterTime) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(partyMember)); return false; } if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_10, -1, false) < 1) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_QUEST_REQUIREMENT_NOT_SUFFICIENT); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } } return true; } - private void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - - if (world != null) + if (firstEntrance) { - if (world instanceof RFWorld) + if (player.getParty() == null) { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); - return; - } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; - } - - if (!checkTeleport(player)) - { - return; - } - - world = new RFWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.addAllowed(player.getObjectId()); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); - - _log.info("Tower of Infinitum - Ranku floor started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - - for (L2PcInstance partyMember : player.getParty().getMembers()) - { - teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); - partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true); - world.addAllowed(partyMember.getObjectId()); - } - } - - public void setReenterTime(InstanceWorld world) - { - if (world instanceof RFWorld) - { - // Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable - Calendar reenter; - Calendar now = Calendar.getInstance(); - Calendar reenterPointWed = (Calendar) now.clone(); - reenterPointWed.set(Calendar.AM_PM, Calendar.AM); - reenterPointWed.set(Calendar.MINUTE, RESET_MIN); - reenterPointWed.set(Calendar.HOUR_OF_DAY, RESET_HOUR); - reenterPointWed.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); - Calendar reenterPointSat = (Calendar) reenterPointWed.clone(); - reenterPointSat.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY); - - if (now.after(reenterPointSat)) - { - reenterPointWed.add(Calendar.WEEK_OF_MONTH, 1); - reenter = (Calendar) reenterPointWed.clone(); + player.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true); + world.addAllowed(player.getObjectId()); } else { - reenter = (Calendar) reenterPointSat.clone(); - } - - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); - sm.addInstanceName(world.getTemplateId()); - // set instance reenter time for all allowed players - for (int objectId : world.getAllowed()) - { - L2PcInstance player = L2World.getInstance().getPlayer(objectId); - if ((player != null) && player.isOnline()) + for (L2PcInstance partyMember : player.getParty().getMembers()) { - InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis()); - player.sendPacket(sm); + teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); + partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true); + world.addAllowed(partyMember.getObjectId()); } } } + else + { + teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); + } } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java index 2cafed544db5d808780ab0463ba4315ecd4f833a..e9c49a7fcb0d38317fd303158f4a27ff5288ca85 100644 --- a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java +++ b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java @@ -19,15 +19,15 @@ package hellbound.Instances.UrbanArea; import hellbound.HellboundEngine; +import instances.AbstractInstance; import java.util.concurrent.ScheduledFuture; -import ai.npc.AbstractNpcAI; - import com.l2jserver.gameserver.ThreadPoolManager; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.Location; +import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; @@ -47,15 +47,33 @@ import com.l2jserver.gameserver.util.Util; * Urban Area instance zone. * @author GKR */ -public final class UrbanArea extends AbstractNpcAI +public final class UrbanArea extends AbstractInstance { protected class UrbanAreaWorld extends InstanceWorld { protected L2MonsterInstance spawnedAmaskari; protected ScheduledFuture<?> activeAmaskariCall = null; - public boolean isAmaskariDead = false; + protected boolean isAmaskariDead = false; } + // NPCs + private static final int TOMBSTONE = 32343; + private static final int KANAF = 32346; + private static final int KEYMASTER = 22361; + private static final int AMASKARI = 22449; + private static final int DOWNTOWN_NATIVE = 32358; + private static final int TOWN_GUARD = 22359; + private static final int TOWN_PATROL = 22360; + // Items + private static final int KEY = 9714; + // Skills + private static final SkillHolder STONE = new SkillHolder(4616, 1); + // Locations + private static final Location AMASKARI_SPAWN_POINT = new Location(19424, 253360, -2032, 16860); + private static final Location ENTRY_POINT = new Location(14117, 255434, -2016); + protected static final Location EXIT_POINT = new Location(16262, 283651, -9700); + // Misc + private static final int MIN_LV = 78; private static final int TEMPLATE_ID = 2; private static final NpcStringId[] NPCSTRING_ID = @@ -71,35 +89,16 @@ public final class UrbanArea extends AbstractNpcAI NpcStringId.NOW_I_CAN_ESCAPE_ON_MY_OWN }; - private static final int TOMBSTONE = 32343; - private static final int KANAF = 32346; - private static final int KEYMASTER = 22361; - private static final int AMASKARI = 22449; - private static final int DOWNTOWN_NATIVE = 32358; - private static final int TOWN_GUARD = 22359; - private static final int TOWN_PATROL = 22360; - private static final Location AMASKARI_SPAWN_POINT = new Location(19424, 253360, -2032, 16860); - private static final Location ENTRY_POINT = new Location(14117, 255434, -2016); - protected static final Location EXIT_POINT = new Location(16262, 283651, -9700); - private static final SkillHolder STONE = new SkillHolder(4616, 1); - private static final int KEY = 9714; - public UrbanArea() { super(UrbanArea.class.getSimpleName(), "hellbound/Instances"); addFirstTalkId(DOWNTOWN_NATIVE); - addStartNpc(KANAF); - addStartNpc(DOWNTOWN_NATIVE); - addTalkId(KANAF); - addTalkId(DOWNTOWN_NATIVE); - addAttackId(TOWN_GUARD); - addAttackId(KEYMASTER); + addStartNpc(KANAF, DOWNTOWN_NATIVE); + addTalkId(KANAF, DOWNTOWN_NATIVE); + addAttackId(TOWN_GUARD, KEYMASTER); addAggroRangeEnterId(TOWN_GUARD); addKillId(AMASKARI); - addSpawnId(DOWNTOWN_NATIVE); - addSpawnId(TOWN_GUARD); - addSpawnId(TOWN_PATROL); - addSpawnId(KEYMASTER); + addSpawnId(DOWNTOWN_NATIVE, TOWN_GUARD, TOWN_PATROL, KEYMASTER); } @Override @@ -118,16 +117,27 @@ public final class UrbanArea extends AbstractNpcAI String htmltext = null; if (npc.getId() == KANAF) { - htmltext = checkConditions(player); + if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) + { + if (HellboundEngine.getInstance().getLevel() < 10) + { + htmltext = "32346-lvl.htm"; + } + + if (player.getParty() == null) + { + htmltext = "32346-party.htm"; + } + } if (htmltext == null) { - enterInstance(player, "UrbanArea.xml"); + enterInstance(player, new UrbanAreaWorld(), "UrbanArea.xml", TEMPLATE_ID); } } else if (npc.getId() == TOMBSTONE) { - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; @@ -156,7 +166,7 @@ public final class UrbanArea extends AbstractNpcAI { npc.setBusy(true); // destroy instance after 5 min - Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); + final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); inst.setDuration(5 * 60000); inst.setEmptyDestroyTime(0); ThreadPoolManager.getInstance().scheduleGeneral(new ExitInstance(party, world), 285000); @@ -190,8 +200,8 @@ public final class UrbanArea extends AbstractNpcAI { if (!npc.isAffectedBySkill(STONE.getSkillId()) || world.isAmaskariDead) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NATIVES_NPCSTRING_ID[0])); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NATIVES_NPCSTRING_ID[2])); + broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[0]); + broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[2]); } else { @@ -201,8 +211,8 @@ public final class UrbanArea extends AbstractNpcAI npc.stopSkillEffects(false, STONE.getSkillId()); } - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NATIVES_NPCSTRING_ID[0])); - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NATIVES_NPCSTRING_ID[1])); + broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[0]); + broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[1]); HellboundEngine.getInstance().updateTrust(10, true); npc.scheduleDespawn(3000); // Try to call Amaskari @@ -219,7 +229,7 @@ public final class UrbanArea extends AbstractNpcAI } } } - return null; + return super.onAdvEvent(event, npc, player); } @Override @@ -237,21 +247,20 @@ public final class UrbanArea extends AbstractNpcAI npc.setBusy(false); npc.setBusyMessage(""); } - return super.onSpawn(npc); } @Override public String onAggroRangeEnter(L2Npc npc, L2PcInstance player, boolean isSummon) { - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { - UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; + final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; if (!npc.isBusy()) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NPCSTRING_ID[0])); + broadcastNpcSay(npc, Say2.NPC_ALL, NPCSTRING_ID[0]); npc.setBusy(true); if ((world.spawnedAmaskari != null) && !world.spawnedAmaskari.isDead() && (getRandom(1000) < 25) && Util.checkIfInRange(1000, npc, world.spawnedAmaskari, false)) @@ -260,7 +269,6 @@ public final class UrbanArea extends AbstractNpcAI { world.activeAmaskariCall.cancel(true); } - world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000); } } @@ -271,10 +279,10 @@ public final class UrbanArea extends AbstractNpcAI @Override public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill) { - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { - UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; + final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; if (!world.isAmaskariDead && !(npc.getBusyMessage().equalsIgnoreCase("atk") || npc.isBusy())) { @@ -296,7 +304,7 @@ public final class UrbanArea extends AbstractNpcAI } if (msgId >= 0) { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NPCSTRING_ID[msgId])); + broadcastNpcSay(npc, Say2.NPC_ALL, NPCSTRING_ID[msgId], range); } npc.setBusy(true); npc.setBusyMessage("atk"); @@ -307,7 +315,6 @@ public final class UrbanArea extends AbstractNpcAI { world.activeAmaskariCall.cancel(true); } - world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000); } } @@ -318,7 +325,7 @@ public final class UrbanArea extends AbstractNpcAI @Override public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon) { - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld)) { UrbanAreaWorld world = (UrbanAreaWorld) tmpworld; @@ -327,30 +334,17 @@ public final class UrbanArea extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - private String checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { - if (HellboundEngine.getInstance().getLevel() < 10) + if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { - return "32346-lvl.htm"; + return true; } - if (player.getParty() == null) - { - return "32346-party.htm"; - } - return null; - } - - private boolean checkTeleport(L2PcInstance player) - { final L2Party party = player.getParty(); - if (party == null) - { - return false; - } - - if (!party.isLeader(player)) + if ((party == null) || !party.isLeader(player)) { player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); return false; @@ -358,70 +352,51 @@ public final class UrbanArea extends AbstractNpcAI for (L2PcInstance partyMember : party.getMembers()) { - if (partyMember.getLevel() < 78) + if (partyMember.getLevel() < MIN_LV) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember)); return false; } if (!Util.checkIfInRange(1000, player, partyMember, true)) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember)); return false; } if (InstanceManager.getInstance().getPlayerWorld(player) != null) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - sm.addPcName(partyMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember)); return false; } } return true; } - private void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - - if (world != null) + if (firstEntrance) { - if (world instanceof UrbanAreaWorld) + if (player.getParty() == null) { teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); - return; + world.addAllowed(player.getObjectId()); } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; - } - - if (!checkTeleport(player)) - { - return; + else + { + for (L2PcInstance partyMember : player.getParty().getMembers()) + { + teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); + world.addAllowed(partyMember.getObjectId()); + } + } + ((UrbanAreaWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT, false, 0, false, world.getInstanceId()); } - - world = new UrbanAreaWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.addAllowed(player.getObjectId()); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); - - _log.info("Hellbound Town started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - - for (L2PcInstance partyMember : player.getParty().getMembers()) + else { - teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); - world.addAllowed(partyMember.getObjectId()); + teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); } - - ((UrbanAreaWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT, false, 0, false, world.getInstanceId()); } private static class CallAmaskari implements Runnable @@ -480,4 +455,4 @@ public final class UrbanArea extends AbstractNpcAI } } } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/AbstractInstance.java b/L2J_DataPack/dist/game/data/scripts/instances/AbstractInstance.java new file mode 100644 index 0000000000000000000000000000000000000000..97838d69ba47ceb1302f2e63be26bbc3a5d37f88 --- /dev/null +++ b/L2J_DataPack/dist/game/data/scripts/instances/AbstractInstance.java @@ -0,0 +1,306 @@ +/* + * Copyright (C) 2004-2014 L2J DataPack + * + * This file is part of L2J DataPack. + * + * L2J DataPack is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * L2J DataPack is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package instances; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.List; +import java.util.logging.Logger; + +import ai.npc.AbstractNpcAI; + +import com.l2jserver.Config; +import com.l2jserver.gameserver.enums.InstanceReenterType; +import com.l2jserver.gameserver.instancemanager.InstanceManager; +import com.l2jserver.gameserver.model.L2World; +import com.l2jserver.gameserver.model.actor.L2Npc; +import com.l2jserver.gameserver.model.actor.L2Summon; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.entity.Instance; +import com.l2jserver.gameserver.model.holders.InstanceReenterTimeHolder; +import com.l2jserver.gameserver.model.instancezone.InstanceWorld; +import com.l2jserver.gameserver.model.skills.BuffInfo; +import com.l2jserver.gameserver.network.SystemMessageId; +import com.l2jserver.gameserver.network.serverpackets.SystemMessage; + +/** + * Abstract class for Instances. + * @author FallenAngel + */ +public abstract class AbstractInstance extends AbstractNpcAI +{ + public final Logger _log = Logger.getLogger(getClass().getSimpleName()); + + public AbstractInstance(String name, String desc) + { + super(name, desc); + } + + public AbstractInstance(String name) + { + super(name, "instances"); + } + + protected void enterInstance(L2PcInstance player, InstanceWorld instance, String template, int templateId) + { + final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); + if (world != null) + { + if (world.getTemplateId() == templateId) + { + onEnterInstance(player, world, false); + + final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); + if (inst.isRemoveBuffEnabled()) + { + handleRemoveBuffs(player, world); + } + return; + } + player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); + return; + } + + if (checkConditions(player)) + { + final InstanceWorld playerWorld = instance; + playerWorld.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); + playerWorld.setTemplateId(templateId); + playerWorld.setStatus(0); + InstanceManager.getInstance().addWorld(playerWorld); + onEnterInstance(player, playerWorld, true); + + final Instance inst = InstanceManager.getInstance().getInstance(playerWorld.getInstanceId()); + if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_ENTER) + { + handleReenterTime(playerWorld); + } + + if (inst.isRemoveBuffEnabled()) + { + handleRemoveBuffs(playerWorld); + } + + if (Config.DEBUG_INSTANCES) + { + _log.info("Instance " + InstanceManager.getInstance().getInstance(playerWorld.getInstanceId()).getName() + " (" + playerWorld.getTemplateId() + ") has been created by player " + player.getName()); + } + } + } + + protected void finishInstance(InstanceWorld world) + { + finishInstance(world, Config.INSTANCE_FINISH_TIME); + } + + protected void finishInstance(InstanceWorld world, int duration) + { + final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); + + if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_FINISH) + { + handleReenterTime(world); + } + + if (duration == 0) + { + InstanceManager.getInstance().destroyInstance(inst.getId()); + } + else if (duration > 0) + { + inst.setDuration(duration); + inst.setEmptyDestroyTime(0); + } + } + + protected void handleReenterTime(InstanceWorld world) + { + final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); + final List<InstanceReenterTimeHolder> reenterData = inst.getReenterData(); + + long time = -1; + + for (InstanceReenterTimeHolder data : reenterData) + { + if (data.getTime() > 0) + { + time = System.currentTimeMillis() + data.getTime(); + break; + } + + final Calendar calendar = Calendar.getInstance(); + calendar.set(Calendar.AM_PM, data.getHour() >= 12 ? 1 : 0); + calendar.set(Calendar.HOUR, data.getHour()); + calendar.set(Calendar.MINUTE, data.getMinute()); + calendar.set(Calendar.SECOND, 0); + + if (calendar.getTimeInMillis() <= System.currentTimeMillis()) + { + calendar.add(Calendar.DAY_OF_MONTH, 1); + } + + if (data.getDay() != null) + { + while (calendar.get(Calendar.DAY_OF_WEEK) != (data.getDay().getValue() + 1)) + { + calendar.add(Calendar.DAY_OF_MONTH, 1); + } + } + + if (time == -1) + { + time = calendar.getTimeInMillis(); + } + else if (calendar.getTimeInMillis() < time) + { + time = calendar.getTimeInMillis(); + } + } + + if (time > 0) + { + setReenterTime(world, time); + } + } + + protected void handleRemoveBuffs(InstanceWorld world) + { + for (Integer objId : world.getAllowed()) + { + final L2PcInstance player = L2World.getInstance().getPlayer(objId); + + if (player != null) + { + handleRemoveBuffs(player, world); + } + } + } + + protected abstract void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance); + + protected boolean checkConditions(L2PcInstance player) + { + return true; + } + + /** + * Spawns group of instance NPC's + * @param groupName - name of group from XML definition to spawn + * @param instanceId - ID of instance + * @return list of spawned NPC's + */ + protected List<L2Npc> spawnGroup(String groupName, int instanceId) + { + return InstanceManager.getInstance().getInstance(instanceId).spawnGroup(groupName); + } + + /** + * Save Reenter time for every player in InstanceWorld. + * @param world - the InstanceWorld + * @param time - Time in miliseconds + */ + protected void setReenterTime(InstanceWorld world, long time) + { + for (int objectId : world.getAllowed()) + { + InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), time); + final L2PcInstance player = L2World.getInstance().getPlayer(objectId); + if ((player != null) && player.isOnline()) + { + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_FROM_HERE_S1_S_ENTRY_HAS_BEEN_RESTRICTED).addString(InstanceManager.getInstance().getInstance(world.getInstanceId()).getName())); + } + } + + if (Config.DEBUG_INSTANCES) + { + _log.info("Time restrictions has been set for player in instance ID: " + world.getInstanceId() + " (" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time) + ")"); + } + } + + private void handleRemoveBuffs(L2PcInstance player, InstanceWorld world) + { + final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); + final List<BuffInfo> buffToRemove = new ArrayList<>(); + + switch (inst.getRemoveBuffType()) + { + case ALL: + { + final L2Summon summon = player.getSummon(); + if (summon != null) + { + summon.stopAllEffectsExceptThoseThatLastThroughDeath(); + } + break; + } + case WHITELIST: + { + for (BuffInfo info : player.getEffectList().getBuffs().values()) + { + if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) + { + buffToRemove.add(info); + } + } + + final L2Summon summon = player.getSummon(); + if (summon != null) + { + for (BuffInfo info : summon.getEffectList().getBuffs().values()) + { + if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) + { + buffToRemove.add(info); + } + } + } + break; + } + case BLACKLIST: + { + for (BuffInfo info : player.getEffectList().getBuffs().values()) + { + if (inst.getBuffExceptionList().contains(info.getSkill().getId())) + { + buffToRemove.add(info); + } + } + + final L2Summon summon = player.getSummon(); + if (summon != null) + { + for (BuffInfo info : summon.getEffectList().getBuffs().values()) + { + if (inst.getBuffExceptionList().contains(info.getSkill().getId())) + { + buffToRemove.add(info); + } + } + } + break; + } + } + + for (BuffInfo info : buffToRemove) + { + info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill()); + } + } +} \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java b/L2J_DataPack/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java index 5ce609fa5ad68ae3fdc13534ae3eae7a4c3c7c9a..f77fdfc1905fffc8ce6cc6105f061c5ee6aef9be 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java @@ -18,21 +18,18 @@ */ package instances.CavernOfThePirateCaptain; +import instances.AbstractInstance; + import java.util.ArrayList; -import java.util.Calendar; import java.util.List; -import ai.npc.AbstractNpcAI; - import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2Party; -import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Attackable; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; @@ -42,16 +39,16 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; * Cavern Of The Pirate Captain (Day Dream) instance Zone. * @author St3eT */ -public class CavernOfThePirateCaptain extends AbstractNpcAI +public final class CavernOfThePirateCaptain extends AbstractInstance { protected class CavernOfThePirateCaptainWorld extends InstanceWorld { - List<L2PcInstance> playersInside = new ArrayList<>(); - L2Attackable _zaken; - long storeTime = 0; - boolean _is83; - int _zakenRoom; - int _blueFounded; + protected List<L2PcInstance> playersInside = new ArrayList<>(); + protected L2Attackable _zaken; + protected long storeTime = 0; + protected boolean _is83; + protected int _zakenRoom; + protected int _blueFounded; } // NPCs @@ -131,11 +128,6 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI private static final int PLAYERS_83_MAX = 27; private static final int TEMPLATE_ID_60 = 133; private static final int TEMPLATE_ID_83 = 135; - private static final int HOURS = 6; - private static final int MINUTES = 30; - private static final int DAY_A = Calendar.MONDAY; - private static final int DAY_B = Calendar.WEDNESDAY; - private static final int DAY_C = Calendar.FRIDAY; //@formatter:off private static final int[][] ROOM_DATA = { @@ -160,39 +152,22 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI }; //@formatter:on - private CavernOfThePirateCaptain() + public CavernOfThePirateCaptain() { - super(CavernOfThePirateCaptain.class.getSimpleName(), "instances"); + super(CavernOfThePirateCaptain.class.getSimpleName()); addStartNpc(PATHFINDER); addTalkId(PATHFINDER); addKillId(ZAKEN_60, ZAKEN_83); addFirstTalkId(CANDLE); } - private void enterInstance(L2PcInstance player, String template, boolean is83) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - - if (world != null) - { - if (world instanceof CavernOfThePirateCaptainWorld) - { - teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); - return; - } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; - } - - if (checkConditions(player, is83)) + if (firstEntrance) { - world = new CavernOfThePirateCaptainWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(is83 ? TEMPLATE_ID_83 : TEMPLATE_ID_60); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); final CavernOfThePirateCaptainWorld curworld = (CavernOfThePirateCaptainWorld) world; - curworld._is83 = is83; + curworld._is83 = curworld.getTemplateId() == TEMPLATE_ID_83; curworld.storeTime = System.currentTimeMillis(); if (!player.isInParty()) @@ -215,24 +190,21 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI } manageNpcSpawn(curworld); } + else + { + teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); + } } private void managePlayerEnter(L2PcInstance player, CavernOfThePirateCaptainWorld world) { - if (!world._is83) - { - player.stopAllEffectsExceptThoseThatLastThroughDeath(); - if (player.hasSummon()) - { - player.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); - } - } world.playersInside.add(player); world.addAllowed(player.getObjectId()); teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); } - private boolean checkConditions(L2PcInstance player, boolean is83) + @Override + protected boolean checkConditions(L2PcInstance player) { if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { @@ -245,6 +217,7 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI return false; } + final boolean is83 = InstanceManager.getInstance().getPlayerWorld(player).getTemplateId() == TEMPLATE_ID_83 ? true : false; final L2Party party = player.getParty(); final boolean isInCC = party.isInCommandChannel(); final List<L2PcInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers(); @@ -266,20 +239,20 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI { if (groupMembers.getLevel() < (is83 ? MIN_LV_83 : MIN_LV_60)) { - broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT, true); + broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED, true); return false; } if (!player.isInsideRadius(groupMembers, 1000, true, true)) { - broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED, true); + broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED, true); return false; } final Long reentertime = InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? TEMPLATE_ID_83 : TEMPLATE_ID_60)); if (System.currentTimeMillis() < reentertime) { - broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_MAY_NOT_REENTER_YET, true); + broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_MAY_NOT_RE_ENTER_YET, true); return false; } } @@ -314,11 +287,11 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI { if (event.equals("enter60")) { - enterInstance(player, "CavernOfThePirateCaptainWorldDay60.xml", false); + enterInstance(player, new CavernOfThePirateCaptainWorld(), "CavernOfThePirateCaptainWorldDay60.xml", TEMPLATE_ID_60); } else if (event.equals("enter83")) { - enterInstance(player, "CavernOfThePirateCaptainWorldDay83.xml", true); + enterInstance(player, new CavernOfThePirateCaptainWorld(), "CavernOfThePirateCaptainWorldDay83.xml", TEMPLATE_ID_83); } else { @@ -401,7 +374,6 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld)) { final CavernOfThePirateCaptainWorld world = (CavernOfThePirateCaptainWorld) tmpworld; - final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); if (npc.getId() == ZAKEN_83) { @@ -434,9 +406,7 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI } } } - saveReenterForPlayers(world); - inst.setDuration(300000); - inst.setEmptyDestroyTime(0); + finishInstance(world); } return super.onKill(npc, killer, isSummon); } @@ -537,56 +507,4 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI world._zaken.setInvisible(true); world._zaken.setIsParalyzed(true); } - - private void saveReenterForPlayers(InstanceWorld world) - { - final Calendar reenter = Calendar.getInstance(); - reenter.set(Calendar.MINUTE, MINUTES); - reenter.set(Calendar.HOUR_OF_DAY, HOURS); - - if (reenter.getTimeInMillis() <= System.currentTimeMillis()) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - - if ((reenter.get(Calendar.DAY_OF_WEEK) <= DAY_A) || (reenter.get(Calendar.DAY_OF_WEEK) > DAY_C)) - { - while (reenter.get(Calendar.DAY_OF_WEEK) != DAY_A) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - } - else if (reenter.get(Calendar.DAY_OF_WEEK) <= DAY_B) - { - while (reenter.get(Calendar.DAY_OF_WEEK) != DAY_B) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - } - else - { - while (reenter.get(Calendar.DAY_OF_WEEK) != DAY_C) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - } - - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); - sm.addString(InstanceManager.getInstance().getInstanceIdName(world.getTemplateId())); - - for (int objectId : world.getAllowed()) - { - final L2PcInstance player = L2World.getInstance().getPlayer(objectId); - InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis()); - if ((player != null) && player.isOnline()) - { - player.sendPacket(sm); - } - } - } - - public static void main(String[] args) - { - new CavernOfThePirateCaptain(); - } } diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java index 19e3cb250270663f9cdc6f7e44d47025fd1eff8f..3e92a69fc406f1cbbdfbe3939ac80efe4dd2b42f 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java @@ -18,6 +18,8 @@ */ package instances.ChambersOfDelusion; +import instances.AbstractInstance; + import java.util.Calendar; import java.util.concurrent.ScheduledFuture; import java.util.logging.Level; @@ -35,7 +37,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.NpcStringId; @@ -50,7 +51,7 @@ import com.l2jserver.gameserver.util.Util; * Chambers of Delusion superclass. * @author GKR */ -public abstract class Chamber extends Quest +public abstract class Chamber extends AbstractInstance { protected class CDWorld extends InstanceWorld { @@ -173,9 +174,9 @@ public abstract class Chamber extends Quest // Misc private static final String RETURN = Chamber.class.getSimpleName() + "_return"; - protected Chamber(int questId, String name, String descr, int instanceId, String instanceTemplateName, int entranceGKId, int roomGKFirstId, int roomGKLastId, int aenkinelId, int boxId) + protected Chamber(String name, String descr, int instanceId, String instanceTemplateName, int entranceGKId, int roomGKFirstId, int roomGKLastId, int aenkinelId, int boxId) { - super(questId, name, descr); + super(name, descr); INSTANCEID = instanceId; INSTANCE_TEMPLATE = instanceTemplateName; @@ -208,7 +209,8 @@ public abstract class Chamber extends Quest return (world.currentRoom == (ROOM_ENTER_POINTS.length - 1)); } - private boolean checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { final L2Party party = player.getParty(); if (party == null) @@ -227,7 +229,7 @@ public abstract class Chamber extends Quest { if (partyMember.getLevel() < 80) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -235,7 +237,7 @@ public abstract class Chamber extends Quest if (!Util.checkIfInRange(1000, player, partyMember, true)) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -247,7 +249,7 @@ public abstract class Chamber extends Quest if (System.currentTimeMillis() < reentertime) { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -270,7 +272,7 @@ public abstract class Chamber extends Quest { reenter.add(Calendar.DAY_OF_WEEK, 1); } - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_FROM_HERE_S1_S_ENTRY_HAS_BEEN_RESTRICTED); sm.addString(InstanceManager.getInstance().getInstanceIdName(world.getTemplateId())); // set instance reenter time for all allowed players for (int objectId : world.getAllowed()) @@ -402,39 +404,18 @@ public abstract class Chamber extends Quest } } - protected int enterInstance(L2PcInstance player) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - int instanceId = 0; - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof CDWorld)) - { - player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER)); - return 0; - } - final CDWorld currentWorld = (CDWorld) world; - teleportPlayer(player, ROOM_ENTER_POINTS[currentWorld.currentRoom], world.getInstanceId()); - return instanceId; + enter((CDWorld) world); } - - // New instance - if (!checkConditions(player)) + else { - return 0; + final CDWorld currentWorld = (CDWorld) world; + teleportPlayer(player, ROOM_ENTER_POINTS[currentWorld.currentRoom], world.getInstanceId()); } - final L2Party party = player.getParty(); - instanceId = InstanceManager.getInstance().createDynamicInstance(INSTANCE_TEMPLATE); - world = new CDWorld(party); - world.setInstanceId(instanceId); - world.setTemplateId(INSTANCEID); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - _log.info("Chamber Of Delusion started " + INSTANCE_TEMPLATE + " Instance: " + instanceId + " created by player: " + player.getName()); - enter((CDWorld) world); - return instanceId; } protected void exitInstance(L2PcInstance player) @@ -635,7 +616,6 @@ public abstract class Chamber extends Quest { npc.doDie(player); } - return super.onSpellFinished(npc, player, skill); } @@ -652,9 +632,13 @@ public abstract class Chamber extends Quest if (npcId == ENTRANCE_GATEKEEPER) { - enterInstance(player); + if (checkConditions(player)) + { + final L2Party party = player.getParty(); + enterInstance(player, new CDWorld(party), INSTANCE_TEMPLATE, INSTANCEID); + } } return ""; } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java index 53716ae14c087ea3b30afa46cfb6bad620709db4..35780eff3e2b90d38ae3ea22aa7875df93a7275b 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java @@ -45,14 +45,9 @@ public final class ChamberOfDelusionEast extends Chamber private static final int INSTANCEID = 127; private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionEast.xml"; - private ChamberOfDelusionEast() + public ChamberOfDelusionEast() { - super(-1, ChamberOfDelusionEast.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); + super(ChamberOfDelusionEast.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } - - public static void main(String[] args) - { - new ChamberOfDelusionEast(); - } } \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java index 10708db9d5b734e1626ae3a3e86eba1893553877..3eb89a04a4b5e95ea759d495d54962950df1ebd3 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java @@ -45,14 +45,9 @@ public final class ChamberOfDelusionNorth extends Chamber private static final int INSTANCEID = 130; // this is the client number private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionNorth.xml"; - private ChamberOfDelusionNorth() + public ChamberOfDelusionNorth() { - super(-1, ChamberOfDelusionNorth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); + super(ChamberOfDelusionNorth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } - - public static void main(String[] args) - { - new ChamberOfDelusionNorth(); - } } \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java index d681e3fa22df8413e49fa0e837e65a47aad4c005..e4f4d9d8b132c2846a0a1cc5fc89312a284cfe29 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java @@ -45,14 +45,9 @@ public final class ChamberOfDelusionSouth extends Chamber private static final int INSTANCEID = 129; // this is the client number private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionSouth.xml"; - private ChamberOfDelusionSouth() + public ChamberOfDelusionSouth() { - super(-1, ChamberOfDelusionSouth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); + super(ChamberOfDelusionSouth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } - - public static void main(String[] args) - { - new ChamberOfDelusionSouth(); - } } \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java index 4e5867b31d226285f80589668841b9995718bbfa..22ef833090568a017b8cdc998dab68fd23de1c8d 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java @@ -49,14 +49,9 @@ public final class ChamberOfDelusionSquare extends Chamber private static final int INSTANCEID = 131; private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionSquare.xml"; - private ChamberOfDelusionSquare() + public ChamberOfDelusionSquare() { - super(-1, ChamberOfDelusionSquare.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); + super(ChamberOfDelusionSquare.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } - - public static void main(String[] args) - { - new ChamberOfDelusionSquare(); - } } \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java index b082219d7e98fdaea18dcf89dd702100a12cba73..8b3b8a2a625c5428e6f263d75a57596e711eb349 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java @@ -49,14 +49,9 @@ public final class ChamberOfDelusionTower extends Chamber private static final int INSTANCEID = 132; // this is the client number private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionTower.xml"; - private ChamberOfDelusionTower() + public ChamberOfDelusionTower() { - super(-1, ChamberOfDelusionTower.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); + super(ChamberOfDelusionTower.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } - - public static void main(String[] args) - { - new ChamberOfDelusionTower(); - } } \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java index 5e9a1a94cde89a4a50fef92581de6a0fdc3dc09e..0e77369f319d4de206373e5ae9950b7404eb4d5c 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java @@ -45,14 +45,9 @@ public final class ChamberOfDelusionWest extends Chamber private static final int INSTANCEID = 128; // this is the client number private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionWest.xml"; - private ChamberOfDelusionWest() + public ChamberOfDelusionWest() { - super(-1, ChamberOfDelusionWest.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); + super(ChamberOfDelusionWest.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX); ROOM_ENTER_POINTS = ENTER_POINTS; } - - public static void main(String[] args) - { - new ChamberOfDelusionWest(); - } } \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java b/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java index 9c0f8802bf381563d68ec5fcb11ca7c206c6cf40..dd892ac884568f6dce6d2a2a035d6d76db5ebfcb 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java @@ -18,6 +18,8 @@ */ package instances.CrystalCaverns; +import instances.AbstractInstance; + import java.util.List; import java.util.Map; @@ -35,6 +37,7 @@ import com.l2jserver.gameserver.model.L2Object; import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.Location; +import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Attackable; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; @@ -45,7 +48,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2TrapInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.model.skills.targets.L2TargetType; @@ -71,13 +73,13 @@ import com.l2jserver.gameserver.util.Util; * 4. Baylor Raid is missing a lot of things This script takes the best elements of different versions and combines them into one script to get the most optimal and retail-like experience.<br> * Original sources: theone, L2JEmu, L2JOfficial, L2JFree Contributing authors: TGS, Lantoc, Janiii, Gigiikun, RosT Please maintain consistency between the Crystal Caverns scripts. */ -public final class CrystalCaverns extends Quest +public final class CrystalCaverns extends AbstractInstance { protected static class CrystalGolem { - public L2ItemInstance foodItem = null; - public boolean isAtDestination = false; - public Location oldLoc = null; + protected L2ItemInstance foodItem = null; + protected boolean isAtDestination = false; + protected Location oldLoc = null; } private class CCWorld extends InstanceWorld @@ -128,9 +130,6 @@ public final class CrystalCaverns extends Quest } } - private static final int TEMPLATE_ID = 10; - private static final boolean debug = false; - // Items private static final int WHITE_SEED = 9597; private static final int BLACK_SEED = 9598; @@ -141,7 +140,6 @@ public final class CrystalCaverns extends Quest private static final int BOSS_CRYSTAL_1 = 9695; // Clear Crystal private static final int BOSS_CRYSTAL_2 = 9696; // Clear Crystal private static final int BOSS_CRYSTAL_3 = 9697; // Clear Crystal - // NPCs private static final int ORACLE_GUIDE_1 = 32281; private static final int ORACLE_GUIDE_2 = 32278; @@ -156,18 +154,14 @@ public final class CrystalCaverns extends Quest -11886, 16384 }; - - // mobs private static final int GK1 = 22275; private static final int GK2 = 22277; - private static final int TOURMALINE = 22292; private static final int TEROD = 22301; private static final int DOLPH = 22299; private static final int WEYLIN = 22298; private static final int GUARDIAN = 22303; private static final int GUARDIAN2 = 22304; - private static final int TEARS = 25534; private static final int TEARS_COPY = 25535; private static final int KECHI = 25532; @@ -175,7 +169,6 @@ public final class CrystalCaverns extends Quest private static final int BAYLOR = 29099; private static final int DARNEL = 25531; private final static int ALARMID = 18474; - // private static final int[] BOSSCR = {9695,9696,9697}; private static final int[] CGMOBS = { @@ -222,7 +215,11 @@ public final class CrystalCaverns extends Quest 22420 }; - // Doors/Walls/Zones + // Locations + private static final Location START_LOC = new Location(143348, 148707, -11972); + // Misc + private static final int TEMPLATE_ID = 10; + private static final boolean debug = false; private static final int DOOR1 = 24220021; private static final int DOOR2 = 24220024; private static final int DOOR3 = 24220023; @@ -235,1239 +232,277 @@ public final class CrystalCaverns extends Quest 20106, 20107 }; - - // Baylor alarm spawns + // @formatter:off private final static int[][] ALARMSPAWN = { - { - 153572, - 141277, - -12738 - }, - { - 153572, - 142852, - -12738 - }, - { - 154358, - 142075, - -12738 - }, - { - 152788, - 142075, - -12738 - } + {153572, 141277, -12738}, + {153572, 142852, -12738}, + {154358, 142075, -12738}, + {152788, 142075, -12738} }; - // Oracle order private static final int[][] ordreOracle1 = { - { - 32274, - 147090, - 152505, - -12169, - 31613 - }, - { - 32275, - 147090, - 152575, - -12169, - 31613 - }, - { - 32274, - 147090, - 152645, - -12169, - 31613 - }, - { - 32274, - 147090, - 152715, - -12169, - 31613 - } + {32274, 147090, 152505, -12169, 31613}, + {32275, 147090, 152575, -12169, 31613}, + {32274, 147090, 152645, -12169, 31613}, + {32274, 147090, 152715, -12169, 31613} }; private static final int[][] ordreOracle2 = { - { - 32274, - 149783, - 152505, - -12169, - 31613 - }, + {32274, 149783, 152505, -12169, 31613}, // {32274, 149783, 152575, -12169, 31613}, - { - 32274, - 149783, - 152645, - -12169, - 31613 - }, - { - 32276, - 149783, - 152715, - -12169, - 31613 - } + {32274, 149783, 152645, -12169, 31613}, + {32276, 149783, 152715, -12169, 31613} }; private static final int[][] ordreOracle3 = { - { - 32274, - 152461, - 152505, - -12169, - 31613 - }, + {32274, 152461, 152505, -12169, 31613}, // {32274, 152461, 152575, -12169, 31613}, - { - 32277, - 152461, - 152645, - -12169, - 31613 - } - // {32274, 152461, 152715, -12169, 31613} + {32277, 152461, 152645, -12169, 31613}, + // {32274, 152461, 152715, -12169, 31613} }; - - // Hall spawns - private static int[][] SPAWNS = + private static int[][] HALL_SPAWNS = { - { - 141842, - 152556, - -11814, - 50449 - }, - { - 141503, - 153395, - -11814, - 40738 - }, - { - 141070, - 153201, - -11814, - 39292 - }, - { - 141371, - 152986, - -11814, - 35575 - }, - { - 141602, - 154188, - -11814, - 24575 - }, - { - 141382, - 154719, - -11814, - 37640 - }, - { - 141376, - 154359, - -11814, - 12054 - }, - { - 140895, - 154383, - -11814, - 37508 - }, - { - 140972, - 154740, - -11814, - 52690 - }, - { - 141045, - 154504, - -11814, - 50674 - }, - { - 140757, - 152740, - -11814, - 39463 - }, - { - 140406, - 152376, - -11814, - 16599 - }, - { - 140268, - 152007, - -11817, - 45316 - }, - { - 139996, - 151485, - -11814, - 47403 - }, - { - 140378, - 151190, - -11814, - 58116 - }, - { - 140521, - 150711, - -11815, - 55997 - }, - { - 140816, - 150215, - -11814, - 53682 - }, - { - 141528, - 149909, - -11814, - 22020 - }, - { - 141644, - 150360, - -11817, - 13283 - }, - { - 142048, - 150695, - -11815, - 5929 - }, - { - 141852, - 151065, - -11817, - 27071 - }, - { - 142408, - 151211, - -11815, - 2402 - }, - { - 142481, - 151762, - -11815, - 12876 - }, - { - 141929, - 152193, - -11815, - 27511 - }, - { - 142083, - 151791, - -11814, - 47176 - }, - { - 141435, - 150402, - -11814, - 41798 - }, - { - 140390, - 151199, - -11814, - 50069 - }, - { - 140557, - 151849, - -11814, - 45293 - }, - { - 140964, - 153445, - -11814, - 56672 - }, - { - 142851, - 154109, - -11814, - 24920 - }, - { - 142379, - 154725, - -11814, - 30342 - }, - { - 142816, - 154712, - -11814, - 33193 - }, - { - 142276, - 154223, - -11814, - 33922 - }, - { - 142459, - 154490, - -11814, - 33184 - }, - { - 142819, - 154372, - -11814, - 21318 - }, - { - 141157, - 154541, - -11814, - 27090 - }, - { - 141095, - 150281, - -11814, - 55186 - } + {141842, 152556, -11814, 50449}, + {141503, 153395, -11814, 40738}, + {141070, 153201, -11814, 39292}, + {141371, 152986, -11814, 35575}, + {141602, 154188, -11814, 24575}, + {141382, 154719, -11814, 37640}, + {141376, 154359, -11814, 12054}, + {140895, 154383, -11814, 37508}, + {140972, 154740, -11814, 52690}, + {141045, 154504, -11814, 50674}, + {140757, 152740, -11814, 39463}, + {140406, 152376, -11814, 16599}, + {140268, 152007, -11817, 45316}, + {139996, 151485, -11814, 47403}, + {140378, 151190, -11814, 58116}, + {140521, 150711, -11815, 55997}, + {140816, 150215, -11814, 53682}, + {141528, 149909, -11814, 22020}, + {141644, 150360, -11817, 13283}, + {142048, 150695, -11815, 5929}, + {141852, 151065, -11817, 27071}, + {142408, 151211, -11815, 2402}, + {142481, 151762, -11815, 12876}, + {141929, 152193, -11815, 27511}, + {142083, 151791, -11814, 47176}, + {141435, 150402, -11814, 41798}, + {140390, 151199, -11814, 50069}, + {140557, 151849, -11814, 45293}, + {140964, 153445, -11814, 56672}, + {142851, 154109, -11814, 24920}, + {142379, 154725, -11814, 30342}, + {142816, 154712, -11814, 33193}, + {142276, 154223, -11814, 33922}, + {142459, 154490, -11814, 33184}, + {142819, 154372, -11814, 21318}, + {141157, 154541, -11814, 27090}, + {141095, 150281, -11814, 55186} }; // first spawns private static int[][] FIRST_SPAWNS = { - { - 22276, - 148109, - 149601, - -12132, - 34490 - }, - { - 22276, - 148017, - 149529, - -12132, - 33689 - }, - { - 22278, - 148065, - 151202, - -12132, - 35323 - }, - { - 22278, - 147966, - 151117, - -12132, - 33234 - }, - { - 22279, - 144063, - 150238, - -12132, - 29654 - }, - { - 22279, - 144300, - 149118, - -12135, - 5520 - }, - { - 22279, - 144397, - 149337, - -12132, - 644 - }, - { - 22279, - 144426, - 150639, - -12132, - 50655 - }, - { - 22282, - 145841, - 151097, - -12132, - 31810 - }, - { - 22282, - 144387, - 149958, - -12132, - 61173 - }, - { - 22282, - 145821, - 149498, - -12132, - 31490 - }, - { - 22282, - 146619, - 149694, - -12132, - 33374 - }, - { - 22282, - 146669, - 149244, - -12132, - 31360 - }, - { - 22284, - 144147, - 151375, - -12132, - 58395 - }, - { - 22284, - 144485, - 151067, - -12132, - 64786 - }, - { - 22284, - 144356, - 149571, - -12132, - 63516 - }, - { - 22285, - 144151, - 150962, - -12132, - 664 - }, - { - 22285, - 146657, - 151365, - -12132, - 33154 - }, - { - 22285, - 146623, - 150857, - -12132, - 28034 - }, - { - 22285, - 147046, - 151089, - -12132, - 32941 - }, - { - 22285, - 145704, - 151255, - -12132, - 32523 - }, - { - 22285, - 145359, - 151101, - -12132, - 32767 - }, - { - 22285, - 147785, - 150817, - -12132, - 27423 - }, - { - 22285, - 147727, - 151375, - -12132, - 37117 - }, - { - 22285, - 145428, - 149494, - -12132, - 890 - }, - { - 22285, - 145601, - 149682, - -12132, - 32442 - }, - { - 22285, - 147003, - 149476, - -12132, - 31554 - }, - { - 22285, - 147738, - 149210, - -12132, - 20971 - }, - { - 22285, - 147769, - 149757, - -12132, - 34980 - } + {22276, 148109, 149601, -12132, 34490}, + {22276, 148017, 149529, -12132, 33689}, + {22278, 148065, 151202, -12132, 35323}, + {22278, 147966, 151117, -12132, 33234}, + {22279, 144063, 150238, -12132, 29654}, + {22279, 144300, 149118, -12135, 5520}, + {22279, 144397, 149337, -12132, 644}, + {22279, 144426, 150639, -12132, 50655}, + {22282, 145841, 151097, -12132, 31810}, + {22282, 144387, 149958, -12132, 61173}, + {22282, 145821, 149498, -12132, 31490}, + {22282, 146619, 149694, -12132, 33374}, + {22282, 146669, 149244, -12132, 31360}, + {22284, 144147, 151375, -12132, 58395}, + {22284, 144485, 151067, -12132, 64786}, + {22284, 144356, 149571, -12132, 63516}, + {22285, 144151, 150962, -12132, 664}, + {22285, 146657, 151365, -12132, 33154}, + {22285, 146623, 150857, -12132, 28034}, + {22285, 147046, 151089, -12132, 32941}, + {22285, 145704, 151255, -12132, 32523}, + {22285, 145359, 151101, -12132, 32767}, + {22285, 147785, 150817, -12132, 27423}, + {22285, 147727, 151375, -12132, 37117}, + {22285, 145428, 149494, -12132, 890}, + {22285, 145601, 149682, -12132, 32442}, + {22285, 147003, 149476, -12132, 31554}, + {22285, 147738, 149210, -12132, 20971}, + {22285, 147769, 149757, -12132, 34980} }; // Emerald Square private static int[][] EMERALD_SPAWNS = { - { - 22280, - 144437, - 143395, - -11969, - 34248 - }, - { - 22281, - 149241, - 143735, - -12230, - 24575 - }, - { - 22281, - 147917, - 146861, - -12289, - 60306 - }, - { - 22281, - 144406, - 147782, - -12133, - 14349 - }, - { - 22281, - 144960, - 146881, - -12039, - 23881 - }, - { - 22281, - 144985, - 147679, - -12135, - 27594 - }, - { - 22283, - 147784, - 143540, - -12222, - 2058 - }, - { - 22283, - 149091, - 143491, - -12230, - 24836 - }, - { - 22287, - 144479, - 147569, - -12133, - 20723 - }, - { - 22287, - 145158, - 146986, - -12058, - 21970 - }, - { - 22287, - 145142, - 147175, - -12092, - 24420 - }, - { - 22287, - 145110, - 147133, - -12088, - 22465 - }, - { - 22287, - 144664, - 146604, - -12028, - 14861 - }, - { - 22287, - 144596, - 146600, - -12028, - 14461 - }, - { - 22288, - 143925, - 146773, - -12037, - 10813 - }, - { - 22288, - 144415, - 147070, - -12069, - 8568 - }, - { - 22288, - 143794, - 145584, - -12027, - 14849 - }, - { - 22288, - 143429, - 146166, - -12030, - 4078 - }, - { - 22288, - 144477, - 147009, - -12056, - 8752 - }, - { - 22289, - 142577, - 145319, - -12029, - 5403 - }, - { - 22289, - 143831, - 146902, - -12051, - 9717 - }, - { - 22289, - 143714, - 146705, - -12028, - 10044 - }, - { - 22289, - 143937, - 147134, - -12078, - 7517 - }, - { - 22293, - 143356, - 145287, - -12027, - 8126 - }, - { - 22293, - 143462, - 144352, - -12008, - 25905 - }, - { - 22293, - 143745, - 142529, - -11882, - 17102 - }, - { - 22293, - 144574, - 144032, - -12005, - 34668 - }, - { - 22295, - 143992, - 142419, - -11884, - 19697 - }, - { - 22295, - 144671, - 143966, - -12004, - 32088 - }, - { - 22295, - 144440, - 143269, - -11957, - 34169 - }, - { - 22295, - 142642, - 146362, - -12028, - 281 - }, - { - 22295, - 143865, - 142707, - -11881, - 21326 - }, - { - 22295, - 143573, - 142530, - -11879, - 16141 - }, - { - 22295, - 143148, - 146039, - -12031, - 65014 - }, - { - 22295, - 143001, - 144853, - -12014, - 0 - }, - { - 22296, - 147505, - 146580, - -12260, - 59041 - }, - { - 22296, - 149366, - 146932, - -12358, - 39407 - }, - { - 22296, - 149284, - 147029, - -12352, - 41120 - }, - { - 22296, - 149439, - 143940, - -12230, - 23189 - }, - { - 22296, - 147698, - 143995, - -12220, - 27028 - }, - { - 22296, - 141885, - 144969, - -12007, - 2526 - }, - { - 22296, - 147843, - 143763, - -12220, - 28386 - }, - { - 22296, - 144753, - 143650, - -11982, - 35429 - }, - { - 22296, - 147613, - 146760, - -12271, - 56296 - } + {22280, 144437, 143395, -11969, 34248}, + {22281, 149241, 143735, -12230, 24575}, + {22281, 147917, 146861, -12289, 60306}, + {22281, 144406, 147782, -12133, 14349}, + {22281, 144960, 146881, -12039, 23881}, + {22281, 144985, 147679, -12135, 27594}, + {22283, 147784, 143540, -12222, 2058}, + {22283, 149091, 143491, -12230, 24836}, + {22287, 144479, 147569, -12133, 20723}, + {22287, 145158, 146986, -12058, 21970}, + {22287, 145142, 147175, -12092, 24420}, + {22287, 145110, 147133, -12088, 22465}, + {22287, 144664, 146604, -12028, 14861}, + {22287, 144596, 146600, -12028, 14461}, + {22288, 143925, 146773, -12037, 10813}, + {22288, 144415, 147070, -12069, 8568}, + {22288, 143794, 145584, -12027, 14849}, + {22288, 143429, 146166, -12030, 4078}, + {22288, 144477, 147009, -12056, 8752}, + {22289, 142577, 145319, -12029, 5403}, + {22289, 143831, 146902, -12051, 9717}, + {22289, 143714, 146705, -12028, 10044}, + {22289, 143937, 147134, -12078, 7517}, + {22293, 143356, 145287, -12027, 8126}, + {22293, 143462, 144352, -12008, 25905}, + {22293, 143745, 142529, -11882, 17102}, + {22293, 144574, 144032, -12005, 34668}, + {22295, 143992, 142419, -11884, 19697}, + {22295, 144671, 143966, -12004, 32088}, + {22295, 144440, 143269, -11957, 34169}, + {22295, 142642, 146362, -12028, 281}, + {22295, 143865, 142707, -11881, 21326}, + {22295, 143573, 142530, -11879, 16141}, + {22295, 143148, 146039, -12031, 65014}, + {22295, 143001, 144853, -12014, 0}, + {22296, 147505, 146580, -12260, 59041}, + {22296, 149366, 146932, -12358, 39407}, + {22296, 149284, 147029, -12352, 41120}, + {22296, 149439, 143940, -12230, 23189}, + {22296, 147698, 143995, -12220, 27028}, + {22296, 141885, 144969, -12007, 2526}, + {22296, 147843, 143763, -12220, 28386}, + {22296, 144753, 143650, -11982, 35429}, + {22296, 147613, 146760, -12271, 56296} }; private static int[][] ROOM1_SPAWNS = { - { - 22288, - 143114, - 140027, - -11888, - 15025 - }, - { - 22288, - 142173, - 140973, - -11888, - 55698 - }, - { - 22289, - 143210, - 140577, - -11888, - 17164 - }, - { - 22289, - 142638, - 140107, - -11888, - 6571 - }, - { - 22297, - 142547, - 140938, - -11888, - 48556 - }, - { - 22298, - 142690, - 140479, - -11887, - 7663 - } + {22288, 143114, 140027, -11888, 15025}, + {22288, 142173, 140973, -11888, 55698}, + {22289, 143210, 140577, -11888, 17164}, + {22289, 142638, 140107, -11888, 6571}, + {22297, 142547, 140938, -11888, 48556}, + {22298, 142690, 140479, -11887, 7663} }; private static int[][] ROOM2_SPAWNS = { - { - 22303, - 146276, - 141483, - -11880, - 34643 - }, - { - 22287, - 145707, - 142161, - -11880, - 28799 - }, - { - 22288, - 146857, - 142129, - -11880, - 33647 - }, - { - 22288, - 146869, - 142000, - -11880, - 31215 - }, - { - 22289, - 146897, - 140880, - -11880, - 19210 - } + {22303, 146276, 141483, -11880, 34643}, + {22287, 145707, 142161, -11880, 28799}, + {22288, 146857, 142129, -11880, 33647}, + {22288, 146869, 142000, -11880, 31215}, + {22289, 146897, 140880, -11880, 19210} }; private static int[][] ROOM3_SPAWNS = { - { - 22302, - 145123, - 143713, - -12808, - 65323 - }, - { - 22294, - 145188, - 143331, - -12808, - 496 - }, - { - 22294, - 145181, - 144104, - -12808, - 64415 - }, - { - 22293, - 144994, - 143431, - -12808, - 65431 - }, - { - 22293, - 144976, - 143915, - -12808, - 61461 - } + {22302, 145123, 143713, -12808, 65323}, + {22294, 145188, 143331, -12808, 496}, + {22294, 145181, 144104, -12808, 64415}, + {22293, 144994, 143431, -12808, 65431}, + {22293, 144976, 143915, -12808, 61461} }; private static int[][] ROOM4_SPAWNS = { - { - 22304, - 150563, - 142240, - -12108, - 16454 - }, - { - 22294, - 150769, - 142495, - -12108, - 16870 - }, - { - 22281, - 150783, - 141995, - -12108, - 20033 - }, - { - 22283, - 150273, - 141983, - -12108, - 16043 - }, - { - 22294, - 150276, - 142492, - -12108, - 13540 - } + {22304, 150563, 142240, -12108, 16454}, + {22294, 150769, 142495, -12108, 16870}, + {22281, 150783, 141995, -12108, 20033}, + {22283, 150273, 141983, -12108, 16043}, + {22294, 150276, 142492, -12108, 13540} }; // Steam Corridor private static int[][] STEAM1_SPAWNS = { - { - 22305, - 145260, - 152387, - -12165, - 32767 - }, - { - 22305, - 144967, - 152390, - -12165, - 30464 - }, - { - 22305, - 145610, - 152586, - -12165, - 17107 - }, - { - 22305, - 145620, - 152397, - -12165, - 8191 - }, - { - 22418, - 146081, - 152847, - -12165, - 31396 - }, - { - 22418, - 146795, - 152641, - -12165, - 33850 - } - // {22308, 145093, 152502, -12165, 31841},{22308, 146158, 152776, -12165, 30810}, - // {22308, 146116, 152976, -12133, 32571}, + {22305, 145260, 152387, -12165, 32767}, + {22305, 144967, 152390, -12165, 30464}, + {22305, 145610, 152586, -12165, 17107}, + {22305, 145620, 152397, -12165, 8191}, + {22418, 146081, 152847, -12165, 31396}, + {22418, 146795, 152641, -12165, 33850}, + // {22308, 145093, 152502, -12165, 31841}, + // {22308, 146158, 152776, -12165, 30810}, + // {22308, 146116, 152976, -12133, 32571} }; private static int[][] STEAM2_SPAWNS = { - { - 22306, - 147740, - 152767, - -12165, - 65043 - }, - { - 22306, - 148215, - 152828, - -12165, - 970 - }, - { - 22306, - 147743, - 152846, - -12165, - 64147 - },// {22308, 147849, 152854, -12165, 60534}, - // {22308, 147754, 152908, -12141, 59827},{22308, 148194, 152681, -12165, 63620}, - // {22308, 147767, 152939, -12133, 63381},{22309, 147737, 152671, -12165, 65320}, - { - 22418, - 148207, - 152725, - -12165, - 61801 - }, - { - 22419, - 149058, - 152828, - -12165, - 64564 - } + {22306, 147740, 152767, -12165, 65043}, + {22306, 148215, 152828, -12165, 970}, + {22306, 147743, 152846, -12165, 64147}, + // {22308, 147849, 152854, -12165, 60534}, + // {22308, 147754, 152908, -12141, 59827}, + // {22308, 148194, 152681, -12165, 63620}, + // {22308, 147767, 152939, -12133, 63381}, + // {22309, 147737, 152671, -12165, 65320}, + {22418, 148207, 152725, -12165, 61801}, + {22419, 149058, 152828, -12165, 64564} }; private static int[][] STEAM3_SPAWNS = { - { - 22307, - 150735, - 152316, - -12145, - 31930 - }, - { - 22307, - 150725, - 152467, - -12165, - 33635 - }, - { - 22307, - 151058, - 152316, - -12146, - 65342 - }, - { - 22307, - 151057, - 152461, - -12165, - 2171 - } - /* - * {22308, 150794, 152455, -12165, 31613},{22308, 150665, 152383, -12165, 32767}, {22308, 151697, 152621, -12167, 31423},{22309, 151061, 152581, -12165, 6228}, {22309, 150653, 152253, -12132, 31343},{22309, 150628, 152431, -12165, 33022}, {22309, 151620, 152487, -12165, 30114},{22309, 151672, - * 152544, -12165, 31846}, {22309, 150488, 152350, -12165, 29072},{22310, 151139, 152238, -12132, 1069} - */ + {22307, 150735, 152316, -12145, 31930}, + {22307, 150725, 152467, -12165, 33635}, + {22307, 151058, 152316, -12146, 65342}, + {22307, 151057, 152461, -12165, 2171}, + // {22308, 150794, 152455, -12165, 31613}, + // {22308, 150665, 152383, -12165, 32767}, + // {22308, 151697, 152621, -12167, 31423}, + // {22309, 151061, 152581, -12165, 6228}, + // {22309, 150653, 152253, -12132, 31343}, + // {22309, 150628, 152431, -12165, 33022}, + // {22309, 151620, 152487, -12165, 30114}, + // {22309, 151672, 152544, -12165, 31846}, + // {22309, 150488, 152350, -12165, 29072}, + // {22310, 151139, 152238, -12132, 1069} }; private static int[][] STEAM4_SPAWNS = - {// {22308, 151707, 150199, -12165, 32859},{22308, 152091, 150140, -12165, 32938}, - // {22308, 149757, 150204, -12138, 65331},{22308, 149950, 150307, -12132, 62437}, - // {22308, 149901, 150322, -12132, 62136},{22309, 150071, 150173, -12165, 64943}, - { - 22416, - 151636, - 150280, - -12142, - 36869 - }, - { - 22416, - 149893, - 150232, - -12165, - 64258 - }, - { - 22416, - 149864, - 150110, - -12165, - 65054 - }, - { - 22416, - 151926, - 150218, - -12165, - 31613 - }, - { - 22420, - 149986, - 150051, - -12165, - 105 - }, - { - 22420, - 151970, - 149997, - -12165, - 32170 - }, - { - 22420, - 150744, - 150006, - -12165, - 63 - } - // ,{22417, 149782, 150188, -12151, 64001} + { + // {22308, 151707, 150199, -12165, 32859}, + // {22308, 152091, 150140, -12165, 32938}, + // {22308, 149757, 150204, -12138, 65331}, + // {22308, 149950, 150307, -12132, 62437}, + // {22308, 149901, 150322, -12132, 62136}, + // {22309, 150071, 150173, -12165, 64943}, + {22416, 151636, 150280, -12142, 36869}, + {22416, 149893, 150232, -12165, 64258}, + {22416, 149864, 150110, -12165, 65054}, + {22416, 151926, 150218, -12165, 31613}, + {22420, 149986, 150051, -12165, 105}, + {22420, 151970, 149997, -12165, 32170}, + {22420, 150744, 150006, -12165, 63}, + // {22417, 149782, 150188, -12151, 64001} }; - - // Instance reenter time - // default: 86400000ms(24h) - private static final int INSTANCEPENALTY = 86400000; + // @formatter:on private static final int DRAGONSCALETIME = 3000; private static final int DRAGONCLAWTIME = 3000; - private CrystalCaverns() + public CrystalCaverns() { - super(-1, CrystalCaverns.class.getSimpleName(), "instances"); - addStartNpc(ORACLE_GUIDE_1); - addTalkId(ORACLE_GUIDE_1); - addTalkId(ORACLE_GUIDE_3); - addStartNpc(ORACLE_GUIDE_4); - addFirstTalkId(ORACLE_GUIDE_4); - addTalkId(ORACLE_GUIDE_4); - addFirstTalkId(CRYSTAL_GOLEM); - addAttackId(TEARS); + super(CrystalCaverns.class.getSimpleName()); + addStartNpc(ORACLE_GUIDE_1, ORACLE_GUIDE_4); + addTalkId(ORACLE_GUIDE_1, ORACLE_GUIDE_3, ORACLE_GUIDE_4, 32275, 32276, 32277); + addFirstTalkId(ORACLE_GUIDE_1, ORACLE_GUIDE_2, ORACLE_GUIDE_4, CRYSTAL_GOLEM, 32274, 32275, 32276, 32277); + addKillId(TEARS, GK1, GK2, TEROD, WEYLIN, DOLPH, DARNEL, KECHI, GUARDIAN, GUARDIAN2, TOURMALINE, BAYLOR, ALARMID); + addSkillSeeId(BAYLOR, 25534, 32275, 32276, 32277); addTrapActionId(DOOR_OPENING_TRAP[0]); - addKillId(TEARS); - addKillId(GK1); - addKillId(GK2); - addKillId(TEROD); - addKillId(WEYLIN); - addKillId(DOLPH); - addKillId(DARNEL); - addKillId(KECHI); - addKillId(GUARDIAN); - addKillId(GUARDIAN2); - addKillId(TOURMALINE); - addKillId(BAYLOR); addSpellFinishedId(BAYLOR); - addKillId(ALARMID); - addFirstTalkId(32274, 32275, 32276, 32277, ORACLE_GUIDE_1, ORACLE_GUIDE_2); - addTalkId(32275, 32276, 32277); - addSkillSeeId(25534, 32275, 32276, 32277, BAYLOR); + addAttackId(TEARS); addKillId(MOBLIST); addKillId(CGMOBS); for (int zones : ZONES) @@ -1477,13 +512,18 @@ public final class CrystalCaverns extends Quest } } - private boolean checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { - if (debug) + if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { - return true; + if (debug) + { + return true; + } } - L2Party party = player.getParty(); + + final L2Party party = player.getParty(); if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); @@ -1498,7 +538,7 @@ public final class CrystalCaverns extends Quest { if (partyMember.getLevel() < 78) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -1513,7 +553,7 @@ public final class CrystalCaverns extends Quest } if (!Util.checkIfInRange(1000, player, partyMember, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -1521,7 +561,7 @@ public final class CrystalCaverns extends Quest Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID); if (System.currentTimeMillis() < reentertime) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -1559,7 +599,7 @@ public final class CrystalCaverns extends Quest } if (!Util.checkIfInRange(1000, player, partyMember, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -1595,7 +635,7 @@ public final class CrystalCaverns extends Quest } if (!Util.checkIfInRange(1000, player, partyMember, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); party.broadcastPacket(sm); return false; @@ -1652,55 +692,33 @@ public final class CrystalCaverns extends Quest effected.broadcastPacket(new ValidateLocation(effected)); } - protected int enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof CCWorld)) + if (player.getParty() == null) { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; + // this can happen only if debug is true + player.sendMessage("Welcome to Crystal Caverns."); + teleportPlayer(player, START_LOC, world.getInstanceId()); + world.addAllowed(player.getObjectId()); } - teleportPlayer(player, loc, world.getInstanceId()); - return world.getInstanceId(); - } - - // New instance - if (!checkConditions(player)) - { - return 0; - } - L2Party party = player.getParty(); - int instanceId = InstanceManager.getInstance().createDynamicInstance(template); - world = new CCWorld(System.currentTimeMillis() + 5400000); - world.setInstanceId(instanceId); - world.setTemplateId(TEMPLATE_ID); - InstanceManager.getInstance().addWorld(world); - _log.info("Crystal Caverns started " + template + " Instance: " + instanceId + " created by player: " + player.getName()); - runOracle((CCWorld) world); - // teleport players - if (player.getParty() == null) - { - // this can happen only if debug is true - player.sendMessage("Welcome to Crystal Caverns."); - InstanceManager.getInstance().setInstanceTime(player.getObjectId(), TEMPLATE_ID, ((System.currentTimeMillis() + INSTANCEPENALTY))); - teleportPlayer(player, loc, world.getInstanceId()); - world.isAllowed(player.getObjectId()); + else + { + for (L2PcInstance partyMember : player.getParty().getMembers()) + { + partyMember.sendMessage("Welcome to Crystal Caverns."); + teleportPlayer(partyMember, START_LOC, world.getInstanceId()); + world.addAllowed(partyMember.getObjectId()); + } + } + runOracle((CCWorld) world); } else { - for (L2PcInstance partyMember : party.getMembers()) - { - partyMember.sendMessage("Welcome to Crystal Caverns."); - InstanceManager.getInstance().setInstanceTime(partyMember.getObjectId(), TEMPLATE_ID, ((System.currentTimeMillis() + INSTANCEPENALTY))); - teleportPlayer(partyMember, loc, world.getInstanceId()); - world.addAllowed(partyMember.getObjectId()); - } + teleportPlayer(player, START_LOC, world.getInstanceId()); } - return instanceId; } protected void stopAttack(L2PcInstance player) @@ -1749,7 +767,7 @@ public final class CrystalCaverns extends Quest { world.setStatus(2); - for (int[] spawn : SPAWNS) + for (int[] spawn : HALL_SPAWNS) { L2Npc mob = addSpawn(CGMOBS[getRandom(CGMOBS.length)], spawn[0], spawn[1], spawn[2], spawn[3], false, 0, false, world.getInstanceId()); world.npcList1.put(mob, false); @@ -2744,7 +1762,7 @@ public final class CrystalCaverns extends Quest } if (npcId == ORACLE_GUIDE_1) { - enterInstance(player, "CrystalCaverns.xml", new Location(143348, 148707, -11972)); + enterInstance(player, new CCWorld(System.currentTimeMillis() + 5400000), "CrystalCaverns.xml", TEMPLATE_ID); return ""; } @@ -3051,10 +2069,4 @@ public final class CrystalCaverns extends Quest } return super.onExitZone(character, zone); } - - public static void main(String[] args) - { - // now call the constructor (starts up the) - new CrystalCaverns(); - } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java b/L2J_DataPack/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java index 81d3b1774a5c353098aac74f1c0b8ed89da81835..fc888ee25f24914f6f2a2f8ff43e66307bcbac2a 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java @@ -18,17 +18,18 @@ */ package instances.DarkCloudMansion; +import instances.AbstractInstance; import javolution.util.FastList; import javolution.util.FastMap; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2Party; import com.l2jserver.gameserver.model.Location; +import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; @@ -40,15 +41,12 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage; /** * Dark Cloud Mansion instance zone. */ -public final class DarkCloudMansion extends Quest +public final class DarkCloudMansion extends AbstractInstance { - private static final int TEMPLATE_ID = 9; - - private static boolean debug = false; - private static boolean noRndWalk = true; - - // Items - private static int CC = 9690; // Contaminated Crystal + protected class DMCWorld extends InstanceWorld + { + protected FastMap<String, DMCRoom> rooms = new FastMap<>(); + } // NPCs private static int YIYEN = 32282; @@ -58,7 +56,6 @@ public final class DarkCloudMansion extends Quest private static int SOTruth = 32291; // Symbol of Truth private static int BSM = 32324; // Black Stone Monolith private static int SC = 22402; // Shadow Column - // Mobs private static int[] CCG = { @@ -106,7 +103,10 @@ public final class DarkCloudMansion extends Quest 22264 }; - // Doors/Walls + // Items + private static int CC = 9690; // Contaminated Crystal + // Misc + private static final int TEMPLATE_ID = 9; private static int D1 = 24230001; // Starting Room private static int D2 = 24230002; // First Room private static int D3 = 24230005; // Second Room @@ -120,7 +120,8 @@ public final class DarkCloudMansion extends Quest // private static int W5 = 24230011; // Wall 5 // private static int W6 = 24230012; // Wall 6 // private static int W7 = 24230013; // Wall 7 - + private static boolean debug = false; + private static boolean noRndWalk = true; private static NpcStringId[] _spawnChat = { NpcStringId.IM_THE_REAL_ONE, @@ -129,14 +130,12 @@ public final class DarkCloudMansion extends Quest NpcStringId.NOT_THAT_DUDE_IM_THE_REAL_ONE, NpcStringId.DONT_BE_FOOLED_DONT_BE_FOOLED_IM_THE_REAL_ONE }; - private static NpcStringId[] _decayChat = { NpcStringId.IM_THE_REAL_ONE_PHEW, NpcStringId.CANT_YOU_EVEN_FIND_OUT, NpcStringId.FIND_ME }; - private static NpcStringId[] _successChat = { NpcStringId.HUH_HOW_DID_YOU_KNOW_IT_WAS_ME, @@ -144,312 +143,74 @@ public final class DarkCloudMansion extends Quest NpcStringId.YOUVE_DONE_WELL, NpcStringId.OH_VERY_SENSIBLE }; - private static NpcStringId[] _faildChat = { NpcStringId.YOUVE_BEEN_FOOLED, NpcStringId.SORRY_BUT_IM_THE_FAKE_ONE }; - + // @formatter:off // Second room - random monolith order private static int[][] MonolithOrder = new int[][] { - { - 1, - 2, - 3, - 4, - 5, - 6 - }, - { - 6, - 5, - 4, - 3, - 2, - 1 - }, - { - 4, - 5, - 6, - 3, - 2, - 1 - }, - { - 2, - 6, - 3, - 5, - 1, - 4 - }, - { - 4, - 1, - 5, - 6, - 2, - 3 - }, - { - 3, - 5, - 1, - 6, - 2, - 4 - }, - { - 6, - 1, - 3, - 4, - 5, - 2 - }, - { - 5, - 6, - 1, - 2, - 4, - 3 - }, - { - 5, - 2, - 6, - 3, - 4, - 1 - }, - { - 1, - 5, - 2, - 6, - 3, - 4 - }, - { - 1, - 2, - 3, - 6, - 5, - 4 - }, - { - 6, - 4, - 3, - 1, - 5, - 2 - }, - { - 3, - 5, - 2, - 4, - 1, - 6 - }, - { - 3, - 2, - 4, - 5, - 1, - 6 - }, - { - 5, - 4, - 3, - 1, - 6, - 2 - }, + {1, 2, 3, 4, 5, 6}, + {6, 5, 4, 3, 2, 1}, + {4 ,5, 6, 3, 2, 1}, + {2, 6, 3, 5, 1, 4}, + {4, 1, 5, 6, 2, 3}, + {3, 5, 1, 6, 2, 4}, + {6, 1, 3, 4, 5, 2}, + {5, 6, 1, 2, 4, 3}, + {5, 2, 6, 3, 4, 1}, + {1, 5, 2, 6, 3, 4}, + {1, 2, 3, 6, 5, 4}, + {6, 4, 3, 1, 5, 2}, + {3, 5, 2, 4, 1, 6}, + {3, 2, 4, 5, 1, 6}, + {5, 4, 3, 1, 6, 2}, }; - // Second room - golem spawn locatons - random private static int[][] GolemSpawn = new int[][] { - { - CCG[0], - 148060, - 181389 - }, - { - CCG[1], - 147910, - 181173 - }, - { - CCG[0], - 147810, - 181334 - }, - { - CCG[1], - 147713, - 181179 - }, - { - CCG[0], - 147569, - 181410 - }, - { - CCG[1], - 147810, - 181517 - }, - { - CCG[0], - 147805, - 181281 - } + {CCG[0], 148060, 181389}, + {CCG[1], 147910, 181173}, + {CCG[0], 147810, 181334}, + {CCG[1], 147713, 181179}, + {CCG[0], 147569, 181410}, + {CCG[1], 147810, 181517}, + {CCG[0], 147805, 181281}, }; // forth room - random shadow column private static int[][] ColumnRows = new int[][] { - { - 1, - 1, - 0, - 1, - 0 - }, - { - 0, - 1, - 1, - 0, - 1 - }, - { - 1, - 0, - 1, - 1, - 0 - }, - { - 0, - 1, - 0, - 1, - 1 - }, - { - 1, - 0, - 1, - 0, - 1 - } + {1, 1, 0, 1, 0}, + {0, 1, 1, 0, 1}, + {1, 0, 1, 1, 0}, + {0, 1, 0, 1, 1}, + {1, 0, 1, 0, 1}, }; // Fifth room - beleth order private static int[][] Beleths = new int[][] { - { - 1, - 0, - 1, - 0, - 1, - 0, - 0 - }, - { - 0, - 0, - 1, - 0, - 1, - 1, - 0 - }, - { - 0, - 0, - 0, - 1, - 0, - 1, - 1 - }, - { - 1, - 0, - 1, - 1, - 0, - 0, - 0 - }, - { - 1, - 1, - 0, - 0, - 0, - 1, - 0 - }, - { - 0, - 1, - 0, - 1, - 0, - 1, - 0 - }, - { - 0, - 0, - 0, - 1, - 1, - 1, - 0 - }, - { - 1, - 0, - 1, - 0, - 0, - 1, - 0 - }, - { - 0, - 1, - 1, - 0, - 0, - 0, - 1 - } + {1, 0, 1, 0, 1, 0, 0}, + {0, 0, 1, 0, 1, 1, 0}, + {0, 0, 0, 1, 0, 1, 1}, + {1, 0, 1, 1, 0, 0, 0}, + {1, 1, 0, 0, 0, 1, 0}, + {0, 1, 0, 1, 0, 1, 0}, + {0, 0, 0, 1, 1, 1, 0}, + {1, 0, 1, 0, 0, 1, 0}, + {0, 1, 1, 0, 0, 0, 1}, }; + // @formatter:on - private DarkCloudMansion() + public DarkCloudMansion() { - super(-1, DarkCloudMansion.class.getSimpleName(), "instances"); - addFirstTalkId(BSM); - addFirstTalkId(SOTruth); + super(DarkCloudMansion.class.getSimpleName()); + addFirstTalkId(BSM, SOTruth); addStartNpc(YIYEN); - addTalkId(YIYEN); - addTalkId(SOTruth); + addTalkId(YIYEN, SOTruth); addAttackId(SC); addAttackId(BS); addAttackId(CCG); @@ -475,19 +236,15 @@ public final class DarkCloudMansion extends Quest public int[] Order; } - protected class DMCWorld extends InstanceWorld - { - public FastMap<String, DMCRoom> rooms = new FastMap<>(); - } - - private boolean checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { - if (debug) + if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } - L2Party party = player.getParty(); + final L2Party party = player.getParty(); if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); @@ -507,14 +264,14 @@ public final class DarkCloudMansion extends Quest { if (partyMember.getLevel() < 78) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return false; } if (!partyMember.isInsideRadius(player, 1000, true, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); player.sendPacket(sm); return false; @@ -524,46 +281,34 @@ public final class DarkCloudMansion extends Quest return true; } - protected void enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) + if (firstEntrance) { - if (!(world instanceof DMCWorld)) + runStartRoom((DMCWorld) world); + // teleport players + if (debug && (player.getParty() == null)) { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; + world.addAllowed(player.getObjectId()); + teleportPlayer(player, new Location(146534, 180464, -6117), world.getInstanceId()); + } + else + { + for (L2PcInstance partyMember : player.getParty().getMembers()) + { + if (partyMember.getQuestState(getName()) == null) + { + newQuestState(partyMember); + } + world.addAllowed(partyMember.getObjectId()); + teleportPlayer(partyMember, new Location(146534, 180464, -6117), world.getInstanceId()); + } } - teleportPlayer(player, loc, world.getInstanceId()); - return; - } - - if (!checkConditions(player)) - { - return; - } - L2Party party = player.getParty(); - final int instanceId = InstanceManager.getInstance().createDynamicInstance(template); - world = new DMCWorld(); - world.setInstanceId(instanceId); - world.setTemplateId(TEMPLATE_ID); - InstanceManager.getInstance().addWorld(world); - _log.info("DarkCloudMansion: started " + template + " Instance: " + instanceId + " created by player: " + player.getName()); - runStartRoom((DMCWorld) world); - // teleport players - if (debug && (party == null)) - { - world.addAllowed(player.getObjectId()); - teleportPlayer(player, loc, instanceId); } else { - for (L2PcInstance partyMember : party.getMembers()) - { - getQuestState(partyMember, true); - world.addAllowed(partyMember.getObjectId()); - teleportPlayer(partyMember, loc, instanceId); - } + teleportPlayer(player, new Location(146534, 180464, -6117), world.getInstanceId()); } } @@ -1200,8 +945,8 @@ public final class DarkCloudMansion extends Quest return ""; } - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - DMCWorld world; + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final DMCWorld world; if (tmpworld instanceof DMCWorld) { world = (DMCWorld) tmpworld; @@ -1262,8 +1007,8 @@ public final class DarkCloudMansion extends Quest @Override public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - DMCWorld world; + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final DMCWorld world; if (tmpworld instanceof DMCWorld) { world = (DMCWorld) tmpworld; @@ -1336,15 +1081,14 @@ public final class DarkCloudMansion extends Quest killedBelethSample(world, npc); } } - return ""; } @Override public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon, Skill skill) { - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); - DMCWorld world; + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final DMCWorld world; if (tmpworld instanceof DMCWorld) { world = (DMCWorld) tmpworld; @@ -1418,10 +1162,10 @@ public final class DarkCloudMansion extends Quest @Override public String onTalk(L2Npc npc, L2PcInstance player) { - int npcId = npc.getId(); + final int npcId = npc.getId(); if (npcId == YIYEN) { - enterInstance(player, "DarkCloudMansion.xml", new Location(146534, 180464, -6117)); + enterInstance(player, new DMCWorld(), "DarkCloudMansion.xml", TEMPLATE_ID); } else { @@ -1458,9 +1202,4 @@ public final class DarkCloudMansion extends Quest } return ""; } - - public static void main(String[] args) - { - new DarkCloudMansion(); - } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java b/L2J_DataPack/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java index 7c19ef94175ef9690ed927b20428ea76f3040cb2..adbf8c92455a3c8f4bf5018fcc551da3fe1e0a68 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java @@ -18,6 +18,8 @@ */ package instances.DisciplesNecropolisPast; +import instances.AbstractInstance; + import java.util.HashMap; import java.util.Map; @@ -26,12 +28,10 @@ import quests.Q00196_SevenSignsSealOfTheEmperor.Q00196_SevenSignsSealOfTheEmpero import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; -import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; @@ -43,18 +43,15 @@ import com.l2jserver.gameserver.util.Util; * Disciple's Necropolis Past instance zone. * @author Adry_85 */ -public final class DisciplesNecropolisPast extends Quest +public final class DisciplesNecropolisPast extends AbstractInstance { protected class DNPWorld extends InstanceWorld { protected final FastList<L2Npc> anakimGroup = new FastList<>(); protected final FastList<L2Npc> lilithGroup = new FastList<>(); - protected long storeTime = 0; protected int countKill = 0; } - // Instance - private static final int TEMPLATE_ID = 112; // NPCs private static final int SEAL_DEVICE = 27384; private static final int PROMISE_OF_MAMMON = 32585; @@ -68,20 +65,6 @@ public final class DisciplesNecropolisPast extends Quest private static final int ANAKIMS_GUARDIAN = 32719; private static final int ANAKIMS_GUARD = 32720; private static final int ANAKIMS_EXECUTOR = 32721; - // Doors - private static final int DOOR_1 = 17240102; - private static final int DOOR_2 = 17240104; - private static final int DOOR_3 = 17240106; - private static final int DOOR_4 = 17240108; - private static final int DOOR_5 = 17240110; - private static final int DISCIPLES_NECROPOLIS_DOOR = 17240111; - // Items - private static final int SACRED_SWORD_OF_EINHASAD = 15310; - private static final int SEAL_OF_BINDING = 13846; - // Locations - private static final Location ENTER = new Location(-89554, 216078, -7488, 0, 0); - private static final Location EXIT = new Location(171895, -17501, -4903, 0, 0); - // Monsters private static final int LILIM_BUTCHER = 27371; private static final int LILIM_MAGUS = 27372; private static final int LILIM_KNIGHT_ERRANT = 27373; @@ -91,15 +74,40 @@ public final class DisciplesNecropolisPast extends Quest private static final int LILIM_SLAYER = 27377; private static final int LILIM_GREAT_MAGUS = 27378; private static final int LILIM_GUARD_KNIGHT = 27379; + // Items + private static final int SACRED_SWORD_OF_EINHASAD = 15310; + private static final int SEAL_OF_BINDING = 13846; + // Skills + private static final SkillHolder SEAL_ISOLATION = new SkillHolder(5980, 3); + private static final Map<Integer, SkillHolder> SKILLS = new HashMap<>(); + static + { + SKILLS.put(32715, new SkillHolder(6187, 1)); // Presentation - Lilith Battle + SKILLS.put(32716, new SkillHolder(6188, 1)); // Presentation - Lilith's Steward Battle1 + SKILLS.put(32717, new SkillHolder(6190, 1)); // Presentation - Lilith's Bodyguards Battle1 + SKILLS.put(32718, new SkillHolder(6191, 1)); // Presentation - Anakim Battle + SKILLS.put(32719, new SkillHolder(6192, 1)); // Presentation - Anakim's Guardian Battle1 + SKILLS.put(32720, new SkillHolder(6194, 1)); // Presentation - Anakim's Guard Battle + SKILLS.put(32721, new SkillHolder(6195, 1)); // Presentation - Anakim's Executor Battle + } + // Locations + private static final Location ENTER = new Location(-89554, 216078, -7488, 0, 0); + private static final Location EXIT = new Location(171895, -17501, -4903, 0, 0); // NpcStringId private static final NpcStringId[] LILITH_SHOUT = { NpcStringId.HOW_DARE_YOU_TRY_TO_CONTEND_AGAINST_ME_IN_STRENGTH_RIDICULOUS, NpcStringId.ANAKIM_IN_THE_NAME_OF_GREAT_SHILIEN_I_WILL_CUT_YOUR_THROAT, - NpcStringId.YOU_CANNOT_BE_THE_MATCH_OF_LILITH_ILL_TEACH_YOU_A_LESSON + NpcStringId.YOU_CANNOT_BE_THE_MATCH_OF_LILITH_I_LL_TEACH_YOU_A_LESSON }; - - // Bosses Spawn + // Misc + private static final int TEMPLATE_ID = 112; + private static final int DOOR_1 = 17240102; + private static final int DOOR_2 = 17240104; + private static final int DOOR_3 = 17240106; + private static final int DOOR_4 = 17240108; + private static final int DOOR_5 = 17240110; + private static final int DISCIPLES_NECROPOLIS_DOOR = 17240111; private static final Map<Integer, Location> LILITH_SPAWN = new HashMap<>(); private static final Map<Integer, Location> ANAKIM_SPAWN = new HashMap<>(); static @@ -113,23 +121,9 @@ public final class DisciplesNecropolisPast extends Quest ANAKIM_SPAWN.put(ANAKIMS_EXECUTOR, new Location(-83031, 216604, -7492, 17071)); } - // Skills - private static final SkillHolder SEAL_ISOLATION = new SkillHolder(5980, 3); - private static final Map<Integer, SkillHolder> SKILLS = new HashMap<>(); - static - { - SKILLS.put(32715, new SkillHolder(6187, 1)); // Presentation - Lilith Battle - SKILLS.put(32716, new SkillHolder(6188, 1)); // Presentation - Lilith's Steward Battle1 - SKILLS.put(32717, new SkillHolder(6190, 1)); // Presentation - Lilith's Bodyguards Battle1 - SKILLS.put(32718, new SkillHolder(6191, 1)); // Presentation - Anakim Battle - SKILLS.put(32719, new SkillHolder(6192, 1)); // Presentation - Anakim's Guardian Battle1 - SKILLS.put(32720, new SkillHolder(6194, 1)); // Presentation - Anakim's Guard Battle - SKILLS.put(32721, new SkillHolder(6195, 1)); // Presentation - Anakim's Executor Battle - } - - private DisciplesNecropolisPast() + public DisciplesNecropolisPast() { - super(-1, DisciplesNecropolisPast.class.getSimpleName(), "instances"); + super(DisciplesNecropolisPast.class.getSimpleName()); addAttackId(SEAL_DEVICE); addFirstTalkId(SHUNAIMAN, LEON, DISCIPLES_GATEKEEPER); addKillId(LILIM_BUTCHER, LILIM_MAGUS, LILIM_KNIGHT_ERRANT, LILIM_KNIGHT, SHILENS_EVIL_THOUGHTS1, SHILENS_EVIL_THOUGHTS2, LILIM_SLAYER, LILIM_GREAT_MAGUS, LILIM_GUARD_KNIGHT); @@ -143,69 +137,47 @@ public final class DisciplesNecropolisPast extends Quest { for (Map.Entry<Integer, Location> entry : LILITH_SPAWN.entrySet()) { - L2Npc npc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId()); + final L2Npc npc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId()); world.lilithGroup.add(npc); } for (Map.Entry<Integer, Location> entry : ANAKIM_SPAWN.entrySet()) { - L2Npc enpc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId()); + final L2Npc enpc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId()); world.anakimGroup.add(enpc); } } private synchronized void checkDoors(L2Npc npc, DNPWorld world) { - if (world.countKill == 4) + switch (world.countKill) { - openDoor(DOOR_1, world.getInstanceId()); - } - else if (world.countKill == 10) - { - openDoor(DOOR_2, world.getInstanceId()); - } - else if (world.countKill == 18) - { - openDoor(DOOR_3, world.getInstanceId()); - } - else if (world.countKill == 28) - { - openDoor(DOOR_4, world.getInstanceId()); - } - else if (world.countKill == 40) - { - openDoor(DOOR_5, world.getInstanceId()); + case 4: + openDoor(DOOR_1, world.getInstanceId()); + break; + case 10: + openDoor(DOOR_2, world.getInstanceId()); + break; + case 18: + openDoor(DOOR_3, world.getInstanceId()); + break; + case 28: + openDoor(DOOR_4, world.getInstanceId()); + break; + case 40: + openDoor(DOOR_5, world.getInstanceId()); + break; } } - protected int enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof DNPWorld)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; - } - teleportPlayer(player, loc, world.getInstanceId()); - removeBuffs(player); - return world.getInstanceId(); + spawnNPC((DNPWorld) world); + world.addAllowed(player.getObjectId()); } - // New instance - world = new DNPWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - ((DNPWorld) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Disciple's Necropolis Past started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // teleport players - teleportPlayer(player, loc, world.getInstanceId()); - spawnNPC((DNPWorld) world); - world.addAllowed(player.getObjectId()); - return world.getInstanceId(); + teleportPlayer(player, ENTER, world.getInstanceId()); } private void makeCast(L2Npc npc, FastList<L2Npc> targets) @@ -220,10 +192,10 @@ public final class DisciplesNecropolisPast extends Quest @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); + final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); if (tmpworld instanceof DNPWorld) { - DNPWorld world = (DNPWorld) tmpworld; + final DNPWorld world = (DNPWorld) tmpworld; switch (event) { case "FINISH": @@ -397,31 +369,16 @@ public final class DisciplesNecropolisPast extends Quest @Override public String onFirstTalk(L2Npc npc, L2PcInstance player) { - switch (npc.getId()) - { - case SHUNAIMAN: - { - return "32586.htm"; - } - case LEON: - { - return "32587.htm"; - } - case DISCIPLES_GATEKEEPER: - { - return "32657.htm"; - } - } - return super.onFirstTalk(npc, player); + return npc.getId() + ".htm"; } @Override public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon) { - InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); + final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); if (tmpworld instanceof DNPWorld) { - DNPWorld world = (DNPWorld) tmpworld; + final DNPWorld world = (DNPWorld) tmpworld; world.countKill++; checkDoors(npc, world); } @@ -473,7 +430,7 @@ public final class DisciplesNecropolisPast extends Quest { if (qs.isCond(3) || qs.isCond(4)) { - enterInstance(talker, "DisciplesNecropolisPast.xml", ENTER); + enterInstance(talker, new DNPWorld(), "DisciplesNecropolisPast.xml", TEMPLATE_ID); return ""; } break; @@ -508,18 +465,4 @@ public final class DisciplesNecropolisPast extends Quest } return htmltext; } - - private static final void removeBuffs(L2Character ch) - { - ch.stopAllEffectsExceptThoseThatLastThroughDeath(); - if (ch.hasSummon()) - { - ch.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); - } - } - - public static void main(String[] args) - { - new DisciplesNecropolisPast(); - } } diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java b/L2J_DataPack/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java index 765daa6ed9f91e12349c760fa95f2c124ff6f1c8..ee003ebd7a449b59345b3c66785934603a4d5610 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java @@ -18,10 +18,10 @@ */ package instances.ElcadiasTent; +import instances.AbstractInstance; import quests.Q10292_SevenSignsGirlOfDoubt.Q10292_SevenSignsGirlOfDoubt; import quests.Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom; import quests.Q10294_SevenSignsToTheMonasteryOfSilence.Q10294_SevenSignsToTheMonasteryOfSilence; -import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; @@ -29,30 +29,30 @@ import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.model.quest.QuestState; -import com.l2jserver.gameserver.network.SystemMessageId; /** * Elcadia's Tent instance zone. * @author Adry_85 */ -public final class ElcadiasTent extends AbstractNpcAI +public final class ElcadiasTent extends AbstractInstance { protected class ETWorld extends InstanceWorld { } - private static final int TEMPLATE_ID = 158; // NPCs private static final int ELCADIA = 32784; private static final int GRUFF_LOOKING_MAN = 32862; // Locations private static final Location START_LOC = new Location(89706, -238074, -9632, 0, 0); private static final Location EXIT_LOC = new Location(43316, -87986, -2832, 0, 0); + // Misc + private static final int TEMPLATE_ID = 158; - private ElcadiasTent() + public ElcadiasTent() { - super(ElcadiasTent.class.getSimpleName(), "instances"); + super(ElcadiasTent.class.getSimpleName()); addFirstTalkId(GRUFF_LOOKING_MAN, ELCADIA); addStartNpc(GRUFF_LOOKING_MAN, ELCADIA); addTalkId(GRUFF_LOOKING_MAN, ELCADIA); @@ -71,7 +71,7 @@ public final class ElcadiasTent extends AbstractNpcAI || ((ForbiddenBook != null) && ForbiddenBook.isStarted()) // || ((ForbiddenBook != null) && ForbiddenBook.isCompleted() && (Monastery == null))) { - enterInstance(talker, "ElcadiasTent.xml", START_LOC); + enterInstance(talker, new ETWorld(), "ElcadiasTent.xml", TEMPLATE_ID); } else { @@ -88,37 +88,13 @@ public final class ElcadiasTent extends AbstractNpcAI return super.onTalk(npc, talker); } - private void enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) - { - if (!(world instanceof ETWorld)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - } - else - { - teleportPlayer(player, loc, world.getInstanceId(), false); - } - } - else + if (firstEntrance) { - // New instance. - world = new ETWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - _log.info("Elcadia's Tent started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // Teleport players. - teleportPlayer(player, loc, world.getInstanceId(), false); world.addAllowed(player.getObjectId()); } - } - - public static void main(String[] args) - { - new ElcadiasTent(); + teleportPlayer(player, START_LOC, world.getInstanceId(), false); } } diff --git a/L2J_DataPack/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java b/L2J_DataPack/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java index 629bb0f1e8b24db684035492c201ea8e77ecbd36..7c1777a4901bf01b69820abfb9ffbbbfa871d85e 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java @@ -18,8 +18,9 @@ */ package instances.FinalEmperialTomb; +import instances.AbstractInstance; + import java.io.File; -import java.util.Calendar; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -58,7 +59,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.effects.L2EffectType; import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; @@ -80,31 +80,31 @@ import com.l2jserver.gameserver.util.Util; * Use proper zone spawn system. * @author Gigiikun */ -public final class FinalEmperialTomb extends Quest +public final class FinalEmperialTomb extends AbstractInstance { private class FETWorld extends InstanceWorld { - public Lock lock = new ReentrantLock(); - public FastList<L2Npc> npcList = new FastList<>(); - public int darkChoirPlayerCount = 0; - public FrintezzaSong OnSong = null; - public ScheduledFuture<?> songTask = null; - public ScheduledFuture<?> songEffectTask = null; - public boolean isVideo = false; - public L2Npc frintezzaDummy = null; - public L2Npc overheadDummy = null; - public L2Npc portraitDummy1 = null; - public L2Npc portraitDummy3 = null; - public L2Npc scarletDummy = null; - public L2GrandBossInstance frintezza = null; - public L2GrandBossInstance activeScarlet = null; - public List<L2MonsterInstance> demons = new FastList<>(); - public Map<L2MonsterInstance, Integer> portraits = new FastMap<>(); - public int scarlet_x = 0; - public int scarlet_y = 0; - public int scarlet_z = 0; - public int scarlet_h = 0; - public int scarlet_a = 0; + protected Lock lock = new ReentrantLock(); + protected FastList<L2Npc> npcList = new FastList<>(); + protected int darkChoirPlayerCount = 0; + protected FrintezzaSong OnSong = null; + protected ScheduledFuture<?> songTask = null; + protected ScheduledFuture<?> songEffectTask = null; + protected boolean isVideo = false; + protected L2Npc frintezzaDummy = null; + protected L2Npc overheadDummy = null; + protected L2Npc portraitDummy1 = null; + protected L2Npc portraitDummy3 = null; + protected L2Npc scarletDummy = null; + protected L2GrandBossInstance frintezza = null; + protected L2GrandBossInstance activeScarlet = null; + protected List<L2MonsterInstance> demons = new FastList<>(); + protected Map<L2MonsterInstance, Integer> portraits = new FastMap<>(); + protected int scarlet_x = 0; + protected int scarlet_y = 0; + protected int scarlet_z = 0; + protected int scarlet_h = 0; + protected int scarlet_a = 0; protected FETWorld() { @@ -141,24 +141,9 @@ public final class FinalEmperialTomb extends Quest } } - private static final int TEMPLATE_ID = 136; // this is the client number - private static final int MIN_PLAYERS = 36; - private static final int MAX_PLAYERS = 45; - private static final boolean debug = false; - - private final Map<Integer, L2Territory> _spawnZoneList = new HashMap<>(); - private final Map<Integer, List<FETSpawn>> _spawnList = new HashMap<>(); - private final List<Integer> _mustKillMobsId = new FastList<>(); - - // Teleports - private static final Location ENTER_TELEPORT = new Location(-88015, -141153, -9168); - // NPCs private static final int GUIDE = 32011; private static final int CUBE = 29061; - // Item - private static final int DEWDROP_OF_DESTRUCTION_ITEM_ID = 8556; - // mobs private static final int SCARLET1 = 29046; private static final int SCARLET2 = 29047; private static final int FRINTEZZA = 29045; @@ -174,15 +159,19 @@ public final class FinalEmperialTomb extends Quest }; private static final int HALL_ALARM = 18328; private static final int HALL_KEEPER_CAPTAIN = 18329; + // Items private static final int HALL_KEEPER_SUICIDAL_SOLDIER = 18333; private static final int DARK_CHOIR_PLAYER = 18339; private static final int[] AI_DISABLED_MOBS = { 18328 }; - + private static final int DEWDROP_OF_DESTRUCTION_ITEM_ID = 8556; private static final int FIRST_SCARLET_WEAPON = 8204; private static final int SECOND_SCARLET_WEAPON = 7903; + // Skills + private static final int DEWDROP_OF_DESTRUCTION_SKILL_ID = 2276; + private static final int SOUL_BREAKING_ARROW_SKILL_ID = 2234; protected static final SkillHolder INTRO_SKILL = new SkillHolder(5004, 1); private static final SkillHolder FIRST_MORPH_SKILL = new SkillHolder(5017, 1); @@ -194,10 +183,19 @@ public final class FinalEmperialTomb extends Quest new FrintezzaSong(new SkillHolder(5007, 4), new SkillHolder(5008, 4), NpcStringId.FUGUE_OF_JUBILATION, 90), new FrintezzaSong(new SkillHolder(5007, 5), new SkillHolder(5008, 5), NpcStringId.HYPNOTIC_MAZURKA, 100), }; - // Skills - private static final int DEWDROP_OF_DESTRUCTION_SKILL_ID = 2276; - private static final int SOUL_BREAKING_ARROW_SKILL_ID = 2234; - // Doors/Walls/Zones + // Locations + private static final Location ENTER_TELEPORT = new Location(-88015, -141153, -9168); + protected static final Location MOVE_TO_CENTER = new Location(-87904, -141296, -9168, 0); + // Misc + private static final int TEMPLATE_ID = 136; // this is the client number + private static final int MIN_PLAYERS = 36; + private static final int MAX_PLAYERS = 45; + private static final int TIME_BETWEEN_DEMON_SPAWNS = 20000; + private static final int MAX_DEMONS = 24; + private static final boolean debug = false; + private final Map<Integer, L2Territory> _spawnZoneList = new HashMap<>(); + private final Map<Integer, List<FETSpawn>> _spawnList = new HashMap<>(); + private final List<Integer> _mustKillMobsId = new FastList<>(); protected static final int[] FIRST_ROOM_DOORS = { 17130051, @@ -222,7 +220,6 @@ public final class FinalEmperialTomb extends Quest 17130069, 17130070 }; - protected static final int[] FIRST_ROUTE_DOORS = { 17130042, @@ -233,68 +230,19 @@ public final class FinalEmperialTomb extends Quest 17130045, 17130046 }; - protected static final Location MOVE_TO_CENTER = new Location(-87904, -141296, -9168, 0); - - // spawns - private static final int TIME_BETWEEN_DEMON_SPAWNS = 20000; - private static final int MAX_DEMONS = 24; + // @formatter:off protected static final int[][] PORTRAIT_SPAWNS = { - { - 29048, - -89381, - -153981, - -9168, - 3368, - -89378, - -153968, - -9168, - 3368 - }, - { - 29048, - -86234, - -152467, - -9168, - 37656, - -86261, - -152492, - -9168, - 37656 - }, - { - 29049, - -89342, - -152479, - -9168, - -5152, - -89311, - -152491, - -9168, - -5152 - }, - { - 29049, - -86189, - -153968, - -9168, - 29456, - -86217, - -153956, - -9168, - 29456 - } + {29048, -89381, -153981, -9168, 3368, -89378, -153968, -9168, 3368}, + {29048, -86234, -152467, -9168, 37656, -86261, -152492, -9168, 37656}, + {29049, -89342, -152479, -9168, -5152, -89311, -152491, -9168, -5152}, + {29049, -86189, -153968, -9168, 29456, -86217, -153956, -9168, 29456}, }; + // @formatter:on - // Initialization at 6:30 am on Wednesday and Saturday - private static final int RESET_HOUR = 6; - private static final int RESET_MIN = 30; - private static final int RESET_DAY_1 = 4; - private static final int RESET_DAY_2 = 7; - - private FinalEmperialTomb() + public FinalEmperialTomb() { - super(-1, FinalEmperialTomb.class.getSimpleName(), "instances"); + super(FinalEmperialTomb.class.getSimpleName()); load(); addAttackId(SCARLET1, FRINTEZZA); addAttackId(PORTRAITS); @@ -531,19 +479,22 @@ public final class FinalEmperialTomb extends Quest } } - private boolean checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) { return true; } - L2Party party = player.getParty(); + + final L2Party party = player.getParty(); if (party == null) { player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); return false; } - L2CommandChannel channel = player.getParty().getCommandChannel(); + + final L2CommandChannel channel = player.getParty().getCommandChannel(); if (channel == null) { player.sendPacket(SystemMessageId.NOT_IN_COMMAND_CHANNEL_CANT_ENTER); @@ -570,82 +521,51 @@ public final class FinalEmperialTomb extends Quest { if (channelMember.getLevel() < 80) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); - sm.addPcName(channelMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(channelMember)); return false; } if (!Util.checkIfInRange(1000, player, channelMember, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); - sm.addPcName(channelMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(channelMember)); return false; } - Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID); + final Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID); if (System.currentTimeMillis() < reentertime) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); - sm.addPcName(channelMember); - party.broadcastPacket(sm); + party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(channelMember)); return false; } } return true; } - protected int enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof FETWorld)) + controlStatus((FETWorld) world); + + if ((player.getParty() == null) || (player.getParty().getCommandChannel() == null)) { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; + player.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, player.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true); + world.addAllowed(player.getObjectId()); + teleportPlayer(player, ENTER_TELEPORT, world.getInstanceId(), false); + } + else + { + for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers()) + { + channelMember.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, channelMember.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true); + world.addAllowed(channelMember.getObjectId()); + teleportPlayer(channelMember, ENTER_TELEPORT, world.getInstanceId(), false); + } } - teleportPlayer(player, loc, world.getInstanceId(), false); - return world.getInstanceId(); - } - - // New instance - if (!checkConditions(player)) - { - return 0; - } - if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS) && !player.destroyItemByItemId("QUEST", 8073, 1, player, true)) - { - return 0; - } - final int instanceId = InstanceManager.getInstance().createDynamicInstance(template); - // Instance ins = InstanceManager.getInstance().getInstance(instanceId); - // ins.setSpawnLoc(new int[]{player.getX(),player.getY(),player.getZ()}); - world = new FETWorld(); - world.setTemplateId(TEMPLATE_ID); - world.setInstanceId(instanceId); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - controlStatus((FETWorld) world); - _log.info("Final Emperial Tomb started " + template + " Instance: " + instanceId + " created by player: " + player.getName()); - // teleport players - if ((player.getParty() == null) || (player.getParty().getCommandChannel() == null)) - { - player.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, player.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true); - world.addAllowed(player.getObjectId()); - teleportPlayer(player, loc, instanceId, false); } else { - for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers()) - { - channelMember.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, channelMember.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true); - world.addAllowed(channelMember.getObjectId()); - teleportPlayer(channelMember, loc, instanceId, false); - } + teleportPlayer(player, ENTER_TELEPORT, world.getInstanceId(), false); } - return instanceId; } protected boolean checkKillProgress(L2Npc mob, FETWorld world) @@ -737,7 +657,7 @@ public final class FinalEmperialTomb extends Quest { world.activeScarlet.abortCast(); } - setInstanceTimeRestrictions(world); + handleReenterTime(world); world.activeScarlet.doCast(FIRST_MORPH_SKILL.getSkill()); ThreadPoolManager.getInstance().scheduleGeneral(new SongTask(world, 2), 1500); break; @@ -800,7 +720,7 @@ public final class FinalEmperialTomb extends Quest protected void spawn(FETWorld world, int npcId, int x, int y, int z, int h, boolean addToKillTable) { - L2Npc npc = addSpawn(npcId, x, y, z, h, false, 0, false, world.getInstanceId()); + final L2Npc npc = addSpawn(npcId, x, y, z, h, false, 0, false, world.getInstanceId()); if (addToKillTable) { world.npcList.add(npc); @@ -1405,46 +1325,6 @@ public final class FinalEmperialTomb extends Quest } } - protected void setInstanceTimeRestrictions(FETWorld world) - { - Calendar reenter = Calendar.getInstance(); - reenter.set(Calendar.MINUTE, RESET_MIN); - reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR); - // if time is >= RESET_HOUR - roll to the next day - if (reenter.getTimeInMillis() <= System.currentTimeMillis()) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1) - { - while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - } - else - { - while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - } - - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); - sm.addInstanceName(TEMPLATE_ID); - - // set instance reenter time for all allowed players - for (int objectId : world.getAllowed()) - { - L2PcInstance player = L2World.getInstance().getPlayer(objectId); - InstanceManager.getInstance().setInstanceTime(objectId, TEMPLATE_ID, reenter.getTimeInMillis()); - if ((player != null) && player.isOnline()) - { - player.sendPacket(sm); - } - } - } - protected void broadCastPacket(FETWorld world, L2GameServerPacket packet) { for (int objId : world.getAllowed()) @@ -1578,7 +1458,7 @@ public final class FinalEmperialTomb extends Quest getQuestState(player, true); if (npcId == GUIDE) { - enterInstance(player, "FinalEmperialTomb.xml", ENTER_TELEPORT); + enterInstance(player, new FETWorld(), "FinalEmperialTomb.xml", TEMPLATE_ID); } else if (npc.getId() == CUBE) { @@ -1589,9 +1469,4 @@ public final class FinalEmperialTomb extends Quest } return ""; } - - public static void main(String[] args) - { - new FinalEmperialTomb(); - } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java b/L2J_DataPack/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java index 6b262c6014e32b3954978db3b07b3ce52251ee70..26b79b19c0f0b33dcd2a47e88d2f124ca1720a12 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java @@ -18,37 +18,37 @@ */ package instances.HideoutOfTheDawn; +import instances.AbstractInstance; + import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; -import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; -import com.l2jserver.gameserver.network.SystemMessageId; /** * Hideout of the Dawn instance zone. * @author Adry_85 */ -public final class HideoutOfTheDawn extends Quest +public final class HideoutOfTheDawn extends AbstractInstance { protected class HotDWorld extends InstanceWorld { - long storeTime = 0; + } - private static final int TEMPLATE_ID = 113; // NPCs private static final int WOOD = 32593; private static final int JAINA = 32617; // Location private static final Location WOOD_LOC = new Location(-23758, -8959, -5384, 0, 0); private static final Location JAINA_LOC = new Location(147072, 23743, -1984, 0); + // Misc + private static final int TEMPLATE_ID = 113; - private HideoutOfTheDawn() + public HideoutOfTheDawn() { - super(-1, HideoutOfTheDawn.class.getSimpleName(), "instances"); + super(HideoutOfTheDawn.class.getSimpleName()); addStartNpc(WOOD); addTalkId(WOOD, JAINA); } @@ -60,7 +60,7 @@ public final class HideoutOfTheDawn extends Quest { case WOOD: { - enterInstance(talker, "HideoutOfTheDawn.xml", WOOD_LOC); + enterInstance(talker, new HotDWorld(), "HideoutOfTheDawn.xml", TEMPLATE_ID); return "32593-01.htm"; } case JAINA: @@ -75,49 +75,13 @@ public final class HideoutOfTheDawn extends Quest return super.onTalk(npc, talker); } - protected int enterInstance(L2PcInstance player, String template, Location loc) - { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) - { - if (!(world instanceof HotDWorld)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; - } - teleportPlayer(player, loc, world.getInstanceId(), false); - removeBuffs(player); - return 0; - } - // New instance - world = new HotDWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - ((HotDWorld) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Hideout of the Dawn started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // teleport players - teleportPlayer(player, loc, world.getInstanceId(), false); - removeBuffs(player); - world.addAllowed(player.getObjectId()); - - return world.getInstanceId(); - } - - private static final void removeBuffs(L2Character ch) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - ch.stopAllEffectsExceptThoseThatLastThroughDeath(); - if (ch.hasSummon()) + if (firstEntrance) { - ch.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); + world.addAllowed(player.getObjectId()); } + teleportPlayer(player, WOOD_LOC, world.getInstanceId(), false); } - - public static void main(String[] args) - { - new HideoutOfTheDawn(); - } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java b/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java index 20ca8f61992b6763ba18730bccc2696c412b1acc..d1f740c42a8008e5033fb71ec431c8c1cc37fb57 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java @@ -18,8 +18,8 @@ */ package instances.IceQueensCastle; +import instances.AbstractInstance; import quests.Q10285_MeetingSirra.Q10285_MeetingSirra; -import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.instancemanager.InstanceManager; @@ -40,7 +40,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2; * Ice Queen's Castle instance zone. * @author Adry_85 */ -public final class IceQueensCastle extends AbstractNpcAI +public final class IceQueensCastle extends AbstractInstance { protected class IQCWorld extends InstanceWorld { @@ -65,9 +65,9 @@ public final class IceQueensCastle extends AbstractNpcAI private static final int ICE_QUEEN_DOOR = 23140101; private static final int MIN_LV = 82; - private IceQueensCastle() + public IceQueensCastle() { - super(IceQueensCastle.class.getSimpleName(), "instances"); + super(IceQueensCastle.class.getSimpleName()); addStartNpc(JINIA); addTalkId(JINIA); addSeeCreatureId(BATTALION_LEADER, LEGIONNAIRE, MERCENARY_ARCHER); @@ -187,52 +187,30 @@ public final class IceQueensCastle extends AbstractNpcAI @Override public String onTalk(L2Npc npc, L2PcInstance talker) { - enterInstance(talker, "IceQueensCastle.xml"); + enterInstance(talker, new IQCWorld(), "IceQueensCastle.xml", TEMPLATE_ID); return super.onTalk(npc, talker); } - private void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - - if (world != null) + if (firstEntrance) { - if (world instanceof IQCWorld) - { - teleportPlayer(player, START_LOC, world.getInstanceId(), false); - return; - } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; - } - - if (checkConditions(player)) - { - world = new IQCWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - _log.info("Ice Queen's Castle started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - teleportPlayer(player, START_LOC, world.getInstanceId(), false); world.addAllowed(player.getObjectId()); ((IQCWorld) world).player = player; openDoor(ICE_QUEEN_DOOR, world.getInstanceId()); } + teleportPlayer(player, START_LOC, world.getInstanceId(), false); } - private boolean checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { if (player.getLevel() < MIN_LV) { - player.sendPacket(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + player.sendPacket(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); return false; } return true; } - - public static void main(String[] args) - { - new IceQueensCastle(); - } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java b/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java index ccdc6a3c0a7c9000f25a77a42e3a5c0b0d97f92a..bac2098452f0b61bd7f691a1e2381031d4679237 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java @@ -18,14 +18,14 @@ */ package instances.IceQueensCastleNormalBattle; +import instances.AbstractInstance; + import java.util.ArrayList; -import java.util.Calendar; import java.util.Collections; import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import quests.Q10286_ReunionWithSirra.Q10286_ReunionWithSirra; -import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.enums.MountType; @@ -62,19 +62,19 @@ import com.l2jserver.gameserver.util.Util; * Ice Queen's Castle (Normal Battle) instance zone. * @author St3eT */ -public final class IceQueensCastleNormalBattle extends AbstractNpcAI +public final class IceQueensCastleNormalBattle extends AbstractInstance { protected class IQCNBWorld extends InstanceWorld { - List<L2PcInstance> playersInside = new ArrayList<>(); - List<L2Npc> knightStatues = new ArrayList<>(); - List<L2Attackable> spawnedMobs = new CopyOnWriteArrayList<>(); - L2NpcInstance controller = null; - L2GrandBossInstance freya = null; - L2QuestGuardInstance supp_Jinia = null; - L2QuestGuardInstance supp_Kegor = null; - boolean isSupportActive = false; - boolean canSpawnMobs = true; + protected List<L2PcInstance> playersInside = new ArrayList<>(); + protected List<L2Npc> knightStatues = new ArrayList<>(); + protected List<L2Attackable> spawnedMobs = new CopyOnWriteArrayList<>(); + protected L2NpcInstance controller = null; + protected L2GrandBossInstance freya = null; + protected L2QuestGuardInstance supp_Jinia = null; + protected L2QuestGuardInstance supp_Kegor = null; + protected boolean isSupportActive = false; + protected boolean canSpawnMobs = true; } // Npcs @@ -158,16 +158,12 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI private static final int MAX_PLAYERS = 27; private static final int MIN_PLAYERS = 10; private static final int MIN_LEVEL = 82; - private static final int RESET_HOUR = 6; - private static final int RESET_MIN = 30; - private static final int RESET_DAY_1 = 4; // Wednesday - private static final int RESET_DAY_2 = 7; // Saturday private static final int TEMPLATE_ID = 139; // Ice Queen's Castle private static final int DOOR_ID = 23140101; - private IceQueensCastleNormalBattle() + public IceQueensCastleNormalBattle() { - super(IceQueensCastleNormalBattle.class.getSimpleName(), "instances"); + super(IceQueensCastleNormalBattle.class.getSimpleName()); addStartNpc(SIRRA, SUPP_KEGOR, SUPP_JINIA); addFirstTalkId(SUPP_KEGOR, SUPP_JINIA); addTalkId(SIRRA, JINIA, SUPP_KEGOR); @@ -182,7 +178,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI { if (event.equals("enter")) { - enterInstance(player, "IceQueensCastleNormalBattle.xml"); + enterInstance(player, new IQCNBWorld(), "IceQueensCastleNormalBattle.xml", TEMPLATE_ID); } else { @@ -1076,41 +1072,10 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI } case FREYA_STAND: { - for (L2PcInstance player : world.playersInside) - { - if ((player != null) && (player.getInstanceId() == world.getInstanceId())) - { - Calendar reenter = Calendar.getInstance(); - Calendar.getInstance().set(Calendar.MINUTE, RESET_MIN); - Calendar.getInstance().set(Calendar.HOUR_OF_DAY, RESET_HOUR); - - if (reenter.getTimeInMillis() <= System.currentTimeMillis()) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1) - { - while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - } - else - { - while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2) - { - reenter.add(Calendar.DAY_OF_MONTH, 1); - } - } - InstanceManager.getInstance().setInstanceTime(player.getObjectId(), TEMPLATE_ID, reenter.getTimeInMillis()); - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); - sm.addInstanceName(TEMPLATE_ID); - player.sendPacket(sm); - } - } world.isSupportActive = false; manageMovie(world, 19); manageDespawnMinions(world); + finishInstance(world); DecayTaskManager.getInstance().cancel(world.freya); cancelQuestTimer("ATTACK_FREYA", world.supp_Jinia, null); cancelQuestTimer("ATTACK_FREYA", world.supp_Kegor, null); @@ -1169,43 +1134,11 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI return super.onKill(npc, killer, isSummon); } - private void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - - if (world != null) - { - if (world instanceof IQCNBWorld) - { - player.stopAllEffectsExceptThoseThatLastThroughDeath(); - if (player.hasSummon()) - { - player.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); - } - - if (world.isStatus(4)) - { - teleportPlayer(player, BATTLE_PORT, world.getInstanceId()); - } - else - { - teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); - } - return; - } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; - } - - if (checkConditions(player)) + if (firstEntrance) { - world = new IQCNBWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - _log.info("Ice Queen Castle started (Normal Battle)" + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - if (!player.isInParty()) { managePlayerEnter(player, (IQCNBWorld) world); @@ -1225,21 +1158,21 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI } } } + else + { + teleportPlayer(player, world.isStatus(4) ? BATTLE_PORT : ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId()); + } } private void managePlayerEnter(L2PcInstance player, IQCNBWorld world) { - player.stopAllEffectsExceptThoseThatLastThroughDeath(); - if (player.hasSummon()) - { - player.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); - } world.playersInside.add(player); world.addAllowed(player.getObjectId()); teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); } - private boolean checkConditions(L2PcInstance player) + @Override + protected boolean checkConditions(L2PcInstance player) { final L2Party party = player.getParty(); final L2CommandChannel channel = party != null ? party.getCommandChannel() : null; @@ -1273,21 +1206,21 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI { if (channelMember.getLevel() < MIN_LEVEL) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(channelMember); party.broadcastPacket(sm); return false; } else if (!Util.checkIfInRange(1000, player, channelMember, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(channelMember); party.broadcastPacket(sm); return false; } else if (System.currentTimeMillis() < InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(channelMember); party.broadcastPacket(sm); return false; @@ -1365,9 +1298,4 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI } } } - - public static void main(String[] args) - { - new IceQueensCastleNormalBattle(); - } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java b/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java new file mode 100644 index 0000000000000000000000000000000000000000..0a2d55077d9eda9b9a9fe2fb21e169bec8505295 --- /dev/null +++ b/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2004-2014 L2J DataPack + * + * This file is part of L2J DataPack. + * + * L2J DataPack is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * L2J DataPack is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ +package instances; + +import instances.CavernOfThePirateCaptain.CavernOfThePirateCaptain; +import instances.ChambersOfDelusion.ChamberOfDelusionEast; +import instances.ChambersOfDelusion.ChamberOfDelusionNorth; +import instances.ChambersOfDelusion.ChamberOfDelusionSouth; +import instances.ChambersOfDelusion.ChamberOfDelusionSquare; +import instances.ChambersOfDelusion.ChamberOfDelusionTower; +import instances.ChambersOfDelusion.ChamberOfDelusionWest; +import instances.CrystalCaverns.CrystalCaverns; +import instances.DarkCloudMansion.DarkCloudMansion; +import instances.DisciplesNecropolisPast.DisciplesNecropolisPast; +import instances.ElcadiasTent.ElcadiasTent; +import instances.FinalEmperialTomb.FinalEmperialTomb; +import instances.HideoutOfTheDawn.HideoutOfTheDawn; +import instances.IceQueensCastle.IceQueensCastle; +import instances.IceQueensCastleNormalBattle.IceQueensCastleNormalBattle; +import instances.JiniaGuildHideout1.JiniaGuildHideout1; +import instances.JiniaGuildHideout2.JiniaGuildHideout2; +import instances.JiniaGuildHideout3.JiniaGuildHideout3; +import instances.JiniaGuildHideout4.JiniaGuildHideout4; +import instances.Kamaloka.Kamaloka; +import instances.LibraryOfSages.LibraryOfSages; +import instances.MithrilMine.MithrilMine; +import instances.MonasteryOfSilence1.MonasteryOfSilence1; +import instances.NornilsGarden.NornilsGarden; +import instances.PailakaDevilsLegacy.PailakaDevilsLegacy; +import instances.PailakaSongOfIceAndFire.PailakaSongOfIceAndFire; +import instances.SanctumOftheLordsOfDawn.SanctumOftheLordsOfDawn; + +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * Instance class-loader. + * @author FallenAngel + */ +public final class InstanceLoader +{ + private static final Logger _log = Logger.getLogger(InstanceLoader.class.getName()); + + private static final Class<?>[] SCRIPTS = + { + CavernOfThePirateCaptain.class, + CrystalCaverns.class, + DarkCloudMansion.class, + DisciplesNecropolisPast.class, + ElcadiasTent.class, + FinalEmperialTomb.class, + HideoutOfTheDawn.class, + ChamberOfDelusionEast.class, + ChamberOfDelusionNorth.class, + ChamberOfDelusionSouth.class, + ChamberOfDelusionSquare.class, + ChamberOfDelusionTower.class, + ChamberOfDelusionWest.class, + IceQueensCastle.class, + IceQueensCastleNormalBattle.class, + JiniaGuildHideout1.class, + JiniaGuildHideout2.class, + JiniaGuildHideout3.class, + JiniaGuildHideout4.class, + Kamaloka.class, + LibraryOfSages.class, + MithrilMine.class, + MonasteryOfSilence1.class, + NornilsGarden.class, + PailakaDevilsLegacy.class, + PailakaSongOfIceAndFire.class, + SanctumOftheLordsOfDawn.class, + }; + + public static void main(String[] args) + { + _log.info(InstanceLoader.class.getSimpleName() + ": Loading Instances scripts."); + for (Class<?> script : SCRIPTS) + { + try + { + script.newInstance(); + } + catch (Exception e) + { + _log.log(Level.SEVERE, InstanceLoader.class.getSimpleName() + ": Failed loading " + script.getSimpleName() + ":", e); + } + } + } +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java index 09dbfc71b25f403cc37e05d95181d742697cc7eb..673e03869923373cbfe08beb0fddea67baed5706 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java @@ -18,37 +18,36 @@ */ package instances.JiniaGuildHideout1; +import instances.AbstractInstance; import quests.Q10284_AcquisitionOfDivineSword.Q10284_AcquisitionOfDivineSword; -import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; -import com.l2jserver.gameserver.network.SystemMessageId; /** * Jinia Guild Hideout instance zone. * @author Adry_85 */ -public final class JiniaGuildHideout1 extends Quest +public final class JiniaGuildHideout1 extends AbstractInstance { protected class JGH1World extends InstanceWorld { - long storeTime = 0; + } - private static final int INSTANCEID = 140; // NPC private static final int RAFFORTY = 32020; // Location private static final Location START_LOC = new Location(-23530, -8963, -5413); + // Misc + private static final int TEMPLATE_ID = 140; - private JiniaGuildHideout1() + public JiniaGuildHideout1() { - super(-1, JiniaGuildHideout1.class.getSimpleName(), "instances"); + super(JiniaGuildHideout1.class.getSimpleName()); addStartNpc(RAFFORTY); addTalkId(RAFFORTY); } @@ -59,42 +58,19 @@ public final class JiniaGuildHideout1 extends Quest final QuestState qs = talker.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName()); if ((qs != null) && qs.isCond(1)) { - enterInstance(talker, "JiniaGuildHideout1.xml"); + enterInstance(talker, new JGH1World(), "JiniaGuildHideout1.xml", TEMPLATE_ID); qs.setCond(2, true); } return super.onTalk(npc, talker); } - protected void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof JGH1World)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; - } - teleportPlayer(player, START_LOC, world.getInstanceId(), false); - return; + world.addAllowed(player.getObjectId()); } - // New instance - world = new JGH1World(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(INSTANCEID); - world.setStatus(0); - ((JGH1World) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Jinia Guild Hideout started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // teleport players teleportPlayer(player, START_LOC, world.getInstanceId(), false); - world.addAllowed(player.getObjectId()); - } - - public static void main(String[] args) - { - new JiniaGuildHideout1(); } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java index e6ab51ee3cac7f01f7573333f146a8778c0adc77..6b738d688530d6c883c8051eb3d9cfb12075098b 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java @@ -18,37 +18,36 @@ */ package instances.JiniaGuildHideout2; +import instances.AbstractInstance; import quests.Q10285_MeetingSirra.Q10285_MeetingSirra; -import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; -import com.l2jserver.gameserver.network.SystemMessageId; /** * Jinia Guild Hideout instance zone. * @author Adry_85 */ -public final class JiniaGuildHideout2 extends Quest +public final class JiniaGuildHideout2 extends AbstractInstance { protected class JGH2World extends InstanceWorld { - long storeTime = 0; + } - private static final int TEMPLATE_ID = 141; // NPC private static final int RAFFORTY = 32020; // Location private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0); + // Misc + private static final int TEMPLATE_ID = 141; - private JiniaGuildHideout2() + public JiniaGuildHideout2() { - super(-1, JiniaGuildHideout2.class.getSimpleName(), "instances"); + super(JiniaGuildHideout2.class.getSimpleName()); addStartNpc(RAFFORTY); addTalkId(RAFFORTY); } @@ -59,43 +58,19 @@ public final class JiniaGuildHideout2 extends Quest final QuestState qs = talker.getQuestState(Q10285_MeetingSirra.class.getSimpleName()); if ((qs != null) && qs.isMemoState(1)) { - enterInstance(talker, "JiniaGuildHideout2.xml", START_LOC); + enterInstance(talker, new JGH2World(), "JiniaGuildHideout2.xml", TEMPLATE_ID); qs.setCond(2, true); } return super.onTalk(npc, talker); } - protected int enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof JGH2World)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; - } - teleportPlayer(player, loc, world.getInstanceId(), false); - return 0; + world.addAllowed(player.getObjectId()); } - // New instance - world = new JGH2World(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - ((JGH2World) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Jinia Guild Hideout started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // teleport players - teleportPlayer(player, loc, world.getInstanceId(), false); - world.addAllowed(player.getObjectId()); - return world.getInstanceId(); - } - - public static void main(String[] args) - { - new JiniaGuildHideout2(); + teleportPlayer(player, START_LOC, world.getInstanceId(), false); } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java index 7166875a73520535d7b0d7c1d271d3adacc46bac..c443f5c20bb5b28e8dbf7d6681deab2c53639c6a 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java @@ -18,37 +18,36 @@ */ package instances.JiniaGuildHideout3; +import instances.AbstractInstance; import quests.Q10286_ReunionWithSirra.Q10286_ReunionWithSirra; -import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; -import com.l2jserver.gameserver.network.SystemMessageId; /** * Jinia Guild Hideout instance zone. * @author Adry_85 */ -public final class JiniaGuildHideout3 extends Quest +public final class JiniaGuildHideout3 extends AbstractInstance { - protected class JGH2World extends InstanceWorld + protected class JGH3World extends InstanceWorld { - long storeTime = 0; + } - private static final int TEMPLATE_ID = 145; // NPC private static final int RAFFORTY = 32020; // Location private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0); + // Misc + private static final int TEMPLATE_ID = 145; - private JiniaGuildHideout3() + public JiniaGuildHideout3() { - super(-1, JiniaGuildHideout3.class.getSimpleName(), "instances"); + super(JiniaGuildHideout3.class.getSimpleName()); addStartNpc(RAFFORTY); addTalkId(RAFFORTY); } @@ -59,43 +58,19 @@ public final class JiniaGuildHideout3 extends Quest final QuestState qs = talker.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName()); if ((qs != null) && qs.isMemoState(1)) { - enterInstance(talker, "JiniaGuildHideout3.xml", START_LOC); + enterInstance(talker, new JGH3World(), "JiniaGuildHideout3.xml", TEMPLATE_ID); qs.setCond(2, true); } return super.onTalk(npc, talker); } - protected int enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof JGH2World)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; - } - teleportPlayer(player, loc, world.getInstanceId(), false); - return 0; + world.addAllowed(player.getObjectId()); } - // New instance - world = new JGH2World(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - ((JGH2World) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Jinia Guild Hideout started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // teleport players - teleportPlayer(player, loc, world.getInstanceId(), false); - world.addAllowed(player.getObjectId()); - return world.getInstanceId(); - } - - public static void main(String[] args) - { - new JiniaGuildHideout3(); + teleportPlayer(player, START_LOC, world.getInstanceId(), false); } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java index 9fe850fe773decd9dd743d77d294a207ecb8b6f1..3909d37203964ff6bb7b6023ddba44cd6822383d 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java @@ -18,37 +18,36 @@ */ package instances.JiniaGuildHideout4; +import instances.AbstractInstance; import quests.Q10287_StoryOfThoseLeft.Q10287_StoryOfThoseLeft; -import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; -import com.l2jserver.gameserver.network.SystemMessageId; /** * Jinia Guild Hideout instance zone. * @author Adry_85 */ -public final class JiniaGuildHideout4 extends Quest +public final class JiniaGuildHideout4 extends AbstractInstance { - protected class JGH2World extends InstanceWorld + protected class JGH4World extends InstanceWorld { - long storeTime = 0; + } - private static final int TEMPLATE_ID = 146; // NPC private static final int RAFFORTY = 32020; // Location private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0); + // Misc + private static final int TEMPLATE_ID = 146; - private JiniaGuildHideout4() + public JiniaGuildHideout4() { - super(-1, JiniaGuildHideout4.class.getSimpleName(), "instances"); + super(JiniaGuildHideout4.class.getSimpleName()); addStartNpc(RAFFORTY); addTalkId(RAFFORTY); } @@ -59,43 +58,19 @@ public final class JiniaGuildHideout4 extends Quest final QuestState qs = talker.getQuestState(Q10287_StoryOfThoseLeft.class.getSimpleName()); if ((qs != null) && qs.isMemoState(1)) { - enterInstance(talker, "JiniaGuildHideout4.xml", START_LOC); + enterInstance(talker, new JGH4World(), "JiniaGuildHideout4.xml", TEMPLATE_ID); qs.setCond(2, true); } return super.onTalk(npc, talker); } - protected int enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof JGH2World)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; - } - teleportPlayer(player, loc, world.getInstanceId(), false); - return 0; + world.addAllowed(player.getObjectId()); } - // New instance - world = new JGH2World(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - ((JGH2World) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Jinia Guild Hideout started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // teleport players - teleportPlayer(player, loc, world.getInstanceId(), false); - world.addAllowed(player.getObjectId()); - return world.getInstanceId(); - } - - public static void main(String[] args) - { - new JiniaGuildHideout4(); + teleportPlayer(player, START_LOC, world.getInstanceId(), false); } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java b/L2J_DataPack/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java index f291650e7caf1e22d3da72ec3a75a9b75aa106df..1762d454e05017882981b228ea80d8cae74a35f5 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java @@ -18,6 +18,8 @@ */ package instances.Kamaloka; +import instances.AbstractInstance; + import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; @@ -38,13 +40,12 @@ import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.skills.BuffInfo; import com.l2jserver.gameserver.model.skills.Skill; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.SystemMessage; -public final class Kamaloka extends Quest +public final class Kamaloka extends AbstractInstance { /* * Reset time for all kamaloka Default: 6:30AM on server time @@ -1176,9 +1177,9 @@ public final class Kamaloka extends Quest public L2Npc boss = null; // boss } - private Kamaloka() + public Kamaloka() { - super(-1, Kamaloka.class.getSimpleName(), "instances"); + super(Kamaloka.class.getSimpleName()); addFirstTalkId(TELEPORTER); addTalkId(TELEPORTER); for (int cap : CAPTAINS) @@ -1260,7 +1261,7 @@ public final class Kamaloka extends Quest // player level must be in range if (Math.abs(partyMember.getLevel() - level) > MAX_LEVEL_DIFFERENCE) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return false; @@ -1268,7 +1269,7 @@ public final class Kamaloka extends Quest // player must be near party leader if (!partyMember.isInsideRadius(player, 1000, true, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); player.sendPacket(sm); return false; @@ -1288,7 +1289,7 @@ public final class Kamaloka extends Quest // if found instance still can't be reentered - exit if (System.currentTimeMillis() < instanceTimes.get(id)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_REENTER_YET); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET); sm.addPcName(partyMember); player.sendPacket(sm); return false; @@ -1348,13 +1349,13 @@ public final class Kamaloka extends Quest // but not in kamaloka if (!(world instanceof KamaWorld) || (world.getTemplateId() != templateId)) { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); + player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return; } // check for level difference again on reenter if (Math.abs(player.getLevel() - LEVEL[((KamaWorld) world).index]) > MAX_LEVEL_DIFFERENCE) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(player); player.sendPacket(sm); return; @@ -1413,7 +1414,8 @@ public final class Kamaloka extends Quest * Called on instance finish and handles reenter time for instance * @param world instanceWorld */ - private static final void finishInstance(InstanceWorld world) + @Override + protected final void finishInstance(InstanceWorld world) { if (world instanceof KamaWorld) { @@ -1426,7 +1428,7 @@ public final class Kamaloka extends Quest } reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR); - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_RESTRICTED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_FROM_HERE_S1_S_ENTRY_HAS_BEEN_RESTRICTED); sm.addInstanceName(world.getTemplateId()); // set instance reenter time for all allowed players @@ -1722,8 +1724,9 @@ public final class Kamaloka extends Quest return super.onKill(npc, player, isSummon); } - public static void main(String[] args) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - new Kamaloka(); + } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/32861.html b/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/32861.html index 189a7a5d910275c6347ec90fe8ab977c2f5a29ae..f36dd538231065f91920b0a0b80f979f4f59d866 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/32861.html +++ b/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/32861.html @@ -1,5 +1,5 @@ <html><body>Library of Sages Director Sophia:<br> Hello. What brings you to Library of Sages?<br> -<a action="bypass -h Quest LibraryOfSages EXIT">"I wish to leave."</a><br> +<a action="bypass -h Quest LibraryOfSages exit">"I wish to leave."</a><br> <a action="bypass -h npc_%objectId%_Quest">Quest</a> </body></html> \ No newline at end of file diff --git a/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java b/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java index 1d466efa16f376b9edcfbc1b9d3aa0a36e18941e..856747d41d29417eec185ac572bab339c701deac 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java @@ -18,7 +18,7 @@ */ package instances.LibraryOfSages; -import ai.npc.AbstractNpcAI; +import instances.AbstractInstance; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; @@ -26,22 +26,19 @@ import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.network.NpcStringId; -import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.clientpackets.Say2; /** * Library of Sages instance zone. * @author Adry_85 */ -public final class LibraryOfSages extends AbstractNpcAI +public final class LibraryOfSages extends AbstractInstance { protected class LoSWorld extends InstanceWorld { protected L2Npc elcadia = null; - protected long storeTime = 0; } - private static final int TEMPLATE_ID = 156; // NPCs private static final int SOPHIA1 = 32596; private static final int PILE_OF_BOOKS1 = 32809; @@ -64,10 +61,12 @@ public final class LibraryOfSages extends AbstractNpcAI NpcStringId.AN_UNDERGROUND_LIBRARY_I_HATE_DAMP_AND_SMELLY_PLACES, NpcStringId.THE_BOOK_THAT_WE_SEEK_IS_CERTAINLY_HERE_SEARCH_INCH_BY_INCH }; + // Misc + private static final int TEMPLATE_ID = 156; - private LibraryOfSages() + public LibraryOfSages() { - super(LibraryOfSages.class.getSimpleName(), "instances"); + super(LibraryOfSages.class.getSimpleName()); addFirstTalkId(SOPHIA2, ELCADIA_INSTANCE, PILE_OF_BOOKS1, PILE_OF_BOOKS2, PILE_OF_BOOKS3, PILE_OF_BOOKS4, PILE_OF_BOOKS5); addStartNpc(SOPHIA1, SOPHIA2, SOPHIA3); addTalkId(SOPHIA1, SOPHIA2, SOPHIA3); @@ -76,42 +75,40 @@ public final class LibraryOfSages extends AbstractNpcAI @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); - if (!(tmpworld instanceof LoSWorld)) + final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); + if (tmpworld instanceof LoSWorld) { - return null; - } - - LoSWorld world = (LoSWorld) tmpworld; - switch (event) - { - case "TELEPORT2": - { - teleportPlayer(player, LIBRARY_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(LIBRARY_LOC.getX(), LIBRARY_LOC.getY(), LIBRARY_LOC.getZ(), 0, world.getInstanceId()); - break; - } - case "EXIT": - { - cancelQuestTimer("FOLLOW", npc, player); - player.teleToLocation(EXIT_LOC); - world.elcadia.deleteMe(); - break; - } - case "FOLLOW": - { - npc.setIsRunning(true); - npc.getAI().startFollow(player); - broadcastNpcSay(npc, Say2.NPC_ALL, ELCADIA_DIALOGS[getRandom(ELCADIA_DIALOGS.length)]); - startQuestTimer("FOLLOW", 10000, npc, player); - break; - } - case "ENTER": + final LoSWorld world = (LoSWorld) tmpworld; + switch (event) { - cancelQuestTimer("FOLLOW", npc, player); - teleportPlayer(player, START_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(START_LOC.getX(), START_LOC.getY(), START_LOC.getZ(), 0, world.getInstanceId()); - break; + case "TELEPORT2": + { + teleportPlayer(player, LIBRARY_LOC, world.getInstanceId()); + world.elcadia.teleToLocation(LIBRARY_LOC.getX(), LIBRARY_LOC.getY(), LIBRARY_LOC.getZ(), 0, world.getInstanceId()); + break; + } + case "exit": + { + cancelQuestTimer("FOLLOW", npc, player); + player.teleToLocation(EXIT_LOC); + world.elcadia.deleteMe(); + break; + } + case "FOLLOW": + { + npc.setIsRunning(true); + npc.getAI().startFollow(player); + broadcastNpcSay(npc, Say2.NPC_ALL, ELCADIA_DIALOGS[getRandom(ELCADIA_DIALOGS.length)]); + startQuestTimer("FOLLOW", 10000, npc, player); + break; + } + case "ENTER": + { + cancelQuestTimer("FOLLOW", npc, player); + teleportPlayer(player, START_LOC, world.getInstanceId()); + world.elcadia.teleToLocation(START_LOC.getX(), START_LOC.getY(), START_LOC.getZ(), 0, world.getInstanceId()); + break; + } } } return super.onAdvEvent(event, npc, player); @@ -120,50 +117,28 @@ public final class LibraryOfSages extends AbstractNpcAI @Override public String onTalk(L2Npc npc, L2PcInstance talker) { - enterInstance(talker, "LibraryOfSages.xml"); + enterInstance(talker, new LoSWorld(), "LibraryOfSages.xml", TEMPLATE_ID); return super.onTalk(npc, talker); } - protected int enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof LoSWorld)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; - } - teleportPlayer(player, START_LOC, world.getInstanceId(), false); - spawnNPC(player, (LoSWorld) world); - return 0; + world.addAllowed(player.getObjectId()); } - // New instance - world = new LoSWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - ((LoSWorld) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Library of Sages started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // teleport players teleportPlayer(player, START_LOC, world.getInstanceId(), false); - world.addAllowed(player.getObjectId()); - spawnNPC(player, (LoSWorld) world); - return world.getInstanceId(); + spawnElcadia(player, (LoSWorld) world); } - protected void spawnNPC(L2PcInstance player, LoSWorld world) + private void spawnElcadia(L2PcInstance player, LoSWorld world) { - final L2Npc npc = addSpawn(ELCADIA_INSTANCE, player.getX(), player.getY(), player.getZ(), 0, false, 0, false, player.getInstanceId()); - world.elcadia = npc; - startQuestTimer("FOLLOW", 3000, npc, player); - } - - public static void main(String[] args) - { - new LibraryOfSages(); + if (world.elcadia != null) + { + world.elcadia.deleteMe(); + } + world.elcadia = addSpawn(ELCADIA_INSTANCE, player, false, 0, false, player.getInstanceId()); + startQuestTimer("FOLLOW", 3000, world.elcadia, player); } } diff --git a/L2J_DataPack/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java b/L2J_DataPack/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java index 50e2c9daf25b9ba5f5e13b1ac83a48eb9fd0cfb5..03467d4a985f74e2764845e5d27f56296fae37ba 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java @@ -18,8 +18,8 @@ */ package instances.MithrilMine; +import instances.AbstractInstance; import quests.Q10284_AcquisitionOfDivineSword.Q10284_AcquisitionOfDivineSword; -import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.instancemanager.InstanceManager; @@ -32,22 +32,19 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.network.NpcStringId; -import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.clientpackets.Say2; /** * Mithril Mine instance zone. * @author Adry_85 */ -public final class MithrilMine extends AbstractNpcAI +public final class MithrilMine extends AbstractInstance { protected class MMWorld extends InstanceWorld { - long storeTime = 0; - int _count = 0; + protected int _count = 0; } - private static final int TEMPLATE_ID = 138; // NPCs private static final int KEGOR = 18846; private static final int MITHRIL_MILLIPEDE = 22766; @@ -68,8 +65,10 @@ public final class MithrilMine extends AbstractNpcAI new Location(185920, -184544, -3308, -32544), new Location(185664, -184720, -3308, 27892) }; + // Misc + private static final int TEMPLATE_ID = 138; - private MithrilMine() + public MithrilMine() { super(MithrilMine.class.getSimpleName(), "instances"); addFirstTalkId(KEGOR); @@ -205,7 +204,7 @@ public final class MithrilMine extends AbstractNpcAI giveItems(talker, COLD_RESISTANCE_POTION, 1); } qs.setCond(4, true); - enterInstance(talker, "MithrilMine.xml", START_LOC); + enterInstance(talker, new MMWorld(), "MithrilMine.xml", TEMPLATE_ID); } break; } @@ -227,37 +226,13 @@ public final class MithrilMine extends AbstractNpcAI return super.onTalk(npc, talker); } - protected int enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - // check for existing instances for this player - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - // existing instance - if (world != null) + if (firstEntrance) { - if (!(world instanceof MMWorld)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return 0; - } - teleportPlayer(player, loc, world.getInstanceId(), false); - return 0; + world.addAllowed(player.getObjectId()); } - // New instance - world = new MMWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - ((MMWorld) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Mithril Mine started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // teleport players - teleportPlayer(player, loc, world.getInstanceId(), false); - world.addAllowed(player.getObjectId()); - return world.getInstanceId(); - } - - public static void main(String[] args) - { - new MithrilMine(); + teleportPlayer(player, START_LOC, world.getInstanceId(), false); } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java b/L2J_DataPack/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java index 391b458dd2706684113b9ad31062b85b8e1ee9da..a665544cbd8bcff8aa433a66cddda24ebb85e9cb 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java @@ -18,31 +18,28 @@ */ package instances.MonasteryOfSilence1; -import ai.npc.AbstractNpcAI; +import instances.AbstractInstance; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; -import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.network.NpcStringId; -import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.clientpackets.Say2; /** * Monastery of Silence instance zone. * @author Adry_85 */ -public final class MonasteryOfSilence1 extends AbstractNpcAI +public final class MonasteryOfSilence1 extends AbstractInstance { protected static final class MoSWorld extends InstanceWorld { protected L2Npc elcadia = null; } - private static final int TEMPLATE_ID = 151; // NPCs private static final int ELCADIA_INSTANCE = 32787; private static final int ERIS_EVIL_THOUGHTS = 32792; @@ -56,6 +53,13 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI private static final int TELEPORT_CONTROL_DEVICE2 = 32818; private static final int TELEPORT_CONTROL_DEVICE3 = 32819; private static final int TELEPORT_CONTROL_DEVICE4 = 32820; + // Skills + private static final SkillHolder[] BUFFS = + { + new SkillHolder(6725, 1), // Bless the Blood of Elcadia + new SkillHolder(6728, 1), // Recharge of Elcadia + new SkillHolder(6730, 1), // Greater Battle Heal of Elcadia + }; // Locations private static final Location START_LOC = new Location(120710, -86971, -3392); private static final Location EXIT_LOC = new Location(115983, -87351, -3397, 0, 0); @@ -72,72 +76,44 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI NpcStringId.WE_MUST_SEARCH_HIGH_AND_LOW_IN_EVERY_ROOM_FOR_THE_READING_DESK_THAT_CONTAINS_THE_BOOK_WE_SEEK, NpcStringId.REMEMBER_THE_CONTENT_OF_THE_BOOKS_THAT_YOU_FOUND_YOU_CANT_TAKE_THEM_OUT_WITH_YOU }; - // Buffs - private static final SkillHolder[] BUFFS = - { - new SkillHolder(6725, 1), // Bless the Blood of Elcadia - new SkillHolder(6728, 1), // Recharge of Elcadia - new SkillHolder(6730, 1), // Greater Battle Heal of Elcadia - }; + // Misc + private static final int TEMPLATE_ID = 151; - private MonasteryOfSilence1() + public MonasteryOfSilence1() { - super(MonasteryOfSilence1.class.getSimpleName(), "instances"); + super(MonasteryOfSilence1.class.getSimpleName()); addFirstTalkId(TELEPORT_CONTROL_DEVICE1, TELEPORT_CONTROL_DEVICE2, TELEPORT_CONTROL_DEVICE3, TELEPORT_CONTROL_DEVICE4, ERIS_EVIL_THOUGHTS); addStartNpc(ODD_GLOBE, TELEPORT_CONTROL_DEVICE1, TELEPORT_CONTROL_DEVICE2, TELEPORT_CONTROL_DEVICE3, TELEPORT_CONTROL_DEVICE4, ERIS_EVIL_THOUGHTS); addTalkId(ODD_GLOBE, ERIS_EVIL_THOUGHTS, RELIC_GUARDIAN, RELIC_WATCHER1, RELIC_WATCHER2, RELIC_WATCHER3, RELIC_WATCHER4, TELEPORT_CONTROL_DEVICE1, TELEPORT_CONTROL_DEVICE2, TELEPORT_CONTROL_DEVICE3, TELEPORT_CONTROL_DEVICE4, ERIS_EVIL_THOUGHTS); } - private void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) - { - if (!(world instanceof MoSWorld)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - } - else - { - // Teleport player. - teleportPlayer(player, START_LOC, world.getInstanceId(), false); - spawnNPC(player, (MoSWorld) world); - removeBuffs(player); - } - } - else + if (firstEntrance) { - // New instance. - world = new MoSWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - InstanceManager.getInstance().addWorld(world); - _log.info("Monastery of Silence started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // Teleport players. - teleportPlayer(player, START_LOC, world.getInstanceId(), false); - spawnNPC(player, (MoSWorld) world); - removeBuffs(player); world.addAllowed(player.getObjectId()); } + teleportPlayer(player, START_LOC, world.getInstanceId(), false); + spawnElcadia(player, (MoSWorld) world); } @Override public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) { - InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); + final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); if (!(tmpworld instanceof MoSWorld)) { return null; } - MoSWorld world = (MoSWorld) tmpworld; + final MoSWorld world = (MoSWorld) tmpworld; switch (event) { case "TELE2": { teleportPlayer(player, CENTRAL_ROOM_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(CENTRAL_ROOM_LOC.getX(), CENTRAL_ROOM_LOC.getY(), CENTRAL_ROOM_LOC.getZ(), 0, world.getInstanceId()); + world.elcadia.teleToLocation(CENTRAL_ROOM_LOC, 0, world.getInstanceId()); startQuestTimer("START_MOVIE", 2000, npc, player); break; } @@ -156,37 +132,37 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI case "BACK": { teleportPlayer(player, BACK_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(BACK_LOC.getX(), BACK_LOC.getY(), BACK_LOC.getZ(), 0, world.getInstanceId()); + world.elcadia.teleToLocation(BACK_LOC, 0, world.getInstanceId()); break; } case "EAST": { teleportPlayer(player, EAST_WATCHERS_ROOM_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(EAST_WATCHERS_ROOM_LOC.getX(), EAST_WATCHERS_ROOM_LOC.getY(), EAST_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId()); + world.elcadia.teleToLocation(EAST_WATCHERS_ROOM_LOC, 0, world.getInstanceId()); break; } case "WEST": { teleportPlayer(player, WEST_WATCHERS_ROOM_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(WEST_WATCHERS_ROOM_LOC.getX(), WEST_WATCHERS_ROOM_LOC.getY(), WEST_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId()); + world.elcadia.teleToLocation(WEST_WATCHERS_ROOM_LOC, 0, world.getInstanceId()); break; } case "NORTH": { teleportPlayer(player, NORTH_WATCHERS_ROOM_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(NORTH_WATCHERS_ROOM_LOC.getX(), NORTH_WATCHERS_ROOM_LOC.getY(), NORTH_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId()); + world.elcadia.teleToLocation(NORTH_WATCHERS_ROOM_LOC, 0, world.getInstanceId()); break; } case "SOUTH": { teleportPlayer(player, SOUTH_WATCHERS_ROOM_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(SOUTH_WATCHERS_ROOM_LOC.getX(), SOUTH_WATCHERS_ROOM_LOC.getY(), SOUTH_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId()); + world.elcadia.teleToLocation(SOUTH_WATCHERS_ROOM_LOC, 0, world.getInstanceId()); break; } case "CENTER": { teleportPlayer(player, CENTRAL_ROOM_LOC, world.getInstanceId()); - world.elcadia.teleToLocation(CENTRAL_ROOM_LOC.getX(), CENTRAL_ROOM_LOC.getY(), CENTRAL_ROOM_LOC.getZ(), 0, world.getInstanceId()); + world.elcadia.teleToLocation(CENTRAL_ROOM_LOC, 0, world.getInstanceId()); break; } case "FOLLOW": @@ -215,29 +191,18 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI { if (npc.getId() == ODD_GLOBE) { - enterInstance(talker, "MonasteryOfSilence.xml"); + enterInstance(talker, new MoSWorld(), "MonasteryOfSilence.xml", TEMPLATE_ID); } return super.onTalk(npc, talker); } - private static final void removeBuffs(L2Character ch) + protected void spawnElcadia(L2PcInstance player, MoSWorld world) { - ch.stopAllEffectsExceptThoseThatLastThroughDeath(); - if (ch.hasSummon()) + if (world.elcadia != null) { - ch.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); + world.elcadia.deleteMe(); } - } - - protected void spawnNPC(L2PcInstance player, MoSWorld world) - { - final L2Npc npc = addSpawn(ELCADIA_INSTANCE, player.getX(), player.getY(), player.getZ(), 0, false, 0, false, player.getInstanceId()); - world.elcadia = npc; - startQuestTimer("FOLLOW", 3000, npc, player); - } - - public static void main(String[] args) - { - new MonasteryOfSilence1(); + world.elcadia = addSpawn(ELCADIA_INSTANCE, player.getX(), player.getY(), player.getZ(), 0, false, 0, false, player.getInstanceId()); + startQuestTimer("FOLLOW", 3000, world.elcadia, player); } } diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java index ba55e5b93e63c7c597c6cfed7401329b361324bc..09b2a7960034719a985b6ded690dfa5dabb23a9c 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java @@ -18,6 +18,7 @@ */ package instances.NornilsGarden; +import instances.AbstractInstance; import quests.Q00179_IntoTheLargeCavern.Q00179_IntoTheLargeCavern; import com.l2jserver.gameserver.datatables.SkillData; @@ -30,7 +31,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; -import com.l2jserver.gameserver.model.quest.Quest; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.model.quest.State; import com.l2jserver.gameserver.model.skills.Skill; @@ -44,37 +44,39 @@ import com.l2jserver.gameserver.util.Util; * @author Gnacik * @version 2010-10-15 Based on official server Naia */ -public final class NornilsGarden extends Quest +public final class NornilsGarden extends AbstractInstance { protected class NornilsWorld extends InstanceWorld { - public L2Npc first_npc = null; - public boolean spawned_1 = false; - public boolean spawned_2 = false; - public boolean spawned_3 = false; - public boolean spawned_4 = false; + protected L2Npc first_npc = null; + protected boolean spawned_1 = false; + protected boolean spawned_2 = false; + protected boolean spawned_3 = false; + protected boolean spawned_4 = false; } - private static final int TEMPLATE_ID = 11; - - private static final int DURATION_TIME = 70; - private static final int EMPTY_DESTROY_TIME = 5; - - private static final int INSTANCE_LVL_MIN = 18; - private static final int INSTANCE_LVL_MAX = 22; - + // NPCs private static final int _garden_guard = 32330; - private static final int[] _final_gates = { 32260, 32261, 32262 }; - + // Skills + private static final Skill skill1 = SkillData.getInstance().getSkill(4322, 1); + private static final Skill skill2 = SkillData.getInstance().getSkill(4327, 1); + private static final Skill skill3 = SkillData.getInstance().getSkill(4329, 1); + private static final Skill skill4 = SkillData.getInstance().getSkill(4324, 1); + // Locations private static final Location SPAWN_PPL = new Location(-111184, 74540, -12430); private static final Location EXIT_PPL = new Location(-74058, 52040, -3680); - + // Misc + private static final int TEMPLATE_ID = 11; + private static final int DURATION_TIME = 70; + private static final int EMPTY_DESTROY_TIME = 5; + private static final int INSTANCE_LVL_MIN = 18; + private static final int INSTANCE_LVL_MAX = 22; private static final int[][] _auto_gates = { // Warriors gate @@ -93,14 +95,7 @@ public final class NornilsGarden extends Quest 16200013 } }; - - private static final Skill skill1 = SkillData.getInstance().getSkill(4322, 1); - private static final Skill skill2 = SkillData.getInstance().getSkill(4327, 1); - private static final Skill skill3 = SkillData.getInstance().getSkill(4329, 1); - private static final Skill skill4 = SkillData.getInstance().getSkill(4324, 1); - private static final int _herb_jar = 18478; - // @formatter:off private static final int[][] _gatekeepers = { @@ -116,7 +111,6 @@ public final class NornilsGarden extends Quest { 18361, 9711, 0 }, // Guardian of Prediction { 25528, 9712, 0 } // Tiberias }; - private static final int[][] HP_HERBS_DROPLIST = { // itemId, count, chance @@ -124,7 +118,6 @@ public final class NornilsGarden extends Quest { 8601, 2, 40 }, { 8600, 3, 70 } }; - private static final int[][] _group_1 = { { 18363, -109899, 74431, -12528, 16488 }, @@ -133,7 +126,6 @@ public final class NornilsGarden extends Quest { 18363, -109703, 74879, -12528, 49336 } }; - private static final int[][] _group_2 = { { 18363, -110393, 78276, -12848, 49152 }, @@ -145,7 +137,6 @@ public final class NornilsGarden extends Quest { 18483, -110389, 79131, -12915, 48539 }, { 18483, -110551, 79134, -12915, 49151 } }; - private static final int[][] _group_3 = { { 18483, -107798, 80721, -12912, 0 }, @@ -155,8 +146,7 @@ public final class NornilsGarden extends Quest { 18483, -108740, 80752, -12912, 0 }, { 18363, -109016, 80642, -12912, 0 }, { 18483, -108740, 80546, -12912, 0 } - }; - + }; private static final int[][] _group_4 = { { 18362, -110082, 83998, -12928, 0 }, @@ -169,7 +159,6 @@ public final class NornilsGarden extends Quest { 18362, -109122, 84490, -12880, 0 }, { 18347, -108939, 84489, -12880, 0 } }; - private static final int[][] MP_HERBS_DROPLIST = { // itemId, count, chance @@ -191,11 +180,6 @@ public final class NornilsGarden extends Quest } } - private static final void removeBuffs(L2Character ch) - { - ch.stopAllEffectsExceptThoseThatLastThroughDeath(); - } - private static final void giveBuffs(L2Character ch) { if (skill1 != null) @@ -216,9 +200,9 @@ public final class NornilsGarden extends Quest } } - private NornilsGarden() + public NornilsGarden() { - super(-1, NornilsGarden.class.getSimpleName(), "instances"); + super(NornilsGarden.class.getSimpleName()); addStartNpc(_garden_guard); addFirstTalkId(_garden_guard); addTalkId(_garden_guard); @@ -238,11 +222,9 @@ public final class NornilsGarden extends Quest @Override public final void teleportPlayer(L2PcInstance player, Location loc, int instanceId) { - removeBuffs(player); giveBuffs(player); if (player.hasSummon()) { - removeBuffs(player.getSummon()); giveBuffs(player.getSummon()); } super.teleportPlayer(player, loc, instanceId); @@ -266,19 +248,19 @@ public final class NornilsGarden extends Quest { if (!(world instanceof NornilsWorld) || (world.getTemplateId() != TEMPLATE_ID)) { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); + player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return null; } // check for level difference again on reenter if ((player.getLevel() > INSTANCE_LVL_MAX) || (player.getLevel() < INSTANCE_LVL_MIN)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(player); player.sendPacket(sm); return null; } // check what instance still exist - Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); + final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); if (inst != null) { teleportPlayer(player, SPAWN_PPL, world.getInstanceId()); @@ -437,21 +419,21 @@ public final class NornilsGarden extends Quest // player level must be in range if (partyMember.getLevel() > INSTANCE_LVL_MAX) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-06.html"; } if (partyMember.getLevel() < INSTANCE_LVL_MIN) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-07.html"; } if (partyMember.getClassId().level() != 0) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_LEVEL_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-06.html"; @@ -459,7 +441,7 @@ public final class NornilsGarden extends Quest // player must be near party leader if (!partyMember.isInsideRadius(player, 500, true, true)) { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_LOCATION_THAT_CANNOT_BE_ENTERED); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-08.html"; @@ -473,7 +455,7 @@ public final class NornilsGarden extends Quest } else { - SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_QUEST_REQUIREMENT_NOT_SUFFICIENT); + SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED); sm.addPcName(partyMember); player.sendPacket(sm); return "32330-08.html"; @@ -656,8 +638,9 @@ public final class NornilsGarden extends Quest return super.onKill(npc, player, isSummon); } - public static void main(String[] args) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - new NornilsGarden(); + } } diff --git a/L2J_DataPack/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java b/L2J_DataPack/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java index cface7af2d5c9bd5f1263db65f94707cbe92b2a8..4581a138b3e056d7f4743b8c96c9b9b69c281059 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java @@ -18,11 +18,12 @@ */ package instances.PailakaDevilsLegacy; +import instances.AbstractInstance; + import java.util.List; import java.util.concurrent.CopyOnWriteArrayList; import quests.Q00129_PailakaDevilsLegacy.Q00129_PailakaDevilsLegacy; -import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.ai.CtrlIntention; import com.l2jserver.gameserver.instancemanager.InstanceManager; @@ -35,18 +36,17 @@ import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.model.zone.L2ZoneType; -import com.l2jserver.gameserver.network.SystemMessageId; /** * Pailaka Devil's Legacy Instance zone. * @author St3eT */ -public final class PailakaDevilsLegacy extends AbstractNpcAI +public final class PailakaDevilsLegacy extends AbstractInstance { protected class DIWorld extends InstanceWorld { - L2Attackable _lematanNpc = null; - List<L2Attackable> _followerslist = new CopyOnWriteArrayList<>(); + protected L2Attackable _lematanNpc = null; + protected List<L2Attackable> _followerslist = new CopyOnWriteArrayList<>(); } // NPCs @@ -88,9 +88,9 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI private static final int TEMPLATE_ID = 44; private static final int ZONE = 20109; - private PailakaDevilsLegacy() + public PailakaDevilsLegacy() { - super(PailakaDevilsLegacy.class.getSimpleName(), "instances"); + super(PailakaDevilsLegacy.class.getSimpleName()); addTalkId(SURVIVOR); addAttackId(POWDER_KEG, TREASURE_BOX, LEMATAN); addKillId(LEMATAN); @@ -108,7 +108,7 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI if (event.equals("enter")) { final QuestState qs = player.getQuestState(Q00129_PailakaDevilsLegacy.class.getSimpleName()); - enterInstance(player, "PailakaDevilsLegacy.xml"); + enterInstance(player, new DIWorld(), "PailakaDevilsLegacy.xml", TEMPLATE_ID); if (qs.isCond(1)) { qs.setCond(2, true); @@ -304,32 +304,19 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI } } - private void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - - if (world != null) + if (firstEntrance) { - if (world instanceof DIWorld) - { - teleportPlayer(player, TELEPORT, world.getInstanceId()); - return; - } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; + world.addAllowed(player.getObjectId()); + ((DIWorld) world)._lematanNpc = (L2Attackable) addSpawn(LEMATAN, LEMATAN_SPAWN, false, 0, false, world.getInstanceId()); } - world = new DIWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - InstanceManager.getInstance().addWorld(world); - world.addAllowed(player.getObjectId()); teleportPlayer(player, TELEPORT, world.getInstanceId()); - ((DIWorld) world)._lematanNpc = (L2Attackable) addSpawn(LEMATAN, LEMATAN_SPAWN, false, 0, false, world.getInstanceId()); - _log.info("Pailaka Devils Legacy" + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); } public static void main(String[] args) { new PailakaDevilsLegacy(); } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java b/L2J_DataPack/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java index 4f39583571f916fb3b08c9c5a784e5143cec3249..444f9e3f7ff4708b953a922983379f06f208eb27 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java @@ -18,7 +18,7 @@ */ package instances.PailakaSongOfIceAndFire; -import ai.npc.AbstractNpcAI; +import instances.AbstractInstance; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.Location; @@ -28,14 +28,13 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.model.zone.L2ZoneType; import com.l2jserver.gameserver.network.NpcStringId; -import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.clientpackets.Say2; /** * Pailaka Song of Ice and Fire Instance zone. * @author Gnacik, St3eT */ -public final class PailakaSongOfIceAndFire extends AbstractNpcAI +public final class PailakaSongOfIceAndFire extends AbstractInstance { protected class PSoIWorld extends InstanceWorld { @@ -59,9 +58,9 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI private static final int TEMPLATE_ID = 43; private static final int ZONE = 20108; - private PailakaSongOfIceAndFire() + public PailakaSongOfIceAndFire() { - super(PailakaSongOfIceAndFire.class.getSimpleName(), "instances"); + super(PailakaSongOfIceAndFire.class.getSimpleName()); addStartNpc(ADLER1); addTalkId(ADLER1); addAttackId(BOTTLE, BRAZIER); @@ -71,27 +70,14 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI addKillId(BLOOM); } - private void enterInstance(L2PcInstance player, String template) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - - if (world != null) + if (firstEntrance) { - if (world instanceof PSoIWorld) - { - teleportPlayer(player, TELEPORT, world.getInstanceId()); - return; - } - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - return; + world.addAllowed(player.getObjectId()); } - world = new PSoIWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - InstanceManager.getInstance().addWorld(world); - world.addAllowed(player.getObjectId()); teleportPlayer(player, TELEPORT, world.getInstanceId()); - _log.info("Pailaka Song of Ice and Fire" + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); } @Override @@ -101,7 +87,7 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI { case "enter": { - enterInstance(player, "PailakaSongOfIceAndFire.xml"); + enterInstance(player, new PSoIWorld(), "PailakaSongOfIceAndFire.xml", TEMPLATE_ID); break; } case "GARGOS_LAUGH": @@ -218,9 +204,4 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI startQuestTimer("BLOOM_TIMER", 1000, npc, null); return super.onSpawn(npc); } - - public static void main(String[] args) - { - new PailakaSongOfIceAndFire(); - } -} \ No newline at end of file +} diff --git a/L2J_DataPack/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java b/L2J_DataPack/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java index 2c9af067eda97311459859b3e268834c53da2082..7430c16043c12eea49cfb43367bf5e1df0b5b1bb 100644 --- a/L2J_DataPack/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java +++ b/L2J_DataPack/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java @@ -18,37 +18,36 @@ */ package instances.SanctumOftheLordsOfDawn; +import instances.AbstractInstance; + import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import quests.Q00195_SevenSignsSecretRitualOfThePriests.Q00195_SevenSignsSecretRitualOfThePriests; -import ai.npc.AbstractNpcAI; import com.l2jserver.gameserver.instancemanager.InstanceManager; import com.l2jserver.gameserver.model.L2World; import com.l2jserver.gameserver.model.Location; import com.l2jserver.gameserver.model.actor.L2Npc; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; -import com.l2jserver.gameserver.model.entity.Instance; import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.instancezone.InstanceWorld; import com.l2jserver.gameserver.model.quest.QuestState; import com.l2jserver.gameserver.network.NpcStringId; import com.l2jserver.gameserver.network.SystemMessageId; +import com.l2jserver.gameserver.network.clientpackets.Say2; import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse; -import com.l2jserver.gameserver.network.serverpackets.NpcSay; /** * Sanctum of the Lords of Dawn instance zone. * @author Adry_85 */ -public final class SanctumOftheLordsOfDawn extends AbstractNpcAI +public final class SanctumOftheLordsOfDawn extends AbstractInstance { protected static final class HSWorld extends InstanceWorld { - protected long storeTime = 0; protected int doorst = 0; protected final static Map<Integer, List<L2Npc>> _save_point = new HashMap<>(); @@ -58,8 +57,6 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI } } - // Instance - private static final int TEMPLATE_ID = 111; // NPCs private static final int GUARDS_OF_THE_DAWN = 18834; private static final int GUARDS_OF_THE_DAWN_2 = 18835; @@ -69,10 +66,6 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI private static final int IDENTITY_CONFIRM_DEVICE = 32578; private static final int DARKNESS_OF_DAWN = 32579; private static final int SHELF = 32580; - // Doors - private static int DOOR_ONE = 17240001; - private static int DOOR_TWO = 17240003; - private static int DOOR_THREE = 17240005; // Item private static final int IDENTITY_CARD = 13822; // Skill @@ -80,7 +73,11 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI // Locations private static final Location ENTER = new Location(-76161, 213401, -7120, 0, 0); private static final Location EXIT = new Location(-12585, 122305, -2989, 0, 0); - + // Misc + private static final int TEMPLATE_ID = 111; + private static int DOOR_ONE = 17240001; + private static int DOOR_TWO = 17240003; + private static int DOOR_THREE = 17240005; private static final Location[] SAVE_POINT = new Location[] { new Location(-75775, 213415, -7120), @@ -89,9 +86,9 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI new Location(-79939, 205857, -7888), }; - private SanctumOftheLordsOfDawn() + public SanctumOftheLordsOfDawn() { - super(SanctumOftheLordsOfDawn.class.getSimpleName(), "instances"); + super(SanctumOftheLordsOfDawn.class.getSimpleName()); addStartNpc(LIGHT_OF_DAWN); addTalkId(LIGHT_OF_DAWN, IDENTITY_CONFIRM_DEVICE, PASSWORD_ENTRY_DEVICE, DARKNESS_OF_DAWN, SHELF); addAggroRangeEnterId(GUARDS_OF_THE_DAWN, GUARDS_OF_THE_DAWN_2, GUARDS_OF_THE_DAWN_3); @@ -104,13 +101,12 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI { case "spawn": { - InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); + final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); if (tmpworld instanceof HSWorld) - { - HSWorld world = (HSWorld) tmpworld; - Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - inst.spawnGroup("high_priest_of_dawn"); - player.sendPacket(SystemMessageId.SNEAK_INTO_DAWNS_DOCUMENT_STORAGE); + { + final HSWorld world = (HSWorld) tmpworld; + spawnGroup("high_priest_of_dawn", world.getInstanceId()); + player.sendPacket(SystemMessageId.BY_USING_THE_SKILL_OF_EINHASAD_S_HOLY_SWORD_DEFEAT_THE_EVIL_LILIMS); } break; } @@ -120,23 +116,22 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI { case GUARDS_OF_THE_DAWN: { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.INTRUDER_PROTECT_THE_PRIESTS_OF_DAWN)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.INTRUDER_PROTECT_THE_PRIESTS_OF_DAWN); break; } case GUARDS_OF_THE_DAWN_2: { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.HOW_DARE_YOU_INTRUDE_WITH_THAT_TRANSFORMATION_GET_LOST)); + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HOW_DARE_YOU_INTRUDE_WITH_THAT_TRANSFORMATION_GET_LOST); break; } case GUARDS_OF_THE_DAWN_3: - { - npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.WHO_ARE_YOU_A_NEW_FACE_LIKE_YOU_CANT_APPROACH_THIS_PLACE)); + { + broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WHO_ARE_YOU_A_NEW_FACE_LIKE_YOU_CAN_T_APPROACH_THIS_PLACE); break; } } - OUTTER: - for (Entry<Integer, List<L2Npc>> entry : HSWorld._save_point.entrySet()) + OUTTER: for (Entry<Integer, List<L2Npc>> entry : HSWorld._save_point.entrySet()) { for (L2Npc monster : entry.getValue()) { @@ -152,40 +147,19 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI return super.onAdvEvent(event, npc, player); } - private void enterInstance(L2PcInstance player, String template, Location loc) + @Override + public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) { - InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); - if (world != null) - { - if (!(world instanceof HSWorld)) - { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); - } - else - { - teleportPlayer(player, loc, world.getInstanceId()); - } - } - else - { - // New instance, - world = new HSWorld(); - world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template)); - world.setTemplateId(TEMPLATE_ID); - world.setStatus(0); - ((HSWorld) world).storeTime = System.currentTimeMillis(); - InstanceManager.getInstance().addWorld(world); - _log.info("Sanctum of the Lords of Dawn started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName()); - // Teleport players. - teleportPlayer(player, loc, world.getInstanceId()); + if (firstEntrance) + { world.addAllowed(player.getObjectId()); final Map<Integer, List<L2Npc>> save_point = HSWorld.getMonsters(); - final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); - save_point.put(0, inst.spawnGroup("save_point1")); - save_point.put(1, inst.spawnGroup("save_point2")); - save_point.put(2, inst.spawnGroup("save_point3")); - save_point.put(3, inst.spawnGroup("save_point4")); + save_point.put(0, spawnGroup("save_point1", world.getInstanceId())); + save_point.put(1, spawnGroup("save_point2", world.getInstanceId())); + save_point.put(2, spawnGroup("save_point3", world.getInstanceId())); + save_point.put(3, spawnGroup("save_point4", world.getInstanceId())); } + teleportPlayer(player, ENTER, world.getInstanceId()); } @Override @@ -198,19 +172,19 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI final QuestState qs = talker.getQuestState(Q00195_SevenSignsSecretRitualOfThePriests.class.getSimpleName()); if ((qs != null) && qs.isCond(3) && hasQuestItems(talker, IDENTITY_CARD) && (talker.getTransformationId() == 113)) { - enterInstance(talker, "SanctumoftheLordsofDawn.xml", ENTER); + enterInstance(talker, new HSWorld(), "SanctumoftheLordsofDawn.xml", TEMPLATE_ID); return "32575-01.html"; } return "32575-02.html"; } case IDENTITY_CONFIRM_DEVICE: { - InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if (tmpworld instanceof HSWorld) { if (hasQuestItems(talker, IDENTITY_CARD) && (talker.getTransformationId() == 113)) { - HSWorld world = (HSWorld) tmpworld; + final HSWorld world = (HSWorld) tmpworld; if (world.doorst == 0) { openDoor(DOOR_ONE, world.getInstanceId()); @@ -227,7 +201,7 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI npc.decayMe(); for (int objId : world.getAllowed()) { - L2PcInstance pl = L2World.getInstance().getPlayer(objId); + final L2PcInstance pl = L2World.getInstance().getPlayer(objId); if (pl != null) { pl.showQuestMovie(11); @@ -243,10 +217,10 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI } case PASSWORD_ENTRY_DEVICE: { - InstanceWorld tmworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld tmworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); if (tmworld instanceof HSWorld) { - HSWorld world = (HSWorld) tmworld; + final HSWorld world = (HSWorld) tmworld; openDoor(DOOR_THREE, world.getInstanceId()); return "32577-01.html"; } @@ -261,7 +235,7 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI } case SHELF: { - InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); + final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); InstanceManager.getInstance().getInstance(world.getInstanceId()).setDuration(300000); talker.teleToLocation(-75925, 213399, -7128); return "32580-01.html"; @@ -277,9 +251,4 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI startQuestTimer("teleportPlayer", 2000, npc, player); return super.onAggroRangeEnter(npc, player, isSummon); } - - public static void main(String[] args) - { - new SanctumOftheLordsOfDawn(); - } -} +} diff --git a/L2J_DataPack/dist/game/data/scripts/quests/Q00196_SevenSignsSealOfTheEmperor/Q00196_SevenSignsSealOfTheEmperor.java b/L2J_DataPack/dist/game/data/scripts/quests/Q00196_SevenSignsSealOfTheEmperor/Q00196_SevenSignsSealOfTheEmperor.java index 05b2b93e6c8655d1a3be63aa7c3a429be1f0a436..cebc611f0f3130bb3ca6ae30148e008af6c0e284 100644 --- a/L2J_DataPack/dist/game/data/scripts/quests/Q00196_SevenSignsSealOfTheEmperor/Q00196_SevenSignsSealOfTheEmperor.java +++ b/L2J_DataPack/dist/game/data/scripts/quests/Q00196_SevenSignsSealOfTheEmperor/Q00196_SevenSignsSealOfTheEmperor.java @@ -170,7 +170,7 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest giveItems(player, ELMOREDEN_HOLY_WATER, 1); giveItems(player, SACRED_SWORD_OF_EINHASAD, 1); st.setCond(4, true); - player.sendPacket(SystemMessageId.USING_EINHASAD_HOLY_SWORD_DEFEAT_LILIMS); + player.sendPacket(SystemMessageId.BY_USING_THE_SKILL_OF_EINHASAD_S_HOLY_SWORD_DEFEAT_THE_EVIL_LILIMS); player.sendPacket(SystemMessageId.USING_EINHASAD_HOLY_WATER_TO_OPEN_DOOR); htmltext = event; } @@ -331,7 +331,7 @@ public final class Q00196_SevenSignsSealOfTheEmperor extends Quest htmltext = "32586-09.html"; giveItems(player, SACRED_SWORD_OF_EINHASAD, 1); } - player.sendPacket(SystemMessageId.USING_EINHASAD_HOLY_SWORD_DEFEAT_LILIMS); + player.sendPacket(SystemMessageId.BY_USING_THE_SKILL_OF_EINHASAD_S_HOLY_SWORD_DEFEAT_THE_EVIL_LILIMS); player.sendPacket(SystemMessageId.USING_EINHASAD_HOLY_WATER_TO_OPEN_DOOR); } else diff --git a/L2J_DataPack/dist/game/data/scripts/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java b/L2J_DataPack/dist/game/data/scripts/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java index be52bfd9c0ac3c4ce5090316f6830e4cff74c9c2..c1e3acda4743ad4c1e3bcb182ed8346f7efcadd1 100644 --- a/L2J_DataPack/dist/game/data/scripts/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java +++ b/L2J_DataPack/dist/game/data/scripts/quests/Q00511_AwlUnderFoot/Q00511_AwlUnderFoot.java @@ -271,7 +271,7 @@ public final class Q00511_AwlUnderFoot extends Quest { if (!(world instanceof FAUWorld)) { - player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); + player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON); return ""; } teleportPlayer(player, coords, world.getInstanceId()); diff --git a/L2J_DataPack/dist/game/data/xsd/instance.xsd b/L2J_DataPack/dist/game/data/xsd/instance.xsd index e6550d6ff224213115afd92c56440b1e9d30de91..2325d5b0e0cdddd9c60b698ddfa2c6eb9ef7f7a9 100644 --- a/L2J_DataPack/dist/game/data/xsd/instance.xsd +++ b/L2J_DataPack/dist/game/data/xsd/instance.xsd @@ -37,6 +37,61 @@ <xs:attribute name="spawnZ" type="xs:integer" use="required" /> </xs:complexType> </xs:element> + <xs:element name="reenter" minOccurs="0" maxOccurs="1"> + <xs:complexType> + <xs:sequence> + <xs:element name="reset" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:attribute name="day"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="Monday" /> + <xs:enumeration value="Tuesday" /> + <xs:enumeration value="Wednesday" /> + <xs:enumeration value="Thursday" /> + <xs:enumeration value="Friday" /> + <xs:enumeration value="Saturday" /> + <xs:enumeration value="Sunday" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + <xs:attribute name="time" type="xs:long" /> + <xs:attribute name="hour" type="xs:positiveInteger" /> + <xs:attribute name="minute" type="xs:positiveInteger" /> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="additionStyle"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="NONE" /> + <xs:enumeration value="ON_INSTANCE_ENTER" /> + <xs:enumeration value="ON_INSTANCE_FINISH" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> + <xs:element name="removeBuffs" minOccurs="0" maxOccurs="1"> + <xs:complexType> + <xs:sequence> + <xs:element name="skill" minOccurs="0" maxOccurs="unbounded"> + <xs:complexType> + <xs:attribute name="id" type="xs:integer" /> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="type"> + <xs:simpleType> + <xs:restriction base="xs:token"> + <xs:enumeration value="ALL" /> + <xs:enumeration value="WHITELIST" /> + <xs:enumeration value="BLACKLIST" /> + </xs:restriction> + </xs:simpleType> + </xs:attribute> + </xs:complexType> + </xs:element> <xs:element name="doorlist" minOccurs="0" maxOccurs="1"> <xs:complexType> <xs:sequence minOccurs="1" maxOccurs="1"> @@ -97,4 +152,4 @@ <xs:attribute name="allowRandomWalk" type="xs:boolean" /> </xs:complexType> </xs:element> -</xs:schema> \ No newline at end of file +</xs:schema>