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)); } }
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; LeagueSharp.Common.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)); } }
protected override void OnInitialize() { try { var smiteSpell = ObjectManager.Player.Spellbook.Spells.FirstOrDefault( s => s.Name.Contains("Smite", StringComparison.OrdinalIgnoreCase)); if (smiteSpell != null) { _smiteSpell = new Spell(smiteSpell.Slot, SmiteRange, TargetSelector.DamageType.True); } _camps.AddRange(Jungle.Camps.Where(c => c.MapType == LeagueSharp.Common.Utility.Map.GetMap().Type)); if (!_camps.Any() || _smiteSpell == null && !_heroSpells.Any()) { OnUnload(this, new UnloadEventArgs(true)); return; } _mobNames = Menu.Item(Name + "SmallCamps").GetValue <bool>() ? (from c in _camps from m in c.Mobs.Where(m => m.IsBig) select m.Name).ToArray() : (from c in _camps.Where(c => c.IsBig) from m in c.Mobs.Where(m => m.IsBig) select m.Name).ToArray( ); var spellMenu = Menu.SubMenu(Name + "Spell"); var championMenu = spellMenu.AddSubMenu( new Menu(ObjectManager.Player.ChampionName, spellMenu.Name + ObjectManager.Player.ChampionName)); var championPriorityMenu = championMenu.AddSubMenu(new Menu("Priority", championMenu.Name + "Priority")); var spells = ObjectManager.Player.Spellbook.Spells.Where( s => new[] { SpellSlot.Q, SpellSlot.W, SpellSlot.E, SpellSlot.R }.Contains(s.Slot)).ToList(); var index = spells.Count; foreach (var spell in spells.Where(s => s.SData.TargettingType != SpellDataTargetType.Self)) { var spellName = Utils.GetEnumName(spell.Slot); championPriorityMenu.AddItem( new MenuItem(championPriorityMenu.Name + spellName, spellName).SetValue( new Slider(index--, 1, spells.Count))); var championSpellMenu = championMenu.AddSubMenu(new Menu(spellName, championMenu.Name + spellName)); var championDrawingMenu = championSpellMenu.AddSubMenu(new Menu("Drawing", championSpellMenu.Name + "Drawing")); championDrawingMenu.AddItem( new MenuItem(championDrawingMenu.Name + "UseableColor", "Useable Color").SetValue(Color.Blue)); championDrawingMenu.AddItem( new MenuItem(championDrawingMenu.Name + "UnusableColor", "Unusable Color").SetValue(Color.Gray)); championDrawingMenu.AddItem( new MenuItem(championDrawingMenu.Name + "Thickness", "Thickness").SetValue(new Slider(2, 1, 10))); championDrawingMenu.AddItem( new MenuItem(championDrawingMenu.Name + "Range", "Range").SetValue(false)); championSpellMenu.AddItem( new MenuItem(championSpellMenu.Name + "IsSkillshot", "Is Skillshot").SetValue(false)); championSpellMenu.AddItem( new MenuItem(championSpellMenu.Name + "Collision", "Collision").SetValue(false)); championSpellMenu.AddItem( new MenuItem(championSpellMenu.Name + "MinHitChance", "Min HitChance").SetValue( new StringList(new[] { "Low", "Medium", "High", "Very High" }, 1))); championSpellMenu.AddItem( new MenuItem(championSpellMenu.Name + "DamageType", "Damage Type").SetValue( new StringList(new[] { "Magical", "Physical", "True" }))); championSpellMenu.AddItem( new MenuItem(championSpellMenu.Name + "SkillshotType", "Skillshot Type").SetValue( new StringList(new[] { "Line", "Circle", "Cone" }))); championSpellMenu.AddItem( new MenuItem(championSpellMenu.Name + "Enabled", "Enabled").SetValue(false)); var heroSpell = new HeroSpell( spell.Slot, Menu.Item(championSpellMenu.Name + "IsSkillshot").GetValue <bool>(), Menu.Item(championSpellMenu.Name + "Collision").GetValue <bool>(), (HitChance) (Menu.Item(championSpellMenu.Name + "MinHitChance").GetValue <StringList>().SelectedIndex + 3), (TargetSelector.DamageType) Menu.Item(championSpellMenu.Name + "DamageType").GetValue <StringList>().SelectedIndex, (SkillshotType) Menu.Item(championSpellMenu.Name + "SkillshotType").GetValue <StringList>().SelectedIndex, Menu.Item(championSpellMenu.Name + "Enabled").GetValue <bool>()) { Priority = Menu.Item(championPriorityMenu.Name + spellName).GetValue <Slider>().Value, UseableColor = Menu.Item(championDrawingMenu.Name + "UseableColor").GetValue <Color>(), UnusableColor = Menu.Item(championDrawingMenu.Name + "UnusableColor").GetValue <Color>(), Thickness = Menu.Item(championDrawingMenu.Name + "Thickness").GetValue <Slider>().Value, Drawing = Menu.Item(championDrawingMenu.Name + "Range").GetValue <bool>() }; Menu.Item(championPriorityMenu.Name + spellName).ValueChanged += (o, args) => heroSpell.Priority = args.GetNewValue <Slider>().Value; Menu.Item(championSpellMenu.Name + "IsSkillshot").ValueChanged += (o, args) => heroSpell.IsSkillshot = args.GetNewValue <bool>(); Menu.Item(championSpellMenu.Name + "Collision").ValueChanged += (o, args) => heroSpell.Collision = args.GetNewValue <bool>(); Menu.Item(championSpellMenu.Name + "MinHitChance").ValueChanged += (o, args) => heroSpell.MinHitChance = (HitChance)(args.GetNewValue <StringList>().SelectedIndex + 3); Menu.Item(championSpellMenu.Name + "DamageType").ValueChanged += (o, args) => heroSpell.DamageType = (TargetSelector.DamageType)args.GetNewValue <StringList>().SelectedIndex; Menu.Item(championSpellMenu.Name + "SkillshotType").ValueChanged += (o, args) => heroSpell.SkillshotType = (SkillshotType)args.GetNewValue <StringList>().SelectedIndex; Menu.Item(championSpellMenu.Name + "Enabled").ValueChanged += (o, args) => heroSpell.Enabled = args.GetNewValue <bool>(); Menu.Item(championDrawingMenu.Name + "UseableColor").ValueChanged += (o, args) => heroSpell.UseableColor = args.GetNewValue <Color>(); Menu.Item(championDrawingMenu.Name + "UnusableColor").ValueChanged += (o, args) => heroSpell.UnusableColor = args.GetNewValue <Color>(); Menu.Item(championDrawingMenu.Name + "Thickness").ValueChanged += (o, args) => heroSpell.Thickness = args.GetNewValue <Slider>().Value; Menu.Item(championDrawingMenu.Name + "Range").ValueChanged += (o, args) => heroSpell.Drawing = args.GetNewValue <bool>(); _heroSpells.Add(heroSpell); } championMenu.AddItem(new MenuItem(championMenu.Name + "Enabled", "Enabled").SetValue(false)); base.OnInitialize(); } catch (Exception ex) { Global.Logger.AddItem(new LogItem(ex)); } }