Package l2p.gameserver.instancemanager.InstancedZoneManager

Examples of l2p.gameserver.instancemanager.InstancedZoneManager.InstancedZone


    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;
        }
      }
    }
    Reflection r = new Reflection(iz);
    r.setInstancedZoneId(instancedZoneId);
    for(InstancedZone i : izs.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());
    }
    if(minParty <= 1) // для соло инстансов без босса флаг ставится при входе
    {
      player.setVar(name, String.valueOf(System.currentTimeMillis()));
    }
    for(L2Player member : player.getParty().getPartyMembers())
    {
      if(dispellBuffs)
      {
        for(L2Effect e : member.getEffectList().getAllEffects())
        {
          if(!e.getSkill().isOffensive() && !e.getSkill().getName().startsWith("Adventurer's "))
          {
            e.exit();
          }
        }
        if(member.getPet() != null)
        {
          for(L2Effect e : member.getPet().getEffectList().getAllEffects())
          {
            if(!e.getSkill().isOffensive() && !e.getSkill().getName().startsWith("Adventurer's "))
            {
              e.exit();
            }
          }
        }
      }
      member.setVar("backCoords", r.getReturnLoc().toXYZString());
      member.teleToLocation(iz.getTeleportCoords(), r.getId());
    }
    player.getParty().setReflection(r);
    r.setParty(player.getParty());
    if(timelimit > 0)
    {
View Full Code Here


    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 min_level = iz.getMinLevel();
    int max_level = iz.getMaxLevel();
    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;
    }
View Full Code Here

    if(izs == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return;
    }
    InstancedZone iz = izs.get(0);
    assert iz != null;
    if(player.getLevel() < iz.getMinLevel() || player.getLevel() > iz.getMaxLevel() || player.isInFlyingTransform())
    {
      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 r = ReflectionTable.SOD_REFLECTION_ID == 0 ? null : ReflectionTable.getInstance().get(ReflectionTable.SOD_REFLECTION_ID);
    if(ReflectionTable.SOD_REFLECTION_ID > 0 && r != null)
    {
      player.setVar("backCoords", r.getReturnLoc().toXYZString());
      player.teleToLocation(r.getTeleportLoc(), r.getId());
      return;
    }
    else
    {
      r = new Reflection(iz.getName());
      r.setInstancedZoneId(instancedZoneId);
      ReflectionTable.SOD_REFLECTION_ID = r.getId();
    }
    long timelimit = 0;
    if(instancedZoneId == 400)
View Full Code Here

    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());
    }
    cc.setReflection(r);
    r.setCommandChannel(cc);
    if(timelimit > 0)
    {
View Full Code Here

    if(ils == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return;
    }
    InstancedZone il = ils.get(0);
    assert il != null;
    String name = il.getName();
    int timelimit = il.getTimelimit();
    int min_level = il.getMinLevel();
    int max_level = il.getMaxLevel();
    int minParty = il.getMinParty();
    int maxParty = il.getMaxParty();
    if(minParty > 1 && !player.isInParty())
    {
      player.sendPacket(Msg.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
      return;
    }
    if(player.isInParty())
    {
      if(player.getParty().isInReflection())
      {
        player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
        return;
      }
      for(L2Player member : player.getParty().getPartyMembers())
      {
        if(ilm.getTimeToNextEnterInstance(name, member) > 0)
        {
          player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
          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(member.getClassId().getLevel() > 1 || member.isCursedWeaponEquipped())
        {
          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;
        }
      }
    }
    Reflection r = new Reflection(name);
    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.instanceId = r.getId();
    worlds.put(r.getId(), world);
    for(L2Player member : player.getParty().getPartyMembers())
    {
      npc.makeSupportMagic(player);
      if(member != player)
      {
        newQuestState(member, STARTED);
      }
      member.setReflection(r);
      member.teleToLocation(il.getTeleportCoords());
      member.setVar("backCoords", r.getReturnLoc().toXYZString());
      member.setVar(name, String.valueOf(System.currentTimeMillis()));
    }
    player.getParty().setReflection(r);
    r.setParty(player.getParty());
View Full Code Here

    if(ils == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return;
    }
    InstancedZone il = ils.get(0);
    assert il != null;
    String name = il.getName();
    int timelimit = il.getTimelimit();
    int min_level = il.getMinLevel();
    int max_level = il.getMaxLevel();
    int minParty = il.getMinParty();
    int maxParty = il.getMaxParty();
    if(minParty > 1 && !player.isInParty())
    {
      player.sendPacket(Msg.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
      return;
    }
    if(player.isInParty())
    {
      if(player.getParty().isInReflection())
      {
        player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
        return;
      }
      for(L2Player member : player.getParty().getPartyMembers())
      {
        if(ilm.getTimeToNextEnterInstance(name, member) > 0)
        {
          player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
          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;
        }
      }
    }
    player.getInventory().destroyItemByItemId(CONTAMINATED_CRYSTAL, 1, true);
    player.sendPacket(SystemMessage.removeItems(CONTAMINATED_CRYSTAL, 1));
    Reflection r = new Reflection(name);
    r.setInstancedZoneId(instancedZoneId);
    for(InstancedZone i : ils.values())
    {
      if(r.getReturnLoc() == null)
      {
        r.setReturnLoc(i.getReturnCoords());
      }
      if(r.getTeleportLoc() == null)
      {
        r.setTeleportLoc(i.getTeleportCoords());
      }
      if(i.getDoors() != null)
      {
        for(L2DoorInstance d : i.getDoors())
        {
          L2DoorInstance door = d.clone();
          r.addDoor(door);
          door.setReflection(r);
          door.spawnMe();
          if(d.isOpen())
          {
            door.openMe();
          }
        }
      }
    }
    World world = new World();
    world.rewarded = new GArray<Integer>();
    world.instanceId = r.getId();
    world.bosses = 5;
    worlds.put(r.getId(), world);
    if(type == 1)
    {
      runEmeraldAndSteamFirstRoom(world);
      r.openDoor(DOOR1);
      r.openDoor(DOOR2);
    }
    else if(type == 2)
    {
      runCoralGardenHall(world);
      r.openDoor(CORAL_GARDEN_GATEWAY);
    }
    for(L2Player member : player.getParty().getPartyMembers())
    {
      if(member != player)
      {
        newQuestState(member, STARTED);
      }
      member.setReflection(r);
      member.teleToLocation(il.getTeleportCoords());
      member.setVar("backCoords", r.getReturnLoc().toXYZString());
      member.setVar(name, String.valueOf(System.currentTimeMillis()));
    }
    player.getParty().setReflection(r);
    r.setParty(player.getParty());
View Full Code Here

    if(ils == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return null;
    }
    InstancedZone il = ils.get(0);
    assert il != null;
    String name = il.getName();
    int timelimit = il.getTimelimit();
    int min_level = il.getMinLevel();
    int max_level = il.getMaxLevel();
    int minParty = il.getMinParty();
    int maxParty = il.getMaxParty();
    if(minParty > 1 && !player.isInParty())
    {
      player.sendPacket(Msg.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
      return null;
    }
    if(player.isInParty())
    {
      if(player.getParty().isInReflection())
      {
        player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
        return null;
      }
      for(L2Player member : player.getParty().getPartyMembers())
      {
        if(ilm.getTimeToNextEnterInstance(name, member) > 0)
        {
          player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
          return null;
        }
      }
      if(!player.getParty().isLeader(player))
      {
        player.sendPacket(Msg.ONLY_A_PARTY_LEADER_CAN_TRY_TO_ENTER);
        return null;
      }
      if(player.getParty().getMemberCount() > maxParty)
      {
        player.sendPacket(Msg.YOU_CANNOT_ENTER_DUE_TO_THE_PARTY_HAVING_EXCEEDED_THE_LIMIT);
        return null;
      }
      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 null;
        }
        if(member.getClan() != player.getClan())
        {
          return "gludio_fort_a_campkeeper_q0511_01a.htm";
        }
        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 null;
        }
      }
    }
    Prison prison = null;
    if(!_prisons.isEmpty())
    {
      prison = _prisons.get(fort.getId());
      if(prison != null && prison.isLocked())
      {
        // TODO правильное сообщение
        player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
        return null;
      }
    }
    prison = new Prison(fort.getId(), ils);
    _prisons.put(prison.getFortId(), prison);
    Reflection r = ReflectionTable.getInstance().get(prison.getReflectionId());
    r.setReturnLoc(player.getLoc());
    for(L2Player member : player.getParty().getPartyMembers())
    {
      if(member != player)
      {
        newQuestState(member, STARTED);
      }
      member.setReflection(r);
      member.teleToLocation(il.getTeleportCoords());
      member.setVar("backCoords", r.getReturnLoc().toXYZString());
      member.setVar(name, String.valueOf(System.currentTimeMillis()));
    }
    player.getParty().setReflection(r);
    r.setParty(player.getParty());
View Full Code Here

    if(ils == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return null;
    }
    InstancedZone il = ils.get(0);
    assert il != null;
    String name = il.getName();
    int timelimit = il.getTimelimit();
    int min_level = il.getMinLevel();
    int max_level = il.getMaxLevel();
    int minParty = il.getMinParty();
    int maxParty = il.getMaxParty();
    if(minParty > 1 && !player.isInParty())
    {
      player.sendPacket(Msg.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
      return null;
    }
    if(player.isInParty())
    {
      if(player.getParty().isInReflection())
      {
        player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
        return null;
      }
      for(L2Player member : player.getParty().getPartyMembers())
      {
        if(ilm.getTimeToNextEnterInstance(name, member) > 0)
        {
          player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
          return null;
        }
      }
      if(!player.getParty().isLeader(player))
      {
        player.sendPacket(Msg.ONLY_A_PARTY_LEADER_CAN_TRY_TO_ENTER);
        return null;
      }
      if(player.getParty().getMemberCount() > maxParty)
      {
        player.sendPacket(Msg.YOU_CANNOT_ENTER_DUE_TO_THE_PARTY_HAVING_EXCEEDED_THE_LIMIT);
        return null;
      }
      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 null;
        }
        if(member.getClan() != player.getClan())
        {
          return "gludio_prison_keeper_q0512_01a.htm";
        }
        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 null;
        }
      }
    }
    Prison prison = null;
    if(!_prisons.isEmpty())
    {
      prison = _prisons.get(castle.getId());
      if(prison != null && prison.isLocked())
      {
        // TODO правильное сообщение
        player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(player));
        return null;
      }
    }
    prison = new Prison(castle.getId(), ils);
    _prisons.put(prison.getCastleId(), prison);
    Reflection r = ReflectionTable.getInstance().get(prison.getReflectionId());
    r.setReturnLoc(player.getLoc());
    for(L2Player member : player.getParty().getPartyMembers())
    {
      if(member != player)
      {
        newQuestState(member, STARTED);
      }
      member.setReflection(r);
      member.setVar("backCoords", r.getReturnLoc().toXYZString());
      member.teleToLocation(il.getTeleportCoords());
      member.setVar("backCoords", r.getReturnLoc().toXYZString());
      member.setVar(name, String.valueOf(System.currentTimeMillis()));
    }
    player.getParty().setReflection(r);
    r.setParty(player.getParty());
View Full Code Here

    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());
    }
    int timelimit = il.getTimelimit();
    player.setReflection(r);
    player.teleToLocation(il.getTeleportCoords());
    player.setVar("backCoords", r.getReturnLoc().toXYZString());
    player.sendPacket(new SystemMessage(SystemMessage.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTES).addNumber(timelimit));
    r.setNotCollapseWithoutPlayers(true);
    r.startCollapseTimer(timelimit * 60 * 1000L);
    _instances.put(player.getObjectId(), r.getId());
View Full Code Here

    if(ils == null)
    {
      player.sendPacket(Msg.SYSTEM_ERROR);
      return;
    }
    InstancedZone il = ils.get(0);
    assert il != null;
    String name = il.getName();
    int timelimit = il.getTimelimit();
    int min_level = il.getMinLevel();
    int max_level = il.getMaxLevel();
    int minParty = il.getMinParty();
    int maxParty = il.getMaxParty();
    if(minParty > 1 && !player.isInParty())
    {
      player.sendPacket(Msg.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER);
      return;
    }
    if(player.isInParty())
    {
      // TODO возможно, лучше запретить повторный вход "вылетевших"
      if(player.getParty().isInReflection())
      {
        Reflection old_ref = ReflectionTable.getInstance().get(player.getParty().getReflection().getId());
        if(old_ref != null && worlds.containsKey(old_ref.getId()))
        {
          player.setReflection(old_ref);
          player.teleToLocation(old_ref.getTeleportLoc());
          return;
        }
      }
      for(L2Player member : player.getParty().getPartyMembers())
      {
        if(ilm.getTimeToNextEnterInstance(name, member) > 0)
        {
          player.sendPacket(new SystemMessage(SystemMessage.C1_MAY_NOT_RE_ENTER_YET).addName(member));
          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(member.isCursedWeaponEquipped())
        {
          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;
        }
      }
    }
    Reflection r = new Reflection(name);
    r.setInstancedZoneId(instancedZoneId);
    for(InstancedZone i : ils.values())
    {
      if(r.getReturnLoc() == null)
      {
        r.setReturnLoc(i.getReturnCoords());
      }
      if(r.getTeleportLoc() == null)
      {
        r.setTeleportLoc(i.getTeleportCoords());
      }
      if(i.getDoors() != null)
      {
        for(L2DoorInstance d : i.getDoors())
        {
          L2DoorInstance door = d.clone();
          r.addDoor(door);
          door.setReflection(r);
          door.spawnMe();
          if(d.isOpen())
          {
            door.openMe();
          }
        }
      }
    }
    World world = new World();
    world.rewarded = new GArray<Long>();
    world.instanceId = r.getId();
    worlds.put(r.getId(), world);
    runStartRoom(world);
    for(L2Player member : player.getParty().getPartyMembers())
    {
      if(member != player)
      {
        newQuestState(member, STARTED);
      }
      member.setReflection(r);
      member.teleToLocation(il.getTeleportCoords());
      member.setVar("backCoords", r.getReturnLoc().toXYZString());
      member.setVar(name, String.valueOf(System.currentTimeMillis()));
    }
    player.getParty().setReflection(r);
    r.setParty(player.getParty());
View Full Code Here

TOP

Related Classes of l2p.gameserver.instancemanager.InstancedZoneManager.InstancedZone

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.