public static void Main(string[] args) { Loading.OnLoadingComplete += delegate { _skillshotDetector = new SkillshotDetector(); Evade = new EvadePlus(_skillshotDetector); EvadeMenu.CreateMenu(); }; }
public static bool ProcessFlash(EvadePlus evade) { var dangerValue = evade.GetDangerValue(); var flashDangerValue = EvadeMenu.SpellMenu["flash"].Cast <Slider>().CurrentValue; if (flashDangerValue > 0 && flashDangerValue <= dangerValue) { var castPos = GetBlinkCastPos(evade, Player.Instance.ServerPosition.To2D(), 425); var slot = GetFlashSpellSlot(); if (!castPos.IsZero && slot != SpellSlot.Unknown && Player.CanUseSpell(slot) == SpellState.Ready) { //Player.IssueOrder(GameObjectOrder.Stop, Player.Instance.Position, true); Player.CastSpell(slot, castPos.To3DWorld()); return(true); } } return(false); }
public static bool ProcessFlash(EvadePlus evade) { var dangerValue = evade.GetDangerValue(); var flashDangerValue = EvadeMenu.SpellMenu["flash"].Cast<Slider>().CurrentValue; if (flashDangerValue > 0 && flashDangerValue <= dangerValue) { var castPos = GetBlinkCastPos(evade, Player.Instance.ServerPosition.To2D(), 425); var slot = GetFlashSpellSlot(); if (!castPos.IsZero && slot != SpellSlot.Unknown && Player.CanUseSpell(slot) == SpellState.Ready) { //Player.IssueOrder(GameObjectOrder.Stop, Player.Instance.Position, true); Player.CastSpell(slot, castPos.To3DWorld()); return true; } } return false; }
public EvadeResult(EvadePlus evade, Vector2 evadePoint, Vector2 anchorPoint, int totalTimeAvailable, int timeAvailable, bool enoughTime) { Evade = evade; PlayerPos = Player.Instance.Position.To2D(); Time = Environment.TickCount; EvadePoint = evadePoint; AnchorPoint = anchorPoint; TotalTimeAvailable = totalTimeAvailable; TimeAvailable = timeAvailable; EnoughTime = enoughTime; // extra evade range if (Evade.ExtraEvadeRange > 0) { ExtraRange = (Evade.RandomizeExtraEvadeRange ? Utils.Random.Next(Evade.ExtraEvadeRange / 3, Evade.ExtraEvadeRange) : Evade.ExtraEvadeRange); } }
public static Vector2 GetBlinkCastPos(EvadePlus evade, Vector2 center, float maxRange) { var polygons = evade.ClippedPolygons.Where(p => p.IsInside(center)).ToArray(); var segments = new List <Vector2[]>(); foreach (var pol in polygons) { for (var i = 0; i < pol.Points.Count; i++) { var start = pol.Points[i]; var end = i == pol.Points.Count - 1 ? pol.Points[0] : pol.Points[i + 1]; var intersections = Utils.GetLineCircleIntersectionPoints(center, maxRange, start, end) .Where(p => p.IsInLineSegment(start, end)) .ToList(); if (intersections.Count == 0) { if (start.Distance(center, true) < maxRange.Pow() && end.Distance(center, true) < maxRange.Pow()) { intersections = new[] { start, end }.ToList(); } else { continue; } } else if (intersections.Count == 1) { intersections.Add(center.Distance(start, true) > center.Distance(end, true) ? end : start); } segments.Add(intersections.ToArray()); } } if (!segments.Any()) { return(Vector2.Zero); } const int maxdist = 2000; const int division = 30; var points = new List <Vector2>(); foreach (var segment in segments) { var dist = segment[0].Distance(segment[1]); if (dist > maxdist) { segment[0] = segment[0].Extend(segment[1], dist / 2 - maxdist / 2); segment[1] = segment[1].Extend(segment[1], dist / 2 - maxdist / 2); dist = maxdist; } var step = maxdist / division; var count = dist / step; for (var i = 0; i < count; i++) { var point = segment[0].Extend(segment[1], i * step); if (!point.IsWall()) { points.Add(point); } } } if (!points.Any()) { return(Vector2.Zero); } var evadePoint = points.OrderByDescending(p => p.Distance(evade.LastIssueOrderPos) + p.Distance(center)).Last(); return(evadePoint); }
public EvadeResult(EvadePlus evade, Vector2 evadePoint, Vector2 anchorPoint, int totalTimeAvailable, int timeAvailable, bool enoughTime) { Evade = evade; PlayerPos = Player.Instance.Position.To2D(); Time = Environment.TickCount; EvadePoint = evadePoint; AnchorPoint = anchorPoint; TotalTimeAvailable = totalTimeAvailable; TimeAvailable = timeAvailable; EnoughTime = enoughTime; // extra evade range if (Evade.ExtraEvadeRange > 0) { ExtraRange = (Evade.RandomizeExtraEvadeRange ? Utils.Random.Next(Evade.ExtraEvadeRange/3, Evade.ExtraEvadeRange) : Evade.ExtraEvadeRange); } }
public static void Main(string[] args) { _skillshotDetector = new SkillshotDetector(); Evade = new EvadePlus(_skillshotDetector); EvadeMenu.CreateMenu(); }
public EvadeResult(EvadePlus evade, Vector2 evadePoint, Vector2 anchorPoint, int totalTimeAvailable, int timeAvailable, bool enoughTime) { Evade = evade; PlayerPos = Player.Instance.Position.To2D(); Time = Environment.TickCount; EvadePoint = evadePoint.Extend(PlayerPos, -70); //adjust evade range; AnchorPoint = anchorPoint; TotalTimeAvailable = totalTimeAvailable; TimeAvailable = timeAvailable; EnoughTime = enoughTime; // fix evade pos //if (evadePoint.IsInLineSegment(PlayerPos, anchorPoint, 40)) //{ // EvadePoint = anchorPoint; //} // extra evade range if (Evade.ExtraEvadeRange > 0) { var newPoint = EvadePoint.Extend(PlayerPos, -(Evade.RandomizeExtraEvadeRange ? Utils.Random.Next(Evade.ExtraEvadeRange/3, Evade.ExtraEvadeRange) : Evade.ExtraEvadeRange)); if (Evade.IsPointSafe(newPoint)) { EvadePoint = newPoint; } } }
public static Vector2 GetBlinkCastPos(EvadePlus evade, Vector2 center, float maxRange) { var polygons = evade.ClippedPolygons.Where(p => p.IsInside(center)).ToArray(); var segments = new List<Vector2[]>(); foreach (var pol in polygons) { for (var i = 0; i < pol.Points.Count; i++) { var start = pol.Points[i]; var end = i == pol.Points.Count - 1 ? pol.Points[0] : pol.Points[i + 1]; var intersections = Utils.GetLineCircleIntersectionPoints(center, maxRange, start, end) .Where(p => p.IsInLineSegment(start, end)) .ToList(); if (intersections.Count == 0) { if (start.Distance(center, true) < maxRange.Pow() && end.Distance(center, true) < maxRange.Pow()) { intersections = new[] {start, end}.ToList(); } else { continue; } } else if (intersections.Count == 1) { intersections.Add(center.Distance(start, true) > center.Distance(end, true) ? end : start); } segments.Add(intersections.ToArray()); } } if (!segments.Any()) { return Vector2.Zero; } const int maxdist = 2000; const int division = 30; var points = new List<Vector2>(); foreach (var segment in segments) { var dist = segment[0].Distance(segment[1]); if (dist > maxdist) { segment[0] = segment[0].Extend(segment[1], dist/2 - maxdist/2); segment[1] = segment[1].Extend(segment[1], dist/2 - maxdist/2); dist = maxdist; } var step = maxdist/division; var count = dist/step; for (var i = 0; i < count; i++) { var point = segment[0].Extend(segment[1], i*step); if (!point.IsWall()) { points.Add(point); } } } if (!points.Any()) { return Vector2.Zero; } var evadePoint = points.OrderByDescending(p => p.Distance(evade.LastIssueOrderPos) + p.Distance(center)).Last(); return evadePoint; }