private static void Check(bool dash, Obj_AI_Hero sender, Vector3 startPosition, Vector3 endPosition, float endTime, bool targeted) { try { if (!sender.IsValid || !sender.IsEnemy || sender.IsDead) { return; } if (Game.Time - endTime >= 5) { return; } if (endPosition.Distance(ObjectManager.Player.ServerPosition) >= 2000) { return; } foreach (var entry in Menues) { var uniqueId = entry.Key; var menu = entry.Value; if (HeroListManager.Check(entry.Key, sender)) { var distance = menu.Item(menu.Name + ".gap-" + uniqueId + ".distance").GetValue <Slider>().Value; var dangerous = menu.Item(menu.Name + ".gap-" + uniqueId + ".dangerous").GetValue <bool>(); if (startPosition.Distance(ObjectManager.Player.Position) >= distance && (!dangerous || IsDangerous(sender, startPosition, endPosition, targeted))) { var delay = menu.Item(menu.Name + ".gap-" + uniqueId + ".delay").GetValue <Slider>().Value; Utility.DelayAction.Add( Math.Max(1, dash ? delay - 100 : delay), delegate { OnGapcloser.RaiseEvent( null, new GapcloserManagerArgs( uniqueId, sender, startPosition, endPosition, endTime - (delay / 1000f))); }); } } } OnGapcloser.RaiseEvent( null, new GapcloserManagerArgs(string.Empty, sender, startPosition, endPosition, endTime)); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
private static void Check(bool dash, AIHeroClient sender, Vector3 startPosition, Vector3 endPosition, float endTime, bool targeted) { try { if (!sender.IsValid || !sender.IsEnemy || sender.IsDead) { return; } if (Game.Time - endTime >= 5) { return; } if (endPosition.Distance(ObjectManager.Player.ServerPosition) >= 2000) { return; } foreach (var entry in Menues) { var uniqueId = entry.Key; var menu = entry.Value; if (HeroListManager.Check(uniqueId, sender)) { var distance = menu.Item(menu.Name + ".gap-" + uniqueId + ".distance").GetValue <Slider>().Value; var dangerous = menu.Item(menu.Name + ".gap-" + uniqueId + ".dangerous").GetValue <bool>(); if (startPosition.Distance(ObjectManager.Player.Position) >= distance && (!dangerous || IsDangerous(sender, startPosition, endPosition, targeted))) { var delay = menu.Item(menu.Name + ".gap-" + uniqueId + ".delay").GetValue <Slider>().Value; var randomize = menu.Item(menu.Name + ".gap-" + uniqueId + ".randomize").GetValue <Slider>().Value; if (delay > 1) { delay = Random.Next((int)(delay * 0.9f), (int)(delay * 1.1f)); } if (randomize > 0) { if (!startPosition.Equals(Vector3.Zero)) { startPosition.X += Random.Next(0, randomize * 2 + 1) - randomize; startPosition.Y += Random.Next(0, randomize * 2 + 1) - randomize; } if (!endPosition.Equals(Vector3.Zero)) { endPosition.X += Random.Next(0, randomize * 2 + 1) - randomize; endPosition.Y += Random.Next(0, randomize * 2 + 1) - randomize; } } LeagueSharp.Common.Utility.DelayAction.Add( Math.Max(1, dash ? delay - 100 : delay), () => OnGapcloser.RaiseEvent( null, new GapcloserManagerArgs(uniqueId, sender, startPosition, endPosition, endTime))); } } } OnGapcloser.RaiseEvent( null, new GapcloserManagerArgs(string.Empty, sender, startPosition, endPosition, endTime)); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }