/// <summary>
        ///     The entity_ on int 32 property change.
        /// </summary>
        /// <param name="sender">
        ///     The sender.
        /// </param>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Entity_OnInt32PropertyChange(Entity sender, Int32PropertyChangeEventArgs args)
        {
            if (!sender.Equals(this.Unit) || args.PropertyName != "m_NetworkActivity")
            {
                return;
            }

            if (this.Unit == null || !this.Unit.IsValid)
            {
                Entity.OnInt32PropertyChange -= this.Entity_OnInt32PropertyChange;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            var newValue = (NetworkActivity)args.NewValue;
            var oldValue = (NetworkActivity)args.OldValue;

            if (newValue == this.lastUnitActivity || newValue == oldValue)
            {
                return;
            }

            var canCancel    = this.CanCancelAttack();
            var wasAttacking = false;

            if (!this.IsAttackOnCoolDown() || canCancel)
            {
                wasAttacking          = this.isAttacking;
                this.lastUnitActivity = newValue;
                this.isAttacking      = newValue == NetworkActivity.Attack || newValue == NetworkActivity.Crit ||
                                        newValue == NetworkActivity.Attack2 || newValue == NetworkActivity.AttackEvent ||
                                        newValue == NetworkActivity.AttackEventBash ||
                                        newValue == NetworkActivity.EarthshakerTotemAttack;
            }

            if (wasAttacking && canCancel && !this.isAttacking &&
                (oldValue == NetworkActivity.Attack || oldValue == NetworkActivity.Crit ||
                 oldValue == NetworkActivity.Attack2 || oldValue == NetworkActivity.AttackEvent ||
                 oldValue == NetworkActivity.AttackEventBash || oldValue == NetworkActivity.EarthshakerTotemAttack))
            {
                this.AttackEnd();
            }

            if (!this.isAttacking || (!this.isAttacking && !canCancel))
            {
                return;
            }

            this.LastUnitAttackStart = Game.RawGameTime;
            this.NextUnitAttackEnd   =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.NextUnitAttackRelease =
                (float)(this.LastUnitAttackStart * 1000 + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
            this.AttackOrderSent = false;
            this.AttackStart();
        }
        /// <summary>
        ///     The attack start.
        /// </summary>
        new public void AttackStart()
        {
            DelayAction.Add(
                (int)(UnitDatabase.GetAttackRate(this.Unit) * 1000),
                () =>
            {
                this.currentCount +=
                    (float)((Game.RawGameTime - this.counterStart) / UnitDatabase.GetAttackRate(this.Unit));
            });
            if (!this.counter10Sleeper2.Sleeping)
            {
                this.counter10Started = true;
            }

            if (this.movingWhenReady)
            {
                return;
            }

            if (this.moveSleeper.Sleeping || this.attackSleeper.Sleeping ||
                (this.hero && (!Utils.SleepCheck("Orbwalk.Move") || !Utils.SleepCheck("Orbwalk.Attack"))))
            {
                this.movingWhenReady = true;
            }
        }
Exemple #3
0
        /// <summary>
        ///     The attack start.
        /// </summary>
        public override void AttackStart()
        {
            DelayAction.Add(
                (int)
                ((this.UsingCustomAttackSpeedValue
                      ? UnitDatabase.GetAttackRate(this.Unit, this.CustomAttackSpeedValue)
                      : UnitDatabase.GetAttackRate(this.Unit)) * 1000),
                () =>
            {
                this.currentCount +=
                    (float)
                    ((Game.RawGameTime - this.counterStart)
                     / (this.UsingCustomAttackSpeedValue
                                    ? UnitDatabase.GetAttackRate(this.Unit, this.CustomAttackSpeedValue)
                                    : UnitDatabase.GetAttackRate(this.Unit)));
            });
            if (!this.counter10Sleeper2.Sleeping)
            {
                this.counter10Started = true;
            }

            if (this.movingWhenReady)
            {
                return;
            }

            if (this.moveSleeper.Sleeping || this.attackSleeper.Sleeping ||
                this.hero && (!Utils.SleepCheck("Orbwalk.Move") || !Utils.SleepCheck("Orbwalk.Attack")))
            {
                this.movingWhenReady = true;
                Drawing.OnDraw      += this.MoveWhenReady;
            }
        }
        private void Track(EventArgs args)
        {
            if (Unit == null || !Unit.IsValid)
            {
                Events.OnUpdate -= Track;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            if (Unit.NetworkActivity == lastUnitActivity)
            {
                return;
            }

            lastUnitActivity = Unit.NetworkActivity;
            if (!Unit.IsAttacking())
            {
                if (CanCancelAttack())
                {
                    return;
                }

                lastUnitActivity      = 0;
                nextUnitAttackEnd     = 0;
                nextUnitAttackRelease = 0;
                return;
            }

            nextUnitAttackEnd     = (float)(Utils.TickCount + (UnitDatabase.GetAttackRate(Unit) * 1000));
            nextUnitAttackRelease = (float)(Utils.TickCount + (UnitDatabase.GetAttackPoint(Unit) * 1000));
        }
        /// <summary>
        ///     The track.
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Track(EventArgs args)
        {
            if (this.Unit == null || !this.Unit.IsValid)
            {
                Drawing.OnDraw -= this.Track;
                return;
            }

            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            if (this.Unit.NetworkActivity == this.lastUnitActivity)
            {
                return;
            }

            this.lastUnitActivity = this.Unit.NetworkActivity;
            if (!this.Unit.IsAttacking())
            {
                if (this.CanCancelAttack())
                {
                    return;
                }

                this.lastUnitActivity      = 0;
                this.nextUnitAttackEnd     = 0;
                this.nextUnitAttackRelease = 0;
                return;
            }

            this.nextUnitAttackEnd     = (float)(Utils.TickCount + UnitDatabase.GetAttackRate(this.Unit) * 1000);
            this.nextUnitAttackRelease = (float)(Utils.TickCount + UnitDatabase.GetAttackPoint(this.Unit) * 1000);
        }
 public static double AttackRate()
 {
     if (!Utils.SleepCheck("MyAttackRate"))
     {
         return(attackRate);
     }
     attackRate = UnitDatabase.GetAttackRate(AbilityMain.Me);
     Utils.Sleep(500, "MyAttackRate");
     return(attackRate);
 }
Exemple #7
0
        private static bool AttackOnCooldown(Hero me, Entity target = null, float bonusWindupMs = 0)
        {
            if (me == null)
            {
                return(false);
            }
            var turnTime = 0d;

            if (target != null)
            {
                turnTime = me.GetTurnTime(target);
            }
            int lastAttackStart;

            LastAttackStart.TryGetValue(me.Handle, out lastAttackStart);
            return(lastAttackStart + UnitDatabase.GetAttackRate(me) * 1000 - Game.Ping - turnTime * 1000 - 75
                   + bonusWindupMs > _tick);
        }
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!OnUpdateChecks.CanUpdate())
            {
                return;
            }

            MyHeroInfo.UpdatePosition();
            var enemyHeroes = EnemyHeroes.UsableHeroes;
            var allyHeroes  = AllyHeroes.UsableHeroes;

            GankDamage.UpdateDamage(enemyHeroes, allyHeroes);
            if (!Me.IsAlive || Me.IsChanneling() || Me.HasModifier("modifier_spirit_breaker_charge_of_darkness") ||
                (MyAbilities.ChargeOfDarkness != null && MyAbilities.ChargeOfDarkness.IsValid &&
                 MyAbilities.ChargeOfDarkness.IsInAbilityPhase) || !Utils.SleepCheck("Ability#.Sleep"))
            {
                return;
            }

            var keyDown = Game.IsKeyDown(MainMenu.ComboKeysMenu.Item("abilityKey1").GetValue <KeyBind>().Key);

            if (Utils.SleepCheck("cancelorder") || !keyDown)
            {
                if (lastOrderPosition != Vector3.Zero && lastActivity == NetworkActivity.Move)
                {
                    var ctarget = TargetSelector.ClosestToMouse(Me, 150);
                    if (ctarget != null && ctarget.IsValid)
                    {
                        Me.Attack(ctarget);
                    }
                    else
                    {
                        Me.Move(lastOrderPosition);
                    }

                    lastOrderPosition = Vector3.Zero;
                }
            }
            else
            {
                lastActivity      = Me.NetworkActivity;
                lastOrderPosition = Game.MousePosition;
            }

            var ping = Game.Ping;

            var invisible = Me.IsInvisible() && Me.ClassID != ClassID.CDOTA_Unit_Hero_Riki &&
                            (!Me.HasModifier("modifier_templar_assassin_meld") || !Orbwalking.CanCancelAnimation());

            if (!invisible && MainMenu.Menu.Item("Ability#.EnableAutoUsage").GetValue <bool>() &&
                MyAbilities.DefensiveAbilities.Any() && Utils.SleepCheck("casting"))
            {
                if (Utils.SleepCheck("Orbwalk.Attack") &&
                    allyHeroes.Any(allyHero => FullCombo.DeffensiveAutoUsage(allyHero, Me, enemyHeroes, ping)))
                {
                    return;
                }
            }

            var targetLock =
                MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.TargetLock").GetValue <StringList>().SelectedIndex;

            if (!keyDown)
            {
                target = null;
            }

            if (Game.IsChatOpen)
            {
                return;
            }

            var meMissingHp = Me.MaximumHealth - Me.Health;
            var meMana      = Me.Mana;

            ManageAutoAttack.UpdateAutoAttack();

            if (keyDown)
            {
                if (Utils.SleepCheck("UpdateTarget") &&
                    (target == null || !target.IsValid || !target.IsAlive || !target.IsVisible ||
                     (target.IsVisible && targetLock <= 1)))
                {
                    var mode =
                        MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Target").GetValue <StringList>().SelectedIndex;
                    target = mode == 0
                                 ? TargetSelector.ClosestToMouse(Me, 2000)
                                 : EnemyHeroes.UsableHeroes.Where(x => x.Distance2D(Me) < 2000)
                             .MaxOrDefault(x => x.GetDoableDamage());
                    Utils.Sleep(250, "UpdateTarget");
                }

                var selectedCombo = MainMenu.ComboKeysMenu.Item("abilityComboType").GetValue <StringList>().SelectedIndex;
                var combo         = false;
                if (!invisible && target != null && Orbwalking.CanCancelAnimation() && Utils.SleepCheck("Orbwalk.Attack"))
                {
                    combo = FullCombo.Execute(
                        target,
                        enemyHeroes,
                        ping,
                        selectedCombo == 2,
                        selectedCombo == 1,
                        Me,
                        meMana,
                        selectedCombo == 3);
                }

                if (!combo &&
                    (target == null ||
                     (target.Distance2D(MyHeroInfo.Position) > 500 && Me.HasModifier("modifier_pudge_rot") &&
                      !target.HasModifier("modifier_pudge_meat_hook"))) &&
                    AllyHeroes.AbilityDictionary.ContainsKey(Me.StoredName()))
                {
                    foreach (var ability in AllyHeroes.AbilityDictionary[Me.StoredName()].Where(x => x.IsToggled))
                    {
                        var handle = ability.Handle.ToString();
                        if (!Utils.SleepCheck(handle))
                        {
                            continue;
                        }

                        ability.ToggleAbility();
                        Utils.Sleep(500 + Game.Ping, handle);
                        return;
                    }
                }

                if (Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin && target != null && target.IsVisible)
                {
                    var meld = Me.Spellbook.SpellW;
                    if (meld.ManaCost <= meMana && meld.Cooldown >= 0 && meld.Cooldown < UnitDatabase.GetAttackRate(Me) &&
                        target.Health > Dictionaries.HitDamageDictionary[target.Handle] * 2)
                    {
                        if (!Utils.SleepCheck("Ability.Move"))
                        {
                            return;
                        }

                        Me.Move(Game.MousePosition);
                        Utils.Sleep(100, "Ability.Move");
                        return;
                    }
                }

                if (combo || !Utils.SleepCheck("GlobalCasting") ||
                    (!(Game.MousePosition.Distance2D(Me)
                       > MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue <Slider>().Value) &&
                     (target == null || !(Me.Distance2D(target) <= MyHeroInfo.AttackRange() + 100))))
                {
                    return;
                }

                MoveMode(target);
            }

            if (!invisible && MainMenu.Menu.Item("Ability#.EnableAutoKillSteal").GetValue <bool>() &&
                Utils.SleepCheck("casting"))
            {
                Variables.Killsteal.FindTarget(enemyHeroes, Me);
                if (Variables.Killsteal.TryKillsteal(Me, ping, enemyHeroes))
                {
                    return;
                }
            }

            if (!invisible && MainMenu.Menu.Item("Ability#.EnableAutoUsage").GetValue <bool>() &&
                Utils.SleepCheck("Orbwalk.Attack") &&
                enemyHeroes.Any(
                    enemyHero => Variables.AutoUsage.Try(enemyHero, enemyHeroes, meMissingHp, ping, Me, meMana)))
            {
                return;
            }
        }
Exemple #9
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                //Orbwalking.Load();
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null)
                {
                    return;
                }
                loaded = true;
            }

            if (me == null || !me.IsValid)
            {
                //Orbwalking.Load();
                loaded = false;
                me     = ObjectMgr.LocalHero;
                if (rangeDisplay == null)
                {
                    return;
                }
                rangeDisplay = null;
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (rangeDisplay == null)
            {
                rangeDisplay = me.AddParticleEffect(@"particles\ui_mouseactions\range_display.vpcf");
                lastRange    = me.GetAttackRange() + me.HullRadius + 25;
                rangeDisplay.SetControlPoint(1, new Vector3(lastRange, 0, 0));
            }
            else
            {
                if (lastRange != (me.GetAttackRange() + me.HullRadius + 25))
                {
                    lastRange = me.GetAttackRange() + me.HullRadius + 25;
                    rangeDisplay.Dispose();
                    rangeDisplay = me.AddParticleEffect(@"particles\ui_mouseactions\range_display.vpcf");
                    rangeDisplay.SetControlPoint(1, new Vector3(lastRange, 0, 0));
                }
            }
            if (target != null && (!target.IsValid || !target.IsVisible || !target.IsAlive || target.Health <= 0))
            {
                target = null;
            }
            var canCancel = Orbwalking.CanCancelAnimation();

            if (canCancel)
            {
                if (target != null && !target.IsVisible && !Orbwalking.AttackOnCooldown(target))
                {
                    target = me.ClosestToMouseTarget(128);
                }
                else if (target == null || !Orbwalking.AttackOnCooldown(target))
                {
                    var bestAa = me.BestAATarget();
                    if (bestAa != null)
                    {
                        target = me.BestAATarget();
                    }
                }
                if (Game.IsKeyDown(FarmKey) &&
                    (creepTarget == null || !creepTarget.IsValid || !creepTarget.IsVisible || !creepTarget.IsAlive || creepTarget.Health <= 0 ||
                     !Orbwalking.AttackOnCooldown(creepTarget)))
                {
                    creepTarget = TargetSelector.GetLowestHPCreep(me);
                }
            }

            if (Game.IsChatOpen)
            {
                return;
            }

            if (Game.IsKeyDown(FarmKey))
            {
                Orbwalking.Orbwalk(creepTarget);
            }
            if (Game.IsKeyDown(ChaseKey))
            {
                Orbwalking.Orbwalk(target, attackmodifiers: true);
            }
            if (Game.IsKeyDown(KiteKey))
            {
                Orbwalking.Orbwalk(
                    target,
                    attackmodifiers: true,
                    bonusRange: (float)(UnitDatabase.GetAttackRate(me) * 1000));
            }
        }
Exemple #10
0
 /// <summary>
 ///     The attack rate.
 /// </summary>
 /// <param name="unit">
 ///     The unit.
 /// </param>
 /// <returns>
 ///     The <see cref="double" />.
 /// </returns>
 public static double AttackRate(this Unit unit)
 {
     return(UnitDatabase.GetAttackRate(unit));
 }
Exemple #11
0
 /// <summary>
 ///     The attack rate.
 /// </summary>
 /// <param name="hero">
 ///     The hero.
 /// </param>
 /// <returns>
 ///     The <see cref="double" />.
 /// </returns>
 public static double AttackRate(this Hero hero)
 {
     return(UnitDatabase.GetAttackRate(hero));
 }
Exemple #12
0
        private void Drawing_OnDraw(EventArgs args)
        {
            if (!this.Unit.IsValid)
            {
                Drawing.OnDraw -= this.Drawing_OnDraw;
                return;
            }

            if (!this.counterSleeper.Sleeping)
            {
                this.counterSleeper.Sleep(1000);
                this.counterStart = Game.RawGameTime;
                var current  = (Game.RawGameTime - this.LastUnitAttackStart) / UnitDatabase.GetAttackRate(this.Unit);
                var newValue = current <= 1 ? this.currentCount + current : this.currentCount;
                this.attacksPerSecond = (float)newValue;
                this.currentCount     = 0;
            }

            if (this.counter10Started && !this.counter10Sleeper.Sleeping)
            {
                if (!this.counter10Sleeper2.Sleeping)
                {
                    if (this.counter10Running)
                    {
                        this.counter10Started = false;
                        var current = (Game.RawGameTime - this.LastUnitAttackStart)
                                      / UnitDatabase.GetAttackRate(this.Unit);
                        var newValue = current <= 1 ? this.current10Count + current : this.current10Count;
                        this.counter10Result  = (float)newValue;
                        this.counter10Running = false;
                        this.counter10Sleeper2.Sleep(3000);
                        this.current10Count = 0;
                    }
                    else
                    {
                        this.counter10Sleeper.Sleep(10000);
                        this.counter10Start = Game.RawGameTime;
                    }
                }
            }

            if (this.counter10Sleeper.Sleeping)
            {
                this.counter10Running = true;
            }

            this.counterText.Text          = this.attacksPerSecond + " - Current Atk/s";
            this.secondsperattackText.Text = this.Unit.SecondsPerAttack + " - unit.SecondsPerAttack";
            this.counter10Text.Text        = this.counter10Running
                                          ? Math.Floor(Game.RawGameTime - this.counter10Start) + " sec: "
                                             + this.current10Count + " attacks"
                                          : this.counter10Result <= 0
                                              ? "counter not started"
                                              : "result: " + this.counter10Result + " attacks ";
            this.counterText.Position = HUDInfo.GetHPbarPosition(this.Unit)
                                        - new Vector2(50, 50 + this.counterText.Size.Y);
            this.counter10Text.Position        = HUDInfo.GetHPbarPosition(this.Unit) - new Vector2(50);
            this.secondsperattackText.Position = HUDInfo.GetHPbarPosition(this.Unit)
                                                 - new Vector2(
                50,
                50 + this.counterText.Size.Y + this.counter10Text.Size.Y);
            this.counterText.Draw();

            // this.secondsperattackText.Draw();
            this.counter10Text.Draw();
        }
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!OnUpdateChecks.CanUpdate())
            {
                return;
            }
            MyHeroInfo.UpdatePosition();
            ManageAutoAttack.UpdateAutoAttack();
            var enemyHeroes = EnemyHeroes.UsableHeroes;
            var allyHeroes  = AllyHeroes.UsableHeroes;

            GankDamage.UpdateDamage(enemyHeroes, allyHeroes);
            if (!Me.IsAlive ||
                (Me.IsInvisible() && !Me.IsVisibleToEnemies && Me.ClassID != ClassID.CDOTA_Unit_Hero_Riki &&
                 (Me.Modifiers.All(x => x.Name != "modifier_templar_assassin_meld") ||
                  !Orbwalking.CanCancelAnimation())) || Me.IsChanneling())
            {
                return;
            }
            if (Utils.SleepCheck("cancelorder"))
            {
                if (lastOrderPosition != Vector3.Zero)
                {
                    var ctarget = TargetSelector.ClosestToMouse(Me, 150);
                    if (ctarget != null)
                    {
                        Me.Attack(ctarget);
                    }
                    else
                    {
                        Me.Attack(lastOrderPosition);
                    }
                    lastOrderPosition = Vector3.Zero;
                }
            }
            else
            {
                lastOrderPosition = Game.MousePosition;
            }
            var meModifiers = Me.Modifiers.ToList();
            var ping        = Game.Ping;

            if (LaunchSnowball(meModifiers))
            {
                return;
            }
            if (MyAbilities.DeffensiveAbilities.Any() && Utils.SleepCheck("casting"))
            {
                if (allyHeroes.Any(allyHero => FullCombo.DeffensiveAutoUsage(allyHero, Me, enemyHeroes, ping)))
                {
                    return;
                }
            }

            if (!MyAbilities.OffensiveAbilities.Any())
            {
                if (Game.IsChatOpen)
                {
                    return;
                }
                if (Game.IsKeyDown(MainMenu.ComboKeysMenu.Item("abilityKey1").GetValue <KeyBind>().Key))
                {
                    if (Utils.SleepCheck("UpdateTarget"))
                    {
                        target = TargetSelector.ClosestToMouse(Me, 2000);
                        Utils.Sleep(250, "UpdateTarget");
                    }
                    if (target != null && !target.IsValid)
                    {
                        target = null;
                    }
                    if (Utils.SleepCheck("GlobalCasting"))
                    {
                        Orbwalking.Orbwalk(target, attackmodifiers: true);
                    }
                }
            }

            if (Utils.SleepCheck("casting"))
            {
                if (FullCombo.KillSteal(enemyHeroes, ping, Me))
                {
                    return;
                }
            }
            var meMissingHp = Me.MaximumHealth - Me.Health;
            var meMana      = Me.Mana;

            if (
                enemyHeroes.Any(
                    enemyHero => FullCombo.AutoUsage(enemyHero, enemyHeroes, meMissingHp, meModifiers, ping, Me, meMana)))
            {
                return;
            }
            if (Game.IsChatOpen)
            {
                return;
            }
            if (Game.IsKeyDown(MainMenu.ComboKeysMenu.Item("abilityKey1").GetValue <KeyBind>().Key))
            {
                if (Utils.SleepCheck("UpdateTarget"))
                {
                    target = TargetSelector.ClosestToMouse(Me, 2000);
                    Utils.Sleep(250, "UpdateTarget");
                }
                if (target != null && !target.IsValid)
                {
                    target = null;
                }
                var selectedCombo = MainMenu.ComboKeysMenu.Item("abilityComboType").GetValue <StringList>().SelectedIndex;
                if (target != null && Utils.SleepCheck("Orbwalk.Attack"))
                {
                    FullCombo.Execute(
                        target,
                        enemyHeroes,
                        ping,
                        selectedCombo == 2,
                        selectedCombo == 1,
                        Me,
                        meModifiers,
                        meMana);
                }
                if (Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin && target != null && target.IsVisible)
                {
                    var meld = Me.Spellbook.SpellW;
                    if (meld.ManaCost <= meMana && meld.Cooldown >= 0 && meld.Cooldown < UnitDatabase.GetAttackRate(Me) &&
                        target.Health > Dictionaries.HitDamageDictionary[target.Handle] * 2)
                    {
                        if (!Utils.SleepCheck("Ability.Move"))
                        {
                            return;
                        }
                        Me.Move(Game.MousePosition);
                        Utils.Sleep(100, "Ability.Move");
                        return;
                    }
                }
                if (Utils.SleepCheck("GlobalCasting"))
                {
                    Orbwalking.Orbwalk(target, attackmodifiers: true);
                }
            }
        }
Exemple #14
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!OnUpdateChecks.CanUpdate())
            {
                return;
            }

            MyHeroInfo.UpdatePosition();
            ManageAutoAttack.UpdateAutoAttack();
            var enemyHeroes = EnemyHeroes.UsableHeroes;
            var allyHeroes  = AllyHeroes.UsableHeroes;

            GankDamage.UpdateDamage(enemyHeroes, allyHeroes);
            if (!Me.IsAlive ||
                (Me.IsInvisible() && !Me.IsVisibleToEnemies && Me.ClassID != ClassID.CDOTA_Unit_Hero_Riki &&
                 (!Me.HasModifier("modifier_templar_assassin_meld") ||
                  !Orbwalking.CanCancelAnimation())) || Me.IsChanneling())
            {
                return;
            }

            if (Utils.SleepCheck("cancelorder"))
            {
                if (lastOrderPosition != Vector3.Zero && lastActivity == NetworkActivity.Move)
                {
                    var ctarget = TargetSelector.ClosestToMouse(Me, 150);
                    if (ctarget != null && ctarget.IsValid)
                    {
                        Me.Attack(ctarget);
                    }
                    else
                    {
                        Me.Move(lastOrderPosition);
                    }

                    lastOrderPosition = Vector3.Zero;
                }
            }
            else
            {
                lastActivity      = Me.NetworkActivity;
                lastOrderPosition = Game.MousePosition;
            }

            var ping = Game.Ping;

            if (MyAbilities.DeffensiveAbilities.Any() && Utils.SleepCheck("casting"))
            {
                if (Utils.SleepCheck("Orbwalk.Attack") &&
                    allyHeroes.Any(allyHero => FullCombo.DeffensiveAutoUsage(allyHero, Me, enemyHeroes, ping)))
                {
                    return;
                }
            }

            var targetLock =
                MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.TargetLock").GetValue <StringList>().SelectedIndex;

            var keyDown = Game.IsKeyDown(MainMenu.ComboKeysMenu.Item("abilityKey1").GetValue <KeyBind>().Key);

            if (!keyDown)
            {
                target = null;
            }

            if (!MyAbilities.OffensiveAbilities.Any())
            {
                if (Game.IsChatOpen)
                {
                    return;
                }

                if (keyDown)
                {
                    if (Utils.SleepCheck("UpdateTarget") &&
                        (target == null || !target.IsValid || !target.IsAlive || (!target.IsVisible && targetLock == 0)))
                    {
                        var mode =
                            MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Target").GetValue <StringList>().SelectedIndex;
                        target = mode == 0
                                     ? TargetSelector.ClosestToMouse(Me, 2000)
                                     : EnemyHeroes.UsableHeroes.Where(x => x.Distance2D(Me) < 2000)
                                 .MaxOrDefault(x => x.GetDoableDamage());
                        Utils.Sleep(250, "UpdateTarget");
                    }

                    if (target != null && !target.IsValid)
                    {
                        target = null;
                    }

                    if (Utils.SleepCheck("GlobalCasting") &&
                        (Game.MousePosition.Distance2D(Me)
                         > MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue <Slider>().Value ||
                         (target != null &&
                          Me.Distance2D(target)
                          <= MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue <Slider>().Value)))
                    {
                        var mode =
                            MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Mode").GetValue <StringList>().SelectedIndex;
                        switch (mode)
                        {
                        case 0:

                            Orbwalking.Orbwalk(target, attackmodifiers: true);
                            break;

                        case 1:
                            if (!Utils.SleepCheck("Ability.Move"))
                            {
                                return;
                            }

                            Me.Move(Game.MousePosition);
                            Utils.Sleep(100, "Ability.Move");
                            break;

                        case 2:
                            if (!Utils.SleepCheck("Ability.Move") || target == null)
                            {
                                return;
                            }

                            Me.Attack(target);
                            Utils.Sleep(100, "Ability.Move");
                            break;

                        case 3:
                            return;
                        }
                    }
                }
            }

            var meMissingHp = Me.MaximumHealth - Me.Health;
            var meMana      = Me.Mana;

            if (Utils.SleepCheck("Orbwalk.Attack") &&
                enemyHeroes.Any(
                    enemyHero => FullCombo.AutoUsage(enemyHero, enemyHeroes, meMissingHp, ping, Me, meMana)))
            {
                return;
            }

            if (Utils.SleepCheck("casting"))
            {
                if (FullCombo.KillSteal(enemyHeroes, ping, Me))
                {
                    return;
                }
            }

            if (Game.IsChatOpen)
            {
                return;
            }

            if (keyDown)
            {
                if (Utils.SleepCheck("UpdateTarget") &&
                    (target == null || !target.IsValid || !target.IsAlive || (!target.IsVisible && targetLock == 0)))
                {
                    var mode =
                        MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Target").GetValue <StringList>().SelectedIndex;
                    target = mode == 0
                                 ? TargetSelector.ClosestToMouse(Me, 2000)
                                 : EnemyHeroes.UsableHeroes.Where(x => x.Distance2D(Me) < 2000)
                             .MaxOrDefault(x => x.GetDoableDamage());
                    Utils.Sleep(250, "UpdateTarget");
                }

                var selectedCombo = MainMenu.ComboKeysMenu.Item("abilityComboType").GetValue <StringList>().SelectedIndex;
                if (target != null && Utils.SleepCheck("Orbwalk.Attack"))
                {
                    var combo = FullCombo.Execute(
                        target,
                        enemyHeroes,
                        ping,
                        selectedCombo == 2,
                        selectedCombo == 1,
                        Me,
                        meMana);
                }

                if (Me.ClassID == ClassID.CDOTA_Unit_Hero_TemplarAssassin && target != null && target.IsVisible)
                {
                    var meld = Me.Spellbook.SpellW;
                    if (meld.ManaCost <= meMana && meld.Cooldown >= 0 && meld.Cooldown < UnitDatabase.GetAttackRate(Me) &&
                        target.Health > Dictionaries.HitDamageDictionary[target.Handle] * 2)
                    {
                        if (!Utils.SleepCheck("Ability.Move"))
                        {
                            return;
                        }

                        Me.Move(Game.MousePosition);
                        Utils.Sleep(100, "Ability.Move");
                        return;
                    }
                }

                if (Utils.SleepCheck("GlobalCasting") &&
                    (Game.MousePosition.Distance2D(Me)
                     > MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue <Slider>().Value ||
                     (target != null &&
                      Me.Distance2D(target)
                      <= MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.NoMoveRange").GetValue <Slider>().Value)))
                {
                    var mode = MainMenu.ComboKeysMenu.Item("Ability.KeyCombo.Mode").GetValue <StringList>().SelectedIndex;
                    switch (mode)
                    {
                    case 0:

                        Orbwalking.Orbwalk(target, attackmodifiers: true);
                        break;

                    case 1:
                        if (!Utils.SleepCheck("Ability.Move"))
                        {
                            return;
                        }

                        Me.Move(Game.MousePosition);
                        Utils.Sleep(100, "Ability.Move");
                        break;

                    case 2:
                        if (!Utils.SleepCheck("Ability.Move") || target == null)
                        {
                            return;
                        }

                        Me.Attack(target);
                        Utils.Sleep(100, "Ability.Move");
                        break;

                    case 3:
                        return;
                    }
                }
            }
        }