Exemple #1
0
 public void Should_sleep_for_a_one_second_period()
 {
     var time = 1;
     ISleeper sleeper = new Sleeper(time);
     var start = DateTime.Now;
     var rtn = sleeper.Sleep();
     var end = DateTime.Now;
     Assert.That(end.Subtract(start).Seconds, Is.EqualTo(1));
     Assert.That(rtn, Is.EqualTo(true));
 }
Exemple #2
0
 public StopElement(Ability x, Hero target)
 {
     Target       = target;
     X            = x;
     Sleeper      = new Sleeper();
     StartTime    = Game.RawGameTime;
     AbilityDelay = x.GetAbilityDelay();
     Sleeper.Sleep(AbilityDelay);
     if (x.Equals(Core.RazeLow))
     {
         Printer.Both("===================NEW========================");
     }
 }
        // Token: 0x06000329 RID: 809 RVA: 0x00012CD8 File Offset: 0x00010ED8
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!base.Ability.UseAbility(this.realityTarget, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay();

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.2f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
        // Token: 0x06000A29 RID: 2601 RVA: 0x0002C214 File Offset: 0x0002A414
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!base.Ability.UseAbility(targetManager.Owner, targetManager.AllyHeroes, 1, 0, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(targetManager.Owner);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Exemple #5
0
        public override bool ForceUseAbility(TargetManager targetManager, Sleeper comboSleeper)
        {
            if (!this.Ability.UseAbility(this.Owner.Position.Extend2D(targetManager.Target.Position, 100)))
            {
                return false;
            }

            var delay = this.Ability.GetCastDelay(targetManager.Target);
            comboSleeper.Sleep(delay + 0.1f);
            this.Sleeper.Sleep(1);
            this.OrbwalkSleeper.Sleep(delay);
            return true;
        }
        // Token: 0x06000306 RID: 774 RVA: 0x0001273C File Offset: 0x0001093C
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, Vector3 toPosition)
        {
            if (!base.Ability.UseAbility(toPosition, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(toPosition);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
        // Token: 0x06000A71 RID: 2673 RVA: 0x0002CE80 File Offset: 0x0002B080
        public override bool ForceUseAbility(TargetManager targetManager, Sleeper comboSleeper)
        {
            if (!base.Ability.UseAbility(base.Owner, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay();

            comboSleeper.Sleep(base.Ability.GetHitTime(base.Owner.InFront(base.Ability.Range, 0f, true)));
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Exemple #8
0
        public void OnLoad()
        {
            hero      = ObjectManager.LocalHero;
            abilities = hero.Spellbook.Spells.Where(
                x => !x.IsHidden && !IgnoredAbilities.List.Contains(x.StoredName()) &&
                !x.Name.Contains("special_bonus"));
            menuManager    = new MenuManager(abilities.Select(x => x.StoredName()).ToList(), hero.Name);
            sleeper        = new Sleeper();
            abilityBuilder = new AbilityBuilder(hero);
            talents        = hero.Spellbook.Spells.Where(x => x.Name.Contains("special_bonus")).ToList();

            sleeper.Sleep(10000);
        }
Exemple #9
0
        private void OnOnIngameUpdate(EventArgs args)
        {
            Mode = OrbwalkingMode.Idle;

            if (Game.IsPaused || Game.IsChatOpen)
            {
                return;
            }
            if (Members.Menu.Item("Combo.key").GetValue <KeyBind>().Active)
            {
                Mode = OrbwalkingMode.Combo;
            }
            else if (Mode == OrbwalkingMode.Idle)
            {
                EffectManager.Remove("attackTarget" + Owner.Handle);
                return;
            }
            if (TurnEndTime > Game.RawGameTime)
            {
                return;
            }
            var target = GetTarget();

            if ((target == null || !CanAttack(target)) && CanMove())
            {
                if (Move(Game.MousePosition))
                {
                    return;
                }
            }

            if (target != null && CanAttack(target))
            {
                LastTarget = target;
                var meld = ObjectManager.LocalHero.GetAbilityById(AbilityId.templar_assassin_meld);
                if (AbilityExtensions.CanBeCasted(meld) && !_sleeper.Sleeping)
                {
                    meld.UseAbility();
                    _sleeper.Sleep(300);
                }
                Attack(target);
            }
            if (LastTarget != null && LastTarget.IsValid && LastTarget.IsAlive)
            {
                EffectManager.DrawRange(LastTarget, "attackTarget" + Owner.Handle, 60, Color.Red);
            }
            else
            {
                EffectManager.Remove("attackTarget" + Owner.Handle);
            }
        }
Exemple #10
0
        private static void GameOnOnUpdate(EventArgs args)
        {
            if (!Checker.IsActive())
            {
                return;
            }
            if (!IsEnable)
            {
                return;
            }
            if (_sleeper.Sleeping)
            {
                return;
            }
            _sleeper.Sleep(500);
            InSys = InSys.Where(x => x != null && x.IsValid).ToList();
            var randomEnemy = Manager.HeroManager.GetEnemyViableHeroes().FirstOrDefault();

            if (randomEnemy == null || !randomEnemy.IsValid)
            {
                return;
            }
            foreach (
                var spell in
                Members.MyHero.Spellbook.Spells.Where(
                    x =>
                    !x.IsAbilityBehavior(AbilityBehavior.Passive) && !InSys.Contains(x) && x.Level > 0 &&
                    (AbilityDamage.CalculateDamage(x, Members.MyHero, randomEnemy) > 0 || WhiteList.Contains(x.Name))))
            {
                InSys.Add(spell);
                AddToCalcMenu(spell.StoredName());
            }
            try
            {
                var items = Manager.HeroManager.GetItemList(Members.MyHero);
                items =
                    items.Where(
                        x =>
                        !InSys.Contains(x) && AbilityDamage.CalculateDamage(x, Members.MyHero, randomEnemy) > 0)
                    .ToList();
                foreach (var spell in items)
                {
                    InSys.Add(spell);
                    AddToCalcMenu(spell.StoredName());
                }
            }
            catch (Exception)
            {
                //
            }
        }
Exemple #11
0
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!this.Ability.UseAbility(this.realityTarget))
            {
                return(false);
            }

            var delay = this.Ability.GetCastDelay();

            comboSleeper.Sleep(delay);
            this.Sleeper.Sleep(delay + 0.2f);
            this.OrbwalkSleeper.Sleep(delay);
            return(true);
        }
Exemple #12
0
        // Token: 0x06000618 RID: 1560 RVA: 0x0001E088 File Offset: 0x0001C288
        public bool UseAbility(Vector3 position, TargetManager targetManager, Sleeper comboSleeper)
        {
            if (!base.Ability.UseAbility(position, false, false))
            {
                return(false);
            }
            float num       = base.Ability.GetHitTime(targetManager.Target) + 0.5f;
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(castDelay);
            base.OrbwalkSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(num);
            return(true);
        }
Exemple #13
0
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!this.Ability.UseAbility(this.Owner.InFront(150)))
            {
                return(false);
            }

            var delay = this.Ability.GetCastDelay(this.Owner.Position);

            comboSleeper.Sleep(delay);
            this.Sleeper.Sleep(2);
            this.OrbwalkSleeper.Sleep(delay);
            return(true);
        }
Exemple #14
0
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!this.Ability.UseAbility(this.Owner.Position.Extend2D(this.castPosition, 400)))
            {
                return(false);
            }

            var delay = this.Ability.GetCastDelay(this.castPosition);

            comboSleeper.Sleep(delay);
            this.Sleeper.Sleep(delay + 0.5f);
            this.OrbwalkSleeper.Sleep(this.Ability.GetHitTime(this.castPosition));
            return(true);
        }
Exemple #15
0
        // Token: 0x060006A3 RID: 1699 RVA: 0x00020188 File Offset: 0x0001E388
        public bool UseAbility(Vector3 position, Sleeper comboSleeper)
        {
            if (!base.Ability.UseAbility(position, false, false))
            {
                return(false);
            }
            this.CastPosition = position;
            float castDelay = base.Ability.GetCastDelay(position);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Exemple #16
0
        // Token: 0x06000344 RID: 836 RVA: 0x000131C0 File Offset: 0x000113C0
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            PredictionInput9  predictionInput  = base.Ability.GetPredictionInput(targetManager.Target, null);
            PredictionOutput9 predictionOutput = base.Ability.GetPredictionOutput(predictionInput);

            if (base.Owner.GetAngle(predictionOutput.CastPosition, false) > 0.1f)
            {
                base.Owner.BaseUnit.Move(predictionOutput.CastPosition);
                base.OrbwalkSleeper.Sleep(0.1f);
                comboSleeper.Sleep(0.1f);
                return(true);
            }
            if (!base.Ability.UseAbility(false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Exemple #17
0
 public void Use(Hero target)
 {
     if (target == null)
     {
         Item.UseAbility();
     }
     else
     {
         Item.UseAbility(target);
     }
     Sleeper.Sleep(restoreTime * 1000, "AutoBottle");
     Sleeper.Sleep(300, "Used");
     SetSleep(200 + Game.Ping);
 }
Exemple #18
0
        private void OnUpdate()
        {
            if (sleeper.Sleeping || Game.IsPaused)
            {
                return;
            }

            if (EntityManager <Hero> .Entities.Any(
                    x => x.IsValid && x.IsVisible && x.IsAlive && x.Team != manager.MyHero.Team && x.Distance2D(manager.MyHero.Position) < 800))
            {
                manager.MyHero.PickUpItems();
                sleeper.Sleep(500);
            }
        }
        // Token: 0x0600067D RID: 1661 RVA: 0x0001F818 File Offset: 0x0001DA18
        public override bool ForceUseAbility(TargetManager targetManager, Sleeper comboSleeper)
        {
            if (!base.Ability.UseAbility(false, false))
            {
                return(false);
            }
            float num       = base.Ability.GetHitTime(targetManager.Target) + 0.5f;
            float castDelay = base.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(castDelay);
            base.OrbwalkSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(num);
            return(true);
        }
Exemple #20
0
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!this.Ability.UseAbility(targetManager.Owner, targetManager.AllyHeroes, HitChance.Low))
            {
                return(false);
            }

            var delay = this.Ability.GetCastDelay(targetManager.Owner);

            comboSleeper.Sleep(delay);
            this.Sleeper.Sleep(delay + 0.5f);
            this.OrbwalkSleeper.Sleep(delay);
            return(true);
        }
Exemple #21
0
        public override bool ForceUseAbility(TargetManager targetManager, Sleeper comboSleeper)
        {
            if (!this.Ability.UseAbility(targetManager.Owner))
            {
                return(false);
            }

            var delay = this.Ability.GetCastDelay(targetManager.Owner);

            comboSleeper.Sleep(delay);
            this.Sleeper.Sleep(delay + 0.5f);
            this.OrbwalkSleeper.Sleep(delay);
            return(true);
        }
Exemple #22
0
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!this.Ability.IsUsable)
            {
                if (this.Ability.UseAbility())
                {
                    comboSleeper.Sleep(0.1f);
                    return(true);
                }
            }

            if (!this.Ability.UseAbility(targetManager.Target, targetManager.EnemyHeroes, HitChance.Low))
            {
                return(false);
            }

            var delay = this.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(delay);
            this.Sleeper.Sleep(this.Ability.GetHitTime(targetManager.Target) + 0.5f);
            this.OrbwalkSleeper.Sleep(delay);
            return(true);
        }
Exemple #23
0
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            if (!this.Ability.UseAbility(this.blinkPosition))
            {
                return(false);
            }

            var delay = this.Ability.GetHitTime(this.blinkPosition);

            comboSleeper.Sleep(delay + 0.1f);
            this.OrbwalkSleeper.Sleep(delay + 0.2f);
            this.Sleeper.Sleep(this.Ability.GetCastDelay(targetManager.Target) + 0.5f);
            return(true);
        }
Exemple #24
0
        public bool UseAbilityOnTarget(TargetManager targetManager, Sleeper comboSleeper)
        {
            if (!this.Ability.UseAbility(targetManager.Target, HitChance.Low))
            {
                return(false);
            }

            var delay = this.Ability.GetCastDelay(targetManager.Target);

            comboSleeper.Sleep(this.Ability.GetHitTime(targetManager.Target));
            this.Sleeper.Sleep(delay + 0.5f);
            this.OrbwalkSleeper.Sleep(delay);
            return(true);
        }
        private void OnUpdate()
        {
            if (sleeper.Sleeping || Game.IsPaused || !manager.MyHero.IsAlive)
            {
                return;
            }

            var enemies = EntityManager <Hero> .Entities
                          .Where(x => x.IsValid && x.IsVisible && x.IsAlive && x.Team != manager.MyHero.Team && !x.IsIllusion)
                          .ToList();

            if (!enemies.Any())
            {
                return;
            }

            var canUseItems     = manager.MyHero.CanUseItems();
            var canUseAbilities = manager.MyHero.CanUseAbilities();

            foreach (var defensiveAbility in defensiveAbilities
                     .Where(x => menu.IsAbilityEnabled(x.Name) && x.CanBeCasted() && (x.IsItem ? canUseItems : canUseAbilities))
                     .OrderByDescending(x => menu.GetPriority(x.Name)))
            {
                var defaultUse = enemies.Count(x => x.Distance2D(manager.MyHero.Position) <= defensiveAbility.Menu.Range)
                                 >= defensiveAbility.Menu.EnemyCount;

                var alwaysUse = defensiveAbility.Menu.AlwaysUse && enemies.Any(
                    x => defensiveAbility.Menu.IsEnabled(x.StoredName()) && x.Distance2D(manager.MyHero.Position)
                    <= defensiveAbility.Menu.AlwaysUseRange);

                if (defaultUse || alwaysUse)
                {
                    UpdateManager.BeginInvoke(
                        () =>
                    {
                        if (!defensiveAbility.CanBeCasted())
                        {
                            return;
                        }

                        defensiveAbility.Use();
                    },
                        defensiveAbility.Menu.Delay);

                    sleeper.Sleep(defensiveAbility.Menu.Delay + 100);
                    return;
                }
            }
        }
Exemple #26
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);
                }
            }
        }
Exemple #27
0
        public Abyssal(Hero hero, Unit target, MenuItemToggler hasItem, ref Sleeper sleeper)
        {
            var item = AbilityId.item_abyssal_blade;

            if (hasItem.GetValue(item) &&
                ItemsHelper.FindItem(hero, item) &&
                hero.Position.Distance2D(target.Position) <= 500 &&
                hero.Inventory.MainItems.Where(x => x.Id == item).FirstOrDefault().Cooldown == 0 &&
                !target.IsHexed() &&
                !target.IsStunned())
            {
                ItemsHelper.CastItemEnemy(hero, target, item);
                sleeper.Sleep(300);
            }
        }
Exemple #28
0
        // Token: 0x06000322 RID: 802 RVA: 0x00012B70 File Offset: 0x00010D70
        public override bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe)
        {
            Vector3 vector = Vector3Extensions.Extend2D(base.Owner.Position, Game.MousePosition, Math.Max(base.Ability.CastRange, base.Owner.Distance(Game.MousePosition)));

            if (!base.Ability.UseAbility(vector, false, false))
            {
                return(false);
            }
            float castDelay = base.Ability.GetCastDelay(vector);

            comboSleeper.Sleep(castDelay);
            base.Sleeper.Sleep(castDelay + 0.5f);
            base.OrbwalkSleeper.Sleep(castDelay);
            return(true);
        }
Exemple #29
0
 /// <summary>
 ///     The update.
 /// </summary>
 /// <param name="args">
 ///     The args.
 /// </param>
 public static void Update(EventArgs args)
 {
     if (!Game.IsInGame)
     {
         return;
     }
     //Printer.Print($"update#1 {!Utils.SleepCheck("Common.Heroes.Update2")} { All.Count(x => x.IsValid) >= 10}");
     if (Sleeper.Sleeping || All.Count(x => x.IsValid) >= 10)
     {
         return;
     }
     //Printer.Print("update#2");
     UpdateHeroes();
     Sleeper.Sleep(1000);
 }
Exemple #30
0
        public bool UseAbility(Vector3 position, Sleeper comboSleeper)
        {
            if (!this.Ability.UseAbility(position))
            {
                return(false);
            }

            this.CastPosition = position;
            var delay = this.Ability.GetCastDelay(position);

            comboSleeper.Sleep(delay);
            this.Sleeper.Sleep(delay + 0.5f);
            this.OrbwalkSleeper.Sleep(delay);
            return(true);
        }
Exemple #31
0
        /// <summary>
        ///     The update.
        /// </summary>
        /// <param name="args">
        ///     The args.
        /// </param>
        public static void Update(EventArgs args)
        {
            if (!Game.IsInGame)
            {
                return;
            }

            if (updateSleeper.Sleeping || !Game.IsCustomGame && All.Count(x => x.IsValid) >= 10)
            {
                return;
            }

            UpdateHeroes();
            updateSleeper.Sleep(1000);
        }