private static void HandleSendInvite(GameSession session, PacketReader packet) { long clubId = packet.ReadLong(); string invitee = packet.ReadUnicodeString(); Player other = GameServer.PlayerManager.GetPlayerByName(invitee); if (other == null) { return; } if (other.Clubs.Any(x => x.Id == clubId)) { session.Send(ClubPacket.ErrorNotice((int)ClubErrorNotice.AlreadyInClub)); return; } if (other.Clubs.Count >= int.Parse(ConstantsMetadataStorage.GetConstant("ClubMaxCount"))) { session.Send(ClubPacket.ErrorNotice((int)ClubErrorNotice.PlayerCannotJoinMoreClubs)); return; } Club club = GameServer.ClubManager.GetClubById(clubId); if (club == null) { return; } if (club.Members.Count >= int.Parse(ConstantsMetadataStorage.GetConstant("ClubMaxMembers"))) { session.Send(ClubPacket.ErrorNotice((int)ClubErrorNotice.ClubIsFull)); return; } session.Send(ClubPacket.InviteSentReceipt(clubId, other)); other.Session.Send(ClubPacket.Invite(club, other)); }
private static void HandleSendInvite(GameSession session, PacketReader packet) { long clubId = packet.ReadLong(); string invitee = packet.ReadUnicodeString(); Player other = GameServer.Storage.GetPlayerByName(invitee); if (other == null) { return; } Club club = GameServer.ClubManager.GetClubById(clubId); if (club == null) { return; } // TODO check that the club can fit more people, if it's at max members, return/leave error session.Send(ClubPacket.InviteSentReceipt(clubId, other)); other.Session.Send(ClubPacket.Invite(club, other)); }