Sync with L2JServer Feb 3rd 2015.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user