Esempio n. 1
0
        //private void Game_OnGameInput(GameInputEventArgs args)
        //{
        //    ConsolePrinter.Print("" + args.Input);

        //}

        private static void ObjAiHeroOnOnNewPath(Obj_AI_Base unit, Obj_AI_BaseNewPathEventArgs args)
        {
            if (unit.Type == GameObjectType.obj_AI_Hero)
            {
                if (testMenu["(TestSpellEndTime)"].As <MenuBool>().Enabled)
                {
                    //ConsolePrinter.Print("Dash windup: " + (EvadeUtils.TickCount - EvadeSpell.lastSpellEvadeCommand.timestamp));
                }

                if (args.IsDash && testMenu["(ShowDashInfo)"].As <MenuBool>().Enabled)
                {
                    var dist = args.Path.First().Distance(args.Path.Last());
                    ConsolePrinter.Print("Dash Speed: " + args.Speed + " Dash dist: " + dist);
                }

                if (unit.IsMe && testMenu["(EvadeTesterPing)"].As <MenuBool>().Enabled &&
                    args.Path.Count() > 1)
                {
                    //ConsolePrinter.Print("Received Path ClickTime: " + (EvadeUtils.TickCount - lastRightMouseClickTime));
                }

                if (unit.IsMe)
                {
                    //Draw.RenderObjects.Add(new Draw.RenderCircle(args.Path.Last().To2D(), 500));
                    //Draw.RenderObjects.Add(new Draw.RenderCircle(args.Path.First().To2D(), 500));
                }
            }
        }
Esempio n. 2
0
        private static void ObjAiHeroOnOnNewPath(Obj_AI_Base unit, Obj_AI_BaseNewPathEventArgs args)
        {
            if (unit.Type != GameObjectType.obj_AI_Hero)
            {
                return;
            }

            if (!args.IsDash || !TestMenu["(ShowDashInfo)"].Enabled)
            {
                return;
            }
            var dist = args.Path.First().Distance(args.Path.Last());

            ConsolePrinter.Print("Dash Speed: " + args.Speed + " Dash dist: " + dist);
        }
Esempio n. 3
0
        private static void OnObjAiHeroDash(Obj_AI_Base sender, Obj_AI_BaseNewPathEventArgs args)
        {
            var hero = sender as Obj_AI_Hero;

            if (hero == null || !hero.IsValid || hero.ChampionName == "PracticeTool_TargetDummy")
            {
                return;
            }

            if (!DetectedDashes.ContainsKey(hero.NetworkId))
            {
                DetectedDashes.Add(hero.NetworkId, new DashArgs());
            }

            if (args.IsDash)
            {
                var path = new List <Vector2> {
                    (Vector2)hero.ServerPosition
                };

                path.AddRange(args.Path.ToList().Select(x => (Vector2)x));

                DetectedDashes[hero.NetworkId].Unit      = sender;
                DetectedDashes[hero.NetworkId].Path      = path;
                DetectedDashes[hero.NetworkId].Speed     = args.Speed;
                DetectedDashes[hero.NetworkId].StartPos  = (Vector2)hero.ServerPosition;
                DetectedDashes[hero.NetworkId].StartTick = Game.TickCount - Game.Ping / 2;
                DetectedDashes[hero.NetworkId].EndPos    = path.Last();
                DetectedDashes[hero.NetworkId].EndTick   = DetectedDashes[hero.NetworkId].StartTick
                                                           + (int)(1000
                                                                   * (DetectedDashes[hero.NetworkId].EndPos.Distance(DetectedDashes[hero.NetworkId].StartPos)
                                                                      / DetectedDashes[hero.NetworkId].Speed));
                DetectedDashes[hero.NetworkId].Duration = DetectedDashes[hero.NetworkId].EndTick
                                                          - DetectedDashes[hero.NetworkId].StartTick;

                HeroDashed?.Invoke(null, DetectedDashes[hero.NetworkId]);
            }
            else
            {
                DetectedDashes[hero.NetworkId].EndTick = 0;
            }
        }
Esempio n. 4
0
        private static void OnNewPath(Obj_AI_Base sender, Obj_AI_BaseNewPathEventArgs Args)
        {
            if (sender == null || sender.Type != GameObjectType.obj_AI_Hero || !sender.IsEnemy)
            {
                return;
            }

            if (sender.UnitSkinName == "Vi" || sender.UnitSkinName == "Sion" || sender.UnitSkinName == "Kayn" || sender.UnitSkinName == "Fizz")
            {
                // Vi R
                // Sion R
                // Kayn R
                // Fizz E
                return;
            }

            if (!Gapclosers.ContainsKey(sender.NetworkId))
            {
                Gapclosers.Add(sender.NetworkId, new GapcloserArgs());
            }

            if (Args.IsDash)
            {
                Gapclosers[sender.NetworkId].Unit          = (Obj_AI_Hero)sender;
                Gapclosers[sender.NetworkId].Slot          = SpellSlot.Unknown;
                Gapclosers[sender.NetworkId].Type          = SpellType.Dash;
                Gapclosers[sender.NetworkId].SpellName     = sender.UnitSkinName + "_Dash";
                Gapclosers[sender.NetworkId].StartPosition = sender.ServerPosition;
                Gapclosers[sender.NetworkId].EndPosition   = Args.Path.Last();
                Gapclosers[sender.NetworkId].StartTick     = Game.TickCount;
                Gapclosers[sender.NetworkId].EndTick       =
                    (int)
                    (Gapclosers[sender.NetworkId].EndPosition.DistanceSqr(Gapclosers[sender.NetworkId].StartPosition) /
                     Args.Speed * Args.Speed * 1000) + Gapclosers[sender.NetworkId].StartTick;
                Gapclosers[sender.NetworkId].DurationTick = Gapclosers[sender.NetworkId].EndTick - Gapclosers[sender.NetworkId].StartTick;
                Gapclosers[sender.NetworkId].HaveShield   = HaveShiledBuff(sender);
            }
        }
Esempio n. 5
0
        private static void OnNewPath(Obj_AI_Base sender, Obj_AI_BaseNewPathEventArgs args)
        {
            if (sender == null || sender.Type != GameObjectType.obj_AI_Hero || !sender.IsEnemy || Gapclosers == null)
            {
                return;
            }

            if (sender.UnitSkinName == "Vi" || // Vi R
                sender.UnitSkinName == "Sion" || // Sion R
                sender.UnitSkinName == "Kayn" || // Kayn R
                sender.UnitSkinName == "Fizz") // Fizz E
            {
                return;
            }

            if (!Gapclosers.ContainsKey(sender.NetworkId))
            {
                Gapclosers.Add(sender.NetworkId, new GapcloserArgs());
            }

            if (!args.IsDash)
            {
                return;
            }

            var gapclosers = Gapclosers[sender.NetworkId];

            gapclosers.Unit          = (Obj_AI_Hero)sender;
            gapclosers.Slot          = SpellSlot.Unknown;
            gapclosers.Type          = SpellType.Dash;
            gapclosers.SpellName     = sender.UnitSkinName + "_Dash";
            gapclosers.StartPosition = sender.ServerPosition;
            gapclosers.EndPosition   = args.Path.Last();
            gapclosers.StartTick     = Game.TickCount;
            gapclosers.EndTick       = (int)(gapclosers.EndPosition.DistanceSqr(gapclosers.StartPosition) / args.Speed * args.Speed * 1000) + gapclosers.StartTick;
            gapclosers.DurationTick  = gapclosers.EndTick - gapclosers.StartTick;
            gapclosers.HaveShield    = HaveShiledBuff(sender);
        }
Esempio n. 6
0
        private static void Obj_AI_Hero_OnNewPath(Obj_AI_Base sender, Obj_AI_BaseNewPathEventArgs args)
        {
            if (!(sender is Obj_AI_Hero))
            {
                return;
            }

            if (!StoredPaths.ContainsKey(sender.NetworkId))
            {
                StoredPaths.Add(sender.NetworkId, new List <StoredPath>());
            }

            var newPath = new StoredPath {
                Tick = Game.TickCount, Path = args.Path.Select(x => (Vector2)x).ToList()
            };

            StoredPaths[sender.NetworkId].Add(newPath);

            if (StoredPaths[sender.NetworkId].Count > 50)
            {
                StoredPaths[sender.NetworkId].RemoveRange(0, 40);
            }
        }
Esempio n. 7
0
        private static void Hero_OnNewPath(Obj_AI_Base hero, Obj_AI_BaseNewPathEventArgs args)
        {
            if (!ObjectCache.MenuCache.Cache["AutoSetPingOn"].Enabled)
            {
                return;
            }

            if (!hero.IsMe)
            {
                return;
            }

            var path = args.Path;

            if (path.Length <= 1 || args.IsDash)
            {
                return;
            }

            var movePos = path.Last().To2D();

            if (_checkPing && _lastIssueOrderArgs.ProcessEvent && _lastIssueOrderArgs.OrderType == OrderType.MoveTo && _lastIssueOrderArgs.Target.Position.To2D().Distance(movePos) < 3 &&
                MyHero.Path.Length == 1 && args.Path.Length == 2 && MyHero.HasPath)
            {
                RenderObjects.Add(new RenderLine(args.Path.First().To2D(), args.Path.Last().To2D(), 1000));
                RenderObjects.Add(new RenderLine(MyHero.Position.To2D(), MyHero.Path.Last().To2D(), 1000));

                var distanceTillEnd = MyHero.Path.Last().To2D().Distance(MyHero.Position.To2D());
                var moveTimeTillEnd = 1000 * distanceTillEnd / MyHero.MoveSpeed;

                if (moveTimeTillEnd < 500)
                {
                    return;
                }

                var myHeroPosition = new Vector3(MyHero.Position.X, MyHero.Position.Y, MyHero.Position.Z);

                var dir1 = (MyHero.Path.Last().To2D() - MyHero.Position.To2D()).Normalized();

                var ray1Startpos = new Vector3(myHeroPosition.X, myHeroPosition.Y, 0);
                var ray1Dir      = new Vector3(dir1.X, dir1.Y, 0);

                var dir2 = (args.Path.First().To2D() - args.Path.Last().To2D()).Normalized();

                var argsPathFirst = new Vector3(args.Path.First().X, args.Path.First().Y, args.Path.First().Z);

                var ray2Startpos = new Vector3(argsPathFirst.X, argsPathFirst.Y, 0);
                var ray2Dir      = new Vector3(dir2.X, dir2.Y, 0);

                var intersection = ray2Startpos.To2D().
                                   Intersection(ray2Startpos.To2D().ExtendDir(ray2Dir.To2D(), args.Path.Length), ray1Startpos.To2D(), ray1Startpos.To2D().ExtendDir(ray1Dir.To2D(), args.Path.Length));

                if (intersection.Intersects)
                {
                    var intersection3 = intersection.Point.To3D();

                    var x = intersection3.To2D().X;
                    var y = intersection3.To2D().Y;

                    var intersectionAt = new Vector2(x, y);

                    var projection = intersectionAt.ProjectOn(MyHero.Path.Last().To2D(), MyHero.Position.To2D());

                    if (projection.IsOnSegment && dir1.AngleBetween(dir2) > 20 && dir1.AngleBetween(dir2) < 160)
                    {
                        RenderObjects.Add(new RenderCircle(intersectionAt, 1000, Color.Red, 10));

                        var distance =
                            _lastMoveToServerPos.Distance(intersectionAt);
                        var moveTime = 1000 * distance / MyHero.MoveSpeed;

                        if (moveTime < 1000)
                        {
                            if (_numExtraDelayTime > 0)
                            {
                                PingList.Add(moveTime);
                            }
                            _numExtraDelayTime += 1;

                            if (_maxExtraDelayTime == 0)
                            {
                                _maxExtraDelayTime = ObjectCache.MenuCache.Cache["ExtraPingBuffer"].As <MenuSlider>().Value;
                            }

                            if (_numExtraDelayTime % 100 == 0)
                            {
                                PingList.Sort();

                                var percentile   = ObjectCache.MenuCache.Cache["AutoSetPercentile"].As <MenuSlider>().Value;
                                var percentIndex = (int)Math.Floor(PingList.Count * (percentile / 100f)) - 1;
                                _maxExtraDelayTime = Math.Max(PingList.ElementAt(percentIndex) - Game.Ping, 0);
                                ObjectCache.MenuCache.Cache["ExtraPingBuffer"].As <MenuSlider>().Value = (int)_maxExtraDelayTime; //(new MenuSlider((int)maxExtraDelayTime, 0, 200));

                                PingList.Clear();

                                Console.WriteLine("Max Extra Delay: " + _maxExtraDelayTime);
                            }

                            Console.WriteLine("Extra Delay: " + Math.Max(moveTime - Game.Ping, 0));
                        }
                    }
                }
            }

            _checkPing = false;
        }
Esempio n. 8
0
 /// <summary>
 /// Called when [new path].
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="Obj_AI_BaseNewPathEventArgs"/> instance containing the event data.</param>
 protected virtual void OnNewPath(Obj_AI_Base sender, Obj_AI_BaseNewPathEventArgs e)
 {
     return;
 }
Esempio n. 9
0
        private void OnNewPath(Obj_AI_Base sender, Obj_AI_BaseNewPathEventArgs e)
        {
            if (sender.Type == GameObjectType.AIHeroClient && sender.Team != Player.Team ||
                sender.NetworkId == Player.NetworkId)
            {
                if (this.PathAnalysis[sender.NetworkId].Count == 2)
                {
                    var p1    = this.PathAnalysis[sender.NetworkId][this.PathAnalysis[sender.NetworkId].Count - 2].Position;
                    var p2    = this.PathAnalysis[sender.NetworkId][this.PathAnalysis[sender.NetworkId].Count - 1].Position;
                    var angle = ((Vector2)sender.Position).AngleBetween((Vector2)p2, (Vector2)p1);

                    if (angle > 20)
                    {
                        this.PathAnalysis[sender.NetworkId].Add(new Path()
                        {
                            Time = GetTime(), Position = e.Path.Last()
                        });
                    }
                }
                else
                {
                    this.PathAnalysis[sender.NetworkId].Add(new Path()
                    {
                        Time = GetTime(), Position = e.Path.Last()
                    });
                }
            }

            if (sender.IsValid && sender.Type == GameObjectType.AIHeroClient)
            {
                this.DontShootUntilNewWaypoints[sender.NetworkId] = false;

                var waypointsToAdd = this.GetCurrentWaypoints(sender);

                if (waypointsToAdd.Count >= 1) // todo Maybe 2?
                {
                    this.TargetsWaypoints[sender.NetworkId].Add(
                        new WaypointInfo()
                    {
                        UnitPosition = sender.Position,
                        Waypoint     = waypointsToAdd.Last(),
                        Time         = GetTime(),
                        N            = waypointsToAdd.Count
                    });
                }
            }

            if (e.IsDash)
            {
                if (sender.Type == GameObjectType.AIHeroClient)
                {
                    var dash = new Dash()
                    {
                        StartPosition = e.Path[0],
                        EndPosition   = e.Path.Last(),
                        Speed         = e.Speed,
                        StartTime     = GetTime() - Game.Ping / 2000f,
                    };

                    var dist = Vector3.Distance(dash.StartPosition, dash.EndPosition);
                    dash.EndTime = dash.StartTime + (dist / dash.Speed);

                    this.TargetsDashing[sender.NetworkId]             = dash;
                    this.DontShootUntilNewWaypoints[sender.NetworkId] = true;
                }
            }
        }
Esempio n. 10
0
        private void Hero_OnNewPath(Obj_AI_Base hero, Obj_AI_BaseNewPathEventArgs args)
        {
            if (ObjectCache.menuCache.cache["AutoSetPingOn"].As <MenuBool>().Value == false)
            {
                return;
            }

            if (!hero.IsMe)
            {
                return;
            }

            var path = args.Path;

            if (path.Length > 1 && !args.IsDash)
            {
                var movePos = path.Last().To2D();

                if (checkPing &&
                    lastIssueOrderArgs.ProcessEvent &&
                    lastIssueOrderArgs.OrderType == OrderType.MoveTo &&
                    lastIssueOrderArgs.Target.Position.To2D().Distance(movePos) < 3 &&
                    myHero.Path.Count() == 1 &&
                    args.Path.Count() == 2 &&
                    myHero.HasPath)
                {
                    //Draw.RenderObjects.Add(new Draw.RenderPosition(myHero.Path.Last().To2D(), 1000));

                    RenderObjects.Add(new RenderLine(args.Path.First().To2D(), args.Path.Last().To2D(), 1000));
                    RenderObjects.Add(new RenderLine(myHero.Position.To2D(), myHero.Path.Last().To2D(), 1000));

                    //Draw.RenderObjects.Add(new Draw.RenderCircle(lastMoveToServerPos, 1000, System.Drawing.Color.Red, 10));

                    var distanceTillEnd = myHero.Path.Last().To2D().Distance(myHero.Position.To2D());
                    var moveTimeTillEnd = 1000 * distanceTillEnd / myHero.MoveSpeed;

                    if (moveTimeTillEnd < 500)
                    {
                        return;
                    }

                    /*SharpDX.*/
                    var myHeroPosition = new /*SharpDX.*/
                                         Vector3(myHero.Position.X, myHero.Position.Y, myHero.Position.Z);

                    var dir1 = (myHero.Path.Last().To2D() - myHero.Position.To2D()).Normalized();

                    //SharpDX.Vector2 dir1sharpdx = new SharpDX.Vector2(myHero.Position.X, myHero.Position.Y);

                    //var ray1 = new Ray(myHeroPosition.SetZ(0), new SharpDX.Vector3(dir1.X, dir1.Y, 0));
                    var ray1startpos = new Vector3(myHeroPosition.X, myHeroPosition.Y, 0);
                    var ray1dir      = new Vector3(dir1.X, dir1.Y, 0);
                    //Vector3 ray1 = ray1startpos.ExtendDir(ray1dir, args.Path.Length);

                    var dir2 = (args.Path.First().To2D() - args.Path.Last().To2D()).Normalized();
                    //var pos2 = new Vector3(args.Path.First().X, args.Path.First().Y, 0);

                    /*SharpDX.*/
                    var argsPathFirst = new /*SharpDX.*/
                                        Vector3(args.Path.First().X, args.Path.First().Y, args.Path.First().Z);

                    //var ray2 = new Ray(argsPathFirst.SetZ(0), new SharpDX.Vector3(dir2.X, dir2.Y, 0));
                    var ray2startpos = new Vector3(argsPathFirst.X, argsPathFirst.Y, 0);
                    var ray2dir      = new Vector3(dir2.X, dir2.Y, 0);

                    //Vector3 ray2 = ray2startpos.ExtendDir(ray2dir, args.Path.Length);

                    /*SharpDX.*/ //Vector3 intersection3;

                    var intersection = ray2startpos.To2D()
                                       .Intersection(ray2startpos.To2D().ExtendDir(ray2dir.To2D(), args.Path.Length),
                                                     ray1startpos.To2D(), ray1startpos.To2D().ExtendDir(ray1dir.To2D(), args.Path.Length));


                    if (intersection.Intersects)
                    {
                        var intersection3 = intersection.Point.To3D();

                        var x = intersection3.To2D().X;
                        var y = intersection3.To2D().Y;

                        var intersectionAT = new Vector2(x, y);

                        var projection = intersectionAT.ProjectOn(myHero.Path.Last().To2D(), myHero.Position.To2D());

                        if (projection.IsOnSegment && dir1.AngleBetween(dir2) > 20 && dir1.AngleBetween(dir2) < 160)
                        {
                            RenderObjects.Add(new RenderCircle(intersectionAT, 1000, Color.Red, 10, 5));

                            var distance = //args.Path.First().To2D().Distance(intersection);
                                           lastMoveToServerPos.Distance(intersectionAT);
                            var moveTime = 1000 * distance / myHero.MoveSpeed;

                            //Console.WriteLine("waa: " + distance);

                            if (moveTime < 1000)
                            {
                                if (numExtraDelayTime > 0)
                                {
                                    sumExtraDelayTime += moveTime;
                                    avgExtraDelayTime  = sumExtraDelayTime / numExtraDelayTime;

                                    pingList.Add(moveTime);
                                }
                                numExtraDelayTime += 1;

                                if (maxExtraDelayTime == 0)
                                {
                                    maxExtraDelayTime = ObjectCache.menuCache.cache["ExtraPingBuffer"].As <MenuSlider>()
                                                        .Value;
                                }

                                if (numExtraDelayTime % 100 == 0)
                                {
                                    pingList.Sort();

                                    var percentile = ObjectCache.menuCache.cache["AutoSetPercentile"].As <MenuSlider>()
                                                     .Value;
                                    var percentIndex = (int)Math.Floor(pingList.Count() * (percentile / 100f)) - 1;
                                    maxExtraDelayTime = Math.Max(pingList.ElementAt(percentIndex) - Game.Ping, 0);
                                    ObjectCache.menuCache.cache["ExtraPingBuffer"].As <MenuSlider>().Value =
                                        (int)maxExtraDelayTime;  //(new MenuSlider((int)maxExtraDelayTime, 0, 200));

                                    pingList.Clear();

                                    Console.WriteLine("Max Extra Delay: " + maxExtraDelayTime);
                                }

                                Console.WriteLine("Extra Delay: " + Math.Max(moveTime - Game.Ping, 0));
                            }
                        }
                    }

                    //if (ray2.Intersects(ref ray1, out intersection3))
                    //{
                    //    //var intersection = intersection3.To2D();

                    //    float x = intersection3.To2D().X;
                    //    float y = intersection3.To2D().Y;

                    //    Vector2 intersectionAT = new Vector2(x, y);

                    //    var projection = intersectionAT.ProjectOn(myHero.Path.Last().To2D(), myHero.Position.To2D());

                    //    if (projection.IsOnSegment && dir1.AngleBetween(dir2) > 20 && dir1.AngleBetween(dir2) < 160)
                    //    {
                    //        Draw.RenderObjects.Add(new Draw.RenderCircle(intersectionAT, 1000, System.Drawing.Color.Red, 10, 5));

                    //        var distance = //args.Path.First().To2D().Distance(intersection);
                    //            lastMoveToServerPos.Distance(intersectionAT);
                    //        float moveTime = 1000 * distance / myHero.MoveSpeed;

                    //        //Console.WriteLine("waa: " + distance);

                    //        if (moveTime < 1000)
                    //        {
                    //            if (numExtraDelayTime > 0)
                    //            {
                    //                sumExtraDelayTime += moveTime;
                    //                avgExtraDelayTime = sumExtraDelayTime / numExtraDelayTime;

                    //                pingList.Add(moveTime);
                    //            }
                    //            numExtraDelayTime += 1;

                    //            if (maxExtraDelayTime == 0)
                    //            {
                    //                maxExtraDelayTime = ObjectCache.menuCache.cache["ExtraPingBuffer"].As<MenuSlider>().Value;
                    //            }

                    //            if (numExtraDelayTime % 100 == 0)
                    //            {
                    //                pingList.Sort();

                    //                var percentile = ObjectCache.menuCache.cache["AutoSetPercentile"].As<MenuSlider>().Value;
                    //                int percentIndex = (int)Math.Floor(pingList.Count() * (percentile / 100f)) - 1;
                    //                maxExtraDelayTime = Math.Max(pingList.ElementAt(percentIndex) - Game.Ping, 0);
                    //                ObjectCache.menuCache.cache["ExtraPingBuffer"].As<MenuSlider>().Value =
                    //                    (int)maxExtraDelayTime; //(new MenuSlider((int)maxExtraDelayTime, 0, 200));

                    //                pingList.Clear();

                    //                Console.WriteLine("Max Extra Delay: " + maxExtraDelayTime);
                    //            }

                    //            Console.WriteLine("Extra Delay: " + Math.Max(moveTime - Game.Ping, 0));
                    //        }
                    //    }
                    //}
                }

                checkPing = false;
            }
        }