Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 15.65 KB | None | 0 0
  1. namespace AurelionSol
  2. {
  3.     using System;
  4.     using System.Linq;
  5.  
  6.     using EloBuddy;
  7.     using EloBuddy.SDK;
  8.     using EloBuddy.SDK.Enumerations;
  9.     using EloBuddy.SDK.Events;
  10.     using EloBuddy.SDK.Menu;
  11.     using EloBuddy.SDK.Menu.Values;
  12.     using EloBuddy.SDK.Rendering;
  13.  
  14.     using SharpDX;
  15.  
  16.     internal class Program
  17.     {
  18.         private static Geometry.Polygon.Circle QCircle;
  19.  
  20.         private static MissileClient QMissle;
  21.  
  22.         private static readonly AIHeroClient player = ObjectManager.Player;
  23.  
  24.         public static Spell.Skillshot Q { get; private set; }
  25.  
  26.         public static Spell.Active W { get; private set; }
  27.  
  28.         public static Spell.Skillshot R { get; private set; }
  29.  
  30.         public static Menu ComboMenu { get; private set; }
  31.  
  32.         public static Menu HarassMenu { get; private set; }
  33.  
  34.         public static Menu LaneMenu { get; private set; }
  35.  
  36.         public static Menu MiscMenu { get; private set; }
  37.  
  38.         public static Menu DrawMenu { get; private set; }
  39.  
  40.         private static Menu menuIni;
  41.  
  42.         public static void Execute()
  43.         {
  44.             if (player.ChampionName != "AurelionSol")
  45.             {
  46.                 return;
  47.             }
  48.  
  49.             Q = new Spell.Skillshot(SpellSlot.Q, (uint)650f, SkillShotType.Linear, 250, 850, 180);
  50.             W = new Spell.Active(SpellSlot.W, 725);
  51.             R = new Spell.Skillshot(SpellSlot.R, 1500, SkillShotType.Linear, 250, 1750, 180);
  52.  
  53.             menuIni = MainMenu.AddMenu("AurelionSol", "AurelionSol");
  54.             menuIni.AddGroupLabel("Welcome to my AurelionSol addon!");
  55.             menuIni.AddGroupLabel("Global Settings");
  56.             menuIni.Add("Combo", new CheckBox("Use Combo?"));
  57.             menuIni.Add("Harass", new CheckBox("Use Harass?"));
  58.             menuIni.Add("Clear", new CheckBox("Use Lane Clear?"));
  59.             menuIni.Add("Drawings", new CheckBox("Use Drawings?"));
  60.  
  61.             ComboMenu = menuIni.AddSubMenu("Combo");
  62.             ComboMenu.AddGroupLabel("Combo Settings");
  63.             ComboMenu.Add("Q", new CheckBox("Use Q"));
  64.             ComboMenu.Add("Q2", new CheckBox("Follow Q"));
  65.             ComboMenu.Add("W", new CheckBox("Use W"));
  66.             ComboMenu.Add("W2", new CheckBox("Use W2"));
  67.             ComboMenu.Add("R", new CheckBox("Use R"));
  68.             ComboMenu.Add("Rhit", new Slider("Use R Hit", 2, 1, 5));
  69.  
  70.             HarassMenu = menuIni.AddSubMenu("Harass");
  71.             HarassMenu.AddGroupLabel("Harass Settings");
  72.             HarassMenu.Add("Q", new CheckBox("Use Q"));
  73.             HarassMenu.Add("W", new CheckBox("Use W", false));
  74.             HarassMenu.Add("W2", new CheckBox("Use W2", false));
  75.             HarassMenu.Add("Mana", new Slider("Save Mana %", 30, 0, 100));
  76.  
  77.             LaneMenu = menuIni.AddSubMenu("Farm");
  78.             LaneMenu.AddGroupLabel("LaneClear Settings");
  79.             LaneMenu.Add("Q", new CheckBox("Use Q"));
  80.             LaneMenu.Add("W", new CheckBox("Use W", false));
  81.             LaneMenu.Add("Mana", new Slider("Save Mana %", 30, 0, 100));
  82.  
  83.             MiscMenu = menuIni.AddSubMenu("Misc");
  84.             MiscMenu.AddGroupLabel("Misc Settings");
  85.             MiscMenu.Add("gapcloserQ", new CheckBox("Anti-GapCloser (Q)"));
  86.             MiscMenu.Add("gapcloserR", new CheckBox("Anti-GapCloser (R)"));
  87.             MiscMenu.Add("KillStealQ", new CheckBox("KillSteal (Q)"));
  88.             MiscMenu.Add("KillStealR", new CheckBox("KillSteal (R)"));
  89.             MiscMenu.Add("AQ", new Slider("Auto Trigger Q On hit (Size inc)", 1, 1, 5));
  90.  
  91.             DrawMenu = menuIni.AddSubMenu("Drawings");
  92.             DrawMenu.AddGroupLabel("Drawing Settings");
  93.             DrawMenu.Add("Q", new CheckBox("Draw Q"));
  94.             DrawMenu.Add("W", new CheckBox("Draw W"));
  95.             DrawMenu.Add("E", new CheckBox("Draw E"));
  96.             DrawMenu.Add("R", new CheckBox("Draw R"));
  97.             DrawMenu.Add("QS", new CheckBox("Draw Q Size"));
  98.  
  99.             Game.OnUpdate += OnUpdate;
  100.             Drawing.OnDraw += OnDraw;
  101.             Gapcloser.OnGapcloser += Gapcloser_OnGap;
  102.             GameObject.OnCreate += OnCreate;
  103.             GameObject.OnDelete += OnDelete;
  104.         }
  105.  
  106.         private static void OnCreate(GameObject sender, EventArgs args)
  107.         {
  108.             var miss = sender as MissileClient;
  109.             if (miss != null && miss.IsValid)
  110.             {
  111.                 if (miss.SpellCaster.IsMe && miss.SpellCaster.IsValid && miss.SData.Name.Contains("AurelionSolQMissile"))
  112.                 {
  113.                     QMissle = miss;
  114.                 }
  115.             }
  116.         }
  117.  
  118.         private static void OnDelete(GameObject sender, EventArgs args)
  119.         {
  120.             var miss = sender as MissileClient;
  121.             if (miss == null || !miss.IsValid)
  122.             {
  123.                 return;
  124.             }
  125.             if (miss.SpellCaster is AIHeroClient && miss.SpellCaster.IsValid && miss.SpellCaster.IsMe
  126.                 && miss.SData.Name.Contains("AurelionSolQMissile"))
  127.             {
  128.                 QMissle = null;
  129.             }
  130.         }
  131.  
  132.         private static void OnUpdate(EventArgs args)
  133.         {
  134.             var flags = Orbwalker.ActiveModesFlags;
  135.             if (flags.HasFlag(Orbwalker.ActiveModes.Combo) && menuIni.Get<CheckBox>("Combo").CurrentValue)
  136.             {
  137.                 Combo();
  138.             }
  139.  
  140.             if (flags.HasFlag(Orbwalker.ActiveModes.Harass) && menuIni.Get<CheckBox>("Harass").CurrentValue)
  141.             {
  142.                 Harass();
  143.             }
  144.  
  145.             if (flags.HasFlag(Orbwalker.ActiveModes.LaneClear) && menuIni.Get<CheckBox>("Clear").CurrentValue)
  146.             {
  147.                 Clear();
  148.             }
  149.  
  150.             var qsize = QMissle?.StartPosition.Distance(QMissle.Position);
  151.             var f = (qsize + Q.Width) / 16;
  152.             if (f != null && (QMissle?.Position.CountEnemiesInRange((float)f) >= MiscMenu.Get<Slider>("AQ").CurrentValue && Q.Handle.ToggleState == 2))
  153.             {
  154.                 Q.Cast(Game.CursorPos);
  155.             }
  156.  
  157.             Orbwalker.DisableAttacking = Q.Handle.ToggleState == 2;
  158.             KS();
  159.         }
  160.  
  161.         private static void Gapcloser_OnGap(AIHeroClient Sender, Gapcloser.GapcloserEventArgs args)
  162.         {
  163.             if (!menuIni.Get<CheckBox>("Misc").CurrentValue || Sender == null || !Sender.IsEnemy)
  164.             {
  165.                 return;
  166.             }
  167.  
  168.             if (MiscMenu.Get<CheckBox>("gapcloserQ").CurrentValue)
  169.             {
  170.                 var pred = Q.GetPrediction(Sender);
  171.                 if (Q.Handle.ToggleState == 1 && Sender.IsValidTarget(Q.Range))
  172.                 {
  173.                     Q.Cast(pred.CastPosition);
  174.                 }
  175.  
  176.                 if (Q.Handle.ToggleState == 2)
  177.                 {
  178.                     var qsize = QMissle.StartPosition.Distance(QMissle.Position);
  179.                     if (QMissle.Position.IsInRange(Sender, (qsize + Q.Width) / 16))
  180.                     {
  181.                         Q.Cast(Game.CursorPos);
  182.                     }
  183.                 }
  184.             }
  185.  
  186.             if (MiscMenu.Get<CheckBox>("gapcloserR").CurrentValue)
  187.             {
  188.                 var pred = R.GetPrediction(Sender);
  189.                 if (args.SenderMousePos.IsInRange(Player.Instance, Player.Instance.GetAutoAttackRange()))
  190.                 {
  191.                     R.Cast(pred.CastPosition);
  192.                 }
  193.             }
  194.         }
  195.  
  196.         private static void OnDraw(EventArgs args)
  197.         {
  198.             if (!player.IsDead && menuIni.Get<CheckBox>("Drawings").CurrentValue)
  199.             {
  200.                 if (DrawMenu.Get<CheckBox>("Q").CurrentValue)
  201.                 {
  202.                     Circle.Draw(Color.Blue, Q.Range, Player.Instance.Position);
  203.                 }
  204.  
  205.                 if (DrawMenu.Get<CheckBox>("W").CurrentValue)
  206.                 {
  207.                     Circle.Draw(Color.Blue, W.Range, Player.Instance.Position);
  208.                     Circle.Draw(Color.Blue, W.Range - 250, Player.Instance.Position);
  209.                 }
  210.  
  211.                 if (DrawMenu.Get<CheckBox>("R").CurrentValue)
  212.                 {
  213.                     Circle.Draw(Color.Blue, R.Range, Player.Instance.Position);
  214.                 }
  215.  
  216.                 if (DrawMenu.Get<CheckBox>("QS").CurrentValue && QMissle != null)
  217.                 {
  218.                     var Qsize = QMissle.StartPosition.Distance(QMissle.Position);
  219.                     Circle.Draw(Color.White, Q.Width + Qsize / 16, QMissle.Position);
  220.                 }
  221.             }
  222.         }
  223.  
  224.         private static void KS()
  225.         {
  226.             foreach (var target in EntityManager.Heroes.Enemies.Where(target => target != null))
  227.             {
  228.                 if (target.IsValidTarget(Q.Range) && Q.IsReady() && Damage.Q(target) >= target.Health)
  229.                 {
  230.                     if (MiscMenu["KillStealQ"].Cast<CheckBox>().CurrentValue)
  231.                     {
  232.                         var pred = Q.GetPrediction(target);
  233.                         if (Q.Handle.ToggleState == 1)
  234.                         {
  235.                             Q.Cast(pred.CastPosition);
  236.                         }
  237.  
  238.                         if (Q.Handle.ToggleState == 2)
  239.                         {
  240.                             var qsize = QMissle.StartPosition.Distance(QMissle.Position);
  241.                             if (QMissle.Position.IsInRange(target, (qsize + Q.Width) / 16))
  242.                             {
  243.                                 Q.Cast(Game.CursorPos);
  244.                             }
  245.                         }
  246.                     }
  247.                 }
  248.  
  249.                 if (MiscMenu["KillStealR"].Cast<CheckBox>().CurrentValue && target.IsValidTarget(R.Range) && R.IsReady()
  250.                     && Damage.R(target) >= target.Health)
  251.                 {
  252.                     R.Cast(target.Position);
  253.                 }
  254.             }
  255.         }
  256.  
  257.         private static void Combo()
  258.         {
  259.             var fQ = ComboMenu["Q2"].Cast<CheckBox>().CurrentValue;
  260.             var useQ = ComboMenu["Q"].Cast<CheckBox>().CurrentValue && Q.IsReady();
  261.             var useW = ComboMenu["W"].Cast<CheckBox>().CurrentValue && W.IsReady();
  262.             var useW2 = ComboMenu["W2"].Cast<CheckBox>().CurrentValue && W.IsReady();
  263.             var useR = ComboMenu["R"].Cast<CheckBox>().CurrentValue && R.IsReady();
  264.             var Rhit = ComboMenu["Rhit"].Cast<Slider>().CurrentValue;
  265.             var Qtarget = TargetSelector.GetTarget(Q.Range * 2, DamageType.Magical);
  266.             var Wtarget = TargetSelector.GetTarget(W.Range, DamageType.Magical);
  267.             var Rtarget = TargetSelector.GetTarget(R.Range, DamageType.Magical);
  268.  
  269.             if (useQ && Qtarget != null && Qtarget.IsValidTarget(Q.Range))
  270.             {
  271.                 var pred = Q.GetPrediction(Qtarget);
  272.                 if (Q.Handle.ToggleState == 1)
  273.                 {
  274.                     Q.Cast(pred.CastPosition);
  275.                 }
  276.  
  277.                 if (Q.Handle.ToggleState == 2 && QMissle != null)
  278.                 {
  279.                     var qsize = QMissle.StartPosition.Distance(QMissle.Position);
  280.                     if (QMissle.Position.IsInRange(Qtarget, (qsize + Q.Width) / 16))
  281.                     {
  282.                         Q.Cast(Game.CursorPos);
  283.                     }
  284.                 }
  285.             }
  286.  
  287.             if (fQ && Q.Handle.ToggleState == 2 && QMissle != null)
  288.             {
  289.                 Player.IssueOrder(GameObjectOrder.MoveTo, QMissle.Position);
  290.             }
  291.  
  292.             if (fQ)
  293.             {
  294.                 Orbwalker.DisableAttacking = Q.Handle.ToggleState == 2;
  295.                 Orbwalker.DisableMovement = Q.Handle.ToggleState == 2;
  296.             }
  297.  
  298.             if (useW)
  299.             {
  300.                 if (W.Handle.ToggleState != 2 && Wtarget != null && Wtarget.IsValidTarget(W.Range) && !Wtarget.IsValidTarget(W.Range - 250))
  301.                 {
  302.                     W.Cast();
  303.                 }
  304.             }
  305.  
  306.             if (useW2)
  307.             {
  308.                 if (W.Handle.ToggleState == 2 && (!Wtarget.IsValidTarget(W.Range) || Wtarget.IsValidTarget(W.Range - 250)))
  309.                 {
  310.                     W.Cast();
  311.                 }
  312.             }
  313.  
  314.             if (useR && Rtarget != null && Rtarget.IsValidTarget(R.Range))
  315.             {
  316.                 foreach (var enemy in from enemy in EntityManager.Heroes.Enemies
  317.                                       let startPos = enemy.ServerPosition
  318.                                       let endPos = Player.Instance.ServerPosition.Extend(startPos, Player.Instance.Distance(enemy) + R.Range)
  319.                                       let rectangle = new Geometry.Polygon.Rectangle((Vector2)startPos, endPos, R.Radius)
  320.                                       where EntityManager.Heroes.Enemies.Count(x => rectangle.IsInside(x)) >= Rhit
  321.                                       select enemy)
  322.                 {
  323.                     R.Cast(enemy.Position);
  324.                 }
  325.             }
  326.         }
  327.  
  328.         private static void Harass()
  329.         {
  330.             var useQ = HarassMenu["Q"].Cast<CheckBox>().CurrentValue && Q.IsReady();
  331.             var useW = HarassMenu["W"].Cast<CheckBox>().CurrentValue && W.IsReady();
  332.             var useW2 = HarassMenu["W2"].Cast<CheckBox>().CurrentValue && W.IsReady();
  333.             var Qtarget = TargetSelector.GetTarget(Q.Range, DamageType.Magical);
  334.             var Wtarget = TargetSelector.GetTarget(W.Range, DamageType.Magical);
  335.  
  336.             if (useQ && Qtarget != null && Qtarget.IsValidTarget(Q.Range))
  337.             {
  338.                 var qsize = QMissle.StartPosition.Distance(QMissle.Position);
  339.                 var pred = Q.GetPrediction(Qtarget);
  340.                 if (pred.HitChance >= HitChance.High && Q.Handle.ToggleState == 1)
  341.                 {
  342.                     Q.Cast(pred.CastPosition);
  343.                 }
  344.  
  345.                 if (QMissle.Position.IsInRange(Qtarget, (qsize + Q.Width) / 16) && Q.Handle.ToggleState == 2)
  346.                 {
  347.                     Q.Cast(Game.CursorPos);
  348.                 }
  349.             }
  350.  
  351.             if (useW)
  352.             {
  353.                 if (W.Handle.ToggleState != 2 && Wtarget != null && Wtarget.IsValidTarget(W.Range) && !Wtarget.IsValidTarget(W.Range - 250))
  354.                 {
  355.                     W.Cast();
  356.                 }
  357.             }
  358.  
  359.             if (useW2)
  360.             {
  361.                 if (W.Handle.ToggleState == 2 && (!Wtarget.IsValidTarget(W.Range) || Wtarget.IsValidTarget(W.Range - 250)))
  362.                 {
  363.                     W.Cast();
  364.                 }
  365.             }
  366.         }
  367.  
  368.         private static void Clear()
  369.         {
  370.             var useQ = LaneMenu["Q"].Cast<CheckBox>().CurrentValue && Q.IsReady();
  371.             var useW = LaneMenu["W"].Cast<CheckBox>().CurrentValue && W.IsReady();
  372.  
  373.             if (useQ)
  374.             {
  375.                
  376.                 var minions = EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Enemy, Player.Instance.Position, 1500, false);
  377.  
  378.                 var predictResult =
  379.                     Prediction.Position.PredictCircularMissileAoe(minions.Cast<Obj_AI_Base>().ToArray(), Q.Range, Q.Radius, Q.CastDelay, Q.Speed)
  380.                         .OrderByDescending(r => r.GetCollisionObjects<Obj_AI_Minion>().Length)
  381.                         .FirstOrDefault();
  382.  
  383.                 if (predictResult != null && predictResult.CollisionObjects.Length >= 2)
  384.                 {
  385.                     Q.Cast(predictResult.CastPosition);
  386.                 }
  387.             }
  388.  
  389.             if (useW)
  390.             {
  391.                 var minions = EntityManager.MinionsAndMonsters.GetLaneMinions(EntityManager.UnitTeam.Enemy, Player.Instance.Position, W.Range, false);
  392.  
  393.                 if (minions.Count() >= 2)
  394.                 {
  395.                     W.Cast();
  396.                 }
  397.             }
  398.         }
  399.     }
  400. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement