예제 #1
0
        public static void Init()
        {
            FirstMenu = MainMenu.AddMenu("URF Spell Spammer", Player.Instance.ChampionName.ToLower() + "hueurfspammer");
            FirstMenu.AddGroupLabel("Spells");
            FirstMenu.CreateCheckBox(" - Use Q", "qUse");
            if (Skillshots.Contains(Q))
            {
                FirstMenu.CreateSlider("Q Hitchance %", "qHitChance", 75);
            }

            FirstMenu.CreateCheckBox(" - Use W", "wUse");
            if (Skillshots.Contains(W))
            {
                FirstMenu.CreateSlider("W Hitchance %", "wHitChance", 75);
            }

            FirstMenu.CreateCheckBox(" - Use E", "eUse");
            if (Skillshots.Contains(E))
            {
                FirstMenu.CreateSlider("E Hitchance %", "eHitChance", 75);
            }

            FirstMenu.CreateCheckBox(" - Use R", "rUse");
            if (Skillshots.Contains(R))
            {
                FirstMenu.CreateSlider("R Hitchance %", "rHitChance", 90);
            }
        }
예제 #2
0
 public bool IsPathSafeEx(Vector2[] path, int speed = -1, int delay = 0)
 {
     return(Skillshots.All(evadeSkillshot =>
     {
         bool safe = evadeSkillshot.IsSafePath(path, ServerTimeBuffer + Game.Ping, speed, delay);
         //if (path.Length == 2 && path[1].Distance(LastIssueOrderPos) <= 50)
         //    if (!safe)
         return safe;
     }));
 }
예제 #3
0
 public bool IsPathSafeEx(Vector2[] path, int speed = -1, int delay = 0)
 {
     return(Skillshots.All(evadeSkillshot =>
     {
         bool safe = evadeSkillshot.IsSafePath(path, ServerTimeBuffer, speed, delay);
         //if (path.Length == 2 && path[1].Distance(LastIssueOrderPos) <= 50)
         //    if (!safe && evadeSkillshot.OwnSpellData.IsVeigarE)
         //        Chat.Print(Game.Time);
         return safe;
     }));
 }
예제 #4
0
        public int GetDangerValue(AIHeroClient hero = null)
        {
            hero = hero ?? Player.Instance;
            var skillshots = Skillshots.Where(c => _skillshotPolygonCache[c].IsInside(hero.Position)).ToArray();

            if (!skillshots.Any())
            {
                return(0);
            }

            var values = skillshots.Select(c => c.SpellData.DangerValue).OrderByDescending(t => t);

            return(values.Any() ? values.First() : 0);
        }
예제 #5
0
        public int GetTimeAvailable(AIHeroClient hero = null)
        {
            hero = hero ?? Player.Instance;
            var skillshots = Skillshots.Where(c => _skillshotPolygonCache[c].IsInside(hero.Position)).ToArray();

            if (!skillshots.Any())
            {
                return(short.MaxValue);
            }

            var times =
                skillshots.Select(c => c.GetAvailableTime(hero.ServerPosition.To2D()))
                .Where(t => t > 0)
                .OrderByDescending(t => t);

            return(times.Any() ? times.Last() : short.MaxValue);
        }
예제 #6
0
        private void CacheSkillshots()
        {
            Skillshots =
                (DodgeDangerousOnly
                    ? SkillshotDetector.ActiveSkillshots.Where(c => c.SpellData.IsDangerous)
                    : SkillshotDetector.ActiveSkillshots).ToArray();

            _skillshotPolygonCache.Clear();
            Polygons = Skillshots.Select(c =>
            {
                var pol = c.ToPolygon();
                _skillshotPolygonCache.Add(c, pol);

                return(pol);
            }).ToArray();
            ClippedPolygons = Geometry.ClipPolygons(Polygons).ToPolygons();
        }
예제 #7
0
        public List <Geometry.Polygon> CustomPoly()
        {
            Skillshots =
                (DodgeDangerousOnly
                    ? SkillshotDetector.ActiveSkillshots.Where(c => c.SpellData.IsDangerous && EvadeMenu.IsSkillshotE(c) && Environment.TickCount - c.TimeDetected >= Yasuo.FleeMenu["Evade.WDelay"].Cast <Slider>().CurrentValue)
                    : SkillshotDetector.ActiveSkillshots).ToArray();

            _skillshotPolygonCache.Clear();
            Polygons = Skillshots.Select(c =>
            {
                var pol = c.ToPolygon();
                _skillshotPolygonCache.Add(c, pol);

                return(pol);
            }).ToArray();
            return(Geometry.ClipPolygons(Polygons).ToPolygons());
        }
예제 #8
0
        private void CacheSkillshots()
        {
            Skillshots =
                (DodgeDangerousOnly
                    ? SkillshotDetector.ActiveSkillshots.Where(c => c.OwnSpellData.IsDangerous)
                    : SkillshotDetector.ActiveSkillshots).ToArray();

            _skillshotPolygonCache.Clear();

            Polygons = Skillshots.Select(c =>
            {
                Geometry.Polygon pol;
                if (c.OwnSpellData.IsVeigarE)
                {
                    var skill = c as VeigarE;
                    var inner = skill.ToInnerPolygon();
                    var outer = skill.ToOuterPolygon();

                    if (!skill.IsSafe())
                    {
                        pol = outer;
                    }
                    else
                    {
                        pol = inner.IsInside(Player.Instance) ? inner : outer;
                    }
                }
                else
                {
                    pol = c.ToPolygon();
                }

                _skillshotPolygonCache.Add(c, pol);
                return(pol);
            }).ToArray();

            ClippedPolygons = Geometry.ClipPolygons(Polygons).ToPolygons();
        }
예제 #9
0
        public Vector2[] GetPath(Vector2 start, Vector2 end)
        {
            const int extraWidth   = 50;
            var       walkPolygons = Geometry.ClipPolygons(Skillshots.Select(c => c.ToPolygon(extraWidth))).ToPolygons();

            //if (walkPolygons.Any(pol => pol.IsInside(start)))
            //{
            //    Chat.Print("start");
            //    var polPoints =
            //        Geometry.ClipPolygons(
            //            SkillshotDetector.DetectedSkillshots.Where(c => c.IsValid)
            //                .Select(c => c.ToPolygon(extraWidth))
            //                .ToList())
            //            .ToPolygons()
            //            .Where(pol => pol.IsInside(start))
            //            .SelectMany(pol => pol.Points)
            //            .ToList();
            //    polPoints.Sort((p1, p2) => p1.Distance(start, true).CompareTo(p2.Distance(start, true)));
            //    start = polPoints.First().Extend(start, -150);
            //}

            if (walkPolygons.Any(pol => pol.IsInside(end)))
            {
                var polPoints =
                    Geometry.ClipPolygons(
                        SkillshotDetector.DetectedSkillshots.Where(c => c.IsValid)
                        .Select(c => c.ToPolygon(extraWidth))
                        .ToList())
                    .ToPolygons()
                    .Where(pol => pol.IsInside(end))
                    .SelectMany(pol => pol.Points)
                    .ToList();
                polPoints.Sort((p1, p2) => p1.Distance(end, true).CompareTo(p2.Distance(end, true)));
                end = polPoints.First().Extend(end, -extraWidth);
            }

            var ritoPath          = Player.Instance.GetPath(end.To3DWorld(), true).ToArray().ToVector2().ToList(); //Player.Instance.GetPath(start.To3DWorld(), end.To3DWorld()).ToArray().ToVector2().ToList();
            var pathPoints        = new List <Vector2>();
            var polygonDictionary = new Dictionary <Vector2, Geometry.Polygon>();

            for (var i = 0; i < ritoPath.Count - 1; i++)
            {
                var lineStart = ritoPath[i];
                var lineEnd   = ritoPath[i + 1];

                foreach (var pol in walkPolygons)
                {
                    var intersectionPoints = pol.GetIntersectionPointsWithLineSegment(lineStart, lineEnd);
                    foreach (var p in intersectionPoints)
                    {
                        if (!polygonDictionary.ContainsKey(p))
                        {
                            polygonDictionary.Add(p, pol);
                            pathPoints.Add(p);
                        }
                    }
                }
            }
            ritoPath.RemoveAll(p => walkPolygons.Any(pol => pol.IsInside(p)));
            pathPoints.AddRange(ritoPath);
            pathPoints.SortPath(Player.Instance.ServerPosition.To2D()); //start

            var path = new List <Vector2>();

            while (pathPoints.Count > 0)
            {
                if (pathPoints.Count == 1)
                {
                    path.Add(pathPoints[0]);
                    break;
                }

                var current = pathPoints[0];
                var next    = pathPoints[1];

                Geometry.Polygon pol1;
                Geometry.Polygon pol2;

                if (polygonDictionary.TryGetValue(current, out pol1) && polygonDictionary.TryGetValue(next, out pol2) &&
                    pol1.Equals(pol2))
                {
                    var detailedPolygon = pol1.ToDetailedPolygon();
                    detailedPolygon.Points.Sort(
                        (p1, p2) => p1.Distance(current, true).CompareTo(p2.Distance(current, true)));
                    current = detailedPolygon.Points.First();

                    detailedPolygon.Points.Sort((p1, p2) => p1.Distance(next, true).CompareTo(p2.Distance(next, true)));
                    next = detailedPolygon.Points.First();

                    detailedPolygon = pol1.ToDetailedPolygon();
                    var index      = detailedPolygon.Points.FindIndex(p => p == current);
                    var linkedList = new LinkedList <Vector2>(detailedPolygon.Points, index);

                    var nextPath       = new List <Vector2>();
                    var previousPath   = new List <Vector2>();
                    var nextLength     = 0F;
                    var previousLength = 0F;
                    var nextWall       = false;
                    var previousWall   = false;

                    while (true)
                    {
                        var c = linkedList.Next();

                        if (c.IsWall())
                        {
                            nextWall = true;
                            break;
                        }

                        nextPath.Add(c);

                        if (nextPath.Count > 1)
                        {
                            nextLength += nextPath[nextPath.Count - 2].Distance(c, true);
                        }

                        if (c == next)
                        {
                            break;
                        }
                    }

                    linkedList.Index = index;
                    while (true)
                    {
                        var c = linkedList.Previous();

                        if (c.IsWall())
                        {
                            previousWall = true;
                            break;
                        }

                        previousPath.Add(c);

                        if (previousPath.Count > 1)
                        {
                            previousLength += previousPath[previousPath.Count - 2].Distance(c, true);
                        }

                        if (c == next)
                        {
                            break;
                        }
                    }

                    var shortest = nextWall && previousWall
                        ? (nextLength > previousLength ? nextPath : previousPath)
                        : (nextWall || previousWall
                            ? (nextWall ? previousPath : nextPath)
                            : nextLength < previousLength ? nextPath : previousPath);
                    path.AddRange(shortest);

                    if (previousWall && nextWall)
                    {
                        break;
                    }
                }
                else
                {
                    path.Add(current);
                    path.Add(next);
                }

                pathPoints.RemoveRange(0, 2);
            }

            return(path.ToArray());
        }
예제 #10
0
        private static void OnUpdate(EventArgs args)
        {
            var target = TargetSelector.GetTarget(2000, DamageType.Mixed);

            if (target != null)
            {
                //Q
                if (Skillshots.Contains(Q))
                {
                    var qSS = Q as Spell.Skillshot;
                    qSS.TryToCast(target, FirstMenu, FirstMenu.GetSliderValue("qHitChance"));
                }
                else
                {
                    try
                    {
                        Q.TryToCast(target, FirstMenu);
                    }
                    catch (Exception)
                    {
                        Q.Cast();
                    }
                }
                //W
                if (Skillshots.Contains(W))
                {
                    var wSS = W as Spell.Skillshot;
                    wSS.TryToCast(target, FirstMenu, FirstMenu.GetSliderValue("wHitChance"));
                }
                else
                {
                    try
                    {
                        W.TryToCast(target, FirstMenu);
                    }
                    catch (Exception)
                    {
                        W.Cast();
                    }
                }
                //E
                if (Skillshots.Contains(E))
                {
                    var eSS = E as Spell.Skillshot;
                    eSS.TryToCast(target, FirstMenu, FirstMenu.GetSliderValue("eHitChance"));
                }
                else
                {
                    try
                    {
                        E.TryToCast(target, FirstMenu);
                    }
                    catch (Exception)
                    {
                        E.Cast();
                    }
                }
                //R
                if (Skillshots.Contains(R))
                {
                    var rSS = R as Spell.Skillshot;
                    rSS.TryToCast(target, FirstMenu, FirstMenu.GetSliderValue("rHitChance"));
                }
                else
                {
                    try
                    {
                        R.TryToCast(target, FirstMenu);
                    }
                    catch (Exception)
                    {
                        R.Cast();
                    }
                }
            }
            else
            //No Target
            {
                //Q
                if (Skillshots.Contains(Q))
                {
                    Q.Cast(Game.CursorPos);
                }
                else
                {
                    Q.Cast();
                }
                //W
                if (Skillshots.Contains(W))
                {
                    W.Cast(Game.CursorPos);
                }
                else
                {
                    W.Cast();
                }
                //E
                if (Skillshots.Contains(W))
                {
                    E.Cast(Game.CursorPos);
                }
                else
                {
                    E.Cast();
                }
            }
        }