context: using EloBuddy; 
   using LeagueSharp.Common; 
   namespace xSaliceResurrected_Rework.Pluging
  {
      using System;
      using System.Drawing;
      using LeagueSharp;
      using LeagueSharp.Common;
      using Base;
      using Managers;
      using Utilities;
      using Orbwalking = Orbwalking;
  
      internal class Jinx : Champion
      {
          public Jinx()
          {
              SpellManager.Q = new Spell(SpellSlot.Q);
              SpellManager.W = new Spell(SpellSlot.W, 1300);
  
              SpellManager.W.SetSkillshot(0.55f, 50, 3500, true, SkillshotType.SkillshotLine);
  
              var combo = new Menu("Combo", "Combo");
              {
                  combo.AddItem(new MenuItem("UseQCombo", "Use Q", true).SetValue(true));
                  combo.AddItem(new MenuItem("UseECombo", "Use W", true).SetValue(true));
                  Menu.AddSubMenu(combo);
              }
  
              var harass = new Menu("Harass", "Harass");
              {
                  harass.AddItem(new MenuItem("UseWHarass", "Use W", true).SetValue(false));
                  harass.AddItem(new MenuItem("FarmT", "Harass (toggle)!", true).SetValue(new KeyBind("N".ToCharArray()[0], KeyBindType.Toggle)));
                  ManaManager.AddManaManagertoMenu(harass, "Harass", 50);
                  Menu.AddSubMenu(harass);
              }
  
              var farm = new Menu("LaneClear", "LaneClear");
              {
                  farm.AddItem(new MenuItem("UseQFarm", "Use Q", true).SetValue(true));
                  farm.AddItem(new MenuItem("UseEFarm", "Use W", true).SetValue(false));
                  Menu.AddSubMenu(farm);
              }
  
              var miscMenu = new Menu("Misc", "Misc");
              {
                  //aoe
                  miscMenu.AddSubMenu(AoeSpellManager.AddHitChanceMenuCombo(true, false, false, true));
                  miscMenu.AddItem(new MenuItem("smartKS", "Smart KS", true).SetValue(true));
                  //add to menu
                  Menu.AddSubMenu(miscMenu);
              }
  
              var drawMenu = new Menu("Drawing", "Drawing");
              {
                  drawMenu.AddItem(new MenuItem("Draw_Disabled", "Disable All", true).SetValue(false));
  
                  MenuItem drawComboDamageMenu = new MenuItem("Draw_ComboDamage", "Draw Combo Damage", true).SetValue(true);
                  MenuItem drawFill = new MenuItem("Draw_Fill", "Draw Combo Damage Fill", true).SetValue(new Circle(true, Color.FromArgb(90, 255, 169, 4)));
                  drawMenu.AddItem(drawComboDamageMenu);
                  drawMenu.AddItem(drawFill);
                  DamageIndicator.DamageToUnit = GetComboDamage;
                  DamageIndicator.Enabled = drawComboDamageMenu.GetValue<bool>();
                  DamageIndicator.Fill = drawFill.GetValue<Circle>().Active;
                  DamageIndicator.FillColor = drawFill.GetValue<Circle>().Color;
                  drawComboDamageMenu.ValueChanged +=
                      delegate (object sender, OnValueChangeEventArgs eventArgs)
                      {
                          DamageIndicator.Enabled = eventArgs.GetNewValue<bool>();
                      };
                  drawFill.ValueChanged +=
                      delegate (object sender, OnValueChangeEventArgs eventArgs)
                      {
                          DamageIndicator.Fill = eventArgs.GetNewValue<Circle>().Active;
                          DamageIndicator.FillColor = eventArgs.GetNewValue<Circle>().Color;
                      };
  
                  Menu.AddSubMenu(drawMenu);
              }
  
              var customMenu = new Menu("Custom Perma Show", "Custom Perma Show");
              {
                  var myCust = new CustomPermaMenu();
                  customMenu.AddItem(new MenuItem("custMenu", "Move Menu", true).SetValue(new KeyBind("L".ToCharArray()[0], KeyBindType.Press)));
                  customMenu.AddItem(new MenuItem("enableCustMenu", "Enabled", true).SetValue(true));
                  customMenu.AddItem(myCust.AddToMenu("Combo Active: ", "Orbwalk"));
                  customMenu.AddItem(myCust.AddToMenu("Harass Active: ", "Farm"));
                  customMenu.AddItem(myCust.AddToMenu("Harass(T) Active: ", "FarmT"));
                  customMenu.AddItem(myCust.AddToMenu("Laneclear Active: ", "LaneClear"));
                  Menu.AddSubMenu(customMenu);
              }
          }
  
  
          private float GetComboDamage(Obj_AI_Base target)
          {
              double comboDamage = 0;
  
              if (Q.IsReady())
                  comboDamage += Player.GetSpellDamage(target, SpellSlot.Q);
  
              if (W.IsReady())
                  comboDamage += Player.GetSpellDamage(target, SpellSlot.W);
  
              comboDamage = ItemManager.CalcDamage(target, comboDamage);
  
              return (float)(comboDamage + Player.GetAutoAttackDamage(target) * 2);
          }
  
          private void Combo()
          {
              var itemTarget = TargetSelector.GetTarget(750, TargetSelector.DamageType.Physical);
  
              if (itemTarget != null)
              {
                  var dmg = GetComboDamage(itemTarget);
  
                  ItemManager.Target = itemTarget;
  
                  if (dmg > itemTarget.Health - 50)
                      ItemManager.KillableTarget = true;
  
                  ItemManager.UseTargetted = true;
              }
  
              var target = TargetSelector.GetTarget(550, TargetSelector.DamageType.Magical);
  
              if (target != null && Menu.Item("Always_Use", true).GetValue<bool>())
                  return;
  
              if (Menu.Item("UseWCombo", true).GetValue<bool>() && W.IsReady())
                  W.CastIfHitchanceEquals(target, HitChance.High);
          }
  
          private void Harass()
          {
              if (!ManaManager.HasMana("Harass"))
                  return;
  
              var target = TargetSelector.GetTarget(550, TargetSelector.DamageType.Magical);
  
              if (Menu.Item("UseWHarass", true).GetValue<bool>() && W.IsReady())
                  W.CastIfHitchanceEquals(target, HitChance.High);
          }
  
  
          protected override void AfterAttack(AttackableUnit unit, AttackableUnit mytarget)
          {
              if (Menu.Item("UseQCombo", true).GetValue<bool>() && Q.IsReady() && Orbwalker.ActiveMode == Orbwalking.OrbwalkingMode.Combo)
              {
                  if (ObjectManager.Player.CountEnemiesInRange(450) == 0 && ObjectManager.Player.AttackRange < 600)
                  {
                      return;
                  }
  
                  Q.Cast();
              }
          }
  
          private void Farm()
          {
          }
  
          private void CheckKs()
          {
          }
  
  
          protected override void Game_OnGameUpdate(EventArgs args)
          {
              if (Player.IsDead) return;
  
              if (Menu.Item("smartKS", true).GetValue<bool>())
                  CheckKs();
  
              if (Menu.Item("FarmT", true).GetValue<KeyBind>().Active)
                  Harass();
  
              switch (Orbwalker.ActiveMode)
              {
                  case Orbwalking.OrbwalkingMode.Combo:
                      Combo();
                      break;
                  case Orbwalking.OrbwalkingMode.Mixed:
                      Harass();
                      break;
                  case Orbwalking.OrbwalkingMode.LastHit:
                      break;
                  case Orbwalking.OrbwalkingMode.LaneClear:
                      Farm();
                      break;
                  case Orbwalking.OrbwalkingMode.Freeze:
                      break;
                  case Orbwalking.OrbwalkingMode.CustomMode:
                      break;
                  case Orbwalking.OrbwalkingMode.None:
                      break;
                  case Orbwalking.OrbwalkingMode.Flee:
                      break;
                  default:
  
gt:                     throw new ArgumentOutOfRangeException();