Exemple #1
0
 public static final int getPartyRoomState(L2PcInstance player) {
   L2PartyRoom room = player.getPartyRoom();
   if (room == null) return 0;
   if (room.getLeader() == player) return 1;
   L2Party party = room.getParty();
   if (party != null && party == player.getParty()) return 2;
   return 0;
 }
Exemple #2
0
  /**
   * Verifies if player can join the given party room and either adds the player to the party room
   * or sends a message why the player could not join the room.<br>
   * <I>Parameters may be <CODE>null</CODE>, which guarantees <CODE>false</CODE></I>
   *
   * @param activeChar a player
   * @param room a party room
   * @param checkForParty whether check if the player is in party/[room]
   * @return true if player joined the given room, false otherwise
   */
  public static final boolean tryJoin(
      L2PcInstance activeChar, L2PartyRoom room, boolean checkForParty) {
    if (activeChar == null) return false;

    if (checkForParty) {
      if (activeChar.getPartyRoom() != null || activeChar.getParty() != null) {
        activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FORBIDDEN);
        return false;
      }
    }

    if (room == null) {
      activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FORBIDDEN);
      return false;
    } else if (!room.checkLevel(activeChar.getLevel())) {
      activeChar.sendPacket(SystemMessageId.CANT_ENTER_PARTY_ROOM);
      return false;
    } else if (room.getMemberCount() >= room.getMaxMembers()) {
      activeChar.sendPacket(SystemMessageId.PARTY_ROOM_FULL);
      return false;
    }
    room.addMember(activeChar);
    return true;
  }
Exemple #3
0
 /**
  * Verifies is player is eligible to join this party room.<br>
  * Does not specify a reason, does not send a message.
  *
  * @param activeChar a player
  * @return whether the given player can join this room
  * @see #tryJoin(L2PcInstance, L2PartyRoom, boolean)
  */
 public final boolean canJoin(L2PcInstance activeChar) {
   return (activeChar.getPartyRoom() == null
       && activeChar.getParty() == null
       && checkLevel(activeChar.getLevel())
       && getMemberCount() < getMaxMembers());
 }