}
}
public void TiatEnter()
{
L2Player player = (L2Player) getSelf();
if(player == null)
{
return;
}
int instancedZoneId = 401;
if(player.getParty() == null || !player.getParty().isInCommandChannel())
{
player.sendPacket(Msg.YOU_CANNOT_ENTER_BECAUSE_YOU_ARE_NOT_IN_A_CURRENT_COMMAND_CHANNEL);
return;
}
L2CommandChannel cc = player.getParty().getCommandChannel();
if(cc.getChannelLeader() != player)
{
player.sendMessage("You must be leader of the command channel.");
return;
}
InstancedZoneManager izm = InstancedZoneManager.getInstance();
FastMap<Integer, InstancedZone> izs = InstancedZoneManager.getInstance().getById(instancedZoneId);
if(izs == null)
{
player.sendPacket(Msg.SYSTEM_ERROR);
return;
}
InstancedZone iz = izs.get(0);
assert iz != null;
String name = iz.getName();
int timelimit = iz.getTimelimit();
int minMembers = iz.getMinParty();
int maxMembers = iz.getMaxParty();
if(cc.getMemberCount() < minMembers)
{
player.sendMessage("The command channel must contains at least " + minMembers + " members.");
return;
}
if(cc.getMemberCount() > maxMembers)
{
player.sendMessage("The command channel must contains not more than " + maxMembers + " members.");
return;
}
for(L2Player member : cc.getMembers())
{
if(member.getLevel() < iz.getMinLevel() || member.getLevel() > iz.getMaxLevel())
{
cc.broadcastToChannelMembers(new SystemMessage(SystemMessage.C1S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(member));
return;
}
if(member.isCursedWeaponEquipped() || member.isInFlyingTransform() || member.isDead())
{
player.sendPacket(new SystemMessage(SystemMessage.C1S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(member));
return;
}
if(!player.isInRange(member, 500))
{
member.sendPacket(Msg.ITS_TOO_FAR_FROM_THE_NPC_TO_WORK);
player.sendPacket(Msg.ITS_TOO_FAR_FROM_THE_NPC_TO_WORK);
return;
}
if(izm.getTimeToNextEnterInstance(name, member) > 0)
{
cc.broadcastToChannelMembers(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
return;
}
}
Reflection r = new Reflection(name);
r.setInstancedZoneId(instancedZoneId);
for(InstancedZone i : izs.values())
{
if(r.getTeleportLoc() == null)
{
r.setTeleportLoc(i.getTeleportCoords());
}
r.FillSpawns(i.getSpawnsInfo());
r.FillDoors(i.getDoors());
}
r.setCoreLoc(r.getReturnLoc());
r.setReturnLoc(player.getLoc());
for(L2Player member : cc.getMembers())
{
member.setVar(name, String.valueOf(System.currentTimeMillis()));
member.setVar("backCoords", r.getReturnLoc().toXYZString());
member.teleToLocation(iz.getTeleportCoords(), r.getId());