Пример #1
0
        public static bool Execute(
            Hero target,
            Hero[] enemyHeroes,
            float ping,
            bool onlyDamage,
            bool onlyDisable,
            Hero me,
            float mana,
            bool customOrder)
        {
            var toggler = MainMenu.ComboKeysMenu.Item("comboAbilitiesToggler").GetValue <AbilityToggler>();

            if (Utils.SleepCheck("UpdateCombo"))
            {
                if (customOrder)
                {
                    MyAbilities.Combo =
                        MyAbilities.OffensiveAbilities.Where(
                            x =>
                            x.Value.IsValid && x.Value.Owner.Equals(me) && toggler.IsEnabled(NameManager.Name(x.Value)))
                        .OrderByDescending(
                            x =>
                            MainMenu.ComboKeysMenu.Item("Ability#.ComboOrder")
                            .GetValue <PriorityChanger>()
                            .GetPriority(x.Value.StoredName()));
                }
                else
                {
                    MyAbilities.Combo =
                        MyAbilities.OffensiveAbilities.Where(
                            x =>
                            x.Value.IsValid && x.Value.Owner.Equals(me) && toggler.IsEnabled(NameManager.Name(x.Value)))
                        .OrderBy(x => ComboOrder.GetComboOrder(x.Value, onlyDisable));
                }

                Utils.Sleep(500, "UpdateCombo");
            }

            if (Utils.SleepCheck("casting") && MyAbilities.Combo != null)
            {
                if (target != null)
                {
                    if (Dictionaries.HitDamageDictionary.ContainsKey(target.Handle) &&
                        Dictionaries.HitDamageDictionary[target.Handle] * 1.5 >= target.Health &&
                        target.Distance2D(MyHeroInfo.Position) <= me.GetAttackRange() + 150)
                    {
                        return(false);
                    }

                    if (!Utils.SleepCheck(target.Handle + "KeyCombo"))
                    {
                        return(false);
                    }

                    if (AbilityMain.Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin)
                    {
                        var r        = MyAbilities.Combo.FirstOrDefault(x => x.Key == "templar_assassin_psionic_trapslow");
                        var modifier = target.FindModifier("modifier_templar_assassin_trap_slow");
                        if (modifier == null || modifier.RemainingTime < r.Value.GetHitDelay(target))
                        {
                            Slow.TemplarAssasinUseTrap(target);
                        }
                    }

                    if (me.ClassID == ClassID.CDOTA_Unit_Hero_Tinker && toggler.IsEnabled("tinker_rearm") &&
                        MyAbilities.TinkerRearm.CanBeCasted() && Utils.SleepCheck("Ability.TinkerRearm") &&
                        !MyAbilities.Combo.Any(
                            x =>
                            x.Value.CanBeCasted() ||
                            (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value))))
                    {
                        MyAbilities.TinkerRearm.UseAbility();
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000 + 500,
                            "Ability.TinkerRearm");
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
                            "GlobalCasting");
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
                            "casting");
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
                            "cancelorder");
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
                            "Orbwalk.Attack");
                        Utils.Sleep(
                            MyAbilities.TinkerRearm.FindCastPoint() * 1000 + Game.Ping
                            + MyAbilities.TinkerRearm.GetChannelTime(MyAbilities.TinkerRearm.Level - 1) * 1000,
                            "Ability#.Sleep");
                        return(true);
                    }

                    foreach (var data in
                             MyAbilities.Combo.Where(
                                 x =>
                                 x.Value.IsValid && !x.Value.IsToggled &&
                                 (x.Value.CanBeCasted() || x.Value.CanInvoke() ||
                                  (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value))) &&
                                 (!x.Value.IsAbilityBehavior(AbilityBehavior.Hidden) ||
                                  (AbilityMain.Me.ClassID == ClassID.CDOTA_Unit_Hero_Invoker &&
                                   (x.Value.CanBeCasted() || x.Value.CanInvoke()))) &&
                                 ((x.Value is Item && me.CanUseItems()) || (!(x.Value is Item) && me.CanCast())) &&
                                 (Utils.SleepCheck(x.Value.Handle.ToString()) ||
                                  (!x.Value.IsInAbilityPhase && x.Value.FindCastPoint() > 0))))
                    {
                        var ability  = data.Value;
                        var name     = NameManager.Name(ability);
                        var category = (name == "lion_impale") ? "disable" : data.Key.Substring(name.Length);

                        // if (category == "special" || category == "buff")
                        // {
                        // continue;
                        // }
                        // if (onlyDamage && (category == "disable" || category == "slow" || category == "silence"))
                        // {
                        // continue;
                        // }
                        // if (onlyDisable && (category == "nuke" || category == "harras"))
                        // {
                        // continue;
                        // }
                        var handleString = ability.Handle.ToString();
                        if (category == "blink")
                        {
                            var range         = MainMenu.BlinkMenu.Item("Ability#.BlinkRange").GetValue <Slider>().Value;
                            var blinkPosition = target.PredictedPosition(0.3 + me.GetTurnTime(target));
                            if (MyHeroInfo.Position.Distance2D(blinkPosition) > 1500 + range ||
                                MyHeroInfo.Position.Distance2D(blinkPosition) < 500 + range)
                            {
                                continue;
                            }

                            var minEnemiesAround =
                                MainMenu.BlinkMenu.Item("Ability#.BlinkMaxEnemiesAround").GetValue <Slider>().Value;
                            if (
                                Heroes.GetByTeam(target.Team)
                                .Count(
                                    x =>
                                    x.IsValid && !x.Equals(target) && x.IsAlive && !x.IsIllusion &&
                                    x.Distance2D(target) < 500 + range) > minEnemiesAround)
                            {
                                continue;
                            }

                            if (MyHeroInfo.Position.Distance2D(blinkPosition) > 1200)
                            {
                                blinkPosition = (blinkPosition - MyHeroInfo.Position) * 1200
                                                / blinkPosition.Distance2D(MyHeroInfo.Position) + MyHeroInfo.Position;
                            }

                            if (blinkPosition.Distance2D(target) < range)
                            {
                                blinkPosition.Extend(MyHeroInfo.Position, range);
                            }

                            ability.UseAbility(blinkPosition);
                            MyHeroInfo.Position = blinkPosition;
                            Utils.Sleep(Game.Ping + me.GetTurnTime(MyHeroInfo.Position) + 200, "mePosition");
                            Utils.Sleep(500, handleString);
                            Utils.Sleep(500, "GlobalCasting");
                            return(true);
                        }

                        if (category != "buff" && target.IsMagicImmune() && ability.ImmunityType != (ImmunityType)3)
                        {
                            continue;
                        }

                        if (!CastingChecks.All(name, target, ability))
                        {
                            continue;
                        }

                        if (Variables.EtherealHitTime >= (Utils.TickCount + ability.GetHitDelay(target, name) * 1000))
                        {
                            continue;
                        }

                        if (Variables.EtherealHitTime >= Utils.TickCount && name == "pudge_dismember")
                        {
                            continue;
                        }

                        if (name == "omniknight_purification")
                        {
                            if (Nukes.NukesMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value
                                < mana && MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().IsEnabled(name) &&
                                Nukes.NukesMenuDictionary[name].Item(name + "herotoggler")
                                .GetValue <HeroToggler>()
                                .IsEnabled(NameManager.Name(target)) &&
                                (Variables.EtherealHitTime
                                 < (Utils.TickCount + ability.GetHitDelay(target, name) * 1000)) &&
                                target.Health
                                > Nukes.NukesMenuDictionary[name].Item(NameManager.Name(ability) + "minhealthslider")
                                .GetValue <Slider>()
                                .Value)
                            {
                                var target1 =
                                    AllyHeroes.UsableHeroes.Where(x => !x.IsMagicImmune())
                                    .MinOrDefault(x => x.Distance2D(target));
                                if (target1 != null && ability.CanHit(target1, MyHeroInfo.Position, name) &&
                                    target1.PredictedPosition().Distance2D(target.PredictedPosition())
                                    < ability.GetRadius(name) &&
                                    target1.PredictedPosition()
                                    .Distance2D(
                                        target.PredictedPosition(
                                            ability.FindCastPoint(NameManager.Name(ability))))
                                    < ability.GetRadius(name))
                                {
                                    if (Nuke.Cast(ability, target1, name))
                                    {
                                        Utils.Sleep(
                                            Math.Max(ability.GetCastDelay(me, target1, abilityName: name), 0.2) * 1000,
                                            "GlobalCasting");
                                        Utils.Sleep(ability.GetHitDelay(target1, name) * 1000, "calculate");
                                        Utils.Sleep(
                                            Math.Max(
                                                ability.GetCastDelay(
                                                    me,
                                                    target1,
                                                    useCastPoint: false,
                                                    abilityName: name),
                                                0.15) * 1000 + Game.Ping,

                                            // + (Math.Max(me.Distance2D(target) - ability.GetCastRange(name) - 50, 0)
                                            // / me.MovementSpeed) * 1000,
                                            "casting");
                                        Utils.Sleep(
                                            Math.Max(ability.GetCastDelay(me, target1, abilityName: name), 0.2) * 1000,
                                            "cancelorder");
                                        return(true);
                                    }
                                }
                                else if (target1 != null && target1.Equals(me))
                                {
                                    AbilityMain.MoveMode(target);
                                    return(true);
                                }
                            }

                            return(false);
                        }

                        if (!ability.CanHit(target, MyHeroInfo.Position, name) && category != "buff" &&
                            (!target.HasModifier("modifier_pudge_meat_hook") ||
                             me.ClassID != ClassID.CDOTA_Unit_Hero_Pudge || target.Distance2D(me) > 600))
                        {
                            Variables.DealtDamage = 0;
                            if (name == "templar_assassin_meld")
                            {
                                if (!Nuke.Cast(ability, target, name) && Utils.SleepCheck("Ability.Move"))
                                {
                                    AbilityMain.MoveMode(target);
                                    Utils.Sleep(100, "Ability.Move");
                                }

                                Utils.Sleep(200, "GlobalCasting");
                                return(true);
                            }

                            if (name == "pudge_rot")
                            {
                                continue;
                            }

                            if (ability.IsAbilityBehavior(AbilityBehavior.NoTarget, NameManager.Name(ability)) &&
                                target.PredictedPosition().Distance2D(MyHeroInfo.Position)
                                < ability.GetRadius() + 150 && me.ClassID != ClassID.CDOTA_Unit_Hero_Pudge)
                            {
                                if (Utils.SleepCheck("Ability.Move"))
                                {
                                    AbilityMain.MoveMode(target);
                                    Utils.Sleep(100, "Ability.Move");
                                }

                                Utils.Sleep(200, "GlobalCasting");
                                return(true);
                            }

                            if (me.ClassID == ClassID.CDOTA_Unit_Hero_Pudge)
                            {
                                return(false);
                            }

                            var distance = target.Distance2D(MyHeroInfo.Position);

                            if (distance > ability.GetCastRange(name) + 250 &&
                                ((name != "item_cyclone" && category != "disable") ||
                                 distance > ability.GetCastRange(name) + 1200))
                            {
                                continue;
                            }

                            if (Game.MousePosition.Distance2D(me)
                                < MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue <Slider>().Value)
                            {
                                return(false);
                            }

                            if (!Utils.SleepCheck("Ability.Move"))
                            {
                                return(true);
                            }

                            AbilityMain.MoveMode(target);
                            Utils.Sleep(100, "Ability.Move");
                            return(true);
                        }

                        if (name == "item_cyclone" && coldFeetLastUse - Utils.TickCount < 2500 &&
                            coldFeetLastUse - Utils.TickCount > -1000)
                        {
                            continue;
                        }

                        if (((Dictionaries.InDamageDictionary.ContainsKey(target.Handle) &&
                              Dictionaries.InDamageDictionary[target.Handle] >= target.Health) ||
                             (Dictionaries.OutDamageDictionary.ContainsKey(target.Handle) &&
                              Dictionaries.InDamageDictionary.ContainsKey(target.Handle) &&
                              (Dictionaries.InDamageDictionary[target.Handle]
                               + Dictionaries.OutDamageDictionary[target.Handle]) >= target.Health)) &&
                            MainMenu.Menu.Item("Ability#.EnableAutoKillSteal").GetValue <bool>())
                        {
                            return(false);
                        }

                        if (category == "nuke" &&
                            (Nukes.NukesMenuDictionary[name].Item(name + "minManaCheckCombo")
                             .GetValue <Slider>()
                             .Value > mana || !Utils.SleepCheck(target.Handle + "KillSteal") ||
                             (name == "axe_culling_blade" && !CastingChecks.Killsteal(ability, target, name)) ||
                             (target.Health
                              < Nukes.NukesMenuDictionary[name].Item(name + "minhealthslider")
                              .GetValue <Slider>()
                              .Value) ||
                             (name == "zuus_thundergods_wrath" &&
                              (1
                               + enemyHeroes.Count(
                                   x =>
                                   !x.Equals(target) &&
                                   x.Health <= AbilityDamage.CalculateDamage(ability, me, x)))
                              < Nukes.NukesMenuDictionary[name].Item(name + "minenemykill")
                              .GetValue <Slider>()
                              .Value)))
                        {
                            continue;
                        }

                        if (name == "item_urn_of_shadows" && target.HasModifier("modifier_item_urn_damage"))
                        {
                            continue;
                        }

                        if (category == "nuke")
                        {
                            var casted = Nuke.Cast(ability, target, name);
                            if (!casted)
                            {
                                continue;
                            }

                            if (AbilityDamage.CalculateDamage(ability, me, target) >= target.Health)
                            {
                                Utils.Sleep(ability.GetHitDelay(target, name) * 1000 + 500, target.Handle + "KillSteal");
                            }
                        }

                        if (category == "disable" &&
                            Disables.DisablesMenuDictionary[name].Item(name + "minManaCheckCombo")
                            .GetValue <Slider>()
                            .Value < mana && !Disable.Cast(ability, target, name))
                        {
                            continue;
                        }

                        if (category == "slow" &&
                            Slows.SlowsMenuDictionary[name].Item(name + "minManaCheckCombo").GetValue <Slider>().Value
                            < mana && !Slow.Cast(ability, target, name))
                        {
                            continue;
                        }

                        if (category == "harras" &&
                            Harrases.HarrasesMenuDictionary[name].Item(name + "minManaCheckCombo")
                            .GetValue <Slider>()
                            .Value < mana && !Harras.Cast(ability, target, name))
                        {
                            continue;
                        }

                        if (category == "silence" &&
                            Silences.SilencesMenuDictionary[name].Item(name + "minManaCheckCombo")
                            .GetValue <Slider>()
                            .Value < mana &&
                            (((name == "item_orchid" || name == "item_bloodthorn" ||
                               name == "skywrath_mage_ancient_seal") &&
                              MainMenu.ComboKeysMenu.Item("Ability#.MaximizeDamage").GetValue <bool>() &&
                              !Nuke.Cast(ability, target, name)) || !Silence.Cast(ability, target, name)))
                        {
                            continue;
                        }

                        if (category == "special" &&
                            Specials.SpecialsMenuDictionary[name].Item(name + "minManaCheckCombo")
                            .GetValue <Slider>()
                            .Value < mana && !Special.Cast(ability, target, name))
                        {
                            continue;
                        }

                        if (category == "buff" &&
                            Buffs.BuffsMenuDictionary[name].Item(name + "minManaCheckCombo").GetValue <Slider>().Value
                            < mana &&
                            (name == "item_armlet" || name == "item_satanic" || !Buff.Cast(ability, target, me, name)))
                        {
                            continue;
                        }

                        if (Utils.SleepCheck(ability.Handle.ToString()))
                        {
                            Variables.DealtDamage += AbilityDamage.CalculateDamage(ability, me, target);
                        }

                        var delay = Math.Max(
                            ability.GetCastDelay(me, target, abilityName: name, useCastPoint: false),
                            0.2) * 1000;
                        switch (name)
                        {
                        case "riki_blink_strike":
                            Utils.Sleep(MyHeroInfo.AttackRate() * 1000, handleString);
                            break;

                        case "necrolyte_reapers_scythe":
                            Utils.Sleep(delay + ping + 1500, "calculate");
                            break;

                        case "necrolyte_death_pulse":
                            Utils.Sleep(delay + ping + 200, "calculate");
                            break;

                        case "item_ethereal_blade":

                            // Variables.EtherealHitTime =
                            // (float)
                            // (Utils.TickCount + me.GetTurnTime(target) * 1000
                            // + Prediction.CalculateReachTime(target, 1200, target.Position - me.Position)
                            // + ping * 2);
                            Variables.LastEtherealTarget       = target;
                            Variables.LastEtherealCastPosition = me.NetworkPosition;
                            Variables.LastEtherealCastTime     =
                                (float)(Utils.TickCount + (me.GetTurnTime(target) * 1000) + ping);
                            Utils.Sleep(
                                me.GetTurnTime(target) * 1000 + 100
                                + (MyHeroInfo.Position.Distance2D(target) / 1200) * 1000 + ping,
                                "calculate");
                            break;

                        case "tusk_snowball":
                            Utils.Sleep(
                                me.GetTurnTime(target) * 1000
                                + (MyHeroInfo.Position.Distance2D(target) / 675) * 1000,
                                "GlobalCasting");
                            break;

                        case "ancient_apparition_cold_feet":
                            coldFeetLastUse = Utils.TickCount + 4000;
                            break;

                        case "item_cyclone":
                            Utils.Sleep(Game.Ping + (me.GetTurnTime(target) * 1000) + 450, "GlobalCasting");
                            Utils.Sleep(Game.Ping + (me.GetTurnTime(target) * 1000) + 450, "casting");
                            break;
                        }

                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 4, "GlobalCasting");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 4, "casting");
                        }

                        Utils.Sleep(delay, handleString);
                        Utils.Sleep(
                            ability.GetCastDelay(me, target, abilityName: name, useCastPoint: false) * 1000,
                            "GlobalCasting");
                        Utils.Sleep(ability.GetHitDelay(target, name) * 1000, "calculate");
                        Utils.Sleep(
                            Math.Max(ability.GetCastDelay(me, target, useCastPoint: false, abilityName: name), 0.15)
                            * 1000 + Game.Ping,

                            // + (Math.Max(me.Distance2D(target) - ability.GetCastRange(name) - 50, 0)
                            // / me.MovementSpeed) * 1000,
                            "casting");
                        Utils.Sleep(delay, "cancelorder");
                        if (name == "pudge_rot")
                        {
                            continue;
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        ///     The try.
        /// </summary>
        /// <param name="enemyHero">
        ///     The enemy hero.
        /// </param>
        /// <param name="enemyHeroes">
        ///     The enemy heroes.
        /// </param>
        /// <param name="mineMissingHp">
        ///     The mine missing health.
        /// </param>
        /// <param name="ping">
        ///     The ping.
        /// </param>
        /// <param name="me">
        ///     The me.
        /// </param>
        /// <param name="mana">
        ///     The mana.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public bool Try(Hero enemyHero, Hero[] enemyHeroes, float mineMissingHp, float ping, Hero me, float mana)
        {
            var hero         = enemyHero;
            var heroName     = NameManager.Name(hero);
            var heroDistance = MyHeroInfo.Position.Distance2D(hero);

            if (!Utils.SleepCheck("GlobalCasting") || !Utils.SleepCheck("casting"))
            {
                return(false);
            }

            Ability tuskSnowBall;

            if (me.ClassId == ClassId.CDOTA_Unit_Hero_Tusk && Dictionaries.InDamageDictionary.ContainsKey(hero.Handle) &&
                (Dictionaries.OutDamageDictionary[hero.Handle] + Dictionaries.InDamageDictionary[hero.Handle])
                >= enemyHero.Health && Utils.SleepCheck("tusk_snowball") && heroDistance <= 1350 &&
                me.FindSpell("tusk_snowball", out tuskSnowBall).CanBeCasted())
            {
                if (!Nuke.Cast(tuskSnowBall, hero, "tusk_snowball"))
                {
                    return(false);
                }

                DelayAction.Add(
                    new DelayActionItem(300, () => { AbilityMain.LaunchSnowball(); }, CancellationToken.None));
                Utils.Sleep(100 + (me.GetTurnTime(hero) * 1000) + ping, "tusk_snowball");
                var delay = (me.GetTurnTime(hero) * 1000) + ((heroDistance / 675) * 1000);
                Utils.Sleep(delay + 100, "GlobalCasting");
                Utils.Sleep(delay + 100, "calculate");
                Utils.Sleep(delay, "cancelorder");
                return(true);
            }

            foreach (var data in
                     MyAbilities.OffensiveAbilities.Where(
                         x =>
                         x.Value.IsValid &&
                         (x.Value.CanBeCasted() || (x.Value.CanBeCasted(SoulRing.ManaGained) && SoulRing.Check(x.Value)) ||
                          x.Value.CanInvoke()) &&
                         ((x.Value is Item && me.CanUseItems()) || (!(x.Value is Item) && me.CanCast())) &&
                         (Utils.SleepCheck(x.Value.Handle.ToString()) ||
                          (!x.Value.IsInAbilityPhase && x.Value.FindCastPoint() > 0)))
                     .OrderBy(x => ComboOrder.GetAbilityOrder(x.Value)))
            {
                var ability      = data.Value;
                var name         = NameManager.Name(ability);
                var category     = data.Key.Substring(name.Length);
                var handleString = ability.Handle.ToString();
                if (category != "buff" && hero.IsMagicImmune() && ability.SpellPierceImmunityType != SpellPierceImmunityType.EnemiesYes)
                {
                    continue;
                }

                if (!CastingChecks.All(name, hero))
                {
                    continue;
                }

                var delay  = (ability.GetCastDelay(me, hero, true, abilityName: name) * 1000) + 100;
                var canHit = ability.CanHit(hero, MyHeroInfo.Position, name);
                if (name == "omniknight_purification")
                {
                    if (!MainMenu.Menu.Item("Ability#.EnableAutoKillSteal").GetValue <bool>())
                    {
                        continue;
                    }

                    if (!(Nukes.NukesMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value < mana) ||
                        !MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().IsEnabled(name) ||
                        !Nukes.NukesMenuDictionary[name].Item(name + "herotoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) ||
                        (!(Variables.EtherealHitTime < (Utils.TickCount + (ability.GetHitDelay(hero, name) * 1000)))) ||
                        hero.Health
                        <= Nukes.NukesMenuDictionary[name].Item(NameManager.Name(ability) + "minhealthslider")
                        .GetValue <Slider>()
                        .Value || !CastingChecks.Killsteal(ability, hero, name))
                    {
                        return(false);
                    }

                    var target = FullCombo.FindPurificationTarget(hero);
                    if (target == null || !ability.CanHit(target, MyHeroInfo.Position, name) ||
                        !(target.PredictedPosition().Distance2D(hero.PredictedPosition()) < ability.GetRadius(name)) ||
                        !(target.PredictedPosition()
                          .Distance2D(hero.PredictedPosition(ability.FindCastPoint(NameManager.Name(ability))))
                          < ability.GetRadius(name)))
                    {
                        return(false);
                    }

                    if (!Nuke.Cast(ability, target, name))
                    {
                        return(false);
                    }

                    Utils.Sleep((ability.GetCastDelay(me, hero, abilityName: name) * 1000) + ping + 100, handleString);
                    Utils.Sleep(delay, "GlobalCasting");
                    Utils.Sleep(delay, "cancelorder");
                    return(true);
                }

                if (category == "nuke" && !MainMenu.Menu.Item("Ability#.EnableAutoKillSteal").GetValue <bool>())
                {
                    continue;
                }

                if (name == "item_urn_of_shadows" && hero.HasModifier("modifier_item_urn_damage"))
                {
                    continue;
                }

                if (category == "nuke" && Nukes.NukesMenuDictionary[name].Item(name + "ondisabletoggler") != null &&
                    Nukes.NukesMenuDictionary[name].Item(name + "ondisabletoggler")
                    .GetValue <HeroToggler>()
                    .IsEnabled(heroName) &&
                    Nukes.NukesMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value < mana &&
                    MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().IsEnabled(name) && canHit &&
                    (Variables.EtherealHitTime < (Utils.TickCount + (ability.GetHitDelay(hero, name) * 1000))) &&
                    hero.Health
                    > Nukes.NukesMenuDictionary[name].Item(NameManager.Name(ability) + "minhealthslider")
                    .GetValue <Slider>()
                    .Value)
                {
                    var duration = Utils.DisableDuration(hero);
                    if (duration > 0 &&
                        duration
                        > ability.GetHitDelay(hero, name)
                        - ((ability.EndRadius() + hero.HullRadius) / hero.MovementSpeed) - (Game.Ping / 1000) &&
                        (!hero.IsInvul() || duration < ability.GetHitDelay(hero, name)) &&
                        Nuke.Cast(ability, hero, name, true))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + ((ability.ChannelTime(name) * 1000) / 3), "cancelorder");
                            Utils.Sleep(delay + ((ability.ChannelTime(name) * 1000) / 3), "casting");
                        }

                        Utils.Sleep(
                            (ability.GetCastDelay(me, hero, abilityName: name) * 1000) + ping + 100,
                            handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }
                }

                if (category == "nuke" && Utils.SleepCheck(hero.Handle + "KillSteal") &&
                    Nukes.NukesMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value < mana &&
                    MainMenu.Menu.Item("nukesToggler").GetValue <AbilityToggler>().IsEnabled(name) &&
                    Nukes.NukesMenuDictionary[name].Item(name + "herotoggler")
                    .GetValue <HeroToggler>()
                    .IsEnabled(heroName) && canHit &&
                    (Variables.EtherealHitTime < (Utils.TickCount + (ability.GetHitDelay(hero, name) * 1000))) &&
                    hero.Health
                    > Nukes.NukesMenuDictionary[name].Item(NameManager.Name(ability) + "minhealthslider")
                    .GetValue <Slider>()
                    .Value&& CastingChecks.Killsteal(ability, hero, name) &&
                    (name != "zuus_thundergods_wrath" ||
                     (1
                      + enemyHeroes.Count(
                          x => !x.Equals(hero) && x.Health <= AbilityDamage.CalculateDamage(ability, me, x)))
                     >= Nukes.NukesMenuDictionary[name].Item(name + "minenemykill").GetValue <Slider>().Value))
                {
                    if ((hero.Health - Variables.DealtDamage) <= 0 ||
                        (hero.Health - Variables.DealtDamage)
                        < Nukes.NukesMenuDictionary[name].Item(name + "minhealthslider").GetValue <Slider>().Value)
                    {
                        Variables.DealtDamage = 0;
                        return(false);
                    }

                    if (Nuke.Cast(ability, hero, name))
                    {
                        if (Utils.SleepCheck(handleString) &&
                            ability.GetCastDelay(AbilityMain.Me, hero, true) * 1000 - Game.Ping > 0.1)
                        {
                            DelayAction.Add(
                                new DelayActionItem(
                                    (int)(ability.GetCastDelay(AbilityMain.Me, hero, true) * 1000 - Game.Ping - 50),
                                    () =>
                            {
                                if (!CastingChecks.Killsteal(ability, hero, name) || !hero.IsAlive ||
                                    hero.Health <= 0)
                                {
                                    AbilityMain.Me.Stop();
                                }
                            },
                                    CancellationToken.None));
                            Utils.Sleep(ability.GetHitDelay(hero, name) * 1000 + 500, hero.Handle + "KillSteal");
                        }

                        if (name == "riki_blink_strike")
                        {
                            Utils.Sleep(MyHeroInfo.AttackRate() * 1000 + ping + 100, handleString);
                        }

                        if (name == "item_ethereal_blade")
                        {
                            Variables.LastEtherealTarget       = hero;
                            Variables.LastEtherealCastPosition = me.NetworkPosition;
                            Variables.LastEtherealCastTime     =
                                (float)(Utils.TickCount + (me.GetTurnTime(hero) * 1000) + ping);
                            Utils.Sleep(
                                me.GetTurnTime(hero) * 1000 + 100 + (MyHeroInfo.Position.Distance2D(hero) / 1200) * 1000
                                + ping,
                                "calculate");
                        }

                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");

                        // Utils.Sleep(ping, "killsteal");
                        return(true);
                    }

                    continue;
                }

                if (Dictionaries.HitDamageDictionary.ContainsKey(hero.Handle) &&
                    Dictionaries.HitDamageDictionary[hero.Handle] * 1.5 >= hero.Health &&
                    hero.Distance2D(MyHeroInfo.Position) <= me.GetAttackRange() + 150)
                {
                    continue;
                }

                if (category == "disable" &&
                    Disables.DisablesMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value < mana &&
                    MainMenu.Menu.Item("disablesToggler").GetValue <AbilityToggler>().IsEnabled(name))
                {
                    if (
                        Disables.DisablesMenuDictionary[name].Item(name + "onsighttoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && Disable.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (
                        Disables.DisablesMenuDictionary[name].Item(name + "onchainstuntoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.ChainStun(ability, hero, name) &&
                        Disable.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (CastingChecks.UnderTower(ability, hero) &&
                        Disables.DisablesMenuDictionary[name].Item(name + "undertowertoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && Disable.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (
                        Disables.DisablesMenuDictionary[name].Item(name + "onchanneltoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && CastingChecks.Channel(hero) && canHit &&
                        Disable.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (
                        Disables.DisablesMenuDictionary[name].Item(name + "oncasttoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.Cast(hero, ability) &&
                        Disable.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    continue;
                }

                if (Dictionaries.InDamageDictionary.ContainsKey(hero.Handle) &&
                    Dictionaries.InDamageDictionary[hero.Handle] >= hero.Health &&
                    MainMenu.Menu.Item("Ability#.EnableAutoKillSteal").GetValue <bool>())
                {
                    continue;
                }

                if (category == "slow" &&
                    Slows.SlowsMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value < mana &&
                    MainMenu.Menu.Item("slowsToggler").GetValue <AbilityToggler>().IsEnabled(name))
                {
                    if (
                        Slows.SlowsMenuDictionary[name].Item(name + "onsighttoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && Slow.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        if (name == "item_ethereal_blade")
                        {
                            Utils.Sleep(
                                me.GetTurnTime(hero) * 1000
                                + Prediction.CalculateReachTime(hero, 1200, hero.Position - MyHeroInfo.Position),
                                "casting");
                            Utils.Sleep(
                                me.GetTurnTime(hero) * 1000 + 100 + (MyHeroInfo.Position.Distance2D(hero) / 1200) * 1000
                                + ping,
                                "calculate");
                        }

                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (
                        Slows.SlowsMenuDictionary[name].Item(name + "onchainstuntoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.ChainStun(ability, hero, name) &&
                        Slow.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        if (name == "item_ethereal_blade")
                        {
                            Utils.Sleep(
                                me.GetTurnTime(hero) * 1000
                                + Prediction.CalculateReachTime(hero, 1200, hero.Position - MyHeroInfo.Position),
                                "casting");
                            Utils.Sleep(
                                me.GetTurnTime(hero) * 1000 + 100 + (MyHeroInfo.Position.Distance2D(hero) / 1200) * 1000
                                + ping,
                                "calculate");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (CastingChecks.UnderTower(ability, hero) &&
                        Slows.SlowsMenuDictionary[name].Item(name + "undertowertoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && Slow.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        if (name == "item_ethereal_blade")
                        {
                            Utils.Sleep(
                                me.GetTurnTime(hero) * 1000
                                + Prediction.CalculateReachTime(hero, 1200, hero.Position - MyHeroInfo.Position),
                                "casting");
                            Utils.Sleep(
                                me.GetTurnTime(hero) * 1000 + 100 + (MyHeroInfo.Position.Distance2D(hero) / 1200) * 1000
                                + ping,
                                "calculate");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    continue;
                }

                if (category == "special" &&
                    (name == "rubick_spell_steal" ||
                     Specials.SpecialsMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value
                     < mana) && MainMenu.Menu.Item("specialsToggler").GetValue <AbilityToggler>().IsEnabled(name))
                {
                    if (name == "rubick_spell_steal")
                    {
                        var spell4 = me.Spellbook.Spell4;
                        if ((!spell4.CanBeCasted()) && Rubick.LastCasted(heroName) != null &&
                            NameManager.Name(spell4) != NameManager.Name(Rubick.LastCasted(heroName)) &&
                            Specials.SpecialsMenuDictionary[name].Item(heroName)
                            .GetValue <AbilityToggler>()
                            .IsEnabled(NameManager.Name(Rubick.LastCasted(heroName))) && canHit &&
                            Special.Cast(ability, hero, name))
                        {
                            Utils.Sleep(
                                ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100,
                                handleString);
                            Utils.Sleep(delay, "GlobalCasting");
                            Utils.Sleep(delay, "cancelorder");
                            return(true);
                        }

                        continue;
                    }

                    if (
                        Specials.SpecialsMenuDictionary[name].Item(name + "onsighttoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && Special.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (Specials.SpecialsMenuDictionary[name].Item(name + "onpurgetoggler") != null &&
                        Specials.SpecialsMenuDictionary[name].Item(name + "onpurgetoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.Purgable(hero) &&
                        Special.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (Specials.SpecialsMenuDictionary[name].Item(name + "oninvistoggler") != null &&
                        Specials.SpecialsMenuDictionary[name].Item(name + "oninvistoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.Invisible(hero) &&
                        Special.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (Specials.SpecialsMenuDictionary[name].Item(name + "onattacktoggler") != null &&
                        Specials.SpecialsMenuDictionary[name].Item(name + "onattacktoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.Attacking(hero, me) &&
                        Special.Cast(ability, hero, name))
                    {
                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    continue;
                }

                if (category == "buff" &&
                    Buffs.BuffsMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value < mana &&
                    MainMenu.Menu.Item("buffsToggler").GetValue <AbilityToggler>().IsEnabled(name))
                {
                    if (name == "item_armlet")
                    {
                        if (ability.IsToggled &&
                            Buffs.BuffsMenuDictionary[name].Item(name + "belowhpslider").GetValue <Slider>().Value
                            < me.Health)
                        {
                            continue;
                        }

                        if (Buffs.BuffsMenuDictionary[name].Item(name + "alwaystoggle").GetValue <bool>() &&
                            Buffs.BuffsMenuDictionary[name].Item(name + "belowhpslider").GetValue <Slider>().Value
                            > me.Health && AbilityMain.Me.Distance2D(Base.Position()) > 1300 &&
                            Buff.Cast(ability, hero, me, name, true))
                        {
                            Utils.Sleep(
                                Buffs.BuffsMenuDictionary[name].Item(name + "armletdelay").GetValue <Slider>().Value,
                                handleString);
                            Utils.Sleep(ping + 200, "GlobalCasting");
                            Utils.Sleep(ping + 200, "casting");
                            return(true);
                        }
                    }

                    if (name == "item_satanic" &&
                        Buffs.BuffsMenuDictionary[name].Item(name + "missinghpslider").GetValue <Slider>().Value
                        > mineMissingHp &&
                        Buffs.BuffsMenuDictionary[name].Item(name + "belowhpslider").GetValue <Slider>().Value
                        < me.Health)
                    {
                        continue;
                    }

                    if (
                        Buffs.BuffsMenuDictionary[name].Item(name + "onsighttoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && Buff.Cast(ability, hero, me, name))
                    {
                        if (name == "item_armlet")
                        {
                            Utils.Sleep(
                                Buffs.BuffsMenuDictionary[name].Item(name + "armletdelay").GetValue <Slider>().Value,
                                handleString);
                            Utils.Sleep(ping + 200, "GlobalCasting");
                            Utils.Sleep(ping + 200, "casting");
                        }
                        else
                        {
                            Utils.Sleep(
                                ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100,
                                handleString);
                        }

                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (
                        Buffs.BuffsMenuDictionary[name].Item(name + "onattacktoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.Attacking(hero, me) &&
                        Buff.Cast(ability, hero, me, name))
                    {
                        if (name == "item_armlet")
                        {
                            Utils.Sleep(
                                Buffs.BuffsMenuDictionary[name].Item(name + "armletdelay").GetValue <Slider>().Value,
                                handleString);
                            Utils.Sleep(ping + 200, "GlobalCasting");
                            Utils.Sleep(ping + 200, "casting");
                        }
                        else
                        {
                            Utils.Sleep(
                                ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100,
                                handleString);
                        }

                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    continue;
                }

                if (category == "silence" &&
                    Silences.SilencesMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value < mana &&
                    MainMenu.Menu.Item("silencesToggler").GetValue <AbilityToggler>().IsEnabled(name))
                {
                    if (
                        Silences.SilencesMenuDictionary[name].Item(name + "onsighttoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && Silence.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (
                        Silences.SilencesMenuDictionary[name].Item(name + "oncasttoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.Cast(hero, ability) &&
                        Silence.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (
                        Silences.SilencesMenuDictionary[name].Item(name + "oninvistoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.Invisible(hero) &&
                        Silence.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    continue;
                }

                if (category == "harras" &&
                    Harrases.HarrasesMenuDictionary[name].Item(name + "minManaCheck").GetValue <Slider>().Value < mana &&
                    MainMenu.Menu.Item("harrasesToggler").GetValue <AbilityToggler>().IsEnabled(name))
                {
                    if (
                        Harrases.HarrasesMenuDictionary[name].Item(name + "onsighttoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && Harras.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }

                    if (
                        Harrases.HarrasesMenuDictionary[name].Item(name + "onattacktoggler")
                        .GetValue <HeroToggler>()
                        .IsEnabled(heroName) && canHit && CastingChecks.Attacking(hero, me) &&
                        Harras.Cast(ability, hero, name))
                    {
                        if (ability.ChannelTime(name) > 0)
                        {
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "cancelorder");
                            Utils.Sleep(delay + (ability.ChannelTime(name) * 1000) / 3, "casting");
                        }

                        Utils.Sleep(ability.GetCastDelay(me, hero, abilityName: name) * 1000 + ping + 100, handleString);
                        Utils.Sleep(delay, "GlobalCasting");
                        Utils.Sleep(delay, "cancelorder");
                        return(true);
                    }
                }
            }

            return(false);
        }