Skip to content

Instantly share code, notes, and snippets.

@St3eT
Last active August 29, 2015 14:14
Show Gist options
  • Save St3eT/5a780edeaab21e11a863 to your computer and use it in GitHub Desktop.
Save St3eT/5a780edeaab21e11a863 to your computer and use it in GitHub Desktop.
Abstract Instance, author LucusAngel
diff --git a/L2J_Server/dist/game/config/Character.properties b/L2J_Server/dist/game/config/Character.properties
index b8a10c4..39a0176 100644
--- a/L2J_Server/dist/game/config/Character.properties
+++ b/L2J_Server/dist/game/config/Character.properties
@@ -741,21 +741,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.
diff --git a/L2J_Server/dist/game/config/General.properties b/L2J_Server/dist/game/config/General.properties
index 7d3c710..53a0189 100644
--- a/L2J_Server/dist/game/config/General.properties
+++ b/L2J_Server/dist/game/config/General.properties
@@ -463,6 +463,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
+AllowSummonInInstance = 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
# ---------------------------------------------------------------------------
@@ -863,6 +887,10 @@
# Default: False
Debug = False
+# Instances debugging
+# Default: False
+InstanceDebug = False
+
# Html action cache debugging
# Default: False
HtmlActionCacheDebug = False
diff --git a/L2J_Server/java/com/l2jserver/Config.java b/L2J_Server/java/com/l2jserver/Config.java
index c255f66..7a982a3 100644
--- a/L2J_Server/java/com/l2jserver/Config.java
+++ b/L2J_Server/java/com/l2jserver/Config.java
@@ -245,9 +245,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;
@@ -463,6 +460,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;
@@ -534,6 +532,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_IN_INSTANCE;
+ public static int EJECT_DEAD_PLAYER_TIME;
public static boolean ALLOW_LOTTERY;
public static boolean ALLOW_RACE;
public static boolean ALLOW_WATER;
@@ -1632,9 +1634,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);
@@ -1726,6 +1725,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);
@@ -1808,6 +1808,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_IN_INSTANCE = General.getBoolean("AllowSummonInInstance", 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);
@@ -2998,6 +3002,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 "allowsummonininstance":
+ ALLOW_SUMMON_IN_INSTANCE = Boolean.parseBoolean(pValue);
+ break;
+ case "ejectdeadplayertime":
+ EJECT_DEAD_PLAYER_TIME = Integer.parseInt(pValue);
+ break;
case "allowwater":
ALLOW_WATER = Boolean.parseBoolean(pValue);
break;
@@ -3171,12 +3187,6 @@
break;
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;
diff --git a/L2J_Server/java/com/l2jserver/gameserver/enums/InstanceReenterType.java b/L2J_Server/java/com/l2jserver/gameserver/enums/InstanceReenterType.java
new file mode 100644
index 0000000..5eb5edf
--- /dev/null
+++ b/L2J_Server/java/com/l2jserver/gameserver/enums/InstanceReenterType.java
@@ -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 InstanceReenterType
+{
+ NONE,
+ ON_INSTANCE_ENTER,
+ ON_INSTANCE_FINISH,
+}
\ No newline at end of file
diff --git a/L2J_Server/java/com/l2jserver/gameserver/enums/InstanceRemoveBuffType.java b/L2J_Server/java/com/l2jserver/gameserver/enums/InstanceRemoveBuffType.java
new file mode 100644
index 0000000..d9ee34c
--- /dev/null
+++ b/L2J_Server/java/com/l2jserver/gameserver/enums/InstanceRemoveBuffType.java
@@ -0,0 +1,30 @@
+/*
+ * 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 St3eT
+ */
+public enum InstanceRemoveBuffType
+{
+ NONE,
+ ALL,
+ WHITELIST,
+ BLACKLIST,
+}
\ No newline at end of file
diff --git a/L2J_Server/java/com/l2jserver/gameserver/model/actor/L2Character.java b/L2J_Server/java/com/l2jserver/gameserver/model/actor/L2Character.java
index 7786fce..c18b3f5 100644
--- a/L2J_Server/java/com/l2jserver/gameserver/model/actor/L2Character.java
+++ b/L2J_Server/java/com/l2jserver/gameserver/model/actor/L2Character.java
@@ -783,6 +783,11 @@
teleToLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getHeading(), loc.getInstanceId(), randomOffset);
}
+ public void teleToLocation(ILocational loc, int instanceId, int randomOffset)
+ {
+ 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);
diff --git a/L2J_Server/java/com/l2jserver/gameserver/model/entity/Instance.java b/L2J_Server/java/com/l2jserver/gameserver/model/entity/Instance.java
index 2fb30cb..bd53d04 100644
--- a/L2J_Server/java/com/l2jserver/gameserver/model/entity/Instance.java
+++ b/L2J_Server/java/com/l2jserver/gameserver/model/entity/Instance.java
@@ -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,8 @@
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.data.xml.impl.DoorData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
+import com.l2jserver.gameserver.enums.InstanceReenterType;
+import com.l2jserver.gameserver.enums.InstanceRemoveBuffType;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Spawn;
@@ -58,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 +96,12 @@
private boolean _showTimer = false;
private boolean _isTimerIncrease = true;
private String _timerText = "";
+ // Instance reset data
+ private InstanceReenterType _type = InstanceReenterType.NONE;
+ private final List<InstanceReenterTimeHolder> _resetData = new ArrayList<>();
+ // Instance remove buffs data
+ private InstanceRemoveBuffType _removeBuffType = InstanceRemoveBuffType.NONE;
+ private final List<Integer> _exceptionList = new ArrayList<>();
protected ScheduledFuture<?> _checkTimeUpTask = null;
protected final Map<Integer, ScheduledFuture<?>> _ejectDeadTasks = new FastMap<>();
@@ -653,6 +663,78 @@
_spawnLoc = null;
}
}
+ else if ("reenter".equalsIgnoreCase(n.getNodeName()))
+ {
+ a = n.getAttributes().getNamedItem("additionStyle");
+ if (a != null)
+ {
+ _type = InstanceReenterType.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 = InstanceRemoveBuffType.valueOf(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()));
+ }
+ }
+ }
+ }
}
}
@@ -830,4 +912,34 @@
InstanceManager.getInstance().destroyInstance(getId());
}
}
-}
+
+ public InstanceReenterType getReenterType()
+ {
+ return _type;
+ }
+
+ public void setReenterType(InstanceReenterType type)
+ {
+ _type = type;
+ }
+
+ public List<InstanceReenterTimeHolder> getReenterData()
+ {
+ return _resetData;
+ }
+
+ public boolean isRemoveBuffEnabled()
+ {
+ return getRemoveBuffType() != InstanceRemoveBuffType.NONE;
+ }
+
+ public InstanceRemoveBuffType getRemoveBuffType()
+ {
+ return _removeBuffType;
+ }
+
+ public List<Integer> getBuffExceptionList()
+ {
+ return _exceptionList;
+ }
+}
\ No newline at end of file
diff --git a/L2J_Server/java/com/l2jserver/gameserver/model/holders/InstanceReenterTimeHolder.java b/L2J_Server/java/com/l2jserver/gameserver/model/holders/InstanceReenterTimeHolder.java
new file mode 100644
index 0000000..684d3d4
--- /dev/null
+++ b/L2J_Server/java/com/l2jserver/gameserver/model/holders/InstanceReenterTimeHolder.java
@@ -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
diff --git a/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml b/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml
index 0bfa972..6459dac 100644
--- a/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml
+++ b/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay60.xml
@@ -4,4 +4,9 @@
<allowSummon val="false"/>
<showTimer val="true" increase="true" text="Elapsed Time :" />
<spawnPoint spawnX="52212" spawnY="218998" spawnZ="-3208" />
+ <reenter additionStyle="ON_INSTANCE_FINISH" >
+ <reset day="Monday" hour="6" minute="30" />
+ <reset day="Wednesday" hour="6" minute="30" />
+ <reset day="Friday" hour="6" minute="30" />
+ </reenter>
</instance>
diff --git a/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml b/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml
index 0694c48..7b9eb20 100644
--- a/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml
+++ b/L2J_DataPack/dist/game/data/instances/CavernOfThePirateCaptainWorldDay83.xml
@@ -4,4 +4,9 @@
<allowSummon val="false"/>
<showTimer val="true" increase="true" text="Elapsed Time :" />
<spawnPoint spawnX="52212" spawnY="218998" spawnZ="-3208" />
-</instance>
+ <reenter additionStyle="ON_INSTANCE_FINISH" >
+ <reset day="Monday" hour="6" minute="30" />
+ <reset day="Wednesday" hour="6" minute="30" />
+ <reset day="Friday" hour="6" minute="30" />
+ </reenter>
+</instance>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/instances/CrystalCaverns.xml b/L2J_DataPack/dist/game/data/instances/CrystalCaverns.xml
index 2453365..96498a1 100644
--- a/L2J_DataPack/dist/game/data/instances/CrystalCaverns.xml
+++ b/L2J_DataPack/dist/game/data/instances/CrystalCaverns.xml
@@ -4,6 +4,9 @@
<allowSummon val="false" />
<emptyDestroyTime val="1200" />
<spawnPoint spawnX="149442" spawnY="173520" spawnZ="-5024" />
+ <reenter additionStyle="ON_INSTANCE_ENTER" >
+ <reset time="86400000" />
+ </reenter>
<doorlist>
<door doorId="24220001" />
<door doorId="24220002" />
diff --git a/L2J_DataPack/dist/game/data/instances/DemonPrince.xml b/L2J_DataPack/dist/game/data/instances/DemonPrince.xml
index dd01992..c05daa7 100644
--- a/L2J_DataPack/dist/game/data/instances/DemonPrince.xml
+++ b/L2J_DataPack/dist/game/data/instances/DemonPrince.xml
@@ -4,6 +4,10 @@
<allowSummon val="false" />
<emptyDestroyTime val="600" />
<spawnPoint spawnX="-22213" spawnY="277138" spawnZ="-9930" />
+ <reenter additionStyle="ON_INSTANCE_FINISH" >
+ <reset day="Wednesday" hour="6" minute="30" />
+ <reset day="Saturday" hour="6" minute="30" />
+ </reenter>
<spawnlist>
<group name="general">
<spawn npcId="25540" x="-22199" y="278407" z="-8264" heading="0" respawn="0" />
diff --git a/L2J_DataPack/dist/game/data/instances/DisciplesNecropolisPast.xml b/L2J_DataPack/dist/game/data/instances/DisciplesNecropolisPast.xml
index b6290ba..45bc3b8 100644
--- a/L2J_DataPack/dist/game/data/instances/DisciplesNecropolisPast.xml
+++ b/L2J_DataPack/dist/game/data/instances/DisciplesNecropolisPast.xml
@@ -4,6 +4,7 @@
<allowSummon val="false" />
<emptyDestroyTime val="900" />
<spawnPoint spawnX="171895" spawnY="-17501" spawnZ="-4903" />
+ <removeBuffs type="ALL" />
<doorlist>
<door doorId="17240101" />
<door doorId="17240102" />
diff --git a/L2J_DataPack/dist/game/data/instances/FinalEmperialTomb.xml b/L2J_DataPack/dist/game/data/instances/FinalEmperialTomb.xml
index 1b4de4b..0866bf1 100644
--- a/L2J_DataPack/dist/game/data/instances/FinalEmperialTomb.xml
+++ b/L2J_DataPack/dist/game/data/instances/FinalEmperialTomb.xml
@@ -4,6 +4,10 @@
<allowSummon val="false" />
<emptyDestroyTime val="1800" />
<spawnPoint spawnX="181381" spawnY="-80883" spawnZ="-2730" />
+ <reenter additionStyle="NONE" >
+ <reset day="Wednesday" hour="6" minute="30" />
+ <reset day="Saturday" hour="6" minute="30" />
+ </reenter>
<doorlist>
<door doorId="17130045" />
<door doorId="17130051" />
diff --git a/L2J_DataPack/dist/game/data/instances/HideoutOfTheDawn.xml b/L2J_DataPack/dist/game/data/instances/HideoutOfTheDawn.xml
index 7cac997..8e4d8fb 100644
--- a/L2J_DataPack/dist/game/data/instances/HideoutOfTheDawn.xml
+++ b/L2J_DataPack/dist/game/data/instances/HideoutOfTheDawn.xml
@@ -4,6 +4,7 @@
<allowSummon val="false" />
<emptyDestroyTime val="30" />
<spawnPoint spawnX="147072" spawnY="23743" spawnZ="-1984" />
+ <removeBuffs type="ALL" />
<spawnlist>
<group name="general">
<!-- Franz -->
diff --git a/L2J_DataPack/dist/game/data/instances/IceQueensCastleNormalBattle.xml b/L2J_DataPack/dist/game/data/instances/IceQueensCastleNormalBattle.xml
index 982c1c7..af7eb7a 100644
--- a/L2J_DataPack/dist/game/data/instances/IceQueensCastleNormalBattle.xml
+++ b/L2J_DataPack/dist/game/data/instances/IceQueensCastleNormalBattle.xml
@@ -4,6 +4,10 @@
<allowSummon val="false" />
<emptyDestroyTime val="600" />
<spawnPoint spawnX="115717" spawnY="-125734" spawnZ="-3392" />
+ <reenter additionStyle="ON_INSTANCE_FINISH" >
+ <reset day="Wednesday" hour="6" minute="30" />
+ <reset day="Saturday" hour="6" minute="30" />
+ </reenter>
<doorlist>
<door doorId="23140101" />
</doorlist>
diff --git a/L2J_DataPack/dist/game/data/instances/MonasteryOfSilence.xml b/L2J_DataPack/dist/game/data/instances/MonasteryOfSilence.xml
index f5d01c2..a0feb48 100644
--- a/L2J_DataPack/dist/game/data/instances/MonasteryOfSilence.xml
+++ b/L2J_DataPack/dist/game/data/instances/MonasteryOfSilence.xml
@@ -4,6 +4,7 @@
<allowSummon val="false" />
<emptyDestroyTime val="1" />
<spawnPoint spawnX="115983" spawnY="-87351" spawnZ="-3397" />
+ <removeBuffs type="ALL" />
<spawnlist>
<group name="general">
<!-- Eris's Evil Thoughts -->
diff --git a/L2J_DataPack/dist/game/data/instances/NornilsGarden.xml b/L2J_DataPack/dist/game/data/instances/NornilsGarden.xml
index 9bb7251..e33d9c9 100644
--- a/L2J_DataPack/dist/game/data/instances/NornilsGarden.xml
+++ b/L2J_DataPack/dist/game/data/instances/NornilsGarden.xml
@@ -4,6 +4,7 @@
<allowSummon val="false" />
<emptyDestroyTime val="3000" />
<spawnPoint spawnX="-84757" spawnY="60009" spawnZ="-2581" />
+ <removeBuffs type="ALL" />
<doorlist>
<door doorId="16200001" />
<door doorId="16200002" />
diff --git a/L2J_DataPack/dist/game/data/instances/Ranku.xml b/L2J_DataPack/dist/game/data/instances/Ranku.xml
index f75fe34..f8aa548 100644
--- a/L2J_DataPack/dist/game/data/instances/Ranku.xml
+++ b/L2J_DataPack/dist/game/data/instances/Ranku.xml
@@ -4,6 +4,10 @@
<allowSummon val="false" />
<emptyDestroyTime val="600" />
<spawnPoint spawnX="-19006" spawnY="277065" spawnZ="-13383" />
+ <reenter additionStyle="ON_INSTANCE_FINISH" >
+ <reset day="Wednesday" hour="6" minute="30" />
+ <reset day="Saturday" hour="6" minute="30" />
+ </reenter>
<spawnlist>
<group name="general">
<spawn npcId="25542" x="-19056" y="278732" z="-15000" heading="0" respawn="0" />
diff --git a/L2J_DataPack/dist/game/data/scripts.cfg b/L2J_DataPack/dist/game/data/scripts.cfg
index f0034d0..4a6d347 100644
--- a/L2J_DataPack/dist/game/data/scripts.cfg
+++ b/L2J_DataPack/dist/game/data/scripts.cfg
@@ -171,37 +171,8 @@
village_master/ProofOfCourage/ProofOfCourage.java
village_master/ProofOfJustice/ProofOfJustice.java
-# 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/FaeronTrainingGrounds1/FaeronTrainingGrounds1.java
-instances/FaeronTrainingGrounds2/FaeronTrainingGrounds2.java
-instances/FinalEmperialTomb/FinalEmperialTomb.java
-instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java
-instances/HideoutOfTheDawn/HideoutOfTheDawn.java
-instances/IceQueensCastle/IceQueensCastle.java
-instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java
-instances/JiniaGuildHideout1/JiniaGuildHideout1.java
-instances/JiniaGuildHideout2/JiniaGuildHideout2.java
-instances/JiniaGuildHideout3/JiniaGuildHideout3.java
-instances/JiniaGuildHideout4/JiniaGuildHideout4.java
-instances/LibraryOfSages/LibraryOfSages.java
-instances/Kamaloka/Kamaloka.java
-instances/MithrilMine/MithrilMine.java
-instances/MonasteryOfSilence1/MonasteryOfSilence1.java
-instances/NornilsGarden/NornilsGarden.java
-instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java
-instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java
-instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java
+# Instance Section
+instances/InstanceLoader.java
# Gracia Section
gracia/GraciaLoader.java
diff --git a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/CallPc.java b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/CallPc.java
index fd822ca..6d9e1f4 100644
--- a/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/CallPc.java
+++ b/L2J_DataPack/dist/game/data/scripts/handlers/effecthandlers/CallPc.java
@@ -155,7 +155,7 @@
if (activeChar.getInstanceId() > 0)
{
Instance summonerInstance = InstanceManager.getInstance().getInstance(activeChar.getInstanceId());
- if (!Config.ALLOW_SUMMON_TO_INSTANCE || !summonerInstance.isSummonAllowed())
+ if (!Config.ALLOW_SUMMON_IN_INSTANCE || !summonerInstance.isSummonAllowed())
{
activeChar.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION);
return false;
diff --git a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java
index 739d8df..1fd26d4 100644
--- a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java
+++ b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/DemonPrinceFloor/DemonPrinceFloor.java
@@ -18,14 +18,12 @@
*/
package hellbound.Instances.DemonPrinceFloor;
-import java.util.Calendar;
-
-import ai.npc.AbstractNpcAI;
+import instances.AbstractInstance;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Party;
-import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.Location;
+import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
@@ -38,7 +36,7 @@
* 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;
- // Misc
- private static final int TEMPLATE_ID = 142;
- private static final int RESET_HOUR = 6;
- private static final int RESET_MIN = 30;
+ // Locations
private static final Location ENTRY_POINT = new Location(-22208, 277056, -8239);
private static final Location EXIT_POINT = new Location(-19024, 277122, -8256);
+ // Misc
+ private static final int TEMPLATE_ID = 142;
+ private static final int MIN_LV = 78;
public DemonPrinceFloor()
{
super(DemonPrinceFloor.class.getSimpleName(), "hellbound/Instances");
- addStartNpc(GK_4);
- addStartNpc(CUBE);
- addTalkId(GK_4);
- addTalkId(CUBE);
+ addStartNpc(GK_4, CUBE);
+ addTalkId(GK_4, CUBE);
addKillId(DEMON_PRINCE);
}
@@ -74,16 +70,26 @@
String htmltext = null;
if (npc.getId() == GK_4)
{
- htmltext = checkConditions(player);
+ if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
+ {
+ if (player.getParty() == null)
+ {
+ htmltext = "gk-noparty.htm";
+ }
+ else if (!player.getParty().isLeader(player))
+ {
+ htmltext = "gk-noleader.htm";
+ }
+ }
if (htmltext == null)
{
- enterInstance(player, "DemonPrince.xml");
+ enterInstance(player, new DPFWorld(), "DemonPrince.xml", TEMPLATE_ID);
}
}
else if (npc.getId() == CUBE)
{
- InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+ final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (world instanceof DPFWorld)
{
world.removeAllowed(player.getObjectId());
@@ -99,51 +105,27 @@
final int instanceId = npc.getInstanceId();
if (instanceId > 0)
{
- Instance inst = InstanceManager.getInstance().getInstance(instanceId);
- InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+ final Instance inst = InstanceManager.getInstance().getInstance(instanceId);
+ final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
inst.setSpawnLoc(EXIT_POINT);
- // Terminate instance in 10 min
- if ((inst.getInstanceEndTime() - System.currentTimeMillis()) > 600000)
- {
- inst.setDuration(600000);
- }
-
- inst.setEmptyDestroyTime(0);
-
- if (world instanceof DPFWorld)
- {
- setReenterTime(world);
- }
+ finishInstance(world);
addSpawn(CUBE, -22144, 278744, -8239, 0, false, 0, false, instanceId);
}
return super.onKill(npc, killer, isSummon);
}
- private String checkConditions(L2PcInstance player)
+ @Override
+ protected boolean checkConditions(L2PcInstance player)
{
- if (player.getParty() == null)
+ if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
{
- return "gk-noparty.htm";
- }
- else if (!player.getParty().isLeader(player))
- {
- return "gk-noleader.htm";
+ return true;
}
- return null;
- }
-
- private boolean checkTeleport(L2PcInstance player)
- {
final L2Party party = player.getParty();
- if (party == null)
- {
- return false;
- }
-
- if (!party.isLeader(player))
+ if ((party == null) || !party.isLeader(player))
{
player.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
return false;
@@ -151,125 +133,64 @@
for (L2PcInstance partyMember : party.getMembers())
{
- if (partyMember.getLevel() < 78)
+ if (partyMember.getLevel() < MIN_LV)
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY).addPcName(partyMember));
return false;
}
if (!Util.checkIfInRange(500, player, partyMember, true))
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember));
return false;
}
if (InstanceManager.getInstance().getPlayerWorld(player) != null)
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember));
return false;
}
- Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
+ final Long reentertime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
if (System.currentTimeMillis() < reentertime)
{
- SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(partyMember));
return false;
}
if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_5, -1, false) < 1)
{
- SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember));
return false;
}
}
return true;
}
- private void enterInstance(L2PcInstance player, String template)
+ @Override
+ public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
- InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
-
- if (world != null)
+ if (firstEntrance)
{
- if (world instanceof DPFWorld)
+ if (player.getParty() == null)
{
teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
- return;
- }
- player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- return;
- }
-
- if (!checkTeleport(player))
- {
- return;
- }
-
- world = new DPFWorld();
- world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
- world.setTemplateId(TEMPLATE_ID);
- world.addAllowed(player.getObjectId());
- world.setStatus(0);
- InstanceManager.getInstance().addWorld(world);
- teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
-
- _log.info("Tower of Infinitum - Demon Prince floor started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
-
- for (L2PcInstance partyMember : player.getParty().getMembers())
- {
- teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
- partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true);
- world.addAllowed(partyMember.getObjectId());
- }
- }
-
- public void setReenterTime(InstanceWorld world)
- {
- if (world instanceof DPFWorld)
- {
- // Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable
- Calendar reenter;
- Calendar now = Calendar.getInstance();
- Calendar reenterPointWed = (Calendar) now.clone();
- reenterPointWed.set(Calendar.AM_PM, Calendar.AM);
- reenterPointWed.set(Calendar.MINUTE, RESET_MIN);
- reenterPointWed.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
- reenterPointWed.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
- Calendar reenterPointSat = (Calendar) reenterPointWed.clone();
- reenterPointSat.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
-
- if (now.after(reenterPointSat))
- {
- reenterPointWed.add(Calendar.WEEK_OF_MONTH, 1);
- reenter = (Calendar) reenterPointWed.clone();
+ player.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true);
+ world.addAllowed(player.getObjectId());
}
else
{
- reenter = (Calendar) reenterPointSat.clone();
- }
-
- SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE);
- sm.addInstanceName(world.getTemplateId());
- // set instance reenter time for all allowed players
- for (int objectId : world.getAllowed())
- {
- L2PcInstance player = L2World.getInstance().getPlayer(objectId);
- if ((player != null) && player.isOnline())
+ for (L2PcInstance partyMember : player.getParty().getMembers())
{
- InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis());
- player.sendPacket(sm);
+ teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
+ partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_5, 1, null, true);
+ world.addAllowed(partyMember.getObjectId());
}
}
}
+ else
+ {
+ teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
+ }
}
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java
index cecc5ed..9113a06 100644
--- a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java
+++ b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/RankuFloor/RankuFloor.java
@@ -18,14 +18,12 @@
*/
package hellbound.Instances.RankuFloor;
-import java.util.Calendar;
-
-import ai.npc.AbstractNpcAI;
+import instances.AbstractInstance;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Party;
-import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.Location;
+import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
@@ -38,7 +36,7 @@
* 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;
- // Misc
- private static final int TEMPLATE_ID = 143;
- private static final int RESET_HOUR = 6;
- private static final int RESET_MIN = 30;
+ // Locations
private static final Location ENTRY_POINT = new Location(-19008, 277024, -15000);
private static final Location EXIT_POINT = new Location(-19008, 277122, -13376);
+ // Misc
+ private static final int TEMPLATE_ID = 143;
+ private static final int MIN_LV = 78;
public RankuFloor()
{
super(RankuFloor.class.getSimpleName(), "hellbound/Instances");
- addStartNpc(GK_9);
- addStartNpc(CUBE);
- addTalkId(GK_9);
- addTalkId(CUBE);
+ addStartNpc(GK_9, CUBE);
+ addTalkId(GK_9, CUBE);
addKillId(RANKU);
}
@@ -75,11 +71,21 @@
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,55 +102,29 @@
@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";
- }
- else if (player.getParty().getLeaderObjectId() != player.getObjectId())
- {
- return "gk-noleader.htm";
+ return true;
}
- return null;
- }
-
- private boolean checkTeleport(L2PcInstance player)
- {
final L2Party party = player.getParty();
- if (party == null)
- {
- return false;
- }
-
- if (!party.isLeader(player))
+ if ((party == null) || !party.isLeader(player))
{
player.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
return false;
@@ -153,125 +132,64 @@
for (L2PcInstance partyMember : party.getMembers())
{
- if (partyMember.getLevel() < 78)
+ if (partyMember.getLevel() < MIN_LV)
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY).addPcName(partyMember));
return false;
}
if (!Util.checkIfInRange(500, player, partyMember, true))
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember));
return false;
}
if (InstanceManager.getInstance().getPlayerWorld(player) != null)
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember));
return false;
}
final Long reenterTime = InstanceManager.getInstance().getInstanceTime(partyMember.getObjectId(), TEMPLATE_ID);
if (System.currentTimeMillis() < reenterTime)
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(partyMember));
return false;
}
if (partyMember.getInventory().getInventoryItemCount(SEAL_BREAKER_10, -1, false) < 1)
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addPcName(partyMember));
return false;
}
}
return true;
}
- private void enterInstance(L2PcInstance player, String template)
+ @Override
+ public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
- InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
-
- if (world != null)
+ if (firstEntrance)
{
- if (world instanceof RFWorld)
+ if (player.getParty() == null)
{
teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
- return;
- }
- player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- return;
- }
-
- if (!checkTeleport(player))
- {
- return;
- }
-
- world = new RFWorld();
- world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
- world.setTemplateId(TEMPLATE_ID);
- world.addAllowed(player.getObjectId());
- world.setStatus(0);
- InstanceManager.getInstance().addWorld(world);
- teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
-
- _log.info("Tower of Infinitum - Ranku floor started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
-
- for (L2PcInstance partyMember : player.getParty().getMembers())
- {
- teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
- partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true);
- world.addAllowed(partyMember.getObjectId());
- }
- }
-
- public void setReenterTime(InstanceWorld world)
- {
- if (world instanceof RFWorld)
- {
- // Reenter time should be cleared every Wed and Sat at 6:30 AM, so we set next suitable
- Calendar reenter;
- Calendar now = Calendar.getInstance();
- Calendar reenterPointWed = (Calendar) now.clone();
- reenterPointWed.set(Calendar.AM_PM, Calendar.AM);
- reenterPointWed.set(Calendar.MINUTE, RESET_MIN);
- reenterPointWed.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
- reenterPointWed.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
- Calendar reenterPointSat = (Calendar) reenterPointWed.clone();
- reenterPointSat.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
-
- if (now.after(reenterPointSat))
- {
- reenterPointWed.add(Calendar.WEEK_OF_MONTH, 1);
- reenter = (Calendar) reenterPointWed.clone();
+ player.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true);
+ world.addAllowed(player.getObjectId());
}
else
{
- reenter = (Calendar) reenterPointSat.clone();
- }
-
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE);
- sm.addInstanceName(world.getTemplateId());
- // set instance reenter time for all allowed players
- for (int objectId : world.getAllowed())
- {
- L2PcInstance player = L2World.getInstance().getPlayer(objectId);
- if ((player != null) && player.isOnline())
+ for (L2PcInstance partyMember : player.getParty().getMembers())
{
- InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), reenter.getTimeInMillis());
- player.sendPacket(sm);
+ teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
+ partyMember.destroyItemByItemId("Quest", SEAL_BREAKER_10, 1, null, true);
+ world.addAllowed(partyMember.getObjectId());
}
}
}
+ else
+ {
+ teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
+ }
}
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java
index cc59b33..5126197 100644
--- a/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java
+++ b/L2J_DataPack/dist/game/data/scripts/hellbound/Instances/UrbanArea/UrbanArea.java
@@ -19,15 +19,15 @@
package hellbound.Instances.UrbanArea;
import hellbound.HellboundEngine;
+import instances.AbstractInstance;
import java.util.concurrent.ScheduledFuture;
-
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.Location;
+import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@@ -47,15 +47,33 @@
* Urban Area instance zone.
* @author GKR
*/
-public final class UrbanArea extends AbstractNpcAI
+public final class UrbanArea extends AbstractInstance
{
protected class UrbanAreaWorld extends InstanceWorld
{
protected L2MonsterInstance spawnedAmaskari;
protected ScheduledFuture<?> activeAmaskariCall = null;
- public boolean isAmaskariDead = false;
+ protected boolean isAmaskariDead = false;
}
+ // NPCs
+ private static final int TOMBSTONE = 32343;
+ private static final int KANAF = 32346;
+ private static final int KEYMASTER = 22361;
+ private static final int AMASKARI = 22449;
+ private static final int DOWNTOWN_NATIVE = 32358;
+ private static final int TOWN_GUARD = 22359;
+ private static final int TOWN_PATROL = 22360;
+ // Items
+ private static final int KEY = 9714;
+ // Skills
+ private static final SkillHolder STONE = new SkillHolder(4616, 1);
+ // Locations
+ private static final Location AMASKARI_SPAWN_POINT = new Location(19424, 253360, -2032, 16860);
+ private static final Location ENTRY_POINT = new Location(14117, 255434, -2016);
+ protected static final Location EXIT_POINT = new Location(16262, 283651, -9700);
+ // Misc
+ private static final int MIN_LV = 78;
private static final int TEMPLATE_ID = 2;
private static final NpcStringId[] NPCSTRING_ID =
@@ -71,35 +89,16 @@
NpcStringId.NOW_I_CAN_ESCAPE_ON_MY_OWN
};
- private static final int TOMBSTONE = 32343;
- private static final int KANAF = 32346;
- private static final int KEYMASTER = 22361;
- private static final int AMASKARI = 22449;
- private static final int DOWNTOWN_NATIVE = 32358;
- private static final int TOWN_GUARD = 22359;
- private static final int TOWN_PATROL = 22360;
- private static final Location AMASKARI_SPAWN_POINT = new Location(19424, 253360, -2032, 16860);
- private static final Location ENTRY_POINT = new Location(14117, 255434, -2016);
- protected static final Location EXIT_POINT = new Location(16262, 283651, -9700);
- private static final SkillHolder STONE = new SkillHolder(4616, 1);
- private static final int KEY = 9714;
-
public UrbanArea()
{
super(UrbanArea.class.getSimpleName(), "hellbound/Instances");
addFirstTalkId(DOWNTOWN_NATIVE);
- addStartNpc(KANAF);
- addStartNpc(DOWNTOWN_NATIVE);
- addTalkId(KANAF);
- addTalkId(DOWNTOWN_NATIVE);
- addAttackId(TOWN_GUARD);
- addAttackId(KEYMASTER);
+ addStartNpc(KANAF, DOWNTOWN_NATIVE);
+ addTalkId(KANAF, DOWNTOWN_NATIVE);
+ addAttackId(TOWN_GUARD, KEYMASTER);
addAggroRangeEnterId(TOWN_GUARD);
addKillId(AMASKARI);
- addSpawnId(DOWNTOWN_NATIVE);
- addSpawnId(TOWN_GUARD);
- addSpawnId(TOWN_PATROL);
- addSpawnId(KEYMASTER);
+ addSpawnId(DOWNTOWN_NATIVE, TOWN_GUARD, TOWN_PATROL, KEYMASTER);
}
@Override
@@ -118,16 +117,27 @@
String htmltext = null;
if (npc.getId() == KANAF)
{
- htmltext = checkConditions(player);
+ if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
+ {
+ if (HellboundEngine.getInstance().getLevel() < 10)
+ {
+ htmltext = "32346-lvl.htm";
+ }
+
+ if (player.getParty() == null)
+ {
+ htmltext = "32346-party.htm";
+ }
+ }
if (htmltext == null)
{
- enterInstance(player, "UrbanArea.xml");
+ enterInstance(player, new UrbanAreaWorld(), "UrbanArea.xml", TEMPLATE_ID);
}
}
else if (npc.getId() == TOMBSTONE)
{
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld))
{
final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld;
@@ -156,7 +166,7 @@
{
npc.setBusy(true);
// destroy instance after 5 min
- Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
+ final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
inst.setDuration(5 * 60000);
inst.setEmptyDestroyTime(0);
ThreadPoolManager.getInstance().scheduleGeneral(new ExitInstance(party, world), 285000);
@@ -190,8 +200,8 @@
{
if (!npc.isAffectedBySkill(STONE.getSkillId()) || world.isAmaskariDead)
{
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NATIVES_NPCSTRING_ID[0]));
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NATIVES_NPCSTRING_ID[2]));
+ broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[0]);
+ broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[2]);
}
else
{
@@ -201,8 +211,8 @@
npc.stopSkillEffects(false, STONE.getSkillId());
}
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NATIVES_NPCSTRING_ID[0]));
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NATIVES_NPCSTRING_ID[1]));
+ broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[0]);
+ broadcastNpcSay(npc, Say2.NPC_ALL, NATIVES_NPCSTRING_ID[1]);
HellboundEngine.getInstance().updateTrust(10, true);
npc.scheduleDespawn(3000);
// Try to call Amaskari
@@ -219,7 +229,7 @@
}
}
}
- return null;
+ return super.onAdvEvent(event, npc, player);
}
@Override
@@ -237,21 +247,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 +269,6 @@
{
world.activeAmaskariCall.cancel(true);
}
-
world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000);
}
}
@@ -271,10 +279,10 @@
@Override
public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isSummon, Skill skill)
{
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if ((tmpworld != null) && (tmpworld instanceof UrbanAreaWorld))
{
- UrbanAreaWorld world = (UrbanAreaWorld) tmpworld;
+ final UrbanAreaWorld world = (UrbanAreaWorld) tmpworld;
if (!world.isAmaskariDead && !(npc.getBusyMessage().equalsIgnoreCase("atk") || npc.isBusy()))
{
@@ -296,7 +304,7 @@
}
if (msgId >= 0)
{
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), NPCSTRING_ID[msgId]));
+ broadcastNpcSay(npc, Say2.NPC_ALL, NPCSTRING_ID[msgId], range);
}
npc.setBusy(true);
npc.setBusyMessage("atk");
@@ -307,7 +315,6 @@
{
world.activeAmaskariCall.cancel(true);
}
-
world.activeAmaskariCall = ThreadPoolManager.getInstance().scheduleGeneral(new CallAmaskari(npc), 25000);
}
}
@@ -318,7 +325,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,30 +334,17 @@
return super.onKill(npc, killer, isSummon);
}
- private String checkConditions(L2PcInstance player)
+ @Override
+ protected boolean checkConditions(L2PcInstance player)
{
- if (HellboundEngine.getInstance().getLevel() < 10)
+ if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
{
- return "32346-lvl.htm";
+ return true;
}
- if (player.getParty() == null)
- {
- return "32346-party.htm";
- }
- return null;
- }
-
- private boolean checkTeleport(L2PcInstance player)
- {
final L2Party party = player.getParty();
- if (party == null)
- {
- return false;
- }
-
- if (!party.isLeader(player))
+ if ((party == null) || !party.isLeader(player))
{
player.sendPacket(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER);
return false;
@@ -358,70 +352,51 @@
for (L2PcInstance partyMember : party.getMembers())
{
- if (partyMember.getLevel() < 78)
+ if (partyMember.getLevel() < MIN_LV)
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY).addPcName(partyMember));
return false;
}
if (!Util.checkIfInRange(1000, player, partyMember, true))
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(partyMember));
return false;
}
if (InstanceManager.getInstance().getPlayerWorld(player) != null)
{
- final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- sm.addPcName(partyMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON).addPcName(partyMember));
return false;
}
}
return true;
}
- private void enterInstance(L2PcInstance player, String template)
+ @Override
+ public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
- InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
-
- if (world != null)
+ if (firstEntrance)
{
- if (world instanceof UrbanAreaWorld)
+ if (player.getParty() == null)
{
teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
- return;
+ world.addAllowed(player.getObjectId());
}
- player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- return;
+ else
+ {
+ for (L2PcInstance partyMember : player.getParty().getMembers())
+ {
+ teleportPlayer(partyMember, ENTRY_POINT, world.getInstanceId());
+ world.addAllowed(partyMember.getObjectId());
+ }
+ }
+ ((UrbanAreaWorld) world).spawnedAmaskari = (L2MonsterInstance) addSpawn(AMASKARI, AMASKARI_SPAWN_POINT, false, 0, false, world.getInstanceId());
}
-
- if (!checkTeleport(player))
+ else
{
- return;
+ teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
}
-
- world = new UrbanAreaWorld();
- world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
- world.setTemplateId(TEMPLATE_ID);
- world.addAllowed(player.getObjectId());
- world.setStatus(0);
- InstanceManager.getInstance().addWorld(world);
- teleportPlayer(player, ENTRY_POINT, world.getInstanceId());
-
- _log.info("Hellbound Town started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
-
- for (L2PcInstance partyMember : player.getParty().getMembers())
- {
- 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
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/AbstractInstance.java b/L2J_DataPack/dist/game/data/scripts/instances/AbstractInstance.java
new file mode 100644
index 0000000..92f50b8
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/AbstractInstance.java
@@ -0,0 +1,330 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J DataPack is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package instances;
+
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.logging.Logger;
+
+import ai.npc.AbstractNpcAI;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.enums.InstanceReenterType;
+import com.l2jserver.gameserver.instancemanager.InstanceManager;
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.L2Summon;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.Instance;
+import com.l2jserver.gameserver.model.holders.InstanceReenterTimeHolder;
+import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
+import com.l2jserver.gameserver.model.skills.BuffInfo;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Abstract class for Instances.
+ * @author FallenAngel
+ */
+public abstract class AbstractInstance extends AbstractNpcAI
+{
+ public final Logger _log = Logger.getLogger(getClass().getSimpleName());
+
+ public AbstractInstance(String name, String desc)
+ {
+ super(name, desc);
+ }
+
+ public AbstractInstance(String name)
+ {
+ super(name, "instances");
+ }
+
+ protected void enterInstance(L2PcInstance player, InstanceWorld instance, String template, int templateId)
+ {
+ final InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
+ if (world != null)
+ {
+ if (world.getTemplateId() == templateId)
+ {
+ onEnterInstance(player, world, false);
+
+ final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
+ if (inst.isRemoveBuffEnabled())
+ {
+ handleRemoveBuffs(player, world);
+ }
+ return;
+ }
+ player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
+ return;
+ }
+
+ if (checkConditions(player))
+ {
+ final InstanceWorld playerWorld = instance;
+ playerWorld.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
+ playerWorld.setTemplateId(templateId);
+ playerWorld.setStatus(0);
+ InstanceManager.getInstance().addWorld(playerWorld);
+ onEnterInstance(player, playerWorld, true);
+
+ final Instance inst = InstanceManager.getInstance().getInstance(playerWorld.getInstanceId());
+ if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_ENTER)
+ {
+ handleReenterTime(playerWorld);
+ }
+
+ if (inst.isRemoveBuffEnabled())
+ {
+ handleRemoveBuffs(playerWorld);
+ }
+
+ if (Config.DEBUG_INSTANCES)
+ {
+ _log.info("Instance " + InstanceManager.getInstance().getInstance(playerWorld.getInstanceId()).getName() + " (" + playerWorld.getTemplateId() + ") has been created by player " + player.getName());
+ }
+ }
+ }
+
+ protected void finishInstance(InstanceWorld world)
+ {
+ finishInstance(world, Config.INSTANCE_FINISH_TIME);
+ }
+
+ protected void finishInstance(InstanceWorld world, int duration)
+ {
+ final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
+
+ if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_FINISH)
+ {
+ handleReenterTime(world);
+ }
+
+ if (duration == 0)
+ {
+ InstanceManager.getInstance().destroyInstance(inst.getId());
+ }
+ else if (duration > 0)
+ {
+ inst.setDuration(duration);
+ inst.setEmptyDestroyTime(0);
+ }
+ }
+
+ protected void handleReenterTime(InstanceWorld world)
+ {
+ final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
+ final List<InstanceReenterTimeHolder> reenterData = inst.getReenterData();
+
+ long time = -1;
+
+ for (InstanceReenterTimeHolder data : reenterData)
+ {
+ if (data.getTime() > 0)
+ {
+ time = System.currentTimeMillis() + data.getTime();
+ break;
+ }
+
+ final Calendar calendar = Calendar.getInstance();
+ calendar.set(Calendar.AM_PM, data.getHour() >= 12 ? 1 : 0);
+ calendar.set(Calendar.HOUR, data.getHour());
+ calendar.set(Calendar.MINUTE, data.getMinute());
+ calendar.set(Calendar.SECOND, 0);
+
+ if (calendar.getTimeInMillis() <= System.currentTimeMillis())
+ {
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ }
+
+ if (data.getDay() != null)
+ {
+ while (calendar.get(Calendar.DAY_OF_WEEK) != (data.getDay().getValue() + 1))
+ {
+ calendar.add(Calendar.DAY_OF_MONTH, 1);
+ }
+ }
+
+ if (time == -1)
+ {
+ time = calendar.getTimeInMillis();
+ }
+ else if (calendar.getTimeInMillis() < time)
+ {
+ time = calendar.getTimeInMillis();
+ }
+ }
+
+ if (time > 0)
+ {
+ setReenterTime(world, time);
+ }
+ }
+
+ protected void handleRemoveBuffs(InstanceWorld world)
+ {
+ for (Integer objId : world.getAllowed())
+ {
+ final L2PcInstance player = L2World.getInstance().getPlayer(objId);
+
+ if (player != null)
+ {
+ handleRemoveBuffs(player, world);
+ }
+ }
+ }
+
+ protected abstract void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance);
+
+ protected boolean checkConditions(L2PcInstance player)
+ {
+ return true;
+ }
+
+ /**
+ * Spawns group of instance NPC's
+ * @param groupName - name of group from XML definition to spawn
+ * @param instanceId - ID of instance
+ * @return list of spawned NPC's
+ */
+ protected List<L2Npc> spawnGroup(String groupName, int instanceId)
+ {
+ return InstanceManager.getInstance().getInstance(instanceId).spawnGroup(groupName);
+ }
+
+ /**
+ * Save Reenter time for every player in InstanceWorld.
+ * @param world - the InstanceWorld
+ * @param time - Time in miliseconds
+ */
+ protected void setReenterTime(InstanceWorld world, long time)
+ {
+ for (int objectId : world.getAllowed())
+ {
+ InstanceManager.getInstance().setInstanceTime(objectId, world.getTemplateId(), time);
+ final L2PcInstance player = L2World.getInstance().getPlayer(objectId);
+ if ((player != null) && player.isOnline())
+ {
+ player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE).addString(InstanceManager.getInstance().getInstance(world.getInstanceId()).getName()));
+ }
+ }
+
+ if (Config.DEBUG_INSTANCES)
+ {
+ _log.info("Time restrictions has been set for player in instance ID: " + world.getInstanceId() + " (" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(time) + ")");
+ }
+ }
+
+ private void handleRemoveBuffs(L2PcInstance player, InstanceWorld world)
+ {
+ final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
+ final List<BuffInfo> buffToRemove = new ArrayList<>();
+
+ switch (inst.getRemoveBuffType())
+ {
+ case ALL:
+ {
+ final L2Summon pet = player.getPet();
+ if (pet != null)
+ {
+ pet.stopAllEffectsExceptThoseThatLastThroughDeath();
+ }
+
+ player.getServitors().values().forEach(L2Summon::stopAllEffectsExceptThoseThatLastThroughDeath);
+ break;
+ }
+ case WHITELIST:
+ {
+ for (BuffInfo info : player.getEffectList().getBuffs().values())
+ {
+ if (!inst.getBuffExceptionList().contains(info.getSkill().getId()))
+ {
+ buffToRemove.add(info);
+ }
+ }
+
+ for (L2Summon summon : player.getServitors().values())
+ {
+ for (BuffInfo info : summon.getEffectList().getBuffs().values())
+ {
+ if (!inst.getBuffExceptionList().contains(info.getSkill().getId()))
+ {
+ buffToRemove.add(info);
+ }
+ }
+ }
+
+ final L2Summon pet = player.getPet();
+ if (pet != null)
+ {
+ for (BuffInfo info : pet.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);
+ }
+ }
+
+ for (L2Summon summon : player.getServitors().values())
+ {
+ for (BuffInfo info : summon.getEffectList().getBuffs().values())
+ {
+ if (inst.getBuffExceptionList().contains(info.getSkill().getId()))
+ {
+ buffToRemove.add(info);
+ }
+ }
+ }
+
+ final L2Summon pet = player.getPet();
+ if (pet != null)
+ {
+ for (BuffInfo info : pet.getEffectList().getBuffs().values())
+ {
+ if (inst.getBuffExceptionList().contains(info.getSkill().getId()))
+ {
+ buffToRemove.add(info);
+ }
+ }
+ }
+ break;
+ }
+ }
+
+ for (BuffInfo info : buffToRemove)
+ {
+ info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
+ }
+ }
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java b/L2J_DataPack/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java
index 3d5dbde..f5cf640 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/CavernOfThePirateCaptain/CavernOfThePirateCaptain.java
@@ -18,22 +18,18 @@
*/
package instances.CavernOfThePirateCaptain;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.List;
+import instances.AbstractInstance;
-import ai.npc.AbstractNpcAI;
+import java.util.ArrayList;
+import java.util.List;
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.L2Summon;
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;
@@ -43,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
@@ -132,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 =
{
@@ -161,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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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;
curworld.storeTime = System.currentTimeMillis();
if (!player.isInParty())
@@ -216,26 +190,21 @@
}
manageNpcSpawn(curworld);
}
+ else
+ {
+ teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false);
+ }
}
private void managePlayerEnter(L2PcInstance player, CavernOfThePirateCaptainWorld world)
{
- if (!world._is83)
- {
- player.stopAllEffectsExceptThoseThatLastThroughDeath();
- final L2Summon pet = player.getPet();
- if (pet != null)
- {
- pet.stopAllEffectsExceptThoseThatLastThroughDeath();
- }
- player.getServitors().values().forEach(L2Summon::stopAllEffectsExceptThoseThatLastThroughDeath);
- }
world.playersInside.add(player);
world.addAllowed(player.getObjectId());
teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false);
}
- private boolean checkConditions(L2PcInstance player, boolean is83)
+ @Override
+ protected boolean checkConditions(L2PcInstance player)
{
if (player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
{
@@ -248,6 +217,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();
@@ -317,11 +287,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
{
@@ -404,7 +374,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)
{
@@ -437,9 +406,7 @@
}
}
}
- saveReenterForPlayers(world);
- inst.setDuration(300000);
- inst.setEmptyDestroyTime(0);
+ finishInstance(world);
}
return super.onKill(npc, killer, isSummon);
}
@@ -540,56 +507,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_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE);
- 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();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java
index d88a7fc..67e4831 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/Chamber.java
@@ -18,6 +18,8 @@
*/
package instances.ChambersOfDelusion;
+import instances.AbstractInstance;
+
import java.util.Calendar;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
@@ -35,7 +37,6 @@
import com.l2jserver.gameserver.model.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
{
@@ -173,9 +174,9 @@
// Misc
private static final String RETURN = Chamber.class.getSimpleName() + "_return";
- protected Chamber(int questId, String name, String descr, int instanceId, String instanceTemplateName, int entranceGKId, int roomGKFirstId, int roomGKLastId, int aenkinelId, int boxId)
+ protected Chamber(String name, String descr, int instanceId, String instanceTemplateName, int entranceGKId, int roomGKFirstId, int roomGKLastId, int aenkinelId, int boxId)
{
- super(questId, name, descr);
+ super(name, descr);
INSTANCEID = instanceId;
INSTANCE_TEMPLATE = instanceTemplateName;
@@ -208,7 +209,8 @@
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)
@@ -402,39 +404,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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON));
- 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)
@@ -635,7 +616,6 @@
{
npc.doDie(player);
}
-
return super.onSpellFinished(npc, player, skill);
}
@@ -652,7 +632,11 @@
if (npcId == ENTRANCE_GATEKEEPER)
{
- enterInstance(player);
+ if (checkConditions(player))
+ {
+ final L2Party party = player.getParty();
+ enterInstance(player, new CDWorld(party), INSTANCE_TEMPLATE, INSTANCEID);
+ }
}
return "";
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java
index 53716ae..35780ef 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionEast.java
@@ -45,14 +45,9 @@
private static final int INSTANCEID = 127;
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionEast.xml";
- private ChamberOfDelusionEast()
+ public ChamberOfDelusionEast()
{
- super(-1, ChamberOfDelusionEast.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
+ super(ChamberOfDelusionEast.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
- }
-
- public static void main(String[] args)
- {
- new ChamberOfDelusionEast();
}
}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java
index 10708db..3eb89a0 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionNorth.java
@@ -45,14 +45,9 @@
private static final int INSTANCEID = 130; // this is the client number
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionNorth.xml";
- private ChamberOfDelusionNorth()
+ public ChamberOfDelusionNorth()
{
- super(-1, ChamberOfDelusionNorth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
+ super(ChamberOfDelusionNorth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
- }
-
- public static void main(String[] args)
- {
- new ChamberOfDelusionNorth();
}
}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java
index d681e3f..e4f4d9d 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSouth.java
@@ -45,14 +45,9 @@
private static final int INSTANCEID = 129; // this is the client number
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionSouth.xml";
- private ChamberOfDelusionSouth()
+ public ChamberOfDelusionSouth()
{
- super(-1, ChamberOfDelusionSouth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
+ super(ChamberOfDelusionSouth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
- }
-
- public static void main(String[] args)
- {
- new ChamberOfDelusionSouth();
}
}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java
index 4e5867b..22ef833 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionSquare.java
@@ -49,14 +49,9 @@
private static final int INSTANCEID = 131;
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionSquare.xml";
- private ChamberOfDelusionSquare()
+ public ChamberOfDelusionSquare()
{
- super(-1, ChamberOfDelusionSquare.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
+ super(ChamberOfDelusionSquare.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
- }
-
- public static void main(String[] args)
- {
- new ChamberOfDelusionSquare();
}
}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java
index b082219..8b3b8a2 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionTower.java
@@ -49,14 +49,9 @@
private static final int INSTANCEID = 132; // this is the client number
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionTower.xml";
- private ChamberOfDelusionTower()
+ public ChamberOfDelusionTower()
{
- super(-1, ChamberOfDelusionTower.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
+ super(ChamberOfDelusionTower.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
- }
-
- public static void main(String[] args)
- {
- new ChamberOfDelusionTower();
}
}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java
index 5e9a1a9..0e77369 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/ChambersOfDelusion/ChamberOfDelusionWest.java
@@ -45,14 +45,9 @@
private static final int INSTANCEID = 128; // this is the client number
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionWest.xml";
- private ChamberOfDelusionWest()
+ public ChamberOfDelusionWest()
{
- super(-1, ChamberOfDelusionWest.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
+ super(ChamberOfDelusionWest.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
- }
-
- public static void main(String[] args)
- {
- new ChamberOfDelusionWest();
}
}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java b/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
index bdb41f6..22f6914 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/CrystalCaverns/CrystalCaverns.java
@@ -18,6 +18,8 @@
*/
package instances.CrystalCaverns;
+import instances.AbstractInstance;
+
import java.util.List;
import java.util.Map;
@@ -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,14 @@
-11886,
16384
};
-
- // mobs
private static final int GK1 = 22275;
private static final int GK2 = 22277;
-
private static final int TOURMALINE = 22292;
private static final int TEROD = 22301;
private static final int DOLPH = 22299;
private static final int WEYLIN = 22298;
private static final int GUARDIAN = 22303;
private static final int GUARDIAN2 = 22304;
-
private static final int TEARS = 25534;
private static final int TEARS_COPY = 25535;
private static final int KECHI = 25532;
@@ -174,7 +168,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 =
{
@@ -221,7 +214,11 @@
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,277 @@
20106,
20107
};
-
- // Baylor alarm spawns
+ // @formatter:off
private final static int[][] ALARMSPAWN =
{
- {
- 153572,
- 141277,
- -12738
- },
- {
- 153572,
- 142852,
- -12738
- },
- {
- 154358,
- 142075,
- -12738
- },
- {
- 152788,
- 142075,
- -12738
- }
+ {153572, 141277, -12738},
+ {153572, 142852, -12738},
+ {154358, 142075, -12738},
+ {152788, 142075, -12738}
};
-
// Oracle order
private static final int[][] ordreOracle1 =
{
- {
- 32274,
- 147090,
- 152505,
- -12169,
- 31613
- },
- {
- 32275,
- 147090,
- 152575,
- -12169,
- 31613
- },
- {
- 32274,
- 147090,
- 152645,
- -12169,
- 31613
- },
- {
- 32274,
- 147090,
- 152715,
- -12169,
- 31613
- }
+ {32274, 147090, 152505, -12169, 31613},
+ {32275, 147090, 152575, -12169, 31613},
+ {32274, 147090, 152645, -12169, 31613},
+ {32274, 147090, 152715, -12169, 31613}
};
private static final int[][] ordreOracle2 =
{
- {
- 32274,
- 149783,
- 152505,
- -12169,
- 31613
- },
+ {32274, 149783, 152505, -12169, 31613},
// {32274, 149783, 152575, -12169, 31613},
- {
- 32274,
- 149783,
- 152645,
- -12169,
- 31613
- },
- {
- 32276,
- 149783,
- 152715,
- -12169,
- 31613
- }
+ {32274, 149783, 152645, -12169, 31613},
+ {32276, 149783, 152715, -12169, 31613}
};
private static final int[][] ordreOracle3 =
{
- {
- 32274,
- 152461,
- 152505,
- -12169,
- 31613
- },
+ {32274, 152461, 152505, -12169, 31613},
// {32274, 152461, 152575, -12169, 31613},
- {
- 32277,
- 152461,
- 152645,
- -12169,
- 31613
- }
- // {32274, 152461, 152715, -12169, 31613}
+ {32277, 152461, 152645, -12169, 31613},
+ // {32274, 152461, 152715, -12169, 31613}
};
-
- // Hall spawns
- private static int[][] SPAWNS =
+ private static int[][] HALL_SPAWNS =
{
- {
- 141842,
- 152556,
- -11814,
- 50449
- },
- {
- 141503,
- 153395,
- -11814,
- 40738
- },
- {
- 141070,
- 153201,
- -11814,
- 39292
- },
- {
- 141371,
- 152986,
- -11814,
- 35575
- },
- {
- 141602,
- 154188,
- -11814,
- 24575
- },
- {
- 141382,
- 154719,
- -11814,
- 37640
- },
- {
- 141376,
- 154359,
- -11814,
- 12054
- },
- {
- 140895,
- 154383,
- -11814,
- 37508
- },
- {
- 140972,
- 154740,
- -11814,
- 52690
- },
- {
- 141045,
- 154504,
- -11814,
- 50674
- },
- {
- 140757,
- 152740,
- -11814,
- 39463
- },
- {
- 140406,
- 152376,
- -11814,
- 16599
- },
- {
- 140268,
- 152007,
- -11817,
- 45316
- },
- {
- 139996,
- 151485,
- -11814,
- 47403
- },
- {
- 140378,
- 151190,
- -11814,
- 58116
- },
- {
- 140521,
- 150711,
- -11815,
- 55997
- },
- {
- 140816,
- 150215,
- -11814,
- 53682
- },
- {
- 141528,
- 149909,
- -11814,
- 22020
- },
- {
- 141644,
- 150360,
- -11817,
- 13283
- },
- {
- 142048,
- 150695,
- -11815,
- 5929
- },
- {
- 141852,
- 151065,
- -11817,
- 27071
- },
- {
- 142408,
- 151211,
- -11815,
- 2402
- },
- {
- 142481,
- 151762,
- -11815,
- 12876
- },
- {
- 141929,
- 152193,
- -11815,
- 27511
- },
- {
- 142083,
- 151791,
- -11814,
- 47176
- },
- {
- 141435,
- 150402,
- -11814,
- 41798
- },
- {
- 140390,
- 151199,
- -11814,
- 50069
- },
- {
- 140557,
- 151849,
- -11814,
- 45293
- },
- {
- 140964,
- 153445,
- -11814,
- 56672
- },
- {
- 142851,
- 154109,
- -11814,
- 24920
- },
- {
- 142379,
- 154725,
- -11814,
- 30342
- },
- {
- 142816,
- 154712,
- -11814,
- 33193
- },
- {
- 142276,
- 154223,
- -11814,
- 33922
- },
- {
- 142459,
- 154490,
- -11814,
- 33184
- },
- {
- 142819,
- 154372,
- -11814,
- 21318
- },
- {
- 141157,
- 154541,
- -11814,
- 27090
- },
- {
- 141095,
- 150281,
- -11814,
- 55186
- }
+ {141842, 152556, -11814, 50449},
+ {141503, 153395, -11814, 40738},
+ {141070, 153201, -11814, 39292},
+ {141371, 152986, -11814, 35575},
+ {141602, 154188, -11814, 24575},
+ {141382, 154719, -11814, 37640},
+ {141376, 154359, -11814, 12054},
+ {140895, 154383, -11814, 37508},
+ {140972, 154740, -11814, 52690},
+ {141045, 154504, -11814, 50674},
+ {140757, 152740, -11814, 39463},
+ {140406, 152376, -11814, 16599},
+ {140268, 152007, -11817, 45316},
+ {139996, 151485, -11814, 47403},
+ {140378, 151190, -11814, 58116},
+ {140521, 150711, -11815, 55997},
+ {140816, 150215, -11814, 53682},
+ {141528, 149909, -11814, 22020},
+ {141644, 150360, -11817, 13283},
+ {142048, 150695, -11815, 5929},
+ {141852, 151065, -11817, 27071},
+ {142408, 151211, -11815, 2402},
+ {142481, 151762, -11815, 12876},
+ {141929, 152193, -11815, 27511},
+ {142083, 151791, -11814, 47176},
+ {141435, 150402, -11814, 41798},
+ {140390, 151199, -11814, 50069},
+ {140557, 151849, -11814, 45293},
+ {140964, 153445, -11814, 56672},
+ {142851, 154109, -11814, 24920},
+ {142379, 154725, -11814, 30342},
+ {142816, 154712, -11814, 33193},
+ {142276, 154223, -11814, 33922},
+ {142459, 154490, -11814, 33184},
+ {142819, 154372, -11814, 21318},
+ {141157, 154541, -11814, 27090},
+ {141095, 150281, -11814, 55186}
};
// first spawns
private static int[][] FIRST_SPAWNS =
{
- {
- 22276,
- 148109,
- 149601,
- -12132,
- 34490
- },
- {
- 22276,
- 148017,
- 149529,
- -12132,
- 33689
- },
- {
- 22278,
- 148065,
- 151202,
- -12132,
- 35323
- },
- {
- 22278,
- 147966,
- 151117,
- -12132,
- 33234
- },
- {
- 22279,
- 144063,
- 150238,
- -12132,
- 29654
- },
- {
- 22279,
- 144300,
- 149118,
- -12135,
- 5520
- },
- {
- 22279,
- 144397,
- 149337,
- -12132,
- 644
- },
- {
- 22279,
- 144426,
- 150639,
- -12132,
- 50655
- },
- {
- 22282,
- 145841,
- 151097,
- -12132,
- 31810
- },
- {
- 22282,
- 144387,
- 149958,
- -12132,
- 61173
- },
- {
- 22282,
- 145821,
- 149498,
- -12132,
- 31490
- },
- {
- 22282,
- 146619,
- 149694,
- -12132,
- 33374
- },
- {
- 22282,
- 146669,
- 149244,
- -12132,
- 31360
- },
- {
- 22284,
- 144147,
- 151375,
- -12132,
- 58395
- },
- {
- 22284,
- 144485,
- 151067,
- -12132,
- 64786
- },
- {
- 22284,
- 144356,
- 149571,
- -12132,
- 63516
- },
- {
- 22285,
- 144151,
- 150962,
- -12132,
- 664
- },
- {
- 22285,
- 146657,
- 151365,
- -12132,
- 33154
- },
- {
- 22285,
- 146623,
- 150857,
- -12132,
- 28034
- },
- {
- 22285,
- 147046,
- 151089,
- -12132,
- 32941
- },
- {
- 22285,
- 145704,
- 151255,
- -12132,
- 32523
- },
- {
- 22285,
- 145359,
- 151101,
- -12132,
- 32767
- },
- {
- 22285,
- 147785,
- 150817,
- -12132,
- 27423
- },
- {
- 22285,
- 147727,
- 151375,
- -12132,
- 37117
- },
- {
- 22285,
- 145428,
- 149494,
- -12132,
- 890
- },
- {
- 22285,
- 145601,
- 149682,
- -12132,
- 32442
- },
- {
- 22285,
- 147003,
- 149476,
- -12132,
- 31554
- },
- {
- 22285,
- 147738,
- 149210,
- -12132,
- 20971
- },
- {
- 22285,
- 147769,
- 149757,
- -12132,
- 34980
- }
+ {22276, 148109, 149601, -12132, 34490},
+ {22276, 148017, 149529, -12132, 33689},
+ {22278, 148065, 151202, -12132, 35323},
+ {22278, 147966, 151117, -12132, 33234},
+ {22279, 144063, 150238, -12132, 29654},
+ {22279, 144300, 149118, -12135, 5520},
+ {22279, 144397, 149337, -12132, 644},
+ {22279, 144426, 150639, -12132, 50655},
+ {22282, 145841, 151097, -12132, 31810},
+ {22282, 144387, 149958, -12132, 61173},
+ {22282, 145821, 149498, -12132, 31490},
+ {22282, 146619, 149694, -12132, 33374},
+ {22282, 146669, 149244, -12132, 31360},
+ {22284, 144147, 151375, -12132, 58395},
+ {22284, 144485, 151067, -12132, 64786},
+ {22284, 144356, 149571, -12132, 63516},
+ {22285, 144151, 150962, -12132, 664},
+ {22285, 146657, 151365, -12132, 33154},
+ {22285, 146623, 150857, -12132, 28034},
+ {22285, 147046, 151089, -12132, 32941},
+ {22285, 145704, 151255, -12132, 32523},
+ {22285, 145359, 151101, -12132, 32767},
+ {22285, 147785, 150817, -12132, 27423},
+ {22285, 147727, 151375, -12132, 37117},
+ {22285, 145428, 149494, -12132, 890},
+ {22285, 145601, 149682, -12132, 32442},
+ {22285, 147003, 149476, -12132, 31554},
+ {22285, 147738, 149210, -12132, 20971},
+ {22285, 147769, 149757, -12132, 34980}
};
// Emerald Square
private static int[][] EMERALD_SPAWNS =
{
- {
- 22280,
- 144437,
- 143395,
- -11969,
- 34248
- },
- {
- 22281,
- 149241,
- 143735,
- -12230,
- 24575
- },
- {
- 22281,
- 147917,
- 146861,
- -12289,
- 60306
- },
- {
- 22281,
- 144406,
- 147782,
- -12133,
- 14349
- },
- {
- 22281,
- 144960,
- 146881,
- -12039,
- 23881
- },
- {
- 22281,
- 144985,
- 147679,
- -12135,
- 27594
- },
- {
- 22283,
- 147784,
- 143540,
- -12222,
- 2058
- },
- {
- 22283,
- 149091,
- 143491,
- -12230,
- 24836
- },
- {
- 22287,
- 144479,
- 147569,
- -12133,
- 20723
- },
- {
- 22287,
- 145158,
- 146986,
- -12058,
- 21970
- },
- {
- 22287,
- 145142,
- 147175,
- -12092,
- 24420
- },
- {
- 22287,
- 145110,
- 147133,
- -12088,
- 22465
- },
- {
- 22287,
- 144664,
- 146604,
- -12028,
- 14861
- },
- {
- 22287,
- 144596,
- 146600,
- -12028,
- 14461
- },
- {
- 22288,
- 143925,
- 146773,
- -12037,
- 10813
- },
- {
- 22288,
- 144415,
- 147070,
- -12069,
- 8568
- },
- {
- 22288,
- 143794,
- 145584,
- -12027,
- 14849
- },
- {
- 22288,
- 143429,
- 146166,
- -12030,
- 4078
- },
- {
- 22288,
- 144477,
- 147009,
- -12056,
- 8752
- },
- {
- 22289,
- 142577,
- 145319,
- -12029,
- 5403
- },
- {
- 22289,
- 143831,
- 146902,
- -12051,
- 9717
- },
- {
- 22289,
- 143714,
- 146705,
- -12028,
- 10044
- },
- {
- 22289,
- 143937,
- 147134,
- -12078,
- 7517
- },
- {
- 22293,
- 143356,
- 145287,
- -12027,
- 8126
- },
- {
- 22293,
- 143462,
- 144352,
- -12008,
- 25905
- },
- {
- 22293,
- 143745,
- 142529,
- -11882,
- 17102
- },
- {
- 22293,
- 144574,
- 144032,
- -12005,
- 34668
- },
- {
- 22295,
- 143992,
- 142419,
- -11884,
- 19697
- },
- {
- 22295,
- 144671,
- 143966,
- -12004,
- 32088
- },
- {
- 22295,
- 144440,
- 143269,
- -11957,
- 34169
- },
- {
- 22295,
- 142642,
- 146362,
- -12028,
- 281
- },
- {
- 22295,
- 143865,
- 142707,
- -11881,
- 21326
- },
- {
- 22295,
- 143573,
- 142530,
- -11879,
- 16141
- },
- {
- 22295,
- 143148,
- 146039,
- -12031,
- 65014
- },
- {
- 22295,
- 143001,
- 144853,
- -12014,
- 0
- },
- {
- 22296,
- 147505,
- 146580,
- -12260,
- 59041
- },
- {
- 22296,
- 149366,
- 146932,
- -12358,
- 39407
- },
- {
- 22296,
- 149284,
- 147029,
- -12352,
- 41120
- },
- {
- 22296,
- 149439,
- 143940,
- -12230,
- 23189
- },
- {
- 22296,
- 147698,
- 143995,
- -12220,
- 27028
- },
- {
- 22296,
- 141885,
- 144969,
- -12007,
- 2526
- },
- {
- 22296,
- 147843,
- 143763,
- -12220,
- 28386
- },
- {
- 22296,
- 144753,
- 143650,
- -11982,
- 35429
- },
- {
- 22296,
- 147613,
- 146760,
- -12271,
- 56296
- }
+ {22280, 144437, 143395, -11969, 34248},
+ {22281, 149241, 143735, -12230, 24575},
+ {22281, 147917, 146861, -12289, 60306},
+ {22281, 144406, 147782, -12133, 14349},
+ {22281, 144960, 146881, -12039, 23881},
+ {22281, 144985, 147679, -12135, 27594},
+ {22283, 147784, 143540, -12222, 2058},
+ {22283, 149091, 143491, -12230, 24836},
+ {22287, 144479, 147569, -12133, 20723},
+ {22287, 145158, 146986, -12058, 21970},
+ {22287, 145142, 147175, -12092, 24420},
+ {22287, 145110, 147133, -12088, 22465},
+ {22287, 144664, 146604, -12028, 14861},
+ {22287, 144596, 146600, -12028, 14461},
+ {22288, 143925, 146773, -12037, 10813},
+ {22288, 144415, 147070, -12069, 8568},
+ {22288, 143794, 145584, -12027, 14849},
+ {22288, 143429, 146166, -12030, 4078},
+ {22288, 144477, 147009, -12056, 8752},
+ {22289, 142577, 145319, -12029, 5403},
+ {22289, 143831, 146902, -12051, 9717},
+ {22289, 143714, 146705, -12028, 10044},
+ {22289, 143937, 147134, -12078, 7517},
+ {22293, 143356, 145287, -12027, 8126},
+ {22293, 143462, 144352, -12008, 25905},
+ {22293, 143745, 142529, -11882, 17102},
+ {22293, 144574, 144032, -12005, 34668},
+ {22295, 143992, 142419, -11884, 19697},
+ {22295, 144671, 143966, -12004, 32088},
+ {22295, 144440, 143269, -11957, 34169},
+ {22295, 142642, 146362, -12028, 281},
+ {22295, 143865, 142707, -11881, 21326},
+ {22295, 143573, 142530, -11879, 16141},
+ {22295, 143148, 146039, -12031, 65014},
+ {22295, 143001, 144853, -12014, 0},
+ {22296, 147505, 146580, -12260, 59041},
+ {22296, 149366, 146932, -12358, 39407},
+ {22296, 149284, 147029, -12352, 41120},
+ {22296, 149439, 143940, -12230, 23189},
+ {22296, 147698, 143995, -12220, 27028},
+ {22296, 141885, 144969, -12007, 2526},
+ {22296, 147843, 143763, -12220, 28386},
+ {22296, 144753, 143650, -11982, 35429},
+ {22296, 147613, 146760, -12271, 56296}
};
private static int[][] ROOM1_SPAWNS =
{
- {
- 22288,
- 143114,
- 140027,
- -11888,
- 15025
- },
- {
- 22288,
- 142173,
- 140973,
- -11888,
- 55698
- },
- {
- 22289,
- 143210,
- 140577,
- -11888,
- 17164
- },
- {
- 22289,
- 142638,
- 140107,
- -11888,
- 6571
- },
- {
- 22297,
- 142547,
- 140938,
- -11888,
- 48556
- },
- {
- 22298,
- 142690,
- 140479,
- -11887,
- 7663
- }
+ {22288, 143114, 140027, -11888, 15025},
+ {22288, 142173, 140973, -11888, 55698},
+ {22289, 143210, 140577, -11888, 17164},
+ {22289, 142638, 140107, -11888, 6571},
+ {22297, 142547, 140938, -11888, 48556},
+ {22298, 142690, 140479, -11887, 7663}
};
private static int[][] ROOM2_SPAWNS =
{
- {
- 22303,
- 146276,
- 141483,
- -11880,
- 34643
- },
- {
- 22287,
- 145707,
- 142161,
- -11880,
- 28799
- },
- {
- 22288,
- 146857,
- 142129,
- -11880,
- 33647
- },
- {
- 22288,
- 146869,
- 142000,
- -11880,
- 31215
- },
- {
- 22289,
- 146897,
- 140880,
- -11880,
- 19210
- }
+ {22303, 146276, 141483, -11880, 34643},
+ {22287, 145707, 142161, -11880, 28799},
+ {22288, 146857, 142129, -11880, 33647},
+ {22288, 146869, 142000, -11880, 31215},
+ {22289, 146897, 140880, -11880, 19210}
};
private static int[][] ROOM3_SPAWNS =
{
- {
- 22302,
- 145123,
- 143713,
- -12808,
- 65323
- },
- {
- 22294,
- 145188,
- 143331,
- -12808,
- 496
- },
- {
- 22294,
- 145181,
- 144104,
- -12808,
- 64415
- },
- {
- 22293,
- 144994,
- 143431,
- -12808,
- 65431
- },
- {
- 22293,
- 144976,
- 143915,
- -12808,
- 61461
- }
+ {22302, 145123, 143713, -12808, 65323},
+ {22294, 145188, 143331, -12808, 496},
+ {22294, 145181, 144104, -12808, 64415},
+ {22293, 144994, 143431, -12808, 65431},
+ {22293, 144976, 143915, -12808, 61461}
};
private static int[][] ROOM4_SPAWNS =
{
- {
- 22304,
- 150563,
- 142240,
- -12108,
- 16454
- },
- {
- 22294,
- 150769,
- 142495,
- -12108,
- 16870
- },
- {
- 22281,
- 150783,
- 141995,
- -12108,
- 20033
- },
- {
- 22283,
- 150273,
- 141983,
- -12108,
- 16043
- },
- {
- 22294,
- 150276,
- 142492,
- -12108,
- 13540
- }
+ {22304, 150563, 142240, -12108, 16454},
+ {22294, 150769, 142495, -12108, 16870},
+ {22281, 150783, 141995, -12108, 20033},
+ {22283, 150273, 141983, -12108, 16043},
+ {22294, 150276, 142492, -12108, 13540}
};
// Steam Corridor
private static int[][] STEAM1_SPAWNS =
{
- {
- 22305,
- 145260,
- 152387,
- -12165,
- 32767
- },
- {
- 22305,
- 144967,
- 152390,
- -12165,
- 30464
- },
- {
- 22305,
- 145610,
- 152586,
- -12165,
- 17107
- },
- {
- 22305,
- 145620,
- 152397,
- -12165,
- 8191
- },
- {
- 22418,
- 146081,
- 152847,
- -12165,
- 31396
- },
- {
- 22418,
- 146795,
- 152641,
- -12165,
- 33850
- }
- // {22308, 145093, 152502, -12165, 31841},{22308, 146158, 152776, -12165, 30810},
- // {22308, 146116, 152976, -12133, 32571},
+ {22305, 145260, 152387, -12165, 32767},
+ {22305, 144967, 152390, -12165, 30464},
+ {22305, 145610, 152586, -12165, 17107},
+ {22305, 145620, 152397, -12165, 8191},
+ {22418, 146081, 152847, -12165, 31396},
+ {22418, 146795, 152641, -12165, 33850},
+ // {22308, 145093, 152502, -12165, 31841},
+ // {22308, 146158, 152776, -12165, 30810},
+ // {22308, 146116, 152976, -12133, 32571}
};
private static int[][] STEAM2_SPAWNS =
{
- {
- 22306,
- 147740,
- 152767,
- -12165,
- 65043
- },
- {
- 22306,
- 148215,
- 152828,
- -12165,
- 970
- },
- {
- 22306,
- 147743,
- 152846,
- -12165,
- 64147
- },// {22308, 147849, 152854, -12165, 60534},
- // {22308, 147754, 152908, -12141, 59827},{22308, 148194, 152681, -12165, 63620},
- // {22308, 147767, 152939, -12133, 63381},{22309, 147737, 152671, -12165, 65320},
- {
- 22418,
- 148207,
- 152725,
- -12165,
- 61801
- },
- {
- 22419,
- 149058,
- 152828,
- -12165,
- 64564
- }
+ {22306, 147740, 152767, -12165, 65043},
+ {22306, 148215, 152828, -12165, 970},
+ {22306, 147743, 152846, -12165, 64147},
+ // {22308, 147849, 152854, -12165, 60534},
+ // {22308, 147754, 152908, -12141, 59827},
+ // {22308, 148194, 152681, -12165, 63620},
+ // {22308, 147767, 152939, -12133, 63381},
+ // {22309, 147737, 152671, -12165, 65320},
+ {22418, 148207, 152725, -12165, 61801},
+ {22419, 149058, 152828, -12165, 64564}
};
private static int[][] STEAM3_SPAWNS =
{
- {
- 22307,
- 150735,
- 152316,
- -12145,
- 31930
- },
- {
- 22307,
- 150725,
- 152467,
- -12165,
- 33635
- },
- {
- 22307,
- 151058,
- 152316,
- -12146,
- 65342
- },
- {
- 22307,
- 151057,
- 152461,
- -12165,
- 2171
- }
- /*
- * {22308, 150794, 152455, -12165, 31613},{22308, 150665, 152383, -12165, 32767}, {22308, 151697, 152621, -12167, 31423},{22309, 151061, 152581, -12165, 6228}, {22309, 150653, 152253, -12132, 31343},{22309, 150628, 152431, -12165, 33022}, {22309, 151620, 152487, -12165, 30114},{22309, 151672,
- * 152544, -12165, 31846}, {22309, 150488, 152350, -12165, 29072},{22310, 151139, 152238, -12132, 1069}
- */
+ {22307, 150735, 152316, -12145, 31930},
+ {22307, 150725, 152467, -12165, 33635},
+ {22307, 151058, 152316, -12146, 65342},
+ {22307, 151057, 152461, -12165, 2171},
+ // {22308, 150794, 152455, -12165, 31613},
+ // {22308, 150665, 152383, -12165, 32767},
+ // {22308, 151697, 152621, -12167, 31423},
+ // {22309, 151061, 152581, -12165, 6228},
+ // {22309, 150653, 152253, -12132, 31343},
+ // {22309, 150628, 152431, -12165, 33022},
+ // {22309, 151620, 152487, -12165, 30114},
+ // {22309, 151672, 152544, -12165, 31846},
+ // {22309, 150488, 152350, -12165, 29072},
+ // {22310, 151139, 152238, -12132, 1069}
};
private static int[][] STEAM4_SPAWNS =
- {// {22308, 151707, 150199, -12165, 32859},{22308, 152091, 150140, -12165, 32938},
- // {22308, 149757, 150204, -12138, 65331},{22308, 149950, 150307, -12132, 62437},
- // {22308, 149901, 150322, -12132, 62136},{22309, 150071, 150173, -12165, 64943},
- {
- 22416,
- 151636,
- 150280,
- -12142,
- 36869
- },
- {
- 22416,
- 149893,
- 150232,
- -12165,
- 64258
- },
- {
- 22416,
- 149864,
- 150110,
- -12165,
- 65054
- },
- {
- 22416,
- 151926,
- 150218,
- -12165,
- 31613
- },
- {
- 22420,
- 149986,
- 150051,
- -12165,
- 105
- },
- {
- 22420,
- 151970,
- 149997,
- -12165,
- 32170
- },
- {
- 22420,
- 150744,
- 150006,
- -12165,
- 63
- }
- // ,{22417, 149782, 150188, -12151, 64001}
+ {
+ // {22308, 151707, 150199, -12165, 32859},
+ // {22308, 152091, 150140, -12165, 32938},
+ // {22308, 149757, 150204, -12138, 65331},
+ // {22308, 149950, 150307, -12132, 62437},
+ // {22308, 149901, 150322, -12132, 62136},
+ // {22309, 150071, 150173, -12165, 64943},
+ {22416, 151636, 150280, -12142, 36869},
+ {22416, 149893, 150232, -12165, 64258},
+ {22416, 149864, 150110, -12165, 65054},
+ {22416, 151926, 150218, -12165, 31613},
+ {22420, 149986, 150051, -12165, 105},
+ {22420, 151970, 149997, -12165, 32170},
+ {22420, 150744, 150006, -12165, 63},
+ // {22417, 149782, 150188, -12151, 64001}
};
-
- // Instance reenter time
- // default: 86400000ms(24h)
- private static final int INSTANCEPENALTY = 86400000;
+ // @formatter:on
private static final int DRAGONSCALETIME = 3000;
private static final int DRAGONCLAWTIME = 3000;
- private CrystalCaverns()
+ public CrystalCaverns()
{
- super(-1, CrystalCaverns.class.getSimpleName(), "instances");
- addStartNpc(ORACLE_GUIDE_1);
- addTalkId(ORACLE_GUIDE_1);
- addTalkId(ORACLE_GUIDE_3);
- addStartNpc(ORACLE_GUIDE_4);
- addFirstTalkId(ORACLE_GUIDE_4);
- addTalkId(ORACLE_GUIDE_4);
- addFirstTalkId(CRYSTAL_GOLEM);
- addAttackId(TEARS);
+ super(CrystalCaverns.class.getSimpleName());
+ addStartNpc(ORACLE_GUIDE_1, ORACLE_GUIDE_4);
+ addTalkId(ORACLE_GUIDE_1, ORACLE_GUIDE_3, ORACLE_GUIDE_4, 32275, 32276, 32277);
+ addFirstTalkId(ORACLE_GUIDE_1, ORACLE_GUIDE_2, ORACLE_GUIDE_4, CRYSTAL_GOLEM, 32274, 32275, 32276, 32277);
+ addKillId(TEARS, GK1, GK2, TEROD, WEYLIN, DOLPH, DARNEL, KECHI, GUARDIAN, GUARDIAN2, TOURMALINE, BAYLOR, ALARMID);
+ addSkillSeeId(BAYLOR, 25534, 32275, 32276, 32277);
addTrapActionId(DOOR_OPENING_TRAP[0]);
- addKillId(TEARS);
- addKillId(GK1);
- addKillId(GK2);
- addKillId(TEROD);
- addKillId(WEYLIN);
- addKillId(DOLPH);
- addKillId(DARNEL);
- addKillId(KECHI);
- addKillId(GUARDIAN);
- addKillId(GUARDIAN2);
- addKillId(TOURMALINE);
- addKillId(BAYLOR);
addSpellFinishedId(BAYLOR);
- addKillId(ALARMID);
- addFirstTalkId(32274, 32275, 32276, 32277, ORACLE_GUIDE_1, ORACLE_GUIDE_2);
- addTalkId(32275, 32276, 32277);
- addSkillSeeId(25534, 32275, 32276, 32277, BAYLOR);
+ addAttackId(TEARS);
addKillId(MOBLIST);
addKillId(CGMOBS);
for (int zones : ZONES)
@@ -1476,13 +511,18 @@
}
}
- private boolean checkConditions(L2PcInstance player)
+ @Override
+ protected boolean checkConditions(L2PcInstance player)
{
- if (debug)
+ if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
{
- return true;
+ if (debug)
+ {
+ return true;
+ }
}
- L2Party party = player.getParty();
+
+ final L2Party party = player.getParty();
if (party == null)
{
player.sendPacket(SystemMessageId.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
@@ -1651,55 +691,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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- return 0;
+ // this can happen only if debug is true
+ player.sendMessage("Welcome to Crystal Caverns.");
+ teleportPlayer(player, START_LOC, world.getInstanceId());
+ world.addAllowed(player.getObjectId());
}
- teleportPlayer(player, loc, world.getInstanceId());
- return world.getInstanceId();
- }
-
- // New instance
- if (!checkConditions(player))
- {
- return 0;
- }
- L2Party party = player.getParty();
- int instanceId = InstanceManager.getInstance().createDynamicInstance(template);
- world = new CCWorld(System.currentTimeMillis() + 5400000);
- world.setInstanceId(instanceId);
- world.setTemplateId(TEMPLATE_ID);
- InstanceManager.getInstance().addWorld(world);
- _log.info("Crystal Caverns started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
- runOracle((CCWorld) world);
- // teleport players
- if (player.getParty() == null)
- {
- // this can happen only if debug is true
- player.sendMessage("Welcome to Crystal Caverns.");
- InstanceManager.getInstance().setInstanceTime(player.getObjectId(), TEMPLATE_ID, ((System.currentTimeMillis() + INSTANCEPENALTY)));
- teleportPlayer(player, loc, world.getInstanceId());
- world.isAllowed(player.getObjectId());
+ else
+ {
+ for (L2PcInstance partyMember : player.getParty().getMembers())
+ {
+ partyMember.sendMessage("Welcome to Crystal Caverns.");
+ teleportPlayer(partyMember, START_LOC, world.getInstanceId());
+ world.addAllowed(partyMember.getObjectId());
+ }
+ }
+ runOracle((CCWorld) world);
}
else
{
- for (L2PcInstance partyMember : party.getMembers())
- {
- partyMember.sendMessage("Welcome to Crystal Caverns.");
- InstanceManager.getInstance().setInstanceTime(partyMember.getObjectId(), TEMPLATE_ID, ((System.currentTimeMillis() + INSTANCEPENALTY)));
- teleportPlayer(partyMember, loc, world.getInstanceId());
- world.addAllowed(partyMember.getObjectId());
- }
+ teleportPlayer(player, START_LOC, world.getInstanceId());
}
- return instanceId;
}
protected void stopAttack(L2PcInstance player)
@@ -1757,7 +775,7 @@
{
world.setStatus(2);
- for (int[] spawn : SPAWNS)
+ for (int[] spawn : HALL_SPAWNS)
{
L2Npc mob = addSpawn(CGMOBS[getRandom(CGMOBS.length)], spawn[0], spawn[1], spawn[2], spawn[3], false, 0, false, world.getInstanceId());
world.npcList1.put(mob, false);
@@ -2755,7 +1773,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 "";
}
@@ -3067,10 +2085,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
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java b/L2J_DataPack/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java
index 2303112..2b9c20d 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/DarkCloudMansion/DarkCloudMansion.java
@@ -18,17 +18,18 @@
*/
package instances.DarkCloudMansion;
+import instances.AbstractInstance;
import javolution.util.FastList;
import javolution.util.FastMap;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.Location;
+import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
-import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -40,15 +41,12 @@
/**
* Dark Cloud Mansion instance zone.
*/
-public final class DarkCloudMansion extends Quest
+public final class DarkCloudMansion extends AbstractInstance
{
- private static final int TEMPLATE_ID = 9;
-
- private static boolean debug = false;
- private static boolean noRndWalk = true;
-
- // Items
- private static int CC = 9690; // Contaminated Crystal
+ protected class DMCWorld extends InstanceWorld
+ {
+ protected FastMap<String, DMCRoom> rooms = new FastMap<>();
+ }
// NPCs
private static int YIYEN = 32282;
@@ -58,7 +56,6 @@
private static int SOTruth = 32291; // Symbol of Truth
private static int BSM = 32324; // Black Stone Monolith
private static int SC = 22402; // Shadow Column
-
// Mobs
private static int[] CCG =
{
@@ -106,7 +103,10 @@
22264
};
- // Doors/Walls
+ // Items
+ private static int CC = 9690; // Contaminated Crystal
+ // Misc
+ private static final int TEMPLATE_ID = 9;
private static int D1 = 24230001; // Starting Room
private static int D2 = 24230002; // First Room
private static int D3 = 24230005; // Second Room
@@ -120,7 +120,8 @@
// 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.I_M_THE_REAL_ONE,
@@ -129,14 +130,12 @@
NpcStringId.NOT_THAT_DUDE_I_M_THE_REAL_ONE,
NpcStringId.DON_T_BE_FOOLED_DON_T_BE_FOOLED_I_M_THE_REAL_ONE
};
-
private static NpcStringId[] _decayChat =
{
NpcStringId.I_M_THE_REAL_ONE_PHEW,
NpcStringId.CAN_T_YOU_EVEN_FIND_OUT,
NpcStringId.FIND_ME
};
-
private static NpcStringId[] _successChat =
{
NpcStringId.HUH_HOW_DID_YOU_KNOW_IT_WAS_ME,
@@ -144,312 +143,74 @@
NpcStringId.YOU_VE_DONE_WELL,
NpcStringId.OH_VERY_SENSIBLE
};
-
private static NpcStringId[] _faildChat =
{
NpcStringId.YOU_VE_BEEN_FOOLED,
NpcStringId.SORRY_BUT_I_M_THE_FAKE_ONE
};
-
+ // @formatter:off
// Second room - random monolith order
private static int[][] MonolithOrder = new int[][]
{
- {
- 1,
- 2,
- 3,
- 4,
- 5,
- 6
- },
- {
- 6,
- 5,
- 4,
- 3,
- 2,
- 1
- },
- {
- 4,
- 5,
- 6,
- 3,
- 2,
- 1
- },
- {
- 2,
- 6,
- 3,
- 5,
- 1,
- 4
- },
- {
- 4,
- 1,
- 5,
- 6,
- 2,
- 3
- },
- {
- 3,
- 5,
- 1,
- 6,
- 2,
- 4
- },
- {
- 6,
- 1,
- 3,
- 4,
- 5,
- 2
- },
- {
- 5,
- 6,
- 1,
- 2,
- 4,
- 3
- },
- {
- 5,
- 2,
- 6,
- 3,
- 4,
- 1
- },
- {
- 1,
- 5,
- 2,
- 6,
- 3,
- 4
- },
- {
- 1,
- 2,
- 3,
- 6,
- 5,
- 4
- },
- {
- 6,
- 4,
- 3,
- 1,
- 5,
- 2
- },
- {
- 3,
- 5,
- 2,
- 4,
- 1,
- 6
- },
- {
- 3,
- 2,
- 4,
- 5,
- 1,
- 6
- },
- {
- 5,
- 4,
- 3,
- 1,
- 6,
- 2
- },
+ {1, 2, 3, 4, 5, 6},
+ {6, 5, 4, 3, 2, 1},
+ {4 ,5, 6, 3, 2, 1},
+ {2, 6, 3, 5, 1, 4},
+ {4, 1, 5, 6, 2, 3},
+ {3, 5, 1, 6, 2, 4},
+ {6, 1, 3, 4, 5, 2},
+ {5, 6, 1, 2, 4, 3},
+ {5, 2, 6, 3, 4, 1},
+ {1, 5, 2, 6, 3, 4},
+ {1, 2, 3, 6, 5, 4},
+ {6, 4, 3, 1, 5, 2},
+ {3, 5, 2, 4, 1, 6},
+ {3, 2, 4, 5, 1, 6},
+ {5, 4, 3, 1, 6, 2},
};
-
// Second room - golem spawn locatons - random
private static int[][] GolemSpawn = new int[][]
{
- {
- CCG[0],
- 148060,
- 181389
- },
- {
- CCG[1],
- 147910,
- 181173
- },
- {
- CCG[0],
- 147810,
- 181334
- },
- {
- CCG[1],
- 147713,
- 181179
- },
- {
- CCG[0],
- 147569,
- 181410
- },
- {
- CCG[1],
- 147810,
- 181517
- },
- {
- CCG[0],
- 147805,
- 181281
- }
+ {CCG[0], 148060, 181389},
+ {CCG[1], 147910, 181173},
+ {CCG[0], 147810, 181334},
+ {CCG[1], 147713, 181179},
+ {CCG[0], 147569, 181410},
+ {CCG[1], 147810, 181517},
+ {CCG[0], 147805, 181281},
};
// forth room - random shadow column
private static int[][] ColumnRows = new int[][]
{
- {
- 1,
- 1,
- 0,
- 1,
- 0
- },
- {
- 0,
- 1,
- 1,
- 0,
- 1
- },
- {
- 1,
- 0,
- 1,
- 1,
- 0
- },
- {
- 0,
- 1,
- 0,
- 1,
- 1
- },
- {
- 1,
- 0,
- 1,
- 0,
- 1
- }
+ {1, 1, 0, 1, 0},
+ {0, 1, 1, 0, 1},
+ {1, 0, 1, 1, 0},
+ {0, 1, 0, 1, 1},
+ {1, 0, 1, 0, 1},
};
// Fifth room - beleth order
private static int[][] Beleths = new int[][]
{
- {
- 1,
- 0,
- 1,
- 0,
- 1,
- 0,
- 0
- },
- {
- 0,
- 0,
- 1,
- 0,
- 1,
- 1,
- 0
- },
- {
- 0,
- 0,
- 0,
- 1,
- 0,
- 1,
- 1
- },
- {
- 1,
- 0,
- 1,
- 1,
- 0,
- 0,
- 0
- },
- {
- 1,
- 1,
- 0,
- 0,
- 0,
- 1,
- 0
- },
- {
- 0,
- 1,
- 0,
- 1,
- 0,
- 1,
- 0
- },
- {
- 0,
- 0,
- 0,
- 1,
- 1,
- 1,
- 0
- },
- {
- 1,
- 0,
- 1,
- 0,
- 0,
- 1,
- 0
- },
- {
- 0,
- 1,
- 1,
- 0,
- 0,
- 0,
- 1
- }
+ {1, 0, 1, 0, 1, 0, 0},
+ {0, 0, 1, 0, 1, 1, 0},
+ {0, 0, 0, 1, 0, 1, 1},
+ {1, 0, 1, 1, 0, 0, 0},
+ {1, 1, 0, 0, 0, 1, 0},
+ {0, 1, 0, 1, 0, 1, 0},
+ {0, 0, 0, 1, 1, 1, 0},
+ {1, 0, 1, 0, 0, 1, 0},
+ {0, 1, 1, 0, 0, 0, 1},
};
+ // @formatter:on
- private DarkCloudMansion()
+ public DarkCloudMansion()
{
- super(-1, DarkCloudMansion.class.getSimpleName(), "instances");
- addFirstTalkId(BSM);
- addFirstTalkId(SOTruth);
+ super(DarkCloudMansion.class.getSimpleName());
+ addFirstTalkId(BSM, SOTruth);
addStartNpc(YIYEN);
- addTalkId(YIYEN);
- addTalkId(SOTruth);
+ addTalkId(YIYEN, SOTruth);
addAttackId(SC);
addAttackId(BS);
addAttackId(CCG);
@@ -475,19 +236,15 @@
public 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.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
@@ -524,46 +281,34 @@
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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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 : player.getParty().getMembers())
+ {
+ if (partyMember.getQuestState(getName()) == null)
+ {
+ newQuestState(partyMember);
+ }
+ world.addAllowed(partyMember.getObjectId());
+ teleportPlayer(partyMember, new Location(146534, 180464, -6117), world.getInstanceId());
+ }
+ }
}
else
{
- for (L2PcInstance partyMember : party.getMembers())
- {
- getQuestState(partyMember, true);
- world.addAllowed(partyMember.getObjectId());
- teleportPlayer(partyMember, loc, instanceId);
- }
+ teleportPlayer(player, new Location(146534, 180464, -6117), world.getInstanceId());
}
}
@@ -1200,8 +945,8 @@
return "";
}
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
- DMCWorld world;
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+ final DMCWorld world;
if (tmpworld instanceof DMCWorld)
{
world = (DMCWorld) tmpworld;
@@ -1262,8 +1007,8 @@
@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
- DMCWorld world;
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+ final DMCWorld world;
if (tmpworld instanceof DMCWorld)
{
world = (DMCWorld) tmpworld;
@@ -1336,15 +1081,14 @@
killedBelethSample(world, npc);
}
}
-
return "";
}
@Override
public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon, Skill skill)
{
- InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
- DMCWorld world;
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
+ final DMCWorld world;
if (tmpworld instanceof DMCWorld)
{
world = (DMCWorld) tmpworld;
@@ -1418,10 +1162,10 @@
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
- int npcId = npc.getId();
+ final int npcId = npc.getId();
if (npcId == YIYEN)
{
- enterInstance(player, "DarkCloudMansion.xml", new Location(146534, 180464, -6117));
+ enterInstance(player, new DMCWorld(), "DarkCloudMansion.xml", TEMPLATE_ID);
}
else
{
@@ -1458,9 +1202,4 @@
}
return "";
}
-
- public static void main(String[] args)
- {
- new DarkCloudMansion();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java b/L2J_DataPack/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java
index 223985f..1906b17 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/DisciplesNecropolisPast/DisciplesNecropolisPast.java
@@ -18,6 +18,8 @@
*/
package instances.DisciplesNecropolisPast;
+import instances.AbstractInstance;
+
import java.util.HashMap;
import java.util.Map;
@@ -26,13 +28,10 @@
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.L2Summon;
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;
@@ -44,18 +43,15 @@
* 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;
@@ -69,20 +65,6 @@
private static final int ANAKIMS_GUARDIAN = 32719;
private static final int ANAKIMS_GUARD = 32720;
private static final int ANAKIMS_EXECUTOR = 32721;
- // Doors
- private static final int DOOR_1 = 17240102;
- private static final int DOOR_2 = 17240104;
- private static final int DOOR_3 = 17240106;
- private static final int DOOR_4 = 17240108;
- private static final int DOOR_5 = 17240110;
- private static final int DISCIPLES_NECROPOLIS_DOOR = 17240111;
- // Items
- private static final int SACRED_SWORD_OF_EINHASAD = 15310;
- private static final int SEAL_OF_BINDING = 13846;
- // Locations
- private static final Location ENTER = new Location(-89554, 216078, -7488, 0, 0);
- private static final Location EXIT = new Location(171895, -17501, -4903, 0, 0);
- // Monsters
private static final int LILIM_BUTCHER = 27371;
private static final int LILIM_MAGUS = 27372;
private static final int LILIM_KNIGHT_ERRANT = 27373;
@@ -92,28 +74,9 @@
private static final int LILIM_SLAYER = 27377;
private static final int LILIM_GREAT_MAGUS = 27378;
private static final int LILIM_GUARD_KNIGHT = 27379;
- // NpcStringId
- private static final NpcStringId[] LILITH_SHOUT =
- {
- NpcStringId.HOW_DARE_YOU_TRY_TO_CONTEND_AGAINST_ME_IN_STRENGTH_RIDICULOUS,
- NpcStringId.ANAKIM_IN_THE_NAME_OF_GREAT_SHILEN_I_WILL_CUT_YOUR_THROAT,
- NpcStringId.YOU_CANNOT_BE_THE_MATCH_OF_LILITH_I_LL_TEACH_YOU_A_LESSON
- };
-
- // Bosses Spawn
- private static final Map<Integer, Location> LILITH_SPAWN = new HashMap<>();
- private static final Map<Integer, Location> ANAKIM_SPAWN = new HashMap<>();
- static
- {
- LILITH_SPAWN.put(LILITH, new Location(-83175, 217021, -7504, 49151));
- LILITH_SPAWN.put(LILITHS_STEWARD, new Location(-83327, 216938, -7492, 50768));
- LILITH_SPAWN.put(LILITHS_ELITE, new Location(-83003, 216909, -7492, 4827));
- ANAKIM_SPAWN.put(ANAKIM, new Location(-83179, 216479, -7504, 16384));
- ANAKIM_SPAWN.put(ANAKIMS_GUARDIAN, new Location(-83321, 216507, -7492, 16166));
- ANAKIM_SPAWN.put(ANAKIMS_GUARD, new Location(-83086, 216519, -7495, 15910));
- ANAKIM_SPAWN.put(ANAKIMS_EXECUTOR, new Location(-83031, 216604, -7492, 17071));
- }
-
+ // 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<>();
@@ -127,10 +90,40 @@
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()
+ // Locations
+ private static final Location ENTER = new Location(-89554, 216078, -7488, 0, 0);
+ private static final Location EXIT = new Location(171895, -17501, -4903, 0, 0);
+ // NpcStringId
+ private static final NpcStringId[] LILITH_SHOUT =
{
- super(-1, DisciplesNecropolisPast.class.getSimpleName(), "instances");
+ NpcStringId.HOW_DARE_YOU_TRY_TO_CONTEND_AGAINST_ME_IN_STRENGTH_RIDICULOUS,
+ NpcStringId.ANAKIM_IN_THE_NAME_OF_GREAT_SHILEN_I_WILL_CUT_YOUR_THROAT,
+ NpcStringId.YOU_CANNOT_BE_THE_MATCH_OF_LILITH_I_LL_TEACH_YOU_A_LESSON
+ };
+ // Misc
+ private static final int TEMPLATE_ID = 112;
+ private static final int DOOR_1 = 17240102;
+ private static final int DOOR_2 = 17240104;
+ private static final int DOOR_3 = 17240106;
+ private static final int DOOR_4 = 17240108;
+ private static final int DOOR_5 = 17240110;
+ private static final int DISCIPLES_NECROPOLIS_DOOR = 17240111;
+ private static final Map<Integer, Location> LILITH_SPAWN = new HashMap<>();
+ private static final Map<Integer, Location> ANAKIM_SPAWN = new HashMap<>();
+ static
+ {
+ LILITH_SPAWN.put(LILITH, new Location(-83175, 217021, -7504, 49151));
+ LILITH_SPAWN.put(LILITHS_STEWARD, new Location(-83327, 216938, -7492, 50768));
+ LILITH_SPAWN.put(LILITHS_ELITE, new Location(-83003, 216909, -7492, 4827));
+ ANAKIM_SPAWN.put(ANAKIM, new Location(-83179, 216479, -7504, 16384));
+ ANAKIM_SPAWN.put(ANAKIMS_GUARDIAN, new Location(-83321, 216507, -7492, 16166));
+ ANAKIM_SPAWN.put(ANAKIMS_GUARD, new Location(-83086, 216519, -7495, 15910));
+ ANAKIM_SPAWN.put(ANAKIMS_EXECUTOR, new Location(-83031, 216604, -7492, 17071));
+ }
+
+ public DisciplesNecropolisPast()
+ {
+ 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);
@@ -144,69 +137,47 @@
{
for (Map.Entry<Integer, Location> entry : LILITH_SPAWN.entrySet())
{
- L2Npc npc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId());
+ final L2Npc npc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId());
world.lilithGroup.add(npc);
}
for (Map.Entry<Integer, Location> entry : ANAKIM_SPAWN.entrySet())
{
- L2Npc enpc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId());
+ final L2Npc enpc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId());
world.anakimGroup.add(enpc);
}
}
private synchronized void checkDoors(L2Npc npc, DNPWorld world)
{
- if (world.countKill == 4)
+ switch (world.countKill)
{
- openDoor(DOOR_1, world.getInstanceId());
- }
- else if (world.countKill == 10)
- {
- openDoor(DOOR_2, world.getInstanceId());
- }
- else if (world.countKill == 18)
- {
- openDoor(DOOR_3, world.getInstanceId());
- }
- else if (world.countKill == 28)
- {
- openDoor(DOOR_4, world.getInstanceId());
- }
- else if (world.countKill == 40)
- {
- openDoor(DOOR_5, world.getInstanceId());
+ case 4:
+ openDoor(DOOR_1, world.getInstanceId());
+ break;
+ case 10:
+ openDoor(DOOR_2, world.getInstanceId());
+ break;
+ case 18:
+ openDoor(DOOR_3, world.getInstanceId());
+ break;
+ case 28:
+ openDoor(DOOR_4, world.getInstanceId());
+ break;
+ case 40:
+ openDoor(DOOR_5, world.getInstanceId());
+ break;
}
}
- protected int enterInstance(L2PcInstance player, String template, Location loc)
+ @Override
+ public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
- // check for existing instances for this player
- InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
- // existing instance
- if (world != null)
+ if (firstEntrance)
{
- if (!(world instanceof DNPWorld))
- {
- player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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)
@@ -221,10 +192,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":
@@ -398,31 +369,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);
}
@@ -474,7 +430,7 @@
{
if (qs.isCond(3) || qs.isCond(4))
{
- enterInstance(talker, "DisciplesNecropolisPast.xml", ENTER);
+ enterInstance(talker, new DNPWorld(), "DisciplesNecropolisPast.xml", TEMPLATE_ID);
return "";
}
break;
@@ -509,18 +465,4 @@
}
return htmltext;
}
-
- private static final void removeBuffs(L2Character ch)
- {
- ch.stopAllEffectsExceptThoseThatLastThroughDeath();
- if (ch.hasSummon())
- {
- ch.getServitors().values().forEach(L2Summon::stopAllEffectsExceptThoseThatLastThroughDeath);
- }
- }
-
- public static void main(String[] args)
- {
- new DisciplesNecropolisPast();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java b/L2J_DataPack/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java
index 33ad931..4d7a8e8 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/ElcadiasTent/ElcadiasTent.java
@@ -18,10 +18,10 @@
*/
package instances.ElcadiasTent;
+import instances.AbstractInstance;
import quests.Q10292_SevenSignsGirlOfDoubt.Q10292_SevenSignsGirlOfDoubt;
import quests.Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom;
import quests.Q10294_SevenSignsToTheMonasteryOfSilence.Q10294_SevenSignsToTheMonasteryOfSilence;
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
@@ -29,30 +29,30 @@
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Elcadia's Tent instance zone.
* @author Adry_85
*/
-public final class ElcadiasTent extends AbstractNpcAI
+public final class ElcadiasTent extends AbstractInstance
{
protected class ETWorld extends InstanceWorld
{
}
- private static final int TEMPLATE_ID = 158;
// NPCs
private static final int ELCADIA = 32784;
private static final int GRUFF_LOOKING_MAN = 32862;
// Locations
private static final Location START_LOC = new Location(89706, -238074, -9632, 0, 0);
private static final Location EXIT_LOC = new Location(43316, -87986, -2832, 0, 0);
+ // Misc
+ private static final int TEMPLATE_ID = 158;
- private ElcadiasTent()
+ public ElcadiasTent()
{
- super(ElcadiasTent.class.getSimpleName(), "instances");
+ super(ElcadiasTent.class.getSimpleName());
addFirstTalkId(GRUFF_LOOKING_MAN, ELCADIA);
addStartNpc(GRUFF_LOOKING_MAN, ELCADIA);
addTalkId(GRUFF_LOOKING_MAN, ELCADIA);
@@ -71,7 +71,7 @@
|| ((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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- }
- 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();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/FaeronTrainingGrounds1/FaeronTrainingGrounds1.java b/L2J_DataPack/dist/game/data/scripts/instances/FaeronTrainingGrounds1/FaeronTrainingGrounds1.java
index 3dc7623..5800f3b 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/FaeronTrainingGrounds1/FaeronTrainingGrounds1.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/FaeronTrainingGrounds1/FaeronTrainingGrounds1.java
@@ -18,8 +18,8 @@
*/
package instances.FaeronTrainingGrounds1;
+import instances.AbstractInstance;
import quests.Q10735_ASpecialPower.Q10735_ASpecialPower;
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
@@ -28,21 +28,21 @@
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.serverpackets.ExShowScreenMessage;
/**
+ * Fearon Training Grounds Instance Zone.
* @author Sdw
*/
-public class FaeronTrainingGrounds1 extends AbstractNpcAI
+public final class FaeronTrainingGrounds1 extends AbstractInstance
{
- // Locations
- private static final Location START_LOC = new Location(-74903, 240618, -3584);
- private static final Location EXIT_LOC = new Location(-82088, 249880, -3392);
// NPC's
private static final int AYANTHE = 33942;
private static final int AYANTHE_2 = 33944;
- // Instance
+ // Locations
+ private static final Location START_LOC = new Location(-74903, 240618, -3584);
+ private static final Location EXIT_LOC = new Location(-82088, 249880, -3392);
+ // Misc
private static final int TEMPLATE_ID = 251;
protected class FTGWorld extends InstanceWorld
@@ -60,7 +60,8 @@
if (event.equals("enter_instance"))
{
- enterInstance(player, "FaeronTrainingGrounds1.xml");
+ enterInstance(player, new FTGWorld(), "FaeronTrainingGrounds1.xml", TEMPLATE_ID);
+
}
else if (event.equals("exit_instance"))
{
@@ -72,39 +73,21 @@
return super.onAdvEvent(event, npc, player);
}
- private FaeronTrainingGrounds1()
+ public FaeronTrainingGrounds1()
{
- super(FaeronTrainingGrounds1.class.getSimpleName(), "instances");
+ super(FaeronTrainingGrounds1.class.getSimpleName());
addStartNpc(AYANTHE, AYANTHE_2);
addTalkId(AYANTHE, AYANTHE_2);
}
- 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 FTGWorld)
- {
- teleportPlayer(player, START_LOC, world.getInstanceId());
- return;
- }
- player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- return;
+ world.addAllowed(player.getObjectId());
+ showOnScreenMsg(player, NpcStringId.TALK_TO_MAGISTER_AYANTHE, ExShowScreenMessage.TOP_CENTER, 4500);
}
- world = new FTGWorld();
- world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
- world.setTemplateId(TEMPLATE_ID);
- world.addAllowed(player.getObjectId());
- world.setStatus(0);
- InstanceManager.getInstance().addWorld(world);
teleportPlayer(player, START_LOC, world.getInstanceId());
- showOnScreenMsg(player, NpcStringId.TALK_TO_MAGISTER_AYANTHE, ExShowScreenMessage.TOP_CENTER, 4500);
}
-
- public static void main(String[] args)
- {
- new FaeronTrainingGrounds1();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/FaeronTrainingGrounds2/FaeronTrainingGrounds2.java b/L2J_DataPack/dist/game/data/scripts/instances/FaeronTrainingGrounds2/FaeronTrainingGrounds2.java
index 61c7cb6..719e308 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/FaeronTrainingGrounds2/FaeronTrainingGrounds2.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/FaeronTrainingGrounds2/FaeronTrainingGrounds2.java
@@ -18,8 +18,8 @@
*/
package instances.FaeronTrainingGrounds2;
+import instances.AbstractInstance;
import quests.Q10736_ASpecialPower.Q10736_ASpecialPower;
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
@@ -28,21 +28,21 @@
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.serverpackets.ExShowScreenMessage;
/**
+ * Fearon Training Grounds Instance Zone.
* @author Sdw
*/
-public class FaeronTrainingGrounds2 extends AbstractNpcAI
+public final class FaeronTrainingGrounds2 extends AbstractInstance
{
- // Locations
- private static final Location START_LOC = new Location(-74903, 240618, -3584);
- private static final Location EXIT_LOC = new Location(-82088, 249880, -3392);
// NPC's
private static final int KATALIN = 33943;
private static final int KATALIN_2 = 33945;
- // Instance
+ // Locations
+ private static final Location START_LOC = new Location(-74903, 240618, -3584);
+ private static final Location EXIT_LOC = new Location(-82088, 249880, -3392);
+ // Misc
private static final int TEMPLATE_ID = 252;
protected class FTGWorld extends InstanceWorld
@@ -60,7 +60,7 @@
if (event.equals("enter_instance"))
{
- enterInstance(player, "FaeronTrainingGrounds2.xml");
+ enterInstance(player, new FTGWorld(), "FaeronTrainingGrounds2.xml", TEMPLATE_ID);
}
else if (event.equals("exit_instance"))
{
@@ -72,39 +72,21 @@
return super.onAdvEvent(event, npc, player);
}
- private FaeronTrainingGrounds2()
+ public FaeronTrainingGrounds2()
{
- super(FaeronTrainingGrounds2.class.getSimpleName(), "instances");
+ super(FaeronTrainingGrounds2.class.getSimpleName());
addStartNpc(KATALIN, KATALIN_2);
addTalkId(KATALIN, KATALIN_2);
}
- 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 FTGWorld)
- {
- teleportPlayer(player, START_LOC, world.getInstanceId());
- return;
- }
- player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- return;
+ world.addAllowed(player.getObjectId());
+ showOnScreenMsg(player, NpcStringId.TALK_TO_MASTER_KATALIN, ExShowScreenMessage.TOP_CENTER, 4500);
}
- world = new FTGWorld();
- world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
- world.setTemplateId(TEMPLATE_ID);
- world.addAllowed(player.getObjectId());
- world.setStatus(0);
- InstanceManager.getInstance().addWorld(world);
teleportPlayer(player, START_LOC, world.getInstanceId());
- showOnScreenMsg(player, NpcStringId.TALK_TO_MASTER_KATALIN, ExShowScreenMessage.TOP_CENTER, 4500);
}
-
- public static void main(String[] args)
- {
- new FaeronTrainingGrounds2();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java b/L2J_DataPack/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java
index c052a84..3500fe9 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/FinalEmperialTomb/FinalEmperialTomb.java
@@ -18,8 +18,9 @@
*/
package instances.FinalEmperialTomb;
+import instances.AbstractInstance;
+
import java.io.File;
-import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -59,7 +60,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.skills.Skill;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -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,15 +160,19 @@
};
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);
@@ -195,10 +184,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 +221,6 @@
17130069,
17130070
};
-
protected static final int[] FIRST_ROUTE_DOORS =
{
17130042,
@@ -234,68 +231,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 +480,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.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
return false;
}
- L2CommandChannel channel = player.getParty().getCommandChannel();
+
+ final L2CommandChannel channel = player.getParty().getCommandChannel();
if (channel == null)
{
player.sendPacket(SystemMessageId.YOU_CANNOT_ENTER_BECAUSE_YOU_ARE_NOT_ASSOCIATED_WITH_THE_CURRENT_COMMAND_CHANNEL);
@@ -571,82 +522,51 @@
{
if (channelMember.getLevel() < 80)
{
- SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY);
- sm.addPcName(channelMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_S_LEVEL_DOES_NOT_CORRESPOND_TO_THE_REQUIREMENTS_FOR_ENTRY).addPcName(channelMember));
return false;
}
if (!Util.checkIfInRange(1000, player, channelMember, true))
{
- SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED);
- sm.addPcName(channelMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_IS_IN_A_LOCATION_WHICH_CANNOT_BE_ENTERED_THEREFORE_IT_CANNOT_BE_PROCESSED).addPcName(channelMember));
return false;
}
- Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID);
+ final Long reentertime = InstanceManager.getInstance().getInstanceTime(channelMember.getObjectId(), TEMPLATE_ID);
if (System.currentTimeMillis() < reentertime)
{
- SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET);
- sm.addPcName(channelMember);
- party.broadcastPacket(sm);
+ party.broadcastPacket(SystemMessage.getSystemMessage(SystemMessageId.C1_MAY_NOT_RE_ENTER_YET).addPcName(channelMember));
return false;
}
}
return true;
}
- protected int enterInstance(L2PcInstance player, String template, Location loc)
+ @Override
+ public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
- // check for existing instances for this player
- InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
- // existing instance
- if (world != null)
+ if (firstEntrance)
{
- if (!(world instanceof FETWorld))
+ controlStatus((FETWorld) world);
+
+ if ((player.getParty() == null) || (player.getParty().getCommandChannel() == null))
{
- player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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();
- }
-
- // 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, ENTER_TELEPORT, world.getInstanceId(), false);
+ }
+ }
}
else
{
- for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
- {
- channelMember.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, channelMember.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true);
- world.addAllowed(channelMember.getObjectId());
- teleportPlayer(channelMember, loc, instanceId, false);
- }
+ teleportPlayer(player, ENTER_TELEPORT, world.getInstanceId(), false);
}
- return instanceId;
}
protected boolean checkKillProgress(L2Npc mob, FETWorld world)
@@ -738,7 +658,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 +721,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);
@@ -1414,46 +1334,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_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE);
- 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())
@@ -1587,7 +1467,7 @@
getQuestState(player, true);
if (npcId == GUIDE)
{
- enterInstance(player, "FinalEmperialTomb.xml", ENTER_TELEPORT);
+ enterInstance(player, new FETWorld(), "FinalEmperialTomb.xml", TEMPLATE_ID);
}
else if (npc.getId() == CUBE)
{
@@ -1598,9 +1478,4 @@
}
return "";
}
-
- public static void main(String[] args)
- {
- new FinalEmperialTomb();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java b/L2J_DataPack/dist/game/data/scripts/instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java
index 1027128..c1b6e6b 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/HarnakUndergroundRuins/HarnakUndergroundRuins.java
@@ -18,12 +18,12 @@
*/
package instances.HarnakUndergroundRuins;
+import instances.AbstractInstance;
+
import java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
-
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.enums.CategoryType;
@@ -32,30 +32,36 @@
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.entity.Instance;
import com.l2jserver.gameserver.model.holders.SkillHolder;
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;
import com.l2jserver.gameserver.network.serverpackets.ExSendUIEvent;
import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
import com.l2jserver.gameserver.util.Util;
/**
+ * Harnak Underground Ruins Instance Zone.
* @author Sdw
*/
-public class HarnakUndergroundRuins extends AbstractNpcAI
+public final class HarnakUndergroundRuins extends AbstractInstance
{
- private static final int TEMPLATE_ID = 195;
- // Locations
- private static final Location START_LOC = new Location(-107910, 205828, -10872);
- private static final Location NPC_ROOM1_LOC = new Location(-107930, 206328, -10872);
- private static final Location EXIT_LOC = new Location(-114962, 226564, -2864);
- // Doors
- private static final int DOOR_ONE = 16240100;
- private static final int DOOR_TWO = 16240102;
+ protected class HuRWorld extends InstanceWorld
+ {
+ protected int wave = 0;
+ protected int currentNpc = 0;
+ protected int waveNpcId = 0;
+ protected int maximalDefenseCounter = 0;
+ protected int timerCount = 0;
+ protected int enabledSeal = 0;
+ protected Set<L2Npc> spawnedNpc = Collections.newSetFromMap(new ConcurrentHashMap<L2Npc, Boolean>());
+ protected boolean openingPlayed = false;
+ protected boolean harnakMessage1 = false;
+ protected boolean harnakMessage2 = false;
+ protected boolean harnakMessage3 = false;
+ }
+
// NPCs
private static final int HADEL = 33344;
private static final int KRAKIA_BATHUS = 27437;
@@ -75,37 +81,28 @@
33556,
33557
};
+ // Locations
+ private static final Location START_LOC = new Location(-107910, 205828, -10872);
+ private static final Location NPC_ROOM1_LOC = new Location(-107930, 206328, -10872);
+ private static final Location EXIT_LOC = new Location(-114962, 226564, -2864);
// Skills
private static final SkillHolder RELEASE_OF_POWER = new SkillHolder(14625, 1);
private static final SkillHolder MAXIMUM_DEFENSE = new SkillHolder(14700, 1);
private static final SkillHolder LIGHT_HEAL = new SkillHolder(14736, 1);
private static final SkillHolder ULTIMATE_BUFF = new SkillHolder(4318, 1);
- // Zones
+ // Misc
+ private static final int TEMPLATE_ID = 195;
private static final int ZONE_ROOM_2 = 200032;
private static final int ZONE_ROOM_3 = 200033;
- // Movies
private static final int LAST_ROOM_OPENING = 46;
private static final int SUCCES_ENDING = 47;
private static final int FAILED_ENDING = 48;
+ private static final int DOOR_ONE = 16240100;
+ private static final int DOOR_TWO = 16240102;
- protected class HuRWorld extends InstanceWorld
+ public HarnakUndergroundRuins()
{
- protected int wave = 0;
- protected int currentNpc = 0;
- protected int waveNpcId = 0;
- protected int maximalDefenseCounter = 0;
- protected int timerCount = 0;
- protected int enabledSeal = 0;
- protected Set<L2Npc> spawnedNpc = Collections.newSetFromMap(new ConcurrentHashMap<L2Npc, Boolean>());
- protected boolean openingPlayed = false;
- protected boolean harnakMessage1 = false;
- protected boolean harnakMessage2 = false;
- protected boolean harnakMessage3 = false;
- }
-
- private HarnakUndergroundRuins()
- {
- super(HarnakUndergroundRuins.class.getSimpleName(), "instances");
+ super(HarnakUndergroundRuins.class.getSimpleName());
registerMobs(KRAKIA_BATHUS, KRAKIA_CARCASS, KRAKIA_LOTUS, RAKZAN, WEISS_KHAN, BAMONTI, SEKNUS, WEISS_ELE, HARNAKS_WRAITH);
addSeeCreatureId(POWER_SOURCES);
addEnterZoneId(ZONE_ROOM_2, ZONE_ROOM_3);
@@ -122,7 +119,7 @@
{
case "enter_instance":
{
- enterInstance(player, "HarnakUndergroundRuins.xml");
+ enterInstance(player, new HuRWorld(), "HarnakUndergroundRuins.xml", TEMPLATE_ID);
break;
}
case "message1":
@@ -200,9 +197,8 @@
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof HuRWorld)
{
- HuRWorld world = (HuRWorld) tmpworld;
- Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
- List<L2Npc> spawnedNpcs = inst.spawnGroup("first_room");
+ final HuRWorld world = (HuRWorld) tmpworld;
+ final List<L2Npc> spawnedNpcs = spawnGroup("first_room", world.getInstanceId());
world.spawnedNpc.addAll(spawnedNpcs);
final L2Npc razkan = spawnedNpcs.stream().filter(n -> n.getId() == RAKZAN).findFirst().orElse(null);
if (razkan != null)
@@ -219,8 +215,7 @@
case "spawn_npc2":
{
openDoor(DOOR_ONE, player.getInstanceId());
- final Instance inst = InstanceManager.getInstance().getInstance(player.getInstanceId());
- inst.spawnGroup("power_sources");
+ spawnGroup("power_sources", player.getInstanceId());
break;
}
case "spawn_npc3":
@@ -228,10 +223,9 @@
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof HuRWorld)
{
- HuRWorld world = (HuRWorld) tmpworld;
+ final HuRWorld world = (HuRWorld) tmpworld;
world.incStatus();
- Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
- List<L2Npc> spawnedNpcs = inst.spawnGroup("third_room");
+ final List<L2Npc> spawnedNpcs = spawnGroup("third_room", world.getInstanceId());
final L2Npc powerSource = spawnedNpcs.stream().filter(n -> n.getId() == POWER_SOURCE).findFirst().orElse(null);
if (powerSource != null)
{
@@ -289,8 +283,7 @@
if (tmpworld instanceof HuRWorld)
{
final HuRWorld world = (HuRWorld) tmpworld;
- final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
- final List<L2Npc> spawnedNpcs = inst.spawnGroup("second_room_wave_1_" + npcId);
+ final List<L2Npc> spawnedNpcs = spawnGroup("second_room_wave_1_" + npcId, world.getInstanceId());
world.spawnedNpc.addAll(spawnedNpcs);
world.waveNpcId = npcId;
for (L2Npc spawnedNpc : spawnedNpcs)
@@ -308,8 +301,7 @@
if (tmpworld instanceof HuRWorld)
{
final HuRWorld world = (HuRWorld) tmpworld;
- final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
- final List<L2Npc> spawnedNpcs = inst.spawnGroup("second_room_wave_2_" + world.waveNpcId);
+ final List<L2Npc> spawnedNpcs = spawnGroup("second_room_wave_2_" + world.waveNpcId, world.getInstanceId());
world.spawnedNpc.addAll(spawnedNpcs);
for (L2Npc spawnedNpc : spawnedNpcs)
{
@@ -325,15 +317,14 @@
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof HuRWorld)
{
- HuRWorld world = (HuRWorld) tmpworld;
- final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
- List<L2Npc> spawnedNpcs = inst.spawnGroup("second_room_wave_3_" + world.waveNpcId);
+ final HuRWorld world = (HuRWorld) tmpworld;
+ final List<L2Npc> spawnedNpcs = spawnGroup("second_room_wave_3_" + world.waveNpcId, world.getInstanceId());
world.spawnedNpc.addAll(spawnedNpcs);
for (L2Npc spawnedNpc : spawnedNpcs)
{
addAttackPlayerDesire(spawnedNpc, player);
}
- final List<L2Npc> powersources = inst.spawnGroup("power_source");
+ final List<L2Npc> powersources = spawnGroup("power_source", world.getInstanceId());
for (L2Npc powersource : powersources)
{
powersource.setTarget(player);
@@ -348,7 +339,7 @@
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof HuRWorld)
{
- HuRWorld world = (HuRWorld) tmpworld;
+ final HuRWorld world = (HuRWorld) tmpworld;
if (npc.calculateDistance(player, true, false) < MAXIMUM_DEFENSE.getSkill().getCastRange())
{
npc.doCast(MAXIMUM_DEFENSE.getSkill());
@@ -403,13 +394,12 @@
if (tmpworld instanceof HuRWorld)
{
final HuRWorld world = (HuRWorld) tmpworld;
- final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
- List<L2Npc> spawnedNpcs = inst.spawnGroup("third_room_" + world.waveNpcId);
+ List<L2Npc> spawnedNpcs = spawnGroup("third_room_" + world.waveNpcId, world.getInstanceId());
for (L2Npc spawnedNpc : spawnedNpcs)
{
addAttackPlayerDesire(spawnedNpc, player);
}
- spawnedNpcs = inst.spawnGroup("seal");
+ spawnedNpcs = spawnGroup("seal", world.getInstanceId());
for (L2Npc spawnedNpc : spawnedNpcs)
{
broadcastNpcSay(spawnedNpc, Say2.NPC_ALL, NpcStringId.DISABLE_DEVICE_WILL_GO_OUT_OF_CONTROL_IN_1_MINUTE);
@@ -423,7 +413,7 @@
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof HuRWorld)
{
- HuRWorld world = (HuRWorld) tmpworld;
+ final HuRWorld world = (HuRWorld) tmpworld;
if (npc.getScriptValue() == 0)
{
npc.setScriptValue(1);
@@ -512,8 +502,7 @@
}
case "spawn_hermuncus":
{
- final Instance inst = InstanceManager.getInstance().getInstance(player.getInstanceId());
- inst.spawnGroup("hermuncus");
+ spawnGroup("hermuncus", player.getInstanceId());
break;
}
case "cast_release_power":
@@ -536,34 +525,18 @@
return htmltext;
}
- 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 HuRWorld)
- {
- teleportPlayer(player, START_LOC, world.getInstanceId());
- return;
- }
- player.sendPacket(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- return;
+ startQuestTimer("fail_instance", 1260000, null, player);
+ startQuestTimer("message1", 2500, null, player);
+ startQuestTimer("message2", 5000, null, player);
+ startQuestTimer("message3", 8500, null, player);
+ startQuestTimer("spawn_npc1", 10000, null, player);
}
- world = new HuRWorld();
- world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
- world.setTemplateId(TEMPLATE_ID);
- world.addAllowed(player.getObjectId());
- world.setStatus(0);
- InstanceManager.getInstance().addWorld(world);
-
teleportPlayer(player, START_LOC, world.getInstanceId());
-
- startQuestTimer("fail_instance", 1260000, null, player);
- startQuestTimer("message1", 2500, null, player);
- startQuestTimer("message2", 5000, null, player);
- startQuestTimer("message3", 8500, null, player);
- startQuestTimer("spawn_npc1", 10000, null, player);
}
@Override
@@ -572,7 +545,7 @@
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(killer);
if ((tmpworld instanceof HuRWorld))
{
- HuRWorld world = (HuRWorld) tmpworld;
+ final HuRWorld world = (HuRWorld) tmpworld;
if (world.isStatus(0))
{
world.spawnedNpc.remove(npc);
@@ -800,7 +773,6 @@
}
}
}
-
return super.onAttack(npc, player, damage, isSummon);
}
@@ -854,10 +826,5 @@
}
}
return super.onEnterZone(character, zone);
- }
-
- public static void main(String[] args)
- {
- new HarnakUndergroundRuins();
}
}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java b/L2J_DataPack/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java
index 41f9a77..de5f083 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/HideoutOfTheDawn/HideoutOfTheDawn.java
@@ -18,38 +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.L2Summon;
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);
}
@@ -61,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:
@@ -76,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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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.getServitors().values().forEach(L2Summon::stopAllEffectsExceptThoseThatLastThroughDeath);
- }
- }
-
- public static void main(String[] args)
- {
- new HideoutOfTheDawn();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java b/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java
index f1b0b90..3626281 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastle/IceQueensCastle.java
@@ -18,8 +18,8 @@
*/
package instances.IceQueensCastle;
+import instances.AbstractInstance;
import quests.Q10285_MeetingSirra.Q10285_MeetingSirra;
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@@ -40,7 +40,7 @@
* 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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java b/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java
index 8c4d100..ee0d152 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/IceQueensCastleNormalBattle/IceQueensCastleNormalBattle.java
@@ -18,14 +18,14 @@
*/
package instances.IceQueensCastleNormalBattle;
+import instances.AbstractInstance;
+
import java.util.ArrayList;
-import java.util.Calendar;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import quests.Q10286_ReunionWithSirra.Q10286_ReunionWithSirra;
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.enums.MountType;
@@ -37,7 +37,6 @@
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.model.actor.L2Summon;
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@@ -63,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
@@ -159,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 +177,7 @@
{
if (event.equals("enter"))
{
- enterInstance(player, "IceQueensCastleNormalBattle.xml");
+ enterInstance(player, new IQCNBWorld(), "IceQueensCastleNormalBattle.xml", TEMPLATE_ID);
}
else
{
@@ -1069,41 +1064,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_S_ENTRY_HAS_BEEN_RESTRICTED_YOU_CAN_CHECK_THE_NEXT_POSSIBLE_ENTRY_TIME_BY_USING_THE_COMMAND_INSTANCEZONE);
- 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);
@@ -1162,46 +1126,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();
- final L2Summon pet = player.getPet();
- if (pet != null)
- {
- pet.stopAllEffectsExceptThoseThatLastThroughDeath();
- }
-
- player.getServitors().values().forEach(L2Summon::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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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);
@@ -1221,23 +1150,21 @@
}
}
}
+ else
+ {
+ teleportPlayer(player, world.isStatus(4) ? BATTLE_PORT : ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId());
+ }
}
private void managePlayerEnter(L2PcInstance player, IQCNBWorld world)
{
- player.stopAllEffectsExceptThoseThatLastThroughDeath();
- final L2Summon pet = player.getPet();
- if (pet != null)
- {
- pet.stopAllEffectsExceptThoseThatLastThroughDeath();
- }
- player.getServitors().values().forEach(L2Summon::stopAllEffectsExceptThoseThatLastThroughDeath);
world.playersInside.add(player);
world.addAllowed(player.getObjectId());
teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false);
}
- private boolean checkConditions(L2PcInstance player)
+ @Override
+ protected boolean checkConditions(L2PcInstance player)
{
final L2Party party = player.getParty();
final L2CommandChannel channel = party != null ? party.getCommandChannel() : null;
@@ -1363,9 +1290,4 @@
}
}
}
-
- public static void main(String[] args)
- {
- new IceQueensCastleNormalBattle();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java b/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java
new file mode 100644
index 0000000..10e73fe
--- /dev/null
+++ b/L2J_DataPack/dist/game/data/scripts/instances/InstanceLoader.java
@@ -0,0 +1,112 @@
+/*
+ * 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.FaeronTrainingGrounds1.FaeronTrainingGrounds1;
+import instances.FaeronTrainingGrounds2.FaeronTrainingGrounds2;
+import instances.FinalEmperialTomb.FinalEmperialTomb;
+import instances.HarnakUndergroundRuins.HarnakUndergroundRuins;
+import instances.HideoutOfTheDawn.HideoutOfTheDawn;
+import instances.IceQueensCastle.IceQueensCastle;
+import instances.IceQueensCastleNormalBattle.IceQueensCastleNormalBattle;
+import instances.JiniaGuildHideout1.JiniaGuildHideout1;
+import instances.JiniaGuildHideout2.JiniaGuildHideout2;
+import instances.JiniaGuildHideout3.JiniaGuildHideout3;
+import instances.JiniaGuildHideout4.JiniaGuildHideout4;
+import instances.Kamaloka.Kamaloka;
+import instances.LibraryOfSages.LibraryOfSages;
+import instances.MithrilMine.MithrilMine;
+import instances.MonasteryOfSilence1.MonasteryOfSilence1;
+import instances.NornilsGarden.NornilsGarden;
+import instances.PailakaDevilsLegacy.PailakaDevilsLegacy;
+import instances.PailakaSongOfIceAndFire.PailakaSongOfIceAndFire;
+import instances.SanctumOftheLordsOfDawn.SanctumOftheLordsOfDawn;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * Instance class-loader.
+ * @author FallenAngel
+ */
+public final class InstanceLoader
+{
+ private static final Logger _log = Logger.getLogger(InstanceLoader.class.getName());
+
+ private static final Class<?>[] SCRIPTS =
+ {
+ CavernOfThePirateCaptain.class,
+ CrystalCaverns.class,
+ DarkCloudMansion.class,
+ DisciplesNecropolisPast.class,
+ ElcadiasTent.class,
+ FaeronTrainingGrounds1.class,
+ FaeronTrainingGrounds2.class,
+ FinalEmperialTomb.class,
+ HarnakUndergroundRuins.class,
+ HideoutOfTheDawn.class,
+ ChamberOfDelusionEast.class,
+ ChamberOfDelusionNorth.class,
+ ChamberOfDelusionSouth.class,
+ ChamberOfDelusionSquare.class,
+ ChamberOfDelusionTower.class,
+ ChamberOfDelusionWest.class,
+ IceQueensCastle.class,
+ IceQueensCastleNormalBattle.class,
+ JiniaGuildHideout1.class,
+ JiniaGuildHideout2.class,
+ JiniaGuildHideout3.class,
+ JiniaGuildHideout4.class,
+ Kamaloka.class,
+ LibraryOfSages.class,
+ MithrilMine.class,
+ MonasteryOfSilence1.class,
+ NornilsGarden.class,
+ PailakaDevilsLegacy.class,
+ PailakaSongOfIceAndFire.class,
+ SanctumOftheLordsOfDawn.class,
+ };
+
+ public static void main(String[] args)
+ {
+ _log.info(InstanceLoader.class.getSimpleName() + ": Loading Instances scripts.");
+ for (Class<?> script : SCRIPTS)
+ {
+ try
+ {
+ script.newInstance();
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, InstanceLoader.class.getSimpleName() + ": Failed loading " + script.getSimpleName() + ":", e);
+ }
+ }
+ }
+}
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java
index 80d552f..b707ca3 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout1/JiniaGuildHideout1.java
@@ -18,37 +18,36 @@
*/
package instances.JiniaGuildHideout1;
+import instances.AbstractInstance;
import quests.Q10284_AcquisitionOfDivineSword.Q10284_AcquisitionOfDivineSword;
-import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
-import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Jinia Guild Hideout instance zone.
* @author Adry_85
*/
-public final class JiniaGuildHideout1 extends Quest
+public final class JiniaGuildHideout1 extends AbstractInstance
{
protected class JGH1World extends InstanceWorld
{
- long storeTime = 0;
+
}
- private static final int INSTANCEID = 140;
// NPC
private static final int RAFFORTY = 32020;
// Location
private static final Location START_LOC = new Location(-23530, -8963, -5413);
+ // Misc
+ private static final int TEMPLATE_ID = 140;
- private JiniaGuildHideout1()
+ public JiniaGuildHideout1()
{
- super(-1, JiniaGuildHideout1.class.getSimpleName(), "instances");
+ super(JiniaGuildHideout1.class.getSimpleName());
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
}
@@ -59,42 +58,19 @@
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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- return;
- }
- teleportPlayer(player, START_LOC, world.getInstanceId(), false);
- return;
+ world.addAllowed(player.getObjectId());
}
- // New instance
- world = new JGH1World();
- world.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
- world.setTemplateId(INSTANCEID);
- world.setStatus(0);
- ((JGH1World) world).storeTime = System.currentTimeMillis();
- InstanceManager.getInstance().addWorld(world);
- _log.info("Jinia Guild Hideout started " + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
- // teleport players
teleportPlayer(player, START_LOC, world.getInstanceId(), false);
- world.addAllowed(player.getObjectId());
}
-
- public static void main(String[] args)
- {
- new JiniaGuildHideout1();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java
index 6f2eb0c..5718644 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout2/JiniaGuildHideout2.java
@@ -18,37 +18,36 @@
*/
package instances.JiniaGuildHideout2;
+import instances.AbstractInstance;
import quests.Q10285_MeetingSirra.Q10285_MeetingSirra;
-import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
-import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Jinia Guild Hideout instance zone.
* @author Adry_85
*/
-public final class JiniaGuildHideout2 extends Quest
+public final class JiniaGuildHideout2 extends AbstractInstance
{
protected class JGH2World extends InstanceWorld
{
- long storeTime = 0;
+
}
- private static final int TEMPLATE_ID = 141;
// NPC
private static final int RAFFORTY = 32020;
// Location
private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0);
+ // Misc
+ private static final int TEMPLATE_ID = 141;
- private JiniaGuildHideout2()
+ public JiniaGuildHideout2()
{
- super(-1, JiniaGuildHideout2.class.getSimpleName(), "instances");
+ super(JiniaGuildHideout2.class.getSimpleName());
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
}
@@ -59,43 +58,19 @@
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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java
index 1d7085b..f2083ae 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout3/JiniaGuildHideout3.java
@@ -18,37 +18,36 @@
*/
package instances.JiniaGuildHideout3;
+import instances.AbstractInstance;
import quests.Q10286_ReunionWithSirra.Q10286_ReunionWithSirra;
-import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
-import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Jinia Guild Hideout instance zone.
* @author Adry_85
*/
-public final class JiniaGuildHideout3 extends Quest
+public final class JiniaGuildHideout3 extends AbstractInstance
{
- protected class JGH2World extends InstanceWorld
+ protected class JGH3World extends InstanceWorld
{
- long storeTime = 0;
+
}
- private static final int TEMPLATE_ID = 145;
// NPC
private static final int RAFFORTY = 32020;
// Location
private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0);
+ // Misc
+ private static final int TEMPLATE_ID = 145;
- private JiniaGuildHideout3()
+ public JiniaGuildHideout3()
{
- super(-1, JiniaGuildHideout3.class.getSimpleName(), "instances");
+ super(JiniaGuildHideout3.class.getSimpleName());
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
}
@@ -59,43 +58,19 @@
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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java
index 0495720..a58bed0 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/JiniaGuildHideout4/JiniaGuildHideout4.java
@@ -18,37 +18,36 @@
*/
package instances.JiniaGuildHideout4;
+import instances.AbstractInstance;
import quests.Q10287_StoryOfThoseLeft.Q10287_StoryOfThoseLeft;
-import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
-import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Jinia Guild Hideout instance zone.
* @author Adry_85
*/
-public final class JiniaGuildHideout4 extends Quest
+public final class JiniaGuildHideout4 extends AbstractInstance
{
- protected class JGH2World extends InstanceWorld
+ protected class JGH4World extends InstanceWorld
{
- long storeTime = 0;
+
}
- private static final int TEMPLATE_ID = 146;
// NPC
private static final int RAFFORTY = 32020;
// Location
private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0);
+ // Misc
+ private static final int TEMPLATE_ID = 146;
- private JiniaGuildHideout4()
+ public JiniaGuildHideout4()
{
- super(-1, JiniaGuildHideout4.class.getSimpleName(), "instances");
+ super(JiniaGuildHideout4.class.getSimpleName());
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
}
@@ -59,43 +58,19 @@
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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java b/L2J_DataPack/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java
index ce7936f..d340eb0 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/Kamaloka/Kamaloka.java
@@ -18,6 +18,8 @@
*/
package instances.Kamaloka;
+import instances.AbstractInstance;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
@@ -38,13 +40,12 @@
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
-import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
-public final class Kamaloka extends Quest
+public final class Kamaloka extends AbstractInstance
{
/*
* Reset time for all kamaloka Default: 6:30AM on server time
@@ -1176,9 +1177,9 @@
public L2Npc boss = null; // boss
}
- private Kamaloka()
+ public Kamaloka()
{
- super(-1, Kamaloka.class.getSimpleName(), "instances");
+ super(Kamaloka.class.getSimpleName());
addFirstTalkId(TELEPORTER);
addTalkId(TELEPORTER);
for (int cap : CAPTAINS)
@@ -1418,7 +1419,8 @@
* Called on instance finish and handles reenter time for instance
* @param world instanceWorld
*/
- private static final void finishInstance(InstanceWorld world)
+ @Override
+ protected final void finishInstance(InstanceWorld world)
{
if (world instanceof KamaWorld)
{
@@ -1725,8 +1727,9 @@
return super.onKill(npc, player, isSummon);
}
- public static void main(String[] args)
+ @Override
+ public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
- new Kamaloka();
+
}
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/32861.html b/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/32861.html
index 189a7a5..f36dd53 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/32861.html
+++ b/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/32861.html
@@ -1,5 +1,5 @@
<html><body>Library of Sages Director Sophia:<br>
Hello. What brings you to Library of Sages?<br>
-<a action="bypass -h Quest LibraryOfSages EXIT">"I wish to leave."</a><br>
+<a action="bypass -h Quest LibraryOfSages exit">"I wish to leave."</a><br>
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
</body></html>
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java b/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java
index 2549e80..0dd7217 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/LibraryOfSages/LibraryOfSages.java
@@ -18,7 +18,7 @@
*/
package instances.LibraryOfSages;
-import ai.npc.AbstractNpcAI;
+import instances.AbstractInstance;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
@@ -26,22 +26,19 @@
import com.l2jserver.gameserver.model.actor.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,42 +75,40 @@
@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 "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 "TELEPORT2":
+ {
+ teleportPlayer(player, LIBRARY_LOC, world.getInstanceId());
+ world.elcadia.teleToLocation(LIBRARY_LOC.getX(), LIBRARY_LOC.getY(), LIBRARY_LOC.getZ(), 0, world.getInstanceId());
+ break;
+ }
+ case "exit":
+ {
+ cancelQuestTimer("FOLLOW", npc, player);
+ player.teleToLocation(EXIT_LOC);
+ world.elcadia.deleteMe();
+ break;
+ }
+ case "FOLLOW":
+ {
+ npc.setIsRunning(true);
+ npc.getAI().startFollow(player);
+ broadcastNpcSay(npc, Say2.NPC_ALL, ELCADIA_DIALOGS[getRandom(ELCADIA_DIALOGS.length)]);
+ startQuestTimer("FOLLOW", 10000, npc, player);
+ break;
+ }
+ case "ENTER":
+ {
+ cancelQuestTimer("FOLLOW", npc, player);
+ teleportPlayer(player, START_LOC, world.getInstanceId());
+ world.elcadia.teleToLocation(START_LOC.getX(), START_LOC.getY(), START_LOC.getZ(), 0, world.getInstanceId());
+ break;
+ }
}
}
return super.onAdvEvent(event, npc, player);
@@ -120,50 +117,28 @@
@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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java b/L2J_DataPack/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java
index b55d6e4..db57f41 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/MithrilMine/MithrilMine.java
@@ -18,8 +18,8 @@
*/
package instances.MithrilMine;
+import instances.AbstractInstance;
import quests.Q10284_AcquisitionOfDivineSword.Q10284_AcquisitionOfDivineSword;
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@@ -32,22 +32,19 @@
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.NpcStringId;
-import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
/**
* Mithril Mine instance zone.
* @author Adry_85
*/
-public final class MithrilMine extends AbstractNpcAI
+public final class MithrilMine extends AbstractInstance
{
protected class MMWorld extends InstanceWorld
{
- long storeTime = 0;
- int _count = 0;
+ protected int _count = 0;
}
- private static final int TEMPLATE_ID = 138;
// NPCs
private static final int KEGOR = 18846;
private static final int MITHRIL_MILLIPEDE = 22766;
@@ -68,8 +65,10 @@
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 @@
giveItems(talker, COLD_RESISTANCE_POTION, 1);
}
qs.setCond(4, true);
- enterInstance(talker, "MithrilMine.xml", START_LOC);
+ enterInstance(talker, new MMWorld(), "MithrilMine.xml", TEMPLATE_ID);
}
break;
}
@@ -227,37 +226,13 @@
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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java b/L2J_DataPack/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java
index 34bc4ec..2e4a5e0 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/MonasteryOfSilence1/MonasteryOfSilence1.java
@@ -18,32 +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.L2Summon;
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;
@@ -57,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);
@@ -73,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_CAN_T_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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- }
- 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);
+ spawnElcadia(player, (MoSWorld) world);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
- InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
+ final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (!(tmpworld instanceof MoSWorld))
{
return null;
}
- MoSWorld world = (MoSWorld) tmpworld;
+ final MoSWorld world = (MoSWorld) tmpworld;
switch (event)
{
case "TELE2":
{
teleportPlayer(player, CENTRAL_ROOM_LOC, world.getInstanceId());
- world.elcadia.teleToLocation(CENTRAL_ROOM_LOC.getX(), CENTRAL_ROOM_LOC.getY(), CENTRAL_ROOM_LOC.getZ(), 0, world.getInstanceId());
+ world.elcadia.teleToLocation(CENTRAL_ROOM_LOC, 0, world.getInstanceId());
startQuestTimer("START_MOVIE", 2000, npc, player);
break;
}
@@ -157,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":
@@ -216,31 +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 spawnElcadia(L2PcInstance player, MoSWorld world)
{
- ch.stopAllEffectsExceptThoseThatLastThroughDeath();
- final L2Summon pet = ch.getPet();
- if (pet != null)
+ if (world.elcadia != null)
{
- pet.stopAllEffectsExceptThoseThatLastThroughDeath();
+ world.elcadia.deleteMe();
}
- ch.getServitors().values().forEach(L2Summon::stopAllEffectsExceptThoseThatLastThroughDeath);
+ 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();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java
index 8d8e3e8..37e70d8 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/NornilsGarden/NornilsGarden.java
@@ -18,6 +18,8 @@
*/
package instances.NornilsGarden;
+import instances.AbstractInstance;
+
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Party;
@@ -29,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.skills.Skill;
import com.l2jserver.gameserver.model.zone.L2ZoneType;
@@ -42,37 +43,39 @@
* @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
@@ -91,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 =
{
@@ -114,7 +110,6 @@
{ 18361, 9711, 0 }, // Guardian of Prediction
{ 25528, 9712, 0 } // Tiberias
};
-
private static final int[][] HP_HERBS_DROPLIST =
{
// itemId, count, chance
@@ -122,7 +117,6 @@
{ 8601, 2, 40 },
{ 8600, 3, 70 }
};
-
private static final int[][] _group_1 =
{
{ 18363, -109899, 74431, -12528, 16488 },
@@ -131,7 +125,6 @@
{ 18363, -109703, 74879, -12528, 49336 }
};
-
private static final int[][] _group_2 =
{
{ 18363, -110393, 78276, -12848, 49152 },
@@ -143,7 +136,6 @@
{ 18483, -110389, 79131, -12915, 48539 },
{ 18483, -110551, 79134, -12915, 49151 }
};
-
private static final int[][] _group_3 =
{
{ 18483, -107798, 80721, -12912, 0 },
@@ -153,8 +145,7 @@
{ 18483, -108740, 80752, -12912, 0 },
{ 18363, -109016, 80642, -12912, 0 },
{ 18483, -108740, 80546, -12912, 0 }
- };
-
+ };
private static final int[][] _group_4 =
{
{ 18362, -110082, 83998, -12928, 0 },
@@ -167,7 +158,6 @@
{ 18362, -109122, 84490, -12880, 0 },
{ 18347, -108939, 84489, -12880, 0 }
};
-
private static final int[][] MP_HERBS_DROPLIST =
{
// itemId, count, chance
@@ -187,11 +177,6 @@
mob.dropItem(player, element[0], element[1]);
}
}
- }
-
- private static final void removeBuffs(L2Character ch)
- {
- ch.stopAllEffectsExceptThoseThatLastThroughDeath();
}
private static final void giveBuffs(L2Character ch)
@@ -214,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);
@@ -236,17 +221,14 @@
@Override
public final void teleportPlayer(L2PcInstance player, Location loc, int instanceId)
{
- removeBuffs(player);
giveBuffs(player);
final L2Summon pet = player.getPet();
if (pet != null)
{
- removeBuffs(pet);
giveBuffs(pet);
}
player.getServitors().values().forEach(s ->
{
- removeBuffs(s);
giveBuffs(s);
});
super.teleportPlayer(player, loc, instanceId);
@@ -282,7 +264,7 @@
return null;
}
// check what instance still exist
- Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
+ final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
if (inst != null)
{
teleportPlayer(player, SPAWN_PPL, world.getInstanceId());
@@ -644,8 +626,9 @@
return super.onKill(npc, player, isSummon);
}
- public static void main(String[] args)
+ @Override
+ public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
- new NornilsGarden();
+
}
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java b/L2J_DataPack/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java
index 6a96581..4581a13 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/PailakaDevilsLegacy/PailakaDevilsLegacy.java
@@ -18,11 +18,12 @@
*/
package instances.PailakaDevilsLegacy;
+import instances.AbstractInstance;
+
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import quests.Q00129_PailakaDevilsLegacy.Q00129_PailakaDevilsLegacy;
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@@ -35,18 +36,17 @@
import com.l2jserver.gameserver.model.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,28 +304,15 @@
}
}
- 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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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)
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java b/L2J_DataPack/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java
index 909c3fe..37c64ca 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/PailakaSongOfIceAndFire/PailakaSongOfIceAndFire.java
@@ -18,7 +18,7 @@
*/
package instances.PailakaSongOfIceAndFire;
-import ai.npc.AbstractNpcAI;
+import instances.AbstractInstance;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
@@ -28,14 +28,13 @@
import com.l2jserver.gameserver.model.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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- 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
diff --git a/L2J_DataPack/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java b/L2J_DataPack/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java
index ec599c3..085709a 100644
--- a/L2J_DataPack/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java
+++ b/L2J_DataPack/dist/game/data/scripts/instances/SanctumOftheLordsOfDawn/SanctumOftheLordsOfDawn.java
@@ -18,37 +18,36 @@
*/
package instances.SanctumOftheLordsOfDawn;
+import instances.AbstractInstance;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import quests.Q00195_SevenSignsSecretRitualOfThePriests.Q00195_SevenSignsSecretRitualOfThePriests;
-import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.clientpackets.Say2;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
-import com.l2jserver.gameserver.network.serverpackets.NpcSay;
/**
* Sanctum of the Lords of Dawn instance zone.
* @author Adry_85
*/
-public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
+public final class SanctumOftheLordsOfDawn extends AbstractInstance
{
protected static final class HSWorld extends InstanceWorld
{
- protected long storeTime = 0;
protected int doorst = 0;
protected final static Map<Integer, List<L2Npc>> _save_point = new HashMap<>();
@@ -58,8 +57,6 @@
}
}
- // Instance
- private static final int TEMPLATE_ID = 111;
// NPCs
private static final int GUARDS_OF_THE_DAWN = 18834;
private static final int GUARDS_OF_THE_DAWN_2 = 18835;
@@ -69,10 +66,6 @@
private static final int IDENTITY_CONFIRM_DEVICE = 32578;
private static final int DARKNESS_OF_DAWN = 32579;
private static final int SHELF = 32580;
- // Doors
- private static int DOOR_ONE = 17240001;
- private static int DOOR_TWO = 17240003;
- private static int DOOR_THREE = 17240005;
// Item
private static final int IDENTITY_CARD = 13822;
// Skill
@@ -80,7 +73,11 @@
// Locations
private static final Location ENTER = new Location(-76161, 213401, -7120, 0, 0);
private static final Location EXIT = new Location(-12585, 122305, -2989, 0, 0);
-
+ // Misc
+ private static final int TEMPLATE_ID = 111;
+ private static int DOOR_ONE = 17240001;
+ private static int DOOR_TWO = 17240003;
+ private static int DOOR_THREE = 17240005;
private static final Location[] SAVE_POINT = new Location[]
{
new Location(-75775, 213415, -7120),
@@ -89,9 +86,9 @@
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 +101,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.BY_USING_THE_INVISIBLE_SKILL_SNEAK_INTO_THE_DAWN_S_DOCUMENT_STORAGE);
}
break;
@@ -120,23 +116,22 @@
{
case GUARDS_OF_THE_DAWN:
{
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.INTRUDER_PROTECT_THE_PRIESTS_OF_DAWN));
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.INTRUDER_PROTECT_THE_PRIESTS_OF_DAWN);
break;
}
case GUARDS_OF_THE_DAWN_2:
{
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.HOW_DARE_YOU_INTRUDE_WITH_THAT_TRANSFORMATION_GET_LOST));
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HOW_DARE_YOU_INTRUDE_WITH_THAT_TRANSFORMATION_GET_LOST);
break;
}
case GUARDS_OF_THE_DAWN_3:
{
- npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.WHO_ARE_YOU_A_NEW_FACE_LIKE_YOU_CAN_T_APPROACH_THIS_PLACE));
+ broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.WHO_ARE_YOU_A_NEW_FACE_LIKE_YOU_CAN_T_APPROACH_THIS_PLACE);
break;
}
}
- OUTTER:
- for (Entry<Integer, List<L2Npc>> entry : HSWorld._save_point.entrySet())
+ OUTTER: for (Entry<Integer, List<L2Npc>> entry : HSWorld._save_point.entrySet())
{
for (L2Npc monster : entry.getValue())
{
@@ -152,40 +147,19 @@
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.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON);
- }
- 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 +172,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 +201,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 +217,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 +235,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 +251,4 @@
startQuestTimer("teleportPlayer", 2000, npc, player);
return super.onAggroRangeEnter(npc, player, isSummon);
}
-
- public static void main(String[] args)
- {
- new SanctumOftheLordsOfDawn();
- }
-}
+}
\ No newline at end of file
diff --git a/L2J_DataPack/dist/game/data/xsd/instance.xsd b/L2J_DataPack/dist/game/data/xsd/instance.xsd
index c389dff..9cf8da5 100644
--- a/L2J_DataPack/dist/game/data/xsd/instance.xsd
+++ b/L2J_DataPack/dist/game/data/xsd/instance.xsd
@@ -37,6 +37,61 @@
<xs:attribute name="spawnZ" type="xs:integer" use="required" />
</xs:complexType>
</xs:element>
+ <xs:element name="reenter" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="reset" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="day">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="Monday" />
+ <xs:enumeration value="Tuesday" />
+ <xs:enumeration value="Wednesday" />
+ <xs:enumeration value="Thursday" />
+ <xs:enumeration value="Friday" />
+ <xs:enumeration value="Saturday" />
+ <xs:enumeration value="Sunday" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ <xs:attribute name="time" type="xs:long" />
+ <xs:attribute name="hour" type="xs:positiveInteger" />
+ <xs:attribute name="minute" type="xs:positiveInteger" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="additionStyle">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="NONE" />
+ <xs:enumeration value="ON_INSTANCE_ENTER" />
+ <xs:enumeration value="ON_INSTANCE_FINISH" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="removeBuffs" minOccurs="0" maxOccurs="1">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="skill" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="id" type="xs:integer" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ <xs:attribute name="type">
+ <xs:simpleType>
+ <xs:restriction base="xs:token">
+ <xs:enumeration value="ALL" />
+ <xs:enumeration value="WHITELIST" />
+ <xs:enumeration value="BLACKLIST" />
+ </xs:restriction>
+ </xs:simpleType>
+ </xs:attribute>
+ </xs:complexType>
+ </xs:element>
<xs:element name="doorlist" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:sequence minOccurs="1" maxOccurs="1">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment