coolerfarmer

Untitled

Jan 28th, 2015
6,072
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.46 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.  
  11. namespace KatarinaTutorial
  12. {
  13. class Program
  14. {
  15. public static Spell Q;
  16. public static Spell W;
  17. public static Spell E;
  18. public static Spell R;
  19.  
  20. private static Menu _menu;
  21. private static Orbwalking.Orbwalker _orbwalker;
  22.  
  23. static void Main(string[] args)
  24. {
  25. Game.PrintChat("Katarina Script loaded");
  26. Game.OnGameUpdate += Game_OnGameUpdate;
  27.  
  28. //We need to create our Spells. The 1st parameter is the SpellSlot and the 2nd one is the range/radius of the spell.
  29. Q = new Spell(SpellSlot.Q, 675);
  30. W = new Spell(SpellSlot.W, 375);
  31. E = new Spell(SpellSlot.E, 700);
  32. R = new Spell(SpellSlot.R, 550);
  33.  
  34. Utility.HpBarDamageIndicator.DamageToUnit = CalculateDamage;
  35. Utility.HpBarDamageIndicator.Enabled = true;
  36.  
  37. InitializeMenu();
  38. }
  39.  
  40. static void Game_OnGameUpdate(EventArgs args)
  41. {
  42.  
  43. }
  44.  
  45. static void InitializeMenu()
  46. {
  47. //We create a Menu for the Orbwalker
  48. var orbwalkerMenu = new Menu("Orbwalker", "Orbwalker");
  49. //This creates a new instance of the Orbwalker with the menu from above
  50. _orbwalker = new Orbwalking.Orbwalker(orbwalkerMenu);
  51.  
  52. //This creates the main Menu, the 1st parameter is the display Name, the 2nd one the internal Name and the 3rd one defines if this is a root menu.
  53. _menu = new Menu(ObjectManager.Player.ChampionName, ObjectManager.Player.ChampionName, true);
  54. //This adds the Main Menu to LeagueSharp so it's displayed.
  55. _menu.AddToMainMenu();
  56.  
  57. //This is not necessary. It only shows a sub menu with infos about the script
  58. _menu.AddSubMenu(new Menu("Info", "Info"));
  59. {
  60. _menu.SubMenu("Info").AddItem(new MenuItem("Author", "By coolerfarmer"));
  61. _menu.SubMenu("Info").AddItem(new MenuItem("Version", "Version: 1.0.0"));
  62. }
  63.  
  64. //This creates a new SubMenu for the TargetSelector
  65. _menu.AddSubMenu(new Menu("Target Selector", "Target Selector"));
  66. //here we add the TargetSelector to the menu created above.
  67. TargetSelector.AddToMenu(_menu.SubMenu("Target Selector"));
  68.  
  69. //Finally we add the Orbwalking Menu from above to our Main Menu
  70. _menu.AddSubMenu(orbwalkerMenu);
  71. }
  72.  
  73. static float CalculateDamage(Obj_AI_Hero target)
  74. {
  75. //Create a variable to add all the attack damages
  76. double damage = 0d;
  77.  
  78. //when the Q spell is ready we add the damage of the hit AND the additional damage when striking a marked target
  79. if (Q.IsReady())
  80. damage += ObjectManager.Player.GetSpellDamage(target, SpellSlot.Q) + //Damage of the attack
  81. ObjectManager.Player.GetSpellDamage(target, SpellSlot.Q, 1); //Damage of the mark
  82. //We do the same routine with the W spell
  83. if (W.IsReady())
  84. damage += ObjectManager.Player.GetSpellDamage(target, SpellSlot.W);
  85. //And the E
  86. if (E.IsReady())
  87. damage += ObjectManager.Player.GetSpellDamage(target, SpellSlot.E);
  88.  
  89. //The Ultimate is a bit special. the function R.IsReady() only returns true if there's an enemy in range
  90. //otherwise the spell is supressed and the function returns false. To fix this we need to check
  91. //if the spell is either ready or surpressed. The problem is that the Spell is also surpressed when it's not yet leveled.
  92. //So we need to check if the level is > 0
  93. if (R.IsReady() || (ObjectManager.Player.GetSpell(R.Slot).State == SpellState.Surpressed && R.Level > 0))
  94. damage += ObjectManager.Player.GetSpellDamage(target, SpellSlot.R, 1); //the 3rd parameter is the state of the skill. In this case
  95. // state = 0 returns the damage of one dagger and state = 1
  96. // returns the total damage
  97.  
  98. return (float) damage;
  99. }
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment