if(ils == null)
{
player.sendPacket(Msg.SYSTEM_ERROR);
return;
}
InstancedZone il = ils.get(0);
assert il != null;
if(player.isInParty())
{
player.sendPacket(Msg.A_PARTY_CANNOT_BE_FORMED_IN_THIS_AREA);
return;
}
if(player.isCursedWeaponEquipped())
{
player.sendPacket(new SystemMessage(SystemMessage.C1S_QUEST_REQUIREMENT_IS_NOT_SUFFICIENT_AND_CANNOT_BE_ENTERED).addName(player));
return;
}
Long old = _instances.get(player.getObjectId());
if(old != null)
{
Reflection old_r = ReflectionTable.getInstance().get(old);
if(old_r != null)
{
player.setReflection(old_r);
player.teleToLocation(il.getTeleportCoords());
player.setVar("backCoords", old_r.getReturnLoc().toXYZString());
return;
}
}
Reflection r = new Reflection(il.getName());
r.setInstancedZoneId(instancedZoneId);
for(InstancedZone i : ils.values())
{
if(r.getReturnLoc() == null)
{
r.setReturnLoc(i.getReturnCoords());
}
if(r.getTeleportLoc() == null)
{
r.setTeleportLoc(i.getTeleportCoords());
}
r.FillSpawns(i.getSpawnsInfo());
r.FillDoors(i.getDoors());
}
World world = new World();
world.rooms = new GArray<Room>();
world.instanceId = r.getId();
world.status = 0;
worlds.put(r.getId(), world);
runTheSanctum(world);
int timelimit = il.getTimelimit();
player.setReflection(r);
player.teleToLocation(il.getTeleportCoords());
player.setVar("backCoords", r.getReturnLoc().toXYZString());
r.setNotCollapseWithoutPlayers(true);
r.startCollapseTimer(timelimit * 60 * 1000L);
_instances.put(player.getObjectId(), r.getId());
}