/** Method runImpl. */
  @Override
  protected void runImpl() {
    Player player = getClient().getActiveChar();

    if (player == null) {
      return;
    }

    Party party = player.getParty();
    CommandChannel channel = party != null ? party.getCommandChannel() : null;

    if ((channel != null) && (channel.getChannelLeader() == player)) {
      if ((channel.getMatchingRoom() == null) && (party != null)) {
        CCMatchingRoom room =
            new CCMatchingRoom(
                player, 1, player.getLevel(), 50, party.getLootDistribution(), player.getName());
        channel.setMatchingRoom(room);
      }
    } else if ((channel != null) && !channel.getParties().contains(party)) {
      player.sendPacket(
          SystemMsg
              .THE_COMMAND_CHANNEL_AFFILIATED_PARTYS_PARTY_MEMBER_CANNOT_USE_THE_MATCHING_SCREEN);
    } else if ((party != null) && !party.isLeader(player)) {
      player.sendPacket(
          SystemMsg
              .THE_LIST_OF_PARTY_ROOMS_CAN_ONLY_BE_VIEWED_BY_A_PERSON_WHO_IS_NOT_PART_OF_A_PARTY);
    } else {
      MatchingRoomManager.getInstance().addToWaitingList(player);
      player.sendPacket(new ListPartyWaiting(_region, _allLevels == 1, _page, player));
    }
  }
Пример #2
0
  /**
   * Method sendOrderToMinions.
   *
   * @param actor NpcInstance
   */
  private void sendOrderToMinions(NpcInstance actor) {
    if (!actor.isInCombat()) {
      _lastMinionsTargetRef = HardReferences.emptyRef();
      return;
    }

    final MinionList ml = actor.getMinionList();

    if ((ml == null) || !ml.hasMinions()) {
      _lastMinionsTargetRef = HardReferences.emptyRef();
      return;
    }

    final long now = System.currentTimeMillis();

    if ((_nextOrderTime > now) && (_lastMinionsTargetRef.get() != null)) {
      final Player old_target = _lastMinionsTargetRef.get();

      if ((old_target != null) && !old_target.isAlikeDead()) {
        for (MinionInstance m : ml.getAliveMinions()) {
          if (!m.getAI().getAttackTarget().equals(old_target)) {
            m.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, old_target, 10000000);
          }
        }

        return;
      }
    }

    _nextOrderTime = now + 30000;
    final List<Player> pl = World.getAroundPlayers(actor);

    if (pl.isEmpty()) {
      _lastMinionsTargetRef = HardReferences.emptyRef();
      return;
    }

    final List<Player> alive = new LazyArrayList<>();

    for (Player p : pl) {
      if (!p.isAlikeDead()) {
        alive.add(p);
      }
    }

    if (alive.isEmpty()) {
      _lastMinionsTargetRef = HardReferences.emptyRef();
      return;
    }

    final Player target = alive.get(Rnd.get(alive.size()));
    _lastMinionsTargetRef = target.getRef();
    Functions.npcSay(actor, "You " + target.getName() + "! Attack them!");

    for (MinionInstance m : ml.getAliveMinions()) {
      m.getAggroList().clear();
      m.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, target, 10000000);
    }
  }
Пример #3
0
  @Override
  protected void writeImpl() {
    writeEx(0x98);
    writeD(0x00);
    writeD(_roomNumber);
    writeD(_timeleft);
    writeD(_bluePlayers.size());

    for (Player player : _bluePlayers) {
      writeD(player.getObjectId());
      writeS(player.getName());
    }

    writeD(_redPlayers.size());

    for (Player player : _redPlayers) {
      writeD(player.getObjectId());
      writeS(player.getName());
    }
  }
  /** Method runImpl. */
  @Override
  protected void runImpl() {
    Player activeChar = getClient().getActiveChar();

    if (activeChar == null) {
      return;
    }

    if (activeChar.getNoChannel() != 0) {
      if ((activeChar.getNoChannelRemained() > 0) || (activeChar.getNoChannel() < 0)) {
        activeChar.sendPacket(
            new SystemMessage(
                SystemMessage
                    .CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_BECOME_EVEN_LONGER));
        return;
      }

      activeChar.updateNoChannel(0);
    }

    Player targetPlayer = World.getPlayer(_reciever);

    if (targetPlayer == null) {
      activeChar.sendPacket(new SystemMessage(SystemMessage.THAT_PLAYER_IS_NOT_ONLINE));
      return;
    }

    if (targetPlayer.isBlockAll()) {
      activeChar.sendPacket(
          new SystemMessage(SystemMessage.THE_PERSON_IS_IN_A_MESSAGE_REFUSAL_MODE));
      return;
    }

    if (!activeChar.getFriendList().getList().containsKey(targetPlayer.getObjectId())) {
      return;
    }

    Log.LogChat("FRIENDTELL", activeChar.getName(), _reciever, _message);
    L2FriendSay frm = new L2FriendSay(activeChar.getName(), _reciever, _message);
    targetPlayer.sendPacket(frm);
  }
Пример #5
0
  /**
   * Method useAdminCommand.
   *
   * @param command String
   * @param wordList String[]
   * @param fullString String
   * @param activeChar Player
   * @return boolean
   * @see lineage2.gameserver.handlers.IAdminCommandHandler#useAdminCommand(String, String[],
   *     String, Player)
   */
  @Override
  public boolean useAdminCommand(
      String command, String[] wordList, String fullString, Player activeChar) {
    if (!activeChar.getPlayerAccess().CanKick) {
      return false;
    }

    switch (command) {
      case "admin_disconnect":
      case "admin_kick":
        final Player player;

        if (wordList.length == 1) {
          GameObject target = activeChar.getTarget();

          if (target == null) {
            activeChar.sendMessage("Select character or specify player name.");
            break;
          }

          if (!target.isPlayer()) {
            activeChar.sendPacket(new SystemMessage(SystemMessage.INVALID_TARGET));
            break;
          }

          player = (Player) target;
        } else {
          player = World.getPlayer(wordList[1]);

          if (player == null) {
            activeChar.sendMessage("Character " + wordList[1] + " not found in game.");
            break;
          }
        }

        if (player.getObjectId() == activeChar.getObjectId()) {
          activeChar.sendMessage("You can't logout your character.");
          break;
        }

        activeChar.sendMessage("Character " + player.getName() + " disconnected from server.");

        if (player.isInOfflineMode()) {
          player.setOfflineMode(false);
          player.kick();
          return true;
        }

        player.sendMessage("You where kicked by a GM.");
        player.sendPacket(
            new SystemMessage(
                SystemMessage.YOU_HAVE_BEEN_DISCONNECTED_FROM_THE_SERVER_PLEASE_LOGIN_AGAIN));
        ThreadPoolManager.getInstance()
            .schedule(
                new RunnableImpl() {
                  @Override
                  public void runImpl() {
                    player.kick();
                  }
                },
                500);
        break;
    }

    return true;
  }