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); } }
private static void HandleInviteResponse(GameSession session, PacketReader packet) { long clubId = packet.ReadLong(); string clubName = packet.ReadUnicodeString(); string clubLeader = packet.ReadUnicodeString(); string invitee = packet.ReadUnicodeString(); //playerName. TODO: verify player name byte response = packet.ReadByte(); // 1 = accept Club club = GameServer.ClubManager.GetClubById(clubId); if (club == null) { return; } Player other = GameServer.Storage.GetPlayerByName(invitee); if (other == null) { return; } if (response == 1) { club.Leader.Session.Send(ClubPacket.LeaderInviteResponse(club, invitee, response)); club.BroadcastPacketClub(ClubPacket.ConfirmInvite(club, other.Session.Player)); other.Session.Send(ClubPacket.InviteResponse(club, session.Player)); other.Session.Send(ClubPacket.Join(session.Player, club)); other.Session.Send(ClubPacket.UpdateClub(club)); club.BroadcastPacketClub(ClubPacket.UpdatePlayerClubList(session.Player, club)); // TODO add member to club (club.AddMember(other);) } else { club.Leader.Session.Send(ClubPacket.LeaderInviteResponse(club, invitee, response)); other.Session.Send(ClubPacket.InviteResponse(club, session.Player)); } }