Exemplo n.º 1
0
        public static void AddToMenu(Menu menu)
        {
            menu.Name = "sfx.ts";
            Menu      = menu;

            Drawings.AddToMainMenu();
            Weights.AddToMainMenu();
            Priorities.AddToMainMenu();
            Selected.Focus.AddToMainMenu();
            Humanizer.AddToMainMenu();
            Modes.AddToMainMenu();
        }
        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));
            }
        }
        private static IEnumerable <Targets.Item> GetOrderedChampions(List <Targets.Item> items)
        {
            try
            {
                switch (Mode)
                {
                case TargetSelectorModeType.Weights:
                    return(Weights.OrderChampions(items));

                case TargetSelectorModeType.Priorities:
                    return(Priorities.OrderChampions(items));

                case TargetSelectorModeType.LessAttacksToKill:
                    return(items.OrderBy(x => x.Hero.Health / ObjectManager.Player.TotalAttackDamage));

                case TargetSelectorModeType.MostAbilityPower:
                    return(items.OrderByDescending(x => x.Hero.TotalMagicalDamage));

                case TargetSelectorModeType.MostAttackDamage:
                    return(items.OrderByDescending(x => x.Hero.TotalAttackDamage));

                case TargetSelectorModeType.Closest:
                    return(items.OrderBy(x => x.Hero.Distance(ObjectManager.Player)));

                case TargetSelectorModeType.NearMouse:
                    return(items.OrderBy(x => x.Hero.Distance(Game.CursorPos)));

                case TargetSelectorModeType.LessCastPriority:
                    return(items.OrderBy(x => x.Hero.Health / ObjectManager.Player.TotalMagicalDamage));

                case TargetSelectorModeType.LeastHealth:
                    return(items.OrderBy(x => x.Hero.Health));
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
            return(new List <Targets.Item>());
        }
 public static float GetPriority(Obj_AI_Hero hero)
 {
     return(Priorities.GetPriority(hero));
 }
 public static void SetPriority(Obj_AI_Hero hero, int newPriority)
 {
     Priorities.SetPriority(hero, newPriority);
 }