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

    // You cannot do anything while fishing
    if (activeChar.isFishing()) {
      activeChar.sendPacket(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);
      return;
    }

    // check if the actionId is allowed
    if (_actionId < 2 || _actionId > 13) {
      Util.handleIllegalPlayerAction(
          activeChar,
          activeChar.getName()
              + " of account "
              + activeChar.getAccountName()
              + " requested an internal Social Action.",
          Config.DEFAULT_PUNISH);
      return;
    }

    if (!activeChar.isInStoreMode()
        && activeChar.getActiveRequester() == null
        && !activeChar.isAlikeDead()
        && (!activeChar.isAllSkillsDisabled() || activeChar.isInDuel())
        && activeChar.getAI().getIntention() == CtrlIntention.IDLE) {
      if (Config.DEBUG) _log.fine("Social Action: " + _actionId);

      activeChar.broadcastPacket(new SocialAction(activeChar, _actionId));
    }
  }
Example #2
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();
  }