コード例 #1
0
    private static void HandleLeave(GameSession session, PacketReader packet)
    {
        long clubId = packet.ReadLong();

        Club club = GameServer.ClubManager.GetClubById(clubId);

        if (club is null)
        {
            return;
        }

        if (!session.Player.Clubs.Contains(club))
        {
            return;
        }

        if (club.Members.Count <= 2)
        {
            club.Disband();
            return;
        }

        if (session.Player.CharacterId == club.LeaderCharacterId)
        {
            club.AssignNewLeader(session.Player);
        }
        club.RemoveMember(session.Player);
        session.Player.UpdateSocials();
    }