Esempio n. 1
0
    public PlayerCondition(L2PcInstance player, boolean partyDuel) {
      if (player == null) {
        return;
      }
      _player = player;
      _hp = _player.getCurrentHp();
      _mp = _player.getCurrentMp();
      _cp = _player.getCurrentCp();
      _paDuel = partyDuel;

      if (_paDuel) {
        _x = _player.getX();
        _y = _player.getY();
        _z = _player.getZ();
      }
    }
Esempio n. 2
0
  public void teleportGroup(L2PcInstance player) {
    removeDead();

    for (L2ControllableMobInstance mobInst : getMobs()) {
      if (mobInst == null) {
        continue;
      }

      if (!mobInst.isDead()) {
        int x = player.getX() + Rnd.nextInt(50);
        int y = player.getY() + Rnd.nextInt(50);

        mobInst.teleToLocation(x, y, player.getZ(), true);
        L2ControllableMobAI ai = (L2ControllableMobAI) mobInst.getAI();
        ai.follow(player);
      }
    }
  }
Esempio n. 3
0
 public void spawnGroup(L2PcInstance activeChar) {
   spawnGroup(activeChar.getX(), activeChar.getY(), activeChar.getZ());
 }
  public synchronized void start(L2PcInstance player, byte type, L2Npc npc) {
    boolean canPass = true;
    if (!player.isInParty()) {
      showHtmlFile(player, "data/html/seven_signs/rift/NoParty.htm", npc);
      return;
    }

    if (player.getParty().getPartyLeaderOID() != player.getObjectId()) {
      showHtmlFile(player, "data/html/seven_signs/rift/NotPartyLeader.htm", npc);
      return;
    }

    if (player.getParty().isInDimensionalRift()) {
      handleCheat(player, npc);
      return;
    }

    if (player.getParty().getMemberCount() < Config.RIFT_MIN_PARTY_SIZE) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/SmallParty.htm");
      html.replace("%npc_name%", npc.getName());
      html.replace("%count%", Integer.toString(Config.RIFT_MIN_PARTY_SIZE));
      player.sendPacket(html);
      return;
    }

    // max parties inside is rooms count - 1
    if (!isAllowedEnter(type)) {
      player.sendMessage("Rift is full. Try later.");
      return;
    }

    for (L2PcInstance p : player.getParty().getPartyMembers())
      if (!checkIfInPeaceZone(p.getX(), p.getY(), p.getZ())) {
        canPass = false;
        break;
      }

    if (!canPass) {
      showHtmlFile(player, "data/html/seven_signs/rift/NotInWaitingRoom.htm", npc);
      return;
    }

    L2ItemInstance i;
    int count = getNeededItems(type);
    for (L2PcInstance p : player.getParty().getPartyMembers()) {
      i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID);

      if (i == null) {
        canPass = false;
        break;
      }

      if (i.getCount() > 0) {
        if (i.getCount() < getNeededItems(type)) {
          canPass = false;
          break;
        }
      } else {
        canPass = false;
        break;
      }
    }

    if (!canPass) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/NoFragments.htm");
      html.replace("%npc_name%", npc.getName());
      html.replace("%count%", Integer.toString(count));
      player.sendPacket(html);
      return;
    }

    for (L2PcInstance p : player.getParty().getPartyMembers()) {
      i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID);
      if (!p.destroyItem("RiftEntrance", i, count, null, false)) {
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/NoFragments.htm");
        html.replace("%npc_name%", npc.getName());
        html.replace("%count%", Integer.toString(count));
        player.sendPacket(html);
        return;
      }
    }

    byte room;
    FastList<Byte> emptyRooms;
    do {
      emptyRooms = getFreeRooms(type);
      room = emptyRooms.get(Rnd.get(1, emptyRooms.size()) - 1);
    }
    // find empty room
    while (_rooms.get(type).get(room).ispartyInside());
    new DimensionalRift(player.getParty(), type, room);
  }