Exemplo n.º 1
0
        public static uint AuraStacks(this WoWUnit unit, int auraId, bool isMyAura = false)
        {
            try
            {
                if (!AuraExists(unit, auraId, isMyAura))
                {
                    return(0);
                }

                if (unit == null)
                {
                    throw new Exception("unit cannot be null!");
                }
                WoWAura aura = isMyAura
                    ? unit.GetAllAuras().First(a => a.SpellId == auraId && a.CreatorGuid == StyxWoW.Me.Guid)
                    : unit.GetAllAuras().First(a => a.SpellId == auraId);

                return(aura.StackCount);
            }
            catch (Exception xException)
            {
                Log.Diagnostics("Exception in AuraStacks(): " + xException);
                return(0);
            }
        }
Exemplo n.º 2
0
        private static WoWAura GetPurgeEnemyAura(WoWUnit target)
        {
            if (SingularSettings.Instance.PurgeBuffs == PurgeAuraFilter.All)
            {
                return(target.GetAllAuras().FirstOrDefault(a => a.TimeLeft.TotalSeconds > 1 && a.Spell.DispelType == WoWDispelType.Magic));
            }

            SpellList sl = StyxWoW.Me.Class == WoWClass.Mage ? MageSteallist.Instance.SpellList : PurgeWhitelist.Instance.SpellList;

            return(target.GetAllAuras().FirstOrDefault(a => a.TimeLeft.TotalSeconds > 1 && a.Spell.DispelType == WoWDispelType.Magic && sl.Contains(a.SpellId)));
        }
Exemplo n.º 3
0
 public static WoWAura GetAura(WoWUnit unit, spell_data_t aura, bool fromMyAura = false)
 {
     //if (aura == null) return null;
     if (unit != null)
     {
         LogDebug("Looking for " + aura.name);
         WoWAura wantedAura = null;
         var     mismatch   = 0;
         foreach (var a in unit.GetAllAuras())
         {
             LogDebug(a.Name + " " + a.IsActive + " " + a.TimeLeft.TotalSeconds + " " + Me.HasAura((int)a.SpellId));
             if (a.SpellId == aura.id &&
                 (!fromMyAura || a.CreatorGuid == Me.Guid || (Me.Pet != null && a.CreatorGuid == Me.Pet.Guid)))
             {
                 return(a);
             }
             if (a.Name.Equals(aura.name) && a.IsActive)
             {
                 mismatch = a.SpellId;
             }
         }
         if (mismatch > 0 &&
             !Mismatches.Contains("We couldnt find " + aura.name + " by Id but there is an Aura with its name: " +
                                  aura.id + " / " + mismatch))
         {
             Mismatches.Add("We couldnt find " + aura.name + " by Id but there is an Aura with its name: " +
                            aura.id + " / " + mismatch);
             Write("We couldnt find " + aura.name + " by Id but there is an Aura with its name: " +
                   aura.id + " / " + mismatch);
         }
     }
     return(null);
 }
Exemplo n.º 4
0
 //Used for checking auras that has no time
 private bool IsMyAuraActive(WoWUnit Who, String What)
 {
     using (new FrameLock())
     {
         return(Who.GetAllAuras().Where(p => p.CreatorGuid == Me.Guid && p.Name == What).FirstOrDefault() != null);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        ///  Checks for my auras on a specified unit. Returns true if the unit has any aura in the auraNames list applied by player.
        /// </summary>
        /// <param name="unit"> The unit to check auras for. </param>
        /// <param name="auraNames"> Aura names to be checked. </param>
        /// <returns></returns>
        public static bool HasAnyOfMyAuras(this WoWUnit unit, params string[] auraNames)
        {
            var auras  = unit.GetAllAuras();
            var hashes = new HashSet <string>(auraNames);

            return(auras.Any(a => a.CreatorGuid == StyxWoW.Me.Guid && hashes.Contains(a.Name)));
        }
Exemplo n.º 6
0
        /// <summary>
        ///  Checks for the auras on a specified unit. Returns true if the unit has any aura in the auraNames list.
        /// </summary>
        /// <param name="unit"> The unit to check auras for. </param>
        /// <param name="auraNames"> Aura names to be checked. </param>
        /// <returns></returns>
        public static bool HasAnyAura(this WoWUnit unit, params string[] auraNames)
        {
            var auras  = unit.GetAllAuras();
            var hashes = new HashSet <string>(auraNames);

            return(auras.Any(a => hashes.Contains(a.Name)));
        }
Exemplo n.º 7
0
        public static TimeSpan GetAuraTimeLeft(this WoWUnit onUnit, int auraID, bool fromMyAura = true)
        {
            WoWAura wantedAura = onUnit.GetAllAuras()
                                 .Where(a => a.SpellId == auraID && a.TimeLeft > TimeSpan.Zero && (!fromMyAura || a.CreatorGuid == StyxWoW.Me.Guid)).FirstOrDefault();

            return(wantedAura != null ? wantedAura.TimeLeft : TimeSpan.Zero);
        }
Exemplo n.º 8
0
        /// <summary>
        ///  Returns the timeleft of an aura by TimeSpan. Return TimeSpan.Zero if the aura doesn't exist.
        /// </summary>
        /// <param name="auraName"> The name of the aura in English. </param>
        /// <param name="onUnit"> The unit to check the aura for. </param>
        /// <param name="fromMyAura"> Check for only self or all buffs</param>
        /// <returns></returns>
        public static TimeSpan GetAuraTimeLeft(this WoWUnit onUnit, string auraName, bool fromMyAura)
        {
            WoWAura wantedAura =
                onUnit.GetAllAuras().Where(a => a.Name == auraName && (!fromMyAura || a.CreatorGuid == StyxWoW.Me.Guid)).FirstOrDefault();

            return(wantedAura != null ? wantedAura.TimeLeft : TimeSpan.Zero);
        }
Exemplo n.º 9
0
 public static bool AuraExists(this WoWUnit unit, int auraId, bool isMyAura = false)
 {
     try
     {
         if (unit == null || !unit.IsValid)
         {
             return(false);
         }
         var aura = isMyAura
             ? unit.GetAllAuras().FirstOrDefault(a => a.SpellId == auraId && a.CreatorGuid == StyxWoW.Me.Guid)
             : unit.GetAllAuras().FirstOrDefault(a => a.SpellId == auraId);
         return(aura != null);
     }
     catch (Exception xException)
     {
         Log.Diagnostics("Exception in auraExists(): " + xException);
         return(false);
     }
 }
Exemplo n.º 10
0
 static public double GetAuraTimeLeft(WoWUnit auraTarget, string auraName, UInt64 creatorGuid)
 {
     if (auraTarget == null)
     {
         return(0);
     }
     return((from aura in auraTarget.GetAllAuras()
             where aura.Name == auraName && aura.CreatorGuid == creatorGuid
             select aura.TimeLeft.TotalSeconds).FirstOrDefault());
 }
Exemplo n.º 11
0
        /// <summary>
        /// gets a PartyBuff mask representing all categories of buffs present
        /// </summary>
        /// <param name="unit">WoWUnit to check for buffs</param>
        /// <returns>PartyBuff mask representing all buffs founds</returns>
        public static PartyBuffType GetPartyBuffs(this WoWUnit unit)
        {
            PartyBuffType buffs = PartyBuffType.None;

            foreach (var a in unit.GetAllAuras())
            {
                PartyBuffType bc = GetPartyBuffForSpell(a.Name);
                buffs |= bc;
            }
            return(buffs);
        }
Exemplo n.º 12
0
        public TimeSpan GetAuraTimeLeft(string auraName, WoWUnit onUnit, bool fromMyAura)
        {
            WoWAura wantedAura =
                onUnit.GetAllAuras().Where(a => a.Name == auraName && (fromMyAura ? a.CreatorGuid == Me.Guid : true)).FirstOrDefault();

            if (wantedAura != null)
            {
                return(wantedAura.TimeLeft);
            }
            return(TimeSpan.Zero);
        }
Exemplo n.º 13
0
 /// <summary>
 /// check a WoWUnit for a particular PartyBuff enum
 /// </summary>
 /// <param name="unit">unit to check for buff</param>
 /// <param name="cat">buff to check for.  may be a mask of multiple buffs if any will do, such as PartyBuff.Stats + PartyBuff.Mastery</param>
 /// <returns>true if any buff matching the mask in 'cat' is found, otherwise false</returns>
 public static bool HasPartyBuff(this WoWUnit unit, PartyBuffType cat)
 {
     foreach (var a in unit.GetAllAuras())
     {
         PartyBuffType bc = GetPartyBuffForSpell(a.Name);
         if ((bc & cat) != PartyBuffType.None)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 14
0
        public static uint GetAuraStacks(this WoWUnit onUnit, string auraName, bool fromMyAura = true)
        {
            WoWAura wantedAura =
                onUnit.GetAllAuras().Where(a => a.Name == auraName && a.TimeLeft > TimeSpan.Zero && (!fromMyAura || a.CreatorGuid == StyxWoW.Me.Guid)).FirstOrDefault();

            if (wantedAura == null)
            {
                return(0);
            }

            return(wantedAura.StackCount == 0 ? 1 : wantedAura.StackCount);
        }
Exemplo n.º 15
0
 public static bool IsCrowdControlled(WoWUnit unit)
 {
     return(unit.GetAllAuras().Any(a => a.IsHarmful &&
                                   (a.Spell.Mechanic == WoWSpellMechanic.Shackled ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Polymorphed ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Horrified ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Rooted ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Frozen ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Stunned ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Fleeing ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Banished ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Sapped)));
 }
Exemplo n.º 16
0
 public static bool IsCrowdControlled(WoWUnit unit)
 {
     return unit.GetAllAuras().Any(a => a.IsHarmful &&
         (a.Spell.Mechanic == WoWSpellMechanic.Shackled ||
         a.Spell.Mechanic == WoWSpellMechanic.Polymorphed ||
         a.Spell.Mechanic == WoWSpellMechanic.Horrified ||
         a.Spell.Mechanic == WoWSpellMechanic.Rooted ||
         a.Spell.Mechanic == WoWSpellMechanic.Frozen ||
         a.Spell.Mechanic == WoWSpellMechanic.Stunned ||
         a.Spell.Mechanic == WoWSpellMechanic.Fleeing ||
         a.Spell.Mechanic == WoWSpellMechanic.Banished ||
         a.Spell.Mechanic == WoWSpellMechanic.Sapped));
 }
Exemplo n.º 17
0
        public static TimeSpan AuraRemainingTime(this WoWUnit unit, int auraId, bool isMyAura = false)
        {
            try
            {
                if (!AuraExists(unit, auraId, isMyAura))
                {
                    return(TimeSpan.FromSeconds(0));
                }

                if (unit == null)
                {
                    return(TimeSpan.FromSeconds(0));
                }
                var aura = isMyAura
                    ? unit.GetAllAuras().First(a => a.SpellId == auraId && a.CreatorGuid == StyxWoW.Me.Guid)
                    : unit.GetAllAuras().First(a => a.SpellId == auraId);
                return(aura.TimeLeft);
            }
            catch (Exception xException)
            {
                Log.Diagnostics("Exception in auraRemainingTime(): " + xException);
                return(TimeSpan.FromSeconds(0));
            }
        }
Exemplo n.º 18
0
        public static WoWAuraCollection AuraCache(this WoWUnit unit)
        {
            return(unit.GetAllAuras());

            /*if (_auraCache == null || ResetAuraCache)
             * {
             *  _auraCache = new Dictionary<WoWGuid, WoWAuraCollection>();
             * }
             *
             * if (_auraCache.ContainsKey(unit.Guid))
             *  return _auraCache[unit.Guid];
             *
             * _auraCache[unit.Guid] = unit.GetAllAuras();
             * return _auraCache[unit.Guid];*/
        }
Exemplo n.º 19
0
        public static TimeSpan GetAuraTimeLeft(string auraName, WoWUnit onUnit, bool fromMyAura)
        {
            if (onUnit == null)
            {
                return TimeSpan.Zero;
            }

            WoWAura wantedAura =
                onUnit.GetAllAuras().Where(a => a.Name == auraName && (!fromMyAura || a.CreatorGuid == Me.Guid)).FirstOrDefault();

            if (wantedAura != null)
            {
                return wantedAura.TimeLeft;
            }
            return TimeSpan.Zero;
        }
Exemplo n.º 20
0
 public static uint auraStacks(WoWUnit Unit, int auraID, bool isMyAura = false)
 {
     try
     {
         if (Unit == null || !Unit.IsValid)
         {
             return(0);
         }
         WoWAura Aura = isMyAura ? Unit.GetAllAuras().FirstOrDefault(A => A.SpellId == auraID && A.CreatorGuid == Me.Guid) : Unit.GetAllAuras().FirstOrDefault(A => A.SpellId == auraID);
         return(Aura != null ? Aura.StackCount : 0);
     }
     catch (Exception xException)
     {
         L.diagnosticsLog("Exception in auraStacks(); ", xException);
         return(0);
     }
 }
Exemplo n.º 21
0
 public static double auraTimeLeft(WoWUnit Unit, int auraID, bool isMyAura = false)
 {
     try
     {
         if (Unit == null || !Unit.IsValid)
         {
             return(0);
         }
         WoWAura Aura = isMyAura ? Unit.GetAllAuras().FirstOrDefault(A => A.SpellId == auraID && A.CreatorGuid == Me.Guid) : Unit.GetAllAuras().FirstOrDefault(A => A.SpellId == auraID);
         return(Aura != null ? Aura.TimeLeft.TotalMilliseconds : 0);
     }
     catch (Exception xException)
     {
         L.diagnosticsLog("Exception in auraExists(); ", xException);
         return(9999);
     }
 }
Exemplo n.º 22
0
        /// <summary>
        /// determines if an Aura with any slowing effect matching
        /// slowedPct or greater is affecting unit
        /// </summary>
        /// <param name="unit">WoWUnit to check</param>
        /// <param name="slowedPct">% slowing required for true</param>
        /// <returns>true: if slowed by slowedPct or more, false: if not slowed as much as specified</returns>
        public static bool IsSlowed(this WoWUnit unit, uint slowedPct = 50)
        {
            if (unit == null)
            {
                return(false);
            }

            int     slowedCompare = -(int)slowedPct;
            WoWAura foundAura     = null;

            Styx.WoWInternals.DBC.SpellEffect foundSE = null;
            int foundSpellId = 0;

            foreach (WoWAura aura in unit.GetAllAuras())
            {
                foreach (Styx.WoWInternals.DBC.SpellEffect se in aura.Spell.SpellEffects)
                {
                    if (se != null && se.AuraType == WoWApplyAuraType.ModDecreaseSpeed && se.BasePoints <= slowedCompare)
                    {
                        foundAura    = aura;
                        foundSE      = se;
                        foundSpellId = aura.SpellId;
                        break;
                    }
                }
            }

            if (SingularSettings.Debug)
            {
                if ((foundAura != null) != lastIsSlowedResult || lastIsSlowedTarget != unit.Guid || lastIsSlowedSpellId != foundSpellId)
                {
                    lastIsSlowedResult  = (foundAura != null);
                    lastIsSlowedTarget  = unit.Guid;
                    lastIsSlowedSpellId = foundSpellId;
                    if (foundAura != null)
                    {
                        if (foundSE != null)
                        {
                            Logger.WriteDebug("IsSlowed: target {0} slowed {1}% with [{2}] #{3}", unit.SafeName(), foundSE.BasePoints, foundAura.Name, foundSpellId);
                        }
                    }
                }
            }

            return(foundSE != null);
        }
Exemplo n.º 23
0
 //Used for checking how the time left on "my" debuff
 private int MyDebuffTime(String spellName, WoWUnit unit)
 {
     using (new FrameLock())
     {
         if (unit.HasAura(spellName))
         {
             var auras = unit.GetAllAuras();
             foreach (var a in auras)
             {
                 if (a.Name == spellName && a.CreatorGuid == Me.Guid)
                 {
                     return(a.TimeLeft.Seconds);
                 }
             }
         }
     }
     return(0);
 }
Exemplo n.º 24
0
        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());
        }
Exemplo n.º 25
0
 //Used for checking debuff timers
 private int DebuffTime(String spellName, WoWUnit unit)
 {
     using (new FrameLock())
     {
         if (unit.HasAura(spellName))
         {
             var auras = unit.GetAllAuras();
             foreach (var b in auras)
             {
                 if (b.Name == spellName)
                 {
                     return(b.TimeLeft.Seconds);
                 }
             }
         }
     }
     return(0);
 }
Exemplo n.º 26
0
        public static bool IsMelee(this WoWUnit unit)
        {
            if (unit.Class == WoWClass.DeathKnight ||
                unit.Class == WoWClass.Paladin ||
                unit.Class == WoWClass.Rogue ||
                unit.Class == WoWClass.Warrior)
            {
                return(true);
            }

            if (!unit.IsMe)
            {
                if (unit.Class == WoWClass.Monk)
                {
                    return(true);
                }

                if (unit.Class == WoWClass.Druid && unit.HasAura("Cat Form"))
                {
                    return(true);
                }

                if (unit.Class == WoWClass.Shaman && unit.GetAllAuras().Any(a => a.Name == "Unleashed Rage" && a.CreatorGuid == unit.Guid))
                {
                    return(true);
                }

                return(false);
            }

            switch (StyxWoW.Me.Specialization)
            {
            case WoWSpec.DruidFeral:
            case WoWSpec.DruidGuardian:
            case WoWSpec.MonkBrewmaster:
            case WoWSpec.MonkWindwalker:
            case WoWSpec.ShamanEnhancement:
                return(true);
            }

            return(false);
        }
Exemplo n.º 27
0
 private static bool GetMyShieldonUnit(WoWUnit target)
 {
     return target.GetAllAuras().Any<WoWAura>(delegate(WoWAura aura)
     {
         if (aura.CreatorGuid != target.Guid)
         {
             return false;
         }
         if ((aura.SpellId != 974) && (aura.SpellId != 324))
         {
             return (aura.SpellId == 52127);
         }
         return true;
     });
 }
Exemplo n.º 28
0
 private static bool NeedPurgeASAPResto(WoWUnit target)
 {
     return target.GetAllAuras().Any<WoWAura>(aura => NeedPurgeASAPRestoHS.Contains(aura.Name));
 }
Exemplo n.º 29
0
        /// <summary>
        ///  Checks for the auras on a specified unit. Returns true if the unit has any aura with any of the mechanics in the mechanics list.
        /// </summary>
        /// <param name="unit"> The unit to check auras for. </param>
        /// <param name="mechanics"> Mechanics to be checked. </param>
        /// <returns></returns>
        public static bool HasAuraWithMechanic(this WoWUnit unit, params WoWSpellMechanic[] mechanics)
        {
            var auras = unit.GetAllAuras();

            return(auras.Any(a => mechanics.Contains(a.Spell.Mechanic)));
        }
Exemplo n.º 30
0
 private static bool HasAura(this WoWUnit unit, string aura, int stacks, WoWUnit creator)
 {
     return(unit.GetAllAuras().Any(a => a.Name == aura && a.StackCount >= stacks &&
                                   (creator == null || a.CreatorGuid == creator.Guid)));
 }
 /// <summary>
 /// Similar to WoWUnit.Mounted, but also tests for auras that provide a 'mounted' characteristic.
 /// <para>Notes:<list type="bullet">
 /// <item><description><para> * The following auras count as 'mounted' auras:
 /// Druid(Flight Form), Druid(Swift Fight Form, Druid(Travel Form), Shaman(Ghost Wolf),
 /// Worgen(Running Wild).</para></description></item>
 /// </list></para>
 /// </summary>
 /// <param name="wowUnit"></param>
 /// <returns></returns>
 public static bool IsMounted(this WoWUnit wowUnit)
 {
     return(wowUnit.Mounted ||
            wowUnit.GetAllAuras().Any(a => _mountedAuras.Contains(a.SpellId)));
 }
Exemplo n.º 32
0
        private static WoWAura GetPurgeEnemyAura(WoWUnit target)
        {
            if (SingularSettings.Instance.PurgeBuffs == PurgeAuraFilter.All)
                return target.GetAllAuras().FirstOrDefault(a => a.TimeLeft.TotalSeconds > 1 && a.Spell.DispelType == WoWDispelType.Magic);

            SpellList sl = StyxWoW.Me.Class == WoWClass.Mage ? MageSteallist.Instance.SpellList : PurgeWhitelist.Instance.SpellList;
            return target.GetAllAuras().FirstOrDefault(a => a.TimeLeft.TotalSeconds > 1 && a.Spell.DispelType == WoWDispelType.Magic && sl.Contains(a.SpellId));
        }
Exemplo n.º 33
0
 //Used for checking auras that has no time
 private bool IsMyAuraActive(WoWUnit Who, String What)
 {
     using (new FrameLock())
     {
         return Who.GetAllAuras().Where(p => p.CreatorGuid == Me.Guid && p.Name == What).FirstOrDefault() != null;
     }
 }
Exemplo n.º 34
0
 //Used for checking debuff timers
 private int DebuffTime(String spellName, WoWUnit unit)
 {
     using (new FrameLock())
     {
         if (unit.HasAura(spellName))
         {
             var auras = unit.GetAllAuras();
             foreach (var b in auras)
             {
                 if (b.Name == spellName)
                 {
                     return b.TimeLeft.Seconds;
                 }
             }
         }
     }
     return 0;
 }
Exemplo n.º 35
0
        /// <summary>Returns the timeleft of an aura by TimeSpan. Return TimeSpan.Zero if the aura doesn't exist.</summary>
        /// <param name="unit">The unit to check the aura for.</param>
        /// <param name="auraName">The name of the aura in English.</param>
        /// <param name="fromMyAura"> true if its from my aura</param>
        /// <returns>The get aura time left.</returns>
        public static TimeSpan GetAuraTimeLeft(WoWUnit unit, string auraName, bool fromMyAura)
        {
            if (unit != null)
            {
                var wantedAura = unit.GetAllAuras().FirstOrDefault(a => a.Name == auraName && (!fromMyAura || a.CreatorGuid == StyxWoW.Me.Guid));
                return wantedAura != null ? wantedAura.TimeLeft : TimeSpan.Zero;
            }

            CLULogger.DiagnosticLog(" [GetAuraTimeLeft] Unit is null ");
            return TimeSpan.Zero;
        }
Exemplo n.º 36
0
 /// <summary>
 /// Checks to see if specified target is under the effect of crowd control
 /// </summary>
 /// <param name="target">Target</param>
 /// <returns></returns>
 private static bool IsCrowdControlled(WoWUnit target)
 {
     // Just want to throw a shout-out to Singular for this function.
     return
         target.GetAllAuras().Any(
             unit =>
             unit.Spell.Mechanic == WoWSpellMechanic.Banished || unit.Spell.Mechanic == WoWSpellMechanic.Charmed
             || unit.Spell.Mechanic == WoWSpellMechanic.Horrified
             || unit.Spell.Mechanic == WoWSpellMechanic.Incapacitated
             || unit.Spell.Mechanic == WoWSpellMechanic.Polymorphed
             || unit.Spell.Mechanic == WoWSpellMechanic.Sapped
             || unit.Spell.Mechanic == WoWSpellMechanic.Shackled
             || unit.Spell.Mechanic == WoWSpellMechanic.Asleep
             || unit.Spell.Mechanic == WoWSpellMechanic.Frozen);
 }
Exemplo n.º 37
0
 /// <summary>Checks for the auras on a specified unit. Returns true if the unit has any aura in the auraNames list.</summary>
 /// <param name="unit">The unit to check auras for.</param>
 /// <param name="aura">Aura names to be checked.</param>
 /// <param name="creator">Check for only self or all buffs</param>
 /// <returns>The has aura.</returns>
 public static bool HasAura(WoWUnit unit, string aura, WoWUnit creator)
 {
     return unit != null && unit.GetAllAuras().Any(a => a.Name == aura && (creator == null || a.CreatorGuid == creator.Guid));
 }
Exemplo n.º 38
0
 /// <summary>Checks for the auras on a specified unit. Returns true if the unit has any aura in the auraNames list.</summary>
 /// <param name="unit">The unit to check auras for.</param>
 /// <param name="spellId">Aura names to be checked.</param>
 /// <param name="creator">Check for only self or all buffs</param>
 /// <returns>The has aura.</returns>
 public static bool HasAura(WoWUnit unit, int spellId, WoWUnit creator)
 {
     return unit != null && unit.GetAllAuras().Any(a => a.SpellId == spellId && (creator == null || a.CreatorGuid == creator.Guid));
 }
Exemplo n.º 39
0
 private static bool Debuff63280Duration(WoWUnit target, double duration, bool LogSpell = false)
 {
     return target.GetAllAuras().Any<WoWAura>(aura => Debuff63280DurationHS.Contains(aura.SpellId));
 }
Exemplo n.º 40
0
 public static bool IsSilenced(WoWUnit unit)
 {
     return(unit.GetAllAuras().Any(a => a.IsHarmful &&
                                   (a.Spell.Mechanic == WoWSpellMechanic.Interrupted ||
                                    a.Spell.Mechanic == WoWSpellMechanic.Silenced)));
 }
Exemplo n.º 41
0
 //Used for checking how the time left on "my" debuff
 private int MyDebuffTime(String spellName, WoWUnit unit)
 {
     using (new FrameLock())
     {
         if (unit.HasAura(spellName))
         {
             var auras = unit.GetAllAuras();
             foreach (var a in auras)
             {
                 if (a.Name == spellName && a.CreatorGuid == Me.Guid)
                 {
                     return a.TimeLeft.Seconds;
                 }
             }
         }
     }
     return 0;
 }
Exemplo n.º 42
0
 private static WoWAura MyAura(WoWUnit Who, String What)
 {
     return Who.GetAllAuras().FirstOrDefault(p => p.CreatorGuid == StyxWoW.Me.Guid && p.Name == What);
 }
Exemplo n.º 43
0
 public static bool IsSilenced(WoWUnit unit)
 {
     return unit.GetAllAuras().Any(a => a.IsHarmful &&
         (a.Spell.Mechanic == WoWSpellMechanic.Interrupted || 
         a.Spell.Mechanic == WoWSpellMechanic.Silenced));
 }
 // 16Apr2013-10:34UTC chinajade
 public static bool IsShapeshifted(this WoWUnit wowUnit)
 {
     return(wowUnit.GetAllAuras().Any(a => _shapeshiftAuras.Contains(a.SpellId)));
 }
Exemplo n.º 45
0
        /// <summary>Check the aura stack count thats created by the specified unit</summary>
        /// <param name="unit">The unit to check auras for.</param>
        /// <param name="auraId">The Id of the aura</param>
        /// <param name="fromMyAura">True if you applied the aura</param>
        /// <returns>The get aura stack.</returns>
        public static uint GetAuraStack(WoWUnit unit, int auraId, bool fromMyAura)
        {
            if (unit != null)
            {
                var wantedAura = unit.GetAllAuras().FirstOrDefault(a => a.SpellId == auraId && a.StackCount > 0 && (!fromMyAura || a.CreatorGuid == Me.Guid));
                return wantedAura != null ? wantedAura.StackCount : 0;
            }

            CLULogger.DiagnosticLog(" [GetAuraStack] Unit is null ");
            return 0;
        }
Exemplo n.º 46
0
 private static int CountMagicBuffPurge(WoWUnit target)
 {
     return target.GetAllAuras().Count<WoWAura>(a => ((a.IsActive && !a.IsHarmful) && (a.get_Spell().get_DispelType() == ((WoWDispelType)((int)WoWDispelType.Magic)))));
 }
Exemplo n.º 47
0
 private static bool CanHex(WoWUnit target)
 {
     return target.GetAllAuras().All<WoWAura>(aura => !HexImmuneAura.Contains(aura.SpellId));
 }
Exemplo n.º 48
0
 private static bool NeedTremor(WoWUnit target, int duration, bool writelog = true)
 {
     foreach (WoWAura aura in target.GetAllAuras())
     {
         if ((((aura.TimeLeft.TotalMilliseconds >= duration) && (aura.SpellId != 30283)) && (aura.SpellId != 132168)) && ((DebuffNeedTremor.Contains(aura.SpellId) || (aura.get_Spell().get_Mechanic() == ((WoWSpellMechanic)((int)WoWSpellMechanic.Asleep)))) || (((aura.get_Spell().get_Mechanic() == ((WoWSpellMechanic)((int)WoWSpellMechanic.Charmed))) || (aura.get_Spell().get_Mechanic() == ((WoWSpellMechanic)((int)WoWSpellMechanic.Fleeing)))) || (aura.get_Spell().get_Mechanic() == ((WoWSpellMechanic)((int)WoWSpellMechanic.Horrified))))))
         {
             if (writelog)
             {
                 Logging.Write("NeedTremor {0} {1} ID: {2}", new object[] { target.SafeName, aura.Name, aura.SpellId });
             }
             return true;
         }
     }
     return false;
 }
Exemplo n.º 49
0
 /// <summary>returns true if the unit is crowd controlled.</summary>
 /// <param name="unit">unit to check</param>
 /// <param name="breakOnDamageOnly">true for break on damage</param>
 /// <returns>The unit is controlled.</returns>
 public static bool UnitIsControlled(WoWUnit unit, bool breakOnDamageOnly)
 {
     return unit != null && unit.GetAllAuras().Any(x => x.IsHarmful && (ControlDebuffs.Contains(x.Name) || (!breakOnDamageOnly && ControlUnbreakableDebuffs.Contains(x.Name))));
 }
Exemplo n.º 50
0
 public static bool IsFrozen(this WoWUnit unit)
 {
     return(unit.GetAllAuras().Any(a => a.Spell.Mechanic == WoWSpellMechanic.Frozen || (a.Spell.School == WoWSpellSchool.Frost && a.Spell.SpellEffects.Any(e => e.AuraType == WoWApplyAuraType.ModRoot))));
 }
Exemplo n.º 51
0
 public static double GetAuraTimeLeft(WoWUnit auraTarget, string auraName, UInt64 creatorGuid)
 {
     if( auraTarget == null) return 0;
     return (from aura in auraTarget.GetAllAuras()
             where aura.Name == auraName && aura.CreatorGuid == creatorGuid
             select aura.TimeLeft.TotalSeconds).FirstOrDefault();
 }