context: // --------------------------------------------------------------------------------------------------------------------
  // <copyright file="Program.cs" company="SSIvern">
  //      Copyright (c) SSIvern. All rights reserved.
  // </copyright>
  // --------------------------------------------------------------------------------------------------------------------
  
  using System;
  using System.Drawing;
  using System.Linq;
  using LeagueSharp;
  using LeagueSharp.Common;
  using SebbyLib;
  using SPrediction;
  using Color = SharpDX.Color;
  using HitChance = SebbyLib.Prediction.HitChance;
  
  using Prediction = SPrediction.Prediction;
  using PredictionInput = SebbyLib.Prediction.PredictionInput;
  
  using EloBuddy;
  using LeagueSharp.Common;
  namespace SSIvern
  {
      internal class SSIvernInit
      {
          protected static Spell Q, W, E, R;
          protected static Orbwalking.Orbwalker Orbwalker;
          protected static Obj_AI_Base Daisy;
          protected static bool DaisyStatus;
          protected static Menu Config;
          private static bool SPredictionLoaded;
  
          public static string[] HighChamps =
          {
              "Ahri", "Anivia", "Annie", "Ashe", "Azir", "Brand", "Caitlyn", "Cassiopeia", "Corki", "Draven",
              "Ezreal", "Graves", "Jinx", "Kalista", "Karma", "Karthus", "Katarina", "Kennen", "KogMaw", "Leblanc",
              "Lucian", "Lux", "Malzahar", "MasterYi", "MissFortune", "Orianna", "Quinn", "Sivir", "Syndra", "Talon",
              "Teemo", "Tristana", "TwistedFate", "Twitch", "Varus", "Vayne", "Veigar", "VelKoz", "Viktor", "Xerath",
              "Zed", "Ziggs", "Kindred", "Jhin"
          };
  
          //protected static int lvl1, lvl2, lvl3, lvl4;
  
          public SSIvernInit()
          {
              GameOnGameLoad(new EventArgs());
          }
  
          protected static AIHeroClient Player
          {
              get { return ObjectManager.Player; }
          }
  
          public Items.Item GLP800 { get; private set; }
          public Items.Item Protobelt { get; private set; }
          public SpellSlot IgniteSlot { get; private set; }
          public SpellSlot SmiteSlot { get; private set; }
  
          public static void Main()
          {
              var SSIvernInit = new SSIvernInit();
          }
  
          private void GameOnGameLoad(EventArgs args)
          {
              if (Player.ChampionName != "Ivern")
                  return;
  
              #region Spells && Items
  
              //IgniteSlot = Player.GetSpellSlot("summonerdot");
              //var smite = ObjectManager.Player.Spellbook.Spells.FirstOrDefault(x => x.Name.ToLower().Contains("smite"));
              Q = new Spell(SpellSlot.Q, 1100f);
              W = new Spell(SpellSlot.W, 1600f);
              E = new Spell(SpellSlot.E, 750f);
              R = new Spell(SpellSlot.R, 0);
              Q.SetSkillshot(0.5f, 65f, 1300f, true, SkillshotType.SkillshotLine);
              W.SetSkillshot(0.5f, 50f, 1600f, false, SkillshotType.SkillshotCircle);
              R.SetSkillshot(0.5f, 100f, 1200f, false, SkillshotType.SkillshotCircle);
              /*if ((Ignite != null) && (IgniteSlot != SpellSlot.Unknown))
                  Ignite = new Spell(IgniteSlot, 550f);
              if ((smite != null) && (smite.Slot != SpellSlot.Unknown))
                  Smite = new Spell(smite.Slot, 500f, TargetSelector.DamageType.True);*/
              GLP800 = new Items.Item(3030, 800f);
              Protobelt = new Items.Item(3152, 850f);
  
              #endregion
  
              #region SpellDatabase Initializing
  
              #endregion
  
              #region Config
  
              Config = new Menu("SurvivorIvern", "SurvivorIvern", true).SetFontStyle(FontStyle.Bold, Color.Chartreuse);
  
              var OrbwalkerMenu = Config.AddSubMenu(new Menu(":: Orbwalker", "Orbwalker"));
              Orbwalker = new Orbwalking.Orbwalker(OrbwalkerMenu);
  
              var TargetSelectorMenu = Config.AddSubMenu(new Menu(":: Target Selector", "TargetSelector"));
  
              TargetSelector.AddToMenu(TargetSelectorMenu);
  
              #endregion
  
              #region Config Items
  
              var ComboMenu = Config.AddSubMenu(new Menu(":: Combo", "Combo"));
              ComboMenu.AddItem(new MenuItem("ComboUseQ", "Use Q").SetValue(true));
              ComboMenu.AddItem(new MenuItem("ComboUseW", "Use W").SetValue(true));
              ComboMenu.AddItem(new MenuItem("ComboUseE", "Use E").SetValue(true));
              ComboMenu.AddItem(new MenuItem("ComboUseItems", "Use Items?").SetValue(true));
              ComboMenu.AddItem(
                  new MenuItem("ComboDashIfPossibleQ", "Use Q Again to Dash/Gapclose?").SetValue(false)
                      .SetTooltip(
                          "Will Use Q in Combo Mode again if, Near enemy, there is no more than 1 enemy => Range (1500)",
                          Color.Chartreuse));
              ComboMenu.AddItem(
                  new MenuItem("SemiManualR", "Semi-Manual R Casting?").SetValue(false)
                      .SetTooltip("True - Script will Auto R | False - You will R when you decide - preferably",
                          Color.Chartreuse));
              ComboMenu.AddItem(
                  new MenuItem("ComboMinimumREnemies", "Minimum Enemies in E Range Before Casting R").SetValue(
                      new Slider(2, 1, 5)));
              ComboMenu.AddItem(
                  new MenuItem("ComboUseR", "Use R").SetValue(true)
                      .SetTooltip(
                          "Will use R if there's more than 1 target"));
  
              var DaisyMenu = Config.AddSubMenu(new Menu(":: Daisy", "Daisy"));
              DaisyMenu.AddItem(new MenuItem("AutoDaisy", "Auto-Play Daisy?").SetValue(false));
              DaisyMenu.AddItem(new MenuItem("DaisyAttackUnderTurret", "Let Daisy dive under turret?").SetValue(true));
              DaisyMenu.AddItem(
                  new MenuItem("DaisyAttackJungleMobs", "Let Daisy attack jungle mobs?").SetValue(true)
                      .SetTooltip("Dragon/Baron and etc."));
              // Will make it a toggle-able keybind.
              DaisyMenu.AddItem(new MenuItem("DaisyFooter", ":: Soon More Options! <3"));
  
              var EWhitelistMenu =
                  Config.AddSubMenu(new Menu(":: (E) Protector", "Protector").SetFontStyle(FontStyle.Bold, Color.HotPink));
              {
                  EWhitelistMenu.AddItem(
                      new MenuItem("ProtectionLogic", ":: Protector Logic").SetValue(
                          new StringList(new[] { "Normal", "(New) Protection Logic" }, 0)));
                  //EWhitelistMenu.AddItem(new MenuItem("EProtectionAlly", "Use (E) to Protect?").SetValue(true));
                  foreach (var ally in HeroManager.Allies.Where(x => x.IsValid))
                      EWhitelistMenu.AddItem(
                          new MenuItem("EProtectionAlly." + ally.ChampionName, "Protect with (E): " + ally.ChampionName)
                              .SetValue(HighChamps.Contains(ally.ChampionName)));
                  EWhitelistMenu.AddItem(
                      new MenuItem("FooterProtector", "Thanks xcxooxl").SetTooltip(
                          "Thanks to 'xcxooxl' for the contribution to this assembly :) (New Logic)"));
              }
  
              var LaneClearMenu = Config.AddSubMenu(new Menu(":: LaneClear", "LaneClear"));
              LaneClearMenu.AddItem(new MenuItem("LaneClearQ", "Use Q").SetValue(true));
              LaneClearMenu.AddItem(new MenuItem("LaneClearE", "Use E").SetValue(false));
              LaneClearMenu.AddItem(new MenuItem("LaneClearEAlly", "Use E on Ally to Farm").SetValue(false));
              LaneClearMenu.AddItem(
                  new MenuItem("LaneClearManaManager", "LaneClear Mana Manager").SetValue(new Slider(50, 0, 100)));
              LaneClearMenu.AddItem(
                  new MenuItem("MinimumEMinions", "Minimum Minions Near You To Use E?").SetValue(new Slider(3, 1, 10)));
  
              var LastHitMenu = Config.AddSubMenu(new Menu(":: LastHit", "LastHit"));
              LastHitMenu.AddItem(new MenuItem("LastHitQ", "Use Q").SetValue(true));
              LastHitMenu.AddItem(
                  new MenuItem("LastHitManaManager", "LastHit Mana Manager Mana Manager").SetValue(new Slider(50, 0, 100)));
  
              var HarassMenu = Config.AddSubMenu(new Menu(":: Harass", "Harass"));
              HarassMenu.AddItem(new MenuItem("HarassQ", "Use Q").SetValue(true));
              HarassMenu.AddItem(new MenuItem("HarassW", "Use W").SetValue(true));
              HarassMenu.AddItem(new MenuItem("HarassItems", "Use Items (GLP/Protobelt)").SetValue(true));
              HarassMenu.AddItem(
                  new MenuItem("HarassManaManager", "Harass Mana Manager Mana Manager").SetValue(new Slider(50, 0, 100)));
  
              var KillStealMenu = Config.AddSubMenu(new Menu(":: Killsteal", "Killsteal"));
              KillStealMenu.AddItem(new MenuItem("EnableKS", "Enable Killsteal?").SetValue(true));
              KillStealMenu.AddItem(new MenuItem("KSQ", "KS with Q?").SetValue(true));
              KillStealMenu.AddItem(new MenuItem("KSItems", "KS with Items?").SetValue(true));
              KillStealMenu.AddItem(new MenuItem("UnavailableService",
                  "KS with Ignite/Smite is currently (Temporary) Unavailable."));
              KillStealMenu.AddItem(new MenuItem("KSIgnite", "KS with Ignite").SetValue(false));
              KillStealMenu.AddItem(new MenuItem("KSSmite", "KS with Smite").SetValue(false));
  
              var DrawingMenu = Config.AddSubMenu(new Menu(":: Drawings", "Drawings"));
              DrawingMenu.AddItem(new MenuItem("DrawQ", "Draw Q Range").SetValue(true));
              DrawingMenu.AddItem(new MenuItem("DrawW", "Draw W Range").SetValue(false));
              DrawingMenu.AddItem(new MenuItem("DrawE", "Draw E Range").SetValue(true));
              DrawingMenu.AddItem(new MenuItem("DrawR", "Draw R Range").SetValue(false));
              DrawingMenu.AddItem(new MenuItem("DrawDaisy", "Draw Daisy Attack Range").SetValue(true));
              DrawingMenu.AddItem(new MenuItem("DrawDaisyStatus", "Draw Daisy Status/Mode!").SetValue(true));
              DrawingMenu.AddItem(new MenuItem("DrawJungleMobPassive", "Draw Jungle Mob Ready!").SetValue(true));
              DrawingMenu.AddItem(new MenuItem("NotifyProtectedAlly", "Notify when Protected Ally?").SetValue(true));
  
              #region Skin Changer
  
              var SkinChangerMenu =
                  Config.AddSubMenu(new Menu(":: Skin Changer", "SkinChanger").SetFontStyle(FontStyle.Bold,
                      Color.Chartreuse));
              var SkinChanger =
                  SkinChangerMenu.AddItem(
                      new MenuItem("UseSkinChanger", ":: Use SkinChanger?").SetValue(true)
                          .SetFontStyle(FontStyle.Bold, Color.Crimson));
              var SkinID =
                  SkinChangerMenu.AddItem(
                      new MenuItem("SkinID", ":: Skin").SetValue(new StringList(new[] { "Classic", "Candy King Ivern" }, 0))
                          .SetFontStyle(FontStyle.Bold, Color.Crimson));
              SkinID.ValueChanged += (sender, eventArgs) =>
              {
                  if (!SkinChanger.GetValue<bool>())
                      return;
  
                  //Player.SetSkin(Player.BaseSkinName, eventArgs.GetNewValue<StringList>().SelectedIndex);
              };
  
              #endregion
  
              var GapCloserInterrupter =
                  Config.AddSubMenu(
                      new Menu(":: Anti-GapCloser/Interrupter", "GapCloserInterrupter").SetFontStyle(FontStyle.Bold,
                          Color.Chartreuse));
              GapCloserInterrupter.AddItem(new MenuItem("EnableAntiGapCloser", "Enable Anti-GapCloser?").SetValue(true));
              GapCloserInterrupter.AddItem(new MenuItem("QToInterrupt", "Q to Interrupt?").SetValue(true));
              GapCloserInterrupter.AddItem(new MenuItem("GapCloserAutoE", "E on Gapclose enemy near you?").SetValue(false));
              GapCloserInterrupter.AddItem(new MenuItem("GapCloserInfo",
                  "                   .:Gap-Closer Q on Enemy (Whitelist):."));
              foreach (var enemy in HeroManager.Enemies)
                  GapCloserInterrupter
                      .AddItem(
                          new MenuItem("GapCloserEnemies" + enemy.ChampionName, enemy.ChampionName).SetValue(true)
                              .SetTooltip("Use Q on GapClosing Champion (" + enemy.ChampionName + ")"));
  
              var MiscMenu = Config.AddSubMenu(new Menu(":: Settings", "Settings"));
              MiscMenu.AddItem(
                  new MenuItem("HitChance", "Hit Chance").SetValue(new StringList(new[] { "Medium", "High", "Very High" }, 1)));
              var PredictionVar = MiscMenu.AddItem(
                  new MenuItem("Prediction", "Prediction:").SetValue(new StringList(
                      new[] { "Common", "OKTW", "SPrediction" }, 1)));
              if (PredictionVar.GetValue<StringList>().SelectedIndex == 2)
                  if (!SPredictionLoaded)
                  {
                      Prediction.Initialize(MiscMenu, "SPrediction Settings");
                      var SPreditctionLoaded =
                          MiscMenu.AddItem(new MenuItem("SPredictionLoaded", "SPrediction Loaded!"));
                      SPredictionLoaded = true;
                  }
              PredictionVar.ValueChanged += (sender, eventArgs) =>
              {
  
gt:                 if (eventArgs.GetNewValue<StringList>().SelectedIndex == 2)