CtScript


SUBMITTED BY: Alerand

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

UPDATED: May 7, 2016, 10:46 a.m.

FORMAT: Text only

SIZE: 9.5 kB

HITS: 12053

  1. using System;
  2. using System.Drawing;
  3. using DetuksSharp;
  4. using LeagueSharp;
  5. using LeagueSharp.Common;
  6. #endregion
  7. namespace Marksman.Champions
  8. {
  9. internal class Caitlyn : Champion // Base done by xQx, Drawings and improvements added by Dibes.
  10. {
  11. public static Spell R;
  12. public Spell E;
  13. public Spell Q;
  14. public bool ShowUlt;
  15. public string UltTarget;
  16. public Spell W;
  17. public Caitlyn()
  18. {
  19. Utils.Utils.PrintMessage("Caitlyn loaded.");
  20. Q = new Spell(SpellSlot.Q, 1240);
  21. W = new Spell(SpellSlot.W, 820);
  22. E = new Spell(SpellSlot.E, 800);
  23. R = new Spell(SpellSlot.R, 2000);
  24. Q.SetSkillshot(0.25f, 60f, 2000f, false, SkillshotType.SkillshotLine);
  25. E.SetSkillshot(0.25f, 80f, 1600f, true, SkillshotType.SkillshotLine);
  26. AntiGapcloser.OnEnemyGapcloser += AntiGapcloser_OnEnemyGapcloser;
  27. Drawing.OnEndScene += DrawingOnOnEndScene;
  28. }
  29. public void AntiGapcloser_OnEnemyGapcloser(ActiveGapcloser gapcloser)
  30. {
  31. if (E.IsReady() && gapcloser.Sender.IsValidTarget(E.Range))
  32. E.CastOnUnit(gapcloser.Sender);
  33. }
  34. public override void Drawing_OnDraw(EventArgs args)
  35. {
  36. Spell[] spellList = {Q, E, R};
  37. foreach (var spell in spellList)
  38. {
  39. var menuItem = GetValue<Circle>("Draw" + spell.Slot);
  40. if (menuItem.Active)
  41. Render.Circle.DrawCircle(ObjectManager.Player.Position, spell.Range, menuItem.Color);
  42. }
  43. var drawUlt = GetValue<Circle>("DrawUlt");
  44. if (drawUlt.Active && ShowUlt)
  45. {
  46. //var playerPos = Drawing.WorldToScreen(ObjectManager.Player.Position);
  47. //Drawing.DrawText(playerPos.X - 65, playerPos.Y + 20, drawUlt.Color, "Hit R To kill " + UltTarget + "!");
  48. }
  49. }
  50. private static void DrawingOnOnEndScene(EventArgs args)
  51. {
  52. var rCircle2 = Program.Config.Item("Draw.UltiMiniMap").GetValue<Circle>();
  53. if (rCircle2.Active)
  54. {
  55. Utility.DrawCircle(ObjectManager.Player.Position, R.Range, rCircle2.Color, 1, 23, true);
  56. }
  57. }
  58. public override void Game_OnGameUpdate(EventArgs args)
  59. {
  60. R.Range = 500*(R.Level == 0 ? 1 : R.Level) + 1500;
  61. Obj_AI_Hero t;
  62. if (W.IsReady() && GetValue<bool>("AutoWI"))
  63. {
  64. t = TargetSelector.GetTarget(W.Range, TargetSelector.DamageType.Physical);
  65. if (t.IsValidTarget(W.Range) &&
  66. (t.HasBuffOfType(BuffType.Stun) || t.HasBuffOfType(BuffType.Snare) ||
  67. t.HasBuffOfType(BuffType.Taunt) || t.HasBuff("zhonyasringshield") ||
  68. t.HasBuff("Recall")))
  69. {
  70. W.Cast(t.Position);
  71. }
  72. }
  73. if (Q.IsReady() && GetValue<bool>("AutoQI"))
  74. {
  75. t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
  76. if (t.IsValidTarget(Q.Range) &&
  77. (t.HasBuffOfType(BuffType.Stun) || t.HasBuffOfType(BuffType.Snare) ||
  78. t.HasBuffOfType(BuffType.Taunt) &&
  79. (t.Health <= ObjectManager.Player.GetSpellDamage(t, SpellSlot.Q) ||
  80. !DeathWalker.inAutoAttackRange(t))))
  81. {
  82. Q.Cast(t, false, true);
  83. }
  84. }
  85. if (R.IsReady())
  86. {
  87. t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical);
  88. if (t.IsValidTarget(R.Range) && t.Health <= R.GetDamage(t))
  89. {
  90. if (GetValue<KeyBind>("UltHelp").Active)
  91. R.Cast(t);
  92. UltTarget = t.ChampionName;
  93. ShowUlt = true;
  94. }
  95. else
  96. {
  97. ShowUlt = false;
  98. }
  99. }
  100. else
  101. {
  102. ShowUlt = false;
  103. }
  104. if (GetValue<KeyBind>("Dash").Active && E.IsReady())
  105. {
  106. var pos = ObjectManager.Player.ServerPosition.To2D().Extend(Game.CursorPos.To2D(), -300).To3D();
  107. E.Cast(pos, true);
  108. }
  109. if (GetValue<KeyBind>("UseEQC").Active && E.IsReady() && Q.IsReady())
  110. {
  111. t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
  112. if (t.IsValidTarget(E.Range) &&
  113. t.Health <
  114. ObjectManager.Player.GetSpellDamage(t, SpellSlot.Q) +
  115. ObjectManager.Player.GetSpellDamage(t, SpellSlot.E) + 20 && E.CanCast(t))
  116. {
  117. E.Cast(t);
  118. Q.Cast(t, false, true);
  119. }
  120. }
  121. // PQ you broke it D:
  122. if ((!ComboActive && !HarassActive) || !DeathWalker.canMove()) return;
  123. var useQ = GetValue<bool>("UseQ" + (ComboActive ? "C" : "H"));
  124. var useE = GetValue<bool>("UseEC");
  125. var useR = GetValue<bool>("UseRC");
  126. if (Q.IsReady() && useQ)
  127. {
  128. t = TargetSelector.GetTarget(Q.Range, TargetSelector.DamageType.Physical);
  129. if (t != null)
  130. Q.Cast(t, false, true);
  131. }
  132. else if (E.IsReady() && useE)
  133. {
  134. t = TargetSelector.GetTarget(E.Range, TargetSelector.DamageType.Physical);
  135. if (t != null && t.Health <= E.GetDamage(t))
  136. E.Cast(t);
  137. }
  138. if (R.IsReady() && useR)
  139. {
  140. t = TargetSelector.GetTarget(R.Range, TargetSelector.DamageType.Physical);
  141. if (t != null && t.Health <= R.GetDamage(t) &&
  142. !DeathWalker.inAutoAttackRange(t))
  143. {
  144. R.CastOnUnit(t);
  145. }
  146. }
  147. }
  148. public override void DeathWalker_AfterAttack(AttackableUnit unit, AttackableUnit target)
  149. {
  150. var t = target as Obj_AI_Hero;
  151. if (t != null || (!ComboActive && !HarassActive) || unit.IsMe)
  152. return;
  153. var useQ = GetValue<bool>("UseQ" + (ComboActive ? "C" : "H"));
  154. if (useQ)
  155. Q.Cast(t, false, true);
  156. }
  157. public override bool ComboMenu(Menu config)
  158. {
  159. config.AddItem(new MenuItem("UseQC" + Id, "Use Q").SetValue(true));
  160. config.AddItem(new MenuItem("UseEC" + Id, "Use E").SetValue(true));
  161. config.AddItem(new MenuItem("UseRC" + Id, "Use R").SetValue(true));
  162. return true;
  163. }
  164. public override bool HarassMenu(Menu config)
  165. {
  166. config.AddItem(new MenuItem("UseQH" + Id, "Use Q").SetValue(true));
  167. return true;
  168. }
  169. public override bool DrawingMenu(Menu config)
  170. {
  171. config.AddItem(new MenuItem("Champion.Drawings", ObjectManager.Player.ChampionName + " Draw Options"));
  172. config.AddItem(
  173. new MenuItem("DrawQ" + Id, Program.MenuSpace + "Q range").SetValue(new Circle(true,
  174. Color.FromArgb(100, 255, 0, 255))));
  175. config.AddItem(
  176. new MenuItem("DrawE" + Id, Program.MenuSpace + "E range").SetValue(new Circle(false,
  177. Color.FromArgb(100, 255, 255, 255))));
  178. config.AddItem(
  179. new MenuItem("DrawR" + Id, Program.MenuSpace + "R range").SetValue(new Circle(false,
  180. Color.FromArgb(100, 255, 255, 255))));
  181. config.AddItem(
  182. new MenuItem("DrawUlt" + Id, Program.MenuSpace + "Ult Text").SetValue(new Circle(true,
  183. Color.FromArgb(255, 255, 255, 255))));
  184. config.AddItem(
  185. new MenuItem("Draw.UltiMiniMap", Program.MenuSpace + "Draw Ulti Minimap").SetValue(new Circle(true,
  186. Color.FromArgb(255, 255, 255, 255))));
  187. return true;
  188. }
  189. public override bool MiscMenu(Menu config)
  190. {
  191. config.AddItem(
  192. new MenuItem("UltHelp" + Id, "Ult Target on R").SetValue(new KeyBind("R".ToCharArray()[0],
  193. KeyBindType.Press)));
  194. config.AddItem(
  195. new MenuItem("UseEQC" + Id, "Use E-Q Combo").SetValue(new KeyBind("T".ToCharArray()[0],
  196. KeyBindType.Press)));
  197. config.AddItem(
  198. new MenuItem("Dash" + Id, "Dash to Mouse").SetValue(new KeyBind("Z".ToCharArray()[0], KeyBindType.Press)));
  199. return true;
  200. }
  201. public override bool ExtrasMenu(Menu config)
  202. {
  203. config.AddItem(new MenuItem("AutoQI" + Id, "Auto Q (Stun/Snare/Taunt/Slow)").SetValue(true));
  204. config.AddItem(new MenuItem("AutoWI" + Id, "Auto W (Stun/Snare/Taunt)").SetValue(true));
  205. return true;
  206. }
  207. public override bool LaneClearMenu(Menu config)
  208. {
  209. return true;
  210. }
  211. }
  212. }

comments powered by Disqus