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));
            }
        }
Exemplo n.º 2
0
        public static bool Check(string mode,
                                 int min,
                                 List <Obj_AI_Hero> hits,
                                 Func <Obj_AI_Hero, float> calcDamage = null)
        {
            try
            {
                if (_menu == null || hits == null || !hits.Any())
                {
                    return(false);
                }

                if (_force && HeroListManager.Enabled("ultimate-force"))
                {
                    var killable   = _menu.Item(_menu.Name + ".ultimate.force.combo-killable").GetValue <bool>();
                    var additional = _menu.Item(_menu.Name + ".ultimate.force.additional").GetValue <Slider>().Value;
                    if (
                        hits.Any(
                            hit =>
                            HeroListManager.Check("ultimate-force", hit) &&
                            (!killable || calcDamage == null || calcDamage(hit) > hit.Health)) &&
                        hits.Count >= additional + 1)
                    {
                        return(true);
                    }
                }

                if (_required && HeroListManager.Enabled("ultimate-required-" + mode))
                {
                    var minReq        = _menu.Item(_menu.Name + ".ultimate.required." + mode + ".min").GetValue <Slider>().Value;
                    var range         = _menu.Item(_menu.Name + ".ultimate.required.range-check").GetValue <Slider>().Value;
                    var enabledHeroes = HeroListManager.GetEnabledHeroes("ultimate-required-" + mode);
                    var count         =
                        enabledHeroes.Where(e => !e.IsDead && e.IsVisible && e.Distance(ObjectManager.Player) <= range)
                        .Count(e => hits.Any(h => h.NetworkId.Equals(e.NetworkId)));
                    if (count < minReq)
                    {
                        return(false);
                    }
                }

                return(hits.Count >= min);
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(false);
        }
Exemplo n.º 3
0
        private static void OnCorePreUpdate(EventArgs args)
        {
            if (ObjectManager.Player.IsDead)
            {
                return;
            }
            foreach (var entry in Menues)
            {
                var uniqueId  = entry.Key;
                var menu      = entry.Value.Item1;
                var buffTypes = entry.Value.Item2;

                var delay     = menu.Item(menu.Name + ".buff-" + uniqueId + ".delay").GetValue <Slider>().Value;
                var randomize = entry.Value.Item3
                    ? menu.Item(menu.Name + ".buff-" + uniqueId + ".randomize").GetValue <Slider>().Value
                    : 0;

                foreach (var enemy in
                         GameObjects.EnemyHeroes.Where(e => HeroListManager.Check(uniqueId, e) && e.IsValidTarget(2000)))
                {
                    var buff =
                        enemy.Buffs.OrderBy(b => b.EndTime)
                        .FirstOrDefault(b => b.IsValid && b.IsActive && buffTypes.Any(bt => b.Type.Equals(bt)));
                    if (buff != null)
                    {
                        var position = enemy.ServerPosition;
                        var lEnemy   = enemy;
                        if (delay > 1)
                        {
                            delay = Random.Next((int)(delay * 0.9f), (int)(delay * 1.1f));
                        }
                        if (randomize > 0)
                        {
                            position.X += Random.Next(0, randomize * 2 + 1) - randomize;
                            position.Y += Random.Next(0, randomize * 2 + 1) - randomize;
                        }
                        Utility.DelayAction.Add(
                            Math.Max(1, delay),
                            () => OnBuff.RaiseEvent(null, new BuffManagerArgs(uniqueId, lEnemy, position, buff.EndTime)));
                    }
                }
            }
        }
Exemplo n.º 4
0
 public bool IsActive(UltimateModeType mode, Obj_AI_Hero hero = null)
 {
     if (_menu != null)
     {
         if (mode == UltimateModeType.Combo)
         {
             return(Combo && _menu.Item(_menu.Name + ".ultimate.combo.enabled").GetValue <bool>());
         }
         if (mode == UltimateModeType.Auto)
         {
             return(Auto && _menu.Item(_menu.Name + ".ultimate.auto.enabled").GetValue <bool>());
         }
         if (mode == UltimateModeType.Flash)
         {
             return(Flash && Assisted && _menu.Item(_menu.Name + ".ultimate.assisted.enabled").GetValue <bool>() &&
                    _menu.Item(_menu.Name + ".ultimate.flash.hotkey").GetValue <KeyBind>().Active);
         }
         if (mode == UltimateModeType.Assisted)
         {
             return(Assisted && _menu.Item(_menu.Name + ".ultimate.assisted.enabled").GetValue <bool>() &&
                    _menu.Item(_menu.Name + ".ultimate.assisted.hotkey").GetValue <KeyBind>().Active);
         }
         if (mode == UltimateModeType.Interrupt)
         {
             return(Auto && Interrupt && hero != null &&
                    _menu.Item(_menu.Name + ".ultimate.auto.enabled").GetValue <bool>() &&
                    HeroListManager.Check("ultimate-interrupt", hero));
         }
         if (mode == UltimateModeType.Gapcloser)
         {
             return(Auto && Gapcloser && hero != null &&
                    _menu.Item(_menu.Name + ".ultimate.auto.enabled").GetValue <bool>() &&
                    HeroListManager.Check("ultimate-gapcloser", hero));
         }
     }
     return(false);
 }
Exemplo n.º 5
0
 public bool Check(UltimateModeType mode, List <Obj_AI_Hero> hits)
 {
     try
     {
         var modeString = GetModeString(mode, true);
         if (_menu == null || hits == null || !hits.Any(h => h.IsValidTarget()))
         {
             return(false);
         }
         if (IsActive(mode))
         {
             if (mode != UltimateModeType.Gapcloser && mode != UltimateModeType.Interrupt)
             {
                 if (Force && HeroListManager.Enabled("ultimate-force"))
                 {
                     var dmgCheck = DamageCalculation != null &&
                                    _menu.Item(_menu.Name + ".ultimate.force.damage-check").GetValue <bool>();
                     var additional =
                         _menu.Item(_menu.Name + ".ultimate.force.additional").GetValue <Slider>().Value + 1;
                     if (
                         hits.Any(
                             hit =>
                             HeroListManager.Check("ultimate-force", hit) && hits.Count >= additional &&
                             (!dmgCheck || GetDamage(hit, mode, additional) >= hit.Health)))
                     {
                         return(true);
                     }
                 }
                 if (Required && HeroListManager.Enabled("ultimate-required-" + modeString))
                 {
                     var minReq =
                         _menu.Item(_menu.Name + ".ultimate.required." + modeString + ".min")
                         .GetValue <Slider>()
                         .Value;
                     var enabledHeroes = HeroListManager.GetEnabledHeroes("ultimate-required-" + modeString);
                     if (minReq > 0 && enabledHeroes.Count > 0)
                     {
                         var count =
                             enabledHeroes.Where(
                                 e => !e.IsDead && e.IsVisible && e.Distance(ObjectManager.Player) <= 2000)
                             .Count(e => hits.Any(h => h.NetworkId.Equals(e.NetworkId)));
                         if (count < minReq)
                         {
                             return(false);
                         }
                     }
                 }
                 if (DamageCalculation != null &&
                     _menu.Item(_menu.Name + ".ultimate." + modeString + ".damage-check").GetValue <bool>())
                 {
                     if (hits.All(h => GetDamage(h, mode, hits.Count) < h.Health))
                     {
                         return(false);
                     }
                 }
                 return(hits.Count >= GetMinHits(mode));
             }
             return(true);
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
     return(false);
 }
Exemplo n.º 6
0
 public static bool Gapcloser(Obj_AI_Hero hero)
 {
     return(_menu != null && _gapcloser && _menu.Item(_menu.Name + ".ultimate.auto.enabled").GetValue <bool>() &&
            HeroListManager.Check("ultimate-gapcloser", hero));
 }
Exemplo n.º 7
0
 public static bool Interrupt(Obj_AI_Hero hero)
 {
     return(_menu != null && _interrupt && _menu.Item(_menu.Name + ".ultimate.auto.enabled").GetValue <bool>() &&
            HeroListManager.Check("ultimate-interrupt", hero));
 }
        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(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;
                                }
                            }
                            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));
            }
        }