context: #region
  using System;
  using System.Collections.Generic;
  using Colors = System.Drawing.Color;
  using System.Linq;
  
  using LeagueSharp;
  using LeagueSharp.Common;
  #endregion
  
  using EloBuddy; 
   using LeagueSharp.Common; 
   namespace EzrealDreamCatcher
  {
  	internal class Program
  	{
  		public static string ChampionName = "Ezreal";
  		public static Orbwalking.Orbwalker Orbwalker;
  		public static AIHeroClient Player { get { return ObjectManager.Player; } }
  		public static List<Spell> SpellList = new List<Spell>();
  		public static Spell Q;
  		public static Spell W;
  		public static Spell E;
  		public static Spell R;
  		public static float QMana;
  		public static float WMana;
  		public static float EMana;
  		public static Menu Config;
  
          public static void Main()
          {
              Game_OnGameLoad();
          }
  
          static void Game_OnGameLoad()
          {
  			if (Player.ChampionName != ChampionName) return;
  			
  			Q = new Spell(SpellSlot.Q, 1150f);
  			W = new Spell(SpellSlot.W, 1000f);
  			E = new Spell(SpellSlot.E, 475f);
  			R = new Spell(SpellSlot.R, 3000f);
  
  			Q.SetSkillshot(0.25f, 70f, 2000f, true, SkillshotType.SkillshotLine);
  			W.SetSkillshot(0.25f, 80f, 1600f, false, SkillshotType.SkillshotLine);
  			R.SetSkillshot(1f, 160f, 2000f, false, SkillshotType.SkillshotLine);
  
  			SpellList.Add(Q);
  			SpellList.Add(W);
  			SpellList.Add(E);
  			SpellList.Add(R);
  
  			SetMenu();
  			SetEvents();
  			SetMana();
  		}
  
  		private static void OnEnemyGapcloser(ActiveGapcloser gapcloser)
  		{
  			var useE = Config.Item("AntiGapcloser").GetValue<bool>();
  
  			if (useE && Player.Mana >= EMana + QMana)
  			{
  				var target = gapcloser.Sender;
  				if (target == null || !target.IsValidTarget(E.Range)) return;
  
  				E.Cast(Player.Position.Extend(Game.CursorPos, E.Range));
  			}
  		}
  
  		private static void OnDraw(EventArgs args)
  		{
  			var drawQ = Config.Item("qDraw").GetValue<bool>();
  			if (drawQ && Q.IsReady())
  				Render.Circle.DrawCircle(Player.Position, Q.Range, Colors.MistyRose);
  
  			var drawW = Config.Item("wDraw").GetValue<bool>();
  			if (drawW && W.IsReady())
  				Render.Circle.DrawCircle(Player.Position, W.Range, Colors.MistyRose);
  
  			var drawE = Config.Item("eDraw").GetValue<bool>();
  			if (drawE && E.IsReady())
  				Render.Circle.DrawCircle(Player.Position, E.Range, Colors.MistyRose);
  		}
  
  		private static void OnGameUpdate(EventArgs args)
  		{
  			if (Player != null && Player.BaseSkinName != null)
  			{
  				//Player.SetSkin(model: Player.BaseSkinName, id: Config.Item("SkinChangerTogggle").GetValue<bool>() ? Config.Item("SkinChangerID").GetValue<StringList>().SelectedIndex : Player.SkinId);
  			}
  
  			switch (Orbwalker.ActiveMode)
  			{
  				case Orbwalking.OrbwalkingMode.Combo:
  					Combo();
  					break;
  				case Orbwalking.OrbwalkingMode.Mixed:
  					Harass();
  					break;
  				case Orbwalking.OrbwalkingMode.LaneClear:
  					LaneClear();
  					JungleClear();
  					break;
  			}
  
  			if (Config.Item("harassToggle").GetValue<KeyBind>().Active)
  				HarassToggle();
  			
  			if (Config.Item("farmKey").GetValue<KeyBind>().Active)
  				Farm();
  
  			Killsteal();
  		}
  
  		private static void Combo()
  		{
  			var qTarget = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
  			var wTarget = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Magical);
  			var eTarget = TargetSelector.GetTarget(E.Range + W.Range, TargetSelector.DamageType.Magical);
  
  			if (qTarget == null || wTarget == null || eTarget == null) return;
  
  			var useQ = Config.Item("UseQCombo").GetValue<bool>();
  			var useW = Config.Item("UseWCombo").GetValue<bool>();
  
  			if (Player.Mana >= WMana + QMana)
  			{
  				switch (Config.Item("UseECombo").GetValue<StringList>().SelectedIndex)
  				{
  					case 0:
  						if (E.IsReady() && Q.IsReady() || W.IsReady())
  							E.Cast(Game.CursorPos);
  						break;
  					case 1:
  						if (E.IsReady() && Q.IsReady() || W.IsReady())
  							E.Cast(eTarget.ServerPosition);
  						break;
  					case 2:
  						break;
  				}
  			}
  
  			if (useQ && Q.IsReady())
  				Q.CastIfHitchanceEquals(qTarget, HitChanceChooser());
  			if (useW && W.IsReady())
  				W.CastIfHitchanceEquals(wTarget, HitChanceChooser());
  		}
  
  		private static void Harass()
  		{
  			if (Config.Item("harassMana").GetValue<Slider>().Value >= (Player.Mana / Player.MaxMana) * 100) return;
  
  			var qTarget = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
  			var wTarget = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Magical);
  
  			if (qTarget == null || wTarget == null) return;
  
  			var useQ = Config.Item("UseQHarass").GetValue<bool>();
  			var useW = Config.Item("UseWHarass").GetValue<bool>();
  
  			if (useQ && Q.IsReady())
  				Q.CastIfHitchanceEquals(qTarget, HitChanceChooser());
  			if (useW && W.IsReady())
  				W.CastIfHitchanceEquals(wTarget, HitChanceChooser());
  		}
  
  		private static void HarassToggle()
  		{
  			if (Config.Item("harassMana").GetValue<Slider>().Value >= (Player.Mana / Player.MaxMana) * 100) return;
  
  			var target = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
  			if (target == null) return;
  
  			var useQ = Config.Item("UseQHarass").GetValue<bool>();
  			var useW = Config.Item("UseWHarass").GetValue<bool>();
  			var validTarget = Config.Item("harass" + target.ChampionName).GetValue<bool>();
  
  			if (!validTarget)
  			{
  				return;
  			}
  
  			if (useQ && Q.IsReady())
  				Q.CastIfHitchanceEquals(target, HitChanceChooser());
  			if (useW && W.IsReady())
  				W.CastIfHitchanceEquals(target, HitChanceChooser());
  		}
  		
  		private static void Farm()
  		{
  			if (Config.Item("farmMana").GetValue<Slider>().Value >= (Player.Mana / Player.MaxMana) * 100) return;
  
  			var useQ = Config.Item("UseQFarm").GetValue<bool>();
  			var minions = MinionManager.GetMinions(Player.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.NotAlly);
  
  			if (minions.Count <= 0) return;
  
  			var minion = minions[0];
  
  			if (useQ && Q.IsReady() && Q.GetDamage(minion) > minion.Health)
  				Q.CastIfHitchanceEquals(minion, HitChanceChooser());
  		}
  		
  		private static void JungleClear()
  		{
  			if (Config.Item("jungleMana").GetValue<Slider>().Value >= (Player.Mana / Player.MaxMana) * 100) return;
  
  			var useQ = Config.Item("UseQJungle").GetValue<bool>();
  			var mobs = MinionManager.GetMinions(Player.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.Neutral, MinionOrderTypes.MaxHealth);
  
  			if (mobs.Count <= 0) return;
  
  			var mob = mobs[0];
  
  			if (useQ && Q.IsReady())
  				Q.CastIfHitchanceEquals(mob, HitChanceChooser());
  		}
  
  		private static void LaneClear()
  		{
  			if (Config.Item("laneMana").GetValue<Slider>().Value >= (Player.Mana / Player.MaxMana) * 100) return;
  
  			var useQ = Config.Item("UseQLane").GetValue<bool>();
  			var minions = MinionManager.GetMinions(Player.ServerPosition, Q.Range, MinionTypes.All, MinionTeam.NotAlly, MinionOrderTypes.MaxHealth);
  
  			if (minions.Count <= 0) return;
  
  
gt: 			var minion = minions[0];