예제 #1
0
 protected override void OnPreUpdate()
 {
     if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LastHit && ResourceManager.Check("lasthit") &&
         E.IsReady())
     {
         var ePoison = Menu.Item(Menu.Name + ".lasthit.e-poison").GetValue <bool>();
         var eHit    = Menu.Item(Menu.Name + ".lasthit.e").GetValue <bool>();
         if (eHit || ePoison)
         {
             var m =
                 MinionManager.GetMinions(Player.ServerPosition, E.Range, MinionTypes.All, MinionTeam.NotAlly)
                 .FirstOrDefault(
                     e =>
                     (_lastAaMinion == null || e.NetworkId != _lastAaMinion.NetworkId ||
                      Game.Time > _lastAaMinionEndTime) && e.Health < E.GetDamage(e) - 5 &&
                     (ePoison && GetPoisonBuffEndTime(e) > E.ArrivalTime(e) || eHit));
             if (m != null)
             {
                 Casting.TargetSkill(m, E);
             }
         }
     }
 }
예제 #2
0
        protected override void LaneClear()
        {
            if (!ResourceManager.Check("lane-clear"))
            {
                return;
            }

            var useQ = Menu.Item(Menu.Name + ".lane-clear.q").GetValue <bool>() && Q.IsReady();
            var useW = Menu.Item(Menu.Name + ".lane-clear.w").GetValue <bool>() && W.IsReady();
            var useE = Menu.Item(Menu.Name + ".lane-clear.e").GetValue <bool>() && E.IsReady() &&
                       DelayManager.Check("e-delay", _lastECast);

            if (useE)
            {
                var minion =
                    MinionManager.GetMinions(Player.ServerPosition, E.Range)
                    .FirstOrDefault(
                        e =>
                        GetPoisonBuffEndTime(e) > E.ArrivalTime(e) &&
                        (e.Health > E.GetDamage(e) * 2 || e.Health < E.GetDamage(e) - 5));
                if (minion != null)
                {
                    _lastEEndTime = Game.Time + E.ArrivalTime(minion) + 0.1f;
                    _lastECast    = Environment.TickCount;
                    Casting.TargetSkill(minion, E);
                }
            }

            if (useQ || useW)
            {
                var minions =
                    MinionManager.GetMinions(Player.ServerPosition, Q.Range + Q.Width)
                    .Where(e => GetPoisonBuffEndTime(e) < Q.Delay * 1.1)
                    .ToList();
                if (minions.Any())
                {
                    if (useQ)
                    {
                        var prediction = Q.GetCircularFarmLocation(minions, Q.Width + 30);
                        if (prediction.MinionsHit > 1 && Game.Time > _lastPoisonClearDelay ||
                            _lastPoisonClearPosition.Distance(prediction.Position) > W.Width * 1.1f)
                        {
                            var mP =
                                minions.Count(
                                    p =>
                                    p.Distance(prediction.Position) < Q.Width + 30 &&
                                    GetPoisonBuffEndTime(p) >= 0.5f);
                            if (prediction.MinionsHit - mP > 1)
                            {
                                _lastPoisonClearDelay    = Game.Time + Q.Delay + 1;
                                _lastPoisonClearPosition = prediction.Position;
                                Q.Cast(prediction.Position);
                            }
                        }
                    }
                    if (useW)
                    {
                        var prediction = W.GetCircularFarmLocation(minions, W.Width + 50);
                        if (prediction.MinionsHit > 2 &&
                            (Game.Time > _lastPoisonClearDelay ||
                             _lastPoisonClearPosition.Distance(prediction.Position) > Q.Width * 1.1f))
                        {
                            var mP =
                                minions.Count(
                                    p =>
                                    p.Distance(prediction.Position) < W.Width + 50 &&
                                    GetPoisonBuffEndTime(p) >= 0.5f);
                            if (prediction.MinionsHit - mP > 1)
                            {
                                _lastPoisonClearDelay    = Game.Time + W.Delay + 2;
                                _lastPoisonClearPosition = prediction.Position;
                                W.Cast(prediction.Position);
                            }
                        }
                    }
                }
            }
        }
        private static void OnCorePostUpdate(EventArgs args)
        {
            try
            {
                if (_menu == null || !_menu.Item(_menu.Name + ".enabled").GetValue <bool>())
                {
                    return;
                }

                if (Environment.TickCount - _lastTick >= _interval)
                {
                    _lastTick = Environment.TickCount;

                    if (_menu.Item(_menu.Name + ".fountain").GetValue <bool>() && !ObjectManager.Player.InFountain())
                    {
                        return;
                    }

                    if (ObjectManager.Player.ManaPercent >=
                        _menu.Item(_menu.Name + ".min-mana").GetValue <Slider>().Value)
                    {
                        var tearSlot = ObjectManager.Player.GetSpellSlot("TearsDummySpell");
                        if (tearSlot != SpellSlot.Unknown &&
                            Game.Time > ObjectManager.Player.GetSpell(tearSlot).CooldownExpires&&
                            ObjectManager.Player.CountEnemiesInRange(
                                _menu.Item(_menu.Name + ".min-distance").GetValue <Slider>().Value) <= 0)
                        {
                            var spell =
                                _spells.FirstOrDefault(
                                    s => s.IsReady() && _menu.Item(_menu.Name + "." + s.Slot).GetValue <bool>());
                            if (spell != null)
                            {
                                if (spell.IsSkillshot)
                                {
                                    var target =
                                        GameObjects.EnemyHeroes.Where(e => e.IsValidTarget(spell.Range))
                                        .Concat(MinionManager.GetMinions(spell.Range))
                                        .FirstOrDefault();
                                    if (target != null)
                                    {
                                        spell.Cast(target.Position);
                                    }
                                    else
                                    {
                                        var position = ObjectManager.Player.Position.Extend(
                                            Game.CursorPos, Math.Min(1000, spell.Range * 0.8f + Random.Next(1, 26)));
                                        if (position.IsValid())
                                        {
                                            spell.Cast(position);
                                        }
                                    }
                                }
                                else if (spell.Range > 0f)
                                {
                                    if (spell.Speed.Equals(default(float)))
                                    {
                                        spell.Cast();
                                    }
                                    else
                                    {
                                        var target =
                                            GameObjects.EnemyHeroes.Where(e => e.IsValidTarget(spell.Range))
                                            .Concat(MinionManager.GetMinions(spell.Range))
                                            .FirstOrDefault();
                                        if (target != null)
                                        {
                                            spell.Cast(target);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }