Advertisement
Guest User

Untitled

a guest
Feb 1st, 2014
765
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 20.44 KB | None | 0 0
  1. if myHero.charName ~= "Lulu" then return end
  2.  
  3. --[[       ----------------------------------------------------------------------------------------------       ]]--
  4. --[[                            Kalman Filter, all credits too vadash for coding it                             ]]--
  5. --[[       ----------------------------------------------------------------------------------------------       ]]--
  6. class 'Kalman' -- {
  7. function Kalman:__init()
  8.         self.current_state_estimate = 0
  9.         self.current_prob_estimate = 0
  10.         self.Q = 1
  11.         self.R = 15
  12. end
  13. function Kalman:STEP(control_vector, measurement_vector)
  14.         local predicted_state_estimate = self.current_state_estimate + control_vector
  15.         local predicted_prob_estimate = self.current_prob_estimate + self.Q
  16.         local innovation = measurement_vector - predicted_state_estimate
  17.         local innovation_covariance = predicted_prob_estimate + self.R
  18.         local kalman_gain = predicted_prob_estimate / innovation_covariance
  19.         self.current_state_estimate = predicted_state_estimate + kalman_gain * innovation
  20.         self.current_prob_estimate = (1 - kalman_gain) * predicted_prob_estimate
  21.         return self.current_state_estimate
  22. end
  23.  
  24. local CurVer = 1
  25. local NeedUpdate = false
  26. local Do_Once = true
  27. local ScriptName = "Lulu, The Queen of the Yordles"
  28. local NetFile = "http://tekilla.cuccfree.org/SidasAutoCarryPlugin%20-%20Lulu.lua"
  29. local LocalFile = BOL_PATH.."Scripts\\Common\\SidasAutoCarryPlugin - Lulu.lua"
  30.  
  31.  
  32. function CheckVersion(data)
  33.     local NetVersion = tonumber(data)
  34.     if type(NetVersion) ~= "number" then
  35.         return
  36.     end
  37.     if NetVersion and NetVersion > CurVer then
  38.         print("<font color='#FF4000'>-- "..ScriptName..": Update found ! Don't F9 till done...</font>")
  39.         NeedUpdate = true  
  40.     else
  41.         print("<font color='#00BFFF'>-- "..ScriptName..": You have the lastest version</font>")
  42.     end
  43. end
  44.  
  45. function UpdateScript()
  46.     if Do_Once then
  47.         Do_Once = false
  48.         if _G.UseUpdater == nil or _G.UseUpdater == true then
  49.             GetAsyncWebResult("tekilla.cuccfree.org", "LuluQueen-Ver.txt", CheckVersion)
  50.         end
  51.     end
  52.  
  53.     if NeedUpdate then
  54.         NeedUpdate = false
  55.         DownloadFile(NetFile, LocalFile, function()
  56.                                             if FileExist(LocalFile) then
  57.                                                 print("<font color='#00BFFF'>-- "..ScriptName..": Script updated! Please reload.</font>")
  58.                                             end
  59.                                         end
  60.                     )
  61.     end
  62. end
  63.  
  64. AddTickCallback(UpdateScript)
  65.  
  66.  
  67. --[[ Velocities ]]
  68. local kalmanFilters = {}
  69. local velocityTimers = {}
  70. local oldPosx = {}
  71. local oldPosz = {}
  72. local oldTick = {}
  73. local velocity = {}
  74. local lastboost = {}
  75. local velocity_TO = 10
  76. local CONVERSATION_FACTOR = 975
  77. local MS_MIN = 500
  78. ----------------------
  79. local castRTick = nil
  80. local enemyList = {}
  81. local ToInterrupt = {}
  82. local InteruptionSpells = {
  83.     { charName = "FiddleSticks",    spellName = "Crowstorm",                    Skill = "W"},
  84.     { charName = "FiddleSticks",    spellName = "Drain",                        Skill = "W"},
  85.     { charName = "Galio",           spellName = "GalioIdolOfDurand",            Skill = "W"},
  86.     { charName = "Pantheon",        spellName = "Pantheon_Heartseeker",         Skill = "W"},
  87.     { charName = "Pantheon",        spellName = "Pantheon_GrandSkyfall_Jump",   Skill = "W"},
  88.     { charName = "Warwick",         spellName = "InfiniteDuress",               Skill = "W"},
  89.     { charName = "MissFortune",     spellName = "MissFortuneBulletTime",        Skill = "W"},
  90.     { charName = "Nunu",            spellName = "AbsoluteZero",                 Skill = "W"},
  91.     { charName = "Caitlyn",         spellName = "CaitlynAceintheHole",          Skill = "W"},
  92.     { charName = "Caitlyn",         spellName = "CaitlynEntrapment",            Skill = "W"},
  93.     { charName = "Shen",            spellName = "ShenStandUnited",              Skill = "W"},
  94.     { charName = "Urgot",           spellName = "UrgotSwap2",                   Skill = "W"},
  95.     { charName = "Janna",           spellName = "ReapTheWhirlwind",             Skill = "W"},
  96.     { charName = "TwistedFate",     spellName = "gate",                         Skill = "W"},
  97.     { charName = "Lucian",          spellName = "LucianR",                      Skill = "W"},
  98.     { charName = "MasterYi",        spellName = "Meditate",                     Skill = "W"},
  99.     { charName = "Varus",           spellName = "VarusQ",                       Skill = "W"},
  100.     { charName = "Katarina",        spellName = "KatarinaR",                    Skill = "W"},
  101.     { charName = "Karthus",         spellName = "FallenOne",                    Skill = "W"},
  102.     { charName = "Malzahar",        spellName = "AlZaharNetherGrasp",           Skill = "W"},
  103.     { charName = "Darius",          spellName = "DariusExecute",                Skill = "W"},
  104.     { charName = "MonkeyKing",      spellName = "MonkeyKingSpinToWin",          Skill = "W"},
  105.    
  106.     { charName = "Akali",           spellName = "AkaliSmokeBomb",               Skill = "E"},
  107.     { charName = "Twitch",          spellName = "HideInShadows",                Skill = "E"},
  108.     --{ charName = "Khazix",        spellName = "KhazixR",                      Skill = "E"},
  109.     { charName = "Vayne",           spellName = "vayneinquisition",             Skill = "E"},
  110. }
  111. --[[       ----------------------------------------------------------------------------------------------       ]]--
  112. --[[                                                AutoCarry                                                   ]]--
  113. --[[       ----------------------------------------------------------------------------------------------       ]]--
  114.  
  115. function InitMenu()
  116.     Menu:addSubMenu("-----> Ultimate options", "ultsub")
  117.     Menu.ultsub:addParam("ultLowHP", "Use Auto-Ultimate on LowHP allies", SCRIPT_PARAM_ONOFF, true)
  118.     Menu.ultsub:addParam("useRperc", "HP % to ult an ally", SCRIPT_PARAM_SLICE, 14, 0, 100, 0)
  119.     Menu.ultsub:addParam("UltimateInfo1", "---------------------------", SCRIPT_PARAM_INFO, "")
  120.     Menu.ultsub:addParam("useRMEC", "Use Auto-Ultimate MEC", SCRIPT_PARAM_ONOFF, true)
  121.     Menu.ultsub:addParam("rMECminEnemies", "Number of enemies to cast R", SCRIPT_PARAM_SLICE, 2, 1, 5, 0)
  122.    
  123.     Menu:addSubMenu("-----> Mixed mode options", "mmsub")
  124.     Menu.mmsub:addParam("qMix", "Harass with Q", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
  125.     Menu.mmsub:addParam("wMix", "Harass with W", SCRIPT_PARAM_ONOFF, true)
  126.     Menu.mmsub:addParam("eMix", "Harass with E", SCRIPT_PARAM_ONOFF, true)
  127.    
  128.     Menu:addSubMenu("-----> AutoHarass options", "ahsub")
  129.     Menu.ahsub:addParam("qAuto", "Auto Harass with Q", SCRIPT_PARAM_ONOFF, false)
  130.     Menu.ahsub:addParam("wAuto", "Auto Harass with W", SCRIPT_PARAM_ONOFF, false)
  131.     Menu.ahsub:addParam("eAuto", "Auto Harass with E", SCRIPT_PARAM_ONOFF, false)
  132.    
  133.    
  134.     Menu:addSubMenu("-----> Interuptions", "intsub")
  135.     Menu.intsub:addParam("NinjaInteruption", "Interupt skills with W", SCRIPT_PARAM_ONOFF, false)
  136.     Menu.intsub:addParam("InterupInfo0", "----------------------------", SCRIPT_PARAM_INFO, "")
  137.     if #ToInterrupt > 0 then
  138.         for _, Inter in pairs(ToInterrupt) do
  139.             if Inter.Skill == "W" then
  140.                 Menu.intsub:addParam(Inter.spellName, "Stop "..Inter.charName.." "..Inter.spellName, SCRIPT_PARAM_ONOFF, true)
  141.             end
  142.         end
  143.     else
  144.         Menu.intsub:addParam("InterupInfo1", "No supported skills to interupt", SCRIPT_PARAM_INFO, "")
  145.     end
  146.    
  147.     Menu:addSubMenu("-----> Reveal", "revsub")
  148.     Menu.revsub:addParam("NinjaReveal", "Reveal champions with E", SCRIPT_PARAM_ONOFF, false)
  149.     Menu.revsub:addParam("RevealInfo0", "----------------------------", SCRIPT_PARAM_INFO, "")
  150.     if #ToInterrupt > 0 then
  151.         for _, Inter in pairs(ToInterrupt) do
  152.             if Inter.Skill == "E" then
  153.                 Menu.revsub:addParam(Inter.spellName, "Reveal "..Inter.charName.." when "..Inter.spellName, SCRIPT_PARAM_ONOFF, true)
  154.             end
  155.         end
  156.     else
  157.         Menu.revsub:addParam("RevealInfo1", "No supported skills to interupt", SCRIPT_PARAM_INFO, "")
  158.     end
  159.    
  160.    
  161.     Menu:addSubMenu("-----> W Skill Usage", "wusesub")
  162.     if #enemyList > 0 then
  163.         for _, enem in pairs(enemyList) do
  164.             Menu.wusesub:addParam(enem.charName, "Use W on "..enem.charName, SCRIPT_PARAM_ONOFF, true)
  165.         end
  166.     else
  167.         Menu.wusesub:addParam("UseWInfo1", "Not enough enemies", SCRIPT_PARAM_INFO, "")
  168.     end
  169.    
  170.     Menu:addSubMenu("-----> Visual options", "vissub")
  171.     Menu.vissub:addParam("dQRange", "Draw Q Range", SCRIPT_PARAM_ONOFF, false)
  172.     Menu.vissub:addParam("dQRangeColor","--Q Range Color", SCRIPT_PARAM_COLOR, { 255, 255, 50, 50 })
  173.    
  174.     Menu.vissub:addParam("dWRange", "Draw W Range", SCRIPT_PARAM_ONOFF, false)
  175.     Menu.vissub:addParam("dWRangeColor","--W Range Color", SCRIPT_PARAM_COLOR, { 255, 255, 50, 50 })
  176.    
  177.     Menu.vissub:addParam("dERange", "Draw E Range", SCRIPT_PARAM_ONOFF, false)
  178.     Menu.vissub:addParam("dERangeColor","--E Range Color", SCRIPT_PARAM_COLOR, { 255, 255, 50, 50 })
  179.    
  180.     Menu.vissub:addParam("dRRange", "Draw R Range", SCRIPT_PARAM_ONOFF, false)
  181.     Menu.vissub:addParam("dRRangeColor","--R Range Color", SCRIPT_PARAM_COLOR, { 255, 255, 50, 50 })
  182.    
  183.     Menu.intsub:addParam("GeneralInfo0", "----------------------------", SCRIPT_PARAM_INFO, "")
  184.     Menu:addParam("extendQwithE", "Extend Q range with E on ally", SCRIPT_PARAM_ONOFF, true)
  185.     Menu:addParam("MinMana", "Mana Manager min %", SCRIPT_PARAM_SLICE, 35, 0, 100, 0)
  186.  
  187.     if VIP_USER then
  188.         if Prodiction then
  189.             Menu:addParam("Status", "---- PROdiction loaded ----", SCRIPT_PARAM_INFO, "")
  190.         else
  191.             Menu:addParam("minHitChance", "Min Hit Chance %", SCRIPT_PARAM_SLICE, 70, 1, 100, 0)
  192.             Menu:addParam("Status", "---- VIP loaded ----", SCRIPT_PARAM_INFO, "")
  193.         end
  194.     else
  195.         Menu:addParam("Status", "---- FREE User loaded ----", SCRIPT_PARAM_INFO, "")
  196.     end
  197.    
  198. end
  199.  
  200.  
  201. function PluginOnLoad()
  202.     if AutoCarry.Skills then IsSACReborn = true else IsSACReborn = false end
  203.    
  204.     if IsSACReborn then
  205.         AutoCarry.Crosshair:SetSkillCrosshairRange(1000)
  206.         AutoCarry.Crosshair.isCaster = true
  207.         AutoCarry.MyHero:AttacksEnabled(true)
  208.         AutoCarry.Skills:DisableAll()
  209.     else
  210.         AutoCarry.SkillsCrosshair.range = 1000
  211.         AutoCarry.CanAttack = true
  212.     end
  213.     Recalling = false
  214.     Menu = AutoCarry.PluginMenu
  215.    
  216.     -------Skills info-------
  217.     qRange, QSpeed, QDelay, QWidth = 930, 1.50, 250, 50
  218.     wRange = 650
  219.     eRange = 650
  220.     rRange, RWidth = 900, 150
  221.     -------/Skills info-------
  222.    
  223.     tpQ = VIP_USER and TargetPredictionVIP(qRange, QSpeed*1000, QDelay/1000, QWidth) or TargetPrediction(qRange, QSpeed, QDelay, QWidth)
  224.    
  225.     if VIP_USER then
  226.         if FileExist(SCRIPT_PATH..'Common/Prodiction.lua') then
  227.             require "Prodiction"
  228.            
  229.             Prodiction = ProdictManager.GetInstance()
  230.             ProdictionQ = Prodiction:AddProdictionObject(_Q, qRange, QSpeed*1000, QDelay/1000, 80)
  231.            
  232.             PrintChat("<font color='#ab15d9'> > Lulu, The Queen of the Yordles v"..CurVer.." by TeKilla - PROdiction</font>")
  233.         else
  234.             PrintChat("<font color='#ab15d9'> > Lulu, The Queen of the Yordles v"..CurVer.." by TeKilla - VIP</font>")
  235.         end
  236.     else
  237.         PrintChat("<font color='#ab15d9'> > Lulu, The Queen of the Yordles v"..CurVer.." by TeKilla - FREE</font>")
  238.     end
  239.    
  240.    
  241.     LoadInterupt()
  242.     InitMenu()
  243. end
  244.  
  245. function PluginOnTick()
  246.     SpellsState()
  247.     UpdateSpeed()
  248.     if IsSACReborn then Target = AutoCarry.Crosshair:GetTarget() else Target = AutoCarry.GetAttackTarget(true) end
  249.    
  250.     if castRTick == nil or GetTickCount()-castRTick >= 90 then
  251.         castRTick = GetTickCount()
  252.         if Menu.ultsub.ultLowHP then UltimateLowHp() end
  253.         if Menu.ultsub.useRMEC then UltimateMEC() end
  254.     end
  255.        
  256.     if AutoCarry.MainMenu.AutoCarry then
  257.         Combo()
  258.     else
  259.         if (AutoCarry.MainMenu.MixedMode and Menu.mmsub.qMix) or (Menu.ahsub.qAuto and not Recalling) then
  260.             HarassQ()
  261.         end
  262.         if ((AutoCarry.MainMenu.MixedMode and Menu.mmsub.eMix) or (Menu.ahsub.eAuto and not Recalling and not IsMyManaLow())) then
  263.             HarassE()
  264.         end
  265.         if ((AutoCarry.MainMenu.MixedMode and Menu.mmsub.wMix) or (Menu.ahsub.wAuto and not Recalling)) then
  266.             HarassW()
  267.         end
  268.     end
  269.    
  270. end
  271.  
  272. function PluginOnDraw()
  273.     if not myHero.dead then
  274.         if Menu.vissub.dQRange and QReady then
  275.             DrawCircle(myHero.x, myHero.y, myHero.z, qRange, RGB(Menu.vissub.dQRangeColor[2], Menu.vissub.dQRangeColor[3], Menu.vissub.dQRangeColor[4]))
  276.         end
  277.         if Menu.vissub.dWRange and WReady then
  278.             DrawCircle(myHero.x, myHero.y, myHero.z, wRange, RGB(Menu.vissub.dWRangeColor[2], Menu.vissub.dWRangeColor[3], Menu.vissub.dWRangeColor[4]))
  279.         end
  280.         if Menu.vissub.dERange and EReady then
  281.             DrawCircle(myHero.x, myHero.y, myHero.z, eRange, RGB(Menu.vissub.dERangeColor[2], Menu.vissub.dERangeColor[3], Menu.vissub.dERangeColor[4]))
  282.         end
  283.         if Menu.vissub.dRRange and RReady then
  284.             DrawCircle(myHero.x, myHero.y, myHero.z, rRange, RGB(Menu.vissub.dRRangeColor[2], Menu.vissub.dRRangeColor[3], Menu.vissub.dRRangeColor[4]))
  285.         end
  286.     end
  287. end
  288.  
  289.  
  290. function PluginOnProcessSpell(unit, spell)
  291.     if Menu.intsub.NinjaInteruption or Menu.revsub.NinjaReveal then
  292.         if #ToInterrupt > 0 then
  293.             for _, Inter in pairs(ToInterrupt) do
  294.                 if spell.name == Inter.spellName and unit.team ~= myHero.team then
  295.                     if Inter.Skill == "W" and Menu.intsub.NinjaInteruption then
  296.                         if Menu.intsub[Inter.spellName] then
  297.                             if GetDistance(unit) <= wRange then
  298.                                 CastSpellW(unit)
  299.                             end
  300.                         end
  301.                     elseif Inter.Skill == "E" and Menu.revsub.NinjaReveal then
  302.                         if Menu.revsub[Inter.spellName] then
  303.                             print(Inter.spellName)
  304.                             if GetDistance(unit) <= eRange then
  305.                                 CastSpellE(unit)
  306.                             end
  307.                         end
  308.                     end
  309.                 end
  310.             end
  311.         end
  312.     end
  313. end
  314.  
  315. function PluginOnAnimation(unit, animation)
  316.     if unit.isMe then
  317.         if animation:lower():find("recall") then
  318.             Recalling = true
  319.         else
  320.             Recalling = false
  321.         end
  322.     end
  323. end
  324.  
  325. --[[       ----------------------------------------------------------------------------------------------       ]]--
  326. --[[                                                OptionFunction                                              ]]--
  327. --[[       ----------------------------------------------------------------------------------------------       ]]--
  328. function CastSpellQ(target)
  329.     if not Prodiction then
  330.         if VIP_USER then
  331.             if AutoCarry.PluginMenu.minHitChance ~= 0 and tpQ:GetHitChance(target) >= AutoCarry.PluginMenu.minHitChance then
  332.                 QPos,_,_ = tpQ:GetPrediction(target)
  333.                 if QPos ~= nil then
  334.                     Packet('S_CAST', { spellId = _Q, fromX = QPos.x, fromY = QPos.z}):send()
  335.                 end
  336.             end
  337.         else
  338.             QPos,_,_ = tpQ:GetPrediction(target)
  339.             if QPos ~= nil then
  340.                 CastSpell(_Q, QPos.x, QPos.z)
  341.             end
  342.         end
  343.     else
  344.         local QPos = ProdictionQ:GetPrediction(target)
  345.         if QPos ~= nil then
  346.             Packet('S_CAST', { spellId = _Q, fromX = QPos.x, fromY = QPos.z}):send()
  347.         end
  348.     end
  349. end
  350.  
  351.  
  352. function CastSpellW(target)
  353.     if target.team ~= myHero.team then
  354.         if Menu.wusesub[target.charName] then
  355.             if VIP_USER then
  356.                 Packet('S_CAST', { spellId = _W, targetNetworkId = target.networkID}):send()
  357.             else
  358.                 CastSpell(_W, target)
  359.             end
  360.         end
  361.     else
  362.         if VIP_USER then
  363.             Packet('S_CAST', { spellId = _W, targetNetworkId = target.networkID}):send()
  364.         else
  365.             CastSpell(_W, target)
  366.         end
  367.     end
  368. end
  369.  
  370.  
  371. function CastSpellE(target)
  372.     if VIP_USER then
  373.         Packet('S_CAST', { spellId = _E, targetNetworkId = target.networkID}):send()
  374.     else
  375.         CastSpell(_E, target)
  376.     end
  377. end
  378.  
  379.  
  380. function CastSpellR(target)
  381.     if VIP_USER then
  382.         Packet('S_CAST', { spellId = _R, targetNetworkId = target.networkID}):send()
  383.     else
  384.         CastSpell(_R, target)
  385.     end
  386. end
  387.  
  388.  
  389. function UltimateLowHp()
  390.     if RReady then
  391.         for i=1, heroManager.iCount do
  392.             local Ally = heroManager:GetHero(i)
  393.             if Ally.team == myHero.team and not Ally.dead then
  394.                 if GetDistance(Ally) <= rRange then
  395.                     if (Ally.health / Ally.maxHealth) < (Menu.ultsub.useRperc / 100) then
  396.                         if CountEnemies(Ally, 1000) >= 1 then
  397.                             CastSpellR(Ally)
  398.                         end
  399.                     end
  400.                 end
  401.             end
  402.         end
  403.     end
  404. end
  405.  
  406. function UltimateMEC()
  407.     if RReady then
  408.         for i=1, heroManager.iCount do
  409.             local Ally = heroManager:GetHero(i)
  410.             if Ally.team == myHero.team and not Ally.dead then
  411.                 if GetDistance(Ally) <= rRange then
  412.                     if CountEnemies(Ally, 170) >= Menu.ultsub.rMECminEnemies then
  413.                         CastSpellR(Ally)
  414.                     end            
  415.                 end
  416.             end
  417.         end
  418.     end
  419. end
  420.  
  421. function Combo()
  422.  
  423.     if Target and not Target.dead then
  424.         if QReady then
  425.             if GetDistance(Target) <= qRange then
  426.                 CastSpellQ(Target)
  427.             elseif GetDistance(Target) <= (2*qRange+eRange) then
  428.                 if Menu.extendQwithE then
  429.                     local ally, enemy = GetNearestAllyToHitEnemy()
  430.                     if ally ~= nil and enemy ~= nil then
  431.                         CastSpellE(ally)
  432.                         CastSpellQ(enemy)
  433.                     end
  434.                 end
  435.             end
  436.         end
  437.        
  438.         if WReady and GetDistance(Target) <= wRange then
  439.             CastSpellW(Target)
  440.         end
  441.        
  442.         if EReady and GetDistance(Target) <= eRange then
  443.             CastSpellE(Target)
  444.         end
  445.     end
  446.  
  447. end
  448.  
  449.  
  450. function HarassQ()
  451.     if Target then
  452.         if GetDistance(Target) <= qRange and HaveLowVelocity(Target, 750) then
  453.                 CastSpellQ(Target)
  454.             end
  455.         end
  456. end
  457.  
  458. function HarassE()
  459.     if Target then
  460.         if GetDistance(Target) <= eRange then
  461.             CastSpellE(Target)
  462.         end
  463.     end
  464. end
  465.  
  466. function HarassW()
  467.     if Target then
  468.         if GetDistance(Target) <= wRange then
  469.             CastSpellW(Target)
  470.         end
  471.     end
  472. end
  473.  
  474. --[[       ----------------------------------------------------------------------------------------------       ]]--
  475. --[[                                                 Utility                                                    ]]--
  476. --[[       ----------------------------------------------------------------------------------------------       ]]--
  477. function CountEnemies(point, range)
  478.     local count = 0
  479.     for _, enemy in pairs(enemyHeroes) do
  480.         if not enemy.dead and GetDistance(point, enemy) <= range then
  481.             count = count+1
  482.         end
  483.     end  
  484.     return count
  485. end
  486.  
  487. function GetNearbyAllies()
  488.     local Allies = {}
  489.     for i = 1, heroManager.iCount, 1 do
  490.         local ally = heroManager:getHero(i)
  491.         if ally.team == myHero.team and not ally.dead and GetDistance(ally) <= eRange and ally ~= myHero then
  492.             table.insert(Allies, ally)
  493.         end
  494.     end
  495.     return Allies
  496. end
  497.  
  498. function GetNearestAllyToHitEnemy()
  499.     nearestAlly = nil
  500.     enemyTarget = nil
  501.     nearestDist = math.huge
  502.     for _, Ally in pairs( GetNearbyAllies() ) do    --For each nearby ally
  503.         if not Ally.dead then
  504.             for i=1, #enemyList do                 
  505.                 local Enemy = enemyList[i]
  506.                 if not Enemy.dead then              --And for each enemy alive
  507.                     if GetDistance(Ally, Enemy) <= qRange and GetDistance(Ally, Enemy) <= nearestDist then
  508.                         nearestDist = GetDistance(Ally, Enemy)
  509.                         nearestAlly = Ally
  510.                         enemyTarget = Enemy
  511.                         --PrintChat(nearestAlly.name)
  512.                         --PrintChat(enemyTarget.name)
  513.                     end
  514.                 end
  515.             end
  516.         end
  517.     end
  518.    
  519.     return nearestAlly, enemyTarget
  520. end
  521.  
  522.  
  523. function LoadInterupt()
  524.     enemyHeroes = GetEnemyHeroes()
  525.     for _, enemy in pairs(enemyHeroes) do   --thank's to pqmailer
  526.         table.insert(enemyList, enemy)
  527.         kalmanFilters[enemy.networkID] = Kalman()
  528.         velocityTimers[enemy.networkID] = 0
  529.         oldPosx[enemy.networkID] = 0
  530.         oldPosz[enemy.networkID] = 0
  531.         oldTick[enemy.networkID] = 0
  532.         velocity[enemy.networkID] = 0
  533.         lastboost[enemy.networkID] = 0
  534.         for _, champ in pairs(InteruptionSpells) do
  535.             if enemy.charName == champ.charName then
  536.                 table.insert(ToInterrupt, {charName = champ.charName, spellName = champ.spellName, Skill = champ.Skill})
  537.             end
  538.         end
  539.     end
  540. end
  541.  
  542. function HaveLowVelocity(target, time)
  543.         if ValidTarget(target, 1200) then
  544.                 return (velocity[target.networkID] < MS_MIN and target.ms < MS_MIN and GetTickCount() - lastboost[target.networkID] > time)
  545.         else
  546.                 return nil
  547.         end
  548. end
  549.  
  550. function _calcHeroVelocity(target, oldPosx, oldPosz, oldTick)
  551.         if oldPosx and oldPosz and target.x and target.z then
  552.                 local dis = math.sqrt((oldPosx - target.x) ^ 2 + (oldPosz - target.z) ^ 2)
  553.                 velocity[target.networkID] = kalmanFilters[target.networkID]:STEP(0, (dis / (GetTickCount() - oldTick)) * CONVERSATION_FACTOR)
  554.         end
  555. end
  556.  
  557. function UpdateSpeed()
  558.         local tick = GetTickCount()
  559.         for i=1, #enemyList do
  560.                 local hero = enemyList[i]
  561.                 if ValidTarget(hero) then
  562.                         if velocityTimers[hero.networkID] <= tick and hero and hero.x and hero.z and (tick - oldTick[hero.networkID]) > (velocity_TO-1) then
  563.                                 velocityTimers[hero.networkID] = tick + velocity_TO
  564.                                 _calcHeroVelocity(hero, oldPosx[hero.networkID], oldPosz[hero.networkID], oldTick[hero.networkID])
  565.                                 oldPosx[hero.networkID] = hero.x
  566.                                 oldPosz[hero.networkID] = hero.z
  567.                                 oldTick[hero.networkID] = tick
  568.                                 if velocity[hero.networkID] > MS_MIN then
  569.                                         lastboost[hero.networkID] = tick
  570.                                 end
  571.                         end
  572.                 end
  573.         end
  574. end
  575.  
  576.  
  577. function SpellsState()
  578.     QReady = (myHero:CanUseSpell(_Q) == READY)
  579.     WReady = (myHero:CanUseSpell(_W) == READY)
  580.     EReady = (myHero:CanUseSpell(_E) == READY)
  581.     RReady = (myHero:CanUseSpell(_R) == READY)
  582. end
  583.  
  584. --[Credits to Kain]--
  585. function IsMyManaLow()
  586.     if myHero.mana < (myHero.maxMana * ( AutoCarry.PluginMenu.MinMana / 100)) then
  587.         return true
  588.     else
  589.         return false
  590.     end
  591. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement