private void ReceiveFATE(FATEReport fate)
 {
     if (this.PutInChat(fate) && Settings.Default.FlashTaskbarIconOnHuntAndFATEs)
     {
         NativeMethods.FlashTaskbarIcon(Program.mem.Process);
     }
 }
Exemple #2
0
 private void ReceiveFATE(FATEReport fate)
 {
     //LogHost.Default.Debug(string.Format("[{0}] Report received: {1} - {2}%", GameResources.GetWorldName(fate.WorldId), fate.Name(true), fate.Progress));
     if (PutInChat(fate) && Settings.Default.FlashTaskbarIconOnHuntAndFATEs)
     {
         NativeMethods.FlashTaskbarIcon(Program.mem.Process);
     }
 }
        private bool PutInChat(FATEReport fate)
        {
            World world;

            if (!FFXIVHunts.Worlds.TryGetValue(fate.WorldId, out world))
            {
                return(false);
            }
            int idx = world.FATEs.IndexOf(fate);

            if (idx == -1)
            {
                return(false);
            }
            FATEReport FATEReport = world.FATEs[idx];

            FATEReport.State          = fate.State;
            FATEReport.StartTimeEpoch = fate.StartTimeEpoch;
            FATEReport.Duration       = fate.Duration;
            FATEReport.Progress       = fate.Progress;
            bool skipAnnounce = (Settings.Default.NoAnnouncementsInContent && Program.mem.GetCurrentContentFinderCondition() > 0) || (Math.Abs(fate.TimeRemaining.TotalHours) < 3.0 && fate.TimeRemaining.TotalMinutes < (double)Settings.Default.FATEMinimumMinutesRemaining) || ((fate.State == FATEState.Preparation) ? (FATEReport.lastPutInChat > Program.mem.GetServerUtcTime().AddMinutes(-10.0)) : (Math.Abs((int)(fate.Progress - FATEReport.LastReportedProgress)) < (int)Settings.Default.FATEMinimumPercentInterval && Settings.Default.FATEMinimumPercentInterval > 0));

            if (FFXIVHunts.FateNotifyCheck(FATEReport.ID) && FATEReport.lastPutInChat < Program.mem.GetServerUtcTime().AddMinutes((double)(-(double)Settings.Default.FATEInterval)) && !fate.HasEnded && !skipAnnounce)
            {
                string postpend;
                if (fate.State == FATEState.Preparation)
                {
                    postpend = Resources.PreparationState;
                }
                else if (Math.Abs(fate.TimeRemaining.TotalHours) > 3.0)
                {
                    postpend = fate.Progress.ToString() + "%";
                }
                else
                {
                    postpend = string.Format(CultureInfo.CurrentCulture, Resources.FATEPrcTimeRemaining, fate.Progress, (int)fate.TimeRemaining.TotalMinutes, fate.TimeRemaining.Seconds.ToString("D2", CultureInfo.CreateSpecificCulture(Settings.Default.LanguageCI)));
                }
                if (fate.Instance > 0)
                {
                    postpend += string.Format(CultureInfo.CurrentCulture, " " + Resources.InstanceSpecifier, fate.Instance);
                }
                ChatMessage cm = ChatMessage.MakePosChatMessage(string.Format(CultureInfo.CurrentCulture, FFXIVHunts.GetWorldPrepend(fate.WorldId) + Resources.FATEMsg, FATEReport.Name(false)), fate.ZoneID, fate.PosX, fate.PosY, " " + postpend, 0);
                Program.mem.WriteChatMessage(cm);
                this.CheckAndPlaySound(HuntRank.FATE);
                FATEReport.lastPutInChat        = Program.mem.GetServerUtcTime();
                FATEReport.LastReportedProgress = fate.Progress;
                return(true);
            }
            return(false);
        }
Exemple #4
0
        public override bool Equals(object obj)
        {
            FATEReport item = obj as FATEReport;

            if (item == null)
            {
                return(false);
            }
            if (this.WorldId > 1000 && this.WorldId < 2000 && (base.ID > 1425 || base.ZoneID == 156 || base.ZoneID == 152))
            {
                return(base.ID.Equals(item.ID) && this.WorldId.Equals(item.WorldId) && this.Instance.Equals(item.Instance));
            }
            if (base.IsDataCenterShared())
            {
                return(base.ID.Equals(item.ID));
            }
            return(base.ID.Equals(item.ID) && this.WorldId.Equals(item.WorldId));
        }
Exemple #5
0
        private bool PutInChat(FATEReport fate)
        {
            int idx = FATEs.IndexOf(fate);

            if (idx == -1)
            {
                return(false);
            }
            FATEs[idx].State          = fate.State;
            FATEs[idx].StartTimeEpoch = fate.StartTimeEpoch;
            FATEs[idx].Duration       = fate.Duration;
            FATEs[idx].Progress       = fate.Progress;
            bool skipAnnounce = Settings.Default.NoAnnouncementsInContent && Program.mem.GetCurrentContentFinderCondition() > 0 ||
                                (Math.Abs(fate.TimeRemaining.TotalHours) < 3 && fate.TimeRemaining.TotalMinutes < Settings.Default.FATEMinimumMinutesRemaining) ||
                                ((fate.State == FATEState.Preparation) ? FATEs[idx].lastPutInChat > Program.mem.GetServerUtcTime().AddMinutes(-10) : Math.Abs(fate.Progress - FATEs[idx].LastReportedProgress) < Settings.Default.FATEMinimumPercentInterval && Settings.Default.FATEMinimumPercentInterval > 0);

            if (FateNotifyCheck(FATEs[idx].ID) && FATEs[idx].lastPutInChat < Program.mem.GetServerUtcTime().AddMinutes(-Settings.Default.FATEInterval) && !fate.HasEnded && !skipAnnounce)
            {
                ChatMessage cm = new ChatMessage();
                string      postpend;
                if (fate.State == FATEState.Preparation)
                {
                    postpend = Resources.PreparationState;
                }
                else if (Math.Abs(fate.TimeRemaining.TotalHours) > 3)//StartTimeEpoch isn't set during the first few seconds
                {
                    postpend = fate.Progress + "%";
                }
                else
                {
                    postpend = string.Format(Resources.FATEPrcTimeRemaining, fate.Progress, (int)fate.TimeRemaining.TotalMinutes, fate.TimeRemaining.Seconds.ToString("D2"));
                }
                cm = ChatMessage.MakePosChatMessage(string.Format(GetWorldPrepend(fate.WorldId) + Resources.FATEMsg, FATEs[idx].Name()), fate.ZoneID, fate.PosX, fate.PosY, " " + postpend);
                _  = Program.mem.WriteChatMessage(cm);
                CheckAndPlaySound(HuntRank.FATE);
                FATEs[idx].lastPutInChat        = Program.mem.GetServerUtcTime();
                FATEs[idx].LastReportedProgress = fate.Progress;
                //if (fate.Progress > 99)
                //    fates[idx].lastReportedDead = DateTime.UtcNow;
                return(true);
            }
            return(false);
        }