naturus

nami

Dec 23rd, 2014
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.82 KB | None | 0 0
  1. if myHero.charName ~= "Nami" then return end
  2.  
  3. local _ScriptName = "NamiPred"
  4. local _ScriptVersion = 1.1
  5. local _ScriptAuthor = "Isexcats"
  6.  
  7. local AutoUpdate = false
  8. local SrcLibURL = "https://raw.github.com/TheRealSource/public/master/common/SourceLib.lua"
  9. local SrcLibPath = LIB_PATH .. "SourceLib.lua"
  10. local SrcLibDownload = false
  11.  
  12. local UPDATE_HOST = "raw.github.com"
  13. local UPDATE_PATH = "isexcats/Bol-Scripts/master/NamiPred.lua"
  14.  
  15. local orbwalker = "SOW"
  16.  
  17. function SendMessage(msg)
  18.  
  19.     PrintChat("<font color='#7D1935'><b>[" .. _ScriptName .. " " .. myHero.charName .. "]</b> </font><font color='#FFFFFF'>" .. tostring(msg) .. "</font>")
  20.  
  21. end
  22.  
  23. if FileExist(SrcLibPath) then
  24.  
  25.     require "SourceLib"
  26.     SrcLibDownload = false
  27.  
  28. else
  29.  
  30.     SrcLibDownload = true
  31.     DownloadFile(SrcLibURL, SrcLibPath, function() SendMessage("Downloaded SourceLib, please reload. (Double F9)") end)
  32.  
  33. end
  34.  
  35. if SrcLibDownload == true then
  36.  
  37.     SendMessage("SourceLib was not found. Downloading...")
  38.     return
  39.  
  40. end
  41.  
  42. if AutoUpdate then
  43.  
  44.     SourceUpdater(ScriptName .. " - " .. myHero.charName, tostring(ScriptVersion), UPDATE_HOST, UPDATE_PATH, SCRIPT_PATH .. GetCurrentEnv().FILE_NAME):CheckUpdate()
  45.  
  46. end
  47.  
  48. local libs = Require(_ScriptName .. " Libs")
  49. libs:Add("VPrediction", "https://raw.githubusercontent.com/Hellsing/BoL/master/common/VPrediction.lua")
  50. libs:Add("SOW", "https://raw.githubusercontent.com/Hellsing/BoL/master/common/SOW.lua")
  51. if VIP_USER then libs:Add("Prodiction", "https://bitbucket.org/Klokje/public-klokjes-bol-scripts/raw/ec830facccefb3b52212dba5696c08697c3c2854/Test/Prodiction/Prodiction.lua") end
  52.  
  53. libs:Check()
  54.  
  55. if libs.downloadNeeded == true then return end
  56.  
  57. local Recalling
  58.  
  59. function OnLoad()
  60.  
  61.     __initVars()
  62.     __load()
  63.     __initLibs()
  64.     __initMenu()
  65.     __initPriorities()
  66.     __initOrbwalkers()
  67.  
  68. end
  69.  
  70. function OnTick()
  71.  
  72.     if not _G.NamiPred_Loaded then return end
  73.  
  74.     __modes()
  75.     __update()
  76.  
  77. end
  78.  
  79. function OnUnload()
  80.  
  81.     if not _G.NamiPred_Loaded then return end
  82.  
  83. end
  84.  
  85. function OnDraw()
  86.  
  87.     if not _G.NamiPred_Loaded then return end
  88.  
  89.     __draw()
  90.  
  91. end
  92.  
  93. function OnProcessSpell(unit, spell)
  94.  
  95.     if not _G.NamiPred_Loaded then return end
  96.  
  97. end
  98.  
  99. function OnCreateObj(obj)
  100.  
  101.     if not _G.NamiPred_Loaded then return end
  102.  
  103. end
  104.  
  105. function OnDeleteObj(obj)
  106.  
  107.     if not _G.NamiPred_Loaded then return end
  108.  
  109. end
  110.  
  111. -- INITIALIZE GLOBAL VARIABLES --
  112. function __initVars()
  113.  
  114.     -- SCRIPT GLOBALS
  115.     _G.NamiPred_Loaded = false
  116.    
  117.  
  118.     SKILLSHOT_LINEAR, SKILLSHOT_CONE, SKILLSHOT_CIRCULAR, ENEMY_TARGETED, SELF_TARGETED, MULTI_TARGETED, UNIDENTIFIED = 0, 1, 2, 3, 4, 5, -1
  119.  
  120. local Ranges = { AA = 550 }
  121.     -- TABLE OF HERO SKILLS
  122.     SpellTable = {
  123.    
  124.         [_Q] = {
  125.  
  126.             id = "q",
  127.             name = myHero:GetSpellData(_Q).name,
  128.             ready = false,
  129.             range = 945,
  130.             width = 250,
  131.             speed = 1750,
  132.             delay = 0.5,
  133.             sType = SKILLSHOT_CIRCULAR
  134.         },
  135.  
  136.  
  137.        [_W] = {
  138.  
  139.             id = "w",
  140.             name = myHero:GetSpellData(_E).name,
  141.             ready = false,
  142.             range = 725,
  143.             width = nil,
  144.             speed = nil,
  145.             delay = nil,
  146.             sType = MULTI_TARGETED
  147.  
  148.         },
  149.  
  150.  
  151.         [_E] = {
  152.  
  153.             id = "e",
  154.             name = myHero:GetSpellData(_E).name,
  155.             ready = false,
  156.             range = 2750,
  157.             width = 800,
  158.             speed = nil,
  159.             delay = .5,
  160.             sType = MULTI_TARGETED,
  161.  
  162.         },
  163.  
  164.        [_R] = {
  165.  
  166.             id = "r",
  167.             name = myHero:GetSpellData(_R).name,
  168.             ready = false,
  169.             range = 2750,
  170.             width = 700,
  171.             speed = 1200,
  172.             delay = .5,
  173.             sType = SKILLSHOT_LINEAR
  174.         }
  175.  
  176.  
  177.     }
  178.  
  179.  
  180.  
  181.     -- TABLE FOR ARRANGING TARGETING PRIORITIES
  182.     PriorityTable = {
  183.         AP = {
  184.             "Annie", "Ahri", "Akali", "Anivia", "Annie", "Azir", "Brand", "Cassiopeia", "Diana", "Evelynn", "FiddleSticks", "Fizz", "Gragas", "Heimerdinger", "Karthus",
  185.             "Kassadin", "Katarina", "Kayle", "Kennen", "Leblanc", "Lissandra", "Lux", "Malzahar", "Mordekaiser", "Morgana", "Nidalee", "Orianna",
  186.             "Ryze", "Sion", "Swain", "Syndra", "Teemo", "TwistedFate", "Veigar", "Viktor", "Vladimir", "Xerath", "Ziggs", "Zyra", "Velkoz"
  187.         },
  188.  
  189.         Support = {
  190.             "Alistar", "Blitzcrank", "Braum", "Janna", "Karma", "Leona", "Lulu", "Nami", "Nunu", "Sona", "Soraka", "Taric", "Thresh", "Zilean", "Braum"
  191.         },
  192.  
  193.         Tank = {
  194.             "Amumu", "Chogath", "DrMundo", "Galio", "Hecarim", "Malphite", "Maokai", "Nasus", "Rammus", "Sejuani", "Nautilus", "Shen", "Singed", "Skarner", "Volibear",
  195.             "Warwick", "Yorick", "Zac"
  196.         },
  197.  
  198.         AD_Carry = {
  199.             "Ashe", "Caitlyn", "Corki", "Draven", "Ezreal", "Graves", "Jayce", "Jinx", "KogMaw", "Lucian", "MasterYi", "MissFortune", "Pantheon", "Quinn", "Shaco", "Sivir",
  200.             "Talon","Tryndamere", "Tristana", "Twitch", "Urgot", "Varus", "Vayne", "Yasuo", "Zed"
  201.         },
  202.  
  203.         Bruiser = {
  204.             "Aatrox", "Darius", "Elise", "Fiora", "Gangplank", "Garen", "Irelia", "JarvanIV", "Jax", "Khazix", "LeeSin", "Nocturne", "Olaf", "Poppy",
  205.             "Renekton", "Rengar", "Riven", "Rumble", "Shyvana", "Trundle", "Udyr", "Vi", "MonkeyKing", "XinZhao"
  206.         }
  207.     }
  208.  
  209. end
  210.  
  211. -- LOAD SEQUENCE -- SCRIPT LOADUP - SEND START MESSAGES AND ARRANGE GLOBALS
  212. function __load()
  213.  
  214.     SendMessage("NamiPred by Isexcats")
  215.     SendMessage("Script version v" .. _ScriptVersion .. " loaded for " .. myHero.charName)
  216.  
  217.    
  218.  
  219. end
  220.  
  221. -- LIBRARY INITIALIZATION --
  222. function __initLibs()
  223.  
  224.     VP = VPrediction()
  225.     SOWi = SOW(VP)
  226.     PROD = Prodiction
  227.  
  228.     enemyMinions = minionManager(MINION_ENEMY, GetMaxRange(), myHero, MINION_SORT_HEALTH_ASC) -- MINION MANAGER FOR LANE CLEAR
  229.  
  230. end
  231.  
  232. function __initMenu()
  233.  
  234.     Menu = scriptConfig("[" .. _ScriptName .. "] " .. myHero.charName, "NamiPred"..myHero.charName)
  235.  
  236.     Menu:addSubMenu("[" .. myHero.charName.. "] Keybindings", "keys")
  237.         Menu.keys:addParam("carry", "Carry Mode Key:", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  238.         Menu.keys:addParam("harass", "Harass Mode Key:", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('C'))
  239.         Menu.keys:addParam("farm", "Lane Clear Mode Key:", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('V'))
  240.  
  241.  
  242.     Menu:addSubMenu("[" .. myHero.charName.. "] Combo", "combo")
  243.         Menu.combo:addParam("useQ", "Enable Q (".. SpellTable[_Q].name ..")", SCRIPT_PARAM_ONOFF, true)
  244.         Menu.combo:addParam("useE", "Enable E (".. SpellTable[_E].name ..")", SCRIPT_PARAM_ONOFF, true)
  245.         Menu.combo:addParam("useW", "Enable W (".. SpellTable[_W].name ..")", SCRIPT_PARAM_ONOFF, true)
  246.         Menu.combo:addParam("useW", "Enable W (".. SpellTable[_W].name ..")", SCRIPT_PARAM_ONOFF, true)
  247.         Menu.combo:addParam("mana", "Min Mana For Combo", SCRIPT_PARAM_SLICE, 0, 0, 100, 0)
  248.         Menu.combo:addParam("minR", "Minimum targets to use R", SCRIPT_PARAM_SLICE, 1, 1, 4, 0)
  249.  
  250.     Menu:addSubMenu("[" .. myHero.charName.. "] Harass", "harass")
  251.         Menu.harass:addParam("useQ", "Enable Q (".. SpellTable[_Q].name ..")", SCRIPT_PARAM_ONOFF, true)
  252.         Menu.harass:addParam("useW", "Enable W (".. SpellTable[_W].name ..")", SCRIPT_PARAM_ONOFF, true)
  253.      
  254.         Menu.harass:addParam("mana", "Min Mana For Harass", SCRIPT_PARAM_SLICE, 0, 0, 100, 0)
  255.  
  256.     Menu:addSubMenu("[" .. myHero.charName.. "] Farm", "farm")
  257.         Menu.farm:addParam("useQ", "Enable Q (".. SpellTable[_Q].name ..")", SCRIPT_PARAM_ONOFF, true)
  258.         Menu.farm:addParam("mana", "Min Mana For Lane Clear", SCRIPT_PARAM_SLICE, 0, 0, 100, 0)
  259.  
  260.    
  261.  
  262.       Menu:addSubMenu("[" .. myHero.charName.. "] Heal", "heal")        
  263.         Menu.heal:addParam("UseHeal", "Auto Heal Allies", SCRIPT_PARAM_ONOFF, true)
  264.         Menu.heal:addParam("HealManager", "Heal allies under", SCRIPT_PARAM_SLICE, 65, 0, 100, 0)
  265.         Menu.farm:addParam("mana", "Min Mana For Heal", SCRIPT_PARAM_SLICE, 0, 0, 100, 0)
  266.        
  267.            
  268.  
  269.     Menu:addSubMenu("[" .. myHero.charName.. "] Orbwalk", "orbwalk")
  270.         SOWi:LoadToMenu(Menu.orbwalk)
  271.  
  272.     Menu:addSubMenu("[" .. myHero.charName .. "] Prediction", "prediction")
  273.         if VIP_USER then
  274.             Menu.prediction:addParam("type", "Prediction:", SCRIPT_PARAM_LIST, 1, {"Prodiction", "VPrediction"})
  275.         else
  276.             Menu.prediction:addParam("type", "Prediction:", SCRIPT_PARAM_INFO, "VPrediction")
  277.         end
  278.         Menu.prediction:addParam("", "", SCRIPT_PARAM_INFO, "")
  279.  
  280.         for index, skill in pairs(SpellTable) do
  281.             if (skill.sType == SKILLSHOT_LINEAR) or (skill.sType == SKILLSHOT_CONE) or (skill.sType == SKILLSHOT_CIRCULAR) then
  282.                 Menu.prediction:addParam(skill.id, string.upper(skill.id) .. " hit chance", SCRIPT_PARAM_SLICE, 2, 1, 3, 0)
  283.             end
  284.         end
  285.  
  286.  
  287.     Menu:addSubMenu("[" .. myHero.charName.. "] Draw", "draw")
  288.         Menu.draw:addParam("enabled", "Enable All Drawings", SCRIPT_PARAM_ONOFF, true)
  289.         Menu.draw:addParam("drawAA", "Draw AutoAttack Range", SCRIPT_PARAM_ONOFF, true)
  290.         Menu.draw:addParam("drawQ", "Draw ".. SpellTable[_Q].name .." Range", SCRIPT_PARAM_ONOFF, true)
  291.         Menu.draw:addParam("drawW", "Draw ".. SpellTable[_W].name .." Range", SCRIPT_PARAM_ONOFF, true)
  292.         Menu.draw:addParam("drawE", "Draw ".. SpellTable[_E].name .." Range", SCRIPT_PARAM_ONOFF, true)
  293.         Menu.draw:addParam("drawTarget", "Draw Circle on Target", SCRIPT_PARAM_ONOFF, true)
  294.         Menu.draw:addParam("lfc", "Use Lag Free Circles", SCRIPT_PARAM_ONOFF, true)
  295.  
  296.     Menu:addSubMenu("[" .. myHero.charName.. "] Misc", "misc")
  297.         if VIP_USER then
  298.             Menu.misc:addParam("packet", "Use Packets to Cast Spells", SCRIPT_PARAM_ONOFF, false)
  299.         end
  300.        
  301.    
  302.     TargetSelector = TargetSelector(TARGET_LESS_CAST_PRIORITY, 1250, DAMAGE_MAGIC, true)
  303.     TargetSelector.name = "Swag"
  304.     Menu:addTS(TargetSelector)
  305.  
  306. end
  307.  
  308.  
  309.  --DETECT AND INITIALIZE ORBWALKERS -- USES SIMPLE ORBWALKER IF NONE FOUND
  310. function __initOrbwalkers()
  311.  
  312.     if _G.Reborn_Loaded then -- SIDA'S AUTO CARRY REBORN LOADED - DISABLE SOW
  313.  
  314.         SendMessage("SAC:R Detected. Disabling SOW.")
  315.         orbwalker = "SAC"
  316.         Menu.orbwalk.Enabled = false
  317.  
  318.     elseif _G.MMA_Loaded then -- MARKSMAN'S MIGHTY ASSISTANT LOADED - DISABLE SOW
  319.  
  320.         SendMessage("MMA Detected. Disabling SOW.")
  321.         orbwalker = "MMA"
  322.         Menu.orbwalk.Enabled = false
  323.  
  324.     elseif _G.SxOrbMenu then -- SXORBWALK LOADED - DISABLE SOW
  325.  
  326.         SendMessage("SxOrbwalk Detected. Disabling SOW.")
  327.         orbwalker = "SxOrb"
  328.         Menu.orbwalk.Enabled = false
  329.  
  330.     end
  331.  
  332.     if not _G.NamiPred_Loaded then _G.NamiPred_Loaded = true end
  333.  
  334. end
  335.  
  336. -- ACTIVATE MODES
  337. function __modes()
  338.  
  339.     carryKey    = Menu.keys.carry
  340.     harassKey   = Menu.keys.harass
  341.     farmKey     = Menu.keys.farm
  342.  
  343.     if carryKey     then Combo(Target)  end -- ACTIVATE CARRY MODE
  344.     if harassKey    then Harass(Target) end -- ACTIVATE MIXED MODE
  345.     if farmKey      then Farm()         end -- ACTIVATE CLEAR MODE
  346.  
  347.    
  348.    
  349. end
  350.  
  351. -- TICK UPDATE --
  352. function __update() -- UPDATE VARIABLES ON TICK
  353. if Menu.heal.UseHeal and myManaPct() >= Menu.combo.mana then --ENABLE AUTO HEAL
  354.             AutoHeal()
  355.         end
  356.  
  357.  
  358.     -- SKILLS -- CHECK IF SPELLS ARE READY
  359.     for i in pairs(SpellTable) do
  360.         SpellTable[i].ready = myHero:CanUseSpell(i) == READY
  361.     end
  362.     -- SKILLS --
  363.  
  364.    
  365.  
  366.     TargetSelector:update() -- UPDATE TARGETS IN RANGE
  367.     Target = GetTarget() -- GET DESIRED TARGET IN GLOBAL
  368.  
  369. end
  370.  
  371.  
  372. -- SCRIPT FUNCTIONS --
  373.  
  374. function Combo(target) -- CARRY MODE BEHAVIOUS
  375.  
  376.     if ValidTarget(target) and target ~= nil and target.type == myHero.type then
  377.  
  378.         if myManaPct() >= Menu.combo.mana and Menu.combo.useQ then CastQ(target, Menu.prediction.q) end
  379.         if myManaPct() >= Menu.combo.mana and Menu.combo.useR then CastR(target, Menu.prediction.r) end
  380.         if myManaPct() >= Menu.combo.mana and Menu.combo.useE then CastE(target, Menu.prediction.e) end
  381.         if myManaPct() >= Menu.combo.mana and Menu.combo.useW then CastW(target, Menu.prediction.w) end
  382.        
  383.  
  384.     end
  385.  
  386. end
  387.  
  388. function Harass(target) -- HARASS MODE BEHAVIOUR
  389.  
  390.     if ValidTarget(target) and target ~= nil and target.type == myHero.type and (myManaPct() >= Menu.harass.mana) then
  391.  
  392.         if Menu.harass.useQ then CastQ(target, Menu.prediction.q) end
  393.         if Menu.harass.useW then CastW(target, Menu.prediction.W) end
  394.  
  395.  
  396.     end
  397.  
  398. end
  399.  
  400. function Farm() -- LANE CLEAR
  401.  
  402.     enemyMinions:update()
  403.  
  404.     if not (myManaPct() < Menu.farm.mana) then
  405.             if SpellTable[_Q].ready then
  406.        
  407.         for _, minion in pairs(enemyMinions.objects) do
  408.             if minion ~= nil and ValidTarget(minion) then
  409.                 if Menu.farm.useW and GetDistance(minion) <= SpellTable[_Q].range then
  410.                     local pos, hit = GetBestCircularFarmPos(SpellTable[_Q].range, SpellTable[_Q].width, enemyMinions.objects)
  411.                     if pos ~= nil then
  412.                         if VIP_USER and Menu.misc.packet then -- PACKET CAST Q
  413.                             local packet = GenericSpellPacket(_Q, pos.x, pos.z)
  414.                             Packet("S_CAST", packet):send()
  415.                         else -- NORMAL CAST Q
  416.                             CastSpell(_Q, pos.x, pos.z)
  417.                         end
  418.                     end
  419.                 end
  420.             end
  421.         end
  422.             end
  423.     end
  424.  
  425. end
  426.  
  427. -- SKILL FUNCTIONS --
  428. function CastQ(target, chance) -- CAST W SKILL
  429.  
  430.     chance = chance or 2
  431.  
  432.     local n = 0
  433.  
  434.     if target ~= nil and ValidTarget(target) and GetDistance(target) <= SpellTable[_Q].range and SpellTable[_Q].ready then
  435.  
  436.         local aoeCastPos, hitChance, castInfo, nTargets
  437.         if VIP_USER and Menu.prediction.type and Menu.prediction.type == 1 then
  438.             aoeCastPos, castInfo = Prodiction.GetCircularAOEPrediction(target, SpellTable[_Q].range, SpellTable[_Q].speed, SpellTable[_Q].delay, SpellTable[_Q].width, myHero)
  439.             hitChance = tonumber(castInfo.hitchance)
  440.         else
  441.             aoeCastPos, hitChance, nTargets = VP:GetCircularAOECastPosition(target, SpellTable[_Q].delay, SpellTable[_Q].width, SpellTable[_Q].range, SpellTable[_Q].speed, myHero)
  442.         end
  443.  
  444.  
  445.  
  446.  
  447.         if GetEnemyCountInPos(aoeCastPos, SpellTable[_Q].range) >= n then
  448.             if VIP_USER and Menu.misc.packet then
  449.  
  450.                 local packet = GenericSpellPacket(_Q, aoeCastPos.x, aoeCastPos.z)
  451.                 Packet("S_CAST", packet):send()
  452.  
  453.             else
  454.  
  455.                 CastSpell(_Q, aoeCastPos.x, aoeCastPos.z)
  456.  
  457.             end
  458.         end
  459.  
  460.     end
  461.  
  462. end
  463.  
  464. function CastE(target, chance) -- CAST W SKILL
  465.  
  466.     if target ~= nil and GetDistance(target) <= SpellTable[_E].range and target.team == myHero.team then
  467.  
  468.         if VIP_USER and Menu.misc.packet then
  469.  
  470.             local packet = TargetedSpellPacket(_E, target)
  471.             Packet("S_CAST", packet):send()
  472.  
  473.         else
  474.  
  475.             CastSpell(_E, target)
  476.  
  477.         end
  478.  
  479.     end
  480.  
  481.  
  482.      
  483.  
  484.     end
  485.  
  486.  
  487. function AutoHeal()
  488.         for i, ally in ipairs(GetAllyHeroes()) do
  489.             if SpellTable[_W].ready and Menu.heal.UseHeal then
  490.                 if (ally.health / ally.maxHealth < Menu.heal.HealManager /100) and (myHero.health / myHero.maxHealth > Menu.heal.HPManager /100) then
  491.                     if GetDistance(ally, myHero) <= SpellTable[_W].range then
  492.                         if Menu.misc.packet then
  493.                             Packet("S_CAST", {spellId = _W, targetNetworkId = ally.networkID}):send()
  494.                             return
  495.                         end
  496.  
  497.                         if not Menu.misc.packet then
  498.                             CastSpell(_W, ally)
  499.                         end
  500.                     end
  501.                 end
  502.             end
  503.         end
  504.     end
  505.  
  506.  
  507.  
  508.  
  509.  
  510.  
  511. function CastR(target, chance) -- CAST Q SKILL
  512.  
  513.     chance = chance or 2
  514.  
  515.     if target ~= nil and ValidTarget(target) and GetDistance(target) <= SpellTable[_Q].range and SpellTable[_Q].ready then
  516.  
  517.         local castPos, hitChance, castInfo
  518.         if VIP_USER and Menu.prediction.type and Menu.prediction.type == 1 then -- PRODICTION
  519.             castPos, castInfo = Prodiction.GetLineAOEPrediction(target, SpellTable[_Q].range, SpellTable[_Q].speed,  SpellTable[_Q].delay,  SpellTable[_Q].width, myHero)
  520.             if castInfo.collision() then return end
  521.             hitChance = tonumber(castInfo.hitchance)
  522.         else -- VPREDICTION
  523.             castPos, hitChance, pos = VP:GetLineCastPosition(target, SpellTable[_Q].delay, SpellTable[_Q].width, SpellTable[_Q].range, SpellTable[_Q].speed, myHero, true)
  524.         end
  525.  
  526.  
  527.         if GetMode() == 1 then
  528.             n = Menu.combo.minR
  529.         end
  530.  
  531.         if GetEnemyCountInPos(CastPos, SpellTable[_R].range) >= n then
  532.             if hitChance and hitChance >= chance then
  533.  
  534.              if VIP_USER and Menu.misc.packet then
  535.  
  536.                  local packet = GenericSpellPacket(_R, castPos.x, castPos.z)  
  537.                  Packet("S_CAST", packet):send()
  538.  
  539.              else
  540.                  CastSpell(_R, castPos.x, castPos.z)
  541.              end
  542.  
  543.         end
  544.  
  545.         end
  546.  
  547.     end
  548.  
  549. end
  550.  
  551. function CastW()
  552.     if ts.target ~= nil and ValidTarget(ts.target, WRange) and myHero:CanUseSpell(_W) == READY then
  553.         CastSpell(_W, ts.target)
  554.     end
  555. end
  556.     -- MAIN DRAW FUNCTION --
  557. function __draw()
  558.  
  559.     DrawCircles()
  560.     DrawText()
  561.     DrawMisc()
  562.  
  563. end
  564. -- MAIN DRAW FUNCION --
  565.  
  566. -- DRAW FUNCTIONS --
  567. function DrawCircles() -- CIRCLE DRAWINGS ON SCREEN
  568.  
  569.     if Menu and Menu.draw and Menu.draw.enabled then
  570.  
  571.         if Menu.draw.lfc then -- LAG FREE CIRCLES
  572.  
  573.             if Menu.draw.drawAA then DrawCircleLFC(myHero.x, myHero.y, myHero.z, GetTrueRange(), ARGB(255,255,255,255)) end -- DRAW AA RANGE
  574.  
  575.             if Menu.draw.drawQ and SpellTable[_Q].ready then DrawCircleLFC(myHero.x, myHero.y, myHero.z, SpellTable[_Q].range, ARGB(255,255,255,255)) end -- DRAW Q RANGE
  576.  
  577.             if Menu.draw.drawW and SpellTable[_W].ready then DrawCircleLFC(myHero.x, myHero.y, myHero.z, SpellTable[_W].range, ARGB(255,255,255,255)) end -- DRAW W RANGE
  578.  
  579.             if Menu.draw.drawE and SpellTable[_E].ready then DrawCircleLFC(myHero.x, myHero.y, myHero.z, SpellTable[_E].range, ARGB(255,255,255,255)) end -- DRAW E RANGE
  580.  
  581.          
  582.  
  583.             if Menu.draw.drawTarget and GetTarget() ~= nil then DrawCircleLFC(GetTarget().x, GetTarget().y, GetTarget().z, 150, ARGB(255,255,255,255)) end -- DRAW TARGET
  584.  
  585.         else -- NORMAL CIRCLES
  586.  
  587.             if Menu.draw.drawAA then DrawCircle(myHero.x, myHero.y, myHero.z, GetTrueRange(), ARGB(255,255,255,255)) end -- DRAW AA RANGE
  588.  
  589.             if Menu.draw.drawQ and SpellTable[_Q].ready then DrawCircle(myHero.x, myHero.y, myHero.z, SpellTable[_Q].range, ARGB(255,255,255,255)) end -- DRAW Q RANGE
  590.  
  591.             if Menu.draw.drawW and SpellTable[_W].ready then DrawCircle(myHero.x, myHero.y, myHero.z, SpellTable[_W].range, ARGB(255,255,255,255)) end -- DRAW W RANGE
  592.  
  593.             if Menu.draw.drawE and SpellTable[_E].ready then DrawCircle(myHero.x, myHero.y, myHero.z, SpellTable[_E].range, ARGB(255,255,255,255)) end -- DRAW E RANGE
  594.  
  595.            
  596.  
  597.             if Menu.draw.drawTarget and GetTarget() ~= nil then DrawCircle(GetTarget().x, GetTarget().y, GetTarget().z, 150, ARGB(255,255,255,255)) end -- DRAW TARGET
  598.  
  599.         end
  600.  
  601.     end
  602.  
  603. end
  604.  
  605. function DrawText() -- TEXT DRAWINGS ON SCREEN
  606.  
  607.     if Menu and Menu.draw and Menu.draw.enabled then
  608.  
  609.     end
  610.  
  611. end
  612.  
  613. function DrawMisc() -- MISC DRAWINGS LIKE LINES OR SPRITES ON SCREEN
  614.  
  615.     if Menu and Menu.draw and Menu.draw.enabled then
  616.  
  617.     end
  618.  
  619. end
  620. -- DRAW FUNCTIONS --
  621.  
  622. function GetBestCircularFarmPos(range, radius, objects) -- RETURN: POSITION AND NUMBER OF BEST POSSIBLE W FARM - pos, number
  623.     local bestPos
  624.     local bestHit = 0
  625.     for _, object in ipairs(objects) do
  626.         local hit = CountObjectsNearPos(objects.visionPos or object, range, radius, objects)
  627.         if hit > bestHit then
  628.             bestHit = hit
  629.             bestPos = Vector(object)
  630.             if bestHit == #objects then
  631.                 break
  632.             end
  633.         end
  634.     end
  635.     return bestPos, bestHit
  636. end
  637.  
  638. function __initPriorities()
  639.  
  640.     if heroManager.iCount < 10 and (GetGame().map.shortName == "twistedTreeline" or heroManager.iCount < 6) then
  641.  
  642.         SendMessage("Too few champs to arrange priorities.")
  643.  
  644.     elseif heroManager.iCount == 6 then
  645.  
  646.         ArrangePrioritiesTT()
  647.  
  648.     else
  649.  
  650.         ArrangePriorities()
  651.  
  652.     end
  653.  
  654. end
  655.  
  656. function SetPriority(table, hero, priority)
  657.  
  658.     for i = 1, #table, 1 do
  659.  
  660.         if hero.charName:find(table[i]) ~= nil then
  661.             TS_SetHeroPriority(priority, hero.charName)
  662.         end
  663.  
  664.     end
  665.  
  666. end
  667.  
  668. function ArrangePriorities()
  669.  
  670.     for _, enemy in ipairs(GetEnemyHeroes()) do
  671.  
  672.         SetPriority(PriorityTable.AD_Carry, enemy, 1)
  673.         SetPriority(PriorityTable.AP, enemy, 2)
  674.         SetPriority(PriorityTable.Support, enemy, 3)
  675.         SetPriority(PriorityTable.Bruiser, enemy, 4)
  676.         SetPriority(PriorityTable.Tank, enemy, 5)
  677.  
  678.     end
  679.  
  680. end
  681.  
  682. function ArrangePrioritiesTT()
  683.  
  684.     for _, enemy in ipairs(GetEnemyHeroes()) do
  685.  
  686.         SetPriority(PriorityTable.AD_Carry, enemy, 1)
  687.         SetPriority(PriorityTable.AP, enemy, 1)
  688.         SetPriority(PriorityTable.Support, enemy, 2)
  689.         SetPriority(PriorityTable.Bruiser, enemy, 2)
  690.         SetPriority(PriorityTable.Tank, enemy, 3)
  691.  
  692.     end
  693.  
  694. end
  695.  
  696. -- SUPP PLOX GLOBAL FUNCTIONS --
  697. function myManaPct() return (myHero.mana * 100) / myHero.maxMana end -- RETURN: HERO MANA PERCENTAGE - %number
  698. function myHealthPct() return (myHero.health * 100) / myHero.maxHealth end -- RETURN: HERO HEALTH PERCENTAGE - %number
  699.  
  700. function getManaPercent(unit) -- RETURN: TARGET MANA PERCENTAGE - %number
  701.  
  702.     local obj = unit or myHero
  703.     return (onj.mana / obj.maxMana) * 100
  704.  
  705. end
  706.  
  707. function getHealthPercent(unit) -- RETURN: TARGET HEALTH PERCENTAGE - %number
  708.  
  709.     local obj = unit or myHero
  710.     return (obj.health / obj.maxHealth) * 100
  711.  
  712. end
  713.  
  714. function GetMaxRange() -- RETURN: MAX RANGE AMONGST HERO SKILLS - number
  715.  
  716.     return math.max(myHero.range, SpellTable[_Q].range or 0,  SpellTable[_E].range or 0)
  717.  
  718. end
  719.  
  720. function GetTrueRange() -- RETURN: REAL AUTO ATTACK RANGE - number
  721.     return myHero.range + GetDistance(myHero, myHero.minBBox)
  722. end
  723.  
  724. function GetHitBoxRadius(target) -- RETURN: HITBOX RADIUS OF TARGET - number
  725.  
  726.     return GetDistance(target.minBBox, target.maxBBox)/2
  727.  
  728. end
  729.  
  730. function CheckHeroCollision(pos, spell) -- RETURN: WILL THE SKILL COLLIDE - boolean, unit
  731.  
  732.     for _, enemy in ipairs(GetEnemyHeroes()) do
  733.  
  734.         if ValidTarget(enemy) and _GetDistanceSqr(enemy) < math.pow(SpellTable[spell].range * 1.5, 2) then -- TODO ADD TARGET MENU HERE
  735.  
  736.             local projectile, pointLine, onSegment = VectorPointProjectionOnLineSegment(Vector(player), pos, Vector(enemy))
  737.  
  738.             if (_GetDistanceSqr(enemy, projectile) <= math.pow(VP:GetHitBox(enemy) * 2 + SpellTable[spell].width, 2)) then
  739.  
  740.                 return true, enemy
  741.  
  742.             end
  743.  
  744.         end
  745.  
  746.     end
  747.  
  748.     return false
  749.  
  750. end
  751.  
  752. function CountObjectsNearPos(pos, range, radius, objects) -- RETURN: NUMBER OF OBJECTS - number
  753.     local n = 0
  754.     for i, object in ipairs(objects) do
  755.         if GetDistanceSqr(pos, object) <= radius * radius then
  756.             n = n + 1
  757.         end
  758.     end
  759.     return n
  760. end
  761.  
  762. function GetEnemyCountInPos(pos, radius)
  763.     local n = 0
  764.     for _, enemy in ipairs(GetEnemyHeroes()) do
  765.         if GetDistanceSqr(pos, enemy) <= radius * radius then n = n + 1 end
  766.     end
  767.     return n
  768. end
  769.  
  770. function AlliesInRange(range, point) -- RETURN: NUMBER OF ALLIES - number
  771.     local n = 0
  772.     for _, ally in ipairs(GetAllyHeroes()) do
  773.         if ValidTarget(ally, math.huge, false) and GetDistanceSqr(point, ally) <= range * range then
  774.             n = n + 1
  775.         end
  776.     end
  777.     return n
  778. end
  779.  
  780. function GetLowestHealthAlly() -- RETURN: ALLY, HEALTH PERCENT - unit, %number
  781.  
  782.     local leastHp = myHealthPct()
  783.     local leastHpAlly = myHero
  784.  
  785.     for _, ally in ipairs(GetAllyHeroes()) do
  786.         local allyHpPct = getHealthPercent(ally)
  787.         if allyHpPct <= leastHp and not ally.dead and _GetDistanceSqr(ally) < 700 * 700 then
  788.             leastHp = allyHpPct
  789.             leastHpAlly = ally
  790.         end
  791.     end
  792.  
  793.     return leastHpAlly, leastHp
  794.  
  795. end
  796.  
  797. -- Lag free circles (by barasia, vadash and viseversa)
  798. function DrawCircleNextLvl(x, y, z, radius, width, color, chordlength)
  799.     radius = radius or 300
  800.   quality = math.max(8,round(180/math.deg((math.asin((chordlength/(2*radius)))))))
  801.   quality = 2 * math.pi / quality
  802.   radius = radius*.92
  803.     local points = {}
  804.     for theta = 0, 2 * math.pi + quality, quality do
  805.         local c = WorldToScreen(D3DXVECTOR3(x + radius * math.cos(theta), y, z - radius * math.sin(theta)))
  806.         points[#points + 1] = D3DXVECTOR2(c.x, c.y)
  807.     end
  808.     DrawLines2(points, width or 1, color or 4294967295)
  809. end
  810.  
  811. function round(num)
  812.  if num >= 0 then return math.floor(num+.5) else return math.ceil(num-.5) end
  813. end
  814.  
  815. function DrawCircleLFC(x, y, z, radius, color)
  816.     local vPos1 = Vector(x, y, z)
  817.     local vPos2 = Vector(cameraPos.x, cameraPos.y, cameraPos.z)
  818.     local tPos = vPos1 - (vPos1 - vPos2):normalized() * radius
  819.     local sPos = WorldToScreen(D3DXVECTOR3(tPos.x, tPos.y, tPos.z))
  820.     if OnScreen({ x = sPos.x, y = sPos.y }, { x = sPos.x, y = sPos.y }) then
  821.         DrawCircleNextLvl(x, y, z, radius, 1, color, 75)
  822.     end
  823. end
  824.  
  825. function GetTarget()
  826.  
  827.     TargetSelector:update()
  828.  
  829.     if orbwalker == 'SAC' then
  830.  
  831.         if _G.AutoCarry and _G.AutoCarry.Crosshair and _G.AutoCarry.Attack_Crosshair and _G.AutoCarry.Attack_Crosshair.target and _G.AutoCarry.Attack_Crosshair.target.type == myHero.type then
  832.  
  833.             return _G.AutoCarry.Attack_Crosshair.target
  834.  
  835.         end
  836.  
  837.     end
  838.  
  839.     if orbwalker == 'MMA' then
  840.  
  841.         if _G.MMA_Target and _G.MMA_Target.type == myHero.type then
  842.  
  843.             return _G.MMA_Target
  844.  
  845.         end
  846.  
  847.     end
  848.  
  849.     if orbwalker == 'SxOrb' then
  850.  
  851.         if SxOrb and SxOrb:GetTarget() and SxOrb:GetTarget().type == myHero.type then
  852.  
  853.             return SxOrb:GetTarget()
  854.  
  855.         end
  856.  
  857.     end
  858.  
  859.     return TargetSelector.target
  860.  
  861. end
  862.  
  863. function GetMode()
  864.  
  865.     if carryKey then  return 1 end
  866.     if harassKey then return 2 end
  867.     if farmKey then   return 3 end
  868.  
  869.     return nil
  870.  
  871. end
  872.  
  873. -- SPELL PACKET FUNCTIONS --
  874. function TargetedSpellPacket(spell, target)
  875.  
  876.     return { spellId = spell, targetNetworkId = target.networkID }
  877.  
  878. end
  879.  
  880. function GenericSpellPacket(spell, x, y)
  881.  
  882.     return { spellId = spell, toX = x, toY = y, fromX = x, fromY = y }
  883.  
  884. end
  885.  
  886. function SpellPacket(spell)
  887.  
  888.     return { spellId = spell }
  889.  
  890. end
Advertisement
Add Comment
Please, Sign In to add comment