if(player == null)
{
return;
}
int instancedZoneId = Integer.parseInt(param[0]);
InstancedZoneManager izm = InstancedZoneManager.getInstance();
FastMap<Integer, InstancedZone> izs = izm.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();
boolean dispellBuffs = iz.isDispellBuffs();
int min_level = iz.getMinLevel();
int max_level = iz.getMaxLevel();
int minParty = iz.getMinParty();
int maxParty = iz.getMaxParty();
if(!player.isInParty())
{
player.sendPacket(Msg.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
return;
}
if(player.getParty().isInReflection())
{
if(player.getLevel() < min_level || player.getLevel() > max_level)
{
player.sendPacket(new SystemMessage(SystemMessage.C1S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(player));
return;
}
if(player.isCursedWeaponEquipped())
{
player.sendPacket(new SystemMessage(SystemMessage.C1S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(player));
return;
}
Reflection old_ref = player.getParty().getReflection();
if(old_ref != null)
{
if(!iz.equals(old_ref.getInstancedZone()))
{
player.sendMessage("Your party is in instanced zone already.");
return;
}
if(!Config.ALT_KAMALOKA_LIMITS.equalsIgnoreCase("Leader") && izm.getTimeToNextEnterInstance(name, player) > 0)
{
player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
return;
}
if(player.getLevel() < min_level || player.getLevel() > max_level)
{
player.sendPacket(new SystemMessage(SystemMessage.C1S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(player));
return;
}
player.teleToLocation(old_ref.getTeleportLoc(), old_ref.getId());
if(dispellBuffs)
{
for(L2Effect e : player.getEffectList().getAllEffects())
{
if(!e.getSkill().isOffensive() && !e.getSkill().getName().startsWith("Adventurer's "))
{
e.exit();
}
}
if(player.getPet() != null)
{
for(L2Effect e : player.getPet().getEffectList().getAllEffects())
{
if(!e.getSkill().isOffensive() && !e.getSkill().getName().startsWith("Adventurer's "))
{
e.exit();
}
}
}
}
return;
}
}
if(!player.getParty().isLeader(player))
{
player.sendPacket(Msg.ONLY_A_PARTY_LEADER_CAN_TRY_TO_ENTER);
return;
}
if(player.getParty().getMemberCount() > maxParty)
{
player.sendPacket(Msg.YOU_CANNOT_ENTER_DUE_TO_THE_PARTY_HAVING_EXCEEDED_THE_LIMIT);
return;
}
for(L2Player member : player.getParty().getPartyMembers())
{
if(member.getLevel() < min_level || member.getLevel() > max_level)
{
SystemMessage sm = new SystemMessage(SystemMessage.C1S_LEVEL_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(member);
member.sendPacket(sm);
player.sendPacket(sm);
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(Config.ALT_KAMALOKA_LIMITS.equalsIgnoreCase("Leader"))
{
if(izm.getTimeToNextEnterInstance(name, player) > 0)
{
player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
return;
}
}
else
{
for(L2Player member : player.getParty().getPartyMembers())
{
if(izm.getTimeToNextEnterInstance(name, member) > 0)
{
player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
return;
}
}