예제 #1
0
        public static void AddToMenu(Menu menu)
        {
            try
            {
                _menu = menu;

                var drawingMenu = _menu.AddSubMenu(new Menu("Drawings", menu.Name + ".drawing"));

                drawingMenu.AddItem(
                    new MenuItem(drawingMenu.Name + ".circle-thickness", "Circle Thickness").SetShared()
                    .SetValue(new Slider(5, 1, 10)));

                Selected.AddToMenu(_menu, drawingMenu);
                Weights.AddToMenu(_menu, drawingMenu);
                Priorities.AddToMenu(_menu);

                _menu.AddItem(new MenuItem(_menu.Name + ".focus", "Focus Selected Target").SetShared().SetValue(true));
                _menu.AddItem(
                    new MenuItem(_menu.Name + ".force-focus", "Only Attack Selected Target").SetShared().SetValue(false));

                Humanizer.AddToMenu(_menu);

                _menu.AddItem(
                    new MenuItem(menu.Name + ".mode", "Mode").SetShared()
                    .SetValue(
                        new StringList(
                            new[]
                {
                    "Weigths", "Priorities", "Less Attacks To Kill", "Most Ability Power",
                    "Most Attack Damage", "Closest", "Near Mouse", "Less Cast Priority", "Least Health"
                }))).ValueChanged +=
                    delegate(object sender, OnValueChangeEventArgs args)
                {
                    Mode = GetModeBySelectedIndex(args.GetNewValue <StringList>().SelectedIndex);
                };

                Mode = GetModeBySelectedIndex(_menu.Item(menu.Name + ".mode").GetValue <StringList>().SelectedIndex);
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
        public static IEnumerable <Obj_AI_Hero> GetTargets(float range,
                                                           DamageType damageType = DamageType.True,
                                                           bool ignoreShields    = true,
                                                           Vector3 from          = default(Vector3),
                                                           IEnumerable <Obj_AI_Hero> ignoreChampions = null)
        {
            Weights.Range = Math.Max(range, Weights.Range);

            var selectedTarget = Selected.GetTarget(range, damageType, ignoreShields, from);

            if (selectedTarget != null)
            {
                return(new List <Obj_AI_Hero> {
                    selectedTarget
                });
            }

            range = Modes.Current.Mode == Mode.Weights && Selected.Focus.Enabled && Selected.Focus.Force
                ? Weights.Range
                : range;

            var targets =
                Humanizer.FilterTargets(Targets.Items)
                .Where(h => ignoreChampions == null || ignoreChampions.All(i => i.NetworkId != h.Hero.NetworkId))
                .Where(h => Utils.IsValidTarget(h.Hero, range, damageType, ignoreShields, from))
                .ToList();

            if (targets.Count > 0)
            {
                var t = Modes.GetOrderedChampions(targets).ToList();
                if (t.Count > 0)
                {
                    if (Selected.Target != null && Selected.Focus.Enabled && t.Count > 1)
                    {
                        t = t.OrderByDescending(x => x.Hero.NetworkId.Equals(Selected.Target.NetworkId)).ToList();
                    }
                    return(t.Select(h => h.Hero).ToList());
                }
            }
            return(new List <Obj_AI_Hero>());
        }