public static bool IsCondemable(this AIHeroClient unit, Vector2 pos = new Vector2()) { if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || LastCheck + 50 > Environment.TickCount || _Player.IsDashing()) return false; var prediction = ESpell.GetPrediction(unit); var predictionsList = pos.IsValid() ? new List<Vector3>() {pos.To3D()} : new List<Vector3> { unit.ServerPosition, unit.Position, prediction.CastPosition, prediction.UnitPosition }; var wallsFound = 0; Program.Points = new List<Vector2>(); foreach (var position in predictionsList) { for (var i = 0; i < Program.CondemnMenu["pushDistance"].Cast<Slider>().CurrentValue; i += (int) unit.BoundingRadius) { var cPos = _Player.Position.Extend(position, _Player.Distance(position) + i).To3D(); Program.Points.Add(cPos.To2D()); if (NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Building)) { wallsFound++; break; } } } if ((wallsFound/ predictionsList.Count) >= Program.CondemnMenu["condemnPercent"].Cast<Slider>().CurrentValue/100f) { return true; } return false; }
public FoundIntersection(float distance, int time, Vector2 point, Vector2 comingFrom) { this.Distance = distance; this.ComingFrom = comingFrom; this.Valid = point.IsValid(); this.Point = point + Config.GridSize * (this.ComingFrom - point).LSNormalized(); this.Time = time; }
public FoundIntersection(float distance, int time, Vector2 point, Vector2 comingFrom) { Distance = distance; ComingFrom = comingFrom; Valid = point.IsValid(); Point = point + Config.GridSize * (ComingFrom - point).Normalized(); Time = time; }
public FoundIntersection(float distance, int time, Vector2 pointVector2, Vector2 comingFromVector2) { Distance = distance; ComingFromVector2 = comingFromVector2; IsValid = pointVector2.IsValid(); PointVector2 = pointVector2 + GridSize * (ComingFromVector2 - pointVector2).Normalized(); Time = time; }
public static AIHeroClient GetTarget(float range, DamageType type, Vector2 secondaryPos = new Vector2()) { if (_target == null || _target.IsDead || _target.Health <= 0 || !_target.IsValidTarget()) _target = null; if (secondaryPos.IsValid() && _target.Distance(secondaryPos) < range || _target.IsValidTarget(range)) { return _target; } return TargetSelector.GetTarget(range, type); }
public static AIHeroClient GetTarget(float range, DamageType type, Vector2 secondaryPos = new Vector2()) { if (_target == null || _target.IsDead || _target.Health <= 0 || !_target.IsValidTarget()) _target = null; var hasBuffTristE = Player.Instance.HasBuff("tristanaecharge"); if (secondaryPos.IsValid() && _target.Distance(secondaryPos) < range || _target.IsValidTarget(range) || hasBuffTristE) { return _target; } return TargetSelector.GetTarget(range, type); }
private bool Cast(Vector2 position, Obj_AI_Base target) { Console.WriteLine("cast equest"); switch (Type) { case ActiveSpellType.Item: if (Items.CanUseItem(ItemId)) { if (position.IsValid() && ObjectManager.Player.Distance(position, true) < Range * Range) { Items.UseItem(ItemId, position); } else if (target.IsValidTarget(Range, false)) { Items.UseItem(ItemId, target); } return true; } return false; case ActiveSpellType.Spell: if (position.IsValid() && ObjectManager.Player.Distance(position, true) < Range * Range) { return ObjectManager.Player.Spellbook.CastSpell(Slot, position.To3D()); } if (target.IsValidTarget(Range, false)) { return ObjectManager.Player.Spellbook.CastSpell(Slot, target); } return false; case ActiveSpellType.SummonerSpell: var slot = ObjectManager.Player.GetSpellSlot(SummmonerSpellName); if (slot != SpellSlot.Unknown) { if (position.IsValid() && ObjectManager.Player.Distance(position, true) < Range * Range) { return ObjectManager.Player.Spellbook.CastSpell(slot, position.To3D()); } if (target.IsValidTarget(Range, false)) { return ObjectManager.Player.Spellbook.CastSpell(slot); } } return false; } return false; }
public static void SetPosition(Vector2 position = new Vector2()) { position = position.IsValid() ? position : Cursor.ScreenPosition; if (position == Vector2.Zero) { return; } if (Position.LSDistance(position) < 100) { CursorSprite.Position = position.GetRelativePosition(); } //MouseManager.StartPath(position); }
public static bool IsCondemable(this AIHeroClient unit, Vector2 pos = new Vector2()) { if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || LastCheck + 50 > Environment.TickCount || _Player.IsDashing()) return false; Program.CorrectPoints = new List<Vector2>(); Program.Points = new List<Vector2>(); if (!pos.IsValid()) pos = ObjectManager.Player.Position.To2D(); int wallCount = 0; int pushDistance = Program.CondemnMenu["pushDistance"].Cast<Slider>().CurrentValue; for (int i = 0; i < pushDistance; i += 20) { var unitPos = Prediction.Position.PredictUnitPosition(unit, 250); var cell = pos.Extend(unitPos, unitPos.Distance(pos) + i); if (cell.ToNavMeshCell().CollFlags.HasFlag(CollisionFlags.Wall)) { Program.CorrectPoints.Add(cell); wallCount++; } else { Program.Points.Add(cell); } } if (CheckCount >= 2 && wallCount > 2) { CheckCount = 0; LastCheck = Environment.TickCount; return true; } if (wallCount > 2) { CheckCount++; } else { CheckCount = 0; } LastCheck = Environment.TickCount; return false; }
public static bool Condemn360(Obj_AI_Hero unit, int push, Vector2 pos = new Vector2()) { if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || _lastCheck + 50 > Environment.TickCount || ObjectManager.Player.IsDashing()) { return false; } var prediction = E.GetPrediction(unit); var predictionsList = pos.IsValid() ? new List<Vector3>() { pos.ToVector3() } : new List<Vector3> { unit.ServerPosition, unit.Position, prediction.CastPosition, prediction.UnitPosition }; var wallsFound = 0; _points = new List<Vector2>(); foreach (var position in predictionsList) { for (var i = 0; i < push; i += (int)unit.BoundingRadius) // 420 = push distance { var cPos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).ToVector2(); _points.Add(cPos); if (NavMesh.GetCollisionFlags(cPos.ToVector3()).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos.ToVector3()).HasFlag(CollisionFlags.Building)) { wallsFound++; break; } } } // ReSharper disable once PossibleLossOfFraction if ((wallsFound / predictionsList.Count) >= 33 / 100f) { return true; } return false; }
public static void Condemn360(Obj_AI_Hero hero, Vector2 pos = new Vector2()) { if (hero.HasBuffOfType(BuffType.SpellImmunity) || hero.HasBuffOfType(BuffType.SpellShield) || LastCheck + 50 > Environment.TickCount || ObjectManager.Player.IsDashing()) { return; } var prediction = VayneSpells.E.GetPrediction(hero); var predictionsList = pos.IsValid() ? new List<Vector3>() { pos.To3D() } : new List<Vector3> { hero.ServerPosition, hero.Position, prediction.CastPosition, prediction.UnitPosition }; var wallsFound = 0; Points = new List<Vector2>(); foreach (var position in predictionsList) { for (var i = 0; i < PushDistance; i += (int)hero.BoundingRadius) // 420 = push distance { var cPos = ObjectManager.Player.Position.Extend(position, ObjectManager.Player.Distance(position) + i).To2D(); Points.Add(cPos); if (NavMesh.GetCollisionFlags(cPos.To3D()).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos.To3D()).HasFlag(CollisionFlags.Building)) { wallsFound++; break; } } } if ((wallsFound / predictionsList.Count) >= 33 / 100f) { VayneSpells.E.Cast(hero); } }
public static bool threeSixty(AIHeroClient unit, Vector2 pos = new Vector2()) { if (unit.HasBuffOfType(BuffType.SpellImmunity) || unit.HasBuffOfType(BuffType.SpellShield) || ObjectManager.Player.LSIsDashing()) return false; var prediction = E.GetPrediction(unit); var predictionsList = pos.IsValid() ? new List<Vector3> { pos.To3D() } : new List<Vector3> { unit.ServerPosition, unit.Position, prediction.CastPosition, prediction.UnitPosition }; var wallsFound = 0; Points = new List<Vector2>(); foreach (var position in predictionsList) { for (var i = 0; i < getSliderItem(emenu, "PushDistance"); i += (int)unit.BoundingRadius) // 420 = push distance { var cPos = ObjectManager.Player.Position.LSExtend(position, ObjectManager.Player.LSDistance(position) + i); Points.Add(cPos.LSTo2D()); if (NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Wall) || NavMesh.GetCollisionFlags(cPos).HasFlag(CollisionFlags.Building)) { wallsFound++; break; } } } if (wallsFound / predictionsList.Count >= 33 / 100f) { return true; } return false; }
private static void OnDetectSkillshot(Skillshot skillshot) { var alreadyAdded = DetectedSkillshots.Any( i => i.SpellData.SpellName == skillshot.SpellData.SpellName && i.Unit.Compare(skillshot.Unit) && skillshot.Direction.AngleBetween(i.Direction) < 5 && (skillshot.Start.Distance(i.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)); if (skillshot.Unit.IsAlly) { return; } if (skillshot.Start.Distance(PlayerPosition) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } if (alreadyAdded && !skillshot.SpellData.DontCheckForDuplicates) { return; } if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SpellData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2; i <= (skillshot.SpellData.MultipleNumber - 1) / 2; i++) { DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.Start + skillshot.SpellData.Range * originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i), skillshot.Unit)); } return; } if (skillshot.SpellData.SpellName == "UFSlash") { skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.SpellName == "SionR") { skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.Invert) { DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.Start + -(skillshot.End - skillshot.Start).Normalized() * skillshot.Start.Distance(skillshot.End), skillshot.Unit)); return; } if (skillshot.SpellData.Centered) { DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start - skillshot.Direction * skillshot.SpellData.Range, skillshot.Start + skillshot.Direction * skillshot.SpellData.Range, skillshot.Unit)); return; } if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5") { const int Angle = 60; var edge1 = (skillshot.End - skillshot.Unit.ServerPosition.ToVector2()).Rotated( -Angle / 2f * (float)Math.PI / 180); var edge2 = edge1.Rotated(Angle * (float)Math.PI / 180); foreach (var skillshotToAdd in from orb in GameObjects.EnemyMinions.Where(i => i.Name == "Seed" && i.Distance(skillshot.Unit) < 800) let v = (orb.ServerPosition - skillshot.Unit.ServerPosition).ToVector2() where edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 select new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, orb.ServerPosition.ToVector2(), skillshot.Unit.ServerPosition.Extend( orb.ServerPosition, skillshot.Unit.Distance(orb) > 200 ? 1300 : 1000).ToVector2(), skillshot.Unit)) { DetectedSkillshots.Add(skillshotToAdd); } return; } if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid") { DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.End - skillshot.Direction.Perpendicular() * 400, skillshot.End + skillshot.Direction.Perpendicular() * 400, skillshot.Unit)); return; } if (skillshot.SpellData.SpellName == "DianaArc") { DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("DianaArcArc"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit)); } if (skillshot.SpellData.SpellName == "ZiggsQ") { var d1 = skillshot.Start.Distance(skillshot.End); var d2 = d1 * 0.4f; var d3 = d2 * 0.69f; var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2"); var bounce1Pos = skillshot.End + skillshot.Direction * d2; var bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500); bounce2SpellData.Delay = (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos, skillshot.Unit)); DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Unit)); } if (skillshot.SpellData.SpellName == "ZiggsR") { skillshot.SpellData.Delay = (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range); } if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (var s in DetectedSkillshots.Where(i => i.SpellData.Slot == SpellSlot.E)) { if (!s.Unit.Compare(skillshot.Unit)) { continue; } var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafePoint(s.End)) { endPos = s.End; } break; } foreach (var m in GameObjects.Minions.Where(i => i.CharData.BaseSkinName == "jarvanivstandard")) { if (m.Team != skillshot.Unit.Team) { continue; } var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafePoint(m.Position.ToVector2())) { endPos = m.Position.ToVector2(); } break; } if (endPos.IsValid()) { skillshot = new Skillshot( DetectionType.ProcessSpell, SpellDatabase.GetByName("JarvanIVEQ"), Variables.TickCount, skillshot.Start, endPos + 200 * (endPos - skillshot.Start).Normalized(), skillshot.Unit); } } } if (skillshot.SpellData.SpellName == "OriannasQ") { DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("OriannaQend"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit)); } if ((skillshot.SpellData.DisableFowDetection || Program.MainMenu["Evade"][skillshot.SpellData.ChampionName.ToLowerInvariant()][ skillshot.SpellData.SpellName]["DisableFoW"].GetValue<MenuBool>().Value) && skillshot.DetectionType == DetectionType.RecvPacket) { return; } DetectedSkillshots.Add(skillshot); }
private static void OnDetectSkillshot(Skillshot skillshot) { var alreadyAdded = false; foreach (var i in SkillshotDetector.DetectedSkillshots) { if (i.SpellData.SpellName == skillshot.SpellData.SpellName && i.Unit.NetworkId == skillshot.Unit.NetworkId && skillshot.Direction.AngleBetween(i.Direction) < 5 && (skillshot.Start.Distance(i.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)) alreadyAdded = true; } if (skillshot.Unit.Team == Variables._Player.Team) { return; } if (skillshot.Start.Distance(Variables._Player.ServerPosition.To2D()) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } if (alreadyAdded && !skillshot.SpellData.DontCheckForDuplicates) { return; } if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SpellData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2; i <= (skillshot.SpellData.MultipleNumber - 1) / 2; i++) { SkillshotDetector.DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.Start + skillshot.SpellData.Range * originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i), skillshot.Unit)); } return; } if (skillshot.SpellData.SpellName == "UFSlash") { skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.SpellName == "SionR") { skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.Invert) { SkillshotDetector.DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.Start + -(skillshot.End - skillshot.Start).Normalized() * skillshot.Start.Distance(skillshot.End), skillshot.Unit)); return; } if (skillshot.SpellData.Centered) { SkillshotDetector.DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start - skillshot.Direction * skillshot.SpellData.Range, skillshot.Start + skillshot.Direction * skillshot.SpellData.Range, skillshot.Unit)); return; } if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5") { const int Angle = 60; var edge1 = (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated( -Angle / 2f * (float)Math.PI / 180); var edge2 = edge1.Rotated(Angle * (float)Math.PI / 180); foreach (var skillshotToAdd in from minion in ObjectManager.Get<Obj_AI_Minion>() let v = (minion.ServerPosition - skillshot.Unit.ServerPosition).To2D( ) where minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 && minion.Distance(skillshot.Unit) < 800 && minion.Team != Variables._Player.Team let start = minion.ServerPosition.To2D() let end = skillshot.Unit.ServerPosition.Extend( minion.ServerPosition, skillshot.Unit.Distance(minion) > 200 ? 1300 : 1000) select new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit)) { SkillshotDetector.DetectedSkillshots.Add(skillshotToAdd); } return; } if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid") { SkillshotDetector.DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.End - skillshot.Perpendicular * 400, skillshot.End + skillshot.Perpendicular * 400, skillshot.Unit)); return; } if (skillshot.SpellData.SpellName == "DianaArc") { SkillshotDetector.DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("DianaArcArc"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit)); } if (skillshot.SpellData.SpellName == "ZiggsQ") { var d1 = skillshot.Start.Distance(skillshot.End); var d2 = d1 * 0.4f; var d3 = d2 * 0.69f; var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2"); var bounce1Pos = skillshot.End + skillshot.Direction * d2; var bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500); bounce2SpellData.Delay = (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); SkillshotDetector.DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos, skillshot.Unit)); SkillshotDetector.DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Unit)); } if (skillshot.SpellData.SpellName == "ZiggsR") { skillshot.SpellData.Delay = (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range); } if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (var s in SkillshotDetector.DetectedSkillshots) { if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E) { var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafePoint(s.End)) { endPos = s.End; } break; } } foreach (var m in ObjectManager.Get<Obj_AI_Minion>()) { if (m.CharData.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team) { var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafePoint(m.Position.To2D())) { endPos = m.Position.To2D(); } break; } } if (endPos.IsValid()) { skillshot = new Skillshot( DetectionType.ProcessSpell, SpellDatabase.GetByName("JarvanIVEQ"), Utils.GameTimeTickCount, skillshot.Start, endPos + 200 * (endPos - skillshot.Start).Normalized(), skillshot.Unit); } } } if (skillshot.SpellData.SpellName == "OriannasQ") { SkillshotDetector.DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("OriannaQend"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit)); } if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket) { return; } SkillshotDetector.DetectedSkillshots.Add(skillshot); }
private static void LockROnTarget() { var target = R.GetTarget(); if (target == null) { return; } var endPos = (Player.ServerPosition - target.ServerPosition).Normalized(); var predPos = R.GetPrediction(target).CastPosition.To2D(); var fullPoint = new Vector2(predPos.X + endPos.X * R.Range * 0.98f, predPos.Y + endPos.Y * R.Range * 0.98f); var closestPoint = Player.ServerPosition.To2D().Closest(new List<Vector2> { predPos, fullPoint }); if (closestPoint.IsValid() && !closestPoint.IsWall() && predPos.Distance(closestPoint) > E.Range) { Player.IssueOrder(GameObjectOrder.MoveTo, closestPoint.To3D()); } else if (fullPoint.IsValid() && !fullPoint.IsWall() && predPos.Distance(fullPoint) < R.Range && predPos.Distance(fullPoint) > 100) { Player.IssueOrder(GameObjectOrder.MoveTo, fullPoint.To3D()); } }
private static void OnDetectSkillshot(Skillshot skillshot) { bool alreadyAdded = false; foreach (Skillshot item in DetectedSkillshots) { if (item.SpellData.SpellName == skillshot.SpellData.SpellName && (item.Unit.NetworkId == skillshot.Unit.NetworkId && (skillshot.Direction).AngleBetween(item.Direction) < 5 && (skillshot.Start.Distance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))) { alreadyAdded = true; } } //Check if the skillshot is from an ally. if (skillshot.Unit.Team == ObjectManager.Player.Team) { return; } //Check if the skillshot is too far away. if (skillshot.Start.Distance(ObjectManager.Player.ServerPosition.To2D()) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } //Add the skillshot to the detected skillshot list. if (!alreadyAdded) { //Multiple skillshots like twisted fate Q. if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SpellData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (int i = -(skillshot.SpellData.MultipleNumber - 1) / 2; i <= (skillshot.SpellData.MultipleNumber - 1) / 2; i++) { var end = skillshot.Start + skillshot.SpellData.Range * originalDirection.Rotated(skillshot.SpellData.MultipleAngle * i); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } return; } if (skillshot.SpellData.SpellName == "UFSlash") { skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.Invert) { var newDirection = -(skillshot.End - skillshot.Start).Normalized(); var end = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.Centered) { var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range; var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5") { int angle = 60; var edge1 = (skillshot.End - skillshot.Unit.ServerPosition.To2D()).Rotated( -angle / 2 * (float)Math.PI / 180); var edge2 = edge1.Rotated(angle * (float)Math.PI / 180); foreach (Obj_AI_Minion minion in ObjectManager.Get<Obj_AI_Minion>()) { Vector2 v = minion.ServerPosition.To2D() - skillshot.Unit.ServerPosition.To2D(); if (minion.Name == "Seed" && edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0 && minion.Distance(skillshot.Unit) < 800 && (minion.Team != ObjectManager.Player.Team)) { Vector2 start = minion.ServerPosition.To2D(); var end = skillshot.Unit.ServerPosition.To2D() .Extend( minion.ServerPosition.To2D(), skillshot.Unit.Distance(minion) > 200 ? 1300 : 1000); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } } return; } if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid") { Vector2 start = skillshot.End - skillshot.Direction.Perpendicular() * 400; Vector2 end = skillshot.End + skillshot.Direction.Perpendicular() * 400; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "ZiggsQ") { var d1 = skillshot.Start.Distance(skillshot.End); float d2 = d1 * 0.4f; float d3 = d2 * 0.69f; var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2"); Vector2 bounce1Pos = skillshot.End + skillshot.Direction * d2; Vector2 bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500); bounce2SpellData.Delay = (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); var bounce1 = new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos, skillshot.Unit); var bounce2 = new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Unit); DetectedSkillshots.Add(bounce1); DetectedSkillshots.Add(bounce2); } if (skillshot.SpellData.SpellName == "ZiggsR") { skillshot.SpellData.Delay = (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range); } if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (Skillshot s in DetectedSkillshots) { if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E) { endPos = s.End; } } foreach (Obj_AI_Minion m in ObjectManager.Get<Obj_AI_Minion>()) { if (m.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team && skillshot.IsDanger(m.Position.To2D())) { endPos = m.Position.To2D(); } } if (!endPos.IsValid()) { return; } skillshot.End = endPos + 200 * (endPos - skillshot.Start).Normalized(); skillshot.Direction = (skillshot.End - skillshot.Start).Normalized(); } } if (skillshot.SpellData.SpellName == "OriannasQ") { var endCSpellData = SpellDatabase.GetByName("OriannaQend"); var skillshotToAdd = new Skillshot( skillshot.DetectionType, endCSpellData, skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } //Dont allow fow detection. if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket) { return; } #if DEBUG Console.WriteLine(Environment.TickCount + "Adding new skillshot: " + skillshot.SpellData.SpellName); #endif DetectedSkillshots.Add(skillshot); } }
private static void Game_OnGameUpdate(EventArgs args) { if (Player.IsDead) return; if (Player.IsChannelingImportantSpell()) { var endPoint = new Vector2(); foreach (var obj in ObjectManager.Get<GameObject>()) { if (obj != null && obj.IsValid && obj.Name.Contains("Velkoz_") && obj.Name.Contains("_R_Beam_End")) { endPoint = Player.ServerPosition.To2D() + R.Range * (obj.Position - Player.ServerPosition).To2D().Normalized(); break; } } if (endPoint.IsValid()) { var targets = new List<Obj_AI_Base>(); foreach (var enemy in ObjectManager.Get<Obj_AI_Hero>().Where(h => h.IsValidTarget(R.Range))) { if (enemy.ServerPosition.To2D().Distance(Player.ServerPosition.To2D(), endPoint, true) < 400) targets.Add(enemy); } if (targets.Count > 0) { var target = targets.OrderBy(t => t.Health / Q.GetDamage(t)).ToList()[0]; Packet.C2S.ChargedCast.Encoded(new Packet.C2S.ChargedCast.Struct(SpellSlot.R, target.ServerPosition.X, target.ServerPosition.Z, target.ServerPosition.Y)).Send(); } else { Packet.C2S.ChargedCast.Encoded(new Packet.C2S.ChargedCast.Struct(SpellSlot.R, Game.CursorPos.X, Game.CursorPos.Z, Game.CursorPos.Y)).Send(); } } return; } if (QMissile != null && QMissile.IsValid && Q.Instance.Name == "velkozqsplitactivate" && Environment.TickCount - Q.LastCastAttemptT < 2000) { var qMissilePosition = QMissile.Position.To2D(); var perpendicular = (QMissile.EndPosition - QMissile.StartPosition).To2D().Normalized().Perpendicular(); var lineSegment1End = qMissilePosition + perpendicular * QSplit.Range; var lineSegment2End = qMissilePosition - perpendicular * QSplit.Range; var potentialTargets = new List<Obj_AI_Base>(); foreach ( var enemy in ObjectManager.Get<Obj_AI_Hero>() .Where( h => h.IsValidTarget() && h.ServerPosition.To2D() .Distance(qMissilePosition, QMissile.EndPosition.To2D(), true) < 700)) { potentialTargets.Add(enemy); } QSplit.UpdateSourcePosition(qMissilePosition.To3D(), qMissilePosition.To3D()); foreach ( var enemy in ObjectManager.Get<Obj_AI_Hero>() .Where( h => h.IsValidTarget() && (potentialTargets.Count == 0 || h.NetworkId == potentialTargets.OrderBy(t => t.Health / Q.GetDamage(t)).ToList()[0].NetworkId) && (h.ServerPosition.To2D().Distance(qMissilePosition, QMissile.EndPosition.To2D(), true) > Q.Width + h.BoundingRadius))) { var prediction = QSplit.GetPrediction(enemy); var d1 = prediction.Position.To2D().Distance(qMissilePosition, lineSegment1End, true); var d2 = prediction.Position.To2D().Distance(qMissilePosition, lineSegment2End, true); if (prediction.HitChance >= Prediction.HitChance.HighHitchance && (d1 < QSplit.Width + enemy.BoundingRadius || d2 < QSplit.Width + enemy.BoundingRadius)) { Q.Cast(); } } } Orbwalker.SetAttacks(true); if (Config.Item("ComboActive").GetValue<KeyBind>().Active) { Combo(); } else { if (Config.Item("HarassActive").GetValue<KeyBind>().Active || Config.Item("HarassActiveT").GetValue<KeyBind>().Active) Harass(); if (Config.Item("LaneClearActive").GetValue<KeyBind>().Active) Farm(); if (Config.Item("JungleFarmActive").GetValue<KeyBind>().Active) JungleFarm(); } }
private static void OnDetectSkillshot(Skillshot skillshot) { //Check if the skillshot is already added. var alreadyAdded = false; if (getCheckBoxItem(Config.misc, "DisableFow") && !skillshot.Unit.IsVisible) { return; } foreach (var item in DetectedSkillshots) { if (item.SpellData.SpellName == skillshot.SpellData.SpellName && (item.Unit.NetworkId == skillshot.Unit.NetworkId && (skillshot.Direction).LSAngleBetween(item.Direction) < 5 && (skillshot.Start.LSDistance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))) { alreadyAdded = true; } } //Check if the skillshot is from an ally. if (skillshot.Unit.Team == ObjectManager.Player.Team && !Config.TestOnAllies) { return; } //Check if the skillshot is too far away. if (skillshot.Start.LSDistance(PlayerPosition) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } //Add the skillshot to the detected skillshot list. if (!alreadyAdded || skillshot.SpellData.DontCheckForDuplicates) { //Multiple skillshots like twisted fate Q. if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SpellData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2; i <= (skillshot.SpellData.MultipleNumber - 1) / 2; i++) { var end = skillshot.Start + skillshot.SpellData.Range * originalDirection.LSRotated(skillshot.SpellData.MultipleAngle * i); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } return; } if (skillshot.SpellData.SpellName == "UFSlash") { skillshot.SpellData.MissileSpeed = 1600 + (int) skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.SpellName == "SionR") { skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.Invert) { var newDirection = -(skillshot.End - skillshot.Start).LSNormalized(); var end = skillshot.Start + newDirection * skillshot.Start.LSDistance(skillshot.End); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.Centered) { var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range; var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "TaricE" && (skillshot.Unit as AIHeroClient).ChampionName == "Taric") { var target = HeroManager.AllHeroes.FirstOrDefault(h => h.Team == skillshot.Unit.Team && h.IsVisible && h.HasBuff("taricwleashactive")); if (target != null) { var start = target.ServerPosition.LSTo2D(); var direction = (skillshot.OriginalEnd - start).LSNormalized(); var end = start + direction * skillshot.SpellData.Range; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, target) { OriginalEnd = skillshot.OriginalEnd }; DetectedSkillshots.Add(skillshotToAdd); } } if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5") { var angle = 60; var edge1 = (skillshot.End - skillshot.Unit.ServerPosition.LSTo2D()).LSRotated( -angle / 2 * (float) Math.PI / 180); var edge2 = edge1.LSRotated(angle * (float) Math.PI / 180); var positions = new List<Vector2>(); var explodingQ = DetectedSkillshots.FirstOrDefault(s => s.SpellData.SpellName == "SyndraQ"); if (explodingQ != null) { positions.Add(explodingQ.End); } foreach (var minion in ObjectManager.Get<Obj_AI_Minion>()) { if (minion.Name == "Seed" && !minion.IsDead && (minion.Team != ObjectManager.Player.Team || Config.TestOnAllies)) { positions.Add(minion.ServerPosition.LSTo2D()); } } Console.WriteLine(positions.Count + " positions to check"); foreach (var position in positions) { var v = position - skillshot.Unit.ServerPosition.LSTo2D(); if (edge1.LSCrossProduct(v) > 0 && v.LSCrossProduct(edge2) > 0 && position.LSDistance(skillshot.Unit) < 800 ) { var start = position; var end = skillshot.Unit.ServerPosition.LSTo2D() .LSExtend( position, skillshot.Unit.LSDistance(position) > 200 ? 1300 : 1000); var startTime = skillshot.StartTick; startTime += (int)(150 + skillshot.Unit.LSDistance(position) / 2.5f); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, startTime, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } } return; } if (skillshot.SpellData.SpellName == "MalzaharQ") { var start = skillshot.End - skillshot.Direction.LSPerpendicular() * 400; var end = skillshot.End + skillshot.Direction.LSPerpendicular() * 400; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "ZyraQ") { var start = skillshot.End - skillshot.Direction.LSPerpendicular() * 450; var end = skillshot.End + skillshot.Direction.LSPerpendicular() * 450; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "DianaArc") { var skillshotToAdd = new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("DianaArcArc"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } if (skillshot.SpellData.SpellName == "ZiggsQ") { var d1 = skillshot.Start.LSDistance(skillshot.End); var d2 = d1 * 0.4f; var d3 = d2 * 0.69f; var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2"); var bounce1Pos = skillshot.End + skillshot.Direction * d2; var bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int) (skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500); bounce2SpellData.Delay = (int) (bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); var bounce1 = new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos, skillshot.Unit); var bounce2 = new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Unit); DetectedSkillshots.Add(bounce1); DetectedSkillshots.Add(bounce2); } if (skillshot.SpellData.SpellName == "ZiggsR") { skillshot.SpellData.Delay = (int) (1500 + 1500 * skillshot.End.LSDistance(skillshot.Start) / skillshot.SpellData.Range); } if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (var s in DetectedSkillshots) { if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E) { var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafe(s.End)) { endPos = s.End; } break; } } foreach (var m in ObjectManager.Get<Obj_AI_Minion>()) { if (m.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team) { var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafe(m.Position.LSTo2D())) { endPos = m.Position.LSTo2D(); } break; } } if (endPos.IsValid()) { skillshot = new Skillshot(DetectionType.ProcessSpell, SpellDatabase.GetByName("JarvanIVEQ"), Utils.TickCount, skillshot.Start, endPos, skillshot.Unit); skillshot.End = endPos + 200 * (endPos - skillshot.Start).LSNormalized(); skillshot.Direction = (skillshot.End - skillshot.Start).LSNormalized(); } } } if (skillshot.SpellData.SpellName == "OriannasQ") { var skillshotToAdd = new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("OriannaQend"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } //Dont allow fow detection. if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket) { return; } #if DEBUG Console.WriteLine(Utils.TickCount + "Adding new skillshot: " + skillshot.SpellData.SpellName); #endif DetectedSkillshots.Add(skillshot); } }
private static void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { var unit = sender as AIHeroClient; if (unit == null || !unit.IsValid || unit.Team == Program.Player.Team) { return; } if (args.SData.Name == "dravenrdoublecast") { Evade.DetectedSkillshots.RemoveAll( i => i.Unit.NetworkId == unit.NetworkId && i.SpellData.SpellName == "DravenRCast"); } //Game.PrintChat("N: " + args.SData.Name); var spellData = SpellDatabase.GetByName(args.SData.Name); if (spellData == null) { return; } var startPos = new Vector2(); if (spellData.FromObject != "") { GameObjects.EnemyMinions.Where(i => i.CharData.BaseSkinName == spellData.FromObject) .ForEach(i => startPos = i.Position.ToVector2()); } else { startPos = unit.ServerPosition.ToVector2(); } if (spellData.FromObjects != null && spellData.FromObjects.Length > 0) { foreach (var obj in TrackObjects.Where(i => spellData.FromObjects.Contains(i.CharData.BaseSkinName))) { var start = obj.Position.ToVector2(); var end = start + spellData.Range * (args.End.ToVector2() - obj.Position.ToVector2()).LSNormalized(); TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Variables.TickCount - Game.Ping / 2, start, end, end, unit); } } if (!startPos.IsValid()) { return; } var endPos = args.End.ToVector2(); if (spellData.SpellName == "LucianQ" && args.Target != null && args.Target.NetworkId == Program.Player.NetworkId) { return; } var direction = (endPos - startPos).LSNormalized(); if (startPos.Distance(endPos) > spellData.Range || spellData.FixedRange) { endPos = startPos + direction * spellData.Range; } if (spellData.ExtraRange != -1) { endPos = endPos + Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(startPos)) * direction; } TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Variables.TickCount - Game.Ping / 2, startPos, endPos, args.End.ToVector2(), unit); }
public void UpdateTextureBitmap(Bitmap newBitmap, Vector2 position = new Vector2()) { if (position.IsValid()) { Position = position; } Bitmap = newBitmap; _texture = Texture.FromMemory( Drawing.Direct3DDevice, (byte[])new ImageConverter().ConvertTo(newBitmap, typeof(byte[])), Width, Height, 0, Usage.None, Format.A1, Pool.Managed, Filter.Default, Filter.Default, 0); }
private static void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { var caster = sender as Obj_AI_Hero; if (caster == null || !caster.IsValid || caster.IsAlly) { return; } if (args.SData.Name == "dravenrdoublecast") { Evade.DetectedSkillshots.RemoveAll( i => i.Unit.Compare(caster) && i.SpellData.SpellName == "DravenRCast"); } var spellData = SpellDatabase.GetByName(args.SData.Name); if (spellData == null) { return; } var startPos = new Vector2(); if (spellData.FromObject != "") { foreach (var obj in GameObjects.AllGameObjects.Where(i => i.Name.Contains(spellData.FromObject))) { startPos = obj.Position.ToVector2(); } } else { startPos = caster.ServerPosition.ToVector2(); } if (spellData.FromObjects != null && spellData.FromObjects.Length > 0) { foreach (var obj in GameObjects.AllGameObjects.Where(i => i.IsEnemy && spellData.FromObject.Contains(i.Name))) { var start = obj.Position.ToVector2(); var end = start + spellData.Range * (args.End - obj.Position).Normalized().ToVector2(); TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Variables.TickCount - Game.Ping / 2, start, end, caster); } } if (!startPos.IsValid()) { return; } var endPos = args.End.ToVector2(); if (spellData.SpellName == "LucianQ" && args.Target.Compare(ObjectManager.Player)) { return; } var direction = (endPos - startPos).Normalized(); if (startPos.Distance(endPos) > spellData.Range || spellData.FixedRange) { endPos = startPos + direction * spellData.Range; } if (spellData.ExtraRange != -1) { endPos += Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(startPos)) * direction; } TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Variables.TickCount - Game.Ping / 2, startPos, endPos, caster); }
/// <summary> /// Updates the texture bitmap. /// </summary> /// <param name="newBitmap">The new bitmap.</param> /// <param name="position">The position.</param> public void UpdateTextureBitmap(Bitmap newBitmap, Vector2 position = new Vector2()) { if (position.IsValid()) { this.Position = position; } this.Bitmap?.Dispose(); this.Bitmap = newBitmap; this.texture = Texture.FromMemory( Device, (byte[])new ImageConverter().ConvertTo(newBitmap, typeof(byte[])), this.Width, this.Height, 0, Usage.None, Format.A1, Pool.Managed, Filter.Default, Filter.Default, 0); if (this.originalTexture == null) { this.originalTexture = this.texture; } }
//credits Brian(L$) public static void LockR() { var target = TargetSelector.GetTarget(1800, DamageType.Physical); if (target == null) { return; } var endPos = (ObjectManager.Player.ServerPosition - target.ServerPosition).Normalized(); var predPos = R.GetPrediction(target).CastPosition.To2D(); var fullPoint = new Vector2(predPos.X + endPos.X*R.Range*0.98f, predPos.Y + endPos.Y*R.Range*0.98f); var closestPoint = ObjectManager.Player.ServerPosition.To2D() .Closest(new List<Vector2> {predPos, fullPoint}); if (closestPoint.IsValid() && !NavMesh.GetCollisionFlags(closestPoint).HasFlag(CollisionFlags.Wall) && !NavMesh.GetCollisionFlags(closestPoint).HasFlag(CollisionFlags.Building) && predPos.Distance(closestPoint) > E.Range) { Orbwalker.MoveTo(closestPoint.To3D()); } else if (fullPoint.IsValid() && !NavMesh.GetCollisionFlags(fullPoint).HasFlag(CollisionFlags.Wall) && !NavMesh.GetCollisionFlags(fullPoint).HasFlag(CollisionFlags.Building) && predPos.Distance(fullPoint) < R.Range && predPos.Distance(fullPoint) > 100) { Orbwalker.MoveTo(fullPoint.To3D()); } }
private static void OnDetectSkillshot(Skillshot skillshot) { if (skillshot.Unit.Team == Program.Player.Team) { return; } var alreadyAdded = DetectedSkillshots.Where( i => i.SpellData.SpellName == skillshot.SpellData.SpellName && i.Unit.Compare(skillshot.Unit)) .Any( i => i.Direction.AngleBetween(skillshot.Direction) < 5 && (i.Start.Distance(skillshot.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0)); if (skillshot.Start.Distance(PlayerPosition) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } if (alreadyAdded && !skillshot.SpellData.DontCheckForDuplicates) { return; } if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SpellData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2; i <= (skillshot.SpellData.MultipleNumber - 1) / 2; i++) { var end = skillshot.Start + skillshot.SpellData.Range * originalDirection.LSRotated(skillshot.SpellData.MultipleAngle * i); DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit)); } return; } if (skillshot.SpellData.SpellName == "UFSlash") { skillshot.SpellData.MissileSpeed = 1600 + (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.SpellName == "SionR") { skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.Invert) { var newDirection = -(skillshot.End - skillshot.Start).LSNormalized(); var end = skillshot.Start + newDirection * skillshot.Start.Distance(skillshot.End); DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit)); return; } if (skillshot.SpellData.Centered) { var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range; var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range; DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit)); return; } if (skillshot.SpellData.SpellName == "TaricE") { var source = skillshot.Unit as AIHeroClient; if (source != null && source.ChampionName == "Taric") { var target = GameObjects.Heroes.FirstOrDefault( h => h.Team == source.Team && h.HasBuff("taricwleashactive")); if (target != null) { var start = target.ServerPosition.ToVector2(); var direction = (skillshot.OriginalEnd - start).LSNormalized(); var end = start + direction * skillshot.SpellData.Range; DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, target) { OriginalEnd = skillshot.OriginalEnd }); } } } if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5") { const int Angle = 60; var edge1 = (skillshot.End - skillshot.Unit.ServerPosition.ToVector2()).LSRotated( -Angle / 2f * (float)Math.PI / 180); var edge2 = edge1.LSRotated(Angle * (float)Math.PI / 180); var positions = new List<Vector2>(); var explodingQ = DetectedSkillshots.FirstOrDefault(s => s.SpellData.SpellName == "SyndraQ"); if (explodingQ != null) { positions.Add(explodingQ.End); } positions.AddRange( GameObjects.EnemyMinions.Where(i => !i.IsDead && i.Name == "Seed") .Select(minion => minion.ServerPosition.ToVector2())); foreach (var pos in positions.Where(i => skillshot.Unit.Distance(i) < 800)) { var v = pos - skillshot.Unit.ServerPosition.ToVector2(); if (edge1.CrossProduct(v) > 0 && v.CrossProduct(edge2) > 0) { var start = pos; var end = skillshot.Unit.ServerPosition.ToVector2() .Extend(pos, skillshot.Unit.Distance(pos) > 200 ? 1300 : 1000); DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick + (int)(150 + skillshot.Unit.Distance(pos) / 2.5), start, end, skillshot.Unit)); } } return; } if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid") { var start = skillshot.End - skillshot.Direction.Perpendicular() * 400; var end = skillshot.End + skillshot.Direction.Perpendicular() * 400; DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit)); return; } if (skillshot.SpellData.SpellName == "DianaArc") { DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("DianaArcArc"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit)); } if (skillshot.SpellData.SpellName == "ZiggsQ") { var d1 = skillshot.Start.Distance(skillshot.End); var d2 = d1 * 0.4f; var d3 = d2 * 0.69f; var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2"); var bounce1Pos = skillshot.End + skillshot.Direction * d2; var bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int)(skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500); bounce2SpellData.Delay = (int)(bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos, skillshot.Unit)); DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Unit)); } if (skillshot.SpellData.SpellName == "ZiggsR") { skillshot.SpellData.Delay = (int)(1500 + 1500 * skillshot.End.Distance(skillshot.Start) / skillshot.SpellData.Range); } if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (var s in DetectedSkillshots.Where(i => i.SpellData.Slot == SpellSlot.E)) { if (!s.Unit.Compare(skillshot.Unit)) { continue; } var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafe(s.End)) { endPos = s.End; } break; } foreach (var m in ObjectManager.Get<Obj_AI_Minion>().Where(i => i.CharData.BaseSkinName == "jarvanivstandard")) { if (m.Team != skillshot.Unit.Team) { continue; } var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafe(m.Position.ToVector2())) { endPos = m.Position.ToVector2(); } break; } if (endPos.IsValid()) { skillshot = new Skillshot( DetectionType.ProcessSpell, SpellDatabase.GetByName("JarvanIVEQ"), Variables.TickCount, skillshot.Start, endPos, skillshot.Unit); skillshot.End = endPos + 200 * (endPos - skillshot.Start).LSNormalized(); skillshot.Direction = (skillshot.End - skillshot.Start).LSNormalized(); } } } if (skillshot.SpellData.SpellName == "OriannasQ") { DetectedSkillshots.Add( new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("OriannaQend"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit, skillshot.DetectionType == DetectionType.RecvPacket && skillshot.Missile != null ? skillshot.Missile : null)); } if (skillshot.SpellData.DisableFowDetection && skillshot.DetectionType == DetectionType.RecvPacket) { return; } DetectedSkillshots.Add(skillshot); }
private static void OnDetectSkillshot(Skillshot skillshot) { //Check if the skillshot is already added. var alreadyAdded = false; if (!Helper.GetBool("Evade.FOW", YasuoMenu.EvadeM) && !skillshot.Unit.IsVisible) { return; } foreach (var item in DetectedSkillshots) { if (item.SpellData.SpellName == skillshot.SpellData.SpellName && (item.Unit.NetworkId == skillshot.Unit.NetworkId && (skillshot.Direction).LSAngleBetween(item.Direction) < 5 && (skillshot.Start.LSDistance(item.Start) < 100 || skillshot.SpellData.FromObjects.Length == 0))) { alreadyAdded = true; } } //Check if the skillshot is from an ally. if (skillshot.Unit.Team == ObjectManager.Player.Team && !Config.TestOnAllies) { return; } //Check if the skillshot is too far away. if (skillshot.Start.LSDistance(PlayerPosition) > (skillshot.SpellData.Range + skillshot.SpellData.Radius + 1000) * 1.5) { return; } //Add the skillshot to the detected skillshot list. if (!alreadyAdded || skillshot.SpellData.DontCheckForDuplicates) { //Multiple skillshots like twisted fate Q. if (skillshot.DetectionType == DetectionType.ProcessSpell) { if (skillshot.SpellData.MultipleNumber != -1) { var originalDirection = skillshot.Direction; for (var i = -(skillshot.SpellData.MultipleNumber - 1) / 2; i <= (skillshot.SpellData.MultipleNumber - 1) / 2; i++) { var end = skillshot.Start + skillshot.SpellData.Range * originalDirection.LSRotated(skillshot.SpellData.MultipleAngle * i); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } return; } if (skillshot.SpellData.SpellName == "UFSlash") { skillshot.SpellData.MissileSpeed = 1600 + (int) skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.SpellName == "SionR") { skillshot.SpellData.MissileSpeed = (int)skillshot.Unit.MoveSpeed; } if (skillshot.SpellData.Invert) { var newDirection = -(skillshot.End - skillshot.Start).LSNormalized(); var end = skillshot.Start + newDirection * skillshot.Start.LSDistance(skillshot.End); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.Centered) { var start = skillshot.Start - skillshot.Direction * skillshot.SpellData.Range; var end = skillshot.Start + skillshot.Direction * skillshot.SpellData.Range; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "SyndraE" || skillshot.SpellData.SpellName == "syndrae5") { var angle = 60; var edge1 = (skillshot.End - skillshot.Unit.ServerPosition.LSTo2D()).LSRotated( -angle / 2 * (float) Math.PI / 180); var edge2 = edge1.LSRotated(angle * (float) Math.PI / 180); foreach (var minion in ObjectManager.Get<Obj_AI_Minion>()) { var v = minion.ServerPosition.LSTo2D() - skillshot.Unit.ServerPosition.LSTo2D(); if (minion.Name == "Seed" && edge1.LSCrossProduct(v) > 0 && v.LSCrossProduct(edge2) > 0 && minion.LSDistance(skillshot.Unit) < 800 && (minion.Team != ObjectManager.Player.Team || Config.TestOnAllies)) { var start = minion.ServerPosition.LSTo2D(); var end = skillshot.Unit.ServerPosition.LSTo2D() .LSExtend( minion.ServerPosition.LSTo2D(), skillshot.Unit.LSDistance(minion) > 200 ? 1300 : 1000); var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } } return; } if (skillshot.SpellData.SpellName == "AlZaharCalloftheVoid") { var start = skillshot.End - skillshot.Direction.LSPerpendicular() * 400; var end = skillshot.End + skillshot.Direction.LSPerpendicular() * 400; var skillshotToAdd = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, start, end, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); return; } if (skillshot.SpellData.SpellName == "DianaArc") { var skillshotToAdd = new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("DianaArcArc"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } if (skillshot.SpellData.SpellName == "ZiggsQ") { var d1 = skillshot.Start.LSDistance(skillshot.End); var d2 = d1 * 0.4f; var d3 = d2 * 0.69f; var bounce1SpellData = SpellDatabase.GetByName("ZiggsQBounce1"); var bounce2SpellData = SpellDatabase.GetByName("ZiggsQBounce2"); var bounce1Pos = skillshot.End + skillshot.Direction * d2; var bounce2Pos = bounce1Pos + skillshot.Direction * d3; bounce1SpellData.Delay = (int) (skillshot.SpellData.Delay + d1 * 1000f / skillshot.SpellData.MissileSpeed + 500); bounce2SpellData.Delay = (int) (bounce1SpellData.Delay + d2 * 1000f / bounce1SpellData.MissileSpeed + 500); var bounce1 = new Skillshot( skillshot.DetectionType, bounce1SpellData, skillshot.StartTick, skillshot.End, bounce1Pos, skillshot.Unit); var bounce2 = new Skillshot( skillshot.DetectionType, bounce2SpellData, skillshot.StartTick, bounce1Pos, bounce2Pos, skillshot.Unit); DetectedSkillshots.Add(bounce1); DetectedSkillshots.Add(bounce2); } if (skillshot.SpellData.SpellName == "ZiggsR") { skillshot.SpellData.Delay = (int) (1500 + 1500 * skillshot.End.LSDistance(skillshot.Start) / skillshot.SpellData.Range); } if (skillshot.SpellData.SpellName == "JarvanIVDragonStrike") { var endPos = new Vector2(); foreach (var s in DetectedSkillshots) { if (s.Unit.NetworkId == skillshot.Unit.NetworkId && s.SpellData.Slot == SpellSlot.E) { var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafe(s.End)) { endPos = s.End; } break; } } foreach (var m in ObjectManager.Get<Obj_AI_Minion>()) { if (m.BaseSkinName == "jarvanivstandard" && m.Team == skillshot.Unit.Team) { var extendedE = new Skillshot( skillshot.DetectionType, skillshot.SpellData, skillshot.StartTick, skillshot.Start, skillshot.End + skillshot.Direction * 100, skillshot.Unit); if (!extendedE.IsSafe(m.Position.LSTo2D())) { endPos = m.Position.LSTo2D(); } break; } } if (endPos.IsValid()) { skillshot = new Skillshot(DetectionType.ProcessSpell, SpellDatabase.GetByName("JarvanIVEQ"), Utils.TickCount, skillshot.Start, endPos, skillshot.Unit); skillshot.End = endPos + 200 * (endPos - skillshot.Start).LSNormalized(); skillshot.Direction = (skillshot.End - skillshot.Start).LSNormalized(); } } } if (skillshot.SpellData.SpellName == "OriannasQ") { var skillshotToAdd = new Skillshot( skillshot.DetectionType, SpellDatabase.GetByName("OriannaQend"), skillshot.StartTick, skillshot.Start, skillshot.End, skillshot.Unit); DetectedSkillshots.Add(skillshotToAdd); } //Dont allow fow detection. if (!Helper.GetBool("Evade.FOW", YasuoMenu.EvadeM) && skillshot.DetectionType == DetectionType.RecvPacket) { return; } #if DEBUG //Console.WriteLine(Utils.TickCount + "Adding new skillshot: " + skillshot.SpellData.SpellName); #endif DetectedSkillshots.Add(skillshot); } }
public static void LucianRLock() { var currentTarget = Variables.spells[SpellSlot.R].GetTarget(); if (currentTarget.IsValidTarget()) { var predictedPosition = Variables.spells[SpellSlot.R].GetPrediction(currentTarget).UnitPosition; var directionVector = (currentTarget.ServerPosition - ObjectManager.Player.ServerPosition).Normalized(); var RRangeCoefficient = 0.95f; var RRangeAdjusted = Variables.spells[SpellSlot.R].Range * RRangeCoefficient; var REndPointXCoordinate = predictedPosition.X + directionVector.X * RRangeAdjusted; var REndPointYCoordinate = predictedPosition.Y + directionVector.Y * RRangeAdjusted; var REndPoint = new Vector2(REndPointXCoordinate, REndPointYCoordinate).To3D(); if (REndPoint.IsValid() && REndPoint.Distance(ObjectManager.Player.ServerPosition) < Variables.spells[SpellSlot.R].Range && !REndPoint.IsWall()) { Variables.Orbwalker.SetOrbwalkingPoint(REndPoint); } } }
private static void OnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (!sender.IsValid<Obj_AI_Hero>() || sender.Team == ObjectManager.Player.Team) { return; } if (args.SData.Name == "dravenrdoublecast") { DetectedSkillshots.RemoveAll( i => i.Unit.NetworkId == sender.NetworkId && i.SpellData.SpellName == "DravenRCast"); } var spellData = SpellDatabase.GetByName(args.SData.Name); if (spellData == null) { return; } var startPos = new Vector2(); if (spellData.FromObject != "") { foreach (var obj in ObjectManager.Get<GameObject>().Where(i => i.Name.Contains(spellData.FromObject))) { startPos = obj.Position.To2D(); } } else { startPos = sender.ServerPosition.To2D(); } if (spellData.FromObjects != null && spellData.FromObjects.Length > 0) { foreach (var obj in ObjectManager.Get<GameObject>().Where(i => i.IsEnemy && spellData.FromObject.Contains(i.Name))) { var start = obj.Position.To2D(); var end = start + spellData.Range * (args.End.To2D() - obj.Position.To2D()).Normalized(); TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Utils.GameTimeTickCount - Game.Ping / 2, start, end, sender); } } if (!startPos.IsValid()) { return; } var endPos = args.End.To2D(); if (spellData.SpellName == "LucianQ" && args.Target != null && args.Target.NetworkId == ObjectManager.Player.NetworkId) { return; } var direction = (endPos - startPos).Normalized(); if (startPos.Distance(endPos) > spellData.Range || spellData.FixedRange) { endPos = startPos + direction * spellData.Range; } if (spellData.ExtraRange != -1) { endPos = endPos + Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(startPos)) * direction; } TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Utils.GameTimeTickCount - Game.Ping / 2, startPos, endPos, sender); }
/// <summary> /// Updates the texture bitmap. /// </summary> /// <param name="newBitmap">The new bitmap.</param> /// <param name="position">The position.</param> public void UpdateTextureBitmap(Bitmap newBitmap, Vector2 position = new Vector2()) { if (position.IsValid()) { Position = position; } if (Bitmap != null) { Bitmap.Dispose(); } Bitmap = newBitmap; _texture = Texture.FromMemory( Device, (byte[]) new ImageConverter().ConvertTo(newBitmap, typeof(byte[])), Width, Height, 0, Usage.None, Format.A1, Pool.Managed, Filter.Default, Filter.Default, 0); if (_originalTexture == null) { _originalTexture = _texture; } }
/// <summary> /// Gets triggered when a unit casts a spell and the unit is visible. /// </summary> private static void ObjAiHeroOnOnProcessSpellCast(Obj_AI_Base sender, GameObjectProcessSpellCastEventArgs args) { if (sender == null || !sender.IsValid) { return; } if (Config.PrintSpellData && sender is Obj_AI_Hero) { Game.PrintChat(Utils.TickCount + " ProcessSpellCast: " + args.SData.Name); Console.WriteLine(Utils.TickCount + " ProcessSpellCast: " + args.SData.Name); } if (args.SData.Name == "dravenrdoublecast") { Program.DetectedSkillshots.RemoveAll( s => s.Unit.NetworkId == sender.NetworkId && s.SpellData.SpellName == "DravenRCast"); } if (!sender.IsValid || sender.Team == ObjectManager.Player.Team && !Config.TestOnAllies) { return; } //Get the skillshot data. var spellData = SpellDatabase.GetByName(args.SData.Name); //Skillshot not added in the database. if (spellData == null) { return; } var startPos = new Vector2(); if (spellData.FromObject != "") { foreach (var o in ObjectManager.Get<GameObject>()) { if (o.Name.Contains(spellData.FromObject)) { startPos = o.Position.To2D(); } } } else { startPos = sender.ServerPosition.To2D(); } //For now only zed support. if (spellData.FromObjects != null && spellData.FromObjects.Length > 0) { foreach (var obj in ObjectManager.Get<GameObject>()) { if (obj.IsEnemy && spellData.FromObjects.Contains(obj.Name)) { var start = obj.Position.To2D(); var end = start + spellData.Range * (args.End.To2D() - obj.Position.To2D()).Normalized(); TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Utils.TickCount - Game.Ping / 2, start, end, sender); } } } if (!startPos.IsValid()) { return; } var endPos = args.End.To2D(); if (spellData.SpellName == "LucianQ" && args.Target != null && args.Target.NetworkId == ObjectManager.Player.NetworkId) { return; } //Calculate the real end Point: var direction = (endPos - startPos).Normalized(); if (startPos.Distance(endPos) > spellData.Range || spellData.FixedRange) { endPos = startPos + direction * spellData.Range; } if (spellData.ExtraRange != -1) { endPos = endPos + Math.Min(spellData.ExtraRange, spellData.Range - endPos.Distance(startPos)) * direction; } //Trigger the skillshot detection callbacks. TriggerOnDetectSkillshot( DetectionType.ProcessSpell, spellData, Utils.TickCount - Game.Ping / 2, startPos, endPos, sender); }
private static void Game_OnOnGameUpdate(EventArgs args) { //Set evading to false after blinking if (PreviousTickPosition.IsValid() && ObjectManager.Player.ServerPosition.To2D().Distance(PreviousTickPosition) > 200) { Evading = false; } PreviousTickPosition = ObjectManager.Player.ServerPosition.To2D(); //Remove the detected skillshots that have expired. DetectedSkillshots.RemoveAll(skillshot => !skillshot.IsActive()); //Trigger OnGameUpdate on each skillshot. foreach (var skillshot in DetectedSkillshots) { skillshot.Game_OnGameUpdate(); } //Evading disabled if (!Config.Menu.Item("Enabled").GetValue<KeyBind>().Active) { return; } //Avoid sending move/cast packets while dead. if (ObjectManager.Player.IsDead) { return; } //Avoid sending move/cast packets while channeling interruptable spells that cause hero not being able to move. if (ObjectManager.Player.IsCastingInterruptableSpell(true)) { return; } /*Avoid evading while stunned or immobile.*/ if (Utils.ImmobileTime(ObjectManager.Player) - Utils.TickCount > Game.Ping / 2 + 70) { Evading = false; return; } //Shield allies. foreach (var ally in ObjectManager.Get<Obj_AI_Hero>()) { if (ally.IsValidTarget(1000, false)) { var shieldAlly = Config.Menu.Item("shield" + ally.ChampionName); if (shieldAlly != null && shieldAlly.GetValue<bool>()) { var allySafeResult = IsSafe(ally.ServerPosition.To2D()); if (!allySafeResult.IsSafe) { var dangerLevel = 0; foreach (var skillshot in allySafeResult.SkillshotList) { dangerLevel = Math.Max(dangerLevel, skillshot.GetValue<Slider>("DangerLevel").Value); } foreach (var evadeSpell in EvadeSpellDatabase.Spells) { if (evadeSpell.IsShield && evadeSpell.CanShieldAllies && ally.Distance(ObjectManager.Player) < evadeSpell.MaxRange && dangerLevel >= evadeSpell.DangerLevel && ObjectManager.Player.Spellbook.CanUseSpell(evadeSpell.Slot) == SpellState.Ready && IsAboutToHit(ally, evadeSpell.Delay)) { ObjectManager.Player.Spellbook.CastSpell(evadeSpell.Slot, ally); } } } } } } //Spell Shielded if (IsSpellShielded(ObjectManager.Player)) { return; } //Don't evade while casting R as sion if (ObjectManager.Player.ChampionName == "Sion" && ObjectManager.Player.HasBuff("SionR")) { return; } /**/ if (EvadeToPoint.IsValid() && DetectedSkillshots.Count > 0) { if (Utils.TickCount - LastSentMovePacketT2 > 1000 / 10) { ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, EvadeToPoint.To3D()); LastSentMovePacketT2 = Utils.TickCount; } } NoSolutionFound = false; var currentPath = ObjectManager.Player.GetWaypoints(); var safeResult = IsSafe(ObjectManager.Player.ServerPosition.To2D()); var safePath = IsSafePath(currentPath, 100); //Continue evading if (Evading && IsSafe(EvadePoint).IsSafe) { if (safeResult.IsSafe) { //We are safe, stop evading. Evading = false; } else { if (Utils.TickCount - LastSentMovePacketT > 1000/15) { LastSentMovePacketT = Utils.TickCount; ObjectManager.Player.SendMovePacket(EvadePoint); } return; } } //Stop evading if the point is not safe. else if (Evading) { Evading = false; } //The path is not safe. if (!safePath.IsSafe) { //Inside the danger polygon. if (!safeResult.IsSafe) { //Search for an evade point: TryToEvade(safeResult.SkillshotList, EvadeToPoint.IsValid() ? EvadeToPoint : Game.CursorPos.To2D()); } //Outside the danger polygon. else { //Stop at the edge of the skillshot. ObjectManager.Player.SendMovePacket(safePath.Intersection.Point); } } } private static bool IsSpellShielded(Obj_AI_Hero unit) { if (ObjectManager.Player.HasBuffOfType(BuffType.SpellShield)) { return true; } if (ObjectManager.Player.HasBuffOfType(BuffType.SpellImmunity)) { return true; } //Sivir E if (unit.LastCastedSpellName() == "SivirE" && (Utils.TickCount - unit.LastCastedSpellT()) < 300) { return true; } //Morganas E if (unit.LastCastedSpellName() == "BlackShield" && (Utils.TickCount - unit.LastCastedSpellT()) < 300) { return true; } //Nocturnes E if (unit.LastCastedSpellName() == "NocturneShit" && (Utils.TickCount - unit.LastCastedSpellT()) < 300) { return true; } return false; } private static void Main(string[] args) { if (Game.Mode == GameMode.Running) { Game_OnGameStart(new EventArgs()); } Game.OnStart += Game_OnGameStart; } /// <summary> /// Used to block the movement to avoid entering in dangerous areas. /// </summary> /// private static void ObjAiHeroOnOnIssueOrder(Obj_AI_Base sender, GameObjectIssueOrderEventArgs args) { if (!sender.IsMe) { return; } //Don't block the movement packets if cant find an evade point. if (NoSolutionFound) { return; } //Evading disabled if (!Config.Menu.Item("Enabled").GetValue<KeyBind>().Active) { return; } if (EvadeSpellDatabase.Spells.Any(evadeSpell => evadeSpell.Name == "Walking" && !evadeSpell.Enabled)) { return; } //Spell Shielded if (IsSpellShielded(ObjectManager.Player)) { return; } if (args.Order == GameObjectOrder.MoveTo) { EvadeToPoint.X = args.TargetPosition.X; EvadeToPoint.Y = args.TargetPosition.Y; } else { EvadeToPoint.X = 0; EvadeToPoint.Y = 0; } var myPath = ObjectManager.Player.GetPath( new Vector3(args.TargetPosition.X, args.TargetPosition.Y, ObjectManager.Player.ServerPosition.Z)).To2DList(); var safeResult = IsSafe(ObjectManager.Player.ServerPosition.To2D()); //If we are evading: if (Evading || !safeResult.IsSafe) { var rcSafePath = IsSafePath(myPath, Config.EvadingRouteChangeTimeOffset); if (args.Order == GameObjectOrder.MoveTo) { if (Evading && Utils.TickCount - Config.LastEvadePointChangeT > Config.EvadePointChangeInterval) { //Update the evade point to the closest one: var points = Evader.GetEvadePoints(-1, 0, false, true); if (points.Count > 0) { var to = new Vector2(args.TargetPosition.X, args.TargetPosition.Y); EvadePoint = to.Closest(points); Evading = true; Config.LastEvadePointChangeT = Utils.TickCount; } } //If the path is safe let the user follow it. if (rcSafePath.IsSafe && IsSafe(myPath[myPath.Count - 1]).IsSafe && args.Order == GameObjectOrder.MoveTo) { EvadePoint = myPath[myPath.Count - 1]; Evading = true; } } //Block the packets if we are evading or not safe. args.Process = false; return; } var safePath = IsSafePath(myPath, Config.CrossingTimeOffset); //Not evading, outside the skillshots. //The path is not safe, stop in the intersection point. if (!safePath.IsSafe && args.Order != GameObjectOrder.AttackUnit) { if (safePath.Intersection.Valid) { if (ObjectManager.Player.Distance(safePath.Intersection.Point) > 75) { ObjectManager.Player.SendMovePacket(safePath.Intersection.Point); } else { if (/*DetectedSkillshots.Count == 1 &&*/ Utils.TickCount - LastSMovePacketT > 400) { LastSMovePacketT = Utils.TickCount; var perpendicular = (ObjectManager.Player.ServerPosition.To2D() - safePath.Intersection.Point) .Normalized(); var direction = perpendicular.Perpendicular(); var p = ObjectManager.Player.ServerPosition.To2D() + 1 * perpendicular + 150 * direction; var p2 = ObjectManager.Player.ServerPosition.To2D() + 1 * perpendicular - 150 * direction; if (!IsSafePath(ObjectManager.Player.GetPath(p.To3D()).To2DList(), 100).IsSafe) { p = new Vector2(); } if (!IsSafePath(ObjectManager.Player.GetPath(p2.To3D()).To2DList(), 100).IsSafe) { p2 = new Vector2(); } EvadeToPoint2 = (p.IsValid() && (p.Distance(EvadeToPoint) < p2.Distance(EvadeToPoint))) ? p : p2; if (EvadeToPoint2.IsValid()) { ObjectManager.Player.SendMovePacket(EvadeToPoint2); } } }