Example #1
0
        private void WatchAurasForProcs()
        {
            if (!SingularSettings.Instance.EnableDebugTraceBuffPresence)
            {
                return;
            }

            if (DateTime.UtcNow < NextAuraCheck)
            {
                return;
            }

            NextAuraCheck = DateTime.UtcNow + TimeSpan.FromSeconds(1);
            if (Auras == null)
            {
                Auras = new Dictionary <int, AuraEntry>();
            }

            Dictionary <int, AuraEntry> found = new Dictionary <int, AuraEntry>();

            foreach (var a in Me.GetAllAuras().Where(a => !a.IsHarmful && a.TimeLeft > TimeSpan.Zero))
            {
                SpellEffect se = a.Spell.SpellEffects.FirstOrDefault(s => s != null);
                if (se != null)
                {
                    AuraEntry ae = new AuraEntry()
                    {
                        Name = a.Name, SpellId = a.SpellId, EffectId = se.Id
                    };
                    if (found.ContainsKey(ae.SpellId))
                    {
                        Logger.WriteDiagnostic("Aura: *dup* [{0}] #{1} EffId:{2}", ae.Name, ae.SpellId, ae.EffectId);
                    }
                    else
                    {
                        found.Add(a.SpellId, ae);
                        if (!Auras.ContainsKey(a.SpellId))
                        {
                            Logger.WriteDiagnostic("Aura: +new+ [{0}] #{1} EffId:{2} Typ:{3} Remn:{4:F2}", ae.Name, ae.SpellId, ae.EffectId, a.ApplyAuraType, a.TimeLeft.TotalSeconds);
                            Auras.Add(a.SpellId, ae);
                        }
                    }
                }
            }

            int i = Auras.Count();

            while (i-- > 0)
            {
                KeyValuePair <int, AuraEntry> kvp = Auras.ElementAt(i);
                if (!found.ContainsKey(kvp.Key))
                {
                    Logger.WriteDiagnostic("Aura: -exp- [{0}] #{1}", kvp.Value.Name, kvp.Value.SpellId);
                    Auras.Remove(kvp.Key);
                }
            }
        }
Example #2
0
        private void WatchAurasForProcs()
        {
            if (!SingularSettings.Instance.EnableDebugTraceBuffPresence)
                return;

            if (DateTime.UtcNow < NextAuraCheck)
                return;

            NextAuraCheck = DateTime.UtcNow + TimeSpan.FromSeconds(1);
            if (Auras == null)
                Auras = new Dictionary<int, AuraEntry>();

            Dictionary<int, AuraEntry> found = new Dictionary<int,AuraEntry>();
            foreach (var a in Me.GetAllAuras().Where(a => !a.IsHarmful && a.TimeLeft > TimeSpan.Zero))
            {
                SpellEffect se = a.Spell.SpellEffects.FirstOrDefault( s => s != null);
                if (se != null)
                {
                    AuraEntry ae = new AuraEntry() { Name = a.Name, SpellId = a.SpellId, EffectId = se.Id  };
                    if (found.ContainsKey(ae.SpellId))
                    {
                        Logger.WriteDiagnostic("Aura: *dup* [{0}] #{1} EffId:{2}", ae.Name, ae.SpellId, ae.EffectId);
                    }
                    else
                    {
                        found.Add(a.SpellId, ae);
                        if (!Auras.ContainsKey(a.SpellId))
                        {
                            Logger.WriteDiagnostic("Aura: +new+ [{0}] #{1} EffId:{2} Typ:{3} Remn:{4:F2}", ae.Name, ae.SpellId, ae.EffectId, a.ApplyAuraType, a.TimeLeft.TotalSeconds);
                            Auras.Add(a.SpellId, ae);
                        }
                    }
                }
            }

            int i = Auras.Count();
            while (i-- > 0)
            {
                KeyValuePair<int, AuraEntry> kvp = Auras.ElementAt(i);
                if (!found.ContainsKey(kvp.Key))
                {
                    Logger.WriteDiagnostic("Aura: -exp- [{0}] #{1}", kvp.Value.Name, kvp.Value.SpellId);
                    Auras.Remove(kvp.Key);
                }
            }
        }