示例#1
0
        private void OnOrbwalkingAfterAttack(AttackableUnit unit, AttackableUnit target)
        {
            try
            {
                if (unit.IsMe && W.IsReady())
                {
                    var useW        = false;
                    var wMin        = 0;
                    var laneclear   = false;
                    var jungleClear = false;
                    switch (Orbwalker.ActiveMode)
                    {
                    case Orbwalking.OrbwalkingMode.Combo:
                        useW = Menu.Item(Menu.Name + ".combo.w").GetValue <bool>();
                        break;

                    case Orbwalking.OrbwalkingMode.Mixed:
                        useW = Menu.Item(Menu.Name + ".harass.w").GetValue <bool>();
                        break;

                    case Orbwalking.OrbwalkingMode.LaneClear:
                        useW = Menu.Item(Menu.Name + ".lane-clear.w").GetValue <bool>();
                        wMin = target.Team != GameObjectTeam.Neutral
                                ? Menu.Item(Menu.Name + ".lane-clear.w-min").GetValue <Slider>().Value
                                : 1;
                        laneclear   = true;
                        jungleClear = target.Team == GameObjectTeam.Neutral;
                        break;
                    }
                    if (useW &&
                        (!laneclear ||
                         (jungleClear
                             ? (ResourceManager.Check("lane-clear-w") || ResourceManager.IgnoreJungle("lane-clear-w"))
                             : ResourceManager.Check("lane-clear-w"))))
                    {
                        var range   = W.Range + Player.BoundingRadius * 2f;
                        var targets = laneclear
                            ? MinionManager.GetMinions(range + 450, MinionTypes.All, MinionTeam.NotAlly)
                            : GameObjects.EnemyHeroes.Where(e => e.IsValidTarget(range + 450))
                                      .Cast <Obj_AI_Base>()
                                      .ToList();
                        if (targets.Count >= wMin && targets.Any(Orbwalking.InAutoAttackRange) &&
                            (wMin == 0 ||
                             targets.Any(
                                 t =>
                                 Orbwalking.InAutoAttackRange(t) &&
                                 targets.Any(t2 => t2.NetworkId != t.NetworkId && t2.Distance(t) <= 450))))
                        {
                            W.Cast();
                            Orbwalking.ResetAutoAttackTimer();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Global.Logger.AddItem(new LogItem(ex));
            }
        }
        protected override void LaneClear()
        {
            var useQ = Menu.Item(Menu.Name + ".lane-clear.q").GetValue <bool>() && Q.IsReady() &&
                       ResourceManager.Check("lane-clear-q");

            if (useQ)
            {
                Casting.Farm(
                    Q, MinionManager.GetMinions(Q.Range + Q.Width),
                    Menu.Item(Menu.Name + ".lane-clear.q-min").GetValue <Slider>().Value);
            }
        }
        protected override void JungleClear()
        {
            var useQ = Menu.Item(Menu.Name + ".jungle-clear.q").GetValue <bool>() && Q.IsReady() &&
                       ResourceManager.Check("jungle-clear-q");

            if (useQ)
            {
                Casting.Farm(
                    Q,
                    MinionManager.GetMinions(
                        Q.Range + Q.Width, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth), 1);
            }
        }
        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));
            }
        }