示例#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);
        }
示例#2
0
        public RecoveryMenu(Menu mainMenu)
        {
            var menu = new Menu("Recovery abuse", "recoveryAbuse");

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

            menu.AddItem(enabled);
            enabled.ValueChanged += (sender, args) => IsEnabled = args.GetNewValue <bool>();
            IsEnabled             = enabled.IsActive();

            var key = new MenuItem("recoveryKey", "Hotkey").SetValue(new KeyBind('-', KeyBindType.Press));

            menu.AddItem(key);
            key.ValueChanged += (sender, args) =>
            {
                if (skipNextEvent)
                {
                    skipNextEvent = false;
                    return;
                }

                IsActive = args.GetNewValue <KeyBind>().Active;
                OnAbuseChange?.Invoke(null, new BoolEventArgs(IsActive));
            };

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

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

            var toBackpack = new MenuItem("recoveryToBackpack", "Move items to backpack").SetValue(false);

            toBackpack.SetTooltip("Move items to backpack to \"disable\" them instead of dropping on the ground");
            menu.AddItem(toBackpack);
            toBackpack.ValueChanged += (sender, args) => ItemsToBackpack = args.GetNewValue <bool>();
            ItemsToBackpack          = toBackpack.IsActive();

            ItemSettingsMenu = new SettingsMenu(menu);

            mainMenu.AddSubMenu(menu);
        }
示例#3
0
        public AbilitiesMenu(MenuFactory factory)
        {
            var subFactory = factory.Menu("Abilities");

            AbilitiesColor = new AbilitiesColor(subFactory);
            Texture        = new Texture(subFactory);

            IsEnabled = subFactory.Item("Enabled", true);
            SumDamage = subFactory.Item("Sum damage", true);
            SumDamage.Item.SetTooltip("If enabled it will sum damage from all abilities otherwise only from one");
            ShowBorder = subFactory.Item("Show border", true);
            ShowBorder.Item.SetTooltip("Show border when unit can be killed");
            ShowWarningBorder = subFactory.Item("Show warning border", true);
            ShowWarningBorder.Item.SetTooltip(
                "Show texture and border when unit requires one more auto attack hit before he can be killed");

            subFactory.Item("Abilities:", abilityToggler = new AbilityToggler(new Dictionary <string, bool>()));
            subFactory.Item("Order:", priorityChanger    = new PriorityChanger(new List <string>()));
        }
示例#4
0
        public UsableAbilitiesMenu(Menu rootMenu)
        {
            var menu = new Menu("Abilities", "usableAbilities");

            menu.AddItem(
                new MenuItem("usableBlinkAbilities", "Blink:").SetValue(
                    blinkAbilityToggler = new AbilityToggler(new Dictionary <string, bool>())));
            menu.AddItem(
                new MenuItem("usableCounterAbilities", "Counter:").SetValue(
                    counterAbilityToggler = new AbilityToggler(new Dictionary <string, bool>())));
            menu.AddItem(
                new MenuItem("usableDiasbleAbilities", "Disable:").SetValue(
                    disableAbilityToggler = new AbilityToggler(new Dictionary <string, bool>())));

            specials = new Menu("Specials", "specials");
            menu.AddSubMenu(specials);

            rootMenu.AddSubMenu(menu);
        }
示例#5
0
        public Courier(Menu mainMenu)
        {
            var menu = new Menu("Courier", "courierSwapper");

            menu.AddItem(
                new MenuItem("courierSwapItems", "Items:").SetValue(abilityToggler = new AbilityToggler(new Dictionary <string, bool>())));

            var key = new MenuItem("courierKey", "Hotkey").SetValue(new KeyBind('-', KeyBindType.Press));

            menu.AddItem(key);
            key.ValueChanged += (sender, args) =>
            {
                if (args.GetNewValue <KeyBind>().Active)
                {
                    OnSwap?.Invoke(this, EventArgs.Empty);
                }
            };

            mainMenu.AddSubMenu(menu);
        }
示例#6
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="DragAndDrop" /> class.
        /// </summary>
        /// <param name="height">
        ///     The height.
        /// </param>
        /// <param name="itemList">
        ///     The item list.
        /// </param>
        public DragAndDrop(float height, List <string> itemList)
        {
            this.Height = height;
            var count = 0u;

            this.PriorityIconsDictionary = new Dictionary <PriorityIcon, uint>();
            this.itemList = new List <string>(itemList);
            foreach (var s in itemList)
            {
                this.PriorityIconsDictionary.Add(new PriorityIcon(s, height, true), count);
                count++;
            }

            this.doubleClickSleeper = new Sleeper();
            this.iconCountSleeper   = new Sleeper();
            this.iconSizeSleeper    = new Sleeper();
            this.transition         = new QuadEaseInOut(0.35);
            this.transition.Start(0, 150);
            this.abilityToggler = new AbilityToggler(new Dictionary <string, bool>());
            this.Width          = itemList.Count * this.Height;
        }
示例#7
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!isloaded)
            {
                me = ObjectManager.LocalHero;
                if (!Game.IsInGame || me == null)
                {
                    return;
                }
                if (me.Team == Team.Dire)
                {
                    foreach (var creepWave in CreepWaves)
                    {
                        creepWave.Coords.Reverse();
                    }
                }
                isloaded = true;
            }

            if (me == null || !me.IsValid)
            {
                isloaded = false;
                me       = ObjectManager.LocalHero;
                return;
            }


            if (me.ClassID != ClassID.CDOTA_Unit_Hero_Meepo || Game.IsPaused || Game.IsChatOpen)
            {
                return;
            }

            var stackKey   = Menu.Item("Stack").GetValue <KeyBind>().Active;
            var lanePush   = Menu.Item("LanePush").GetValue <KeyBind>().Active;
            var JungleFarm = Menu.Item("JungleFarm").GetValue <KeyBind>().Active;

            _menuValue = Menu.Item("enabledAbilities").GetValue <AbilityToggler>();
            W          = me.Spellbook.Spell2;
            var wRadius       = W.GetCastRange() - 30;
            var movementspeed = me.MovementSpeed;

            travels = me.Inventory.Items.FirstOrDefault(item => item.Name.Contains("item_travel_boots"));

            meepos = ObjectMgr.GetEntities <Meepo>().Where(meepo => meepo.Team == me.Team && !meepo.Equals(me)).ToList();

            var seconds = ((int)Game.GameTime) % 60;

            if (JungleCamps.FindAll(x => x.meepos != null).Count != meepos.Count || seconds == 1)
            {
                foreach (var camp in JungleCamps)
                {
                    camp.meepos   = null;
                    camp.Stacking = false;
                    camp.Farming  = false;
                    camp.State    = 0;
                }
            }
            if (seconds == 0)
            {
                foreach (var camp in JungleCamps)
                {
                    camp.meepos   = null;
                    camp.Stacking = false;
                    camp.Farming  = false;
                    camp.Empty    = false;
                    camp.State    = 0;
                }
            }

            #region lanepush

            if (lanePush && Utils.SleepCheck("lanePush"))
            {
                try
                {
                    var creeps =
                        ObjectManager.GetEntities <Unit>()
                        .Where(
                            x =>
                            x.IsAlive && x.IsVisible && x.Team != me.Team &&
                            (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane ||
                             x.ClassID == ClassID.CDOTA_BaseNPC_Creep ||
                             x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral ||
                             x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
                            ))
                        .OrderByDescending(x => x.Distance2D(new Vector3(0, 0, 0))).ToList();

                    var creepdel = new List <Unit>();
                    foreach (var creepWave in CreepWaves)
                    {
                        creepdel.AddRange(creepWave.Creeps.Where(creep => creeps.All(x => x.Handle != creep.Handle)));
                        foreach (var creep in creepdel)
                        {
                            creepWave.Creeps.Remove(creep);
                        }
                    }

                    foreach (var creep in creeps)
                    {
                        float[] distance = { float.MaxValue };
                        var     name     = "";
                        foreach (var creepWave in CreepWaves)
                        {
                            foreach (var pos in creepWave.Coords.Where(pos => distance[0] > pos.Distance2D(creep)))
                            {
                                name        = creepWave.Name;
                                distance[0] = pos.Distance2D(creep);
                            }
                        }
                        if (CreepWaves.Any(x => x.Name == name && !x.Creeps.Contains(creep)))
                        {
                            CreepWaves.First(x => x.Name == name && !x.Creeps.Contains(creep)).Creeps.Add(creep);
                        }
                    }

                    foreach (var creepWave in CreepWaves)
                    {
                        if (creepWave.Creeps.Count > 0)
                        {
                            creepWave.Position = new Vector3(
                                creepWave.Creeps.Average(x => x.Position.X),
                                creepWave.Creeps.Average(x => x.Position.Y),
                                creepWave.Creeps.Average(x => x.Position.Z));
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error LanePush" + e);
                }

                if (meepos.Count > 0)
                {
                    try
                    {
                        foreach (var meepo in meepos)
                        {
                            if (!CreepWaves.Any(x => x.meepo != null && x.meepo.Handle == meepo.Handle) &&
                                CreepWaves.Count(x => x.meepo == null) > 0)
                            {
                                CreepWaves.First(x => x.meepo == null).meepo = meepo;
                            }
                        }
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Error LanePush 4");
                    }
                    try
                    {
                        foreach (var creepWave in CreepWaves.Where(x => x.meepo != null))
                        {
                            if (GetClosestCreep(creepWave) != null)
                            {
                                if (creepWave.meepo.Distance2D(GetClosestWave(creepWave)) < 300 ||
                                    creepWave.meepo.Distance2D(creepWave.Position) < 1000)
                                {
                                    creepWave.meepo.Attack(GetClosestCreep(creepWave));
                                }
                                else
                                {
                                    creepWave.meepo.Move(creepWave.Position);
                                }
                            }
                            else
                            {
                                if (creepWave.meepo.Distance2D(GetClosestWave(creepWave)) > 100)
                                {
                                    creepWave.meepo.Move(GetClosestWave(creepWave));
                                    creepWave.Position = GetNextWave(creepWave);
                                }
                                else
                                {
                                    creepWave.meepo.Move(GetNextWave(creepWave));
                                    creepWave.Position = GetNextWave(creepWave);
                                }
                            }

                            if (creepWave.meepo.Modifiers.Any(
                                    m => m.Name == "modifier_kill" && Math.Abs(m.Duration - m.ElapsedTime - 1) < 0) ||
                                meepos.All(x => x.Handle != creepWave.meepo.Handle))
                            {
                                creepWave.meepo = null;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error LanePush 5" + e);
                    }
                }
                Utils.Sleep(500, "lanePush");
            }
            #endregion

            #region Stack

            else if (stackKey && meepos.Count > 0 && Utils.SleepCheck("wait"))
            {
                foreach (var meepo in meepos)
                {
                    if (!Check(meepo))
                    {
                        JungleCamps.Find(x => x.Id == GetClosestCamp(meepo, true, false).Id).meepos   = meepo;
                        JungleCamps.Find(x => x.Id == GetClosestCamp(meepo, true, false).Id).Stacking = true;
                    }
                    else
                    {
                        var illusionCamps = CheckMeepo(meepo);
                        switch (illusionCamps.State)
                        {
                        case 0:
                            if (meepo.Distance2D(illusionCamps.WaitPosition) < 5)
                            {
                                illusionCamps.State = 1;
                            }
                            else
                            {
                                meepo.Move(illusionCamps.WaitPosition);
                            }
                            Utils.Sleep(500, "wait");
                            break;

                        case 1:
                            creepscount = CreepCount(illusionCamps.meepos, 800);
                            if (creepscount == 0)
                            {
                                JungleCamps.Find(x => x.Id == illusionCamps.Id).meepos   = null;
                                JungleCamps.Find(x => x.Id == illusionCamps.Id).Empty    = true;
                                JungleCamps.Find(x => x.Id == illusionCamps.Id).Stacking = false;
                                JungleCamps.Find(x => x.Id == GetClosestCamp(meepo, true, false).Id).meepos =
                                    meepo;
                                JungleCamps.Find(x => x.Id == GetClosestCamp(meepo, true, false).Id).Stacking =
                                    true;
                            }
                            else if (seconds >= illusionCamps.Starttime - 5)
                            {
                                closestNeutral = GetNearestCreepToPull(illusionCamps.meepos, 800);
                                stackPosition  = illusionCamps.StackPosition;
                                var moveTime = illusionCamps.Starttime -
                                               (GetDistance2D(illusionCamps.meepos.Position,
                                                              closestNeutral.Position) +
                                                (closestNeutral.IsRanged
                                                        ? closestNeutral.AttackRange
                                                        : closestNeutral.RingRadius)) / movementspeed;
                                illusionCamps.AttackTime = (int)moveTime;
                                illusionCamps.State      = 2;
                            }
                            Utils.Sleep(500, "wait");
                            break;

                        case 2:
                            if (seconds >= illusionCamps.AttackTime)
                            {
                                closestNeutral = GetNearestCreepToPull(illusionCamps.meepos, 1200);
                                stackPosition  = GetClosestCamp(illusionCamps.meepos, true, false).StackPosition;
                                illusionCamps.meepos.Attack(closestNeutral);
                                illusionCamps.State = 3;
                                var tWait =
                                    (int)
                                    (((GetDistance2D(illusionCamps.meepos.Position, closestNeutral.Position)) /
                                      movementspeed) * 1000 + Game.Ping);
                                Utils.Sleep(tWait, "" + illusionCamps.meepos.Handle);
                            }
                            break;

                        case 3:
                            if (Utils.SleepCheck("" + illusionCamps.meepos.Handle))
                            {
                                var poof = meepo.Spellbook.SpellW;
                                if (_menuValue.IsEnabled(poof.Name) && poof.CanBeCasted() &&
                                    Creepcountall(wRadius) > Creepcountall(600) / 2)
                                {
                                    poof.UseAbility(meepo);
                                }
                                illusionCamps.meepos.Move(illusionCamps.StackPosition);
                                illusionCamps.State = 4;
                            }
                            break;

                        case 4:
                            meepo.Move(illusionCamps.StackPosition);
                            Utils.Sleep(1000, "wait");
                            break;

                        default:
                            illusionCamps.State = 0;
                            break;
                        }
                    }
                }
            }
            #endregion Stack

            #region Farm

            else if (JungleFarm && meepos.Count > 0 && Utils.SleepCheck("farm"))
            {
                foreach (var meepo in meepos)
                {
                    if (!Check(meepo))
                    {
                        JungleCamps.Find(x => x.Id == GetClosestCamp(meepo, false, false).Id).meepos  = meepo;
                        JungleCamps.Find(x => x.Id == GetClosestCamp(meepo, false, false).Id).Farming = true;
                    }
                    else
                    {
                        var illusionCamps = CheckMeepo(meepo);
                        if (meepo.Distance2D(illusionCamps.Position) > 100)
                        {
                            meepo.Move(illusionCamps.Position);
                        }
                        else
                        {
                            var poof = meepo.Spellbook.SpellW;
                            if (poof.CanBeCasted() && CreepCount(meepo, 300) > 0 && _menuValue.IsEnabled(poof.Name) &&
                                Creepcountall(wRadius) >= Creepcountall(600) / 2)
                            {
                                poof.UseAbility(meepo);
                            }
                            meepo.Attack(GetNearestCreepToPull(illusionCamps.meepos, 500));
                        }
                    }
                }
                Utils.Sleep(1000, "farm");
            }

            #endregion Farm
        }
示例#8
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Ursa)
                {
                    return;
                }
                earthshock   = me.Spellbook.Spell1;
                overpower    = me.Spellbook.SpellW;
                enrage       = me.FindSpell("ursa_enrage");
                blink        = me.FindItem("item_blink");
                abyssalBlade = me.FindItem("item_abyssal_blade");
                scytheOfVyse = me.FindItem("item_sheepstick");
                loaded       = true;
                Game.PrintMessage(
                    "<font color='#3377ff'>UrsaRage</font>: GL HF <font face='Tahoma' size='9'>(GUYS<font color='#ff9900'></font>)</font>",
                    MessageType.ChatMessage);
            }

            if (!Game.IsInGame || me == null)
            {
                overpowerCastPoint  = 0;
                earthshockCastPoint = 0;
                loaded       = false;
                me           = null;
                target       = null;
                earthshock   = null;
                overpower    = null;
                enrage       = null;
                abyssalBlade = null;
                scytheOfVyse = null;
                blink        = null;
                return;
            }

            if (!menuvalueSet)
            {
                menuValue    = Menu.Item("enabledAbilities").GetValue <AbilityToggler>();
                menuvalueSet = true;
                //Utils.Sleep(100000, "updateMenuValue");
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (blink == null)
            {
                blink = me.FindItem("item_blink");
            }

            if (abyssalBlade == null)
            {
                abyssalBlade = me.FindItem("item_abyssal_blade");
            }

            if (abyssalBlade == null)
            {
                abyssalBlade = me.FindItem("item_sheepstick");
            }

            if (earthshock == null)
            {
                earthshock = me.Spellbook.Spell1;
            }
            else if (earthshockCastPoint == 0)
            {
                earthshockCastPoint = 0.3;
            }

            if (overpower == null)
            {
                overpower = me.Spellbook.SpellW;
            }
            else if (overpowerCastPoint == 0)
            {
                overpowerCastPoint = 0.3;
            }

            if (enrage == null)
            {
                enrage = me.FindSpell("ursa_enrage");
            }

            if (!Menu.Item("comboKey").GetValue <KeyBind>().Active || Game.IsChatOpen)
            {
                target = null;
                return;
            }
            if (Utils.SleepCheck("blink"))
            {
                mePosition = me.Position;
            }
            if (earthshock.IsInAbilityPhase &&
                (target == null || !target.IsAlive ||
                 target.Distance2D(me) > earthshock.GetAbilityData("shock_radius")))
            {
                me.Stop();
                if (target != null)
                {
                    me.Attack(target);
                }
            }
            if (overpower.IsInAbilityPhase && (target == null || !target.IsAlive))
            {
                me.Stop();
                if (target != null)
                {
                    me.Attack(target);
                }
            }
            var range         = 1000f;
            var mousePosition = Game.MousePosition;

            if (blink != null)
            {
                blinkRange = blink.AbilityData.FirstOrDefault(x => x.Name == "blink_range").GetValue(0);
                range      = blinkRange + me.HullRadius + 500;
            }
            var canCancel = (Orbwalking.CanCancelAnimation() && Orbwalking.AttackOnCooldown(target)) ||
                            (!Orbwalking.AttackOnCooldown(target) &&
                             (targetDistance > 350 || (target != null && !target.IsVisible))) || target == null;

            if (canCancel)
            {
                if (target != null && !target.IsVisible)
                {
                    if (!Menu.Item("lockTarget").GetValue <bool>())
                    {
                        var closestToMouse = me.ClosestToMouseTarget(128);
                        if (closestToMouse != null)
                        {
                            target = me.ClosestToMouseTarget(range);
                        }
                    }
                }
                else
                {
                    var index = Menu.Item("targetSelecting").GetValue <StringList>().SelectedIndex;
                    target = index == 0 ? me.BestAATarget(blinkRange) : me.ClosestToMouseTarget();
                }
            }
            if (target == null || !target.IsAlive ||
                ((!target.IsVisible || target.Distance2D(mousePosition) > target.Distance2D(me) + 1000) && canCancel))
            {
                if (!Utils.SleepCheck("move"))
                {
                    return;
                }
                me.Move(mousePosition);
                Utils.Sleep(100, "move");
                return;
            }
            targetDistance = mePosition.Distance2D(target);
            hullsum        = (me.HullRadius + target.HullRadius) * 2;
            turnTime       = me.GetTurnTime(target);
            var casting = CastCombo();

            if (casting)
            {
                return;
            }
            if (!Utils.SleepCheck("casting"))
            {
                return;
            }
            OrbWalk(Orbwalking.CanCancelAnimation());
        }
示例#9
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="DragAndDrop" /> class.
        /// </summary>
        /// <param name="height">
        ///     The height.
        /// </param>
        /// <param name="itemList">
        ///     The item list.
        /// </param>
        /// <param name="abilityToggler">
        ///     The ability toggler.
        /// </param>
        public DragAndDrop(float height, List<string> itemList, AbilityToggler abilityToggler)
        {
            this.Height = height;
            var count = 0u;
            this.PriorityIconsDictionary = new Dictionary<PriorityIcon, uint>();
            this.itemList = new List<string>(itemList);
            foreach (var s in itemList)
            {
                this.PriorityIconsDictionary.Add(new PriorityIcon(s, height, abilityToggler.IsEnabled(s)), count);
                count++;
            }

            this.doubleClickSleeper = new Sleeper();
            this.iconCountSleeper = new Sleeper();
            this.iconSizeSleeper = new Sleeper();
            this.transition = new QuadEaseInOut(0.35);
            this.transition.Start(0, 150);
            this.abilityToggler = abilityToggler;
            this.usingAbilityToggler = true;
            this.Width = itemList.Count * this.Height;
        }
示例#10
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
            {
                return;
            }

            me = ObjectMgr.LocalHero;
            if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Obsidian_Destroyer)
            {
                return;
            }

            if (astral == null)
            {
                astral = me.Spellbook.SpellW;
            }

            if (eclipse == null)
            {
                eclipse = me.Spellbook.SpellR;
            }


            if (bkb == null)
            {
                bkb = me.FindItem("item_black_king_bar");
            }

            if (orb == null)
            {
                orb = me.Spellbook.Spell1;
            }

            if (hex == null)
            {
                hex = me.FindItem("item_sheepstick");
            }

            if (orchid == null)
            {
                orchid = me.FindItem("item_orchid");
            }

            if (shiva == null)
            {
                shiva = me.FindItem("item_shivas_guard");
            }

            if (atos == null)
            {
                atos = me.FindItem("item_rod_of_atos");
            }
            if (atos == null)
            {
                atos = me.FindItem("item_bloodthorn");
            }

            if (!menuvalueSet)
            {
                menuValue    = Menu.Item("Items").GetValue <AbilityToggler>();
                menuvalueSet = true;
            }


            if (Combo)
            {
                var ctm  = Targeting.SelectedIndex != 2 || Targeting.SelectedIndex != 1 || Targeting.SelectedIndex != 3;
                var hhp  = Targeting.SelectedIndex != 0 || Targeting.SelectedIndex != 2 || Targeting.SelectedIndex != 3;
                var hi   = Targeting.SelectedIndex != 1 || Targeting.SelectedIndex != 0 || Targeting.SelectedIndex != 3;
                var baat = Targeting.SelectedIndex != 0 || Targeting.SelectedIndex != 1 || Targeting.SelectedIndex != 2;

                if (ctm)
                {
                    target = me.ClosestToMouseTarget(1000);
                }

                else if (hhp)
                {
                    target = TargetSelector.HighestHealthPointsTarget(me, 600);
                }

                else if (hi)
                {
                    target = HighestInt(me);
                }

                else if (baat)
                {
                    target = me.BestAATarget();
                }

                //orbwalk
                if (target != null && (!target.IsValid || !target.IsVisible || !target.IsAlive || target.Health <= 0))
                {
                    target = null;
                }
                var canCancel = Orbwalking.CanCancelAnimation();
                if (canCancel)
                {
                    if (target != null && !target.IsVisible && !Orbwalking.AttackOnCooldown(target))
                    {
                        target = me.ClosestToMouseTarget();
                    }
                }
                if (target != null && target.IsAlive && !target.IsInvul() && !target.IsIllusion)
                {
                    var targetDistance = me.Distance2D(target);
                    if (me.CanAttack() && me.CanCast())
                    {
                        if (orb != null && orb.IsValid && orb.CanBeCasted() && me.CanCast() && Utils.SleepCheck("orb") && !target.UnitState.HasFlag(UnitState.MagicImmune))
                        {
                            orb.UseAbility(target);
                            Utils.Sleep(50, "orb");
                        }
                    }

                    if (atos != null && atos.IsValid && atos.CanBeCasted() && Utils.SleepCheck("atos") && menuValue.IsEnabled(atos.Name))
                    {
                        atos.UseAbility(target);
                        Utils.Sleep(50 + Game.Ping, "atos");
                    }

                    if (shiva != null && shiva.IsValid && shiva.CanBeCasted() && Utils.SleepCheck("shiva") && menuValue.IsEnabled(shiva.Name))
                    {
                        atos.UseAbility(target);
                        Utils.Sleep(50 + Game.Ping, "shiva");
                    }

                    if (!(targetDistance <= me.AttackRange))
                    {
                        return;
                    }
                    if (bkb != null && bkb.IsValid && bkb.CanBeCasted() && Utils.SleepCheck("bkb") && menuValue.IsEnabled(bkb.Name))
                    {
                        bkb.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "bkb");
                    }

                    if (hex != null && hex.IsValid && hex.CanBeCasted() && Utils.SleepCheck("hex") && menuValue.IsEnabled(hex.Name))
                    {
                        hex.CastStun(target);
                        Utils.Sleep(250 + Game.Ping, "hex");
                        return;
                    }

                    if (orchid != null && orchid.IsValid && orchid.CanBeCasted() && Utils.SleepCheck("orchid") && menuValue.IsEnabled(orchid.Name))
                    {
                        orchid.CastStun(target);
                        Utils.Sleep(250 + Game.Ping, "orchid");
                        return;
                    }

                    if (bloodthorn != null && bloodthorn.IsValid && bloodthorn.CanBeCasted() && Utils.SleepCheck("bloodthorn") && menuValue.IsEnabled(bloodthorn.Name))
                    {
                        bloodthorn.CastStun(target);
                        Utils.Sleep(250 + Game.Ping, "bloodthorn");
                        return;
                    }

                    if (orb == null || orb.CanBeCasted() || !Utils.SleepCheck("orb") ||
                        !Menu.Item("orbwalkk").GetValue <bool>() || !(targetDistance <= me.AttackRange))
                    {
                    }
                    else
                    {
                        Orbwalking.Orbwalk(target);
                        Utils.Sleep(Game.Ping + 150, "orb");
                    }

                    if (me.IsAttacking() || !(targetDistance >= me.AttackRange) ||
                        !Utils.SleepCheck("follow"))
                    {
                        return;
                    }
                    me.Move(Game.MousePosition);
                    Utils.Sleep(150 + Game.Ping, "follow");
                }
                else if (!orb.CanBeCasted() && Utils.SleepCheck("orb") && target != null && target.UnitState.HasFlag(UnitState.MagicImmune))
                {
                    me.Attack(target);
                    Utils.Sleep(150, "noorb");
                }
                else
                {
                    me.Move(Game.MousePosition);
                }
            }
        }
示例#11
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
            {
                return;
            }

            me = ObjectMgr.LocalHero;
            if (me == null)
            {
                return;
            }

            if (bkb == null)
            {
                bkb = me.FindItem("item_black_king_bar");
            }

            if (ghost == null)
            {
                ghost = me.FindItem("item_ghost");
            }

            if (ethereal == null)
            {
                ethereal = me.FindItem("item_ethereal_blade");
            }

            if (blink == null)
            {
                blink = me.FindItem("item_blink");
            }

            if (force == null)
            {
                force = me.FindItem("item_force_staff");
            }

            if (tp == null)
            {
                tp = me.FindItem("item_tpscroll");
            }

            if (bot == null)
            {
                bot = me.FindItem("item_travel_boots");
            }

            if (bott == null)
            {
                bott = me.FindItem("item_travel_boots_2");
            }

            if (!menuvalueSet)
            {
                menuValue    = Menu.Item("Items").GetValue <AbilityToggler>();
                menuvalueSet = true;
            }

            if (panic)
            {
                Mouse_Position = Game.MousePosition;
                if (fountain == null || !fountain.IsValid)
                {
                    fountain = ObjectMgr.GetEntities <Unit>()
                               .FirstOrDefault(x => x.Team == me.Team && x.ClassID == ClassID.CDOTA_Unit_Fountain);
                }

                if (bkb != null && bkb.IsValid && bkb.CanBeCasted() && Utils.SleepCheck("bkb") &&
                    menuValue.IsEnabled(bkb.Name))
                {
                    bkb.UseAbility();
                    Utils.Sleep(150 + Game.Ping, "bkb");
                }

                if (ghost != null && ghost.IsValid && ghost.CanBeCasted() && Utils.SleepCheck("ghost") &&
                    menuValue.IsEnabled(ghost.Name))
                {
                    ghost.UseAbility();
                    Utils.Sleep(150 + Game.Ping, "ghost");
                }

                if (ethereal != null && me.Mana > 175 && ethereal.IsValid && ethereal.CanBeCasted() && Utils.SleepCheck("ethereal") &&
                    menuValue.IsEnabled(ethereal.Name))
                {
                    ethereal.UseAbility(me);
                    Utils.Sleep(150 + Game.Ping, "ethereal");
                }

                if (blink != null && blink.IsValid && blink.CanBeCasted() && Utils.SleepCheck("blink") &&
                    menuValue.IsEnabled(blink.Name))
                {
                    blink.UseAbility(Mouse_Position);
                    Utils.Sleep(150 + Game.Ping, "blink");
                }

                if (force != null && force.IsValid && me.Mana > 100 && force.CanBeCasted() && Utils.SleepCheck("force") &&
                    menuValue.IsEnabled(force.Name))
                {
                    force.UseAbility(me);
                    Utils.Sleep(150 + Game.Ping, "force");
                }

                if (bot != null && bot.IsValid && bot.CanBeCasted() && Utils.SleepCheck("bot") &&
                    menuValue.IsEnabled(bot.Name))
                {
                    bot.UseAbility(fountain);
                    Utils.Sleep(150 + Game.Ping, "bot");
                }

                else if (bott != null && bott.IsValid && bott.CanBeCasted() && Utils.SleepCheck("bott") &&
                         menuValue.IsEnabled(bott.Name))
                {
                    bott.UseAbility(fountain);
                    Utils.Sleep(150 + Game.Ping, "bott");
                }

                else if (tp != null && tp.IsValid && bot.CanBeCasted() && Utils.SleepCheck("tp") &&
                         menuValue.IsEnabled(tp.Name))
                {
                    tp.UseAbility(fountain);
                    Utils.Sleep(150 + Game.Ping, "tp");
                }
            }
        }
示例#12
0
文件: Program.cs 项目: Lat0ur/Ensage-
        private static void Game_OnUpdate(EventArgs args)
        {
            _me = ObjectManager.LocalHero;
            if (!Game.IsInGame || _me == null || _me.ClassID != ClassID.CDOTA_Unit_Hero_Lina)
            {
                return;
            }
            if (Game.IsPaused || Game.IsChatOpen)
            {
                return;
            }

            _menuValue = Menu.Item("enabledAbilities").GetValue <AbilityToggler>();
            _slider    = Menu.Item("distance").GetValue <Slider>().Value;

            Q = _me.Spellbook.Spell1;
            W = _me.Spellbook.Spell2;
            R = _me.Spellbook.Spell4;

            Dagon    = _me.Inventory.Items.FirstOrDefault(item => item.Name.Contains("item_dagon"));
            Hex      = _me.FindItem("item_sheepstick");
            Ethereal = _me.FindItem("item_ethereal_blade");
            Veil     = _me.FindItem("item_veil_of_discord");
            Orchid   = _me.FindItem("item_orchid");
            Shiva    = _me.FindItem("item_shivas_guard");
            Eul      = _me.FindItem("item_cyclone");
            Blink    = _me.FindItem("item_blink");

            if (!Game.IsKeyDown(Menu.Item("Cooombo").GetValue <KeyBind>().Key))
            {
                _targetActive = false;
                return;
            }

            if (!_targetActive)
            {
                _target       = _me.ClosestToMouseTarget(300);
                _targetActive = true;
            }
            else
            {
                var modifHex =
                    _target.Modifiers.Where(y => y.Name == "modifier_sheepstick_debuff")
                    .DefaultIfEmpty(null)
                    .FirstOrDefault();
                var modifEul =
                    _target.Modifiers.Where(y => y.Name == "modifier_eul_cyclone").DefaultIfEmpty(null).FirstOrDefault();

                if (_target == null || !_target.IsAlive || _target.IsIllusion || _target.IsMagicImmune())
                {
                    return;
                }

                if (Blink != null && Blink.CanBeCasted() && _me.Distance2D(_target) > _slider + 100 && _menuValue.IsEnabled("item_blink") && Utils.SleepCheck("blink"))
                {
                    Blink.UseAbility(PositionCalc(_me, _target, _slider));
                    Utils.Sleep(150 + Game.Ping, "blink");
                }
                else if (Eul != null && Eul.CanBeCasted() && Utils.SleepCheck("eul") && _menuValue.IsEnabled("item_cyclone") && Utils.SleepCheck("blink"))
                {
                    Eul.UseAbility(_target);
                    Utils.Sleep(4000 + Game.Ping, "eul");
                }
                else if (Eul == null || Eul.Cooldown > 0 || !_menuValue.IsEnabled("item_cyclone"))
                {
                    if (Orchid != null && Orchid.CanBeCasted() && Utils.SleepCheck("orchid") && modifEul == null &&
                        _menuValue.IsEnabled("item_orchid"))
                    {
                        Orchid.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "orchid");
                    }
                    else if (Shiva != null && Shiva.CanBeCasted() && Utils.SleepCheck("shiva") && modifEul == null &&
                             _menuValue.IsEnabled("item_shivas_guard"))
                    {
                        Shiva.UseAbility();
                        Utils.Sleep(150 + Game.Ping, "shiva");
                    }
                    else if (Veil != null && Veil.CanBeCasted() && Utils.SleepCheck("veil") && modifEul == null &&
                             _menuValue.IsEnabled("item_veil_of_discord"))
                    {
                        Veil.UseAbility(_target.Position);
                        Utils.Sleep(150 + Game.Ping, "veil");
                    }
                    else if (Ethereal != null && Ethereal.CanBeCasted() && Utils.SleepCheck("ethereal") &&
                             modifEul == null && _menuValue.IsEnabled("item_ethereal_blade"))
                    {
                        Ethereal.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "ethereal");
                    }
                    else if (Dagon != null && Dagon.CanBeCasted() && Utils.SleepCheck("dagon") &&
                             modifEul == null)
                    {
                        Dagon.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "dagon");
                    }
                    else if (Hex != null && Hex.CanBeCasted() && Utils.SleepCheck("hex") &&
                             !_target.IsStunned() &&
                             Utils.SleepCheck("eul") && _menuValue.IsEnabled("item_sheepstick"))
                    {
                        Hex.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "hex");
                    }
                    else if (W != null && W.CanBeCasted() && Utils.SleepCheck("w") &&
                             (modifEul != null && modifEul.RemainingTime <= W.GetCastDelay(_me, _target, true) + 0.5 ||
                              modifHex != null && modifHex.RemainingTime <= W.GetCastDelay(_me, _target, true) + 0.5 ||
                              (Hex == null || !_menuValue.IsEnabled("item_sheepstick") || Hex.Cooldown > 0) &&
                              (Eul == null || !_menuValue.IsEnabled("item_cyclone") || Eul.Cooldown < 20 && Eul.Cooldown > 0)))
                    {
                        W.UseAbility(W.GetPrediction(_target, W.GetCastDelay(_me, _target)));
                        Utils.Sleep(150 + Game.Ping, "w");
                    }
                    else if (Q != null && Q.CanBeCasted() && Utils.SleepCheck("q") &&
                             modifEul == null)
                    {
                        Q.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "q");
                    }
                    else if (R != null && R.CanBeCasted() && Utils.SleepCheck("r") &&
                             modifEul == null)
                    {
                        R.UseAbility(_target);
                        Utils.Sleep(150 + Game.Ping, "r");
                    }
                    else if (!_me.IsChanneling() && NothingCanCast() &&
                             !_target.IsAttackImmune() && Utils.SleepCheck("attack"))
                    {
                        _me.Attack(_target);
                        Utils.Sleep(1000 + Game.Ping, "attack");
                    }
                }
            }
        }
示例#13
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused || Game.IsWatchingGame)
            {
                return;
            }

            me = ObjectManager.LocalHero;
            if (me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Clinkz)
            {
                return;
            }

            if (strafe == null)
            {
                strafe = me.Spellbook.SpellQ;
            }

            if (arrows == null)
            {
                arrows = me.Spellbook.SpellW;
            }

            if (dpAbility == null)
            {
                dpAbility = me.Spellbook.SpellR;
            }

            if (bkb == null)
            {
                bkb = me.FindItem("item_black_king_bar");
            }

            if (hex == null)
            {
                hex = me.FindItem("item_sheepstick");
            }

            if (orchid == null)
            {
                orchid = me.FindItem("item_orchid");
            }

            if (bloodthorn == null)
            {
                bloodthorn = me.FindItem("item_bloodthorn");
            }

            if (medallion == null)
            {
                medallion = me.FindItem("item_medallion_of_courage");
            }

            if (bladeMail == null)
            {
                bladeMail = me.FindItem("item_blade_mail");
            }

            if (solar == null)
            {
                solar = me.FindItem("item_solar_crest");
            }

            if (powerTreads == null)
            {
                powerTreads = me.FindItem("item_power_treads") as PowerTreads;
            }

            dragonLance = me.HasModifier("modifier_item_dragon_lance");

            attackRange = dragonLance ? 760 : 630;


            if (!itemTogglerSet)
            {
                itemToggler    = Menu.Item("Items").GetValue <AbilityToggler>();
                itemTogglerSet = true;
            }

            if (!menuSkillSet)
            {
                skillToggler = Menu.Item("Skills").GetValue <AbilityToggler>();
                menuSkillSet = true;
            }

            ultBool = dpAbility != null && skillToggler.IsEnabled("clinkz_death_pact");

            const int DPrange = 0x190;

            if (powerTreads != null)
            {
                lastAttribute = powerTreads.ActiveAttribute;
            }


            var creepR =
                ObjectManager.GetEntities <Unit>()
                .Where(
                    creep =>
                    (creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane ||
                     creep.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral) &&
                    creep.IsAlive && creep.IsVisible && creep.IsSpawned &&
                    creep.Team != me.Team && creep.Position.Distance2D(me.Position) <= DPrange &&
                    me.Spellbook.SpellR.CanBeCasted()).ToList();

            var enemies = ObjectManager.GetEntities <Hero>().Where(x => x.IsAlive && x.Team != me.Team && !x.IsIllusion).ToList();


            if (autoKillz && Menu.Item("enable").GetValue <bool>())
            {
                target = me.ClosestToMouseTarget(1001);

                //orbwalk
                if (target != null && (!target.IsValid || !target.IsVisible || !target.IsAlive || target.Health <= 0))
                {
                    target = null;
                }
                var canCancel = Orbwalking.CanCancelAnimation();
                if (canCancel)
                {
                    if (target != null && !target.IsVisible && !Orbwalking.AttackOnCooldown(target))
                    {
                        target = me.ClosestToMouseTarget();
                    }
                    else if (target == null || !Orbwalking.AttackOnCooldown(target) && target.HasModifiers(new[]
                    {
                        "modifier_dazzle_shallow_grave", "modifier_item_blade_mail_reflect",
                    }, false))
                    {
                        var bestAa = me.BestAATarget();
                        if (bestAa != null)
                        {
                            target = me.BestAATarget();
                        }
                    }
                }

                if (target != null && target.IsAlive && !target.IsInvul() && !target.IsIllusion)
                {
                    if (me.CanAttack() && me.CanCast() && !me.IsChanneling())
                    {
                        TargetDistance = me.Position.Distance2D(target);

                        if (Menu.Item("orbwalk").GetValue <bool>())
                        {
                            if (!Utils.SleepCheck("attacking"))
                            {
                                if (lastAttribute != Attribute.Agility && Utils.SleepCheck("powerTreadsSwitch"))
                                {
                                    SwitchTo(Attribute.Agility);
                                    Utils.Sleep(400, "powerTreadsSwitch");
                                }
                            }
                            Orbwalking.Orbwalk(target, Game.Ping, attackmodifiers: true);
                            Utils.Sleep(400, "attacking");
                        }
                        else if (!Menu.Item("orbwalk").GetValue <bool>())
                        {
                            if (arrows != null && arrows.IsValid && arrows.CanBeCasted() && !Utils.SleepCheck("attacking"))
                            {
                                arrows.UseAbility(target);
                            }
                            Utils.Sleep(200, "attacking");
                        }

                        if (creepR.Count > 0 && !me.Modifiers.ToList().Exists(x => x.Name == "modifier_clinkz_death_pact") && skillToggler.IsEnabled(dpAbility.Name))
                        {
                            var creepmax = creepR.MaxOrDefault(x => x.Health);
                            if (lastAttribute != Attribute.Intelligence && Utils.SleepCheck("powerTreadsSwitch"))
                            {
                                SwitchTo(Attribute.Intelligence);
                                Utils.Sleep(400, "powerTreadsSwitch");
                            }
                            dpAbility.UseAbility(creepmax);
                        }

                        if (strafe != null && strafe.IsValid && strafe.CanBeCasted() && me.CanCast() && me.Distance2D(target) <= attackRange + 90 && Utils.SleepCheck("strafe") && skillToggler.IsEnabled(strafe.Name))
                        {
                            if (lastAttribute != Attribute.Intelligence && Utils.SleepCheck("powerTreadsSwitch"))
                            {
                                SwitchTo(Attribute.Intelligence);
                                Utils.Sleep(400, "powerTreadsSwitch");
                            }
                            strafe.UseAbility();
                            Utils.Sleep(100 + Game.Ping, "strafe");
                        }

                        if (bladeMail != null && bladeMail.IsValid && Utils.SleepCheck("blademail") && itemToggler.IsEnabled(bladeMail.Name) && me.Distance2D(target) <= attackRange + 90)
                        {
                            bladeMail.UseAbility();
                            Utils.Sleep(50 + Game.Ping, "blademail");
                        }

                        if (medallion != null && medallion.IsValid && medallion.CanBeCasted() && Utils.SleepCheck("medallion") && itemToggler.IsEnabled(medallion.Name) && me.Distance2D(target) <= attackRange + 90)
                        {
                            medallion.UseAbility(target);
                            Utils.Sleep(50 + Game.Ping, "medallion");
                        }

                        if (solar != null && solar.IsValid && solar.CanBeCasted() && Utils.SleepCheck("solar") && itemToggler.IsEnabled(solar.Name))
                        {
                            solar.UseAbility(target);
                            Utils.Sleep(50 + Game.Ping, "solar");
                        }


                        if (bkb != null && bkb.IsValid && bkb.CanBeCasted() && Utils.SleepCheck("bkb") && itemToggler.IsEnabled(bkb.Name) && (enemies.Count(x => x.Distance2D(me) <= 650) >= (Menu.Item("bkblogic").GetValue <Slider>().Value)))
                        {
                            bkb.UseAbility();
                            Utils.Sleep(150 + Game.Ping, "bkb");
                        }

                        if (hex != null && hex.IsValid && hex.CanBeCasted() && Utils.SleepCheck("hex") && itemToggler.IsEnabled(hex.Name))
                        {
                            hex.CastStun(target);
                            Utils.Sleep(250 + Game.Ping, "hex");
                            return;
                        }

                        if (orchid != null && orchid.IsValid && orchid.CanBeCasted() && Utils.SleepCheck("orchid") && itemToggler.IsEnabled(orchid.Name))
                        {
                            orchid.CastStun(target);
                            Utils.Sleep(250 + Game.Ping, "orchid");
                            return;
                        }

                        if (bloodthorn != null && bloodthorn.IsValid && bloodthorn.CanBeCasted() && Utils.SleepCheck("bloodthorn") && itemToggler.IsEnabled(bloodthorn.Name))
                        {
                            bloodthorn.CastStun(target);
                            Utils.Sleep(250 + Game.Ping, "orchid");
                            return;
                        }

                        if (!me.IsAttacking() && me.Distance2D(target) >= attackRange && Utils.SleepCheck("follow"))
                        {
                            me.Move(Game.MousePosition);
                            Utils.Sleep(150 + Game.Ping, "follow");
                        }
                    }
                }
                else
                {
                    me.Move(Game.MousePosition);
                }
            }
        }//gameOnUpdate Close.
示例#14
0
        private async Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                if (Game.IsPaused)
                {
                    return;
                }

                var Heroes = EntityManager <Hero> .Entities.Where(
                    x =>
                    !x.IsIllusion &&
                    x.IsValid &&
                    x.IsAlive &&
                    x.IsControllable &&
                    x != Owner &&
                    Owner.IsAlly(x));


                var Target = Config.UpdateMode.Target;

                foreach (var Hero in Heroes.ToList())
                {
                    //Item Phase Boots
                    var PhaseBoots = Hero.GetItemById(AbilityId.item_phase_boots);
                    if (CanBeCasted(PhaseBoots, Hero) &&
                        !PhaseBoots.IsInAbilityPhase)
                    {
                        UseAbility(PhaseBoots, Hero);
                        await Await.Delay(GetDelay, token);
                    }

                    if (Target != null)
                    {
                        if (Hero.Distance2D(Target) > Config.RadiusTargetUnitsItem)
                        {
                            continue;
                        }

                        if (!Target.IsInvulnerable() && !Target.HasModifier("modifier_winter_wyvern_winters_curse") && !Hero.IsChanneling())
                        {
                            if (!Target.IsMagicImmune())
                            {
                                var Abilities = Hero.Spellbook.Spells.Where(
                                    x =>
                                    !x.AbilityBehavior.HasFlag(AbilityBehavior.Passive) &&
                                    !x.AbilityBehavior.HasFlag(AbilityBehavior.Hidden));

                                foreach (var Ability in Abilities.ToList())
                                {
                                    // Spell Q, W, E, R, D
                                    if (Ability != null &&
                                        AbilityToggler.Any(x => x.IsEnabled(Ability.Name)) &&
                                        CanBeCasted(Ability, Hero) &&
                                        !Ability.IsInAbilityPhase &&
                                        Hero.Distance2D(Target) < CastRange.FirstOrDefault(x => x.Name == Ability.Name).GetValue <Slider>())
                                    {
                                        if (Ability.AbilityBehavior.HasFlag(AbilityBehavior.UnitTarget))
                                        {
                                            UseAbility(Ability, Hero, Target);
                                            await Await.Delay(GetDelay, token);
                                        }
                                        else if (Ability.AbilityBehavior.HasFlag(AbilityBehavior.Point))
                                        {
                                            UseAbility(Ability, Hero, Target.Position);
                                            await Await.Delay(GetDelay, token);
                                        }
                                        else if (Ability.AbilityBehavior.HasFlag(AbilityBehavior.Toggle))
                                        {
                                            if (Ability.IsToggled)
                                            {
                                                continue;
                                            }

                                            Ability.ToggleAbility();
                                            await Await.Delay(GetDelay, token);
                                        }
                                        else if (Ability.AbilityBehavior.HasFlag(AbilityBehavior.NoTarget))
                                        {
                                            UseAbility(Ability, Hero);
                                            await Await.Delay(GetDelay, token);
                                        }
                                    }
                                }

                                //Item Medallion Of Courage
                                var MedallionOfCourage = Hero.GetItemById(AbilityId.item_medallion_of_courage);
                                if (CanBeCasted(MedallionOfCourage, Hero) &&
                                    CanHit(MedallionOfCourage, Hero, Target) &&
                                    !MedallionOfCourage.IsInAbilityPhase)
                                {
                                    UseAbility(MedallionOfCourage, Hero, Target);
                                    await Await.Delay(GetDelay, token);
                                }

                                //Item Solar Crest
                                var SolarCrest = Hero.GetItemById(AbilityId.item_solar_crest);
                                if (CanBeCasted(SolarCrest, Hero) &&
                                    CanHit(SolarCrest, Hero, Target) &&
                                    !SolarCrest.IsInAbilityPhase)
                                {
                                    UseAbility(SolarCrest, Hero, Target);
                                    await Await.Delay(GetDelay, token);
                                }
                            }

                            //Item Abyssal Blade
                            var AbyssalBlade = Hero.GetItemById(AbilityId.item_abyssal_blade);
                            if (CanBeCasted(AbyssalBlade, Hero) &&
                                CanHit(AbyssalBlade, Hero, Target) &&
                                !AbyssalBlade.IsInAbilityPhase)
                            {
                                UseAbility(AbyssalBlade, Hero, Target);
                                await Await.Delay(GetDelay, token);
                            }

                            //Item Mjollnir
                            var Mjollnir = Hero.GetItemById(AbilityId.item_mjollnir);
                            if (CanBeCasted(Mjollnir, Hero) &&
                                Hero.Distance2D(Target) < 500 &&
                                !Mjollnir.IsInAbilityPhase)
                            {
                                UseAbility(Mjollnir, Hero, Hero);
                                await Await.Delay(GetDelay, token);
                            }

                            //Item Mask Of Madness
                            var MaskOfMadness = Hero.GetItemById(AbilityId.item_mask_of_madness);
                            if (CanBeCasted(MaskOfMadness, Hero) &&
                                Hero.Distance2D(Target) < 1000 &&
                                !MaskOfMadness.IsInAbilityPhase)
                            {
                                UseAbility(MaskOfMadness, Hero);
                                await Await.Delay(GetDelay, token);
                            }
                        }

                        if (Target.IsInvulnerable() || Target.IsAttackImmune() || !Hero.CanAttack())
                        {
                            Move(Hero, Target);
                        }
                        else
                        {
                            Attack(Hero, Target);
                        }
                    }
                    else
                    {
                        if (Hero.Distance2D(Owner) > 2000)
                        {
                            continue;
                        }

                        switch (Config.WithoutTargetItem.Value.SelectedIndex)
                        {
                        case 0:
                            Move(Hero, Game.MousePosition);
                            break;

                        case 1:
                            Follow(Hero, Owner);
                            break;
                        }
                    }
                }
            }
            catch (TaskCanceledException)
            {
                // canceled
            }
            catch (Exception e)
            {
                Config.Main.Log.Error(e);
            }
        }
示例#15
0
文件: Program.cs 项目: Lat0ur/Ensage-
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!_isloaded)
            {
                _me = ObjectManager.LocalHero;
                if (!Game.IsInGame || _me == null)
                {
                    return;
                }
                if (_me.Team == Team.Dire)
                {
                    foreach (var creepWave in CreepWaves)
                    {
                        creepWave.Coords.Reverse();
                    }
                }
                _isloaded = true;
            }

            if (_me == null || !_me.IsValid)
            {
                _isloaded = false;
                _me       = ObjectManager.LocalHero;
                return;
            }


            if (_me.ClassID != ClassID.CDOTA_Unit_Hero_Naga_Siren || Game.IsPaused || Game.IsChatOpen)
            {
                return;
            }

            var stackKey = Menu.Item("Stack").GetValue <KeyBind>().Active;
            var linePush = Menu.Item("LinePush").GetValue <KeyBind>().Active;
            var farmJ    = Menu.Item("FarmJ").GetValue <KeyBind>().Active;

            _menuValue = Menu.Item("enabledAbilities").GetValue <AbilityToggler>();
            Q          = _me.Spellbook.Spell1;
            E          = _me.Spellbook.Spell3;
            var eRadius       = E.GetCastRange() - 30;
            var movementspeed = _me.MovementSpeed;

            radiance = _me.FindItem("item_radiance");
            manta    = _me.FindItem("item_manta");
            travels  = _me.Inventory.Items.FirstOrDefault(item => item.Name.Contains("item_travel_boots"));
            octa     = _me.FindItem("item_octarine_core");

            _illusions =
                ObjectManager.GetEntities <Hero>()
                .Where(
                    x =>
                    x.ClassID == ClassID.CDOTA_Unit_Hero_Naga_Siren && x.IsIllusion && x.IsVisible && x.IsAlive &&
                    x.Team == _me.Team)
                .ToList();

            var seconds = ((int)Game.GameTime) % 60;

            if (JungleCamps.FindAll(x => x.Illusion != null).Count != _illusions.Count || seconds == 1)
            {
                foreach (var camp in JungleCamps)
                {
                    camp.Illusion = null;
                    camp.Stacking = false;
                    camp.Farming  = false;
                    camp.State    = 0;
                }
            }
            if (seconds == 0)
            {
                foreach (var camp in JungleCamps)
                {
                    camp.Illusion = null;
                    camp.Stacking = false;
                    camp.Farming  = false;
                    camp.Empty    = false;
                    camp.State    = 0;
                }
            }

            #region linepush

            if (linePush && Utils.SleepCheck("linePush"))
            {
                try
                {
                    var creeps =
                        ObjectManager.GetEntities <Unit>()
                        .Where(
                            x =>
                            x.IsAlive && x.IsVisible && x.Team != _me.Team &&
                            (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane ||
                             x.ClassID == ClassID.CDOTA_BaseNPC_Creep ||
                             x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Neutral ||
                             x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege
                            ))
                        .OrderByDescending(x => x.Distance2D(new Vector3(0, 0, 0))).ToList();

                    var creepdel = new List <Unit>();
                    foreach (var creepWave in CreepWaves)
                    {
                        creepdel.AddRange(creepWave.Creeps.Where(creep => creeps.All(x => x.Handle != creep.Handle)));
                        foreach (var creep in creepdel)
                        {
                            creepWave.Creeps.Remove(creep);
                        }
                    }

                    foreach (var creep in creeps)
                    {
                        float[] distance = { float.MaxValue };
                        var     name     = "";
                        foreach (var creepWave in CreepWaves)
                        {
                            foreach (var pos in creepWave.Coords.Where(pos => distance[0] > pos.Distance2D(creep)))
                            {
                                name        = creepWave.Name;
                                distance[0] = pos.Distance2D(creep);
                            }
                        }
                        if (CreepWaves.Any(x => x.Name == name && !x.Creeps.Contains(creep)))
                        {
                            CreepWaves.First(x => x.Name == name && !x.Creeps.Contains(creep)).Creeps.Add(creep);
                        }
                    }

                    foreach (var creepWave in CreepWaves)
                    {
                        if (creepWave.Creeps.Count > 0)
                        {
                            creepWave.Position = new Vector3(
                                creepWave.Creeps.Average(x => x.Position.X),
                                creepWave.Creeps.Average(x => x.Position.Y),
                                creepWave.Creeps.Average(x => x.Position.Z));
                        }
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine("Error LinePush" + e);
                }
                //try
                //{
                //    if (Utils.SleepCheck("Print"))
                //    {
                //        Console.WriteLine("----------------------------------------");
                //        foreach (var creepWave in CreepWaves)
                //        {
                //            Console.WriteLine("illusion {0} , Position {1} , Count {2}", creepWave.Illusion.Handle,
                //                creepWave.Position, creepWave.Creeps.Count);
                //            //foreach (var creep in creepWave.Creeps)
                //            //    Console.WriteLine(creep.Handle);
                //        }
                //        Utils.Sleep(1000, "Print");
                //    }
                //}
                //catch (Exception e)
                //{
                //    Console.WriteLine("Error LinePush 3");
                //}

                if (_illusions.Count > 0)
                {
                    try
                    {
                        foreach (var illusion in _illusions)
                        {
                            if (!CreepWaves.Any(x => x.Illusion != null && x.Illusion.Handle == illusion.Handle) &&
                                CreepWaves.Count(x => x.Illusion == null) > 0)
                            {
                                CreepWaves.First(x => x.Illusion == null).Illusion = illusion;
                            }
                        }
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Error LinePush 4");
                    }
                    try
                    {
                        foreach (var creepWave in CreepWaves.Where(x => x.Illusion != null))
                        {
                            if (GetClosestCreep(creepWave) != null)
                            {
                                if (creepWave.Illusion.Distance2D(GetClosestWave(creepWave)) < 300 ||
                                    creepWave.Illusion.Distance2D(creepWave.Position) < 1000)
                                {
                                    creepWave.Illusion.Attack(GetClosestCreep(creepWave));
                                }
                                else
                                {
                                    creepWave.Illusion.Move(creepWave.Position);
                                }
                            }
                            else
                            {
                                if (creepWave.Illusion.Distance2D(GetClosestWave(creepWave)) > 100)
                                {
                                    creepWave.Illusion.Move(GetClosestWave(creepWave));
                                    creepWave.Position = GetNextWave(creepWave);
                                }
                                else
                                {
                                    creepWave.Illusion.Move(GetNextWave(creepWave));
                                    creepWave.Position = GetNextWave(creepWave);
                                }
                            }

                            if (creepWave.Illusion.Modifiers.Any(
                                    m => m.Name == "modifier_kill" && Math.Abs(m.Duration - m.ElapsedTime - 1) < 0) ||
                                _illusions.All(x => x.Handle != creepWave.Illusion.Handle))
                            {
                                creepWave.Illusion = null;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error LinePush 5" + e);
                    }
                }
                Utils.Sleep(500, "linePush");
            }
            #endregion

            #region Stack

            else if (stackKey && _illusions.Count > 0 && Utils.SleepCheck("wait"))
            {
                foreach (var illusion in _illusions)
                {
                    if (!Check(illusion))
                    {
                        JungleCamps.Find(x => x.Id == GetClosestCamp(illusion, true, false).Id).Illusion = illusion;
                        JungleCamps.Find(x => x.Id == GetClosestCamp(illusion, true, false).Id).Stacking = true;
                    }
                    else
                    {
                        var illusionCamps = Checkillusion(illusion);
                        switch (illusionCamps.State)
                        {
                        case 0:
                            if (illusion.Distance2D(illusionCamps.WaitPosition) < 5)
                            {
                                illusionCamps.State = 1;
                            }
                            else
                            {
                                illusion.Move(illusionCamps.WaitPosition);
                            }
                            Utils.Sleep(500, "wait");
                            break;

                        case 1:
                            _creepscount = CreepCount(illusionCamps.Illusion, 800);
                            if (_creepscount == 0)
                            {
                                JungleCamps.Find(x => x.Id == illusionCamps.Id).Illusion = null;
                                JungleCamps.Find(x => x.Id == illusionCamps.Id).Empty    = true;
                                JungleCamps.Find(x => x.Id == illusionCamps.Id).Stacking = false;
                                JungleCamps.Find(x => x.Id == GetClosestCamp(illusion, true, false).Id).Illusion =
                                    illusion;
                                JungleCamps.Find(x => x.Id == GetClosestCamp(illusion, true, false).Id).Stacking =
                                    true;
                            }
                            else if (seconds >= illusionCamps.Starttime - 5)
                            {
                                _closestNeutral = GetNearestCreepToPull(illusionCamps.Illusion, 800);
                                _stackPosition  = illusionCamps.StackPosition;
                                var moveTime = illusionCamps.Starttime -
                                               (GetDistance2D(illusionCamps.Illusion.Position,
                                                              _closestNeutral.Position) +
                                                (_closestNeutral.IsRanged
                                                        ? _closestNeutral.AttackRange
                                                        : _closestNeutral.RingRadius)) / movementspeed;
                                illusionCamps.AttackTime = (int)moveTime;
                                illusionCamps.State      = 2;
                            }
                            Utils.Sleep(500, "wait");
                            break;

                        case 2:
                            if (seconds >= illusionCamps.AttackTime)
                            {
                                _closestNeutral = GetNearestCreepToPull(illusionCamps.Illusion, 1200);
                                _stackPosition  = GetClosestCamp(illusionCamps.Illusion, true, false).StackPosition;
                                illusionCamps.Illusion.Attack(_closestNeutral);
                                illusionCamps.State = 3;
                                var tWait =
                                    (int)
                                    (((GetDistance2D(illusionCamps.Illusion.Position, _closestNeutral.Position)) /
                                      movementspeed) * 1000 + Game.Ping);
                                Utils.Sleep(tWait, "" + illusionCamps.Illusion.Handle);
                            }
                            break;

                        case 3:
                            if (Utils.SleepCheck("" + illusionCamps.Illusion.Handle))
                            {
                                if (_menuValue.IsEnabled(E.Name) && E.CanBeCasted() &&
                                    Creepcountall(eRadius) > Creepcountall(600) / 2)
                                {
                                    E.UseAbility();
                                }
                                illusionCamps.Illusion.Move(illusionCamps.StackPosition);
                                illusionCamps.State = 4;
                            }
                            break;

                        case 4:
                            illusion.Move(illusionCamps.StackPosition);
                            Utils.Sleep(1000, "wait");
                            break;

                        default:
                            illusionCamps.State = 0;
                            break;
                        }
                    }
                }
            }
            #endregion Stack or farm

            #region Farm

            else if (farmJ && _illusions.Count > 0 && Utils.SleepCheck("farm"))
            {
                foreach (var illusion in _illusions)
                {
                    if (!Check(illusion))
                    {
                        JungleCamps.Find(x => x.Id == GetClosestCamp(illusion, false, false).Id).Illusion = illusion;
                        JungleCamps.Find(x => x.Id == GetClosestCamp(illusion, false, false).Id).Farming  = true;
                    }
                    else
                    {
                        var illusionCamps = Checkillusion(illusion);
                        if (illusion.Distance2D(illusionCamps.Position) > 100)
                        {
                            illusion.Move(illusionCamps.Position);
                        }
                        else
                        {
                            if (E.CanBeCasted() && _menuValue.IsEnabled(E.Name) &&
                                Creepcountall(eRadius) >= Creepcountall(600) / 2)
                            {
                                E.UseAbility();
                            }
                            illusion.Attack(GetNearestCreepToPull(illusionCamps.Illusion, 500));
                        }
                    }
                }
                Utils.Sleep(1000, "farm");
            }

            #endregion Farm
        }