예제 #1
0
  @Override
  protected void runImpl() {
    final L2PcInstance player = getClient().getActiveChar();
    if (player == null) return;

    final L2PcInstance partner = player.getActiveRequester();
    if (partner == null || L2World.getInstance().getPlayer(partner.getObjectId()) == null) {
      // Partner hasn't be found, cancel the invitation
      player.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME);
      player.setActiveRequester(null);
      return;
    }

    // If answer is positive, join the requester's PartyRoom.
    if (_answer == 1 && !partner.isRequestExpired()) {
      PartyMatchRoom _room = PartyMatchRoomList.getInstance().getRoom(partner.getPartyRoom());
      if (_room == null) return;

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

        player.setPartyRoom(partner.getPartyRoom());

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

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

          _member.sendPacket(new ExManagePartyRoomMember(player, _room, 0));
          _member.sendPacket(
              SystemMessage.getSystemMessage(SystemMessageId.S1_ENTERED_PARTY_ROOM)
                  .addPcName(player));
        }
        _room.addMember(player);

        // Info Broadcast
        player.broadcastUserInfo();
      } else player.sendPacket(SystemMessageId.CANT_ENTER_PARTY_ROOM);
    }
    // Else, send a message to requester.
    else partner.sendPacket(SystemMessageId.PARTY_MATCHING_REQUEST_NO_RESPONSE);

    // reset transaction timers
    player.setActiveRequester(null);
    partner.onTransactionResponse();
  }
  @Override
  protected void runImpl() {
    final L2PcInstance _activeChar = getClient().getActiveChar();
    if (_activeChar == null) return;

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

    if ((_activeChar.isInParty() && _room.getOwner().isInParty())
        && (_activeChar.getParty().getPartyLeaderOID()
            == _room.getOwner().getParty().getPartyLeaderOID())) {
      // If user is in party with Room Owner is not removed from Room
    } else {
      _room.deleteMember(_activeChar);
      _activeChar.setPartyRoom(0);
      _activeChar.broadcastUserInfo();

      _activeChar.sendPacket(ExClosePartyRoom.STATIC_PACKET);
      _activeChar.sendPacket(SystemMessageId.PARTY_ROOM_EXITED);
    }
  }