Exemple #1
0
            public static Vector3 bestVectorToAoeSpell(IEnumerable<AIHeroClient> heroes,
                float spellrange,
                float spellwidth)
            {
                var bestPos = new Vector3();
                var hits = 0;
                foreach (var hero in heroes)
                {
                    if (countChampsAtrange(hero.Position, spellwidth) > hits)
                    {
                        bestPos = hero.Position;
                        hits = countChampsAtrange(hero.Position, spellwidth);
                    }
                    var newPos = new Vector3(hero.Position.X + 80, hero.Position.Y + 80, hero.Position.Z);
                    for (var i = 1; i < 4; i++)
                    {
                        var rotated = newPos.LSTo2D().RotateAroundPoint(newPos.LSTo2D(), 90*i).To3D();
                        if (countChampsAtrange(rotated, spellwidth) > hits && player.LSDistance(rotated) <= spellrange)
                        {
                            bestPos = newPos;
                            hits = countChampsAtrange(rotated, spellwidth);
                        }
                    }
                }

                return bestPos;
            }
Exemple #2
0
        public static void Jump(Vector3 pos, bool juke = false, bool castq = true)
        {
            if (Math.Abs(Program._e.Cooldown) < 0.00001)
            {
                var extended = ObjectManager.Player.ServerPosition.LSTo2D().LSExtend(pos.LSTo2D(), 800f);
                if (!JumpTo.IsValid())
                    JumpTo = pos.LSTo2D();

                if (Program._w.IsReady() && SoldierMgr.ActiveSoldiers.Count == 0)
                {
                    if (juke)
                    {
                        var outRadius = 250 / (float)Math.Cos(2 * Math.PI / 12);

                        for (var i = 1; i <= 12; i++)
                        {
                            var angle = i * 2 * Math.PI / 12;
                            var x = ObjectManager.Player.Position.X + outRadius * (float)Math.Cos(angle);
                            var y = ObjectManager.Player.Position.Y + outRadius * (float)Math.Sin(angle);
                            if (NavMesh.GetCollisionFlags(x, y).HasFlag(CollisionFlags.Wall) && !ObjectManager.Player.ServerPosition.LSTo2D().LSExtend(new Vector2(x, y), 500f).LSIsWall())
                            {
                                Program._w.Cast(ObjectManager.Player.ServerPosition.LSTo2D().LSExtend(new Vector2(x, y), 800f));
                                return;
                            }
                        }
                    }
                    Program._w.Cast(extended);
                }

                if (SoldierMgr.ActiveSoldiers.Count > 0 && Program._q.IsReady())
                {
                    var closestSoldier = SoldierMgr.ActiveSoldiers.MinOrDefault(s => s.Position.LSTo2D().LSDistance(extended, true));
                    CastELocation = closestSoldier.Position.LSTo2D();
                    CastQLocation = closestSoldier.Position.LSTo2D().LSExtend(JumpTo, 800f);

                    if (CastELocation.LSDistance(JumpTo) > ObjectManager.Player.ServerPosition.LSTo2D().LSDistance(JumpTo) && !juke && castq)
                    {
                        CastQLocation = extended;
                        CastET = Utils.TickCount + 250;
                        Program._q.Cast(CastQLocation);
                    }
                    else
                    {
                        Program._e.Cast(CastELocation, true);
                        if (ObjectManager.Player.ServerPosition.LSTo2D().LSDistance(CastELocation) < 700 && castq)
                            LeagueSharp.Common.Utility.DelayAction.Add(250, () => Program._q.Cast(CastQLocation, true));
                    }
                }
            }
            else
            {
                if (Program._q.IsReady() && CastELocation.LSDistance(ObjectManager.Player.ServerPosition) <= 200 && castq)
                    Program._q.Cast(CastQLocation, true);

                JumpTo = Vector2.Zero;
            }
        }
Exemple #3
0
        public static List<Vector2> GetCastMinionsPredictedPositions(List<Obj_AI_Base> minions,
            float delay,
            float width,
            float speed,
            Vector3 from,
            float range,
            bool collision,
            SkillshotType stype,
            Vector3 rangeCheckFrom = new Vector3())
        {
            var result = new List<Vector2>();
            from = from.LSTo2D().IsValid() ? from : ObjectManager.Player.ServerPosition;
            foreach (var minion in minions)
            {
                var pos = Prediction.GetPrediction(new PredictionInput
                {
                    Unit = minion,
                    Delay = delay,
                    Radius = width,
                    Speed = speed,
                    From = from,
                    Range = range,
                    Collision = collision,
                    Type = stype,
                    RangeCheckFrom = rangeCheckFrom
                });

                if (pos.Hitchance >= HitChance.High)
                {
                    result.Add(pos.CastPosition.LSTo2D());
                }
            }

            return result;
        }
Exemple #4
0
        /// <summary>
        ///     Collideses the with wall.
        /// </summary>
        /// <param name="start">The start.</param>
        /// <param name="end">The end.</param>
        /// <returns></returns>
        internal static bool CollidesWithWall(Vector3 start, Vector3 end)
        {
            if (Environment.TickCount - _wallCastT > 4000)
            {
                return false;
            }

            GameObject wall = null;
            foreach (var gameObject in
                ObjectManager.Get<GameObject>()
                    .Where(
                        gameObject =>
                            gameObject.IsValid &&
                            Regex.IsMatch(
                                gameObject.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase))
                )
            {
                wall = gameObject;
            }
            if (wall == null)
            {
                return false;
            }
            var level = wall.Name.Substring(wall.Name.Length - 6, 1);
            var wallWidth = 300 + 50*Convert.ToInt32(level);

            var wallDirection =
                (wall.Position.LSTo2D() - _yasuoWallCastedPos).Normalized().Perpendicular();
            var wallStart = wall.Position.LSTo2D() + wallWidth/2f*wallDirection;
            var wallEnd = wallStart - wallWidth*wallDirection;

            for (var i = 0; i < start.LSDistance(end); i += 30)
            {
                var currentPosition = start.LSExtend(end, i);
                if (wallStart.Intersection(wallEnd, currentPosition.LSTo2D(), start.LSTo2D()).Intersects)
                {
                    return true;
                }
            }

            return false;
        }
Exemple #5
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Polygon.Arc" /> class.
 /// </summary>
 /// <param name="start">The start.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="angle">The angle.</param>
 /// <param name="radius">The radius.</param>
 /// <param name="quality">The quality.</param>
 public Arc(Vector3 start, Vector3 direction, float angle, float radius, int quality = 20)
     : this(start.LSTo2D(), direction.LSTo2D(), angle, radius, quality)
 {
 }
Exemple #6
0
 /// <summary>
 ///     Determines whether the specified point is inside.
 /// </summary>
 /// <param name="point">The point.</param>
 /// <returns></returns>
 public bool IsInside(Vector3 point)
 {
     return !IsOutside(point.LSTo2D());
 }
Exemple #7
0
        public static void DrawLineRectangle(Vector3 start2, Vector3 end2, int radius, float width, Color color)
        {
            var start = start2.LSTo2D();
            var end = end2.LSTo2D();
            var dir = (end - start).Normalized();
            var pDir = dir.Perpendicular();

            var rightStartPos = start + pDir*radius;
            var leftStartPos = start - pDir*radius;
            var rightEndPos = end + pDir*radius;
            var leftEndPos = end - pDir*radius;

            var rStartPos =
                Drawing.WorldToScreen(new Vector3(rightStartPos.X, rightStartPos.Y, ObjectManager.Player.Position.Z));
            var lStartPos =
                Drawing.WorldToScreen(new Vector3(leftStartPos.X, leftStartPos.Y, ObjectManager.Player.Position.Z));
            var rEndPos =
                Drawing.WorldToScreen(new Vector3(rightEndPos.X, rightEndPos.Y, ObjectManager.Player.Position.Z));
            var lEndPos = Drawing.WorldToScreen(new Vector3(leftEndPos.X, leftEndPos.Y, ObjectManager.Player.Position.Z));

            Drawing.DrawLine(rStartPos, rEndPos, width, color);
            Drawing.DrawLine(lStartPos, lEndPos, width, color);
            Drawing.DrawLine(rStartPos, lStartPos, width, color);
            Drawing.DrawLine(lEndPos, rEndPos, width, color);
        }
Exemple #8
0
 /// <summary>
 ///     Calculates the distance to the Vector3.
 /// </summary>
 /// <param name="v">The v.</param>
 /// <param name="to">To.</param>
 /// <param name="squared">if set to <c>true</c> gets the distance squared.</param>
 /// <returns></returns>
 public static float ELDistance(this Vector2 v, Vector3 to, bool squared = false)
 {
     return v.LSDistance(to.LSTo2D(), squared);
 }
Exemple #9
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Polygon.Sector" /> class.
 /// </summary>
 /// <param name="center">The center.</param>
 /// <param name="direction">The direction.</param>
 /// <param name="angle">The angle.</param>
 /// <param name="radius">The radius.</param>
 /// <param name="quality">The quality.</param>
 public Sector(Vector3 center, Vector3 direction, float angle, float radius, int quality = 20)
     : this(center.LSTo2D(), direction.LSTo2D(), angle, radius, quality)
 {
 }
Exemple #10
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Rectangle" /> class.
 /// </summary>
 /// <param name="start">The start.</param>
 /// <param name="end">The end.</param>
 /// <param name="width">The width.</param>
 public Rectangle(Vector3 start, Vector3 end, float width)
     : this(start.LSTo2D(), end.LSTo2D(), width)
 {
 }
Exemple #11
0
        internal static double GetAngle(Vector3 from, Obj_AI_Base target)
        {
            var C = target.ServerPosition.LSTo2D();
            var A = target.GetWaypoints().Last();

            if (C == A)
                return 60;

            var B = from.LSTo2D();

            var AB = Math.Pow((double)A.X - (double)B.X, 2) + Math.Pow((double)A.Y - (double)B.Y, 2);
            var BC = Math.Pow((double)B.X - (double)C.X, 2) + Math.Pow((double)B.Y - (double)C.Y, 2);
            var AC = Math.Pow((double)A.X - (double)C.X, 2) + Math.Pow((double)A.Y - (double)C.Y, 2);

            return Math.Cos((AB + BC - AC) / (2 * Math.Sqrt(AB) * Math.Sqrt(BC))) * 180 / Math.PI;
        }
Exemple #12
0
        public static bool goesThroughWall(Vector3 vec1, Vector3 vec2)
        {
            if (wall.endtime < Game.Time || wall.pointL == null || wall.pointL == null)
                return false;
            Vector2 inter = YasMath.LineIntersectionPoint(vec1.LSTo2D(), vec2.LSTo2D(), wall.pointL.Position.LSTo2D(), wall.pointR.Position.LSTo2D());
            float wallW = (300 + 50 * W.Level);
            if (wall.pointL.Position.LSTo2D().LSDistance(inter) > wallW ||
                wall.pointR.Position.LSTo2D().LSDistance(inter) > wallW)
                return false;
            var dist = vec1.LSDistance(vec2);
            if (vec1.LSTo2D().LSDistance(inter) + vec2.LSTo2D().LSDistance(inter) - 30 > dist)
                return false;

            return true;
        }
Exemple #13
0
 static Vector2 V2E(Vector3 from, Vector3 direction, float distance)
 {
     return from.LSTo2D() + distance * Vector3.Normalize(direction - from).LSTo2D();
 }
Exemple #14
0
        /// <summary>
        ///     TODO The is pass wall.
        /// </summary>
        /// <param name="start">
        ///     TODO The start.
        /// </param>
        /// <param name="end">
        ///     TODO The end.
        /// </param>
        /// <returns>
        /// </returns>
        private static bool IsPassWall(Vector3 start, Vector3 end)
        {
            double count = Vector3.Distance(start, end);
            for (uint i = 0; i <= count; i += 25)
            {
                var pos = start.LSTo2D().LSExtend(Player.ServerPosition.LSTo2D(), -i);
                if (pos.IsWall())
                {
                    return true;
                }
            }

            return false;
        }
Exemple #15
0
        private static void MoveTo(Vector3 position)
        {
            var delay = getSliderItem(menuMisc, "orb_Misc_Humanizer");
            if (Environment.TickCount - _lastMovement < delay)
                return;
            _lastMovement = Environment.TickCount;

            var holdAreaRadius = getSliderItem(menuMisc, "orb_Misc_Holdzone");
            if (MyHero.ServerPosition.LSDistance(position) < holdAreaRadius)
            {
                if (MyHero.Path.Count() > 1)
                    Player.IssueOrder(GameObjectOrder.Stop, MyHero.Position);
                return;
            }
            var point = MyHero.ServerPosition +
            300 * (position.LSTo2D() - MyHero.ServerPosition.LSTo2D()).LSNormalized().To3D();
            Player.IssueOrder(GameObjectOrder.MoveTo, point);
        }
Exemple #16
0
        private static bool InCone(Vector3 Position)
        {
            var range = R.Range;
            var angle = 70f * (float)Math.PI / 180;
            var end2 = rPosCast.LSTo2D() - Player.Position.LSTo2D();
            var edge1 = end2.LSRotated(-angle / 2);
            var edge2 = edge1.LSRotated(angle);

            var point = Position.LSTo2D() - Player.Position.LSTo2D();
            if (point.LSDistance(new Vector2(), true) < range * range && edge1.LSCrossProduct(point) > 0 && point.LSCrossProduct(edge2) > 0)
                return true;

            return false;
        }
Exemple #17
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Circle" /> class.
 /// </summary>
 /// <param name="center">The center.</param>
 /// <param name="radius">The radius.</param>
 /// <param name="quality">The quality.</param>
 public Circle(Vector3 center, float radius, int quality = 20)
     : this(center.LSTo2D(), radius, quality)
 {
 }
Exemple #18
0
        public bool IsAboutToHit(int time, Vector3 position)
        {
            if (SpellData.Type == SkillShotType.SkillshotMissileLine)
            {
                Vector2 missilePos = GetMissilePosition(0);
                Vector2 missilePosAfterT = GetMissilePosition(time);
                LeagueSharp.Common.Geometry.ProjectionInfo projection = position.LSTo2D().LSProjectOn(missilePos, missilePosAfterT);

                return projection.IsOnSegment &&
                       projection.SegmentPoint.LSDistance(position) < SpellData.Radius;
            }

            if (IsSafe(position.LSTo2D()))
            {
                return false;
            }

            var timeToExplode = SpellData.ExtraDuration + SpellData.Delay +
                                (int)((1000 * Start.LSDistance(End)) / SpellData.MissileSpeed) -
                                (Environment.TickCount - StartTick);
            return timeToExplode <= time;
        }
Exemple #19
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Polygon.Line" /> class.
 /// </summary>
 /// <param name="start">The start.</param>
 /// <param name="end">The end.</param>
 /// <param name="length">The length.</param>
 public Line(Vector3 start, Vector3 end, float length = -1)
     : this(start.LSTo2D(), end.LSTo2D(), length)
 {
 }
Exemple #20
0
            public static Vector3 bestVectorToAoeFarm(Vector3 center, float spellrange, float spellWidth, int hit = 0)
            {
                var minions = MinionManager.GetMinions(center, spellrange, MinionTypes.All, MinionTeam.NotAlly);
                var bestPos = new Vector3();
                var hits = hit;
                foreach (var minion in minions)
                {
                    if (countMinionsInrange(minion.Position, spellWidth) > hits)
                    {
                        bestPos = minion.Position;
                        hits = countMinionsInrange(minion.Position, spellWidth);
                    }
                    var newPos = new Vector3(minion.Position.X + 80, minion.Position.Y + 80, minion.Position.Z);
                    for (var i = 1; i < 4; i++)
                    {
                        var rotated = newPos.LSTo2D().RotateAroundPoint(newPos.LSTo2D(), 90*i).To3D();
                        if (countMinionsInrange(rotated, spellWidth) > hits && player.LSDistance(rotated) <= spellrange)
                        {
                            bestPos = newPos;
                            hits = countMinionsInrange(rotated, spellWidth);
                        }
                    }
                }

                return bestPos;
            }
Exemple #21
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Polygon.Ring" /> class.
 /// </summary>
 /// <param name="center">The center.</param>
 /// <param name="innerRadius">The inner radius.</param>
 /// <param name="outerRadius">The outer radius.</param>
 /// <param name="quality">The quality.</param>
 public Ring(Vector3 center, float innerRadius, float outerRadius, int quality = 20)
     : this(center.LSTo2D(), innerRadius, outerRadius, quality)
 {
 }
Exemple #22
0
 /// <summary>
 /// Searches for the position.
 /// </summary>
 /// <param name="position">The position.</param>
 /// <returns></returns>
 public int[][] SearchPosition(Vector3 position)
 {
     return SearchPosition(position.LSTo2D());
 }
Exemple #23
0
 /// <summary>
 ///     Calculates the 2D distance to the point.
 /// </summary>
 /// <param name="unit">The unit.</param>
 /// <param name="point">The point.</param>
 /// <param name="squared">if set to <c>true</c> [squared].</param>
 /// <returns></returns>
 public static float ELDistance(this Obj_AI_Base unit, Vector3 point, bool squared = false)
 {
     return unit.ServerPosition.LSTo2D().LSDistance(point.LSTo2D(), squared);
 }
        public static void CreateSpellData(Obj_AI_Base hero, Vector3 spellStartPos, Vector3 spellEndPos,
            SpellData spellData, GameObject obj = null, float extraEndTick = 0.0f, bool processSpell = true,
            SpellType spellType = SpellType.None, bool checkEndExplosion = true, float spellRadius = 0)
        {
            if (checkEndExplosion && spellData.hasEndExplosion)
            {
                CreateSpellData(hero, spellStartPos, spellEndPos,
            spellData, obj, extraEndTick, false,
            spellData.spellType, false);

                CreateSpellData(hero, spellStartPos, spellEndPos,
            spellData, obj, extraEndTick, true,
            SpellType.Circular, false);

                return;
            }

            if (spellStartPos.LSDistance(myHero.Position) < spellData.range + 1000)
            {
                Vector2 startPosition = spellStartPos.LSTo2D();
                Vector2 endPosition = spellEndPos.LSTo2D();
                Vector2 direction = (endPosition - startPosition).LSNormalized();
                float endTick = 0;

                if (spellType == SpellType.None)
                {
                    spellType = spellData.spellType;
                }

                if (spellData.fixedRange) //for diana q
                {
                    if (endPosition.LSDistance(startPosition) > spellData.range)
                    {
                        //var heroCastPos = hero.ServerPosition.LSTo2D();
                        //direction = (endPosition - heroCastPos).LSNormalized();
                        endPosition = startPosition + direction * spellData.range;
                    }
                }

                if (spellType == SpellType.Line)
                {
                    endTick = spellData.spellDelay + (spellData.range / spellData.projectileSpeed) * 1000;
                    endPosition = startPosition + direction * spellData.range;

                    if (spellData.useEndPosition)
                    {
                        var range = spellEndPos.LSTo2D().LSDistance(spellStartPos.LSTo2D());
                        endTick = spellData.spellDelay + (range / spellData.projectileSpeed) * 1000;
                        endPosition = spellEndPos.LSTo2D();
                    }

                    if (obj != null)
                        endTick -= spellData.spellDelay;
                }
                else if (spellType == SpellType.Circular)
                {
                    endTick = spellData.spellDelay;

                    if (spellData.projectileSpeed == 0)
                    {
                        endPosition = hero.ServerPosition.LSTo2D();
                    }
                    else if (spellData.projectileSpeed > 0)
                    {
                        if (spellData.spellType == SpellType.Line &&
                            spellData.hasEndExplosion &&
                            spellData.useEndPosition == false)
                        {
                            endPosition = startPosition + direction * spellData.range;
                        }

                        endTick = endTick + 1000 * startPosition.LSDistance(endPosition) / spellData.projectileSpeed;
                    }
                }
                else if (spellType == SpellType.Arc)
                {
                    endTick = endTick + 1000 * startPosition.LSDistance(endPosition) / spellData.projectileSpeed;

                    if (obj != null)
                        endTick -= spellData.spellDelay;
                }
                else if (spellType == SpellType.Cone)
                {
                    return;
                }
                else
                {
                    return;
                }

                if (spellData.invert)
                {
                    var dir = (startPosition - endPosition).LSNormalized();
                    endPosition = startPosition + dir * startPosition.LSDistance(endPosition);
                }

                if (spellData.isPerpendicular)
                {
                    startPosition = spellEndPos.LSTo2D() - direction.LSPerpendicular() * spellData.secondaryRadius;
                    endPosition = spellEndPos.LSTo2D() + direction.LSPerpendicular() * spellData.secondaryRadius;
                }

                endTick += extraEndTick;

                Spell newSpell = new Spell();

                newSpell.startTime = EvadeUtils.TickCount;
                newSpell.endTime = EvadeUtils.TickCount + endTick;
                newSpell.startPos = startPosition;
                newSpell.endPos = endPosition;
                newSpell.height = spellEndPos.Z + spellData.extraDrawHeight;
                newSpell.direction = direction;
                newSpell.heroID = hero.NetworkId;
                newSpell.info = spellData;
                newSpell.spellType = spellType;
                newSpell.radius = spellRadius > 0 ? spellRadius : newSpell.GetSpellRadius();

                if (obj != null)
                {
                    newSpell.spellObject = obj;
                    newSpell.projectileID = obj.NetworkId;
                }

                int spellID = CreateSpell(newSpell, processSpell);

                DelayAction.Add((int)(endTick + spellData.extraEndTime), () => DeleteSpell(spellID));
            }
        }
Exemple #25
0
        private static void BestAim(Vector3 predictionPos)
        {
            var start = Player.Position.LSTo2D();
            var c1 = predictionPos.LSDistance(Player.Position);
            var playerPos2d = Player.Position.LSTo2D();

            foreach (var point in pointList)
            {
                for (var j = 400; j <= 1100; j = j + 50)
                {
                    var posExtend = Player.Position.LSExtend(point, j);

                    var a1 = Player.LSDistance(posExtend);
                    var b1 = (float) Math.Sqrt(c1*c1 - a1*a1);

                    if (b1 > QSplit.Range)
                        continue;

                    var pointA = Player.Position.LSExtend(point, a1);

                    var end = pointA.LSTo2D();
                    var dir = (end - start).Normalized();
                    var pDir = dir.Perpendicular();

                    var rightEndPos = end + pDir*b1;
                    var leftEndPos = end - pDir*b1;

                    var rEndPos = new Vector3(rightEndPos.X, rightEndPos.Y, ObjectManager.Player.Position.Z);
                    var lEndPos = new Vector3(leftEndPos.X, leftEndPos.Y, ObjectManager.Player.Position.Z);

                    if (lEndPos.LSDistance(predictionPos) < QSplit.Width)
                    {
                        var collision = Q.GetCollision(playerPos2d, new List<Vector2> {posExtend.LSTo2D()});
                        if (collision.Count > 0)
                            break;

                        var collisionS = QSplit.GetCollision(pointA.LSTo2D(), new List<Vector2> {lEndPos.LSTo2D()});
                        if (collisionS.Count > 0)
                            break;

                        Q.Cast(pointA);
                        return;
                    }
                    if (rEndPos.LSDistance(predictionPos) < QSplit.Width)
                    {
                        var collision = Q.GetCollision(playerPos2d, new List<Vector2> {posExtend.LSTo2D()});
                        if (collision.Count > 0)
                            break;

                        var collisionR = QSplit.GetCollision(pointA.LSTo2D(), new List<Vector2> {rEndPos.LSTo2D()});
                        if (collisionR.Count > 0)
                            break;

                        Q.Cast(pointA);
                        return;
                    }
                }
            }
        }
Exemple #26
0
        public static bool CollisionYasuo(Vector3 from, Vector3 to)
        {
            if (!YasuoInGame)
                return false;

            if (Game.Time - yasuoWall.CastTime > 4)
                return false;

            var level = yasuoWall.WallLvl;
            var wallWidth = 350 + 50*level;
            var wallDirection =
                (yasuoWall.CastPosition.LSTo2D() - yasuoWall.YasuoPosition.LSTo2D()).LSNormalized().Perpendicular();
            var wallStart = yasuoWall.CastPosition.LSTo2D() + wallWidth/2f*wallDirection;
            var wallEnd = wallStart - wallWidth*wallDirection;

            if (wallStart.LSIntersection(wallEnd, to.LSTo2D(), from.LSTo2D()).Intersects)
            {
                return true;
            }
            return false;
        }
Exemple #27
0
 /// <summary>
 /// Searches for the game tile.
 /// </summary>
 /// <param name="position">The position.</param>
 /// <returns></returns>
 public int[][] SearchGameTile(Vector3 position)
 {
     return SearchGameTile(position.LSTo2D());
 }
Exemple #28
0
 private static void Game_OnUpdate(EventArgs args)
 {
     switch (Program.insecmode)
     {
         case 0:
             var hero = HeroManager.Allies.Where(x => !x.IsMe && !x.IsDead)
                 .OrderByDescending(x => x.LSDistance(Player.Position)).LastOrDefault();
             if (hero != null)
                 InsecPoint = hero.Position;
             break;
         case 1:
             var turret = GameObjects.AllyTurrets.OrderByDescending(x => x.LSDistance(Player.Position)).LastOrDefault();
             if (turret != null)
                 InsecPoint = turret.Position;
             break;
         case 2:
             InsecPoint = Game.CursorPos;
             break;
         case 3:
             InsecPoint = LastLeftClick;
             break;
     }
     if (!Program.insec)
         return;
     if (Orbwalker.CanMove)
     {
         Orbwalker.MoveTo(Game.CursorPos);
     }
     if (!InsecPoint.IsValid())
         return;
     var target = TargetSelector.SelectedTarget;
     if (!target.LSIsValidTarget() || target.IsZombie)
         return;
     if (!Program._r2.IsReady())
         return;
     //case 1
     Vector2 start1 = Player.Position.LSTo2D().LSExtend(InsecPoint.LSTo2D(), -300);
     Vector2 end1 = start1.LSExtend(Player.Position.LSTo2D(), 750);
     float width1 = Program._r.Level == 3 ? 125 * 6 / 2 :
                 Program._r.Level == 2 ? 125 * 5 / 2 :
                 125 * 4 / 2;
     var Rect1 = new LeagueSharp.Common.Geometry.Polygon.Rectangle(start1, end1, width1 - 100);
     var Predicted1 = LeagueSharp.Common.Prediction.GetPrediction(target, Game.Ping / 1000f + 0.25f).UnitPosition;
     if (Rect1.IsInside(target.Position) && Rect1.IsInside(Predicted1))
     {
         Program._r2.Cast(InsecPoint);
         return;
     }
     if (Environment.TickCount - LastJump < 1500)
         return;
     if (!Program._e.IsReady())
         return;
     //case 2
     var sold2 = Soldiers.soldier
             .Where(x => Player.LSDistance(x.Position) <= 1100)
             .OrderBy(x => x.Position.LSDistance(target.Position)).FirstOrDefault();
     if (sold2 != null)
     {
         if (!Program._q2.IsReady())
         {
             var time = Player.Position.LSDistance(sold2.Position) / 1700f;
             var predicted2 = LeagueSharp.Common.Prediction.GetPrediction(target, time).UnitPosition;
             Vector2 start2 = sold2.Position.LSTo2D().LSExtend(InsecPoint.LSTo2D(), -300);
             Vector2 end2 = start2.LSExtend(InsecPoint.LSTo2D(), 750);
             float width2 = Program._r.Level == 3 ? 125 * 6 / 2 :
                         Program._r.Level == 2 ? 125 * 5 / 2 :
                         125 * 4 / 2;
             var Rect2 = new LeagueSharp.Common.Geometry.Polygon.Rectangle(start2, end2, width2 - 100);
             if (Rect2.IsInside(target.Position) && Rect2.IsInside(predicted2))
             {
                 Program._e.Cast(sold2.Position);
                 LastJump = Environment.TickCount;
                 return;
             }
         }
         if (Program._q2.IsReady() && target.LSDistance(sold2.Position) <= 875 - 100)
         {
             var time = (Player.LSDistance(sold2.Position) + sold2.Position.LSDistance(target.Position)) / 1700f;
             var predicted2 = LeagueSharp.Common.Prediction.GetPrediction(target, time).UnitPosition;
             Vector2 start2 = target.Position.LSTo2D().LSExtend(InsecPoint.LSTo2D(), -300);
             Vector2 end2 = start2.LSExtend(InsecPoint.LSTo2D(), 750);
             float width2 = Program._r.Level == 3 ? 125 * 6 / 2 :
                         Program._r.Level == 2 ? 125 * 5 / 2 :
                         125 * 4 / 2;
             var Rect2 = new LeagueSharp.Common.Geometry.Polygon.Rectangle(start2, end2, width2 - 100);
             if (Rect2.IsInside(target.Position) && Rect2.IsInside(predicted2))
             {
                 var timetime = sold2.Position.LSDistance(Player.Position) * 1000 / 1700;
                 Program._e.Cast(sold2.Position);
                 LeagueSharp.Common.Utility.DelayAction.Add((int)timetime - 150 - Program.EQdelay, () => Program._q2.Cast(target.Position));
                 LastJump = Environment.TickCount;
                 return;
             }
         }
     }
     if(Program._w.IsReady())
     {
         var posWs = GeoAndExten.GetWsPosition(target.Position.LSTo2D()).Where(x => x != null);
         foreach (var posW in posWs)
         {
             if (!Program._q2.IsReady())
             {
                 var time = Player.Position.LSTo2D().LSDistance((Vector2)posW) / 1700f + 0.3f;
                 var predicted2 = LeagueSharp.Common.Prediction.GetPrediction(target, time).UnitPosition;
                 Vector2 start2 = ((Vector2)posW).LSExtend(InsecPoint.LSTo2D(), -300);
                 Vector2 end2 = start2.LSExtend(InsecPoint.LSTo2D(), 750);
                 float width2 = Program._r.Level == 3 ? 125 * 6 / 2 :
                             Program._r.Level == 2 ? 125 * 5 / 2 :
                             125 * 4 / 2;
                 var Rect2 = new LeagueSharp.Common.Geometry.Polygon.Rectangle(start2, end2, width2 - 100);
                 if (Rect2.IsInside(target.Position) && Rect2.IsInside(predicted2))
                 {
                     var timetime = ((Vector2)posW).LSDistance(Player.Position) * 1000 / 1700;
                     Program._w.Cast(Player.Position.LSTo2D().LSExtend((Vector2)posW, Program._w.Range));
                     LeagueSharp.Common.Utility.DelayAction.Add(0, () => Program._e.Cast((Vector2)posW));
                     LeagueSharp.Common.Utility.DelayAction.Add((int)timetime + 300 - 150 - Program.EQdelay, () => Program._q2.Cast(target.Position));
                     LastJump = Environment.TickCount;
                     return;
                 }
             }
             if (Program._q2.IsReady() && target.LSDistance((Vector2)posW) <= 875 - 100)
             {
                 var time = (Player.LSDistance((Vector2)posW) + ((Vector2)posW).LSDistance(target.Position)) / 1700f + 0.3f;
                 var predicted2 = LeagueSharp.Common.Prediction.GetPrediction(target, time).UnitPosition;
                 Vector2 start2 = target.Position.LSTo2D().LSExtend(InsecPoint.LSTo2D(), -300);
                 Vector2 end2 = start2.LSExtend(InsecPoint.LSTo2D(), 750);
                 float width2 = Program._r.Level == 3 ? 125 * 6 / 2 :
                             Program._r.Level == 2 ? 125 * 5 / 2 :
                             125 * 4 / 2;
                 var Rect2 = new LeagueSharp.Common.Geometry.Polygon.Rectangle(start2, end2, width2 - 100);
                 if (Rect2.IsInside(target.Position) && Rect2.IsInside(predicted2))
                 {
                     var timetime = ((Vector2)posW).LSDistance(Player.Position) * 1000 / 1700;
                     Program._w.Cast(Player.Position.LSTo2D().LSExtend((Vector2)posW, Program._w.Range));
                     LeagueSharp.Common.Utility.DelayAction.Add(0, () => Program._e.Cast((Vector2)posW));
                     LeagueSharp.Common.Utility.DelayAction.Add((int)timetime + 300 - 150 - Program.EQdelay, () => Program._q2.Cast(target.Position));
                     LastJump = Environment.TickCount;
                     return;
                 }
             }
         }
     }
 }
Exemple #29
0
 private static Vector2? GetFirstWallPoint(Vector3 from, Vector3 to, float step = 25)
 {
     return GetFirstWallPoint(from.LSTo2D(), to.LSTo2D(), step);
 }
Exemple #30
0
 /// <summary>
 ///     Adds the specified point.
 /// </summary>
 /// <param name="point">The point.</param>
 public void Add(Vector3 point)
 {
     Points.Add(point.LSTo2D());
 }