void HandleGuildFinderGetGuildPost(LFGuildGetGuildPost lfGuildGetGuildPost) { Player player = GetPlayer(); Guild guild = player.GetGuild(); if (!guild) // Player must be in guild { return; } LFGuildPost lfGuildPost = new LFGuildPost(); if (guild.GetLeaderGUID() == player.GetGUID()) { LFGuildSettings settings = Global.GuildFinderMgr.GetGuildSettings(guild.GetGUID()); if (settings == null) { return; } lfGuildPost.Post.HasValue = true; lfGuildPost.Post.Value.Active = settings.IsListed(); lfGuildPost.Post.Value.PlayStyle = settings.GetInterests(); lfGuildPost.Post.Value.Availability = settings.GetAvailability(); lfGuildPost.Post.Value.ClassRoles = settings.GetClassRoles(); lfGuildPost.Post.Value.LevelRange = settings.GetLevel(); lfGuildPost.Post.Value.Comment = settings.GetComment(); } player.SendPacket(lfGuildPost); }
void HandleGuildFinderGetApplications(LFGuildGetApplications lfGuildGetApplications) { List <MembershipRequest> applicatedGuilds = Global.GuildFinderMgr.GetAllMembershipRequestsForPlayer(GetPlayer().GetGUID()); LFGuildApplications lfGuildApplications = new LFGuildApplications(); lfGuildApplications.NumRemaining = 10 - Global.GuildFinderMgr.CountRequestsFromPlayer(GetPlayer().GetGUID()); for (var i = 0; i < applicatedGuilds.Count; ++i) { MembershipRequest application = applicatedGuilds[i]; LFGuildApplicationData applicationData = new LFGuildApplicationData(); Guild guild = Global.GuildMgr.GetGuildByGuid(application.GetGuildGuid()); LFGuildSettings guildSettings = Global.GuildFinderMgr.GetGuildSettings(application.GetGuildGuid()); applicationData.GuildGUID = application.GetGuildGuid(); applicationData.GuildVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress(); applicationData.GuildName = guild.GetName(); applicationData.ClassRoles = guildSettings.GetClassRoles(); applicationData.PlayStyle = guildSettings.GetInterests(); applicationData.Availability = guildSettings.GetAvailability(); applicationData.SecondsSinceCreated = (uint)(Time.UnixTime - application.GetSubmitTime()); applicationData.SecondsUntilExpiration = (uint)(application.GetExpiryTime() - Time.UnixTime); applicationData.Comment = application.GetComment(); lfGuildApplications.Application.Add(applicationData); } GetPlayer().SendPacket(lfGuildApplications); }
void HandleGuildFinderBrowse(LFGuildBrowse lfGuildBrowse) { if (!lfGuildBrowse.ClassRoles.HasAnyFlag((uint)GuildFinderOptionsRoles.All) || lfGuildBrowse.ClassRoles > (uint)GuildFinderOptionsRoles.All) { return; } if (!lfGuildBrowse.Availability.HasAnyFlag((uint)GuildFinderOptionsAvailability.Always) || lfGuildBrowse.Availability > (uint)GuildFinderOptionsAvailability.Always) { return; } if (!lfGuildBrowse.PlayStyle.HasAnyFlag((uint)GuildFinderOptionsInterest.All) || lfGuildBrowse.PlayStyle > (uint)GuildFinderOptionsInterest.All) { return; } if (lfGuildBrowse.CharacterLevel > WorldConfig.GetIntValue(WorldCfg.MaxPlayerLevel) || lfGuildBrowse.CharacterLevel < 1) { return; } Player player = GetPlayer(); LFGuildPlayer settings = new LFGuildPlayer(player.GetGUID(), lfGuildBrowse.ClassRoles, lfGuildBrowse.Availability, lfGuildBrowse.PlayStyle, (uint)GuildFinderOptionsLevel.Any); var guildList = Global.GuildFinderMgr.GetGuildsMatchingSetting(settings, (uint)player.GetTeam()); LFGuildBrowseResult lfGuildBrowseResult = new LFGuildBrowseResult(); for (var i = 0; i < guildList.Count; ++i) { LFGuildSettings guildSettings = guildList[i]; LFGuildBrowseData guildData = new LFGuildBrowseData(); Guild guild = Global.GuildMgr.GetGuildByGuid(guildSettings.GetGUID()); guildData.GuildName = guild.GetName(); guildData.GuildGUID = guild.GetGUID(); guildData.GuildVirtualRealm = Global.WorldMgr.GetVirtualRealmAddress(); guildData.GuildMembers = guild.GetMembersCount(); guildData.GuildAchievementPoints = guild.GetAchievementMgr().GetAchievementPoints(); guildData.PlayStyle = guildSettings.GetInterests(); guildData.Availability = guildSettings.GetAvailability(); guildData.ClassRoles = guildSettings.GetClassRoles(); guildData.LevelRange = guildSettings.GetLevel(); guildData.EmblemStyle = guild.GetEmblemInfo().GetStyle(); guildData.EmblemColor = guild.GetEmblemInfo().GetColor(); guildData.BorderStyle = guild.GetEmblemInfo().GetBorderStyle(); guildData.BorderColor = guild.GetEmblemInfo().GetBorderColor(); guildData.Background = guild.GetEmblemInfo().GetBackgroundColor(); guildData.Comment = guildSettings.GetComment(); guildData.Cached = 0; guildData.MembershipRequested = (sbyte)(Global.GuildFinderMgr.HasRequest(player.GetGUID(), guild.GetGUID()) ? 1 : 0); lfGuildBrowseResult.Post.Add(guildData); } player.SendPacket(lfGuildBrowseResult); }