Beispiel #1
0
    public void InvitedPlayerResponse(Player player, ClubInviteResponse inviteResponse)
    {
        if (!Members.Any(x => x.Player.CharacterId == player.CharacterId))
        {
            return;
        }

        ClubMember member = player.ClubMembers.FirstOrDefault(x => x.ClubId == Id);

        member.InviteResponse = inviteResponse;

        if (inviteResponse == ClubInviteResponse.Reject)
        {
            List <GameSession> memberSessions = GetSessions();
            foreach (GameSession session in memberSessions)
            {
                session.Send(ClubPacket.ClubProposalInviteResponse(Id, inviteResponse, player.Name));
                session.Send(ClubPacket.DeleteUnestablishedClub(Id));
                ClubMember membership = session.Player.ClubMembers.First(x => x.ClubId == Id);
                session.Player.ClubMembers.Remove(membership);
                session.Player.Clubs.Remove(this);
            }

            GameServer.ClubManager.RemoveClub(this);
            return;
        }
        EstablishClub(player);
    }
Beispiel #2
0
 public ClubMember(Player player, long clubId)
 {
     Player         = player;
     JoinTimestamp  = TimeInfo.Now();
     ClubId         = clubId;
     InviteResponse = ClubInviteResponse.Pending;
     DatabaseManager.ClubMembers.Insert(this);
 }
Beispiel #3
0
    public static PacketWriter ClubProposalInviteResponse(long clubId, ClubInviteResponse response, string characterName)
    {
        PacketWriter pWriter = PacketWriter.Of(SendOp.Club);

        pWriter.Write(ClubPacketMode.ClubProposalInviteResponse);
        pWriter.WriteLong(clubId);
        pWriter.Write(response);
        pWriter.WriteUnicodeString(characterName);
        return(pWriter);
    }
Beispiel #4
0
    private static void HandleNewClubInvite(GameSession session, PacketReader packet)
    {
        if (session.Player.Clubs.Count > int.Parse(ConstantsMetadataStorage.GetConstant("ClubMaxCount")))
        {
            return;
        }

        long clubId = packet.ReadLong();

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

        if (club == null)
        {
            return;
        }

        ClubInviteResponse response = (ClubInviteResponse)packet.ReadInt();

        club.InvitedPlayerResponse(session.Player, response);
    }