Пример #1
0
 private static void OnUpdate(EventArgs args)
 {
     DoAutoplay();
     MetaHandler.DoChecks();
     MetaHandler.UpdateObjects();
     if (Bot.InFountain() || !Carry.IsDead)
     {
         _tookRecallDecision = false;
     }
     if (Carry != null && Carry.IsDead && RandomDecision() &&
         Environment.TickCount - _lastTimeTookRecallDecision > Rand.Next(60000, 300000))
     {
         _tookRecallDecision         = true;
         _lastTimeTookRecallDecision = Environment.TickCount;
     }
 }
Пример #2
0
        private static void OnGameLoad(EventArgs args)
        {
            _loaded   = (Bot.Level == 1) ? Environment.TickCount:Environment.TickCount - 140000;
            _stepTime = Environment.TickCount;
            var map = Utility.Map.GetMap();

            if (map != null && map.Type == Utility.Map.MapType.SummonersRift)
            {
                if (Bot.Team == GameObjectTeam.Order)
                {
                    _chosen      = Blue + Rand.Next(-76, 76);
                    _safe        = Purple + Rand.Next(-67, 67);
                    BotLanePos.X = 11376 + Rand.Next(-50, 50);
                    BotLanePos.Y = 1062 + Rand.Next(-50, 50);
                    TopLanePos.X = 1302 + Rand.Next(-50, 50);
                    TopLanePos.Y = 10249 + Rand.Next(-50, 50);
                }
                if (Bot.Team == GameObjectTeam.Chaos)
                {
                    _chosen      = Purple + Rand.Next(-67, 67);
                    _safe        = Blue + Rand.Next(-76, 76);
                    BotLanePos.X = 13496 + Rand.Next(-50, 50);
                    BotLanePos.Y = 4218 + Rand.Next(-50, 50);
                    TopLanePos.X = 4849 + Rand.Next(-50, 50);
                    TopLanePos.Y = 13535 + Rand.Next(-50, 50);
                }
            }
            else
            {
                _byPassLoadedCheck = true;
                if (Bot.Team == GameObjectTeam.Order)
                {
                    _chosen = Blue;
                    _safe   = Purple;
                }
                if (Bot.Team == GameObjectTeam.Chaos)
                {
                    _chosen = Purple;
                    _safe   = Blue;
                }
            }
            AutoLevel levelUpSpells = new AutoLevel(TreesAutoLevel.GetSequence());

            AutoLevel.Enabled(true);
            FileHandler.DoChecks();
            MetaHandler.LoadObjects();
        }
Пример #3
0
        private static void OnGameLoad(EventArgs args)
        {
            _loaded   = (Bot.Level == 1) ? Environment.TickCount:Environment.TickCount - 140000;
            _stepTime = Environment.TickCount;
            var map = Utility.Map.GetMap();

            if (map.Type == Utility.Map.MapType.SummonersRift)
            {
                //Initialize
                var condition = Bot.Team == GameObjectTeam.Order;
                _chosen    = condition ? Blue : Purple;
                _safe      = condition ? Purple : Blue;
                BotLanePos = condition ? new Vector2(11376, 1062).To3D() : new Vector2(13496, 4218).To3D();
                TopLanePos = condition ? new Vector2(1302, 10249).To3D() : new Vector2(4849, 13535).To3D();

                //Randomize:
                _chosen   += Rand.Next(-100, 100);
                _safe     += Rand.Next(-100, 100);
                TopLanePos = TopLanePos.Randomize(-150, 150);
                BotLanePos = BotLanePos.Randomize(-150, 150);
            }
            else
            {
                _byPassLoadedCheck = true;
                var condition = Bot.Team == GameObjectTeam.Order;
                _chosen = condition ? Blue : Purple;
                _safe   = condition ? Purple : Blue;

                //Randomize:
                _chosen += Rand.Next(-100, 100);
                _safe   += Rand.Next(-100, 100);
            }
            var _autoLevel = new AutoSharpporting.AutoLevel(AutoSharpporting.AutoLevel.GetSequenceFromDb());

            _autoLevel.Enable();
            MetaHandler.LoadObjects();
        }
Пример #4
0
        public static void DoAutoplay()
        {
            if (Bot.InFountain() && RandomDecision())
            {
                WalkAround(Bot.Position);
            }
            var timeElapsed = Environment.TickCount - _loaded;

            if (!Bot.IsDead)
            {
                try
                {
                    var turret = MetaHandler.EnemyTurrets.FirstOrDefault(t => t.Distance(Bot.Position) < 1200);
                    if (_overrideAttackUnitAction && !_tookRecallDecision)
                    {
                        Bot.IssueOrder(GameObjectOrder.MoveTo, _safepos.To3D());
                    }
                    if (!Bot.UnderTurret(true))
                    {
                        _overrideAttackUnitAction = false;
                    }
                    if (Bot.UnderTurret(true) && MetaHandler.NearbyAllyMinions(turret, 750) > 2 && IsBotSafe() && !_tookRecallDecision)
                    {
                        if (turret.Distance(Bot.Position) < Bot.AttackRange && !_overrideAttackUnitAction)
                        {
                            Bot.IssueOrder(GameObjectOrder.AttackUnit, turret);
                        }
                    }
                    else
                    {
                        if (TargetSelector.GetTarget(Bot.AttackRange, TargetSelector.DamageType.Physical) != null)
                        {
                            Obj_AI_Hero target = TargetSelector.GetTarget(Bot.AttackRange, TargetSelector.DamageType.Physical);
                            if (target != null && target.IsValid && !target.IsDead && IsBotSafe() &&
                                !target.UnderTurret(true) && !_overrideAttackUnitAction && !_tookRecallDecision)
                            {
                                Bot.IssueOrder(GameObjectOrder.AttackUnit, target);
                            }
                        }
                    }
                    if (Bot.UnderTurret(true) && MetaHandler.NearbyAllyMinions(turret, 750) < 2)
                    {
                        _safepos.X = (Bot.Position.X + _safe);
                        _safepos.Y = (Bot.Position.Y + _safe);
                        Bot.IssueOrder(GameObjectOrder.MoveTo, _safepos.To3D());
                    }
                    #region Carry is null
                    if (Carry == null && timeElapsed > 15000 && timeElapsed < 135000 && !_byPassLoadedCheck)
                    {
                        if (Bot.InFountain() || Bot.Distance(BotLanePos) > 400)
                        {
                            Bot.IssueOrder(GameObjectOrder.MoveTo, BotLanePos.To3D());
                        }
                        if (Bot.Distance(BotLanePos) < 1000)
                        {
                            WalkAround(BotLanePos.To3D());
                            if (timeElapsed > 60000 && !MetaHandler.ShouldSupportTopLane)
                            {
                                if (
                                    MetaHandler.AllyHeroes.FirstOrDefault(
                                        hero => !hero.IsMe && hero.Distance(Bot.Position) < 4500 && !MetaHandler.HasSmite(hero)) !=
                                    null)
                                {
                                    Carry =
                                        MetaHandler.AllyHeroes.FirstOrDefault(
                                            hero =>
                                            !hero.IsMe && hero.Distance(Bot.Position) < 4500 && !MetaHandler.HasSmite(hero));
                                }
                            }
                            if (timeElapsed > 60000 && MetaHandler.ShouldSupportTopLane)
                            {
                                if (
                                    MetaHandler.AllyHeroes.FirstOrDefault(
                                        hero => !hero.IsMe && hero.Distance(TopLanePos) < 4500 && !MetaHandler.HasSmite(hero)) !=
                                    null)
                                {
                                    Carry =
                                        MetaHandler.AllyHeroes.FirstOrDefault(
                                            hero =>
                                            !hero.IsMe && hero.Distance(TopLanePos) < 4500 && !MetaHandler.HasSmite(hero));
                                }
                            }
                        }
                    }
                    if (_byPassLoadedCheck && Carry == null)
                    {
                        if (MetaHandler.AllyHeroes.FirstOrDefault(hero => !hero.IsMe && !hero.InFountain() && !MetaHandler.HasSmite(hero)) != null)
                        {
                            Carry = MetaHandler.AllyHeroes.FirstOrDefault(hero => !hero.IsMe && !hero.InFountain() && !MetaHandler.HasSmite(hero));
                        }
                    }
                    #endregion
                    #region Carry is dead
                    if (Carry != null)
                    {
                        if (IsBotSafe() && Carry.IsDead || Carry.InFountain())
                        {
                            if (_tempcarry == null || _tempcarry.IsDead || _tempcarry.InFountain())
                            {
                                if (
                                    MetaHandler.AllyHeroes.FirstOrDefault(
                                        hero =>
                                        !hero.IsMe && !hero.InFountain() && !hero.IsDead &&
                                        !MetaHandler.HasSmite(hero)) != null)
                                {
                                    _tempcarry =
                                        MetaHandler.AllyHeroes.FirstOrDefault(
                                            hero =>
                                            !hero.IsMe && !hero.InFountain() && !hero.IsDead &&
                                            !MetaHandler.HasSmite(hero));
                                }
                                if (
                                    MetaHandler.AllyHeroes.FirstOrDefault(
                                        hero =>
                                        !hero.IsMe && !hero.InFountain() && !hero.IsDead &&
                                        !MetaHandler.HasSmite(hero)) == null &&
                                    MetaHandler.AllyHeroes.FirstOrDefault(
                                        hero => !hero.IsMe && !hero.InFountain() && !hero.IsDead) != null)
                                {
                                    //well f**k, let's follow the jungler -sighs-
                                    _tempcarry =
                                        MetaHandler.AllyHeroes.FirstOrDefault(
                                            hero => !hero.IsMe && !hero.InFountain() && !hero.IsDead);
                                }
                                if (!MetaHandler.AllyHeroes.Any(hero => !hero.IsMe && !hero.IsDead))
                                //everyone is dead
                                {
                                    if (!Bot.InFountain())
                                    {
                                        NearestAllyTurret = MetaHandler.AllyTurrets.FirstOrDefault();
                                        if (NearestAllyTurret != null)
                                        {
                                            _saferecall.X       = NearestAllyTurret.Position.X + _safe;
                                            _saferecall.Y       = NearestAllyTurret.Position.Y;
                                            _tookRecallDecision = true;
                                            if (Bot.Position.Distance(_saferecall.To3D()) < 200)
                                            {
                                                Bot.Spellbook.CastSpell(SpellSlot.Recall);
                                            }
                                            else
                                            {
                                                Bot.IssueOrder(GameObjectOrder.MoveTo, _saferecall.To3D());
                                            }
                                        }
                                    }
                                }
                            }
                            if (_tempcarry != null)
                            {
                                Console.WriteLine("Carry dead or afk, following: " + _tempcarry.ChampionName);
                                _frontline.X = _tempcarry.Position.X + _chosen;
                                _frontline.Y = _tempcarry.Position.Y + _chosen;
                                if (!(_tempcarry.UnderTurret(true) && MetaHandler.NearbyAllyMinions(_tempcarry, 400) < 2) && IsBotSafe())
                                {
                                    if (_tempcarry.Distance(Bot) > 550 && !_tookRecallDecision)
                                    {
                                        Bot.IssueOrder(GameObjectOrder.MoveTo, _frontline.To3D());
                                        WalkAround(_tempcarry);
                                    }
                                }
                            }
                        }
                    }
                    #endregion Carry is dead
                    #region Following
                    if (Carry != null && !Carry.IsDead && !Carry.InFountain() && IsBotSafe() && !(Carry.UnderTurret(true) && MetaHandler.NearbyAllyMinions(Carry, 400) < 2))
                    {
                        Console.WriteLine("All good, following: " + Carry.ChampionName);
                        _frontline.X = Carry.Position.X + _chosen;
                        _frontline.Y = Carry.Position.Y + _chosen;
                        if (Carry.Distance(Bot) > 550 && !_tookRecallDecision)
                        {
                            Bot.IssueOrder(GameObjectOrder.MoveTo, _frontline.To3D());
                        }

                        WalkAround(Carry);
                    }
                    #endregion Following
                    #region Carry not found
                    if (timeElapsed > 135000 &&
                        Carry == null && IsBotSafe())
                    {
                        if (_tempcarry == null || _tempcarry.IsDead || _tempcarry.InFountain())
                        {
                            if (
                                MetaHandler.AllyHeroes.FirstOrDefault(
                                    hero => !hero.IsMe && !hero.InFountain() && !hero.IsDead && !MetaHandler.HasSmite(hero)) != null)
                            {
                                _tempcarry =
                                    MetaHandler.AllyHeroes.FirstOrDefault(
                                        hero => !hero.IsMe && !hero.InFountain() && !hero.IsDead && !MetaHandler.HasSmite(hero));
                            }
                            if (
                                MetaHandler.AllyHeroes.FirstOrDefault(
                                    hero => !hero.IsMe && !hero.InFountain() && !hero.IsDead && !MetaHandler.HasSmite(hero)) == null &&
                                MetaHandler.AllyHeroes.FirstOrDefault(
                                    hero => !hero.IsMe && !hero.InFountain() && !hero.IsDead) != null)
                            {
                                //well f**k, let's follow the jungler -sighs-
                                _tempcarry =
                                    MetaHandler.AllyHeroes.FirstOrDefault(
                                        hero => !hero.IsMe && !hero.InFountain() && !hero.IsDead);
                            }
                        }
                        if (_tempcarry != null)
                        {
                            Console.WriteLine("Carry not found, following: " + _tempcarry.ChampionName);
                            _frontline.X = _tempcarry.Position.X + _chosen;
                            _frontline.Y = _tempcarry.Position.Y + _chosen;
                            if (!(_tempcarry.UnderTurret(true) && MetaHandler.NearbyAllyMinions(_tempcarry, 400) < 2) && IsBotSafe())
                            {
                                if (Bot.Distance(_frontline) > 550 && !_tookRecallDecision)
                                {
                                    Bot.IssueOrder(GameObjectOrder.MoveTo, _frontline.To3D());
                                }
                                WalkAround(_tempcarry);
                            }
                        }
                    }
                    #endregion
                    #region Lowhealth mode
                    if (!IsBotSafe() && !Bot.InFountain())
                    {
                        NearestAllyTurret = MetaHandler.AllyTurrets.FirstOrDefault();
                        if (NearestAllyTurret != null)
                        {
                            _saferecall.X = NearestAllyTurret.Position.X + _safe;
                            _saferecall.Y = NearestAllyTurret.Position.Y;
                            if (Bot.Position.Distance(_saferecall.To3D()) < 200)
                            {
                                if (Environment.TickCount - _lastRecallAttempt > Rand.Next(500, 2000))
                                {
                                    Bot.Spellbook.CastSpell(SpellSlot.Recall);
                                    _lastRecallAttempt = Environment.TickCount;
                                }
                            }
                            else
                            {
                                Bot.IssueOrder(GameObjectOrder.MoveTo, _saferecall.To3D());
                            }
                        }
                    }
                    #endregion
                    #region Carry Switching

                    if ((Bot.Level > 8 || Environment.TickCount - _loaded > 900000) && Environment.TickCount - _lastSwitched > 180000)
                    {
                        var alliesSortedByKDA =
                            MetaHandler.AllyHeroes.OrderByDescending(hero => (hero.ChampionsKilled / ((hero.Deaths != 0) ? hero.Deaths : 1))); //AsunaChan2Kawaii
                        if (alliesSortedByKDA.FirstOrDefault() != null)
                        {
                            Carry         = alliesSortedByKDA.FirstOrDefault();
                            _lastSwitched = Environment.TickCount;
                        }
                    }
                    #endregion
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        } //end of DoAutoplay()
Пример #5
0
        private static bool IsBotSafe()
        {
            var map = Utility.Map.GetMap();

            if (map != null && map.Type == Utility.Map.MapType.HowlingAbyss)
            {
                return(true);
            }
            if (_tookRecallDecision)
            {
                return(false);
            }
            if (Bot.InFountain())
            {
                return((Bot.Health > Bot.MaxHealth * 0.9f) && (Bot.Mana > Bot.MaxMana * 0.8f));
            }
            if (Bot.Mana < Bot.MaxMana * _lowManaRatio)
            {
                return(Bot.Health > Bot.MaxHealth * _lowHealthIfLowManaRatio && !Bot.IsRecalling() && !(Bot.Gold > _neededGoldToBack && !MetaHandler.HasSixItems()));
            }
            return((Bot.Health > Bot.MaxHealth * _lowHealthRatio) && !Bot.IsRecalling() && !(Bot.Gold > _neededGoldToBack && !MetaHandler.HasSixItems()));
        }