/** {@inheritDoc} */
  @Override
  protected void runImpl() {
    Player activePlayer = getConnection().getActivePlayer();

    Iterator<Player> it = World.getInstance().getPlayersIterator();

    List<Player> matches = new ArrayList<Player>(MAX_RESULTS);

    if (activePlayer != null && activePlayer.getLevel() < 10) {
      sendPacket(SM_SYSTEM_MESSAGE.LEVEL_NOT_ENOUGH_FOR_SEARCH("10"));
      return;
    }
    while (it.hasNext() && matches.size() < MAX_RESULTS) {
      Player player = it.next();
      if (!player.isSpawned()) continue;
      else if (player.getFriendList().getStatus() == Status.OFFLINE) continue;
      else if (lfgOnly == 1 && !player.isLookingForGroup()) continue;
      else if (!name.isEmpty() && !player.getName().toLowerCase().contains(name.toLowerCase()))
        continue;
      else if (minLevel != 0xFF && player.getLevel() < minLevel) continue;
      else if (maxLevel != 0xFF && player.getLevel() > maxLevel) continue;
      else if (classMask > 0 && (player.getPlayerClass().getMask() & classMask) == 0) continue;
      else if (region > 0 && player.getActiveRegion().getMapId() != region) continue;
      else if ((player.getCommonData().getRace() != activePlayer.getCommonData().getRace())
          && (CustomConfig.FACTIONS_SEARCH_MODE == false)) continue;
      else
      // This player matches criteria
      {
        matches.add(player);
      }
    }

    sendPacket(new SM_PLAYER_SEARCH(matches, region));
  }
Ejemplo n.º 2
0
 /**
  * This method is called just after player logged in to the game.<br>
  * <br>
  * <b><font color='red'>NOTICE: </font> This method called only from {@link CM_ENTER_WORLD} and
  * must not be called from anywhere else.</b>
  *
  * @param player
  */
 public static void playerLoggedIn(Player player) {
   log.info(
       "Player logged in: "
           + player.getName()
           + " Account: "
           + player.getClientConnection().getAccount().getName());
   player.getCommonData().setOnline(true);
   DAOManager.getDAO(PlayerDAO.class).onlinePlayer(player, true);
   player.getFriendList().setStatus(Status.ONLINE);
   player.onLoggedIn();
 }
Ejemplo n.º 3
0
  /** {@inheritDoc} */
  @Override
  protected void runImpl() {

    Player activePlayer = getConnection().getActivePlayer();
    Friend target = activePlayer.getFriendList().getFriend(targetName);
    if (target == null) {
      log.warn(
          activePlayer.getName()
              + " tried to delete friend "
              + targetName
              + " who is not his friend");
      sendPacket(SM_SYSTEM_MESSAGE.BUDDYLIST_NOT_IN_LIST);
    } else {
      SocialService.deleteFriend(activePlayer, target.getOid());
    }
  }
Ejemplo n.º 4
0
  /** {@inheritDoc} */
  @Override
  protected void runImpl() {
    Player activePlayer = getConnection().getActivePlayer();

    if (!note.equals(activePlayer.getCommonData().getNote())) {

      activePlayer.getCommonData().setNote(note);

      for (Friend friend : activePlayer.getFriendList()) // For all my friends
      {

        if (friend.isOnline()) // If the player is online
        {
          friend
              .getPlayer()
              .getClientConnection()
              .sendPacket(new SM_FRIEND_LIST()); // Send him a new friend list packet
        }
      }
    }
  }