private void OnGameUpdate(EventArgs args) { try { if (!Menu.Item(Name + "Hotkey").GetValue <KeyBind>().Active) { return; } var smiteSpellEnabled = _smiteSpell != null && Menu.Item(Name + "SpellSmiteUse").GetValue <bool>(); var heroSpellEnabled = Menu.Item(Name + "Spell" + ObjectManager.Player.ChampionName + "Enabled").GetValue <bool>(); if (_smiteSpell != null && smiteSpellEnabled && !heroSpellEnabled) { if (_currentMinion == null) { _currentMinion = ObjectManager.Player.ServerPosition.GetMinionFastByNames(SmiteRange, _mobNames); } if (_smiteSpell.IsReady()) { if (_currentMinion.IsValidTarget(SmiteRange)) { if ( ObjectManager.Player.GetSummonerSpellDamage(_currentMinion, Damage.SummonerSpell.Smite) > _currentMinion.Health) { _smiteSpell.Cast(_currentMinion, true); } } else { _currentMinion = null; } } return; } if (_delayActive && _currentMinion != null && _smiteSpell != null && _currentMinion.IsValid && !_currentMinion.IsDead) { if (ObjectManager.Player.GetSummonerSpellDamage(_currentMinion, Damage.SummonerSpell.Smite) >= _currentMinion.Health && _smiteSpell.CanCast(_currentMinion)) { _smiteSpell.Cast(_currentMinion); } } HeroSpell heroSpell = null; _currentMinion = ObjectManager.Player.ServerPosition.GetNearestMinionByNames(_mobNames); if (_currentMinion != null && _smiteSpell != null) { if (heroSpellEnabled) { heroSpell = _heroSpells.OrderByDescending(s => s.Priority) .FirstOrDefault(s => s.Enabled && s.CanCast(_currentMinion)); heroSpellEnabled = heroSpell != null; } double totalDamage = 0; if (smiteSpellEnabled && _smiteSpell.CanCast(_currentMinion)) { totalDamage += ObjectManager.Player.GetSummonerSpellDamage( _currentMinion, Damage.SummonerSpell.Smite); } if (heroSpellEnabled) { totalDamage += heroSpell.CalculateDamage(_currentMinion, false); } if (totalDamage >= _currentMinion.Health) { if (heroSpellEnabled) { heroSpell.Cast(_currentMinion); if (smiteSpellEnabled && _smiteSpell.CanCast(_currentMinion)) { _delayActive = true; Utility.DelayAction.Add( (int)heroSpell.CalculateHitDelay(_currentMinion), delegate { if (_smiteSpell.CanCast(_currentMinion)) { _smiteSpell.Cast(_currentMinion); } _delayActive = false; }); } } else if (smiteSpellEnabled && _smiteSpell.CanCast(_currentMinion)) { _smiteSpell.Cast(_currentMinion); } } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }
private void OnDrawingDraw(EventArgs args) { try { if (!Menu.Item(Name + "Hotkey").GetValue <KeyBind>().Active || ObjectManager.Player.IsDead) { return; } var minion = _currentMinion != null && _currentMinion.IsValidTarget(); if (_smiteSpell != null && Menu.Item(Name + "SpellSmiteDrawingRange").GetValue <bool>()) { Render.Circle.DrawCircle( ObjectManager.Player.Position, SmiteRange, minion && _smiteSpell.IsReady() && _smiteSpell.CanCast(_currentMinion) ? Menu.Item(Name + "SpellSmiteDrawingUseableColor").GetValue <Color>() : Menu.Item(Name + "SpellSmiteDrawingUnusableColor").GetValue <Color>(), Menu.Item(Name + "SpellSmiteDrawingThickness").GetValue <Slider>().Value); } if (Menu.Item(Name + "Spell" + ObjectManager.Player.ChampionName + "Enabled").GetValue <bool>()) { foreach (var spell in _heroSpells.Where(s => s.Enabled && s.Drawing)) { Render.Circle.DrawCircle( ObjectManager.Player.Position, spell.Range, spell.CanCast(_currentMinion) ? spell.UseableColor : spell.UnusableColor, spell.Thickness); } } if (minion && _currentMinion.IsVisible && Menu.Item(Name + "DrawingDamageIndicator").GetValue <bool>()) { var damage = 0d; if (Menu.Item(Name + "Spell" + ObjectManager.Player.ChampionName + "Enabled").GetValue <bool>()) { var heroSpell = _heroSpells.Where(s => s.Enabled).OrderByDescending(s => s.Priority).ToList(); if (heroSpell.Any()) { HeroSpell spell = null; if (heroSpell.Count == 1) { spell = heroSpell.First(); } else if (heroSpell.Count > 1) { spell = heroSpell.FirstOrDefault(s => s.Spell.IsReady()) ?? heroSpell.OrderBy(h => h.Spell.Instance.CooldownExpires).First(); } if (spell != null && (spell.Spell.Instance.CooldownExpires - Game.Time) < 3f) { damage += spell.CalculateDamage(_currentMinion, false); } } } if (_smiteSpell != null && Menu.Item(Name + "SpellSmiteUse").GetValue <bool>()) { if ((_smiteSpell.Instance.CooldownExpires - Game.Time) < 3f) { damage += ObjectManager.Player.GetSummonerSpellDamage( _currentMinion, Damage.SummonerSpell.Smite); } } if (damage > 0) { var pos = Drawing.WorldToScreen(_currentMinion.Position); Drawing.DrawText( pos.X, pos.Y + _currentMinion.BoundingRadius / 2f, Menu.Item(Name + "DrawingDamageColor").GetValue <Color>(), ((int)(_currentMinion.Health - damage)).ToString()); } } } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }