protected override void JungleClear()
        {
            if (!ResourceManager.Check("jungle-clear"))
            {
                return;
            }
            var useQ = Menu.Item(Menu.Name + ".jungle-clear.q").GetValue <bool>() && Q.IsReady();
            var useE = Menu.Item(Menu.Name + ".jungle-clear.e").GetValue <bool>() && E.IsReady();

            if (useQ)
            {
                var minion =
                    MinionManager.GetMinions(
                        Q.ChargedMaxRange, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth)
                    .FirstOrDefault();
                if (minion != null)
                {
                    Q.CastOnUnit(minion);
                }
            }

            if (useE)
            {
                Casting.Farm(
                    E,
                    MinionManager.GetMinions(
                        E.Range + E.Width, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth), 1);
            }
        }
        protected override void LaneClear()
        {
            if (!ResourceManager.Check("lane-clear"))
            {
                return;
            }
            var useQ = Menu.Item(Menu.Name + ".lane-clear.q").GetValue <bool>() && Q.IsReady();
            var useE = Menu.Item(Menu.Name + ".lane-clear.e").GetValue <bool>() && E.IsReady();
            var minE = Menu.Item(Menu.Name + ".lane-clear.e-min").GetValue <Slider>().Value;

            if (useQ)
            {
                var minion =
                    MinionManager.GetMinions(Q.Range)
                    .FirstOrDefault(m => m.Health > Q.GetDamage(m) * 1.5f || m.Health < Q.GetDamage(m));
                if (minion != null)
                {
                    Q.CastOnUnit(minion);
                }
            }

            if (useE)
            {
                Casting.Farm(E, MinionManager.GetMinions(E.Range + E.Width), minE);
            }
        }
 private void OnOrbwalkingAfterAttack(AttackableUnit unit, AttackableUnit target)
 {
     try
     {
         if (unit.IsMe)
         {
             var useW = false;
             if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.LaneClear)
             {
                 var minion = target as Obj_AI_Minion;
                 if (minion != null)
                 {
                     if (target.Team == GameObjectTeam.Neutral)
                     {
                         useW = Menu.Item(Menu.Name + ".jungle-clear.w").GetValue <bool>() &&
                                ResourceManager.Check("jungle-clear");
                     }
                     else
                     {
                         useW = Menu.Item(Menu.Name + ".lane-clear.w").GetValue <bool>() &&
                                ResourceManager.Check("lane-clear") &&
                                MinionManager.GetMinions(W.Range).Count >=
                                Menu.Item(Menu.Name + ".lane-clear.w-min").GetValue <Slider>().Value;
                     }
                 }
             }
             if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Mixed)
             {
                 useW = target is Obj_AI_Hero && Menu.Item(Menu.Name + ".harass.w").GetValue <bool>();
             }
             if (Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo)
             {
                 useW = target is Obj_AI_Hero && Menu.Item(Menu.Name + ".combo.w").GetValue <bool>();
             }
             if (useW)
             {
                 W.Cast();
             }
         }
     }
     catch (Exception ex)
     {
         Global.Logger.AddItem(new LogItem(ex));
     }
 }
        private void QLogic()
        {
            try
            {
                var target = TargetSelector.GetTarget(Q.Range);
                if (target != null)
                {
                    Q.CastOnUnit(target);
                }
                else if (Menu.Item(Menu.Name + ".miscellaneous.extended-q").GetValue <bool>())
                {
                    target = TargetSelector.GetTarget(Q1);
                    if (target != null)
                    {
                        var heroPositions = (from t in GameObjects.EnemyHeroes
                                             where t.IsValidTarget(Q1.Range)
                                             let prediction = Q.GetPrediction(t)
                                                              select new CPrediction.Position(t, prediction.UnitPosition)).Where(
                            t => t.UnitPosition.Distance(Player.Position) < Q1.Range).ToList();
                        if (heroPositions.Any())
                        {
                            var minions = MinionManager.GetMinions(
                                Q1.Range, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.None);

                            if (minions.Any(m => m.IsMoving) && !heroPositions.Any(h => HasPassiveDebuff(h.Hero)))
                            {
                                return;
                            }

                            var outerMinions   = minions.Where(m => m.Distance(Player) > Q.Range).ToList();
                            var innerPositions = minions.Where(m => m.Distance(Player) < Q.Range).ToList();
                            foreach (var minion in innerPositions)
                            {
                                var lMinion  = minion;
                                var coneBuff = new Geometry.Polygon.Sector(
                                    minion.Position,
                                    Player.Position.Extend(minion.Position, Player.Distance(minion) + Q.Range * 0.5f),
                                    (float)(40 * Math.PI / 180), Q1.Range - Q.Range);
                                var coneNormal = new Geometry.Polygon.Sector(
                                    minion.Position,
                                    Player.Position.Extend(minion.Position, Player.Distance(minion) + Q.Range * 0.5f),
                                    (float)(60 * Math.PI / 180), Q1.Range - Q.Range);
                                foreach (var enemy in
                                         heroPositions.Where(
                                             m => m.UnitPosition.Distance(lMinion.Position) < Q1.Range - Q.Range))
                                {
                                    if (coneBuff.IsInside(enemy.Hero) && HasPassiveDebuff(enemy.Hero))
                                    {
                                        Q.CastOnUnit(minion);
                                        return;
                                    }
                                    if (coneNormal.IsInside(enemy.UnitPosition))
                                    {
                                        var insideCone =
                                            outerMinions.Where(m => coneNormal.IsInside(m.Position)).ToList();
                                        if (!insideCone.Any() ||
                                            enemy.UnitPosition.Distance(minion.Position) <
                                            insideCone.Select(
                                                m => m.Position.Distance(minion.Position) - m.BoundingRadius)
                                            .DefaultIfEmpty(float.MaxValue)
                                            .Min())
                                        {
                                            Q.CastOnUnit(minion);
                                            return;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
Esempio n. 5
0
        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));
            }
        }