Exemplo n.º 1
0
    private static void HandleInviteResponse(GameSession session, PacketReader packet)
    {
        long   clubId     = packet.ReadLong();
        string clubName   = packet.ReadUnicodeString();
        string clubLeader = packet.ReadUnicodeString();
        string invitee    = packet.ReadUnicodeString();
        bool   accept     = packet.ReadBool();

        if (invitee != session.Player.Name)
        {
            return;
        }

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

        if (club == null)
        {
            return;
        }

        Player leader = GameServer.PlayerManager.GetPlayerById(club.LeaderCharacterId);

        leader?.Session.Send(ClubPacket.LeaderInviteResponse(club, invitee, accept));
        session.Send(ClubPacket.InviteResponse(club, session.Player));

        if (accept)
        {
            club.AcceptInvite(session.Player);
        }
    }