Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.01 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using LeagueSharp;
  7. using LeagueSharp.Common;
  8. using SharpDX;
  9.  
  10. namespace ExoCondemn
  11. {
  12. class Program
  13. {
  14. private static SpellSlot FlashSlot;
  15. private static Spell Condemn;
  16. private static Menu AssemblyMenu;
  17. private static Vector3 MyPosition2;
  18.  
  19. private static void Main(string[] args)
  20. {
  21. CustomEvents.Game.OnGameLoad += Game_OnGameLoad;
  22.  
  23. }
  24.  
  25. static void Game_OnGameLoad(EventArgs args)
  26. {
  27. if (ObjectManager.Player.ChampionName != "Vayne")
  28. {
  29. return;
  30. }
  31. OnLoad();
  32. }
  33.  
  34. private static void OnLoad()
  35. {
  36. AssemblyMenu = new Menu("ExoCondemn - Flash E","dz191.exocondemn", true);
  37.  
  38. AssemblyMenu.AddItem(
  39. new MenuItem("dz191.exocondemn.pushdistance", "Push Distance").SetValue(
  40. new Slider(400, 370, 465)));
  41.  
  42. AssemblyMenu.AddItem(
  43. new MenuItem("dz191.exocondemn.execute", "Do Flash Condemn!").SetValue(
  44. new KeyBind("Z".ToCharArray()[0], KeyBindType.Press)));
  45.  
  46. AssemblyMenu.AddItem(
  47. new MenuItem("dz191.exocondemn.onlyone", "Only for 1v1").SetValue(true));
  48.  
  49. AssemblyMenu.AddToMainMenu();
  50.  
  51.  
  52. Condemn = new Spell(SpellSlot.E, 590f);
  53. LoadFlash();
  54. Condemn.SetTargetted(0.25f, 2000f);
  55.  
  56. Game.OnUpdate += Game_OnUpdate;
  57. Drawing.OnDraw += OnDraw;
  58. }
  59.  
  60. private static void OnDraw(EventArgs args)
  61. {
  62.  
  63. }
  64. public static List<Vector3> GetRotatedFlashPositions()
  65. {
  66. const int currentStep = 30;
  67. var direction = ObjectManager.Player.Direction.To2D().Perpendicular();
  68.  
  69. var list = new List<Vector3>();
  70. for (var i = -90; i <= 90; i += currentStep)
  71. {
  72. var angleRad = Geometry.DegreeToRadian(i);
  73. var rotatedPosition = ObjectManager.Player.Position.To2D() + (425f * direction.Rotated(angleRad));
  74. list.Add(rotatedPosition.To3D());
  75. }
  76. return list;
  77. }
  78.  
  79. private static void Game_OnUpdate(EventArgs args)
  80. {
  81. if (AssemblyMenu.Item("dz191.exocondemn.execute").GetValue<KeyBind>().Active && (Condemn.IsReady() && ObjectManager.Player.GetSpell(FlashSlot).State == SpellState.Ready))
  82. {
  83. if (CondemnCheck(ObjectManager.Player.ServerPosition) != null)
  84. {
  85. return;
  86. }
  87.  
  88. if (AssemblyMenu.Item("dz191.exocondemn.onlyone").GetValue<bool>() &&
  89. ObjectManager.Player.CountEnemiesInRange(1200f) > 1)
  90. {
  91. return;
  92. }
  93.  
  94. var positions = GetRotatedFlashPositions();
  95.  
  96. foreach (var p in positions)
  97. {
  98. var condemnUnit = CondemnCheck(p);
  99. if (condemnUnit != null)
  100. {
  101. Condemn.CastOnUnit(condemnUnit);
  102.  
  103. Utility.DelayAction.Add((int)(250 + Game.Ping / 2f + 25), () =>
  104. {
  105. ObjectManager.Player.Spellbook.CastSpell(FlashSlot, p);
  106. });
  107. }
  108. }
  109. }
  110. }
  111.  
  112. private static Obj_AI_Hero CondemnCheck(Vector3 fromPosition)
  113. {
  114. var HeroList = HeroManager.Enemies.Where(
  115. h =>
  116. h.IsValidTarget(Condemn.Range) &&
  117. !h.HasBuffOfType(BuffType.SpellShield) &&
  118. !h.HasBuffOfType(BuffType.SpellImmunity));
  119. foreach (var Hero in HeroList)
  120. {
  121. var ePred = Condemn.GetPrediction(Hero);
  122. int pushDist = AssemblyMenu.Item("dz191.exocondemn.pushdistance").GetValue<Slider>().Value;
  123. for (int i = 0; i < pushDist; i += (int)Hero.BoundingRadius)
  124. {
  125. Vector3 loc3 = ePred.UnitPosition.To2D().Extend(fromPosition.To2D(), -i).To3D();
  126. if (loc3.IsWall())
  127. {
  128. return Hero;
  129. }
  130. }
  131. }
  132. return null;
  133. }
  134.  
  135. private static void LoadFlash()
  136. {
  137. var testSlot = ObjectManager.Player.GetSpellSlot("summonerflash");
  138. if (testSlot != SpellSlot.Unknown)
  139. {
  140. Console.WriteLine("Flash Slot: {0}", testSlot);
  141. FlashSlot = testSlot;
  142. }
  143. else
  144. {
  145. Console.WriteLine("Error loading Flash! Not found!");
  146. }
  147. }
  148. }
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement