Exemplo n.º 1
0
 // TODO: add LFG link packet processing for more precision
 public void HandleLfg(S_SHOW_PARTY_MATCH_INFO sShowPartyMatchInfo)
 {
     try
     {
         var lfg = sShowPartyMatchInfo.Listings.First(listing => PacketProcessor.Instance.PlayerTracker.MyParty(_me.ServerId, listing.LeaderId));
         _lfgMessage = lfg.Message;
         _lfgStarted = _lfgStarted ?? DateTime.UtcNow;
     }
     catch (InvalidOperationException)
     {
         _lfgMessage = null;
         _lfgStarted = null;
     }
     UpdatePresence();
 }
Exemplo n.º 2
0
        internal static void HandleLfgList(S_SHOW_PARTY_MATCH_INFO x)
        {
            if (!Settings.SettingsHolder.LfgEnabled) return;
            if (WindowManager.LfgListWindow == null) return;
            if (WindowManager.LfgListWindow.VM == null) return;
            if (!x.IsLast) return;

            if (S_SHOW_PARTY_MATCH_INFO.Listings.Count == 0)
            {
                WindowManager.LfgListWindow.VM.NotifyMyLfg();
                WindowManager.LfgListWindow.ShowWindow();
                return;
            }
            //WindowManager.LfgListWindow.VM.Listings.Clear();
            S_SHOW_PARTY_MATCH_INFO.Listings.ForEach(l =>
            {
                if (WindowManager.LfgListWindow.VM.Listings.Any(toFind => toFind.LeaderId == l.LeaderId))
                {
                    var target = WindowManager.LfgListWindow.VM.Listings.FirstOrDefault(t => t.LeaderId == l.LeaderId);
                    if (target == null) return;
                    target.LeaderId = l.LeaderId;
                    target.Message = l.Message;
                    target.IsRaid = l.IsRaid;
                    target.LeaderName = l.LeaderName;
                    if (target.PlayerCount != l.PlayerCount)
                    {
                        Proxy.Proxy.RequestPartyInfo(l.LeaderId);
                    }
                }
                else WindowManager.LfgListWindow.VM.Listings.Add(l);
            });
            var toRemove = new List<uint>();
            WindowManager.LfgListWindow.VM.Listings.ToList().ForEach(l =>
            {
                if (S_SHOW_PARTY_MATCH_INFO.Listings.All(f => f.LeaderId != l.LeaderId)) toRemove.Add(l.LeaderId);
            });
            toRemove.ForEach(r =>
            {
                var target = WindowManager.LfgListWindow.VM.Listings.FirstOrDefault(rm => rm.LeaderId == r);
                if (target != null) WindowManager.LfgListWindow.VM.Listings.Remove(target);
            });
            WindowManager.LfgListWindow.VM.NotifyMyLfg();
            WindowManager.LfgListWindow.ShowWindow();
        }