public static void AddToMenu(Menu menu, List <BuffType> buffTypes, HeroListManagerArgs args, bool randomize)
        {
            try
            {
                if (Menues.ContainsKey(args.UniqueId))
                {
                    throw new ArgumentException(
                              string.Format("BuffManager: UniqueID \"{0}\" already exist.", args.UniqueId));
                }

                args.Enemies = true;
                args.Allies  = false;

                menu.AddItem(
                    new MenuItem(menu.Name + ".buff-" + args.UniqueId + ".delay", "Delay").SetValue(
                        new Slider(100, 0, 500)));
                if (randomize)
                {
                    menu.AddItem(
                        new MenuItem(menu.Name + ".buff-" + args.UniqueId + ".randomize", "Randomize Position").SetValue
                            (new Slider(10)));
                }

                menu.AddItem(new MenuItem(menu.Name + ".buff-" + args.UniqueId + ".separator", string.Empty));

                HeroListManager.AddToMenu(menu, args);

                Menues[args.UniqueId] = new Tuple <Menu, List <BuffType>, bool>(menu, buffTypes, randomize);
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Пример #2
0
        public static void AddToMenu(Menu menu, HeroListManagerArgs args, bool dangerous = false)
        {
            try
            {
                if (Menues.ContainsKey(args.UniqueId))
                {
                    throw new ArgumentException(
                              string.Format("GapcloserManager: UniqueID \"{0}\" already exist.", args.UniqueId));
                }

                args.Enemies = true;
                args.Allies  = false;

                menu.AddItem(
                    new MenuItem(menu.Name + ".gap-" + args.UniqueId + ".delay", "Delay").SetValue(
                        new Slider(100, 0, 500)));
                menu.AddItem(
                    new MenuItem(menu.Name + ".gap-" + args.UniqueId + ".distance", "Min. Distance").SetValue(
                        new Slider(150, 0, 500)));
                menu.AddItem(
                    new MenuItem(menu.Name + ".gap-" + args.UniqueId + ".dangerous", "Only Dangerous").SetValue(
                        dangerous));

                menu.AddItem(new MenuItem(menu.Name + ".gap-" + args.UniqueId + ".separator", string.Empty));

                HeroListManager.AddToMenu(menu, args);

                Menues[args.UniqueId] = menu;
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Пример #3
0
        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));
            }
        }
Пример #4
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);
        }
        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)));
                    }
                }
            }
        }
Пример #6
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);
 }
Пример #7
0
        public static Menu AddToMenu(Menu menu,
                                     bool auto,
                                     bool autoInterrupt,
                                     bool interruptDelay,
                                     bool autoGapcloser,
                                     bool gapcloserDelay,
                                     bool flash,
                                     bool assisted,
                                     bool required,
                                     bool force)
        {
            try
            {
                _auto      = auto;
                _interrupt = autoInterrupt;
                _gapcloser = autoGapcloser;
                _flash     = flash;
                _assisted  = assisted;
                _required  = required;
                _force     = force;
                _menu      = menu;

                var ultimateMenu = menu.AddSubMenu(new Menu(Global.Lang.Get("F_Ultimate"), menu.Name + ".ultimate"));

                var uComboMenu =
                    ultimateMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Combo"), ultimateMenu.Name + ".combo"));
                uComboMenu.AddItem(
                    new MenuItem(uComboMenu.Name + ".min", "R " + Global.Lang.Get("G_Min")).SetValue(
                        new Slider(2, 1, 5)));
                uComboMenu.AddItem(new MenuItem(uComboMenu.Name + ".duel", Global.Lang.Get("UM_Duel")).SetValue(true));
                uComboMenu.AddItem(
                    new MenuItem(uComboMenu.Name + ".enabled", Global.Lang.Get("G_Enabled")).SetValue(true));

                if (auto)
                {
                    var uAutoMenu =
                        ultimateMenu.AddSubMenu(new Menu(Global.Lang.Get("UM_Auto"), ultimateMenu.Name + ".auto"));
                    if (autoInterrupt)
                    {
                        var autoInterruptMenu =
                            uAutoMenu.AddSubMenu(
                                new Menu(Global.Lang.Get("G_InterruptSpell"), uAutoMenu.Name + ".interrupt"));
                        if (interruptDelay)
                        {
                            DelayManager.AddToMenu(
                                autoInterruptMenu, "ultimate-interrupt-delay", string.Empty, 250, 0, 1000);
                        }
                        HeroListManager.AddToMenu(autoInterruptMenu, "ultimate-interrupt", false, false, true, false);
                    }
                    if (autoGapcloser)
                    {
                        var autoGapcloserMenu =
                            uAutoMenu.AddSubMenu(
                                new Menu(Global.Lang.Get("G_Gapcloser"), uAutoMenu.Name + ".gapcloser"));
                        if (gapcloserDelay)
                        {
                            DelayManager.AddToMenu(
                                autoGapcloserMenu, "ultimate-gapcloser-delay", string.Empty, 250, 0, 1000);
                        }
                        HeroListManager.AddToMenu(autoGapcloserMenu, "ultimate-gapcloser", false, false, true, false);
                    }
                    uAutoMenu.AddItem(
                        new MenuItem(uAutoMenu.Name + ".min", "R " + Global.Lang.Get("G_Min")).SetValue(
                            new Slider(3, 1, 5)));
                    uAutoMenu.AddItem(
                        new MenuItem(uAutoMenu.Name + ".duel", Global.Lang.Get("UM_Duel")).SetValue(false));
                    uAutoMenu.AddItem(
                        new MenuItem(uAutoMenu.Name + ".enabled", Global.Lang.Get("G_Enabled")).SetValue(true));
                }

                if (flash)
                {
                    var uFlashMenu =
                        ultimateMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Flash"), ultimateMenu.Name + ".flash"));
                    uFlashMenu.AddItem(
                        new MenuItem(uFlashMenu.Name + ".min", "R " + Global.Lang.Get("G_Min")).SetValue(
                            new Slider(3, 1, 5)));
                    uFlashMenu.AddItem(
                        new MenuItem(uFlashMenu.Name + ".duel", Global.Lang.Get("UM_Duel")).SetValue(true));
                    uFlashMenu.AddItem(
                        new MenuItem(uFlashMenu.Name + ".hotkey", Global.Lang.Get("G_Hotkey")).SetValue(
                            new KeyBind('U', KeyBindType.Press)));
                    uFlashMenu.AddItem(
                        new MenuItem(uFlashMenu.Name + ".move-cursor", Global.Lang.Get("UM_MoveCursor")).SetValue(true));
                    uFlashMenu.AddItem(
                        new MenuItem(uFlashMenu.Name + ".enabled", Global.Lang.Get("G_Enabled")).SetValue(true));
                }

                if (assisted)
                {
                    var uAssistedMenu =
                        ultimateMenu.AddSubMenu(
                            new Menu(Global.Lang.Get("UM_Assisted"), ultimateMenu.Name + ".assisted"));
                    uAssistedMenu.AddItem(
                        new MenuItem(uAssistedMenu.Name + ".min", "R " + Global.Lang.Get("G_Min")).SetValue(
                            new Slider(3, 1, 5)));
                    uAssistedMenu.AddItem(
                        new MenuItem(uAssistedMenu.Name + ".duel", Global.Lang.Get("UM_Duel")).SetValue(true));
                    uAssistedMenu.AddItem(
                        new MenuItem(uAssistedMenu.Name + ".hotkey", Global.Lang.Get("G_Hotkey")).SetValue(
                            new KeyBind('R', KeyBindType.Press)));
                    uAssistedMenu.AddItem(
                        new MenuItem(uAssistedMenu.Name + ".move-cursor", Global.Lang.Get("UM_MoveCursor")).SetValue(
                            true));
                    uAssistedMenu.AddItem(
                        new MenuItem(uAssistedMenu.Name + ".enabled", Global.Lang.Get("G_Enabled")).SetValue(true));
                }

                var uDuelMenu =
                    ultimateMenu.AddSubMenu(
                        new Menu(
                            Global.Lang.Get("UM_Duel") + " " + Global.Lang.Get("G_Settings"),
                            ultimateMenu.Name + ".duel"));

                var uDuelAlliesMenu =
                    uDuelMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Allies"), uDuelMenu.Name + ".allies"));

                uDuelAlliesMenu.AddItem(
                    new MenuItem(uDuelAlliesMenu.Name + ".range", Global.Lang.Get("UM_MaxAlliesRange")).SetValue(
                        new Slider(1500, 500, 3000)));
                uDuelAlliesMenu.AddItem(
                    new MenuItem(uDuelAlliesMenu.Name + ".min", Global.Lang.Get("UM_MinAllies")).SetValue(
                        new Slider(0, 0, 4)));
                uDuelAlliesMenu.AddItem(
                    new MenuItem(uDuelAlliesMenu.Name + ".max", Global.Lang.Get("UM_MaxAllies")).SetValue(
                        new Slider(3, 0, 4)));

                var uDuelEnemiesMenu =
                    uDuelMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Enemies"), uDuelMenu.Name + ".enemies"));

                uDuelEnemiesMenu.AddItem(
                    new MenuItem(uDuelEnemiesMenu.Name + ".range", Global.Lang.Get("UM_MaxEnemiesRange")).SetValue(
                        new Slider(2500, 500, 3000)));
                uDuelEnemiesMenu.AddItem(
                    new MenuItem(uDuelEnemiesMenu.Name + ".min", Global.Lang.Get("UM_MinEnemies")).SetValue(
                        new Slider(1, 1, 5)));
                uDuelEnemiesMenu.AddItem(
                    new MenuItem(uDuelEnemiesMenu.Name + ".max", Global.Lang.Get("UM_MaxEnemies")).SetValue(
                        new Slider(1, 1, 5)));

                var uDuelTargetMenu =
                    uDuelMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Target"), uDuelMenu.Name + ".target"));

                uDuelTargetMenu.AddItem(
                    new MenuItem(uDuelTargetMenu.Name + ".min-health", Global.Lang.Get("UM_MinTargetHealth")).SetValue(
                        new Slider(15, 10)));
                uDuelTargetMenu.AddItem(
                    new MenuItem(uDuelTargetMenu.Name + ".max-health", Global.Lang.Get("UM_MaxTargetHealth")).SetValue(
                        new Slider(100, 10)));

                var uDuelDamageMenu =
                    uDuelMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Damage"), uDuelMenu.Name + ".damage"));

                uDuelDamageMenu.AddItem(
                    new MenuItem(uDuelDamageMenu.Name + ".percent", Global.Lang.Get("UM_DamagePercent")).SetValue(
                        new Slider(100, 1, 200)));

                if (required)
                {
                    var uRequiredMenu =
                        ultimateMenu.AddSubMenu(
                            new Menu(Global.Lang.Get("UM_RequiredTarget"), ultimateMenu.Name + ".required"));

                    var requiredComboMenu =
                        uRequiredMenu.AddSubMenu(new Menu(Global.Lang.Get("G_Combo"), uRequiredMenu.Name + ".combo"));
                    requiredComboMenu.AddItem(
                        new MenuItem(requiredComboMenu.Name + ".min", Global.Lang.Get("G_Min")).SetValue(
                            new Slider(0, 0, 5)).DontSave());
                    HeroListManager.AddToMenu(
                        requiredComboMenu, "ultimate-required-combo", true, false, true, false, true);

                    var requiredAutoMenu =
                        uRequiredMenu.AddSubMenu(new Menu(Global.Lang.Get("UM_Auto"), uRequiredMenu.Name + ".auto"));
                    requiredAutoMenu.AddItem(
                        new MenuItem(requiredAutoMenu.Name + ".min", Global.Lang.Get("G_Min")).SetValue(
                            new Slider(0, 0, 5)).DontSave());
                    HeroListManager.AddToMenu(
                        requiredAutoMenu, "ultimate-required-auto", true, false, true, false, true);


                    uRequiredMenu.AddItem(
                        new MenuItem(uRequiredMenu.Name + ".range-check", Global.Lang.Get("UM_RangeCheck")).SetValue(
                            new Slider(2000, 1000, 3000)));
                }

                if (force)
                {
                    var uForceMenu =
                        ultimateMenu.AddSubMenu(
                            new Menu(Global.Lang.Get("UM_ForceTarget"), ultimateMenu.Name + ".force"));
                    uForceMenu.AddItem(
                        new MenuItem(uForceMenu.Name + ".additional", Global.Lang.Get("UM_AdditionalTargets")).SetValue(
                            new Slider(0, 0, 4)).DontSave());
                    uForceMenu.AddItem(
                        new MenuItem(uForceMenu.Name + ".combo-killable", Global.Lang.Get("UM_ComboKillable")).SetValue(
                            false).DontSave());
                    HeroListManager.AddToMenu(uForceMenu, "ultimate-force", true, false, true, false, true);
                }

                return(ultimateMenu);
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(null);
        }
Пример #8
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));
 }
Пример #9
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));
 }
Пример #10
0
        public Menu AddToMenu(Menu menu)
        {
            try
            {
                _menu = menu;

                var ultimateMenu = menu.AddSubMenu(new Menu("Ultimate", menu.Name + ".ultimate"));

                if (Required)
                {
                    var requiredMenu =
                        ultimateMenu.AddSubMenu(new Menu("Required Targets", ultimateMenu.Name + ".required"));

                    var modes = new List <UltimateModeType>();
                    if (Combo)
                    {
                        modes.Add(UltimateModeType.Combo);
                    }
                    if (Auto)
                    {
                        modes.Add(UltimateModeType.Auto);
                    }
                    if (Assisted)
                    {
                        modes.Add(UltimateModeType.Assisted);
                    }

                    requiredMenu.AddItem(
                        new MenuItem(requiredMenu.Name + ".mode", "Mode").SetValue(
                            new StringList(modes.Select(m => m.ToString()).ToArray()))).ValueChanged +=
                        delegate(object sender, OnValueChangeEventArgs eventArgs)
                    {
                        UpdateVisibileTags(requiredMenu, eventArgs.GetNewValue <StringList>().SelectedIndex + 1);
                    };

                    for (var i = 0; i < modes.Count; i++)
                    {
                        requiredMenu.AddItem(
                            new MenuItem(
                                requiredMenu.Name + "." + GetModeString(modes[i], true) + ".min", "Min. Required")
                            .SetValue(new Slider(1, 1, 5))).SetTag(i + 1);
                        HeroListManager.AddToMenu(
                            requiredMenu,
                            new HeroListManagerArgs("ultimate-required-" + GetModeString(modes[i], true))
                        {
                            IsWhitelist   = true,
                            Allies        = false,
                            Enemies       = true,
                            DefaultValue  = false,
                            DontSave      = true,
                            Enabled       = true,
                            MenuTag       = i + 1,
                            EnabledButton = false
                        });
                    }

                    UpdateVisibileTags(
                        requiredMenu, _menu.Item(requiredMenu.Name + ".mode").GetValue <StringList>().SelectedIndex + 1);
                }

                if (Force)
                {
                    var uForceMenu = ultimateMenu.AddSubMenu(new Menu("Forced Targets", ultimateMenu.Name + ".force"));
                    if (DamageCalculation != null)
                    {
                        uForceMenu.AddItem(
                            new MenuItem(uForceMenu.Name + ".damage-check", "Damage Check").SetValue(true));
                    }
                    uForceMenu.AddItem(
                        new MenuItem(uForceMenu.Name + ".additional", "Additional Targets").SetValue(
                            new Slider(0, 0, 4)));
                    HeroListManager.AddToMenu(
                        uForceMenu,
                        new HeroListManagerArgs("ultimate-force")
                    {
                        IsWhitelist   = true,
                        Allies        = false,
                        Enemies       = true,
                        DefaultValue  = false,
                        DontSave      = true,
                        Enabled       = true,
                        EnabledButton = false
                    });
                }

                if (Combo)
                {
                    var uComboMenu = ultimateMenu.AddSubMenu(new Menu("Combo", ultimateMenu.Name + ".combo"));
                    uComboMenu.AddItem(
                        new MenuItem(uComboMenu.Name + ".min", "Min. Hits").SetValue(new Slider(2, 1, 5)));
                    if (DamageCalculation != null)
                    {
                        uComboMenu.AddItem(
                            new MenuItem(uComboMenu.Name + ".damage-check", "Damage Check").SetValue(false));
                    }
                    uComboMenu.AddItem(new MenuItem(uComboMenu.Name + ".enabled", "Enabled").SetValue(true));
                }

                if (Auto)
                {
                    var uAutoMenu = ultimateMenu.AddSubMenu(new Menu("Auto", ultimateMenu.Name + ".auto"));
                    if (Interrupt)
                    {
                        var autoInterruptMenu =
                            uAutoMenu.AddSubMenu(new Menu("Interrupt", uAutoMenu.Name + ".interrupt"));
                        if (InterruptDelay)
                        {
                            DelayManager.AddToMenu(
                                autoInterruptMenu, "ultimate-interrupt-delay", string.Empty, 0, 0, 500);
                        }
                        HeroListManager.AddToMenu(
                            autoInterruptMenu,
                            new HeroListManagerArgs("ultimate-interrupt")
                        {
                            IsWhitelist  = false,
                            Allies       = false,
                            Enemies      = true,
                            DefaultValue = false,
                            DontSave     = false,
                            Enabled      = true
                        });
                    }
                    if (Gapcloser)
                    {
                        var autoGapcloserMenu =
                            uAutoMenu.AddSubMenu(new Menu("Gapcloser", uAutoMenu.Name + ".gapcloser"));
                        if (GapcloserDelay)
                        {
                            DelayManager.AddToMenu(
                                autoGapcloserMenu, "ultimate-gapcloser-delay", string.Empty, 0, 0, 500);
                        }
                        HeroListManager.AddToMenu(
                            autoGapcloserMenu,
                            new HeroListManagerArgs("ultimate-gapcloser")
                        {
                            IsWhitelist  = false,
                            Allies       = false,
                            Enemies      = true,
                            DefaultValue = false,
                            DontSave     = false,
                            Enabled      = false
                        });
                        BestTargetOnlyManager.AddToMenu(autoGapcloserMenu, "r-gapcloser", true);
                    }
                    uAutoMenu.AddItem(new MenuItem(uAutoMenu.Name + ".min", "Min. Hits").SetValue(new Slider(3, 1, 5)));
                    if (DamageCalculation != null)
                    {
                        uAutoMenu.AddItem(new MenuItem(uAutoMenu.Name + ".damage-check", "Damage Check").SetValue(true));
                    }
                    uAutoMenu.AddItem(new MenuItem(uAutoMenu.Name + ".enabled", "Enabled").SetValue(true));
                }

                if (Assisted)
                {
                    var uAssistedMenu = ultimateMenu.AddSubMenu(new Menu("Assisted", ultimateMenu.Name + ".assisted"));
                    if (Flash)
                    {
                        uAssistedMenu.AddItem(
                            new MenuItem(ultimateMenu.Name + ".flash.min", "Flash Min. Hits").SetValue(
                                new Slider(3, 1, 5)));
                    }
                    uAssistedMenu.AddItem(
                        new MenuItem(uAssistedMenu.Name + ".min", "Min. Hits").SetValue(new Slider(1, 1, 5)));
                    if (Flash)
                    {
                        uAssistedMenu.AddItem(
                            new MenuItem(ultimateMenu.Name + ".flash.hotkey", "Flash").SetValue(
                                new KeyBind('Y', KeyBindType.Press)));
                    }
                    uAssistedMenu.AddItem(
                        new MenuItem(uAssistedMenu.Name + ".hotkey", "Hotkey").SetValue(
                            new KeyBind('T', KeyBindType.Press)));
                    uAssistedMenu.AddItem(
                        new MenuItem(uAssistedMenu.Name + ".move-cursor", "Move to Cursor").SetValue(true));
                    if (DamageCalculation != null)
                    {
                        uAssistedMenu.AddItem(
                            new MenuItem(uAssistedMenu.Name + ".damage-check", "Damage Check").SetValue(false));
                    }
                    uAssistedMenu.AddItem(new MenuItem(uAssistedMenu.Name + ".enabled", "Enabled").SetValue(true));
                }

                var uSingleMenu = ultimateMenu.AddSubMenu(new Menu("Single Target", ultimateMenu.Name + ".single"));
                uSingleMenu.AddItem(
                    new MenuItem(uSingleMenu.Name + ".min-health", "Min. Target Health %").SetValue(new Slider(15)));
                uSingleMenu.AddItem(
                    new MenuItem(uSingleMenu.Name + ".max-add-allies", "Max. Additional Allies").SetValue(
                        new Slider(3, 0, 4)));
                uSingleMenu.AddItem(
                    new MenuItem(uSingleMenu.Name + ".max-add-enemies", "Max. Additional Enemies").SetValue(
                        new Slider(0, 0, 4)));

                uSingleMenu.AddItem(
                    new MenuItem(uSingleMenu.Name + ".range-allies", "Allies Range Check").SetValue(
                        new Slider(1750, 500, 3000)));
                uSingleMenu.AddItem(
                    new MenuItem(uSingleMenu.Name + ".range-enemies", "Enemies Range Check").SetValue(
                        new Slider(1750, 500, 3000)));

                if (Combo)
                {
                    uSingleMenu.AddItem(new MenuItem(uSingleMenu.Name + ".combo", "Combo").SetValue(true));
                }
                if (Auto)
                {
                    uSingleMenu.AddItem(new MenuItem(uSingleMenu.Name + ".auto", "Auto").SetValue(false));
                }
                if (Assisted)
                {
                    if (Flash)
                    {
                        uSingleMenu.AddItem(new MenuItem(uSingleMenu.Name + ".flash", "Flash").SetValue(false));
                    }
                    uSingleMenu.AddItem(new MenuItem(uSingleMenu.Name + ".assisted", "Assisted").SetValue(false));
                }

                if (DamageCalculation != null)
                {
                    ultimateMenu.AddItem(
                        new MenuItem(ultimateMenu.Name + ".damage-percent-single", "Single Damage Check %").SetValue(
                            new Slider(100, 1, 200)));
                    ultimateMenu.AddItem(
                        new MenuItem(ultimateMenu.Name + ".damage-percent", "Damage Check %").SetValue(
                            new Slider(150, 1, 200)));
                }

                return(ultimateMenu);
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(null);
        }
Пример #11
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);
 }
Пример #12
0
        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));
            }
        }