Example #1
0
        private static void Game_OnIngameUpdate(EventArgs args)
        {
            if (sleeper.Sleeping)
            {
                return;
            }
            sleeper.Sleep(1000);

            var dcedAlly = Heroes.GetByTeam(heroTeam).Any(x => x.Player == null);

            if (Game.IsPaused)
            {
                if (Menu.Item("enabledUnpause").GetValue <bool>() &&
                    (Menu.Item("ignoreAlly").GetValue <bool>() || !dcedAlly))
                {
                    Game.ExecuteCommand("dota_pause");

                    //prevent const interval console spam, just in case...
                    sleeper.Sleep(Random.Next(1111, 1222));
                }
            }
            else if (dcedAlly && Menu.Item("enabledPause").GetValue <bool>() && !Menu.Item("ignoreAlly").GetValue <bool>())
            {
                Game.ExecuteCommand("dota_pause");

                //prevent const interval console spam, just in case...
                sleeper.Sleep(Random.Next(3333, 4444));
            }
        }
Example #2
0
        /// <summary>
        ///     The is being attacked.
        /// </summary>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public float IsBeingAttacked()
        {
            if (this.creep == null || !this.creep.IsValid)
            {
                return(0);
            }

            return
                (Creeps.All.Count(
                     x =>
                     x.IsValid && !x.Equals(this.creep) && x.Team != this.creep.Team && x.Distance2D(this.me) < 1000 &&
                     x.Distance2D(this.creep) < x.AttackRange &&
                     Math.Max(
                         Math.Abs(x.FindAngleR() - Utils.DegreeToRadian(x.FindAngleForTurnTime(this.creep.Position)))
                         - 20,
                         0) <= 0.09 && x.IsAttacking())
                 + Heroes.GetByTeam(this.creep.GetEnemyTeam())
                 .Count(
                     x =>
                     x.Distance2D(this.me) < 1000 && x.Distance2D(this.creep) < x.GetAttackRange() &&
                     Math.Max(
                         Math.Abs(
                             x.FindAngleR() - Utils.DegreeToRadian(x.FindAngleForTurnTime(this.creep.Position)))
                         - 20,
                         0) <= 0.09 && x.IsAttacking())
                 + ObjectManager.TrackingProjectiles.Count(x => x.Target != null && x.Target.Equals(this.creep)));
        }
Example #3
0
        /// <summary>
        ///     The get remote mine damage.
        /// </summary>
        /// <param name="level">
        ///     The level.
        /// </param>
        /// <param name="classId">
        ///     The class id.
        /// </param>
        /// <param name="creep">
        ///     The creep.
        /// </param>
        /// <returns>
        ///     The <see cref="float" />.
        /// </returns>
        public float GetRemoteMineDamage(uint level, ClassID classId, Unit creep = null)
        {
            Dictionary <ClassID, float> dictionary;

            if (!this.remoteMineDamageDictionary.TryGetValue(level, out dictionary))
            {
                var damage = Variables.Techies.AghanimState()
                                 ? Variables.RemoteMinesAbility.GetAbilityData("damage_scepter", level)
                                 : Variables.RemoteMinesAbility.GetAbilityData("damage", level);
                dictionary = Heroes.GetByTeam(Variables.EnemyTeam)
                             .ToDictionary(
                    hero => hero.ClassID,
                    hero => hero.DamageTaken(damage, DamageType.Magical, Variables.Techies));
            }

            if (!dictionary.ContainsKey(classId) &&
                (classId == ClassID.CDOTA_BaseNPC_Creep || classId == ClassID.CDOTA_BaseNPC_Creep_Lane ||
                 classId == ClassID.CDOTA_BaseNPC_Creep_Siege))
            {
                dictionary.Add(
                    classId,
                    creep.DamageTaken(this.currentRemoteMineDamage, DamageType.Magical, Variables.Techies));
            }

            return(!dictionary.ContainsKey(classId) ? 0 : dictionary[classId]);
        }
Example #4
0
        public static async void OnUpdate(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (!Members.MyHero.IsAlive)
            {
                return;
            }
            if (_attacker == null)
            {
                _attacker = new Sleeper();
            }
            if (_spellSleeper == null)
            {
                _spellSleeper = new MultiSleeper();
            }
            if (_ethereal == null)
            {
                _ethereal = new Sleeper();
            }
            if (_laser == null)
            {
                _laser = Abilities.FindAbility("tinker_laser");
            }
            if (_rockets == null)
            {
                _rockets = Abilities.FindAbility("tinker_heat_seeking_missile");
            }
            if (_spellSleeper.Sleeping(Abilities.FindAbility("tinker_rearm")))
            {
                return;
            }
            if (_testCombo != null && !_testCombo.IsCompleted)
            {
                return;
            }

            _tks       = new CancellationTokenSource();
            _testCombo = Action(_tks.Token);
            try
            {
                await _testCombo;
                _testCombo = null;
            }
            catch (OperationCanceledException)
            {
                _testCombo = null;
            }
            if (IsEnableKillSteal && !IsComboHero)
            {
                foreach (var x in Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                         .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune())
                         .Where(x => Helper.CalculateMyCurrentDamage(x, true) < 0))
                {
                    await DoTrash(x, CancellationToken.None, true);
                }
            }
        }
Example #5
0
        public override bool ShouldSpendGold()
        {
            if (Sleeper.Sleeping)
            {
                return(false);
            }

            if (!Menu.NearDeathEnabled || GoldLossOnDeath <= 20)
            {
                return(false);
            }

            if (!Utils.SleepCheck("GoldSpender.ForceSpend"))
            {
                return(true);
            }

            var distance = Menu.NearDeathEnemyDistance;

            return((Hero.Health <= Menu.NearDeathHpThreshold ||
                    (float)Hero.Health / Hero.MaximumHealth * 100 <= Menu.NearDeathHpPercentageThreshold) &&
                   (distance <= 0 ||
                    Heroes.GetByTeam(enemyTeam)
                    .Any(x => x.IsValid && !x.IsIllusion && x.IsAlive && x.Distance2D(Hero) <= distance)));
        }
Example #6
0
 private static void HandleHeroes(Entity player)
 {
     foreach (var hero in Heroes.GetByTeam(player.Team))
     {
         HandleEffect(hero);
     }
 }
Example #7
0
        private static void AutoTeaser(EventArgs args)
        {
            if (!IsEnableautoTether)
            {
                return;
            }
            if (TetherInCombo)
            {
                return;
            }
            var tether = Abilities.FindAbility("wisp_tether");

            if (tether == null || tether.Level == 0 || !tether.CanBeCasted() || tether.IsHidden)
            {
                return;
            }
            var anyPossibleAlly =
                Heroes.GetByTeam(Members.MyTeam)
                .FirstOrDefault(
                    x =>
                    x != null && Helper.IsHeroEnableForTether(x.StoredName()) &&
                    x.Distance2D(Members.MyHero) <= tether.GetCastRange());

            if (anyPossibleAlly == null)
            {
                return;
            }

            if (!_multiSleeper.Sleeping(tether))
            {
                tether.UseAbility(anyPossibleAlly);
                _multiSleeper.Sleep(500, tether);
            }
        }
Example #8
0
 /// <summary>
 ///     The highest health points target.
 /// </summary>
 /// <param name="source">
 ///     The source hero (LocalHero).
 /// </param>
 /// <param name="range">
 ///     The range.
 /// </param>
 /// <returns>
 ///     The <see cref="Hero" />.
 /// </returns>
 public static Hero HighestHealthPointsTarget(Unit source, float range)
 {
     return
         (Heroes.GetByTeam(source.GetEnemyTeam())
          .Where(hero => hero.IsValid && hero.IsAlive && hero.IsVisible && hero.Distance2D(source) <= range)
          .MaxOrDefault(hero => hero.Health));
 }
Example #9
0
        /// <summary>
        ///     The On Window Procedure Event
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        public void Game_OnWndProc(WndEventArgs args)
        {
            foreach (var module in Variables.Modules.Where(x => x.CanDraw()))
            {
                module.OnWndProc(args);
            }

            if (args.Msg != (ulong)Utils.WindowsMessages.WM_LBUTTONDOWN)
            {
                return;
            }

            foreach (var hero in
                     from play in Heroes.GetByTeam(Variables.EnemyTeam).Where(x => x.IsValid && !x.IsIllusion)
                     select play
                     into hero
                     let sizeX = (float)HUDInfo.GetTopPanelSizeX(hero)
                                 let x = HUDInfo.GetTopPanelPosition(hero).X
                                         let sizey = HUDInfo.GetTopPanelSizeY(hero) * 1.4
                                                     where Utils.IsUnderRectangle(Game.MouseScreenPosition, x, 0, sizeX, (float)(sizey * 1.4))
                                                     select hero)
            {
                bool enabled;
                if (this.EnabledHeroes.TryGetValue(hero.ClassID, out enabled))
                {
                    this.EnabledHeroes[hero.ClassID] = !enabled;
                }
            }
        }
Example #10
0
        public override bool ShouldSpendGold()
        {
            if (!Utils.SleepCheck("GoldSpender.NearDeath.AllBought"))
            {
                return(false);
            }

            var disableTime = Menu.NearDeathAutoDisableTime;

            if (!Menu.NearDeathEnabled || disableTime > 0 && Game.GameTime / 60 > disableTime || UnreliableGold < 20)
            {
                if (boughtItems.Any())
                {
                    boughtItems.Clear();
                }
                return(false);
            }

            var distance = Menu.NearDeathEnemyDistance;

            return((float)Hero.Health / Hero.MaximumHealth <= (float)Menu.NearDeathHpThreshold / 100 &&
                   (distance <= 0 ||
                    Heroes.GetByTeam(EnemyTeam)
                    .Any(x => !x.IsIllusion && x.IsAlive && x.Distance2D(Hero) <= distance)));
        }
Example #11
0
        /// <summary>
        ///     The get remote mine damage.
        /// </summary>
        /// <param name="level">
        ///     The level.
        /// </param>
        /// <param name="handle">
        ///     The handle.
        /// </param>
        /// <param name="creep">
        ///     The creep.
        /// </param>
        /// <returns>
        ///     The <see cref="float" />.
        /// </returns>
        public float GetRemoteMineDamage(uint level, uint handle, Unit creep = null)
        {
            Dictionary <uint, float> dictionary;

            if (!this.remoteMineDamageDictionary.TryGetValue(level, out dictionary))
            {
                var damage = Variables.Techies.AghanimState()
                                 ? Variables.RemoteMinesAbility.GetAbilityData("damage_scepter", level)
                                 : Variables.RemoteMinesAbility.GetAbilityData("damage", level);
                dictionary =
                    Heroes.GetByTeam(Variables.EnemyTeam)
                    .Where(x => x.IsValid && !x.IsIllusion)
                    .ToDictionary(
                        hero => hero.Handle,
                        hero => hero.DamageTaken(damage, DamageType.Magical, Variables.Techies));
            }

            if (!dictionary.ContainsKey(1) && creep != null)
            {
                handle = 1;
                dictionary.Add(
                    1,
                    creep.DamageTaken(this.CurrentRemoteMineDamage, DamageType.Magical, Variables.Techies));
            }

            return(!dictionary.ContainsKey(handle) ? 0 : dictionary[handle]);
        }
Example #12
0
 public void Execute()
 {
     if (!hasArmlet())
     {
         return;
     }
     this.armletToggler = new ArmletToggler(me.FindItem("item_armlet"));
     if (me.IsAttacking() && Heroes.GetByTeam(Variables.EnemyTeam)
         .Any(x => x.IsValid && x.IsAlive && x.IsVisible &&
              x.Distance2D(Variables.Hero) < x.GetAttackRange() + 200))
     {
         if (Utils.SleepCheck("TurnOn"))
         {
             armletToggler.TurnOn();
             Utils.Sleep(1000, "TurnOn");
         }
     }
     if (me.Health > thresholdHP)
     {
         return;
     }
     if (armletToggler.CanToggle)
     {
         if (Utils.SleepCheck("toggle"))
         {
             armletToggler.Toggle();
             Utils.Sleep(1000, "toggle");
         }
     }
 }
Example #13
0
        /// <summary>
        ///     The game_ on update.
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        private void Game_OnUpdate(EventArgs args)
        {
            if (!Utils.SleepCheck("Techies.Damage.Update"))
            {
                return;
            }

            if (!Game.IsInGame || Game.IsPaused || Variables.Techies == null || !Variables.Techies.IsValid)
            {
                return;
            }

            this.currentRemoteMineDamage = Variables.Techies.AghanimState()
                                               ? Variables.RemoteMinesAbility.GetAbilityData("damage_scepter")
                                               : Variables.RemoteMinesAbility.GetAbilityData("damage");
            this.currentLandMineDamage   = Variables.LandMinesAbility.GetAbilityData("damage");
            this.suicideDamageDictionary = Heroes.GetByTeam(Variables.EnemyTeam)
                                           .ToDictionary(
                hero => hero.ClassID,
                hero =>
                hero.DamageTaken(
                    Variables.SuicideAbility.GetAbilityData("damage"),
                    DamageType.Physical,
                    Variables.Techies));
            var level = Variables.LandMinesAbility.Level;

            if (!this.landMineDamageDictionary.ContainsKey(level))
            {
                var damage = Heroes.GetByTeam(Variables.EnemyTeam)
                             .ToDictionary(
                    hero => hero.ClassID,
                    hero => hero.DamageTaken(this.currentLandMineDamage, DamageType.Physical, Variables.Techies));
                this.landMineDamageDictionary.Add(level, damage);
                return;
            }

            this.landMineDamageDictionary[level] =
                Heroes.GetByTeam(Variables.EnemyTeam)
                .ToDictionary(
                    hero => hero.ClassID,
                    hero => hero.DamageTaken(this.currentLandMineDamage, DamageType.Physical, Variables.Techies));
            Utils.Sleep(500, "Techies.Damage.Update");
            level = Variables.RemoteMinesAbility.Level;
            if (!this.remoteMineDamageDictionary.ContainsKey(level))
            {
                var damage = Heroes.GetByTeam(Variables.EnemyTeam)
                             .ToDictionary(
                    hero => hero.ClassID,
                    hero => hero.DamageTaken(this.currentRemoteMineDamage, DamageType.Magical, Variables.Techies));
                this.remoteMineDamageDictionary.Add(level, damage);
                return;
            }

            this.remoteMineDamageDictionary[level] =
                Heroes.GetByTeam(Variables.EnemyTeam)
                .ToDictionary(
                    hero => hero.ClassID,
                    hero => hero.DamageTaken(this.currentRemoteMineDamage, DamageType.Magical, Variables.Techies));
        }
Example #14
0
        public static Hero HighestInt(Hero source, float range = 1000)
        {
            var mousePosition = Game.MousePosition;

            return
                (Heroes.GetByTeam(source.GetEnemyTeam())
                 .Where(hero => hero.IsValid && hero.IsAlive && hero.IsVisible && hero.Distance2D(mousePosition) <= range)
                 .MaxOrDefault(hero => hero.Intelligence));
        }
Example #15
0
        /// <summary>
        ///     The drawing_ on draw.
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        public void Drawing_OnDraw(EventArgs args)
        {
            if (!Game.IsInGame || Game.IsPaused || Variables.Techies == null || !Variables.Techies.IsValid)
            {
                return;
            }

            foreach (var module in Variables.Modules.Where(module => module.CanDraw()))
            {
                module.Draw();
            }

            foreach (var hero in Heroes.GetByTeam(Variables.EnemyTeam).Where(x => x.IsValid && !x.IsIllusion))
            {
                var  classId = hero.ClassID;
                bool enabled;
                if (!this.EnabledHeroes.TryGetValue(classId, out enabled))
                {
                    this.EnabledHeroes[classId] = true;
                }

                var health = hero.Health;
                if (!hero.IsAlive)
                {
                    health = hero.MaximumHealth;
                }

                double[] topPanel;
                if (!this.heroTopPanel.TryGetValue(classId, out topPanel))
                {
                    topPanel    = new double[3];
                    topPanel[0] = HUDInfo.GetTopPanelSizeX(hero);
                    topPanel[1] = HUDInfo.GetTopPanelPosition(hero).X;
                    topPanel[2] = HUDInfo.GetTopPanelSizeY(hero) * 1.4;
                    this.heroTopPanel.Add(classId, topPanel);
                }

                var sizeX = topPanel[0];
                var x     = topPanel[1];
                var sizey = topPanel[2];
                var meepo = hero as Meepo;
                if ((meepo == null || meepo.WhichMeepo == 0) &&
                    Variables.Menu.DrawingsMenu.Item("drawTopPanel").GetValue <bool>())
                {
                    DrawingUtils.DrawRemoteMineNumber(hero.Handle, health, x, sizeX, sizey, enabled, hero);
                    DrawingUtils.DrawLandMineNumber(hero.Handle, health, x, sizey, enabled, hero);
                }

                if (!Variables.Damage.GetSuicideDamage().ContainsKey(hero.Handle))
                {
                    continue;
                }

                DrawingUtils.DrawSuicide(hero.Handle, health, x, sizey, sizeX, enabled, hero);
            }
        }
Example #16
0
        public static bool CanRockedHit(Hero globalTarget)
        {
            var allHeroes =
                Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                .Where(x => x.IsAlive && x.IsVisible && !x.IsMagicImmune())
                .OrderBy(y => y.Distance2D(Members.MyHero)).ToList();
            var range = allHeroes.GetRange(0, Math.Min(allHeroes.Count, Members.MyHero.AghanimState() ? 4 : 2));

            return(range.Contains(globalTarget));
        }
 /// <summary>
 ///     The highest health points target.
 /// </summary>
 /// <param name="source">
 ///     The source hero (LocalHero).
 /// </param>
 /// <param name="range">
 ///     The range.
 /// </param>
 /// <returns>
 ///     The <see cref="Hero" />.
 /// </returns>
 public static Hero HighestHealthPointsTarget(Unit source, float range)
 {
     return
         (Heroes.GetByTeam(source.GetEnemyTeam())
          .Where(
              hero =>
              hero.IsValid && hero.IsAlive && hero.IsVisible && hero.Distance2D(source) <= range &&
              !hero.IsInvul() && !hero.HasModifier("modifier_skeleton_king_reincarnation_scepter_active"))
          .MaxOrDefault(hero => hero.Health));
 }
Example #18
0
        public void Escaping(Meepo me, EarthBind earthBind, Poof poof, Hero _globalTarget)
        {
            var handle = me.Handle;
            //bool nh;
            //if (!Variables.NeedHeal.TryGetValue(handle, out nh))
            //    Variables.NeedHeal.Add(handle, false);
            var perc = me.Health / (float)me.MaximumHealth * 100;

            if (!me.HasModifiers(new[] { "modifier_fountain_aura", "modifier_fountain_aura_buff" }, false))
            {
                if (Utils.SleepCheck("move check" + handle))
                {
                    var anyEnemyHero =
                        Heroes.GetByTeam(me.GetEnemyTeam())
                        .FirstOrDefault(x => x.IsAlive && x.IsVisible && x.Distance2D(me) <= 800);
                    if (anyEnemyHero != null)
                    {
                        //var earthBind = Variables.earthBindList[handle];
                        if (earthBind != null && earthBind.CanBeCasted() && !anyEnemyHero.HasModifier("modifier_meepo_earthbind"))
                        {
                            earthBind.CastSpell(anyEnemyHero);
                        }
                    }
                    var anyAllyMeepoNearBase =
                        Variables.MeepoList.Where(
                            x =>
                            !Heroes.GetByTeam(me.GetEnemyTeam()).Any(y => y.Distance2D(x) <= 1500))
                        .OrderBy(z => z.Distance2D(Fountain.GetAllyFountain())).FirstOrDefault();
                    if (anyAllyMeepoNearBase == null)
                    {
                        me.Move(Fountain.GetAllyFountain().Position);
                    }
                    else
                    {
                        if (anyAllyMeepoNearBase == me)
                        {
                            me.Move(Fountain.GetAllyFountain().Position);
                        }
                        else
                        {
                            if (poof.CanBeCasted())
                            {
                                poof.Use(anyAllyMeepoNearBase.Position);
                            }
                            else
                            {
                                me.Move(Fountain.GetAllyFountain().Position);
                            }
                        }
                    }

                    Utils.Sleep(500, "move check" + handle);
                }
            }
        }
Example #19
0
        public static void OnUpdate(EventArgs args)
        {
            if (!MenuManager.AimIsActive || Updater.Sleeping || MenuManager.ComboIsActive)
            {
                return;
            }
            var target =
                Heroes.GetByTeam(Me.GetEnemyTeam())
                .FirstOrDefault(
                    x =>
                    x.IsAlive && x.IsVisible && x.IsValidRazeTarget() &&
                    (!MenuManager.AimKillStealOnly || WillDie(x)
                     /*AbilityDamage.CalculateDamage(Core.RazeLow, Core.Me, x) > x.Health + x.HealthRegeneration*/));

            if (target != null)
            {
                if (!KillStealer.Sleeping && Core.Razes.Any(x => x.CanBeCasted() && x.CanHit(target, x.GetAbilityDelay() + 50, false)) && !Core.Razes.Any(y => y.IsInAbilityPhase))
                {
                    /*var mePos = Me.Position;
                     * var targetPos = Prediction.PredictedXYZ(Target, 550);//Target.Position;
                     * var angle = Me.FindAngleBetween(targetPos, true);
                     * var point = new Vector3(
                     *  (float)
                     *      (mePos.X +
                     *       100 *
                     *       Math.Cos(angle)),
                     *  (float)
                     *      (mePos.Y +
                     *       100 *
                     *       Math.Sin(angle)),
                     *  Target.Position.Z);
                     * Me.Move(point);*/
                    Me.Attack(target);
                    KillStealer.Sleep(350);
                }
                if (Helper.RazeAimCaster(Core.RazeLow, target))
                {
                    Updater.Sleep(1000);
                }
                else if (Helper.RazeAimCaster(Core.RazeNormal, target))
                {
                    Updater.Sleep(1000);
                }
                else if (Helper.RazeAimCaster(Core.RazeHigh, target))
                {
                    Updater.Sleep(1000);
                }
            }
        }
Example #20
0
        public void PlayerExecution_Armlet(ExecuteOrderEventArgs args)
        {
            var spell = args.Ability;
            var manta = me.FindItem("item_manta");

            if (args.OrderId == OrderId.Ability)
            {
                if (args.Ability == manta)
                {
                    if (!hasArmlet())
                    {
                        return;
                    }
                    Update();
                    if (!manta.CanBeCasted())
                    {
                        return;
                    }
                    if (Variables.Hero.HasModifier("modifier_item_armlet_unholy_strength"))
                    {
                        return;
                    }
                    args.Process = false;
                    if (armletToggler.CanToggle)
                    {
                        if (Utils.SleepCheck("TurnOn"))
                        {
                            armletToggler.TurnOn();
                            spell.UseAbility();
                            Utils.Sleep(100, "TurnOn");
                        }
                        DelayAction.Add(500, () =>
                        {
                            if (!me.IsAttacking() &&
                                !Heroes.GetByTeam(Variables.EnemyTeam)
                                .Any(x => x.IsValid && x.IsAlive && x.IsVisible &&
                                     x.Distance2D(Variables.Hero) < x.GetAttackRange() + 200))
                            {
                                if (Utils.SleepCheck("TurnOff"))
                                {
                                    armletToggler.TurnOff();
                                    Utils.Sleep(100, "TurnOff");
                                }
                            }
                        });
                    }
                }
            }
        }
Example #21
0
        /// <summary>
        ///     The get land mine damage.
        /// </summary>
        /// <param name="level">
        ///     The level.
        /// </param>
        /// <param name="classId">
        ///     The class id.
        /// </param>
        /// <returns>
        ///     The <see cref="float" />.
        /// </returns>
        public float GetLandMineDamage(uint level, ClassID classId)
        {
            Dictionary <ClassID, float> dictionary;

            if (!this.landMineDamageDictionary.TryGetValue(level, out dictionary))
            {
                var damage = Variables.LandMinesAbility.GetAbilityData("damage", level);
                dictionary = Heroes.GetByTeam(Variables.EnemyTeam)
                             .ToDictionary(
                    hero => hero.ClassID,
                    hero => hero.DamageTaken(damage, DamageType.Physical, Variables.Techies));
            }

            return(!dictionary.ContainsKey(classId) ? 0 : dictionary[classId]);
        }
Example #22
0
        /// <summary>
        ///     The kill steal.
        /// </summary>
        /// <param name="minHealth">
        ///     The min Health.
        /// </param>
        /// <returns>
        ///     The <see cref="bool" />.
        /// </returns>
        public bool KillSteal(float minHealth)
        {
            foreach (var hero in
                     Heroes.GetByTeam(Variables.EnemyTeam)
                     .Where(
                         hero =>
                         hero.IsValid && hero.IsVisible && hero.IsAlive && this.CanUseOn(hero) && hero.Health > minHealth &&
                         AbilityDamage.CalculateDamage(this.ability, Variables.Hero, hero) >= hero.Health &&
                         hero.CanDie()))
            {
                this.UseOn(hero);
                return(true);
            }

            return(false);
        }
Example #23
0
        private static bool TryToHelpAllyHeroes(Hero v, IEnumerable <Item> myItems, IEnumerable <Ability> myAbilities)
        {
            var allyHeroes =
                Heroes.GetByTeam(Members.MyTeam)
                .Where(x => x != null && x.IsValid && !x.Equals(Me) && x.IsAlive && x.Distance2D(v) <= 1000 && (float)
                       Math.Max(Math.Abs(v.RotationRad - Utils.DegreeToRadian(v.FindAngleBetween(x.Position))) - 0.20, 0) == 0);

            foreach (var allyHero in from allyHero in allyHeroes let any = v.Spellbook.Spells.Any(
                         x =>
                         x.IsInAbilityPhase && x.IsDisable() &&
                         x.CanHit(allyHero) && x.CanBeCasted(allyHero)) where any select allyHero)
            {
                Log.Debug($"Help {allyHero.GetRealName()} from {v.GetRealName()}");
                TryToDisable(v, myItems, myAbilities);
            }
            return(false);
        }
Example #24
0
        public void StackJungle(Hero me)
        {
            var s = Utitilies.JungleCamps.FindClosestCampForStacking(me, Variables.MenuManager.StackJungleMenu.Item("JungleStack.TeamCheck").GetValue <bool>(),
                                                                     Variables.MenuManager.StackJungleMenu.Item("JungleStack.Ancient").GetValue <bool>());
            var enemyHeroes = Heroes.GetByTeam(me.GetEnemyTeam()).Where(x => x.IsAlive).ToList();
            var dist        = Variables.MenuManager.StackJungleMenu.Item("JungleStack.EscapeRange").GetValue <Slider>().Value;

            if (Variables.MenuManager.StackJungleMenu.Item("JungleStack.EscapeFromAnyEnemyHero").GetValue <bool>() &&
                enemyHeroes.Any(x => x.Distance2D(me) <= dist))     //escape from hero
            {
                var handle = me.Handle;
                Variables.OrderStates[handle] = Variables.OrderState.Escape;
                Variables.NeedHeal[handle]    = true;
            }
            if (s == null)
            {
                return;
            }
            s.stacking = me;
            var set          = Variables.MeepoSet.Find(x => Equals(x.Hero, me));
            var name         = set.Handle.ToString();
            var sec          = Game.GameTime % 60;
            var timeForStart = s.WaitPosition.Distance2D(s.CampPosition) / me.MovementSpeed;
            var time         = s.StackTime - timeForStart - sec;

            //Print("Current Time: [" + sec + "] Time For Travel: [" + timeForStart + "] TimeForStartMoving: [" + (time - sec) + "]");
            //Print(time.ToString());
            if (time >= 0.5)
            {
                if (Utils.SleepCheck("move_cd2" + name))
                {
                    me.Move(s.WaitPosition);
                    Utils.Sleep(250, "move_cd2" + name);
                }
            }
            else if (Utils.SleepCheck("move_cd" + name))
            {
                var pos = s.CampPosition;
                var ang = me.FindAngleBetween(pos, true);
                var p   = new Vector3((float)(pos.X - 80 * Math.Cos(ang)),
                                      (float)(pos.Y - 80 * Math.Sin(ang)), 0);
                me.Move(p);
                me.Move(s.StackPosition, true);
                Utils.Sleep((60 - s.StackTime) * 1000 + 8000, "move_cd" + name);
            }
        }
Example #25
0
        /// <summary>
        ///     The get land mine damage.
        /// </summary>
        /// <param name="level">
        ///     The level.
        /// </param>
        /// <param name="handle">
        ///     The handle.
        /// </param>
        /// <returns>
        ///     The <see cref="float" />.
        /// </returns>
        public float GetLandMineDamage(uint level, uint handle)
        {
            Dictionary <uint, float> dictionary;

            if (!this.landMineDamageDictionary.TryGetValue(level, out dictionary))
            {
                var damage = Variables.LandMinesAbility.GetAbilityData("damage", level);
                dictionary =
                    Heroes.GetByTeam(Variables.EnemyTeam)
                    .Where(x => x.IsValid && !x.IsIllusion)
                    .ToDictionary(
                        hero => hero.Handle,
                        hero => hero.DamageTaken(damage, DamageType.Physical, Variables.Techies));
            }

            return(!dictionary.ContainsKey(handle) ? 0 : dictionary[handle]);
        }
Example #26
0
        public static void Drawing(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (!IsDrawingEnable)
            {
                return;
            }
            var heroes =
                Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                .Where(x => x.IsVisible && x.IsAlive && x.HasModifier("modifier_earth_spirit_magnetize"))
                .ToList();

            foreach (var hero in heroes)
            {
                var pos = HUDInfo.GetHPbarPosition(hero);
                if (pos.IsZero)
                {
                    continue;
                }
                pos += new Vector2(ExtraPosX, ExtraPosY);
                var size = Size;
                var mod  = hero.FindModifier("modifier_earth_spirit_magnetize");
                if (mod == null || !mod.IsValid)
                {
                    continue;
                }
                var ultimateCd =
                    ((int)Math.Min(mod.RemainingTime + 1, 99)).ToString(CultureInfo.InvariantCulture);
                var textSize = Ensage.Drawing.MeasureText(ultimateCd, "Arial",
                                                          new Vector2((float)(size * .75), size / 2), FontFlags.AntiAlias);
                var textPos = pos;
                Ensage.Drawing.DrawRect(textPos - new Vector2(0, 0),
                                        new Vector2(textSize.X, textSize.Y),
                                        new Color(0, 0, 0, 200));
                Ensage.Drawing.DrawText(
                    ultimateCd,
                    textPos,
                    new Vector2(textSize.Y, 0),
                    Color.White,
                    FontFlags.AntiAlias | FontFlags.StrikeOut);
            }
        }
Example #27
0
        public static void OnUpdate(EventArgs args)
        {
            if (!MenuManager.IsEnable)
            {
                return;
            }
            var spellAmp = 0;//UnitExtensions.GetSpellAmplification(Me);

            foreach (var hero in Heroes.GetByTeam(EnemyTeam))
            {
                if (HeroSleeper.Sleeping(hero) || !hero.IsAlive || !hero.IsVisible || !hero.CanDie(MenuManager.CheckForAegis))
                {
                    continue;
                }
                var listForDetonation = new List <BombManager>();
                var heroHealth        = hero.Health + hero.HealthRegeneration;
                var reduction         = RemoteMine.GetDamageReduction(hero);
                foreach (var element in Bombs)
                {
                    if (element.IsRemoteMine && element.Active)
                    {
                        if (element.CanHit(hero))
                        {
                            //Printer.Print($"BombDelay: {element.GetBombDelay(hero)} MaxDelay: {MenuManager.GetBombDelay}");
                            if (MenuManager.IsEnableDelayBlow &&
                                !(element.GetBombDelay(hero) >= MenuManager.GetBombDelay))
                            {
                                continue;
                            }
                            heroHealth -= DamageHelpers.GetSpellDamage(element.Damage, spellAmp, reduction);
                            listForDetonation.Add(element);
                            if (heroHealth <= 0)
                            {
                                HeroSleeper.Sleep(300 + listForDetonation.Count * 30, hero);
                                foreach (var manager in listForDetonation)
                                {
                                    manager.Detonate();
                                }
                                break;
                            }
                        }
                    }
                }
            }
        }
Example #28
0
        private static void AutoSaver(EventArgs args)
        {
            if (!IsEnableAutoSaver)
            {
                return;
            }
            if (_fountain == null || !_fountain.IsValid)
            {
                _fountain = ObjectManager.GetEntities <Unit>()
                            .FirstOrDefault(
                    x => x != null && x.Team == ObjectManager.LocalHero.Team && x.ClassId == ClassId.CDOTA_Unit_Fountain);
                return;
            }
            var tether = Abilities.FindAbility("wisp_tether");

            if (tether == null || tether.Level == 0 || !tether.CanBeCasted() || tether.IsHidden)
            {
                return;
            }
            var relocate = Abilities.FindAbility("wisp_relocate");

            if (relocate == null || relocate.Level == 0 || !relocate.CanBeCasted())
            {
                return;
            }
            var anyPossibleAlly =
                Heroes.GetByTeam(Members.MyTeam)
                .FirstOrDefault(
                    x =>
                    x != null && x.IsValid && Helper.IsHeroEnableForRelocate(x.StoredName()) &&
                    Helper.CheckForPercents(x) &&
                    x.Distance2D(Members.MyHero) <= tether.CastRange);

            if (anyPossibleAlly == null)
            {
                return;
            }

            if (!_multiSleeper.Sleeping(relocate))
            {
                relocate.UseAbility(_fountain.Position);
                tether.UseAbility(anyPossibleAlly);
                _multiSleeper.Sleep(500, relocate);
            }
        }
Example #29
0
        public static async void Updater()
        {
            var printType = BadGuy.Config.Pinger.Type.Item.GetValue <StringList>().SelectedIndex == 0
                ? PingType.Danger
                : PingType.Normal;

            while (BadGuy.Config.Pinger.Enable)
            {
                foreach (var hero in Heroes.GetByTeam(ObjectManager.LocalHero.Team))
                {
                    if (BadGuy.Config.Pinger.Toggler.Value.IsEnabled(hero.StoredName()))
                    {
                        Network.MapPing(hero.Position.ToVector2(), printType);
                        await Task.Delay(BadGuy.Config.Pinger.Rate);
                    }
                }
                await Task.Delay(5);
            }
        }
Example #30
0
        public static void Drawing_OnDraw(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (_globalTarget != null && _globalTarget.IsValid)
            {
                Helper.HandleEffect(_globalTarget);
            }
            var closeToMouse = Helper.ClosestToMouse(Members.MyHero);

            if (DamageIndex == (int)DamageDrawing.OnlyForGlobalTarget && (closeToMouse == null || !closeToMouse.IsValid))
            {
                return;
            }
            var list = DamageIndex == (int)DamageDrawing.ForAll
                ? Heroes.GetByTeam(Members.MyHero.GetEnemyTeam())
                       .Where(x => x.IsAlive && x.IsVisible && !x.IsIllusion() && !x.IsMagicImmune()).ToList()
                : new List <Hero> {
                closeToMouse
            };

            foreach (var hero in list)
            {
                var pos = HUDInfo.GetHPbarPosition(hero);
                if (pos.IsZero)
                {
                    continue;
                }
                var size     = HUDInfo.GetHpBarSizeY();
                var text     = $"     {(int) Helper.CalculateMyCurrentDamage(hero)} ({(int) Helper.CalculateMyDamage(hero)})";
                var textSize = Drawing.MeasureText(text, "Arial",
                                                   new Vector2((float)(size * 1.5), 500), FontFlags.AntiAlias);
                var textPos = pos + new Vector2(HUDInfo.GetHPBarSizeX() + 4, 0);
                Drawing.DrawText(
                    text,
                    textPos,
                    new Vector2(textSize.Y, 0),
                    new Color(255, 255, 255, 255),
                    FontFlags.AntiAlias | FontFlags.StrikeOut);
            }
        }