private void formatslog(string type, string reason, string spell, WoWUnit target)
 {
     System.Drawing.Color textcolor;
     switch (type)
     {
         case "Heal":
             textcolor = Color.Green;
             break;
         case "Cleanse":
             textcolor = Color.Magenta;
             break;
         case "Buff":
             textcolor = Color.Brown;
             break;
         case "OhShit":
             textcolor = Color.Red;
             break;
         case "Mana":
             textcolor = Color.Blue;
             break;
         case "DPS":
             textcolor = Color.Violet;
             break;
         case "Utility":
             textcolor = Color.Orange;
             break;
         default:
             textcolor = Color.Black;
             break;
     }
     slog(textcolor, reason + ": casting {0} on {1} at distance {2} with type {3} at hp {4}", spell, privacyname(target), Round(target.Distance), type, Round(target.HealthPercent));
 }
示例#2
0
 public static void LogCast(string sname, WoWUnit unit, double health, double dist)
 {
     if (unit.IsMe)
         Logger.Write("Casting {0} on Me @ {1:F1}%", sname, health);
     else
         Logger.Write("Casting {0} on {1} @ {2:F1}% at {3:F1} yds", sname, unit.SafeName(), health, dist);
 }
示例#3
0
 private static bool CanCastFortitudeOn(WoWUnit unit)
 {
     //return !unit.HasAura("Blood Pact") &&
     return !unit.HasAura("Power Word: Fortitude") &&
            !unit.HasAura("Qiraji Fortitude") &&
            !unit.HasAura("Commanding Shout");
 }
示例#4
0
        static bool ValidUnit(WoWUnit p)
        {
            if (IgnoreMobs.Contains(p.Entry))
                return false;

            // Ignore shit we can't select/attack
            if (!p.CanSelect || !p.Attackable)
                return false;

            // Ignore friendlies!
            if (p.IsFriendly)
                return false;

            // Duh
            if (p.Dead)
                return false;

            // Dummies/bosses are valid by default. Period.
            if (p.IsTrainingDummy() || p.IsBoss())
                return true;

            // If its a pet, lets ignore it please.
            if (p.IsPet || p.OwnedByRoot != null)
                return false;

            // And ignore critters/non-combat pets
            if (p.IsNonCombatPet || p.IsCritter)
                return false;

            return true;
        }
示例#5
0
文件: Spell.cs 项目: Marteen21/Radar
 public bool CastIfHasBuff(WoWGlobal wowinfo, WoWUnit unit) {
     if (unit.HasBuff(this.ID)) {
         this.SendCast();
         return true;
     }
     return false;
 }
示例#6
0
        public static void MovementThread()
        {
            while (TreeRoot.IsRunning)
            {
                try
                {
                    Thread.Sleep(1000 / FPSPulse);

                    if (!StyxWoW.IsInGame) continue;
                    if (!ObjectManager.Me.IsValid) continue;
                    if (ObjectManager.Me.CurrentTarget == null) continue;
                    if (!StyxWoW.Me.GotTarget) continue;
                    if (Me.CurrentTarget.IsFriendly) continue;
                    if (ObjectManager.Me.Mounted) continue;

                    Target = Me.CurrentTarget;

                    if (Me.MovementInfo.CurrentSpeed == 0)
                    {
                        Me.CurrentTarget.Face();
                    }
                }
                catch (System.Exception) { }
            }

            tMovement = null;
        }
示例#7
0
        internal static void PulseMovement()
        {
            try
            {
                // Experimenting with Facing
                if (ObjectManager.Me.CurrentTarget == null) WoWMovement.StopFace();

                // bunch of fuckoff checks to make sure we can even do the movements.
                if (StyxWoW.IsInGame == false) return;
                if (Me.IsValid == false) return;
                if (Me.CurrentTarget == null) return;
                if (Me.GotTarget == false) return;
                if (Me.Mounted) return;
                if (Me.Dead) return;
                if (Settings._Instance.PlayersOnly) if (Me.CurrentTarget.IsPlayer == false) return;

                // Target stuff
                Target = Me.CurrentTarget;
                if (Target.Distance > 10) return;
                if (Target.Dead) return;
                //if (Target.IsFriendly) return;

                // Do our movement stuff
                CheckFace();
                if (CheckMoving()) return;
                if (CheckStop()) return;
            }
            catch (System.Exception) { }
        }
示例#8
0
        /// <summary>
        /// WillChainHealHop()
        /// Tests whether casting Chain Lightning on 'healTarget' results in a minimum 
        /// of 2 hops (3 people healed.) 
        /// </summary>
        /// <param name="healTarget"></param>
        /// <returns></returns>
        public static bool WillChainHealHop(WoWUnit healTarget)
        {
            double threshhold = SingularSettings.Instance.Shaman.RAF_ChainHeal_Health;

            if (healTarget == null)
                return false;

            var t = (from o in ObjectManager.ObjectList
                     where o is WoWPlayer && healTarget.Location.Distance(o.Location) < 12
                     let p = o.ToPlayer()
                     where p != null
                           && p.IsHorde == StyxWoW.Me.IsHorde
                           && !p.IsPet
                           && p != healTarget
                           && p.IsAlive
                           && p.HealthPercent < threshhold
                     let c = (from oo in ObjectManager.ObjectList
                              where oo is WoWPlayer && p.Location.Distance(oo.Location) < 12
                              let pp = oo.ToPlayer()
                              where pp != null
                                    && pp.IsHorde == p.IsHorde
                                    && !pp.IsPet
                                    && pp.IsAlive
                                    && pp.HealthPercent < threshhold
                              select pp).Count()
                     orderby c descending, p.Distance ascending
                     select new { Player = p, Count = c }).FirstOrDefault();

            if (t == null || t.Count < 3)
                return false;
            return true;
        }
示例#9
0
        private static void DoMovement(WoWUnit Target)
        {
            // Thought i might try add this, just to see if this might catch wow's error
            // prob a longggggggggg shot, but worth the try.
            // -> my thoughts, if theres something to catch, maybe it wont crash wow it self?, but im guessing hb will still cause crash
            try
            {
                // If we are > 2, we need to get closer to them at all costs.
                if (Target.Distance > 2)
                {
                    ClickToMove.MoveTo(Target.Location);
                    return;
                }

                //// If player not moving and we not behind, lets get behind
                //if ((Target.MovementInfo.CurrentSpeed == 0) && (!Target.MeIsSafelyBehind))
                //{
                //    WoWPoint BehindLocation = WoWMathHelper.CalculatePointBehind(Target.Location, Target.Rotation, 1.5f);
                //    ClickToMove.MoveTo(BehindLocation);
                //}

                //// If where behind them and not facing them, Face them
                //if ((Target.MeIsSafelyBehind) && (!Me.IsSafelyFacing(Target)))
                //{
                //    Target.Face();
                //}

            } catch (Exception) { }
        }
示例#10
0
 /// <summary>
 ///  Returns maximum spell range based on hitbox of unit. 
 /// </summary>
 /// <param name="spell"></param>
 /// <param name="unit"></param>
 /// <returns>Maximum spell range</returns>
 public static float ActualMaxRange(this WoWSpell spell, WoWUnit unit)
 {
     if (spell.MaxRange == 0)
         return 0;
     // 0.3 margin for error
     return unit != null ? spell.MaxRange + unit.CombatReach + 1f : spell.MaxRange;
 }
示例#11
0
 public override Task<bool> CastOnTarget(WoWUnit target)
 {
     base.Conditions.Clear();
     InitializeBase();
     base.Conditions.Add(_energy);
     base.Conditions.Add(new TargetNotAuraUpCondition(target, Spell));
     return base.CastOnTarget(target);
 }
示例#12
0
 /// <summary>
 /// Returns the estimated combat time left for this unit. (Time until death)
 /// If the unit is invalid; TimeSpan.MinValue is returned.
 /// </summary>
 /// <param name="u"></param>
 /// <returns></returns>
 public static TimeSpan GetCombatTimeLeft(WoWUnit u)
 {
     if (DpsInfos.ContainsKey(u.Guid))
     {
         return DpsInfos[u.Guid].CombatTimeLeft;
     }
     return TimeSpan.MinValue;
 }
示例#13
0
 public override Task<bool> CastOnTarget(WoWUnit target)
 {
     base.Conditions.Clear();
     InitializeBase();
     Conditions.Add(Energy);
     Conditions.Add(new BooleanCondition(target != null && target.IsWithinMeleeRange));
     return base.CastOnTarget(target);
 }
示例#14
0
 /// <summary>
 /// Returns the current DPS on a specific unit, or -1 if the unit is not currently being tracked, or doesn't exist.
 /// </summary>
 /// <param name="u"></param>
 /// <returns></returns>
 public static double GetDps(WoWUnit u)
 {
     if (DpsInfos.ContainsKey(u.Guid))
     {
         return DpsInfos[u.Guid].CurrentDps;
     }
     // -1 is a fail case.
     return -1;
 }
示例#15
0
        /// <summary>
        /// Returns the string "Myself" if the unit name is equal to our name.
        /// </summary>
        /// <param name="unit">the unit to check</param>
        /// <returns>a safe name for the log</returns>
        public static string SafeName(WoWUnit unit)
        {
            if (unit != null)
            {
                return (unit.Name == StyxWoW.Me.Name) ? "Myself" : unit.Name;
            }

            return "No Target";
        }
示例#16
0
        /// <summary>
        /// Casts spell
        /// </summary>
        /// <param name="SpellName"></param>
        /// <param name="Player"></param>
        /// <returns></returns>
        public static bool Cast(string SpellName, WoWUnit CastOn)
        {
            if (SpellManager.HasSpell(SpellName) == false) return false;
            if (SpellManager.CanCast(SpellName) == false) return false;

            Log.Write("Casting {0} on [{1}]", SpellName, CastOn.Name);

            return SpellManager.Cast(SpellName, CastOn);
        }
示例#17
0
 public override bool ReCast(WoWGlobal wowinfo, WoWUnit unit) {
     if (!unit.HasBuff(this.ID) && !wowinfo.SpellIsPending && wowinfo.HasRunesFor(cost)) {
         this.SendCast();
         return true;
     }
     else {
         return false;
     }
 }
示例#18
0
文件: DoT.cs 项目: Marteen21/Radar
 public virtual bool ReCast(WoWGlobal wowinfo, WoWUnit unit) {
     if (!unit.HasBuff(this.ID) /*&& !wowinfo.SpellIsPending*/) {
         this.SendCast();
         return true;
     }
     else {
         return false;
     }
 }
示例#19
0
        public static void MoveBehind(WoWUnit Unit)
        {
            // Movement Checks
            if (GlueEnabled && Unit.Distance < 10) return;
            if (!ClassSettings._Instance.GeneralMovement) return;

            WoWPoint BehindLocation = WoWMathHelper.CalculatePointBehind(Unit.Location, Unit.Rotation, 2.3f);
            Navigator.MoveTo(BehindLocation);
        }
示例#20
0
 public static UnitOracle FindUnit(WoWUnit unit)
 {
     try {
         // CLU.DebugLog(Color.GreenYellow, "[CLU-ORACLE] " + CLU.Version + ": FindUnit [" + unit + "] = [" + unit.Guid + "]");
         return instances[unit.Guid];
     } catch {
         return null;
     }
 }
示例#21
0
文件: Curse.cs 项目: Marteen21/Radar
 public override bool ReCast(WoWGlobal wowinfo, WoWUnit unit) {
     if (!unit.HasBuff(cot) && !unit.HasBuff(cote) && !unit.HasBuff(cow) && !unit.HasBuff(coe)) {
         this.SendCast();
         return true; 
     }
     else {
         return false;
     }
 }
示例#22
0
 public override Task<bool> CastOnTarget(WoWUnit target)
 {
     Conditions.Clear();
     InitializeBase();
     Conditions.Add(new InMeeleRangeCondition());
     Conditions.Add(new BooleanCondition(Me.ComboPoints <= 2));
     Conditions.Add(new BooleanCondition(SettingsManager.Instance.UseMFD));
     return base.CastOnTarget(target);
 }
        public static bool CanCast(string spellName, WoWUnit onUnit)
        {
            if (onUnit == null) { return false;}

            //trying to prevent vt from doublecasting....

            // Do we have spell?
            if (!SpellManager.Spells.ContainsKey(spellName))
            {
                return false;
            }

            WoWSpell spell = SpellManager.Spells[spellName];

            if (spellName == "Vampiric Touch" && spell.Cooldown ) {
                return false;
            }

            // are we casting or channeling ?
            if (Me.ChanneledCastingSpellId == 15407 && spellName != "Vampiric Touch" &&
                AuraManager.GetAuraTimeLeft("Mind Flay", onUnit, true).TotalSeconds >= AltarboySettings.Instance.ClippingDuration)
            {
                return false;
            }

            if (Priest.ActiveSpec == TalentSpec.DisciplinePriest && (Me.IsCasting || Me.ChanneledCastingSpellId != 0))
            {
                return false;
            }

            if (SpellManager.GlobalCooldownLeft.TotalSeconds > AltarboySettings.Instance.CoolDownDuration)
               {
               return false;
               }

            // is spell in CD?
            if (spell.CooldownTimeLeft.TotalSeconds >= AltarboySettings.Instance.CoolDownDuration )
            {
                return false;
            }

            // minrange check
            if (spell.MinRange != 0 && onUnit.DistanceSqr < spell.MinRange * spell.MinRange)
            {
                return false;
            }

            // do we have enough power?
            if (Me.GetCurrentPower(spell.PowerType) < spell.PowerCost)
            {
                return false;
            }

            return true;
        }
        public static void CastPetAction(string action, WoWUnit on)
        {
            var spell = Me.PetSpells.FirstOrDefault(p => p.ToString() == action);
            if (spell == null)
                return;

            Logging.Write(string.Format("[Pet] Casting {0} on {1}", action, on.Name));
            StyxWoW.Me.SetFocus(on);
            Lua.DoString("CastPetAction({0}, 'focus')", spell.ActionBarIndex + 1);
            StyxWoW.Me.SetFocus(0);
        }
示例#25
0
 public override async Task<bool> CastOnTarget(WoWUnit target)
 {
     Conditions.Clear();
     if (MustWaitForGlobalCooldown) Conditions.Add(new IsOffGlobalCooldownCondition());
     if (MustWaitForSpellCooldown) Conditions.Add(new SpellIsNotOnCooldownCondition(Spell));
     Conditions.Add(new BooleanCondition(target != null));
     Conditions.Add(new InMeeleRangeCondition(target));
     Conditions.Add(_energy);
     Conditions.Add(new ComboPointCondition(5));
     return await base.CastOnTarget(target);
 }
示例#26
0
 private static List<WoWUnit> GetUnitsChainWillJumpTo(WoWUnit target, List<WoWUnit> otherUnits, float chainRange)
 {
     var targetLoc = target.Location;
     var targetGuid = target.Guid;
     for (int i = otherUnits.Count - 1; i >= 0; i--)
     {
         if (otherUnits[i].Guid == targetGuid || otherUnits[i].Location.DistanceSqr(targetLoc) > chainRange)
             otherUnits.RemoveAt(i);
     }
     return otherUnits;
 }
示例#27
0
 public override async Task<bool> CastOnTarget(WoWUnit target)
 {
     Conditions.Clear();
     if (MustWaitForGlobalCooldown) Conditions.Add(new IsOffGlobalCooldownCondition());
     if (MustWaitForSpellCooldown) Conditions.Add(new SpellIsNotOnCooldownCondition(Spell));
     Conditions.Add(new BooleanCondition(target != null));
     Conditions.Add(new InMeeleRangeCondition(target));
     Conditions.Add(new TargetNotAuraUpCondition(Me, WoWSpell.FromId(SpellBook.AuraVanish)));
     //Conditions.Add(new ApplyPoisonToSurroundingCondition(UnitManager.Instance.LastKnownPoisonedEnemies));
     return await base.CastOnTarget(target);
 }
示例#28
0
 public override Task<bool> CastOnTarget(WoWUnit target)
 {
     base.Conditions.Clear();
     InitializeBase();
     Conditions.Add(new BooleanCondition(SettingsManager.Instance.UseKillingSpree));
     Conditions.Add(new InMeeleRangeCondition());
     Conditions.Add(new ConditionSwitchTester(
         new BooleanCondition(SettingsManager.Instance.KillingSpreeOnlyOnBoss),
         new OnlyOnBossCondition()));
     base.Conditions.Add(new TargetNotAuraUpCondition(Me, WoWSpell.FromId(SpellBook.CastAdrenalineRush)));
     return base.CastOnTarget(target);
 }
示例#29
0
 public override async Task<bool> CastOnTarget(WoWUnit target)
 {
     Conditions.Clear();
     if (MustWaitForGlobalCooldown) Conditions.Add(new IsOffGlobalCooldownCondition());
     if (MustWaitForSpellCooldown) Conditions.Add(new SpellIsNotOnCooldownCondition(Spell));
     Conditions.Add(new BooleanCondition(target != null));
     Conditions.Add(new InMeeleRangeCondition(target));
     Conditions.Add(Energy);
     Conditions.Add(new TargetIsInHealthRangeCondition(target, 35, 100));
     Conditions.Add(new WillNotCapComboPointsCondition(2));
     return await base.CastOnTarget(target);
 }
 public override void Pulse()
 {
     if (Me != null && Me.IsValid && Me.IsAlive && Me.IsInInstance)
     {
         tank = GetTank();
         if (tank == null)
         {
             tank = Me;
         }
         Combat();
     }
 }
示例#31
0
 /// <summary>
 ///     Retrieves the last 4 characters of the Guid.
 /// </summary>
 public static string GetUnitId(this WoWUnit thisUnit)
 {
     return(UnitManager.GuidToUnitId(thisUnit.Guid));
 }
示例#32
0
 public static bool HasCancelableEnragedEffect(this WoWUnit thisUnit)
 {
     return(thisUnit.GetAllAuras().Any(o => o.Name == "Enraged" && o.Flags.HasFlag(AuraFlags.Cancelable)));
 }
示例#33
0
        public static void QuestTurnIn(ref Npc npc, string questName, int questId, bool ignoreBlacklist = false, bool forceTravel = false)
        {
            if (npc.ForceTravel)
            {
                forceTravel = true;
            }
            Point   me   = ObjectManager.ObjectManager.Me.Position;
            WoWUnit mNpc = ObjectManager.ObjectManager.GetNearestWoWUnit(ObjectManager.ObjectManager.GetWoWUnitByEntry(npc.Entry, true), false, ignoreBlacklist, true);

            if (mNpc.IsValid && mNpc.CanTurnIn)
            {
                npc.Position = mNpc.Position;
            }
            WoWGameObject mObj = ObjectManager.ObjectManager.GetNearestWoWGameObject(ObjectManager.ObjectManager.GetWoWGameObjectByEntry(npc.Entry), ignoreBlacklist);

            if (mObj.IsValid && mObj.CanTurnIn)
            {
                npc.Position = mObj.Position;
            }
            bool bypassTravel = false;

            if (me.DistanceTo(npc.Position) <= 800f)
            {
                PathFinder.FindPath(npc.Position, out bypassTravel);
            }
            if (Usefuls.IsFlying && npc.ContinentIdInt == Usefuls.ContinentId)
            {
                bypassTravel = true;
            }
            else if (Usefuls.IsFlying)
            {
                MountTask.DismountMount();
            }
            if (_travelLocation != null && _travelLocation.DistanceTo(me) > 0.1f)
            {
                if (Products.Products.TravelRegenerated && Products.Products.TravelFrom.IsValid)
                {
                    _travelLocation = Products.Products.TravelFrom;
                    Products.Products.TravelRegenerated = false;
                }
            }
            if (!bypassTravel && (_travelLocation == null || _travelLocation.DistanceTo(me) > 0.1f) && !_travelDisabled)
            {
                MovementManager.StopMove();
                Logging.Write("Calling travel system for TurnInQuest " + questName + "(" + questId + ") from " + npc.Name + " (" + npc.Entry + ")...");
                Products.Products.TravelToContinentId   = npc.ContinentIdInt;
                Products.Products.TravelTo              = npc.Position;
                Products.Products.TravelFromContinentId = Usefuls.ContinentId;
                Products.Products.TravelFrom            = me;
                Products.Products.ForceTravel           = forceTravel;
                // Pass the check for valid destination as a lambda
                Products.Products.TargetValidationFct = IsNearQuestGiver;
                _travelLocation = Products.Products.TravelFrom;
                return;
            }
            if (_travelLocation != null && _travelLocation.DistanceTo(me) <= 0.1f)
            {
                _travelDisabled = true;
            }
            //Start target finding based on QuestGiver.
            uint baseAddress = MovementManager.FindTarget(ref npc, 4.5f, true, true, 0f, ignoreBlacklist);

            if (MovementManager.InMovement)
            {
                return;
            }

            if (baseAddress > 0)
            {
                var tmpNpc = ObjectManager.ObjectManager.GetObjectByGuid(npc.Guid);
                if (tmpNpc is WoWUnit)
                {
                    var unitTest = tmpNpc as WoWUnit;
                    if (unitTest.IsValid && unitTest.GetDistance < 20f && !unitTest.CanTurnIn)
                    {
                        _travelDisabled = false; // reset travel
                        nManagerSetting.AddBlackList(unitTest.Guid, 30000);
                        Logging.Write("Npc QuestGiver " + unitTest.Name + " (" + unitTest.Entry + ", distance: " + unitTest.GetDistance +
                                      ") cannot TurnIn any quest right now. Blacklisting it for 30 seconds.");
                        return;
                    }
                }
            }
            _travelDisabled = false; // reset travel
            ItemInfo equip = null;

            //End target finding based on QuestGiver.
            if (mObj.IsValid && mObj.GetDistance <= 4.5f || npc.Position.DistanceTo2D(ObjectManager.ObjectManager.Me.Position) < 4.5f && npc.Position.DistanceZ(ObjectManager.ObjectManager.Me.Position) < 6f ||
                npc.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) < 4.5f)
            {
                if (baseAddress <= 0)
                {
                    npc.Ignore(120000);
                    return;
                }
                if (Usefuls.IsFlying)
                {
                    MountTask.Land();
                }
                InteractTarget(ref npc, baseAddress);
                Logging.Write("QuestTurnIn " + questName + " (" + questId + ") to " + npc.Name + " (" + npc.Entry + ")");
                int id = GetQuestID();
                if (GetNumGossipActiveQuests() == 0 && id == questId)
                {
                    if (Others.IsFrameVisible("QuestFrameCompleteButton") && !Others.IsFrameVisible("QuestFrameCompleteQuestButton"))
                    {
                        Lua.RunMacroText("/click QuestFrameCompleteButton");
                        Thread.Sleep(300);
                    }
                    equip = CompleteQuest();
                    Thread.Sleep(Usefuls.Latency + 500);
                }
                if (!GetLogQuestId().Contains(questId)) // It's no more in the quest log, then we did turn in it sucessfuly
                {
                    id = GetQuestID();
                    FinishedQuestSet.Add(questId);
                    CloseWindow();
                    AbandonnedId = id;
                }
                else
                {
                    bool systemWorks = GetGossipActiveQuestsWorks();
                    if (systemWorks) // 2 quest gossip systems = 2 different codes :(
                    {
                        for (int i = 1; i <= GetNumGossipActiveQuests(); i++)
                        {
                            SelectGossipActiveQuest(i);
                            Thread.Sleep(Usefuls.Latency + 500);
                            id = GetQuestID();
                            if (id == 0)
                            {
                                systemWorks = false;
                                break;
                            }
                            if (id == questId)
                            {
                                if (Others.IsFrameVisible("QuestFrameCompleteButton") && !Others.IsFrameVisible("QuestFrameCompleteQuestButton"))
                                {
                                    Lua.RunMacroText("/click QuestFrameCompleteButton");
                                    Thread.Sleep(300);
                                }
                                equip = CompleteQuest();
                                Thread.Sleep(Usefuls.Latency + 500);
                                // here it can be the next quest id presented automatically when the current one is turned in
                                id = GetQuestID();
                                CloseWindow();
                                if (GetLogQuestId().Contains(questId))
                                {
                                    equip = null;
                                    Logging.WriteError("Could not turn-in quest " + questId + ": \"" + questName + "\"");
                                    break;
                                }
                                FinishedQuestSet.Add(questId);
                                AbandonnedId = id;
                                break;
                            }
                            CloseWindow();
                            Thread.Sleep(Usefuls.Latency + 500);
                            Interact.InteractWith(baseAddress);
                            Thread.Sleep(Usefuls.Latency + 500);
                        }
                    }
                    if (!systemWorks)
                    {
                        int gossipid = 1;
                        while (GetActiveTitle(gossipid) != "")
                        {
                            SelectActiveQuest(gossipid);
                            Thread.Sleep(Usefuls.Latency + 500);
                            id = GetQuestID();
                            if (id == questId)
                            {
                                if (Others.IsFrameVisible("QuestFrameCompleteButton") && !Others.IsFrameVisible("QuestFrameCompleteQuestButton"))
                                {
                                    Lua.RunMacroText("/click QuestFrameCompleteButton");
                                    Thread.Sleep(300);
                                }
                                equip = CompleteQuest();
                                Thread.Sleep(Usefuls.Latency + 500);
                                CloseWindow();
                                if (GetLogQuestId().Contains(questId))
                                {
                                    equip = null;
                                    Logging.WriteError("Could not turn-in quest " + questId + ": \"" + questName + "\"");
                                    break;
                                }
                                FinishedQuestSet.Add(questId);
                                break;
                            }
                            CloseWindow();
                            Thread.Sleep(Usefuls.Latency + 500);
                            Interact.InteractWith(baseAddress);
                            Thread.Sleep(Usefuls.Latency + 500);
                            gossipid++;
                        }
                    }
                }
            }
            Thread.Sleep(Usefuls.Latency);
            if (equip != null)
            {
                ItemSelection.EquipItem(equip);
                Thread.Sleep(Usefuls.Latency + 500);
            }
            CloseWindow();
            if (!GetLogQuestId().Contains(questId))
            {
                FinishedQuestSet.Add(questId);
            }
        }
    internal static void CombatRotation()
    {
        bool    _shouldBeInterrupted = ToolBox.EnemyCasting();
        bool    _inMeleeRange        = ObjectManager.Target.GetDistance < 6f;
        WoWUnit Target = ObjectManager.Target;

        // Check Auto-Attacking
        ToolBox.CheckAutoAttack(Attack);

        // Check if fighting a caster
        if (_shouldBeInterrupted)
        {
            _fightingACaster = true;
            if (!_casterEnemies.Contains(Target.Name))
            {
                _casterEnemies.Add(Target.Name);
            }
        }

        // Melee ?
        if (_pullMeleeTimer.ElapsedMilliseconds > 0)
        {
            _pullMeleeTimer.Reset();
        }

        if (_meleeTimer.ElapsedMilliseconds <= 0 &&
            _pullFromAfar)
        {
            _meleeTimer.Start();
        }

        if ((_shouldBeInterrupted || _meleeTimer.ElapsedMilliseconds > 3000) &&
            !Main.CurrentRangeIsMelee())
        {
            Main.Log("Going in Melee range (combat)");
            Main.SetRangeToMelee();
            _meleeTimer.Stop();
        }

        // Innervate
        if (_settings.UseInnervate &&
            Me.ManaPercentage < 20)
        {
            if (Cast(Innervate))
            {
                return;
            }
        }

        // Barkskin + Regrowth + Rejuvenation
        if (_settings.UseBarkskin &&
            Barkskin.KnownSpell &&
            Me.HealthPercent < 50 &&
            !Me.HaveBuff("Regrowth") &&
            Me.Mana > _bigHealComboCost + ToolBox.GetSpellCost("Barkskin") &&
            (Target.HealthPercent > 15 || Me.HealthPercent < 25))
        {
            if (Cast(Barkskin) && Cast(Regrowth) && Cast(Rejuvenation))
            {
                return;
            }
        }

        // Regrowth + Rejuvenation
        if (Me.HealthPercent < 50 &&
            !Me.HaveBuff("Regrowth") &&
            Me.Mana > _bigHealComboCost &&
            (Target.HealthPercent > 15 || Me.HealthPercent < 25))
        {
            if (Cast(Regrowth) && Cast(Rejuvenation))
            {
                return;
            }
        }

        // Regrowth
        if (Me.HealthPercent < 50 &&
            !Me.HaveBuff("Regrowth") &&
            Me.Mana > _smallHealComboCost &&
            (Target.HealthPercent > 15 || Me.HealthPercent < 25))
        {
            if (Cast(Regrowth))
            {
                return;
            }
        }

        // Rejuvenation
        if (Me.HealthPercent < 50 &&
            !Me.HaveBuff("Rejuvenation") &&
            !Regrowth.KnownSpell &&
            (Target.HealthPercent > 15 || Me.HealthPercent < 25))
        {
            if (Cast(Rejuvenation))
            {
                return;
            }
        }

        // Healing Touch
        if (Me.HealthPercent < 30 &&
            !Regrowth.KnownSpell &&
            (Target.HealthPercent > 15 || Me.HealthPercent < 25))
        {
            if (Cast(HealingTouch))
            {
                return;
            }
        }

        // Catorm
        if (!Me.HaveBuff("Cat Form") &&
            (ObjectManager.GetNumberAttackPlayer() < _settings.NumberOfAttackersBearForm || (!BearForm.KnownSpell && !DireBearForm.KnownSpell)))
        {
            if (Cast(CatForm))
            {
                return;
            }
        }

        // Bear Form
        if (!Me.HaveBuff("Bear Form") &&
            !Me.HaveBuff("Dire Bear Form"))
        {
            if (!CatForm.KnownSpell)
            {
                if (Cast(DireBearForm) || Cast(BearForm))
                {
                    return;
                }
            }
            else if (ObjectManager.GetNumberAttackPlayer() >= _settings.NumberOfAttackersBearForm &&
                     _settings.BearFormOnMultiAggro &&
                     _settings.NumberOfAttackersBearForm > 1)
            {
                {
                    if (Cast(DireBearForm) || Cast(BearForm))
                    {
                        return;
                    }
                }
            }
        }


        #region Cat Form Rotation

        // **************** CAT FORM ROTATION ****************

        if (Me.HaveBuff("Cat Form"))
        {
            Main.SetRangeToMelee();

            // Shred (when behind)
            if (Target.HaveBuff("Pounce"))
            {
                if (Cast(Shred))
                {
                    return;
                }
            }

            // Faerie Fire
            if (!Target.HaveBuff("Faerie Fire (Feral)") &&
                FaerieFireFeral.KnownSpell &&
                !Target.HaveBuff("Pounce") &&
                ToolBox.CanBleed(Me.TargetObject))
            {
                Lua.RunMacroText("/cast Faerie Fire (Feral)()");
                return;
            }

            // Rip
            if (!Target.HaveBuff("Rip") &&
                !Target.HaveBuff("Pounce") &&
                ToolBox.CanBleed(Me.TargetObject))
            {
                if (Me.ComboPoint >= 3 &&
                    Target.HealthPercent > 60)
                {
                    if (Cast(Rip))
                    {
                        return;
                    }
                }

                if (Me.ComboPoint >= 1 &&
                    Target.HealthPercent <= 60)
                {
                    if (Cast(Rip))
                    {
                        return;
                    }
                }
            }

            // Ferocious Bite
            if (FerociousBite.KnownSpell &&
                !Target.HaveBuff("Pounce"))
            {
                if (Me.ComboPoint >= 3 &&
                    Target.HealthPercent > 60)
                {
                    if (Cast(FerociousBite))
                    {
                        return;
                    }
                }

                if (Me.ComboPoint >= 1 &&
                    Target.HealthPercent <= 60)
                {
                    if (Cast(FerociousBite))
                    {
                        return;
                    }
                }
            }

            // Rake
            if (!Target.HaveBuff("Rake") &&
                !Target.HaveBuff("Pounce") &&
                ToolBox.CanBleed(Me.TargetObject))
            {
                if (Cast(Rake))
                {
                    return;
                }
            }

            // Tiger's Fury
            if (!TigersFury.HaveBuff &&
                _settings.UseTigersFury &&
                Me.ComboPoint < 1 &&
                !Target.HaveBuff("Pounce") &&
                Me.Energy > 30 &&
                TigersFury.IsSpellUsable)
            {
                TigersFury.Launch();
            }

            // Mangle
            if (Me.ComboPoint < 5 &&
                !Target.HaveBuff("Pounce") &&
                MangleCat.KnownSpell)
            {
                Lua.RunMacroText("/cast Mangle (Cat)()");
                return;
            }

            // Claw
            if (Me.ComboPoint < 5 && !Target.HaveBuff("Pounce"))
            {
                if (Cast(Claw))
                {
                    return;
                }
            }
        }

        #endregion

        #region Bear form rotation

        // **************** BEAR FORM ROTATION ****************

        if (Me.HaveBuff("Bear Form") || Me.HaveBuff("Dire Bear Form"))
        {
            Main.SetRangeToMelee();

            // Frenzied Regeneration
            if (Me.HealthPercent < 50)
            {
                if (Cast(FrenziedRegeneration))
                {
                    return;
                }
            }

            // Faerie Fire
            if (!Target.HaveBuff("Faerie Fire (Feral)") &&
                FaerieFireFeral.KnownSpell &&
                ToolBox.CanBleed(Me.TargetObject))
            {
                Lua.RunMacroText("/cast Faerie Fire (Feral)()");
            }

            // Swipe
            if (ObjectManager.GetNumberAttackPlayer() > 1 && ToolBox.CheckIfEnemiesClose(8f))
            {
                if (Cast(Swipe))
                {
                    return;
                }
            }

            // Interrupt with Bash
            if (_shouldBeInterrupted)
            {
                Thread.Sleep(Main._humanReflexTime);
                if (Cast(Bash))
                {
                    return;
                }
            }

            // Enrage
            if (_settings.UseEnrage)
            {
                if (Cast(Enrage))
                {
                    return;
                }
            }

            // Demoralizing Roar
            if (!Target.HaveBuff("Demoralizing Roar") && Target.GetDistance < 9f)
            {
                if (Cast(DemoralizingRoar))
                {
                    return;
                }
            }

            // Maul
            if (!MaulOn() && (!_fightingACaster || Me.Rage > 30))
            {
                if (Cast(Maul))
                {
                    return;
                }
            }
        }

        #endregion

        #region Human form rotation

        // **************** HUMAN FORM ROTATION ****************

        // Avoid accidental Human Form stay
        if (CatForm.KnownSpell && ToolBox.GetSpellCost("Cat Form") < Me.Mana)
        {
            return;
        }
        if (BearForm.KnownSpell && ToolBox.GetSpellCost("Bear Form") < Me.Mana)
        {
            return;
        }

        if (!Me.HaveBuff("Bear Form") &&
            !Me.HaveBuff("Cat Form") &&
            !Me.HaveBuff("Dire Bear Form"))
        {
            // Warstomp
            if (ObjectManager.GetNumberAttackPlayer() > 1 &&
                Target.GetDistance < 8)
            {
                if (Cast(WarStomp))
                {
                    return;
                }
            }

            // Moonfire
            if (!Target.HaveBuff("Moonfire") &&
                Me.ManaPercentage > 15 &&
                Target.HealthPercent > 15 &&
                Me.Level >= 8)
            {
                if (Cast(Moonfire))
                {
                    return;
                }
            }

            // Wrath
            if (Target.GetDistance <= _pullRange &&
                Me.ManaPercentage > 45 &&
                Target.HealthPercent > 30 &&
                Me.Level >= 8)
            {
                if (Cast(Wrath))
                {
                    return;
                }
            }

            // Moonfire Low level DPS
            if (!Target.HaveBuff("Moonfire") &&
                Me.ManaPercentage > 50 &&
                Target.HealthPercent > 30 &&
                Me.Level < 8)
            {
                if (Cast(Moonfire))
                {
                    return;
                }
            }

            // Wrath Low level DPS
            if (Target.GetDistance <= _pullRange &&
                Me.ManaPercentage > 60 &&
                Target.HealthPercent > 30 &&
                Me.Level < 8)
            {
                if (Cast(Wrath))
                {
                    return;
                }
            }
        }
        #endregion
    }
示例#35
0
    /*
     * CombatRotation()
     */
    public void CombatRotation()
    {
        if (OutlawSettings.CurrentSetting.EnableInterrupt)
        {
            WoWUnit toInterrupt = MyHelpers.InterruptableUnits();
            if (toInterrupt != null)
            {
                ObjectManager.Me.FocusGuid = toInterrupt.Guid;

                if (Kick.IsSpellUsable && Kick.KnownSpell)
                {
                    MovementManager.Face(toInterrupt.Position);
                    Kick.Launch(false, false, false, "focus");
                    Lua.LuaDoString("dRotationFrame.text:SetText(\"Kick " + MyHelpers.getTargetDistance() + " / " + MyHelpers.GetMeleeRangeWithTarget() + "\")");
                    return;
                }
                if (Gouge.IsSpellUsable && Gouge.KnownSpell)
                {
                    MovementManager.Face(toInterrupt.Position);
                    Gouge.Launch(false, false, false, "focus");
                    Lua.LuaDoString("dRotationFrame.text:SetText(\"Gouge " + MyHelpers.getTargetDistance() + " / " + MyHelpers.GetMeleeRangeWithTarget() + "\")");
                    return;
                }
                if (Blind.IsSpellUsable && Blind.KnownSpell)
                {
                    MovementManager.Face(toInterrupt.Position);
                    Blind.Launch(false, false, false, "focus");
                    Lua.LuaDoString("dRotationFrame.text:SetText(\"Blind " + MyHelpers.getTargetDistance() + " / " + MyHelpers.GetMeleeRangeWithTarget() + "\")");
                    return;
                }
            }
        }

        if (ObjectManager.Me.Health < ObjectManager.Me.MaxHealth * 0.7)
        {
            if (CrimsonVial.KnownSpell && CrimsonVial.IsSpellUsable)
            {
                CrimsonVial.Launch();
                Lua.LuaDoString(@"dRotationFrame.text:SetText(""Crimson Vial"")");
                return;
            }


            if (Feint.KnownSpell && Feint.IsSpellUsable)
            {
                Feint.Launch();
                Lua.LuaDoString(@"dRotationFrame.text:SetText(""Feint"")");
                return;
            }
        }

        if (ObjectManager.Me.Health < ObjectManager.Me.MaxHealth * 0.3)
        {
            if (SmokeBomb.KnownSpell && SmokeBomb.IsSpellUsable)
            {
                SmokeBomb.Launch();
                Lua.LuaDoString(@"dRotationFrame.text:SetText(""Smoke Bomb"")");
                return;
            }

            if (Riposte.KnownSpell && Riposte.IsSpellUsable)
            {
                Riposte.Launch();
                Lua.LuaDoString(@"dRotationFrame.text:SetText(""Riposte"")");
                return;
            }
        }

        if (ObjectManager.Me.IsStunned || ObjectManager.Me.Rooted || ObjectManager.Me.Confused)
        {
            if (GladiatorsMedallion.KnownSpell && GladiatorsMedallion.IsSpellUsable)
            {
                GladiatorsMedallion.Launch();
                Lua.LuaDoString(@"dRotationFrame.text:SetText(""Gladiators Medallion"")");
                return;
            }
        }

        if (ObjectManager.Me.SpeedMoving < 8.05 && ObjectManager.Me.SpeedMoving > 0)
        {
            if (OutlawSettings.CurrentSetting.EnableCloakOfShadows &&
                CloakOfShadows.KnownSpell && CloakOfShadows.IsSpellUsable)
            {
                CloakOfShadows.Launch();
                Lua.LuaDoString(@"dRotationFrame.text:SetText(""Cloak Of Shadows"")");
                return;
            }
        }
        if (OutlawSettings.CurrentSetting.EnableRazorCoral &&
            EquippedItems.GetEquippedItems().Find(x => x.GetItemInfo.ItemName == ItemsManager.GetNameById(169311)) != null &&
            MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange() &&
            Lua.LuaDoString("result = \"\";  local cooldown = GetItemCooldown(169311) if (cooldown == 0 ) then     result = true else     result = false end ", "result") == "true" &&
            (!ObjectManager.Target.BuffCastedByAll("Razor Coral").Contains(ObjectManager.Me.Guid) || ObjectManager.Target.BuffStack("Razor Coral") >= 10))
        {
            ItemsManager.UseItem(169311);
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Razor Coral"")");
            return;
        }

        if (OutlawSettings.CurrentSetting.EnableBladeFlurry &&
            BladeFlurry.KnownSpell && !MyHelpers.haveBuff("Blade Flurry") && BladeFlurry.IsSpellUsable && (MyHelpers.getAttackers(10) > 1))
        {
            BladeFlurry.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Blade Flurry"")");
            return;
        }

        if (OutlawSettings.CurrentSetting.EnableBloodoftheEnemy &&
            BloodoftheEnemy.KnownSpell &&
            BloodoftheEnemy.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange() &&
            !MyHelpers.rtbReroll() &&
            BetweenTheEyes.IsSpellUsable &&
            (ObjectManager.Target.IsLocalPlayer || ObjectManager.Target.Type == WoWObjectType.Player)

            )
        {
            BloodoftheEnemy.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Bloodof the Enemy"")");
            return;
        }



        if (OutlawSettings.CurrentSetting.EnableGrapplingHook &&
            !ObjectManager.Me.IsMounted &&
            GrapplingHook.KnownSpell &&
            GrapplingHook.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= 20.0f &&
            MyHelpers.getTargetDistance() > MyHelpers.getMeleeRange()
            )
        {
            ClickOnTerrain.Spell(195457, ObjectManager.Target.Position);
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Grappling Hook"")");
            return;
        }

        if (OutlawSettings.CurrentSetting.EnableSprint &&
            !ObjectManager.Me.IsMounted &&
            Sprint.KnownSpell &&
            Sprint.IsSpellUsable &&
            MyHelpers.getTargetDistance() > 20.0f
            )
        {
            Sprint.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Sprint"")");
            return;
        }

        if (OutlawSettings.CurrentSetting.EnableRolltheBones &&
            RolltheBones.KnownSpell &&
            RolltheBones.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange() &&
            MyHelpers.getComboPoint() >= 4 &&
            MyHelpers.rtbReroll()
            )
        {
            RolltheBones.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Roll the Bones"")");
            return;
        }
        if (OutlawSettings.CurrentSetting.EnableAdrenalineRush &&
            AdrenalineRush.KnownSpell &&
            AdrenalineRush.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange() &&
            (ObjectManager.Target.IsBoss ||
             ObjectManager.Target.IsElite ||
             ObjectManager.Target.IsLocalPlayer ||
             ObjectManager.Target.Type == WoWObjectType.Player ||
             MyHelpers.getAttackers(10) > 3))
        {
            AdrenalineRush.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Adrenaline Rush"")");
            return;
        }

        if (BladeRush.KnownSpell &&
            BladeRush.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= 20.0f &&
            MyHelpers.getTargetDistance() > MyHelpers.getMeleeRange() &&
            !ObjectManager.Me.IsMounted
            )
        {
            BladeRush.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Blade Rush"")");
            return;
        }

        if (OutlawSettings.CurrentSetting.EnablePistolShot &&
            PistolShot.KnownSpell &&
            PistolShot.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= 20.0f &&
            ((MyHelpers.haveBuff("Opportunity") && MyHelpers.getComboPoint() <= 4) ||
             (MyHelpers.getTargetDistance() > MyHelpers.getMeleeRange() && !(BetweenTheEyes.IsSpellUsable && MyHelpers.getComboPoint() == 6)) ||
             (MyHelpers.haveBuff("Deadshot") && MyHelpers.haveBuff("Seething Rage") && !BetweenTheEyes.IsSpellUsable)
            ))
        {
            PistolShot.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Pistol Shot"")");
            return;
        }

        if (OutlawSettings.CurrentSetting.EnableSinisterStrike &&
            SinisterStrike.KnownSpell &&
            SinisterStrike.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange() &&
            MyHelpers.getComboPoint() <= 5)
        {
            SinisterStrike.Launch();
            Lua.LuaDoString("dRotationFrame.text:SetText(\"Sinister Strike " + MyHelpers.getTargetDistance() + " / " + MyHelpers.GetMeleeRangeWithTarget() + "\")");
            return;
        }



        if (OutlawSettings.CurrentSetting.EnableBetweenTheEyes &&
            BetweenTheEyes.KnownSpell &&
            BetweenTheEyes.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= 20.0f &&
            MyHelpers.getComboPoint() == 6)
        {
            BetweenTheEyes.Launch();
            Lua.LuaDoString(@"dRotationFrame.text:SetText(""Between the Eyes"")");

            return;
        }

        if (OutlawSettings.CurrentSetting.EnableDispatch &&
            Dispatch.KnownSpell &&
            Dispatch.IsSpellUsable &&
            MyHelpers.getTargetDistance() <= MyHelpers.getMeleeRange() &&
            MyHelpers.getComboPoint() == 6)
        {
            Dispatch.Launch();
            Lua.LuaDoString("dRotationFrame.text:SetText(\"Dispatch " + MyHelpers.getTargetDistance() + " / " + MyHelpers.GetMeleeRangeWithTarget() + "\")");
            return;
        }
    }
示例#36
0
    internal static void CombatRotation()
    {
        WoWUnit Target = ObjectManager.Target;

        ToolBox.CheckAutoAttack(Attack);

        // Purify
        if ((ToolBox.HasPoisonDebuff() || ToolBox.HasDiseaseDebuff()) && Purify.IsSpellUsable &&
            (_purifyTimer.ElapsedMilliseconds > 10000 || _purifyTimer.ElapsedMilliseconds <= 0))
        {
            _purifyTimer.Restart();
            Thread.Sleep(Main._humanReflexTime);
            Lua.RunMacroText("/target player");
            Cast(Purify);
            Lua.RunMacroText("/cleartarget");
        }

        // Cleanse
        if (ToolBox.HasMagicDebuff() && (_cleanseTimer.ElapsedMilliseconds > 10000 || _cleanseTimer.ElapsedMilliseconds <= 0) &&
            Cleanse.IsSpellUsable)
        {
            _cleanseTimer.Restart();
            Thread.Sleep(Main._humanReflexTime);
            Lua.RunMacroText("/target player");
            Cast(Cleanse);
            Lua.RunMacroText("/cleartarget");
        }

        // Devotion Aura multi
        if ((ObjectManager.GetNumberAttackPlayer() > 1 && _settings.DevoAuraOnMulti) &&
            !Me.HaveBuff("Devotion Aura"))
        {
            Cast(DevotionAura);
        }

        // Devotion Aura
        if (!Me.HaveBuff("Devotion Aura") && !SanctityAura.KnownSpell && !RetributionAura.KnownSpell)
        {
            Cast(DevotionAura);
        }

        // Sanctity Aura
        if (!Me.HaveBuff("Sanctity Aura") && SanctityAura.KnownSpell && ObjectManager.GetNumberAttackPlayer() <= 1)
        {
            Cast(SanctityAura);
        }

        // Retribution Aura
        if (!Me.HaveBuff("Retribution Aura") && !SanctityAura.KnownSpell && RetributionAura.KnownSpell &&
            ObjectManager.GetNumberAttackPlayer() <= 1)
        {
            Cast(SanctityAura);
        }

        // Lay on Hands
        if (Me.HealthPercent < 10)
        {
            Cast(LayOnHands);
        }

        // Avenging Wrath
        if (Me.ManaPercentage > _manaSavePercent && ObjectManager.GetNumberAttackPlayer() > 1)
        {
            Cast(AvengingWrath);
        }

        // Hammer of Justice
        if (Me.HealthPercent < 50 && Me.ManaPercentage > _manaSavePercent)
        {
            Cast(HammerOfJustice);
        }

        // Exorcism
        if (Target.CreatureTypeTarget == "Undead" || Target.CreatureTypeTarget == "Demon" &&
            _settings.UseExorcism)
        {
            Cast(Exorcism);
        }

        // Judgement (Crusader)
        if (Me.HaveBuff("Seal of the Crusader") && Target.GetDistance < 10)
        {
            Cast(Judgement);
            Thread.Sleep(200);
        }

        // Judgement
        if ((Me.HaveBuff("Seal of Righteousness") || Me.HaveBuff("Seal of Command")) &&
            Target.GetDistance < 10 &&
            (Me.ManaPercentage >= _manaSavePercent || Me.HaveBuff("Seal of the Crusader")))
        {
            Cast(Judgement);
        }

        // Seal of the Crusader
        if (!Target.HaveBuff("Judgement of the Crusader") && !Me.HaveBuff("Seal of the Crusader") &&
            Me.ManaPercentage > _manaSavePercent - 20 && Target.IsAlive && _settings.UseSealOfTheCrusader)
        {
            Cast(SealOfTheCrusader);
        }

        // Seal of Righteousness
        if (!Me.HaveBuff("Seal of Righteousness") && !Me.HaveBuff("Seal of the Crusader") && Target.IsAlive &&
            (Target.HaveBuff("Judgement of the Crusader") || Me.ManaPercentage > _manaSavePercent || !_settings.UseSealOfTheCrusader) &&
            (!_settings.UseSealOfCommand || !SealOfCommand.KnownSpell))
        {
            Cast(SealOfRighteousness);
        }

        // Seal of Command
        if (!Me.HaveBuff("Seal of Command") && !Me.HaveBuff("Seal of the Crusader") && Target.IsAlive &&
            (Target.HaveBuff("Judgement of the Crusader") || Me.ManaPercentage > _manaSavePercent || !_settings.UseSealOfTheCrusader) &&
            _settings.UseSealOfCommand && SealOfCommand.KnownSpell)
        {
            Cast(SealOfCommand);
        }

        // Seal of Command Rank 1
        if (!Me.HaveBuff("Seal of Righteousness") && !Me.HaveBuff("Seal of the Crusader") &&
            !Me.HaveBuff("Seal of Command") && !SealOfCommand.IsSpellUsable && !SealOfRighteousness.IsSpellUsable &&
            SealOfCommand.KnownSpell && Me.Mana < _manaSavePercent)
        {
            Lua.RunMacroText("/cast Seal of Command(Rank 1)");
        }

        // Holy Light / Flash of Light
        if (Me.HealthPercent < 50 && (Target.HealthPercent > 15 || Me.HealthPercent < 25) && _settings.HealDuringCombat)
        {
            if (!HolyLight.IsSpellUsable)
            {
                if (Me.HealthPercent < 20)
                {
                    Cast(DivineShield);
                }
                Cast(FlashOfLight);
            }
            Cast(HolyLight);
        }

        // Crusader Strike
        if (Me.ManaPercentage > 10)
        {
            Cast(CrusaderStrike);
        }

        // Hammer of Wrath
        if (_settings.UseHammerOfWrath)
        {
            Cast(HammerOfWrath);
        }
    }
 public static void SetMouseoverUnit(WoWUnit unit)
 {
     Memory.WowMemory.Memory.WriteUInt64((uint)Memory.WowMemory.Memory.MainModuleAddress + 0x74E2C8, unit.Guid);
 }
示例#38
0
    internal static void CombatRotation()
    {
        Lua.LuaDoString("PetAttack();", false);
        bool    _hasCurse = ToolBox.HasCurseDebuff();
        WoWUnit Target    = ObjectManager.Target;

        _usingWand = Lua.LuaDoString <bool>("isAutoRepeat = false; local name = GetSpellInfo(5019); " +
                                            "if IsAutoRepeatSpell(name) then isAutoRepeat = true end", "isAutoRepeat");

        // Remove Curse
        if (_hasCurse)
        {
            Thread.Sleep(Main._humanReflexTime);
            if (Cast(RemoveCurse))
            {
                return;
            }
        }

        // Summon Water Elemental
        if (Target.HealthPercent > 95 || ObjectManager.GetNumberAttackPlayer() > 1)
        {
            if (Cast(SummonWaterElemental))
            {
                return;
            }
        }

        // Ice Barrier
        if (IceBarrier.IsSpellUsable && !Me.HaveBuff("Ice Barrier"))
        {
            if (Cast(IceBarrier))
            {
                return;
            }
        }

        // Mana Shield
        if (!Me.HaveBuff("Mana Shield") && Me.HealthPercent < 30 && Me.ManaPercentage > 50)
        {
            if (Cast(ManaShield))
            {
                return;
            }
        }

        // Cold Snap
        if (ObjectManager.GetNumberAttackPlayer() > 1 && !Me.HaveBuff("Icy Veins") && !IcyVeins.IsSpellUsable)
        {
            if (Cast(ColdSnap))
            {
                return;
            }
        }

        // Icy Veins
        if ((ObjectManager.GetNumberAttackPlayer() > 1 && _settings.IcyVeinMultiPull) ||
            !_settings.IcyVeinMultiPull)
        {
            if (Cast(IcyVeins))
            {
                return;
            }
        }

        // Use Mana Stone
        if (((ObjectManager.GetNumberAttackPlayer() > 1 && Me.ManaPercentage < 50) || Me.ManaPercentage < 5) &&
            _foodManager.ManaStone != "")
        {
            _foodManager.UseManaStone();
            _foodManager.ManaStone = "";
        }

        // Ice Lance
        if (Target.HaveBuff("Frostbite") || Target.HaveBuff("Frost Nova"))
        {
            if (Cast(IceLance))
            {
                return;
            }
        }

        // Frost Nova
        if (Target.GetDistance < _meleeRange + 2 && Target.HealthPercent > 10 && !Target.HaveBuff("Frostbite"))
        {
            if (Cast(FrostNova))
            {
                return;
            }
        }

        // Fire Blast
        if (Target.GetDistance < 20f && Target.HealthPercent > 30f)
        {
            if (Cast(FireBlast))
            {
                return;
            }
        }

        // Cone of Cold
        if (Target.GetDistance < 10 && _settings.UseConeOfCold && !_isBackingUp && !MovementManager.InMovement)
        {
            if (Cast(ConeOfCold))
            {
                return;
            }
        }

        // Frost Bolt
        if (Target.GetDistance < _range && Me.Level >= 6 && (Target.HealthPercent > _settings.WandThreshold ||
                                                             ObjectManager.GetNumberAttackPlayer() > 1 || Me.HealthPercent < 30 || !_iCanUseWand))
        {
            if (Cast(Frostbolt, true))
            {
                return;
            }
        }

        // Low level Frost Bolt
        if (Target.GetDistance < _range && Target.HealthPercent > 30 && Me.Level < 6)
        {
            if (Cast(Frostbolt, true))
            {
                return;
            }
        }

        // Low level FireBall
        if (Target.GetDistance < _range && !Frostbolt.KnownSpell && Target.HealthPercent > 30)
        {
            if (Cast(Fireball, true))
            {
                return;
            }
        }

        // Use Wand
        if (!_usingWand && _iCanUseWand && ObjectManager.Target.GetDistance <= _range && !_isBackingUp && !MovementManager.InMovement)
        {
            Main.settingRange = _range;
            if (Cast(UseWand, false))
            {
                return;
            }
        }

        // Go in melee because nothing else to do
        if (!_usingWand && !UseWand.IsSpellUsable && Main.settingRange != _meleeRange && !_isBackingUp && Target.IsAlive)
        {
            Main.Log("Going in melee");
            Main.settingRange = _meleeRange;
            return;
        }
    }
示例#39
0
 public static T ExecuteActionOnUnit <T>(WoWUnit unit, Func <string, T> action)
 {
     return(ExecuteActionOnTarget(unit.Guid, action));
 }
示例#40
0
        public static bool CastSpell(RotationSpell spell, WoWUnit unit, bool force = false)
        {
            // still waiting to make sure last spell was casted successfully, this can be interrupted
            // by interrupting the current cast to cast something else (which will clear the verification)
            if (RotationSpellVerifier.IsWaitingForVerification() && !force)
            {
                return(false);
            }

            // no need to check for spell availability
            // already wanding, don't turn it on again!
            if (spell.Spell.Name == "Shoot" && IsAutoRepeating("Shoot"))
            {
                return(true);
            }

            // targetfinder function already checks that they are in LoS and RotationStep takes care of the range check
            if (unit != null && spell.IsKnown() && spell.CanCast())
            {
                Lua.LuaDoString("if IsMounted() then Dismount() end");

                if (spell.Spell.CastTime > 0)
                {
                    if (spell.Verification != RotationSpell.VerificationType.NONE)
                    {
                        //setting this for delegates, so we don't miss events
                        //SetFocusGuid(unit.Guid);
                        RotationSpellVerifier.QueueVerification(spell.Spell.Name, unit, spell.Verification);
                    }

                    //force iscast so we don't have to wait for client updates
                    RotationFramework.IsCast = true;
                    //ObjectManager.Me.ForceIsCast = true;
                }

                if (AreaSpells.Contains(spell.Spell.Name))
                {
                    SpellManager.CastSpellByIDAndPosition(spell.Spell.Id, unit.Position);
                }
                else
                {
                    if (unit.Guid != RotationFramework.Me.Guid && unit.Guid != RotationFramework.Target.Guid)
                    {
                        MovementManager.Face(unit);
                    }

                    ExecuteActionOnUnit <object>(unit, (luaUnitId =>
                    {
                        RotationLogger.Fight($"Casting {spell.FullName()} ({spell.Spell.Name} on {luaUnitId} with guid {unit.Guid}");
                        //MovementManager.StopMoveTo(false, (int) spell.CastTime());
                        Lua.LuaDoString($@"
						if {force.ToString().ToLower()} then SpellStopCasting() end
                        CastSpellByName(""{spell.FullName()}"", ""{luaUnitId}"");
						--CombatTextSetActiveUnit(""{luaUnitId}"");
						FocusUnit(""{luaUnitId}"");
						"                        );
                        return(null);
                    }));
                }

                return(true);
            }

            return(false);
        }
示例#41
0
        public static void harvestNode()
        {
            WoWUnit wgo = getNode();

            if (wgo == null)
            {
                return;
            }
            if (wgo.Distance > 5)
            {
                return;
            }
            int     tries    = 0;
            WoWUnit newwgo   = null;
            bool    firstrun = true;

            while (wgo != null)
            {
                if (newwgo != null)
                {
                    if (newwgo.Guid != wgo.Guid)
                    {
                        return;
                    }
                }
                else if (!firstrun)
                {
                    return;
                }
                firstrun = false;
                ObjectManager.Update();
                if (tries > 30)
                {
                    Stopwatch sw = new Stopwatch();
                    sw.Start();
                    blackList.Add(sw, wgo.Location);
                    return;
                }
                DoQuest(wgo);
                for (int i = 0; i < 10; i++)
                {
                    ObjectManager.Update();
                    newwgo = getNode();
                    if (newwgo != null || newwgo.QuestGiverStatus == QuestGiverStatus.None)
                    {
                        if (newwgo.Guid != wgo.Guid)
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                    if (StyxWoW.Me.Combat)
                    {
                        if (StyxWoW.Me.Mounted)
                        {
                            Logging.Write("Incombat, but still Mounted, Flying away");
                            KeyboardManager.PressKey((char)KeyboardManager.eVirtualKeyMessages.VK_SPACE);
                            Thread.Sleep(3000);
                            KeyboardManager.ReleaseKey((char)KeyboardManager.eVirtualKeyMessages.VK_SPACE);
                        }
                        return;
                    }
                    Thread.Sleep(500);
                }
                tries++;
                newwgo = getNode();
            }
        }
示例#42
0
 public static bool IsImmune(this WoWUnit unit, WoWSpellSchool school)
 {
     return(unit != null && ImmuneNpcs.ContainsKey(unit.Entry) && (ImmuneNpcs[unit.Entry] & school) > 0);
 }
示例#43
0
 private bool HasAuraToBeAvoided(WoWUnit wowUnit)
 {
     return((wowUnit == null) ? false : wowUnit.ActiveAuras.Values.Any(a => AvoidTargetsWithAura.Contains(a.SpellId)));
 }
示例#44
0
 public static int TotemsInRangeOf(WoWUnit unit)
 {
     return(StyxWoW.Me.Totems.Where(t => t.Unit != null).Count(t => unit.Location.Distance(t.Unit.Location) < GetTotemRange(t.WoWTotem)));
 }
示例#45
0
        public static Composite CreatePriestShadowNormalCombat()
        {
            return(new PrioritySelector(
                       Helpers.Common.EnsureReadyToAttackFromLongRange(),
                       Spell.WaitForCastOrChannel(),
                       CreateFightAssessment(),
                       new Decorator(
                           ret => !Spell.IsGlobalCooldown(),
                           new PrioritySelector(

                               SingularRoutine.MoveBehaviorInlineToCombat(BehaviorType.Heal),
                               SingularRoutine.MoveBehaviorInlineToCombat(BehaviorType.CombatBuffs),

                               Helpers.Common.CreateInterruptBehavior(),

                               Movement.WaitForFacing(),
                               Movement.WaitForLineOfSpellSight(),

                               new Decorator(
                                   req => !Me.CurrentTarget.IsTrivial(),
                                   new PrioritySelector(

                                       Dispelling.CreatePurgeEnemyBehavior("Dispel Magic"),

                                       // Mana Management stuff - send in the fiends
                                       Common.CreateShadowfiendBehavior(),

                                       // Defensive stuff
                                       Spell.BuffSelf("Dispersion",
                                                      ret => Me.ManaPercent < PriestSettings.DispersionMana ||
                                                      Me.HealthPercent < 40 ||
                                                      (Me.ManaPercent < SingularSettings.Instance.MinMana && Me.IsSwimming) ||
                                                      Unit.NearbyUnfriendlyUnits.Count(t => t.GotTarget() && t.CurrentTarget.IsTargetingMyStuff()) >= 3),

                                       Common.CreatePriestShackleUndeadAddBehavior(),
                                       Common.CreatePsychicScreamBehavior(),

                                       Spell.HandleOffGCD(
                                           new PrioritySelector(
                                               ctx => Me.CurrentTarget.TimeToDeath() > 15 || cntAoeTargets > 1,
                                               new Sequence(
                                                   Spell.BuffSelfAndWait(sp => "Vampiric Embrace", req => ((bool)req) && Me.HealthPercent < PriestSettings.VampiricEmbracePct),
                                                   Spell.BuffSelf("Power Infusion")
                                                   ),
                                               Spell.Cast("Power Infusion", req => ((bool)req) || Me.HasAura("Vampiric Embrace"))
                                               )
                                           )
                                       )
                                   ),

                               // Shadow immune npcs.
                               // Spell.Cast("Holy Fire", req => Me.CurrentTarget.IsImmune(WoWSpellSchool.Shadow)),

                               // AoE Rotation
                               new Decorator(
                                   ret => Spell.UseAOE && cntAoeTargets > 1,
                                   new PrioritySelector(
                                       ctx => AoeTargets.FirstOrDefault(u => Me.IsSafelyFacing(u) && u.InLineOfSpellSight),

                                       Spell.Cast("Void Eruption", when => !InVoidform),

                                       Spell.Cast(
                                           "Mind Sear",
                                           mov => true,
                                           on =>
            {
                IEnumerable <WoWUnit> aoeTargetsFacing = AoeTargets.Where(u => Me.IsSafelyFacing(u) && u.InLineOfSpellSight && u.IsTrivial());
                WoWUnit unit = Clusters.GetBestUnitForCluster(aoeTargetsFacing, ClusterType.Radius, 10);
                if (unit == null)
                {
                    return null;
                }
                if (3 > Clusters.GetClusterCount(unit, AoeTargets, ClusterType.Radius, 10))
                {
                    return null;
                }
                if (Unit.UnfriendlyUnits(50).Any(u => !u.IsTrivial() && unit.SpellDistance(u) < 12))
                {
                    return null;
                }

                Logger.Write(LogColor.Hilite, "^Trivial Farming: all trivial mobs within 12 yds of {0}", unit.SafeName());
                return unit;
            },
                                           cancel => Me.HealthPercent < PriestSettings.ShadowHeal
                                           ),

                                       Spell.Buff("Shadow Word: Pain", true), // no multi message for current target
                                       Spell.Buff("Vampiric Touch", true),    // no multi message for current target
                                       Spell.Buff(                            // multi-dot others w/ message
                                           "Vampiric Touch",
                                           true,
                                           on =>
            {
                WoWUnit dotTarget = AoeTargets.FirstOrDefault(u => u != Me.CurrentTarget && !u.HasMyAura("Vampiric Touch") && u.InLineOfSpellSight && !Spell.DoubleCastContains(u, "Vampiric Touch"));
                if (dotTarget != null && Spell.CanCastHack("Vampiric Touch", dotTarget))
                {
                    Logger.Write(LogColor.Hilite, "^Multi-DoT: cast Vampiric Touch on {0}", dotTarget.SafeName());
                    return dotTarget;
                }
                return null;
            },
                                           req => true
                                           ),
                                       Spell.Buff(                          // multi-dot others w/ message
                                           "Shadow Word: Pain",
                                           true,
                                           on =>
            {
                WoWUnit dotTarget = AoeTargets.FirstOrDefault(u => u != Me.CurrentTarget && !u.HasMyAura("Shadow Word: Pain") && u.InLineOfSpellSight && !Spell.DoubleCastContains(u, "Shadow Word: Pain"));
                if (dotTarget != null && Spell.CanCastHack("Shadow Word: Pain", dotTarget))
                {
                    Logger.Write(LogColor.Hilite, "^Multi-DoT: cast Shadow Word: Pain on {0}", dotTarget.SafeName());
                    return dotTarget;
                }
                return null;
            },
                                           req => true
                                           ),

                                       // When we enter void form, even if AOE, we use our single target rotation after maintaining debuffs.
                                       new Decorator(ret => InVoidform,
                                                     CreateMaintainVoidformBehaviour()),

                                       // filler spell
                                       Spell.Cast(
                                           "Mind Sear",
                                           mov => true,
                                           on => {
                IEnumerable <WoWUnit> AoeTargetsFacing = AoeTargets.Where(u => Me.IsSafelyFacing(u) && u.InLineOfSpellSight);
                WoWUnit unit = Clusters.GetBestUnitForCluster(AoeTargetsFacing, ClusterType.Radius, 10);
                if (unit == null)
                {
                    return null;
                }
                if (4 > Clusters.GetClusterCount(unit, AoeTargets, ClusterType.Radius, 10))
                {
                    return null;
                }
                return unit;
            },
                                           cancel => Me.HealthPercent < PriestSettings.ShadowHeal
                                           ),
                                       CastMindFlay(on => (WoWUnit)on, req => cntAoeTargets < 4)
                                       )
                                   ),


                               new Decorator(ret => InVoidform,
                                             CreateMaintainVoidformBehaviour()),


                               CreateBuildVoidformBehaviour()
                               )
                           )
                       ));
        }
 /*
  * with vsync turned on, this function errors for some reason - without vsync on, the Lua turning part gets ignore (which was supposed to nudge the character so the server recognizes changed movement)
  */
 public static void FaceUnit(WoWUnit unit)
 {
     ClickToMove.CGPlayer_C__ClickToMove(unit.Position.X, unit.Position.Y, unit.Position.Z, unit.Guid, (int)ClickToMoveType.Face, 0.5f);
     //Lua.LuaDoString("TurnLeftStart(); TurnLeftStop();");
     //Lua.LuaDoString("TurnRightStart(); TurnRightStop();");
 }
示例#47
0
        public static bool FollowTarget()
        {
            string fnname = "FTWCore.FollowTarget";

            MyTimer.Start(fnname);
            LocalPlayer Me           = StyxWoW.Me;
            WoWUnit     followtarget = null;
            double      maxDist      = FTWProps.range;
            bool        retval       = false;
            bool        followtank   = false;

            if (Styx.CommonBot.BotManager.Current.Name == "Grind Bot" &&
                FTWProps.tank.IsDead == false &&
                FTWProps.tank.Guid != StyxWoW.Me.Guid)
            {
                followtank = true;
            }
            else
            {
                followtank = false;
            }

            // Leave early if they don't want movement and facing.
            if (FTWUtils.MovementDisabled())
            {
                FTWLogger.log(Color.Violet, "Movement disabled, not following");
            }
            else if (DateTime.Now < FTWProps.MovementCooldown || StyxWoW.Me.IsCasting || StyxWoW.Me.IsChanneling)
            {
                //log(Color.Violet, "Casting, not following");
            }
            else if (BotPoi.Current.Type == PoiType.Loot)
            {
                FTWLogger.log(Color.Violet, "Looting, not following");
            }
            else if (FTWProps.mode == "@PULL")
            {
                // Just follow whoever is targeted
                followtarget = StyxWoW.Me.CurrentTarget;
            }
            else if (FTWProps.mode == "@COMBAT")
            {
                // In combat, follow target preferentially
                followtarget = StyxWoW.Me.CurrentTarget;
                if (StyxWoW.Me.IsHealer() ||
                    (followtarget == null ||
                     !followtarget.IsValidUnit()
                    ) && followtank)
                {
                    followtarget = FTWProps.tank;
                    maxDist      = 10;
                }
            }
            else if (FTWProps.mode == "@REST")
            {
                // Out of combat, follow tank preferentially
                if (followtank)
                {
                    followtarget = FTWProps.tank;
                    maxDist      = 15;
                }
            }
            else
            {
                FTWLogger.log(Color.Red, "UNKNOWN MODE {0}", FTWProps.mode);
            }

            if (followtarget == null)
            {
                //log(Color.Violet, "No target in FollowTarget");
            }
            else if (followtarget.IsDead)
            {
                //log(Color.Violet, "Target is dead in FollowTarget");
            }
            else if (followtarget.DistanceCalc() <= maxDist && followtarget.InLineOfSpellSight)
            {
                // If close enough, leave
                WoWMovement.MoveStop();
                if (followtarget.IsValidUnit() && !StyxWoW.Me.IsSafelyFacing(followtarget))
                {
                    Face(followtarget);
                }
            }
            else
            {
                // Keep following
                FTWLogger.log("Keep following {0} (dist {1:0.00}, InLineOfSight = {2}, InLineOfSpellSight = {3})", followtarget.SafeName(), followtarget.DistanceCalc(), followtarget.InLineOfSight, followtarget.InLineOfSpellSight);
                WoWPoint loc = followtarget.Location;

                // Get to right under the mob, if it's flying
                if (!Navigator.CanNavigateFully(StyxWoW.Me.Location, followtarget.Location))
                {
                    //List<float> heights = Navigator.FindHeights(loc.X, loc.Y);
                    //if (heights.Count > 0)
                    //    loc.Z = heights.Max();
                    Styx.WoWInternals.WoWMovement.ClickToMove(loc);
                }
                else
                {
                    // Move to the mob's location
                    Navigator.MoveTo(loc);
                }
                retval = true;
            }

            MyTimer.Stop(fnname);
            return(retval);
        }
 public static bool CastSpell(RotationSpell spell, WoWUnit unit)
 {
     return(CastSpell(spell, unit, false));
 }
示例#49
0
        public override void Pulse()
        {
            //base.Pulse();

            // If Settings.DirtyData = true it will reload the settings from the XML file
            // This reads the XML file and re-populates the Settings class with any changed values
            if (!_isCCLoaded)
            {
                _isCCLoaded        = true;
                Settings.DirtyData = true;
            }
            if (Settings.DirtyData)
            {
                LoadSettings(true);
            }

            // So we don't overload HB the below code is only run once per second
            if (!Timers.Expired("Pulse", 1000))
            {
                return;
            }
            Timers.Reset("Pulse");

            if (Me.Combat)
            {
                Timers.Reset("Cheetah");
            }

            // Call and Heal Pet
            if (ClassHelpers.Hunter.Pet.NeedToFeedPet)
            {
                ClassHelpers.Hunter.Pet.FeedPet();
            }
            if (ClassHelpers.Hunter.Pet.NeedToHealPet)
            {
                ClassHelpers.Hunter.Pet.HealPet();
            }
            if (!Settings.PetSlot.Contains("never") && ClassHelpers.Hunter.Pet.NeedToCallPet)
            {
                ClassHelpers.Hunter.Pet.CallPet();
            }

            // Aspect of the Cheetah, Thundercats are go!
            if (ClassHelpers.Hunter.Aspect.CanUseAspectOfTheCheetah)
            {
                if (!Timers.Expired("Cheetah", 5000))
                {
                    return;
                }
                Timers.Reset("Cheetah");
                ClassHelpers.Hunter.Aspect.AspectOfTheCheetah();
            }

            // Consume Frenzy Effect so we don't loose the opportunity to use Focus Fire
            if (Settings.ConsumeFrenzyEffect.Contains("always") && Me.GotAlivePet)
            {
                if (Me.Pet.Auras.ContainsKey("Frenzy Effect") && !Settings.FocusFire.Contains("never") && Me.Pet.Auras["Frenzy Effect"].TimeLeft.Seconds <= 2 && Spell.CanCast("Focus Fire"))
                {
                    Utils.Log(String.Format("Consuming Pet's Frenzy Effect ({0} stacks) with Focus Fire. Lets not waste it", Me.Pet.Auras["Frenzy Effect"].StackCount), Utils.Colour("Red"));
                    Spell.Cast("Focus Fire");
                }
            }


            // Lets keep the fun going! Have the pet attack mobs while we're looting.
            if (CLC.ResultOK(Settings.ContinuousPulling))
            {
                int lootableMobs = LootTargeting.Instance.LootingList.Count;
                if (!Me.Combat && Self.IsHealthPercentAbove(Settings.RestHealth) && Me.GotAlivePet && !ClassHelpers.Hunter.Pet.NeedToHealPet && !Me.Pet.GotTarget && lootableMobs > 0)
                {
                    WoWUnit p = Utils.AttackableMobInRange(LevelbotSettings.Instance.PullDistance);

                    if (p != null)
                    {
                        p.Target();
                        Utils.Log(string.Format("Sending pet to attack {0} while we loot", p.Class), Utils.Colour("Red"));
                        if (Target.CanDebuffTarget("Hunter's Mark") && CLC.ResultOK(Settings.HuntersMark))
                        {
                            Spell.Cast("Hunter's Mark");
                        }
                        ClassHelpers.Hunter.Pet.Attack();
                    }
                }
            }
        }
示例#50
0
 public override void TryToBuffAnotherPlayer(WoWUnit player)
 => dm.Get <DruidManager>().TryToBuffAnotherPlayer(player);
示例#51
0
        /// <summary>
        ///     <para>
        ///         (Non-Blocking) Casts the specified ability on the provided target. Also generates logging and audit
        ///         information.
        ///     </para>
        ///     <para>
        ///         This is the perferred entry point to casting an ability's spell, as it manages the logic behind blocked
        ///         abilities and snapshotting.
        ///     </para>
        /// </summary>
        /// <returns>Will return true if the cast was successful.</returns>
        public async Task <bool> Cast <T>(WoWUnit target) where T : IAbility
        {
            var abilities = Get <T>();

            if (abilities == null || abilities.Count == 0)
            {
                throw new AbilityException("Ability does not exist.");
            }

            foreach (var ability in abilities)
            {
                var blockedAbility = BlockedAbilities.GetBlockedAbilityByType(ability.GetType());
                if (blockedAbility != null)
                {
                    var blockedTimeInMs = (DateTime.Now - blockedAbility.BlockedDateAndTime).TotalMilliseconds;
                    if (blockedTimeInMs >= BlockTimeMs)
                    {
                        BlockedAbilities.Remove(blockedAbility);
                        Log.Diagnostics(string.Format("Blocked ability {0} removed after {1} ms.", ability.Spell.Name,
                                                      blockedTimeInMs));
                    }
                    else
                    {
                        // The ability is blocked, do not cast.
                        return(false);
                    }
                }

                var castResult = await ability.CastOnTarget(target);

                if (!castResult)
                {
                    continue;
                }
                if (ability == LastCastAbility)
                // This ability was already casted before, has it been less than the threshold minimum?
                {
                    var lastCastTimeInMs = (DateTime.Now - LastCastDateTime).TotalMilliseconds;
                    if (lastCastTimeInMs < CastTryElapsedTimeMs)
                    {
                        if (LastCastTries >= CastTryThreshold)
                        {
                            BlockedAbilities.Add(new BlockedAbility(ability, DateTime.Now));
                            Log.Diagnostics(
                                string.Format(
                                    "{0} has been blocked after {1} cast atttempts. Total of {2} blocked abilities.",
                                    ability.GetType().Name, LastCastTries + 1, BlockedAbilities.Count));

                            return(false);
                        }
                        LastCastTries++;
                    }
                }
                else
                {
                    LastCastTries = 1;
                }

                LastCastAbility  = ability;
                LastCastDateTime = DateTime.Now;

                // Track Bleeds
                if (ability is ProwlOpenerAbility && Settings.RakeStealthOpener)
                {
                    SnapshotManager.Instance.AddRakedTarget(target);
                }
                if (ability is RakeAbility)
                {
                    SnapshotManager.Instance.AddRakedTarget(target);
                }
                // if (ability is Feral.RipAbility) SnapshotManager.Instance.AddRippedTarget(target);

                // Track Rejuvenation Targets
                if (ability is RejuvenateMyAllyAbility)
                {
                    UnitManager.Instance.LastKnownRejuvenatedAllies.Add(target);
                }

                return(true);
            }

            return(false);
        }
示例#52
0
 public override void Pull(WoWUnit target)
 => dm.Get <DruidManager>().Pull(target);
示例#53
0
        public static void QuestPickUp(ref Npc npc, string questName, int questId, out bool cancelPickUp, bool ignoreBlacklist = false, bool forceTravel = false)
        {
            if (npc.ForceTravel)
            {
                forceTravel = true;
            }
            cancelPickUp = false;
            if (AbandonnedId == questId) // should happen only when we do a different quest requirement for optimization
            {
                AbandonnedId = 0;
                return;
            }
            if (AbandonnedId != 0)
            {
                AbandonQuest(AbandonnedId);
            }
            AbandonnedId = 0;
            Point   me   = ObjectManager.ObjectManager.Me.Position;
            WoWUnit mNpc = ObjectManager.ObjectManager.GetNearestWoWUnit(ObjectManager.ObjectManager.GetWoWUnitByEntry(npc.Entry, true), false, ignoreBlacklist, true);

            // We have the NPC in memory and he is closer than the QuesterDB entry. (some Npc moves)
            if (mNpc.IsValid && mNpc.HasQuests)
            {
                npc.Position = mNpc.Position;
            }
            WoWGameObject mObj = ObjectManager.ObjectManager.GetNearestWoWGameObject(ObjectManager.ObjectManager.GetWoWGameObjectByEntry(npc.Entry), ignoreBlacklist);

            if (mObj.IsValid && mObj.HasQuests)
            {
                npc.Position = mObj.Position;
            }
            bool bypassTravel = false;

            if (me.DistanceTo(npc.Position) <= 800f)
            {
                PathFinder.FindPath(npc.Position, out bypassTravel);
            }
            if (Usefuls.IsFlying && npc.ContinentIdInt == Usefuls.ContinentId)
            {
                bypassTravel = true;
            }
            else if (Usefuls.IsFlying)
            {
                MountTask.DismountMount();
            }
            if (_travelLocation != null && _travelLocation.DistanceTo(me) > 0.1f)
            {
                if (Products.Products.TravelRegenerated && Products.Products.TravelFrom.IsValid)
                {
                    _travelLocation = Products.Products.TravelFrom;
                    Products.Products.TravelRegenerated = false;
                }
            }
            if (!bypassTravel && (_travelLocation == null || _travelLocation.DistanceTo(me) > 0.1f) && !_travelDisabled)
            {
                MovementManager.StopMove();
                Logging.Write("Calling travel system for PickUpQuest " + questName + "(" + questId + ") from " + npc.Name + " (" + npc.Entry + ")...");
                Products.Products.TravelToContinentId   = npc.ContinentIdInt;
                Products.Products.TravelTo              = npc.Position;
                Products.Products.TravelFromContinentId = Usefuls.ContinentId;
                Products.Products.TravelFrom            = me;
                Products.Products.ForceTravel           = forceTravel;
                // Pass the check for valid destination as a lambda
                Products.Products.TargetValidationFct = IsNearQuestGiver;
                _travelLocation = Products.Products.TravelFrom;
                return;
            }
            if (_travelLocation != null && _travelLocation.DistanceTo(me) <= 0.1f)
            {
                _travelDisabled = true;
            }
            //Start target finding based on QuestGiver.
            uint baseAddress = MovementManager.FindTarget(ref npc, 4.5f, true, true, 0f, ignoreBlacklist); // can pick up quest on dead NPC.

            if (MovementManager.InMovement)
            {
                return;
            }
            _travelDisabled = false; // reset travel
            if (baseAddress > 0)
            {
                var tmpNpc = ObjectManager.ObjectManager.GetObjectByGuid(npc.Guid);
                if (tmpNpc is WoWUnit)
                {
                    var unitTest = tmpNpc as WoWUnit;
                    if (unitTest.IsValid && unitTest.GetDistance < 20f && !unitTest.HasQuests)
                    {
                        _travelDisabled = false; // reset travel
                        nManagerSetting.AddBlackList(unitTest.Guid, 30000);
                        Logging.Write("Npc QuestGiver " + unitTest.Name + " (" + unitTest.Entry + ", distance: " + unitTest.GetDistance +
                                      ") does not have any available quest for the moment. Blacklisting it for 30 seconds.");
                        cancelPickUp = true;
                        return;
                    }
                }
            }
            //End target finding based on QuestGiver.
            if (mObj.IsValid && mObj.GetDistance <= 4.5f || npc.Position.DistanceTo2D(ObjectManager.ObjectManager.Me.Position) <= 4.5f && npc.Position.DistanceZ(ObjectManager.ObjectManager.Me.Position) < 6f ||
                npc.Position.DistanceTo(ObjectManager.ObjectManager.Me.Position) <= 4.5f)
            {
                if (baseAddress <= 0)
                {
                    cancelPickUp = true; // We are there but no NPC waiting for us.
                    // This code is there for Mimesis and I'm not currently working on Quester, so I'm not going to "return;" there as quester will be even more lost.
                    npc.Ignore(120000);
                    return;
                }
                if (Usefuls.IsFlying)
                {
                    MountTask.Land();
                }
                InteractTarget(ref npc, baseAddress);
                Logging.Write("PickUpQuest " + questName + " (" + questId + ") from " + npc.Name + " (" + npc.Entry + ")");
                int id = GetQuestID();
                if (GetNumGossipAvailableQuests() == 0 && id == questId)
                {
                    AcceptQuest();
                    Thread.Sleep(Usefuls.Latency + 500);
                }
                if (GetLogQuestId().Contains(questId))
                {
                    CloseWindow();
                }
                else
                {
                    bool systemWorks = GetGossipAvailableQuestsWorks();
                    if (systemWorks) // 2 quest gossip systems = 2 different codes :(
                    {
                        for (int i = 1; i <= GetNumGossipAvailableQuests(); i++)
                        {
                            SelectGossipAvailableQuest(i);
                            Thread.Sleep(Usefuls.Latency + 500);
                            id = GetQuestID();
                            if (id == 0)
                            {
                                systemWorks = false;
                                break;
                            }
                            if (id == questId)
                            {
                                AcceptQuest();
                                Thread.Sleep(Usefuls.Latency + 500);
                                id = GetQuestID();
                                CloseWindow();
                                if (id != questId)
                                {
                                    AbandonQuest(id);
                                }
                                break;
                            }
                            CloseWindow();
                            Thread.Sleep(Usefuls.Latency + 500);
                            AbandonQuest(id);
                            Interact.InteractWith(baseAddress);
                            Thread.Sleep(Usefuls.Latency + 500);
                        }
                    }
                    if (!systemWorks)
                    {
                        int gossipid = 1;
                        while (GetAvailableTitle(gossipid) != "")
                        {
                            SelectAvailableQuest(gossipid);
                            Thread.Sleep(Usefuls.Latency + 500);
                            id = GetQuestID();
                            if (id == questId)
                            {
                                AcceptQuest();
                                Thread.Sleep(Usefuls.Latency + 500);
                                id = GetQuestID();
                                CloseWindow();
                                if (id != questId)
                                {
                                    AbandonQuest(id);
                                }
                                break;
                            }
                            CloseWindow();
                            Thread.Sleep(Usefuls.Latency + 500);
                            AbandonQuest(id);
                            Interact.InteractWith(baseAddress);
                            Thread.Sleep(Usefuls.Latency + 500);
                            gossipid++;
                        }
                    }
                }
                KilledMobsToCount.Clear();
                Thread.Sleep(Usefuls.Latency);
            }
            CloseWindow();
        }
示例#54
0
        public static bool CanCast(string spellName, WoWUnit onUnit)
        {
            if (onUnit == null)
            {
                return(false);
            }

            //trying to prevent vt from doublecasting....


            // Do we have spell?
            if (!SpellManager.Spells.ContainsKey(spellName))
            {
                return(false);
            }

            WoWSpell spell = SpellManager.Spells[spellName];

            if (spellName == "Vampiric Touch" && spell.Cooldown)
            {
                return(false);
            }


            // are we casting or channeling ?
            if (Me.ChanneledCastingSpellId == 15407 && spellName != "Vampiric Touch" &&
                AuraManager.GetAuraTimeLeft("Mind Flay", onUnit, true).TotalSeconds >= AltarboySettings.Instance.ClippingDuration)
            {
                return(false);
            }

            if (Priest.ActiveSpec == TalentSpec.DisciplinePriest && (Me.IsCasting || Me.ChanneledCastingSpellId != 0))
            {
                return(false);
            }


            if (SpellManager.GlobalCooldownLeft.TotalSeconds > AltarboySettings.Instance.CoolDownDuration)
            {
                return(false);
            }

            // is spell in CD?
            if (spell.CooldownTimeLeft.TotalSeconds >= AltarboySettings.Instance.CoolDownDuration)
            {
                return(false);
            }

            // minrange check
            if (spell.MinRange != 0 && onUnit.DistanceSqr < spell.MinRange * spell.MinRange)
            {
                return(false);
            }

            // do we have enough power?
            if (Me.GetCurrentPower(spell.PowerType) < spell.PowerCost)
            {
                return(false);
            }


            return(true);
        }
示例#55
0
 public static Boolean CastSpell(string spellName, WoWUnit target)
 {
     Logger.CastLog(spellName, target.Name);
     LastSpellCast = spellName;
     return(SpellManager.Cast(spellName, target));
 }
示例#56
0
        protected override Composite CreateBehavior()
        {
            return(_root ?? (_root =
                                 new Decorator(ret => !_isDone,
                                               new PrioritySelector(
                                                   new Decorator(ret => IsQuestComplete(),
                                                                 new PrioritySelector(
                                                                     new Decorator(ret => Me.IsOnTransport,
                                                                                   new Action(delegate
            {
                DLog("Quest complete - cancelling Flame Ascendancy");
                Lua.DoString("VehicleExit()");
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                                   ),
                                                                     new Action(delegate
            {
                _isDone = true;
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                     )
                                                                 ),

                                                   // loop waiting for target only if no buff
                                                   new Decorator(ret => Target == null,
                                                                 new Action(delegate
            {
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                 ),

                                                   // loop waiting for CurrentTarget only if no buff
                                                   new Decorator(ret => Target != Me.CurrentTarget,
                                                                 new Action(delegate
            {
                WoWUnit target = Target;
                target.Target();
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                 ),

                                                   // use item to get buff (enter vehicle)
                                                   new Decorator(ret => !Me.IsOnTransport,
                                                                 new Action(delegate
            {
                WoWItem item = ObjectManager.GetObjectsOfType <WoWItem>().FirstOrDefault(i => i != null && i.Entry == 42481);
                if (item == null)
                {
                    Log("ERROR - quest item Talisman of Flame Ascendancy not in inventory");
                    TreeRoot.Stop();
                }

                Log("Use: {0}", item.Name);
                item.Use(true);
                StyxWoW.SleepForLagDuration();
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Decorator(ret => Target.Distance > 5,
                                                                 new Action(delegate
            {
                DLog("Moving towards target");
                Navigator.MoveTo(Target.Location);
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Decorator(ret => Target.Distance <= 5 && Me.IsMoving,
                                                                 new Action(delegate
            {
                DLog("At target, so stopping");
                WoWMovement.MoveStop();
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Decorator(ret => !StyxWoW.GlobalCooldown && !Blacklist.Contains(2),
                                                                 new Action(delegate
            {
                Log("Cast Flame Shield");
                Lua.DoString("RunMacroText(\"/click BonusActionButton4\")");
                Blacklist.Add(2, TimeSpan.FromMilliseconds(8000));
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Decorator(ret => !StyxWoW.GlobalCooldown && !Blacklist.Contains(1),
                                                                 new Action(delegate
            {
                Log("Cast Attack");
                Lua.DoString("RunMacroText(\"/click BonusActionButton1\")");
                Blacklist.Add(1, TimeSpan.FromMilliseconds(1500));
                return RunStatus.Success;
            })
                                                                 ),

                                                   new Action(delegate
            {
                DLog("Waiting for Cooldown");
                return lastStateReturn;
            })
                                                   )
                                               )
                             ));
        }
示例#57
0
        public void PriestKill(WoWUnit Unit)
        {
            if (Me.HealthPercent < 10 && SpellManager.HasSpell("Flash Heal"))
            {
                while (Me.HealthPercent < 30 && SpellManager.HasSpell("Flash Heal"))
                {
                    RarekillerSpells.CastSafe("Flash Heal", Me, true);
                    Thread.Sleep(100);
                }
            }
            if (Me.HealthPercent < 30 && SpellManager.HasSpell("Greater Heal"))
            {
                while (Me.HealthPercent < 50 && SpellManager.HasSpell("Greater Heal"))
                {
                    RarekillerSpells.CastSafe("Greater Heal", Me, true);
                    Thread.Sleep(100);
                }
            }
            if (Me.HealthPercent < 50 && SpellManager.HasSpell("Renew") && !SpellManager.Spells["Renew"].Cooldown)
            {
                RarekillerSpells.CastSafe("Renew", Me, true);
                Thread.Sleep(100);
            }
            if (Me.ManaPercent < 40 && SpellManager.HasSpell("Dispersion") && !SpellManager.Spells["Dispersion"].Cooldown)
            {
                RarekillerSpells.CastSafe("Dispersion", Me, true);
                Thread.Sleep(6500);
            }
            if (Me.ManaPercent < 10 && SpellManager.HasSpell("Shoot") && !SpellManager.Spells["Shoot"].Cooldown)
            {
                while (Me.ManaPercent < 30 && SpellManager.HasSpell("Shoot"))
                {
                    RarekillerSpells.CastSafe("Shoot", Unit, true);
                    Thread.Sleep(6500);
                    return;
                }
            }

// -------- Shadow Form if possible
            if (SpellManager.HasSpell("Shadowform") && SpellManager.CanCast("Shadowform") && !Me.ActiveAuras.ContainsKey("Shadowform"))
            {
                RarekillerSpells.CastSafe("Shadowform", Me, true);
                Thread.Sleep(100);
            }

// -------- Damage DOTs Renew
            if (SpellManager.HasSpell("Vampiric Embrance") && !SpellManager.Spells["Vampiric Embrance"].Cooldown && !Me.ActiveAuras.ContainsKey("Vampiric Embrance"))
            {
                RarekillerSpells.CastSafe("Vampiric Embrance", Me, true);
                Thread.Sleep(100);
                return;
            }
            if (SpellManager.HasSpell("Vampiric Touch") && !SpellManager.Spells["Vampiric Touch"].Cooldown && !Unit.ActiveAuras.ContainsKey("Vampiric Touch"))
            {
                RarekillerSpells.CastSafe("Vampiric Touch", Unit, true);
                Thread.Sleep(100);
                return;
            }
            if (SpellManager.HasSpell("Shadow Word: Pain") && !SpellManager.Spells["Shadow Word: Pain"].Cooldown && !Unit.ActiveAuras.ContainsKey("Shadow Word: Pain"))
            {
                RarekillerSpells.CastSafe("Shadow Word: Pain", Unit, true);
                Thread.Sleep(100);
                return;
            }
            if (SpellManager.HasSpell("Devouring Plague") && !SpellManager.Spells["Devouring Plague"].Cooldown && !Unit.ActiveAuras.ContainsKey("Devouring Plague"))
            {
                RarekillerSpells.CastSafe("Devouring Plague", Unit, true);
                Thread.Sleep(100);
                return;
            }

// -------- Damage Spells
            if (SpellManager.HasSpell("Mind Blast") && !SpellManager.Spells["Mind Blast"].Cooldown)
            {
                RarekillerSpells.CastSafe("Mind Blast", Unit, true);
                Thread.Sleep(100);
                return;
            }
            if (SpellManager.HasSpell("Mind Flay") && !SpellManager.Spells["Mind Flay"].Cooldown)
            {
                RarekillerSpells.CastSafe("Mind Flay", Unit, true);
                Thread.Sleep(100);
                return;
            }
            if (!SpellManager.HasSpell("Shadowform") && SpellManager.HasSpell("Smite") && !SpellManager.Spells["Smite"].Cooldown)
            {
                RarekillerSpells.CastSafe("Smite", Unit, true);
                Thread.Sleep(100);
                return;
            }
            if (!SpellManager.HasSpell("Shadowform") && SpellManager.HasSpell("Holy Fire") && !SpellManager.Spells["Holy Fire"].Cooldown)
            {
                RarekillerSpells.CastSafe("Holy Fire", Unit, true);
                Thread.Sleep(100);
                return;
            }
        }
示例#58
0
 protected override RunStatus Run(object context)
 {
     if (!IsDone)
     {
         if (MerchantFrame.Instance == null || !MerchantFrame.Instance.IsVisible)
         {
             WoWPoint movetoPoint = _loc;
             WoWUnit  unit        = ObjectManager.GetObjectsOfType <WoWUnit>().Where(o => o.Entry == NpcEntry).
                                    OrderBy(o => o.Distance).FirstOrDefault();
             if (unit != null)
             {
                 movetoPoint = WoWMathHelper.CalculatePointFrom(Me.Location, unit.Location, 3);
             }
             else if (movetoPoint == WoWPoint.Zero)
             {
                 movetoPoint = MoveToAction.GetLocationFromDB(MoveToAction.MoveToType.NpcByID, NpcEntry);
             }
             if (movetoPoint != WoWPoint.Zero && ObjectManager.Me.Location.Distance(movetoPoint) > 4.5)
             {
                 Util.MoveTo(movetoPoint);
             }
             else if (unit != null)
             {
                 unit.Target();
                 unit.Interact();
             }
             if (GossipFrame.Instance != null && GossipFrame.Instance.IsVisible &&
                 GossipFrame.Instance.GossipOptionEntries != null)
             {
                 foreach (GossipEntry ge in GossipFrame.Instance.GossipOptionEntries)
                 {
                     if (ge.Type == GossipEntry.GossipEntryType.Vendor)
                     {
                         GossipFrame.Instance.SelectGossipOption(ge.Index);
                         break;
                     }
                 }
             }
         }
         else
         {
             // check if we have merchant frame open at correct NPC
             if (NpcEntry > 0 && Me.GotTarget && Me.CurrentTarget.Entry != NpcEntry)
             {
                 MerchantFrame.Instance.Close();
                 return(RunStatus.Success);
             }
             if (!_concludingSw.IsRunning)
             {
                 if (BuyItemType == BuyItemActionType.SpecificItem)
                 {
                     var      idList  = new List <uint>();
                     string[] entries = ItemID.Split(',');
                     if (entries.Length > 0)
                     {
                         foreach (string entry in entries)
                         {
                             uint temp;
                             uint.TryParse(entry.Trim(), out temp);
                             idList.Add(temp);
                         }
                     }
                     else
                     {
                         Professionbuddy.Err(Pb.Strings["Error_NoItemEntries"]);
                         IsDone = true;
                         return(RunStatus.Failure);
                     }
                     foreach (uint id in idList)
                     {
                         int count = !BuyAdditively ? Count - Util.GetCarriedItemCount(id) : Count;
                         if (count > 0)
                         {
                             BuyItem(id, (uint)count);
                         }
                     }
                 }
                 else if (BuyItemType == BuyItemActionType.Material)
                 {
                     foreach (var kv in Pb.MaterialList)
                     {
                         // only buy items if we don't have enough in bags...
                         int amount = kv.Value - (int)Ingredient.GetInBagItemCount(kv.Key);
                         if (amount > 0)
                         {
                             BuyItem(kv.Key, (uint)amount);
                         }
                     }
                 }
                 _concludingSw.Start();
             }
             if (_concludingSw.ElapsedMilliseconds >= 2000)
             {
                 Professionbuddy.Log("BuyItemAction Completed");
                 IsDone = true;
             }
         }
         if (!IsDone)
         {
             return(RunStatus.Success);
         }
     }
     return(RunStatus.Failure);
 }
示例#59
0
 // Returns whether the unit can bleed or be poisoned
 public static bool CanBleed(WoWUnit unit)
 {
     return(unit.CreatureTypeTarget != "Elemental" && unit.CreatureTypeTarget != "Mechanical");
 }
示例#60
0
 private bool IsViableTarget(WoWUnit wowUnit)
 {
     return((wowUnit != null) && wowUnit.IsValid && wowUnit.IsHostile && !wowUnit.IsDead);
 }