public static bool HasAuraWithEffect(this WoWUnit unit, WoWApplyAuraType auraType, int miscValue, int basePointsMin, int basePointsMax) { var auras = unit.GetAllAuras(); return((from a in auras where a.Spell != null let spell = a.Spell from e in spell.GetSpellEffects() // First check: Ensure the effect is... well... valid where e != null && // Ensure the aura type is correct. e.AuraType == auraType && // Check for a misc value. (Resistance types, etc) (miscValue == -1 || e.MiscValueA == miscValue) && // Check for the base points value. (Usually %s for most debuffs) e.BasePoints >= basePointsMin && e.BasePoints <= basePointsMax select a).Any()); }
// this one optimized for single applytype lookup public static bool HasAuraWithEffect(this WoWUnit unit, WoWApplyAuraType applyType) { return unit.Auras.Values.Any(a => a.Spell != null && a.Spell.SpellEffects.Any(se => applyType == se.AuraType)); }
public static bool HasAuraWithEffect(this WoWUnit unit, WoWApplyAuraType auraType, int miscValue, int basePointsMin, int basePointsMax) { var auras = unit.GetAllAuras(); return (from a in auras where a.Spell != null let spell = a.Spell from e in spell.GetSpellEffects() // First check: Ensure the effect is... well... valid where e != null && // Ensure the aura type is correct. e.AuraType == auraType && // Check for a misc value. (Resistance types, etc) (miscValue == -1 || e.MiscValueA == miscValue) && // Check for the base points value. (Usually %s for most debuffs) e.BasePoints >= basePointsMin && e.BasePoints <= basePointsMax select a).Any(); }
public static bool HasAuraWithEffect(this WoWUnit unit, WoWApplyAuraType applyType) { return(unit.Auras.Values.Any(a => a.Spell != null && a.Spell.SpellEffects.Any(se => applyType == se.AuraType))); }