Last active
August 29, 2015 14:06
-
-
Save LucusAngel/b836d5d4a56c196dee1f to your computer and use it in GitHub Desktop.
Abstract for Instances
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Eclipse Workspace Patch 1.0 | |
#P L2J_DataPack | |
Index: dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java (revision 18149) | |
+++ dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java (working copy) | |
@@ -49,14 +49,9 @@ | |
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 | |
Index: dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java (revision 18149) | |
+++ dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java (working copy) | |
@@ -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 @@ | |
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(); | |
+ teleportPlayer(player, START_LOC, world.getInstanceId(), false); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new JiniaGuildHideout4(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/instances/MonasteryOfSilence.xml | |
=================================================================== | |
--- dist/game/data/instances/MonasteryOfSilence.xml (revision 18149) | |
+++ dist/game/data/instances/MonasteryOfSilence.xml (working copy) | |
@@ -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 --> | |
Index: dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java (revision 18149) | |
+++ dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java (working copy) | |
@@ -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 @@ | |
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(); | |
+ teleportPlayer(player, START_LOC, world.getInstanceId(), false); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new JiniaGuildHideout3(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java (revision 18149) | |
+++ dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java (working copy) | |
@@ -49,14 +49,9 @@ | |
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 | |
Index: dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java (revision 18149) | |
+++ dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java (working copy) | |
@@ -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 @@ | |
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(); | |
+ teleportPlayer(player, START_LOC, world.getInstanceId(), false); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new JiniaGuildHideout2(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/scripts.cfg | |
=================================================================== | |
--- dist/game/data/scripts.cfg (revision 18149) | |
+++ dist/game/data/scripts.cfg (working copy) | |
@@ -168,34 +168,9 @@ | |
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 | |
+# Instance Section | |
+instances/InstanceLoader.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 | |
# Gracia Section | |
gracia/GraciaLoader.java | |
Index: dist/game/data/scripts/instances/Kamaloka/Kamaloka.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/Kamaloka/Kamaloka.java (revision 18149) | |
+++ dist/game/data/scripts/instances/Kamaloka/Kamaloka.java (working copy) | |
@@ -18,33 +18,35 @@ | |
*/ | |
package instances.Kamaloka; | |
+import instances.AbstractInstance; | |
+ | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
-import java.util.Calendar; | |
import java.util.List; | |
import java.util.Map; | |
import java.util.function.Function; | |
import java.util.logging.Level; | |
import com.l2jserver.gameserver.datatables.SkillData; | |
+import com.l2jserver.gameserver.enums.InstanceRestrictionType; | |
import com.l2jserver.gameserver.instancemanager.InstanceManager; | |
import com.l2jserver.gameserver.model.L2Party; | |
import com.l2jserver.gameserver.model.L2Spawn; | |
-import com.l2jserver.gameserver.model.L2World; | |
import com.l2jserver.gameserver.model.Location; | |
+import com.l2jserver.gameserver.model.PcCondOverride; | |
import com.l2jserver.gameserver.model.actor.L2Character; | |
import com.l2jserver.gameserver.model.actor.L2Npc; | |
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.holders.InstanceReenterTimeHolder; | |
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 | |
@@ -58,11 +60,6 @@ | |
private static final int EMPTY_DESTROY_TIME = 5; | |
/* | |
- * Time to destroy instance (and eject players away) after boss defeat Default: 5 minutes | |
- */ | |
- private static final int EXIT_TIME = 5; | |
- | |
- /* | |
* Maximum level difference between players level and kamaloka level Default: 5 | |
*/ | |
private static final int MAX_LEVEL_DIFFERENCE = 5; | |
@@ -1178,7 +1175,7 @@ | |
private Kamaloka() | |
{ | |
- super(-1, Kamaloka.class.getSimpleName(), "instances"); | |
+ super(Kamaloka.class.getSimpleName()); | |
addFirstTalkId(TELEPORTER); | |
addTalkId(TELEPORTER); | |
for (int cap : CAPTAINS) | |
@@ -1228,6 +1225,11 @@ | |
*/ | |
private static final boolean checkConditions(L2PcInstance player, int index) | |
{ | |
+ if (player.isGM() && player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) | |
+ { | |
+ return true; | |
+ } | |
+ | |
final L2Party party = player.getParty(); | |
// player must be in party | |
if (party == null) | |
@@ -1303,7 +1305,7 @@ | |
* Removing all buffs from player and pet except BUFFS_WHITELIST | |
* @param ch player | |
*/ | |
- private static final void removeBuffs(L2Character ch) | |
+ protected final void removeBuffs(L2Character ch) | |
{ | |
Function<BuffInfo, Boolean> removeBuffs = info -> | |
{ | |
@@ -1385,6 +1387,8 @@ | |
// set duration and empty destroy time | |
inst.setDuration(DURATION[index] * 60000); | |
inst.setEmptyDestroyTime(EMPTY_DESTROY_TIME * 60000); | |
+ inst.setAdditionStyle(InstanceRestrictionType.onInstanceFinish); | |
+ inst.getReenterData().add(new InstanceReenterTimeHolder(null, RESET_HOUR, RESET_MIN)); | |
// Creating new instanceWorld, using our instanceId and templateId | |
world = new KamaWorld(); | |
@@ -1399,51 +1403,22 @@ | |
// and finally teleport party into instance | |
final L2Party party = player.getParty(); | |
- for (L2PcInstance partyMember : party.getMembers()) | |
+ if (party == null) | |
{ | |
- world.addAllowed(partyMember.getObjectId()); | |
- removeBuffs(partyMember); | |
- teleportPlayer(partyMember, TELEPORTS[index], instanceId); | |
+ world.addAllowed(player.getObjectId()); | |
+ removeBuffs(player); | |
+ teleportPlayer(player, TELEPORTS[index], instanceId); | |
} | |
- return; | |
- } | |
- | |
- /** | |
- * Called on instance finish and handles reenter time for instance | |
- * @param world instanceWorld | |
- */ | |
- private static final void finishInstance(InstanceWorld world) | |
- { | |
- if (world instanceof KamaWorld) | |
+ else | |
{ | |
- Calendar reenter = Calendar.getInstance(); | |
- reenter.set(Calendar.MINUTE, RESET_MIN); | |
- // if time is >= RESET_HOUR - roll to the next day | |
- if (reenter.get(Calendar.HOUR_OF_DAY) >= RESET_HOUR) | |
+ for (L2PcInstance partyMember : party.getMembers()) | |
{ | |
- reenter.add(Calendar.DATE, 1); | |
+ world.addAllowed(partyMember.getObjectId()); | |
+ removeBuffs(partyMember); | |
+ teleportPlayer(partyMember, TELEPORTS[index], instanceId); | |
} | |
- reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR); | |
- | |
- 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 obj = L2World.getInstance().getPlayer(objectId); | |
- if ((obj != null) && obj.isOnline()) | |
- { | |
- InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis()); | |
- obj.sendPacket(sm); | |
- } | |
- } | |
- | |
- // destroy instance after EXIT_TIME | |
- Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId()); | |
- inst.setDuration(EXIT_TIME * 60000); | |
- inst.setEmptyDestroyTime(0); | |
} | |
+ return; | |
} | |
/** | |
Index: dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java (revision 18149) | |
+++ dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java (working copy) | |
@@ -18,6 +18,8 @@ | |
*/ | |
package instances.CrystalCaverns; | |
+import instances.AbstractInstance; | |
+ | |
import java.util.List; | |
import java.util.Map; | |
@@ -34,6 +36,7 @@ | |
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; | |
@@ -44,7 +47,6 @@ | |
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; | |
@@ -70,13 +72,13 @@ | |
* 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 | |
@@ -127,9 +129,6 @@ | |
} | |
} | |
- 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; | |
@@ -140,7 +139,6 @@ | |
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; | |
@@ -155,18 +153,15 @@ | |
-11886, | |
16384 | |
}; | |
- | |
- // mobs | |
+ // Monsters | |
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; | |
@@ -174,7 +169,6 @@ | |
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 = | |
{ | |
@@ -220,8 +214,11 @@ | |
22419, | |
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; | |
@@ -234,1239 +231,264 @@ | |
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 | |
+ // TODO: Rework to XML | |
+ // Format: npcId, x, y, z, heading | |
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, 152575, -12169, 31613}, | |
- { | |
- 32274, | |
- 149783, | |
- 152645, | |
- -12169, | |
- 31613 | |
- }, | |
- { | |
- 32276, | |
- 149783, | |
- 152715, | |
- -12169, | |
- 31613 | |
- } | |
+ {32274, 149783, 152505, -12169, 31613}, | |
+ // {32274, 149783, 152575, -12169, 31613}, | |
+ {32274, 149783, 152645, -12169, 31613}, | |
+ {32276, 149783, 152715, -12169, 31613} | |
}; | |
- | |
private static final int[][] ordreOracle3 = | |
{ | |
- { | |
- 32274, | |
- 152461, | |
- 152505, | |
- -12169, | |
- 31613 | |
- }, | |
- // {32274, 152461, 152575, -12169, 31613}, | |
- { | |
- 32277, | |
- 152461, | |
- 152645, | |
- -12169, | |
- 31613 | |
- } | |
- // {32274, 152461, 152715, -12169, 31613} | |
+ {32274, 152461, 152505, -12169, 31613}, | |
+ // {32274, 152461, 152575, -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) | |
@@ -1476,13 +498,15 @@ | |
} | |
} | |
- 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); | |
@@ -1502,7 +526,7 @@ | |
party.broadcastPacket(sm); | |
return false; | |
} | |
- L2ItemInstance item = partyMember.getInventory().getItemByItemId(CONT_CRYSTAL); | |
+ final L2ItemInstance item = partyMember.getInventory().getItemByItemId(CONT_CRYSTAL); | |
if (item == null) | |
{ | |
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT); | |
@@ -1517,7 +541,7 @@ | |
party.broadcastPacket(sm); | |
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); | |
@@ -1535,7 +559,7 @@ | |
{ | |
return true; | |
} | |
- L2Party party = player.getParty(); | |
+ final L2Party party = player.getParty(); | |
if (party == null) | |
{ | |
player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); | |
@@ -1548,7 +572,7 @@ | |
} | |
for (L2PcInstance partyMember : party.getMembers()) | |
{ | |
- L2ItemInstance item = partyMember.getInventory().getItemByItemId(RED_CORAL); | |
+ final L2ItemInstance item = partyMember.getInventory().getItemByItemId(RED_CORAL); | |
if (item == null) | |
{ | |
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT); | |
@@ -1569,7 +593,7 @@ | |
private boolean checkBaylorConditions(L2PcInstance player) | |
{ | |
- L2Party party = player.getParty(); | |
+ final L2Party party = player.getParty(); | |
if (party == null) | |
{ | |
player.sendPacket(SystemMessageId.NOT_IN_PARTY_CANT_ENTER); | |
@@ -1582,9 +606,9 @@ | |
} | |
for (L2PcInstance partyMember : party.getMembers()) | |
{ | |
- L2ItemInstance item1 = partyMember.getInventory().getItemByItemId(BOSS_CRYSTAL_1); | |
- L2ItemInstance item2 = partyMember.getInventory().getItemByItemId(BOSS_CRYSTAL_2); | |
- L2ItemInstance item3 = partyMember.getInventory().getItemByItemId(BOSS_CRYSTAL_3); | |
+ final L2ItemInstance item1 = partyMember.getInventory().getItemByItemId(BOSS_CRYSTAL_1); | |
+ final L2ItemInstance item2 = partyMember.getInventory().getItemByItemId(BOSS_CRYSTAL_2); | |
+ final L2ItemInstance item3 = partyMember.getInventory().getItemByItemId(BOSS_CRYSTAL_3); | |
if ((item1 == null) || (item2 == null) || (item3 == null)) | |
{ | |
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_ITEM_REQUIREMENT_NOT_SUFFICIENT); | |
@@ -1655,55 +679,33 @@ | |
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(); | |
+ 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); | |
} | |
- | |
- // 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 : 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) | |
@@ -1714,8 +716,8 @@ | |
player.breakAttack(); | |
player.breakCast(); | |
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE); | |
- L2Summon pet = player.getSummon(); | |
- if (pet != null) | |
+ final L2Summon pet = player.getSummon(); | |
+ if (player.getSummon() != null) | |
{ | |
pet.setTarget(null); | |
pet.abortAttack(); | |
@@ -1752,9 +754,9 @@ | |
{ | |
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()); | |
+ final 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); | |
} | |
} | |
@@ -2765,7 +1767,7 @@ | |
} | |
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 ""; | |
} | |
@@ -3035,12 +2037,12 @@ | |
@Override | |
public String onExitZone(L2Character character, L2ZoneType zone) | |
{ | |
- if (character instanceof L2PcInstance) | |
+ if (character.isPlayer()) | |
{ | |
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character.getInstanceId()); | |
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character.getInstanceId()); | |
if (tmpworld instanceof CCWorld) | |
{ | |
- CCWorld world = (CCWorld) tmpworld; | |
+ final CCWorld world = (CCWorld) tmpworld; | |
if (world.getStatus() == 8) | |
{ | |
int doorId; | |
@@ -3076,10 +2078,4 @@ | |
} | |
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 | |
Index: dist/game/data/instances/CrystalCaverns.xml | |
=================================================================== | |
--- dist/game/data/instances/CrystalCaverns.xml (revision 18149) | |
+++ dist/game/data/instances/CrystalCaverns.xml (working copy) | |
@@ -4,6 +4,9 @@ | |
<allowSummon val="false" /> | |
<emptyDestroyTime val="1200" /> | |
<spawnPoint spawnX="149442" spawnY="173520" spawnZ="-5024" /> | |
+ <reenter additionStyle="onInstanceEnter" > | |
+ <reset time="86400000" /> | |
+ </reenter> | |
<doorlist> | |
<door doorId="24220001" /> | |
<door doorId="24220002" /> | |
Index: dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java (revision 18149) | |
+++ dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java (working copy) | |
@@ -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 @@ | |
* 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 @@ | |
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 @@ | |
{ | |
if (event.equals("enter")) | |
{ | |
- enterInstance(player, "IceQueensCastleNormalBattle.xml"); | |
+ enterInstance(player, new IQCNBWorld(), "IceQueensCastleNormalBattle.xml", TEMPLATE_ID); | |
} | |
else | |
{ | |
@@ -1076,41 +1072,10 @@ | |
} | |
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 @@ | |
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 (firstEntrance) | |
{ | |
- 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)) | |
- { | |
- 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,6 +1158,15 @@ | |
} | |
} | |
} | |
+ else | |
+ { | |
+ player.stopAllEffectsExceptThoseThatLastThroughDeath(); | |
+ if (player.hasSummon()) | |
+ { | |
+ player.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); | |
+ } | |
+ teleportPlayer(player, world.isStatus(4) ? BATTLE_PORT : ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId()); | |
+ } | |
} | |
private void managePlayerEnter(L2PcInstance player, IQCNBWorld world) | |
@@ -1239,7 +1181,8 @@ | |
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; | |
@@ -1365,9 +1308,4 @@ | |
} | |
} | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new IceQueensCastleNormalBattle(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java (revision 18149) | |
+++ dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java (working copy) | |
@@ -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 @@ | |
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 | |
Index: dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java (revision 18149) | |
+++ dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java (working copy) | |
@@ -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.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 @@ | |
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 @@ | |
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,14 @@ | |
} | |
} | |
- 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 | |
Index: dist/game/data/instances/Ranku.xml | |
=================================================================== | |
--- dist/game/data/instances/Ranku.xml (revision 18149) | |
+++ dist/game/data/instances/Ranku.xml (working copy) | |
@@ -4,6 +4,10 @@ | |
<allowSummon val="false" /> | |
<emptyDestroyTime val="600" /> | |
<spawnPoint spawnX="-19006" spawnY="277065" spawnZ="-13383" /> | |
+ <reenter additionStyle="onInstanceFinish" > | |
+ <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" /> | |
Index: dist/game/data/instances/FinalEmperialTomb.xml | |
=================================================================== | |
--- dist/game/data/instances/FinalEmperialTomb.xml (revision 18149) | |
+++ dist/game/data/instances/FinalEmperialTomb.xml (working copy) | |
@@ -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" /> | |
Index: dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java (revision 18149) | |
+++ dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java (working copy) | |
@@ -18,6 +18,8 @@ | |
*/ | |
package instances.DisciplesNecropolisPast; | |
+import instances.AbstractInstance; | |
+ | |
import java.util.HashMap; | |
import java.util.Map; | |
@@ -26,35 +28,29 @@ | |
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; | |
import com.l2jserver.gameserver.network.clientpackets.Say2; | |
-import com.l2jserver.gameserver.network.serverpackets.NpcSay; | |
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; | |
@@ -78,6 +74,19 @@ | |
// 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); | |
@@ -98,8 +107,8 @@ | |
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 | |
}; | |
- | |
- // Bosses Spawn | |
+ // Misc | |
+ private static final int TEMPLATE_ID = 112; | |
private static final Map<Integer, Location> LILITH_SPAWN = new HashMap<>(); | |
private static final Map<Integer, Location> ANAKIM_SPAWN = new HashMap<>(); | |
static | |
@@ -113,23 +122,9 @@ | |
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 | |
+ public DisciplesNecropolisPast() | |
{ | |
- 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() | |
- { | |
- 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,12 +138,12 @@ | |
{ | |
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); | |
} | |
} | |
@@ -177,35 +172,15 @@ | |
} | |
} | |
- 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 +195,10 @@ | |
@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": | |
@@ -252,12 +227,12 @@ | |
{ | |
if (caster.isScriptValue(0)) | |
{ | |
- caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.YOU_SUCH_A_FOOL_THE_VICTORY_OVER_THIS_WAR_BELONGS_TO_SHILIEN)); | |
+ broadcastNpcSay(caster, Say2.NPC_SHOUT, NpcStringId.YOU_SUCH_A_FOOL_THE_VICTORY_OVER_THIS_WAR_BELONGS_TO_SHILIEN); | |
caster.setScriptValue(1); | |
} | |
else if (getRandom(100) < 10) | |
{ | |
- caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), LILITH_SHOUT[getRandom(3)])); | |
+ broadcastNpcSay(caster, Say2.NPC_SHOUT, LILITH_SHOUT[getRandom(3)]); | |
} | |
} | |
} | |
@@ -271,10 +246,10 @@ | |
{ | |
if (caster.isScriptValue(0)) | |
{ | |
- caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.FOR_THE_ETERNITY_OF_EINHASAD)); | |
+ broadcastNpcSay(caster, Say2.NPC_SHOUT, NpcStringId.FOR_THE_ETERNITY_OF_EINHASAD); | |
if (Util.checkIfInRange(2000, caster, player, true)) | |
{ | |
- player.sendPacket(new NpcSay(caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.MY_POWERS_WEAKENING_HURRY_AND_TURN_ON_THE_SEALING_DEVICE)); | |
+ broadcastNpcSay(caster, Say2.TELL, NpcStringId.MY_POWERS_WEAKENING_HURRY_AND_TURN_ON_THE_SEALING_DEVICE); | |
} | |
caster.setScriptValue(1); | |
} | |
@@ -284,28 +259,28 @@ | |
{ | |
case 0: | |
{ | |
- caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.DEAR_SHILLIENS_OFFSPRINGS_YOU_ARE_NOT_CAPABLE_OF_CONFRONTING_US)); | |
+ broadcastNpcSay(caster, Say2.NPC_SHOUT, NpcStringId.DEAR_SHILLIENS_OFFSPRINGS_YOU_ARE_NOT_CAPABLE_OF_CONFRONTING_US); | |
if (Util.checkIfInRange(2000, caster, player, true)) | |
{ | |
- player.sendPacket(new NpcSay(caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.ALL_4_SEALING_DEVICES_MUST_BE_TURNED_ON)); | |
+ broadcastNpcSay(caster, Say2.TELL, NpcStringId.ALL_4_SEALING_DEVICES_MUST_BE_TURNED_ON); | |
} | |
break; | |
} | |
case 1: | |
{ | |
- caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.ILL_SHOW_YOU_THE_REAL_POWER_OF_EINHASAD)); | |
+ broadcastNpcSay(caster, Say2.NPC_SHOUT, NpcStringId.ILL_SHOW_YOU_THE_REAL_POWER_OF_EINHASAD); | |
if (Util.checkIfInRange(2000, caster, player, true)) | |
{ | |
- player.sendPacket(new NpcSay(caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.LILITHS_ATTACK_IS_GETTING_STRONGER_GO_AHEAD_AND_TURN_IT_ON)); | |
+ broadcastNpcSay(caster, Say2.TELL, NpcStringId.LILITHS_ATTACK_IS_GETTING_STRONGER_GO_AHEAD_AND_TURN_IT_ON); | |
} | |
break; | |
} | |
case 2: | |
{ | |
- caster.broadcastPacket(new NpcSay(caster.getObjectId(), Say2.NPC_SHOUT, caster.getId(), NpcStringId.DEAR_MILITARY_FORCE_OF_LIGHT_GO_DESTROY_THE_OFFSPRINGS_OF_SHILLIEN)); | |
+ broadcastNpcSay(caster, Say2.NPC_SHOUT, NpcStringId.DEAR_MILITARY_FORCE_OF_LIGHT_GO_DESTROY_THE_OFFSPRINGS_OF_SHILLIEN); | |
if (Util.checkIfInRange(2000, caster, player, true)) | |
{ | |
- player.sendPacket(new NpcSay(caster.getObjectId(), Say2.TELL, caster.getId(), NpcStringId.DEAR_S1_GIVE_ME_MORE_STRENGTH).addStringParameter(player.getName())); | |
+ broadcastNpcSay(caster, Say2.TELL, NpcStringId.DEAR_S1_GIVE_ME_MORE_STRENGTH, player.getName()); | |
} | |
break; | |
} | |
@@ -331,7 +306,7 @@ | |
{ | |
if (npc.isScriptValue(0)) | |
{ | |
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.THIS_PLACE_ONCE_BELONGED_TO_LORD_SHILEN)); | |
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THIS_PLACE_ONCE_BELONGED_TO_LORD_SHILEN); | |
npc.setScriptValue(1); | |
} | |
break; | |
@@ -341,7 +316,7 @@ | |
{ | |
if (npc.isScriptValue(0)) | |
{ | |
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.WHO_DARES_ENTER_THIS_PLACE)); | |
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WHO_DARES_ENTER_THIS_PLACE); | |
npc.setScriptValue(1); | |
} | |
break; | |
@@ -351,7 +326,7 @@ | |
{ | |
if (npc.isScriptValue(0)) | |
{ | |
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.THOSE_WHO_ARE_AFRAID_SHOULD_GET_AWAY_AND_THOSE_WHO_ARE_BRAVE_SHOULD_FIGHT)); | |
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.THOSE_WHO_ARE_AFRAID_SHOULD_GET_AWAY_AND_THOSE_WHO_ARE_BRAVE_SHOULD_FIGHT); | |
npc.setScriptValue(1); | |
} | |
break; | |
@@ -360,7 +335,7 @@ | |
{ | |
if (npc.isScriptValue(0)) | |
{ | |
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.LEAVE_NOW)); | |
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.LEAVE_NOW); | |
npc.setScriptValue(1); | |
} | |
break; | |
@@ -372,7 +347,7 @@ | |
@Override | |
public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon) | |
{ | |
- InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); | |
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player); | |
if (tmpworld instanceof DNPWorld) | |
{ | |
if (npc.isScriptValue(0)) | |
@@ -397,31 +372,16 @@ | |
@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); | |
} | |
@@ -431,19 +391,19 @@ | |
case LILIM_MAGUS: | |
case LILIM_GREAT_MAGUS: | |
{ | |
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.LORD_SHILEN_SOME_DAY_YOU_WILL_ACCOMPLISH_THIS_MISSION)); | |
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.LORD_SHILEN_SOME_DAY_YOU_WILL_ACCOMPLISH_THIS_MISSION); | |
break; | |
} | |
case LILIM_KNIGHT_ERRANT: | |
case LILIM_KNIGHT: | |
case LILIM_GUARD_KNIGHT: | |
{ | |
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.WHY_ARE_YOU_GETTING_IN_OUR_WAY)); | |
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WHY_ARE_YOU_GETTING_IN_OUR_WAY); | |
break; | |
} | |
case LILIM_SLAYER: | |
{ | |
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NpcStringId.FOR_SHILEN)); | |
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.FOR_SHILEN); | |
break; | |
} | |
} | |
@@ -473,7 +433,7 @@ | |
{ | |
if (qs.isCond(3) || qs.isCond(4)) | |
{ | |
- enterInstance(talker, "DisciplesNecropolisPast.xml", ENTER); | |
+ enterInstance(talker, new DNPWorld(), "DisciplesNecropolisPast.xml", TEMPLATE_ID); | |
return ""; | |
} | |
break; | |
@@ -483,7 +443,7 @@ | |
if (qs.getCond() >= 3) | |
{ | |
takeItems(talker, SACRED_SWORD_OF_EINHASAD, -1); | |
- InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker); | |
+ final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(talker); | |
world.removeAllowed(talker.getObjectId()); | |
talker.teleToLocation(EXIT, 0); | |
htmltext = "32587-01.html"; | |
@@ -494,10 +454,10 @@ | |
{ | |
if (qs.getCond() >= 3) | |
{ | |
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); | |
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId()); | |
if (tmpworld instanceof DNPWorld) | |
{ | |
- DNPWorld world = (DNPWorld) tmpworld; | |
+ final DNPWorld world = (DNPWorld) tmpworld; | |
openDoor(DISCIPLES_NECROPOLIS_DOOR, world.getInstanceId()); | |
talker.showQuestMovie(12); | |
startQuestTimer("FIGHT", 1000, null, talker); | |
@@ -508,18 +468,4 @@ | |
} | |
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(); | |
- } | |
} | |
Index: dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java (revision 18149) | |
+++ dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java (working copy) | |
@@ -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 @@ | |
* 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 @@ | |
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,41 +187,24 @@ | |
@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) | |
{ | |
@@ -230,9 +213,4 @@ | |
} | |
return true; | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new IceQueensCastle(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java (revision 18149) | |
+++ dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java (working copy) | |
@@ -18,25 +18,26 @@ | |
*/ | |
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; | |
@@ -44,11 +45,10 @@ | |
* 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 +58,6 @@ | |
} | |
} | |
- // 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 +67,6 @@ | |
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,6 +74,12 @@ | |
// 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); | |
+ // Doors | |
+ private static int DOOR_ONE = 17240001; | |
+ private static int DOOR_TWO = 17240003; | |
+ private static int DOOR_THREE = 17240005; | |
+ // Misc | |
+ private static final int TEMPLATE_ID = 111; | |
private static final Location[] SAVE_POINT = new Location[] | |
{ | |
@@ -89,9 +89,9 @@ | |
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,12 +104,11 @@ | |
{ | |
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"); | |
+ final HSWorld world = (HSWorld) tmpworld; | |
+ spawnGroup("high_priest_of_dawn", world.getInstanceId()); | |
player.sendPacket(SystemMessageId.SNEAK_INTO_DAWNS_DOCUMENT_STORAGE); | |
} | |
break; | |
@@ -120,23 +119,23 @@ | |
{ | |
case GUARDS_OF_THE_DAWN: | |
{ | |
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.INTRUDER_PROTECT_THE_PRIESTS_OF_DAWN)); | |
+ broadcastNpcSay(npc, Say2.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.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.ALL, NpcStringId.WHO_ARE_YOU_A_NEW_FACE_LIKE_YOU_CANT_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 +151,19 @@ | |
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 (firstEntrance) | |
{ | |
- 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()); | |
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 +176,19 @@ | |
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 +205,7 @@ | |
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 +221,10 @@ | |
} | |
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 +239,7 @@ | |
} | |
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 +255,4 @@ | |
startQuestTimer("teleportPlayer", 2000, npc, player); | |
return super.onAggroRangeEnter(npc, player, isSummon); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new SanctumOftheLordsOfDawn(); | |
- } | |
} | |
Index: dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java (revision 18149) | |
+++ dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java (working copy) | |
@@ -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.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 @@ | |
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 @@ | |
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 @@ | |
{ | |
case "enter": | |
{ | |
- enterInstance(player, "PailakaSongOfIceAndFire.xml"); | |
+ enterInstance(player, new PSoIWorld(), "PailakaSongOfIceAndFire.xml", TEMPLATE_ID); | |
break; | |
} | |
case "GARGOS_LAUGH": | |
@@ -218,9 +204,4 @@ | |
startQuestTimer("BLOOM_TIMER", 1000, npc, null); | |
return super.onSpawn(npc); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new PailakaSongOfIceAndFire(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java (revision 18149) | |
+++ dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java (working copy) | |
@@ -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.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 @@ | |
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,43 +75,41 @@ | |
@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": | |
+ final LoSWorld world = (LoSWorld) tmpworld; | |
+ switch (event) | |
{ | |
- teleportPlayer(player, LIBRARY_LOC, world.getInstanceId()); | |
- world.elcadia.teleToLocation(LIBRARY_LOC.getX(), LIBRARY_LOC.getY(), LIBRARY_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; | |
+ } | |
} | |
- 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 @@ | |
@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); | |
+ if (world.elcadia != null) | |
+ { | |
+ world.elcadia.deleteMe(); | |
+ } | |
+ world.elcadia = addSpawn(ELCADIA_INSTANCE, player, false, 0, false, player.getInstanceId()); | |
+ startQuestTimer("FOLLOW", 3000, world.elcadia, player); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new LibraryOfSages(); | |
- } | |
} | |
Index: dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java | |
=================================================================== | |
--- dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java (revision 18149) | |
+++ dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java (working copy) | |
@@ -18,14 +18,16 @@ | |
*/ | |
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; | |
@@ -41,29 +43,43 @@ | |
import com.l2jserver.gameserver.network.serverpackets.SystemMessage; | |
import com.l2jserver.gameserver.util.Util; | |
-import hellbound.HellboundEngine; | |
- | |
/** | |
* 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 TEMPLATE_ID = 2; | |
- | |
+ private static final int MIN_LV = 78; | |
private static final NpcStringId[] NPCSTRING_ID = | |
{ | |
NpcStringId.INVADER, | |
NpcStringId.YOU_HAVE_DONE_WELL_IN_FINDING_ME_BUT_I_CANNOT_JUST_HAND_YOU_THE_KEY | |
}; | |
- | |
private static final NpcStringId[] NATIVES_NPCSTRING_ID = | |
{ | |
NpcStringId.THANK_YOU_FOR_SAVING_ME, | |
@@ -71,35 +87,16 @@ | |
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,20 +115,30 @@ | |
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; | |
- | |
final L2Party party = player.getParty(); | |
if (party == null) | |
@@ -156,7 +163,7 @@ | |
{ | |
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 +197,8 @@ | |
{ | |
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 +208,8 @@ | |
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 | |
@@ -212,14 +219,13 @@ | |
{ | |
world.activeAmaskariCall.cancel(true); | |
} | |
- | |
world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000); | |
} | |
} | |
} | |
} | |
} | |
- return null; | |
+ return super.onAdvEvent(event, npc, player); | |
} | |
@Override | |
@@ -237,21 +243,20 @@ | |
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 +265,6 @@ | |
{ | |
world.activeAmaskariCall.cancel(true); | |
} | |
- | |
world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000); | |
} | |
} | |
@@ -271,32 +275,39 @@ | |
@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())) | |
{ | |
int msgId; | |
int range; | |
+ | |
switch (npc.getId()) | |
{ | |
case TOWN_GUARD: | |
+ { | |
msgId = 0; | |
range = 1000; | |
break; | |
+ } | |
case KEYMASTER: | |
+ { | |
msgId = 1; | |
range = 5000; | |
break; | |
+ } | |
default: | |
+ { | |
msgId = -1; | |
range = 0; | |
+ } | |
} | |
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 +318,6 @@ | |
{ | |
world.activeAmaskariCall.cancel(true); | |
} | |
- | |
world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000); | |
} | |
} | |
@@ -318,7 +328,7 @@ | |
@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,103 +337,45 @@ | |
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) | |
+ if ((party == null) || !party.isLeader(player)) | |
{ | |
- return false; | |
- } | |
- | |
- if (!party.isLeader(player)) | |
- { | |
player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); | |
return false; | |
} | |
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_LEVEL_REQUIREMENT_NOT_SUFFICIENT).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_LOCATION_THAT_CANNOT_BE_ENTERED).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.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER).addPcName(partyMember)); | |
return false; | |
} | |
} | |
return true; | |
} | |
- private void enterInstance(L2PcInstance player, String template) | |
- { | |
- InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player); | |
- | |
- if (world != null) | |
- { | |
- if (world instanceof UrbanAreaWorld) | |
- { | |
- teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); | |
- return; | |
- } | |
- player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); | |
- return; | |
- } | |
- | |
- if (!checkTeleport(player)) | |
- { | |
- return; | |
- } | |
- | |
- 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()) | |
- { | |
- teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId()); | |
- world.addAllowed(partyMember.getObjectId()); | |
- } | |
- | |
- ((UrbanAreaWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT, false, 0, false, world.getInstanceId()); | |
- } | |
- | |
private static class CallAmaskari implements Runnable | |
{ | |
private final L2Npc _caller; | |
@@ -453,6 +405,32 @@ | |
} | |
} | |
+ @Override | |
+ public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) | |
+ { | |
+ if (firstEntrance) | |
+ { | |
+ if (player.getParty() == null) | |
+ { | |
+ teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); | |
+ world.addAllowed(player.getObjectId()); | |
+ } | |
+ 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()); | |
+ } | |
+ else | |
+ { | |
+ teleportPlayer(player, ENTRY_POINT, world.getInstanceId()); | |
+ } | |
+ } | |
+ | |
private class ExitInstance implements Runnable | |
{ | |
private final L2Party _party; | |
Index: dist/game/data/instances/HideoutOfTheDawn.xml | |
=================================================================== | |
--- dist/game/data/instances/HideoutOfTheDawn.xml (revision 18149) | |
+++ dist/game/data/instances/HideoutOfTheDawn.xml (working copy) | |
@@ -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 --> | |
Index: dist/game/data/instances/IceQueensCastleNormalBattle.xml | |
=================================================================== | |
--- dist/game/data/instances/IceQueensCastleNormalBattle.xml (revision 18149) | |
+++ dist/game/data/instances/IceQueensCastleNormalBattle.xml (working copy) | |
@@ -4,6 +4,10 @@ | |
<allowSummon val="false" /> | |
<emptyDestroyTime val="600" /> | |
<spawnPoint spawnX="115717" spawnY="-125734" spawnZ="-3392" /> | |
+ <reenter additionStyle="onInstanceFinish" > | |
+ <reset day="Wednesday" hour="6" minute="30" /> | |
+ <reset day="Saturday" hour="6" minute="30" /> | |
+ </reenter> | |
<doorlist> | |
<door doorId="23140101" /> | |
</doorlist> | |
Index: dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java | |
=================================================================== | |
--- dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java (revision 18149) | |
+++ dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java (working copy) | |
@@ -18,14 +18,12 @@ | |
*/ | |
package hellbound.Instances.RankuFloor; | |
-import java.util.Calendar; | |
+import instances.AbstractInstance; | |
-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.L2Npc; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
import com.l2jserver.gameserver.model.entity.Instance; | |
@@ -38,7 +36,7 @@ | |
* 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 @@ | |
private static final int RANKU = 25542; | |
// Item | |
private static final int SEAL_BREAKER_10 = 15516; | |
+ // 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 RESET_HOUR = 6; | |
- private static final int RESET_MIN = 30; | |
- private static final Location ENTRY_POINT = new Location(-19008, 277024, -15000); | |
- private static final Location EXIT_POINT = new Location(-19008, 277122, -13376); | |
+ 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 @@ | |
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 @@ | |
final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId()); | |
if (world instanceof RFWorld) | |
{ | |
- world.removeAllowed(player.getObjectId()); | |
teleportPlayer(player, EXIT_POINT, 0); | |
} | |
} | |
@@ -97,181 +102,94 @@ | |
@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) | |
+ if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS)) | |
{ | |
- return "gk-noparty.htm"; | |
+ return true; | |
} | |
- else if (player.getParty().getLeaderObjectId() != player.getObjectId()) | |
- { | |
- return "gk-noleader.htm"; | |
- } | |
- return null; | |
- } | |
- | |
- private boolean checkTeleport(L2PcInstance player) | |
- { | |
final L2Party party = player.getParty(); | |
- if (party == null) | |
+ if ((party == null) || !party.isLeader(player)) | |
{ | |
- return false; | |
- } | |
- | |
- if (!party.isLeader(player)) | |
- { | |
player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); | |
return false; | |
} | |
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_LEVEL_REQUIREMENT_NOT_SUFFICIENT).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_LOCATION_THAT_CANNOT_BE_ENTERED).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.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER).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_REENTER_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_QUEST_REQUIREMENT_NOT_SUFFICIENT).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.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true); | |
+ world.addAllowed(player.getObjectId()); | |
} | |
- 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(); | |
- } | |
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 | |
Index: dist/game/data/scripts/instances/MithrilMine/MithrilMine.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/MithrilMine/MithrilMine.java (revision 18149) | |
+++ dist/game/data/scripts/instances/MithrilMine/MithrilMine.java (working copy) | |
@@ -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.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; | |
@@ -58,7 +55,7 @@ | |
// Skill | |
private static SkillHolder BLESS_OF_SWORD = new SkillHolder(6286, 1); | |
// Location | |
- private static final Location START_LOC = new Location(186852, -173492, -3763, 0, 0); | |
+ private static final Location START_LOC = new Location(186852, -173492, -3763); | |
private static final Location EXIT_LOC = new Location(178823, -184303, -347, 0, 0); | |
private static final Location[] MOB_SPAWNS = new Location[] | |
{ | |
@@ -68,8 +65,10 @@ | |
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 @@ | |
qs.giveItems(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 @@ | |
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(); | |
+ teleportPlayer(player, START_LOC, world.getInstanceId(), false); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new MithrilMine(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/instances/DemonPrince.xml | |
=================================================================== | |
--- dist/game/data/instances/DemonPrince.xml (revision 18149) | |
+++ dist/game/data/instances/DemonPrince.xml (working copy) | |
@@ -4,6 +4,10 @@ | |
<allowSummon val="false" /> | |
<emptyDestroyTime val="600" /> | |
<spawnPoint spawnX="-22213" spawnY="277138" spawnZ="-9930" /> | |
+ <reenter additionStyle="onInstanceFinish" > | |
+ <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" /> | |
Index: dist/game/data/instances/DisciplesNecropolisPast.xml | |
=================================================================== | |
--- dist/game/data/instances/DisciplesNecropolisPast.xml (revision 18149) | |
+++ dist/game/data/instances/DisciplesNecropolisPast.xml (working copy) | |
@@ -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" /> | |
Index: dist/game/data/instances/NornilsGarden.xml | |
=================================================================== | |
--- dist/game/data/instances/NornilsGarden.xml (revision 18149) | |
+++ dist/game/data/instances/NornilsGarden.xml (working copy) | |
@@ -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" /> | |
Index: dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml | |
=================================================================== | |
--- dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml (revision 18149) | |
+++ dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml (working copy) | |
@@ -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="onInstanceFinish" > | |
+ <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 | |
Index: dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java (revision 18149) | |
+++ dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java (working copy) | |
@@ -45,14 +45,9 @@ | |
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 | |
Index: dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java | |
=================================================================== | |
--- dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java (revision 18149) | |
+++ dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java (working copy) | |
@@ -18,14 +18,12 @@ | |
*/ | |
package hellbound.Instances.DemonPrinceFloor; | |
-import java.util.Calendar; | |
+import instances.AbstractInstance; | |
-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.L2Npc; | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
import com.l2jserver.gameserver.model.entity.Instance; | |
@@ -38,7 +36,7 @@ | |
* 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 @@ | |
private static final int DEMON_PRINCE = 25540; | |
// Item | |
private static final int SEAL_BREAKER_5 = 15515; | |
+ // 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 RESET_HOUR = 6; | |
- private static final int RESET_MIN = 30; | |
- private static final Location ENTRY_POINT = new Location(-22208, 277056, -8239); | |
- private static final Location EXIT_POINT = new Location(-19024, 277122, -8256); | |
+ 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,19 +70,29 @@ | |
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()); | |
teleportPlayer(player, EXIT_POINT, 0); | |
} | |
} | |
@@ -99,177 +105,91 @@ | |
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"; | |
+ return true; | |
} | |
- else if (!player.getParty().isLeader(player)) | |
- { | |
- return "gk-noleader.htm"; | |
- } | |
- return null; | |
- } | |
- | |
- private boolean checkTeleport(L2PcInstance player) | |
- { | |
final L2Party party = player.getParty(); | |
- if (party == null) | |
+ if ((party == null) || !party.isLeader(player)) | |
{ | |
- return false; | |
- } | |
- | |
- if (!party.isLeader(player)) | |
- { | |
player.sendPacket(SystemMessageId.ONLY_PARTY_LEADER_CAN_ENTER); | |
return false; | |
} | |
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_LEVEL_REQUIREMENT_NOT_SUFFICIENT).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_LOCATION_THAT_CANNOT_BE_ENTERED).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.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER).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_REENTER_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_QUEST_REQUIREMENT_NOT_SUFFICIENT).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.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true); | |
+ world.addAllowed(player.getObjectId()); | |
} | |
- 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(); | |
- } | |
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 | |
Index: dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java (revision 18149) | |
+++ dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java (working copy) | |
@@ -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.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); | |
+ private static final Location START_LOC = new Location(89706, -238074, -9632); | |
+ private static final Location EXIT_LOC = new Location(43316, -87986, -2832); | |
+ // 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 @@ | |
|| ((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 @@ | |
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 (firstEntrance) | |
{ | |
- if (!(world instanceof ETWorld)) | |
- { | |
- player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); | |
- } | |
- else | |
- { | |
- teleportPlayer(player, loc, world.getInstanceId(), false); | |
- } | |
- } | |
- else | |
- { | |
- // 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()); | |
} | |
+ teleportPlayer(player, START_LOC, world.getInstanceId(), false); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new ElcadiasTent(); | |
- } | |
} | |
Index: dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java (revision 18149) | |
+++ dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java (working copy) | |
@@ -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.quest.QuestState; | |
import com.l2jserver.gameserver.model.skills.Skill; | |
import com.l2jserver.gameserver.network.NpcStringId; | |
@@ -41,16 +42,13 @@ | |
/** | |
* Dark Cloud Mansion instance zone. | |
*/ | |
-public final class DarkCloudMansion extends Quest | |
+public final class DarkCloudMansion extends AbstractInstance | |
{ | |
- private static final int TEMPLATE_ID = 9; | |
+ protected class DMCWorld extends InstanceWorld | |
+ { | |
+ protected FastMap<String, DMCRoom> rooms = new FastMap<>(); | |
+ } | |
- private static boolean debug = false; | |
- private static boolean noRndWalk = true; | |
- | |
- // Items | |
- private static int CC = 9690; // Contaminated Crystal | |
- | |
// NPCs | |
private static int YIYEN = 32282; | |
private static int SOFaith = 32288; // Symbol of Faith | |
@@ -59,7 +57,6 @@ | |
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,8 +103,10 @@ | |
22402, | |
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 | |
@@ -121,7 +120,8 @@ | |
// 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, | |
@@ -130,14 +130,12 @@ | |
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, | |
@@ -145,312 +143,72 @@ | |
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); | |
@@ -476,19 +234,15 @@ | |
public int[] Order; | |
} | |
- protected class DMCWorld extends InstanceWorld | |
+ @Override | |
+ protected boolean checkConditions(L2PcInstance player) | |
{ | |
- public FastMap<String, DMCRoom> rooms = new FastMap<>(); | |
- } | |
- | |
- private 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); | |
@@ -521,54 +275,38 @@ | |
return false; | |
} | |
} | |
- | |
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()); | |
} | |
- 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()) | |
+ else | |
{ | |
- if (partyMember.getQuestState(getName()) == null) | |
+ for (L2PcInstance partyMember : player.getParty().getMembers()) | |
{ | |
- newQuestState(partyMember); | |
+ if (partyMember.getQuestState(getName()) == null) | |
+ { | |
+ newQuestState(partyMember); | |
+ } | |
+ world.addAllowed(partyMember.getObjectId()); | |
+ teleportPlayer(partyMember, new Location(146534, 180464, -6117), world.getInstanceId()); | |
} | |
- world.addAllowed(partyMember.getObjectId()); | |
- teleportPlayer(partyMember, loc, instanceId); | |
} | |
} | |
+ else | |
+ { | |
+ teleportPlayer(player, new Location(146534, 180464, -6117), world.getInstanceId()); | |
+ } | |
} | |
protected void runStartRoom(DMCWorld world) | |
@@ -1266,8 +1004,8 @@ | |
@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; | |
@@ -1347,8 +1085,8 @@ | |
@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; | |
@@ -1375,15 +1113,14 @@ | |
checkBelethSample(world, npc, player); | |
} | |
} | |
- | |
return ""; | |
} | |
@Override | |
public String onFirstTalk(L2Npc npc, L2PcInstance player) | |
{ | |
- 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; | |
@@ -1427,10 +1164,10 @@ | |
@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 | |
{ | |
@@ -1467,9 +1204,4 @@ | |
} | |
return ""; | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new DarkCloudMansion(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/xsd/instance.xsd | |
=================================================================== | |
--- dist/game/data/xsd/instance.xsd (revision 18149) | |
+++ dist/game/data/xsd/instance.xsd (working copy) | |
@@ -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="onInstanceEnter" /> | |
+ <xs:enumeration value="onInstanceFinish" /> | |
+ </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"> | |
Index: dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java (revision 18149) | |
+++ dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java (working copy) | |
@@ -45,14 +45,9 @@ | |
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 | |
Index: dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java (revision 18149) | |
+++ dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java (working copy) | |
@@ -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.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.quest.QuestState; | |
import com.l2jserver.gameserver.model.skills.Skill; | |
import com.l2jserver.gameserver.network.NpcStringId; | |
@@ -81,31 +81,31 @@ | |
* 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() | |
{ | |
@@ -142,24 +142,9 @@ | |
} | |
} | |
- 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; | |
@@ -175,18 +160,21 @@ | |
}; | |
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); | |
- | |
protected static final FrintezzaSong[] FRINTEZZASONGLIST = | |
{ | |
new FrintezzaSong(new SkillHolder(5007, 1), new SkillHolder(5008, 1), NpcStringId.REQUIEM_OF_HATRED, 5), | |
@@ -195,10 +183,19 @@ | |
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, | |
@@ -223,7 +220,6 @@ | |
17130069, | |
17130070 | |
}; | |
- | |
protected static final int[] FIRST_ROUTE_DOORS = | |
{ | |
17130042, | |
@@ -234,68 +230,19 @@ | |
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); | |
@@ -532,19 +479,22 @@ | |
} | |
} | |
- 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); | |
@@ -571,82 +521,53 @@ | |
{ | |
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_LEVEL_REQUIREMENT_NOT_SUFFICIENT).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_LOCATION_THAT_CANNOT_BE_ENTERED).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_REENTER_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); | |
} | |
- teleportPlayer(player, loc, world.getInstanceId(), false); | |
- return world.getInstanceId(); | |
+ 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); | |
+ } | |
+ } | |
} | |
- | |
- // 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) | |
@@ -738,7 +659,7 @@ | |
{ | |
world.activeScarlet.abortCast(); | |
} | |
- setInstanceTimeRestrictions(world); | |
+ handleReenterTime(world); | |
world.activeScarlet.doCast(FIRST_MORPH_SKILL.getSkill()); | |
ThreadPoolManager.getInstance().scheduleGeneral(new SongTask(world, 2), 1500); | |
break; | |
@@ -801,7 +722,7 @@ | |
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); | |
@@ -1406,46 +1327,6 @@ | |
} | |
} | |
- 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()) | |
@@ -1583,7 +1464,7 @@ | |
} | |
if (npcId == GUIDE) | |
{ | |
- enterInstance(player, "FinalEmperialTomb.xml", ENTER_TELEPORT); | |
+ enterInstance(player, new FETWorld(), "FinalEmperialTomb.xml", TEMPLATE_ID); | |
} | |
else if (npc.getId() == CUBE) | |
{ | |
@@ -1594,9 +1475,4 @@ | |
} | |
return ""; | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new FinalEmperialTomb(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java (revision 18149) | |
+++ dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java (working copy) | |
@@ -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.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; | |
@@ -42,39 +42,40 @@ | |
/** | |
* Nornil's Garden instance zone. | |
* @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 +94,7 @@ | |
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 +110,6 @@ | |
{ 18361, 9711, 0 }, // Guardian of Prediction | |
{ 25528, 9712, 0 } // Tiberias | |
}; | |
- | |
private static final int[][] HP_HERBS_DROPLIST = | |
{ | |
// itemId, count, chance | |
@@ -124,7 +117,6 @@ | |
{ 8601, 2, 40 }, | |
{ 8600, 3, 70 } | |
}; | |
- | |
private static final int[][] _group_1 = | |
{ | |
{ 18363, -109899, 74431, -12528, 16488 }, | |
@@ -133,7 +125,6 @@ | |
{ 18363, -109703, 74879, -12528, 49336 } | |
}; | |
- | |
private static final int[][] _group_2 = | |
{ | |
{ 18363, -110393, 78276, -12848, 49152 }, | |
@@ -145,7 +136,6 @@ | |
{ 18483, -110389, 79131, -12915, 48539 }, | |
{ 18483, -110551, 79134, -12915, 49151 } | |
}; | |
- | |
private static final int[][] _group_3 = | |
{ | |
{ 18483, -107798, 80721, -12912, 0 }, | |
@@ -156,7 +146,6 @@ | |
{ 18363, -109016, 80642, -12912, 0 }, | |
{ 18483, -108740, 80546, -12912, 0 } | |
}; | |
- | |
private static final int[][] _group_4 = | |
{ | |
{ 18362, -110082, 83998, -12928, 0 }, | |
@@ -169,7 +158,6 @@ | |
{ 18362, -109122, 84490, -12880, 0 }, | |
{ 18347, -108939, 84489, -12880, 0 } | |
}; | |
- | |
private static final int[][] MP_HERBS_DROPLIST = | |
{ | |
// itemId, count, chance | |
@@ -191,11 +179,6 @@ | |
} | |
} | |
- private static final void removeBuffs(L2Character ch) | |
- { | |
- ch.stopAllEffectsExceptThoseThatLastThroughDeath(); | |
- } | |
- | |
private static final void giveBuffs(L2Character ch) | |
{ | |
if (skill1 != null) | |
@@ -216,9 +199,9 @@ | |
} | |
} | |
- private NornilsGarden() | |
+ public NornilsGarden() | |
{ | |
- super(-1, NornilsGarden.class.getSimpleName(), "instances"); | |
+ super(NornilsGarden.class.getSimpleName()); | |
addStartNpc(_garden_guard); | |
addFirstTalkId(_garden_guard); | |
addTalkId(_garden_guard); | |
@@ -243,11 +226,10 @@ | |
{ | |
st = newQuestState(player); | |
} | |
- removeBuffs(player); | |
+ | |
giveBuffs(player); | |
if (player.hasSummon()) | |
{ | |
- removeBuffs(player.getSummon()); | |
giveBuffs(player.getSummon()); | |
} | |
super.teleportPlayer(player, loc, instanceId); | |
@@ -255,7 +237,7 @@ | |
private void exitInstance(L2PcInstance player) | |
{ | |
- InstanceWorld inst = InstanceManager.getInstance().getWorld(player.getInstanceId()); | |
+ final InstanceWorld inst = InstanceManager.getInstance().getWorld(player.getInstanceId()); | |
if (inst instanceof NornilsWorld) | |
{ | |
NornilsWorld world = ((NornilsWorld) inst); | |
@@ -340,7 +322,7 @@ | |
private void spawn1(L2Npc npc) | |
{ | |
- InstanceWorld inst = InstanceManager.getInstance().getWorld(npc.getInstanceId()); | |
+ final InstanceWorld inst = InstanceManager.getInstance().getWorld(npc.getInstanceId()); | |
if (inst instanceof NornilsWorld) | |
{ | |
NornilsWorld world = ((NornilsWorld) inst); | |
@@ -358,7 +340,7 @@ | |
private void spawn2(L2Npc npc) | |
{ | |
- InstanceWorld inst = InstanceManager.getInstance().getWorld(npc.getInstanceId()); | |
+ final InstanceWorld inst = InstanceManager.getInstance().getWorld(npc.getInstanceId()); | |
if (inst instanceof NornilsWorld) | |
{ | |
NornilsWorld world = ((NornilsWorld) inst); | |
@@ -376,7 +358,7 @@ | |
private void spawn3(L2Character cha) | |
{ | |
- InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId()); | |
+ final InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId()); | |
if (inst instanceof NornilsWorld) | |
{ | |
NornilsWorld world = ((NornilsWorld) inst); | |
@@ -394,7 +376,7 @@ | |
private void spawn4(L2Character cha) | |
{ | |
- InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId()); | |
+ final InstanceWorld inst = InstanceManager.getInstance().getWorld(cha.getInstanceId()); | |
if (inst instanceof NornilsWorld) | |
{ | |
NornilsWorld world = ((NornilsWorld) inst); | |
@@ -413,7 +395,7 @@ | |
public void openDoor(QuestState st, L2PcInstance player, int doorId) | |
{ | |
st.unset("correct"); | |
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId()); | |
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(player.getInstanceId()); | |
if (tmpworld instanceof NornilsWorld) | |
{ | |
openDoor(doorId, tmpworld.getInstanceId()); | |
@@ -497,7 +479,7 @@ | |
{ | |
if ((character instanceof L2PcInstance) && !character.isDead() && !character.isTeleporting() && ((L2PcInstance) character).isOnline()) | |
{ | |
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character.getInstanceId()); | |
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(character.getInstanceId()); | |
if (tmpworld instanceof NornilsWorld) | |
{ | |
for (int _auto[] : _auto_gates) | |
@@ -602,7 +584,6 @@ | |
} | |
return getNoQuestMsg(player); | |
} | |
- | |
return null; | |
} | |
@@ -666,9 +647,4 @@ | |
} | |
return super.onKill(npc, player, isSummon); | |
} | |
- | |
- public static void main(String[] args) | |
- { | |
- new NornilsGarden(); | |
- } | |
} | |
Index: dist/game/data/scripts/instances/InstanceLoader.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/InstanceLoader.java (revision 0) | |
+++ dist/game/data/scripts/instances/InstanceLoader.java (working copy) | |
@@ -0,0 +1,104 @@ | |
+/* | |
+ * 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.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, | |
+ 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); | |
+ } | |
+ } | |
+ } | |
+} | |
Index: dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java (revision 18149) | |
+++ dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java (working copy) | |
@@ -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 @@ | |
{ | |
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 @@ | |
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 HotDWorld)) | |
- { | |
- player.sendPacket(SystemMessageId.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); | |
- return 0; | |
- } | |
- teleportPlayer(player, loc, world.getInstanceId(), false); | |
- removeBuffs(player); | |
- return 0; | |
+ world.addAllowed(player.getObjectId()); | |
} | |
- // 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(); | |
+ teleportPlayer(player, WOOD_LOC, world.getInstanceId(), false); | |
} | |
- | |
- private static final void removeBuffs(L2Character ch) | |
- { | |
- ch.stopAllEffectsExceptThoseThatLastThroughDeath(); | |
- if (ch.hasSummon()) | |
- { | |
- ch.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); | |
- } | |
- } | |
- | |
- public static void main(String[] args) | |
- { | |
- new HideoutOfTheDawn(); | |
- } | |
} | |
\ No newline at end of file | |
Index: dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java (revision 18149) | |
+++ dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java (working copy) | |
@@ -45,14 +45,9 @@ | |
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 | |
Index: dist/game/data/scripts/instances/LibraryOfSages/32861.html | |
=================================================================== | |
--- dist/game/data/scripts/instances/LibraryOfSages/32861.html (revision 18149) | |
+++ dist/game/data/scripts/instances/LibraryOfSages/32861.html (working copy) | |
@@ -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 | |
Index: dist/game/data/scripts/instances/AbstractInstance.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/AbstractInstance.java (revision 0) | |
+++ dist/game/data/scripts/instances/AbstractInstance.java (working copy) | |
@@ -0,0 +1,310 @@ | |
+/* | |
+ * 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.Level; | |
+import java.util.logging.Logger; | |
+ | |
+import ai.npc.AbstractNpcAI; | |
+ | |
+import com.l2jserver.Config; | |
+import com.l2jserver.gameserver.enums.InstanceRestrictionType; | |
+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.ALREADY_ENTERED_ANOTHER_INSTANCE_CANT_ENTER); | |
+ 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.getAdditionStyle() == InstanceRestrictionType.onInstanceEnter) | |
+ { | |
+ 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.getAdditionStyle() == InstanceRestrictionType.onInstanceFinish) | |
+ { | |
+ 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 void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance) | |
+ { | |
+ _log.log(Level.WARNING, "Undefined onEnterInstance! ", new RuntimeException()); | |
+ } | |
+ | |
+ 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_S1_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<>(); | |
+ final L2Summon summon = player.getSummon(); | |
+ | |
+ switch (inst.getRemoveBuffType()) | |
+ { | |
+ case "ALL": | |
+ { | |
+ player.stopAllEffectsExceptThoseThatLastThroughDeath(); | |
+ | |
+ if (player.hasSummon()) | |
+ { | |
+ summon.stopAllEffectsExceptThoseThatLastThroughDeath(); | |
+ } | |
+ break; | |
+ } | |
+ case "WHITELIST": | |
+ { | |
+ for (BuffInfo info : player.getEffectList().getBuffs().values()) | |
+ { | |
+ if (!inst.getBuffExceptionList().contains(info.getSkill().getId())) | |
+ { | |
+ buffToRemove.add(info); | |
+ } | |
+ } | |
+ | |
+ if (player.hasSummon()) | |
+ { | |
+ 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); | |
+ } | |
+ } | |
+ | |
+ if (player.hasSummon()) | |
+ { | |
+ 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 | |
Index: dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml | |
=================================================================== | |
--- dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml (revision 18149) | |
+++ dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml (working copy) | |
@@ -4,4 +4,9 @@ | |
<allowSummon val="false"/> | |
<showTimer val="true" increase="true" text="Elapsed Time :" /> | |
<spawnPoint spawnX="52212" spawnY="218998" spawnZ="-3208" /> | |
+ <reenter additionStyle="onInstanceFinish" > | |
+ <reset day="Monday" hour="6" minute="30" /> | |
+ <reset day="Wednesday" hour="6" minute="30" /> | |
+ <reset day="Friday" hour="6" minute="30" /> | |
+ </reenter> | |
</instance> | |
Index: dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java (revision 18149) | |
+++ dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java (working copy) | |
@@ -45,14 +45,9 @@ | |
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 | |
Index: dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java (revision 18149) | |
+++ dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java (working copy) | |
@@ -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.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 @@ | |
* Chambers of Delusion superclass. | |
* @author GKR | |
*/ | |
-public abstract class Chamber extends Quest | |
+public abstract class Chamber extends AbstractInstance | |
{ | |
protected class CDWorld extends InstanceWorld | |
{ | |
@@ -171,9 +172,9 @@ | |
protected Location[] ROOM_ENTER_POINTS; | |
- 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; | |
@@ -206,7 +207,8 @@ | |
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) | |
@@ -252,7 +254,6 @@ | |
} | |
} | |
} | |
- | |
return true; | |
} | |
@@ -406,39 +407,18 @@ | |
} | |
} | |
- 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; | |
- } | |
+ enter((CDWorld) world); | |
+ } | |
+ else | |
+ { | |
final CDWorld currentWorld = (CDWorld) world; | |
teleportPlayer(player, ROOM_ENTER_POINTS[currentWorld.currentRoom], world.getInstanceId()); | |
- return instanceId; | |
} | |
- | |
- // New instance | |
- if (!checkConditions(player)) | |
- { | |
- return 0; | |
- } | |
- 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) | |
@@ -670,9 +650,12 @@ | |
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 | |
Index: dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java (revision 18149) | |
+++ dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java (working copy) | |
@@ -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 @@ | |
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 @@ | |
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 (firstEntrance) | |
{ | |
- 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 | |
- { | |
- // 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); | |
+ spawnNPC(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 @@ | |
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 @@ | |
{ | |
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 spawnNPC(L2PcInstance player, MoSWorld world) | |
{ | |
- ch.stopAllEffectsExceptThoseThatLastThroughDeath(); | |
- if (ch.hasSummon()) | |
+ if (world.elcadia != null) | |
{ | |
- ch.getSummon().stopAllEffectsExceptThoseThatLastThroughDeath(); | |
+ world.elcadia.deleteMe(); | |
} | |
+ world.elcadia = addSpawn(ELCADIA_INSTANCE, player.getX(), player.getY(), player.getZ(), 0, false, 0, false, player.getInstanceId()); | |
+ startQuestTimer("FOLLOW", 3000, world.elcadia, player); | |
} | |
- | |
- 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(); | |
- } | |
} | |
Index: dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java | |
=================================================================== | |
--- dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java (revision 18149) | |
+++ dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java (working copy) | |
@@ -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 @@ | |
* 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 @@ | |
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 @@ | |
}; | |
//@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 (firstEntrance) | |
{ | |
- 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)) | |
- { | |
- 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 ? true : false; | |
curworld.storeTime = System.currentTimeMillis(); | |
if (!player.isInParty()) | |
@@ -215,6 +190,10 @@ | |
} | |
manageNpcSpawn(curworld); | |
} | |
+ else | |
+ { | |
+ teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false); | |
+ } | |
} | |
private void managePlayerEnter(L2PcInstance player, CavernOfThePirateCaptainWorld world) | |
@@ -232,7 +211,8 @@ | |
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 +225,7 @@ | |
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(); | |
@@ -314,11 +295,11 @@ | |
{ | |
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 +382,6 @@ | |
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 +414,7 @@ | |
} | |
} | |
} | |
- saveReenterForPlayers(world); | |
- inst.setDuration(300000); | |
- inst.setEmptyDestroyTime(0); | |
+ finishInstance(world); | |
} | |
return super.onKill(npc, killer, isSummon); | |
} | |
@@ -537,56 +515,4 @@ | |
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(); | |
- } | |
} | |
#P L2J_Server | |
Index: java/com/l2jserver/gameserver/model/entity/Instance.java | |
=================================================================== | |
--- java/com/l2jserver/gameserver/model/entity/Instance.java (revision 10075) | |
+++ java/com/l2jserver/gameserver/model/entity/Instance.java (working copy) | |
@@ -20,6 +20,7 @@ | |
import java.io.File; | |
import java.io.IOException; | |
+import java.time.DayOfWeek; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import java.util.HashMap; | |
@@ -44,6 +45,7 @@ | |
import com.l2jserver.gameserver.ThreadPoolManager; | |
import com.l2jserver.gameserver.datatables.DoorTable; | |
import com.l2jserver.gameserver.datatables.NpcData; | |
+import com.l2jserver.gameserver.enums.InstanceRestrictionType; | |
import com.l2jserver.gameserver.idfactory.IdFactory; | |
import com.l2jserver.gameserver.instancemanager.InstanceManager; | |
import com.l2jserver.gameserver.model.L2Spawn; | |
@@ -59,6 +61,7 @@ | |
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; | |
import com.l2jserver.gameserver.model.actor.templates.L2DoorTemplate; | |
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate; | |
+import com.l2jserver.gameserver.model.holders.InstanceReenterTimeHolder; | |
import com.l2jserver.gameserver.model.instancezone.InstanceWorld; | |
import com.l2jserver.gameserver.network.SystemMessageId; | |
import com.l2jserver.gameserver.network.clientpackets.Say2; | |
@@ -92,6 +95,12 @@ | |
private boolean _showTimer = false; | |
private boolean _isTimerIncrease = true; | |
private String _timerText = ""; | |
+ // Instance reset data | |
+ private InstanceRestrictionType _type = InstanceRestrictionType.none; | |
+ private final List<InstanceReenterTimeHolder> _resetData = new FastList<>(); | |
+ // Instance remove buffs data | |
+ private String _removeBuffType = "NONE"; | |
+ private final List<Integer> _exceptionList = new FastList<>(); | |
protected ScheduledFuture<?> _checkTimeUpTask = null; | |
protected final Map<Integer, ScheduledFuture<?>> _ejectDeadTasks = new FastMap<>(); | |
@@ -655,6 +664,78 @@ | |
_spawnLoc = null; | |
} | |
} | |
+ else if ("reenter".equalsIgnoreCase(n.getNodeName())) | |
+ { | |
+ a = n.getAttributes().getNamedItem("additionStyle"); | |
+ if (a != null) | |
+ { | |
+ _type = InstanceRestrictionType.valueOf(a.getNodeValue()); | |
+ } | |
+ | |
+ for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) | |
+ { | |
+ long time = -1; | |
+ DayOfWeek day = null; | |
+ int hour = -1; | |
+ int minute = -1; | |
+ | |
+ if ("reset".equalsIgnoreCase(d.getNodeName())) | |
+ { | |
+ a = d.getAttributes().getNamedItem("time"); | |
+ if (a != null) | |
+ { | |
+ time = Long.parseLong(a.getNodeValue()); | |
+ | |
+ if (time > 0) | |
+ { | |
+ _resetData.add(new InstanceReenterTimeHolder(time)); | |
+ break; | |
+ } | |
+ } | |
+ else if (time == -1) | |
+ { | |
+ a = d.getAttributes().getNamedItem("day"); | |
+ if (a != null) | |
+ { | |
+ day = DayOfWeek.valueOf(a.getNodeValue().toUpperCase()); | |
+ } | |
+ | |
+ a = d.getAttributes().getNamedItem("hour"); | |
+ if (a != null) | |
+ { | |
+ hour = Integer.parseInt(a.getNodeValue()); | |
+ } | |
+ | |
+ a = d.getAttributes().getNamedItem("minute"); | |
+ if (a != null) | |
+ { | |
+ minute = Integer.parseInt(a.getNodeValue()); | |
+ } | |
+ _resetData.add(new InstanceReenterTimeHolder(day, hour, minute)); | |
+ } | |
+ } | |
+ } | |
+ } | |
+ else if ("removeBuffs".equalsIgnoreCase(n.getNodeName())) | |
+ { | |
+ a = n.getAttributes().getNamedItem("type"); | |
+ if (a != null) | |
+ { | |
+ _removeBuffType = a.getNodeValue().toUpperCase(); | |
+ } | |
+ | |
+ for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling()) | |
+ { | |
+ if ("skill".equalsIgnoreCase(d.getNodeName())) | |
+ { | |
+ a = d.getAttributes().getNamedItem("id"); | |
+ if (a != null) | |
+ { | |
+ _exceptionList.add(Integer.parseInt(a.getNodeValue())); | |
+ } | |
+ } | |
+ } | |
+ } | |
} | |
} | |
@@ -832,4 +913,34 @@ | |
InstanceManager.getInstance().destroyInstance(getId()); | |
} | |
} | |
+ | |
+ public InstanceRestrictionType getAdditionStyle() | |
+ { | |
+ return _type; | |
+ } | |
+ | |
+ public void setAdditionStyle(InstanceRestrictionType style) | |
+ { | |
+ _type = style; | |
+ } | |
+ | |
+ public List<InstanceReenterTimeHolder> getReenterData() | |
+ { | |
+ return _resetData; | |
+ } | |
+ | |
+ public boolean isRemoveBuffEnabled() | |
+ { | |
+ return !_removeBuffType.equals("NONE"); | |
+ } | |
+ | |
+ public String getRemoveBuffType() | |
+ { | |
+ return _removeBuffType; | |
+ } | |
+ | |
+ public List<Integer> getBuffExceptionList() | |
+ { | |
+ return _exceptionList; | |
+ } | |
} | |
\ No newline at end of file | |
Index: java/com/l2jserver/gameserver/model/holders/InstanceReenterTimeHolder.java | |
=================================================================== | |
--- java/com/l2jserver/gameserver/model/holders/InstanceReenterTimeHolder.java (revision 0) | |
+++ java/com/l2jserver/gameserver/model/holders/InstanceReenterTimeHolder.java (working copy) | |
@@ -0,0 +1,69 @@ | |
+/* | |
+ * Copyright (C) 2004-2014 L2J Server | |
+ * | |
+ * This file is part of L2J Server. | |
+ * | |
+ * L2J Server 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 Server 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 com.l2jserver.gameserver.model.holders; | |
+ | |
+import java.time.DayOfWeek; | |
+ | |
+/** | |
+ * Simple class for storing Reenter Data for Intances. | |
+ * @author FallenAngel | |
+ */ | |
+public final class InstanceReenterTimeHolder | |
+{ | |
+ private final DayOfWeek _day; | |
+ private final int _hour; | |
+ private final int _minute; | |
+ private final long _time; | |
+ | |
+ public InstanceReenterTimeHolder(long time) | |
+ { | |
+ _time = time; | |
+ _day = null; | |
+ _hour = -1; | |
+ _minute = -1; | |
+ } | |
+ | |
+ public InstanceReenterTimeHolder(DayOfWeek day, int hour, int minute) | |
+ { | |
+ _time = -1; | |
+ _day = day; | |
+ _hour = hour; | |
+ _minute = minute; | |
+ } | |
+ | |
+ public final Long getTime() | |
+ { | |
+ return _time; | |
+ } | |
+ | |
+ public final DayOfWeek getDay() | |
+ { | |
+ return _day; | |
+ } | |
+ | |
+ public final int getHour() | |
+ { | |
+ return _hour; | |
+ } | |
+ | |
+ public final int getMinute() | |
+ { | |
+ return _minute; | |
+ } | |
+} | |
\ No newline at end of file | |
Index: java/com/l2jserver/gameserver/enums/InstanceRestrictionType.java | |
=================================================================== | |
--- java/com/l2jserver/gameserver/enums/InstanceRestrictionType.java (revision 0) | |
+++ java/com/l2jserver/gameserver/enums/InstanceRestrictionType.java (working copy) | |
@@ -0,0 +1,29 @@ | |
+/* | |
+ * Copyright (C) 2004-2014 L2J Server | |
+ * | |
+ * This file is part of L2J Server. | |
+ * | |
+ * L2J Server 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 Server 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 com.l2jserver.gameserver.enums; | |
+ | |
+/** | |
+ * @author FallenAngel | |
+ */ | |
+public enum InstanceRestrictionType | |
+{ | |
+ none, | |
+ onInstanceEnter, | |
+ onInstanceFinish, | |
+} | |
\ No newline at end of file | |
Index: java/com/l2jserver/Config.java | |
=================================================================== | |
--- java/com/l2jserver/Config.java (revision 10075) | |
+++ java/com/l2jserver/Config.java (working copy) | |
@@ -237,9 +237,6 @@ | |
public static boolean RANDOM_RESPAWN_IN_TOWN_ENABLED; | |
public static boolean OFFSET_ON_TELEPORT_ENABLED; | |
public static int MAX_OFFSET_ON_TELEPORT; | |
- public static boolean RESTORE_PLAYER_INSTANCE; | |
- public static boolean ALLOW_SUMMON_TO_INSTANCE; | |
- public static int EJECT_DEAD_PLAYER_TIME; | |
public static boolean PETITIONING_ALLOWED; | |
public static int MAX_PETITIONS_PER_PLAYER; | |
public static int MAX_PETITIONS_PENDING; | |
@@ -452,6 +449,7 @@ | |
public static boolean SKILL_CHECK_REMOVE; | |
public static boolean SKILL_CHECK_GM; | |
public static boolean DEBUG; | |
+ public static boolean DEBUG_INSTANCES; | |
public static boolean HTML_ACTION_CACHE_DEBUG; | |
public static boolean PACKET_HANDLER_DEBUG; | |
public static boolean DEVELOPER; | |
@@ -538,6 +536,10 @@ | |
public static boolean ALLOW_WEAR; | |
public static int WEAR_DELAY; | |
public static int WEAR_PRICE; | |
+ public static int INSTANCE_FINISH_TIME; | |
+ public static boolean RESTORE_PLAYER_INSTANCE; | |
+ public static boolean ALLOW_SUMMON_TO_INSTANCE; | |
+ public static int EJECT_DEAD_PLAYER_TIME; | |
public static boolean ALLOW_LOTTERY; | |
public static boolean ALLOW_RACE; | |
public static boolean ALLOW_WATER; | |
@@ -1647,9 +1649,6 @@ | |
RANDOM_RESPAWN_IN_TOWN_ENABLED = Character.getBoolean("RandomRespawnInTownEnabled", true); | |
OFFSET_ON_TELEPORT_ENABLED = Character.getBoolean("OffsetOnTeleportEnabled", true); | |
MAX_OFFSET_ON_TELEPORT = Character.getInt("MaxOffsetOnTeleport", 50); | |
- RESTORE_PLAYER_INSTANCE = Character.getBoolean("RestorePlayerInstance", false); | |
- ALLOW_SUMMON_TO_INSTANCE = Character.getBoolean("AllowSummonToInstance", true); | |
- EJECT_DEAD_PLAYER_TIME = 1000 * Character.getInt("EjectDeadPlayerTime", 60); | |
PETITIONING_ALLOWED = Character.getBoolean("PetitioningAllowed", true); | |
MAX_PETITIONS_PER_PLAYER = Character.getInt("MaxPetitionsPerPlayer", 5); | |
MAX_PETITIONS_PENDING = Character.getInt("MaxPetitionsPending", 25); | |
@@ -1739,6 +1738,7 @@ | |
SKILL_CHECK_REMOVE = General.getBoolean("SkillCheckRemove", false); | |
SKILL_CHECK_GM = General.getBoolean("SkillCheckGM", true); | |
DEBUG = General.getBoolean("Debug", false); | |
+ DEBUG_INSTANCES = General.getBoolean("InstanceDebug", false); | |
HTML_ACTION_CACHE_DEBUG = General.getBoolean("HtmlActionCacheDebug", false); | |
PACKET_HANDLER_DEBUG = General.getBoolean("PacketHandlerDebug", false); | |
DEVELOPER = General.getBoolean("Developer", false); | |
@@ -1848,6 +1848,10 @@ | |
ALLOW_WEAR = General.getBoolean("AllowWear", true); | |
WEAR_DELAY = General.getInt("WearDelay", 5); | |
WEAR_PRICE = General.getInt("WearPrice", 10); | |
+ INSTANCE_FINISH_TIME = 1000 * General.getInt("DefaultFinishTime", 300); | |
+ RESTORE_PLAYER_INSTANCE = General.getBoolean("RestorePlayerInstance", false); | |
+ ALLOW_SUMMON_TO_INSTANCE = General.getBoolean("AllowSummonToInstance", false); | |
+ EJECT_DEAD_PLAYER_TIME = 1000 * General.getInt("EjectDeadPlayerTime", 60); | |
ALLOW_LOTTERY = General.getBoolean("AllowLottery", true); | |
ALLOW_RACE = General.getBoolean("AllowRace", true); | |
ALLOW_WATER = General.getBoolean("AllowWater", true); | |
@@ -3053,6 +3057,18 @@ | |
case "wearprice": | |
WEAR_PRICE = Integer.parseInt(pValue); | |
break; | |
+ case "DefaultFinishTime": | |
+ INSTANCE_FINISH_TIME = Integer.parseInt(pValue); | |
+ break; | |
+ case "RestorePlayerInstance": | |
+ RESTORE_PLAYER_INSTANCE = Boolean.parseBoolean(pValue); | |
+ break; | |
+ case "AllowSummonToInstance": | |
+ ALLOW_SUMMON_TO_INSTANCE = Boolean.parseBoolean(pValue); | |
+ break; | |
+ case "EjectDeadPlayerTime": | |
+ EJECT_DEAD_PLAYER_TIME = Integer.parseInt(pValue); | |
+ break; | |
case "allowwater": | |
ALLOW_WATER = Boolean.parseBoolean(pValue); | |
break; | |
@@ -3227,12 +3243,6 @@ | |
case "playerfakedeathupprotection": | |
PLAYER_FAKEDEATH_UP_PROTECTION = Integer.parseInt(pValue); | |
break; | |
- case "restoreplayerinstance": | |
- RESTORE_PLAYER_INSTANCE = Boolean.parseBoolean(pValue); | |
- break; | |
- case "allowsummontoinstance": | |
- ALLOW_SUMMON_TO_INSTANCE = Boolean.parseBoolean(pValue); | |
- break; | |
case "partyxpcutoffmethod": | |
PARTY_XP_CUTOFF_METHOD = pValue; | |
break; | |
Index: dist/game/config/Character.properties | |
=================================================================== | |
--- dist/game/config/Character.properties (revision 10075) | |
+++ dist/game/config/Character.properties (working copy) | |
@@ -721,21 +721,6 @@ | |
# Default: 50 | |
MaxOffsetOnTeleport = 50 | |
-# Restores the player to their previous instance (ie. an instanced area/dungeon) on EnterWorld. | |
-# Default: False | |
-RestorePlayerInstance = False | |
- | |
-# Set whether summon skills can be used to summon players inside an instance. | |
-# When enabled individual instances can have summoning disabled in instance xml's. | |
-# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT | |
-# Default: ? | |
-AllowSummonToInstance = True | |
- | |
-# When a player dies, is removed from instance after a fixed period of time. | |
-# Time in seconds. | |
-# Default: 60 | |
-EjectDeadPlayerTime = 60 | |
- | |
# This option is to enable or disable the use of in game petitions. | |
# The MaxPetitionsPerPlayer is the amount of petitions a player can make. | |
# The MaximumPendingPetitions is the total amount of petitions in the server. | |
Index: java/com/l2jserver/gameserver/model/actor/L2Character.java | |
=================================================================== | |
--- java/com/l2jserver/gameserver/model/actor/L2Character.java (revision 10075) | |
+++ java/com/l2jserver/gameserver/model/actor/L2Character.java (working copy) | |
@@ -782,6 +782,11 @@ | |
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), loc.getInstanceId(), randomOffset); | |
} | |
+ public void teleToLocation(ILocational loc, int randomOffset, int instanceId) | |
+ { | |
+ teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), instanceId, randomOffset); | |
+ } | |
+ | |
public void teleToLocation(ILocational loc, boolean randomOffset) | |
{ | |
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), loc.getInstanceId(), (randomOffset) ? Config.MAX_OFFSET_ON_TELEPORT : 0); | |
Index: dist/game/config/General.properties | |
=================================================================== | |
--- dist/game/config/General.properties (revision 10075) | |
+++ dist/game/config/General.properties (working copy) | |
@@ -542,6 +542,30 @@ | |
# --------------------------------------------------------------------------- | |
+# Instances | |
+# --------------------------------------------------------------------------- | |
+# Restores the player to their previous instance (ie. an instanced area/dungeon) on EnterWorld. | |
+# Default: False | |
+RestorePlayerInstance = False | |
+ | |
+# Set whether summon skills can be used to summon players inside an instance. | |
+# When enabled individual instances can have summoning disabled in instance xml's. | |
+# DEFAULT NEEDS TO BE VERIFIED, MUST BE CHANGED HERE AND IN CONFIG.JAVA IF NOT CORRECT | |
+# Default: False | |
+AllowSummonToInstance = False | |
+ | |
+# When a player dies, is removed from instance after a fixed period of time. | |
+# Time in seconds. | |
+# Default: 60 | |
+EjectDeadPlayerTime = 60 | |
+ | |
+# When is instance finished, is set time to destruction currency instance. | |
+# Time in seconds. | |
+# Default: 300 | |
+DefaultFinishTime = 300 | |
+ | |
+ | |
+# --------------------------------------------------------------------------- | |
# Misc Settings | |
# --------------------------------------------------------------------------- | |
@@ -916,6 +940,10 @@ | |
# Default: False | |
Debug = False | |
+# Instances debugging | |
+# Default: False | |
+InstanceDebug = False | |
+ | |
# Html action cache debugging | |
# Default: False | |
HtmlActionCacheDebug = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment