public static void OnUpdate()
 {
     foreach (LandStack landStack in Core.Config._LandStacks.Where<LandStack>((Func<LandStack, bool>) (x => x.MoveForKill)))
       {
     LandStack _SB = landStack;
     Hero hero = EntityManager<Hero>.Entities.FirstOrDefault<Hero>((Func<Hero, bool>) (x =>
     {
       if (x.Team != Core.Config._Hero.Team && TargetChecker.PreCheck(x))
     return (double) x.Distance2D(_SB._Unit.Position) <= 450.0;
       return false;
     }));
     if ((Entity) hero != (Entity) null)
     {
       _SB.IsRunToKill = true;
       foreach (LandBomb landBomb in Core.Config._LandBombs.Where<LandBomb>((Func<LandBomb, bool>) (x => (double) x._Unit.Distance2D(_SB._Unit, false) <= 450.0)))
     landBomb._Unit.Move(hero.Position);
     }
     else if (_SB.IsRunToKill)
     {
       _SB.IsRunToKill = false;
       foreach (LandBomb landBomb in Core.Config._LandBombs.Where<LandBomb>((Func<LandBomb, bool>) (x => (double) x._Unit.Distance2D(_SB._Unit, false) <= 450.0)))
     landBomb._Unit.Stop();
     }
       }
 }
Example #2
0
        private static bool ShouldDetonateLand(Hero _Enemy, Vector3 _Pos)
        {
            if (!TargetChecker.PreCheck(_Enemy))
            {
                return(false);
            }
            float num = DamageManager._LandDemage(_Enemy);

            return(Core.Config._StasisBombs.Any <StasisBomb>((Func <StasisBomb, bool>)(x => (double)x._Unit.Distance2D(_Pos) <= 400.0)) && (double)Core.Config._LandBombs.Count <LandBomb>((Func <LandBomb, bool>)(x => (double)x._Unit.Distance2D(_Pos) <= 400.0)) * (double)num > (double)_Enemy.Health + (double)_Enemy.HealthRegeneration * 2.0);
        }
Example #3
0
        public TargetCheckingResult CheckTargetAvailability(TargetPlatforms targetPlatform, string address, string encryptedCredentials, string sshPort, string token)
        {
            try
            {
                var targetChecker      = new TargetChecker();
                var credentialsInBytes = Encoding.Default.GetBytes(encryptedCredentials);
                var targetInfo         = new TargetInfoExtractor().GetTargetInformation(credentialsInBytes, address, sshPort);

                return(targetChecker.Check(targetPlatform, targetInfo));
            }
            catch (Exception ex)
            {
                var logMessage = String.Format(EXECUTION_ERROR_MESSAGE, ex.Message, ex.StackTrace);
                Logger.Error(logMessage);
                return(new TargetCheckingResult()
                {
                    ErrorMessage = ex.Message, IsTargetAvailable = false
                });
            }
        }
Example #4
0
 private static bool ShouldDetonate(Hero _Enemy, Vector3 _Pos)
 {
     foreach (BombStack bombStack in Core.Config._BombStacks)
     {
         BombStack _Stack = bombStack;
         if (!TargetChecker.CheckPos(_Enemy, _Stack))
         {
             return(false);
         }
         if (_Stack.DetonateOnHeroes == 1)
         {
             List <RemoteBomb> list = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x =>
             {
                 if (x.IsHit(_Pos))
                 {
                     return((double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0);
                 }
                 return(false);
             })).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime)).ToList <RemoteBomb>();
             int kill = DamageManager.NeedToKill(_Enemy, list);
             if (list.Count >= kill)
             {
                 return(true);
             }
         }
         else
         {
             int num = 0;
             Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x => (double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0)).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime));
             foreach (Hero _Enemy1 in EntityManager <Hero> .Entities.Where <Hero>((Func <Hero, bool>)(x =>
             {
                 if (x.Team != Core.Config._Hero.Team && !x.IsIllusion && TargetChecker.ForcePreCheck(x))
                 {
                     return(TargetChecker.CheckPos(x, _Stack));
                 }
                 return(false);
             })))
             {
                 List <RemoteBomb> list = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x =>
                 {
                     if (x.IsHit(_Pos))
                     {
                         return((double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0);
                     }
                     return(false);
                 })).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime)).ToList <RemoteBomb>();
                 List <RemoteBomb> _Bombs = list;
                 int kill = DamageManager.NeedToKill(_Enemy1, _Bombs);
                 if (list.Count >= kill)
                 {
                     ++num;
                 }
             }
             if (num >= _Stack.DetonateOnHeroes)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
Example #5
0
 public static void OnUpdate()
 {
     if (Core.Config._Items.Force == null || !Core.Config._Items.Force.CanBeCasted)
     {
         return;
     }
     foreach (Hero hero in EntityManager <Hero> .Entities.Where <Hero>((Func <Hero, bool>)(x =>
     {
         if (x.Team != Core.Config._Hero.Team && !x.IsIllusion)
         {
             return(TargetChecker.ForcePreCheck(x));
         }
         return(false);
     })))
     {
         Vector3 _Pos = hero.InFront(600f);
         if (hero.IsLinkensProtected())
         {
             if (Core.Config._Items.Hex != null && Core.Config._Items.Hex.IsReady && (double)Core.Config._Items.Hex.CastRange >= (double)Core.Config._Hero.Distance2D((Unit)hero, false))
             {
                 if (ForceLogic.ShouldDetonate(hero, _Pos) || ForceLogic.ShouldDetonateLand(hero, _Pos) || ForceLogic.ShouldDetonateCross(hero, _Pos))
                 {
                     Core.Config._Items.Hex.UseAbility((Unit)hero);
                     break;
                 }
             }
             else if (Core.Config._Items.Eul != null && Core.Config._Items.Eul.IsReady && (double)Core.Config._Items.Eul.CastRange >= (double)Core.Config._Hero.Distance2D((Unit)hero, false))
             {
                 if (ForceLogic.ShouldDetonate(hero, _Pos) || ForceLogic.ShouldDetonateLand(hero, _Pos) || ForceLogic.ShouldDetonateCross(hero, _Pos))
                 {
                     Core.Config._Items.Eul.UseAbility((Unit)hero);
                     break;
                 }
             }
             else if (Core.Config._Items.Salo != null && Core.Config._Items.Salo.IsReady && (double)Core.Config._Items.Salo.CastRange >= (double)Core.Config._Hero.Distance2D((Unit)hero, false))
             {
                 if (ForceLogic.ShouldDetonate(hero, _Pos) || ForceLogic.ShouldDetonateLand(hero, _Pos) || ForceLogic.ShouldDetonateCross(hero, _Pos))
                 {
                     Core.Config._Items.Salo.UseAbility((Unit)hero);
                     break;
                 }
             }
             else if (Core.Config._Items.Salo2 != null && Core.Config._Items.Salo2.IsReady && (double)Core.Config._Items.Salo2.CastRange >= (double)Core.Config._Hero.Distance2D((Unit)hero, false))
             {
                 if (ForceLogic.ShouldDetonate(hero, _Pos) || ForceLogic.ShouldDetonateLand(hero, _Pos) || ForceLogic.ShouldDetonateCross(hero, _Pos))
                 {
                     Core.Config._Items.Salo2.UseAbility((Unit)hero);
                     break;
                 }
             }
             else if (Core.Config._Items.Etherial != null && Core.Config._Items.Etherial.IsReady && (double)Core.Config._Items.Etherial.CastRange >= (double)Core.Config._Hero.Distance2D((Unit)hero, false))
             {
                 if (ForceLogic.ShouldDetonate(hero, _Pos) || ForceLogic.ShouldDetonateLand(hero, _Pos) || ForceLogic.ShouldDetonateCross(hero, _Pos))
                 {
                     Core.Config._Items.Etherial.UseAbility((Unit)hero);
                     break;
                 }
             }
             else
             {
                 Item dagon = DagonManager.GetDagon();
                 if ((Entity)dagon != (Entity)null && (double)dagon.Cooldown == 0.0 && (double)dagon.CastRange >= (double)Core.Config._Hero.Distance2D((Unit)hero, false) && (ForceLogic.ShouldDetonate(hero, _Pos) || ForceLogic.ShouldDetonateLand(hero, _Pos) || ForceLogic.ShouldDetonateCross(hero, _Pos)))
                 {
                     Core.Config._Items.Dagon1.UseAbility((Unit)hero);
                     break;
                 }
             }
         }
         else if (ForceLogic.ShouldDetonate(hero, _Pos) || ForceLogic.ShouldDetonateLand(hero, _Pos) || ForceLogic.ShouldDetonateCross(hero, _Pos))
         {
             Core.Config._Items.Force.UseAbility((Unit)hero);
             break;
         }
     }
 }
Example #6
0
        private static bool ShouldDetonateCross(Hero _Enemy, Vector3 _Pos)
        {
            if (!TargetChecker.PreCheck(_Enemy))
            {
                return(false);
            }
            float num1 = DamageManager._LandDemage(_Enemy);

            if (Core.Config._StasisBombs.Any <StasisBomb>((Func <StasisBomb, bool>)(x => (double)x._Unit.Distance2D(_Pos) <= 400.0)))
            {
                float num2  = (float)Core.Config._LandBombs.Count <LandBomb>((Func <LandBomb, bool>)(x => (double)x._Unit.Distance2D(_Pos) <= 400.0)) * num1;
                int   num3  = 0;
                int   index = -1;
                foreach (string heroesFullName in Core.Config._HeroesFullNames)
                {
                    if (heroesFullName == _Enemy.Name)
                    {
                        index = num3;
                        break;
                    }
                    ++num3;
                }
                RemoteBomb[]        array  = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x => x.IsHit(_Pos))).ToArray <RemoteBomb>();
                List <EnterInStack> source = new List <EnterInStack>();
                foreach (RemoteBomb remoteBomb in array)
                {
                    RemoteBomb B     = remoteBomb;
                    BombStack  _Temp = Core.Config._BombStacks.MinOrDefault <BombStack, float>((Func <BombStack, float>)(x => B._Unit.Distance2D(x._Unit, false)));
                    if (_Temp != null && (double)_Temp._Unit.Distance2D(B._Unit, false) <= 100.0 && (index == -1 ? 1 : (_Temp._Disabler[index] ? 1 : 0)) == 0)
                    {
                        if (source.Any <EnterInStack>((Func <EnterInStack, bool>)(x => x.Stack.Id == _Temp.Id)))
                        {
                            if (!source.Any <EnterInStack>((Func <EnterInStack, bool>)(x => x.Bombs.Any <RemoteBomb>((Func <RemoteBomb, bool>)(y => (Entity)y._Unit == (Entity)B._Unit)))))
                            {
                                source.First <EnterInStack>((Func <EnterInStack, bool>)(x => x.Stack.Id == _Temp.Id)).Bombs.Add(B);
                            }
                        }
                        else
                        {
                            EnterInStack enterInStack = new EnterInStack()
                            {
                                Bombs = new List <RemoteBomb>(),
                                Stack = _Temp
                            };
                            enterInStack.Bombs.Add(B);
                            source.Add(enterInStack);
                        }
                    }
                }
                float num4 = 0.0f;
                foreach (EnterInStack enterInStack in source)
                {
                    if (enterInStack.Stack.DetonateOnHeroes == 1)
                    {
                        float num5 = enterInStack.Bombs.Sum <RemoteBomb>((Func <RemoteBomb, float>)(x => x._Damage)) * (1f - Core.Config._QSpell.GetDamageReduction((Unit)_Enemy));
                        if ((double)num4 < (double)num5)
                        {
                            num4 = num5;
                        }
                    }
                }
                if ((double)num2 + (double)num4 > (double)_Enemy.Health + (double)_Enemy.HealthRegeneration * 2.0)
                {
                    return(true);
                }
            }
            return(false);
        }
Example #7
0
 public AsyncObserver(TargetChecker target, bool inverse = false)
 {
     _target  = target;
     _inverse = inverse;
 }
Example #8
0
 public static async Task OnUpdateAsync()
 {
     try
     {
         List <BombStack> .Enumerator enumerator;
         enumerator = Core.Config._BombStacks.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 BombStack _Stack = enumerator.Current;
                 if (_Stack.DetonateOnHeroes == 1)
                 {
                     if (Core.Config._Menu.Features.UseOldHeroSelector)
                     {
                         foreach (Hero _Enemy in Heroes.GetByTeam(Team.Dire == Core.Config._Hero.Team ? Team.Dire : Team.Radiant).Where <Hero>((Func <Hero, bool>)(x =>
                         {
                             if (!x.IsIllusion && TargetChecker.PreCheck(x) && TargetChecker.CheckPos(x, _Stack))
                             {
                                 return(!TargetChecker.CanCounter(x));
                             }
                             return(false);
                         })))
                         {
                             await DetonationLogic.SingleDetonationAsync(_Enemy, _Stack);
                         }
                     }
                     else
                     {
                         foreach (Hero _Enemy in EntityManager <Hero> .Entities.Where <Hero>((Func <Hero, bool>)(x =>
                         {
                             if (x.Team != Core.Config._Hero.Team && !x.IsIllusion && (TargetChecker.PreCheck(x) && TargetChecker.CheckPos(x, _Stack)))
                             {
                                 return(!TargetChecker.CanCounter(x));
                             }
                             return(false);
                         })))
                         {
                             await DetonationLogic.SingleDetonationAsync(_Enemy, _Stack);
                         }
                     }
                 }
                 else
                 {
                     int           num2       = 0;
                     int           num3       = 0;
                     List <string> stringList = new List <string>();
                     IOrderedEnumerable <RemoteBomb> orderedEnumerable = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x => (double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0)).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime));
                     if (Core.Config._Menu.Features.UseOldHeroSelector)
                     {
                         foreach (Hero hero in Heroes.GetByTeam(Team.Dire == Core.Config._Hero.Team ? Team.Dire : Team.Radiant).Where <Hero>((Func <Hero, bool>)(x =>
                         {
                             if (!x.IsIllusion && TargetChecker.PreCheck(x) && TargetChecker.CheckPos(x, _Stack))
                             {
                                 return(!TargetChecker.CanCounter(x));
                             }
                             return(false);
                         })))
                         {
                             Hero _Enemy            = hero;
                             List <RemoteBomb> list = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x =>
                             {
                                 if (x.IsHit(_Enemy))
                                 {
                                     return((double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0);
                                 }
                                 return(false);
                             })).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime)).ToList <RemoteBomb>();
                             int kill = DamageManager.NeedToKill(_Enemy, list);
                             if (list.Count >= kill)
                             {
                                 if (kill > num3 && kill < 100)
                                 {
                                     num3 = kill;
                                 }
                                 ++num2;
                                 stringList.Add(_Enemy.Name);
                             }
                         }
                     }
                     else
                     {
                         foreach (Hero hero in EntityManager <Hero> .Entities.Where <Hero>((Func <Hero, bool>)(x =>
                         {
                             if (x.Team != Core.Config._Hero.Team && !x.IsIllusion && (TargetChecker.PreCheck(x) && TargetChecker.CheckPos(x, _Stack)))
                             {
                                 return(!TargetChecker.CanCounter(x));
                             }
                             return(false);
                         })))
                         {
                             Hero _Enemy            = hero;
                             List <RemoteBomb> list = Core.Config._RemoteBombs.Where <RemoteBomb>((Func <RemoteBomb, bool>)(x =>
                             {
                                 if (x.IsHit(_Enemy))
                                 {
                                     return((double)x._Unit.Distance2D(_Stack._Unit, false) <= 100.0);
                                 }
                                 return(false);
                             })).OrderBy <RemoteBomb, float>((Func <RemoteBomb, float>)(x => x._Unit.CreateTime)).ToList <RemoteBomb>();
                             int kill = DamageManager.NeedToKill(_Enemy, list);
                             if (list.Count >= kill)
                             {
                                 if (kill > num3 && kill < 100)
                                 {
                                     num3 = kill;
                                 }
                                 ++num2;
                                 stringList.Add(_Enemy.Name);
                             }
                         }
                     }
                     if (num2 >= _Stack.DetonateOnHeroes)
                     {
                         foreach (string Name in stringList)
                         {
                             Sleeper.Sleep(Name, 1f);
                         }
                         int num4 = 0;
                         Core.Config.Log.Warn("DetonateOnStack Multi");
                         foreach (RemoteBomb remoteBomb in (IEnumerable <RemoteBomb>)orderedEnumerable)
                         {
                             remoteBomb.Detonate();
                             ++num4;
                             if (num4 >= num3)
                             {
                                 break;
                             }
                         }
                     }
                 }
             }
         }
         finally
         {
             enumerator.Dispose();
         }
         enumerator = new List <BombStack> .Enumerator();
     }
     catch (Exception ex)
     {
         Core.Config.Log.Error(ex.ToString());
     }
 }