Пример #1
0
        public async Task UseAbilities(UnitBase unitBase)
        {
            if (unitBase.Hero.IsInvisible() || unitBase.Hero.Modifiers.Any(x => x.Name.Contains("windwalk")))
            {
                return;
            }
            var flux          = unitBase.Flux;
            var magneticField = unitBase.MagneticField;
            var spark         = unitBase.Spark;

            if (!_multiSleeper.Sleeping(flux) && unitBase.AbilityChecker.IsAbilityEnabled(flux.GetAbilityId()) &&
                flux.CanBeCasted() && flux.CanHit(Core.Target))
            {
                if (Core.Target.IsLinkensProtected() || !MenuManager.SmartFlux || !EntityManager <Unit> .Entities.Any(
                        x =>
                        !x.Equals(Core.Target) && x.Team == Core.Target.Team && x.Name != "npc_dota_thinker" &&
                        x.IsAlive && x.IsVisible &&
                        Ensage.SDK.Extensions.EntityExtensions.Distance2D(x, Core.Target) <= 225))
                {
                    flux.UseAbility(Core.Target);
                    Printer.Both("Flux usages " + flux.GetAbilityDelay());
                    _multiSleeper.Sleep(500, flux);
                    await Task.Delay(flux.GetAbilityDelay(), Core.ComboToken.Token);
                }
            }
            var distance = unitBase.Hero.Distance2D(Core.Target);

            if (!_multiSleeper.Sleeping(magneticField) && magneticField != null &&
                unitBase.AbilityChecker.IsAbilityEnabled(magneticField.GetAbilityId()) && magneticField.CanBeCasted() &&
                !unitBase.Hero.HasModifier("modifier_arc_warden_magnetic_field") && distance <= 600 &&
                Core.Target.IsVisible)
            {
                if (!MenuManager.MagneticField && Core.Target.IsMelee)
                {
                    magneticField.UseAbility(Prediction.InFront(unitBase.Hero, -250));
                }
                else
                {
                    magneticField.UseAbility(Prediction.InFront(unitBase.Hero, 250));
                }
                _multiSleeper.Sleep(500, magneticField);
                Printer.Both("MagneticField usages");
                await Task.Delay(magneticField.GetAbilityDelay(), Core.ComboToken.Token);
            }
            if (!_multiSleeper.Sleeping(spark) && spark != null &&
                unitBase.AbilityChecker.IsAbilityEnabled(spark.GetAbilityId()) && spark.CanBeCasted() &&
                !Prediction.IsTurning(Core.Target) && unitBase.Hero.IsVisibleToEnemies)
            {
                if (UnitExtensions.IsInAttackRange(unitBase.Hero, Core.Target) && MenuManager.SmartSpark)
                {
                    return;
                }
                var delay       = spark.GetAbilityDelay();
                var predVector3 = Prediction.PredictedXYZ(Core.Target, 2000 + delay);
                spark.UseAbility(predVector3);
                _multiSleeper.Sleep(500, spark);
                Printer.Both("spark usages");
                await Task.Delay(spark.GetAbilityDelay(), Core.ComboToken.Token);
            }
        }
Пример #2
0
        private static void DrawForWr(Hero v)
        {
            if (Prediction.IsTurning(v))
            {
                return;
            }
            var spell = v.Spellbook.Spell2;

            if (spell == null || spell.Cooldown == 0)
            {
                return;
            }
            var cd = Math.Floor(spell.Cooldown * 100);

            if (!(cd < 880))
            {
                return;
            }
            if (!InSys.Contains(v))
            {
                if (cd > 720)
                {
                    var eff = new ParticleEffect[148];
                    for (var z = 1; z <= 26; z++)
                    {
                        var p = new Vector3(
                            v.Position.X + 100 * z * (float)Math.Cos(v.RotationRad),
                            v.Position.Y + 100 * z * (float)Math.Sin(v.RotationRad),
                            100);
                        eff[z] =
                            new ParticleEffect(
                                @"particles\ui_mouseactions\draw_commentator.vpcf",
                                p);
                        eff[z].SetControlPoint(1,
                                               new Vector3(Members.Menu.Item("wr.Red").GetValue <Slider>().Value,
                                                           Members.Menu.Item("wr.Green").GetValue <Slider>().Value,
                                                           Members.Menu.Item("wr.Blue").GetValue <Slider>().Value));
                        eff[z].SetControlPoint(0, p);
                    }
                    Eff.Add(v, eff);
                    InSys.Add(v);
                }
            }
            else if (cd < 720 || !v.IsAlive && InSys.Contains(v))
            {
                InSys.Remove(v);
                ParticleEffect[] eff;
                if (!Eff.TryGetValue(v, out eff))
                {
                    return;
                }
                foreach (var particleEffect in eff.Where(x => x != null))
                {
                    particleEffect.ForceDispose();
                }
                Eff.Clear();
            }
        }
Пример #3
0
        public static void OnUpdate(EventArgs args)
        {
            if (!MenuManager.IsEnableForceStaff || Updater.Sleeping || !MenuManager.IsEnable)
            {
                return;
            }
            Updater.Sleep(1);
            var forceStuff = Core.Me.GetItemById(AbilityId.item_force_staff);

            if (forceStuff != null && ItemExtensions.CanBeCasted(forceStuff))
            {
                foreach (var hero in Heroes.GetByTeam(Core.EnemyTeam))
                {
                    if (Core.HeroSleeper.Sleeping(hero) || !hero.IsAlive || !hero.IsVisible ||
                        !hero.CanDie(MenuManager.CheckForAegis) || Prediction.IsTurning(hero) ||
                        !AbilityExtensions.CanHit(forceStuff, hero))
                    {
                        continue;
                    }
                    var heroPos    = Prediction.InFront(hero, 600);
                    var heroHealth = hero.Health + hero.HealthRegeneration;
                    var reduction  = Core.RemoteMine.GetDamageReduction(hero);
                    foreach (var element in Core.Bombs)
                    {
                        if (element.IsRemoteMine && element.Active)
                        {
                            if (element.CanHit(heroPos, hero))
                            {
                                heroHealth -= DamageHelpers.GetSpellDamage(element.Damage, 0, reduction);
                                if (heroHealth <= 0)
                                {
                                    forceStuff.UseAbility(hero);
                                    Core.HeroSleeper.Sleep(250, hero);
                                    Updater.Sleep(250);
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
        private static void CheckBombDamageAndDetonate(
            Unit hero,
            Vector3 pos,
            IEnumerable <KeyValuePair <Unit, float> > bombs)
        {
            if (!Utils.SleepCheck(hero.ClassID.ToString()))
            {
                return;
            }
            if (hero.Modifiers.Any(y => y.Name == "modifier_abaddon_borrowed_time"))
            {
                return;
            }
            var pos1          = pos;
            var turning       = !Prediction.IsTurning(hero);
            var possibleBombs =
                bombs.Where(
                    x =>
                    x.Key.Distance2D(pos1) <= remoteMinesRadius && x.Key.Distance2D(hero.Position) <= remoteMinesRadius &&
                    ((remoteMinesRadius - x.Key.Distance2D(pos1)) / hero.MovementSpeed > (Game.Ping / 1000) ||
                     hero.NetworkActivity == NetworkActivity.Idle) &&
                    (!turning || x.Key.Distance2D(hero) < remoteMinesRadius - 20 ||
                     x.Key.Distance2D(pos1) - 10 < x.Key.Distance2D(hero)));
            var detonatableBombs = new Dictionary <Unit, Ability>();
            var dmg = 0f;

            foreach (var bomb in possibleBombs)
            {
                if (dmg > 0)
                {
                    var takenDmg = hero.DamageTaken(dmg, DamageType.Magical, me);
                    if (takenDmg >= hero.Health)
                    {
                        break;
                    }
                }
                detonatableBombs[bomb.Key] = bomb.Key.Spellbook.Spell1;
                dmg += bomb.Value;
            }
            dmg = hero.DamageTaken(dmg, DamageType.Magical, me);
            if (dmg < hero.Health)
            {
                return;
            }
            if (hero.NetworkActivity == NetworkActivity.Move)
            {
                pos = Prediction.InFront(hero, ((Game.Ping / 1000) * hero.MovementSpeed));
                var stop = false;
                foreach (var mine in
                         detonatableBombs.Where(data => Utils.SleepCheck(data.Value.Handle.ToString()))
                         .Select(data => data.Key)
                         .Where(
                             mine =>
                             mine.Distance2D(pos) > remoteMinesRadius ||
                             ((remoteMinesRadius - mine.Distance2D(pos)) / hero.MovementSpeed
                              < (Game.Ping / 1000 + detonatableBombs.Count * 0.002) &&
                              hero.NetworkActivity != NetworkActivity.Idle)))
                {
                    stop = true;
                }
                if (stop)
                {
                    return;
                }
            }
            foreach (var data in detonatableBombs.Where(data => Utils.SleepCheck(data.Value.Handle.ToString())))
            {
                data.Value.UseAbility();
                Utils.Sleep(250, data.Value.Handle.ToString());
            }
            Utils.Sleep(1000, hero.ClassID.ToString());
        }
Пример #5
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Techies)
                {
                    return;
                }
                loaded        = true;
                remoteMines   = me.Spellbook.SpellR;
                suicideAttack = me.Spellbook.SpellE;
                landMines     = me.Spellbook.SpellQ;
                forceStaff    = null;
                //enemyHeroes = null;
                players          = null;
                remoteMinesDb    = new Dictionary <Unit, float>();
                heroTopPanel     = new Dictionary <ClassID, double[]>();
                landMinesHeroDmg = new Dictionary <ClassID, double>();
                suicideHeroDmg   = new Dictionary <ClassID, float>();
                enabledHeroes    = new Dictionary <ClassID, bool>();
                var screenSize = new Vector2(Drawing.Width, Drawing.Height);
                monitor = screenSize.X / 1280;
                if (me.AghanimState())
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage_scepter");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(remoteMines.Level - 1);
                    }
                }
                else
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(remoteMines.Level - 1);
                    }
                }
                foreach (var bomb in
                         ObjectMgr.GetEntities <Unit>()
                         .Where(
                             x =>
                             x.ClassID == ClassID.CDOTA_NPC_TechiesMines && x.Spellbook.Spell1 != null &&
                             x.Spellbook.Spell1.IsValid && x.Spellbook.Spell1.CanBeCasted() && x.IsAlive)
                         .Where(bomb => !remoteMinesDb.ContainsKey(bomb)))
                {
                    remoteMinesDb.Add(bomb, remoteMinesDmg);
                    if (bomb.Health < bomb.Health / 2)
                    {
                        bomb.Spellbook.SpellQ.UseAbility();
                    }
                }
                //enemyHeroes =
                //    ObjectMgr.GetEntities<Hero>()
                //        .Where(x => x != null && x.IsValid && x.Team == me.GetEnemyTeam() && !x.IsIllusion);
                players =
                    ObjectMgr.GetEntities <Player>()
                    .Where(x => x != null && x.Hero != null && x.Hero.Team == me.GetEnemyTeam());
                Game.PrintMessage(
                    "<font face='Tahoma'><font color='#993311'>#TECHIES</font> by MOON<font color='#ff9900'>ES</font> loaded!</font> ",
                    MessageType.LogMessage);
            }
            if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Techies)
            {
                loaded = false;
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (forceStaff == null && Menu.Item("useForceStaff").GetValue <bool>()
                )
            {
                forceStaff = me.Inventory.Items.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Item_ForceStaff);
            }
            var detonate = ObjectMgr.GetEntities <Unit>()
                           .Where(x => x.ClassID == ClassID.CDOTA_NPC_TechiesMines && x.Spellbook.Spell1 != null && x.Spellbook.Spell1.IsValid && x.Spellbook.Spell1.CanBeCasted() && x.Health <= (x.MaximumHealth * 0.6) && x.IsAlive).FirstOrDefault();

            if (detonate != null && Utils.SleepCheck(detonate.Handle.ToString()))
            {
                detonate.Spellbook.SpellQ.UseAbility();
                Utils.Sleep(400, detonate.Handle.ToString());
            }

            var suicideLevel = suicideAttack.Level;

            if (suicideAttackLevel != suicideLevel)
            {
                var firstOrDefault = suicideAttack.AbilityData.FirstOrDefault(x => x.Name == "damage");
                if (firstOrDefault != null)
                {
                    suicideAttackDmg = firstOrDefault.GetValue(suicideLevel - 1);
                }
                var abilityData = suicideAttack.AbilityData.FirstOrDefault(x => x.Name == "small_radius");
                if (abilityData != null)
                {
                    suicideAttackRadius = abilityData.Value;
                }
                suicideAttackLevel = suicideLevel;
            }

            var bombLevel = remoteMines.Level;

            if (remoteMinesLevel != bombLevel)
            {
                if (me.AghanimState())
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage_scepter");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(bombLevel - 1);
                    }
                }
                else
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(bombLevel - 1);
                    }
                }
                var abilityData = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "radius");
                if (abilityData != null)
                {
                    remoteMinesRadius = abilityData.Value + 20;
                }
                remoteMinesLevel = bombLevel;
            }

            var landMineslvl = landMines.Level;

            if (landMinesLevel != landMineslvl)
            {
                var firstOrDefault = landMines.AbilityData.FirstOrDefault(x => x.Name == "damage");
                if (firstOrDefault != null)
                {
                    landMinesDmg = firstOrDefault.GetValue(landMineslvl - 1);
                }
                landMinesLevel = landMineslvl;
            }

            if (!aghanims && me.AghanimState())
            {
                var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage_scepter");
                if (firstOrDefault != null)
                {
                    remoteMinesDmg = firstOrDefault.GetValue(bombLevel - 1);
                }
                aghanims = true;
            }
            var bombs =
                remoteMinesDb.Where(
                    x =>
                    x.Key != null && x.Key.IsValid && x.Key.Spellbook.Spell1 != null &&
                    x.Key.Spellbook.Spell1.CanBeCasted() && x.Key.IsAlive);
            var bombsArray = bombs as KeyValuePair <Unit, float>[] ?? bombs.ToArray();
            var eHeroes    =
                ObjectMgr.GetEntities <Hero>()
                .Where(
                    x =>
                    x != null && x.IsValid && !x.IsIllusion && x.Team == me.GetEnemyTeam() && x.IsAlive &&
                    x.IsVisible && !x.IsMagicImmune() &&
                    x.Modifiers.All(y => y.Name != "modifier_abaddon_borrowed_time") &&
                    x.Modifiers.All(y => y.Name != "modifier_dazzle_shallow_grave") &&
                    x.Modifiers.All(y => y.Name != "modifier_templar_assassin_refraction_absorb")

                    && Utils.SleepCheck(x.ClassID.ToString()));

            try
            {
                foreach (var hero in
                         eHeroes)
                {
                    bool enabled;
                    if (!enabledHeroes.TryGetValue(hero.ClassID, out enabled) || !enabled)
                    {
                        continue;
                    }
                    var heroDistance = me.Distance2D(hero);
                    if (Menu.Item("autoDetonate").GetValue <bool>())
                    {
                        var nearbyBombs = bombsArray.Any(x => x.Key.Distance2D(hero) <= remoteMinesRadius + 500);
                        if (nearbyBombs)
                        {
                            CheckBombDamageAndDetonate(hero, bombsArray);
                        }
                    }
                    //Game.PrintMessage((float)me.Health / me.MaximumHealth + " " + (float)Menu.Item("HPTreshold").GetValue<Slider>().Value / 100, MessageType.ChatMessage);
                    var zHeroes =
                        ObjectMgr.GetEntities <Hero>()
                        .Where(
                            x =>
                            x != null && x.IsValid && !x.IsIllusion && x.Team == me.GetEnemyTeam() && x.IsAlive &&
                            x.IsVisible && !x.IsMagicImmune() &&
                            x.Modifiers.All(y => y.Name != "modifier_abaddon_borrowed_time") &&
                            x.Modifiers.All(y => y.Name != "modifier_dazzle_shallow_grave") &&
                            x.Modifiers.All(y => y.Name != "modifier_templar_assassin_refraction_absorb"));
                    foreach (var z in zHeroes)
                    {
                        if (Menu.Item("autoSuicide").GetValue <bool>() && suicideAttack.CanBeCasted() &&
                            (float)me.Health / me.MaximumHealth
                            <= (float)Menu.Item("HPTreshold").GetValue <Slider>().Value / 100 && heroDistance < 400 &&
                            suicideAttackLevel > 0 && me.IsAlive &&
                            z.Modifiers.All(y => y.Name != "modifier_dazzle_shallow_grave"))
                        {
                            SuicideKillSteal(hero);
                        }
                    }
                    if (forceStaff == null || !Menu.Item("useForceStaff").GetValue <bool>() ||
                        !(heroDistance <= forceStaff.CastRange) || !Utils.SleepCheck("forcestaff") ||
                        bombsArray.Any(x => x.Key.Distance2D(hero) <= remoteMinesRadius) ||
                        Prediction.IsTurning(hero) || !forceStaff.CanBeCasted())
                    {
                        continue;
                    }

                    double rotSpeed;
                    if (!Prediction.RotSpeedDictionary.TryGetValue(hero.Handle, out rotSpeed) ||
                        (rotSpeed > 0 && Menu.Item("checkRotating").GetValue <bool>()))
                    {
                        continue;
                    }
                    if (Prediction.StraightTime(hero) / 1000 < Menu.Item("straightTime").GetValue <Slider>().Value)
                    {
                        continue;
                    }
                    var turnTime      = me.GetTurnTime(hero);
                    var forcePosition = hero.Position;
                    if (hero.NetworkActivity == NetworkActivity.Move)
                    {
                        forcePosition = Prediction.InFront(
                            hero,
                            (float)((turnTime + Game.Ping / 1000) * hero.MovementSpeed));
                    }
                    forcePosition +=
                        VectorExtensions.FromPolarCoordinates(1f, (float)(hero.NetworkRotationRad + rotSpeed))
                        .ToVector3() * 600;
                    var possibleBombs = bombsArray.Any(x => x.Key.Distance2D(forcePosition) <= (remoteMinesRadius - 75));
                    if (!possibleBombs)
                    {
                        continue;
                    }
                    var dmg = CheckBombDamage(hero, forcePosition, bombsArray);
                    if (!(dmg >= hero.Health) && hero.Modifiers.All(y => y.Name != "modifier_dazzle_shallow_grave" && y.Name != "modifier_templar_assassin_refraction_absorb"))
                    {
                        continue;
                    }
                    forceStaff.UseAbility(hero);
                    Utils.Sleep(250, "forcestaff");
                }
            }
            catch (Exception)
            {
                //aa
            }

            if (!Menu.Item("autoDetonateCreeps").GetValue <bool>())
            {
                return;
            }
            var creeps =
                ObjectMgr.GetEntities <Creep>()
                .Where(
                    x =>
                    (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege) &&
                    x.IsAlive && x.IsVisible && x.IsSpawned && x.Team == me.GetEnemyTeam());
            var enumerable = creeps as Creep[] ?? creeps.ToArray();

            foreach (var data in (from creep in enumerable
                                  let nearbyBombs =
                                      bombsArray.Any(x => x.Key.Distance2D(creep) <= remoteMinesRadius + 500)
                                      where nearbyBombs
                                      let detonatableBombs = FindDetonatableBombs(creep, creep.Position, bombsArray)
                                                             where detonatableBombs != null
                                                             let nearbyCreeps =
                                          enumerable.Count(
                                              x =>
                                              x.Distance2D(creep) <= remoteMinesRadius &&
                                              CheckBombDamage(x, x.Position, bombsArray) >= x.Health)
                                          where nearbyCreeps > 3
                                          select detonatableBombs).SelectMany(
                         detonatableBombs =>
                         detonatableBombs.Where(data => Utils.SleepCheck(data.Value.Handle.ToString()))))
            {
                data.Value.UseAbility();
                Utils.Sleep(250, data.Value.Handle.ToString());
            }
        }
        public async Task UseAbilities(UnitBase unitBase)
        {
            var flux          = unitBase.Flux;
            var magneticField = unitBase.MagneticField;
            var spark         = unitBase.Spark;

            if (!_multiSleeper.Sleeping(flux) && unitBase.AbilityChecker.IsAbilityEnabled(flux.GetAbilityId()) && flux.CanBeCasted() && flux.CanHit(Core.Target))
            {
                flux.UseAbility(Core.Target);
                Printer.Both("Flux usages " + flux.GetAbilityDelay());
                _multiSleeper.Sleep(500, flux);
                await Task.Delay(flux.GetAbilityDelay(), Core.ComboToken.Token);
            }
            var distance = unitBase.Hero.Distance2D(Core.Target);

            if (!_multiSleeper.Sleeping(magneticField) && magneticField != null && unitBase.AbilityChecker.IsAbilityEnabled(magneticField.GetAbilityId()) && magneticField.CanBeCasted() &&
                !unitBase.Hero.HasModifier("modifier_arc_warden_magnetic_field") && distance <= 600 && Core.Target.IsVisible)
            {
                if (!MenuManager.MagneticField && Core.Target.IsMelee)
                {
                    magneticField.UseAbility(Prediction.InFront(unitBase.Hero, -250));
                }
                else
                {
                    magneticField.UseAbility(Prediction.InFront(unitBase.Hero, 250));
                }
                _multiSleeper.Sleep(500, magneticField);
                Printer.Both("MagneticField usages");
                await Task.Delay(magneticField.GetAbilityDelay(), Core.ComboToken.Token);
            }
            if (!_multiSleeper.Sleeping(spark) && spark != null && unitBase.AbilityChecker.IsAbilityEnabled(spark.GetAbilityId()) && spark.CanBeCasted() && !Prediction.IsTurning(Core.Target) && unitBase.Hero.IsVisibleToEnemies)
            {
                var delay       = spark.GetAbilityDelay();
                var predVector3 = Prediction.PredictedXYZ(Core.Target, 2000 + delay);
                spark.UseAbility(predVector3);
                _multiSleeper.Sleep(500, spark);
                Printer.Both("spark usages");
                await Task.Delay(spark.GetAbilityDelay(), Core.ComboToken.Token);
            }
        }
Пример #7
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (!loaded)
            {
                me = ObjectMgr.LocalHero;
                if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Techies)
                {
                    return;
                }
                loaded        = true;
                remoteMines   = me.Spellbook.SpellR;
                suicideAttack = me.Spellbook.SpellE;
                landMines     = me.Spellbook.SpellQ;
                forceStaff    = null;
                //enemyHeroes = null;
                players          = null;
                remoteMinesDb    = new Dictionary <Unit, float>();
                heroTopPanel     = new Dictionary <ClassID, double[]>();
                landMinesHeroDmg = new Dictionary <ClassID, double>();
                suicideHeroDmg   = new Dictionary <ClassID, float>();
                enabledHeroes    = new Dictionary <ClassID, bool>();
                var screenSize = new Vector2(Drawing.Width, Drawing.Height);
                monitor = screenSize.X / 1280;
                if (me.AghanimState())
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage_scepter");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(remoteMines.Level - 1);
                    }
                }
                else
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(remoteMines.Level - 1);
                    }
                }
                foreach (var bomb in
                         ObjectMgr.GetEntities <Unit>()
                         .Where(
                             x =>
                             x.ClassID == ClassID.CDOTA_NPC_TechiesMines && x.Spellbook.Spell1 != null &&
                             x.Spellbook.Spell1.IsValid && x.Spellbook.Spell1.CanBeCasted() && x.IsAlive)
                         .Where(bomb => !remoteMinesDb.ContainsKey(bomb)))
                {
                    remoteMinesDb.Add(bomb, remoteMinesDmg);
                }
                //enemyHeroes =
                //    ObjectMgr.GetEntities<Hero>()
                //        .Where(x => x != null && x.IsValid && x.Team == me.GetEnemyTeam() && !x.IsIllusion);
                players =
                    ObjectMgr.GetEntities <Player>()
                    .Where(x => x != null && x.Hero != null && x.Hero.Team == me.GetEnemyTeam());
                Console.WriteLine("#Techies: Loaded!");
            }
            if (!Game.IsInGame || me == null || me.ClassID != ClassID.CDOTA_Unit_Hero_Techies)
            {
                loaded = false;
                Console.WriteLine("#Techies: Unloaded!");
                return;
            }

            if (Game.IsPaused)
            {
                return;
            }

            if (forceStaff == null)
            {
                forceStaff = me.Inventory.Items.FirstOrDefault(x => x.ClassID == ClassID.CDOTA_Item_ForceStaff);
            }

            var suicideLevel = suicideAttack.Level;

            if (suicideAttackLevel != suicideLevel)
            {
                var firstOrDefault = suicideAttack.AbilityData.FirstOrDefault(x => x.Name == "damage");
                if (firstOrDefault != null)
                {
                    suicideAttackDmg = firstOrDefault.GetValue(suicideLevel - 1);
                }
                var abilityData = suicideAttack.AbilityData.FirstOrDefault(x => x.Name == "small_radius");
                if (abilityData != null)
                {
                    suicideAttackRadius = abilityData.Value;
                }
                suicideAttackLevel = suicideLevel;
            }

            var bombLevel = remoteMines.Level;

            if (remoteMinesLevel != bombLevel)
            {
                if (me.AghanimState())
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage_scepter");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(bombLevel - 1);
                    }
                }
                else
                {
                    var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage");
                    if (firstOrDefault != null)
                    {
                        remoteMinesDmg = firstOrDefault.GetValue(bombLevel - 1);
                    }
                }
                var abilityData = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "radius");
                if (abilityData != null)
                {
                    remoteMinesRadius = abilityData.Value + 20;
                }
                remoteMinesLevel = bombLevel;
            }

            var landMineslvl = landMines.Level;

            if (landMinesLevel != landMineslvl)
            {
                var firstOrDefault = landMines.AbilityData.FirstOrDefault(x => x.Name == "damage");
                if (firstOrDefault != null)
                {
                    landMinesDmg = firstOrDefault.GetValue(landMineslvl - 1);
                }
                landMinesLevel = landMineslvl;
            }

            if (!aghanims && me.AghanimState())
            {
                var firstOrDefault = remoteMines.AbilityData.FirstOrDefault(x => x.Name == "damage_scepter");
                if (firstOrDefault != null)
                {
                    remoteMinesDmg = firstOrDefault.GetValue(bombLevel - 1);
                }
                aghanims = true;
            }

            var bombs =
                remoteMinesDb.Where(
                    x =>
                    x.Key != null && x.Key.IsValid && x.Key.Spellbook.Spell1 != null &&
                    x.Key.Spellbook.Spell1.CanBeCasted() && x.Key.IsAlive);
            var bombsArray = bombs as KeyValuePair <Unit, float>[] ?? bombs.ToArray();
            var eHeroes    =
                ObjectMgr.GetEntities <Hero>()
                .Where(
                    x =>
                    x != null && x.IsValid && !x.IsIllusion && x.Team == me.GetEnemyTeam() && x.IsAlive &&
                    x.IsVisible && !x.IsMagicImmune() &&
                    x.Modifiers.All(y => y.Name != "modifier_abaddon_borrowed_time") &&
                    Utils.SleepCheck(x.ClassID.ToString()));

            try
            {
                foreach (var hero in
                         eHeroes)
                {
                    bool enabled;
                    if (!enabledHeroes.TryGetValue(hero.ClassID, out enabled) || !enabled)
                    {
                        continue;
                    }
                    var heroDistance = me.Distance2D(hero);
                    var nearbyBombs  = bombsArray.Any(x => x.Key.Distance2D(hero) <= remoteMinesRadius + 500);
                    if (nearbyBombs)
                    {
                        CheckBombDamageAndDetonate(hero, bombsArray);
                    }
                    if (heroDistance < 400 && suicideAttackLevel > 0 && me.IsAlive && (Case == 2 || Case == 3))
                    {
                        SuicideKillSteal(hero);
                    }
                    if (forceStaff == null || !(heroDistance <= forceStaff.CastRange) || !Utils.SleepCheck("forcestaff") ||
                        bombsArray.Any(x => x.Key.Distance2D(hero) <= remoteMinesRadius) ||
                        Prediction.IsTurning(hero) || !forceStaff.CanBeCasted())
                    {
                        continue;
                    }

                    var data =
                        Prediction.TrackTable.ToArray()
                        .FirstOrDefault(
                            unitData => unitData.UnitName == hero.Name || unitData.UnitClassID == hero.ClassID);
                    if (data == null)
                    {
                        continue;
                    }
                    var turnTime      = me.GetTurnTime(hero);
                    var forcePosition = hero.Position;
                    if (hero.NetworkActivity == NetworkActivity.Move)
                    {
                        forcePosition = Prediction.InFront(
                            hero,
                            (float)((turnTime + Game.Ping / 1000) * hero.MovementSpeed));
                    }
                    forcePosition +=
                        VectorExtensions.FromPolarCoordinates(1f, hero.NetworkRotationRad + data.RotSpeed).ToVector3()
                        * 600;
                    var possibleBombs = bombsArray.Any(x => x.Key.Distance2D(forcePosition) <= (remoteMinesRadius - 75));
                    if (!possibleBombs)
                    {
                        continue;
                    }
                    var dmg = CheckBombDamage(hero, forcePosition, bombsArray);
                    if (!(dmg >= hero.Health))
                    {
                        continue;
                    }
                    forceStaff.UseAbility(hero);
                    Utils.Sleep(250, "forcestaff");
                }
            }
            catch (Exception)
            {
                //aa
            }
            if (!(Case == 2 || Case == 4))
            {
                return;
            }
            var creeps =
                ObjectMgr.GetEntities <Creep>()
                .Where(
                    x =>
                    (x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Lane || x.ClassID == ClassID.CDOTA_BaseNPC_Creep_Siege) &&
                    x.IsAlive && x.IsVisible && x.IsSpawned && x.Team == me.GetEnemyTeam());

            var enumerable = creeps as Creep[] ?? creeps.ToArray();

            foreach (var data in (from creep in enumerable
                                  let nearbyBombs =
                                      bombsArray.Any(x => x.Key.Distance2D(creep) <= remoteMinesRadius + 500)
                                      where nearbyBombs
                                      let detonatableBombs = FindDetonatableBombs(creep, creep.Position, bombsArray)
                                                             where detonatableBombs != null
                                                             let nearbyCreeps =
                                          enumerable.Count(
                                              x =>
                                              x.Distance2D(creep) <= remoteMinesRadius &&
                                              CheckBombDamage(x, x.Position, bombsArray) >= x.Health)
                                          where nearbyCreeps > 3
                                          select detonatableBombs).SelectMany(
                         detonatableBombs =>
                         detonatableBombs.Where(data => Utils.SleepCheck(data.Value.Handle.ToString()))))
            {
                data.Value.UseAbility();
                Utils.Sleep(250, data.Value.Handle.ToString());
            }
        }
Пример #8
0
        public static void DrawShowMeMoreSpells(Hero hero)
        {
            switch (hero.ClassID)
            {
            case ClassID.CDOTA_Unit_Hero_Windrunner:
                if (Prediction.IsTurning(hero))
                {
                    return;
                }
                var spell = hero.Spellbook.Spell2;
                if (spell == null || spell.CanBeCasted())
                {
                    return;
                }
                var cd = Math.Floor(spell.Cooldown / Common.GetCooldown(hero, spell) * 1000);
                if (cd < 980)
                {
                    if (!EffectForSpells.ContainsKey(spell) && cd > 800)
                    {
                        var effect = new ParticleEffect(Particles.Partlist[83], hero.Position);
                        effect.SetControlPoint(1, hero.Position);
                        effect.SetControlPoint(2, Common.FindVector(hero.Position, hero.Rotation, spell.GetCastRange() + hero.HullRadius));
                        EffectForSpells.Add(spell, effect);
                    }
                    else if ((!hero.IsAlive || cd <= 800) && EffectForSpells.ContainsKey(spell))
                    {
                        EffectForSpells[spell].ForceDispose();
                        EffectForSpells.Remove(spell);
                    }
                }
                break;

            case ClassID.CDOTA_Unit_Hero_Mirana:
                spell = hero.Spellbook.Spell2;
                if (spell == null)
                {
                    return;
                }
                if (_arrowUnit != null && !Utils.SleepCheck("ShowMeMore.Mirana.Draw") && Utils.SleepCheck("ShowMeMore.Mirana.Wait"))
                {
                    if (_arrowUnit.IsValid && _arrowUnit.IsVisible)
                    {
                        if (!EffectForSpells.ContainsKey(spell))
                        {
                            var effect = new ParticleEffect(Particles.Partlist[83], _arrowUnit.Position);
                            effect.SetControlPoint(1, _arrowUnit.Position);
                            effect.SetControlPoint(2,
                                                   Common.FindVector(_arrowPos, Common.FindRet(_arrowPos, _arrowUnit.Position), 3000 - _arrowUnit.Speed * _arrowUnit.CreateTime));
                            EffectForSpells.Add(spell, effect);
                        }
                    }
                }
                else if (Utils.SleepCheck("ShowMeMore.Mirana.Draw") && EffectForSpells.ContainsKey(spell))
                {
                    EffectForSpells[spell].ForceDispose();
                    EffectForSpells.Remove(spell);
                }
                break;

            case ClassID.CDOTA_Unit_Hero_Pudge:
                if (Prediction.IsTurning(hero))
                {
                    return;
                }
                spell = hero.Spellbook.Spell1;
                if (spell == null || spell.CanBeCasted())
                {
                    return;
                }
                cd = Math.Floor(spell.Cooldown / Common.GetCooldown(hero, spell) * 1000);
                if (cd < 990)
                {
                    if (!EffectForSpells.ContainsKey(spell) && cd > 900)
                    {
                        var effect = new ParticleEffect(Particles.Partlist[83], hero.Position);
                        effect.SetControlPoint(1, hero.Position);
                        effect.SetControlPoint(2, Common.FindVector(hero.Position, hero.Rotation, spell.GetCastRange() + hero.HullRadius + 100));
                        EffectForSpells.Add(spell, effect);
                    }
                    else if ((!hero.IsAlive || cd <= 900) && EffectForSpells.ContainsKey(spell))
                    {
                        EffectForSpells[spell].ForceDispose();
                        EffectForSpells.Remove(spell);
                    }
                }
                break;

            case ClassID.CDOTA_Unit_Hero_Puck:
                if (Prediction.IsTurning(hero))
                {
                    return;
                }
                spell = hero.Spellbook.Spell1;
                var spell4 = hero.Spellbook.Spell4;
                if (spell == null || spell.CanBeCasted())
                {
                    return;
                }
                cd = Math.Floor(spell.Cooldown / Common.GetCooldown(hero, spell) * 1000);
                if (cd < 995)
                {
                    if (!EffectForSpells.ContainsKey(spell) && spell4.IsActivated)
                    {
                        var effect = new ParticleEffect(Particles.Partlist[83], hero.Position);
                        effect.SetControlPoint(1, hero.Position);
                        effect.SetControlPoint(2, Common.FindVector(hero.Position, hero.Rotation, spell.GetCastRange() + hero.HullRadius + 225));
                        EffectForSpells.Add(spell, effect);
                    }
                    else if ((!hero.IsAlive || !spell4.IsActivated || cd < 700) && EffectForSpells.ContainsKey(spell))
                    {
                        EffectForSpells[spell].ForceDispose();
                        EffectForSpells.Remove(spell);
                    }
                }
                break;

            case ClassID.CDOTA_Unit_Hero_Jakiro:
                spell = hero.Spellbook.Spell2;
                if (spell != null)
                {
                    if (spell.IsInAbilityPhase)
                    {
                        if (!EffectForSpells.ContainsKey(spell) && spell.CanBeCasted() &&
                            Common.Wait(220, 500, "ShowMeMore.Jakiro.Wait.2"))
                        {
                            var effect = new ParticleEffect(Particles.Partlist[81], hero.Position);
                            effect.SetControlPoint(1, hero.Position);
                            effect.SetControlPoint(2,
                                                   Common.FindVector(hero.Position, hero.Rotation, spell.GetCastRange() + hero.HullRadius + 150));
                            EffectForSpells.Add(spell, effect);
                        }
                    }
                    else if (!hero.IsAlive || EffectForSpells.ContainsKey(spell))
                    {
                        EffectForSpells[spell].ForceDispose();
                        EffectForSpells.Remove(spell);
                    }
                }
                spell = hero.Spellbook.Spell4;
                if (spell != null)
                {
                    if (spell.IsInAbilityPhase || (spell.Cooldown > 0 && spell.GetCooldown(spell.Level - 1) - spell.Cooldown <= 10))
                    {
                        if (!EffectForSpells.ContainsKey(spell) && Common.Wait(220, 500, "ShowMeMore.Jakiro.Wait.4"))
                        {
                            var effect = new ParticleEffect(Particles.Partlist[81], hero.Position);
                            effect.SetControlPoint(1, hero.Position);
                            effect.SetControlPoint(2,
                                                   Common.FindVector(hero.Position, hero.Rotation, spell.GetCastRange() + hero.HullRadius + 240));
                            EffectForSpells.Add(spell, effect);
                        }
                        else if (EffectForSpells.ContainsKey(spell) && Common.GetCooldown(hero, spell) - spell.Cooldown > 10)
                        {
                            EffectForSpells[spell].ForceDispose();
                            EffectForSpells.Remove(spell);
                        }
                    }
                    else if (!hero.IsAlive || EffectForSpells.ContainsKey(spell))
                    {
                        EffectForSpells[spell].ForceDispose();
                        EffectForSpells.Remove(spell);
                    }
                }

                break;

            case ClassID.CDOTA_Unit_Hero_Kunkka:
                spell = hero.Spellbook.Spell4;
                if (spell != null)
                {
                    if (spell.IsInAbilityPhase)
                    {
                        if (!SpellRadius.Any(x => x.ContainsHero(hero)) && spell.CanBeCasted() &&
                            Common.Wait(220, 500, "ShowMeMore.Kunkka.Wait.4"))
                        {
                            var effect = new ParticleEffect(@"particles\ui_mouseactions\drag_selected_ring.vpcf",
                                                            Common.FindVector(hero.Position, hero.Rotation, 1000));
                            effect.SetControlPoint(1, new Vector3(255, 0, 0));
                            effect.SetControlPoint(2, new Vector3(425, 255, 0));
                            SpellRadius.Add(new AoeSpellStruct(hero, Common.FindVector(hero.Position, hero.Rotation, 1000), "", effect, 425, 310 + 80));
                        }
                    }
                    else if (SpellRadius.Any(x => x.ContainsHero(hero)) && (Common.GetCooldown(hero, spell) - spell.Cooldown) * 100 > 310)
                    {
                        SpellRadius.First(x => x.ContainsHero(hero)).Effect.ForceDispose();
                        SpellRadius.RemoveAt(SpellRadius.FindIndex(x => x.ContainsHero(hero)));
                    }
                }
                break;
            }
            try
            {
                var temp = SpellRadius;
                foreach (var x in temp.Where(x => x.Effect.IsDestroyed))
                {
                    SpellRadius.RemoveAt(SpellRadius.FindIndex(e => e.Effect.IsDestroyed));
                }
                var temp2 = EffectForSpells;
                foreach (var x in temp2.Where(x => x.Value.IsDestroyed))
                {
                    EffectForSpells.Remove(x.Key);
                }
            }
            catch (Exception)
            {
                //
            }
        }