Example #1
0
        public Kalista()
        {
            CreateMenu();
            LoadModules();
            CustomDamageIndicator.Initialize(Helper.GetRendDamage);
            Prediction.Initialize(Menu);
            Game.OnUpdate  += OnUpdate;
            Drawing.OnDraw += OnDraw;
            Obj_AI_Base.OnProcessSpellCast += OnProcessSpell;
            Spellbook.OnCastSpell          += (sender, args) =>
            {
                if (sender.Owner.IsMe && args.Slot == SpellSlot.Q && ObjectManager.Player.IsDashing())
                {
                    args.Process = false;
                }
            };
            Orbwalker.RegisterCustomMode("com.ikalista.flee", "Flee", "V".ToCharArray()[0]);
            Orbwalking.OnNonKillableMinion += minion =>
            {
                var killableMinion = minion as Obj_AI_Base;
                if (killableMinion == null || !SpellManager.Spell[SpellSlot.E].IsReady() ||
                    ObjectManager.Player.HasBuff("summonerexhaust") || !killableMinion.HasRendBuff())
                {
                    return;
                }

                if (Menu.Item("com.ikalista.laneclear.useEUnkillable").GetValue <bool>() &&
                    killableMinion.IsMobKillable())
                {
                    SpellManager.Spell[SpellSlot.E].Cast();
                }
            };
            Orbwalking.BeforeAttack += args =>
            {
                if (!Menu.Item("com.ikalista.misc.forceW").GetValue <bool>())
                {
                    return;
                }

                var target =
                    HeroManager.Enemies.FirstOrDefault(
                        x => ObjectManager.Player.Distance(x) <= 600 && x.HasBuff("kalistacoopstrikemarkally"));
                if (target != null)
                {
                    Orbwalker.ForceTarget(target);
                }
            };
        }
 public static float AvgMovChangeTime(this AIHeroClient t)
 {
     Prediction.AssertInitializationMode();
     return(PathTracker.EnemyInfo[t.NetworkId].AvgTick + ConfigMenu.IgnoreReactionDelay);
 }
 public static int LastMovChangeTime(this AIHeroClient t)
 {
     Prediction.AssertInitializationMode();
     return(Environment.TickCount - PathTracker.EnemyInfo[t.NetworkId].LastWaypointTick);
 }
 public static int MovImmobileTime(this AIHeroClient t)
 {
     Prediction.AssertInitializationMode();
     return(PathTracker.EnemyInfo[t.NetworkId].IsStopped ? Environment.TickCount - PathTracker.EnemyInfo[t.NetworkId].StopTick : 0);
 }
Example #5
0
        /// <summary>
        /// Gets prediction result
        /// </summary>
        /// <param name="target">Target</param>
        /// <param name="width">Vector width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="vectorSpeed">Vector speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <param name="path">Waypoints of target</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.Vector.Result"/></returns>
        public static Result GetPrediction(Obj_AI_Base target, float width, float delay, float vectorSpeed, float range, float vectorLenght, List <Vector2> path, float avgt, float movt, float avgp, Vector2 rangeCheckFrom)
        {
            Prediction.AssertInitializationMode();

            Result result = new Result();

            //auto aoe hit (2 hits with using one target as from position)
            if (target.IsChampion())                                                                                                                                                                                                                                                                                                                                                                        //do these calcs if champion kappa
            {
                if (ObjectManager.Player.CountEnemiesInRange(range) > 0 && ObjectManager.Player.CountEnemiesInRange(range + vectorLenght) > 1)                                                                                                                                                                                                                                                              //if there is at least 1 enemy in range && at least 2 enemy which laser can hit
                {
                    Vector2 predPos1 = Prediction.GetFastUnitPosition(target, delay);                                                                                                                                                                                                                                                                                                                       //get target unit position after delay
                    foreach (var enemy in HeroManager.Enemies)                                                                                                                                                                                                                                                                                                                                              //loop all enemies
                    {
                        if (enemy.NetworkId != target.NetworkId && enemy.Distance(rangeCheckFrom) < range + vectorLenght)                                                                                                                                                                                                                                                                                   //if enemy is not given target and enemy is hitable by laser
                        {
                            Vector2 predPos2 = Prediction.GetFastUnitPosition(enemy, delay);                                                                                                                                                                                                                                                                                                                //get enemy unit position after delay
                            if (predPos1.Distance(rangeCheckFrom) < range)                                                                                                                                                                                                                                                                                                                                  //if target is in range
                            {
                                Prediction.Result predRes = LinePrediction.GetPrediction(enemy, width, delay, vectorSpeed, vectorLenght, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), 360, predPos1 - (predPos1 - rangeCheckFrom).Normalized().Perpendicular() * 30, predPos1 - (predPos1 - rangeCheckFrom).Normalized().Perpendicular() * 30); //get enemy prediciton with from = target's position (a bit backward)
                                if (predRes.HitChance >= HitChance.Low)
                                {
                                    return(predRes.AsVectorResult(predPos1 - (predPos1 - rangeCheckFrom).Normalized().Perpendicular() * 30));
                                }
                            }
                            else if (predPos2.Distance(rangeCheckFrom) < range)                                                                                                                                                                                                                                                    //if enemy is in range
                            {
                                Prediction.Result predRes = LinePrediction.GetPrediction(target, width, delay, vectorSpeed, vectorLenght, false, path, avgt, movt, avgp, 360, predPos2 - (predPos2 - rangeCheckFrom).Normalized().Perpendicular() * 30, predPos2 - (predPos2 - rangeCheckFrom).Normalized().Perpendicular() * 30); //get target prediction with from = enemy's position (a bit backward)
                                if (predRes.HitChance >= HitChance.Low)
                                {
                                    return(predRes.AsVectorResult(predPos2 - (predPos2 - rangeCheckFrom).Normalized().Perpendicular() * 30));
                                }
                            }
                        }
                    }
                }
            }

            Vector2 immobileFrom = rangeCheckFrom + (target.ServerPosition.To2D() - rangeCheckFrom).Normalized() * range;

            if (path.Count <= 1) //if target is not moving, easy to hit
            {
                result.HitChance          = HitChance.VeryHigh;
                result.CastSourcePosition = immobileFrom;
                result.CastTargetPosition = target.ServerPosition.To2D();
                result.UnitPosition       = result.CastTargetPosition;
                result.CollisionResult    = Collision.GetCollisions(immobileFrom, result.CastTargetPosition, range, width, delay, vectorSpeed);

                if (immobileFrom.Distance(result.CastTargetPosition) > vectorLenght - Prediction.GetArrivalTime(immobileFrom.Distance(result.CastTargetPosition), delay, vectorSpeed) * target.MoveSpeed)
                {
                    result.HitChance = HitChance.OutOfRange;
                }

                return(result);
            }

            if (target is AIHeroClient)
            {
                if (((AIHeroClient)target).IsChannelingImportantSpell())
                {
                    result.HitChance          = HitChance.VeryHigh;
                    result.CastSourcePosition = immobileFrom;
                    result.CastTargetPosition = target.ServerPosition.To2D();
                    result.UnitPosition       = result.CastTargetPosition;
                    result.CollisionResult    = Collision.GetCollisions(immobileFrom, result.CastTargetPosition, range, width, delay, vectorSpeed);

                    //check if target can dodge with moving backward
                    if (immobileFrom.Distance(result.CastTargetPosition) > range - Prediction.GetArrivalTime(immobileFrom.Distance(result.CastTargetPosition), delay, vectorSpeed) * target.MoveSpeed)
                    {
                        result.HitChance = HitChance.OutOfRange;
                    }

                    return(result);
                }

                //to do: find a fuking logic
                if (avgp < 400 && movt < 100)
                {
                    result.HitChance          = HitChance.High;
                    result.CastTargetPosition = target.ServerPosition.To2D();
                    result.CastSourcePosition = immobileFrom;
                    result.UnitPosition       = result.CastTargetPosition;
                    result.CollisionResult    = Collision.GetCollisions(immobileFrom, result.CastTargetPosition, range, width, delay, vectorSpeed);

                    //check if target can dodge with moving backward
                    if (immobileFrom.Distance(result.CastTargetPosition) > range - Prediction.GetArrivalTime(immobileFrom.Distance(result.CastTargetPosition), delay, vectorSpeed) * target.MoveSpeed)
                    {
                        result.HitChance = HitChance.OutOfRange;
                    }

                    return(result);
                }
            }

            if (target.IsDashing())
            {
                return(Prediction.GetDashingPrediction(target, width, delay, vectorSpeed, range, false, SkillshotType.SkillshotLine, immobileFrom, rangeCheckFrom).AsVectorResult(immobileFrom));
            }

            if (SPrediction.Utility.IsImmobileTarget(target))
            {
                return(Prediction.GetImmobilePrediction(target, width, delay, vectorSpeed, range, false, SkillshotType.SkillshotLine, immobileFrom, rangeCheckFrom).AsVectorResult(immobileFrom));
            }

            for (int i = 0; i < path.Count - 1; i++)
            {
                Vector2 point = Vector2.Zero;
                if (path[i].Distance(ObjectManager.Player.ServerPosition) < range)
                {
                    point = path[i];
                }
                else
                {
                    point = Geometry.ClosestCirclePoint(rangeCheckFrom, range, path[i]);
                }

                Prediction.Result res = Prediction.WaypointAnlysis(target, width, delay, vectorSpeed, vectorLenght, false, SkillshotType.SkillshotLine, path, avgt, movt, avgp, 360, point);
                res.Lock();
                if (res.HitChance >= HitChance.Low)
                {
                    return(res.AsVectorResult(point));
                }
            }

            result.CastSourcePosition = immobileFrom;
            result.CastTargetPosition = target.ServerPosition.To2D();
            result.HitChance          = HitChance.Impossible;
            return(result);
        }
Example #6
0
        /// <summary>
        /// Champion constructor
        /// </summary>
        /// <param name="szChampName">The champion name.</param>
        /// <param name="szMenuName">The menu name.</param>
        /// <param name="enableRangeDrawings">if <c>true</c>, enables the spell range drawings</param>
        /// <param name="enableEvader">if <c>true</c>, enables the spell evader if the champion is supported</param>
        public Champion(string szChampName, string szMenuName, bool enableRangeDrawings = true, bool enableEvader = true)
        {
            Text = new Font(Drawing.Direct3DDevice,
                            new FontDescription
            {
                FaceName        = "Malgun Gothic",
                Height          = 15,
                OutputPrecision = FontPrecision.Default,
                Quality         = FontQuality.ClearTypeNatural
            });

            TargetSelector.Initialize(ConfigMenu);

            SetSpells();

            if (enableEvader)
            {
                Menu   evaderMenu = null;
                Evader evader;
                switch (szChampName.ToLower())
                {
                case "ezreal":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Blink, Spells[E]);
                    break;

                case "sivir":
                case "morgana":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.SpellShield, Spells[E]);
                    break;

                case "fizz":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Dash, Spells[E]);
                    break;

                case "lissandra":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Invulnerability, Spells[R]);
                    break;

                case "nocturne":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.SpellShield, Spells[W]);
                    break;

                case "vladimir":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Invulnerability, Spells[W]);
                    break;

                case "graves":
                case "gnar":
                case "lucian":
                case "riven":
                case "shen":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Dash, Spells[E]);
                    break;

                case "zed":
                case "leblanc":
                case "corki":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Dash, Spells[W]);
                    break;

                case "vayne":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Dash, Spells[Q]);
                    break;
                }
            }

            #region Events
            Game.OnUpdate                      += this.Game_OnUpdate;
            Drawing.OnDraw                     += this.Drawing_OnDraw;
            Orbwalker.OnPreAttack              += this.OrbwalkingEvents_BeforeAttack;
            Orbwalker.OnPostAttack             += this.OrbwalkingEvents_AfterAttack;
            AntiGapcloser.OnEnemyGapcloser     += this.AntiGapcloser_OnEnemyGapcloser;
            Interrupter2.OnInterruptableTarget += this.Interrupter_OnPossibleToInterrupt;
            Obj_AI_Base.OnBuffGain             += this.Obj_AI_Base_OnBuffAdd;
            Obj_AI_Base.OnProcessSpellCast     += this.Obj_AI_Base_OnProcessSpellCast;
            CustomEvents.Unit.OnDash           += this.Unit_OnDash;
            TargetedSpellDetector.OnDetected   += this.TargetedSpellDetector_OnDetected;
            #endregion

            Prediction.Initialize();
        }
Example #7
0
        /// <summary>
        /// Gets collided units & flags
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Rectangle scale</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <returns>Collision result as <see cref="Collision.Result"/></returns>
        public static Result GetCollisions(Vector2 from, Vector2 to, float range, float width, float delay, float missileSpeed = 0, bool isArc = false)
        {
            List <Obj_AI_Base> collidedUnits = new List <Obj_AI_Base>();
            var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to.LSExtend(from, -width), width));

            if (isArc)
            {
                spellHitBox = ClipperWrapper.MakePaths(new SPrediction.Geometry.Polygon(
                                                           ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.LSDistance(from) / 900), 410, 200 * (to.LSDistance(from) / 900)),
                                                           ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.LSDistance(from) / 900), 410, 320 * (to.LSDistance(from) / 900))));
            }
            Flags _colFlags       = Flags.None;
            var   collidedMinions = MinionManager.GetMinions(range + 100, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None).AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius + 15)), spellHitBox));
            var   collidedEnemies = HeroManager.Enemies.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox));
            var   collidedAllies  = HeroManager.Allies.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox));

            if (collidedMinions != null && collidedMinions.Count() != 0)
            {
                collidedUnits.AddRange(collidedMinions);
                _colFlags |= Flags.Minions;
            }

            if (collidedEnemies != null && collidedEnemies.Count() != 0)
            {
                collidedUnits.AddRange(collidedEnemies);
                _colFlags |= Flags.EnemyChampions;
            }

            if (collidedAllies != null && collidedAllies.Count() != 0)
            {
                collidedUnits.AddRange(collidedAllies);
                _colFlags |= Flags.AllyChampions;
            }

            if (CheckWallCollision(from, to))
            {
                _colFlags |= Flags.Wall;
            }

            if (CheckYasuoWallCollision(from, to, width))
            {
                _colFlags |= Flags.YasuoWall;
            }

            return(new Result(collidedUnits, _colFlags));
        }
Example #8
0
 /// <summary>
 /// Gets Prediction result
 /// </summary>
 /// <param name="target">Target for spell</param>
 /// <param name="width">Spell width</param>
 /// <param name="delay">Spell delay</param>
 /// <param name="missileSpeed">Spell missile speed</param>
 /// <param name="range">Spell range</param>
 /// <param name="collisionable">Spell collisionable</param>
 /// <param name="type">Spell skillshot type</param>
 /// <param name="path">Waypoints of target</param>
 /// <param name="avgt">Average reaction time (in ms)</param>
 /// <param name="movt">Passed time from last movement change (in ms)</param>
 /// <param name="avgp">Average Path Lenght</param>
 /// <param name="from">Spell casted position</param>
 /// <param name="rangeCheckFrom"></param>
 /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
 public static Prediction.Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, List <Vector2> path, float avgt, float movt, float avgp, Vector2 from, Vector2 rangeCheckFrom)
 {
     return(Prediction.GetPrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotLine, path, avgt, movt, avgp, from, rangeCheckFrom));
 }
Example #9
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static Prediction.AoeResult GetAoePrediction(float width, float delay, float missileSpeed, float range, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AoeResult result = new Prediction.AoeResult();
            result.HitCount = 0;
            var enemies = HeroManager.Enemies.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, from).Distance(rangeCheckFrom) < range);

            foreach (AIHeroClient enemy in enemies)
            {
                Prediction.Result prediction = GetPrediction(enemy, width, delay, missileSpeed, range, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), enemy.LastAngleDiff(), from, rangeCheckFrom);
                if (prediction.HitChance > HitChance.Medium)
                {
                    Vector2 to              = from + (prediction.CastPosition - from).Normalized() * range;
                    var     spellHitBox     = ClipperWrapper.DefineSector(from, to, width, range);
                    var     collidedEnemies = HeroManager.Enemies.AsParallel().Where(p => !ClipperWrapper.IsOutside(spellHitBox, Prediction.GetFastUnitPosition(p, delay, missileSpeed, from)));
                    int     collisionCount  = collidedEnemies.Count();
                    if (collisionCount > result.HitCount)
                    {
                        result = prediction.ToAoeResult(collisionCount, new Collision.Result(collidedEnemies.ToList <Obj_AI_Base>(), Collision.Flags.EnemyChampions));
                    }
                }
            }

            return(result);
        }
Example #10
0
        /// <summary>
        /// Checks enemy hero collisions
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Rectangle scale</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="isArc">Checks collision for arc spell</param>
        /// <returns>true if collision found</returns>
        public static bool CheckAllyHeroCollision(Vector2 from, Vector2 to, float width, float delay, float missileSpeed = 0, bool isArc = false)
        {
            var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to, width));

            if (isArc)
            {
                spellHitBox = ClipperWrapper.MakePaths(new SPrediction.Geometry.Polygon(
                                                           ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.LSDistance(from) / 900), 410, 200 * (to.LSDistance(from) / 900)),
                                                           ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float)Math.PI * (to.LSDistance(from) / 900), 410, 320 * (to.LSDistance(from) / 900))));
            }
            return(HeroManager.Allies.AsParallel().Any(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), spellHitBox)));
        }
 public static float AvgMovChangeTime(this Obj_AI_Hero t)
 {
     Prediction.AssertInitializationMode();
     return(PathTracker.EnemyInfo[t.NetworkId].AvgTick + Prediction.IgnoreReactionDelay);
 }
Example #12
0
        /// <summary>
        /// Checks minion collisions
        /// </summary>
        /// <param name="from">Start position</param>
        /// <param name="to">End position</param>
        /// <param name="width">Rectangle scale</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="isArc">Checks collision for arc spell</param>
        /// <returns>true if collision found</returns>
        public static bool CheckMinionCollision(Vector2 from, Vector2 to, float width, float delay, float missileSpeed = 0, bool isArc = false)
        {
            var spellHitBox = ClipperWrapper.MakePaths(ClipperWrapper.DefineRectangle(from, to, width));

            if (isArc)
            {
                spellHitBox = ClipperWrapper.MakePaths(new SPrediction.Geometry.Polygon(
                                                           ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 875f), 410, 200 * (to.Distance(from) / 875f)),
                                                           ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), to, (float)Math.PI * (to.Distance(from) / 875f), 410, 320 * (to.Distance(from) / 875f))));
            }
            return(MinionManager.GetMinions(from.Distance(to) + 250, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None).AsParallel().Any(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius * 2f + 10f)), spellHitBox)));
        }
Example #13
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="vectorSpeed">Vector speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="vectorLenght">Vector lenght</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static AoeResult GetAoePrediction(float width, float delay, float vectorSpeed, float range, float vectorLenght, Vector2 rangeCheckFrom)
        {
            AoeResult result  = new AoeResult();
            var       enemies = HeroManager.Enemies.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, rangeCheckFrom).Distance(rangeCheckFrom) < range);

            foreach (AIHeroClient enemy in enemies)
            {
                List <Vector2> path = enemy.GetWaypoints();
                if (path.Count <= 1)
                {
                    Vector2          from      = rangeCheckFrom + (enemy.ServerPosition.To2D() - rangeCheckFrom).Normalized() * range;
                    Vector2          to        = from + (enemy.ServerPosition.To2D() - from).Normalized() * vectorLenght;
                    Collision.Result colResult = Collision.GetCollisions(from, to, range, width, delay, vectorSpeed);

                    if (colResult.Objects.HasFlag(Collision.Flags.EnemyChampions))
                    {
                        int collisionCount = colResult.Units.Count(p => p.IsEnemy && p.IsChampion());
                        if (collisionCount > result.HitCount)
                        {
                            result = new AoeResult
                            {
                                CastSourcePosition = from,
                                CastTargetPosition = enemy.ServerPosition.To2D(),
                                HitCount           = collisionCount,
                                CollisionResult    = colResult
                            };
                        }
                    }
                }
                else
                {
                    if (!enemy.IsDashing())
                    {
                        for (int i = 0; i < path.Count - 1; i++)
                        {
                            Vector2           point      = Geometry.ClosestCirclePoint(rangeCheckFrom, range, path[i]);
                            Prediction.Result prediction = Prediction.GetPrediction(enemy, width, delay, vectorSpeed, vectorLenght, false, SkillshotType.SkillshotLine, path, enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), enemy.LastAngleDiff(), point, rangeCheckFrom);
                            if (prediction.HitChance > HitChance.Medium)
                            {
                                Vector2          to        = point + (prediction.CastPosition - point).Normalized() * vectorLenght;
                                Collision.Result colResult = Collision.GetCollisions(point, to, range, width, delay, vectorSpeed, false);
                                if (colResult.Objects.HasFlag(Collision.Flags.EnemyChampions))
                                {
                                    int collisionCount = colResult.Units.Count(p => p.IsEnemy && p.IsChampion());
                                    if (collisionCount > result.HitCount)
                                    {
                                        result = new AoeResult
                                        {
                                            CastSourcePosition = point,
                                            CastTargetPosition = prediction.CastPosition,
                                            HitCount           = collisionCount,
                                            CollisionResult    = colResult
                                        };
                                    }
                                }
                            }
                        }
                    }
                }
            }
            return(result);
        }
Example #14
0
 public static float AvgPathLenght(this AIHeroClient t)
 {
     Prediction.AssertInitializationMode();
     return(PathTracker.EnemyInfo[t.NetworkId].AvgPathLenght);
 }
Example #15
0
        /// <summary>
        /// Gets Aoe Prediction result
        /// </summary>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.AoeResult"/></returns>
        public static Prediction.AoeResult GetAoePrediction(float width, float delay, float missileSpeed, float range, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AoeResult result = new Prediction.AoeResult();
            var enemies = HeroManager.Enemies.Where(p => p.IsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, from).Distance(rangeCheckFrom) < range);

            foreach (AIHeroClient enemy in enemies)
            {
                Prediction.Result prediction = GetPrediction(enemy, width, delay, missileSpeed, range, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), enemy.LastAngleDiff(), from, rangeCheckFrom);
                if (prediction.HitChance > HitChance.Medium)
                {
                    float multp = (result.CastPosition.Distance(from) / 875.0f);

                    var spellHitBox = new SPrediction.Geometry.Polygon(
                        ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), result.CastPosition, (float)Math.PI * multp, 410, 200 * multp),
                        ClipperWrapper.DefineArc(from - new Vector2(875 / 2f, 20), result.CastPosition, (float)Math.PI * multp, 410, 320 * multp));

                    var collidedEnemies = HeroManager.Enemies.AsParallel().Where(p => ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(ClipperWrapper.DefineCircle(Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), ClipperWrapper.MakePaths(spellHitBox)));
                    int collisionCount  = collidedEnemies.Count();
                    if (collisionCount > result.HitCount)
                    {
                        result = prediction.ToAoeResult(collisionCount, new Collision.Result(collidedEnemies.ToList <Obj_AI_Base>(), Collision.Flags.EnemyChampions));
                    }
                }
            }

            return(result);
        }
Example #16
0
 public static float LastAngleDiff(this AIHeroClient t)
 {
     Prediction.AssertInitializationMode();
     return(PathTracker.EnemyInfo[t.NetworkId].LastAngleDiff);
 }
Example #17
0
        /// <summary>
        /// Gets Prediction result
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="path">Waypoints of target</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        public static Prediction.Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, List <Vector2> path, float avgt, float movt, float avgp, float anglediff, Vector2 from, Vector2 rangeCheckFrom, bool arconly = true)
        {
            Prediction.AssertInitializationMode();

            if (arconly)
            {
                if (target.Distance(from) < width || target.Distance(from) > range * 0.75f)
                {
                    return(CirclePrediction.GetPrediction(target, width, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, from, rangeCheckFrom));
                }

                var pred = LinePrediction.GetPrediction(target, 80f, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, from, rangeCheckFrom);
                if (pred.HitChance >= HitChance.Low)
                {
                    pred.CastPosition = (from + (pred.CastPosition - from).Normalized() * range);
                    float cos = (float)Math.Cos((1 - pred.UnitPosition.Distance(from) / 820f) * Math.PI / 2);
                    float sin = (float)Math.Sin((1 - pred.UnitPosition.Distance(from) / 820f) * Math.PI / 2);
                    float x   = cos * (pred.CastPosition.X - from.X) - sin * (pred.CastPosition.Y - from.Y) + from.X;
                    float y   = sin * (pred.CastPosition.X - from.X) + cos * (pred.CastPosition.Y - from.Y) + from.Y;
                    pred.CastPosition = new Vector2(x, y);
                }

                return(pred);
            }
            else
            {
                Prediction.Result result = new Prediction.Result();

                if (path.Count <= 1) //if target is not moving, easy to hit
                {
                    result.HitChance    = HitChance.Immobile;
                    result.CastPosition = target.ServerPosition.To2D();
                    result.UnitPosition = result.CastPosition;
                    return(result);
                }

                if (target is AIHeroClient && ((AIHeroClient)target).IsChannelingImportantSpell())
                {
                    result.HitChance    = HitChance.Immobile;
                    result.CastPosition = target.ServerPosition.To2D();
                    result.UnitPosition = result.CastPosition;
                    return(result);
                }

                if (Utility.IsImmobileTarget(target))
                {
                    return(Prediction.GetImmobilePrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, from, rangeCheckFrom));
                }

                if (target.IsDashing())
                {
                    return(Prediction.GetDashingPrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, from, rangeCheckFrom));
                }

                float targetDistance = rangeCheckFrom.Distance(target.ServerPosition);
                float flyTime        = 0f;

                if (missileSpeed != 0)
                {
                    Vector2 Vt = (path[path.Count - 1] - path[0]).Normalized() * target.MoveSpeed;
                    Vector2 Vs = (target.ServerPosition.To2D() - rangeCheckFrom).Normalized() * missileSpeed;
                    Vector2 Vr = Vs - Vt;

                    flyTime = targetDistance / Vr.Length();

                    if (path.Count > 5)
                    {
                        flyTime = targetDistance / missileSpeed;
                    }
                }

                float t = flyTime + delay + Game.Ping / 2000f + ConfigMenu.SpellDelay / 1000f;

                result.HitChance = Prediction.GetHitChance(t * 1000f, avgt, movt, avgp, anglediff);

                #region arc collision test
                if (result.HitChance > HitChance.Low)
                {
                    for (int i = 1; i < path.Count; i++)
                    {
                        Vector2 senderPos = rangeCheckFrom;
                        Vector2 testPos   = path[i];

                        float multp = (testPos.Distance(senderPos) / 875.0f);

                        var dianaArc = new SPrediction.Geometry.Polygon(
                            ClipperWrapper.DefineArc(senderPos - new Vector2(875 / 2f, 20), testPos, (float)Math.PI * multp, 410, 200 * multp),
                            ClipperWrapper.DefineArc(senderPos - new Vector2(875 / 2f, 20), testPos, (float)Math.PI * multp, 410, 320 * multp));

                        if (!ClipperWrapper.IsOutside(dianaArc, target.ServerPosition.To2D()))
                        {
                            result.HitChance    = HitChance.VeryHigh;
                            result.CastPosition = testPos;
                            result.UnitPosition = testPos;
                            return(result);
                        }
                    }
                }
                #endregion

                return(CirclePrediction.GetPrediction(target, width, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, from, rangeCheckFrom));
            }
        }
Example #18
0
        private void GameOnGameLoad(EventArgs args)
        {
            if (Player.ChampionName != "Rumble")
            {
                return;
            }

            #region Spells && Items

            Q = new Spell(SpellSlot.Q, 600f);
            W = new Spell(SpellSlot.W);
            E = new Spell(SpellSlot.E, 850f);
            R = new Spell(SpellSlot.R, 1700f);
            Q.SetSkillshot(0.5f, 120f, 1300f, false, SkillshotType.SkillshotCone);
            E.SetSkillshot(0.5f, 50f, 2000f, true, SkillshotType.SkillshotLine);
            R.SetSkillshot(0.5f, 200f, 1500f, false, SkillshotType.SkillshotLine);
            GLP800    = new Items.Item(3030, 800f);
            Protobelt = new Items.Item(3152, 850f);

            #endregion

            #region Config

            Config = new Menu("SurvivorRumble", "SurvivorRumble", true).SetFontStyle(FontStyle.Bold, Color.Chartreuse);

            var OrbwalkerMenu = Config.AddSubMenu(new Menu(":: Orbwalker", "Orbwalker"));
            Orbwalker = new Orbwalking.Orbwalker(OrbwalkerMenu);

            var TargetSelectorMenu = Config.AddSubMenu(new Menu(":: Target Selector", "TargetSelector"));

            TargetSelector.AddToMenu(TargetSelectorMenu);

            #endregion

            #region Config Items

            var ComboMenu = Config.AddSubMenu(new Menu(":: Combo", "Combo"));
            ComboMenu.AddItem(new MenuItem("ComboUseQ", "Use Q").SetValue(true));
            ComboMenu.AddItem(new MenuItem("ComboUseW", "Use W").SetValue(true));
            ComboMenu.AddItem(new MenuItem("ComboUseE", "Use E").SetValue(true));
            ComboMenu.AddItem(new MenuItem("ComboUseRSolo", "Use R on 1vs1").SetValue(true));
            ComboMenu.AddItem(new MenuItem("ComboUseItems", "Use Items?").SetValue(true));
            //ComboMenu.AddItem(
            //    new MenuItem("UseSmartCastingADC", "Use R Only if it'll land first on ADC?").SetValue(false));
            ComboMenu.AddItem(new MenuItem("ComboCastUltimate", "[Insta] Cast Ultimate Key"))
            .SetValue(new KeyBind('T', KeyBindType.Press)).Permashow(true, "[Insta Ult Active?]");
            ComboMenu.AddItem(
                new MenuItem("SemiManualR", "Semi-Manual R Casting?").SetValue(true)
                .SetTooltip("True - Script will Auto R | False - You will R when you decide - preferably",
                            Color.Chartreuse));
            //ComboMenu.AddItem(
            //    new MenuItem("ComboMinimumRTargets", "Minimum Enemies to hit before casting Ultimate?").SetValue(
            //        new Slider(2, 1, HeroManager.Enemies.Count)));

            var LaneClearMenu = Config.AddSubMenu(new Menu(":: LaneClear", "LaneClear"));
            LaneClearMenu.AddItem(new MenuItem("LaneClearQ", "Use Q").SetValue(true));
            LaneClearMenu.AddItem(new MenuItem("LaneClearE", "Use E").SetValue(false));
            LaneClearMenu.AddItem(
                new MenuItem("LaneClearManaManager", "LaneClear Mana Manager").SetValue(new Slider(0, 0, 100)));
            LaneClearMenu.AddItem(
                new MenuItem("MinimumQMinions", "Minimum Minions Near You To Use Q?").SetValue(new Slider(2, 1, 10)));

            var JungleClearMenu = Config.AddSubMenu(new Menu(":: JungleClear", "JungleClear"));
            JungleClearMenu.AddItem(new MenuItem("JungleClearQ", "Use Q").SetValue(true));
            JungleClearMenu.AddItem(new MenuItem("JungleClearE", "Use E").SetValue(true));

            var LastHitMenu = Config.AddSubMenu(new Menu(":: LastHit", "LastHit"));
            LastHitMenu.AddItem(new MenuItem("LastHitE", "Use E").SetValue(true));
            LastHitMenu.AddItem(
                new MenuItem("LastHitManaManager", "LastHit Mana Manager").SetValue(new Slider(0, 0, 100)));

            var HarassMenu = Config.AddSubMenu(new Menu(":: Harass", "Harass"));
            HarassMenu.AddItem(new MenuItem("HarassQ", "Use Q").SetValue(true));
            HarassMenu.AddItem(new MenuItem("HarassE", "Use E").SetValue(true));
            HarassMenu.AddItem(new MenuItem("HarassItems", "Use Items (GLP/Protobelt)").SetValue(true));
            HarassMenu.AddItem(
                new MenuItem("HarassManaManager", "Harass Mana Manager").SetValue(new Slider(0, 0, 100)));

            var KillStealMenu = Config.AddSubMenu(new Menu(":: Killsteal", "Killsteal"));
            KillStealMenu.AddItem(new MenuItem("EnableKS", "Enable Killsteal?").SetValue(true));
            KillStealMenu.AddItem(new MenuItem("KSQ", "KS with Q?").SetValue(true));
            KillStealMenu.AddItem(new MenuItem("KSE", "KS with E?").SetValue(true));
            //KillStealMenu.AddItem(new MenuItem("KSR", "KS with R?").SetValue(true)); // Later
            KillStealMenu.AddItem(new MenuItem("KSItems", "KS with Items?").SetValue(true));

            var DrawingMenu = Config.AddSubMenu(new Menu(":: Drawings", "Drawings"));
            DrawingMenu.AddItem(new MenuItem("DrawQ", "Draw Q Range").SetValue(true));
            DrawingMenu.AddItem(new MenuItem("DrawE", "Draw E Range").SetValue(true));
            DrawingMenu.AddItem(new MenuItem("DrawR", "Draw R Range").SetValue(true));
            DrawingMenu.AddItem(new MenuItem("DrawRCast", "Draw R Cast Location").SetValue(true));
            DrawingMenu.AddItem(new MenuItem("drawKickPos", "Ultimate Cast Position"))
            .SetValue(new Circle(true, System.Drawing.Color.DeepPink));
            DrawingMenu.AddItem(new MenuItem("drawKickLine", "Ultimate Line Direction"))
            .SetValue(new Circle(true, System.Drawing.Color.Chartreuse));
            DrawingMenu.AddItem(new MenuItem("drawRTarget", "Desired Target"))
            .SetValue(new Circle(true, System.Drawing.Color.LimeGreen));

            #region Skin Changer

            /*var SkinChangerMenu =
             *  Config.AddSubMenu(new Menu(":: Skin Changer", "SkinChanger").SetFontStyle(FontStyle.Bold,
             *      Color.Chartreuse));
             * var SkinChanger =
             *  SkinChangerMenu.AddItem(
             *      new MenuItem("UseSkinChanger", ":: Use SkinChanger?").SetValue(true)
             *          .SetFontStyle(FontStyle.Bold, Color.Crimson));
             * var SkinID =
             *  SkinChangerMenu.AddItem(
             *      new MenuItem("SkinID", ":: Skin").SetValue(new StringList(new[] {"Classic", "Candy King Rumble"}, 0))
             *          .SetFontStyle(FontStyle.Bold, Color.Crimson));
             * SkinID.ValueChanged += (sender, eventArgs) =>
             * {
             *  if (!SkinChanger.GetValue<bool>())
             *      return;
             *
             *  //Player.SetSkin(Player.BaseSkinName, eventArgs.GetNewValue<StringList>().SelectedIndex);
             * };*/

            #endregion

            var MiscMenu = Config.AddSubMenu(new Menu(":: Settings", "Settings"));
            MiscMenu.AddItem(
                new MenuItem("HitChance", "Hit Chance").SetValue(new StringList(new[] { "Medium", "High", "Very High" }, 1)));
            var PredictionVar = MiscMenu.AddItem(
                new MenuItem("Prediction", "Prediction:").SetValue(new StringList(
                                                                       new[] { "Common", "OKTW", "SPrediction" }, 1)));
            if (PredictionVar.GetValue <StringList>().SelectedIndex == 2)
            {
                if (!SPredictionLoaded)
                {
                    Prediction.Initialize(MiscMenu, "SPrediction Settings");
                    var SPreditctionLoaded =
                        MiscMenu.AddItem(new MenuItem("SPredictionLoaded", "SPrediction Loaded!"));
                    SPredictionLoaded = true;
                }
            }
            PredictionVar.ValueChanged += (sender, eventArgs) =>
            {
                if (eventArgs.GetNewValue <StringList>().SelectedIndex == 2)
                {
                    if (!SPredictionLoaded)
                    {
                        Prediction.Initialize(MiscMenu, "SPrediction Settings");
                        var SPreditctionLoaded =
                            MiscMenu.AddItem(new MenuItem("SPredictionLoaded", "SPrediction Loaded!"));
                        Chat.Print(
                            "<font color='#0993F9'>[SS Rumble Warning]</font> <font color='#FF8800'>Please exit the menu and click back on it again, to see the settings or Reload (F5)</font>");

                        SPredictionLoaded = true;
                    }
                }
            };
            MiscMenu.AddItem(new MenuItem("UseWNearbyEnemy", "[Auto] Use (W) Nearby Enemies").SetValue(false));
            MiscMenu.AddItem(new MenuItem("EnableMouseScroll", "Enable Mouse Scroll to Store Heat?").SetValue(true));
            MiscMenu.AddItem(
                new MenuItem("EnableStoreHeat", "Enable Storing Heat?").SetValue(false)
                .SetTooltip("You either change the value here by clicking or by Scrolling Down using the mouse"))
            .Permashow(true, "Storing Heat?");

            #region DrawDamage

            var drawdamage = DrawingMenu.AddSubMenu(new Menu(":: Draw Damage", "drawdamage"));
            {
                var dmgAfterShave =
                    drawdamage.AddItem(
                        new MenuItem("SurvivorRumble.DrawComboDamage", "Draw Damage on Enemy's HP Bar").SetValue(true));
                var drawFill =
                    drawdamage.AddItem(new MenuItem("SurvivorRumble.DrawColour", "Fill Color", true).SetValue(
                                           new Circle(true, System.Drawing.Color.Chartreuse)));
                DrawDamage.DamageToUnit     = CalculateDamage;
                DrawDamage.Enabled          = dmgAfterShave.GetValue <bool>();
                DrawDamage.Fill             = drawFill.GetValue <Circle>().Active;
                DrawDamage.FillColor        = drawFill.GetValue <Circle>().Color;
                dmgAfterShave.ValueChanged +=
                    delegate(object sender, OnValueChangeEventArgs eventArgs)
                {
                    DrawDamage.Enabled = eventArgs.GetNewValue <bool>();
                };

                drawFill.ValueChanged += delegate(object sender, OnValueChangeEventArgs eventArgs)
                {
                    DrawDamage.Fill      = eventArgs.GetNewValue <Circle>().Active;
                    DrawDamage.FillColor = eventArgs.GetNewValue <Circle>().Color;
                };
            }

            #endregion

            // Add everything to the main config/menu/root.
            Config.AddToMainMenu();

            #endregion

            #region Subscriptions

            Game.OnUpdate  += GameOnUpdate;
            Drawing.OnDraw += DrawingOnOnDraw;
            Game.OnWndProc += OnWndProc;
            //Obj_AI_Base.OnProcessSpellCast += ObjAiHeroOnOnProcessSpellCast;
            Chat.Print("<font color='#800040'>[SurvivorSeries] Rumble</font> <font color='#ff6600'>Loaded.</font>");

            #endregion
        }
Example #19
0
        /// <summary>
        /// Gets Prediction result
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="path">Waypoints of target</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        internal static Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, SkillshotType type, List <Vector2> path, float avgt, float movt, float avgp, float anglediff, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AssertInitializationMode();

            Result result = new Result();

            result.Input = new Input(target, delay, missileSpeed, width, range, collisionable, type, from.To3D2(), rangeCheckFrom.To3D2());
            result.Unit  = target;

            try
            {
                if (type == SkillshotType.SkillshotCircle)
                {
                    range += width;
                }

                //to do: hook logic ? by storing average movement direction etc
                if (path.Count <= 1 && movt > 100 && (Environment.TickCount - PathTracker.EnemyInfo[target.NetworkId].LastAATick > 300 || !ConfigMenu.CheckAAWindUp)) //if target is not moving, easy to hit (and not aaing)
                {
                    result.HitChance    = HitChance.VeryHigh;
                    result.CastPosition = target.ServerPosition.To2D();
                    result.UnitPosition = result.CastPosition;
                    result.Lock();

                    return(result);
                }

                if (target is AIHeroClient)
                {
                    if (((AIHeroClient)target).IsChannelingImportantSpell())
                    {
                        result.HitChance    = HitChance.VeryHigh;
                        result.CastPosition = target.ServerPosition.To2D();
                        result.UnitPosition = result.CastPosition;
                        result.Lock();

                        return(result);
                    }

                    if (Environment.TickCount - PathTracker.EnemyInfo[target.NetworkId].LastAATick < 300 && ConfigMenu.CheckAAWindUp)
                    {
                        if (target.AttackCastDelay * 1000 + PathTracker.EnemyInfo[target.NetworkId].AvgOrbwalkTime + avgt - width / 2f / target.MoveSpeed >= GetArrivalTime(target.ServerPosition.To2D().Distance(from), delay, missileSpeed))
                        {
                            result.HitChance    = HitChance.High;
                            result.CastPosition = target.ServerPosition.To2D();
                            result.UnitPosition = result.CastPosition;
                            result.Lock();

                            return(result);
                        }
                    }

                    //to do: find a fuking logic
                    if (avgp < 400 && movt < 100 && path.PathLength() <= avgp)
                    {
                        result.HitChance    = HitChance.High;
                        result.CastPosition = path.Last();
                        result.UnitPosition = result.CastPosition;
                        result.Lock();

                        return(result);
                    }
                }

                if (target.IsDashing()) //if unit is dashing
                {
                    return(GetDashingPrediction(target, width, delay, missileSpeed, range, collisionable, type, from, rangeCheckFrom));
                }

                if (Utility.IsImmobileTarget(target)) //if unit is immobile
                {
                    return(GetImmobilePrediction(target, width, delay, missileSpeed, range, collisionable, type, from, rangeCheckFrom));
                }

                result = WaypointAnlysis(target, width, delay, missileSpeed, range, collisionable, type, path, avgt, movt, avgp, anglediff, from);

                float d = result.CastPosition.Distance(target.ServerPosition.To2D());
                if (d >= (avgt - movt) * target.MoveSpeed && d >= avgp)
                {
                    result.HitChance = HitChance.Medium;
                }

                result.Lock();

                return(result);
            }
            finally
            {
                //check if movement changed while prediction calculations
                if (!target.GetWaypoints().SequenceEqual(path))
                {
                    result.HitChance = HitChance.Medium;
                }
            }
        }
Example #20
0
 /// <summary>
 /// Gets Prediction result
 /// </summary>
 /// <param name="input">Neccesary inputs for prediction calculations</param>
 /// <param name="vectorLenght">Vector Lenght</param>
 /// <returns>Prediction result as <see cref="Prediction.Vector.Result"/></returns>
 public static Result GetPrediction(Prediction.Input input, float vectorLenght)
 {
     return GetPrediction(input.Target, input.SpellWidth, input.SpellDelay, input.SpellMissileSpeed, input.SpellRange, vectorLenght, input.Path, input.AvgReactionTime, input.LastMovChangeTime, input.AvgPathLenght, input.RangeCheckFrom.To2D());
 }
Example #21
0
        /// <summary>
        /// Gets Prediction result
        /// </summary>
        /// <param name="target">Target for spell</param>
        /// <param name="width">Spell width</param>
        /// <param name="delay">Spell delay</param>
        /// <param name="missileSpeed">Spell missile speed</param>
        /// <param name="range">Spell range</param>
        /// <param name="collisionable">Spell collisionable</param>
        /// <param name="type">Spell skillshot type</param>
        /// <param name="path">Waypoints of target</param>
        /// <param name="avgt">Average reaction time (in ms)</param>
        /// <param name="movt">Passed time from last movement change (in ms)</param>
        /// <param name="avgp">Average Path Lenght</param>
        /// <param name="from">Spell casted position</param>
        /// <param name="rangeCheckFrom"></param>
        /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
        internal static Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, SkillshotType type, List <Vector2> path, float avgt, float movt, float avgp, Vector2 from, Vector2 rangeCheckFrom)
        {
            Prediction.AssertInitializationMode();

            Result result = new Result();

            try
            {
                if (type == SkillshotType.SkillshotCircle)
                {
                    range += width;
                }

                //to do: hook logic ? by storing average movement direction etc
                if (path.Count <= 1 && movt > 100 && (Environment.TickCount - PathTracker.EnemyInfo[target.NetworkId].LastAATick > 300 || !predMenu.Item("SPREDWINDUP").GetValue <bool>())) //if target is not moving, easy to hit (and not aaing)
                {
                    result.HitChance       = HitChance.VeryHigh;
                    result.CastPosition    = target.ServerPosition.To2D();
                    result.UnitPosition    = result.CastPosition;
                    result.CollisionResult = Collision.GetCollisions(from, result.CastPosition, width, delay, missileSpeed);

                    if (collisionable && (result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions) || result.CollisionResult.Objects.HasFlag(Collision.Flags.YasuoWall)))
                    {
                        result.HitChance = HitChance.Collision;
                    }

                    if (from.Distance(result.CastPosition) > range - GetArrivalTime(from.Distance(result.CastPosition), delay, missileSpeed) * target.MoveSpeed * (100 - predMenu.Item("SPREDMAXRANGEIGNORE").GetValue <Slider>().Value) / 100f)
                    {
                        result.HitChance = HitChance.OutOfRange;
                    }

                    return(result);
                }

                if (target is Obj_AI_Hero)
                {
                    if (((Obj_AI_Hero)target).IsChannelingImportantSpell())
                    {
                        result.HitChance       = HitChance.VeryHigh;
                        result.CastPosition    = target.ServerPosition.To2D();
                        result.UnitPosition    = result.CastPosition;
                        result.CollisionResult = Collision.GetCollisions(from, result.CastPosition, width, delay, missileSpeed);

                        //check collisions
                        if (collisionable && (result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions) || result.CollisionResult.Objects.HasFlag(Collision.Flags.YasuoWall)))
                        {
                            result.HitChance = HitChance.Collision;
                        }

                        //check if target can dodge with moving backward
                        if (from.Distance(result.CastPosition) > range - GetArrivalTime(from.Distance(result.CastPosition), delay, missileSpeed) * target.MoveSpeed * (100 - predMenu.Item("SPREDMAXRANGEIGNORE").GetValue <Slider>().Value) / 100f)
                        {
                            result.HitChance = HitChance.OutOfRange;
                        }

                        return(result);
                    }

                    if (Environment.TickCount - PathTracker.EnemyInfo[target.NetworkId].LastAATick < 300 && predMenu.Item("SPREDWINDUP").GetValue <bool>())
                    {
                        if (target.AttackCastDelay * 1000 + PathTracker.EnemyInfo[target.NetworkId].AvgOrbwalkTime + avgt - width / 2f / target.MoveSpeed >= GetArrivalTime(target.ServerPosition.To2D().Distance(from), delay, missileSpeed))
                        {
                            result.HitChance       = HitChance.High;
                            result.CastPosition    = target.ServerPosition.To2D();
                            result.UnitPosition    = result.CastPosition;
                            result.CollisionResult = Collision.GetCollisions(from, result.CastPosition, width, delay, missileSpeed);

                            //check collisions
                            if (collisionable && (result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions) || result.CollisionResult.Objects.HasFlag(Collision.Flags.YasuoWall)))
                            {
                                result.HitChance = HitChance.Collision;
                            }

                            return(result);
                        }
                    }

                    //to do: find a fuking logic
                    if (avgp < 400 && movt < 100 && path.PathLength() <= avgp)
                    {
                        result.HitChance       = HitChance.High;
                        result.CastPosition    = path.Last();
                        result.UnitPosition    = result.CastPosition;
                        result.CollisionResult = Collision.GetCollisions(from, result.CastPosition, width, delay, missileSpeed);

                        //check collisions
                        if (collisionable && (result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions) || result.CollisionResult.Objects.HasFlag(Collision.Flags.YasuoWall)))
                        {
                            result.HitChance = HitChance.Collision;
                        }

                        //check if target can dodge with moving backward
                        if (from.Distance(result.CastPosition) > range - GetArrivalTime(from.Distance(result.CastPosition), delay, missileSpeed) * target.MoveSpeed * (100 - predMenu.Item("SPREDMAXRANGEIGNORE").GetValue <Slider>().Value) / 100f)
                        {
                            result.HitChance = HitChance.OutOfRange;
                        }

                        return(result);
                    }
                }

                if (target.IsDashing()) //if unit is dashing
                {
                    return(GetDashingPrediction(target, width, delay, missileSpeed, range, collisionable, type, from));
                }

                if (Utility.IsImmobileTarget(target)) //if unit is immobile
                {
                    return(GetImmobilePrediction(target, width, delay, missileSpeed, range, collisionable, type, from));
                }

                result = WaypointAnlysis(target, width, delay, missileSpeed, range, collisionable, type, path, avgt, movt, avgp, from);

                //check collisions
                if (collisionable && (result.CollisionResult.Objects.HasFlag(Collision.Flags.Minions) || result.CollisionResult.Objects.HasFlag(Collision.Flags.YasuoWall)))
                {
                    result.HitChance = HitChance.Collision;
                }

                //check if target can dodge with moving backward
                if (from.Distance(result.CastPosition) > range - GetArrivalTime(from.Distance(result.CastPosition), delay, missileSpeed) * target.MoveSpeed * (100 - predMenu.Item("SPREDMAXRANGEIGNORE").GetValue <Slider>().Value) / 100f)
                {
                    result.HitChance = HitChance.OutOfRange;
                }

                return(result);
            }
            finally
            {
                //check if movement changed while prediction calculations
                if (!target.GetWaypoints().SequenceEqual(path))
                {
                    result.HitChance = HitChance.Medium;
                }
            }
        }
Example #22
0
 /// <summary>
 /// Gets Prediction result
 /// </summary>
 /// <param name="input">Neccesary inputs for prediction calculations</param>
 /// <returns>Prediction result as <see cref="Prediction.Result"/></returns>
 public static Prediction.Result GetPrediction(Prediction.Input input)
 {
     return GetPrediction(input.Target, input.SpellWidth, input.SpellDelay, input.SpellMissileSpeed, input.SpellRange, input.SpellCollisionable, input.Path, input.AvgReactionTime, input.LastMovChangeTime, input.AvgPathLenght, input.From.To2D(), input.RangeCheckFrom.To2D());
 }
Example #23
0
        /// <summary>
        /// Champion constructor
        /// </summary>
        /// <param name="szChampName">The champion name.</param>
        /// <param name="szMenuName">The menu name.</param>
        /// <param name="enableRangeDrawings">if <c>true</c>, enables the spell range drawings</param>
        /// <param name="enableEvader">if <c>true</c>, enables the spell evader if the champion is supported</param>
        public Champion(string szChampName, string szMenuName, bool enableRangeDrawings = true, bool enableEvader = true)
        {
            Text = new Font(Drawing.Direct3DDevice,
                            new FontDescription
            {
                FaceName        = "Malgun Gothic",
                Height          = 15,
                OutputPrecision = FontPrecision.Default,
                Quality         = FontQuality.ClearTypeNatural
            });

            ConfigMenu = new Menu(szMenuName, String.Format("SAutoCarry.{0}.Root", szChampName), true);

            TargetSelector.Initialize(ConfigMenu);
            Orbwalker = new Orbwalking.Orbwalker(ConfigMenu);

            SetSpells();

            DrawingMenu = new Menu("Drawings", "drawings");
            if (enableRangeDrawings)
            {
                if (this.Spells[Q] != null && this.Spells[0].Range > 0 && this.Spells[Q].Range < 3000)
                {
                    this.DrawingMenu.AddItem(new MenuItem("DDRAWQ", "Draw Q").SetValue(new Circle(true, Color.Red, this.Spells[Q].Range)));
                }

                if (this.Spells[W] != null && this.Spells[1].Range > 0 && this.Spells[W].Range < 3000)
                {
                    this.DrawingMenu.AddItem(new MenuItem("DDRAWW", "Draw W").SetValue(new Circle(true, Color.Aqua, this.Spells[W].Range)));
                }

                if (this.Spells[E] != null && this.Spells[2].Range > 0 && this.Spells[E].Range < 3000)
                {
                    this.DrawingMenu.AddItem(new MenuItem("DDRAWE", "Draw E").SetValue(new Circle(true, Color.Bisque, this.Spells[E].Range)));
                }

                if (this.Spells[R] != null && this.Spells[3].Range > 0 && this.Spells[R].Range < 3000) //global ult ?
                {
                    this.DrawingMenu.AddItem(new MenuItem("DDRAWR", "Draw R").SetValue(new Circle(true, Color.Chartreuse, this.Spells[R].Range)));
                }
            }
            ConfigMenu.AddSubMenu(DrawingMenu);

            if (enableEvader)
            {
                Menu   evaderMenu = null;
                Evader evader;
                switch (szChampName.ToLower())
                {
                case "ezreal":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Blink, Spells[E]);
                    break;

                case "sivir":
                case "morgana":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.SpellShield, Spells[E]);
                    break;

                case "fizz":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Dash, Spells[E]);
                    break;

                case "lissandra":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Invulnerability, Spells[R]);
                    break;

                case "nocturne":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.SpellShield, Spells[W]);
                    break;

                case "vladimir":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Invulnerability, Spells[W]);
                    break;

                case "graves":
                case "gnar":
                case "lucian":
                case "riven":
                case "shen":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Dash, Spells[E]);
                    break;

                case "zed":
                case "leblanc":
                case "corki":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Dash, Spells[W]);
                    break;

                case "vayne":
                    evader = new Evader(out evaderMenu, Database.EvadeMethods.Dash, Spells[Q]);
                    break;
                }
                if (evaderMenu != null)
                {
                    ConfigMenu.AddSubMenu(evaderMenu);
                }
            }
            CreateConfigMenu();

            Menu credits = new Menu("Credits", "SAutoCarry.Credits.Root");

            credits.AddItem(new MenuItem("SAutoCarry.Credits.Root.Author", "SAutoCarry - Made By Synx"));
            credits.AddItem(new MenuItem("SAutoCarry.Credits.Root.Upvote", "Dont Forget to upvote in DB!"));

            Menu supportedChamps = new Menu("Supported Champions", "SAutoCarry.Credits.Supported");

            Menu adc = new Menu("ADC (5)", "SAutoCarry.Credits.ADC");

            adc.AddItem(new MenuItem("SAutoCarry.Credits.ADC.Supported1", "  ->Corki        "));
            adc.AddItem(new MenuItem("SAutoCarry.Credits.ADC.Supported2", "  ->Lucian       "));
            adc.AddItem(new MenuItem("SAutoCarry.Credits.ADC.Supported3", "  ->Miss Fortune "));
            adc.AddItem(new MenuItem("SAutoCarry.Credits.ADC.Supported4", "  ->Twitch       "));
            adc.AddItem(new MenuItem("SAutoCarry.Credits.ADC.Supported5", "  ->Vayne        "));
            //
            supportedChamps.AddSubMenu(adc);
            //
            Menu mid = new Menu("Mid (6)", "SAutoCarry.Credits.Mid");

            mid.AddItem(new MenuItem("SAutoCarry.Credits.Mid.Supported1", "  ->Azir         "));
            mid.AddItem(new MenuItem("SAutoCarry.Credits.Mid.Supported2", "  ->Cassiopeia   "));
            mid.AddItem(new MenuItem("SAutoCarry.Credits.Mid.Supported3", "  ->Orianna      "));
            mid.AddItem(new MenuItem("SAutoCarry.Credits.Mid.Supported4", "  ->Twisted Fate "));
            mid.AddItem(new MenuItem("SAutoCarry.Credits.Mid.Supported5", "  ->Veigar       "));
            mid.AddItem(new MenuItem("SAutoCarry.Credits.Mid.Supported6", "  ->Viktor       "));
            //
            supportedChamps.AddSubMenu(mid);
            //
            Menu top = new Menu("Top (5)", "SAutoCarry.Credits.Top");

            top.AddItem(new MenuItem("SAutoCarry.Credits.Top.Supported1", "  ->Darius      "));
            top.AddItem(new MenuItem("SAutoCarry.Credits.Top.Supported2", "  ->Dr. Mundo   "));
            top.AddItem(new MenuItem("SAutoCarry.Credits.Top.Supported3", "  ->Pantheon    "));
            top.AddItem(new MenuItem("SAutoCarry.Credits.Top.Supported4", "  ->Rengar      "));
            top.AddItem(new MenuItem("SAutoCarry.Credits.Top.Supported5", "  ->Riven       "));
            //
            supportedChamps.AddSubMenu(top);
            //
            Menu jungle = new Menu("Jungle (3)", "SAutoCarry.Credits.Jungle");

            jungle.AddItem(new MenuItem("SAutoCarry.Credits.Jungle.Supported1", "  ->Jax          "));
            jungle.AddItem(new MenuItem("SAutoCarry.Credits.Jungle.Supported2", "  ->Master Yi    "));
            jungle.AddItem(new MenuItem("SAutoCarry.Credits.Jungle.Supported3", "  ->Shyvana      "));
            //
            supportedChamps.AddSubMenu(jungle);
            //
            Menu support = new Menu("Support (1)", "SAutoCarry.Credits.Support");

            support.AddItem(new MenuItem("SAutoCarry.Credits.Support.Support1", "  ->Blitzcrank   "));
            //
            supportedChamps.AddSubMenu(support);
            //

            credits.AddSubMenu(supportedChamps);

            #region Events
            Game.OnUpdate  += this.Game_OnUpdate;
            Drawing.OnDraw += this.Drawing_OnDraw;
            Orbwalking.Events.BeforeAttack     += this.OrbwalkingEvents_BeforeAttack;
            Orbwalking.Events.AfterAttack      += this.OrbwalkingEvents_AfterAttack;
            AntiGapcloser.OnEnemyGapcloser     += this.AntiGapcloser_OnEnemyGapcloser;
            Interrupter2.OnInterruptableTarget += this.Interrupter_OnPossibleToInterrupt;
            Obj_AI_Base.OnBuffGain             += this.Obj_AI_Base_OnBuffAdd;
            Obj_AI_Base.OnSpellCast            += this.Obj_AI_Base_OnProcessSpellCast;
            CustomEvents.Unit.OnDash           += this.Unit_OnDash;
            TargetedSpellDetector.OnDetected   += this.TargetedSpellDetector_OnDetected;
            #endregion

            Prediction.Initialize(ConfigMenu);
            ConfigMenu.AddSubMenu(credits);
        }