Beispiel #1
0
        public static bool HasAnyAura(this WoWUnit unit, IEnumerable <int> ids)
        {
            var auras  = unit.AuraCache();
            var hashes = new HashSet <int>(ids);

            return(auras.Any(a => hashes.Contains(a.SpellId)));
        }
Beispiel #2
0
        public static TimeSpan AuraTimeLeft(this WoWUnit unit, int auraId)
        {
            if (unit == null)
            {
                return(TimeSpan.Zero);
            }

            var aura = unit.AuraCache().FirstOrDefault(a => a.SpellId == auraId && a.TimeLeft > TimeSpan.Zero);

            return((aura == null) ? TimeSpan.Zero : aura.TimeLeft);
        }
Beispiel #3
0
        public static TimeSpan AuraTimeLeft(this WoWUnit unit, string auraName)
        {
            if (unit == null)
            {
                return(TimeSpan.Zero);
            }

            var aura = unit.AuraCache().FirstOrDefault(a => a.Name == auraName && a.TimeLeft > TimeSpan.Zero);

            return((aura == null) ? TimeSpan.Zero : aura.TimeLeft);
        }
Beispiel #4
0
        public static int AuraWithMechanicCount(this WoWUnit unit, params WoWSpellMechanic[] mechanics)
        {
            if (unit == null)
            {
                return(0);
            }

            var auras = unit.AuraCache();

            return(auras.Count(a => mechanics.Contains(a.Spell.Mechanic)));
        }
Beispiel #5
0
        public static bool HasAuraWithMechanic(this WoWUnit unit, params WoWSpellMechanic[] mechanics)
        {
            if (unit == null)
            {
                return(false);
            }

            var auras = unit.AuraCache();

            return(auras.Any(a => mechanics.Contains(a.Spell.Mechanic)));
        }
Beispiel #6
0
        public static WoWAura GetAuraWithMechanic(this WoWUnit unit, params WoWSpellMechanic[] mechanics)
        {
            if (unit == null)
            {
                return(null);
            }

            var auras = unit.AuraCache();

            return(auras.FirstOrDefault(a => mechanics.Contains(a.Spell.Mechanic)));
        }
Beispiel #7
0
        public static uint GetAuraStacks(this WoWUnit unit, int auraId)
        {
            if (unit == null)
            {
                return(0);
            }

            var aura = unit.AuraCache().FirstOrDefault(a => a.SpellId == auraId && a.TimeLeft > TimeSpan.Zero);

            return((aura == null) ? 0 : aura.StackCount);
        }
Beispiel #8
0
        private static bool HasAuraWithEffect(this WoWUnit unit, params WoWApplyAuraType[] applyType)
        {
            var hashes = new HashSet <WoWApplyAuraType>(applyType);

            return(unit.AuraCache().Any(a => a.Spell != null && a.Spell.SpellEffects.Any(se => hashes.Contains(se.AuraType))));
        }
Beispiel #9
0
 public static bool HasStatsBuff(this WoWUnit unit)
 {
     return(unit.AuraCache().Any(u => Stats.Contains(u.SpellId)));
 }
Beispiel #10
0
 public static bool HasMasteryBuff(this WoWUnit unit)
 {
     return(unit.AuraCache().Any(u => Mastery.Contains(u.SpellId)));
 }