Exemplo n.º 1
0
  @Override
  protected final void writeImpl() {
    if (getClient().getActiveChar() == null) return;

    for (PartyMatchRoom room : PartyMatchRoomList.getInstance().getRooms()) {
      if (room.getMembersCount() < 1
          || room.getOwner() == null
          || room.getOwner().isOnline() == 0
          || room.getOwner().getPartyRoom() != room.getId()) {
        PartyMatchRoomList.getInstance().deleteRoom(room.getId());
        continue;
      }
      if (_loc > 0 && _loc != room.getLocation()) continue;
      if (_lim == 0
          && ((_cha.getLevel() < room.getMinLvl()) || (_cha.getLevel() > room.getMaxLvl())))
        continue;
      _rooms.add(room);
    }
    int count = 0;
    int size = _rooms.size();

    writeC(0x96);
    if (size > 0) writeD(1);
    else writeD(0);

    writeD(_rooms.size());
    while (size > count) {
      writeD(_rooms.get(count).getId());
      writeS(_rooms.get(count).getTitle());
      writeD(_rooms.get(count).getLocation());
      writeD(_rooms.get(count).getMinLvl());
      writeD(_rooms.get(count).getMaxLvl());
      writeD(_rooms.get(count).getMembersCount());
      writeD(_rooms.get(count).getMaxMembers());
      writeS(_rooms.get(count).getOwner().getName());
      count++;
    }
  }
Exemplo n.º 2
0
  @Override
  protected void runImpl() {
    if (getClient().getActiveChar() == null) return;

    L2PcInstance _activeChar = getClient().getActiveChar();

    PartyMatchRoom _room = PartyMatchRoomList.getInstance().getRoom(_roomid);
    if (_room == null) return;

    if ((_activeChar.getLevel() >= _room.getMinLvl())
        && (_activeChar.getLevel() <= _room.getMaxLvl())) {
      // Remove from waiting list
      PartyMatchWaitingList.getInstance().removePlayer(_activeChar);

      _activeChar.setPartyRoom(_roomid);

      _activeChar.sendPacket(new PartyMatchDetail(_activeChar, _room));
      _activeChar.sendPacket(new ExPartyRoomMember(_activeChar, _room, 0));

      for (L2PcInstance _member : _room.getPartyMembers()) {
        if (_member == null) continue;

        _member.sendPacket(new ExManagePartyRoomMember(_activeChar, _room, 0));

        SystemMessage sm = new SystemMessage(SystemMessageId.S1_ENTERED_PARTY_ROOM);
        sm.addString(_activeChar.getName());
        _member.sendPacket(sm);
      }
      _room.addMember(_activeChar);

      // Info Broadcast
      _activeChar.broadcastUserInfo();
    } else {
      _activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_ENTER_PARTY_ROOM));
    }
  }