naturus

cassioplugin

Dec 25th, 2014
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 27.00 KB | None | 0 0
  1. if myHero.charName ~= "Cassiopeia" then return end
  2.  
  3.  
  4. local CurVer = 1.41
  5. local NeedUpdate = false
  6. local Do_Once = true
  7. local ScriptName = "JaKCass"
  8. local NetFile = "http://tekilla.cuccfree.org/SidasAutoCarryPlugin%20-%20Cassiopeia.lua"
  9. local LocalFile = BOL_PATH.."Scripts\\Common\\SidasAutoCarryPlugin - Cassiopeia.lua"
  10.  
  11.  
  12. function CheckVersion(data)
  13.     local NetVersion = tonumber(data)
  14.     if type(NetVersion) ~= "number" then
  15.         return
  16.     end
  17.     if NetVersion and NetVersion > CurVer then
  18.         print("<font color='#FF4000'>-- "..ScriptName..": Update found ! Don't F9 till done...</font>")
  19.         NeedUpdate = true  
  20.     else
  21.         print("<font color='#00BFFF'>-- "..ScriptName..": You have the lastest version</font>")
  22.     end
  23. end
  24.  
  25. function UpdateScript()
  26.     if Do_Once then
  27.         Do_Once = false
  28.         if _G.UseUpdater == nil or _G.UseUpdater == true then
  29.             GetAsyncWebResult("tekilla.cuccfree.org", ScriptName.."-Ver.txt", CheckVersion)
  30.         end
  31.     end
  32.  
  33.     if NeedUpdate then
  34.         NeedUpdate = false
  35.         DownloadFile(NetFile, LocalFile, function()
  36.                                             if FileExist(LocalFile) then
  37.                                                 print("<font color='#00BFFF'>-- "..ScriptName..": Script updated! Please reload.</font>")
  38.                                             end
  39.                                         end
  40.                     )
  41.     end
  42. end
  43.  
  44. AddTickCallback(UpdateScript)
  45.  
  46. require "AoE_Skillshot_Position"
  47.  
  48.  
  49. local lastQcastTime = 0
  50. local QisCasting = false
  51. local castRTick = nil
  52. local underTurretTick = nil
  53. local ProdictionQ, ProdictionW, ProdictionR, Prodiction
  54. local enemyHeroes
  55. local enemyList = {}
  56. local ToInterrupt = {}
  57. local TurretList = {}
  58. local JungleMobs = {}
  59. local JungleFocusMobs = {}
  60. local FocusJungleNames = {}
  61. local JungleMobNames = {}
  62. local InteruptionSpells = {
  63.     { charName = "FiddleSticks",    spellName = "Crowstorm"},
  64.     { charName = "MissFortune",     spellName = "MissFortuneBulletTime"},
  65.     { charName = "Nunu",            spellName = "AbsoluteZero"},
  66.     { charName = "Caitlyn",         spellName = "CaitlynAceintheHole"},
  67.     { charName = "Katarina",        spellName = "KatarinaR"},
  68.     { charName = "Karthus",         spellName = "FallenOne"},
  69.     { charName = "Malzahar",        spellName = "AlZaharNetherGrasp"},
  70.     { charName = "Galio",           spellName = "GalioIdolOfDurand"},
  71.     { charName = "Darius",          spellName = "DariusExecute"},
  72.     { charName = "MonkeyKing",      spellName = "MonkeyKingSpinToWin"},
  73. }
  74. --[[       ----------------------------------------------------------------------------------------------       ]]--
  75. --[[                                                AutoCarry                                                   ]]--
  76. --[[       ----------------------------------------------------------------------------------------------       ]]--
  77. function InitMenu()
  78.     Menu:addSubMenu("-----> Ultimate options", "ultsub")
  79.     Menu.ultsub:addParam("useUlt", "Use ultimate in combo", SCRIPT_PARAM_ONOFF, true)
  80.     Menu.ultsub:addParam("AssistedUlt", "Use assisted ultimate", SCRIPT_PARAM_ONOFF, true)
  81.     Menu.ultsub:addParam("rEnemiesSBTW", "Total weight (in SBTW combo)",SCRIPT_PARAM_SLICE, 2, 1, 5, 0)
  82.     Menu.ultsub:addParam("rEnemiesAUTO", "Total weight (automatic)",SCRIPT_PARAM_SLICE, 2, 1, 5, 0)
  83.     Menu.ultsub:addParam("AutoTurretUlt", "Auto ultimate under turret", SCRIPT_PARAM_ONOFF, true)
  84.    
  85.     Menu:addSubMenu("-----> Mixed mode options", "mmsub")
  86.     Menu.mmsub:addParam("qMix", "Harrass with Q",SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
  87.     Menu.mmsub:addParam("eMix", "Harrass with E", SCRIPT_PARAM_ONOFF, true)
  88.    
  89.     Menu:addSubMenu("-----> Farm options", "farmsub")
  90.     Menu.farmsub:addParam("qFarm", "Spam Q on minions", SCRIPT_PARAM_ONOFF, false)
  91.     Menu.farmsub:addParam("eFarm", "Kill poisoned minions with E", SCRIPT_PARAM_ONOFF, false)
  92.     Menu.farmsub:addParam("jFarm", "Farm jungle with Q/E", SCRIPT_PARAM_ONOFF, true)
  93.    
  94.     Menu:addSubMenu("-----> AutoHarass options", "ahsub")
  95.     Menu.ahsub:addParam("qAuto", "Auto Harras with Q", SCRIPT_PARAM_ONOFF, false)
  96.     Menu.ahsub:addParam("eAuto", "Auto Harras with E", SCRIPT_PARAM_ONOFF, false)
  97.    
  98.     Menu:addSubMenu("-----> Skills options", "sksub")
  99.     Menu.sksub:addParam("eKS", "Kill steal with E", SCRIPT_PARAM_ONOFF, true)
  100.     Menu.sksub:addParam("FastE", "Cast E before Q hit", SCRIPT_PARAM_ONOFF, false)
  101.     Menu.sksub:addParam("SafeW", "Use W only if Q fail", SCRIPT_PARAM_ONOFF, false)
  102.  
  103.     Menu:addSubMenu("-----> Visual options", "vissub")
  104.     Menu.vissub:addParam("dQRange", "Draw Q Range", SCRIPT_PARAM_ONOFF, false)
  105.     Menu.vissub:addParam("dQRangeColor","--Q Range Color", SCRIPT_PARAM_COLOR, { 255, 255, 50, 50 })
  106.    
  107.     Menu.vissub:addParam("dWRange", "Draw W Range", SCRIPT_PARAM_ONOFF, false)
  108.     Menu.vissub:addParam("dWRangeColor","--W Range Color", SCRIPT_PARAM_COLOR, { 255, 255, 50, 50 })
  109.    
  110.     Menu.vissub:addParam("dERange", "Draw E Range", SCRIPT_PARAM_ONOFF, false)
  111.     Menu.vissub:addParam("dERangeColor","--E Range Color", SCRIPT_PARAM_COLOR, { 255, 255, 50, 50 })
  112.    
  113.     Menu.vissub:addParam("dRRange", "Draw R Range", SCRIPT_PARAM_ONOFF, false)
  114.     Menu.vissub:addParam("dRRangeColor","--R Range Color", SCRIPT_PARAM_COLOR, { 255, 255, 50, 50 })
  115.    
  116.     Menu:addSubMenu("-----> Interuptions", "intsub")
  117.     Menu.intsub:addParam("NinjaInteruption", "Interupt skills with R", SCRIPT_PARAM_ONOFF, false)
  118.     Menu.intsub:addParam("InterupInfo0", "----------------------------", SCRIPT_PARAM_INFO, "")
  119.     if #ToInterrupt > 0 then
  120.         for _, Inter in pairs(ToInterrupt) do
  121.             Menu.intsub:addParam(Inter.spellName, "Stop "..Inter.charName.." "..Inter.spellName, SCRIPT_PARAM_ONOFF, true)
  122.         end
  123.     else
  124.         Menu.intsub:addParam("InterupInfo1", "No supported skills to interupt", SCRIPT_PARAM_INFO, "")
  125.     end
  126.    
  127.     Menu:addParam("aaCombo", "Use Auto Attack during combo", SCRIPT_PARAM_ONOFF, false)
  128.     Menu:addParam("incQRange", "Increased Q Range", SCRIPT_PARAM_ONOFF, true)
  129.     Menu:addParam("buffStack", "Refresh Buff Automatically", SCRIPT_PARAM_ONOFF, false)
  130.     Menu:addParam("AutoLevelUp", "Autolevel skill (R>E>Q>W)", SCRIPT_PARAM_ONOFF, false)
  131.     Menu:addParam("DrawDPS", "Draw time needed to kill enemy", SCRIPT_PARAM_ONOFF, false)
  132.     Menu:addParam("MinMana", "Mana Manager min %", SCRIPT_PARAM_SLICE, 35, 0, 100, 2)
  133.    
  134.     if VIP_USER then
  135.         if Prodiction then
  136.             Menu:addParam("Status", "----> PROdiction loaded", SCRIPT_PARAM_INFO, "")
  137.         else
  138.             Menu:addParam("Status", "----> VIP loaded", SCRIPT_PARAM_INFO, "")
  139.         end
  140.     end
  141. end
  142.  
  143. function PluginOnLoad()
  144.     if AutoCarry.Skills then IsSACReborn = true else IsSACReborn = false end
  145.    
  146.     if IsSACReborn then
  147.         AutoCarry.Crosshair:SetSkillCrosshairRange(800)
  148.         AutoCarry.Crosshair.isCaster = true
  149.         AutoCarry.MyHero:AttacksEnabled(true)
  150.     else
  151.         AutoCarry.SkillsCrosshair.range = 800
  152.         AutoCarry.CanAttack = true
  153.     end
  154.    
  155.     Recalling = false
  156.    
  157.     if CheckBL() then return false end
  158.    
  159.     -------Skiils info-------
  160.     qRange, QSpeed, QDelay, QWidth = 850, math.huge, 535, 150
  161.     wRange, WSpeed, WDelay, WWidth = 850, math.huge, 375, 250
  162.     eRange = 700
  163.     rRange, RSpeed, RDelay, RWidth = 850, 2.000, 750, 0
  164.     -------/Skiils info-------
  165.  
  166.     if IsSACReborn then
  167.         SkillQ = AutoCarry.Skills:NewSkill(false, _Q, qRange, "Q (Noxious Blast)", AutoCarry.SPELL_CIRCLE, 0, false, false, QSpeed, QDelay, QWidth, false)
  168.         SkillW = AutoCarry.Skills:NewSkill(false, _W, wRange, "W (Miasma)", AutoCarry.SPELL_CIRCLE, 0, false, false, WSpeed, WDelay, WWidth, false)
  169.         SkillR = AutoCarry.Skills:NewSkill(false, _R, rRange, "R (Petrifying Gaze)", AutoCarry.SPELL_CONE, 0, false, false, RSpeed, RDelay, 80, false)
  170.     else
  171.         SkillQ = {spellKey = _Q, range = qRange, speed = QSpeed, delay = QDelay, width = QWidth, configName = "noxiousblast", displayName = "Q (Noxious Blast)", enabled = true, skillShot = false, minions = true, reset = false, reqTarget = false }
  172.         SkillW = {spellKey = _W, range = wRange, speed = WSpeed, delay = WDelay, width = WWidth, configName = "miasma", displayName = "W (Miasma)", enabled = true, skillShot = true, minions = true, reset = false, reqTarget = false }
  173.         SkillR = {spellKey = _R, range = rRange, speed = RSpeed, delay = RDelay, width = RWidth, configName = "petrifyinggaze ", displayName = "R (Petrifying Gaze)", enabled = true, skillShot = true, minions = true, reset = false, reqTarget = false }
  174.     end
  175.  
  176.     Menu = AutoCarry.PluginMenu
  177.    
  178.     if VIP_USER then
  179.         if FileExist(SCRIPT_PATH..'Common/Prodiction.lua') then
  180.             require "Prodiction"
  181.            
  182.             Prodiction = (ProdictManager and ProdictManager.GetInstance()) or nil
  183.             ProdictionQ = (Prodiction and Prodiction:AddProdictionObject(_Q, qRange, QSpeed, QDelay/1000, 80)) or nil
  184.             ProdictionW = (Prodiction and Prodiction:AddProdictionObject(_W, wRange, WSpeed, WDelay/1000, 80)) or nil
  185.             ProdictionR = (Prodiction and Prodiction:AddProdictionObject(_R, rRange, RSpeed, RDelay/1000, 0)) or nil
  186.            
  187.             PrintChat("<font color='#ab15d9'> > JaKCass, The Beautiful Snake v"..CurVer.." by TeKilla - PROdiction</font>")
  188.         else
  189.             PrintChat("<font color='#ab15d9'> > JaKCass, The Beautiful Snake v"..CurVer.." by TeKilla - VIP</font>")
  190.         end
  191.     else
  192.         PrintChat("<font color='#ab15d9'> > JaKCass, The Beautiful Snake v"..CurVer.." by TeKilla - FREE</font>")
  193.     end
  194.    
  195.     LoadInterupt()
  196.     LoadTurret()
  197.     JungleCreeps = minionManager(MINION_JUNGLE, qRange, player, MINION_SORT_HEALTH_DES)
  198.    
  199.     abilitySequence = { 1,3,3,2,3,4,1,3,3,1,4,1,1,2,2,4,2,2 }
  200.    
  201.     InitMenu()
  202. end
  203.  
  204. function PluginOnTick()
  205.     SpellsState()
  206.     if IsSACReborn then Target = AutoCarry.Crosshair:GetTarget() else Target = AutoCarry.GetAttackTarget(true) end
  207.     if not Recalling and Menu.buffStack then buffStack() end
  208.     -----------------
  209.     if AutoCarry.MainMenu.AutoCarry then
  210.         Combo()
  211.         if Menu.aaCombo then
  212.             if IsSACReborn then AutoCarry.MyHero:AttacksEnabled(true) else AutoCarry.CanAttack = true end
  213.         else
  214.             if IsSACReborn then AutoCarry.MyHero:AttacksEnabled(false) AutoCarry.MyHero:Move() else AutoCarry.CanAttack = false end
  215.         end
  216.     else
  217.         if IsSACReborn then AutoCarry.MyHero:AttacksEnabled(true) else AutoCarry.CanAttack = true end
  218.         AutoUlt()
  219.         -----------------
  220.         if (AutoCarry.MainMenu.MixedMode or AutoCarry.MainMenu.LaneClear) and not IsMyManaLow() then
  221.             Farm()
  222.         end
  223.         if (AutoCarry.MainMenu.MixedMode or AutoCarry.MainMenu.LaneClear) and Menu.farmsub.jFarm then
  224.             JungleFarm()
  225.         end
  226.         if ((AutoCarry.MainMenu.MixedMode and Menu.mmsub.eMix) or (Menu.ahsub.eAuto and not Recalling)) and not IsMyManaLow() then
  227.             HarrassE()
  228.         end
  229.         if (AutoCarry.MainMenu.MixedMode and Menu.mmsub.qMix) or (Menu.ahsub.eAuto and not Recalling) then
  230.             HarrassQ()
  231.         end
  232.         -----------------
  233.     end
  234.     -----------------
  235.     if Menu.ultsub.AutoTurretUlt then AutoUltUnderTurret() end
  236.     if Menu.sksub.eKS then eKillSteal() end
  237. end
  238.      
  239.  
  240. function PluginOnAnimation(unit, animation)
  241.     --[[if unit.type == "obj_AI_Hero" and unit == Target then
  242.         if ValidTarget(unit) then
  243.             if GetDistance(unit) <= qRange then
  244.                 if animation:lower():find("spell") or animation:lower():find("attack") or animation:lower():find("idle") then
  245.                     if (AutoCarry.MainMenu.MixedMode and Menu.mmsub.qMix) or (Menu.ahsub.qAuto and not Recalling) then
  246.                         CastSpell(_Q, unit.x, unit.z)
  247.                     end
  248.                 end
  249.             end
  250.         end
  251.     end]]--
  252.    
  253.     if unit.isMe then
  254.         if animation:lower():find("recall") then
  255.             Recalling = true
  256.         else
  257.             Recalling = false
  258.         end
  259.         if animation:lower():find("spell") then
  260.             nextTick = os.clock() + 4.9
  261.         end
  262.     end
  263. end
  264.      
  265. function PluginOnDraw()
  266.     if not myHero.dead then
  267.         if Menu.vissub.dQRange and QReady then
  268.             DrawCircle(myHero.x, myHero.y, myHero.z, qRange, RGB(Menu.vissub.dQRangeColor[2], Menu.vissub.dQRangeColor[3], Menu.vissub.dQRangeColor[4]))
  269.         end
  270.         if Menu.vissub.dWRange and WReady then
  271.             DrawCircle(myHero.x, myHero.y, myHero.z, wRange, RGB(Menu.vissub.dWRangeColor[2], Menu.vissub.dWRangeColor[3], Menu.vissub.dWRangeColor[4]))
  272.         end
  273.         if Menu.vissub.dERange and EReady then
  274.             DrawCircle(myHero.x, myHero.y, myHero.z, eRange, RGB(Menu.vissub.dERangeColor[2], Menu.vissub.dERangeColor[3], Menu.vissub.dERangeColor[4]))
  275.         end
  276.         if Menu.vissub.dRRange and RReady then
  277.             DrawCircle(myHero.x, myHero.y, myHero.z, rRange, RGB(Menu.vissub.dRRangeColor[2], Menu.vissub.dRRangeColor[3], Menu.vissub.dRRangeColor[4]))
  278.         end
  279.     end
  280.    
  281.     if Menu.DrawDPS then
  282.         for i=1, #enemyList do
  283.             if ValidTarget(enemyList[i], 3000) then
  284.                 local qdmgSec = (QReady and getDmg("Q", enemyList[i], myHero)/3) or 0
  285.                 local edmgSec = (EReady and getDmg("E", enemyList[i], myHero)/1.16) or 0
  286.                 local wdmgSec = (WReady and not Menu.sksub.SafeW and getDmg("W", enemyList[i], myHero)/9) or 0
  287.                 local aadmgSec = (Menu.aaCombo and getDmg("AD", enemyList[i], myHero)) or 0
  288.                
  289.                 DPS = qdmgSec + 2*edmgSec + wdmgSec + aadmgSec
  290.                 if DPS ~= 0 then
  291.                     DrawText3D(tostring("Killable in "..string.format("%4.1f", enemyList[i].health/DPS).."s"), enemyList[i].x, enemyList[i].y, enemyList[i].z, 14, RGB(222, 245, 15), true)
  292.                 end
  293.             end
  294.         end
  295.     end
  296.        
  297. end
  298.  
  299. function PluginOnWndMsg(msg, key)
  300.     if msg == KEY_DOWN then
  301.         if key == string.byte("R") then
  302.             AssistedUlt()
  303.         end
  304.     end
  305. end
  306.  
  307. function PluginOnProcessSpell(unit, spell)
  308.     if Menu.intsub.NinjaInteruption and RReady then
  309.         if #ToInterrupt > 0 then
  310.             for _, Inter in pairs(ToInterrupt) do
  311.                 if spell.name == Inter.spellName and unit.team ~= myHero.team then
  312.                     if Menu.intsub[Inter.spellName] then
  313.                         CastRunit(unit)
  314.                     end
  315.                 end
  316.             end
  317.         end
  318.     end
  319.    
  320.     if unit.isMe and spell.name == "CassiopeiaNoxiousBlast" then
  321.         lastQcastTime = GetTickCount()
  322.         QisCasting = true
  323.     end
  324. end
  325.  
  326.  
  327.  
  328. --[[       ----------------------------------------------------------------------------------------------       ]]--
  329. --[[                                                OptionFunction                                              ]]--
  330. --[[       ----------------------------------------------------------------------------------------------       ]]--
  331. function CastSpellQ(target)
  332.     if not Prodiction then
  333.         if IsSACReborn then
  334.                 SkillQ:Cast(target)
  335.         else
  336.                 AutoCarry.CastSkillshot(SkillQ, target)
  337.         end
  338.     else
  339.         local QPos = ProdictionQ:GetPrediction(target)
  340.         if QPos ~= nil then
  341.             CastSpell(_Q, QPos.x, QPos.z)
  342.         end
  343.     end
  344. end
  345.  
  346.  
  347. function CastSpellW(target)
  348.     if not Prodiction then
  349.         if IsSACReborn then
  350.             SkillW:Cast(target)
  351.         else
  352.             AutoCarry.CastSkillshot(SkillW, target)
  353.         end
  354.     else
  355.         local WPos = ProdictionW:GetPrediction(target)
  356.         if WPos ~= nil then
  357.             CastSpell(_W, WPos.x, WPos.z)
  358.         end
  359.     end
  360. end
  361.  
  362.  
  363. function CastSpellE(target)
  364.     CastSpell(_E, target)
  365. end
  366.  
  367.  
  368. function CastSpellR(target)
  369.     CastSpell(_R, target)
  370. end
  371.  
  372. function CastSpellR(targetx, targetz)
  373.     CastSpell(_R, targetx, targetz)
  374. end
  375.  
  376.  
  377. function CastR(n)
  378.     if RReady then
  379.         local ultEnemies = CountEnemyHeroInRange(rRange + 300)
  380.         if ultEnemies >= n then
  381.             local vec = GetCassMECS(75, rRange, n, false, nil)
  382.             if vec ~= nil and GetDistance(vec) < rRange then
  383.                 CastSpellR(vec.x, vec.z)
  384.             end
  385.         end
  386.     end
  387. end
  388.  
  389. function CastRunit(unit)
  390.     if RReady then
  391.         local vec = GetCassMECS(75, rRange, 1, false, unit)
  392.         if vec ~= nil and GetDistance(vec) < rRange then
  393.             CastSpellR(vec.x, vec.z)
  394.         end
  395.     end
  396. end
  397.  
  398. function AutoUlt()
  399.     if castRTick == nil or GetTickCount()-castRTick >= 101 then
  400.         castRTick = GetTickCount()
  401.         if CountEnemyHeroInRange(rRange + 300) >= Menu.ultsub.rEnemiesAUTO then
  402.             CastR(Menu.ultsub.rEnemiesAUTO)
  403.         end
  404.     end
  405. end
  406.  
  407. function AutoUltUnderTurret()
  408.     if underTurretTick == nil or GetTickCount()-underTurretTick >= 101 then
  409.         underTurretTick = GetTickCount()
  410.         if Target ~= nil then
  411.             if IsUnderTurret(Target, myHero.team) then
  412.                 CastRunit(Target)
  413.             end
  414.         end
  415.     end
  416. end
  417.  
  418. function AssistedUlt()
  419.     if Menu.ultsub.AssistedUlt then
  420.         CastR(1)
  421.     end
  422. end
  423.  
  424. function Farm()
  425.     for _, minion in pairs(AutoCarry.EnemyMinions().objects) do
  426.         if Menu.farmsub.qFarm then
  427.             if QReady then
  428.                 if GetDistance(minion) <= qRange then
  429.                     --if minion.health <= (getDmg("Q", minion, myHero)) then
  430.                         CastSpell(_Q, minion.x, minion.z)
  431.                     --end
  432.                 end
  433.             end
  434.         end
  435.         if Menu.farmsub.eFarm then
  436.             if EReady then
  437.                 if isPoisoned(minion) then
  438.                     if GetDistance(minion) <= eRange then
  439.                         if minion.health <= getDmg("E", minion, myHero) and minion.health > getDmg("AD", minion, myHero) then
  440.                             CastSpellE(minion)
  441.                         end
  442.                     end
  443.                 end
  444.             end
  445.         end
  446.     end
  447. end
  448.  
  449.  
  450. function HarrassQ()
  451.     if Target then
  452.         if GetDistance(Target) <= qRange then
  453.                 CastSpellQ(Target)
  454.             end
  455.         end
  456. end
  457.  
  458. function HarrassE()
  459.     if Target then
  460.         if GetDistance(Target) <= eRange then
  461.             if isPoisoned(Target) then
  462.                 CastSpellE(Target)
  463.             end
  464.         end
  465.     end
  466. end
  467.  
  468. function eKillSteal()
  469.     if Target and not Target.dead then
  470.         if EReady and GetDistance(Target) <= eRange then
  471.             if Target.health <= getDmg("E",Target,myHero) then
  472.                 CastSpellE(Target)
  473.             end
  474.         end
  475.     end
  476. end
  477.  
  478. function Combo()
  479.     if Target and not Target.dead then
  480.         if QReady and GetDistance(Target) <= qRange then
  481.             if not isPoisoned(Target) then
  482.                 CastSpellQ(Target)
  483.             end
  484.         end
  485.         if EReady and GetDistance(Target) <= eRange then
  486.             if isPoisoned(Target) or (Menu.sksub.FastE and QisCasting) or Target.health <= getDmg("E",Target,myHero) then
  487.                 CastSpellE(Target)
  488.             end
  489.         end
  490.         if WReady and GetDistance(Target) <= wRange then
  491.             if (not QReady and not Menu.sksub.SafeW) or (not QisCasting and not isPoisoned(Target) and Menu.sksub.SafeW) then
  492.                 if not IsMyManaLow() then
  493.                     CastSpellW(Target)
  494.                 end
  495.             end
  496.         end
  497.         if not QReady and not EReady then
  498.             if Menu.ultsub.useUlt then
  499.                 CastR(Menu.ultsub.rEnemiesSBTW)
  500.             end
  501.         end
  502.     end
  503. end
  504.  
  505. nextTick = 0
  506. function buffStack()
  507.     if nextTick - os.clock() > 0 then
  508.         return
  509.     end
  510.     local eMinions = AutoCarry.EnemyMinions()
  511.     eMinions:update()
  512.     for _, minion in pairs(eMinions.objects) do
  513.         if ValidTarget(minion) then
  514.             if QReady and GetDistance(minion) <= qRange then
  515.                 CastSpell(_Q, minion.x, minion.z)
  516.                 return
  517.             end
  518.         end
  519.     end
  520.     if not IsMyManaLow() then
  521.         if GetDistanceFromMouse(myHero) <= qRange then
  522.             CastSpell(_Q, mousePos.x, mousePos.z)
  523.         else
  524.             CastSpell(_Q, myHero.x, myHero.z)
  525.         end
  526.     end
  527. end
  528.  
  529. function JungleFarm()
  530.     JungleCreeps:update()
  531.     for i, minion in pairs(JungleCreeps.objects) do
  532.         if ValidTarget(minion) then
  533.             if QReady and not isPoisoned(minion) then
  534.                 CastSpell(_Q, minion.x, minion.z)
  535.             end
  536.             if EReady and isPoisoned(minion) then
  537.                 CastSpell(_E, minion)
  538.             end
  539.         end
  540.     end
  541. end
  542.  
  543. --[[       ----------------------------------------------------------------------------------------------       ]]--
  544. --[[                                                 Utility                                                    ]]--
  545. --[[       ----------------------------------------------------------------------------------------------       ]]--
  546. function IsUnderTurret(target, flag)
  547.     local f = flag or TEAM_ENEMY    --Credits iuser99
  548.     for i, turret in pairs(TurretList) do
  549.         if turret and not turret.dead and turret.team == f and not string.find(turret.name, "TurretShrine") then
  550.             if GetDistance(target, turret) <= 720 then
  551.                 return true
  552.             end
  553.         end
  554.     end
  555.     return false
  556. end
  557.  
  558. function CountEnemyHeroInRange(range)
  559.     local enemyInRange = 0
  560.     for i = 1, heroManager.iCount, 1 do
  561.         local hero = heroManager:getHero(i)
  562.         if ValidTarget(hero, range) then
  563.             enemyInRange = enemyInRange + 1
  564.         end
  565.     end
  566.     return enemyInRange
  567. end
  568.  
  569. function areClockwise(testv1,testv2)
  570.     return -testv1.x * testv2.y + testv1.y * testv2.x>0 --true if v1 is clockwise to v2
  571. end
  572.  
  573. function sign(x)
  574.     if x> 0 then return 1
  575.     elseif x<0 then return -1
  576.     end
  577. end
  578.  
  579. local mecCheckTick = 0
  580. function GetCassMECS(theta, radius, minimum, bForce, unit)
  581.     if GetTickCount() - mecCheckTick < 100 then return nil end
  582.     mecCheckTick = GetTickCount()  
  583.     --Build table of enemies in range
  584.     nFaced = 0
  585.     n = 1
  586.     v1,v2,v3 = 0,0,0
  587.     largeN,largeV1,largeV2 = 0,0,0
  588.     theta1,theta2,smallBisect = 0,0,0
  589.     coneTargetsTable = {}
  590.  
  591.     for i = 1, heroManager.iCount, 1 do
  592.         hero = heroManager:getHero(i)
  593.         if unit == nil then
  594.             if not Prodiction then
  595.                 enemyPos = GetPredictionPos(hero,1000)
  596.             else
  597.                 enemyPos = ProdictionR:GetPrediction(hero)
  598.             end
  599.             if ValidTarget(hero, 1000) and enemyPos and GetDistance(enemyPos) < radius then-- and inRadius(hero,radius*radius) then
  600.                 coneTargetsTable[n] = hero
  601.                 n=n+1
  602.                 if --(GetDistance(hero.visionPos) < GetDistance(hero))
  603.                     --or (killable[hero.networkID] >= 1 and killable[hero.networkID] <= 4)
  604.                     --[[or]] bForce == false then
  605.                     nFaced = nFaced + 1
  606.                 else
  607.                     nFaced = nFaced + 0.67
  608.                 end            
  609.             end
  610.         elseif unit.charName == hero.charName then
  611.             if not Prodiction then
  612.                 enemyPos = GetPredictionPos(hero,1000)
  613.             else
  614.                 enemyPos = ProdictionR:GetPrediction(hero)
  615.             end
  616.             if ValidTarget(hero, 1000) and enemyPos and GetDistance(enemyPos) < radius then-- and inRadius(hero,radius*radius) then
  617.                 coneTargetsTable[n] = hero
  618.                 n=n+1
  619.                 if --(GetDistance(hero.visionPos) < GetDistance(hero))
  620.                     --or (killable[hero.networkID] >= 1 and killable[hero.networkID] <= 4)
  621.                     --[[or]] bForce == false then
  622.                     nFaced = nFaced + 1
  623.                 else
  624.                     nFaced = nFaced + 0.67
  625.                 end            
  626.             end
  627.         end
  628.            
  629.     end
  630.  
  631.     if #coneTargetsTable>=2 then -- true if calculation is needed
  632.     --Determine if angle between vectors are < given theta
  633.             for i=1, #coneTargetsTable,1 do
  634.                     for j=1,#coneTargetsTable, 1 do
  635.                             if i~=j then
  636.                                     --Position vector from player to 2 different targets.
  637.                                     v1 = Vector(coneTargetsTable[i].x-player.x , coneTargetsTable[i].z-player.z)
  638.                                     v2 = Vector(coneTargetsTable[j].x-player.x , coneTargetsTable[j].z-player.z)
  639.                                     thetav1 = sign(v1.y)*90-math.deg(math.atan(v1.x/v1.y))
  640.                                     thetav2 = sign(v2.y)*90-math.deg(math.atan(v2.x/v2.y))
  641.                                     thetaBetween = thetav2-thetav1                
  642.  
  643.                                     if (thetaBetween) <= theta and thetaBetween>0 then --true if targets are close enough together.
  644.                                             if #coneTargetsTable == 2 then --only 2 targets, the result is found.
  645.                                                     largeV1 = v1
  646.                                                     largeV2 = v2
  647.                                             else
  648.                                                     --Determine # of vectors between v1 and v2                                                    
  649.                                                     tempN = 0
  650.                                                     for k=1, #coneTargetsTable,1 do
  651.                                                             if k~=i and k~=j then
  652.                                                                     --Build position vector of third target
  653.                                                                     v3 = Vector(coneTargetsTable[k].x-player.x , coneTargetsTable[k].z-player.z)
  654.                                                                     --For v3 to be between v1 and v2
  655.                                                                     --it must be clockwise to v1
  656.                                                                     --and counter-clockwise to v2
  657.                                                                     if areClockwise(v3,v1) and not areClockwise(v3,v2) then
  658.                                                                             tempN = tempN+1
  659.                                                                     end
  660.                                                             end
  661.                                                     end
  662.                                                     if tempN > largeN then
  663.                                                     --store the largest number of contained enemies
  664.                                                     --and the bounding position vectors
  665.                                                             largeN = tempN
  666.                                                             largeV1 = v1
  667.                                                             largeV2 = v2
  668.                                                     end
  669.                                             end
  670.                                     end
  671.                             end
  672.                     end
  673.             end
  674.     elseif #coneTargetsTable==1 and minimum == 1 then
  675.             return coneTargetsTable[1]
  676.     end
  677.    
  678.     if largeV1 == 0 or largeV2 == 0 then
  679.     --No targets or one target was found.
  680.             return nil
  681.     else
  682.             --small-Bisect the two vectors that encompass the most vectors.
  683.             if largeV1.y == 0 then
  684.                     theta1 = 0
  685.             else
  686.                     theta1 = sign(largeV1.y)*90-math.deg(math.atan(largeV1.x/largeV1.y))
  687.             end
  688.             if largeV2.y == 0 then
  689.                     theta2 = 0
  690.             else
  691.                     theta2 = sign(largeV2.y)*90-math.deg(math.atan(largeV2.x/largeV2.y))
  692.             end
  693.  
  694.             smallBisect = math.rad((theta1 + theta2) / 2)
  695.             vResult = {}
  696.             vResult.x = radius*math.cos(smallBisect)+player.x
  697.             vResult.y = player.y
  698.             vResult.z = radius*math.sin(smallBisect)+player.z
  699.            
  700.             return vResult
  701.     end
  702. end
  703.  
  704. function LoadTurret()
  705.     for i=1, objManager.maxObjects do
  706.         local obj = objManager:getObject(i)
  707.         if obj and obj.valid and obj.type == "obj_AI_Turret" then
  708.             table.insert(TurretList, obj)
  709.         end
  710.     end
  711. end
  712.  
  713. function CheckBL() if myHero.name == "Team Amal" then PrintChat("Go uninstall noob")  return true end end
  714.    
  715. function LoadInterupt()
  716.     enemyHeroes = GetEnemyHeroes()
  717.     for _, enemy in pairs(enemyHeroes) do   --thank's to pqmailer
  718.         table.insert(enemyList, enemy)
  719.         for _, champ in pairs(InteruptionSpells) do
  720.             if enemy.charName == champ.charName then
  721.                 table.insert(ToInterrupt, {charName = champ.charName, spellName = champ.spellName})
  722.             end
  723.         end
  724.     end
  725. end
  726.  
  727. --[Credits to Vadash]--
  728. function isPoisoned(target)
  729.     local delay = math.max(GetDistance(target), 700)/1800 + 0.100
  730.     for i = 1, target.buffCount do
  731.         local tBuff = target:getBuff(i)
  732.         if BuffIsValid(tBuff) and (tBuff.name == "cassiopeianoxiousblastpoison" or tBuff.name == "cassiopeiamiasmapoison"
  733.             or tBuff.name == "toxicshotparticle" or tBuff.name == "bantamtraptarget" or tBuff.name == "poisontrailtarget"
  734.             or tBuff.name == "deadlyvenom") and tBuff.endT - delay - GetGameTimer() > 0 then
  735.             return true
  736.         end
  737.     end
  738.     return false
  739. end
  740.  
  741. function SpellsState()
  742.     QReady = (myHero:CanUseSpell(_Q) == READY)
  743.     if not QReady and GetTickCount() > lastQcastTime + 870 then QisCasting = false end
  744.     WReady = (myHero:CanUseSpell(_W) == READY)
  745.     EReady = (myHero:CanUseSpell(_E) == READY)
  746.     RReady = (myHero:CanUseSpell(_R) == READY)
  747.    
  748.     qRange = 850 + (Menu.incQRange and 75 or 0)
  749.    
  750.     if Menu.AutoLevelUp then autoLevelSetSequence(abilitySequence) end
  751. end
  752.  
  753. --[Credits to Kain]--
  754. function IsMyManaLow()
  755.     if myHero.mana < (myHero.maxMana * ( AutoCarry.PluginMenu.MinMana / 100)) then
  756.         return true
  757.     else
  758.         return false
  759.     end
  760. end
Advertisement
Add Comment
Please, Sign In to add comment