context: using System;
  using System.Collections.Generic;
  using ClipperLib;
  using Color = System.Drawing.Color;
  using EloBuddy.SDK.Enumerations;
  using EloBuddy.SDK.Events;
  using EloBuddy.SDK.Menu.Values;
  using EloBuddy.SDK.Menu;
  using EloBuddy.SDK;
  using EloBuddy;
  using LeagueSharp.Common.Data;
  using LeagueSharp.Common;
  using SharpDX;
  using System.Linq;
  using FioraProject.Evade;
  
  namespace FioraProject
  {
      using static FioraPassive;
      using static GetTargets;
      using static Combos;
      public static class Program
      {
          public static AIHeroClient Player { get { return ObjectManager.Player; } }
  
          public static LeagueSharp.Common.Spell Q, W, E, R;
  
          public static Menu Menu, Harass, Combo, Target, PriorityMode, OptionalMode, SelectedMode, LaneClear, JungClear, Draw, Misc;
  
          public static void Game_OnGameLoad()
          {
              if (Player.ChampionName != "Fiora")
                  return;
              Q = new LeagueSharp.Common.Spell(SpellSlot.Q, 400);
              W = new LeagueSharp.Common.Spell(SpellSlot.W, 750);
              E = new LeagueSharp.Common.Spell(SpellSlot.E);
              R = new LeagueSharp.Common.Spell(SpellSlot.R);
              W.SetSkillshot(0.75f, 80, 2000, false, SkillshotType.SkillshotLine);
              W.MinHitChance = EloBuddy.SDK.Enumerations.HitChance.High;
  
  
              Menu = MainMenu.AddMenu("Project" + Player.ChampionName, Player.ChampionName);
  
              Harass = Menu.AddSubMenu("Harass", "Harass");
              Harass.Add("Use Q Harass", new CheckBox("Q Enable"));
              Harass.Add("Use Q Harass Gap", new CheckBox("Use Q to gapclose"));
              Harass.Add("Use Q Harass Pre Pass", new CheckBox("Use Q to hit pre-passive spot"));
              Harass.Add("Use Q Harass Pass", new CheckBox("Use Q to hit passive"));
              Harass.Add("Use E Harass", new CheckBox("E Enable"));
              Harass.Add("Mana Harass", new Slider("Mana Harass", 40, 0, 100));
  
              Combo = Menu.AddSubMenu("Combo", "Combo");
              Combo.Add("Orbwalker2Mouse", new KeyBind("Combo Orbwalk to Passive", false, KeyBind.BindTypes.HoldActive, 'Z'));
              Combo.Add("Use Q Combo", new CheckBox("Q Enable"));
              Combo.Add("Use Q Combo Gap", new CheckBox("Use Q to gapclose"));
              Combo.Add("Use Q Combo Pre Pass", new CheckBox("Use Q to hit pre-passive spot"));
              Combo.Add("Use Q Combo Pass", new CheckBox("Use Q to hit passive"));
              Combo.Add("Use Q Combo Gap Minion", new CheckBox("Use Q minion to gapclose", false));
              Combo.Add("Use Q Combo Gap Minion Value", new Slider("Q minion gapclose if % cdr >=", 25, 0, 40));
              Combo.Add("Use E Combo", new CheckBox("E Enable"));
              Combo.Add("Use R Combo", new CheckBox("R Enable"));
              Combo.Add("Use R Combo LowHP", new CheckBox("Use R LowHP"));
              Combo.Add("Use R Combo LowHP Value", new Slider("R LowHP if player hp <", 40, 0, 100));
              Combo.Add("Use R Combo Killable", new CheckBox("Use R Killable"));
              Combo.Add("Use R Combo On Tap", new CheckBox("Use R on Tap"));
              Combo.Add("Use R Combo On Tap Key", new KeyBind("R on Tap key", false, KeyBind.BindTypes.HoldActive, 'G'));
              Combo.Add("Use R Combo Always", new CheckBox("Use R Always", false));
  
              Target = Menu.AddSubMenu("Targeting Modes", "Targeting Modes");
              Target.Add("Targeting Mode", new ComboBox("Targeting Mode", 0, "Optional", "Selected", "Priority", "Normal"));
              Target.Add("Orbwalk To Passive Range", new Slider("Orbwalk To Passive Range", 300, 250, 500));
              Target.Add("Focus Ulted Target", new CheckBox("Focus Ulted Target", false));
              Target.AddLabel("Go in each Mode menu to customize what you want!");
              Target.AddLabel("Please remember Orbwalk to Passive spot only works");
              Target.AddLabel("in \" Combo Orbwalk to Passive\" mode can be found");
              Target.AddLabel("in misc menu!");
  
              PriorityMode = Menu.AddSubMenu("Priority", "Priority Mode");
              PriorityMode.Add("Priority Range", new Slider("Priority Range", 1000, 300, 1000));
              PriorityMode.Add("Priority Orbwalk to Passive", new CheckBox("Orbwalk to Passive"));
              PriorityMode.Add("Priority Under Tower", new CheckBox("Under Tower"));
              foreach (var hero in HeroManager.Enemies)
              {
                  PriorityMode.Add("Priority" + hero.ChampionName, new Slider(hero.ChampionName, 2, 1, 5));
              }
  
              OptionalMode = Menu.AddSubMenu("Optional", "Optional Mode");
              OptionalMode.Add("Optional Range", new Slider("Optional Range", 1000, 300, 1000));
              OptionalMode.Add("Optional Orbwalk to Passive", new CheckBox("Orbwalk to Passive"));
              OptionalMode.Add("Optional Under Tower", new CheckBox("Under Tower", false));
              OptionalMode.Add("Optional Switch Target Key", new KeyBind("Switch Target Key", false, KeyBind.BindTypes.HoldActive, 'T'));
              OptionalMode.AddLabel("Also Can Left-click the target to switch!");
  
              SelectedMode = Menu.AddSubMenu("Selected", "Selected Mode");
              SelectedMode.Add("Selected Range", new Slider("Selected Range", 1000, 300, 1000));
              SelectedMode.Add("Selected Orbwalk to Passive", new CheckBox("Orbwalk to Passive"));
              SelectedMode.Add("Selected Under Tower", new CheckBox("Under Tower", false));
              SelectedMode.Add("Selected Switch If No Selected", new CheckBox("Switch to Optional if no target"));
  
              LaneClear = Menu.AddSubMenu("Lane Clear", "Lane Clear");
              LaneClear.Add("Use E LClear", new CheckBox("E Enable"));
              LaneClear.Add("Use Timat LClear", new CheckBox("Tiamat Enable"));
              LaneClear.Add("minimum Mana LC", new Slider("minimum Mana", 40, 0, 100));
  
              JungClear = Menu.AddSubMenu("Jungle Clear", "Jungle Clear");
              JungClear.Add("Use E JClear", new CheckBox("E Enable"));
              JungClear.Add("Use Timat JClear", new CheckBox("Tiamat Enable"));
              JungClear.Add("minimum Mana JC", new Slider("minimum Mana", 40, 0, 100));
  
              Misc = Menu.AddSubMenu("Misc", "Misc");
              Misc.Add("WallJump", new KeyBind("WallJump", false, KeyBind.BindTypes.HoldActive, 'H'));
              Misc.Add("Orbwalk Last Right Click", new KeyBind("Orbwalk Last Right Click", false, KeyBind.BindTypes.HoldActive, 'Y')).OnValueChange += OrbwalkLastClick.OrbwalkLRCLK_ValueChanged;
  
              Draw = Menu.AddSubMenu("Draw", "Draw");
              Draw.Add("Draw Q", new CheckBox("Draw Q", false));
              Draw.Add("Draw W", new CheckBox("Draw W", false));
              Draw.Add("Draw Optional Range", new CheckBox("Draw Optional Range"));
              Draw.Add("Draw Selected Range", new CheckBox("Draw Selected Range"));
              Draw.Add("Draw Priority Range", new CheckBox("Draw Priority Range"));
              Draw.Add("Draw Target", new CheckBox("Draw Target"));
              Draw.Add("Draw Vitals", new CheckBox("Draw Vitals", false));
              Draw.Add("Draw Fast Damage", new CheckBox("Draw Fast Damage", false)).OnValueChange += DrawHP_ValueChanged;
  
              if (HeroManager.Enemies.Any())
              {
                  Evade.Evade.Init();
                  EvadeTarget.Init();
                  TargetedNoMissile.Init();
                  OtherSkill.Init();
              }
  
              OrbwalkLastClick.Init();
              Drawing.OnDraw += Drawing_OnDraw;
              Drawing.OnEndScene += Drawing_OnEndScene;
  
              //GameObject.OnCreate += GameObject_OnCreate;
              Game.OnUpdate += Game_OnGameUpdate;
              Orbwalker.OnPostAttack += AfterAttack;
              Orbwalker.OnPostAttack += Orbwalking_AfterAttackNoTarget;
              Orbwalker.OnAttack += OnAttack;
              Obj_AI_Base.OnProcessSpellCast += oncast;
              Game.OnWndProc += Game_OnWndProc;
              CustomDamageIndicator.Initialize(GetFastDamage);
              CustomDamageIndicator.Enabled = DrawHP;
  
              //evade
              FioraProject.Evade.Evade.Evading += EvadeSkillShots.Evading;
              Chat.Print("Welcome to FioraWorld");
          }
  
          // events 
          public static void AfterAttack(AttackableUnit target, EventArgs args)
          {
              if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) || OrbwalkerPassive || OrbwalkLastClickActive)
              {
                  if (Ecombo && E.IsReady())
                  {
                      E.Cast();
                  }
                  else if (HasItem())
                  {
                      CastItem();
                  }
              }
              if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass))
              {
                  if (Eharass && E.IsReady() && Player.ManaPercent >= Manaharass)
                  {
                      E.Cast();
                  }
                  else if (HasItem())
                  {
                      CastItem();
                  }
              }
              if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.LaneClear) || Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.JungleClear))
              {
                  // jungclear
                  if (EJclear && E.IsReady() && Player.Mana * 100 / Player.MaxMana >= ManaJclear && !Orbwalker.ShouldWait
                      && Player.Position.CountMinionsInRange(Player.AttackRange + 200, true) >= 1)
                  {
                      E.Cast();
                  }
                  else if (TimatJClear && HasItem() && !Orbwalker.ShouldWait
                      && Player.Position.CountMinionsInRange(Player.AttackRange + 200, true) >= 1)
                  {
                      CastItem();
                  }
                  // laneclear
                  if (ELclear && E.IsReady() && Player.Mana * 100 / Player.MaxMana >= ManaLclear && !Orbwalker.ShouldWait
                      && Player.Position.CountMinionsInRange(Player.AttackRange + 200, false) >= 1)
                  {
                      E.Cast();
                  }
                  else if (TimatLClear && HasItem() && !Orbwalker.ShouldWait
                      && Player.Position.CountMinionsInRange(Player.AttackRange + 200, false) >= 1)
                  {
                      CastItem();
                  }
              }
  
          }
          private static void Orbwalking_AfterAttackNoTarget(AttackableUnit target, EventArgs args)
          {
              if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Combo) || OrbwalkerPassive || OrbwalkLastClickActive)
              {
                  if (Ecombo && E.IsReady() && Player.CountEnemiesInRange(Player.AttackRange + 200) >= 1)
                  {
                      E.Cast();
                  }
                  else if (HasItem() && Player.CountEnemiesInRange(Player.AttackRange + 200) >= 1)
                  {
                      CastItem();
                  }
              }
              if (Orbwalker.ActiveModesFlags.HasFlag(Orbwalker.ActiveModes.Harass))
              {
  
gt:                 if (Eharass && E.IsReady() && Player.ManaPercent >= Manaharass