AzInject


SUBMITTED BY: Alerand

DATE: May 7, 2016, 10:41 a.m.

FORMAT: Text only

SIZE: 11.7 kB

HITS: 12056

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Drawing.Design;
  4. using System.Linq;
  5. using DetuksSharp;
  6. using LeagueSharp;
  7. using LeagueSharp.Common;
  8. using SharpDX;
  9. using Color = System.Drawing.Color;
  10. using DeathWalker = DetuksSharp.DeathWalker;
  11. namespace AzirSharp
  12. {
  13. internal class AzirSharp
  14. {
  15. public const string CharName = "Azir";
  16. public static Menu Config;
  17. public static HpBarIndicator hpi = new HpBarIndicator();
  18. public static Vector3 tempTestPos = new Vector3();
  19. public AzirSharp()
  20. {
  21. Console.WriteLine("Azir started");
  22. /* CallBAcks */
  23. CustomEvents.Game.OnGameLoad += onLoad;
  24. }
  25. private static void onLoad(EventArgs args)
  26. {
  27. if (ObjectManager.Player.ChampionName != CharName)
  28. return;
  29. Game.PrintChat("Azir - Sharp by DeTuKs");
  30. try
  31. {
  32. Config = new Menu("Azir - Sharp", "Azir", true);
  33. //Orbwalker
  34. Config.AddSubMenu(new Menu("Orbwalker", "Orbwalker"));
  35. DeathWalker.AddToMenu(Config.SubMenu("Orbwalker"));
  36. //TS
  37. var TargetSelectorMenu = new Menu("Target Selector", "Target Selector");
  38. TargetSelector.AddToMenu(TargetSelectorMenu);
  39. Config.AddSubMenu(TargetSelectorMenu);
  40. //Combo
  41. Config.AddSubMenu(new Menu("Combo Sharp", "combo"));
  42. Config.SubMenu("combo").AddItem(new MenuItem("fullin", "full in combo")).SetValue(new KeyBind('A', KeyBindType.Press, false));
  43. Config.SubMenu("combo").AddItem(new MenuItem("useQ", "use Q")).SetValue(true);
  44. Config.SubMenu("combo").AddItem(new MenuItem("useW", "use W")).SetValue(false);
  45. Config.SubMenu("combo").AddItem(new MenuItem("useE", "use E")).SetValue(true);
  46. Config.SubMenu("combo").AddItem(new MenuItem("useR", "use R")).SetValue(false);
  47. Config.SubMenu("combo").AddItem(new MenuItem("fly", "fly to mouse")).SetValue(new KeyBind('T', KeyBindType.Press, false));
  48. Config.SubMenu("combo").AddItem(new MenuItem("glide", "Inject closest")).SetValue(new KeyBind('Y', KeyBindType.Press, false));
  49. //LastHit
  50. // Config.AddSubMenu(new Menu("LastHit Sharp", "lHit"));
  51. //LaneClear
  52. // Config.AddSubMenu(new Menu("LaneClear Sharp", "lClear"));
  53. //Extra
  54. Config.AddSubMenu(new Menu("Extra Sharp", "extra"));
  55. Config.SubMenu("extra").AddItem(new MenuItem("wasteR", "dont Waste R")).SetValue(true);
  56. Config.SubMenu("extra").AddItem(new MenuItem("autoTower", "auto R undet turr")).SetValue(true);
  57. //Drawings
  58. Config.AddSubMenu(new Menu("Drawings Sharp", "draw"));
  59. Config.SubMenu("draw").AddItem(new MenuItem("noDraw", "No Drawings")).SetValue(false);
  60. Config.SubMenu("draw").AddItem(new MenuItem("drawQmax", "draw Q max")).SetValue(true);
  61. Config.SubMenu("draw").AddItem(new MenuItem("drawW", "draw W")).SetValue(true);
  62. Config.SubMenu("draw").AddItem(new MenuItem("drawR", "draw R")).SetValue(true);
  63. Config.SubMenu("draw").AddItem(new MenuItem("drawFullDmg", "draw damage")).SetValue(true);
  64. Config.SubMenu("draw").AddItem(new MenuItem("drawSoliAA", "draw Solider AA")).SetValue(true);
  65. Config.SubMenu("draw").AddItem(new MenuItem("drawSoliCtrl", "draw Solider Control")).SetValue(true);
  66. //Debug
  67. Config.AddSubMenu(new Menu("Debug", "debug"));
  68. Config.SubMenu("debug").AddItem(new MenuItem("db_targ", "Debug Target")).SetValue(new KeyBind('U', KeyBindType.Press, false));
  69. Config.AddToMainMenu();
  70. Drawing.OnDraw += onDraw;
  71. Game.OnUpdate += OnGameUpdate;
  72. GameObject.OnCreate += OnCreateObject;
  73. GameObject.OnDelete += OnDeleteObject;
  74. Obj_AI_Base.OnProcessSpellCast += OnProcessSpell;
  75. Spellbook.OnCastSpell += onCastSpell;
  76. Drawing.OnEndScene += OnEndScene;
  77. // Game.OnGameSendPacket += OnGameSendPacket;
  78. // Game.OnGameProcessPacket += OnGameProcessPacket;
  79. DeathWalker.azir = true;
  80. Azir.setSkillShots();
  81. }
  82. catch (Exception ex)
  83. {
  84. Console.WriteLine(ex);
  85. Game.PrintChat("Oops. Something went wrong with Azir Sharp");
  86. }
  87. }
  88. private static void onCastSpell(Spellbook sender, SpellbookCastSpellEventArgs args)
  89. {
  90. if (Config.Item("wasteR").GetValue<bool>() && args.Slot == SpellSlot.R &&
  91. Azir.Player.GetEnemiesInRange(650).Count(ene => ene.IsValid && !ene.IsDead) == 0)
  92. args.Process = false;
  93. }
  94. public static float startTime = 0;
  95. public static Vector3 startPos = new Vector3();
  96. public static float endTime = 0;
  97. public static Vector3 endPos = new Vector3();
  98. public static bool first = true;
  99. private static void OnGameUpdate(EventArgs args)
  100. {
  101. try
  102. {
  103. /* if (Azir.getUsableSoliders().Count != 0)
  104. {
  105. Obj_AI_Minion fir = Azir.getUsableSoliders().First();
  106. if (fir.IsMoving)
  107. {
  108. if (first)
  109. {
  110. startTime = Game.Time;
  111. startPos = fir.ServerPosition;
  112. first = false;
  113. }
  114. }
  115. else
  116. {
  117. if (!first)
  118. {
  119. endTime = Game.Time;
  120. endPos = fir.ServerPosition;
  121. float dist = endPos.Distance(startPos);
  122. Console.WriteLine(dist/(endTime-startTime));
  123. Console.WriteLine(Azir.Player.BoundingRadius);
  124. first = true;
  125. }
  126. }
  127. }*/
  128. if (DeathWalker.CurrentMode == DeathWalker.Mode.Combo)
  129. {
  130. Obj_AI_Hero target = TargetSelector.GetTarget(1200, TargetSelector.DamageType.Magical);
  131. if(target != null)
  132. Azir.doCombo(target);
  133. }
  134. if (DeathWalker.CurrentMode == DeathWalker.Mode.Harass)
  135. {
  136. //Azir.doAttack();
  137. }
  138. if (DeathWalker.CurrentMode == DeathWalker.Mode.LaneClear)
  139. {
  140. //Azir.doAttack();
  141. }
  142. if (Config.Item("fly").GetValue<KeyBind>().Active)
  143. {
  144. Azir.doFlyToMouse(Game.CursorPos);
  145. }
  146. if (Config.Item("db_targ").GetValue<KeyBind>().Active)
  147. {
  148. tempTestPos = Game.CursorPos;
  149. }
  150. if (Config.Item("glide").GetValue<KeyBind>().Active)
  151. {
  152. Obj_AI_Hero target = TargetSelector.GetTarget(1200, TargetSelector.DamageType.Magical);
  153. if(target != null)
  154. Azir.doGlideToMouse(target.Position);
  155. }
  156. if (Config.Item("autoTower").GetValue<bool>())
  157. Azir.autoRunderTower();
  158. if (Config.Item("fullin").GetValue<KeyBind>().Active)
  159. {
  160. DeathWalker.deathWalk(Game.CursorPos);
  161. Obj_AI_Hero target = TargetSelector.GetTarget(1500, TargetSelector.DamageType.Magical);
  162. if(target != null)
  163. Azir.goFullIn(target);
  164. }
  165. }
  166. catch (Exception ex)
  167. {
  168. Console.WriteLine(ex);
  169. throw;
  170. }
  171. }
  172. private static void onDraw(EventArgs args)
  173. {
  174. if (Config.Item("noDraw").GetValue<bool>())
  175. return;
  176. if(Config.Item("drawQmax").GetValue<bool>())
  177. Render.Circle.DrawCircle(Azir.Player.Position, 1150, (DeathWalker.canAttack()) ? Color.Red : Color.Blue);
  178. if (Config.Item("drawSoliAA").GetValue<bool>() || Config.Item("drawSoliCtrl").GetValue<bool>())
  179. foreach (var solid in Azir.MySoldiers)
  180. {
  181. if (solid.IsValid && !solid.IsDead)
  182. {
  183. if (Config.Item("drawSoliAA").GetValue<bool>())
  184. Render.Circle.DrawCircle(solid.Position, 325, Color.Yellow);
  185. if (Config.Item("drawSoliCtrl").GetValue<bool>())
  186. Render.Circle.DrawCircle(solid.Position, 900, Color.GreenYellow);
  187. }
  188. }
  189. if (Config.Item("drawW").GetValue<bool>())
  190. Render.Circle.DrawCircle(Azir.Player.Position, Azir.W.Range, Color.Yellow);
  191. if (Config.Item("drawR").GetValue<bool>())
  192. {
  193. Obj_AI_Base tower =
  194. ObjectManager.Get<Obj_AI_Turret>()
  195. .Where(tur => tur.IsAlly && tur.Health > 0)
  196. .OrderBy(tur => Azir.Player.Distance(tur))
  197. .First();
  198. if (tower != null)
  199. {
  200. var pol = DeathMath.getPolygonOn(Azir.Player.Position.Extend(tower.Position, -125).To2D(),
  201. tower.Position.To2D(), 300 + Azir.R.Level * 100, 270);
  202. pol.Draw(Color.Yellow);
  203. }
  204. }
  205. }
  206. private static void OnEndScene(EventArgs args)
  207. {
  208. if (Config.Item("drawFullDmg").GetValue<bool>())
  209. foreach (var enemy in DeathWalker.AllEnemys.Where(ene => !ene.IsDead && ene.IsEnemy && ene.IsVisible))
  210. {
  211. hpi.unit = enemy;
  212. hpi.drawDmg(Azir.getFullDmgOn(enemy), Color.Yellow);
  213. }
  214. }
  215. private static void OnCreateObject(GameObject sender, EventArgs args)
  216. {
  217. if (sender.Name == "AzirSoldier" && sender.IsAlly)
  218. {
  219. Obj_AI_Minion myMin = sender as Obj_AI_Minion;
  220. if (myMin.SkinName == "AzirSoldier")
  221. Azir.MySoldiers.Add(myMin);
  222. }
  223. }
  224. private static void OnDeleteObject(GameObject sender, EventArgs args)
  225. {
  226. int i = 0;
  227. foreach (var sol in Azir.MySoldiers)
  228. {
  229. if (sol.NetworkId == sender.NetworkId)
  230. {
  231. Azir.MySoldiers.RemoveAt(i);
  232. return;
  233. }
  234. i++;
  235. }
  236. }
  237. public static void OnProcessSpell(Obj_AI_Base obj, GameObjectProcessSpellCastEventArgs arg)
  238. {
  239. // if(!obj.IsMe)
  240. // return;;
  241. }
  242. }
  243. }

comments powered by Disqus