Exemplo n.º 1
0
        public DewardingMenu(Menu mainMenu)
        {
            var menu = new Menu("Dewarding", "dewardMenu");

            var enabled = new MenuItem("dewardEnabled", "Enabled").SetValue(true);

            enabled.SetTooltip("Auto use quelling blade, tangos, iron talon etc. enemy on wards");
            menu.AddItem(enabled);
            enabled.ValueChanged += (sender, args) =>
            {
                IsEnabled = args.GetNewValue <bool>();
                OnEnabledChange?.Invoke(null, new BoolEventArgs(IsEnabled));
            };
            IsEnabled = enabled.IsActive();

            var tangoHpThreshold =
                new MenuItem("dewardTangoHp", "Tango HP threshold").SetValue(new Slider(150, 0, 250));

            tangoHpThreshold.SetTooltip("Use tango only if you are missing more hp");
            menu.AddItem(tangoHpThreshold);
            tangoHpThreshold.ValueChanged += (sender, args) => TangoHpThreshold = args.GetNewValue <Slider>().Value;
            TangoHpThreshold = tangoHpThreshold.GetValue <Slider>().Value;

            var updateRate = new MenuItem("dewardUpdateRate", "Update rate").SetValue(new Slider(200, 1, 500));

            updateRate.SetTooltip("Lower value => faster reaction, but requires more resources");
            menu.AddItem(updateRate);
            updateRate.ValueChanged += (sender, args) =>
            {
                UpdateRate = args.GetNewValue <Slider>().Value;
                OnUpdateRateChange?.Invoke(null, new IntEventArgs(UpdateRate));
            };
            UpdateRate = updateRate.GetValue <Slider>().Value;

            menu.AddItem(
                new MenuItem("dewardItemsToggler", "Items:").SetValue(
                    abilityToggler = new AbilityToggler(ItemsToUse.ToDictionary(x => x.ToString(), x => true))));

            menu.AddItem(
                new MenuItem("dewardPriority", "Order:").SetValue(
                    priorityChanger = new PriorityChanger(ItemsToUse.Select(x => x.ToString()).ToList())));

            mainMenu.AddSubMenu(menu);
        }
Exemplo n.º 2
0
        public TechiesMinesDestroyerMenu(Menu mainMenu)
        {
            var menu = new Menu("Mines destroyer", "minesDestroyer");

            var enabled = new MenuItem("destroyerMines", "Enabled").SetValue(true);

            enabled.SetTooltip("Auto use quelling blade, iron talon and battle fury on remote/stasis mines");
            menu.AddItem(enabled);
            enabled.ValueChanged += (sender, args) =>
            {
                IsEnabled = args.GetNewValue <bool>();
                OnEnabledChange?.Invoke(null, new BoolEventArgs(IsEnabled));
            };
            IsEnabled = enabled.IsActive();

            var attackMines = new MenuItem("attackMines", "Attack techies mines").SetValue(true);

            attackMines.SetTooltip(
                "Auto attack techies mines when they can be killed with 1 hit and no other mines around");
            menu.AddItem(attackMines);
            attackMines.ValueChanged += (sender, args) => AttackMines = args.GetNewValue <bool>();
            AttackMines = attackMines.IsActive();

            var attackMinesInvisible = new MenuItem("attackMinesInvis", "Attack when invisible").SetValue(true);

            attackMinesInvisible.SetTooltip("Attack techies mines when your hero is invisible");
            menu.AddItem(attackMinesInvisible);
            attackMinesInvisible.ValueChanged += (sender, args) => AttackMinesInvisible = args.GetNewValue <bool>();
            AttackMinesInvisible = attackMinesInvisible.IsActive();

            var updateRate = new MenuItem("techiesMinesUpdateRate", "Update rate").SetValue(new Slider(200, 1, 500));

            updateRate.SetTooltip("Lower value => faster reaction, but requires more resources");
            menu.AddItem(updateRate);
            updateRate.ValueChanged += (sender, args) =>
            {
                UpdateRate = args.GetNewValue <Slider>().Value;
                OnUpdateRateChange?.Invoke(null, new IntEventArgs(UpdateRate));
            };
            UpdateRate = updateRate.GetValue <Slider>().Value;

            mainMenu.AddSubMenu(menu);
        }
Exemplo n.º 3
0
        public SnatcherMenu(Menu mainMenu)
        {
            var menu = new Menu("Snatcher", "snatcher");

            var notificationMenu = new Menu("Notification", "snatcherNotification");

            var notificationEnabled = new MenuItem("snatcherNotificationEnabled", "Enabled").SetValue(false);

            notificationEnabled.SetTooltip("Show notification when snatched is enabled");
            notificationMenu.AddItem(notificationEnabled);
            notificationEnabled.ValueChanged += (sender, args) =>
            {
                IsNotificationEnabled = args.GetNewValue <bool>();
                OnNotificationEnabledChange?.Invoke(null, new BoolEventArgs(IsNotificationEnabled));
            };
            IsNotificationEnabled = notificationEnabled.IsActive();

            var notificationHoldKey =
                new MenuItem("snatcherNotificationHoldKey", "Enabled for hold key").SetValue(false);

            notificationMenu.AddItem(notificationHoldKey);
            notificationHoldKey.ValueChanged += (sender, args) => { NotificationHold = args.GetNewValue <bool>(); };
            NotificationHold = notificationHoldKey.IsActive();

            var notificationToggleKey =
                new MenuItem("snatcherNotificationToggleKey", "Enabled for toggle key").SetValue(true);

            notificationMenu.AddItem(notificationToggleKey);
            notificationToggleKey.ValueChanged += (sender, args) => { NotificationToggle = args.GetNewValue <bool>(); };
            NotificationToggle = notificationToggleKey.IsActive();

            var notificationSize = new MenuItem("snatcherNotificationSize", "Size").SetValue(new Slider(22, 15, 30));

            notificationMenu.AddItem(notificationSize);
            notificationSize.ValueChanged += (sender, args) => { NotificationSize = args.GetNewValue <Slider>().Value; };
            NotificationSize = notificationSize.GetValue <Slider>().Value;

            var notificationX =
                new MenuItem("snatcherNotificationX", "Coordinates X").SetValue(
                    new Slider(15, 0, (int)HUDInfo.ScreenSizeX()));

            notificationMenu.AddItem(notificationX);
            notificationX.ValueChanged += (sender, args) => { NotificationX = args.GetNewValue <Slider>().Value; };
            NotificationX = notificationX.GetValue <Slider>().Value;

            var notificationY =
                new MenuItem("snatcherNotificationY", "Coordinates Y").SetValue(
                    new Slider(50, 0, (int)HUDInfo.ScreenSizeY()));

            notificationMenu.AddItem(notificationY);
            notificationY.ValueChanged += (sender, args) => { NotificationY = args.GetNewValue <Slider>().Value; };
            NotificationY = notificationY.GetValue <Slider>().Value;

            var enabled = new MenuItem("snatcherEnabled", "Enabled").SetValue(true);

            menu.AddItem(enabled);
            enabled.ValueChanged += (sender, args) =>
            {
                IsEnabled = args.GetNewValue <bool>();
                OnEnabledChange?.Invoke(null, new BoolEventArgs(IsEnabled));
            };
            IsEnabled = enabled.IsActive();

            var holdKey = new MenuItem("holdSnatchKey", "Hold key").SetValue(new KeyBind('O', KeyBindType.Press));

            menu.AddItem(holdKey);
            holdKey.ValueChanged += (sender, args) => HoldKey = args.GetNewValue <KeyBind>().Active;
            HoldKey = holdKey.IsActive();

            var holdItems = new MenuItem("enabledStealHold", "Hold steal:").SetValue(
                new AbilityToggler(items.ToDictionary(x => x.Key, x => true)));

            menu.AddItem(holdItems);
            holdItems.ValueChanged += (sender, args) =>
            {
                SetEnabledItems(args.GetNewValue <AbilityToggler>().Dictionary, EnabledHoldItems);
            };

            var toggleKey = new MenuItem("pressSnatchKey", "Toggle key").SetValue(new KeyBind('P', KeyBindType.Toggle));

            menu.AddItem(toggleKey);
            toggleKey.ValueChanged += (sender, args) => ToggleKey = args.GetNewValue <KeyBind>().Active;
            ToggleKey = toggleKey.IsActive();

            var toggleItems =
                new MenuItem("enabledStealToggle", "Toggle steal:").SetValue(
                    new AbilityToggler(items.ToDictionary(x => x.Key, x => true)));

            menu.AddItem(toggleItems);
            toggleItems.ValueChanged += (sender, args) => SetEnabledItems(
                args.GetNewValue <AbilityToggler>().Dictionary,
                EnabledToggleItems);

            var otherUnits = new MenuItem("snatcherOtherUnits", "Use other units").SetValue(false)
                             .SetTooltip("Like Spirit Bear, Meepo clones");

            menu.AddItem(otherUnits);
            otherUnits.ValueChanged += (sender, args) =>
            {
                UseOtherUnits = args.GetNewValue <bool>();
                OnUseOtherUnitsChange?.Invoke(null, new BoolEventArgs(UseOtherUnits));
            };
            UseOtherUnits = otherUnits.IsActive();

            var itemMoveCostThreshold =
                new MenuItem("snatcherMoveItemCost", "Move item cost threshold").SetValue(new Slider(1000, 0, 5000));

            itemMoveCostThreshold.SetTooltip(
                "It will move item from inventory (when full) to backpack which costs less gold to pick up aegis/rapier/gem (disabled: 0)");
            menu.AddItem(itemMoveCostThreshold);
            itemMoveCostThreshold.ValueChanged         +=
                (sender, args) => ItemMoveCostThreshold = args.GetNewValue <Slider>().Value;
            ItemMoveCostThreshold = itemMoveCostThreshold.GetValue <Slider>().Value;

            var updateRate = new MenuItem("snatcherUpdateRate", "Update rate").SetValue(new Slider(1, 1, 500));

            updateRate.SetTooltip("Lower value => faster reaction, but requires more resources");
            menu.AddItem(updateRate);
            updateRate.ValueChanged += (sender, args) =>
            {
                UpdateRate = args.GetNewValue <Slider>().Value;
                OnUpdateRateChange?.Invoke(null, new IntEventArgs(UpdateRate));
            };
            UpdateRate = updateRate.GetValue <Slider>().Value;

            var debug = new MenuItem("snatcherDebug", "Debug info").SetValue(false);

            menu.AddItem(debug);
            debug.ValueChanged += (sender, args) => OnDebug?.Invoke(null, EventArgs.Empty);

            SetEnabledItems(holdItems.GetValue <AbilityToggler>().Dictionary, EnabledHoldItems);
            SetEnabledItems(toggleItems.GetValue <AbilityToggler>().Dictionary, EnabledToggleItems);

            menu.AddSubMenu(notificationMenu);
            mainMenu.AddSubMenu(menu);
        }