Example #1
0
 /// <summary>
 ///     Tracks heroes movements
 /// </summary>
 /// <param name="args"></param>
 public static void SpeedTrack(EventArgs args)
 {
     if (!Game.IsInGame || Game.IsPaused)
     {
         return;
     }
     var me = ObjectMgr.LocalHero;
     if (me == null)
     {
         return;
     }
     var heroes = ObjectMgr.GetEntities<Hero>().Where(x => !x.IsIllusion);
     var tick = Environment.TickCount;
     foreach (var unit in heroes)
     {
         var data =
             TrackTable.FirstOrDefault(
                 unitData => unitData.UnitName == unit.Name || unitData.UnitClassID == unit.ClassID);
         if (data == null && unit.IsAlive && unit.IsVisible)
         {
             data = new Prediction(unit.Name, unit.ClassID, new Vector3(0, 0, 0), 0, new Vector3(0, 0, 0), 0, 0);
             TrackTable.Add(data);
             return;
         }
         if (data != null && (!unit.IsAlive || !unit.IsVisible))
         {
             data.LastPosition = new Vector3(0, 0, 0);
             data.LastRotR = 0;
             data.Lasttick = 0;
             continue;
         }
         if (data == null || (data.LastPosition != new Vector3(0, 0, 0) && !((tick - data.Lasttick) > 0)))
         {
             continue;
         }
         if (data.LastPosition == new Vector3(0, 0, 0))
         {
             data.LastPosition = unit.Position;
             data.LastRotR = unit.RotationRad;
             data.Lasttick = tick;
         }
         else
         {
             data.RotSpeed = data.LastRotR - unit.RotationRad;
             if (!RotTimeDictionary.ContainsKey(unit.Handle))
             {
                 RotTimeDictionary.Add(unit.Handle, tick);
             }
             var speed = (unit.Position - data.LastPosition) / (tick - data.Lasttick);
             //Console.WriteLine(data.RotSpeed + " rot");
             if (Math.Abs(data.RotSpeed) > 0.09 && data.Speed != new Vector3(0, 0, 0))
             {
                 RotTimeDictionary[unit.Handle] = tick;
                 data.Speed = unit.Vector3FromPolarAngle(-data.RotSpeed * 10) * (unit.MovementSpeed) / 3000;
             }
             else if (StraightTime(unit) < 500)
             {
                 data.Speed = unit.Vector3FromPolarAngle(-data.RotSpeed * 10) * (unit.MovementSpeed) / 3000;
             }
             else
             {
                 if (unit.Modifiers.Any(x => x.Name == "modifier_storm_spirit_ball_lightning"))
                 {
                     var ballLightning = unit.FindSpell("storm_spirit_ball_lightning");
                     var firstOrDefault =
                         ballLightning.AbilityData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed");
                     if (firstOrDefault != null)
                     {
                         var ballSpeed = firstOrDefault.GetValue(ballLightning.Level - 1);
                         //Console.WriteLine(ballSpeed);
                         var newpredict = unit.Vector3FromPolarAngle(-data.RotSpeed) * (ballSpeed / 1000);
                         data.Speed = newpredict;
                     }
                 }
                 else if (unit.NetworkActivity != NetworkActivity.Move)
                 {
                     data.Speed = speed;
                 }
                 else
                 {
                     var newpredict = unit.Vector3FromPolarAngle(-data.RotSpeed * 10) * (unit.MovementSpeed)
                                      / 1000;
                     data.Speed = newpredict;
                     //Console.WriteLine("speed" + " " + newpredict + " " + (unit.MovementSpeed / 1000) + " " + unit.Vector3FromPolarAngle(unit.RotationRad + data.RotSpeed) + " " + data.RotSpeed);
                 }
             }
             //var predict = unit.Position + data.Speed * 1000;
             //var realspeed = predict.Distance2D(unit.Position);
             //if ((realspeed + 100 > unit.MovementSpeed) && unit.NetworkActivity == NetworkActivity.Move)
             //{
             //    var newpredict = unit.Vector3FromPolarAngle(data.RotSpeed) * (unit.MovementSpeed) / 1000;
             //    data.Speed = newpredict;
             //}
             data.LastPosition = unit.Position;
             data.LastRotR = unit.RotationRad;
             data.Lasttick = tick;
             if (!SpeedDictionary.ContainsKey(unit.Handle))
             {
                 SpeedDictionary.Add(unit.Handle, data.Speed);
             }
             else
             {
                 SpeedDictionary[unit.Handle] = data.Speed;
             }
             if (!RotSpeedDictionary.ContainsKey(unit.Handle))
             {
                 RotSpeedDictionary.Add(unit.Handle, data.RotSpeed);
             }
             else
             {
                 RotSpeedDictionary[unit.Handle] = data.RotSpeed;
             }
         }
     }
 }
Example #2
0
        public static void SpeedTrack(EventArgs args)
        {
            if (!Utils.SleepCheck("TimberPrediction.SpeedTrack.Sleep"))
            {
                return;
            }

            if (playerList == null || (playerList.Count < 10 && Utils.SleepCheck("TimberPrediction.SpeedTrack")))
            {
                playerList = Heroes.All;
                Utils.Sleep(1000, "TimberPrediction.SpeedTrack");
            }

            if (!playerList.Any())
            {
                return;
            }

            Utils.Sleep(70, "TimberPrediction.SpeedTrack.Sleep");
            var tick = Environment.TickCount & int.MaxValue;
            var tempTable = new List<Prediction>(TrackTable);
            foreach (var unit in playerList.Where(x => x.IsValid))
            {
                var data =
                    tempTable.FirstOrDefault(
                        unitData => unitData.UnitName == unit.StoredName() || unitData.UnitClassId == unit.ClassID);
                if (data == null && unit.IsAlive && unit.IsVisible)
                {
                    data = new Prediction(
                        unit.StoredName(),
                        unit.ClassID,
                        new Vector3(0, 0, 0),
                        0,
                        new Vector3(0, 0, 0),
                        0,
                        0);
                    TrackTable.Add(data);
                }

                if (data != null && (!unit.IsAlive || !unit.IsVisible))
                {
                    data.LastPosition = new Vector3(0, 0, 0);
                    data.LastRotR = 0;
                    data.Lasttick = 0;
                    continue;
                }

                if (data == null || (data.LastPosition != new Vector3(0, 0, 0) && !(tick - data.Lasttick > 0)))
                {
                    continue;
                }

                if (data.LastPosition == new Vector3(0, 0, 0))
                {
                    data.LastPosition = unit.Position;
                    data.LastRotR = unit.RotationRad;
                    data.Lasttick = tick;
                }
                else
                {
                    data.RotSpeed = data.LastRotR - unit.RotationRad;
                    if (!RotTimeDictionary.ContainsKey(unit.Handle))
                    {
                        RotTimeDictionary.Add(unit.Handle, tick);
                    }

                    if (!LastRotRDictionary.ContainsKey(unit.Handle))
                    {
                        LastRotRDictionary.Add(unit.Handle, unit.RotationRad);
                    }

                    var speed = (unit.Position - data.LastPosition) / (tick - data.Lasttick);
                    if (Math.Abs(data.RotSpeed) > 0.18 && data.Speed != new Vector3(0, 0, 0))
                    {
                        data.Speed = speed;
                        RotTimeDictionary[unit.Handle] = tick;
                    }
                    else
                    {
                        LastRotRDictionary[unit.Handle] = unit.RotationRad;
                        data.Speed = speed;
                    }

                    data.LastPosition = unit.Position;
                    data.LastRotR = unit.RotationRad;
                    data.Lasttick = tick;
                    if (!SpeedDictionary.ContainsKey(unit.Handle))
                    {
                        SpeedDictionary.Add(unit.Handle, data.Speed);
                    }
                    else
                    {
                        SpeedDictionary[unit.Handle] = data.Speed;
                    }

                    if (!RotSpeedDictionary.ContainsKey(unit.Handle))
                    {
                        RotSpeedDictionary.Add(unit.Handle, data.RotSpeed);
                    }
                    else
                    {
                        RotSpeedDictionary[unit.Handle] = data.RotSpeed;
                    }
                }
            }
        }
Example #3
0
        public override async Task ExecuteComboAsync(Unit target, CancellationToken tk = new CancellationToken())
        {
            var myHeroNetworkPosition = this.MyHero.NetworkPosition;

            if (!await MoveOrBlinkToEnemy(target, tk, 480, 480))
            {
                if (!this.MyHero.IsSilenced() && this.MyHero.Distance2D(target) >= 480 && this.MyHero.Distance2D(target) <= maxYards)
                {
                    var pos = (target.NetworkPosition - myHeroNetworkPosition).Normalized();
                    pos *= 100;
                    pos  = target.NetworkPosition + pos;
                    float mana = MyHero.MaximumMana;

                    if (this._ultAbility.IsAbilityEnabled())
                    {
                        if (target.IsMoving)
                        {
                            Log.Debug($"Jumping the gun");
                            var    moves        = C**k.InFront(target, 300);
                            double consumedMana = (_ultAbility.GetAbilityData("ball_lightning_initial_mana_base") + ((_ultAbility.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * mana))
                                                  + ((MyHero.Distance2D(moves) / 100) * (((_ultAbility.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * mana)));

                            Log.Debug($"{consumedMana}");

                            if (consumedMana <= MyHero.Mana && (MyHero.Mana - consumedMana >= minMana))
                            {
                                this._ultAbility.UseAbility(moves);
                                await Await.Delay((int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(moves)) * 2250 + Game.Ping), tk);

                                MyHero.Attack(target);
                                Await.Block("zaioAutoAttack", StormAuto);
                            }
                        }

                        else
                        {
                            Log.Debug($"Jumping close but far");
                            double consumedMana = (_ultAbility.GetAbilityData("ball_lightning_initial_mana_base") + ((_ultAbility.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * mana))
                                                  + ((MyHero.Distance2D(pos) / 100) * (((_ultAbility.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * mana)));
                            Log.Debug($"{consumedMana} {(MyHero.Distance2D(pos) / 100)}");
                            if (consumedMana <= MyHero.Mana && (MyHero.Mana - consumedMana >= minMana))
                            {
                                this._ultAbility.UseAbility(pos);
                                Log.Debug($"{(int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(pos)) * 2250 + Game.Ping)}");
                                await Await.Delay((int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(pos)) * 2250 + Game.Ping), tk);

                                MyHero.Attack(target);
                                Await.Block("zaioAutoAttack", StormAuto);
                            }
                        }
                    }
                }
                Log.Debug($"return because of blink");
                return;
            }



            await this.HasNoLinkens(target, tk);

            await this.UseItems(target, tk);

            await this.DisableEnemy(target, tk);

            if (!MyHero.IsSilenced())
            {
                bool  hasAgha = MyHero.HasItem(ClassId.CDOTA_Item_UltimateScepter);
                float qCost   = _qAbility.GetAbilityData("Mana cost");
                float wCost   = _wAbility.GetAbilityData("Mana cost");
                float myMana  = MyHero.Mana;
                float mana    = MyHero.MaximumMana;
                var   pos     = (target.NetworkPosition - myHeroNetworkPosition).Normalized();
                pos *= 100;
                pos  = target.NetworkPosition + pos;
                double consumedMana = (_ultAbility.GetAbilityData("ball_lightning_initial_mana_base") + ((_ultAbility.GetAbilityData("ball_lightning_initial_mana_percentage") / 100) * mana))
                                      + ((MyHero.Distance2D(pos) / 100) * (((_ultAbility.GetAbilityData("ball_lightning_travel_cost_percent") / 100) * mana)));

                if (_qAbility.IsAbilityEnabled() && _qAbility.CanBeCasted() &&
                    _wAbility.IsAbilityEnabled() && _wAbility.CanBeCasted() &&
                    (qCost + wCost) <= myMana && !this.MyHero.HasModifier("modifier_storm_spirit_overload") &&
                    !target.HasModifier("modifier_item_lotus_orb_active"))
                {
                    if (!hasAgha)
                    {
                        this._wAbility.UseAbility(target);
                        await Await.Delay(GetAbilityDelay(_wAbility), tk);

                        MyHero.Attack(target);
                        await Await.Delay(500);
                    }

                    else
                    {
                        this._wAbility.UseAbility();
                        await Await.Delay(GetAbilityDelay(_wAbility), tk);

                        MyHero.Attack(target);
                        await Await.Delay(500);
                    }
                }

                if (_qAbility.IsAbilityEnabled() && _qAbility.CanBeCasted() && !this.MyHero.HasModifier("modifier_storm_spirit_overload") &&
                    ((!_wAbility.CanBeCasted() && (MyHero.Mana <= _qAbility.GetAbilityData("Mana cost") + consumedMana)) || MyHero.Distance2D(target) <= _qAbility.GetAbilityData("static_remnant_radius")))
                {
                    this._qAbility.UseAbility();
                    await Await.Delay(GetAbilityDelay(_qAbility), tk);

                    MyHero.Attack(target);
                    await Await.Delay(500);
                }

                if (_ultAbility.IsAbilityEnabled() && (!_qAbility.CanBeCasted() || this.MyHero.Distance2D(target) >= _qAbility.GetAbilityData("static_remnant_radius")) && (!_wAbility.CanBeCasted(target) || MyHero.Distance2D(target) >= _wAbility.GetAbilityData("Cast range")) &&
                    this.MyHero.Distance2D(target) <= maxYards && !this.MyHero.HasModifier("modifier_storm_spirit_overload"))
                {
                    this._ultAbility.UseAbility(pos);
                    await Await.Delay(GetAbilityDelay(_ultAbility), tk);

                    MyHero.Attack(target);
                    await Await.Delay(500);
                }

                if (this.MyHero.HasModifier("modifier_storm_spirit_overload"))
                {
                    MyHero.Attack(target);
                    await Await.Delay(500);
                }
            }

            if (ZaioMenu.ShouldUseOrbwalker)
            {
                Orbwalk();
            }
        }
Example #4
0
        protected override async Task <bool> Killsteal()
        {
            if (await base.Killsteal())
            {
                return(true);
            }

            if (MyHero.IsSilenced())
            {
                return(false);
            }

            float _qAutoDamage = this._qAbility.GetAbilityData("static_remnant_damage") + this._eAbility.GetDamage(_eAbility.Level - 1);

            _qAutoDamage += (MyHero.MinimumDamage + MyHero.BonusDamage);
            _qAutoDamage *= GetSpellAmp();

            float _eAutoDamage = this._eAbility.GetDamage(_eAbility.Level - 1);

            _eAutoDamage += (MyHero.MinimumDamage + MyHero.BonusDamage);
            _eAutoDamage *= GetSpellAmp();

            var qAutokillableTar =
                ObjectManager.GetEntitiesParallel <Hero>()
                .FirstOrDefault(
                    x =>
                    x.IsAlive && x.Team != this.MyHero.Team && !x.IsIllusion &&
                    this._qAbility.CanBeCasted() && this._qAbility.CanHit(x) &&
                    x.Health < (_qAutoDamage * (1 - x.MagicResistance())) &&
                    !x.IsMagicImmune() && !x.CantBeKilled() && !x.CantBeAttacked() &&
                    x.Distance2D(this.MyHero) <= 235);

            var AutokillableTar =
                ObjectManager.GetEntitiesParallel <Hero>()
                .FirstOrDefault(
                    x =>
                    x.IsAlive && x.Team != this.MyHero.Team && !x.IsIllusion &&
                    x.Health < _eAutoDamage * (1 - x.MagicResistance()) &&
                    !x.IsMagicImmune() && !x.CantBeKilled() && !x.CantBeAttacked() &&
                    x.Distance2D(this.MyHero) <= 480);


            if (this.MyHero.HasModifier("modifier_storm_spirit_overload") && AutokillableTar != null)
            {
                MyHero.Attack(AutokillableTar);
                Await.Block("zaioAutoAttack", StormAuto);
            }

            if (this._qAbility.IsKillstealAbilityEnabled() && this._qAbility.CanBeCasted() && !MyHero.HasModifier("modifier_storm_spirit_overload"))
            {
                if (AutokillableTar != null && _qAbility.CanBeCasted())
                {
                    Log.Debug($"Killing with auto {MyHero.HasModifier("modifier_storm_spirit_overload")}");
                    _qAbility.UseAbility();
                    await Await.Delay(300);

                    MyHero.Attack(AutokillableTar);
                    Await.Block("zaioAutoAttack", StormAuto);
                }

                if (qAutokillableTar != null && _qAbility.CanBeCasted())
                {
                    Log.Debug($"Killing with q and auto");
                    _qAbility.UseAbility();
                    await Await.Delay(300);

                    MyHero.Attack(qAutokillableTar);
                    Await.Block("zaioAutoAttack", StormAuto);
                }
            }

            if (this._ultAbility.IsKillstealAbilityEnabled() && this._ultAbility.CanBeCasted() && !MyHero.HasModifier("modifier_storm_spirit_overload"))
            {
                if (AutokillableTar != null && _ultAbility.CanBeCasted() && !_qAbility.CanBeCasted())
                {
                    var moves = C**k.InFront(AutokillableTar, 100);
                    Log.Debug($"Killable with auto, q not available");
                    _ultAbility.UseAbility(moves);
                    await Await.Delay((int)((_ultAbility.FindCastPoint() + MyHero.GetTurnTime(moves)) * 2500 + Game.Ping));

                    MyHero.Attack(AutokillableTar);
                    Await.Block("zaioAutoAttack", StormAuto);
                }
            }



            return(false);
        }
Example #5
0
        public static void SpeedTrack(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }
            var me = ObjectMgr.LocalHero;
            if (me == null)
            {
                return;
            }

            var heroes = ObjectMgr.GetEntities<Hero>();
            var tick = Environment.TickCount;
            foreach (var unit in heroes)
            {
                var data =
                    TrackTable.FirstOrDefault(
                        unitData => unitData.UnitName == unit.Name || unitData.UnitClassID == unit.ClassID);
                if (data == null && unit.IsAlive && unit.IsVisible)
                {
                    data = new Prediction(unit.Name, unit.ClassID, new Vector3(0, 0, 0), 0, new Vector3(0, 0, 0), 0, 0);
                    TrackTable.Add(data);
                }
                if (data != null && (!unit.IsAlive || !unit.IsVisible))
                {
                    TrackTable.Remove(data);
                    continue;
                }
                if (data == null || (data.LastPosition != new Vector3(0, 0, 0) && !((tick - data.Lasttick) > 0)))
                {
                    continue;
                }
                if (data.LastPosition == new Vector3(0, 0, 0))
                {
                    data.LastPosition = unit.Position;
                    data.LastRotR = unit.RotationRad;
                    data.Lasttick = tick;
                }
                else
                {
                    data.RotSpeed = data.LastRotR - unit.RotationRad;
                    var speed = (unit.Position - data.LastPosition) / (tick - data.Lasttick);
                    if (Math.Abs(data.RotSpeed) > 0.05 && data.Speed != new Vector3(0, 0, 0))
                    {
                        data.Speed = unit.Vector3FromPolarAngle(data.RotSpeed) / (tick - data.Lasttick);
                    }
                    else
                    {
                        if (unit.Modifiers.Any(x => x.Name == "modifier_storm_spirit_ball_lightning"))
                        {
                            var ballLightning = EntityExtensions.FindSpell(unit, "storm_spirit_ball_lightning");
                            var firstOrDefault =
                                ballLightning.AbilityData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed");
                            if (firstOrDefault != null)
                            {
                                var ballSpeed = firstOrDefault.GetValue(ballLightning.Level - 1);
                                Console.WriteLine(ballSpeed);
                                var newpredict = unit.Vector3FromPolarAngle(data.RotSpeed) * (ballSpeed / 1000);
                                data.Speed = newpredict;
                            }
                        }
                        else if (unit.NetworkActivity != NetworkActivity.Move)
                        {
                            data.Speed = speed;
                        }
                        else
                        {
                            var newpredict = unit.Vector3FromPolarAngle(data.RotSpeed) * (unit.MovementSpeed / 1000);
                            data.Speed = newpredict;
                        }
                    }
                    var predict = PredictedXYZ(unit, 1000);
                    var realspeed = predict.Distance2D(unit.Position);
                    if ((realspeed + 100 > unit.MovementSpeed) && unit.NetworkActivity != NetworkActivity.Move)
                    {
                        var newpredict = unit.Vector3FromPolarAngle() * (unit.MovementSpeed / 1000);
                        data.Speed = newpredict;
                    }
                    data.LastPosition = unit.Position;
                    data.LastRotR = unit.RotationRad;
                    data.Lasttick = tick;
                }
            }
        }
Example #6
0
        /// <summary>
        ///     Tracks heroes movements
        /// </summary>
        /// <param name="args"></param>
        public static void SpeedTrack(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }
            var me = ObjectMgr.LocalHero;

            if (me == null)
            {
                return;
            }

            var heroes = ObjectMgr.GetEntities <Hero>();
            var tick   = Environment.TickCount;

            foreach (var unit in heroes)
            {
                var data =
                    TrackTable.FirstOrDefault(
                        unitData => unitData.UnitName == unit.Name || unitData.UnitClassID == unit.ClassID);
                if (data == null && unit.IsAlive && unit.IsVisible)
                {
                    data = new Prediction(unit.Name, unit.ClassID, new Vector3(0, 0, 0), 0, new Vector3(0, 0, 0), 0, 0);
                    TrackTable.Add(data);
                }
                if (data != null && (!unit.IsAlive || !unit.IsVisible))
                {
                    TrackTable.Remove(data);
                    continue;
                }
                if (data == null || (data.LastPosition != new Vector3(0, 0, 0) && !((tick - data.Lasttick) > 0)))
                {
                    continue;
                }
                if (data.LastPosition == new Vector3(0, 0, 0))
                {
                    data.LastPosition = unit.Position;
                    data.LastRotR     = unit.RotationRad;
                    data.Lasttick     = tick;
                }
                else
                {
                    data.RotSpeed = data.LastRotR - unit.RotationRad;
                    var speed = (unit.Position - data.LastPosition) / (tick - data.Lasttick);
                    if (Math.Abs(data.RotSpeed) > 0.05 && data.Speed != new Vector3(0, 0, 0))
                    {
                        data.Speed = unit.Vector3FromPolarAngle(data.RotSpeed) / (tick - data.Lasttick);
                    }
                    else
                    {
                        if (unit.Modifiers.Any(x => x.Name == "modifier_storm_spirit_ball_lightning"))
                        {
                            var ballLightning  = unit.FindSpell("storm_spirit_ball_lightning");
                            var firstOrDefault =
                                ballLightning.AbilityData.FirstOrDefault(x => x.Name == "ball_lightning_move_speed");
                            if (firstOrDefault != null)
                            {
                                var ballSpeed = firstOrDefault.GetValue(ballLightning.Level - 1);
                                //Console.WriteLine(ballSpeed);
                                var newpredict = unit.Vector3FromPolarAngle(data.RotSpeed) * (ballSpeed / 1000);
                                data.Speed = newpredict;
                            }
                        }
                        else if (unit.NetworkActivity != NetworkActivity.Move)
                        {
                            data.Speed = speed;
                        }
                        else
                        {
                            var newpredict = unit.Vector3FromPolarAngle(data.RotSpeed) * (unit.MovementSpeed / 1000);
                            data.Speed = newpredict;
                        }
                    }
                    var predict   = PredictedXYZ(unit, 1000);
                    var realspeed = predict.Distance2D(unit.Position);
                    if ((realspeed + 100 > unit.MovementSpeed) && unit.NetworkActivity != NetworkActivity.Move)
                    {
                        var newpredict = unit.Vector3FromPolarAngle() * (unit.MovementSpeed / 1000);
                        data.Speed = newpredict;
                    }
                    data.LastPosition = unit.Position;
                    data.LastRotR     = unit.RotationRad;
                    data.Lasttick     = tick;
                }
            }
        }
Example #7
0
        /// <summary>
        ///     Tracks heroes movements
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        public static void SpeedTrack(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused)
            {
                return;
            }

            var me = ObjectManager.LocalHero;

            if (me == null)
            {
                return;
            }

            if (!Utils.SleepCheck("Prediction.SpeedTrack.Sleep"))
            {
                return;
            }

            if (playerList == null || (playerList.Count < 10 && Utils.SleepCheck("Prediction.SpeedTrack")))
            {
                playerList = Heroes.All;
                Utils.Sleep(1000, "Prediction.SpeedTrack");
            }

            if (!playerList.Any())
            {
                return;
            }

            Utils.Sleep(70, "Prediction.SpeedTrack.Sleep");
            var tick      = Environment.TickCount & int.MaxValue;
            var tempTable = new List <Prediction>(TrackTable);

            foreach (var unit in playerList.Where(x => x.IsValid))
            {
                var data =
                    tempTable.FirstOrDefault(
                        unitData => unitData.UnitName == unit.StoredName() || unitData.UnitClassId == unit.ClassID);
                if (data == null && unit.IsAlive && unit.IsVisible)
                {
                    data = new Prediction(
                        unit.StoredName(),
                        unit.ClassID,
                        new Vector3(0, 0, 0),
                        0,
                        new Vector3(0, 0, 0),
                        0,
                        0);
                    TrackTable.Add(data);
                }

                if (data != null && (!unit.IsAlive || !unit.IsVisible))
                {
                    data.LastPosition = new Vector3(0, 0, 0);
                    data.LastRotR     = 0;
                    data.Lasttick     = 0;
                    continue;
                }

                if (data == null || (data.LastPosition != new Vector3(0, 0, 0) && !(tick - data.Lasttick > 0)))
                {
                    continue;
                }

                if (data.LastPosition == new Vector3(0, 0, 0))
                {
                    data.LastPosition = unit.Position;
                    data.LastRotR     = unit.RotationRad;
                    data.Lasttick     = tick;
                }
                else
                {
                    data.RotSpeed = data.LastRotR - unit.RotationRad;
                    if (!RotTimeDictionary.ContainsKey(unit.Handle))
                    {
                        RotTimeDictionary.Add(unit.Handle, tick);
                    }

                    if (!lastRotRDictionary.ContainsKey(unit.Handle))
                    {
                        lastRotRDictionary.Add(unit.Handle, unit.RotationRad);
                    }

                    var speed = (unit.Position - data.LastPosition) / (tick - data.Lasttick);
                    if (Math.Abs(data.RotSpeed) > 0.18 && data.Speed != new Vector3(0, 0, 0))
                    {
                        data.Speed = speed;
                        RotTimeDictionary[unit.Handle] = tick;
                    }
                    else
                    {
                        lastRotRDictionary[unit.Handle] = unit.RotationRad;
                        data.Speed = speed;
                    }

                    data.LastPosition = unit.Position;
                    data.LastRotR     = unit.RotationRad;
                    data.Lasttick     = tick;
                    if (!SpeedDictionary.ContainsKey(unit.Handle))
                    {
                        SpeedDictionary.Add(unit.Handle, data.Speed);
                    }
                    else
                    {
                        SpeedDictionary[unit.Handle] = data.Speed;
                    }

                    if (!RotSpeedDictionary.ContainsKey(unit.Handle))
                    {
                        RotSpeedDictionary.Add(unit.Handle, data.RotSpeed);
                    }
                    else
                    {
                        RotSpeedDictionary[unit.Handle] = data.RotSpeed;
                    }
                }
            }
        }