Kain2030

Kayle, The Judicator v1.2b - Kain Reborn Fix

Apr 5th, 2014
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.04 KB | None | 0 0
  1. --[[
  2.     AutoCarry Plugin - Kayle The Judicator, Judgement Day Has Come !!! 1.2a by Jaikor
  3.     With Code from Skeem, thanks Skeem for teaching me the obj for free users
  4.     Credtis to HeX Original Plugin and Pain for his work ( this is a improved version by me )
  5.     Credtis to fbragequit for the AA idea. thanks
  6.     Special thanks to Felina, Chrisokgo and gespierd and all the others who help testing the script for me.
  7.     Credtis to RoachxD helping out fixing bugs ;)
  8.     Copyright 2013
  9.     Changelog :
  10.    1.0 - Initial Release
  11.    1.1 - Bug fixes, ult fixed, reborn & revamp compatible
  12.    1.2 - Bug Fixes, should work for free users, revamp and reborn, new ult logic it should only cast R on % hp if detects enemy in range
  13.    1.2a - BETA FIX
  14.    1.2b - Reborn Fix by Kain
  15.  ]] --
  16.  
  17. if myHero.charName ~= "Kayle" then return end
  18. local rRange = 900
  19.  
  20. --[Function When Plugin Loads]--
  21. function PluginOnLoad()
  22.     mainLoad() -- Loads our Variable Function
  23.     mainMenu() -- Loads our Menu function
  24. end
  25.  
  26. --[OnTick]--
  27. function PluginOnTick()
  28.     if Recall then return end
  29.     if IsSACReborn then
  30.         AutoCarry.Crosshair:SetSkillCrosshairRange(1050)
  31.     else
  32.         AutoCarry.SkillsCrosshair.range = 1050
  33.     end
  34.     Checks()
  35.     SmartKS()
  36.     farmMinions:update()
  37.     if myHero.range > 350 then
  38.     eFlag = true
  39. else
  40.   eFlag = false
  41. end
  42.  
  43.     if Carry.AutoCarry then FullCombo() end
  44.     if Carry.MixedMode and Target then
  45.         if Menu.qHarass and not IsMyManaLow() and GetDistance(Target) <= qRange then CastSpell(_Q, Target) end
  46.     end
  47.     if Carry.LaneClear or JungleClear() then
  48.                     for _, minion in pairs(AutoCarry.EnemyMinions().objects) do
  49.                     if ValidTarget(minion) and GetDistance(minion) <= eRange and Extras.useEclear and EREADY then
  50.                         CastSpell(_E)
  51.                     end
  52.                 end
  53.         end
  54.     if Menu.useR and RREADY then
  55.         for i, ally in ipairs(GetAllyHeroes()) do
  56.             if ally and not ally.dead and ally.visible and GetDistance(ally) <= rRange then
  57.                 UltManagement(ally)
  58.             end
  59.         end
  60.         UltManagement(myHero)
  61.     end
  62.        
  63.     if Extras.ZWItems and IsMyHealthLow() and Target and (ZNAREADY or WGTREADY) then CastSpell((wgtSlot or znaSlot)) end
  64.     if Extras.aHP and NeedHP() and not (UsingHPot or UsingFlask) and (HPREADY or FSKREADY) then CastSpell((hpSlot or fskSlot)) end
  65.     if Extras.aMP and IsMyManaLow() and not (UsingMPot or UsingFlask) and(MPREADY or FSKREADY) then CastSpell((mpSlot or fskSlot)) end
  66.     if Extras.AutoLevelSkills then autoLevelSetSequence(levelSequence) end
  67.       if Extras.qFarm and Carry.LastHit then
  68.       for _, minion in pairs(farmMinions.objects) do
  69.             if minion and ValidTarget(minion) and QREADY and GetDistance(minion) <= qRange then
  70.                 if minion.health < qDmg then CastSpell(_Q, minion) end
  71.             end
  72.         end
  73.     end
  74. end
  75.  
  76. --[Drawing our Range/Killable Enemies]--
  77. function PluginOnDraw()
  78.     if not myHero.dead then
  79.         if QREADY and Menu.qDraw then
  80.             DrawCircle(myHero.x, myHero.y, myHero.z, qRange, 0x191970)
  81.         end
  82.     end
  83. end
  84.  
  85.  
  86.     function OnGainBuff(unit, buff)
  87.         if unit.isMe and buff.name == eBuff then
  88.             AutoCarry.MyHero.IsMelee = false
  89.             EM.range = 625.5
  90.             eFlag = true
  91.         end
  92.     end
  93.  
  94.     function OnLoseBuff(unit, buff)
  95.         if unit.isMe and buff.name == eBuff then
  96.             AutoCarry.MyHero.IsMelee = true
  97.             EM.range = 255.5
  98.             eFlag = false
  99.         end
  100.     end
  101.  
  102. function BonusDamage()
  103.     if eFlag then
  104.         return (myHero:GetSpellData(_E).level * 10 + 10) + myHero.ap * 0.4
  105.     end
  106.     return 0
  107. end
  108.  
  109. --[Object Detection]--
  110. function PluginOnCreateObj(obj)
  111.     if obj.name:find("TeleportHome.troy") then
  112.         if GetDistance(obj, myHero) <= 70 then
  113.             Recall = true
  114.         end
  115.     end
  116.         if obj.name:find("Regenerationpotion_itm.troy") then
  117.         if GetDistance(obj, myHero) <= 70 then
  118.             UsingHPot = true
  119.         end
  120.     end
  121.     if obj.name:find("RighteousFuryHalo_buff.troy") then
  122.         if GetDistance(obj, myHero) <= 70 then
  123.             eBuff = true
  124.             eFlag = true
  125.         end
  126.     end
  127.     if obj.name:find("Global_Item_HealthPotion.troy") then
  128.         if GetDistance(obj, myHero) <= 70 then
  129.             UsingHPot = true
  130.             UsingFlask = true
  131.         end
  132.     end
  133.     if obj.name:find("Global_Item_ManaPotion.troy") then
  134.         if GetDistance(obj, myHero) <= 70 then
  135.             UsingFlask = true
  136.             UsingMPot = true
  137.         end
  138.     end
  139. end
  140.  
  141. function PluginOnDeleteObj(obj)
  142.     if obj.name:find("TeleportHome.troy") then
  143.         Recall = false
  144.     end
  145.     if obj.name:find("Regenerationpotion_itm.troy") then
  146.         UsingHPot = false
  147.     end
  148.     if obj.name:find("Global_Item_HealthPotion.troy") then
  149.         UsingHPot = false
  150.         UsingFlask = false
  151.     end
  152.     if obj.name:find("Global_Item_ManaPotion.troy") then
  153.         UsingMPot = false
  154.         UsingFlask = false
  155.     end
  156.         if obj.name:find("RighteousFuryHalo_buff.troy") then
  157.         if GetDistance(obj, myHero) <= 70 then
  158.             eBuff = false
  159.             eFlag = false
  160.         end
  161.     end
  162. end
  163.  
  164. function OnAttacked()
  165.     if Target and Carry.AutoCarry then
  166.         if QREADY and Menu.useQ and GetDistance(Target) <= qRange then CastSpell(_Q, Target) end
  167.     end
  168. end
  169.  
  170. --[Low Mana Function by Kain]--
  171. function IsMyManaLow()
  172.     if myHero.mana < (myHero.maxMana * ( Extras.MinMana / 100)) then
  173.         return true
  174.     else
  175.         return false
  176.     end
  177. end
  178.  
  179. --[/Low Mana Function by Kain]--
  180.  
  181. --[Low Health Function Trololz]--
  182. function IsMyHealthLow()
  183.     if myHero.health < (myHero.maxHealth * ( Extras.ZWHealth / 100)) then
  184.         return true
  185.     else
  186.         return false
  187.     end
  188. end
  189. --[/Low Health Function Trololz]--
  190.  
  191. --[Health Pots Function]--
  192. function NeedHP()
  193.     if myHero.health < (myHero.maxHealth * ( Extras.HPHealth / 100)) then
  194.         return true
  195.     else
  196.         return false
  197.     end
  198. end
  199.  
  200. function CountEnemies(point, range)
  201.         local ChampCount = 0
  202.         for j = 1, heroManager.iCount, 1 do
  203.                 local enemyhero = heroManager:getHero(j)
  204.                 if myHero.team ~= enemyhero.team and ValidTarget(enemyhero, QRange) then
  205.                         if GetDistance(enemyhero, point) <= range then
  206.                                 ChampCount = ChampCount + 1
  207.                         end
  208.                 end
  209.         end            
  210.         return ChampCount
  211. end
  212.  
  213. function Healing()
  214.     if myHero.mana >= myHero.maxMana*Menu.HealMana then
  215.         for i=1, heroManager.iCount do
  216.             local allytarget = heroManager:GetHero(i)
  217.             if allytarget.team == myHero.team and not allytarget.dead then
  218.                 if GetDistance(allytarget) <= 900 and (allytarget.health / allytarget.maxHealth) < Menu.HealHealth then
  219.                     if myHero:CanUseSpell(_W) == READY then
  220.                         CastSpell(_W, allytarget)
  221.                         end
  222.                     end
  223.                 end
  224.             end
  225.         end
  226. end
  227.  
  228.  
  229.  
  230.  
  231. --[Smart KS Function]--
  232. function SmartKS()
  233.     for i=1, heroManager.iCount do
  234.      local enemy = heroManager:GetHero(i)
  235.         if ValidTarget(enemy) then
  236.             dfgDmg, hxgDmg, bwcDmg, iDmg  = 0, 0, 0, 0
  237.             qDmg = getDmg("Q",enemy,myHero)
  238.             eDmg = getDmg("E",enemy,myHero)
  239.             wDmg = getDmg("W",enemy,myHero)
  240.             if DFGREADY then dfgDmg = (dfgSlot and getDmg("DFG",enemy,myHero) or 0) end
  241.             if HXGREADY then hxgDmg = (hxgSlot and getDmg("HXG",enemy,myHero) or 0) end
  242.             if BWCREADY then bwcDmg = (bwcSlot and getDmg("BWC",enemy,myHero) or 0) end
  243.             if IREADY then iDmg = (ignite and getDmg("IGNITE",enemy,myHero) or 0) end
  244.             onspellDmg = (liandrysSlot and getDmg("LIANDRYS",enemy,myHero) or 0)+(blackfireSlot and getDmg("BLACKFIRE",enemy,myHero) or 0)
  245.             itemsDmg = dfgDmg + hxgDmg + bwcDmg + iDmg + onspellDmg
  246.             if Menu.sKS then
  247.                 if enemy.health <= (qDmg) and GetDistance(enemy) <= qRange and QREADY then
  248.                     if QREADY then CastSpell(_Q, enemy) end
  249.                
  250.                 elseif enemy.health <= (eDmg) and GetDistance(enemy) <= eRange and EREADY then
  251.                     if EREADY then CastSpell(_E, enemy) end
  252.                
  253.                 elseif enemy.health <= (qDmg + eDmg) and GetDistance(enemy) <= eRange and EREADY and QREADY then
  254.                     if QREADY then CastSpell(_Q, enemy)
  255.                     if EREADY then CastSpell(_E, enemy)end
  256.                                    
  257.                 elseif enemy.health <= (qDmg + itemsDmg) and GetDistance(enemy) <= qRange and QREADY then
  258.                     if DFGREADY then CastSpell(dfgSlot, enemy) end
  259.                     if HXGREADY then CastSpell(hxgSlot, enemy) end
  260.                     if BWCREADY then CastSpell(bwcSlot, enemy) end
  261.                     if BRKREADY then CastSpell(brkSlot, enemy) end
  262.                     if QREADY then CastSpell(_Q, enemy) end
  263.                
  264.                 elseif enemy.health <= (eDmg + itemsDmg) and GetDistance(enemy) <= eRange and EREADY then
  265.                     if DFGREADY then CastSpell(dfgSlot, enemy) end
  266.                     if HXGREADY then CastSpell(hxgSlot, enemy) end
  267.                     if BWCREADY then CastSpell(bwcSlot, enemy) end
  268.                     if BRKREADY then CastSpell(brkSlot, enemy) end
  269.                     if EREADY then CastSpell(_E, enemy) end
  270.                
  271.                 elseif enemy.health <= (qDmg + eDmg + itemsDmg) and GetDistance(enemy) <= eRange
  272.                     and EREADY and QREADY then
  273.                         if DFGREADY then CastSpell(dfgSlot, enemy) end
  274.                         if HXGREADY then CastSpell(hxgSlot, enemy) end
  275.                         if BWCREADY then CastSpell(bwcSlot, enemy) end
  276.                         if BRKREADY then CastSpell(brkSlot, enemy) end
  277.                         if QREADY then CastSpell(_Q, enemy) end
  278.                         if EREADY then CastSpell(_E, enemy) end
  279.                        
  280.                
  281.                 end
  282.                                
  283.                 if enemy.health <= iDmg and GetDistance(enemy) <= 600 then
  284.                     if IREADY then CastSpell(ignite, enemy) end
  285.                 end
  286.             end
  287.             KillText[i] = 1
  288.             if enemy.health <= (qDmg + eDmg + itemsDmg) and QREADY and EREADY then
  289.             KillText[i] = 2
  290.             end
  291.         end
  292.     end
  293. end
  294. end
  295.  
  296.  
  297.  
  298. function UltManagement(unit)
  299.     if unit.health <= unit.maxHealth*(Menu.PercentofHealth/100) and CountEnemyHeroInRange(650, unit) > 0 then CastSpell(_R, unit) end
  300. end
  301.  
  302.  
  303. function OnProcessSpell(unit, spell)
  304.     if Menu.useR and unit.team ~= myHero.team and spell.name == "zedult" then UltManagement(spell.target) end
  305. end
  306.  
  307.  
  308. --[Full Combo with Items]--
  309. function FullCombo()
  310.     if Target then
  311.         if AutoCarry.MainMenu.AutoCarry then
  312.             if GetDistance(Target) <= qRange then CastSpell(_Q, Target) end
  313.             if GetDistance(Target) <= eRange then CastSpell(_E) end
  314.             if Menu.useW and WREADY and GetDistance(Target) > wBuffer then CastSpell(_W, myHero) end
  315.         end
  316.     end
  317. end
  318.  
  319.  
  320. function JungleClear()
  321.     if IsSACReborn then
  322.         JungleMob = AutoCarry.Jungle:GetAttackableMonster()
  323.     else
  324.         JungleMob = AutoCarry.GetMinionTarget()
  325.     end
  326.     if JungleMob ~= nil and not IsMyManaLow() then
  327.         if Extras.JungleE and GetDistance(JungleMob) <= eRange then CastSpell(_E, JungleMob) end
  328.     end
  329. end
  330.  
  331.  
  332. --[Variables Load]--
  333. function mainLoad()
  334.     if AutoCarry.Skills then IsSACReborn = true else IsSACReborn = false end
  335.     if IsSACReborn then AutoCarry.Skills:DisableAll() end
  336.     Carry = AutoCarry.MainMenu
  337.     qRange,wRange,eRange,rRange = 650, 900, 525, 900
  338.     QREADY, WREADY, EREADY, RREADY = false, false, false, false
  339.     qName, wName, eName, rName = "Reckoning", "Devine Blessing", "Righteous Fury", "Intervention"
  340.     HK1, HK2, HK3 = string.byte("Z"), string.byte("K"), string.byte("G")
  341.     Menu = AutoCarry.PluginMenu
  342.     UsingHPot, UsingMPot, UsingFlask = false, false, false
  343.     Recall = false, false, false
  344.     TextList = {"Harass him!!", "FULL COMBO KILL!"}
  345.     KillText = {}
  346.     waittxt = {} -- prevents UI lags, all credits to Dekaron
  347.     for i=1, heroManager.iCount do waittxt[i] = i*3 end -- All credits to Dekaron
  348.     farmMinions = minionManager(MINION_ENEMY, qRange+200, player)
  349.     if VIP_USER and IsSACReborn then
  350.         EM = AutoCarry.EnemyMinions()
  351.         AdvancedCallback:bind('OnGainBuff', function(unit, buff) OnGainBuff(unit, buff) end)
  352.         AdvancedCallback:bind('OnLoseBuff', function(unit, buff) OnLoseBuff(unit, buff) end)
  353.         eBuff = "JudicatorRighteousFury"
  354.     end
  355.     wBuffer = 400 --Wont use W unless they are this far away. 400 by default.
  356.     GetEnemyHeroes()
  357.     GetAllyHeroes()
  358. end
  359.  
  360.  
  361. --[Main Menu & Extras Menu]--
  362. function mainMenu()
  363.     Menu:addParam("sep1", "-- Full Combo Options --", SCRIPT_PARAM_INFO, "")
  364.     Menu:addParam("useQ", "Use "..qName.." (Q)", SCRIPT_PARAM_ONOFF, true)
  365.     Menu:addParam("useW", "Use "..wName.." (W)", SCRIPT_PARAM_ONOFF, true)
  366.     Menu:addParam("useE", "Use "..eName.." (E)", SCRIPT_PARAM_ONOFF, true)
  367.     Menu:addParam("HealAll", "Heals Allies if below X Health", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("K"))
  368.     Menu:addParam("HealHealth", "X Amount of Health to heal", SCRIPT_PARAM_SLICE, 0.6, 0.1, 0.9, 1)
  369.     Menu:addParam("HealMana", "X Amount of Mana to heal", SCRIPT_PARAM_SLICE, 0.4, 0.1, 1, 1)  
  370.     Menu:addParam("sep2", "-- Mixed Mode Options --", SCRIPT_PARAM_INFO, "")
  371.     Menu:addParam("qHarass", "Use "..qName.." (Q)", SCRIPT_PARAM_ONOFF, true)
  372.     Menu:addParam("sep3", "-- Draw Options --", SCRIPT_PARAM_INFO, "")
  373.     Menu:addParam("qDraw", "Draw "..qName.." (Q)", SCRIPT_PARAM_ONOFF, true)
  374.     Menu:addParam("cDraw", "Draw Enemy Text", SCRIPT_PARAM_ONOFF, true)
  375.     Menu:addParam("sep4", "-- ULT Options --", SCRIPT_PARAM_INFO, "")
  376.     Menu:addParam("useR", "Auto Ult "..rName.." (R)", SCRIPT_PARAM_ONOFF, true)
  377.     Menu:addParam("PercentofHealth", "PercentofHealth",SCRIPT_PARAM_SLICE, 25, 0, 100, 0)
  378.     Extras = scriptConfig("Sida's Auto Carry Plugin: "..myHero.charName..": Extras", myHero.charName)
  379.     Extras:addParam("sep5", "-- Misc --", SCRIPT_PARAM_INFO, "")
  380.     Extras:addParam("qFarm", "Last Hit with "..qName.." (Q)", SCRIPT_PARAM_ONOFF, true)
  381.     Extras:addParam("JungleE", "Jungle with "..eName.." (E)", SCRIPT_PARAM_ONOFF, true)
  382.     Extras:addParam("useEclear", "Lane Clear with E "..eName.." (E)", SCRIPT_PARAM_ONOFF, true)
  383.     Extras:addParam("MinMana", "Minimum Mana for Jungle/Harass %", SCRIPT_PARAM_SLICE, 50, 0, 100, -1)
  384.     Extras:addParam("ZWItems", "Auto Zhonyas/Wooglets", SCRIPT_PARAM_ONOFF, true)
  385.     Extras:addParam("ZWHealth", "Min Health % for Zhonyas/Wooglets", SCRIPT_PARAM_SLICE, 15, 0, 100, -1)
  386.     Extras:addParam("aHP", "Auto Health Pots", SCRIPT_PARAM_ONOFF, true)
  387.     Extras:addParam("aMP", "Auto Auto Mana Pots", SCRIPT_PARAM_ONOFF, true)
  388.     Extras:addParam("HPHealth", "Min % for Health Pots", SCRIPT_PARAM_SLICE, 50, 0, 100, -1)
  389. end
  390.  
  391. --[Certain Checks]--
  392. function Checks()
  393.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  394.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end
  395.     if IsSACReborn then Target = AutoCarry.Crosshair:GetTarget() else Target = AutoCarry.GetAttackTarget() end
  396.     dfgSlot, hxgSlot, bwcSlot = GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144)
  397.     brkSlot = GetInventorySlotItem(3092),GetInventorySlotItem(3143),GetInventorySlotItem(3153)
  398.     znaSlot, wgtSlot = GetInventorySlotItem(3157),GetInventorySlotItem(3090)
  399.     hpSlot, mpSlot, fskSlot = GetInventorySlotItem(2003),GetInventorySlotItem(2004),GetInventorySlotItem(2041)
  400.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  401.     WREADY = (myHero:CanUseSpell(_W) == READY)
  402.     EREADY = (myHero:CanUseSpell(_E) == READY)
  403.     RREADY = (myHero:CanUseSpell(_R) == READY)
  404.     DFGREADY = (dfgSlot ~= nil and myHero:CanUseSpell(dfgSlot) == READY)
  405.     HXGREADY = (hxgSlot ~= nil and myHero:CanUseSpell(hxgSlot) == READY)
  406.     BWCREADY = (bwcSlot ~= nil and myHero:CanUseSpell(bwcSlot) == READY)
  407.     BRKREADY = (brkSlot ~= nil and myHero:CanUseSpell(brkSlot) == READY)
  408.     ZNAREADY = (znaSlot ~= nil and myHero:CanUseSpell(znaSlot) == READY)
  409.     WGTREADY = (wgtSlot ~= nil and myHero:CanUseSpell(wgtSlot) == READY)
  410.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  411.     HPREADY = (hpSlot ~= nil and myHero:CanUseSpell(hpSlot) == READY)
  412.     MPREADY =(mpSlot ~= nil and myHero:CanUseSpell(mpSlot) == READY)
  413.     FSKREADY = (fskSlot ~= nil and myHero:CanUseSpell(fskSlot) == READY)
  414. end
Advertisement
Add Comment
Please, Sign In to add comment