public override void Run()
        {
            Logger.LogDebug("************ RUNNING BUY AND LEARN RECIPE STATE ************");

            Step currentStep  = profession.CurrentStep;
            var  RecipeVendor = currentStep.ItemoCraft.RecipeVendor;

            Logger.Log($"Buying {currentStep.ItemoCraft.Name} recipe at NPC {profession.ProfessionTrainer.Entry}");

            // Check if continent ok
            if ((ContinentId)Usefuls.ContinentId != RecipeVendor.ContinentId)
            {
                Logger.Log($"The vendor is on continent {RecipeVendor.ContinentId}, launching traveler");
                Bot.SetContinent(RecipeVendor.ContinentId);
                return;
            }

            Broadcaster.autoBroadcast = false;

            if (GoToTask.ToPositionAndIntecractWithNpc(RecipeVendor.Position, RecipeVendor.Entry, RecipeVendor.GossipOption))
            {
                Vendor.BuyItem(ItemsManager.GetNameById(currentStep.ItemoCraft.RecipeItemId), 1);
                Thread.Sleep(2000);

                ItemsManager.UseItemByNameOrId(currentStep.ItemoCraft.RecipeItemId.ToString());
                Usefuls.WaitIsCasting();
                Thread.Sleep(300);
            }

            currentStep.KnownRecipe = ToolBox.RecipeIsKnown(currentStep.ItemoCraft.Name, profession);

            Broadcaster.autoBroadcast = true;
        }
Ejemplo n.º 2
0
 public static bool HealSpell(Spell spell, bool CanBeMounted = false, bool force = false, bool focus = false)
 {
     if (spell.KnownSpell && spell.IsSpellUsable && !ObjectManager.Me.HaveBuff(spell.Name))
     {
         if (force)
         {
             Lua.LuaDoString("SpellStopCasting();");
         }
         if (ObjectManager.Me.IsMounted == CanBeMounted)
         {
             if (focus)
             {
                 Lua.LuaDoString($"CastSpellByID({ spell.Id}, \"focus\")");
                 Usefuls.WaitIsCasting();
                 Logging.Write("Casting Healspell @ focus: " + spell);
                 return(true);
             }
             else
             {
                 spell.Launch();
                 Usefuls.WaitIsCasting();
                 Logging.Write("Casting Healspell: " + spell);
                 return(true);
             }
         }
     }
     return(false);
 }
    public override void Run()
    {
        Logger.LogDebug("************ RUNNING DISENCHANT STATE ************");
        Step           currentStep       = profession.CurrentStep;
        List <WoWItem> bagItems          = Bag.GetBagItem();
        List <WoWItem> itemsToDisenchant = profession.ItemsToDisenchant;

        MovementManager.StopMoveNewThread();

        // Deactivate broadcast
        Broadcaster.autoBroadcast = false;

        foreach (WoWItem item in itemsToDisenchant)
        {
            List <int> bagAndSlot = Bag.GetItemContainerBagIdAndSlot(item.Name);
            Logger.Log($"Disenchanting item {item.Name} (iLvl {item.GetItemInfo.ItemLevel})");
            Disenchant.Launch();
            if (Main.wowVersion > 1)
            {
                Lua.LuaDoString("UseContainerItem(" + bagAndSlot[0] + "," + bagAndSlot[1] + ")");
            }
            else
            {
                Lua.LuaDoString("PickupContainerItem(" + bagAndSlot[0] + "," + bagAndSlot[1] + ")");
            }
            Usefuls.WaitIsCasting();
        }

        profession.ReevaluateStep();

        Broadcaster.autoBroadcast = true;
    }
    internal static void PetManager()
    {
        if (!Me.IsDeadMe || !Me.IsMounted)
        {
            // Call Pet
            if (!ObjectManager.Pet.IsValid && CallPet.KnownSpell && !Me.IsMounted && CallPet.IsSpellUsable)
            {
                CallPet.Launch();
                Thread.Sleep(Usefuls.Latency + 1000);
            }

            // Revive Pet
            if (ObjectManager.Pet.IsDead && RevivePet.KnownSpell && !Me.IsMounted && RevivePet.IsSpellUsable)
            {
                RevivePet.Launch();
                Thread.Sleep(Usefuls.Latency + 1000);
                Usefuls.WaitIsCasting();
            }

            // Mend Pet
            if (ObjectManager.Pet.IsAlive && ObjectManager.Pet.IsValid && !ObjectManager.Pet.HaveBuff("Mend Pet") &&
                Me.IsAlive && MendPet.KnownSpell && MendPet.IsDistanceGood && ObjectManager.Pet.HealthPercent <= 60 &&
                MendPet.IsSpellUsable)
            {
                MendPet.Launch();
                Thread.Sleep(Usefuls.Latency + 1000);
            }
        }
    }
Ejemplo n.º 5
0
        public static void ApplyBandage(string bandage)
        {
            WriteDebug($"[{ FightClassSettings.Name }] applying bandage \"{ bandage }\"");

            ItemsManager.UseItem(ItemsManager.GetIdByName(bandage));
            Thread.Sleep(Usefuls.Latency);
            Usefuls.WaitIsCasting();
        }
Ejemplo n.º 6
0
        // Pull
        public static bool Pull(Cast cast, bool alwaysPull, List <AIOSpell> spells)
        {
            AIOSpell pullSpell = spells.Find(s => s != null && s.IsSpellUsable && s.KnownSpell);

            if (pullSpell == null)
            {
                RangeManager.SetRangeToMelee();
                return(false);
            }

            WoWUnit closestHostileFromTarget = GetClosestHostileFrom(ObjectManager.Target, 20);

            if (closestHostileFromTarget == null && !alwaysPull)
            {
                RangeManager.SetRangeToMelee();
                return(false);
            }

            float pullRange = pullSpell.MaxRange;

            if (ObjectManager.Target.GetDistance > pullRange - 2 ||
                ObjectManager.Target.GetDistance < 6 ||
                TraceLine.TraceLineGo(ObjectManager.Target.Position))
            {
                RangeManager.SetRangeToMelee();
                return(false);
            }

            if (closestHostileFromTarget != null && RangeManager.GetRange() < pullRange)
            {
                Logger.Log($"Pulling from distance (hostile unit {closestHostileFromTarget.Name} is too close)");
            }

            if (ObjectManager.Me.IsMounted)
            {
                MountTask.DismountMount();
            }

            RangeManager.SetRange(pullRange - 1);
            Thread.Sleep(300);

            if (cast.OnTarget(pullSpell))
            {
                Thread.Sleep(500);
                if (pullSpell.GetCurrentCooldown > 0)
                {
                    Usefuls.WaitIsCasting();
                    if (pullSpell.Name == "Shoot" || pullSpell.Name == "Throw" || pullSpell.Name == "Avenger's Shield")
                    {
                        Thread.Sleep(1500);
                    }
                    return(true);
                }
            }

            return(false);
        }
 private void RacialStoneForm()
 {
     if (Stoneform.KnownSpell &&
         Stoneform.IsSpellUsable &&
         (ToolBox.HasPoisonDebuff() || ToolBox.HasDiseaseDebuff() || Me.HaveBuff("Bleed")))
     {
         Stoneform.Launch();
         Usefuls.WaitIsCasting();
     }
 }
 private void RacialGiftOfTheNaaru()
 {
     if (GiftOfTheNaaru.KnownSpell &&
         GiftOfTheNaaru.IsSpellUsable &&
         ObjectManager.GetNumberAttackPlayer() > 1 && Me.HealthPercent < 50)
     {
         GiftOfTheNaaru.Launch();
         Usefuls.WaitIsCasting();
     }
 }
 private void RacialEscapeArtist()
 {
     if (EscapeArtist.KnownSpell &&
         EscapeArtist.IsSpellUsable &&
         Me.Rooted || Me.HaveBuff("Frostnova"))
     {
         EscapeArtist.Launch();
         Usefuls.WaitIsCasting();
     }
 }
Ejemplo n.º 10
0
 public static bool PetSpell(Spell spell)
 {
     if (spell.KnownSpell && spell.IsSpellUsable && !ObjectManager.Me.IsMounted && ObjectManager.Pet.IsValid && ObjectManager.Pet.IsAlive)
     {
         spell.Launch();
         Usefuls.WaitIsCasting();
         Logging.Write("Casting Petspell: " + spell);
         return(true);
     }
     return(false);
 }
    internal static bool Cast(Spell s)
    {
        CombatDebug("In cast for " + s.Name);
        if (!s.IsSpellUsable || !s.KnownSpell || Me.IsCast)
        {
            return(false);
        }

        s.Launch();
        Usefuls.WaitIsCasting();
        return(true);
    }
 private void UseGhostWolf()
 {
     if (string.IsNullOrWhiteSpace(wManagerSetting.CurrentSetting.GroundMountName) &&
         !new Regeneration().NeedToRun&&
         !Me.HasBuff("Ghost Wolf") &&
         ExampleSettings.CurrentSetting.GhostWolf &&
         !Me.InCombat)
     {
         RotationCombatUtil.CastSpell(GhostWolf, Me);
         Thread.Sleep(Usefuls.Latency);
         Usefuls.WaitIsCasting();
     }
 }
 private void RacialWarStomp()
 {
     if (WarStomp.KnownSpell &&
         WarStomp.IsSpellUsable &&
         !Me.HaveBuff("Bear Form") &&
         !Me.HaveBuff("Cat Form") &&
         !Me.HaveBuff("Dire Bear Form") &&
         ObjectManager.GetNumberAttackPlayer() > 1 &&
         ObjectManager.Target.GetDistance < 8)
     {
         WarStomp.Launch();
         Usefuls.WaitIsCasting();
     }
 }
 private void RacialCannibalize()
 {
     // Cannibalize
     if (Cannibalize.KnownSpell &&
         Cannibalize.IsSpellUsable &&
         Me.HealthPercent < 50 &&
         !Me.HaveBuff("Drink") &&
         !Me.HaveBuff("Food") &&
         Me.IsAlive &&
         ObjectManager.GetObjectWoWUnit().Where(u => u.GetDistance <= 8 && u.IsDead && (u.CreatureTypeTarget == "Humanoid" || u.CreatureTypeTarget == "Undead")).Count() > 0)
     {
         Cannibalize.Launch();
         Usefuls.WaitIsCasting();
     }
 }
Ejemplo n.º 15
0
    public void Buff()
    {
        if (ObjectManager.Me.HealthPercent <= 60 && !Fight.InFight)
        {
            MovementManager.StopMoveTo(false, 3000);
            HealingWave.Launch();
            Usefuls.WaitIsCasting();
        }

        if (LightningShield.KnownSpell && ObjectManager.Me.ManaPercentage > 70 && !ObjectManager.Me.HaveBuff("Lightning Shield"))
        {
            LightningShield.Launch();
        }


        if ((ObjectManager.Target.IsNpcVendor) && !(ObjectManager.Me.InCombatFlagOnly) && ObjectManager.Me.HaveBuff("Ghost Wolf"))
        {
            Ghostwolf.Launch();
        }

        // break Wolf for the quest man

        if ((wManager.Wow.ObjectManager.ObjectManager.Target.Reaction == wManager.Wow.Enums.Reaction.Friendly) && !(ObjectManager.Me.InCombatFlagOnly) && ObjectManager.Me.HaveBuff("Ghost Wolf"))
        {
            Ghostwolf.Launch();
        }
        if ((wManager.Wow.ObjectManager.ObjectManager.Target.Reaction == wManager.Wow.Enums.Reaction.Honored) && !(ObjectManager.Me.InCombatFlagOnly) && ObjectManager.Me.HaveBuff("Ghost Wolf"))
        {
            Ghostwolf.Launch();
        }
        if ((wManager.Wow.ObjectManager.ObjectManager.Target.Reaction == wManager.Wow.Enums.Reaction.Revered) && !(ObjectManager.Me.InCombatFlagOnly) && ObjectManager.Me.HaveBuff("Ghost Wolf"))
        {
            Ghostwolf.Launch();
        }

        var nodesNearMe = ObjectManager.GetObjectWoWGameObject().FindAll(p => p.GetDistance <= 8 && p.CanOpen);

        // break wolf for the nodes
        if (nodesNearMe.Count > 0 && !(ObjectManager.Me.InCombatFlagOnly) && ObjectManager.Me.HaveBuff("Ghost Wolf"))
        {
            Ghostwolf.Launch();
        }
        // break wolf for the trainer man
        if ((ObjectManager.Target.IsNpcTrainer) && !(ObjectManager.Me.InCombatFlagOnly) && ObjectManager.Me.HaveBuff("Ghost Wolf"))
        {
            Ghostwolf.Launch();
        }
    }
Ejemplo n.º 16
0
    private static bool InterruptSpell(Spell spell, bool CanBeMounted = false)
    {
        var resultLua = Lua.LuaDoString("ret = \"false\"; spell, rank, displayName, icon, startTime, endTime, isTradeSkill, castID, interrupt = UnitCastingInfo(\"target\"); if interrupt then ret = \"true\" end", "ret");

        if (spell.KnownSpell &&
            spell.IsSpellUsable &&
            resultLua == "true")
        {
            if (ObjectManager.Me.IsMounted == CanBeMounted)
            {
                Frameunlock();
                spell.Launch();
                Usefuls.WaitIsCasting();
                return(true);
            }
        }
        return(false);
    }
Ejemplo n.º 17
0
 public static bool BuffSpell(Spell spell, bool CanBeMounted = false, bool force = false)
 {
     if (spell.KnownSpell && spell.IsSpellUsable && !ObjectManager.Me.HaveBuff(spell.Name))
     {
         if (force)
         {
             Lua.LuaDoString("SpellStopCasting();");
         }
         if (ObjectManager.Me.IsMounted == CanBeMounted)
         {
             spell.Launch();
             Usefuls.WaitIsCasting();
             Logging.Write("Casting Buffspell: " + spell);
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 18
0
    private static void PetRevivehandler()
    {
        if (RevivePet.IsSpellUsable &&
            RevivePet.KnownSpell &&
            ObjectManager.Pet.IsDead &&
            !ObjectManager.Me.IsMounted)
        {
            RevivePet.Launch();
            Usefuls.WaitIsCasting();
        }

        if (CallPet.IsSpellUsable &&
            CallPet.KnownSpell &&
            !ObjectManager.Pet.IsValid &&
            !ObjectManager.Me.IsMounted)
        {
            CallPet.Launch();
            Usefuls.WaitIsCasting();
        }
    }
 public static void Craft(string skillName, Item item, int quantity)
 {
     OpenProfessionFrame(skillName);
     if (item.IsAnEnchant)
     {
         UseProfessionSkill(item, 1);
         WoWItem itemToEnchant = EquippedItems.GetEquippedItems().Find(i => i.GetItemInfo.ItemEquipLoc == item.EnchantGearType);
         for (var i = 0; i < quantity; i++)
         {
             int itemSlot = GetGearSlot(itemToEnchant);
             Logger.Log($"Enchanting {itemToEnchant.Name}");
             Lua.RunMacroText($"/use {itemSlot}");
             Lua.LuaDoString("ReplaceEnchant()");
             Usefuls.WaitIsCasting();
         }
     }
     else
     {
         UseProfessionSkill(item, quantity);
     }
     Usefuls.WaitIsCasting();
 }
Ejemplo n.º 20
0
 public static bool FightSpell(Spell spell, bool focus = false, bool force = false, bool stopMoving = false, bool debuff = true)
 {
     if (spell.KnownSpell && spell.IsSpellUsable && spell.IsDistanceGood && ObjectManager.Me.HasTarget && ObjectManager.Target.IsAttackable && !TraceLine.TraceLineGo(ObjectManager.Me.Position, ObjectManager.Target.Position))
     {
         if (debuff)
         {
             if (ObjectManager.Target.HaveBuff(spell.Name))
             {
                 return(false);
             }
         }
         if (force)
         {
             Lua.LuaDoString("SpellStopCasting();");
         }
         if (stopMoving)
         {
             MovementManager.StopMove();
         }
         if (focus)
         {
             Lua.LuaDoString($"CastSpellByID({ spell.Id}, \"focus\")");
             Usefuls.WaitIsCasting();
             Logging.Write("Casting Fightspell @ focus: " + spell);
             return(true);
         }
         else
         {
             spell.Launch();
             Usefuls.WaitIsCasting();
             Logging.Write("Casting Fightspell: " + spell);
             return(true);
         }
     }
     return(false);
 }
Ejemplo n.º 21
0
    internal void CombatRotation()
    {
        if (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && Fight.InFight)
        {
            if (Lua.LuaDoString <bool>(@"return (UnitIsTapped(""target"")) and (not UnitIsTappedByPlayer(""target""));"))
            {
                Fight.StopFight();
                Lua.LuaDoString("ClearTarget();");
                System.Threading.Thread.Sleep(400);
            }
        }
        if (ObjectManager.Me.HealthPercent <= 40 && !FlashHeal.KnownSpell)
        {
            LesserHeal.Launch();
        }

        if (ObjectManager.Me.HealthPercent <= 40 && FlashHeal.KnownSpell && !ObjectManager.Me.HaveBuff("Shadowform"))
        {
            FlashHeal.Launch();
        }

        if (ObjectManager.Me.HealthPercent <= 70 && Shield.KnownSpell && !ObjectManager.Me.HaveBuff("Power Word: Shield") && !ObjectManager.Me.HaveBuff("Weakened Soul"))
        {
            Shield.Launch();
        }

        if (VampiricEmbrace.KnownSpell && !ObjectManager.Target.HaveBuff("Vampiric Embrace") && ObjectManager.Target.GetDistance < 28)
        {
            VampiricEmbrace.Launch();
        }

        if (MindBlast.KnownSpell && ObjectManager.Me.ManaPercentage > 60 && ObjectManager.Target.GetDistance < 28)
        {
            this.MindBlast.Launch();
        }

        if (HolyFire.KnownSpell && !Shadowform.KnownSpell && ObjectManager.Me.ManaPercentage > 60 && ObjectManager.Target.GetDistance < 25 && ObjectManager.Target.GetDistance > 8 && ObjectManager.Target.HealthPercent >= 85)
        {
            this.HolyFire.Launch();
        }

        if (ShadowWordPain.KnownSpell && !ObjectManager.Target.HaveBuff("Shadow Word: Pain") && ObjectManager.Target.GetDistance < 28)
        {
            ShadowWordPain.Launch();
        }

        if (Mindflay.KnownSpell && ObjectManager.Me.ManaPercentage > 40 && ObjectManager.Target.GetDistance < 20 && ObjectManager.Me.HaveBuff("Power Word: Shield"))
        {
            Mindflay.Launch();
            Thread.Sleep(Usefuls.Latency);
            Usefuls.WaitIsCasting();
        }


        if (Smite.KnownSpell && ObjectManager.Me.ManaPercentage > 20 && ObjectManager.Me.HealthPercent >= 40 && ObjectManager.Me.Level < 5 && ObjectManager.Target.GetDistance < 25)
        {
            Smite.Launch();
        }

        if (DevouringPlague.KnownSpell && ObjectManager.Target.GetDistance < 25)
        {
            DevouringPlague.Launch();
        }

        if (!Lua.LuaDoString <bool>("return IsAutoRepeatAction(" + (SpellManager.GetSpellSlotId(SpellListManager.SpellIdByName("Shoot")) + 1) + ")") && ObjectManager.Me.HealthPercent >= 40)
        {
            if (Shoot.KnownSpell)
            {
                SpellManager.CastSpellByNameLUA("Shoot");
            }
            return;
        }
    }
Ejemplo n.º 22
0
        private void FightLoopHandler(WoWUnit unit, CancelEventArgs cancelable)
        {
            float minDistance = RangeManager.GetMeleeRangeWithTarget() + 3f;

            // Do we need to backup?
            if ((ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                ObjectManager.Target.GetDistance < minDistance &&
                Me.IsAlive &&
                ObjectManager.Target.IsAlive &&
                !cast.IsBackingUp &&
                !Me.IsCast &&
                !RangeManager.CurrentRangeIsMelee() &&
                ObjectManager.Target.HealthPercent > 5 &&
                !_isPolymorphing)
            {
                cast.IsBackingUp = true;
                Timer timer = new Timer(3000);

                // Using CTM
                if (settings.BackupUsingCTM)
                {
                    Vector3 position = ToolBox.BackofVector3(Me.Position, Me, 15f);
                    MovementManager.Go(PathFinder.FindPath(position), false);
                    Thread.Sleep(500);

                    // Backup loop
                    while (MovementManager.InMoveTo &&
                           Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           ObjectManager.Target.GetDistance < minDistance &&
                           ObjectManager.Me.IsAlive &&
                           ObjectManager.Target.IsAlive &&
                           (ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                           !timer.IsReady)
                    {
                        // Wait follow path
                        Thread.Sleep(300);
                        if (settings.BlinkWhenBackup)
                        {
                            cast.OnSelf(Blink);
                        }
                    }
                    MovementManager.StopMove();
                    Thread.Sleep(500);
                }
                // Using Keyboard
                else
                {
                    while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           ObjectManager.Me.IsAlive &&
                           ObjectManager.Target.IsAlive &&
                           ObjectManager.Target.GetDistance < minDistance &&
                           (ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                           !timer.IsReady)
                    {
                        Move.Backward(Move.MoveAction.PressKey, 500);
                    }
                }
                cast.IsBackingUp = false;
            }

            // Polymorph
            if (settings.UsePolymorph &&
                ObjectManager.GetNumberAttackPlayer() > 1 &&
                Polymorph.KnownSpell &&
                !cast.IsBackingUp &&
                !cast.IsApproachingTarget &&
                specialization.RotationType != Enums.RotationType.Party &&
                _polymorphableEnemyInThisFight)
            {
                WoWUnit myNearbyPolymorphed = null;
                // Detect if a polymorph cast has succeeded
                if (_polymorphedEnemy != null)
                {
                    myNearbyPolymorphed = ObjectManager.GetObjectWoWUnit().Find(u => u.HaveBuff("Polymorph") && u.Guid == _polymorphedEnemy.Guid);
                }

                // If we don't have a polymorphed enemy
                if (myNearbyPolymorphed == null)
                {
                    _polymorphedEnemy = null;
                    _isPolymorphing   = true;
                    WoWUnit firstTarget = ObjectManager.Target;
                    WoWUnit potentialPolymorphTarget = null;

                    // Select our attackers one by one for potential polymorphs
                    foreach (WoWUnit enemy in ObjectManager.GetUnitAttackPlayer())
                    {
                        Interact.InteractGameObject(enemy.GetBaseAddress);

                        if ((enemy.CreatureTypeTarget == "Beast" || enemy.CreatureTypeTarget == "Humanoid") &&
                            enemy.Guid != firstTarget.Guid)
                        {
                            potentialPolymorphTarget = enemy;
                            break;
                        }
                    }

                    if (potentialPolymorphTarget == null)
                    {
                        _polymorphableEnemyInThisFight = false;
                    }

                    // Polymorph cast
                    if (potentialPolymorphTarget != null &&
                        _polymorphedEnemy == null &&
                        cast.OnFocusUnit(Polymorph, potentialPolymorphTarget))
                    {
                        Usefuls.WaitIsCasting();
                        _polymorphedEnemy = potentialPolymorphTarget;
                    }

                    _isPolymorphing = false;
                }
            }
        }
    internal static void BuffRotation()
    {
        if (!Me.IsMounted)
        {
            // Make sure we have mana to summon
            if (!ObjectManager.Pet.IsValid &&
                ObjectManager.Me.ManaPercentage < 95 &&
                !ObjectManager.Me.HaveBuff("Drink") &&
                (SummonVoidwalker.KnownSpell && !SummonVoidwalker.IsSpellUsable && ToolBox.CountItemStacks("Soul Shard") > 0 ||
                 (SummonImp.KnownSpell && !SummonImp.IsSpellUsable && !SummonVoidwalker.KnownSpell)))
            {
                Main.Log("Not enough mana to summon, forcing regen");
                wManager.wManagerSetting.CurrentSetting.DrinkPercent = 95;
                Thread.Sleep(1000);
                return;
            }
            else
            {
                wManager.wManagerSetting.CurrentSetting.DrinkPercent = _saveDrinkPercent;
            }

            // Switch Auto Torment & Suffering off
            if (PetAndConsumables.MyWarlockPet().Equals("Voidwalker"))
            {
                ToolBox.TogglePetSpellAuto("Torment", _settings.AutoTorment);
                ToolBox.TogglePetSpellAuto("Suffering", false);
            }

            // Summon Felguard
            if ((!ObjectManager.Pet.IsValid ||
                 PetAndConsumables.MyWarlockPet().Equals("Voidwalker") || PetAndConsumables.MyWarlockPet().Equals("Imp")) &&
                SummonFelguard.KnownSpell)
            {
                Thread.Sleep(Usefuls.Latency + 500); // Safety for Mount check
                if (!ObjectManager.Me.IsMounted)
                {
                    if (Cast(FelDomination))
                    {
                        Thread.Sleep(200);
                    }
                    if (Cast(SummonFelguard))
                    {
                        return;
                    }
                }
            }

            // Summon Felguard for mana or health
            if (SummonFelguard.KnownSpell &&
                (ObjectManager.Pet.ManaPercentage < 20 || ObjectManager.Pet.HealthPercent < 20) &&
                ObjectManager.Pet.IsValid)
            {
                Thread.Sleep(Usefuls.Latency + 500); // Safety for Mount check
                if (!ObjectManager.Me.IsMounted)
                {
                    if (Cast(FelDomination))
                    {
                        Thread.Sleep(200);
                    }
                    if (Cast(SummonFelguard))
                    {
                        return;
                    }
                }
            }

            // Summon Void Walker
            if ((!ObjectManager.Pet.IsValid || !PetAndConsumables.MyWarlockPet().Equals("Voidwalker")) &&
                SummonVoidwalker.KnownSpell &&
                !SummonFelguard.KnownSpell)
            {
                Thread.Sleep(Usefuls.Latency + 500); // Safety for Mount check
                if (!ObjectManager.Me.IsMounted)
                {
                    if (Cast(FelDomination))
                    {
                        Thread.Sleep(200);
                    }
                    if (Cast(SummonVoidwalker))
                    {
                        return;
                    }
                }
            }

            // Summon Void Walker for mana
            if (PetAndConsumables.MyWarlockPet().Equals("Voidwalker") &&
                SummonVoidwalker.KnownSpell &&
                ObjectManager.Pet.ManaPercentage < 20 &&
                !SummonFelguard.KnownSpell)
            {
                Thread.Sleep(Usefuls.Latency + 500); // Safety for Mount check
                if (!ObjectManager.Me.IsMounted)
                {
                    if (Cast(FelDomination))
                    {
                        Thread.Sleep(200);
                    }
                    if (Cast(SummonVoidwalker))
                    {
                        return;
                    }
                }
            }

            // Summon Imp
            if (!ObjectManager.Pet.IsValid && SummonImp.KnownSpell &&
                (!SummonVoidwalker.KnownSpell || ToolBox.CountItemStacks("Soul Shard") < 1))
            {
                Thread.Sleep(Usefuls.Latency + 500); // Safety for Mount check
                if (!ObjectManager.Me.IsMounted)
                {
                    if (Cast(FelDomination))
                    {
                        Thread.Sleep(200);
                    }
                    if (Cast(SummonImp))
                    {
                        return;
                    }
                }
            }

            // Life Tap
            if (Me.HealthPercent > Me.ManaPercentage &&
                _settings.UseLifeTap)
            {
                if (Cast(LifeTap))
                {
                    return;
                }
            }

            // Unending Breath
            if (!Me.HaveBuff("Unending Breath") &&
                UnendingBreath.KnownSpell &&
                UnendingBreath.IsSpellUsable &&
                _settings.UseUnendingBreath)
            {
                Lua.RunMacroText("/target player");
                if (Cast(UnendingBreath))
                {
                    Lua.RunMacroText("/cleartarget");
                    return;
                }
            }

            // Demon Skin
            if (!Me.HaveBuff("Demon Skin") &&
                !DemonArmor.KnownSpell &&
                DemonSkin.KnownSpell)
            {
                if (Cast(DemonSkin))
                {
                    return;
                }
            }

            // Demon Armor
            if ((!Me.HaveBuff("Demon Armor") || Me.HaveBuff("Demon Skin")) &&
                DemonArmor.KnownSpell &&
                (!FelArmor.KnownSpell || (FelArmor.KnownSpell && !_settings.UseFelArmor)))
            {
                if (Cast(DemonArmor))
                {
                    return;
                }
            }

            // Soul Link
            if (SoulLink.KnownSpell &&
                !Me.HaveBuff("Soul Link"))
            {
                if (Cast(SoulLink))
                {
                    return;
                }
            }

            // Fel Armor
            if (!Me.HaveBuff("Fel Armor") &&
                FelArmor.KnownSpell &&
                _settings.UseFelArmor)
            {
                if (Cast(FelArmor))
                {
                    return;
                }
            }

            // Health Funnel
            if (ObjectManager.Pet.HealthPercent < 50 &&
                Me.HealthPercent > 40 &&
                ObjectManager.Pet.GetDistance < 19 &&
                !ObjectManager.Pet.InCombatFlagOnly &&
                HealthFunnel.KnownSpell)
            {
                Fight.StopFight();
                MovementManager.StopMove();
                if (PetAndConsumables.MyWarlockPet().Equals("Voidwalker") &&
                    ToolBox.GetPetSpellIndex("Consume Shadows") != 0)
                {
                    ToolBox.PetSpellCast("Consume Shadows");
                    Usefuls.WaitIsCasting();
                    MovementManager.StopMove();
                    Thread.Sleep(500);
                }


                ToolBox.StopWandWaitGCD(UseWand, ShadowBolt);
                MovementManager.StopMove();
                MovementManager.StopMoveNewThread();
                if (Cast(HealthFunnel))
                {
                    Thread.Sleep(500);
                    Usefuls.WaitIsCasting();
                    return;
                }
            }

            // Health Stone
            if (!PetAndConsumables.HaveHealthstone())
            {
                if (Cast(CreateHealthStone))
                {
                    return;
                }
            }

            // Create Soul Stone
            if (!PetAndConsumables.HaveSoulstone() &&
                CreateSoulstone.KnownSpell)
            {
                if (Cast(CreateSoulstone))
                {
                    return;
                }
            }

            // Use Soul Stone
            if (!Me.HaveBuff("Soulstone Resurrection") &&
                CreateSoulstone.KnownSpell &&
                ToolBox.HaveOneInList(PetAndConsumables.SoulStones()) &&
                ToolBox.GetItemCooldown(PetAndConsumables.SoulStones()) <= 0)
            {
                MovementManager.StopMove();
                Lua.RunMacroText("/target player");
                PetAndConsumables.UseSoulstone();
                Usefuls.WaitIsCasting();
                Lua.RunMacroText("/cleartarget");
            }

            // Cannibalize
            if (ObjectManager.GetObjectWoWUnit().Where(u => u.GetDistance <= 8 && u.IsDead && (u.CreatureTypeTarget == "Humanoid" || u.CreatureTypeTarget == "Undead")).Count() > 0)
            {
                if (Me.HealthPercent < 50 && !Me.HaveBuff("Drink") && !Me.HaveBuff("Food") && Me.IsAlive && Cannibalize.KnownSpell && Cannibalize.IsSpellUsable)
                {
                    if (Cast(Cannibalize))
                    {
                        return;
                    }
                }
            }
        }
    }
Ejemplo n.º 24
0
        protected override void HealerCombat()
        {
            base.HealerCombat();

            WoWUnit Target = ObjectManager.Target;
            List <AIOPartyMember> lisPartyOrdered = AIOParty.GroupAndRaid
                                                    .OrderBy(m => m.HealthPercent)
                                                    .ToList();

            // Party Tranquility
            if (settings.PartyTranquility && !AIOParty.GroupAndRaid.Any(e => e.IsTargetingMe))
            {
                bool needTranquility = AIOParty.GroupAndRaid
                                       .FindAll(m => m.HealthPercent < 50)
                                       .Count > 2;
                if (needTranquility &&
                    cast.OnTarget(Tranquility))
                {
                    Usefuls.WaitIsCasting();
                    return;
                }
            }

            // PARTY Rebirth
            if (settings.PartyUseRebirth)
            {
                WoWPlayer needRebirth = lisPartyOrdered
                                        .Find(m => m.IsDead);
                if (needRebirth != null && cast.OnFocusUnit(Rebirth, needRebirth))
                {
                    return;
                }
            }

            // PARTY Innervate
            if (settings.PartyUseInnervate)
            {
                WoWPlayer needInnervate = lisPartyOrdered
                                          .Find(m => m.ManaPercentage < 10 && !m.HaveBuff("Innervate"));
                if (needInnervate != null && cast.OnFocusUnit(Innervate, needInnervate))
                {
                    return;
                }
            }

            if (settings.PartyRemoveCurse)
            {
                // PARTY Remove Curse
                WoWPlayer needRemoveCurse = lisPartyOrdered
                                            .Find(m => ToolBox.HasCurseDebuff(m.Name));
                if (needRemoveCurse != null && cast.OnFocusUnit(RemoveCurse, needRemoveCurse))
                {
                    return;
                }
            }

            if (settings.PartyAbolishPoison)
            {
                // PARTY Abolish Poison
                WoWPlayer needAbolishPoison = lisPartyOrdered
                                              .Find(m => ToolBox.HasPoisonDebuff(m.Name));
                if (needAbolishPoison != null && cast.OnFocusUnit(AbolishPoison, needAbolishPoison))
                {
                    return;
                }
            }

            // PARTY Burst Heal
            WoWPlayer needBurstHeal = lisPartyOrdered
                                      .Find(m => m.HealthPercent < 30);

            if (needBurstHeal != null &&
                Me.ManaPercentage > 10 &&
                cast.OnTarget(NaturesSwiftness))
            {
                return;
            }
            if (needBurstHeal != null &&
                Me.HaveBuff("Nature's Swiftness"))
            {
                cast.OnFocusUnit(HealingTouch, needBurstHeal);
                return;
            }

            // Tree form
            if (!Me.HaveBuff("Tree of Life") &&
                Me.ManaPercentage > 20 &&
                cast.OnSelf(TreeOfLife))
            {
                return;
            }

            // Swiftmend
            WoWPlayer needBigHeal = lisPartyOrdered
                                    .Find(m => m.HealthPercent < 60 && (m.HaveBuff("Regrowth") || m.HaveBuff("Rejuvenation")));

            if (needBigHeal != null &&
                cast.OnFocusUnit(Swiftmend, needBigHeal))
            {
                return;
            }

            // Healing Touch
            if (!Me.HaveBuff("Tree of Life"))
            {
                if (needBigHeal != null &&
                    cast.OnFocusUnit(HealingTouch, needBigHeal))
                {
                    return;
                }
            }

            // Regrowth
            WoWPlayer needRegrowth = lisPartyOrdered
                                     .Find(m => m.HealthPercent < 70 && !m.HaveBuff("Regrowth"));

            if (needRegrowth != null &&
                cast.OnFocusUnit(Regrowth, needRegrowth))
            {
                return;
            }

            // Rejuvenation
            WoWPlayer needRejuvenation = lisPartyOrdered
                                         .Find(m => m.HealthPercent < 80 && !m.HaveBuff("Rejuvenation"));

            if (needRejuvenation != null &&
                cast.OnFocusUnit(Rejuvenation, needRejuvenation))
            {
                return;
            }

            // Lifebloom 1
            WoWPlayer needLifeBloom1 = lisPartyOrdered
                                       .Find(m => m.HealthPercent < 90 && ToolBox.CountBuff("Lifebloom", m.Name) < 1);

            if (needLifeBloom1 != null &&
                cast.OnFocusUnit(Lifebloom, needLifeBloom1))
            {
                return;
            }

            // Lifebloom 2
            WoWPlayer needLifeBloom2 = lisPartyOrdered
                                       .Find(m => m.HealthPercent < 85 && ToolBox.CountBuff("Lifebloom", m.Name) < 2);

            if (needLifeBloom2 != null &&
                cast.OnFocusUnit(Lifebloom, needLifeBloom2))
            {
                return;
            }

            // Lifebloom 3
            WoWPlayer needLifeBloom3 = lisPartyOrdered
                                       .Find(m => m.HealthPercent < 80 && ToolBox.CountBuff("Lifebloom", m.Name) < 3);

            if (needLifeBloom3 != null &&
                cast.OnFocusUnit(Lifebloom, needLifeBloom3))
            {
                return;
            }
        }
Ejemplo n.º 25
0
        protected override void CombatRotation()
        {
            base.CombatRotation();

            bool    _shouldBeInterrupted = ToolBox.TargetIsCasting();
            WoWUnit Target = ObjectManager.Target;

            // Force melee
            if (_combatMeleeTimer.IsReady)
            {
                RangeManager.SetRangeToMelee();
            }

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

            // Check if interruptable enemy is in list
            if (_shouldBeInterrupted)
            {
                _fightingACaster = true;
                RangeManager.SetRangeToMelee();
                if (!_casterEnemies.Contains(ObjectManager.Target.Name))
                {
                    _casterEnemies.Add(ObjectManager.Target.Name);
                }
            }

            // Kick interrupt
            if (_shouldBeInterrupted)
            {
                Thread.Sleep(Main.humanReflexTime);
                if (cast.OnTarget(Kick) || cast.OnTarget(Gouge) || cast.OnTarget(KidneyShot))
                {
                    return;
                }
            }

            // Adrenaline Rush
            if ((ObjectManager.GetNumberAttackPlayer() > 1 || Target.IsElite) && !Me.HaveBuff("Adrenaline Rush"))
            {
                if (cast.OnTarget(AdrenalineRush))
                {
                    return;
                }
            }

            // Blade Flurry
            if (ObjectManager.GetNumberAttackPlayer() > 1 && !Me.HaveBuff("Blade Flurry"))
            {
                if (cast.OnTarget(BladeFlurry))
                {
                    return;
                }
            }

            // Riposte
            if (Riposte.IsSpellUsable && (Target.CreatureTypeTarget.Equals("Humanoid") || settings.RiposteAll))
            {
                if (cast.OnTarget(Riposte))
                {
                    return;
                }
            }

            // Bandage
            if (Target.HaveBuff("Blind"))
            {
                MovementManager.StopMoveTo(true, 500);
                ItemsManager.UseItemByNameOrId(_myBestBandage);
                Logger.Log("Using " + _myBestBandage);
                Usefuls.WaitIsCasting();
                return;
            }

            // Blind
            if (Me.HealthPercent < 40 && !ToolBox.HasDebuff("Recently Bandaged") && _myBestBandage != null &&
                settings.UseBlindBandage)
            {
                if (cast.OnTarget(Blind))
                {
                    return;
                }
            }

            // Evasion
            if (ObjectManager.GetNumberAttackPlayer() > 1 || Me.HealthPercent < 30 && !Me.HaveBuff("Evasion") && Target.HealthPercent > 50)
            {
                if (cast.OnTarget(Evasion))
                {
                    return;
                }
            }

            // Cloak of Shadows
            if (Me.HealthPercent < 30 && !Me.HaveBuff("Cloak of Shadows") && Target.HealthPercent > 50)
            {
                if (cast.OnTarget(CloakOfShadows))
                {
                    return;
                }
            }

            // Backstab in combat
            if (IsTargetStunned() && ToolBox.GetMHWeaponType().Equals("Daggers"))
            {
                if (cast.OnTarget(Backstab))
                {
                    return;
                }
            }

            // Slice and Dice
            if (!Me.HaveBuff("Slice and Dice") && Me.ComboPoint > 1 && Target.HealthPercent > 40)
            {
                if (cast.OnTarget(SliceAndDice))
                {
                    return;
                }
            }

            // Eviscerate logic
            if (Me.ComboPoint > 0 && Target.HealthPercent < 30 ||
                Me.ComboPoint > 1 && Target.HealthPercent < 45 ||
                Me.ComboPoint > 2 && Target.HealthPercent < 60 ||
                Me.ComboPoint > 3 && Target.HealthPercent < 70)
            {
                if (cast.OnTarget(Eviscerate))
                {
                    return;
                }
            }

            // GhostlyStrike
            if (Me.ComboPoint < 5 && !IsTargetStunned() &&
                (!_fightingACaster || !Kick.KnownSpell ||
                 Me.Energy > GhostlyStrike.Cost + Kick.Cost))
            {
                if (cast.OnTarget(GhostlyStrike))
                {
                    return;
                }
            }

            // Hemohrrage
            if (Me.ComboPoint < 5 && !IsTargetStunned() &&
                (!_fightingACaster || !Kick.KnownSpell ||
                 Me.Energy > Hemorrhage.Cost + Kick.Cost))
            {
                if (cast.OnTarget(Hemorrhage))
                {
                    return;
                }
            }

            // Sinister Strike
            if (Me.ComboPoint < 5 && !IsTargetStunned() &&
                (!_fightingACaster || !Kick.KnownSpell ||
                 Me.Energy > SinisterStrike.Cost + Kick.Cost))
            {
                if (cast.OnTarget(SinisterStrike))
                {
                    return;
                }
            }
        }
        protected override void BuffRotation()
        {
            if (!Me.HaveBuff("Drink") || Me.ManaPercentage > 95)
            {
                base.BuffRotation();

                // Unending Breath
                if (!Me.HaveBuff("Unending Breath") &&
                    settings.UseUnendingBreath &&
                    cast.OnSelf(UnendingBreath))
                {
                    return;
                }

                // Demon Skin
                if (!Me.HaveBuff("Demon Skin") &&
                    !DemonArmor.KnownSpell &&
                    !FelArmor.KnownSpell &&
                    cast.OnSelf(DemonSkin))
                {
                    return;
                }

                // Demon Armor
                if ((!Me.HaveBuff("Demon Armor")) &&
                    !FelArmor.KnownSpell &&
                    cast.OnSelf(DemonArmor))
                {
                    return;
                }

                // Fel Armor
                if (!Me.HaveBuff("Fel Armor") &&
                    cast.OnSelf(FelArmor))
                {
                    return;
                }

                // Health Funnel OOC
                if (ObjectManager.Pet.HealthPercent < 50 &&
                    Me.HealthPercent > 40 &&
                    ObjectManager.Pet.GetDistance < 19 &&
                    !ObjectManager.Pet.InCombatFlagOnly &&
                    settings.HealthFunnelOOC)
                {
                    Lua.LuaDoString("PetWait();");
                    MovementManager.StopMove();
                    Fight.StopFight();

                    if (WarlockPetAndConsumables.MyWarlockPet().Equals("Voidwalker"))
                    {
                        cast.PetSpell("Consume Shadows", false, true);
                    }

                    if (cast.OnSelf(HealthFunnel))
                    {
                        Thread.Sleep(500);
                        Usefuls.WaitIsCasting();
                        Lua.LuaDoString("PetFollow();");
                        return;
                    }
                    Lua.LuaDoString("PetFollow();");
                }

                // Health Stone
                if (!WarlockPetAndConsumables.HaveHealthstone() &&
                    cast.OnSelf(CreateHealthStone))
                {
                    return;
                }

                // Create Soul Stone
                if (!WarlockPetAndConsumables.HaveSoulstone() &&
                    cast.OnSelf(CreateSoulstone))
                {
                    return;
                }

                // PARTY Soul Stone
                if (CreateSoulstone.KnownSpell &&
                    ToolBox.HaveOneInList(WarlockPetAndConsumables.SoulStones()) &&
                    ToolBox.GetItemCooldown(WarlockPetAndConsumables.SoulStones()) <= 0)
                {
                    WoWPlayer noSoulstone = AIOParty.GroupAndRaid
                                            .Find(m => !m.HaveBuff("Soulstone Resurrection") &&
                                                  m.GetDistance < 20 &&
                                                  m.Name != "Unknown" &&
                                                  !TraceLine.TraceLineGo(Me.Position, m.Position) &&
                                                  (m.WowClass == WoWClass.Paladin || m.WowClass == WoWClass.Priest || m.WowClass == WoWClass.Shaman || m.WowClass == WoWClass.Druid));
                    if (noSoulstone != null)
                    {
                        Logger.Log($"Using Soulstone on {noSoulstone.Name}");
                        MovementManager.StopMoveNewThread();
                        MovementManager.StopMoveToNewThread();
                        Lua.RunMacroText($"/target {noSoulstone.Name}");
                        if (ObjectManager.Target.Name == noSoulstone.Name)
                        {
                            ToolBox.UseFirstMatchingItem(WarlockPetAndConsumables.SoulStones());
                            Usefuls.WaitIsCasting();
                            Lua.RunMacroText("/cleartarget");
                            ToolBox.ClearCursor();
                        }
                    }
                }

                // PARTY Drink
                if (AIOParty.PartyDrink(settings.PartyDrinkName, settings.PartyDrinkThreshold))
                {
                    return;
                }

                // Life Tap
                if (Me.HealthPercent > Me.ManaPercentage &&
                    settings.UseLifeTap &&
                    cast.OnSelf(LifeTap))
                {
                    return;
                }
            }
        }
        protected override void CombatRotation()
        {
            base.CombatRotation();

            bool _shouldBeInterrupted = ToolBox.TargetIsCasting();

            WoWUnit Target = ObjectManager.Target;

            // Force melee
            if (_combatMeleeTimer.IsReady)
            {
                RangeManager.SetRangeToMelee();
            }

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

            // Check if interruptable enemy is in list
            if (_shouldBeInterrupted)
            {
                _fightingACaster = true;
                RangeManager.SetRangeToMelee();
                if (!_casterEnemies.Contains(ObjectManager.Target.Name))
                {
                    _casterEnemies.Add(ObjectManager.Target.Name);
                }
            }

            // Kick interrupt
            if (_shouldBeInterrupted &&
                cast.OnTarget(Kick))
            {
                return;
            }

            // Adrenaline Rush
            if (!Me.HaveBuff("Adrenaline Rush") &&
                cast.OnSelf(AdrenalineRush))
            {
                return;
            }

            // Blade Flurry
            if (!Me.HaveBuff("Blade Flurry") &&
                cast.OnSelf(BladeFlurry))
            {
                return;
            }

            // Riposte
            if (Riposte.IsSpellUsable &&
                (Target.CreatureTypeTarget.Equals("Humanoid") || settings.RiposteAll) &&
                cast.OnTarget(Riposte))
            {
                return;
            }

            // Bandage
            if (!ObjectManager.Target.IsTargetingMe &&
                Me.HealthPercent < 40)
            {
                MovementManager.StopMoveTo(true, 500);
                ItemsManager.UseItemByNameOrId(_myBestBandage);
                Logger.Log("Using " + _myBestBandage);
                Usefuls.WaitIsCasting();
                return;
            }

            // Blind
            if (Me.HealthPercent < 40 &&
                Target.IsTargetingMe &&
                !ToolBox.HasDebuff("Recently Bandaged") &&
                _myBestBandage != null &&
                settings.UseBlindBandage &&
                cast.OnTarget(Blind))
            {
                return;
            }

            // Evasion
            if (Me.HealthPercent < 30 &&
                !Me.HaveBuff("Evasion") &&
                cast.OnSelf(Evasion))
            {
                return;
            }

            // Cloak of Shadows
            if (Me.HealthPercent < 30 &&
                !Me.HaveBuff("Cloak of Shadows") &&
                Target.HealthPercent > 50 &&
                cast.OnSelf(CloakOfShadows))
            {
                return;
            }

            // DPS ROTATION

            // Slice and Dice
            if ((!Me.HaveBuff("Slice and Dice") || ToolBox.BuffTimeLeft("Slice and Dice") < 4) &&
                Me.ComboPoint > 0 &&
                cast.OnTarget(SliceAndDice))
            {
                return;
            }

            // Shiv
            if (Target.HaveBuff("Deadly Poison") &&
                ToolBox.DeBuffTimeLeft("Deadly Poison", "target") < 3 &&
                cast.OnTarget(Shiv))
            {
                return;
            }

            // Rupture
            if (!Target.HaveBuff("Rupture") &&
                Me.ComboPoint > 1 &&
                cast.OnTarget(Rupture))
            {
                return;
            }

            // Eviscerate
            if (ToolBox.DeBuffTimeLeft("Rupture", "target") > 5 &&
                Me.ComboPoint > 3 &&
                cast.OnTarget(Eviscerate))
            {
                return;
            }

            // GhostlyStrike
            if (Me.ComboPoint < 5 &&
                cast.OnTarget(GhostlyStrike))
            {
                return;
            }

            // Hemohrrage
            if (Me.ComboPoint < 5 &&
                cast.OnTarget(Hemorrhage))
            {
                return;
            }

            // Backstab
            if (Me.ComboPoint < 5 &&
                Me.Energy >= 60 &&
                BehindTargetCheck &&
                cast.OnTarget(Backstab))
            {
                return;
            }

            // Sinister Strike
            if (Me.ComboPoint < 5 &&
                Me.Energy >= 60 &&
                cast.OnTarget(SinisterStrike))
            {
                return;
            }
        }
    internal static void Pull()
    {
        // Melee ?
        if (_pullMeleeTimer.ElapsedMilliseconds <= 0 &&
            ObjectManager.Target.GetDistance <= _pullRange + 3)
        {
            _pullMeleeTimer.Start();
        }

        if (_pullMeleeTimer.ElapsedMilliseconds > 8000 &&
            !_goInMelee)
        {
            _goInMelee = true;
            _pullMeleeTimer.Reset();
        }

        // Check if caster
        if (_casterEnemies.Contains(ObjectManager.Target.Name))
        {
            _fightingACaster = true;
        }

        // Water Shield
        if (!Me.HaveBuff("Water Shield") &&
            !Me.HaveBuff("Lightning Shield") &&
            (_settings.UseWaterShield || !_settings.UseLightningShield) || Me.ManaPercentage < _lowManaThreshold)
        {
            if (Cast(WaterShield))
            {
                return;
            }
        }

        // Ligntning Shield
        if (Me.ManaPercentage > _lowManaThreshold &&
            !Me.HaveBuff("Lightning Shield") &&
            !Me.HaveBuff("Water Shield") &&
            _settings.UseLightningShield &&
            (!WaterShield.KnownSpell || !_settings.UseWaterShield))
        {
            if (Cast(LightningShield))
            {
                return;
            }
        }

        // Pull with Lightning Bolt
        if (ObjectManager.Target.GetDistance <= _pullRange &&
            !_goInMelee)
        {
            // pull with rank one
            if (_settings.PullRankOneLightningBolt &&
                LightningBolt.IsSpellUsable)
            {
                MovementManager.StopMove();
                Lua.RunMacroText("/cast Lightning Bolt(Rank 1)");
            }

            // pull with max rank
            if (_settings.PullWithLightningBolt &&
                !_settings.PullRankOneLightningBolt &&
                LightningBolt.IsSpellUsable)
            {
                MovementManager.StopMove();
                Lua.RunMacroText("/cast Lightning Bolt");
            }

            _pullAttempt++;
            Thread.Sleep(300);

            // Check if we're NOT casting
            if (!Me.IsCast)
            {
                Main.Log($"Pull attempt failed ({_pullAttempt})");
                if (_pullAttempt > 3)
                {
                    Main.Log("Cast unsuccesful, going in melee");
                    _goInMelee = true;
                }
                return;
            }

            // If we're casting
            Usefuls.WaitIsCasting();

            int limit = 1500;
            while (!Me.InCombatFlagOnly && limit > 0)
            {
                Thread.Sleep(100);
                limit -= 100;
            }
        }
    }
    private static bool Cast(Spell s, bool castEvenIfWanding = true)
    {
        if (!s.KnownSpell)
        {
            return(false);
        }

        CombatDebug("*----------- INTO CAST FOR " + s.Name);
        float _spellCD = ToolBox.GetSpellCooldown(s.Name);

        CombatDebug("Cooldown is " + _spellCD);

        if (ToolBox.GetSpellCost(s.Name) > Me.Mana)
        {
            CombatDebug(s.Name + ": Not enough mana, SKIPPING");
            return(false);
        }

        if (_usingWand && !castEvenIfWanding)
        {
            CombatDebug("Didn't cast because we were backing up or wanding");
            return(false);
        }

        if (_spellCD >= 2f)
        {
            CombatDebug("Didn't cast because cd is too long");
            return(false);
        }

        if (_usingWand && castEvenIfWanding)
        {
            ToolBox.StopWandWaitGCD(UseWand, ShadowBolt);
        }

        if (_spellCD < 2f && _spellCD > 0f)
        {
            if (ToolBox.GetSpellCastTime(s.Name) < 1f)
            {
                CombatDebug(s.Name + " is instant and low CD, recycle");
                return(true);
            }

            int t = 0;
            while (ToolBox.GetSpellCooldown(s.Name) > 0)
            {
                Thread.Sleep(50);
                t += 50;
                if (t > 2000)
                {
                    CombatDebug(s.Name + ": waited for tool long, give up");
                    return(false);
                }
            }
            Thread.Sleep(100 + Usefuls.Latency);
            CombatDebug(s.Name + ": waited " + (t + 100) + " for it to be ready");
        }

        if (!s.IsSpellUsable)
        {
            CombatDebug("Didn't cast because spell somehow not usable");
            return(false);
        }

        CombatDebug("Launching");
        if (ObjectManager.Target.IsAlive || (!Fight.InFight && ObjectManager.Target.Guid < 1))
        {
            s.Launch();
            Usefuls.WaitIsCasting();
        }
        return(true);
    }
        protected override void CombatRotation()
        {
            base.CombatRotation();

            bool    _shouldBeInterrupted = ToolBox.TargetIsCasting();
            bool    _inMeleeRange        = ObjectManager.Target.GetDistance < 6f;
            WoWUnit Target = ObjectManager.Target;

            // Force melee
            if (_combatMeleeTimer.IsReady)
            {
                RangeManager.SetRangeToMelee();
            }

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

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

            // Party Tranquility
            if (settings.PartyTranquility && !AIOParty.GroupAndRaid.Any(e => e.IsTargetingMe))
            {
                bool needTranquility = AIOParty.GroupAndRaid
                                       .FindAll(m => m.HealthPercent < 50)
                                       .Count > 2;
                if (needTranquility &&
                    cast.OnTarget(Tranquility))
                {
                    Usefuls.WaitIsCasting();
                    return;
                }
            }

            // PARTY Rebirth
            if (settings.PartyUseRebirth)
            {
                WoWPlayer needRebirth = AIOParty.GroupAndRaid
                                        .Find(m => m.IsDead);
                if (needRebirth != null && cast.OnFocusUnit(Rebirth, needRebirth))
                {
                    return;
                }
            }

            // PARTY Innervate
            if (settings.PartyUseInnervate)
            {
                WoWPlayer needInnervate = AIOParty.GroupAndRaid
                                          .Find(m => m.ManaPercentage < 10 && !m.HaveBuff("Innervate"));
                if (needInnervate != null && cast.OnFocusUnit(Innervate, needInnervate))
                {
                    return;
                }
            }

            if (settings.PartyRemoveCurse)
            {
                // PARTY Remove Curse
                WoWPlayer needRemoveCurse = AIOParty.GroupAndRaid
                                            .Find(m => ToolBox.HasCurseDebuff(m.Name));
                if (needRemoveCurse != null && cast.OnFocusUnit(RemoveCurse, needRemoveCurse))
                {
                    return;
                }
            }

            if (settings.PartyAbolishPoison)
            {
                // PARTY Abolish Poison
                WoWPlayer needAbolishPoison = AIOParty.GroupAndRaid
                                              .Find(m => ToolBox.HasPoisonDebuff(m.Name));
                if (needAbolishPoison != null && cast.OnFocusUnit(AbolishPoison, needAbolishPoison))
                {
                    return;
                }
            }

            // Catorm
            if (!Me.HaveBuff(CatForm.Name) &&
                cast.OnSelf(CatForm))
            {
                return;
            }

            // Bear Form
            if (!Me.HaveBuff(BearForm.Name) &&
                !Me.HaveBuff(DireBearForm.Name) &&
                !CatForm.KnownSpell)
            {
                if (cast.OnSelf(DireBearForm) || cast.OnSelf(BearForm))
                {
                    return;
                }
            }


            #region Cat Form Rotation

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

            if (Me.HaveBuff(CatForm.Name))
            {
                RangeManager.SetRangeToMelee();

                // Shred (when behind)
                if (Me.HaveBuff("Clearcasting") &&
                    Me.Energy < 80 &&
                    cast.OnTarget(Shred))
                {
                    return;
                }

                // Faerie Fire
                if (!Target.HaveBuff("Faerie Fire (Feral)") &&
                    cast.OnTarget(FaerieFireFeral))
                {
                    return;
                }

                // Mangle
                if (Me.ComboPoint < 5 &&
                    Me.Energy > 40 &&
                    MangleCat.KnownSpell &&
                    cast.OnTarget(MangleCat))
                {
                    return;
                }

                // Rip
                if (Me.ComboPoint >= 5 &&
                    Me.Energy >= 80 &&
                    cast.OnTarget(Rip))
                {
                    return;
                }

                // Rip
                if (Me.ComboPoint >= 4 &&
                    Me.Energy >= 80 &&
                    !Target.HaveBuff("Mangle (Cat)") &&
                    cast.OnTarget(Rip))
                {
                    return;
                }

                // Ferocious bite (Rip is banned)
                if (Me.ComboPoint >= 5 &&
                    Me.Energy >= 90 &&
                    cast.OnTarget(FerociousBite))
                {
                    return;
                }

                // Claw
                if (Me.ComboPoint < 5 &&
                    !MangleCat.KnownSpell &&
                    cast.OnTarget(Claw))
                {
                    return;
                }
            }

            #endregion

            #region Bear form rotation

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

            if (Me.HaveBuff(BearForm.Name) || Me.HaveBuff(DireBearForm.Name))
            {
                RangeManager.SetRangeToMelee();

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

                // Faerie Fire
                if (!Target.HaveBuff("Faerie Fire (Feral)") &&
                    cast.OnTarget(FaerieFireFeral))
                {
                    return;
                }

                // Swipe
                if (ObjectManager.GetNumberAttackPlayer() > 1 &&
                    ToolBox.GetNbEnemiesClose(8f) > 1 &&
                    cast.OnTarget(Swipe))
                {
                    return;
                }

                // Interrupt with Bash
                if (_shouldBeInterrupted)
                {
                    Thread.Sleep(Main.humanReflexTime);
                    if (cast.OnTarget(Bash))
                    {
                        return;
                    }
                }

                // Enrage
                if (settings.UseEnrage &&
                    cast.OnSelf(Enrage))
                {
                    return;
                }

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

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

            #endregion

            #region Human form rotation

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

            // Avoid accidental Human Form stay
            if (CatForm.KnownSpell && CatForm.Cost < Me.Mana)
            {
                return;
            }
            if (BearForm.KnownSpell && BearForm.Cost < Me.Mana)
            {
                return;
            }

            if (!Me.HaveBuff(BearForm.Name) &&
                !Me.HaveBuff(CatForm.Name) &&
                !Me.HaveBuff(DireBearForm.Name))
            {
                // Moonfire
                if (!Target.HaveBuff(Moonfire.Name) &&
                    Me.ManaPercentage > 15 &&
                    Target.HealthPercent > 15 &&
                    Me.Level >= 8 &&
                    cast.OnTarget(Moonfire))
                {
                    return;
                }

                // Wrath
                if (Me.ManaPercentage > 45 &&
                    Target.HealthPercent > 30 &&
                    Me.Level >= 8 &&
                    cast.OnTarget(Wrath))
                {
                    return;
                }

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

                // Wrath Low level DPS
                if (Me.ManaPercentage > 60 &&
                    Target.HealthPercent > 30 &&
                    Me.Level < 8 &&
                    cast.OnTarget(Wrath))
                {
                    return;
                }
            }
            #endregion
        }