public EvadePlus(SkillshotDetector detector) { Skillshots = new EvadeSkillshot[] {}; Polygons = new Geometry.Polygon[] {}; ClippedPolygons = new List<Geometry.Polygon>(); SkillshotDetector = detector; SkillshotDetector.OnUpdateSkillshots += OnUpdateSkillshots; SkillshotDetector.OnSkillshotActivation += OnSkillshotActivation; SkillshotDetector.OnSkillshotDetected += OnSkillshotDetected; SkillshotDetector.OnSkillshotDeleted += OnSkillshotDeleted; Player.OnIssueOrder += PlayerOnIssueOrder; Game.OnTick += Ontick; }
public EvadePlus(SkillshotDetector detector) { Skillshots = new EvadeSkillshot[] {}; Polygons = new Geometry.Polygon[] {}; ClippedPolygons = new List<Geometry.Polygon>(); StatusText = new Text("EvadePlus Enabled", new Font("Lucida Sans Unicode", 7.7F, FontStyle.Bold)); //Lucida Console, 9 StatusTextShadow = new Text("EvadePlus Enabled", new Font("Lucida Sans Unicode", 7.7F, FontStyle.Bold)); SkillshotDetector = detector; SkillshotDetector.OnUpdateSkillshots += OnUpdateSkillshots; SkillshotDetector.OnSkillshotActivation += OnSkillshotActivation; SkillshotDetector.OnSkillshotDetected += OnSkillshotDetected; SkillshotDetector.OnSkillshotDeleted += OnSkillshotDeleted; Player.OnIssueOrder += PlayerOnIssueOrder; Game.OnTick += Ontick; Drawing.OnDraw += OnDraw; }
public EvadePlus(SkillshotDetector detector) { Skillshots = new EvadeSkillshot[] {}; Polygons = new Geometry.Polygon[] {}; ClippedPolygons = new List<Geometry.Polygon>(); PathFinding = new PathFinding(this); StatusText = new Text("EvadePlus Enabled", new Font("Calisto MT", 10F, FontStyle.Bold)); StatusTextShadow = new Text("EvadePlus Enabled", new Font("Calisto MT", 10F, FontStyle.Bold)); SkillshotDetector = detector; SkillshotDetector.OnUpdateSkillshots += OnUpdateSkillshots; SkillshotDetector.OnSkillshotActivation += OnSkillshotActivation; SkillshotDetector.OnSkillshotDetected += OnSkillshotDetected; SkillshotDetector.OnSkillshotDeleted += OnSkillshotDeleted; Player.OnIssueOrder += PlayerOnIssueOrder; Game.OnTick += Ontick; }
/// <summary> /// Gets Aoe Prediction result /// </summary> /// <param name="width">Spell width</param> /// <param name="delay">Spell delay</param> /// <param name="missileSpeed">Spell missile speed</param> /// <param name="range">Spell range</param> /// <param name="from">Spell casted position</param> /// <param name="rangeCheckFrom"></param> /// <returns>Prediction result as <see cref="Prediction.AoeResult" /></returns> public static Prediction.AoeResult GetAoePrediction(float width, float delay, float missileSpeed, float range, Vector2 from, Vector2 rangeCheckFrom) { var result = new Prediction.AoeResult(); var enemies = HeroManager.Enemies.Where( p => p.LSIsValidTarget() && Prediction.GetFastUnitPosition(p, delay, 0, from).LSDistance(rangeCheckFrom) < range); foreach (var enemy in enemies) { var prediction = GetPrediction(enemy, width, delay, missileSpeed, range, false, enemy.GetWaypoints(), enemy.AvgMovChangeTime(), enemy.LastMovChangeTime(), enemy.AvgPathLenght(), enemy.LastAngleDiff(), from, rangeCheckFrom); if (prediction.HitChance > EloBuddy.SDK.Enumerations.HitChance.Medium) { var multp = result.CastPosition.LSDistance(@from)/875.0f; var spellHitBox = new Geometry.Polygon( ClipperWrapper.DefineArc(from - new Vector2(875/2f, 20), result.CastPosition, (float) Math.PI*multp, 410, 200*multp), ClipperWrapper.DefineArc(from - new Vector2(875/2f, 20), result.CastPosition, (float) Math.PI*multp, 410, 320*multp)); var collidedEnemies = HeroManager.Enemies.AsParallel() .Where( p => ClipperWrapper.IsIntersects( ClipperWrapper.MakePaths( ClipperWrapper.DefineCircle( Prediction.GetFastUnitPosition(p, delay, missileSpeed), p.BoundingRadius)), ClipperWrapper.MakePaths(spellHitBox))); var collisionCount = collidedEnemies.Count(); if (collisionCount > result.HitCount) result = prediction.ToAoeResult(collisionCount, new Collision.Result(collidedEnemies.ToList<Obj_AI_Base>(), Collision.Flags.EnemyChampions)); } } return result; }
public EvadePlus(SkillshotDetector detector) { Skillshots = new EvadeSkillshot[] {}; Polygons = new Geometry.Polygon[] {}; ClippedPolygons = new List<Geometry.Polygon>(); PathFinding = new PathFinding(this); StatusText = new Text("EvadePlus Enabled", new Font("Euphemia", 10F, FontStyle.Bold)); //Calisto MT _skillshotPolygonCache = new Dictionary<EvadeSkillshot, Geometry.Polygon>(); SkillshotDetector = detector; SkillshotDetector.OnUpdateSkillshots += OnUpdateSkillshots; SkillshotDetector.OnSkillshotActivation += OnSkillshotActivation; SkillshotDetector.OnSkillshotDetected += OnSkillshotDetected; SkillshotDetector.OnSkillshotDeleted += OnSkillshotDeleted; Player.OnIssueOrder += PlayerOnIssueOrder; Obj_AI_Base.OnProcessSpellCast += OnProcessSpellCast; Dash.OnDash += OnDash; Game.OnTick += Ontick; Drawing.OnDraw += OnDraw; }
public static Geometry.Polygon GetPoly(Vector3 pos, float range, float width) { var poss = Shen.ServerPosition.Extend(pos, range); var direction = (poss.Normalized() - Shen.ServerPosition.To2D()).Normalized(); var pos1 = (Shen.ServerPosition.To2D() - direction.Perpendicular()*width/2f).To3D(); var pos2 = (poss.Normalized() + (poss.Normalized() - Shen.ServerPosition.To2D()).Normalized() + direction.Perpendicular()*width/2f).To3D(); var pos3 = (Shen.ServerPosition.To2D() + direction.Perpendicular()*width/2f).To3D(); var pos4 = (poss.Normalized() + (poss.Normalized() - Shen.ServerPosition.To2D()).Normalized() - direction.Perpendicular()*width/2f).To3D(); var poly = new Geometry.Polygon(); poly.Add(pos1); poly.Add(pos3); poly.Add(pos2); poly.Add(pos4); return poly; }
public static void CheckUltimateHits() { int maxHitCount = 0; Vector2 bestEndVec = Vector2.Zero; Geometry.Polygon BestCone = null; for (int i = 0; i < 360; i += 20) { var endVec = PointOnCircle(i); Geometry.Polygon Cone = CreateUltimateCone(endVec); int currentHits = EntityManager.Heroes.Enemies.Where(x => x.IsValid && !x.IsDead && !x.IsZombie).Count( x => { var pred = Prediction.Position.PredictUnitPosition(x, (int)(Spells.R2.CastDelay + x.Distance(Player.Instance) / Spells.R2.Speed * 1000)); bool inside = Cone.IsInside(pred); return(inside); }); if (currentHits > maxHitCount) { maxHitCount = currentHits; bestEndVec = endVec; BestCone = Cone; } } if (BestCone != null && maxHitCount >= RivenMenu.Combo["minR2Hits"].Cast <Slider>().CurrentValue) { Spells.ForceR2(Player.Instance.Position.Extend(bestEndVec, 100)); } }
public static Geometry.Polygon GetPoly(Vector3 pos, float range, float widht) { var POS = player.ServerPosition.Extend(pos, range); var direction = (POS.To2D() - player.ServerPosition.To2D()).Normalized(); var pos1 = (player.ServerPosition.To2D() - direction.Perpendicular() * widht / 2f).To3D(); var pos2 = (POS.To2D() + (POS.To2D() - player.ServerPosition.To2D()).Normalized() + direction.Perpendicular() * widht / 2f).To3D(); var pos3 = (player.ServerPosition.To2D() + direction.Perpendicular() * widht / 2f).To3D(); var pos4 = (POS.To2D() + (POS.To2D() - player.ServerPosition.To2D()).Normalized() - direction.Perpendicular() * widht / 2f).To3D(); var poly = new Geometry.Polygon(); poly.Add(pos1); poly.Add(pos3); poly.Add(pos2); poly.Add(pos4); return(poly); }
public static Geometry.Polygon ToDetailedPolygon(this Geometry.Polygon polygon, float tolerance = 90) { var list = new List <Vector2>(); for (var i = 0; i < polygon.Points.Count; i++) { var lineStart = polygon.Points[i]; var lineEnd = (i + 1 == polygon.Points.Count) ? polygon.Points[0] : polygon.Points[i + 1]; if (lineStart.Distance(lineEnd, true) > tolerance.Pow()) { var condition = (int)lineStart.Distance(lineEnd) / tolerance; for (var u = 0; u < condition; u++) { list.Add(lineStart.Extend(lineEnd, u * tolerance)); } } else { list.Add(lineStart); } } return(list.ToPolygon()); }
private Geometry.Polygon GetPoly(Vector3 pos) { var POS = player.ServerPosition.Extend(pos, Q.ChargedMaxRange); var direction = (POS.To2D() - player.ServerPosition.To2D()).Normalized(); var pos1 = (player.ServerPosition.To2D() - direction.Perpendicular() * qWidth / 2f).To3D(); var pos2 = (POS.To2D() + (POS.To2D() - player.ServerPosition.To2D()).Normalized() + direction.Perpendicular() * qWidth / 2f).To3D(); var pos3 = (player.ServerPosition.To2D() + direction.Perpendicular() * qWidth / 2f).To3D(); var pos4 = (POS.To2D() + (POS.To2D() - player.ServerPosition.To2D()).Normalized() - direction.Perpendicular() * qWidth / 2f).To3D(); var poly = new Geometry.Polygon(); poly.Add(pos1); poly.Add(pos3); poly.Add(pos2); poly.Add(pos4); return(poly); }
public static void ExecuteW() { if (!LocalMenu.Item("Flee.UseW").GetValue<bool>()) { return; } var pos = Game.CursorPos; if (jumpingWithQ) { return; } if (WStage != Program.WCastStage.IsReady) { canJumpWithW = false; return; } toPolygon = new Geometry.Rectangle(ObjectManager.Player.Position.To2D(), ObjectManager.Player.Position.To2D() .Extend(pos.To2D(), ObjectManager.Player.Position.Distance(pos) < W.Range ? W.Range : +ObjectManager.Player.Position.Distance(pos)), LocalMenu.Item("Flee.Range").GetValue<Slider>().Value).ToPolygon(); if (wardJumpObjectforFlee != null && WStage == Program.WCastStage.IsReady) { Render.Circle.DrawCircle(wardJumpObjectforFlee.Position, 85f, Color.Coral); canJumpWithW = true; W.CastOnUnit(wardJumpObjectforFlee); return; } var jObjects = ObjectManager.Get<Obj_AI_Base>() .OrderByDescending(obj => obj.Distance(ObjectManager.Player.ServerPosition)) .FirstOrDefault(obj => obj.IsAlly && !obj.IsMe && !obj.IsDead && !(obj.Name.IndexOf("turret", StringComparison.InvariantCultureIgnoreCase) >= 0) && obj.Distance(ObjectManager.Player.Position) <= W.Range && obj.Distance(ObjectManager.Player.Position) > Orbwalking.GetRealAutoAttackRange(null) + 100 && toPolygon.IsInside(obj.Position)); if (jObjects != null) { Render.Circle.DrawCircle(jObjects.Position, 85f, Color.Coral); Program.WardJump(jObjects.Position); canJumpWithW = true; return; } if (Items.GetWardSlot() != null && Items.GetWardSlot().Stacks > 0) { canJumpWithW = true; Program.PutWard(ObjectManager.Player.Position.Extend(pos, wardRange)); return; } canJumpWithW = false; }
public CustomPolygon(Geometry.Polygon poly, SpellInfo spellInfo) { polygon = poly; info = spellInfo; }
private static void Drawing_RKickWaveForKillableEnemy(EventArgs args) { if (Config.Item("Insec").GetValue<KeyBind>().Active || Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Combo) { return; } if (!MenuCombo.Item("Combo.R.UseRKickWaveForKill").GetValue<bool>() || !R.IsReady()) { return; } Obj_AI_Hero t = HeroManager.Enemies.Find( e => e.IsValidTarget(Q.Range + W.Range) && !e.IsDead && !e.IsZombie && e.Distance(Game.CursorPos) < e.Distance(ObjectManager.Player.Position) && /*if I'm fallowing the enemy*/ !e.IsValidTarget(Orbwalking.GetRealAutoAttackRange(null) + 65) && e.Health < e.MaxHealth*0.14); //.OrderByDescending(o => o.MaxHealth) //.FirstOrDefault(); if (t == null) { return; } foreach (var enemy in HeroManager.Enemies.Where(e => e.Distance(t.Position) < 800 && e.NetworkId != t.NetworkId && ObjectManager.Player.Distance(e) < ObjectManager.Player.Distance(t))) { toPolygon = new Geometry.Rectangle(t.Position.To2D(), t.Position.To2D().Extend(ObjectManager.Player.Position.To2D(), 800), 100).ToPolygon(); toPolygon.Draw(Color.Blue, 3); if (toPolygon.IsInside(enemy.Position.To2D())) { //Render.Circle.DrawCircle(enemy.Position, 150f, Color.Black); R.CastOnUnit(enemy); } } }
private void CastQr() { if (Q.IsReady && R.IsReady) { Q.CachedPredictions.Clear(); var qWidth = Q.Width; var qCastDelay = Q.CastDelay; Q.CastDelay = R.CastDelay + qCastDelay; Q.Width = R.Range; var list = (from enemy in UnitManager.ValidEnemyHeroes select Q.GetPrediction(enemy) into pred where pred.HitChancePercent >= R.HitChancePercent / 2f select pred.CastPosition.To2D()).ToList(); if (list.Count >= ComboMenu.Slider("R.Hit")) { var bestCount = -1; var bestPoint = new Vector2(0, 0); var result = Enumerable.Range(1, (1 << list.Count) - 1).Select(index => list.Where((item, idx) => ((1 << idx) & index) != 0).ToList()).ToList(); foreach (var points in result) { var polygon = new Geometry.Polygon(); polygon.Points.AddRange(points); var center = polygon.CenterOfPolygon(); var count = list.Count(v => center.IsInRange(v, R.Range * 1.4f)); if (count > bestCount) { bestCount = count; bestPoint = center; } } if (bestCount >= ComboMenu.Slider("R.Hit")) { Q.Cast(bestPoint.To3DWorld()); } } Q.CachedPredictions.Clear(); Q.CastDelay = qCastDelay; Q.Width = qWidth; } }
float GetDistanceToPolygonEdge(Vector2 point, Geometry.Polygon polygon) { return(polygon.Points.OrderBy(x => x.Distance(point)).First().Distance(point)); }
public CustomPolygon(Geometry.Polygon poly, ParticleInfo particleInfo) { polygon = poly; partinfo = particleInfo; }
// TODO PRIORITY: MEDIUM - LOW /// <summary> /// Removes every PathBase that intersects with a skillshot /// </summary> public void RemovePathesThroughSkillshots(List <Skillshot> skillshots) { if (GlobalVariables.Debug) { Console.WriteLine($"GridGenerator.Cs > RemovePathesThroughSkillshots() > {skillshots.Count}"); } if (this.Grid?.Connections == null || !this.Grid.Connections.Any() || this.Grid.Points == null) { return; } var skillshotDict = new Dictionary <Skillshot, Geometry.Polygon>(); if (skillshots.Any()) { foreach (var skillshot in skillshots) { var polygon = new Geometry.Polygon(); switch (skillshot.SData.SpellType) { case LeagueSharp.Data.Enumerations.SpellType.SkillshotLine: polygon = new Geometry.Polygon.Rectangle( skillshot.StartPosition, skillshot.EndPosition, skillshot.SData.Radius); break; case LeagueSharp.Data.Enumerations.SpellType.SkillshotCircle: polygon = new Geometry.Polygon.Circle(skillshot.EndPosition, skillshot.SData.Radius); break; case LeagueSharp.Data.Enumerations.SpellType.SkillshotArc: polygon = new Geometry.Polygon.Sector( skillshot.StartPosition, skillshot.Direction, skillshot.SData.Angle, skillshot.SData.Radius); break; } skillshotDict.Add(skillshot, polygon); } } if (skillshotDict.Any()) { foreach (var skillshot in skillshotDict) { //foreach (var point in Grid.Points.ToList()) //{ // if (skillshot.Value.IsInside(point.Position)) // { // Grid?.Points?.Remove(point); // } //} foreach (var connection in this.Grid.Connections.Where(x => x is YasuoDashConnection)) { var clipperpath = skillshot.Value.ToClipperPath(); var connectionpolygon = new Geometry.Polygon.Line( connection.Start.Position, connection.End.Position); var connectionclipperpath = connectionpolygon.ToClipperPath(); if (clipperpath.Intersect(connectionclipperpath).Any()) { Console.WriteLine(@"Removing YasuoConnection"); this.Grid?.Connections?.Remove(connection); } } } } this.RemoveDisconnectedConnections(); }
/// <summary> /// Gets the Forth and rear autoattack polygons /// </summary> /// <returns>Index 0 = Forth, index 1 = rear</returns> public static Geometry.Polygon[] ReturnForthandRearPolygons() { var polygons = SegmentedAutoattackPolygons(); var index = 0; var forthAndRearPolygons = new Geometry.Polygon[2]; for (var i = 0; i < 4; i++) { var objAiTurret = EntityManager.Turrets.Enemies.OrderBy(a => a.Distance(Player.Instance.ServerPosition)).FirstOrDefault(x => x.Distance(Player.Instance.Position) < 2500); var enemy = EntityManager.Heroes.Enemies.OrderBy(a => a.Distance(Player.Instance.ServerPosition)).FirstOrDefault(x => x.Distance(Player.Instance.Position) < 1200); Vector3 direction; if (enemy != null) { direction = enemy.ServerPosition; } else if (objAiTurret != null) { direction = objAiTurret.ServerPosition; } else { direction = Player.Instance.Path.Last(); } if (polygons[i].IsInside(direction.ExtendPlayerVector())) { index = i; } } var reverseid = index < 2 ? index + 2 : index - 2; forthAndRearPolygons[0] = polygons[index]; forthAndRearPolygons[1] = polygons[reverseid]; return forthAndRearPolygons; }
/// <summary> /// Check Yasuo wall collisions /// </summary> /// <param name="from">Start position</param> /// <param name="to">End position</param> /// <param name="width">Rectangle scale</param> /// <param name="isArc">Check collision for arc spell</param> /// <returns>true if collision found</returns> public static bool CheckYasuoWallCollision(Vector2 from, Vector2 to, float width, bool isArc = false) { if (Utils.TickCount - yasuoWallCastedTick > 4000) return false; var yasuoWall = ObjectManager.Get<GameObject>() .Where( p => p.IsValid && Regex.IsMatch(p.Name, "_w_windwall_enemy_0.\\.troy", RegexOptions.IgnoreCase)) .FirstOrDefault(); if (yasuoWall == null) return false; var yasuoWallDirection = (yasuoWall.Position.LSTo2D() - yasuoWallCastedPos).LSNormalized().LSPerpendicular(); float yasuoWallWidth = 300 + 50*yasuoWallLevel; var yasuoWallStart = yasuoWall.Position.LSTo2D() + yasuoWallWidth/2f*yasuoWallDirection; var yasuoWallEnd = yasuoWallStart - yasuoWallWidth*yasuoWallDirection; var yasuoWallPoly = ClipperWrapper.DefineRectangle(yasuoWallStart, yasuoWallEnd, 5); var spellHitBox = ClipperWrapper.DefineRectangle(from, to, width); if (isArc) { spellHitBox = new Geometry.Polygon( ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float) Math.PI*(to.LSDistance(from)/ 900), 410, 200*(to.LSDistance(from)/ 900)), ClipperWrapper.DefineArc(from - new Vector2(900 / 2f, 20), to, (float) Math.PI*(to.LSDistance(from)/ 900), 410, 320*(to.LSDistance(from)/ 900))); } return ClipperWrapper.IsIntersects(ClipperWrapper.MakePaths(yasuoWallPoly), ClipperWrapper.MakePaths(spellHitBox)); }
public void UpdatePolygon() { switch (SpellData.Type) { case SkillShotType.SkillshotCircle: Polygon = Circle.ToPolygon(); EvadePolygon = Circle.ToPolygon(15); PathFindingPolygon = Circle.ToPolygon(60); PathFindingInnerPolygon = Circle.ToPolygon(35); DrawingPolygon = Circle.ToPolygon( 0, !SpellData.AddHitbox ? SpellData.Radius : (SpellData.Radius - ObjectManager.Player.BoundingRadius)); break; case SkillShotType.SkillshotLine: Polygon = Rectangle.ToPolygon(); DrawingPolygon = Rectangle.ToPolygon( 0, !SpellData.AddHitbox ? SpellData.Radius : (SpellData.Radius - ObjectManager.Player.BoundingRadius)); EvadePolygon = Rectangle.ToPolygon(15); PathFindingPolygon = Rectangle.ToPolygon(60); PathFindingInnerPolygon = Rectangle.ToPolygon(35); break; case SkillShotType.SkillshotMissileLine: Polygon = Rectangle.ToPolygon(); DrawingPolygon = Rectangle.ToPolygon( 0, !SpellData.AddHitbox ? SpellData.Radius : (SpellData.Radius - ObjectManager.Player.BoundingRadius)); EvadePolygon = Rectangle.ToPolygon(15); PathFindingPolygon = Rectangle.ToPolygon(60); PathFindingInnerPolygon = Rectangle.ToPolygon(35); break; case SkillShotType.SkillshotCone: Polygon = Sector.ToPolygon(); DrawingPolygon = Polygon; EvadePolygon = Sector.ToPolygon(15); PathFindingPolygon = Sector.ToPolygon(60); PathFindingInnerPolygon = Sector.ToPolygon(35); break; case SkillShotType.SkillshotRing: Polygon = Ring.ToPolygon(); DrawingPolygon = Polygon; EvadePolygon = Ring.ToPolygon(15); PathFindingPolygon = Ring.ToPolygon(60); PathFindingInnerPolygon = Ring.ToPolygon(35); break; case SkillShotType.SkillshotArc: Polygon = Arc.ToPolygon(); DrawingPolygon = Polygon; EvadePolygon = Arc.ToPolygon(15); PathFindingPolygon = Arc.ToPolygon(60); PathFindingInnerPolygon = Arc.ToPolygon(35); break; } }
private void UpdatePolygon() { switch (this.SpellData.Type) { case SkillShotType.SkillshotCircle: this.Circle.UpdatePolygon(); this.Polygon = this.Circle; break; case SkillShotType.SkillshotLine: case SkillShotType.SkillshotMissileLine: this.Rectangle.UpdatePolygon(); this.Polygon = this.Rectangle; break; case SkillShotType.SkillshotCone: this.Sector.UpdatePolygon(); this.Polygon = this.Sector; break; case SkillShotType.SkillshotRing: this.Ring.UpdatePolygon(); this.Polygon = this.Ring; break; case SkillShotType.SkillshotArc: this.Arc.UpdatePolygon(); this.Polygon = this.Arc; break; } }
//---------------------------------------Methods----------------------------------- private void ZhonyaOnHit(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (args.Target != null) { if (args.Target.IsMe) zhonya.Cast(); return; } var polygons = new Geometry.Polygon[] { new Geometry.Polygon.Rectangle(args.Start, args.End, args.SData.LineWidth), new Geometry.Polygon.Circle(args.End, args.SData.CastRadius) }; if (polygons.Any(it => it.IsInside(Player))) zhonya.Cast(); return; }
/// <summary> /// Converts list to polygon /// </summary> /// <param name="list"></param> /// <returns></returns> public static Geometry.Polygon ToPolygon(this IEnumerable<Vector2> list) { var polygon = new Geometry.Polygon(); foreach (var x in list) { polygon.Add(x); } return polygon; }
/// <summary> /// Gets the side autoattack polygons /// </summary> /// <returns></returns> public static Geometry.Polygon[] GetSidePolygons() { var id = ReturnForthandRearPolygons(true)[0]; var reverseid = id < 2 ? id + 2 : id - 2; var allpolygons = SegmentedAutoattackPolygons(); var polygons = new Geometry.Polygon[2]; if (reverseid == 0 || reverseid == 2 && id == 0 || id == 2) { polygons[0] = allpolygons[1]; polygons[1] = allpolygons[3]; } else { polygons[0] = allpolygons[0]; polygons[1] = allpolygons[2]; } return polygons; }
public QObj(MissileClient miss) { Miss = miss; Poly = new Geometry.Polygon.Rectangle(miss.StartPosition, miss.EndPosition, Q.Width); }
/// <summary> /// Converts a list of <see cref="IntPoint" />s to a <see cref="Geometry.Polygon" /> /// </summary> /// <param name="list">List of <see cref="Geometry.Polygon" /></param> /// <returns>Polygon made up of <see cref="IntPoint" />s</returns> public static Geometry.Polygon ToPolygon(this List<IntPoint> list) { var polygon = new Geometry.Polygon(); foreach (var point in list) { polygon.Add(new Vector2(point.X, point.Y)); } return polygon; }
private static void OnLoadingComplete(EventArgs args) { // Create the config folder Directory.CreateDirectory(ConfigFolderPath); // Initialize menu Menu = MainMenu.AddMenu("MasterMind", "MasterMind", "MasterMind - Improve Yourself!"); Menu.AddGroupLabel("Welcome to MasterMind, your solution for quality game assistance."); Menu.AddLabel("This addon offers some neat features which will improve your gameplay"); Menu.AddLabel("without dropping FPS or gameplay fun."); Menu.AddSeparator(); Menu.AddLabel("Take a look at the various sub menus this addon has to offer, have fun!"); // Initialize properties IsSpectatorMode = Bootstrap.IsSpectatorMode; // Initialize components foreach (var component in Components.Where(component => component.ShouldLoad(IsSpectatorMode))) { component.InitializeComponent(); } return; // TODO: Remove debug Task.Run(() => { // Get all brushes on the map Logger.Debug("[Brushes] NavMesh.Width {0} | Height {1} | CellWith {2} | CellHeight {3}", NavMesh.Width, NavMesh.Height, NavMesh.CellWidth, NavMesh.CellHeight); var brushes = new Dictionary <int, List <Geometry.Polygon> >(); var offset = NavMesh.GridToWorld(0, 0).To2D(); var cellSize = NavMesh.CellHeight; Logger.Debug("[Brushes] Cell size: " + cellSize); for (var cellX = 0; cellX < NavMesh.Width; cellX++) { for (var cellY = 165; cellY < 400; cellY++) { // Get grid and cell var cell = NavMesh.GetCell(cellX, cellY); var worldPos = offset + new Vector2(cellX * cellSize, cellY * cellSize); // Check for brush if (cell.CollFlags.HasFlag(CollisionFlags.Grass)) { // Check if already existing brush var collection = brushes.Values.FirstOrDefault(o => o.Any(p => p.CenterOfPolygon().Distance(worldPos, true) < (cellSize * 3).Pow())); if (collection == null) { // Create a new brush pair Logger.Debug("[Brushes] Creating new pair of brush points, total so far: " + (brushes.Count + 1)); collection = new List <Geometry.Polygon>(); brushes.Add(brushes.Count, collection); } // Add the point to the collection var cellPolygon = new Geometry.Polygon(); cellPolygon.Add(worldPos); cellPolygon.Add(worldPos + new Vector2(0, cellSize)); cellPolygon.Add(worldPos + cellSize); cellPolygon.Add(worldPos + new Vector2(cellSize, 0)); collection.Add(cellPolygon); } } } Logger.Debug("[Brushes] The result:\n" + string.Join("\n", brushes.Values.Select(o => o.Count))); // Convert brush points to polygons var polyBrushes = new Dictionary <int, Geometry.Polygon>(); foreach (var brushEntry in brushes) { var brushPoly = brushEntry.Value.JoinPolygons().FirstOrDefault(); if (brushPoly != null) { polyBrushes.Add(brushEntry.Key, brushPoly); } } // Draw all brushes Logger.Debug("[Brushes] Ready to draw {0} brush polygons!", polyBrushes.Count); Core.DelayAction(() => { Drawing.OnDraw += delegate { foreach (var polyList in brushes) { foreach (var poly in polyList.Value) { //poly.Draw(System.Drawing.Color.LawnGreen, 2); } } foreach (var polyBrush in polyBrushes) { //Circle.Draw(Color.LawnGreen, NavMesh.CellHeight, polyBrush.Value.Points.Select(o => o.To3DWorld()).ToArray()); polyBrush.Value.Draw(System.Drawing.Color.Red, 2); Drawing.DrawText(polyBrush.Value.CenterOfPolygon().To3DWorld().WorldToScreen(), System.Drawing.Color.GreenYellow, polyBrush.Key.ToString(), 10); } }; }, 0); }); }
/// <summary> /// Returns a polygon that contains each position of a team champion /// </summary> /// <param name="allyTeam">returns the polygon for ally team if true, enemy if false</param> /// <returns></returns> internal static Geometry.Polygon GetTeamPolygon(bool allyTeam = true) { var poly = new Geometry.Polygon(); foreach (var v2 in allyTeam ? GetAllyPosList() : GetEnemyPosList()) { poly.Add(v2); } poly.ToClipperPath(); return poly; }
private static void Drawing_OnDraw_Insec(EventArgs args) { if (!Config.Item("Insec").GetValue<KeyBind>().Active) { return; } //InsecDirection2.Clear(); //foreach (var insecDirect in ObjectManager.Get<Obj_AI_Base>().OrderBy(obj => obj.NetworkId).Where( // obj => // obj.IsAlly && !obj.IsMe && !obj.IsDead && !obj.IsMinion && (obj is Obj_AI_Turret || obj is Obj_AI_Hero) && // obj.Distance(ObjectManager.Player.Position) < Q.Range * 4)) //{ // InsecDirection2.Add(insecDirect); //} //if (SelectedInsecDirectionIndex == null) //{ // SelectedInsecDirectionIndex = InsecDirection2[0]; //} //if (InsecDirection2.Count == 0) //{ // return; //} //if (SelectedInsecDirectionIndex != null) //{ // var ignoredEnemies = // HeroManager.Enemies.Where( // e => MenuInsec.Item("Insec." + e.ChampionName).GetValue<StringList>().SelectedIndex == 0) // .ToList(); // var t = AssassinManager.GetTarget(Q.Range * 2, TargetSelector.DamageType.Physical, ignoredEnemies); // InsecJumpPosition = t.ServerPosition.Extend(SelectedInsecDirectionIndex.Position, -220); // Render.Circle.DrawCircle(InsecJumpPosition, 150f, Color.Blue); // Render.Circle.DrawCircle(SelectedInsecDirectionIndex.Position, 150f, Color.Red); // InsecEndPosition = t.ServerPosition.Extend(SelectedInsecDirectionIndex.Position, +500); // var startpos = t.Position; // var endpos = InsecEndPosition; // var endpos1 = InsecEndPosition + (startpos - endpos).To2D().Normalized().Rotated(25 * (float)Math.PI / 180).To3D() * t.BoundingRadius * 2; // var endpos2 = InsecEndPosition + (startpos - endpos).To2D().Normalized().Rotated(-25 * (float)Math.PI / 180).To3D() * t.BoundingRadius * 2; // var width = 2; // var x = new LeagueSharp.Common.Geometry.Polygon.Line(startpos, endpos); x.Draw(Color.Blue, width); // var y = new LeagueSharp.Common.Geometry.Polygon.Line(endpos, endpos1); y.Draw(Color.Blue, width); // var z = new LeagueSharp.Common.Geometry.Polygon.Line(endpos, endpos2); z.Draw(Color.Blue, width); //} //return; if (enemyInsecMethod == 0) { return; } var t = AssassinManager.GetTarget(Q.Range * 2, TargetSelector.DamageType.Physical); var turrents = from u in ObjectManager.Get<Obj_AI_Base>() .Where( obj => obj.IsAlly && !obj.IsMe && !obj.IsDead && !obj.IsMinion && obj is Obj_AI_Turret && obj.Distance(ObjectManager.Player.Position) < Q.Range*5).OrderBy(obj => obj.Distance(ObjectManager.Player.Position)) select u; var allies = from u in HeroManager.Allies .Where( obj => !obj.IsMe && !obj.IsDead && !obj.IsMinion && obj.Health >= t.Health && obj.Distance(ObjectManager.Player.Position) < Q.Range*5).OrderBy(obj => obj.Distance(ObjectManager.Player.Position)) select u; insecDirection = turrents.Union(allies).ToList(); //Obj_AI_Base insecDirection = ObjectManager.Get<Obj_AI_Base>() // .OrderBy(obj => obj.Distance(ObjectManager.Player.ServerPosition)) // .FirstOrDefault( // obj => // obj.IsAlly && !obj.IsMe && !obj.IsDead && !obj.IsMinion && (obj is Obj_AI_Turret || obj is Obj_AI_Hero) && // obj.Distance(ObjectManager.Player.Position) < Q.Range * 10); aInsecJumpPosition = new Geometry.Rectangle(t.Position.To2D().Extend(insecDirection[0].Position.To2D(), -50), t.Position.To2D().Extend(insecDirection[0].Position.To2D(), -R.Range - 50), 100).ToPolygon(); //aInsecJumpPosition.Draw(Color.Yellow, 2); //InsecJumpPosition = t.ServerPosition.Extend(insecDirection[0].Position, -220); Render.Circle.DrawCircle(InsecJumpPosition, 150f, Color.Blue); Render.Circle.DrawCircle(insecDirection[0].Position, 150f, Color.Red); InsecEndPosition = t.ServerPosition.Extend(insecDirection[0].Position, +500); var startpos = t.Position; var endpos = InsecEndPosition; var endpos1 = InsecEndPosition + (startpos - endpos).To2D().Normalized().Rotated(25 * (float)Math.PI / 180).To3D() * t.BoundingRadius * 2; var endpos2 = InsecEndPosition + (startpos - endpos).To2D().Normalized().Rotated(-25 * (float)Math.PI / 180).To3D() * t.BoundingRadius * 2; var width = 2; var x = new LeagueSharp.Common.Geometry.Polygon.Line(startpos, endpos); x.Draw(Color.Blue, width); var y = new LeagueSharp.Common.Geometry.Polygon.Line(endpos, endpos1); y.Draw(Color.Blue, width); var z = new LeagueSharp.Common.Geometry.Polygon.Line(endpos, endpos2); z.Draw(Color.Blue, width); }
/// <summary> /// /// </summary> /// <returns></returns> public static Geometry.Polygon[] SegmentedAutoattackPolygons() { var aaPolygon = new Geometry.Polygon.Circle(Player.Instance.Position, Player.Instance.GetAutoAttackRange(), 24); var points = new Vector2[24]; var i = 0; foreach (var point in aaPolygon.Points) { points[i] = point; i++; } var polygons = new Geometry.Polygon[4]; var dictionary = new Dictionary <int, List <Vector2> > { { 0, // 1 new List <Vector2> { aaPolygon.Center, points[3], points[4], points[5], points[6], points[7], points[8], points[9] } }, { 1, // 2 new List <Vector2> { aaPolygon.Center, points[9], points[10], points[11], points[12], points[13], points[14], points[15] } }, { 2,// Reverse 1 new List <Vector2> { aaPolygon.Center, points[15], points[16], points[17], points[18], points[19], points[20], points[21] } }, { 3, // Reverse 2 new List <Vector2> { aaPolygon.Center, points[21], points[22], points[23], points[0], points[1], points[2], points[3] } } }; for (var x = 0; x < 4; x++) { polygons[x] = new Geometry.Polygon(); polygons[x].Add(dictionary[x].ToPolygon()); } return(polygons); }
private void CastEr() { if (E.IsReady && R.IsReady) { E.CachedPredictions.Clear(); var eWidth = E.Width; var eCastDelay = E.CastDelay; E.CastDelay = R.CastDelay + eCastDelay; E.Width = R.Range; E.Type = SpellType.Circular; var enemyList = (from enemy in UnitManager.ValidEnemyHeroes select E.GetPrediction(enemy) into pred where pred.HitChancePercent >= R.HitChancePercent / 2f select pred.CastPosition).ToList(); if (enemyList.Count >= ComboMenu.Slider("R.Hit")) { var allyList = UnitManager.ValidAllyHeroesInRange.Select(ally => E.GetPrediction(ally)) .Select(pred => pred.CastPosition.To2D()).ToList(); var bestCount = -1; var bestPoint = default(Vector2); var result = Enumerable.Range(1, (1 << allyList.Count) - 1).Select(index => allyList.Where((item, idx) => ((1 << idx) & index) != 0).ToList()).ToList(); foreach (var points in result) { var polygon = new Geometry.Polygon(); polygon.Points.AddRange(points); var center = polygon.CenterOfPolygon(); var count = enemyList.Count(v => center.IsInRange(v, R.Range * 1.4f)); if (count > bestCount) { bestCount = count; bestPoint = center; } } if (bestCount >= ComboMenu.Slider("R.Hit")) { var allyNear = UnitManager.ValidAllyHeroesInRange.OrderBy(h => h.Distance(bestPoint, true)) .FirstOrDefault(); if (allyNear != null) { CastE(allyNear); } } } E.CachedPredictions.Clear(); E.Type = SpellType.Self; E.CastDelay = eCastDelay; E.Width = eWidth; } }
/// <summary> /// Gets Prediction result /// </summary> /// <param name="target">Target for spell</param> /// <param name="width">Spell width</param> /// <param name="delay">Spell delay</param> /// <param name="missileSpeed">Spell missile speed</param> /// <param name="range">Spell range</param> /// <param name="collisionable">Spell collisionable</param> /// <param name="type">Spell skillshot type</param> /// <param name="path">Waypoints of target</param> /// <param name="avgt">Average reaction time (in ms)</param> /// <param name="movt">Passed time from last movement change (in ms)</param> /// <param name="avgp">Average Path Lenght</param> /// <param name="from">Spell casted position</param> /// <param name="rangeCheckFrom"></param> /// <returns>Prediction result as <see cref="Prediction.Result" /></returns> public static Prediction.Result GetPrediction(Obj_AI_Base target, float width, float delay, float missileSpeed, float range, bool collisionable, List<Vector2> path, float avgt, float movt, float avgp, float anglediff, Vector2 from, Vector2 rangeCheckFrom, bool arconly = true) { Prediction.AssertInitializationMode(); if (arconly) { if (target.LSDistance(from) < width || target.LSDistance(from) > range*0.75f) return CirclePrediction.GetPrediction(target, width, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, from, rangeCheckFrom); var pred = LinePrediction.GetPrediction(target, 80f, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, from, rangeCheckFrom); if (pred.HitChance >= EloBuddy.SDK.Enumerations.HitChance.Low) { pred.CastPosition = @from + (pred.CastPosition - @from).LSNormalized()*range /*.RotateAroundPoint(from, (1 - pred.UnitPosition.LSDistance(ObjectManager.Player.ServerPosition.LSTo2D()) / 820f) * (float)Math.PI / 2f)*/; var cos = (float) Math.Cos((1 - pred.UnitPosition.LSDistance(from)/820f)*Math.PI/2); var sin = (float) Math.Sin((1 - pred.UnitPosition.LSDistance(from)/820f)*Math.PI/2); var x = cos*(pred.CastPosition.X - from.X) - sin*(pred.CastPosition.Y - from.Y) + from.X; var y = sin*(pred.CastPosition.X - from.X) + cos*(pred.CastPosition.Y - from.Y) + from.Y; pred.CastPosition = new Vector2(x, y); } return pred; } var result = new Prediction.Result(); if (path.Count <= 1) //if target is not moving, easy to hit { result.HitChance = EloBuddy.SDK.Enumerations.HitChance.Immobile; result.CastPosition = target.ServerPosition.LSTo2D(); result.UnitPosition = result.CastPosition; return result; } if (target is AIHeroClient && ((AIHeroClient) target).IsChannelingImportantSpell()) { result.HitChance = EloBuddy.SDK.Enumerations.HitChance.Immobile; result.CastPosition = target.ServerPosition.LSTo2D(); result.UnitPosition = result.CastPosition; return result; } if (Utility.IsImmobileTarget(target)) return Prediction.GetImmobilePrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, @from, rangeCheckFrom); if (target.IsDashing()) return Prediction.GetDashingPrediction(target, width, delay, missileSpeed, range, collisionable, SkillshotType.SkillshotCircle, @from, rangeCheckFrom); var targetDistance = rangeCheckFrom.LSDistance(target.ServerPosition); var flyTime = 0f; if (missileSpeed != 0) { var Vt = (path[path.Count - 1] - path[0]).LSNormalized()*target.MoveSpeed; var Vs = (target.ServerPosition.LSTo2D() - rangeCheckFrom).LSNormalized()*missileSpeed; var Vr = Vs - Vt; flyTime = targetDistance/Vr.Length(); if (path.Count > 5) flyTime = targetDistance/missileSpeed; } var t = flyTime + delay + Game.Ping/2000f + ConfigMenu.SpellDelay/1000f; result.HitChance = Prediction.GetHitChance(t*1000f, avgt, movt, avgp, anglediff); #region arc collision test if (result.HitChance > EloBuddy.SDK.Enumerations.HitChance.Low) { for (var i = 1; i < path.Count; i++) { var senderPos = rangeCheckFrom; var testPos = path[i]; var multp = testPos.LSDistance(senderPos)/875.0f; var dianaArc = new Geometry.Polygon( ClipperWrapper.DefineArc(senderPos - new Vector2(875/2f, 20), testPos, (float) Math.PI*multp, 410, 200*multp), ClipperWrapper.DefineArc(senderPos - new Vector2(875/2f, 20), testPos, (float) Math.PI*multp, 410, 320*multp)); if (!dianaArc.IsOutside(target.ServerPosition.LSTo2D())) { result.HitChance = EloBuddy.SDK.Enumerations.HitChance.High; result.CastPosition = testPos; result.UnitPosition = testPos; return result; } } } #endregion return CirclePrediction.GetPrediction(target, width, delay, missileSpeed, range, collisionable, path, avgt, movt, avgp, anglediff, @from, rangeCheckFrom); }
public Geometry.Polygon PredictedPolygon(float afterTime, float extraWidth = 0) { var extraAngle = Math.Max(1, Math.Max(1, extraWidth) / 4); extraWidth += this.Width; Geometry.Polygon polygon = null; switch (this.Data.type) { case Type.LineMissile: polygon = new Geometry.Polygon.Rectangle(this.CalculatedPosition(afterTime), this.CollideEndPosition, extraWidth); break; case Type.CircleMissile: polygon = new Geometry.Polygon.Circle(this.Data.IsMoving ? this.CalculatedPosition(afterTime) : this.CollideEndPosition, extraWidth); break; case Type.Cone: polygon = new Geometry.Polygon.Sector(this.CurrentPosition, this.CollideEndPosition, (float)((this.Angle + extraAngle) * Math.PI / 180), this.Range); break; case Type.Arc: polygon = new CustomGeometry.Arc(this.Start, this.CollideEndPosition, (int)extraWidth).ToSDKPolygon(); break; case Type.Ring: polygon = new CustomGeometry.Ring(this.CollideEndPosition, extraWidth, this.RingRadius).ToSDKPolygon(); break; } if (polygon != null && (this.ExplodeEnd || this.CollideExplode)) { var newpolygon = polygon; var pos = this.CurrentPosition; var collidepoint = this.CollideExplode ? this.CorrectCollidePoint.GetValueOrDefault() : this.CollideEndPosition; switch (this.Data.Explodetype) { case Type.CircleMissile: this.ExplodePolygon = new Geometry.Polygon.Circle(collidepoint, this.ExplodeWidth); break; case Type.LineMissile: var st = collidepoint - (collidepoint - pos).Normalized().Perpendicular() * (this.ExplodeWidth); var en = collidepoint + (collidepoint - pos).Normalized().Perpendicular() * (this.ExplodeWidth); this.ExplodePolygon = new Geometry.Polygon.Rectangle(st, en, this.ExplodeWidth / 2); break; case Type.Cone: var st2 = collidepoint - Direction * (this.ExplodeWidth * 0.25f); var en2 = collidepoint + Direction * (this.ExplodeWidth * 3); this.ExplodePolygon = new Geometry.Polygon.Sector(st2, en2, (float)(this.Angle * Math.PI / 180), this.ExplodeWidth); break; } var poly = Geometry.ClipPolygons(new[] { newpolygon, this.ExplodePolygon }); var vectors = new List <IntPoint>(); foreach (var p in poly) { vectors.AddRange(p.ToPolygon().ToClipperPath()); } polygon = vectors.ToPolygon(); } return(polygon); }
private static void Drawing_OnDraw_JumpToEnemy(EventArgs args) { if (MenuCombo.Item("Combo.W.JumpToEnemyFoot").GetValue<StringList>().SelectedIndex == 0) { return; } if (Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Combo) { return; } Obj_AI_Hero t = HeroManager.Enemies.Where( e => e.IsValidTarget(Q.Range + PossibleJumpRange - 50) && !e.IsDead && !e.IsZombie && e.Distance(Game.CursorPos) < e.Distance(ObjectManager.Player.Position) && !e.IsValidTarget(Orbwalking.GetRealAutoAttackRange(null) + 65) && !e.HasBlindMonkBuff()) .OrderByDescending(o => o.MaxHealth) .FirstOrDefault(); if (t == null) { return; } if (!CollisionObjects(ObjectManager.Player.Position, t.Position, Q.Width, Q.Range) && QStage == QCastStage.IsReady && t.IsValidTarget(Q.Range - 20)) { return; } if (t.IsValidTarget(PossibleJumpRange) && WStage == WCastStage.IsReady && t.Health < ObjectManager.Player.TotalAttackDamage * 2 ? Q.Cooldown < 10 : Q.Cooldown < 3) { WardJump(t.Position); return; } if (WStage == WCastStage.IsReady && QStage == QCastStage.IsReady && !t.IsValidTarget(Q.Range) /*&& t.Health < ComboDamage(t)*/) { toPolygon = new Geometry.Rectangle(t.Position.To2D(), t.Position.To2D() .Extend(ObjectManager.Player.Position.To2D(), +(t.Distance(ObjectManager.Player.Position) - PossibleJumpRange)), Q.Width + 100) .ToPolygon(); //toPolygon.Draw(Color.Red, 3); var startPos = t.ServerPosition.Extend(ObjectManager.Player.Position, +(t.Distance(ObjectManager.Player.Position) - PossibleJumpRange)); if (!CollisionObjects(startPos, t.Position, Q.Width + 25, Q.Range) && !startPos.IsWall()) { Render.Circle.DrawCircle( t.ServerPosition.Extend(ObjectManager.Player.Position, +(t.Distance(ObjectManager.Player.Position) - PossibleJumpRange)), 105f, Color.Yellow); WardJump(startPos); } } }
private static void Escape() { if (CheckHandler.BuffedEnemy.IsValidTarget() && CheckHandler.BuffedEnemy.IsValid<Obj_AI_Hero>()) { InitQ = false; return; } if (InitQ) { foreach (Vector3 point in JunglePos) { if (Player.Distance(point) < 100 || CheckHandler.LastQ2 + 2000 < Environment.TickCount) { InitQ = false; } } } _rect = new Geometry.Rectangle( Player.Position.To2D(), Player.Position.To2D().Extend(Game.CursorPos.To2D(), 1050), 100).ToPolygon(); if (CheckHandler.QState && CheckHandler._spells[SpellSlot.Q].IsReady()) { foreach (Vector3 pos in JunglePos.Where(pos => !_rect.IsOutside(pos.To2D()))) { InitQ = true; CheckHandler._spells[SpellSlot.Q].Cast(pos); return; } } else if (CheckHandler._spells[SpellSlot.Q].IsReady() && !CheckHandler.QState) { CheckHandler._spells[SpellSlot.Q].Cast(); InitQ = true; } }
private static void Drawing_RKickWaveForHitToEnemy(EventArgs args) { if (Config.Item("Insec").GetValue<KeyBind>().Active || Orbwalker.ActiveMode != Orbwalking.OrbwalkingMode.Combo) { return; } if (MenuCombo.Item("Combo.R.UseRKickWaveForDamage").GetValue<StringList>().SelectedIndex == 0 || !R.IsReady()) { return; } var hitCount = MenuCombo.Item("Combo.R.UseRKickWaveForDamage").GetValue<StringList>().SelectedIndex; Obj_AI_Hero t = HeroManager.Enemies.Where( e => e.IsValidTarget(Q.Range + W.Range) && !e.IsDead && !e.IsZombie) .OrderBy(o => o.Distance(ObjectManager.Player.Position)) .FirstOrDefault(); if (t == null) { return; } toPolygon = new Geometry.Rectangle(t.Position.To2D(), t.Position.To2D().Extend(ObjectManager.Player.Position.To2D(), 800), 100).ToPolygon(); var enemyCount = HeroManager.Enemies.Where(e => e.Distance(ObjectManager.Player) < 1100 && e.IsValidTarget(1100)) .Count(e => e.NetworkId != t.NetworkId && !e.IsDead && toPolygon.IsInside(e.ServerPosition)); if (enemyCount == 0) { return; } if (enemyCount + 1 <= hitCount + 1) { R.CastOnUnit(t); } //List<Obj_AI_Hero> xEnemy = new List<Obj_AI_Hero>(); //foreach ( // Obj_AI_Hero enemy in // HeroManager.Enemies.Where( // e => // e.Distance(t.Position) < 2800 && // ObjectManager.Player.Distance(e) > ObjectManager.Player.Distance(t))) //{ // //var tt = t.ServerPosition.Extend(ObjectManager.Player.Position, +800); // //var startpos = t.Position; // //var endpos = tt; // //var x = new LeagueSharp.Common.Geometry.Polygon.Rectangle(startpos, endpos, 145); // //x.Draw(Color.Blue, 3); // toPolygon = new Geometry.Rectangle(t.Position.To2D(), t.Position.To2D().Extend(ObjectManager.Player.Position.To2D(), -700), 210).ToPolygon(); // //toPolygon.Draw(Color.Blue, 3); // if (toPolygon.IsInside(enemy.Position.To2D())) // { // //if (xEnemy.Find(hero => hero.ChampionName != enemy.ChampionName) != null) // xEnemy.Add(enemy); // //Render.Circle.DrawCircle(enemy.Position, 150f, Color.Black); // //R.CastOnUnit(enemy); // } // var xCount = xEnemy.Count + 1; // if (hitCount + 1 >= xEnemy.Count + 1 && t.IsValidTarget(R.Range)) // { // R.CastOnUnit(t); // } //} }
public string Render(int width = 0, int height = 0) { SetSvgCanvas(_svgWriter, _extents, width, height); var layers = _map.Layers.OrderBy(l => GetLayerOrder(l.Name)).ToList(); foreach (VectorLayer layer in layers) { // Run overlay procedure var order = GetLayerOrder(layer.Name); if (_overlayRenderProcedures.ContainsKey(order)) { _overlayRenderProcedures[order](); } // Set SVG styles using layer style config var layerConfig = GetLayerConfigByName(layer.Name); SetVectorStyles(_svgWriter, layerConfig); var themeFilter = _themeFilters.ContainsKey(layer.Name) ? _themeFilters[layer.Name] : null; if (layer.GeoType == "1") { foreach (Feature feature in layer.Features) { // Set SVG styles using theme SetVectorStyles(_svgWriter, themeFilter, feature); Geometry.Point2D pos = new Geometry.Point2D(feature.GeoData); AddCircle(20, pos.x, pos.y); } SetTextStyles(_svgWriter, layerConfig); foreach (Feature feature in layer.Features) { Geometry.Point2D pos = new Geometry.Point2D(feature.GeoData); AddText(GetLabel(layerConfig, feature), pos.x, pos.y); } } else if (layer.GeoType == "2") { if (layerConfig != null && layerConfig.StrokeBundle != null && layerConfig.StrokeBundle.Strokes.Count > 0) { foreach (VectorStyle strokeStyle in layerConfig.StrokeBundle.Strokes) { // Set SVG styles using this bundle element style SetVectorStyles(_svgWriter, strokeStyle); foreach (Feature feature in layer.Features) { Geometry.Polyline poly = new Geometry.Polyline(feature.GeoData); AddPolyline(poly.Points); } } } else { foreach (Feature feature in layer.Features) { // Set SVG styles using theme SetVectorStyles(_svgWriter, themeFilter, feature); _svgWriter.SetFill("none"); Geometry.Polyline poly = new Geometry.Polyline(feature.GeoData); AddPolyline(poly.Points); } } // Whatever case, add label in the end in case of overlapping with shapes if (layerConfig != null && layerConfig.LabelStyle != null) { SetTextStyles(_svgWriter, layerConfig); foreach (Feature feature in layer.Features) { // Add label every specified length Geometry.Polyline poly = new Geometry.Polyline(feature.GeoData); string text = GetLabel(layerConfig, feature); double linearRepeatInterval = layerConfig.LabelStyle.LinearRepeatInterval; double length = poly.Length; List <double> positions = new List <double>(); if (length > 0 && length < 2 * linearRepeatInterval) { positions.Add(length / 2); } else { int index = 1; while (index * linearRepeatInterval < length) { positions.Add(index * linearRepeatInterval); index++; } } foreach (double position in positions) { Geometry.Point2D pos = poly.GetPointAtDist(position); double tan = poly.GetFirstDerivative(position); double rotation = Math.Atan(tan); double angle = -180 / Math.PI * rotation; AddText(text, pos.x, pos.y, angle); } } } } else if (layer.GeoType == "4") { foreach (Feature feature in layer.Features) { // Set SVG styles using theme SetVectorStyles(_svgWriter, themeFilter, feature); Geometry.Polygon poly = new Geometry.Polygon(feature.GeoData); AddPolygon(poly.Points); } SetTextStyles(_svgWriter, layerConfig); foreach (Feature feature in layer.Features) { Geometry.Polygon poly = new Geometry.Polygon(feature.GeoData); Geometry.Point2D center = poly.Centroid; AddText(GetLabel(layerConfig, feature), center.x, center.y); } } } return(_svgWriter.ToString()); }
public override Geometry.Polygon ToPolygon() { Vector2[] edges = GetEdgePoints(); Vector2 rightEdge = edges[0]; Vector2 leftEdge = edges[1]; var beginPoints = GetBeginEdgePoints(edges); Vector2 rightBeginPoint = beginPoints[0]; Vector2 leftBeginPoint = beginPoints.Length == 1 ? Vector2.Zero : beginPoints[1]; if (leftBeginPoint.IsZero) { return(new Geometry.Polygon()); } var baseTriangle = new Geometry.Polygon(); baseTriangle.Points.AddRange(new List <Vector2> { FixedStartPosition.To2D(), rightEdge, leftEdge }); var advancedTriangle = new Geometry.Polygon(); advancedTriangle.Points.AddRange(new List <Vector2> { FixedStartPosition.To2D(), rightEdge }); var dummyTriangle = advancedTriangle; if (CollisionPoints.Any()) { foreach (var collisionPoint in OrderCollisionPointsHorizontally(rightEdge)) { var dir = collisionPoint - FixedStartPosition.To2D(); var leftColl = FixedStartPosition.To2D() + dir + dir.Perpendicular().Normalized() * 25; var rightColl = FixedStartPosition.To2D() + dir + dir.Perpendicular2().Normalized() * 25; var backToLineRight = FixedStartPosition.Extend(rightColl, FixedEndPosition.Distance(FixedStartPosition)); var backToLineLeft = FixedStartPosition.Extend(leftColl, FixedEndPosition.Distance(FixedStartPosition)); var earlyCollCheck_Left = backToLineLeft.Extend(leftColl, FixedEndPosition.Distance(FixedStartPosition)); var earlyCollCheck_Right = backToLineRight.Extend(rightColl, FixedEndPosition.Distance(FixedStartPosition)); Geometry.Polygon earlyCollisionRectangle = new Geometry.Polygon(); earlyCollisionRectangle.Points.AddRange(new List <Vector2> { leftColl, earlyCollCheck_Left, earlyCollCheck_Right, rightColl }); bool EarlyCollision = CollisionPoints.Any(x => x != collisionPoint && earlyCollisionRectangle.IsInside(x)); Func <Vector2, bool> outsideDummy = point => dummyTriangle.Points.Count < 3 || dummyTriangle.IsOutside(point); if (baseTriangle.IsInside(rightColl) && baseTriangle.IsInside(leftColl) && outsideDummy(rightColl) && outsideDummy(leftColl) && !EarlyCollision && backToLineLeft.Distance(backToLineRight) >= OwnSpellData.Radius * 2) { CollisionInfo info = AreCollisionPointsBehindBegin(rightColl, leftColl, rightBeginPoint, leftBeginPoint); if (!info.BehindStartLine) { dummyTriangle.Points.Add(backToLineRight); advancedTriangle.Points.Add(backToLineRight); dummyTriangle.Points.Add(rightColl); advancedTriangle.Points.Add(rightColl); dummyTriangle.Points.Add(leftColl); advancedTriangle.Points.Add(leftColl); dummyTriangle.Points.Add(backToLineLeft); advancedTriangle.Points.Add(backToLineLeft); } else //collision points behind startLine { leftColl = info.New_LeftCollPointOnStartLine; rightColl = info.New_RightCollPointOnStartLine; backToLineRight = FixedStartPosition.Extend(rightColl, FixedEndPosition.Distance(FixedStartPosition)); backToLineLeft = FixedStartPosition.Extend(leftColl, FixedEndPosition.Distance(FixedStartPosition)); dummyTriangle.Points.Add(backToLineRight); advancedTriangle.Points.Add(backToLineRight); dummyTriangle.Points.Add(rightColl); advancedTriangle.Points.Add(rightColl); dummyTriangle.Points.Add(leftColl); advancedTriangle.Points.Add(leftColl); dummyTriangle.Points.Add(backToLineLeft); advancedTriangle.Points.Add(backToLineLeft); } } } } advancedTriangle.Points.Add(leftEdge); advancedTriangle.Points.RemoveAt(0); advancedTriangle.Points.Insert(0, rightBeginPoint); advancedTriangle.Points.Insert(0, leftBeginPoint); return(advancedTriangle); }
public void UpdatePolygon() { switch (this.SpellData.Type) { case SkillShotType.SkillshotCircle: this.Polygon = this.Circle.ToPolygon(); this.EvadePolygon = this.Circle.ToPolygon(Config.ExtraEvadeDistance); this.DrawingPolygon = this.Circle.ToPolygon( 0, !this.SpellData.AddHitbox ? this.SpellData.Radius : (this.SpellData.Radius - ObjectManager.Player.BoundingRadius)); break; case SkillShotType.SkillshotLine: this.Polygon = this.Rectangle.ToPolygon(); this.DrawingPolygon = this.Rectangle.ToPolygon( 0, !this.SpellData.AddHitbox ? this.SpellData.Radius : (this.SpellData.Radius - ObjectManager.Player.BoundingRadius)); this.EvadePolygon = this.Rectangle.ToPolygon(Config.ExtraEvadeDistance); break; case SkillShotType.SkillshotMissileLine: this.Polygon = this.Rectangle.ToPolygon(); this.DrawingPolygon = this.Rectangle.ToPolygon( 0, !this.SpellData.AddHitbox ? this.SpellData.Radius : (this.SpellData.Radius - ObjectManager.Player.BoundingRadius)); this.EvadePolygon = this.Rectangle.ToPolygon(Config.ExtraEvadeDistance); break; case SkillShotType.SkillshotCone: this.Polygon = this.Sector.ToPolygon(); this.DrawingPolygon = this.Polygon; this.EvadePolygon = this.Sector.ToPolygon(Config.ExtraEvadeDistance); break; case SkillShotType.SkillshotRing: this.Polygon = this.Ring.ToPolygon(); this.DrawingPolygon = this.Polygon; this.EvadePolygon = this.Ring.ToPolygon(Config.ExtraEvadeDistance); break; } }
/// <summary> /// + minion hitbox /// </summary> public static Vector2[] GetCollisionPoints(this AsheW skillshot) { var collisions = new List <Vector2>(); if (Environment.TickCount - LastMinionPosArrayTick < 1000) { collisions.AddRange(LastMinionPosArray); } Vector2[] edges = skillshot.GetEdgePoints(); Vector2 rightEdge = edges[0]; Vector2 leftEdge = edges[1]; var triangle = new Geometry.Polygon(); triangle.Points.AddRange(new List <Vector2> { skillshot.FixedStartPosition.To2D(), rightEdge, leftEdge }); if (EvadeMenu.CollisionMenu["minion"].Cast <CheckBox>().CurrentValue) { foreach (var minion in EntityManager.MinionsAndMonsters.AlliedMinions.Where(x => !x.IsDead && x.IsValid && x.Health >= 100 && x.Distance(skillshot.FixedStartPosition) < skillshot.OwnSpellData.Range)) { if (GetHitboxCirclePoints(minion).Any(x => triangle.IsInside(x))) { LastMinionPosArray.Add(minion.Position.To2D()); LastMinionPosArrayTick = Environment.TickCount; collisions.Add(minion.Position.To2D()); } } } if (EvadeMenu.CollisionMenu["yasuoWall"].Cast <CheckBox>().CurrentValue&& skillshot.Missile != null) { GameObject wall = null; foreach (var gameObject in ObjectManager.Get <GameObject>(). Where(gameObject => gameObject.IsValid && System.Text.RegularExpressions.Regex.IsMatch( gameObject.Name, "_w_windwall.\\.troy", System.Text.RegularExpressions.RegexOptions.IgnoreCase))) { wall = gameObject; } if (wall != null) { var level = wall.Name.Substring(wall.Name.Length - 6, 1); var wallWidth = 300 + 50 * Convert.ToInt32(level); var wallDirection = (wall.Position.To2D() - WindWallStartPosition).Normalized().Perpendicular(); var wallStart = wall.Position.To2D() + wallWidth / 2f * wallDirection; var wallEnd = wallStart - wallWidth * wallDirection; var wallPolygon = new Geometry.Polygon.Rectangle(wallStart, wallEnd, 75).GetDetailedPolygon(); collisions.AddRange(wallPolygon.Points.Where(wallPoint => triangle.IsInside(wallPoint))); } } return(collisions.ToArray()); }
private static void Escape() { Program.Orbwalk(Game.CursorPos); if (BuffedEnemy.IsValidTarget() && BuffedEnemy.IsValid<AIHeroClient>()) { InitQ = false; return; } if (InitQ) { foreach (var point in JunglePos) { if (Player.Distance(point) < 100 || Program.LastQ2 + 2000 < Environment.TickCount) { InitQ = false; } } } rect = new Geometry.Polygon.Rectangle( Player.Position.To2D(), Player.Position.To2D().Extend(Game.CursorPos.To2D(), 1050), 100); if (Program.QState && Program.spells[Program.Spells.Q].IsReady()) { foreach (var pos in JunglePos) { if (rect.IsOutside(pos.To2D())) { continue; } InitQ = true; Program.spells[Program.Spells.Q].Cast(pos); return; } } else if (Program.spells[Program.Spells.Q].IsReady() && !Program.QState) { Program.spells[Program.Spells.Q].Cast(); InitQ = true; } }
public virtual void SetData(VectorLayer layer) { LayerData = layer; LayerStyle = GetLayerStyle(layer); LayerLableStyle = GetLabelStyle(layer); Features.Clear(); Overlays.Clear(); Children.Clear(); LabelLayer = new MapLayer(); if (layer.GeoType == "1") { foreach (Feature feature in layer.Features) { Geometry.Point2D pos = new Geometry.Point2D(feature.GeoData); AddSpot(new Point(pos.x, pos.y), feature); AddLable(new Point(pos.x, pos.y), LayerLableStyle.GetLable(feature)); } } else if (layer.GeoType == "2") { if (IsRoad()) { foreach (Feature feature in layer.Features) { Geometry.Polyline polyline = new Geometry.Polyline(feature.GeoData); AddRoadStroke(polyline.Points.Select(p => new Point(p.x, p.y)).ToArray(), feature); } } foreach (Feature feature in layer.Features) { Geometry.Polyline poly = new Geometry.Polyline(feature.GeoData); if (!IsRoad()) { AddPolyline(poly.Points.Select(p => new Point(p.x, p.y)).ToArray(), feature); } else { AddRoadFill(poly.Points.Select(p => new Point(p.x, p.y)).ToArray(), feature); } } foreach (Feature feature in layer.Features) // mod 20130516 最后统一加标签 { Geometry.Polyline poly = new Geometry.Polyline(feature.GeoData); string text = LayerLableStyle.GetLable(feature); double linearRepeatInterval = LayerLableStyle.LinearRepeatInterval; double length = poly.Length; //double scale = 4; // 这个时候出现主窗口的Scale是不合适的。 List <double> positions = new List <double>(); // mod 20130528 与SVG同步 if (length > 0 && length < 2 * linearRepeatInterval) { positions.Add(length / 2); } else { int index = 1; while (index * linearRepeatInterval < length) { positions.Add(index * linearRepeatInterval); index++; } } foreach (double position in positions) { Geometry.Point2D tempPt = poly.GetPointAtDist(position); double tanVal = poly.GetFirstDerivative(position); double rotation = Math.Atan(tanVal); double angle = 180 / Math.PI * rotation; AddLable(new Point(tempPt.x, tempPt.y), text, angle); } } } else if (layer.GeoType == "4") { foreach (Feature feature in layer.Features) { Geometry.Polygon poly = new Geometry.Polygon(feature.GeoData); Geometry.Point2D center = poly.Centroid; AddPolygon(poly.Points.Select(p => new Point(p.x, p.y)).ToArray(), feature); AddLable(new Point(center.x, center.y), LayerLableStyle.GetLable(feature)); } } }
/// <summary> /// /// </summary> /// <returns></returns> public static Geometry.Polygon[] SegmentedAutoattackPolygons() { var aaPolygon = new Geometry.Polygon.Circle(Player.Instance.Position, Player.Instance.GetAutoAttackRange(), 24); var points = new Vector2[24]; var i = 0; foreach (var point in aaPolygon.Points) { points[i] = point; i++; } var polygons = new Geometry.Polygon[4]; var dictionary = new Dictionary<int, List<Vector2>> { { 0, // 1 new List<Vector2> { aaPolygon.Center, points[3], points[4], points[5], points[6], points[7], points[8], points[9] } }, { 1, // 2 new List<Vector2> { aaPolygon.Center, points[9], points[10], points[11], points[12], points[13], points[14], points[15] } }, { 2,// Reverse 1 new List<Vector2> { aaPolygon.Center, points[15], points[16], points[17], points[18], points[19], points[20], points[21] } }, { 3, // Reverse 2 new List<Vector2> { aaPolygon.Center, points[21], points[22], points[23], points[0], points[1], points[2], points[3] } } }; for (var x = 0; x < 4; x++) { polygons[x] = new Geometry.Polygon(); polygons[x].Add(dictionary[x].ToPolygon()); } return polygons; }
//------------------------------Methods-------------------------------- private void SummonersOnHit(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args, bool useHeal = false) { var polygons = new Geometry.Polygon[] { new Geometry.Polygon.Rectangle(args.Start, args.End, args.SData.LineWidth), new Geometry.Polygon.Circle(args.End, args.SData.CastRadius) }; if (polygons.Any(it => it.IsInside(Player))) { if (useHeal) heal.Cast(); else barrier.Cast(); } return; }
private static Geometry.Polygon ReadPolygon(BinaryReader reader, int? SRID, WkbCoordinateSystem cs) { Int32 ringCount = reader.ReadInt32(); Geometry.Polygon poly = new Geometry.Polygon(ringCount); poly.SRID = SRID; List<Geometry.LineString> holes = poly.Holes; if (ringCount > 0) { poly.Exterior = ReadLineString(reader, SRID, cs); } for (int j = 1; j < ringCount; j++) { holes.Add(ReadLineString(reader, SRID, cs)); } return poly; }
public void UpdatePolygon() { switch (SpellData.Type) { case SkillShotType.SkillshotCircle: Polygon = Circle.ToPolygon(); EvadePolygon = Circle.ToPolygon(Config.ExtraEvadeDistance); DrawingPolygon = Circle.ToPolygon( 0, !SpellData.AddHitbox ? SpellData.Radius : (SpellData.Radius - ObjectManager.Player.BoundingRadius)); break; case SkillShotType.SkillshotLine: Polygon = Rectangle.ToPolygon(); DrawingPolygon = Rectangle.ToPolygon( 0, !SpellData.AddHitbox ? SpellData.Radius : (SpellData.Radius - ObjectManager.Player.BoundingRadius)); EvadePolygon = Rectangle.ToPolygon(Config.ExtraEvadeDistance); break; case SkillShotType.SkillshotMissileLine: Polygon = Rectangle.ToPolygon(); DrawingPolygon = Rectangle.ToPolygon( 0, !SpellData.AddHitbox ? SpellData.Radius : (SpellData.Radius - ObjectManager.Player.BoundingRadius)); EvadePolygon = Rectangle.ToPolygon(Config.ExtraEvadeDistance); break; case SkillShotType.SkillshotCone: Polygon = Sector.ToPolygon(); DrawingPolygon = Polygon; EvadePolygon = Sector.ToPolygon(Config.ExtraEvadeDistance); break; case SkillShotType.SkillshotRing: Polygon = Ring.ToPolygon(); DrawingPolygon = Polygon; EvadePolygon = Ring.ToPolygon(Config.ExtraEvadeDistance); break; } }
private static void OnLoadingComplete(EventArgs args) { // Create the config folder Directory.CreateDirectory(ConfigFolderPath); // Initialize menu Menu = MainMenu.AddMenu("MasterMind", "MasterMind", "MasterMind - Improve Yourself!"); Menu.AddGroupLabel("Welcome to MasterMind, your solution for quality game assistance."); Menu.AddLabel("This addon offers some neat features which will improve your gameplay"); Menu.AddLabel("without dropping FPS or gameplay fun."); Menu.AddSeparator(); Menu.AddLabel("Take a look at the various sub menus this addon has to offer, have fun!"); // Initialize properties IsSpectatorMode = Bootstrap.IsSpectatorMode; // Initialize components foreach (var component in Components.Where(component => component.ShouldLoad(IsSpectatorMode))) { component.InitializeComponent(); } return; // TODO: Remove debug Task.Run(() => { // Get all brushes on the map Logger.Debug("[Brushes] NavMesh.Width {0} | Height {1} | CellWith {2} | CellHeight {3}", NavMesh.Width, NavMesh.Height, NavMesh.CellWidth, NavMesh.CellHeight); var brushes = new Dictionary<int, List<Geometry.Polygon>>(); var offset = NavMesh.GridToWorld(0, 0).To2D(); var cellSize = NavMesh.CellHeight; Logger.Debug("[Brushes] Cell size: " + cellSize); for (var cellX = 0; cellX < NavMesh.Width; cellX++) { for (var cellY = 165; cellY < 400; cellY++) { // Get grid and cell var cell = NavMesh.GetCell(cellX, cellY); var worldPos = offset + new Vector2(cellX * cellSize, cellY * cellSize); // Check for brush if (cell.CollFlags.HasFlag(CollisionFlags.Grass)) { // Check if already existing brush var collection = brushes.Values.FirstOrDefault(o => o.Any(p => p.CenterOfPolygon().Distance(worldPos, true) < (cellSize * 3).Pow())); if (collection == null) { // Create a new brush pair Logger.Debug("[Brushes] Creating new pair of brush points, total so far: " + (brushes.Count + 1)); collection = new List<Geometry.Polygon>(); brushes.Add(brushes.Count, collection); } // Add the point to the collection var cellPolygon = new Geometry.Polygon(); cellPolygon.Add(worldPos); cellPolygon.Add(worldPos + new Vector2(0, cellSize)); cellPolygon.Add(worldPos + cellSize); cellPolygon.Add(worldPos + new Vector2(cellSize, 0)); collection.Add(cellPolygon); } } } Logger.Debug("[Brushes] The result:\n" + string.Join("\n", brushes.Values.Select(o => o.Count))); // Convert brush points to polygons var polyBrushes = new Dictionary<int, Geometry.Polygon>(); foreach (var brushEntry in brushes) { var brushPoly = brushEntry.Value.JoinPolygons().FirstOrDefault(); if (brushPoly != null) { polyBrushes.Add(brushEntry.Key, brushPoly); } } // Draw all brushes Logger.Debug("[Brushes] Ready to draw {0} brush polygons!", polyBrushes.Count); Core.DelayAction(() => { Drawing.OnDraw += delegate { foreach (var polyList in brushes) { foreach (var poly in polyList.Value) { //poly.Draw(System.Drawing.Color.LawnGreen, 2); } } foreach (var polyBrush in polyBrushes) { //Circle.Draw(Color.LawnGreen, NavMesh.CellHeight, polyBrush.Value.Points.Select(o => o.To3DWorld()).ToArray()); polyBrush.Value.Draw(System.Drawing.Color.Red, 2); Drawing.DrawText(polyBrush.Value.CenterOfPolygon().To3DWorld().WorldToScreen(), System.Drawing.Color.GreenYellow, polyBrush.Key.ToString(), 10); } }; }, 0); }); }
//-----------------------------------------------PriorityCast--------------------------------------------- static void PriorityCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args, List <AIHeroClient> Allies, Geometry.Polygon polygon) { int delay = new int(); Allies.OrderBy(it => it.Distance(args.Start)); var ally = Allies.First(); if (Allies.Count == 1) { delay = (int)((sender.Distance(ally) / args.SData.MissileMaxSpeed * 1000) + args.SData.SpellCastTime - 300 - Game.Ping); Core.DelayAction(delegate { if (polygon.IsInside(ally) && E.IsInRange(ally)) { E.Cast(ally); } return; }, delay); //Chat.Print("Shield for {0} : {1}", sender.BaseSkinName, args.Slot.ToString()); return; } else { if (CollisionSpells.Any(it => it == args.SData.Name)) { delay = (int)((sender.Distance(ally) / args.SData.MissileMaxSpeed * 1000) + args.SData.SpellCastTime - 300 - Game.Ping); Core.DelayAction(delegate { foreach (var Ally in Allies) { if (polygon.IsInside(Ally) && E.IsInRange(Ally)) { E.Cast(Ally); return; } } return; }, delay); //Chat.Print("Shield for {0} : {1}", sender.BaseSkinName, args.Slot.ToString()); return; } else { IEnumerable <AIHeroClient> priorities = from aliado in EntityManager.Heroes.Allies orderby EMenu[aliado.BaseSkinName].Cast <Slider>().CurrentValue descending select aliado; delay = (int)((sender.Distance(ally) / args.SData.MissileMaxSpeed * 1000) + args.SData.SpellCastTime - 200 - Game.Ping); Core.DelayAction(delegate { foreach (var Ally in priorities) { if (polygon.IsInside(Ally) && E.IsInRange(Ally)) { E.Cast(Ally); return; } } return; }, delay); //Chat.Print("Shield for {0} : {1}", sender.BaseSkinName, args.Slot.ToString()); return; } } }
private void InitRiverPolygons() { Geometry.Polygon polygon = new Geometry.Polygon(); Geometry.Polygon polygon2 = new Geometry.Polygon(); polygon.Add(new Vector2(2501.917f, 11621.85f)); polygon.Add(new Vector2(2735.138f, 11951.55f)); polygon.Add(new Vector2(2985.84f, 12011.37f)); polygon.Add(new Vector2(3151.893f, 11972.14f)); polygon.Add(new Vector2(3301.497f, 11862.05f)); polygon.Add(new Vector2(3457.848f, 11781.09f)); polygon.Add(new Vector2(3583.177f, 11685.76f)); polygon.Add(new Vector2(3735.846f, 11578.84f)); polygon.Add(new Vector2(3788.787f, 11442.55f)); polygon.Add(new Vector2(3841.47f, 11302.97f)); polygon.Add(new Vector2(3853.919f, 11242.47f)); polygon.Add(new Vector2(3848.222f, 11101.3f)); polygon.Add(new Vector2(3902.691f, 10586.18f)); polygon.Add(new Vector2(4132.502f, 10373.74f)); polygon.Add(new Vector2(4265.671f, 10273.99f)); polygon.Add(new Vector2(4322.183f, 10206.58f)); polygon.Add(new Vector2(4422.669f, 10161.71f)); polygon.Add(new Vector2(4485.438f, 10168.55f)); polygon.Add(new Vector2(4514.972f, 10232.93f)); polygon.Add(new Vector2(4529.126f, 10293.93f)); polygon.Add(new Vector2(4470.948f, 10427.39f)); polygon.Add(new Vector2(4441.264f, 10466.55f)); polygon.Add(new Vector2(4434.313f, 10607.36f)); polygon.Add(new Vector2(4455.765f, 10652.06f)); polygon.Add(new Vector2(4520.133f, 10724.14f)); polygon.Add(new Vector2(4582.769f, 10768.96f)); polygon.Add(new Vector2(4659.186f, 10828.57f)); polygon.Add(new Vector2(4730.855f, 10847.22f)); polygon.Add(new Vector2(4851.521f, 10858.95f)); polygon.Add(new Vector2(4968.745f, 10868.38f)); polygon.Add(new Vector2(5046.559f, 10882.59f)); polygon.Add(new Vector2(5165.388f, 10837.87f)); polygon.Add(new Vector2(5233.739f, 10803.16f)); polygon.Add(new Vector2(5292.205f, 10762.18f)); polygon.Add(new Vector2(5347.143f, 10702.05f)); polygon.Add(new Vector2(5363.078f, 10609.46f)); polygon.Add(new Vector2(5409.994f, 10536.84f)); polygon.Add(new Vector2(5410.823f, 10435.16f)); polygon.Add(new Vector2(5405.952f, 10368.07f)); polygon.Add(new Vector2(5400.308f, 10286.66f)); polygon.Add(new Vector2(5393.891f, 10236.46f)); polygon.Add(new Vector2(5334.101f, 10157.15f)); polygon.Add(new Vector2(5321.58f, 10128.36f)); polygon.Add(new Vector2(5235.837f, 10059.98f)); polygon.Add(new Vector2(5195.67f, 10014.93f)); polygon.Add(new Vector2(5165.543f, 9993.707f)); polygon.Add(new Vector2(5041.296f, 9957.55f)); polygon.Add(new Vector2(4996.941f, 9965.11f)); polygon.Add(new Vector2(4895.121f, 9965.11f)); polygon.Add(new Vector2(4881.26f, 9929.438f)); polygon.Add(new Vector2(4878.852f, 9874.359f)); polygon.Add(new Vector2(4913.443f, 9809.919f)); polygon.Add(new Vector2(4957.758f, 9788.854f)); polygon.Add(new Vector2(5040.549f, 9749.293f)); polygon.Add(new Vector2(5129.86f, 9693.721f)); polygon.Add(new Vector2(5159.574f, 9684.862f)); polygon.Add(new Vector2(5290.175f, 9653.095f)); polygon.Add(new Vector2(5385.785f, 9610.854f)); polygon.Add(new Vector2(5447.938f, 9585.938f)); polygon.Add(new Vector2(5537.51f, 9563.33f)); polygon.Add(new Vector2(5611.414f, 9542.97f)); polygon.Add(new Vector2(5647.355f, 9534.878f)); polygon.Add(new Vector2(5776.877f, 9504.799f)); polygon.Add(new Vector2(5861.86f, 9486.95f)); polygon.Add(new Vector2(5913.594f, 9467.287f)); polygon.Add(new Vector2(5994.028f, 9439.97f)); polygon.Add(new Vector2(6069.956f, 9397.259f)); polygon.Add(new Vector2(6114.971f, 9379.941f)); polygon.Add(new Vector2(6149.365f, 9345.229f)); polygon.Add(new Vector2(6224.337f, 9262.373f)); polygon.Add(new Vector2(6265.398f, 9222.46f)); polygon.Add(new Vector2(6302.731f, 9177.332f)); polygon.Add(new Vector2(6329.457f, 9107.588f)); polygon.Add(new Vector2(6352.521f, 9023.376f)); polygon.Add(new Vector2(6518.207f, 8893.449f)); polygon.Add(new Vector2(6582.625f, 8855.133f)); polygon.Add(new Vector2(6701.263f, 8776.032f)); polygon.Add(new Vector2(6755.74f, 8737.521f)); polygon.Add(new Vector2(6804.402f, 8699.702f)); polygon.Add(new Vector2(6881.613f, 8612.549f)); polygon.Add(new Vector2(6942.689f, 8558.408f)); polygon.Add(new Vector2(7020.217f, 8501.939f)); polygon.Add(new Vector2(7081.381f, 8426.203f)); polygon.Add(new Vector2(7104.414f, 8379.343f)); polygon.Add(new Vector2(7118.84f, 8322.37f)); polygon.Add(new Vector2(6972.666f, 8195.711f)); polygon.Add(new Vector2(6968.507f, 8190.896f)); polygon.Add(new Vector2(6896.44f, 8128.739f)); polygon.Add(new Vector2(6860.153f, 8110.252f)); polygon.Add(new Vector2(6816.477f, 8086.783f)); polygon.Add(new Vector2(6764.501f, 8047.402f)); polygon.Add(new Vector2(6713.552f, 7997.474f)); polygon.Add(new Vector2(6687.974f, 7949.765f)); polygon.Add(new Vector2(6667.387f, 7925.568f)); polygon.Add(new Vector2(6614.73f, 7877.888f)); polygon.Add(new Vector2(6582.654f, 7835.06f)); polygon.Add(new Vector2(6553.938f, 7791.702f)); polygon.Add(new Vector2(6504.163f, 7770.975f)); polygon.Add(new Vector2(6468.013f, 7795.183f)); polygon.Add(new Vector2(6372.669f, 7905.095f)); polygon.Add(new Vector2(6297.722f, 7975.385f)); polygon.Add(new Vector2(6237.125f, 8042.815f)); polygon.Add(new Vector2(6164.509f, 8092.841f)); polygon.Add(new Vector2(6071.151f, 8141.878f)); polygon.Add(new Vector2(5972.358f, 8206.84f)); polygon.Add(new Vector2(5865.54f, 8273.595f)); polygon.Add(new Vector2(5817.107f, 8304.513f)); polygon.Add(new Vector2(5708.884f, 8384.639f)); polygon.Add(new Vector2(5600.739f, 8434.356f)); polygon.Add(new Vector2(5510.747f, 8486.855f)); polygon.Add(new Vector2(5459.567f, 8515.217f)); polygon.Add(new Vector2(5403.981f, 8540.231f)); polygon.Add(new Vector2(5348.644f, 8533.733f)); polygon.Add(new Vector2(5248.083f, 8566.279f)); polygon.Add(new Vector2(5209.137f, 8542.994f)); polygon.Add(new Vector2(5093.107f, 8492.082f)); polygon.Add(new Vector2(5034.325f, 8481.55f)); polygon.Add(new Vector2(4891.127f, 8548.276f)); polygon.Add(new Vector2(4788.93f, 8644.276f)); polygon.Add(new Vector2(4744.861f, 8700.881f)); polygon.Add(new Vector2(4732.494f, 8782.122f)); polygon.Add(new Vector2(4734.606f, 8856.352f)); polygon.Add(new Vector2(4682.024f, 8883.785f)); polygon.Add(new Vector2(4608.785f, 8901.674f)); polygon.Add(new Vector2(4545.751f, 8929.004f)); polygon.Add(new Vector2(4487.941f, 8958.479f)); polygon.Add(new Vector2(4373.64f, 8994.158f)); polygon.Add(new Vector2(4273.92f, 9092.553f)); polygon.Add(new Vector2(4215.399f, 9155.81f)); polygon.Add(new Vector2(4114.513f, 9248.856f)); polygon.Add(new Vector2(4059.887f, 9295.432f)); polygon.Add(new Vector2(3975.471f, 9368.91f)); polygon.Add(new Vector2(3901.264f, 9430.61f)); polygon.Add(new Vector2(3891.658f, 9425.851f)); polygon.Add(new Vector2(3855.858f, 9346.825f)); polygon.Add(new Vector2(3793.531f, 9283.056f)); polygon.Add(new Vector2(3758.555f, 9255.709f)); polygon.Add(new Vector2(3709.814f, 9235.764f)); polygon.Add(new Vector2(3668.921f, 9291.834f)); polygon.Add(new Vector2(3641.28f, 9399.741f)); polygon.Add(new Vector2(3628.968f, 9522.953f)); polygon.Add(new Vector2(3603.45f, 9627.484f)); polygon.Add(new Vector2(3572.647f, 9681.716f)); polygon.Add(new Vector2(3506.908f, 9709.2f)); polygon.Add(new Vector2(3480.379f, 9844.466f)); polygon.Add(new Vector2(3460.194f, 9864.609f)); polygon.Add(new Vector2(3369.174f, 10054.37f)); polygon.Add(new Vector2(3308.606f, 10134.81f)); polygon.Add(new Vector2(3351.799f, 10144.44f)); polygon.Add(new Vector2(3289.037f, 10255.67f)); polygon.Add(new Vector2(3208.72f, 10374.79f)); polygon.Add(new Vector2(3178.151f, 10440.47f)); polygon.Add(new Vector2(3132.907f, 10535.32f)); polygon.Add(new Vector2(3112.103f, 10621.13f)); polygon.Add(new Vector2(3098.549f, 10716.04f)); polygon.Add(new Vector2(3111.285f, 10753.13f)); polygon.Add(new Vector2(3072.022f, 10885.75f)); polygon.Add(new Vector2(2910.731f, 10992.85f)); polygon.Add(new Vector2(2877.996f, 11113.11f)); polygon.Add(new Vector2(2837.607f, 11225.43f)); polygon.Add(new Vector2(2735.527f, 11361.45f)); polygon.Add(new Vector2(2657.716f, 11432.38f)); polygon.Add(new Vector2(2584.209f, 11491.59f)); polygon2.Add(new Vector2(7868.981f, 6339.229f)); polygon2.Add(new Vector2(7965.963f, 6410.891f)); polygon2.Add(new Vector2(8018.545f, 6463.381f)); polygon2.Add(new Vector2(8128.428f, 6522.556f)); polygon2.Add(new Vector2(8204.156f, 6612.573f)); polygon2.Add(new Vector2(8265.393f, 6692.954f)); polygon2.Add(new Vector2(8336.427f, 6764.822f)); polygon2.Add(new Vector2(8405.357f, 6832.152f)); polygon2.Add(new Vector2(8455.104f, 6883.719f)); polygon2.Add(new Vector2(8515.365f, 6866.398f)); polygon2.Add(new Vector2(8683.265f, 6781.743f)); polygon2.Add(new Vector2(8756.937f, 6714.271f)); polygon2.Add(new Vector2(8857.479f, 6648.822f)); polygon2.Add(new Vector2(8920.91f, 6600.535f)); polygon2.Add(new Vector2(9019.729f, 6558.934f)); polygon2.Add(new Vector2(9090.738f, 6525.52f)); polygon2.Add(new Vector2(9194.9f, 6493.96f)); polygon2.Add(new Vector2(9301.914f, 6469.311f)); polygon2.Add(new Vector2(9349.088f, 6445.979f)); polygon2.Add(new Vector2(9439.987f, 6411.341f)); polygon2.Add(new Vector2(9522.398f, 6389.004f)); polygon2.Add(new Vector2(9566.939f, 6379.513f)); polygon2.Add(new Vector2(9632.563f, 6360.75f)); polygon2.Add(new Vector2(9742.453f, 6344.874f)); polygon2.Add(new Vector2(9840.806f, 6320.129f)); polygon2.Add(new Vector2(9904.938f, 6310.335f)); polygon2.Add(new Vector2(9921.7f, 6321.582f)); polygon2.Add(new Vector2(10056.65f, 6295.665f)); polygon2.Add(new Vector2(10123.85f, 6268.798f)); polygon2.Add(new Vector2(10158.22f, 6233.325f)); polygon2.Add(new Vector2(10163.03f, 6203.653f)); polygon2.Add(new Vector2(10083.83f, 6125.894f)); polygon2.Add(new Vector2(10091.04f, 6084.157f)); polygon2.Add(new Vector2(10148.7f, 5982.94f)); polygon2.Add(new Vector2(10285.32f, 5940.522f)); polygon2.Add(new Vector2(10349.84f, 5908.086f)); polygon2.Add(new Vector2(10449.41f, 5861.624f)); polygon2.Add(new Vector2(10484.97f, 5823.12f)); polygon2.Add(new Vector2(10551.18f, 5765.024f)); polygon2.Add(new Vector2(10606.73f, 5710.038f)); polygon2.Add(new Vector2(10685.21f, 5617.688f)); polygon2.Add(new Vector2(10756.96f, 5552.451f)); polygon2.Add(new Vector2(10849.44f, 5504.297f)); polygon2.Add(new Vector2(10939.62f, 5501.439f)); polygon2.Add(new Vector2(11027.28f, 5470.433f)); polygon2.Add(new Vector2(11116.54f, 5455.872f)); polygon2.Add(new Vector2(11186.23f, 5398.153f)); polygon2.Add(new Vector2(11261.96f, 5288.458f)); polygon2.Add(new Vector2(11287.77f, 5188.666f)); polygon2.Add(new Vector2(11291.01f, 5118.99f)); polygon2.Add(new Vector2(11302.89f, 5046.188f)); polygon2.Add(new Vector2(11393.98f, 4907.275f)); polygon2.Add(new Vector2(11502.31f, 4833.07f)); polygon2.Add(new Vector2(11533.12f, 4799.572f)); polygon2.Add(new Vector2(11614.01f, 4692.32f)); polygon2.Add(new Vector2(11699.8f, 4562.485f)); polygon2.Add(new Vector2(11727.3f, 4496.97f)); polygon2.Add(new Vector2(11773.48f, 4417.811f)); polygon2.Add(new Vector2(11817.09f, 4330.945f)); polygon2.Add(new Vector2(11879.7f, 4215.896f)); polygon2.Add(new Vector2(11939.48f, 4068.597f)); polygon2.Add(new Vector2(11949.11f, 3999.522f)); polygon2.Add(new Vector2(12003.21f, 3932.16f)); polygon2.Add(new Vector2(12035.18f, 3826.729f)); polygon2.Add(new Vector2(11996.48f, 3741.656f)); polygon2.Add(new Vector2(12023.1f, 3659.81f)); polygon2.Add(new Vector2(12016.68f, 3586.539f)); polygon2.Add(new Vector2(11999.81f, 3509.291f)); polygon2.Add(new Vector2(11930.97f, 3378.556f)); polygon2.Add(new Vector2(11852.41f, 3314.604f)); polygon2.Add(new Vector2(11730f, 3232.118f)); polygon2.Add(new Vector2(11652.25f, 3188.159f)); polygon2.Add(new Vector2(11544.43f, 3153.356f)); polygon2.Add(new Vector2(11431.76f, 3152.824f)); polygon2.Add(new Vector2(11284.9f, 3174.834f)); polygon2.Add(new Vector2(11193.03f, 3201.933f)); polygon2.Add(new Vector2(11061.57f, 3290.632f)); polygon2.Add(new Vector2(10988.63f, 3398.995f)); polygon2.Add(new Vector2(10923.88f, 3508.665f)); polygon2.Add(new Vector2(10889.27f, 3617.128f)); polygon2.Add(new Vector2(10910.34f, 3696.219f)); polygon2.Add(new Vector2(10939.28f, 3724.606f)); polygon2.Add(new Vector2(11008.04f, 3867.494f)); polygon2.Add(new Vector2(11003.11f, 3959.638f)); polygon2.Add(new Vector2(10985.27f, 4043.183f)); polygon2.Add(new Vector2(10932.26f, 4155.601f)); polygon2.Add(new Vector2(10838.95f, 4278.329f)); polygon2.Add(new Vector2(10776.97f, 4341.615f)); polygon2.Add(new Vector2(10654.59f, 4484.394f)); polygon2.Add(new Vector2(10589.38f, 4601.917f)); polygon2.Add(new Vector2(10506.6f, 4685.379f)); polygon2.Add(new Vector2(10442.32f, 4736.014f)); polygon2.Add(new Vector2(10403.2f, 4762.162f)); polygon2.Add(new Vector2(10341.41f, 4750.744f)); polygon2.Add(new Vector2(10324.37f, 4669.402f)); polygon2.Add(new Vector2(10341.21f, 4557.95f)); polygon2.Add(new Vector2(10362.71f, 4478.865f)); polygon2.Add(new Vector2(10357.92f, 4416.742f)); polygon2.Add(new Vector2(10361.06f, 4350.383f)); polygon2.Add(new Vector2(10337.69f, 4266.871f)); polygon2.Add(new Vector2(10323.29f, 4227.249f)); polygon2.Add(new Vector2(10263.42f, 4114.481f)); polygon2.Add(new Vector2(10232.18f, 4065.519f)); polygon2.Add(new Vector2(10161.75f, 4007.62f)); polygon2.Add(new Vector2(10107.47f, 3962.813f)); polygon2.Add(new Vector2(10047.05f, 3943.221f)); polygon2.Add(new Vector2(9952.226f, 3928.655f)); polygon2.Add(new Vector2(9872.554f, 3903.026f)); polygon2.Add(new Vector2(9757.226f, 3910.998f)); polygon2.Add(new Vector2(9713.239f, 3917.209f)); polygon2.Add(new Vector2(9623.719f, 3983.908f)); polygon2.Add(new Vector2(9499.824f, 4093.229f)); polygon2.Add(new Vector2(9439.021f, 4189.26f)); polygon2.Add(new Vector2(9334.65f, 4309.126f)); polygon2.Add(new Vector2(9286.929f, 4420.83f)); polygon2.Add(new Vector2(9283.249f, 4493.614f)); polygon2.Add(new Vector2(9365.528f, 4597.45f)); polygon2.Add(new Vector2(9401.229f, 4668.463f)); polygon2.Add(new Vector2(9463.471f, 4718.271f)); polygon2.Add(new Vector2(9546.215f, 4759.035f)); polygon2.Add(new Vector2(9654.335f, 4821.773f)); polygon2.Add(new Vector2(9684.429f, 4843.124f)); polygon2.Add(new Vector2(9852.012f, 4906.69f)); polygon2.Add(new Vector2(9923.106f, 4923.356f)); polygon2.Add(new Vector2(10023.27f, 4972.259f)); polygon2.Add(new Vector2(10029.16f, 5059.08f)); polygon2.Add(new Vector2(9959.093f, 5104.941f)); polygon2.Add(new Vector2(9907.042f, 5129.954f)); polygon2.Add(new Vector2(9837.718f, 5156.542f)); polygon2.Add(new Vector2(9727.542f, 5177.631f)); polygon2.Add(new Vector2(9722.042f, 5177.649f)); polygon2.Add(new Vector2(9534.108f, 5247.74f)); polygon2.Add(new Vector2(9433.008f, 5320.894f)); polygon2.Add(new Vector2(9308.356f, 5400.459f)); polygon2.Add(new Vector2(9144.662f, 5471.706f)); polygon2.Add(new Vector2(9044.622f, 5489.93f)); polygon2.Add(new Vector2(8911.397f, 5518.428f)); polygon2.Add(new Vector2(8789.628f, 5560.841f)); polygon2.Add(new Vector2(8731.121f, 5598.868f)); polygon2.Add(new Vector2(8686.014f, 5743.163f)); polygon2.Add(new Vector2(8656.452f, 5841.5f)); polygon2.Add(new Vector2(8625.521f, 5907.614f)); polygon2.Add(new Vector2(8502.436f, 5988.761f)); polygon2.Add(new Vector2(8420.601f, 6013.734f)); polygon2.Add(new Vector2(8351.037f, 6037.048f)); polygon2.Add(new Vector2(8270.57f, 6072.384f)); polygon2.Add(new Vector2(8201.776f, 6108.546f)); polygon2.Add(new Vector2(8129.375f, 6157.551f)); polygon2.Add(new Vector2(8045.78f, 6220.441f)); polygon2.Add(new Vector2(7980.194f, 6264.799f)); rivers.Add(polygon); rivers.Add(polygon2); }