Kali


SUBMITTED BY: Alerand

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

FORMAT: Text only

SIZE: 15.3 kB

HITS: 10989

  1. #region
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using DetuksSharp;
  6. using LeagueSharp;
  7. using LeagueSharp.Common;
  8. using SharpDX;
  9. using Color = System.Drawing.Color;
  10. #endregion
  11. namespace Marksman.Champions
  12. {
  13. internal class EnemyMarker
  14. {
  15. public string ChampionName { get; set; }
  16. public double ExpireTime { get; set; }
  17. public int BuffCount { get; set; }
  18. }
  19. internal class Kalista : Champion
  20. {
  21. public static Spell E;
  22. public static Dictionary<Vector3, Vector3> JumpPos = new Dictionary<Vector3, Vector3>();
  23. private static readonly List<EnemyMarker> xEnemyMarker = new List<EnemyMarker>();
  24. public Obj_AI_Hero CoopStrikeAlly;
  25. public float CoopStrikeAllyRange = 1250f;
  26. public Dictionary<String, int> MarkedChampions = new Dictionary<String, int>();
  27. public Spell Q;
  28. public Spell R;
  29. public Spell W;
  30. public Kalista()
  31. {
  32. Utils.Utils.PrintMessage("Kalista loaded.");
  33. Q = new Spell(SpellSlot.Q, 1150);
  34. W = new Spell(SpellSlot.W, 5500);
  35. E = new Spell(SpellSlot.E, 950);
  36. R = new Spell(SpellSlot.R, 1250);
  37. Q.SetSkillshot(0.25f, 40f, 1300f, true, SkillshotType.SkillshotLine);
  38. W.SetSkillshot(0.25f, 80f, 1600f, false, SkillshotType.SkillshotLine);
  39. R.SetSkillshot(1f, 160f, 2000f, false, SkillshotType.SkillshotLine);
  40. }
  41. public int KalistaMarkerCount
  42. {
  43. get
  44. {
  45. var xbuffCount = 0;
  46. foreach (
  47. var buff in from enemy in ObjectManager.Get<Obj_AI_Hero>().Where(tx => tx.IsEnemy && !tx.IsDead)
  48. where ObjectManager.Player.Distance(enemy) < E.Range
  49. from buff in enemy.Buffs
  50. where buff.Name.Contains("kalistaexpungemarker")
  51. select buff)
  52. {
  53. xbuffCount = buff.Count;
  54. }
  55. return xbuffCount;
  56. }
  57. }
  58. public override void DeathWalker_AfterAttack(AttackableUnit unit, AttackableUnit target)
  59. {
  60. }
  61. public override void Drawing_OnDraw(EventArgs args)
  62. {
  63. Spell[] spellList = {Q, W, E, R};
  64. foreach (var spell in spellList)
  65. {
  66. var menuItem = GetValue<Circle>("Draw" + spell.Slot);
  67. if (menuItem.Active && spell.Level > 0)
  68. Render.Circle.DrawCircle(ObjectManager.Player.Position, spell.Range, menuItem.Color);
  69. }
  70. var drawConn = GetValue<Circle>("DrawConnMax");
  71. if (drawConn.Active)
  72. Render.Circle.DrawCircle(ObjectManager.Player.Position, CoopStrikeAllyRange, drawConn.Color);
  73. var drawJumpPos = GetValue<Circle>("DrawJumpPos");
  74. if (drawJumpPos.Active)
  75. {
  76. foreach (var pos in JumpPos)
  77. {
  78. if (ObjectManager.Player.Distance(pos.Key) <= 500f ||
  79. ObjectManager.Player.Distance(pos.Value) <= 500f)
  80. {
  81. Drawing.DrawCircle(pos.Key, 75f, drawJumpPos.Color);
  82. Drawing.DrawCircle(pos.Value, 75f, drawJumpPos.Color);
  83. }
  84. if (ObjectManager.Player.Distance(pos.Key) <= 35f ||
  85. ObjectManager.Player.Distance(pos.Value) <= 35f)
  86. {
  87. Render.Circle.DrawCircle(pos.Key, 70f, Color.GreenYellow);
  88. Render.Circle.DrawCircle(pos.Value, 70f, Color.GreenYellow);
  89. }
  90. }
  91. }
  92. }
  93. public void JumpTo()
  94. {
  95. if (!Q.IsReady())
  96. {
  97. Drawing.DrawText(Drawing.Width*0.44f, Drawing.Height*0.80f, Color.Red,
  98. "Q is not ready! You can not Jump!");
  99. return;
  100. }
  101. Drawing.DrawText(Drawing.Width*0.39f, Drawing.Height*0.80f, Color.White,
  102. "Jumping Mode is Active! Go to the nearest jump point!");
  103. foreach (var xTo in from pos in JumpPos
  104. where ObjectManager.Player.Distance(pos.Key) <= 35f ||
  105. ObjectManager.Player.Distance(pos.Value) <= 35f
  106. let xTo = pos.Value
  107. select ObjectManager.Player.Distance(pos.Key) < ObjectManager.Player.Distance(pos.Value)
  108. ? pos.Value
  109. : pos.Key)
  110. {
  111. Q.Cast(new Vector2(xTo.X, xTo.Y), true);
  112. //Packet.C2S.Move.Encoded(new Packet.C2S.Move.Struct(xTo.X, xTo.Y)).Send();
  113. ObjectManager.Player.IssueOrder(GameObjectOrder.MoveTo, xTo);
  114. }
  115. }
  116. private static float GetEDamage(Obj_AI_Base t)
  117. {
  118. if (!E.IsReady())
  119. return 0f;
  120. return (float) ObjectManager.Player.GetSpellDamage(t, SpellSlot.E);
  121. }
  122. public override void Game_OnGameUpdate(EventArgs args)
  123. {
  124. if (GetValue<Circle>("DrawJumpPos").Active)
  125. fillPositions();
  126. if (GetValue<KeyBind>("JumpTo").Active)
  127. {
  128. JumpTo();
  129. }
  130. foreach (
  131. var myBoddy in
  132. ObjectManager.Get<Obj_AI_Minion>()
  133. .Where(
  134. obj => obj.Name == "RobotBuddy" &&
  135. obj.IsAlly && ObjectManager.Player.Distance(obj) < 1500))
  136. {
  137. Render.Circle.DrawCircle(myBoddy.Position, 75f, Color.Red);
  138. }
  139. if (CoopStrikeAlly == null)
  140. {
  141. foreach (
  142. var ally in
  143. from ally in ObjectManager.Get<Obj_AI_Hero>().Where(tx => tx.IsAlly && !tx.IsDead && !tx.IsMe)
  144. where ObjectManager.Player.Distance(ally) <= CoopStrikeAllyRange
  145. from buff in ally.Buffs
  146. where buff.Name.Contains("kalistacoopstrikeally")
  147. select ally)
  148. {
  149. CoopStrikeAlly = ally;
  150. }
  151. if (W.Level != 0)
  152. Drawing.DrawText(Drawing.Width*0.44f, Drawing.Height*0.80f, Color.Red, "Searching Your Friend...");
  153. }
  154. else
  155. {
  156. var drawConnText = GetValue<Circle>("DrawConnText");
  157. if (drawConnText.Active)
  158. {
  159. Drawing.DrawText(Drawing.Width*0.44f, Drawing.Height*0.80f, drawConnText.Color,
  160. "You Connected with " + CoopStrikeAlly.ChampionName);
  161. }
  162. var drawConnSignal = GetValue<bool>("DrawConnSignal");
  163. if (drawConnSignal)
  164. {
  165. if (ObjectManager.Player.Distance(CoopStrikeAlly) > 800 &&
  166. ObjectManager.Player.Distance(CoopStrikeAlly) < CoopStrikeAllyRange)
  167. {
  168. Drawing.DrawText(Drawing.Width*0.45f, Drawing.Height*0.82f, Color.Gold,
  169. "Connection Signal: Low");
  170. }
  171. else if (ObjectManager.Player.Distance(CoopStrikeAlly) < 800)
  172. {
  173. Drawing.DrawText(Drawing.Width*0.45f, Drawing.Height*0.82f, Color.GreenYellow,
  174. "Connection Signal: Good");
  175. }
  176. else if (ObjectManager.Player.Distance(CoopStrikeAlly) > CoopStrikeAllyRange)
  177. {
  178. Drawing.DrawText(Drawing.Width*0.45f, Drawing.Height*0.82f, Color.Red,
  179. "Connection Signal: None");
  180. }
  181. }
  182. }
  183. var drawEStackCount = GetValue<Circle>("DrawEStackCount");
  184. if (drawEStackCount.Active)
  185. {
  186. xEnemyMarker.Clear();
  187. foreach (
  188. var xEnemy in
  189. ObjectManager.Get<Obj_AI_Hero>()
  190. .Where(tx => tx.IsEnemy && !tx.IsDead && ObjectManager.Player.Distance(tx) < E.Range))
  191. {
  192. foreach (var buff in xEnemy.Buffs.Where(buff => buff.Name.Contains("kalistaexpungemarker")))
  193. {
  194. xEnemyMarker.Add(new EnemyMarker
  195. {
  196. ChampionName = xEnemy.ChampionName,
  197. ExpireTime = Game.Time + 4,
  198. BuffCount = buff.Count
  199. });
  200. }
  201. }
  202. foreach (var markedEnemies in xEnemyMarker)
  203. {
  204. foreach (var enemy in ObjectManager.Get<Obj_AI_Hero>())
  205. {
  206. if (enemy.IsEnemy && !enemy.IsDead && ObjectManager.Player.Distance(enemy) <= E.Range &&
  207. enemy.ChampionName == markedEnemies.ChampionName)
  208. {
  209. if (!(markedEnemies.ExpireTime > Game.Time)) continue;
  210. var xCoolDown = TimeSpan.FromSeconds(markedEnemies.ExpireTime - Game.Time);
  211. var display = string.Format("E:{0}", markedEnemies.BuffCount);
  212. Drawing.DrawText(enemy.HPBarPosition.X + 145, enemy.HPBarPosition.Y + 20,
  213. drawEStackCount.Color,
  214. display);
  215. }
  216. }
  217. }
  218. }
  219. Obj_AI_Hero t;
  220. if (Q.IsReady() && GetValue<KeyBind>("UseQTH").Active)
  221. {
  222. if (ObjectManager.Player.HasBuff("Recall"))
  223. return;
  224. t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
  225. if (t != null)
  226. Q.Cast(t);
  227. }
  228. if (ComboActive || HarassActive)
  229. {
  230. var useQ = GetValue<bool>("UseQ" + (ComboActive ? "C" : "H"));
  231. var useE = GetValue<bool>("UseE" + (ComboActive ? "C" : "H"));
  232. if (DeathWalker.canMove())
  233. {
  234. if (Q.IsReady() && useQ)
  235. {
  236. t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
  237. if (t != null)
  238. Q.Cast(t);
  239. }
  240. if (E.IsReady() && useE)
  241. {
  242. t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
  243. if (t != null)
  244. {
  245. if (t.Health < ObjectManager.Player.GetSpellDamage(t, SpellSlot.E))
  246. {
  247. E.Cast();
  248. }
  249. }
  250. }
  251. }
  252. }
  253. if (!R.IsReady() || !GetValue<KeyBind>("CastR").Active) return;
  254. t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical);
  255. if (t != null)
  256. R.Cast(t);
  257. }
  258. public override bool ComboMenu(Menu config)
  259. {
  260. config.AddItem(new MenuItem("UseQC" + Id, "Use Q").SetValue(true));
  261. config.AddItem(new MenuItem("UseWC" + Id, "Use W").SetValue(true));
  262. config.AddItem(new MenuItem("UseEC" + Id, "Use E").SetValue(true));
  263. config.AddItem(new MenuItem("UseRC" + Id, "Use R").SetValue(true));
  264. return true;
  265. }
  266. public override bool HarassMenu(Menu config)
  267. {
  268. config.AddItem(new MenuItem("UseQH" + Id, "Use Q").SetValue(true));
  269. config.AddItem(new MenuItem("UseWH" + Id, "Use W").SetValue(true));
  270. config.AddItem(
  271. new MenuItem("UseQTH" + Id, "Use Q (Toggle)").SetValue(new KeyBind("H".ToCharArray()[0],
  272. KeyBindType.Toggle)));
  273. return true;
  274. }
  275. public override bool MiscMenu(Menu config)
  276. {
  277. config.AddItem(
  278. new MenuItem("JumpTo" + Id, "JumpTo").SetValue(new KeyBind("T".ToCharArray()[0], KeyBindType.Press)));
  279. return true;
  280. }
  281. public override bool DrawingMenu(Menu config)
  282. {
  283. config.AddItem(
  284. new MenuItem("DrawQ" + Id, "Q range").SetValue(new Circle(true, Color.FromArgb(100, 255, 0, 255))));
  285. config.AddItem(
  286. new MenuItem("DrawW" + Id, "W range").SetValue(new Circle(false, Color.FromArgb(100, 255, 255, 255))));
  287. config.AddItem(
  288. new MenuItem("DrawE" + Id, "E range").SetValue(new Circle(false, Color.FromArgb(100, 255, 255, 255))));
  289. config.AddItem(
  290. new MenuItem("DrawR" + Id, "R range").SetValue(new Circle(false, Color.FromArgb(100, 255, 255, 255))));
  291. config.AddItem(new MenuItem("Dx" + Id, ""));
  292. config.AddItem(
  293. new MenuItem("DrawConnMax" + Id, "Connection range").SetValue(new Circle(false,
  294. Color.FromArgb(100, 255, 255, 255))));
  295. config.AddItem(
  296. new MenuItem("DrawConnText" + Id, "Connection Text").SetValue(new Circle(false, Color.GreenYellow)));
  297. config.AddItem(
  298. new MenuItem("DrawConnSignal" + Id, "Connection Signal").SetValue(true));
  299. config.AddItem(new MenuItem("Dx" + Id, ""));
  300. config.AddItem(
  301. new MenuItem("DrawEStackCount" + Id, "E Stack Count").SetValue(new Circle(false, Color.Firebrick)));
  302. config.AddItem(new MenuItem("Dx", ""));
  303. config.AddItem(
  304. new MenuItem("DrawJumpPos" + Id, "Jump Positions").SetValue(new Circle(false, Color.HotPink)));
  305. var damageAfterE = new MenuItem("DamageAfterE", "Damage After E").SetValue(true);
  306. config.AddItem(damageAfterE);
  307. Utility.HpBarDamageIndicator.DamageToUnit = GetEDamage;
  308. Utility.HpBarDamageIndicator.Enabled = damageAfterE.GetValue<bool>();
  309. damageAfterE.ValueChanged +=
  310. delegate(object sender, OnValueChangeEventArgs eventArgs)
  311. {
  312. Utility.HpBarDamageIndicator.Enabled = eventArgs.GetNewValue<bool>();
  313. };
  314. return true;
  315. }
  316. public override bool ExtrasMenu(Menu config)
  317. {
  318. return true;
  319. }
  320. public override bool LaneClearMenu(Menu config)
  321. {
  322. return true;
  323. }
  324. public static void fillPositions()
  325. {
  326. }
  327. }
  328. }

comments powered by Disqus