Sync with L2JServer Feb 3rd 2015.

This commit is contained in:
mobius
2015-02-03 21:11:57 +00:00
parent 9cf1a6d6e5
commit fe25f74122
169 changed files with 3379 additions and 5414 deletions

View File

@@ -0,0 +1,329 @@
/*
* Copyright (C) 2004-2015 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))
{
instance.setInstanceId(InstanceManager.getInstance().createDynamicInstance(template));
instance.setTemplateId(templateId);
instance.setStatus(0);
InstanceManager.getInstance().addWorld(instance);
onEnterInstance(player, instance, true);
final Instance inst = InstanceManager.getInstance().getInstance(instance.getInstanceId());
if (inst.getReenterType() == InstanceReenterType.ON_INSTANCE_ENTER)
{
handleReenterTime(instance);
}
if (inst.isRemoveBuffEnabled())
{
handleRemoveBuffs(instance);
}
if (Config.DEBUG_INSTANCES)
{
_log.info("Instance " + inst.getName() + " (" + instance.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());
}
}
}

View File

@@ -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,22 +39,21 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
* Cavern Of The Pirate Captain (Day Dream) instance Zone.
* @author St3eT
*/
public class CavernOfThePirateCaptain extends AbstractNpcAI
public final class CavernOfThePirateCaptain extends AbstractInstance
{
protected class CavernOfThePirateCaptainWorld extends InstanceWorld
{
List<L2PcInstance> playersInside = new ArrayList<>();
L2Attackable _zaken;
long storeTime = 0;
boolean _is83;
int _zakenRoom;
int _blueFounded;
protected List<L2PcInstance> playersInside = new ArrayList<>();
protected L2Attackable _zaken;
protected long storeTime = 0;
protected boolean _is83;
protected int _zakenRoom;
protected int _blueFounded;
}
// NPCs
private static final int PATHFINDER = 32713; // Pathfinder Worker
private static final int ZAKEN_60 = 29176; // Zaken
private static final int ZAKEN_60_NIGHT = 29022; // Zaken Night
private static final int ZAKEN_83 = 29181; // Zaken
private static final int CANDLE = 32705; // Zaken's Candle
private static final int DOLL_BLADER_60 = 29023; // Doll Blader
@@ -72,9 +67,6 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
// Items
private static final int VORPAL_RING = 15763; // Sealed Vorpal Ring
private static final int VORPAL_EARRING = 15764; // Sealed Vorpal Earring
private static final int FIRE = 15280; // Transparent 1HS (for NPC)
private static final int RED = 15281; // Transparent 1HS (for NPC)
private static final int BLUE = 15302; // Transparent Bow (for NPC)
// Locations
private static final Location[] ENTER_LOC =
{
@@ -129,19 +121,10 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
private static final int MIN_LV_83 = 78;
private static final int PLAYERS_60_MIN = 9;
private static final int PLAYERS_60_MAX = 27;
private static final int PLAYERS_60_NIGHT_MIN = 72;
private static final int PLAYERS_60_NIGHT_MAX = 450;
private static final int PLAYERS_83_MIN = 9;
private static final int PLAYERS_83_MAX = 27;
private static final int TEMPLATE_ID_60 = 133;
private static final int TEMPLATE_ID_60_NIGHT = 114;
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;
private static boolean isNight = false;
//@formatter:off
private static final int[][] ROOM_DATA =
{
@@ -166,39 +149,22 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
};
//@formatter:on
private CavernOfThePirateCaptain()
public CavernOfThePirateCaptain()
{
super(CavernOfThePirateCaptain.class.getSimpleName(), "instances");
super(CavernOfThePirateCaptain.class.getSimpleName());
addStartNpc(PATHFINDER);
addTalkId(PATHFINDER);
addKillId(ZAKEN_60, ZAKEN_60_NIGHT, ZAKEN_83);
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 : (isNight ? TEMPLATE_ID_60_NIGHT : 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())
@@ -221,26 +187,21 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
}
manageNpcSpawn(curworld);
}
else
{
teleportPlayer(player, ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId(), false);
}
}
private void managePlayerEnter(L2PcInstance player, CavernOfThePirateCaptainWorld world)
{
if (!world._is83)
{
player.stopAllEffectsExceptThoseThatLastThroughDeath();
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))
{
@@ -253,6 +214,7 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
return false;
}
final boolean is83 = InstanceManager.getInstance().getPlayerWorld(player).getTemplateId() == TEMPLATE_ID_83 ? true : false;
final L2Party party = player.getParty();
final boolean isInCC = party.isInCommandChannel();
final List<L2PcInstance> members = (isInCC) ? party.getCommandChannel().getMembers() : party.getMembers();
@@ -264,7 +226,7 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
return false;
}
if ((members.size() < (is83 ? PLAYERS_83_MIN : (isNight ? PLAYERS_60_NIGHT_MIN : PLAYERS_60_MIN))) || (members.size() > (is83 ? PLAYERS_83_MAX : (isNight ? PLAYERS_60_NIGHT_MAX : PLAYERS_60_MAX))))
if ((members.size() < (is83 ? PLAYERS_83_MIN : PLAYERS_60_MIN)) || (members.size() > (is83 ? PLAYERS_83_MAX : PLAYERS_60_MAX)))
{
broadcastSystemMessage(player, null, SystemMessageId.YOU_CANNOT_ENTER_DUE_TO_THE_PARTY_HAVING_EXCEEDED_THE_LIMIT, false);
return false;
@@ -284,7 +246,7 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
return false;
}
final Long reentertime = InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? TEMPLATE_ID_83 : (isNight ? TEMPLATE_ID_60_NIGHT : TEMPLATE_ID_60)));
final Long reentertime = InstanceManager.getInstance().getInstanceTime(groupMembers.getObjectId(), (is83 ? TEMPLATE_ID_83 : TEMPLATE_ID_60));
if (System.currentTimeMillis() < reentertime)
{
broadcastSystemMessage(player, groupMembers, SystemMessageId.C1_MAY_NOT_RE_ENTER_YET, true);
@@ -322,16 +284,11 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
{
if (event.equals("enter60"))
{
enterInstance(player, "CavernOfThePirateCaptainWorldDay60.xml", false);
}
else if (event.equals("enter60night"))
{
isNight = true;
enterInstance(player, "CavernOfThePirateCaptainWorldNight60.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
{
@@ -345,9 +302,9 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
{
case "BURN_BLUE":
{
if (npc.getRightHandItem() == 0)
if (npc.isState(0))
{
npc.setRHandId(FIRE);
npc.setState(1); // Burning
startQuestTimer("BURN_BLUE2", 3000, npc, player);
if (world._blueFounded == 4)
{
@@ -358,27 +315,27 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
}
case "BURN_BLUE2":
{
if (npc.getRightHandItem() == FIRE)
if (npc.isState(1)) // Burning
{
npc.setRHandId(BLUE);
npc.setState(3); // Blue glow
}
break;
}
case "BURN_RED":
{
if (npc.getRightHandItem() == 0)
if (npc.isState(0))
{
npc.setRHandId(FIRE);
npc.setState(1); // Burning
startQuestTimer("BURN_RED2", 3000, npc, player);
}
break;
}
case "BURN_RED2":
{
if (npc.getRightHandItem() == FIRE)
if (npc.isState(1)) // Burning
{
final int room = getRoomByCandle(npc);
npc.setRHandId(RED);
npc.setState(2); // Red glow
manageScreenMsg(world, NpcStringId.THE_CANDLES_CAN_LEAD_YOU_TO_ZAKEN_DESTROY_HIM);
spawnNpc(world._is83 ? DOLL_BLADER_83 : DOLL_BLADER_60, room, player, world);
spawnNpc(world._is83 ? VALE_MASTER_83 : VALE_MASTER_60, room, player, world);
@@ -414,7 +371,6 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
if ((tmpworld != null) && (tmpworld instanceof CavernOfThePirateCaptainWorld))
{
final CavernOfThePirateCaptainWorld world = (CavernOfThePirateCaptainWorld) tmpworld;
final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
if (npc.getId() == ZAKEN_83)
{
@@ -447,9 +403,7 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
}
}
}
saveReenterForPlayers(world);
inst.setDuration(300000);
inst.setEmptyDestroyTime(0);
finishInstance(world);
}
return super.onKill(npc, killer, isSummon);
}
@@ -514,14 +468,14 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
{
if ((players != null) && (players.getInstanceId() == world.getInstanceId()))
{
showOnScreenMsg(players, stringId, 2, 6000);
showOnScreenMsg(players, stringId, 5, 6000);
}
}
}
private L2Attackable spawnNpc(int npcId, int roomId, L2PcInstance player, CavernOfThePirateCaptainWorld world)
{
if ((player != null) && (npcId != ZAKEN_60) && (npcId != ZAKEN_60_NIGHT) && (npcId != ZAKEN_83))
if ((player != null) && (npcId != ZAKEN_60) && (npcId != ZAKEN_83))
{
final L2Attackable mob = (L2Attackable) addSpawn(npcId, ROOM_DATA[roomId - 1][0] + getRandom(350), ROOM_DATA[roomId - 1][1] + getRandom(350), ROOM_DATA[roomId - 1][2], 0, false, 0, false, world.getInstanceId());
addAttackPlayerDesire(mob, player);
@@ -546,60 +500,8 @@ public class CavernOfThePirateCaptain extends AbstractNpcAI
{
candles.get(ROOM_DATA[world._zakenRoom - 1][i] - 1).getVariables().set("isBlue", 1);
}
world._zaken = spawnNpc(world._is83 ? ZAKEN_83 : (isNight ? ZAKEN_60_NIGHT : ZAKEN_60), world._zakenRoom, null, world);
world._zaken = spawnNpc(world._is83 ? ZAKEN_83 : ZAKEN_60, world._zakenRoom, null, world);
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();
}
}
}

View File

@@ -18,6 +18,8 @@
*/
package instances.ChambersOfDelusion;
import instances.AbstractInstance;
import java.util.Calendar;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
@@ -35,7 +37,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.NpcStringId;
@@ -50,7 +51,7 @@ import com.l2jserver.gameserver.util.Util;
* Chambers of Delusion superclass.
* @author GKR
*/
public abstract class Chamber extends Quest
public abstract class Chamber extends AbstractInstance
{
protected class CDWorld extends InstanceWorld
{
@@ -173,9 +174,9 @@ public abstract class Chamber extends Quest
// Misc
private static final String RETURN = Chamber.class.getSimpleName() + "_return";
protected Chamber(int questId, String name, String descr, int instanceId, String instanceTemplateName, int entranceGKId, int roomGKFirstId, int roomGKLastId, int aenkinelId, int boxId)
protected Chamber(String name, String descr, int instanceId, String instanceTemplateName, int entranceGKId, int roomGKFirstId, int roomGKLastId, int aenkinelId, int boxId)
{
super(questId, name, descr);
super(name, descr);
INSTANCEID = instanceId;
INSTANCE_TEMPLATE = instanceTemplateName;
@@ -208,7 +209,8 @@ public abstract class Chamber extends Quest
return (world.currentRoom == (ROOM_ENTER_POINTS.length - 1));
}
private boolean checkConditions(L2PcInstance player)
@Override
protected boolean checkConditions(L2PcInstance player)
{
final L2Party party = player.getParty();
if (party == null)
@@ -402,39 +404,18 @@ public abstract class Chamber extends Quest
}
}
protected int enterInstance(L2PcInstance player)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
int instanceId = 0;
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
enter((CDWorld) world);
}
else
{
if (!(world instanceof CDWorld))
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_ENTERED_ANOTHER_INSTANT_ZONE_THEREFORE_YOU_CANNOT_ENTER_CORRESPONDING_DUNGEON));
return 0;
}
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 @@ public abstract class Chamber extends Quest
{
npc.doDie(player);
}
return super.onSpellFinished(npc, player, skill);
}
@@ -652,7 +632,11 @@ public abstract class Chamber extends Quest
if (npcId == ENTRANCE_GATEKEEPER)
{
enterInstance(player);
if (checkConditions(player))
{
final L2Party party = player.getParty();
enterInstance(player, new CDWorld(party), INSTANCE_TEMPLATE, INSTANCEID);
}
}
return "";

View File

@@ -45,14 +45,9 @@ public final class ChamberOfDelusionEast extends Chamber
private static final int INSTANCEID = 127;
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionEast.xml";
private ChamberOfDelusionEast()
public ChamberOfDelusionEast()
{
super(-1, ChamberOfDelusionEast.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
super(ChamberOfDelusionEast.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
}
public static void main(String[] args)
{
new ChamberOfDelusionEast();
}
}

View File

@@ -45,14 +45,9 @@ public final class ChamberOfDelusionNorth extends Chamber
private static final int INSTANCEID = 130; // this is the client number
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionNorth.xml";
private ChamberOfDelusionNorth()
public ChamberOfDelusionNorth()
{
super(-1, ChamberOfDelusionNorth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
super(ChamberOfDelusionNorth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
}
public static void main(String[] args)
{
new ChamberOfDelusionNorth();
}
}

View File

@@ -45,14 +45,9 @@ public final class ChamberOfDelusionSouth extends Chamber
private static final int INSTANCEID = 129; // this is the client number
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionSouth.xml";
private ChamberOfDelusionSouth()
public ChamberOfDelusionSouth()
{
super(-1, ChamberOfDelusionSouth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
super(ChamberOfDelusionSouth.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
}
public static void main(String[] args)
{
new ChamberOfDelusionSouth();
}
}

View File

@@ -49,14 +49,9 @@ public final class ChamberOfDelusionSquare extends Chamber
private static final int INSTANCEID = 131;
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionSquare.xml";
private ChamberOfDelusionSquare()
public ChamberOfDelusionSquare()
{
super(-1, ChamberOfDelusionSquare.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
super(ChamberOfDelusionSquare.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
}
public static void main(String[] args)
{
new ChamberOfDelusionSquare();
}
}

View File

@@ -49,14 +49,9 @@ public final class ChamberOfDelusionTower extends Chamber
private static final int INSTANCEID = 132; // this is the client number
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionTower.xml";
private ChamberOfDelusionTower()
public ChamberOfDelusionTower()
{
super(-1, ChamberOfDelusionTower.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
super(ChamberOfDelusionTower.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
}
public static void main(String[] args)
{
new ChamberOfDelusionTower();
}
}

View File

@@ -45,14 +45,9 @@ public final class ChamberOfDelusionWest extends Chamber
private static final int INSTANCEID = 128; // this is the client number
private static final String INSTANCE_TEMPLATE = "ChamberOfDelusionWest.xml";
private ChamberOfDelusionWest()
public ChamberOfDelusionWest()
{
super(-1, ChamberOfDelusionWest.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
super(ChamberOfDelusionWest.class.getSimpleName(), "instances", INSTANCEID, INSTANCE_TEMPLATE, ENTRANCE_GATEKEEPER, ROOM_GATEKEEPER_FIRST, ROOM_GATEKEEPER_LAST, AENKINEL, BOX);
ROOM_ENTER_POINTS = ENTER_POINTS;
}
public static void main(String[] args)
{
new ChamberOfDelusionWest();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -18,17 +18,18 @@
*/
package instances.DarkCloudMansion;
import instances.AbstractInstance;
import javolution.util.FastList;
import javolution.util.FastMap;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.PcCondOverride;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -40,15 +41,12 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
/**
* Dark Cloud Mansion instance zone.
*/
public final class DarkCloudMansion extends Quest
public final class DarkCloudMansion extends AbstractInstance
{
private static final int TEMPLATE_ID = 9;
private static boolean debug = false;
private static boolean noRndWalk = true;
// Items
private static int CC = 9690; // Contaminated Crystal
protected class DMCWorld extends InstanceWorld
{
protected FastMap<String, DMCRoom> rooms = new FastMap<>();
}
// NPCs
private static int YIYEN = 32282;
@@ -58,7 +56,6 @@ public final class DarkCloudMansion extends Quest
private static int SOTruth = 32291; // Symbol of Truth
private static int BSM = 32324; // Black Stone Monolith
private static int SC = 22402; // Shadow Column
// Mobs
private static int[] CCG =
{
@@ -106,7 +103,10 @@ public final class DarkCloudMansion extends Quest
22264
};
// Doors/Walls
// Items
private static int CC = 9690; // Contaminated Crystal
// Misc
private static final int TEMPLATE_ID = 9;
private static int D1 = 24230001; // Starting Room
private static int D2 = 24230002; // First Room
private static int D3 = 24230005; // Second Room
@@ -120,7 +120,8 @@ public final class DarkCloudMansion extends Quest
// private static int W5 = 24230011; // Wall 5
// private static int W6 = 24230012; // Wall 6
// private static int W7 = 24230013; // Wall 7
private static boolean debug = false;
private static boolean noRndWalk = true;
private static NpcStringId[] _spawnChat =
{
NpcStringId.I_M_THE_REAL_ONE,
@@ -129,14 +130,12 @@ public final class DarkCloudMansion extends Quest
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 @@ public final class DarkCloudMansion extends Quest
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 final class DarkCloudMansion extends Quest
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 @@ public final class DarkCloudMansion extends Quest
return true;
}
protected void enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
if (firstEntrance)
{
if (!(world instanceof DMCWorld))
runStartRoom((DMCWorld) world);
// teleport players
if (debug && (player.getParty() == null))
{
player.sendPacket(SystemMessageId.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());
}
else
{
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if (partyMember.getQuestState(getName()) == null)
{
newQuestState(partyMember);
}
world.addAllowed(partyMember.getObjectId());
teleportPlayer(partyMember, new Location(146534, 180464, -6117), world.getInstanceId());
}
}
teleportPlayer(player, loc, world.getInstanceId());
return;
}
if (!checkConditions(player))
{
return;
}
L2Party party = player.getParty();
final int instanceId = InstanceManager.getInstance().createDynamicInstance(template);
world = new DMCWorld();
world.setInstanceId(instanceId);
world.setTemplateId(TEMPLATE_ID);
InstanceManager.getInstance().addWorld(world);
_log.info("DarkCloudMansion: started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
runStartRoom((DMCWorld) world);
// teleport players
if (debug && (party == null))
{
world.addAllowed(player.getObjectId());
teleportPlayer(player, loc, instanceId);
}
else
{
for (L2PcInstance partyMember : party.getMembers())
{
getQuestState(partyMember, true);
world.addAllowed(partyMember.getObjectId());
teleportPlayer(partyMember, loc, instanceId);
}
teleportPlayer(player, new Location(146534, 180464, -6117), world.getInstanceId());
}
}
@@ -1200,8 +945,8 @@ public final class DarkCloudMansion extends Quest
return "";
}
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
DMCWorld world;
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
final DMCWorld world;
if (tmpworld instanceof DMCWorld)
{
world = (DMCWorld) tmpworld;
@@ -1262,8 +1007,8 @@ public final class DarkCloudMansion extends Quest
@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
DMCWorld world;
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
final DMCWorld world;
if (tmpworld instanceof DMCWorld)
{
world = (DMCWorld) tmpworld;
@@ -1336,15 +1081,14 @@ public final class DarkCloudMansion extends Quest
killedBelethSample(world, npc);
}
}
return "";
}
@Override
public String onAttack(L2Npc npc, L2PcInstance player, int damage, boolean isSummon, Skill skill)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
DMCWorld world;
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
final DMCWorld world;
if (tmpworld instanceof DMCWorld)
{
world = (DMCWorld) tmpworld;
@@ -1418,10 +1162,10 @@ public final class DarkCloudMansion extends Quest
@Override
public String onTalk(L2Npc npc, L2PcInstance player)
{
int npcId = npc.getId();
final int npcId = npc.getId();
if (npcId == YIYEN)
{
enterInstance(player, "DarkCloudMansion.xml", new Location(146534, 180464, -6117));
enterInstance(player, new DMCWorld(), "DarkCloudMansion.xml", TEMPLATE_ID);
}
else
{
@@ -1458,9 +1202,4 @@ public final class DarkCloudMansion extends Quest
}
return "";
}
public static void main(String[] args)
{
new DarkCloudMansion();
}
}
}

View File

@@ -18,6 +18,8 @@
*/
package instances.DisciplesNecropolisPast;
import instances.AbstractInstance;
import java.util.HashMap;
import java.util.Map;
@@ -26,13 +28,10 @@ import quests.Q00196_SevenSignsSealOfTheEmperor.Q00196_SevenSignsSealOfTheEmpero
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.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 @@ import com.l2jserver.gameserver.util.Util;
* Disciple's Necropolis Past instance zone.
* @author Adry_85
*/
public final class DisciplesNecropolisPast extends Quest
public final class DisciplesNecropolisPast extends AbstractInstance
{
protected class DNPWorld extends InstanceWorld
{
protected final FastList<L2Npc> anakimGroup = new FastList<>();
protected final FastList<L2Npc> lilithGroup = new FastList<>();
protected long storeTime = 0;
protected int countKill = 0;
}
// Instance
private static final int TEMPLATE_ID = 112;
// NPCs
private static final int SEAL_DEVICE = 27384;
private static final int PROMISE_OF_MAMMON = 32585;
@@ -69,20 +65,6 @@ public final class DisciplesNecropolisPast extends Quest
private static final int ANAKIMS_GUARDIAN = 32719;
private static final int ANAKIMS_GUARD = 32720;
private static final int ANAKIMS_EXECUTOR = 32721;
// Doors
private static final int DOOR_1 = 17240102;
private static final int DOOR_2 = 17240104;
private static final int DOOR_3 = 17240106;
private static final int DOOR_4 = 17240108;
private static final int DOOR_5 = 17240110;
private static final int DISCIPLES_NECROPOLIS_DOOR = 17240111;
// Items
private static final int SACRED_SWORD_OF_EINHASAD = 15310;
private static final int SEAL_OF_BINDING = 13846;
// Locations
private static final Location ENTER = new Location(-89554, 216078, -7488, 0, 0);
private static final Location EXIT = new Location(171895, -17501, -4903, 0, 0);
// Monsters
private static final int LILIM_BUTCHER = 27371;
private static final int LILIM_MAGUS = 27372;
private static final int LILIM_KNIGHT_ERRANT = 27373;
@@ -92,28 +74,9 @@ public final class DisciplesNecropolisPast extends Quest
private static final int LILIM_SLAYER = 27377;
private static final int LILIM_GREAT_MAGUS = 27378;
private static final int LILIM_GUARD_KNIGHT = 27379;
// 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 @@ public final class DisciplesNecropolisPast extends Quest
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 @@ public final class DisciplesNecropolisPast extends Quest
{
for (Map.Entry<Integer, Location> entry : LILITH_SPAWN.entrySet())
{
L2Npc npc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId());
final L2Npc npc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId());
world.lilithGroup.add(npc);
}
for (Map.Entry<Integer, Location> entry : ANAKIM_SPAWN.entrySet())
{
L2Npc enpc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId());
final L2Npc enpc = addSpawn(entry.getKey(), entry.getValue(), false, 0, false, world.getInstanceId());
world.anakimGroup.add(enpc);
}
}
private synchronized void checkDoors(L2Npc npc, DNPWorld world)
{
if (world.countKill == 4)
switch (world.countKill)
{
openDoor(DOOR_1, world.getInstanceId());
}
else if (world.countKill == 10)
{
openDoor(DOOR_2, world.getInstanceId());
}
else if (world.countKill == 18)
{
openDoor(DOOR_3, world.getInstanceId());
}
else if (world.countKill == 28)
{
openDoor(DOOR_4, world.getInstanceId());
}
else if (world.countKill == 40)
{
openDoor(DOOR_5, world.getInstanceId());
case 4:
openDoor(DOOR_1, world.getInstanceId());
break;
case 10:
openDoor(DOOR_2, world.getInstanceId());
break;
case 18:
openDoor(DOOR_3, world.getInstanceId());
break;
case 28:
openDoor(DOOR_4, world.getInstanceId());
break;
case 40:
openDoor(DOOR_5, world.getInstanceId());
break;
}
}
protected int enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
if (!(world instanceof DNPWorld))
{
player.sendPacket(SystemMessageId.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 @@ public final class DisciplesNecropolisPast extends Quest
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof DNPWorld)
{
DNPWorld world = (DNPWorld) tmpworld;
final DNPWorld world = (DNPWorld) tmpworld;
switch (event)
{
case "FINISH":
@@ -398,31 +369,16 @@ public final class DisciplesNecropolisPast extends Quest
@Override
public String onFirstTalk(L2Npc npc, L2PcInstance player)
{
switch (npc.getId())
{
case SHUNAIMAN:
{
return "32586.htm";
}
case LEON:
{
return "32587.htm";
}
case DISCIPLES_GATEKEEPER:
{
return "32657.htm";
}
}
return super.onFirstTalk(npc, player);
return npc.getId() + ".htm";
}
@Override
public String onKill(L2Npc npc, L2PcInstance player, boolean isSummon)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof DNPWorld)
{
DNPWorld world = (DNPWorld) tmpworld;
final DNPWorld world = (DNPWorld) tmpworld;
world.countKill++;
checkDoors(npc, world);
}
@@ -474,7 +430,7 @@ public final class DisciplesNecropolisPast extends Quest
{
if (qs.isCond(3) || qs.isCond(4))
{
enterInstance(talker, "DisciplesNecropolisPast.xml", ENTER);
enterInstance(talker, new DNPWorld(), "DisciplesNecropolisPast.xml", TEMPLATE_ID);
return "";
}
break;
@@ -509,18 +465,4 @@ public final class DisciplesNecropolisPast extends Quest
}
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();
}
}
}

View File

@@ -18,11 +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 quests.Q10296_SevenSignsPowerOfTheSeal.Q10296_SevenSignsPowerOfTheSeal;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
@@ -30,30 +29,30 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Elcadia's Tent instance zone.
* @author Adry_85
*/
public final class ElcadiasTent extends AbstractNpcAI
public final class ElcadiasTent extends AbstractInstance
{
protected class ETWorld extends InstanceWorld
{
}
private static final int TEMPLATE_ID = 158;
// NPCs
private static final int ELCADIA = 32784;
private static final int GRUFF_LOOKING_MAN = 32862;
// Locations
private static final Location START_LOC = new Location(89706, -238074, -9632, 0, 0);
private static final Location EXIT_LOC = new Location(43316, -87986, -2832, 0, 0);
// Misc
private static final int TEMPLATE_ID = 158;
private ElcadiasTent()
public ElcadiasTent()
{
super(ElcadiasTent.class.getSimpleName(), "instances");
super(ElcadiasTent.class.getSimpleName());
addFirstTalkId(GRUFF_LOOKING_MAN, ELCADIA);
addStartNpc(GRUFF_LOOKING_MAN, ELCADIA);
addTalkId(GRUFF_LOOKING_MAN, ELCADIA);
@@ -67,14 +66,12 @@ public final class ElcadiasTent extends AbstractNpcAI
final QuestState GirlOfDoubt = talker.getQuestState(Q10292_SevenSignsGirlOfDoubt.class.getSimpleName());
final QuestState ForbiddenBook = talker.getQuestState(Q10293_SevenSignsForbiddenBookOfTheElmoreAdenKingdom.class.getSimpleName());
final QuestState Monastery = talker.getQuestState(Q10294_SevenSignsToTheMonasteryOfSilence.class.getSimpleName());
final QuestState Power = talker.getQuestState(Q10296_SevenSignsPowerOfTheSeal.class.getSimpleName());
if (((GirlOfDoubt != null) && GirlOfDoubt.isStarted()) //
|| ((GirlOfDoubt != null) && GirlOfDoubt.isCompleted() && (ForbiddenBook == null)) //
|| ((ForbiddenBook != null) && ForbiddenBook.isStarted()) //
|| ((ForbiddenBook != null) && ForbiddenBook.isCompleted() && (Monastery == null)) //
|| ((Power != null) && Power.isStarted()))
|| ((ForbiddenBook != null) && ForbiddenBook.isCompleted() && (Monastery == null)))
{
enterInstance(talker, "ElcadiasTent.xml", START_LOC);
enterInstance(talker, new ETWorld(), "ElcadiasTent.xml", TEMPLATE_ID);
}
else
{
@@ -91,37 +88,13 @@ public final class ElcadiasTent extends AbstractNpcAI
return super.onTalk(npc, talker);
}
private void enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
if (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();
}
}
}

View File

@@ -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.actor.instance.L2PcInstance;
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 @@ public class FaeronTrainingGrounds1 extends AbstractNpcAI
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 @@ public class FaeronTrainingGrounds1 extends AbstractNpcAI
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();
}
}
}

View File

@@ -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.actor.instance.L2PcInstance;
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 @@ public class FaeronTrainingGrounds2 extends AbstractNpcAI
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 @@ public class FaeronTrainingGrounds2 extends AbstractNpcAI
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();
}
}
}

View File

@@ -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.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.effects.L2EffectType;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -81,31 +81,31 @@ import com.l2jserver.gameserver.util.Util;
* Use proper zone spawn system.
* @author Gigiikun
*/
public final class FinalEmperialTomb extends Quest
public final class FinalEmperialTomb extends AbstractInstance
{
private class FETWorld extends InstanceWorld
{
public Lock lock = new ReentrantLock();
public FastList<L2Npc> npcList = new FastList<>();
public int darkChoirPlayerCount = 0;
public FrintezzaSong OnSong = null;
public ScheduledFuture<?> songTask = null;
public ScheduledFuture<?> songEffectTask = null;
public boolean isVideo = false;
public L2Npc frintezzaDummy = null;
public L2Npc overheadDummy = null;
public L2Npc portraitDummy1 = null;
public L2Npc portraitDummy3 = null;
public L2Npc scarletDummy = null;
public L2GrandBossInstance frintezza = null;
public L2GrandBossInstance activeScarlet = null;
public List<L2MonsterInstance> demons = new FastList<>();
public Map<L2MonsterInstance, Integer> portraits = new FastMap<>();
public int scarlet_x = 0;
public int scarlet_y = 0;
public int scarlet_z = 0;
public int scarlet_h = 0;
public int scarlet_a = 0;
protected Lock lock = new ReentrantLock();
protected FastList<L2Npc> npcList = new FastList<>();
protected int darkChoirPlayerCount = 0;
protected FrintezzaSong OnSong = null;
protected ScheduledFuture<?> songTask = null;
protected ScheduledFuture<?> songEffectTask = null;
protected boolean isVideo = false;
protected L2Npc frintezzaDummy = null;
protected L2Npc overheadDummy = null;
protected L2Npc portraitDummy1 = null;
protected L2Npc portraitDummy3 = null;
protected L2Npc scarletDummy = null;
protected L2GrandBossInstance frintezza = null;
protected L2GrandBossInstance activeScarlet = null;
protected List<L2MonsterInstance> demons = new FastList<>();
protected Map<L2MonsterInstance, Integer> portraits = new FastMap<>();
protected int scarlet_x = 0;
protected int scarlet_y = 0;
protected int scarlet_z = 0;
protected int scarlet_h = 0;
protected int scarlet_a = 0;
protected FETWorld()
{
@@ -142,24 +142,9 @@ public final class FinalEmperialTomb extends Quest
}
}
private static final int TEMPLATE_ID = 136; // this is the client number
private static final int MIN_PLAYERS = 36;
private static final int MAX_PLAYERS = 45;
private static final boolean debug = false;
private final Map<Integer, L2Territory> _spawnZoneList = new HashMap<>();
private final Map<Integer, List<FETSpawn>> _spawnList = new HashMap<>();
private final List<Integer> _mustKillMobsId = new FastList<>();
// Teleports
private static final Location ENTER_TELEPORT = new Location(-88015, -141153, -9168);
// NPCs
private static final int GUIDE = 32011;
private static final int CUBE = 29061;
// Item
private static final int DEWDROP_OF_DESTRUCTION_ITEM_ID = 8556;
// mobs
private static final int SCARLET1 = 29046;
private static final int SCARLET2 = 29047;
private static final int FRINTEZZA = 29045;
@@ -175,15 +160,19 @@ public final class FinalEmperialTomb extends Quest
};
private static final int HALL_ALARM = 18328;
private static final int HALL_KEEPER_CAPTAIN = 18329;
// Items
private static final int HALL_KEEPER_SUICIDAL_SOLDIER = 18333;
private static final int DARK_CHOIR_PLAYER = 18339;
private static final int[] AI_DISABLED_MOBS =
{
18328
};
private static final int DEWDROP_OF_DESTRUCTION_ITEM_ID = 8556;
private static final int FIRST_SCARLET_WEAPON = 8204;
private static final int SECOND_SCARLET_WEAPON = 7903;
// Skills
private static final int DEWDROP_OF_DESTRUCTION_SKILL_ID = 2276;
private static final int SOUL_BREAKING_ARROW_SKILL_ID = 2234;
protected static final SkillHolder INTRO_SKILL = new SkillHolder(5004, 1);
private static final SkillHolder FIRST_MORPH_SKILL = new SkillHolder(5017, 1);
@@ -195,10 +184,19 @@ public final class FinalEmperialTomb extends Quest
new FrintezzaSong(new SkillHolder(5007, 4), new SkillHolder(5008, 4), NpcStringId.FUGUE_OF_JUBILATION, 90),
new FrintezzaSong(new SkillHolder(5007, 5), new SkillHolder(5008, 5), NpcStringId.HYPNOTIC_MAZURKA, 100),
};
// Skills
private static final int DEWDROP_OF_DESTRUCTION_SKILL_ID = 2276;
private static final int SOUL_BREAKING_ARROW_SKILL_ID = 2234;
// Doors/Walls/Zones
// Locations
private static final Location ENTER_TELEPORT = new Location(-88015, -141153, -9168);
protected static final Location MOVE_TO_CENTER = new Location(-87904, -141296, -9168, 0);
// Misc
private static final int TEMPLATE_ID = 136; // this is the client number
private static final int MIN_PLAYERS = 36;
private static final int MAX_PLAYERS = 45;
private static final int TIME_BETWEEN_DEMON_SPAWNS = 20000;
private static final int MAX_DEMONS = 24;
private static final boolean debug = false;
private final Map<Integer, L2Territory> _spawnZoneList = new HashMap<>();
private final Map<Integer, List<FETSpawn>> _spawnList = new HashMap<>();
private final List<Integer> _mustKillMobsId = new FastList<>();
protected static final int[] FIRST_ROOM_DOORS =
{
17130051,
@@ -223,7 +221,6 @@ public final class FinalEmperialTomb extends Quest
17130069,
17130070
};
protected static final int[] FIRST_ROUTE_DOORS =
{
17130042,
@@ -234,68 +231,19 @@ public final class FinalEmperialTomb extends Quest
17130045,
17130046
};
protected static final Location MOVE_TO_CENTER = new Location(-87904, -141296, -9168, 0);
// spawns
private static final int TIME_BETWEEN_DEMON_SPAWNS = 20000;
private static final int MAX_DEMONS = 24;
// @formatter:off
protected static final int[][] PORTRAIT_SPAWNS =
{
{
29048,
-89381,
-153981,
-9168,
3368,
-89378,
-153968,
-9168,
3368
},
{
29048,
-86234,
-152467,
-9168,
37656,
-86261,
-152492,
-9168,
37656
},
{
29049,
-89342,
-152479,
-9168,
-5152,
-89311,
-152491,
-9168,
-5152
},
{
29049,
-86189,
-153968,
-9168,
29456,
-86217,
-153956,
-9168,
29456
}
{29048, -89381, -153981, -9168, 3368, -89378, -153968, -9168, 3368},
{29048, -86234, -152467, -9168, 37656, -86261, -152492, -9168, 37656},
{29049, -89342, -152479, -9168, -5152, -89311, -152491, -9168, -5152},
{29049, -86189, -153968, -9168, 29456, -86217, -153956, -9168, 29456},
};
// @formatter:on
// Initialization at 6:30 am on Wednesday and Saturday
private static final int RESET_HOUR = 6;
private static final int RESET_MIN = 30;
private static final int RESET_DAY_1 = 4;
private static final int RESET_DAY_2 = 7;
private FinalEmperialTomb()
public FinalEmperialTomb()
{
super(-1, FinalEmperialTomb.class.getSimpleName(), "instances");
super(FinalEmperialTomb.class.getSimpleName());
load();
addAttackId(SCARLET1, FRINTEZZA);
addAttackId(PORTRAITS);
@@ -532,19 +480,22 @@ public final class FinalEmperialTomb extends Quest
}
}
private boolean checkConditions(L2PcInstance player)
@Override
protected boolean checkConditions(L2PcInstance player)
{
if (debug || player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS))
{
return true;
}
L2Party party = player.getParty();
final L2Party party = player.getParty();
if (party == null)
{
player.sendPacket(SystemMessageId.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 @@ public final class FinalEmperialTomb extends Quest
{
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);
}
else
{
for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
{
channelMember.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, channelMember.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true);
world.addAllowed(channelMember.getObjectId());
teleportPlayer(channelMember, ENTER_TELEPORT, world.getInstanceId(), false);
}
}
teleportPlayer(player, loc, world.getInstanceId(), false);
return world.getInstanceId();
}
// New instance
if (!checkConditions(player))
{
return 0;
}
if (!player.canOverrideCond(PcCondOverride.INSTANCE_CONDITIONS) && !player.destroyItemByItemId("QUEST", 8073, 1, player, true))
{
return 0;
}
final int instanceId = InstanceManager.getInstance().createDynamicInstance(template);
// Instance ins = InstanceManager.getInstance().getInstance(instanceId);
// ins.setSpawnLoc(new int[]{player.getX(),player.getY(),player.getZ()});
world = new FETWorld();
world.setTemplateId(TEMPLATE_ID);
world.setInstanceId(instanceId);
world.setStatus(0);
InstanceManager.getInstance().addWorld(world);
controlStatus((FETWorld) world);
_log.info("Final Emperial Tomb started " + template + " Instance: " + instanceId + " created by player: " + player.getName());
// teleport players
if ((player.getParty() == null) || (player.getParty().getCommandChannel() == null))
{
player.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, player.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true);
world.addAllowed(player.getObjectId());
teleportPlayer(player, loc, instanceId, false);
}
else
{
for (L2PcInstance channelMember : player.getParty().getCommandChannel().getMembers())
{
channelMember.destroyItemByItemId(getName(), DEWDROP_OF_DESTRUCTION_ITEM_ID, channelMember.getInventory().getInventoryItemCount(DEWDROP_OF_DESTRUCTION_ITEM_ID, -1), null, true);
world.addAllowed(channelMember.getObjectId());
teleportPlayer(channelMember, loc, instanceId, false);
}
teleportPlayer(player, ENTER_TELEPORT, world.getInstanceId(), false);
}
return instanceId;
}
protected boolean checkKillProgress(L2Npc mob, FETWorld world)
@@ -738,7 +658,7 @@ public final class FinalEmperialTomb extends Quest
{
world.activeScarlet.abortCast();
}
setInstanceTimeRestrictions(world);
handleReenterTime(world);
world.activeScarlet.doCast(FIRST_MORPH_SKILL.getSkill());
ThreadPoolManager.getInstance().scheduleGeneral(new SongTask(world, 2), 1500);
break;
@@ -801,7 +721,7 @@ public final class FinalEmperialTomb extends Quest
protected void spawn(FETWorld world, int npcId, int x, int y, int z, int h, boolean addToKillTable)
{
L2Npc npc = addSpawn(npcId, x, y, z, h, false, 0, false, world.getInstanceId());
final L2Npc npc = addSpawn(npcId, x, y, z, h, false, 0, false, world.getInstanceId());
if (addToKillTable)
{
world.npcList.add(npc);
@@ -1414,46 +1334,6 @@ public final class FinalEmperialTomb extends Quest
}
}
protected void setInstanceTimeRestrictions(FETWorld world)
{
Calendar reenter = Calendar.getInstance();
reenter.set(Calendar.MINUTE, RESET_MIN);
reenter.set(Calendar.HOUR_OF_DAY, RESET_HOUR);
// if time is >= RESET_HOUR - roll to the next day
if (reenter.getTimeInMillis() <= System.currentTimeMillis())
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
{
while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
}
else
{
while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
}
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_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 @@ public final class FinalEmperialTomb extends Quest
getQuestState(player, true);
if (npcId == GUIDE)
{
enterInstance(player, "FinalEmperialTomb.xml", ENTER_TELEPORT);
enterInstance(player, new FETWorld(), "FinalEmperialTomb.xml", TEMPLATE_ID);
}
else if (npc.getId() == CUBE)
{
@@ -1598,9 +1478,4 @@ public final class FinalEmperialTomb extends Quest
}
return "";
}
public static void main(String[] args)
{
new FinalEmperialTomb();
}
}
}

View File

@@ -18,13 +18,13 @@
*/
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;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@@ -32,30 +32,36 @@ import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
{
case "enter_instance":
{
enterInstance(player, "HarnakUndergroundRuins.xml");
enterInstance(player, new HuRWorld(), "HarnakUndergroundRuins.xml", TEMPLATE_ID);
break;
}
case "message1":
@@ -200,9 +197,8 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
}
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,19 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 +546,7 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
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 +774,6 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
}
}
}
return super.onAttack(npc, player, damage, isSummon);
}
@@ -855,9 +828,4 @@ public class HarnakUndergroundRuins extends AbstractNpcAI
}
return super.onEnterZone(character, zone);
}
public static void main(String[] args)
{
new HarnakUndergroundRuins();
}
}

View File

@@ -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 @@ public final class HideoutOfTheDawn extends Quest
{
case WOOD:
{
enterInstance(talker, "HideoutOfTheDawn.xml", WOOD_LOC);
enterInstance(talker, new HotDWorld(), "HideoutOfTheDawn.xml", TEMPLATE_ID);
return "32593-01.htm";
}
case JAINA:
@@ -76,49 +75,13 @@ public final class HideoutOfTheDawn extends Quest
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();
}
}
}

View File

@@ -18,8 +18,8 @@
*/
package instances.IceQueensCastle;
import instances.AbstractInstance;
import quests.Q10285_MeetingSirra.Q10285_MeetingSirra;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@@ -40,7 +40,7 @@ import com.l2jserver.gameserver.network.clientpackets.Say2;
* Ice Queen's Castle instance zone.
* @author Adry_85
*/
public final class IceQueensCastle extends AbstractNpcAI
public final class IceQueensCastle extends AbstractInstance
{
protected class IQCWorld extends InstanceWorld
{
@@ -65,9 +65,9 @@ public final class IceQueensCastle extends AbstractNpcAI
private static final int ICE_QUEEN_DOOR = 23140101;
private static final int MIN_LV = 82;
private IceQueensCastle()
public IceQueensCastle()
{
super(IceQueensCastle.class.getSimpleName(), "instances");
super(IceQueensCastle.class.getSimpleName());
addStartNpc(JINIA);
addTalkId(JINIA);
addSeeCreatureId(BATTALION_LEADER, LEGIONNAIRE, MERCENARY_ARCHER);
@@ -187,41 +187,24 @@ public final class IceQueensCastle extends AbstractNpcAI
@Override
public String onTalk(L2Npc npc, L2PcInstance talker)
{
enterInstance(talker, "IceQueensCastle.xml");
enterInstance(talker, new IQCWorld(), "IceQueensCastle.xml", TEMPLATE_ID);
return super.onTalk(npc, talker);
}
private void enterInstance(L2PcInstance player, String template)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
if (firstEntrance)
{
if (world instanceof IQCWorld)
{
teleportPlayer(player, START_LOC, world.getInstanceId(), false);
return;
}
player.sendPacket(SystemMessageId.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 @@ public final class IceQueensCastle extends AbstractNpcAI
}
return true;
}
public static void main(String[] args)
{
new IceQueensCastle();
}
}
}

View File

@@ -18,14 +18,14 @@
*/
package instances.IceQueensCastleHardBattle;
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.PcCondOverride;
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 @@ import com.l2jserver.gameserver.util.Util;
* Ice Queen's Castle (Hard Battle) instance zone.
* @author St3eT
*/
public final class IceQueensCastleHardBattle extends AbstractNpcAI
public final class IceQueensCastleHardBattle 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 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
private static final int MAX_PLAYERS = 45; // (hard)
private static final int MIN_PLAYERS = 36; // (hard)
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 = 144; // Ice Queen's Castle (hard)
private static final int DOOR_ID = 23140101;
private IceQueensCastleHardBattle()
public IceQueensCastleHardBattle()
{
super(IceQueensCastleHardBattle.class.getSimpleName(), "instances");
super(IceQueensCastleHardBattle.class.getSimpleName());
addStartNpc(SIRRA, SUPP_KEGOR, SUPP_JINIA);
addFirstTalkId(SUPP_KEGOR, SUPP_JINIA);
addTalkId(SIRRA, JINIA, SUPP_KEGOR);
@@ -182,7 +177,7 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
{
if (event.equals("enter"))
{
enterInstance(player, "IceQueensCastleHardBattle.xml");
enterInstance(player, new IQCNBWorld(), "IceQueensCastleHardBattle.xml", TEMPLATE_ID);
}
else
{
@@ -424,7 +419,7 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
{
final L2Attackable knight = (L2Attackable) addSpawn(KNIGHT, loc, false, 0, false, world.getInstanceId());
knight.disableCoreAI(true);
knight.setDisplayEffect(1);
knight.setState(1);
knight.getSpawn().setLocation(loc);
world.spawnedMobs.add(knight);
startQuestTimer("ICE_RUPTURE", getRandom(2, 5) * 1000, knight, null);
@@ -445,7 +440,7 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
knight.getVariables().set("SPAWNED_NPC", npc);
knight.disableCoreAI(true);
knight.setIsImmobilized(true);
knight.setDisplayEffect(1);
knight.setState(1);
knight.getSpawn().setLocation(loc);
world.spawnedMobs.add(knight);
startQuestTimer("ICE_RUPTURE", getRandom(5, 10) * 1000, knight, null);
@@ -458,7 +453,7 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
{
final Location loc = new Location(MIDDLE_POINT.getX() + getRandom(-1000, 1000), MIDDLE_POINT.getY() + getRandom(-1000, 1000), MIDDLE_POINT.getZ());
final L2Attackable glacier = (L2Attackable) addSpawn(GLACIER, loc, false, 0, false, world.getInstanceId());
glacier.setDisplayEffect(1);
glacier.setState(1);
glacier.disableCoreAI(true);
glacier.setIsImmobilized(true);
world.spawnedMobs.add(glacier);
@@ -472,7 +467,7 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
{
npc.disableCoreAI(false);
npc.setIsImmobilized(false);
npc.setDisplayEffect(2);
npc.setState(2);
manageRandomAttack(world, (L2Attackable) npc);
}
break;
@@ -484,7 +479,7 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
}
case "CHANGE_STATE":
{
npc.setDisplayEffect(2);
npc.setState(2);
startQuestTimer("CAST_SKILL", 20000, npc, null);
break;
}
@@ -500,7 +495,7 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
}
case "SUICIDE":
{
npc.setDisplayEffect(3);
npc.setState(3);
npc.setIsMortal(true);
npc.doDie(null);
break;
@@ -910,7 +905,7 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
manageRandomAttack(world, (L2Attackable) npc);
npc.disableCoreAI(false);
npc.setIsImmobilized(false);
npc.setDisplayEffect(2);
npc.setState(2);
cancelQuestTimer("ICE_RUPTURE", npc, null);
}
break;
@@ -1069,41 +1064,10 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
}
case FREYA_STAND:
{
for (L2PcInstance player : world.playersInside)
{
if ((player != null) && (player.getInstanceId() == world.getInstanceId()))
{
Calendar reenter = Calendar.getInstance();
Calendar.getInstance().set(Calendar.MINUTE, RESET_MIN);
Calendar.getInstance().set(Calendar.HOUR_OF_DAY, RESET_HOUR);
if (reenter.getTimeInMillis() <= System.currentTimeMillis())
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
{
while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
}
else
{
while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
}
InstanceManager.getInstance().setInstanceTime(player.getObjectId(), TEMPLATE_ID, reenter.getTimeInMillis());
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_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 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
return super.onKill(npc, killer, isSummon);
}
private void enterInstance(L2PcInstance player, String template)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
if (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 (Hard Battle)" + template + " Instance: " + world.getInstanceId() + " created by player: " + player.getName());
if (!player.isInParty())
{
managePlayerEnter(player, (IQCNBWorld) world);
@@ -1221,23 +1150,21 @@ public final class IceQueensCastleHardBattle extends AbstractNpcAI
}
}
}
else
{
teleportPlayer(player, world.isStatus(4) ? BATTLE_PORT : ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId());
}
}
private void managePlayerEnter(L2PcInstance player, IQCNBWorld world)
{
player.stopAllEffectsExceptThoseThatLastThroughDeath();
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 final class IceQueensCastleHardBattle extends AbstractNpcAI
}
}
}
public static void main(String[] args)
{
new IceQueensCastleHardBattle();
}
}

View File

@@ -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.PcCondOverride;
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 @@ import com.l2jserver.gameserver.util.Util;
* Ice Queen's Castle (Normal Battle) instance zone.
* @author St3eT
*/
public final class IceQueensCastleNormalBattle extends AbstractNpcAI
public final class IceQueensCastleNormalBattle extends AbstractInstance
{
protected class IQCNBWorld extends InstanceWorld
{
List<L2PcInstance> playersInside = new ArrayList<>();
List<L2Npc> knightStatues = new ArrayList<>();
List<L2Attackable> spawnedMobs = new CopyOnWriteArrayList<>();
L2NpcInstance controller = null;
L2GrandBossInstance freya = null;
L2QuestGuardInstance supp_Jinia = null;
L2QuestGuardInstance supp_Kegor = null;
boolean isSupportActive = false;
boolean canSpawnMobs = true;
protected List<L2PcInstance> playersInside = new ArrayList<>();
protected List<L2Npc> knightStatues = new ArrayList<>();
protected List<L2Attackable> spawnedMobs = new CopyOnWriteArrayList<>();
protected L2NpcInstance controller = null;
protected L2GrandBossInstance freya = null;
protected L2QuestGuardInstance supp_Jinia = null;
protected L2QuestGuardInstance supp_Kegor = null;
protected boolean isSupportActive = false;
protected boolean canSpawnMobs = true;
}
// Npcs
@@ -159,16 +158,12 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
private static final int MAX_PLAYERS = 27;
private static final int MIN_PLAYERS = 10;
private static final int MIN_LEVEL = 82;
private static final int RESET_HOUR = 6;
private static final int RESET_MIN = 30;
private static final int RESET_DAY_1 = 4; // Wednesday
private static final int RESET_DAY_2 = 7; // Saturday
private static final int TEMPLATE_ID = 139; // Ice Queen's Castle
private static final int DOOR_ID = 23140101;
private IceQueensCastleNormalBattle()
public IceQueensCastleNormalBattle()
{
super(IceQueensCastleNormalBattle.class.getSimpleName(), "instances");
super(IceQueensCastleNormalBattle.class.getSimpleName());
addStartNpc(SIRRA, SUPP_KEGOR, SUPP_JINIA);
addFirstTalkId(SUPP_KEGOR, SUPP_JINIA);
addTalkId(SIRRA, JINIA, SUPP_KEGOR);
@@ -182,7 +177,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
{
if (event.equals("enter"))
{
enterInstance(player, "IceQueensCastleNormalBattle.xml");
enterInstance(player, new IQCNBWorld(), "IceQueensCastleNormalBattle.xml", TEMPLATE_ID);
}
else
{
@@ -424,7 +419,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
{
final L2Attackable knight = (L2Attackable) addSpawn(KNIGHT, loc, false, 0, false, world.getInstanceId());
knight.disableCoreAI(true);
knight.setDisplayEffect(1);
knight.setState(1);
knight.getSpawn().setLocation(loc);
world.spawnedMobs.add(knight);
startQuestTimer("ICE_RUPTURE", getRandom(2, 5) * 1000, knight, null);
@@ -445,7 +440,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
knight.getVariables().set("SPAWNED_NPC", npc);
knight.disableCoreAI(true);
knight.setIsImmobilized(true);
knight.setDisplayEffect(1);
knight.setState(1);
knight.getSpawn().setLocation(loc);
world.spawnedMobs.add(knight);
startQuestTimer("ICE_RUPTURE", getRandom(5, 10) * 1000, knight, null);
@@ -458,7 +453,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
{
final Location loc = new Location(MIDDLE_POINT.getX() + getRandom(-1000, 1000), MIDDLE_POINT.getY() + getRandom(-1000, 1000), MIDDLE_POINT.getZ());
final L2Attackable glacier = (L2Attackable) addSpawn(GLACIER, loc, false, 0, false, world.getInstanceId());
glacier.setDisplayEffect(1);
glacier.setState(1);
glacier.disableCoreAI(true);
glacier.setIsImmobilized(true);
world.spawnedMobs.add(glacier);
@@ -472,7 +467,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
{
npc.disableCoreAI(false);
npc.setIsImmobilized(false);
npc.setDisplayEffect(2);
npc.setState(2);
manageRandomAttack(world, (L2Attackable) npc);
}
break;
@@ -484,7 +479,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
}
case "CHANGE_STATE":
{
npc.setDisplayEffect(2);
npc.setState(2);
startQuestTimer("CAST_SKILL", 20000, npc, null);
break;
}
@@ -500,7 +495,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
}
case "SUICIDE":
{
npc.setDisplayEffect(3);
npc.setState(3);
npc.setIsMortal(true);
npc.doDie(null);
break;
@@ -910,7 +905,7 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
manageRandomAttack(world, (L2Attackable) npc);
npc.disableCoreAI(false);
npc.setIsImmobilized(false);
npc.setDisplayEffect(2);
npc.setState(2);
cancelQuestTimer("ICE_RUPTURE", npc, null);
}
break;
@@ -1069,41 +1064,10 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
}
case FREYA_STAND:
{
for (L2PcInstance player : world.playersInside)
{
if ((player != null) && (player.getInstanceId() == world.getInstanceId()))
{
Calendar reenter = Calendar.getInstance();
Calendar.getInstance().set(Calendar.MINUTE, RESET_MIN);
Calendar.getInstance().set(Calendar.HOUR_OF_DAY, RESET_HOUR);
if (reenter.getTimeInMillis() <= System.currentTimeMillis())
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
if (reenter.get(Calendar.DAY_OF_WEEK) <= RESET_DAY_1)
{
while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_1)
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
}
else
{
while (reenter.get(Calendar.DAY_OF_WEEK) != RESET_DAY_2)
{
reenter.add(Calendar.DAY_OF_MONTH, 1);
}
}
InstanceManager.getInstance().setInstanceTime(player.getObjectId(), TEMPLATE_ID, reenter.getTimeInMillis());
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.INSTANT_ZONE_S1_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 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
return super.onKill(npc, killer, isSummon);
}
private void enterInstance(L2PcInstance player, String template)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
if (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 @@ public final class IceQueensCastleNormalBattle extends AbstractNpcAI
}
}
}
else
{
teleportPlayer(player, world.isStatus(4) ? BATTLE_PORT : ENTER_LOC[getRandom(ENTER_LOC.length)], world.getInstanceId());
}
}
private void managePlayerEnter(L2PcInstance player, IQCNBWorld world)
{
player.stopAllEffectsExceptThoseThatLastThroughDeath();
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 final class IceQueensCastleNormalBattle extends AbstractNpcAI
}
}
}
public static void main(String[] args)
{
new IceQueensCastleNormalBattle();
}
}
}

View File

@@ -0,0 +1,116 @@
/*
* Copyright (C) 2004-2015 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.IceQueensCastleHardBattle.IceQueensCastleHardBattle;
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.MonasteryOfSilence2.MonasteryOfSilence2;
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,
IceQueensCastleHardBattle.class,
IceQueensCastleNormalBattle.class,
JiniaGuildHideout1.class,
JiniaGuildHideout2.class,
JiniaGuildHideout3.class,
JiniaGuildHideout4.class,
Kamaloka.class,
LibraryOfSages.class,
MithrilMine.class,
MonasteryOfSilence1.class,
MonasteryOfSilence2.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);
}
}
}
}

View File

@@ -18,37 +18,36 @@
*/
package instances.JiniaGuildHideout1;
import instances.AbstractInstance;
import quests.Q10284_AcquisitionOfDivineSword.Q10284_AcquisitionOfDivineSword;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Jinia Guild Hideout instance zone.
* @author Adry_85
*/
public final class JiniaGuildHideout1 extends Quest
public final class JiniaGuildHideout1 extends AbstractInstance
{
protected class JGH1World extends InstanceWorld
{
long storeTime = 0;
}
private static final int INSTANCEID = 140;
// NPC
private static final int RAFFORTY = 32020;
// Location
private static final Location START_LOC = new Location(-23530, -8963, -5413);
// Misc
private static final int TEMPLATE_ID = 140;
private JiniaGuildHideout1()
public JiniaGuildHideout1()
{
super(-1, JiniaGuildHideout1.class.getSimpleName(), "instances");
super(JiniaGuildHideout1.class.getSimpleName());
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
}
@@ -59,42 +58,19 @@ public final class JiniaGuildHideout1 extends Quest
final QuestState qs = talker.getQuestState(Q10284_AcquisitionOfDivineSword.class.getSimpleName());
if ((qs != null) && qs.isCond(1))
{
enterInstance(talker, "JiniaGuildHideout1.xml");
enterInstance(talker, new JGH1World(), "JiniaGuildHideout1.xml", TEMPLATE_ID);
qs.setCond(2, true);
}
return super.onTalk(npc, talker);
}
protected void enterInstance(L2PcInstance player, String template)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
if (!(world instanceof JGH1World))
{
player.sendPacket(SystemMessageId.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();
}
}
}

View File

@@ -18,37 +18,36 @@
*/
package instances.JiniaGuildHideout2;
import instances.AbstractInstance;
import quests.Q10285_MeetingSirra.Q10285_MeetingSirra;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Jinia Guild Hideout instance zone.
* @author Adry_85
*/
public final class JiniaGuildHideout2 extends Quest
public final class JiniaGuildHideout2 extends AbstractInstance
{
protected class JGH2World extends InstanceWorld
{
long storeTime = 0;
}
private static final int TEMPLATE_ID = 141;
// NPC
private static final int RAFFORTY = 32020;
// Location
private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0);
// Misc
private static final int TEMPLATE_ID = 141;
private JiniaGuildHideout2()
public JiniaGuildHideout2()
{
super(-1, JiniaGuildHideout2.class.getSimpleName(), "instances");
super(JiniaGuildHideout2.class.getSimpleName());
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
}
@@ -59,43 +58,19 @@ public final class JiniaGuildHideout2 extends Quest
final QuestState qs = talker.getQuestState(Q10285_MeetingSirra.class.getSimpleName());
if ((qs != null) && qs.isMemoState(1))
{
enterInstance(talker, "JiniaGuildHideout2.xml", START_LOC);
enterInstance(talker, new JGH2World(), "JiniaGuildHideout2.xml", TEMPLATE_ID);
qs.setCond(2, true);
}
return super.onTalk(npc, talker);
}
protected int enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
if (!(world instanceof JGH2World))
{
player.sendPacket(SystemMessageId.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();
}
}
}

View File

@@ -18,37 +18,36 @@
*/
package instances.JiniaGuildHideout3;
import instances.AbstractInstance;
import quests.Q10286_ReunionWithSirra.Q10286_ReunionWithSirra;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Jinia Guild Hideout instance zone.
* @author Adry_85
*/
public final class JiniaGuildHideout3 extends Quest
public final class JiniaGuildHideout3 extends AbstractInstance
{
protected class JGH2World extends InstanceWorld
protected class JGH3World extends InstanceWorld
{
long storeTime = 0;
}
private static final int TEMPLATE_ID = 145;
// NPC
private static final int RAFFORTY = 32020;
// Location
private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0);
// Misc
private static final int TEMPLATE_ID = 145;
private JiniaGuildHideout3()
public JiniaGuildHideout3()
{
super(-1, JiniaGuildHideout3.class.getSimpleName(), "instances");
super(JiniaGuildHideout3.class.getSimpleName());
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
}
@@ -59,43 +58,19 @@ public final class JiniaGuildHideout3 extends Quest
final QuestState qs = talker.getQuestState(Q10286_ReunionWithSirra.class.getSimpleName());
if ((qs != null) && qs.isMemoState(1))
{
enterInstance(talker, "JiniaGuildHideout3.xml", START_LOC);
enterInstance(talker, new JGH3World(), "JiniaGuildHideout3.xml", TEMPLATE_ID);
qs.setCond(2, true);
}
return super.onTalk(npc, talker);
}
protected int enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
if (!(world instanceof JGH2World))
{
player.sendPacket(SystemMessageId.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();
}
}
}

View File

@@ -18,37 +18,36 @@
*/
package instances.JiniaGuildHideout4;
import instances.AbstractInstance;
import quests.Q10287_StoryOfThoseLeft.Q10287_StoryOfThoseLeft;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Jinia Guild Hideout instance zone.
* @author Adry_85
*/
public final class JiniaGuildHideout4 extends Quest
public final class JiniaGuildHideout4 extends AbstractInstance
{
protected class JGH2World extends InstanceWorld
protected class JGH4World extends InstanceWorld
{
long storeTime = 0;
}
private static final int TEMPLATE_ID = 146;
// NPC
private static final int RAFFORTY = 32020;
// Location
private static final Location START_LOC = new Location(-23530, -8963, -5413, 0, 0);
// Misc
private static final int TEMPLATE_ID = 146;
private JiniaGuildHideout4()
public JiniaGuildHideout4()
{
super(-1, JiniaGuildHideout4.class.getSimpleName(), "instances");
super(JiniaGuildHideout4.class.getSimpleName());
addStartNpc(RAFFORTY);
addTalkId(RAFFORTY);
}
@@ -59,43 +58,19 @@ public final class JiniaGuildHideout4 extends Quest
final QuestState qs = talker.getQuestState(Q10287_StoryOfThoseLeft.class.getSimpleName());
if ((qs != null) && qs.isMemoState(1))
{
enterInstance(talker, "JiniaGuildHideout4.xml", START_LOC);
enterInstance(talker, new JGH4World(), "JiniaGuildHideout4.xml", TEMPLATE_ID);
qs.setCond(2, true);
}
return super.onTalk(npc, talker);
}
protected int enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
if (!(world instanceof JGH2World))
{
player.sendPacket(SystemMessageId.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();
}
}
}

View File

@@ -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.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.model.quest.Quest;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public final class Kamaloka extends Quest
public final class Kamaloka extends AbstractInstance
{
/*
* Reset time for all kamaloka Default: 6:30AM on server time
@@ -1176,9 +1177,9 @@ public final class Kamaloka extends Quest
public L2Npc boss = null; // boss
}
private Kamaloka()
public Kamaloka()
{
super(-1, Kamaloka.class.getSimpleName(), "instances");
super(Kamaloka.class.getSimpleName());
addFirstTalkId(TELEPORTER);
addTalkId(TELEPORTER);
for (int cap : CAPTAINS)
@@ -1418,7 +1419,8 @@ public final class Kamaloka extends Quest
* Called on instance finish and handles reenter time for instance
* @param world instanceWorld
*/
private static final void finishInstance(InstanceWorld world)
@Override
protected final void finishInstance(InstanceWorld world)
{
if (world instanceof KamaWorld)
{
@@ -1725,8 +1727,9 @@ public final class Kamaloka extends Quest
return super.onKill(npc, player, isSummon);
}
public static void main(String[] args)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
new Kamaloka();
}
}
}

View File

@@ -1,5 +1,5 @@
<html><body>Library of Sages Director Sophia:<br>
Hello. What brings you to Library of Sages?<br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest LibraryOfSages EXIT">"I wish to leave."</Button>
<Button ALIGN=LEFT ICON="QUEST" action="bypass -h npc_%objectId%_Quest">Quest</Button>
<a action="bypass -h Quest LibraryOfSages exit">"I wish to leave."</a><br>
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
</body></html>

View File

@@ -18,7 +18,7 @@
*/
package instances.LibraryOfSages;
import ai.npc.AbstractNpcAI;
import instances.AbstractInstance;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
@@ -26,22 +26,19 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
/**
* Library of Sages instance zone.
* @author Adry_85
*/
public final class LibraryOfSages extends AbstractNpcAI
public final class LibraryOfSages extends AbstractInstance
{
protected class LoSWorld extends InstanceWorld
{
protected L2Npc elcadia = null;
protected long storeTime = 0;
}
private static final int TEMPLATE_ID = 156;
// NPCs
private static final int SOPHIA1 = 32596;
private static final int PILE_OF_BOOKS1 = 32809;
@@ -64,10 +61,12 @@ public final class LibraryOfSages extends AbstractNpcAI
NpcStringId.AN_UNDERGROUND_LIBRARY_I_HATE_DAMP_AND_SMELLY_PLACES,
NpcStringId.THE_BOOK_THAT_WE_SEEK_IS_CERTAINLY_HERE_SEARCH_INCH_BY_INCH
};
// Misc
private static final int TEMPLATE_ID = 156;
private LibraryOfSages()
public LibraryOfSages()
{
super(LibraryOfSages.class.getSimpleName(), "instances");
super(LibraryOfSages.class.getSimpleName());
addFirstTalkId(SOPHIA2, ELCADIA_INSTANCE, PILE_OF_BOOKS1, PILE_OF_BOOKS2, PILE_OF_BOOKS3, PILE_OF_BOOKS4, PILE_OF_BOOKS5);
addStartNpc(SOPHIA1, SOPHIA2, SOPHIA3);
addTalkId(SOPHIA1, SOPHIA2, SOPHIA3);
@@ -76,42 +75,40 @@ public final class LibraryOfSages extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (!(tmpworld instanceof LoSWorld))
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof LoSWorld)
{
return null;
}
LoSWorld world = (LoSWorld) tmpworld;
switch (event)
{
case "TELEPORT2":
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 @@ public final class LibraryOfSages extends AbstractNpcAI
@Override
public String onTalk(L2Npc npc, L2PcInstance talker)
{
enterInstance(talker, "LibraryOfSages.xml");
enterInstance(talker, new LoSWorld(), "LibraryOfSages.xml", TEMPLATE_ID);
return super.onTalk(npc, talker);
}
protected int enterInstance(L2PcInstance player, String template)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
if (!(world instanceof LoSWorld))
{
player.sendPacket(SystemMessageId.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();
}
}
}

View File

@@ -18,8 +18,8 @@
*/
package instances.MithrilMine;
import instances.AbstractInstance;
import quests.Q10284_AcquisitionOfDivineSword.Q10284_AcquisitionOfDivineSword;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@@ -32,22 +32,19 @@ import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
/**
* Mithril Mine instance zone.
* @author Adry_85
*/
public final class MithrilMine extends AbstractNpcAI
public final class MithrilMine extends AbstractInstance
{
protected class MMWorld extends InstanceWorld
{
long storeTime = 0;
int _count = 0;
protected int _count = 0;
}
private static final int TEMPLATE_ID = 138;
// NPCs
private static final int KEGOR = 18846;
private static final int MITHRIL_MILLIPEDE = 22766;
@@ -68,8 +65,10 @@ public final class MithrilMine extends AbstractNpcAI
new Location(185920, -184544, -3308, -32544),
new Location(185664, -184720, -3308, 27892)
};
// Misc
private static final int TEMPLATE_ID = 138;
private MithrilMine()
public MithrilMine()
{
super(MithrilMine.class.getSimpleName(), "instances");
addFirstTalkId(KEGOR);
@@ -205,7 +204,7 @@ public final class MithrilMine extends AbstractNpcAI
giveItems(talker, COLD_RESISTANCE_POTION, 1);
}
qs.setCond(4, true);
enterInstance(talker, "MithrilMine.xml", START_LOC);
enterInstance(talker, new MMWorld(), "MithrilMine.xml", TEMPLATE_ID);
}
break;
}
@@ -227,37 +226,13 @@ public final class MithrilMine extends AbstractNpcAI
return super.onTalk(npc, talker);
}
protected int enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
// existing instance
if (world != null)
if (firstEntrance)
{
if (!(world instanceof MMWorld))
{
player.sendPacket(SystemMessageId.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();
}
}
}

View File

@@ -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 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
private static final int TELEPORT_CONTROL_DEVICE2 = 32818;
private static final int TELEPORT_CONTROL_DEVICE3 = 32819;
private static final int TELEPORT_CONTROL_DEVICE4 = 32820;
// Skills
private static final SkillHolder[] BUFFS =
{
new SkillHolder(6725, 1), // Bless the Blood of Elcadia
new SkillHolder(6728, 1), // Recharge of Elcadia
new SkillHolder(6730, 1), // Greater Battle Heal of Elcadia
};
// Locations
private static final Location START_LOC = new Location(120710, -86971, -3392);
private static final Location EXIT_LOC = new Location(115983, -87351, -3397, 0, 0);
@@ -73,72 +76,44 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
NpcStringId.WE_MUST_SEARCH_HIGH_AND_LOW_IN_EVERY_ROOM_FOR_THE_READING_DESK_THAT_CONTAINS_THE_BOOK_WE_SEEK,
NpcStringId.REMEMBER_THE_CONTENT_OF_THE_BOOKS_THAT_YOU_FOUND_YOU_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 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
case "BACK":
{
teleportPlayer(player, BACK_LOC, world.getInstanceId());
world.elcadia.teleToLocation(BACK_LOC.getX(), BACK_LOC.getY(), BACK_LOC.getZ(), 0, world.getInstanceId());
world.elcadia.teleToLocation(BACK_LOC, 0, world.getInstanceId());
break;
}
case "EAST":
{
teleportPlayer(player, EAST_WATCHERS_ROOM_LOC, world.getInstanceId());
world.elcadia.teleToLocation(EAST_WATCHERS_ROOM_LOC.getX(), EAST_WATCHERS_ROOM_LOC.getY(), EAST_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId());
world.elcadia.teleToLocation(EAST_WATCHERS_ROOM_LOC, 0, world.getInstanceId());
break;
}
case "WEST":
{
teleportPlayer(player, WEST_WATCHERS_ROOM_LOC, world.getInstanceId());
world.elcadia.teleToLocation(WEST_WATCHERS_ROOM_LOC.getX(), WEST_WATCHERS_ROOM_LOC.getY(), WEST_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId());
world.elcadia.teleToLocation(WEST_WATCHERS_ROOM_LOC, 0, world.getInstanceId());
break;
}
case "NORTH":
{
teleportPlayer(player, NORTH_WATCHERS_ROOM_LOC, world.getInstanceId());
world.elcadia.teleToLocation(NORTH_WATCHERS_ROOM_LOC.getX(), NORTH_WATCHERS_ROOM_LOC.getY(), NORTH_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId());
world.elcadia.teleToLocation(NORTH_WATCHERS_ROOM_LOC, 0, world.getInstanceId());
break;
}
case "SOUTH":
{
teleportPlayer(player, SOUTH_WATCHERS_ROOM_LOC, world.getInstanceId());
world.elcadia.teleToLocation(SOUTH_WATCHERS_ROOM_LOC.getX(), SOUTH_WATCHERS_ROOM_LOC.getY(), SOUTH_WATCHERS_ROOM_LOC.getZ(), 0, world.getInstanceId());
world.elcadia.teleToLocation(SOUTH_WATCHERS_ROOM_LOC, 0, world.getInstanceId());
break;
}
case "CENTER":
{
teleportPlayer(player, CENTRAL_ROOM_LOC, world.getInstanceId());
world.elcadia.teleToLocation(CENTRAL_ROOM_LOC.getX(), CENTRAL_ROOM_LOC.getY(), CENTRAL_ROOM_LOC.getZ(), 0, world.getInstanceId());
world.elcadia.teleToLocation(CENTRAL_ROOM_LOC, 0, world.getInstanceId());
break;
}
case "FOLLOW":
@@ -216,31 +191,18 @@ public final class MonasteryOfSilence1 extends AbstractNpcAI
{
if (npc.getId() == ODD_GLOBE)
{
enterInstance(talker, "MonasteryOfSilence.xml");
enterInstance(talker, new MoSWorld(), "MonasteryOfSilence.xml", TEMPLATE_ID);
}
return super.onTalk(npc, talker);
}
private static final void removeBuffs(L2Character ch)
protected void spawnElcadia(L2PcInstance player, MoSWorld world)
{
ch.stopAllEffectsExceptThoseThatLastThroughDeath();
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();
}
}
}

View File

@@ -209,7 +209,7 @@ public class MonasteryOfSilence2 extends AbstractNpcAI
}
}
private MonasteryOfSilence2()
public MonasteryOfSilence2()
{
super(MonasteryOfSilence2.class.getSimpleName(), "instances");
addStartNpc(OddGlobe);

View File

@@ -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.L2DoorInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.zone.L2ZoneType;
@@ -42,37 +43,39 @@ import com.l2jserver.gameserver.util.Util;
* @author Gnacik
* @version 2010-10-15 Based on official server Naia
*/
public final class NornilsGarden extends Quest
public final class NornilsGarden extends AbstractInstance
{
protected class NornilsWorld extends InstanceWorld
{
public L2Npc first_npc = null;
public boolean spawned_1 = false;
public boolean spawned_2 = false;
public boolean spawned_3 = false;
public boolean spawned_4 = false;
protected L2Npc first_npc = null;
protected boolean spawned_1 = false;
protected boolean spawned_2 = false;
protected boolean spawned_3 = false;
protected boolean spawned_4 = false;
}
private static final int TEMPLATE_ID = 11;
private static final int DURATION_TIME = 70;
private static final int EMPTY_DESTROY_TIME = 5;
private static final int INSTANCE_LVL_MIN = 18;
private static final int INSTANCE_LVL_MAX = 22;
// NPCs
private static final int _garden_guard = 32330;
private static final int[] _final_gates =
{
32260,
32261,
32262
};
// Skills
private static final Skill skill1 = SkillData.getInstance().getSkill(4322, 1);
private static final Skill skill2 = SkillData.getInstance().getSkill(4327, 1);
private static final Skill skill3 = SkillData.getInstance().getSkill(4329, 1);
private static final Skill skill4 = SkillData.getInstance().getSkill(4324, 1);
// Locations
private static final Location SPAWN_PPL = new Location(-111184, 74540, -12430);
private static final Location EXIT_PPL = new Location(-74058, 52040, -3680);
// Misc
private static final int TEMPLATE_ID = 11;
private static final int DURATION_TIME = 70;
private static final int EMPTY_DESTROY_TIME = 5;
private static final int INSTANCE_LVL_MIN = 18;
private static final int INSTANCE_LVL_MAX = 22;
private static final int[][] _auto_gates =
{
// Warriors gate
@@ -91,14 +94,7 @@ public final class NornilsGarden extends Quest
16200013
}
};
private static final Skill skill1 = SkillData.getInstance().getSkill(4322, 1);
private static final Skill skill2 = SkillData.getInstance().getSkill(4327, 1);
private static final Skill skill3 = SkillData.getInstance().getSkill(4329, 1);
private static final Skill skill4 = SkillData.getInstance().getSkill(4324, 1);
private static final int _herb_jar = 18478;
// @formatter:off
private static final int[][] _gatekeepers =
{
@@ -114,7 +110,6 @@ public final class NornilsGarden extends Quest
{ 18361, 9711, 0 }, // Guardian of Prediction
{ 25528, 9712, 0 } // Tiberias
};
private static final int[][] HP_HERBS_DROPLIST =
{
// itemId, count, chance
@@ -122,7 +117,6 @@ public final class NornilsGarden extends Quest
{ 8601, 2, 40 },
{ 8600, 3, 70 }
};
private static final int[][] _group_1 =
{
{ 18363, -109899, 74431, -12528, 16488 },
@@ -131,7 +125,6 @@ public final class NornilsGarden extends Quest
{ 18363, -109703, 74879, -12528, 49336 }
};
private static final int[][] _group_2 =
{
{ 18363, -110393, 78276, -12848, 49152 },
@@ -143,7 +136,6 @@ public final class NornilsGarden extends Quest
{ 18483, -110389, 79131, -12915, 48539 },
{ 18483, -110551, 79134, -12915, 49151 }
};
private static final int[][] _group_3 =
{
{ 18483, -107798, 80721, -12912, 0 },
@@ -153,8 +145,7 @@ public final class NornilsGarden extends Quest
{ 18483, -108740, 80752, -12912, 0 },
{ 18363, -109016, 80642, -12912, 0 },
{ 18483, -108740, 80546, -12912, 0 }
};
};
private static final int[][] _group_4 =
{
{ 18362, -110082, 83998, -12928, 0 },
@@ -167,7 +158,6 @@ public final class NornilsGarden extends Quest
{ 18362, -109122, 84490, -12880, 0 },
{ 18347, -108939, 84489, -12880, 0 }
};
private static final int[][] MP_HERBS_DROPLIST =
{
// itemId, count, chance
@@ -189,11 +179,6 @@ public final class NornilsGarden extends Quest
}
}
private static final void removeBuffs(L2Character ch)
{
ch.stopAllEffectsExceptThoseThatLastThroughDeath();
}
private static final void giveBuffs(L2Character ch)
{
if (skill1 != null)
@@ -214,9 +199,9 @@ public final class NornilsGarden extends Quest
}
}
private NornilsGarden()
public NornilsGarden()
{
super(-1, NornilsGarden.class.getSimpleName(), "instances");
super(NornilsGarden.class.getSimpleName());
addStartNpc(_garden_guard);
addFirstTalkId(_garden_guard);
addTalkId(_garden_guard);
@@ -236,17 +221,14 @@ public final class NornilsGarden extends Quest
@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 @@ public final class NornilsGarden extends Quest
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 @@ public final class NornilsGarden extends Quest
return super.onKill(npc, player, isSummon);
}
public static void main(String[] args)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
new NornilsGarden();
}
}
}

View File

@@ -18,11 +18,12 @@
*/
package instances.PailakaDevilsLegacy;
import instances.AbstractInstance;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import quests.Q00129_PailakaDevilsLegacy.Q00129_PailakaDevilsLegacy;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@@ -35,18 +36,17 @@ import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.model.zone.L2ZoneType;
import com.l2jserver.gameserver.network.SystemMessageId;
/**
* Pailaka Devil's Legacy Instance zone.
* @author St3eT
*/
public final class PailakaDevilsLegacy extends AbstractNpcAI
public final class PailakaDevilsLegacy extends AbstractInstance
{
protected class DIWorld extends InstanceWorld
{
L2Attackable _lematanNpc = null;
List<L2Attackable> _followerslist = new CopyOnWriteArrayList<>();
protected L2Attackable _lematanNpc = null;
protected List<L2Attackable> _followerslist = new CopyOnWriteArrayList<>();
}
// NPCs
@@ -88,9 +88,9 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI
private static final int TEMPLATE_ID = 44;
private static final int ZONE = 20109;
private PailakaDevilsLegacy()
public PailakaDevilsLegacy()
{
super(PailakaDevilsLegacy.class.getSimpleName(), "instances");
super(PailakaDevilsLegacy.class.getSimpleName());
addTalkId(SURVIVOR);
addAttackId(POWDER_KEG, TREASURE_BOX, LEMATAN);
addKillId(LEMATAN);
@@ -108,7 +108,7 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI
if (event.equals("enter"))
{
final QuestState qs = player.getQuestState(Q00129_PailakaDevilsLegacy.class.getSimpleName());
enterInstance(player, "PailakaDevilsLegacy.xml");
enterInstance(player, new DIWorld(), "PailakaDevilsLegacy.xml", TEMPLATE_ID);
if (qs.isCond(1))
{
qs.setCond(2, true);
@@ -304,28 +304,15 @@ public final class PailakaDevilsLegacy extends AbstractNpcAI
}
}
private void enterInstance(L2PcInstance player, String template)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
if (firstEntrance)
{
if (world instanceof DIWorld)
{
teleportPlayer(player, TELEPORT, world.getInstanceId());
return;
}
player.sendPacket(SystemMessageId.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)

View File

@@ -18,7 +18,7 @@
*/
package instances.PailakaSongOfIceAndFire;
import ai.npc.AbstractNpcAI;
import instances.AbstractInstance;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.Location;
@@ -28,14 +28,13 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.zone.L2ZoneType;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
/**
* Pailaka Song of Ice and Fire Instance zone.
* @author Gnacik, St3eT
*/
public final class PailakaSongOfIceAndFire extends AbstractNpcAI
public final class PailakaSongOfIceAndFire extends AbstractInstance
{
protected class PSoIWorld extends InstanceWorld
{
@@ -59,9 +58,9 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI
private static final int TEMPLATE_ID = 43;
private static final int ZONE = 20108;
private PailakaSongOfIceAndFire()
public PailakaSongOfIceAndFire()
{
super(PailakaSongOfIceAndFire.class.getSimpleName(), "instances");
super(PailakaSongOfIceAndFire.class.getSimpleName());
addStartNpc(ADLER1);
addTalkId(ADLER1);
addAttackId(BOTTLE, BRAZIER);
@@ -71,27 +70,14 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI
addKillId(BLOOM);
}
private void enterInstance(L2PcInstance player, String template)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
if (firstEntrance)
{
if (world instanceof PSoIWorld)
{
teleportPlayer(player, TELEPORT, world.getInstanceId());
return;
}
player.sendPacket(SystemMessageId.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 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI
{
case "enter":
{
enterInstance(player, "PailakaSongOfIceAndFire.xml");
enterInstance(player, new PSoIWorld(), "PailakaSongOfIceAndFire.xml", TEMPLATE_ID);
break;
}
case "GARGOS_LAUGH":
@@ -218,9 +204,4 @@ public final class PailakaSongOfIceAndFire extends AbstractNpcAI
startQuestTimer("BLOOM_TIMER", 1000, npc, null);
return super.onSpawn(npc);
}
public static void main(String[] args)
{
new PailakaSongOfIceAndFire();
}
}
}

View File

@@ -18,37 +18,36 @@
*/
package instances.SanctumOftheLordsOfDawn;
import instances.AbstractInstance;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import quests.Q00195_SevenSignsSecretRitualOfThePriests.Q00195_SevenSignsSecretRitualOfThePriests;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.gameserver.model.quest.QuestState;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.clientpackets.Say2;
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jserver.gameserver.network.serverpackets.NpcSay;
/**
* Sanctum of the Lords of Dawn instance zone.
* @author Adry_85
*/
public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
public final class SanctumOftheLordsOfDawn extends AbstractInstance
{
protected static final class HSWorld extends InstanceWorld
{
protected long storeTime = 0;
protected int doorst = 0;
protected final static Map<Integer, List<L2Npc>> _save_point = new HashMap<>();
@@ -58,8 +57,6 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
}
}
// Instance
private static final int TEMPLATE_ID = 111;
// NPCs
private static final int GUARDS_OF_THE_DAWN = 18834;
private static final int GUARDS_OF_THE_DAWN_2 = 18835;
@@ -69,10 +66,6 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
private static final int IDENTITY_CONFIRM_DEVICE = 32578;
private static final int DARKNESS_OF_DAWN = 32579;
private static final int SHELF = 32580;
// Doors
private static int DOOR_ONE = 17240001;
private static int DOOR_TWO = 17240003;
private static int DOOR_THREE = 17240005;
// Item
private static final int IDENTITY_CARD = 13822;
// Skill
@@ -80,7 +73,11 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
// Locations
private static final Location ENTER = new Location(-76161, 213401, -7120, 0, 0);
private static final Location EXIT = new Location(-12585, 122305, -2989, 0, 0);
// Misc
private static final int TEMPLATE_ID = 111;
private static int DOOR_ONE = 17240001;
private static int DOOR_TWO = 17240003;
private static int DOOR_THREE = 17240005;
private static final Location[] SAVE_POINT = new Location[]
{
new Location(-75775, 213415, -7120),
@@ -89,9 +86,9 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
new Location(-79939, 205857, -7888),
};
private SanctumOftheLordsOfDawn()
public SanctumOftheLordsOfDawn()
{
super(SanctumOftheLordsOfDawn.class.getSimpleName(), "instances");
super(SanctumOftheLordsOfDawn.class.getSimpleName());
addStartNpc(LIGHT_OF_DAWN);
addTalkId(LIGHT_OF_DAWN, IDENTITY_CONFIRM_DEVICE, PASSWORD_ENTRY_DEVICE, DARKNESS_OF_DAWN, SHELF);
addAggroRangeEnterId(GUARDS_OF_THE_DAWN, GUARDS_OF_THE_DAWN_2, GUARDS_OF_THE_DAWN_3);
@@ -104,12 +101,11 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
{
case "spawn":
{
InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
final InstanceWorld tmpworld = InstanceManager.getInstance().getPlayerWorld(player);
if (tmpworld instanceof HSWorld)
{
HSWorld world = (HSWorld) tmpworld;
Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
inst.spawnGroup("high_priest_of_dawn");
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 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
{
case GUARDS_OF_THE_DAWN:
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.INTRUDER_PROTECT_THE_PRIESTS_OF_DAWN));
broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.INTRUDER_PROTECT_THE_PRIESTS_OF_DAWN);
break;
}
case GUARDS_OF_THE_DAWN_2:
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.HOW_DARE_YOU_INTRUDE_WITH_THAT_TRANSFORMATION_GET_LOST));
broadcastNpcSay(npc, Say2.NPC_ALL, NpcStringId.HOW_DARE_YOU_INTRUDE_WITH_THAT_TRANSFORMATION_GET_LOST);
break;
}
case GUARDS_OF_THE_DAWN_3:
{
npc.broadcastPacket(new NpcSay(npc.getObjectId(), 0, npc.getId(), NpcStringId.WHO_ARE_YOU_A_NEW_FACE_LIKE_YOU_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 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
return super.onAdvEvent(event, npc, player);
}
private void enterInstance(L2PcInstance player, String template, Location loc)
@Override
public void onEnterInstance(L2PcInstance player, InstanceWorld world, boolean firstEntrance)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
if (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 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
final QuestState qs = talker.getQuestState(Q00195_SevenSignsSecretRitualOfThePriests.class.getSimpleName());
if ((qs != null) && qs.isCond(3) && hasQuestItems(talker, IDENTITY_CARD) && (talker.getTransformationId() == 113))
{
enterInstance(talker, "SanctumoftheLordsofDawn.xml", ENTER);
enterInstance(talker, new HSWorld(), "SanctumoftheLordsofDawn.xml", TEMPLATE_ID);
return "32575-01.html";
}
return "32575-02.html";
}
case IDENTITY_CONFIRM_DEVICE:
{
InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
final InstanceWorld tmpworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (tmpworld instanceof HSWorld)
{
if (hasQuestItems(talker, IDENTITY_CARD) && (talker.getTransformationId() == 113))
{
HSWorld world = (HSWorld) tmpworld;
final HSWorld world = (HSWorld) tmpworld;
if (world.doorst == 0)
{
openDoor(DOOR_ONE, world.getInstanceId());
@@ -227,7 +201,7 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
npc.decayMe();
for (int objId : world.getAllowed())
{
L2PcInstance pl = L2World.getInstance().getPlayer(objId);
final L2PcInstance pl = L2World.getInstance().getPlayer(objId);
if (pl != null)
{
pl.showQuestMovie(11);
@@ -243,10 +217,10 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
}
case PASSWORD_ENTRY_DEVICE:
{
InstanceWorld tmworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
final InstanceWorld tmworld = InstanceManager.getInstance().getWorld(npc.getInstanceId());
if (tmworld instanceof HSWorld)
{
HSWorld world = (HSWorld) tmworld;
final HSWorld world = (HSWorld) tmworld;
openDoor(DOOR_THREE, world.getInstanceId());
return "32577-01.html";
}
@@ -261,7 +235,7 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
}
case SHELF:
{
InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
final InstanceWorld world = InstanceManager.getInstance().getWorld(npc.getInstanceId());
InstanceManager.getInstance().getInstance(world.getInstanceId()).setDuration(300000);
talker.teleToLocation(-75925, 213399, -7128);
return "32580-01.html";
@@ -277,9 +251,4 @@ public final class SanctumOftheLordsOfDawn extends AbstractNpcAI
startQuestTimer("teleportPlayer", 2000, npc, player);
return super.onAggroRangeEnter(npc, player, isSummon);
}
public static void main(String[] args)
{
new SanctumOftheLordsOfDawn();
}
}
}