/// <summary> /// TODO The on update. /// </summary> /// <param name="args"> /// TODO The args. /// </param> private void OnUpdate(EventArgs args) { if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo)) { OnCombo(); } if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass)) { OnHarass(); } if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LastHit)) { OnLastHit(); } if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LaneClear) || Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.JungleClear)) { OnLaneClear(); } this.HandleSentinels(); this.KillstealQ(); var enemies = HeroManager.Enemies.Count(x => ObjectManager.Player.LSDistance(x) <= spells[SpellSlot.E].Range); if (getCheckBoxItem(comboMenu, "eDeath") && enemies > 2 && ObjectManager.Player.HealthPercent <= getSliderItem(comboMenu, "eHealth") && spells[SpellSlot.E].IsReady()) { var target = HeroManager.Enemies.Where(x => spells[SpellSlot.E].IsInRange(x) && x.HasBuff("KalistaExpungeMarker")).OrderBy(x => Extensions.GetRendDamage(x)).FirstOrDefault(); if (target != null) { var stacks = Extensions.GetRendDamage(target); var damage = Math.Ceiling(stacks * 100 / target.GetTotalHealth()); if (damage >= getSliderItem(comboMenu, "eDeathC") && Environment.TickCount - spells[SpellSlot.E].LastCastAttemptT > 500) { spells[SpellSlot.E].Cast(); spells[SpellSlot.E].LastCastAttemptT = Environment.TickCount; } } } if (getCheckBoxItem(miscMenu, "useJungleSteal")) { this.DoMobSteal(); } if (getKeyBindItem(miscMenu, "fleeKey") || Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Flee)) { this.OnFlee(); } var item = new Item(ItemId.Farsight_Alteration); if (getCheckBoxItem(miscMenu, "autoTrinket") && ObjectManager.Player.Level >= 9 && ObjectManager.Player.InShop() && !Items.HasItem((int)ItemId.Farsight_Alteration)) { item.Buy(); } this.HandleBalista(); }
/// <summary> /// Perform the lane clear function /// </summary> private void OnLaneClear() { var minions = MinionManager.GetMinions(spells[SpellSlot.E].Range); if (getCheckBoxItem(laneClearMenu, "useQLC") && spells[SpellSlot.Q].IsReady()) { if (getCheckBoxItem(comboMenu, "saveManaR") && spells[SpellSlot.R].IsReady() && ObjectManager.Player.Mana < spells[SpellSlot.Q].Instance.SData.Mana + spells[SpellSlot.R].Instance.SData.Mana) { return; } foreach (var selectedMinion in from selectedMinion in minions let killcount = this.GetCollisionMinions( ObjectManager.Player, ObjectManager.Player.ServerPosition.LSExtend( selectedMinion.ServerPosition, spells[SpellSlot.Q].Range)) .Count( collisionMinion => collisionMinion.GetTotalHealth() < spells[SpellSlot.Q].GetDamage(collisionMinion)) where killcount >= getSliderItem(laneClearMenu, "minHitQ") where !ObjectManager.Player.Spellbook.IsAutoAttacking && !ObjectManager.Player.IsDashing() select selectedMinion) { spells[SpellSlot.Q].Cast(selectedMinion.ServerPosition); } } var harassableMinion = MinionManager.GetMinions(spells[SpellSlot.E].Range, MinionTypes.All, MinionTeam.NotAlly) .Where(x => Extensions.IsRendKillable(x)) .OrderBy(x => x.GetTotalHealth()) .FirstOrDefault(); var rendTarget = HeroManager.Enemies.Where( x => spells[SpellSlot.E].IsInRange(x) && Extensions.GetRendDamage(x) >= 1 && !x.HasBuffOfType(BuffType.Invulnerability) && !x.HasBuffOfType(BuffType.SpellShield)).OrderByDescending(x => Extensions.GetRendDamage(x)).FirstOrDefault(); if (getCheckBoxItem(laneClearMenu, "minLC") && harassableMinion != null && rendTarget != null && spells[SpellSlot.E].CanCast(harassableMinion) && spells[SpellSlot.E].CanCast(rendTarget) && Environment.TickCount - spells[SpellSlot.E].LastCastAttemptT > 500) { spells[SpellSlot.E].Cast(); spells[SpellSlot.E].LastCastAttemptT = Environment.TickCount; } if (spells[SpellSlot.E].IsReady() && getCheckBoxItem(laneClearMenu, "useELC")) { var count = minions.Count(x => spells[SpellSlot.E].CanCast(x) && Extensions.IsRendKillable(x)); if (count >= getSliderItem(laneClearMenu, "eHit") && Environment.TickCount - spells[SpellSlot.E].LastCastAttemptT > 500) { spells[SpellSlot.E].Cast(); spells[SpellSlot.E].LastCastAttemptT = Environment.TickCount; } } }
/// <summary> /// Perform the harass function /// </summary> private void OnHarass() { var spearTarget = TargetSelector.GetTarget( spells[SpellSlot.Q].Range, DamageType.Physical); if (getCheckBoxItem(harassMenu, "useQH") && spells[SpellSlot.Q].IsReady() && !ObjectManager.Player.Spellbook.IsAutoAttacking && !ObjectManager.Player.IsDashing()) { if (getCheckBoxItem(miscMenu, "qMana") && ObjectManager.Player.Mana < spells[SpellSlot.Q].Instance.SData.Mana + spells[SpellSlot.E].Instance.SData.Mana && spells[SpellSlot.Q].GetDamage(spearTarget) < spearTarget.GetTotalHealth()) { return; } if (getCheckBoxItem(comboMenu, "saveManaR") && spells[SpellSlot.R].IsReady() && ObjectManager.Player.Mana < spells[SpellSlot.Q].Instance.SData.Mana + spells[SpellSlot.R].Instance.SData.Mana) { return; } foreach (var unit in HeroManager.Enemies.Where(x => x.LSIsValidTarget(spells[SpellSlot.Q].Range)) .Where(unit => spells[SpellSlot.Q].GetSPrediction(unit).HitChance == LeagueSharp.Common.HitChance.Immobile)) { spells[SpellSlot.Q].Cast(unit); } var prediction = spells[SpellSlot.Q].GetSPrediction(spearTarget); if (!ObjectManager.Player.Spellbook.IsAutoAttacking && !ObjectManager.Player.IsDashing()) { switch (prediction.HitChance) { case LeagueSharp.Common.HitChance.Collision: this.QCollisionCheck(spearTarget); break; case LeagueSharp.Common.HitChance.High: case LeagueSharp.Common.HitChance.VeryHigh: spells[SpellSlot.Q].Cast(spearTarget); break; } } } if (getCheckBoxItem(harassMenu, "useEH")) { var rendTarget = HeroManager.Enemies.Where( x => x.LSIsValidTarget(spells[SpellSlot.E].Range) && Extensions.GetRendDamage(x) >= 1 && !x.HasBuffOfType(BuffType.Invulnerability) && !x.HasBuffOfType(BuffType.SpellShield)) .OrderByDescending(x => Extensions.GetRendDamage(x)) .FirstOrDefault(); if (rendTarget != null) { var stackCount = rendTarget.GetBuffCount("kalistaexpungemarker"); if (Extensions.IsRendKillable(rendTarget) || stackCount >= getSliderItem(comboMenu, "minStacks")) { if (Environment.TickCount - spells[SpellSlot.E].LastCastAttemptT < 500) { return; } spells[SpellSlot.E].Cast(); spells[SpellSlot.E].LastCastAttemptT = Environment.TickCount; } } } if (getCheckBoxItem(harassMenu, "useEMin")) { var minion = MinionManager.GetMinions(spells[SpellSlot.E].Range, MinionTypes.All, MinionTeam.NotAlly) .Where(x => Extensions.IsRendKillable(x)) .OrderBy(x => x.GetTotalHealth()) .FirstOrDefault(); var target = HeroManager.Enemies.Where( x => spells[SpellSlot.E].CanCast(x) && Extensions.GetRendDamage(x) >= 1 && !x.HasBuffOfType(BuffType.SpellShield)) .OrderByDescending(x => Extensions.GetRendDamage(x)) .FirstOrDefault(); if (minion != null && target != null && spells[SpellSlot.E].CanCast(minion) && spells[SpellSlot.E].CanCast(target) && Environment.TickCount - spells[SpellSlot.E].LastCastAttemptT > 500) { spells[SpellSlot.E].Cast(); spells[SpellSlot.E].LastCastAttemptT = Environment.TickCount; } } }
/// <summary> /// Kill steal /// </summary> private void KillstealQ() { foreach (var source in EntityManager.Heroes.Enemies.Where(x => spells[SpellSlot.E].IsInRange(x) && Extensions.IsRendKillable(x))) { if (source.LSIsValidTarget(spells[SpellSlot.E].Range) && !HasUndyingBuff(source) && Extensions.IsRendKillable(source)) { spells[SpellSlot.E].Cast(); spells[SpellSlot.E].LastCastAttemptT = Environment.TickCount; } } }
/// <summary> /// Initialize all the events /// </summary> private void InitEvents() { LeagueSharp.Common.Utility.HpBarDamageIndicator.DamageToUnit = Extensions.GetRendDamage; LeagueSharp.Common.Utility.HpBarDamageIndicator.Enabled = true; CustomDamageIndicator.Initialize(Extensions.GetRendDamage); Game.OnUpdate += this.OnUpdate; Obj_AI_Base.OnProcessSpellCast += this.OnProcessSpell; Orbwalker.OnUnkillableMinion += Orbwalker_OnUnkillableMinionEB; Drawing.OnDraw += args => { if (getCheckBoxItem(drawMenu, "drawQ")) { Render.Circle.DrawCircle(ObjectManager.Player.Position, spells[SpellSlot.Q].Range, Color.FromArgb(150, Color.Red)); } if (getCheckBoxItem(drawMenu, "drawE")) { Render.Circle.DrawCircle(ObjectManager.Player.Position, spells[SpellSlot.E].Range, Color.FromArgb(150, Color.Red)); } CustomDamageIndicator.DrawingColor = Color.FromArgb(150, Color.LawnGreen); if (getCheckBoxItem(drawMenu, "drawPercentage")) { foreach (var source in HeroManager.Enemies.Where(x => ObjectManager.Player.LSDistance(x) <= 2000f && !x.IsDead)) { var currentPercentage = Extensions.GetRendDamage(source) * 100 / source.GetTotalHealth(); var updatedCurrentPercentage = (int)Math.Ceiling(currentPercentage); Drawing.DrawText( Drawing.WorldToScreen(source.Position)[0], Drawing.WorldToScreen(source.Position)[1], currentPercentage >= 100 ? Color.Gold : Color.White, currentPercentage >= 100 ? "Killable With E" : "Current Damage: " + updatedCurrentPercentage + "%"); } } if (getCheckBoxItem(drawMenu, "drawJunglePercentage")) { foreach (var jungleMobs in ObjectManager.Get <Obj_AI_Minion>().Where(x => ObjectManager.Player.LSDistance(x) <= spells[SpellSlot.E].Range && !x.IsDead && x.Team == GameObjectTeam.Neutral)) { var currentPercentage = Extensions.GetRendDamage(jungleMobs) * 100 / jungleMobs.GetTotalHealth(); var updatedCurrentPercentage = (int)Math.Ceiling(currentPercentage); var changeby = 40; if (updatedCurrentPercentage >= 0) { switch (jungleMobs.CharData.BaseSkinName) { case "SRU_Razorbeak": Drawing.DrawText(jungleMobs.HPBarPosition.X + 50, jungleMobs.HPBarPosition.Y + changeby, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; case "SRU_Red": Drawing.DrawText(jungleMobs.HPBarPosition.X, jungleMobs.HPBarPosition.Y + changeby, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; case "SRU_Blue": Drawing.DrawText(jungleMobs.HPBarPosition.X, jungleMobs.HPBarPosition.Y + changeby, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; case "SRU_Dragon_Air": case "SRU_Dragon_Water": case "SRU_Dragon_Elder": case "SRU_Dragon_Fire": case "SRU_Dragon_Earth": Drawing.DrawText(jungleMobs.HPBarPosition.X, jungleMobs.HPBarPosition.Y + changeby, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; case "SRU_Baron": Drawing.DrawText(jungleMobs.HPBarPosition.X, jungleMobs.HPBarPosition.Y + changeby, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; case "SRU_Gromp": Drawing.DrawText(jungleMobs.HPBarPosition.X, jungleMobs.HPBarPosition.Y + changeby, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; case "SRU_Krug": Drawing.DrawText(jungleMobs.HPBarPosition.X + 53, jungleMobs.HPBarPosition.Y + changeby, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; case "SRU_Murkwolf": Drawing.DrawText(jungleMobs.HPBarPosition.X + 50, jungleMobs.HPBarPosition.Y + changeby, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; case "Sru_Crab": Drawing.DrawText(jungleMobs.HPBarPosition.X + 50, jungleMobs.HPBarPosition.Y + 20, Color.GreenYellow, string.Format("{0}%", updatedCurrentPercentage)); break; } } } } }; }
/// <summary> /// This is where the magic happens, we like to steal other peoples stuff. /// </summary> private void DoMobSteal() { var junglelMinions = MinionManager.GetMinions( ObjectManager.Player.ServerPosition, spells[SpellSlot.E].Range, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth) .FirstOrDefault( x => Extensions.IsRendKillable(x) && !x.Name.Contains("Mini") && !x.Name.Contains("Dragon") && !x.Name.Contains("Baron")); var bigMinions = MinionManager.GetMinions( ObjectManager.Player.ServerPosition, spells[SpellSlot.E].Range, MinionTypes.All, MinionTeam.Enemy, MinionOrderTypes.MaxHealth) .FirstOrDefault( x => Extensions.IsRendKillable(x) && (x.BaseSkinName.ToLower().Contains("siege") || x.BaseSkinName.ToLower().Contains("super"))); var baron = MinionManager.GetMinions( ObjectManager.Player.ServerPosition, spells[SpellSlot.E].Range, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth) .FirstOrDefault(x => x.IsValid && Extensions.IsRendKillable(x) && x.Name.Contains("Baron")); var dragon = MinionManager.GetMinions( ObjectManager.Player.ServerPosition, spells[SpellSlot.E].Range, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth) .FirstOrDefault(x => x.IsValid && Extensions.IsRendKillable(x) && x.Name.Contains("Dragon")); switch (getBoxItem(miscMenu, "jungStealMode")) { case 0: // jungle mobs if ((junglelMinions != null && spells[SpellSlot.E].CanCast(junglelMinions) && Extensions.IsRendKillable(junglelMinions)) || (baron != null && spells[SpellSlot.E].CanCast(baron) && Extensions.IsRendKillable(baron)) || (dragon != null && spells[SpellSlot.E].CanCast(dragon) && Extensions.IsRendKillable(dragon))) { spells[SpellSlot.E].Cast(); } break; case 1: // siege and super if (bigMinions != null && Extensions.IsRendKillable(bigMinions)) { spells[SpellSlot.E].Cast(); } break; case 2: // both if ((junglelMinions != null && spells[SpellSlot.E].CanCast(junglelMinions) && Extensions.IsRendKillable(bigMinions)) || (baron != null && spells[SpellSlot.E].CanCast(baron) && Extensions.IsRendKillable(baron)) || (dragon != null && spells[SpellSlot.E].CanCast(dragon) && Extensions.IsRendKillable(dragon)) || (bigMinions != null && spells[SpellSlot.E].CanCast(bigMinions) && Extensions.IsRendKillable(bigMinions))) { spells[SpellSlot.E].Cast(); } break; } }