Exemple #1
0
        internal async void Check(FFXIVMemory mem)
        {
            if (!hubConnection.Connected)
            {
                await Connect();
            }
            if (!hubConnection.Connected)
            {
                return;
            }
            if (lastJoined != mem.GetWorldId() && Joined && !Joining || !Joined)
            {
                await LeaveGroup();
                await JoinServerGroup();
            }
            ServerTimeUtc = mem.GetServerUtcTime();
            ushort thisZone = mem.GetZoneId();

            if (thisZone != lastZone && Settings.Default.OncePerHunt && Settings.Default.ForgetOnZoneChange)
            {
                HuntsPutInChat.Clear();
            }

            if (Array.IndexOf(DCZones, thisZone) > -1 && Array.IndexOf(DCZones, lastZone) == -1 && Joined)
            {
                LastShoutChatSync = await JoinDCZone(thisZone);
            }
            else if (Array.IndexOf(DCZones, lastZone) > -1 && Array.IndexOf(DCZones, thisZone) == -1)
            {
                await LeaveDCZone();
            }
            lastZone = thisZone;
            foreach (Monster c in mem.Combatants.OfType <Monster>().Where(c => Hunts.Exists(h => h.Id == c.BNpcNameID && GetZoneId(c.BNpcNameID) == thisZone)))
            {
                _ = ReportHunt(c);
            }
            if (Array.IndexOf(DCZones, thisZone) > -1 && LastShoutChatSync != null)
            {
                await ReportDCShoutChat(mem.ReadChatLogBackwards(filter : x => x.Channel == ChatChannel.Shout, stopOn : x => x.Timestamp <= LastShoutChatSync).OrderByDescending(x => x.Timestamp).Take(10));
            }
            foreach (FATE f in mem.GetFateList().Where(f => f.ZoneID == thisZone))
            {
                _ = ReportFate(f);
                if (f.IsDataCenterShared() && PutInChat(new FATEReport(f)
                {
                    WorldId = mem.GetWorldId()
                }) && Settings.Default.FlashTaskbarIconOnHuntAndFATEs)
                {
                    NativeMethods.FlashTaskbarIcon(mem.Process);
                }
            }
        }
        internal async void Check(FFXIVMemory mem)
        {
            FFXIVHunts.< > c__DisplayClass44_0 CS$ < > 8__locals1 = new FFXIVHunts.< > c__DisplayClass44_0();
            if (!FFXIVHunts.hubConnection.Connected)
            {
                await this.Connect();
            }
            if (FFXIVHunts.hubConnection.Connected)
            {
                ushort currentWorldID = mem.GetCurrentWorldId();
                if ((FFXIVHunts.LastJoinedWorldID != currentWorldID && FFXIVHunts.Joined && !FFXIVHunts.Joining) || !FFXIVHunts.Joined)
                {
                    await this.LeaveGroup();

                    await this.JoinServerGroup();
                }
                FFXIVHunts.ServerTimeUtc    = mem.GetServerUtcTime();
                CS$ < > 8__locals1.thisZone = mem.GetZoneId();
                if (CS$ < > 8__locals1.thisZone != FFXIVHunts.lastZone && Settings.Default.OncePerHunt && Settings.Default.ForgetOnZoneChange)
                {
                    FFXIVHunts.HuntsPutInChat.Clear();
                }
                if (Array.IndexOf <uint>(FFXIVHunts.DCZones, (uint)CS$ < > 8__locals1.thisZone) > -1 && Array.IndexOf <uint>(FFXIVHunts.DCZones, (uint)FFXIVHunts.lastZone) == -1 && FFXIVHunts.Joined)
                {
                    TaskAwaiter <DateTime> taskAwaiter = this.JoinDCZone(CS$ < > 8__locals1.thisZone).GetAwaiter();
                    if (!taskAwaiter.IsCompleted)
                    {
                        await taskAwaiter;
                        TaskAwaiter <DateTime> taskAwaiter2;
                        taskAwaiter  = taskAwaiter2;
                        taskAwaiter2 = default(TaskAwaiter <DateTime>);
                    }
                    FFXIVHunts.LastShoutChatSync = taskAwaiter.GetResult();
                }
                else if (Array.IndexOf <uint>(FFXIVHunts.DCZones, (uint)FFXIVHunts.lastZone) > -1 && Array.IndexOf <uint>(FFXIVHunts.DCZones, (uint)CS$ < > 8__locals1.thisZone) == -1)
                {
                    await this.LeaveDCZone();
                }
                FFXIVHunts.lastZone = CS$ < > 8__locals1.thisZone;
                IEnumerable <Monster> source = mem.Combatants.OfType <Monster>();
                Func <Monster, bool>  predicate;
                if ((predicate = CS$ < > 8__locals1.< > 9__3) == null)
                {
                    FFXIVHunts.< > c__DisplayClass44_0 CS$ < > 8__locals2 = CS$ < > 8__locals1;
                    Func <Monster, bool> func = (Monster c) => FFXIVHunts.CurrentWorld.Hunts.Exists((Hunt h) => h.Id == c.BNpcNameID && FFXIVHunts.GetZoneId(c.BNpcNameID) == CS$ < > 8__locals1.thisZone);
                    CS$ < > 8__locals2.< > 9__3 = func;
                    predicate = func;
                }
                foreach (Monster c2 in source.Where(predicate))
                {
                    this.ReportHunt(c2);
                }
                if (Array.IndexOf <uint>(FFXIVHunts.DCZones, (uint)CS$ < > 8__locals1.thisZone) > -1)
                {
                    DateTime lastShoutChatSync = FFXIVHunts.LastShoutChatSync;
                    await this.ReportDCShoutChat((from x in mem.ReadChatLogBackwards(1000, (ChatMessage x) => x.Channel == ChatChannel.Shout && !string.IsNullOrWhiteSpace(x.Sender.Name), (ChatMessage x) => x.Timestamp <= FFXIVHunts.LastShoutChatSync)
                                                  orderby x.Timestamp descending
                                                  select x).Take(10));
                }
                IEnumerable <FATE> fateList = mem.GetFateList();
                Func <FATE, bool>  predicate2;
                if ((predicate2 = CS$ < > 8__locals1.< > 9__5) == null)
                {
                    FFXIVHunts.< > c__DisplayClass44_0 CS$ < > 8__locals3 = CS$ < > 8__locals1;
                    Func <FATE, bool> func2 = (FATE f) => f.ZoneID == CS$ < > 8__locals1.thisZone;
                    CS$ < > 8__locals3.< > 9__5 = func2;
                    predicate2 = func2;
                }
                foreach (FATE f2 in fateList.Where(predicate2))
                {
                    this.ReportFate(f2);
                    if (f2.IsDataCenterShared() && this.PutInChat(new FATEReport(f2)
                    {
                        WorldId = mem.GetHomeWorldId()
                    }) && Settings.Default.FlashTaskbarIconOnHuntAndFATEs)
                    {
                        NativeMethods.FlashTaskbarIcon(mem.Process);
                    }
                }
            }