Пример #1
0
 public static void Init()
 {
     Config.CreateMenu();
     Collision.Init();
     Game.OnUpdate += args =>
         {
             DetectedSkillshots.RemoveAll(i => !i.IsActive);
             foreach (var skillshot in DetectedSkillshots)
             {
                 skillshot.OnUpdate();
             }
             if (!Program.getKeyBindItem(Config.evadeMenu, "Enabled"))
             {
                 return;
             }
             if (ObjectManager.Player.IsDead)
             {
                 return;
             }
             if (ObjectManager.Player.IsCastingInterruptableSpell(true))
             {
                 return;
             }
             if (ObjectManager.Player.ChampionName == "Sion" && ObjectManager.Player.HasBuff("SionR"))
             {
                 return;
             }
             if (ObjectManager.Player.HasBuffOfType(BuffType.SpellShield)
                 || ObjectManager.Player.HasBuffOfType(BuffType.SpellImmunity))
             {
                 return;
             }
             if (Evading != null)
             {
                 Evading();
             }
             var currentPath = ObjectManager.Player.GetWaypoints();
             var safeResult = IsSafePoint(PlayerPosition);
             var safePath = IsSafePath(currentPath, 100);
             if (!safePath.IsSafe && !safeResult.IsSafe && TryEvading != null)
             {
                 TryEvading(safeResult.SkillshotList, Game.CursorPos.LSTo2D());
             }
         };
     SkillshotDetector.OnDetectSkillshot += OnDetectSkillshot;
     SkillshotDetector.OnDeleteMissile += (skillshot, missile) =>
         {
             if (skillshot.SpellData.SpellName == "VelkozQ")
             {
                 var spellData = SpellDatabase.GetByName("VelkozQSplit");
                 var direction = skillshot.Direction.LSPerpendicular();
                 if (DetectedSkillshots.Count(i => i.SpellData.SpellName == "VelkozQSplit") == 0)
                 {
                     for (var i = -1; i <= 1; i = i + 2)
                     {
                         var skillshotToAdd = new Skillshot(
                             DetectionType.ProcessSpell,
                             spellData,
                             Utils.GameTimeTickCount,
                             missile.Position.LSTo2D(),
                             missile.Position.LSTo2D() + i * direction * spellData.Range,
                             skillshot.Unit);
                         DetectedSkillshots.Add(skillshotToAdd);
                     }
                 }
             }
         };
     Drawing.OnDraw += args =>
         {
             if (Program.getCheckBoxItem(Config.evadeMenu, "DrawStatus"))
             {
                 var active = Program.getKeyBindItem(Config.evadeMenu, "Enabled");
                 var text = string.Format("Evade Skillshot: {0}", active ? (Program.getKeyBindItem(Config.evadeMenu, "OnlyDangerous") ? "Dangerous" : "On") : "Off");
                 var pos = Drawing.WorldToScreen(ObjectManager.Player.Position);
                 Drawing.DrawText(pos.X - (float)50 / 2, pos.Y + 40, active ? (Program.getKeyBindItem(Config.evadeMenu, "OnlyDangerous") ? Color.Yellow : Color.White) : Color.Gray, text);
             }
             foreach (var skillshot in DetectedSkillshots)
             {
                 skillshot.Draw(skillshot.Enable && Program.getKeyBindItem(Config.evadeMenu, "Enabled") ? Color.White : Color.Red, Color.LimeGreen);
             }
         };
 }
Пример #2
0
        private static void OnDetectSkillshot(Skillshot skillshot)
        {
            var alreadyAdded = false;
            foreach (var item in DetectedSkillshots)
            {
                if (item.SpellData.SpellName == skillshot.SpellData.SpellName
                    && item.Unit.NetworkId == skillshot.Unit.NetworkId
                    && skillshot.Direction.LSAngleBetween(item.Direction) < 5
                    && (skillshot.Start.LSDistance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))
                {
                    alreadyAdded = true;
                }
            }
            if (skillshot.Unit.Team == ObjectManager.Player.Team)
            {
                return;
            }
            if (skillshot.Start.LSDistance(PlayerPosition)
                > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
            {
                return;
            }
            if (alreadyAdded && !skillshot.SpellData.DontCheckForDuplicates)
            {
                return;
            }
            if (skillshot.DetectionType == DetectionType.ProcessSpell)
            {
                if (skillshot.SpellData.MultipleNumber != -1)
                {
                    var originalDirection = skillshot.Direction;
                    for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                         i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                         i++)
                    {
                        var end = skillshot.Start
                                  + skillshot.SpellData.Range
                                  * originalDirection.LSRotated(skillshot.SpellData.MultipleAngle * i);
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType,
                            skillshot.SpellData,
                            skillshot.StartTick,
                            skillshot.Start,
                            end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                    }
                    return;
                }
                if (skillshot.SpellData.SpellName == "UFSlash")
                {
                    skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed;
                }
                if (skillshot.SpellData.SpellName == "SionR")
                {
                    skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed;
                }
                if (skillshot.SpellData.Invert)
                {
                    var newDirection = -(skillshot.End - skillshot.Start).LSNormalized();
                    var end = skillshot.Start + newDirection * skillshot.Start.LSDistance(skillshot.End);
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType,
                        skillshot.SpellData,
                        skillshot.StartTick,
                        skillshot.Start,
                        end,
                        skillshot.Unit);
                    DetectedSkillshots.Add(skillshotToAdd);
                    return;
                }
                if (skillshot.SpellData.Centered)
                {
                    var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                    var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType,
                        skillshot.SpellData,
                        skillshot.StartTick,
                        start,
                        end,
                        skillshot.Unit);
                    DetectedSkillshots.Add(skillshotToAdd);
                    return;
                }
                if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                {
                    const int Angle = 60;
                    var edge1 =
                        (skillshot.End - skillshot.Unit.ServerPosition.LSTo2D()).LSRotated(
                            -Angle / 2f * (float)Math.PI / 180);
                    var edge2 = edge1.LSRotated(Angle * (float)Math.PI / 180);
                    foreach (var skillshotToAdd in
                        from minion in
                            ObjectManager.Get<Obj_AI_Minion>().Where(x=>x.IsEnemy).Where(i => i.Name == "Seed" && i.LSDistance(skillshot.Unit) < 800)
                        let v = minion.ServerPosition.LSTo2D() - skillshot.Unit.ServerPosition.LSTo2D()
                        where edge1.LSCrossProduct(v) > 0 && v.LSCrossProduct(edge2) > 0
                        let start = minion.ServerPosition.LSTo2D()
                        let end =
                            skillshot.Unit.ServerPosition.LSTo2D()
                            .LSExtend(
                                minion.ServerPosition.LSTo2D(),
                                skillshot.Unit.LSDistance(minion) > 200 ? 1300 : 1000)
                        select
                            new Skillshot(
                            skillshot.DetectionType,
                            skillshot.SpellData,
                            skillshot.StartTick,
                            start,
                            end,
                            skillshot.Unit))
                    {
                        DetectedSkillshots.Add(skillshotToAdd);
                    }
                    return;
                }
                if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
                {
                    var start = skillshot.End - skillshot.Direction.LSPerpendicular() * 400;
                    var end = skillshot.End + skillshot.Direction.LSPerpendicular() * 400;
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType,
                        skillshot.SpellData,
                        skillshot.StartTick,
                        start,
                        end,
                        skillshot.Unit);
                    DetectedSkillshots.Add(skillshotToAdd);
                    return;
                }
                if (skillshot.SpellData.SpellName == "DianaArc")
                {
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType,
                        SpellDatabase.GetByName("DianaArcArc"),
                        skillshot.StartTick,
                        skillshot.Start,
                        skillshot.End,
                        skillshot.Unit);

                    DetectedSkillshots.Add(skillshotToAdd);
                }
                if (skillshot.SpellData.SpellName == "ZiggsQ")
                {
                    var d1 = skillshot.Start.LSDistance(skillshot.End);
                    var d2 = d1 * 0.4f;
                    var d3 = d2 * 0.69f;
                    var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                    var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");
                    var bounce1Pos = skillshot.End + skillshot.Direction * d2;
                    var bounce2Pos = bounce1Pos + skillshot.Direction * d3;
                    bounce1SpellData.Delay =
                        (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                    bounce2SpellData.Delay =
                        (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);
                    var bounce1 = new Skillshot(
                        skillshot.DetectionType,
                        bounce1SpellData,
                        skillshot.StartTick,
                        skillshot.End,
                        bounce1Pos,
                        skillshot.Unit);
                    var bounce2 = new Skillshot(
                        skillshot.DetectionType,
                        bounce2SpellData,
                        skillshot.StartTick,
                        bounce1Pos,
                        bounce2Pos,
                        skillshot.Unit);
                    DetectedSkillshots.Add(bounce1);
                    DetectedSkillshots.Add(bounce2);
                }
                if (skillshot.SpellData.SpellName == "ZiggsR")
                {
                    skillshot.SpellData.Delay =
                        (int)(1500 + 1500 * skillshot.End.LSDistance(skillshot.Start) / skillshot.SpellData.Range);
                }
                if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
                {
                    var endPos = Vector2.Zero;
                    foreach (var s in DetectedSkillshots)
                    {
                        if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E)
                        {
                            var extendedE = new Skillshot(
                                skillshot.DetectionType,
                                skillshot.SpellData,
                                skillshot.StartTick,
                                skillshot.Start,
                                skillshot.End + skillshot.Direction * 100,
                                skillshot.Unit);
                            if (!extendedE.IsSafe(s.End))
                            {
                                endPos = s.End;
                            }
                            break;
                        }
                    }
                    foreach (var m in ObjectManager.Get<Obj_AI_Minion>())
                    {
                        if (m.CharData.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team)
                        {
                            var extendedE = new Skillshot(
                                skillshot.DetectionType,
                                skillshot.SpellData,
                                skillshot.StartTick,
                                skillshot.Start,
                                skillshot.End + skillshot.Direction * 100,
                                skillshot.Unit);
                            if (!extendedE.IsSafe(m.Position.LSTo2D()))
                            {
                                endPos = m.Position.LSTo2D();
                            }
                            break;
                        }
                    }
                    if (endPos.IsValid())
                    {
                        skillshot = new Skillshot(
                            DetectionType.ProcessSpell,
                            SpellDatabase.GetByName("JarvanIVEQ"),
                            Utils.GameTimeTickCount,
                            skillshot.Start,
                            endPos,
                            skillshot.Unit);
                        skillshot.End = endPos + 200 * (endPos - skillshot.Start).LSNormalized();
                        skillshot.Direction = (skillshot.End - skillshot.Start).LSNormalized();
                    }
                }
            }
            if (skillshot.SpellData.SpellName == "OriannasQ")
            {
                var skillshotToAdd = new Skillshot(
                    skillshot.DetectionType,
                    SpellDatabase.GetByName("OriannaQend"),
                    skillshot.StartTick,
                    skillshot.Start,
                    skillshot.End,
                    skillshot.Unit);
                DetectedSkillshots.Add(skillshotToAdd);
            }
            if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
            {
                return;
            }
            DetectedSkillshots.Add(skillshot);
        }
Пример #3
0
 public static Vector2 GetCollisionPoint(Skillshot skillshot)
 {
     var collisions = new List<DetectedCollision>();
     var from = skillshot.GetMissilePosition(0);
     skillshot.ForceDisabled = false;
     foreach (var cObject in skillshot.SpellData.CollisionObjects)
     {
         switch (cObject)
         {
             case CollisionObjectTypes.Minion:
                 var minions = new List<Obj_AI_Minion>();
                 minions.AddRange(ObjectManager.Get<Obj_AI_Minion>().Where(x=> x.Team == GameObjectTeam.Neutral).Where(i => i.IsValidTarget(1200, true, from.To3D())));
                 minions.AddRange(
                     ObjectManager.Get<Obj_AI_Minion>().Where(
                         i =>
                         i.IsValidTarget(1200, false, @from.To3D())
                         && (skillshot.Unit.Team == ObjectManager.Player.Team
                                 ? i.Team != ObjectManager.Player.Team
                                 : i.Team == ObjectManager.Player.Team) && MinionManager.IsMinion(i)));
                 collisions.AddRange(
                     from minion in minions
                     let pred =
                         FastPrediction(
                             @from,
                             minion,
                             Math.Max(0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick)),
                             skillshot.SpellData.MissileSpeed)
                     let pos = pred.PredictedPos
                     let w =
                         skillshot.SpellData.RawRadius + (!pred.IsMoving ? (minion.BoundingRadius - 15) : 0)
                         - pos.Distance(@from, skillshot.End, true)
                     where w > 0
                     select
                         new DetectedCollision
                             {
                                 Position =
                                     pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint
                                     + skillshot.Direction * 30,
                                 Unit = minion,
                                 Type = CollisionObjectTypes.Minion, Distance = pos.Distance(@from), Diff = w
                             });
                 break;
             case CollisionObjectTypes.Champion:
                 collisions.AddRange(
                     from hero in HeroManager.Allies.Where(i => i.IsValidTarget(1200, false) && !i.IsMe)
                     let pred =
                         FastPrediction(
                             @from,
                             hero,
                             Math.Max(0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick)),
                             skillshot.SpellData.MissileSpeed)
                     let pos = pred.PredictedPos
                     let w = skillshot.SpellData.RawRadius + 30 - pos.Distance(@from, skillshot.End, true)
                     where w > 0
                     select
                         new DetectedCollision
                             {
                                 Position =
                                     pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint
                                     + skillshot.Direction * 30,
                                 Unit = hero, Type = CollisionObjectTypes.Minion,
                                 Distance = pos.Distance(@from), Diff = w
                             });
                 break;
             case CollisionObjectTypes.YasuoWall:
                 if (
                     !HeroManager.Allies.Any(
                         i => i.IsValidTarget(float.MaxValue, false) && i.ChampionName == "Yasuo"))
                 {
                     break;
                 }
                 GameObject wall = null;
                 foreach (var gameObject in
                     ObjectManager.Get<GameObject>().Where(
                         i => i.IsValid && Regex.IsMatch(i.Name, "_w_windwall.\\.troy", RegexOptions.IgnoreCase))
                     )
                 {
                     wall = gameObject;
                 }
                 if (wall == null)
                 {
                     break;
                 }
                 var level = wall.Name.Substring(wall.Name.Length - 6, 1);
                 var wallWidth = (300 + 50 * Convert.ToInt32(level));
                 var wallDirection = (wall.Position.To2D() - wallCastedPos).Normalized().Perpendicular();
                 var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection;
                 var wallEnd = wallStart - wallWidth * wallDirection;
                 var wallPolygon = new Geometry.Rectangle(wallStart, wallEnd, 75).ToPolygon();
                 var intersections = new List<Vector2>();
                 for (var i = 0; i < wallPolygon.Points.Count; i++)
                 {
                     var inter =
                         wallPolygon.Points[i].Intersection(
                             wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0],
                             from,
                             skillshot.End);
                     if (inter.Intersects)
                     {
                         intersections.Add(inter.Point);
                     }
                 }
                 if (intersections.Count > 0)
                 {
                     var intersection = intersections.OrderBy(item => item.Distance(@from)).ToList()[0];
                     var collisionT = Utils.GameTimeTickCount
                                      + Math.Max(
                                          0,
                                          skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick))
                                      + 100
                                      + (1000 * intersection.Distance(from)) / skillshot.SpellData.MissileSpeed;
                     if (collisionT - wallCastT < 4000)
                     {
                         if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine)
                         {
                             skillshot.ForceDisabled = true;
                         }
                         return intersection;
                     }
                 }
                 break;
         }
     }
     return collisions.Count > 0 ? collisions.OrderBy(i => i.Distance).ToList()[0].Position : Vector2.Zero;
 }
Пример #4
0
        public static Vector2 GetCollisionPoint(Skillshot skillshot)
        {
            var collisions = new List <DetectedCollision>();
            var from       = skillshot.GetMissilePosition(0);

            skillshot.ForceDisabled = false;
            foreach (var cObject in skillshot.SpellData.CollisionObjects)
            {
                switch (cObject)
                {
                case CollisionObjectTypes.Minion:
                    var minions = new List <Obj_AI_Minion>();
                    minions.AddRange(ObjectManager.Get <Obj_AI_Minion>().Where(x => x.Team == GameObjectTeam.Neutral).Where(i => i.IsValidTarget(1200, true, from.To3D())));
                    minions.AddRange(
                        ObjectManager.Get <Obj_AI_Minion>().Where(
                            i =>
                            i.IsValidTarget(1200, false, @from.To3D()) &&
                            (skillshot.Unit.Team == ObjectManager.Player.Team
                                        ? i.Team != ObjectManager.Player.Team
                                        : i.Team == ObjectManager.Player.Team) && MinionManager.IsMinion(i)));
                    collisions.AddRange(
                        from minion in minions
                        let pred =
                            FastPrediction(
                                @from,
                                minion,
                                Math.Max(0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick)),
                                skillshot.SpellData.MissileSpeed)
                            let pos                 = pred.PredictedPos
                                              let w =
                                skillshot.SpellData.RawRadius + (!pred.IsMoving ? (minion.BoundingRadius - 15) : 0)
                                - pos.Distance(@from, skillshot.End, true)
                                where w > 0
                                select
                                new DetectedCollision
                    {
                        Position =
                            pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint
                            + skillshot.Direction * 30,
                        Unit = minion,
                        Type = CollisionObjectTypes.Minion, Distance = pos.Distance(@from), Diff = w
                    });
                    break;

                case CollisionObjectTypes.Champions:
                    collisions.AddRange(
                        from hero in HeroManager.Allies.Where(i => i.IsValidTarget(1200, false) && !i.IsMe)
                        let pred =
                            FastPrediction(
                                @from,
                                hero,
                                Math.Max(0, skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick)),
                                skillshot.SpellData.MissileSpeed)
                            let pos                 = pred.PredictedPos
                                              let w = skillshot.SpellData.RawRadius + 30 - pos.Distance(@from, skillshot.End, true)
                                                      where w > 0
                                                      select
                                                      new DetectedCollision
                    {
                        Position =
                            pos.ProjectOn(skillshot.End, skillshot.Start).LinePoint
                            + skillshot.Direction * 30,
                        Unit     = hero, Type = CollisionObjectTypes.Minion,
                        Distance = pos.Distance(@from), Diff = w
                    });
                    break;

                case CollisionObjectTypes.YasuoWall:
                    if (
                        !HeroManager.Allies.Any(
                            i => i.IsValidTarget(float.MaxValue, false) && i.ChampionName == "Yasuo"))
                    {
                        break;
                    }
                    GameObject wall = null;
                    foreach (var gameObject in
                             ObjectManager.Get <GameObject>().Where(
                                 i => i.IsValid && Regex.IsMatch(i.Name, "_w_windwall.\\.troy", RegexOptions.IgnoreCase))
                             )
                    {
                        wall = gameObject;
                    }
                    if (wall == null)
                    {
                        break;
                    }
                    var level         = wall.Name.Substring(wall.Name.Length - 6, 1);
                    var wallWidth     = (300 + 50 * Convert.ToInt32(level));
                    var wallDirection = (wall.Position.To2D() - wallCastedPos).Normalized().Perpendicular();
                    var wallStart     = wall.Position.To2D() + wallWidth / 2f * wallDirection;
                    var wallEnd       = wallStart - wallWidth * wallDirection;
                    var wallPolygon   = new Geometry.Rectangle(wallStart, wallEnd, 75).ToPolygon();
                    var intersections = new List <Vector2>();
                    for (var i = 0; i < wallPolygon.Points.Count; i++)
                    {
                        var inter =
                            wallPolygon.Points[i].Intersection(
                                wallPolygon.Points[i != wallPolygon.Points.Count - 1 ? i + 1 : 0],
                                from,
                                skillshot.End);
                        if (inter.Intersects)
                        {
                            intersections.Add(inter.Point);
                        }
                    }
                    if (intersections.Count > 0)
                    {
                        var intersection = intersections.OrderBy(item => item.Distance(@from)).ToList()[0];
                        var collisionT   = Utils.GameTimeTickCount
                                           + Math.Max(
                            0,
                            skillshot.SpellData.Delay - (Utils.GameTimeTickCount - skillshot.StartTick))
                                           + 100
                                           + (1000 * intersection.Distance(from)) / skillshot.SpellData.MissileSpeed;
                        if (collisionT - wallCastT < 4000)
                        {
                            if (skillshot.SpellData.Type != SkillShotType.SkillshotMissileLine)
                            {
                                skillshot.ForceDisabled = true;
                            }
                            return(intersection);
                        }
                    }
                    break;
                }
            }
            return(collisions.Count > 0 ? collisions.OrderBy(i => i.Distance).ToList()[0].Position : Vector2.Zero);
        }
Пример #5
0
 public static void Init()
 {
     Config.CreateMenu();
     Collision.Init();
     Game.OnUpdate += args =>
     {
         DetectedSkillshots.RemoveAll(i => !i.IsActive);
         foreach (var skillshot in DetectedSkillshots)
         {
             skillshot.OnUpdate();
         }
         if (!FioraProject.Program.Menu.SubMenu("Evade").Item("Enabled").GetValue <KeyBind>().Active)
         {
             return;
         }
         if (ObjectManager.Player.IsDead)
         {
             return;
         }
         if (ObjectManager.Player.IsCastingInterruptableSpell(true))
         {
             return;
         }
         if (ObjectManager.Player.ChampionName == "Sion" && ObjectManager.Player.HasBuff("SionR"))
         {
             return;
         }
         if (ObjectManager.Player.HasBuffOfType(BuffType.SpellShield) ||
             ObjectManager.Player.HasBuffOfType(BuffType.SpellImmunity))
         {
             return;
         }
         if (Evading != null)
         {
             Evading();
         }
         var currentPath = ObjectManager.Player.GetWaypoints();
         var safeResult  = IsSafePoint(PlayerPosition);
         var safePath    = IsSafePath(currentPath, 100);
         if (!safePath.IsSafe && !safeResult.IsSafe && TryEvading != null)
         {
             TryEvading(safeResult.SkillshotList, Game.CursorPos.To2D());
         }
     };
     SkillshotDetector.OnDetectSkillshot += OnDetectSkillshot;
     SkillshotDetector.OnDeleteMissile   += (skillshot, missile) =>
     {
         if (skillshot.SpellData.SpellName == "VelkozQ")
         {
             var spellData = SpellDatabase.GetByName("VelkozQSplit");
             var direction = skillshot.Direction.Perpendicular();
             if (DetectedSkillshots.Count(i => i.SpellData.SpellName == "VelkozQSplit") == 0)
             {
                 for (var i = -1; i <= 1; i = i + 2)
                 {
                     var skillshotToAdd = new Skillshot(
                         DetectionType.ProcessSpell,
                         spellData,
                         Utils.GameTimeTickCount,
                         missile.Position.To2D(),
                         missile.Position.To2D() + i * direction * spellData.Range,
                         skillshot.Unit);
                     DetectedSkillshots.Add(skillshotToAdd);
                 }
             }
         }
     };
     Drawing.OnDraw += args =>
     {
         if (FioraProject.Program.Menu.SubMenu("Evade").Item("DrawStatus").GetValue <bool>())
         {
             var active = FioraProject.Program.Menu.SubMenu("Evade").Item("Enabled").GetValue <KeyBind>().Active;
             var text   = string.Format(
                 "Evade Skillshot: {0}",
                 active
                         ? (FioraProject.Program.Menu.SubMenu("Evade").Item("OnlyDangerous").GetValue <KeyBind>().Active
                                ? "Dangerous"
                                : "On")
                         : "Off");
             var pos = Drawing.WorldToScreen(ObjectManager.Player.Position);
             Drawing.DrawText(
                 pos.X - (float)70,
                 pos.Y + 40,
                 active
                         ? (FioraProject.Program.Menu.SubMenu("Evade").Item("OnlyDangerous").GetValue <KeyBind>().Active
                                ? Color.Yellow
                                : Color.White)
                         : Color.Gray,
                 text);
         }
         foreach (var skillshot in DetectedSkillshots)
         {
             skillshot.Draw(
                 skillshot.Enable && FioraProject.Program.Menu.SubMenu("Evade").Item("Enabled").GetValue <KeyBind>().Active
                         ? Color.White
                         : Color.Red,
                 Color.LimeGreen);
         }
     };
 }
Пример #6
0
        private static void OnDetectSkillshot(Skillshot skillshot)
        {
            var alreadyAdded = false;

            foreach (var item in DetectedSkillshots)
            {
                if (item.SpellData.SpellName == skillshot.SpellData.SpellName &&
                    item.Unit.NetworkId == skillshot.Unit.NetworkId &&
                    skillshot.Direction.AngleBetween(item.Direction) < 5 &&
                    (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))
                {
                    alreadyAdded = true;
                }
            }
            if (skillshot.Unit.Team == ObjectManager.Player.Team)
            {
                return;
            }
            if (skillshot.Start.Distance(PlayerPosition)
                > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5)
            {
                return;
            }
            if (alreadyAdded && !skillshot.SpellData.DontCheckForDuplicates)
            {
                return;
            }
            if (skillshot.DetectionType == DetectionType.ProcessSpell)
            {
                if (skillshot.SpellData.MultipleNumber != -1)
                {
                    var originalDirection = skillshot.Direction;
                    for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2;
                         i <= (skillshot.SpellData.MultipleNumber - 1) / 2;
                         i++)
                    {
                        var end = skillshot.Start
                                  + skillshot.SpellData.Range
                                  * originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i);
                        var skillshotToAdd = new Skillshot(
                            skillshot.DetectionType,
                            skillshot.SpellData,
                            skillshot.StartTick,
                            skillshot.Start,
                            end,
                            skillshot.Unit);
                        DetectedSkillshots.Add(skillshotToAdd);
                    }
                    return;
                }
                if (skillshot.SpellData.SpellName == "UFSlash")
                {
                    skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed;
                }
                if (skillshot.SpellData.SpellName == "SionR")
                {
                    skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed;
                }
                if (skillshot.SpellData.Invert)
                {
                    var newDirection   = -(skillshot.End - skillshot.Start).Normalized();
                    var end            = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End);
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType,
                        skillshot.SpellData,
                        skillshot.StartTick,
                        skillshot.Start,
                        end,
                        skillshot.Unit);
                    DetectedSkillshots.Add(skillshotToAdd);
                    return;
                }
                if (skillshot.SpellData.Centered)
                {
                    var start          = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range;
                    var end            = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range;
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType,
                        skillshot.SpellData,
                        skillshot.StartTick,
                        start,
                        end,
                        skillshot.Unit);
                    DetectedSkillshots.Add(skillshotToAdd);
                    return;
                }
                if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5")
                {
                    const int Angle = 60;
                    var       edge1 =
                        (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated(
                            -Angle / 2f * (float)Math.PI / 180);
                    var edge2 = edge1.Rotated(Angle * (float)Math.PI / 180);
                    foreach (var skillshotToAdd in
                             from minion in
                             ObjectManager.Get <Obj_AI_Minion>().Where(x => x.IsEnemy).Where(i => i.Name == "Seed" && i.Distance(skillshot.Unit) < 800)
                             let v = minion.ServerPosition.To2D() - skillshot.Unit.ServerPosition.To2D()
                                     where edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0
                                     let start = minion.ServerPosition.To2D()
                                                 let end =
                                 skillshot.Unit.ServerPosition.To2D()
                                 .Extend(
                                     minion.ServerPosition.To2D(),
                                     skillshot.Unit.Distance(minion) > 200 ? 1300 : 1000)
                                 select
                                 new Skillshot(
                                     skillshot.DetectionType,
                                     skillshot.SpellData,
                                     skillshot.StartTick,
                                     start,
                                     end,
                                     skillshot.Unit))
                    {
                        DetectedSkillshots.Add(skillshotToAdd);
                    }
                    return;
                }
                if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid")
                {
                    var start          = skillshot.End - skillshot.Direction.Perpendicular() * 400;
                    var end            = skillshot.End + skillshot.Direction.Perpendicular() * 400;
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType,
                        skillshot.SpellData,
                        skillshot.StartTick,
                        start,
                        end,
                        skillshot.Unit);
                    DetectedSkillshots.Add(skillshotToAdd);
                    return;
                }
                if (skillshot.SpellData.SpellName == "DianaArc")
                {
                    var skillshotToAdd = new Skillshot(
                        skillshot.DetectionType,
                        SpellDatabase.GetByName("DianaArcArc"),
                        skillshot.StartTick,
                        skillshot.Start,
                        skillshot.End,
                        skillshot.Unit);

                    DetectedSkillshots.Add(skillshotToAdd);
                }
                if (skillshot.SpellData.SpellName == "ZiggsQ")
                {
                    var d1 = skillshot.Start.Distance(skillshot.End);
                    var d2 = d1 * 0.4f;
                    var d3 = d2 * 0.69f;
                    var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1");
                    var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2");
                    var bounce1Pos       = skillshot.End + skillshot.Direction * d2;
                    var bounce2Pos       = bounce1Pos + skillshot.Direction * d3;
                    bounce1SpellData.Delay =
                        (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500);
                    bounce2SpellData.Delay =
                        (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500);
                    var bounce1 = new Skillshot(
                        skillshot.DetectionType,
                        bounce1SpellData,
                        skillshot.StartTick,
                        skillshot.End,
                        bounce1Pos,
                        skillshot.Unit);
                    var bounce2 = new Skillshot(
                        skillshot.DetectionType,
                        bounce2SpellData,
                        skillshot.StartTick,
                        bounce1Pos,
                        bounce2Pos,
                        skillshot.Unit);
                    DetectedSkillshots.Add(bounce1);
                    DetectedSkillshots.Add(bounce2);
                }
                if (skillshot.SpellData.SpellName == "ZiggsR")
                {
                    skillshot.SpellData.Delay =
                        (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range);
                }
                if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike")
                {
                    var endPos = Vector2.Zero;
                    foreach (var s in DetectedSkillshots)
                    {
                        if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E)
                        {
                            var extendedE = new Skillshot(
                                skillshot.DetectionType,
                                skillshot.SpellData,
                                skillshot.StartTick,
                                skillshot.Start,
                                skillshot.End + skillshot.Direction * 100,
                                skillshot.Unit);
                            if (!extendedE.IsSafe(s.End))
                            {
                                endPos = s.End;
                            }
                            break;
                        }
                    }
                    foreach (var m in ObjectManager.Get <Obj_AI_Minion>())
                    {
                        if (m.CharData.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team)
                        {
                            var extendedE = new Skillshot(
                                skillshot.DetectionType,
                                skillshot.SpellData,
                                skillshot.StartTick,
                                skillshot.Start,
                                skillshot.End + skillshot.Direction * 100,
                                skillshot.Unit);
                            if (!extendedE.IsSafe(m.Position.To2D()))
                            {
                                endPos = m.Position.To2D();
                            }
                            break;
                        }
                    }
                    if (endPos.IsValid())
                    {
                        skillshot = new Skillshot(
                            DetectionType.ProcessSpell,
                            SpellDatabase.GetByName("JarvanIVEQ"),
                            Utils.GameTimeTickCount,
                            skillshot.Start,
                            endPos,
                            skillshot.Unit);
                        skillshot.End       = endPos + 200 * (endPos - skillshot.Start).Normalized();
                        skillshot.Direction = (skillshot.End - skillshot.Start).Normalized();
                    }
                }
            }
            if (skillshot.SpellData.SpellName == "OriannasQ")
            {
                var skillshotToAdd = new Skillshot(
                    skillshot.DetectionType,
                    SpellDatabase.GetByName("OriannaQend"),
                    skillshot.StartTick,
                    skillshot.Start,
                    skillshot.End,
                    skillshot.Unit);
                DetectedSkillshots.Add(skillshotToAdd);
            }
            if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket)
            {
                return;
            }
            DetectedSkillshots.Add(skillshot);
        }