示例#1
0
        public static PredictClass getPrediction(Hero me, Hero enemy, string Method)
        {
            var Angle = enemy.FindAngleR();
            PredictClass pre = new PredictClass();
            pre.PredictedLocation = Vector2.Zero;
            pre.closest = false;
            switch (Method)
            {
                case "one":
                    Vector2 StraightDis = /*enemy.Position;*/Drawing.WorldToScreen(enemy.Position); //Facing position line
                    StraightDis.X += (float)Math.Cos(Angle) * 100;
                    StraightDis.Y += (float)Math.Sin(Angle) * 100;
                    //
                    Vector2 me2D = Drawing.WorldToScreen(Variables.me.Position);
                    Vector2 enemy2D = Drawing.WorldToScreen(enemy.Position);
                    Vector2 enemyDirection2D = StraightDis;
                    var alpha1 = Math.Atan((me2D.Y - enemy2D.Y) / (me2D.X - enemy2D.X));
                    var alpha2 = Math.Atan((enemyDirection2D.Y - enemy2D.Y) / (enemyDirection2D.X - enemy2D.X));
                    var alpha = Math.Abs(alpha2 - alpha1);
                    var beta = Math.Asin((enemy.MovementSpeed / Variables.HookSpeed) * Math.Sin(alpha));
                    var distanceBetweenMeandEnemy = Variables.me.Distance2D(enemy.Position);
                    var time = (distanceBetweenMeandEnemy) / ((enemy.MovementSpeed * Math.Cos(alpha)) + (Variables.HookSpeed * Math.Cos(beta)));

                    // Print.Info(time.ToString());
                    var predictedDistance = enemy.MovementSpeed * time;
                    Vector2 StraightDis2D = Drawing.WorldToScreen(enemy.Position); //Facing position line
                    StraightDis2D.X += (float)Math.Cos(Angle) * (float)predictedDistance + (float)(enemy.MovementSpeed * Variables.me.Spellbook.Spell1.GetCastDelay(Variables.me, enemy));
                    StraightDis2D.Y += (float)Math.Sin(Angle) * ((float)predictedDistance + (float)(enemy.MovementSpeed * Variables.me.Spellbook.Spell1.GetCastDelay(Variables.me, enemy)));
                   // ESP.Draw.Enemy.PredictionBox(StraightDis2D, Color.Black);
                    pre.PredictedLocation = StraightDis2D;
                    return pre;

                    break;
                case "two":

                    //Previous prediction method
                    var tBase = 0.1;
                    var tIncrement = 0.1;
                    var enemyMovementSpeed = enemy.MovementSpeed;
                    if (enemy.Name == "npc_dota_hero_spirit_breaker")
                        foreach (var mod in enemy.Modifiers)
                            if (mod.Name.Contains("charge"))
                            {
                                tBase = 0.05;
                                tIncrement = 0.05;
                                enemyMovementSpeed = 550 + ((int)enemy.Spellbook.Spell1.Level * 50);
                            }
                    for (double t = tBase; t <= 1; t += tIncrement)
                    {
                        var dis = enemyMovementSpeed * t;
                        Vector2 StraightDis1 = /*enemy.Position;*/Drawing.WorldToScreen(enemy.Position); //Facing position line
                        StraightDis1.X += (float)Math.Cos(Angle) * (float)dis;
                        StraightDis1.Y += (float)Math.Sin(Angle) * (float)dis;
                        //
                        Vector3 StraightDis3D1 = enemy.Position; //Facing position line
                        StraightDis3D1.X += (float)Math.Cos(enemy.RotationRad) * ((float)dis + 120);
                        StraightDis3D1.Y += (float)Math.Sin(enemy.RotationRad) * ((float)dis + 120);
                        if (Variables.DeveloperMode)
                             Drawing.DrawText("***", Drawing.WorldToScreen(StraightDis3D1), Color.Red, FontFlags.None);
                        var DistanceFromMeToPredict = Variables.me.Distance2D(StraightDis3D1);

                        if (Variables.me.Spellbook.Spell1.AbilityState == AbilityState.Ready)
                        {
                            var foobar1 = DistanceFromMeToPredict / Variables.HookSpeed;
                            if (foobar1 >= t * .8 && foobar1 <= t * 1.2)
                            {
                                //  Print.Info(Drawing.WorldToScreen(StraightDis3D1).ToString() + " | " + StraightDis1.ToString());
                                if (Variables.Settings.Auto_Hook_Value.val == 0)
                                {
                                    if (Utils.SleepCheck("hook") && (Variables.HookForMe))
                                    {
                                        Print.Info("Casting Predicted Hook");
                                        Variables.HookingTarget = enemy.NetworkName;
                                        Variables.Hooking = true;
                                        if (DistanceFromMeToPredict > (Variables.me.Spellbook.Spell1.CastRange + 80 + Variables.AetherBonus))
                                            Variables.HookingStartedOOR = true;
                                        Variables.HookLocationDrawer = true;
                                        Variables.EnemyLocation = Drawing.WorldToScreen(enemy.Position);
                                        Variables.AutoHookLocation = Drawing.WorldToScreen(StraightDis3D1);
                                        Variables.PredictionLocation = StraightDis1;
                                        //
                                        if (Variables.DeveloperMode)
                                        {
                                            Variables.hookData.MyPos2D = Drawing.WorldToScreen(Variables.me.Position);
                                            Variables.hookData.MyPos3D = Variables.me.Position;
                                            Variables.hookData.Prediction2D = StraightDis1;
                                            Variables.hookData.Prediction3D = StraightDis3D1;
                                            Variables.hookData.Enabled = true;
                                        }
                                        //
                                        Variables.me.Spellbook.Spell1.UseAbility(StraightDis3D1); //Hook based on prediction location (buggy)'
                                      //  Print.Error("Does this shit even work?");
                                       // Variables.me.Spellbook.Spell1.CastSkillShot(enemy); //Ensage skill shot caster (temp solution untill fix)
                                      //  Print.Success("Must work?");

                                        Utils.Sleep(1000, "hook");
                                        Variables.HookForMe = false;
                                    }
                                    if (ESP.Calculate.Enemy.ClosestToMouse(me).Player.Name == enemy.Player.Name)
                                        pre.closest = true;
                                }
                                pre.PredictedLocation = StraightDis1;
                                return pre;
                                break;
                            }

                        }
                    }
                    return pre;
                    break;
            }
            return pre;
        }
示例#2
0
        public static PredictClass getPrediction(Hero me, Hero enemy, string Method)
        {
            var          Angle = enemy.FindAngleR();
            PredictClass pre   = new PredictClass();

            pre.PredictedLocation = Vector2.Zero;
            pre.closest           = false;
            switch (Method)
            {
            case "one":
                Vector2 StraightDis = /*enemy.Position;*/ Drawing.WorldToScreen(enemy.Position);    //Facing position line
                StraightDis.X += (float)Math.Cos(Angle) * 100;
                StraightDis.Y += (float)Math.Sin(Angle) * 100;
                //
                Vector2 me2D                      = Drawing.WorldToScreen(Variables.me.Position);
                Vector2 enemy2D                   = Drawing.WorldToScreen(enemy.Position);
                Vector2 enemyDirection2D          = StraightDis;
                var     alpha1                    = Math.Atan((me2D.Y - enemy2D.Y) / (me2D.X - enemy2D.X));
                var     alpha2                    = Math.Atan((enemyDirection2D.Y - enemy2D.Y) / (enemyDirection2D.X - enemy2D.X));
                var     alpha                     = Math.Abs(alpha2 - alpha1);
                var     beta                      = Math.Asin((enemy.MovementSpeed / Variables.HookSpeed) * Math.Sin(alpha));
                var     distanceBetweenMeandEnemy = Variables.me.Distance2D(enemy.Position);
                var     time                      = (distanceBetweenMeandEnemy) / ((enemy.MovementSpeed * Math.Cos(alpha)) + (Variables.HookSpeed * Math.Cos(beta)));

                // Print.Info(time.ToString());
                var     predictedDistance = enemy.MovementSpeed * time;
                Vector2 StraightDis2D     = Drawing.WorldToScreen(enemy.Position); //Facing position line
                StraightDis2D.X += (float)Math.Cos(Angle) * (float)predictedDistance + (float)(enemy.MovementSpeed * Variables.me.Spellbook.Spell1.GetCastDelay(Variables.me, enemy));
                StraightDis2D.Y += (float)Math.Sin(Angle) * ((float)predictedDistance + (float)(enemy.MovementSpeed * Variables.me.Spellbook.Spell1.GetCastDelay(Variables.me, enemy)));
                // ESP.Draw.Enemy.PredictionBox(StraightDis2D, Color.Black);
                pre.PredictedLocation = StraightDis2D;
                return(pre);

                break;

            case "two":

                //Previous prediction method
                var tBase              = 0.1;
                var tIncrement         = 0.1;
                var enemyMovementSpeed = enemy.MovementSpeed;
                if (enemy.Name == "npc_dota_hero_spirit_breaker")
                {
                    foreach (var mod in enemy.Modifiers)
                    {
                        if (mod.Name.Contains("charge"))
                        {
                            tBase              = 0.05;
                            tIncrement         = 0.05;
                            enemyMovementSpeed = 550 + ((int)enemy.Spellbook.Spell1.Level * 50);
                        }
                    }
                }
                for (double t = tBase; t <= 1; t += tIncrement)
                {
                    var     dis          = enemyMovementSpeed * t;
                    Vector2 StraightDis1 = /*enemy.Position;*/ Drawing.WorldToScreen(enemy.Position);    //Facing position line
                    StraightDis1.X += (float)Math.Cos(Angle) * (float)dis;
                    StraightDis1.Y += (float)Math.Sin(Angle) * (float)dis;
                    //
                    Vector3 StraightDis3D1 = enemy.Position;     //Facing position line
                    StraightDis3D1.X += (float)Math.Cos(enemy.RotationRad) * ((float)dis + 120);
                    StraightDis3D1.Y += (float)Math.Sin(enemy.RotationRad) * ((float)dis + 120);
                    if (Variables.DeveloperMode)
                    {
                        Drawing.DrawText("***", Drawing.WorldToScreen(StraightDis3D1), Color.Red, FontFlags.None);
                    }
                    var DistanceFromMeToPredict = Variables.me.Distance2D(StraightDis3D1);

                    if (Variables.me.Spellbook.Spell1.AbilityState == AbilityState.Ready)
                    {
                        var foobar1 = DistanceFromMeToPredict / Variables.HookSpeed;
                        if (foobar1 >= t * .8 && foobar1 <= t * 1.2)
                        {
                            //  Print.Info(Drawing.WorldToScreen(StraightDis3D1).ToString() + " | " + StraightDis1.ToString());
                            if (Variables.Settings.Auto_Hook_Value.val == 0)
                            {
                                if (Utils.SleepCheck("hook") && (Variables.HookForMe))
                                {
                                    Print.Info("casting hook");
                                    Variables.HookLocationDrawer = true;
                                    Variables.EnemyLocation      = Drawing.WorldToScreen(enemy.Position);
                                    Variables.AutoHookLocation   = Drawing.WorldToScreen(StraightDis3D1);
                                    Variables.PredictionLocation = StraightDis1;
                                    //Variables.me.Spellbook.Spell1.UseAbility(StraightDis3D1); //Hook based on prediction location (buggy)
                                    Variables.me.Spellbook.Spell1.CastSkillShot(enemy);     //Ensage skill shot caster (temp solution untill fix)
                                    Utils.Sleep(1000, "hook");
                                    Variables.HookForMe = false;
                                }
                                if (ESP.Calculate.Enemy.ClosestToMouse(me).Player.Name == enemy.Player.Name)
                                {
                                    pre.closest = true;
                                }
                            }
                            pre.PredictedLocation = StraightDis1;
                            return(pre);

                            break;
                        }
                    }
                }
                return(pre);

                break;
            }
            return(pre);
        }