Beispiel #1
0
 private static TaskManager CreateTaskManager(ApplicationSection configuration)
 {
     const int sleeptimeLoopTime = 100;
     ISleep sleep = new Sleeper();
     IStop stop = new Stop();
     Service service = new Service(configuration.Port);
     return new TaskManager(log, sleeptimeLoopTime, sleep, stop, service);
 }
Beispiel #2
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));
 }
 public static TaskManager CreateTaskManager(SqlToGraphiteSection configuration)
 {
     var cacheLength = new TimeSpan(0, configuration.ConfigCacheLengthMinutes, 0);
     var stop = new Stop();
     IDataClientFactory dataClientFactory = new DataClientFactory(log);
     IGraphiteClientFactory graphiteClientFactory = new GraphiteClientFactory(log);
     var configMapper = new ConfigMapper(configuration.Hostname, stop, dataClientFactory, graphiteClientFactory, log);
     var configReader = new ConfigReader(configuration.ConfigUri,configuration.ConfigUsername,configuration.ConfigPassword);
     var cache = new Cache(cacheLength, log);
     var sleeper = new Sleeper();
     var knownGraphiteClients = new KnownGraphiteClients();
     var cr = new ConfigRepository(configReader, knownGraphiteClients, cache, sleeper, log, configuration.MinutesBetweenRetryToGetConfigOnError);
     var configController = new ConfigController(configMapper, log, cr);
     return new TaskManager(log, configController, configuration.ConfigUri, stop, sleeper, configuration.CheckConfigUpdatedEveryMinutes);
 }
 public void Should_try_controller()
 {
     var log = LogManager.GetLogger("log");
     log4net.Config.XmlConfigurator.Configure();
     //var host = "metrics.london.ttldev.local";
     //var port = 2003;
     //var connectionString = "Data Source=nuget.london.ttldev.local;Initial Catalog=GoReportingSvn3;User Id=sa;Password=!bcde1234;";
     //var sqlGetter = new SqlGetter(connectionString, host, port, log);
     //var sql = "SELECT [Assigned],DateDiff(s,[Scheduled],[Assigned]) FROM [GoReportingSvn3].[dbo].[V_BuildStateTransition] where Scheduled > '2012-01-01'";
     //sqlGetter.Process("owain.test.Tlsvn3.Assigned", sql);
     var ds = "Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.244.127.11)(PORT=1532)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=tracslg2)));User Id=temp_ttl_user;Password=tt1r34dj0b;";
     var taskParam = new TaskParams("ThePath", "SELECT concat(dm_code,concat('_',current_ds_code)) AS dm, COUNT(DISTINCT (d.ID)) AS dm_count FROM DELIVERIES D WHERE d.tr_ID >= (SELECT TR_ID FROM TRANSACTION_FIRSTOFDAY WHERE date_of_tr = TRUNC(SYSDATE)) GROUP BY dm_code, current_ds_code", ds, "Oracle", "name", "graphiteudp");
     var tasks = new List<ITask> { new Task(taskParam, new DataClientFactory(log), new GraphiteClientFactory(log), new GraphiteParams("hostname", 1234), log) };
     var set = new TaskSet(tasks, new Stop(), 1000);
     var sleep = new Sleeper();
     var stop = new Stop();
     var controller = new Controller(set, sleep, stop, log);
     controller.Process();
 }
        public static TaskManager CreateTaskManager(SqlToGraphiteSection configuration)
        {
            var cacheLength = new TimeSpan(0, configuration.ConfigCacheLengthMinutes, 0);
            var stop = new Stop();
            var directoryImpl = new DirectoryImpl();
            var assemblyResolver = new AssemblyResolver(directoryImpl, log);
            IEncryption encryption = new Encryption();
            IDataClientFactory dataClientFactory = new DataClientFactory(log, assemblyResolver, encryption);
            IGraphiteClientFactory graphiteClientFactory = new GraphiteClientFactory(log);

            var configReader = new ConfigHttpReader(configuration.ConfigUri, configuration.ConfigUsername, configuration.ConfigPassword);
            var cache = new Cache(cacheLength, log);
            var sleeper = new Sleeper();
            var genericSer = new GenericSerializer(Global.GetNameSpace());
            var cr = new ConfigRepository(configReader, cache, sleeper, log, configuration.MinutesBetweenRetryToGetConfigOnError, genericSer);
            var configMapper = new ConfigMapper(configuration.Hostname, stop, dataClientFactory, graphiteClientFactory, log, cr);
            var roleConfigFactory = new RoleConfigFactory();
            var environment = new Environment();
            var taskSetBuilder = new TaskSetBuilder();
            var configController = new ConfigController(configMapper, log, cr, roleConfigFactory, environment, taskSetBuilder);
            return new TaskManager(log, configController, configuration.ConfigUri, stop, sleeper, configuration.CheckConfigUpdatedEveryMinutes);
        }
Beispiel #6
0
        public Worker(string name)
        {
            Name = name;
            LocalResource azureLocalResource = RoleEnvironment.GetLocalResource("LocalStorage");
            WorkDirectoryName = Path.Combine(azureLocalResource.RootPath, "WD" + name);

            /*** Init ***/
            // On instancie un objet de chaque classe héritant de BusinessProcess
            _employees = new List<IBusinessProcess>();
            Object[] args = new object[] { WorkDirectoryName };
            foreach (Type instance in
                    typeof(BusinessProcess).Assembly.GetTypes().Where(t => t.IsSubclassOf(typeof(BusinessProcess))))
            {
                _employees.Add(Activator.CreateInstance(instance, args) as IBusinessProcess);
            }

            //// TODO : find a good time
            int maximumTimeToSleepInSeconde;
            if (!int.TryParse(RoleEnvironment.GetConfigurationSettingValue("MaximumSecondesTimeSleep"),
                out maximumTimeToSleepInSeconde))
                maximumTimeToSleepInSeconde = 2 * 60 * 60; // 2 heures
            CustomSleeper = new Sleeper(2, maximumTimeToSleepInSeconde);
            CountLoop = 0;
        }
Beispiel #7
0
 public WhirlingDeath(Ability ability)
     : base(ability)
 {
     Radius       = ability.GetRadius();
     comboSleeper = new Sleeper();
 }
Beispiel #8
0
        public static void Game_OnUpdate(EventArgs args)
        {
            if (!IsEnable)
            {
                return;
            }
            if (!Members.MyHero.IsAlive)
            {
                return;
            }
            //CalculateDamage();
            if (_attacker == null)
            {
                _attacker = new Sleeper();
            }
            if (_spellSleeper == null)
            {
                _spellSleeper = new MultiSleeper();
            }
            if (_ethereal == null)
            {
                _ethereal = new Sleeper();
            }
            var laser   = Abilities.FindAbility("tinker_laser");
            var rockets = Abilities.FindAbility("tinker_heat_seeking_missile");

            if (_spellSleeper.Sleeping(Abilities.FindAbility("tinker_rearm")))
            {
                return;
            }

            /*var data = _laser.AbilitySpecialData;
             * var dmg = _laser.GetAbilityData("laser_damage", 1);
             * Console.WriteLine($"dmg: {dmg}");
             * foreach (var abilitySpecialData in data.Where(x=>x.IsSpellDamageValue))
             * {
             *  Console.WriteLine($"{abilitySpecialData.Name}: {abilitySpecialData.GetValue(_laser.Level-1)}");
             * }
             * Console.WriteLine($"Laser: {_laser.GetDamage(0)}/{_laser.GetDamage(1)}/{_laser.GetDamage(2)}/{_laser.GetDamage(3)}");*/
            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))
                {
                    CastCombo(x, laser, rockets, true);
                }
            }

            if (!IsComboHero)
            {
                if (_globalTarget != null)
                {
                    Helper.UnHandleEffect(_globalTarget);
                }
                _globalTarget = null;
                return;
            }
            if (_globalTarget == null || !_globalTarget.IsValid)
            {
                _globalTarget = Helper.ClosestToMouse(Members.MyHero);
                return;
            }
            Helper.HandleEffect(_globalTarget);
            if (Members.MyHero.IsChanneling() || _globalTarget.Distance2D(Members.MyHero) > 2500)
            {
                return;
            }
            if (AutoAttack)
            {
                if (UseOrbWalkker)
                {
                    Orbwalking.Orbwalk(_globalTarget, followTarget: true);
                }
                else if (!Members.MyHero.IsAttacking() && !_attacker.Sleeping && !_globalTarget.IsAttackImmune())
                {
                    Members.MyHero.Attack(_globalTarget);
                    _attacker.Sleep(250);
                }
            }
            CastCombo(_globalTarget, laser, rockets);
        }
Beispiel #9
0
 /// <summary>
 ///     Initializes static members of the <see cref="Polygon" /> class.
 /// </summary>
 static Polygon()
 {
     UpdateSleeper = new Sleeper();
 }
Beispiel #10
0
        private static void Load()
        {
            _sleeper = new Sleeper();

            Drawing.OnDraw += Drawing_OnDraw;
        }
 public void EscPressed()
 {
     addCustomerToQueueWindow.SendKeys("{ESC}");
     Sleeper.Delay(500);
     ResetAddCustomerToQueueWindow();
 }
 // Token: 0x060004B8 RID: 1208 RVA: 0x00018D88 File Offset: 0x00016F88
 public Necrophos(Unit9 owner, MultiSleeper abilitySleeper, Sleeper orbwalkSleeper, ControllableUnitMenu menu) : base(owner, abilitySleeper, orbwalkSleeper, menu)
 {
     base.ComboAbilities = new Dictionary <AbilityId, Func <ActiveAbility, UsableAbility> >
     {
         {
             AbilityId.necrolyte_death_pulse,
             (ActiveAbility x) => this.pulse = new NukeAbility(x)
         },
         {
             AbilityId.necrolyte_sadist,
             (ActiveAbility x) => this.shroud = new ShieldAbility(x)
         },
         {
             AbilityId.necrolyte_reapers_scythe,
             (ActiveAbility x) => this.scythe = new NukeAbility(x)
         },
         {
             AbilityId.item_phase_boots,
             (ActiveAbility x) => this.phase = new SpeedBuffAbility(x)
         },
         {
             AbilityId.item_blade_mail,
             (ActiveAbility x) => this.bladeMail = new ShieldAbility(x)
         },
         {
             AbilityId.item_blink,
             (ActiveAbility x) => this.blink = new BlinkAbility(x)
         },
         {
             AbilityId.item_sheepstick,
             (ActiveAbility x) => this.hex = new DisableAbility(x)
         },
         {
             AbilityId.item_orchid,
             (ActiveAbility x) => this.orchid = new DisableAbility(x)
         },
         {
             AbilityId.item_veil_of_discord,
             (ActiveAbility x) => this.veil = new DebuffAbility(x)
         },
         {
             AbilityId.item_bloodthorn,
             (ActiveAbility x) => this.bloodthorn = new Bloodthorn(x)
         },
         {
             AbilityId.item_nullifier,
             (ActiveAbility x) => this.nullifier = new Nullifier(x)
         },
         {
             AbilityId.item_rod_of_atos,
             (ActiveAbility x) => this.atos = new DisableAbility(x)
         },
         {
             AbilityId.item_shivas_guard,
             (ActiveAbility x) => this.shiva = new DebuffAbility(x)
         },
         {
             AbilityId.item_dagon_5,
             (ActiveAbility x) => this.dagon = new NukeAbility(x)
         }
     };
 }
Beispiel #13
0
 public CanUseItems()
 {
     _multiSleeper = new MultiSleeper();
     _afterBlink   = new Sleeper();
     _afterInvis   = new Sleeper();
 }
Beispiel #14
0
 public override bool CanBeCasted()
 {
     return(!Sleeper.Sleeping(Name) && Item != null && Hero.HasModifier(Modifiers.FountainRegeneration) &&
            (Hero.Health < Hero.MaximumHealth || Hero.Mana < Hero.MaximumMana));
 }
 // Token: 0x06000A2A RID: 2602 RVA: 0x000071DF File Offset: 0x000053DF
 public bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, float distance)
 {
     return(base.Owner.Distance(targetManager.Target) <= distance && this.UseAbility(targetManager, comboSleeper, true));
 }
Beispiel #16
0
 public SleeperTests()
 {
     sleeper   = new Sleeper();
     stopwatch = new Stopwatch();
 }
Beispiel #17
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="BreakerSharp" /> class.
 /// </summary>
 public BreakerSharp()
 {
     this.comboSleeper = new Sleeper();
     this.itemCombo    = new ItemCombo();
 }
Beispiel #18
0
 public override bool ForceUseAbility(TargetManager targetManager, Sleeper comboSleeper)
 {
     return(this.UseAbility(targetManager, comboSleeper, true));
 }
        private void Execute()
        {
            if (!Sleeper.Sleeping && Config.LasthitKey)
            {
                foreach (var familiar in Main.Updater.AllFamiliars)
                {
                    var enemyHero =
                        EntityManager <Hero> .Entities.FirstOrDefault(x =>
                                                                      x.IsAlive &&
                                                                      x.IsVisible &&
                                                                      x.IsEnemy(Owner) &&
                                                                      x.Distance2D(familiar.Unit) <= x.AttackRange + 400);

                    if (RunAwayBool && enemyHero != null)
                    {
                        familiar.Unit.Move(this.Owner.Position);
                        return;
                    }

                    var path            = Main.LaneHelper.GetPathCache(familiar.Unit);
                    var lastPoint       = path[path.Count - 1];
                    var closestPosition = path.Where(
                        x =>
                        x.Distance2D(lastPoint) < familiar.Unit.Position.Distance2D(lastPoint) - 300)
                                          .OrderBy(pos => pos.Distance2D(familiar.Unit.Position))
                                          .FirstOrDefault();
                    Sleeper.Sleep(250);
                    var closestTower = EntityManager <Tower> .Entities
                                       .Where(x => x.IsAlive && x.IsEnemy(familiar.Unit)).OrderBy(z => z.Distance2D(familiar.Unit))
                                       .FirstOrDefault();

                    var rnd = new Random();

                    if (closestTower != null && closestTower.IsInRange(familiar.Unit, 1000))
                    {
                        var myDist     = familiar.Unit.Distance2D(closestTower);
                        var allyCreeps = EntityManager <Creep> .Entities.Where(x =>
                                                                               x.IsAlly(familiar.Unit) && x.IsSpawned && x.IsAlive && !x.NetworkName.Contains("CDOTA_Unit_VisageFamiliar") &&
                                                                               x.IsInRange(closestTower, 700) && x.Distance2D(closestTower) <= myDist);

                        if (allyCreeps.Any())
                        {
                            if (closestTower.AttackTarget != null && closestTower.AttackTarget.Equals(familiar.Unit))
                            {
                                var creepForAggro = allyCreeps.FirstOrDefault();
                                if (creepForAggro != null && !Sleeper.Sleeping)
                                {
                                    CameraExtensions.PositionCamera(creepForAggro);
                                    familiar.Unit.Attack(creepForAggro);
                                    return;
                                }
                                else if (!Sleeper.Sleeping)
                                {
                                    CameraExtensions.PositionCamera(Fountain);
                                    familiar.Unit.Move(Fountain.Position);
                                    return;
                                }
                            }
                        }
                        else
                        {
                            var friendlyTower = EntityManager <Tower> .Entities
                                                .Where(x => x.IsAlive && x.IsAlly(familiar.Unit))
                                                .OrderBy(z => z.Distance2D(familiar.Unit))
                                                .FirstOrDefault();

                            if (friendlyTower != null && !Sleeper.Sleeping)
                            {
                                CameraExtensions.PositionCamera(friendlyTower);
                                familiar.Unit.Move(friendlyTower.Position);
                                Sleeper.Sleep(100);
                                return;
                            }
                            else if (!Sleeper.Sleeping)
                            {
                                CameraExtensions.PositionCamera(Fountain);
                                familiar.Unit.Move(this.Fountain.Position);
                                Sleeper.Sleep(100);
                                return;
                            }
                        }
                    }

                    var creep = GetTarget();
                    if (creep != null)
                    {
                        if (familiar.FamiliarMovementManager.Orbwalker.CanAttack(creep))
                        {
                            familiar.Unit.Attack(creep);

                            if (UseStoneForm && familiar.StoneForm.CanBeCasted)
                            {
                                var lowHpCreeps = EntityManager <Creep> .Entities.Count(x =>
                                                                                        x.IsSpawned && x.IsAlive && UnitExtensions.IsEnemy(x, Owner) &&
                                                                                        x.IsInRange(familiar.Unit, familiar.StoneForm.Radius) &&
                                                                                        familiar.StoneForm.GetDamage(x) >= x.Health);

                                if (lowHpCreeps >= 2)
                                {
                                    CameraExtensions.PositionCamera(familiar.Unit);
                                    familiar.StoneForm.UseAbility();
                                }
                            }
                        }
                    }
                    else if (!Ensage.Common.Extensions.UnitExtensions.IsAttacking(familiar.Unit))
                    {
                        CameraExtensions.PositionCamera(closestPosition.X, closestPosition.Y);
                        familiar.Unit.Attack(closestPosition);
                    }
                }
            }
        }
Beispiel #20
0
 public void UseAbility(Vector3 position, bool enemy = false)
 {
     Ability.UseAbility(position);
     CastedOnEnemy = enemy;
     Sleeper.Sleep(GetSleepTime + 1000);
 }
Beispiel #21
0
 public override void Use(bool queue = true)
 {
     Sleeper.Sleep(100 + Game.Ping, Name);
 }
 public void Cancel()
 {
     CancelButton.Click();
     Sleeper.Delay(500);
     ResetAddCustomerToQueueWindow();
 }
Beispiel #23
0
        public bool AutoControl(TargetManager targetManager, Sleeper comboSleeper, float distanceMultiplier)
        {
            var target = targetManager.Target;

            if (this.ray.IsSunRayActive)
            {
                if (this.Owner.GetAngle(target.Position) > 2)
                {
                    if (this.ray.Stop())
                    {
                        this.ray.Stop();
                        comboSleeper.Sleep(0.1f);
                        return(true);
                    }

                    return(false);
                }

                if (this.Owner.Distance(target) > this.ray.CastRange * distanceMultiplier)
                {
                    if (!this.ray.IsSunRayMoving)
                    {
                        if (this.ray.ToggleMovement())
                        {
                            comboSleeper.Sleep(0.1f);
                            return(true);
                        }

                        return(false);
                    }
                }
                else
                {
                    if (this.ray.IsSunRayMoving)
                    {
                        if (this.ray.ToggleMovement())
                        {
                            comboSleeper.Sleep(0.1f);
                            return(true);
                        }

                        return(false);
                    }
                }

                if (this.Owner.BaseUnit.Move(target.Position))
                {
                    comboSleeper.Sleep(0.1f);
                    return(true);
                }

                return(false);
            }

            if (this.ray.CanBeCasted() && this.ray.CanHit(target))
            {
                if (this.Owner.Distance(target) < 300 && !target.IsStunned && !target.IsHexed && !target.IsRooted)
                {
                    return(false);
                }

                if (this.ray.UseAbility(target, HitChance.Low))
                {
                    comboSleeper.Sleep(0.3f);
                    return(true);
                }
            }

            return(false);
        }
Beispiel #24
0
 public override bool ForceUseAbility(TargetManager targetManager, Sleeper comboSleeper)
 {
     return(false);
 }
 public PurchaseCDAdapter PurchaseCD()
 {
     PurchaseCDButton.Click();
     Sleeper.Delay(4000);
     return(new PurchaseCDAdapter(shellWindow, CustomerDetailsTabConrol));
 }
Beispiel #26
0
        public static void Init()
        {
            Effects.Clear();
            _shrineList.Clear();
            _sleeper          = new Sleeper();
            _abilityDictinart = new Dictionary <uint, Ability>();
            if (_firstTime)
            {
                _firstTime  = false;
                _shrineList =
                    ObjectManager.GetEntities <Unit>()
                    .Where(x => x.IsValid && x.IsAlive && x.ClassId == SrineClass && x.Team == Members.MyPlayer.Team)
                    .ToList();
                Game.OnUpdate += args =>
                {
                    if (_sleeper.Sleeping)
                    {
                        return;
                    }
                    _sleeper.Sleep(100);
                    if (Enable)
                    {
                        foreach (var v in _shrineList)
                        {
                            var dist = v.Distance2D(Members.MyHero);

                            if (dist <= 700 && v.CheckForAbility())
                            {
                                HandleEffect(v);
                            }
                            else
                            {
                                UnHandleEffect(v);
                            }
                        }
                    }
                    else
                    {
                        if (Effects.Any())
                        {
                            Effects.ToDictionary(x => x.Key, y => y.Value).ForEach(x => UnHandleEffect(x.Key));
                        }
                    }
                };
                Drawing.OnDraw += args =>
                {
                    if (Draw || IsNumsEnable)
                    {
                        foreach (var v in _shrineList)
                        {
                            var pos = HUDInfo.GetHPbarPosition(v);
                            if (pos.IsZero)
                            {
                                continue;
                            }
                            var filler = v.GetFiller();
                            if (filler == null || filler.AbilityState == AbilityState.Ready)
                            {
                                continue;
                            }
                            var cd        = filler.Cooldown;
                            var cdLength  = filler.CooldownLength;
                            var hpBarSize = HUDInfo.GetHPBarSizeX();
                            var size      = new Vector2(hpBarSize * 2, BarSize);
                            var buff      = v.FindModifier("modifier_filler_heal_aura");
                            var isBuff    = buff != null;
                            var remTine   = buff?.RemainingTime;
                            var cdDelta   = isBuff ? buff.RemainingTime * size.X / 5 : cd * size.X / cdLength;
                            pos += new Vector2(-hpBarSize / 2, hpBarSize * 1.5f);
                            if (Draw)
                            {
                                Drawing.DrawRect(pos, new Vector2(size.X, size.Y), Color.Black);
                                Drawing.DrawRect(pos, new Vector2(isBuff ? cdDelta : size.X - cdDelta, size.Y),
                                                 isBuff ? Color.Orange : Color.YellowGreen);
                                Drawing.DrawRect(pos, new Vector2(size.X, size.Y), Color.Black, true);
                            }
                            if (IsNumsEnable)
                            {
                                var text     = isBuff ? $"{(int) (remTine/5*100)}%" : $"{(int) (100 - cd/cdLength*100)}%";
                                var textSize = Drawing.MeasureText(text, "Arial",
                                                                   new Vector2((float)(size.Y * DigSize), size.Y / 2), FontFlags.AntiAlias);
                                var textPos = pos + new Vector2(size.X / 2 - textSize.X / 2, size.Y - textSize.Y);

                                /*Drawing.DrawRect(textPos - new Vector2(0, 0),
                                 * new Vector2(textSize.X, textSize.Y),
                                 * new Color(0, 0, 0, 200));*/
                                Drawing.DrawText(
                                    text,
                                    textPos,
                                    new Vector2(textSize.Y, 0),
                                    Color.White,
                                    FontFlags.AntiAlias | FontFlags.StrikeOut);
                            }
                        }
                    }
                };
                ObjectManager.OnRemoveEntity += args =>
                {
                    var shrine = args.Entity;
                    if (shrine.ClassId == SrineClass)
                    {
                        _shrineList.Remove(shrine as Unit);
                    }
                };
            }
        }
Beispiel #27
0
 public abstract bool ForceUseAbility(TargetManager targetManager, Sleeper comboSleeper);
Beispiel #28
0
        protected override void OnActivate()
        {
            Log.Debug("pre init");
            Mode = new InvokerMode(
                Key.G,
                Context.Value,
                this);

            Quas                   = Owner.GetAbilityById(AbilityId.invoker_quas);
            Wex                    = Owner.GetAbilityById(AbilityId.invoker_wex);
            Exort                  = Owner.GetAbilityById(AbilityId.invoker_exort);
            BlockerSleeper         = new Sleeper();
            SunStrike              = new AbilityInfo(Exort, Exort, Exort, Owner.GetAbilityById(AbilityId.invoker_sun_strike));
            ColdSnap               = new AbilityInfo(Quas, Quas, Quas, Owner.GetAbilityById(AbilityId.invoker_cold_snap));
            Alacrity               = new AbilityInfo(Wex, Wex, Exort, Owner.GetAbilityById(AbilityId.invoker_alacrity));
            Meteor                 = new AbilityInfo(Exort, Exort, Wex, Owner.GetAbilityById(AbilityId.invoker_chaos_meteor));
            Blast                  = new AbilityInfo(Quas, Exort, Wex, Owner.GetAbilityById(AbilityId.invoker_deafening_blast));
            ForgeSpirit            = new AbilityInfo(Exort, Exort, Quas, Owner.GetAbilityById(AbilityId.invoker_forge_spirit));
            GhostWalk              = new AbilityInfo(Quas, Quas, Wex, Owner.GetAbilityById(AbilityId.invoker_ghost_walk));
            IceWall                = new AbilityInfo(Quas, Quas, Exort, Owner.GetAbilityById(AbilityId.invoker_ice_wall));
            Tornado                = new AbilityInfo(Wex, Wex, Quas, Owner.GetAbilityById(AbilityId.invoker_tornado));
            Emp                    = new AbilityInfo(Wex, Wex, Wex, Owner.GetAbilityById(AbilityId.invoker_emp));
            _invokeSleeper         = new Sleeper();
            GlobalGhostWalkSleeper = new Sleeper();
            AbilityInfos           = new List <AbilityInfo>
            {
                SunStrike,
                ColdSnap,
                Alacrity,
                Meteor,
                Blast,
                ForgeSpirit,
                GhostWalk,
                IceWall,
                Tornado,
                Emp
            };

            //retards re coming
            foreach (var ability in AbilityInfos)
            {
                ability.LoadInvoker(this);
            }


            Empty1        = Owner.GetAbilityById(AbilityId.invoker_empty1);
            Empty2        = Owner.GetAbilityById(AbilityId.invoker_empty2);
            InvokeAbility = Owner.GetAbilityById(AbilityId.invoker_invoke);
            Log.Debug("post init");
            Config = new Config(this);
            Log.Debug("new config");
            Config.ComboKey.Item.ValueChanged += HotkeyChanged;
            Log.Debug("event to config");
            OrbwalkerManager.Value.Activate();
            Log.Debug("activate OrbwalkerManager");
            TargetManager.Value.Activate();
            Log.Debug("activate TargetManager");
            Mode.UpdateConfig(Config);
            Log.Debug("load config");
            OrbwalkerManager.Value.RegisterMode(Mode);
            Log.Debug("RegisterMode");
            foreach (var valueOrbwalkingMode in OrbwalkerManager.Value.OrbwalkingModes)
            {
                Log.Warn($"Mode: {valueOrbwalkingMode.Value}");
            }
            foreach (var valueOrbwalkingMode in OrbwalkerManager.Value.CustomOrbwalkingModes)
            {
                Log.Warn($"Custom Mode: {valueOrbwalkingMode}");
            }
            Mode.Load();
            var key = KeyInterop.KeyFromVirtualKey((int)Config.ComboKey.Item.GetValue <KeyBind>().Key);

            Mode.Key = key;
            Log.Debug($"_mode loaded. Key for combo -> {Mode.Key}");
            InventoryManager.Value.Attach(this);
            Log.Debug("InventoryManager Attach");
            SelectedCombo = 0;
            InventoryManager.Value.CollectionChanged += ValueOnCollectionChanged;
            //if (InventoryManager.Value.Inventory.Items.Any(x => x.Id == AbilityId.item_cyclone))

            /*if (Eul!=null)
             * {
             *  _eulCombo1 = new Combo(this, new[]
             *  {
             *      new AbilityInfo(Eul.Ability), SunStrike, Meteor, Blast, ColdSnap, Alacrity, ForgeSpirit
             *  });
             *  _eulCombo2 = new Combo(this, new[]
             *  {
             *      new AbilityInfo(Eul.Ability), Meteor, Blast, ColdSnap, Alacrity, ForgeSpirit
             *  });
             *  _eulCombo3 = new Combo(this, new[]
             *  {
             *      new AbilityInfo(Eul.Ability), SunStrike, IceWall, ColdSnap, Alacrity, ForgeSpirit
             *  });
             *  Config.ComboPanel.Combos.Add(_eulCombo1);
             *  Config.ComboPanel.Combos.Add(_eulCombo2);
             *  Config.ComboPanel.Combos.Add(_eulCombo3);
             * }*/

            Unit.OnModifierAdded   += HeroOnOnModifierAdded;
            Unit.OnModifierRemoved += HeroOnOnModifierRemoved;
            SpCounter = new SphereCounter();

            /*Player.OnExecuteOrder += (sender, args) =>
             * {
             *  var id = args.Ability?.Id;
             *  if (id == AbilityId.invoker_exort || id == AbilityId.invoker_wex || id == AbilityId.invoker_quas || id == AbilityId.invoker_invoke)
             *      return;
             *  if (BlockActions)
             *  {
             *      Game.PrintMessage($"OrderId: {args.OrderId}");
             *      args.Process = false;
             *  }
             * };*/
        }
Beispiel #29
0
		public void ThreeCommands (TestCaseResult result)
		{
			/*
			VirtuosoCommand cmd1 = connection.CreateCommand ();
			Sleeper sleeper1 = new Sleeper ("first", cmd1, 30, 60);
			Thread thread1 = new Thread (new ThreadStart (sleeper1.Sleep));
			*/

			VirtuosoCommand cmd2 = connection.CreateCommand ();
			Sleeper sleeper2 = new Sleeper ("second", cmd2, 20, 40);
			Thread thread2 = new Thread (new ThreadStart (sleeper2.Sleep));

			VirtuosoCommand cmd3 = connection.CreateCommand ();
			Sleeper sleeper3 = new Sleeper ("third", cmd3, 10, 20);
			Thread thread3 = new Thread (new ThreadStart (sleeper3.Sleep));

			try
			{
				//thread1.Start ();
				//Thread.Sleep (2000);
				thread2.Start ();
				Thread.Sleep (2000);
				thread3.Start ();
			}
			finally
			{
				//thread1.Join ();
				thread2.Join ();
				thread3.Join ();
				//cmd1.Dispose ();
				cmd2.Dispose ();
				cmd3.Dispose ();
			}
		}
 // Token: 0x060005CD RID: 1485 RVA: 0x0001CE34 File Offset: 0x0001B034
 public LegionCommander(Unit9 owner, MultiSleeper abilitySleeper, Sleeper orbwalkSleeper, ControllableUnitMenu menu) : base(owner, abilitySleeper, orbwalkSleeper, menu)
 {
     base.ComboAbilities = new Dictionary <AbilityId, Func <ActiveAbility, UsableAbility> >
     {
         {
             AbilityId.legion_commander_overwhelming_odds,
             (ActiveAbility x) => this.odds = new OverwhelmingOdds(x)
         },
         {
             AbilityId.legion_commander_press_the_attack,
             (ActiveAbility x) => this.attack = new BuffAbility(x)
         },
         {
             AbilityId.legion_commander_duel,
             (ActiveAbility x) => this.duel = new Duel(x)
         },
         {
             AbilityId.item_blink,
             (ActiveAbility x) => this.blink = new LegionBlink(x)
         },
         {
             AbilityId.item_phase_boots,
             (ActiveAbility x) => this.phase = new SpeedBuffAbility(x)
         },
         {
             AbilityId.item_blade_mail,
             (ActiveAbility x) => this.bladeMail = new ShieldAbility(x)
         },
         {
             AbilityId.item_black_king_bar,
             (ActiveAbility x) => this.bkb = new ShieldAbility(x)
         },
         {
             AbilityId.item_heavens_halberd,
             (ActiveAbility x) => this.halberd = new DisableAbility(x)
         },
         {
             AbilityId.item_mjollnir,
             (ActiveAbility x) => this.mjollnir = new ShieldAbility(x)
         },
         {
             AbilityId.item_armlet,
             (ActiveAbility x) => this.armlet = new BuffAbility(x)
         },
         {
             AbilityId.item_abyssal_blade,
             (ActiveAbility x) => this.abyssal = new DisableAbility(x)
         },
         {
             AbilityId.item_orchid,
             (ActiveAbility x) => this.orchid = new DisableAbility(x)
         },
         {
             AbilityId.item_bloodthorn,
             (ActiveAbility x) => this.bloodthorn = new Bloodthorn(x)
         },
         {
             AbilityId.item_nullifier,
             (ActiveAbility x) => this.nullifier = new Nullifier(x)
         }
     };
 }
Beispiel #31
0
        private async Task ExecuteAsync(CancellationToken token)
        {
            try
            {
                if (Game.IsPaused || !Owner.IsValid || !Owner.IsAlive || Owner.IsStunned())
                {
                    return;
                }

                var damageCalculation = DamageCalculation.DamageList.OrderByDescending(x => x.GetHealth).OrderByDescending(x => x.GetHero.Player.Kills).ToList();
                var damage            = damageCalculation.FirstOrDefault(x => (x.GetHealth - x.GetDamage) / x.GetHero.MaximumHealth <= 0.0f);

                Damage = damage;

                if (damage == null)
                {
                    return;
                }

                if (!Update.IsEnabled)
                {
                    Update.IsEnabled = true;
                }

                var target = damage.GetHero;

                if (Cancel(target))
                {
                    return;
                }

                if (!target.IsLinkensProtected() && !Config.LinkenBreaker.AntimageShield(target))
                {
                    // Veil
                    var Veil = Main.Veil;
                    if (Veil != null &&
                        Menu.AutoKillStealToggler.Value.IsEnabled(Veil.ToString()) &&
                        Veil.CanBeCasted &&
                        Veil.CanHit(target))
                    {
                        Veil.UseAbility(target.Position);
                        await Await.Delay(Veil.GetCastDelay(target.Position), token);
                    }

                    // Ethereal
                    var Ethereal = Main.Ethereal;
                    if (Ethereal != null &&
                        Menu.AutoKillStealToggler.Value.IsEnabled(Ethereal.ToString()) &&
                        Ethereal.CanBeCasted &&
                        Ethereal.CanHit(target))
                    {
                        Ethereal.UseAbility(target);
                        Sleeper.Sleep(Ethereal.GetHitTime(target));
                        await Await.Delay(Ethereal.GetCastDelay(target), token);
                    }

                    // Shivas
                    var Shivas = Main.Shivas;
                    if (Shivas != null &&
                        Menu.AutoKillStealToggler.Value.IsEnabled(Shivas.ToString()) &&
                        Shivas.CanBeCasted &&
                        Shivas.CanHit(target))
                    {
                        Shivas.UseAbility();
                        await Await.Delay(Shivas.GetCastDelay(), token);
                    }

                    if (!Sleeper.Sleeping || target.IsEthereal())
                    {
                        // Lightning Bolt
                        var LightningBolt = Main.LightningBolt;
                        if (Menu.AutoKillStealToggler.Value.IsEnabled(LightningBolt.ToString()) &&
                            LightningBolt.CanBeCasted &&
                            LightningBolt.CanHit(target))
                        {
                            LightningBolt.UseAbility(target);
                            await Await.Delay(LightningBolt.GetCastDelay(target), token);
                        }

                        // Arc Lightning
                        var ArcLightning = Main.ArcLightning;
                        if (Menu.AutoKillStealToggler.Value.IsEnabled(ArcLightning.ToString()) &&
                            ArcLightning.CanBeCasted &&
                            ArcLightning.CanHit(target))
                        {
                            ArcLightning.UseAbility(target);
                            await Await.Delay(ArcLightning.GetCastDelay(target), token);

                            return;
                        }

                        // Dagon
                        var Dagon = Main.Dagon;
                        if (Dagon != null &&
                            Menu.AutoKillStealToggler.Value.IsEnabled("item_dagon_5") &&
                            Dagon.CanBeCasted &&
                            Dagon.CanHit(target))
                        {
                            Dagon.UseAbility(target);
                            await Await.Delay(Dagon.GetCastDelay(target), token);

                            return;
                        }

                        // Nimbus
                        var Nimbus = Main.Nimbus;
                        if (Menu.AutoKillStealToggler.Value.IsEnabled(Nimbus.ToString()) && Nimbus.CanBeCasted)
                        {
                            Nimbus.UseAbility(target.Position);
                            await Await.Delay(Nimbus.GetCastDelay(target.Position), token);

                            return;
                        }

                        // Thundergods Wrath
                        var ThundergodsWrath = Main.ThundergodsWrath;
                        if (Menu.AutoKillStealToggler.Value.IsEnabled(ThundergodsWrath.ToString()) && ThundergodsWrath.CanBeCasted)
                        {
                            ThundergodsWrath.UseAbility();
                            await Await.Delay(ThundergodsWrath.GetCastDelay(), token);
                        }
                    }
                }
                else
                {
                    Config.LinkenBreaker.Handler.RunAsync();
                }
            }
            catch (TaskCanceledException)
            {
                // canceled
            }
            catch (Exception e)
            {
                Main.Log.Error(e);
            }
        }
Beispiel #32
0
 public static void Flush()
 {
     _sleeper = new Sleeper();
 }
 public void OkClick()
 {
     OkButton.Click();
     Sleeper.Delay(500);
     ResetAddCustomerToQueueWindow();
 }
Beispiel #34
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="Killsteal" /> class.
 /// </summary>
 public Killsteal()
 {
     this.targetFindSleeper = new Sleeper();
 }
 public void SelfService()
 {
     SelfServiceButton.Click();
     Sleeper.Delay(500);
     ResetAddCustomerToQueueWindow();
 }
Beispiel #36
0
 public abstract bool UseAbility(TargetManager targetManager, Sleeper comboSleeper, bool aoe);
Beispiel #37
0
 public void Stop(Hero hero)
 {
     hero.Stop();
     Sleeper.Sleep(Game.Ping);
 }