示例#1
0
        //complete
        private static void Drawing_OnDraw(EventArgs args)
        {
            if (Yasuo.IsDead)
            {
                return;
            }

            Menu menu = MenuHandler.Drawing;

            System.Drawing.Color drawColor = System.Drawing.Color.Blue;

            //Drawing.DrawText(Yasuo.Position.WorldToScreen(), drawColor, Animation, 15);

            //Vector3 yasuoQStartPos = Yasuo.Position + new Vector3(0, 0, 150f),
            //    yasuoQEndPos = yasuoQStartPos.To2D().Extend(Game.CursorPos, Q.Range).To3D((int)yasuoQStartPos.Z - 75);

            //yasuoQStartPos.DrawArrow(yasuoQEndPos, drawColor);
            //Drawing.DrawLine(yasuoQStartPos.WorldToScreen(), yasuoQEndPos.WorldToScreen(), 5, drawColor);

            if (menu.GetCheckboxValue("Draw Q") && !Yasuo.HasBuff("YasuoQ3W") && Q.IsLearned)
            {
                //Drawing.DrawCircle(yasuoQStartPos, Q.Range, drawColor);
                Q.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw Q") && Yasuo.HasBuff("YasuoQ3W") && Q.IsLearned)
            {
                Q3.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw W") && W.IsLearned)
            {
                W.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw E") && E.IsLearned)
            {
                E.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw EQ") && E.IsLearned && Q.IsLearned)
            {
                EQ.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw R") && R.IsLearned)
            {
                R.DrawRange(drawColor);
            }
            if (menu.GetCheckboxValue("Draw Beyblade") && R.IsLearned && Flash != null && E.IsLearned && Q.IsLearned)
            {
                Drawing.DrawCircle(Yasuo.Position, E.Range + Flash.Range + (EQ.Range / 2), System.Drawing.Color.Red);
            }
            if (menu.GetCheckboxValue("Draw Turret Range"))
            {
                foreach (Obj_AI_Turret turret in EntityManager.Turrets.Enemies.Where(a => !a.IsDead && a.VisibleOnScreen))
                {
                    turret.DrawCircle((int)turret.GetAutoAttackRange() + 35, drawColor);
                }
            }

            Obj_AI_Base hoverObject = EntityManager.Enemies.Where(a => !a.IsDead && a.IsTargetable && a.IsInRange(Yasuo, E.Range) && a.Distance(Game.CursorPos) <= 75).OrderBy(a => a.Distance(Game.CursorPos)).FirstOrDefault();

            if (hoverObject != null)
            {
                if (menu.GetCheckboxValue("Draw EQ on Target"))
                {
                    Drawing.DrawCircle(YasuoCalcs.GetDashingEnd(hoverObject), EQ.Range, drawColor);
                }
                if (menu.GetCheckboxValue("Draw E End Position on Target"))
                {
                    Drawing.DrawLine(Yasuo.Position.WorldToScreen(), YasuoCalcs.GetDashingEnd(hoverObject).WorldToScreen(), 3, drawColor);
                }
                if (menu.GetCheckboxValue("Draw E End Position on Target - Detailed"))
                {
                    Vector3 startPos   = Yasuo.Position,
                            dashEndPos = YasuoCalcs.GetDashingEnd(hoverObject),
                            fakeEndPos = startPos.To2D().Extend(dashEndPos.To2D(), 1000).To3D() + new Vector3(0, 0, startPos.Z),
                            slope      = new Vector3(dashEndPos.X - startPos.X, dashEndPos.Y - startPos.Y, 0),
                            fakeSlope  = new Vector3(fakeEndPos.X - startPos.X, fakeEndPos.Y - startPos.Y, 0);

                    List <Vector3> pointsAlongPath  = new List <Vector3>();
                    List <Vector3> straightLinePath = new List <Vector3>();

                    int points = 100;

                    pointsAlongPath.Add(startPos);

                    //get all points in a line from start to fake end
                    for (int i = 0; i < points; i++)
                    {
                        straightLinePath.Add(startPos + (i * (fakeSlope / points)));
                    }

                    bool isWall = false;

                    //get all wall start and end positions
                    for (int i = 0; i < points; i++)
                    {
                        //wall start
                        if (!isWall && straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = true;
                        }
                        //wall end
                        if (isWall && !straightLinePath[i].IsWall())
                        {
                            pointsAlongPath.Add(straightLinePath[i]);
                            isWall = false;
                        }
                    }

                    pointsAlongPath.Add(fakeEndPos);

                    for (int i = 0; i < pointsAlongPath.Count() - 1; i++)
                    {
                        System.Drawing.Color color = (pointsAlongPath[i].IsWall()) ? System.Drawing.Color.Red : System.Drawing.Color.Green;
                        Drawing.DrawLine(pointsAlongPath[i].WorldToScreen(), pointsAlongPath[i + 1].WorldToScreen(), 2, color);
                    }

                    Vector3 closestWall             = pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(dashEndPos)).FirstOrDefault(),
                            closestWallsEndPosition = (pointsAlongPath.IndexOf(closestWall) + 1 == pointsAlongPath.Count) ? Vector3.Zero : pointsAlongPath[pointsAlongPath.IndexOf(closestWall) + 1];

                    Drawing.DrawText(closestWall.WorldToScreen(), drawColor, "start", 15);
                    Drawing.DrawText(closestWallsEndPosition.WorldToScreen(), drawColor, "end", 15);
                    Drawing.DrawText(((closestWall + closestWallsEndPosition) / 2).WorldToScreen(), drawColor, closestWall.Distance(closestWallsEndPosition).ToString(), 15);
                    Drawing.DrawText(dashEndPos.WorldToScreen(), drawColor, startPos.Distance(closestWallsEndPosition).ToString(), 15);

                    //none of the points are a wall so the end point is the dash position
                    if (!pointsAlongPath.Any(a => a.IsWall()))
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    // OR none of the walls are in the E range
                    else if (pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault() != null &&
                             pointsAlongPath.Where(a => a.IsWall()).OrderBy(a => a.Distance(startPos)).FirstOrDefault().Distance(startPos) > E.Range)
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    //or the dashing end is not a wall
                    else if (!dashEndPos.IsWall())
                    {
                        Drawing.DrawCircle(dashEndPos, 50, drawColor);
                    }
                    //find the nearest wall to the dash position
                    else if (closestWall != Vector3.Zero && closestWallsEndPosition != Vector3.Zero &&
                             closestWall != null && closestWallsEndPosition != null &&
                             closestWallsEndPosition.Distance(dashEndPos) < closestWall.Distance(dashEndPos) &&
                             startPos.Distance(closestWallsEndPosition) <= 630)
                    {
                        Drawing.DrawCircle(closestWallsEndPosition, 50, drawColor);
                    }
                    //the end position is the first wall
                    else
                    {
                        Drawing.DrawCircle(pointsAlongPath.First(a => a.IsWall()), 50, drawColor);
                    }
                }
            }

            if (menu.GetCheckboxValue("Draw Wall Dashes") && E.IsLearned)
            {
                foreach (WallDash wd in YasuoWallDashDatabase.wallDashDatabase.Where(a => a.startPosition.Distance(Yasuo) <= 1300))
                {
                    if (EntityManager.MinionsAndMonsters.Combined.Where(a => a.MeetsCriteria() && a.VisibleOnScreen && a.Name == wd.unitName && a.ServerPosition.Distance(wd.dashUnitPosition) <= 2).FirstOrDefault() != null)
                    {
                        wd.startPosition.DrawArrow(wd.endPosition, System.Drawing.Color.Red, 1);
                        Geometry.Polygon.Circle dashCircle = new Geometry.Polygon.Circle(wd.endPosition, 120);
                        dashCircle.Draw(System.Drawing.Color.Red, 1);
                    }
                }
            }
        }