naturus

Untitled

Dec 25th, 2014
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 26.40 KB | None | 0 0
  1. local version = "1.202"
  2.  
  3. --[[
  4.     Ahri - the Nine-Tailed Fox
  5.         Author: Draconis
  6.         Version: 1.202
  7.         Copyright 2014
  8.            
  9.     Dependency: Standalone
  10. --]]
  11.  
  12. if myHero.charName ~= "Ahri" then return end
  13.  
  14. _G.UseUpdater = true
  15.  
  16. local REQUIRED_LIBS = {
  17.     ["SOW"] = "https://raw.githubusercontent.com/Hellsing/BoL/master/common/SOW.lua",
  18.     ["VPrediction"] = "https://raw.githubusercontent.com/Hellsing/BoL/master/common/VPrediction.lua",
  19. }
  20.  
  21. local DOWNLOADING_LIBS, DOWNLOAD_COUNT = false, 0
  22.  
  23. function AfterDownload()
  24.     DOWNLOAD_COUNT = DOWNLOAD_COUNT - 1
  25.     if DOWNLOAD_COUNT == 0 then
  26.         DOWNLOADING_LIBS = false
  27.         print("<b><font color=\"#6699FF\">Ahri - the Nine-Tailed Fox:</font></b> <font color=\"#FFFFFF\">Required libraries downloaded successfully, please reload (double F9).</font>")
  28.     end
  29. end
  30.  
  31. for DOWNLOAD_LIB_NAME, DOWNLOAD_LIB_URL in pairs(REQUIRED_LIBS) do
  32.     if FileExist(LIB_PATH .. DOWNLOAD_LIB_NAME .. ".lua") then
  33.         require(DOWNLOAD_LIB_NAME)
  34.     else
  35.         DOWNLOADING_LIBS = true
  36.         DOWNLOAD_COUNT = DOWNLOAD_COUNT + 1
  37.         DownloadFile(DOWNLOAD_LIB_URL, LIB_PATH .. DOWNLOAD_LIB_NAME..".lua", AfterDownload)
  38.     end
  39. end
  40.  
  41. if DOWNLOADING_LIBS then return end
  42.  
  43. local UPDATE_NAME = "Ahri - the Nine-Tailed Fox"
  44. local UPDATE_HOST = "raw.github.com"
  45. local UPDATE_PATH = "/DraconisBoL/BoL/master/Ahri%20-%20the%20Nine-Tailed%20Fox.lua" .. "?rand=" .. math.random(1, 10000)
  46. local UPDATE_FILE_PATH = SCRIPT_PATH..GetCurrentEnv().FILE_NAME
  47. local UPDATE_URL = "http://"..UPDATE_HOST..UPDATE_PATH
  48.  
  49. function AutoupdaterMsg(msg) print("<b><font color=\"#6699FF\">"..UPDATE_NAME..":</font></b> <font color=\"#FFFFFF\">"..msg..".</font>") end
  50. if _G.UseUpdater then
  51.     local ServerData = GetWebResult(UPDATE_HOST, UPDATE_PATH)
  52.     if ServerData then
  53.         local ServerVersion = string.match(ServerData, "local version = \"%d+.%d+\"")
  54.         ServerVersion = string.match(ServerVersion and ServerVersion or "", "%d+.%d+")
  55.         if ServerVersion then
  56.             ServerVersion = tonumber(ServerVersion)
  57.             if tonumber(version) < ServerVersion then
  58.                 AutoupdaterMsg("New version available "..ServerVersion)
  59.                 AutoupdaterMsg("Updating, please don't press F9")
  60.                 DownloadFile(UPDATE_URL, UPDATE_FILE_PATH, function () AutoupdaterMsg("Successfully updated. ("..version.." => "..ServerVersion.."), press F9 twice to load the updated version.") end)  
  61.             else
  62.                 AutoupdaterMsg("You have got the latest version ("..ServerVersion..")")
  63.             end
  64.         end
  65.     else
  66.         AutoupdaterMsg("Error downloading version info")
  67.     end
  68. end
  69.  
  70. ------------------------------------------------------
  71. --           Callbacks             
  72. ------------------------------------------------------
  73.  
  74. function OnLoad()
  75.     print("<b><font color=\"#6699FF\">Ahri - the Nine-Tailed Fox:</font></b> <font color=\"#FFFFFF\">Good luck and have fun!</font>")
  76.     Variables()
  77.     Menu()
  78.     PriorityOnLoad()
  79. end
  80.  
  81. function OnTick()
  82.     ComboKey = Settings.combo.comboKey
  83.     HarassKey = Settings.harass.harassKey
  84.     JungleClearKey = Settings.jungle.jungleKey
  85.     LaneClearKey = Settings.lane.laneKey
  86.    
  87.     if ComboKey then
  88.         Combo(Target)
  89.     end
  90.    
  91.     if HarassKey then
  92.         Harass(Target)
  93.     end
  94.    
  95.     if JungleClearKey then
  96.         JungleClear()
  97.     end
  98.    
  99.     if LaneClearKey then
  100.         LaneClear()
  101.     end
  102.    
  103.     if Settings.ks.killSteal then
  104.         KillSteal()
  105.     end
  106.  
  107.     Checks()
  108. end
  109.  
  110. function OnDraw()
  111.     if not myHero.dead and not Settings.drawing.mDraw then
  112.         if SkillQ.ready and Settings.drawing.qDraw then
  113.             DrawCircle(myHero.x, myHero.y, myHero.z, SkillQ.range, RGB(Settings.drawing.qColor[2], Settings.drawing.qColor[3], Settings.drawing.qColor[4]))
  114.         end
  115.         if SkillW.ready and Settings.drawing.wDraw then
  116.             DrawCircle(myHero.x, myHero.y, myHero.z, SkillW.range, RGB(Settings.drawing.wColor[2], Settings.drawing.wColor[3], Settings.drawing.wColor[4]))
  117.         end
  118.         if SkillE.ready and Settings.drawing.eDraw then
  119.             DrawCircle(myHero.x, myHero.y, myHero.z, SkillE.range, RGB(Settings.drawing.eColor[2], Settings.drawing.eColor[3], Settings.drawing.eColor[4]))
  120.         end
  121.         if SkillR.ready and Settings.drawing.rDraw then
  122.             DrawCircle(myHero.x, myHero.y, myHero.z, SkillR.range, RGB(Settings.drawing.rColor[2], Settings.drawing.rColor[3], Settings.drawing.rColor[4]))
  123.         end
  124.        
  125.         if Settings.drawing.myHero then
  126.             DrawCircle(myHero.x, myHero.y, myHero.z, TrueRange(), RGB(Settings.drawing.myColor[2], Settings.drawing.myColor[3], Settings.drawing.myColor[4]))
  127.         end
  128.        
  129.         if Settings.drawing.Target and Target ~= nil then
  130.             DrawCircle(Target.x, Target.y, Target.z, 80, ARGB(255, 10, 255, 10))
  131.         end
  132.        
  133.         if Settings.drawing.Text then Calculation() end
  134.     end
  135. end
  136.  
  137. ------------------------------------------------------
  138. --           Functions             
  139. ------------------------------------------------------
  140.  
  141. function Combo(unit)
  142.     if ValidTarget(unit) and unit ~= nil and unit.type == myHero.type then
  143.         if Settings.combo.comboItems then
  144.             UseItems(unit)
  145.         end
  146.        
  147.         if Settings.combo.comboMode == 1 then
  148.             if Settings.combo.useR then CastR(unit) end
  149.             CastE(unit)
  150.             CastQ(unit)
  151.             CastW(unit)
  152.         else
  153.             CastE(unit)
  154.             CastQ(unit)
  155.             CastW(unit)
  156.         end
  157.    
  158.         if not Settings.combo.useAA then
  159.             SOWi:DisableAttacks()
  160.         end
  161.     end
  162. end
  163.  
  164. function Harass(unit)
  165.     if ValidTarget(unit) and unit ~= nil and unit.type == myHero.type and not IsMyManaLow() then
  166.         if Settings.harass.useQ then CastQ(unit) end
  167.         if Settings.harass.useE then CastE(unit) end
  168.         if Settings.harass.useW then CastW(unit) end
  169.     end
  170. end
  171.  
  172. function LaneClear()
  173.     enemyMinions:update()
  174.     if LaneClearKey then
  175.         for i, minion in pairs(enemyMinions.objects) do
  176.             if ValidTarget(minion) and minion ~= nil then
  177.                 if Settings.lane.laneQ and GetDistance(minion) <= SkillQ.range and SkillQ.ready then
  178.                     local BestPos, BestHit = GetBestLineFarmPosition(SkillQ.range, SkillQ.width, enemyMinions.objects)
  179.                         if BestPos ~= nil then
  180.                             CastSpell(_Q, BestPos.x, BestPos.z)
  181.                         end
  182.                 end
  183.                 if Settings.lane.laneW and GetDistance(minion) <= SkillW.range and SkillW.ready then
  184.                     CastSpell(_W)
  185.                 end
  186.             end      
  187.         end
  188.     end
  189. end
  190.  
  191. function JungleClear()
  192.     if Settings.jungle.jungleKey then
  193.         local JungleMob = GetJungleMob()
  194.        
  195.         if JungleMob ~= nil then
  196.             if Settings.jungle.jungleQ and GetDistance(JungleMob) <= SkillQ.range and SkillQ.ready then
  197.                 CastSpell(_Q, JungleMob.x, JungleMob.z)
  198.             end
  199.             if Settings.jungle.jungleW and GetDistance(JungleMob) <= SkillW.range and SkillW.ready then
  200.                 CastSpell(_W)
  201.             end
  202.         end
  203.     end
  204. end
  205.  
  206. function CastQ(unit)   
  207.     if unit ~= nil and GetDistance(unit) <= SkillQ.range and SkillQ.ready then
  208.         local CastPosition,  HitChance,  Position = VP:GetLineCastPosition(unit, SkillQ.delay, SkillQ.width, SkillQ.range, SkillQ.speed, myHero)
  209.                    
  210.         if HitChance >= 2 then
  211.             CastSpell(_Q, CastPosition.x, CastPosition.z)
  212.         end
  213.     end
  214. end
  215.  
  216. function CastE(unit)
  217.     if unit ~= nil and GetDistance(unit) <= SkillE.range and SkillE.ready then
  218.         local CastPosition,  HitChance,  Position = VP:GetLineCastPosition(unit, SkillE.delay, SkillE.width, SkillE.range, SkillE.speed, myHero, true)
  219.            
  220.         if HitChance >= 2 then
  221.             CastSpell(_E, CastPosition.x, CastPosition.z)
  222.         end
  223.     end
  224. end
  225.  
  226. function CastW(unit)   
  227.     if unit ~= nil and SkillW.ready and GetDistance(unit) <= SkillW.range then
  228.         CastSpell(_W)
  229.     end
  230. end
  231.  
  232. function CastR(unit)
  233.     if unit ~= nil then
  234.         if SkillR.ready and GetDistance(unit) <= SkillQ.range and Settings.combo.useR == 1 then
  235.             local Mouse = Vector(myHero) + 400 * (Vector(mousePos) - Vector(myHero)):normalized()
  236.             CastSpell(_R, Mouse.x, Mouse.z)
  237.         elseif SkillR.ready and GetDistance(unit) <= SkillQ.range and Settings.combo.useR == 2 then
  238.             CastSpell(_R, unit.x, unit.z)
  239.         elseif Settings.combo.useR == 3 then
  240.             return
  241.         end
  242.     end
  243. end
  244.  
  245. function KillSteal()
  246.     for _, enemy in ipairs(GetEnemyHeroes()) do
  247.         if ValidTarget(enemy) and enemy.visible then
  248.             local qDmg = getDmg("Q", enemy, myHero)
  249.             local eDmg = getDmg("E", enemy, myHero)
  250.            
  251.             if enemy.health <= qDmg then
  252.                 CastQ(enemy)
  253.             elseif enemy.health <= (qDmg + eDmg) then
  254.                 CastE(enemy)
  255.                 CastQ(enemy)
  256.             elseif enemy.health <= eDmg then
  257.                 CastE(enemy)
  258.             end
  259.  
  260.             if Settings.ks.autoIgnite then
  261.                 AutoIgnite(enemy)
  262.             end
  263.         end
  264.     end
  265. end
  266.  
  267. function Calculation()
  268.     for _, enemy in ipairs(GetEnemyHeroes()) do
  269.         if ValidTarget(enemy) and enemy.visible then
  270.             local qDmg = getDmg("Q", enemy, myHero)
  271.             local wDmg = getDmg("W", enemy, myHero)
  272.             local eDmg = getDmg("E", enemy, myHero)
  273.             local iDmg = getDmg("IGNITE", enemy, myHero)
  274.            
  275.             if enemy.health <= qDmg then
  276.                 DrawText3D(tostring("Killable: Q"), enemy.x, enemy.y, enemy.z, 16, ARGB(255, 10, 255, 10), true)
  277.             elseif enemy.health <= qDmg + wDmg then
  278.                 DrawText3D(tostring("Killable: Q > W"), enemy.x, enemy.y, enemy.z, 16, ARGB(255, 10, 255, 10), true)
  279.             elseif enemy.health <= eDmg then
  280.                 DrawText3D(tostring("Killable: E"), enemy.x, enemy.y, enemy.z, 16, ARGB(255, 10, 255, 10), true)
  281.             elseif enemy.health <= (qDmg + eDmg) then
  282.                 DrawText3D(tostring("Killable: E > Q"), enemy.x, enemy.y, enemy.z, 16, ARGB(255, 10, 255, 10), true)
  283.             elseif enemy.health <= (wDmg + eDmg) then
  284.                 DrawText3D(tostring("Killable: E > W"), enemy.x, enemy.y, enemy.z, 16, ARGB(255, 10, 255, 10), true)
  285.             elseif enemy.health <= (qDmg + eDmg + wDmg) then
  286.                 DrawText3D(tostring("Killable: E > Q > W"), enemy.x, enemy.y, enemy.z, 16, ARGB(255, 10, 255, 10), true)
  287.             elseif enemy.health <= (qDmg + eDmg + wDmg + iDmg) then
  288.                 DrawText3D(tostring("Killable: E > Q > W > IGNITE"), enemy.x, enemy.y, enemy.z, 16, ARGB(255, 10, 255, 10), true)
  289.             end
  290.         end
  291.     end
  292. end
  293.  
  294. function AutoIgnite(unit)
  295.     if ValidTarget(unit, Ignite.range) and unit.health <= 50 + (20 * myHero.level) then
  296.         if Ignite.ready then
  297.             CastSpell(Ignite.slot, unit)
  298.         end
  299.     end
  300. end
  301.  
  302. ------------------------------------------------------
  303. --           Checks, menu & stuff              
  304. ------------------------------------------------------
  305.  
  306. function Checks()
  307.     SkillQ.ready = (myHero:CanUseSpell(_Q) == READY)
  308.     SkillW.ready = (myHero:CanUseSpell(_W) == READY)
  309.     SkillE.ready = (myHero:CanUseSpell(_E) == READY)
  310.     SkillR.ready = (myHero:CanUseSpell(_R) == READY)
  311.    
  312.     if myHero:GetSpellData(SUMMONER_1).name:find(Ignite.name) then
  313.         Ignite.slot = SUMMONER_1
  314.     elseif myHero:GetSpellData(SUMMONER_2).name:find(Ignite.name) then
  315.         Ignite.slot = SUMMONER_2
  316.     end
  317.    
  318.     Ignite.ready = (Ignite.slot ~= nil and myHero:CanUseSpell(Ignite.slot) == READY)
  319.    
  320.     TargetSelector:update()
  321.     Target = GetCustomTarget()
  322.    
  323.     SOWi:ForceTarget(Target)
  324.     SOWi:EnableAttacks()
  325.    
  326.     --if VIP_USER and Settings.misc.skinList then ChooseSkin() end
  327.     if Settings.drawing.lfc.lfc then _G.DrawCircle = DrawCircle2 else _G.DrawCircle = _G.oldDrawCircle end
  328.    
  329.     if Settings.combo.comboSwitch and Settings.combo.comboMode == 1 then
  330.         Settings.combo.comboMode = 2
  331.     elseif not Settings.combo.comboSwitch and Settings.combo.comboMode == 2 then
  332.         Settings.combo.comboMode = 1
  333.     end
  334. end
  335.  
  336. function IsMyManaLow()
  337.     if myHero.mana < (myHero.maxMana * ( Settings.harass.harassMana / 100)) then
  338.         return true
  339.     else
  340.         return false
  341.     end
  342. end
  343.  
  344. function Menu()
  345.     Settings = scriptConfig("Ahri - the Nine-Tailed Fox "..version.."", "DraconisAhri")
  346.    
  347.     Settings:addSubMenu("["..myHero.charName.."] - Combo Settings", "combo")
  348.         Settings.combo:addParam("comboKey", "Combo Key", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  349.         Settings.combo:addParam("comboSwitch", "Combo Switch", SCRIPT_PARAM_ONKEYTOGGLE, false, GetKey("A"))
  350.         Settings.combo:addParam("comboMode", "Combo Mode", SCRIPT_PARAM_LIST, 1, { "REQW", "EQW"})
  351.         Settings.combo:addParam("useR", "Use "..SkillR.name.." (R) in Combo", SCRIPT_PARAM_LIST, 1, { "To mouse", "Toward enemy", "Don't use"})
  352.         Settings.combo:addParam("comboItems", "Use Items in Combo", SCRIPT_PARAM_ONOFF, true)
  353.         Settings.combo:addParam("useAA", "Use AAs in Combo", SCRIPT_PARAM_ONOFF, true)
  354.         Settings.combo:permaShow("comboKey")
  355.         Settings.combo:permaShow("comboMode")
  356.    
  357.     Settings:addSubMenu("["..myHero.charName.."] - Harass Settings", "harass")
  358.         Settings.harass:addParam("harassKey", "Harass Key", SCRIPT_PARAM_ONKEYDOWN, false, GetKey("C"))
  359.         Settings.harass:addParam("useQ", "Use "..SkillQ.name.." (Q) in Harass", SCRIPT_PARAM_ONOFF, true)
  360.         Settings.harass:addParam("useW", "Use "..SkillW.name.." (W) in Harass", SCRIPT_PARAM_ONOFF, false)
  361.         Settings.harass:addParam("useE", "Use "..SkillE.name.." (E) in Harass", SCRIPT_PARAM_ONOFF, true)
  362.         Settings.harass:addParam("harassMana", "Min. Mana Percent: ", SCRIPT_PARAM_SLICE, 50, 0, 100, 0)
  363.         Settings.harass:permaShow("harassKey")
  364.        
  365.     Settings:addSubMenu("["..myHero.charName.."] - Lane Clear Settings", "lane")
  366.         Settings.lane:addParam("laneKey", "Lane Clear Key", SCRIPT_PARAM_ONKEYDOWN, false, GetKey("V"))
  367.         Settings.lane:addParam("laneQ", "Clear with "..SkillQ.name.." (Q)", SCRIPT_PARAM_ONOFF, true)
  368.         Settings.lane:addParam("laneW", "Clear with "..SkillW.name.." (W)", SCRIPT_PARAM_ONOFF, true)
  369.         Settings.lane:permaShow("laneKey")
  370.        
  371.     Settings:addSubMenu("["..myHero.charName.."] - Jungle Clear Settings", "jungle")
  372.         Settings.jungle:addParam("jungleKey", "Jungle Clear Key", SCRIPT_PARAM_ONKEYDOWN, false, GetKey("V"))
  373.         Settings.jungle:addParam("jungleQ", "Clear with "..SkillQ.name.." (Q)", SCRIPT_PARAM_ONOFF, true)
  374.         Settings.jungle:addParam("jungleW", "Clear with "..SkillW.name.." (W)", SCRIPT_PARAM_ONOFF, true)
  375.         Settings.jungle:permaShow("jungleKey")
  376.        
  377.     Settings:addSubMenu("["..myHero.charName.."] - KillSteal Settings", "ks")
  378.         Settings.ks:addParam("killSteal", "Use Smart Kill Steal", SCRIPT_PARAM_ONOFF, true)
  379.         Settings.ks:addParam("autoIgnite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
  380.         Settings.ks:permaShow("killSteal")
  381.            
  382.     Settings:addSubMenu("["..myHero.charName.."] - Draw Settings", "drawing")  
  383.         Settings.drawing:addParam("mDraw", "Disable All Range Draws", SCRIPT_PARAM_ONOFF, false)
  384.         Settings.drawing:addParam("Target", "Draw Circle on Target", SCRIPT_PARAM_ONOFF, true)
  385.         Settings.drawing:addParam("Text", "Draw Text on Target", SCRIPT_PARAM_ONOFF, true)
  386.         Settings.drawing:addParam("myHero", "Draw My Range", SCRIPT_PARAM_ONOFF, true)
  387.         Settings.drawing:addParam("myColor", "Draw My Range Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  388.         Settings.drawing:addParam("qDraw", "Draw "..SkillQ.name.." (Q) Range", SCRIPT_PARAM_ONOFF, true)
  389.         Settings.drawing:addParam("qColor", "Draw "..SkillQ.name.." (Q) Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  390.         Settings.drawing:addParam("wDraw", "Draw "..SkillW.name.." (W) Range", SCRIPT_PARAM_ONOFF, true)
  391.         Settings.drawing:addParam("wColor", "Draw "..SkillW.name.." (W) Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  392.         Settings.drawing:addParam("eDraw", "Draw "..SkillE.name.." (E) Range", SCRIPT_PARAM_ONOFF, true)
  393.         Settings.drawing:addParam("eColor", "Draw "..SkillE.name.." (E) Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  394.         Settings.drawing:addParam("rDraw", "Draw "..SkillR.name.." (R) Range", SCRIPT_PARAM_ONOFF, true)
  395.         Settings.drawing:addParam("rColor", "Draw "..SkillR.name.." (R) Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  396.        
  397.         Settings.drawing:addSubMenu("Lag Free Circles", "lfc") 
  398.             Settings.drawing.lfc:addParam("lfc", "Lag Free Circles", SCRIPT_PARAM_ONOFF, false)
  399.             Settings.drawing.lfc:addParam("CL", "Quality", 4, 75, 75, 2000, 0)
  400.             Settings.drawing.lfc:addParam("Width", "Width", 4, 1, 1, 10, 0)
  401.    
  402.     Settings:addSubMenu("["..myHero.charName.."] - Misc Settings", "misc")
  403.         Settings.misc:addParam("skinList", "Choose your skin", SCRIPT_PARAM_LIST, 5, { "Dynasty Ahri", "Midnight Ahri", "Foxfire Ahri", "Popstar Ahri", "Classic" })
  404.  
  405.    
  406.     Settings:addSubMenu("["..myHero.charName.."] - Orbwalking Settings", "Orbwalking")
  407.         SOWi:LoadToMenu(Settings.Orbwalking)
  408.    
  409.     TargetSelector = TargetSelector(TARGET_LESS_CAST, SkillE.range, DAMAGE_MAGIC, true)
  410.     TargetSelector.name = "Ahri"
  411.     Settings:addTS(TargetSelector)
  412. end
  413.  
  414. function Variables()
  415.     SkillQ = { name = "Orb of Deception", range = 840, delay = 0.25, speed = 1600, width = 90, ready = false }
  416.     SkillW = { name = "Fox-Fire", range = 800, delay = nil, speed = nil, width = nil, ready = false }
  417.     SkillE = { name = "Charm", range = 975, delay = 0.25, speed = 1500, width = 100, ready = false }
  418.     SkillR = { name = "Spirit Rush", range = 550, delay = nil, speed = nil, width = nil, ready = false }
  419.     Ignite = { name = "summonerdot", range = 600, slot = nil }
  420.    
  421.     enemyMinions = minionManager(MINION_ENEMY, SkillE.range, myHero, MINION_SORT_HEALTH_ASC)
  422.    
  423.     VP = VPrediction()
  424.     SOWi = SOW(VP)
  425.    
  426.     JungleMobs = {}
  427.     JungleFocusMobs = {}
  428.    
  429.     lastSkin = 0
  430.    
  431.     if GetGame().map.shortName == "twistedTreeline" then
  432.         TwistedTreeline = true
  433.     else
  434.         TwistedTreeline = false
  435.     end
  436.    
  437.     _G.oldDrawCircle = rawget(_G, 'DrawCircle')
  438.     _G.DrawCircle = DrawCircle2
  439.    
  440.     priorityTable = {
  441.             AP = {
  442.                 "Annie", "Ahri", "Akali", "Anivia", "Annie", "Brand", "Cassiopeia", "Diana", "Evelynn", "FiddleSticks", "Fizz", "Gragas", "Heimerdinger", "Karthus",
  443.                 "Kassadin", "Katarina", "Kayle", "Kennen", "Leblanc", "Lissandra", "Lux", "Malzahar", "Mordekaiser", "Morgana", "Nidalee", "Orianna",
  444.                 "Ryze", "Sion", "Swain", "Syndra", "Teemo", "TwistedFate", "Veigar", "Viktor", "Vladimir", "Xerath", "Ziggs", "Zyra", "Velkoz"
  445.             },
  446.            
  447.             Support = {
  448.                 "Alistar", "Blitzcrank", "Janna", "Karma", "Leona", "Lulu", "Nami", "Nunu", "Sona", "Soraka", "Taric", "Thresh", "Zilean", "Braum"
  449.             },
  450.            
  451.             Tank = {
  452.                 "Amumu", "Chogath", "DrMundo", "Galio", "Hecarim", "Malphite", "Maokai", "Nasus", "Rammus", "Sejuani", "Nautilus", "Shen", "Singed", "Skarner", "Volibear",
  453.                 "Warwick", "Yorick", "Zac"
  454.             },
  455.            
  456.             AD_Carry = {
  457.                 "Ashe", "Caitlyn", "Corki", "Draven", "Ezreal", "Graves", "Jayce", "Jinx", "KogMaw", "Lucian", "MasterYi", "MissFortune", "Pantheon", "Quinn", "Shaco", "Sivir",
  458.                 "Talon","Tryndamere", "Tristana", "Twitch", "Urgot", "Varus", "Vayne", "Yasuo", "Zed"
  459.             },
  460.            
  461.             Bruiser = {
  462.                 "Aatrox", "Darius", "Elise", "Fiora", "Gangplank", "Garen", "Irelia", "JarvanIV", "Jax", "Khazix", "LeeSin", "Nocturne", "Olaf", "Poppy",
  463.                 "Renekton", "Rengar", "Riven", "Rumble", "Shyvana", "Trundle", "Udyr", "Vi", "MonkeyKing", "XinZhao"
  464.             }
  465.     }
  466.  
  467.     Items = {
  468.         BRK = { id = 3153, range = 450, reqTarget = true, slot = nil },
  469.         BWC = { id = 3144, range = 400, reqTarget = true, slot = nil },
  470.         DFG = { id = 3128, range = 750, reqTarget = true, slot = nil },
  471.         HGB = { id = 3146, range = 400, reqTarget = true, slot = nil },
  472.         RSH = { id = 3074, range = 350, reqTarget = false, slot = nil },
  473.         STD = { id = 3131, range = 350, reqTarget = false, slot = nil },
  474.         TMT = { id = 3077, range = 350, reqTarget = false, slot = nil },
  475.         YGB = { id = 3142, range = 350, reqTarget = false, slot = nil },
  476.         BFT = { id = 3188, range = 750, reqTarget = true, slot = nil },
  477.         RND = { id = 3143, range = 275, reqTarget = false, slot = nil }
  478.     }
  479.    
  480.     if not TwistedTreeline then
  481.         JungleMobNames = {
  482.             ["SRU_MurkwolfMini2.1.3"]   = true,
  483.             ["SRU_MurkwolfMini2.1.2"]   = true,
  484.             ["SRU_MurkwolfMini8.1.3"]   = true,
  485.             ["SRU_MurkwolfMini8.1.2"]   = true,
  486.             ["SRU_BlueMini1.1.2"]       = true,
  487.             ["SRU_BlueMini7.1.2"]       = true,
  488.             ["SRU_BlueMini21.1.3"]      = true,
  489.             ["SRU_BlueMini27.1.3"]      = true,
  490.             ["SRU_RedMini10.1.2"]       = true,
  491.             ["SRU_RedMini10.1.3"]       = true,
  492.             ["SRU_RedMini4.1.2"]        = true,
  493.             ["SRU_RedMini4.1.3"]        = true,
  494.             ["SRU_KrugMini11.1.1"]      = true,
  495.             ["SRU_KrugMini5.1.1"]       = true,
  496.             ["SRU_RazorbeakMini9.1.2"]  = true,
  497.             ["SRU_RazorbeakMini9.1.3"]  = true,
  498.             ["SRU_RazorbeakMini9.1.4"]  = true,
  499.             ["SRU_RazorbeakMini3.1.2"]  = true,
  500.             ["SRU_RazorbeakMini3.1.3"]  = true,
  501.             ["SRU_RazorbeakMini3.1.4"]  = true
  502.         }
  503.        
  504.         FocusJungleNames = {
  505.             ["SRU_Blue1.1.1"]           = true,
  506.             ["SRU_Blue7.1.1"]           = true,
  507.             ["SRU_Murkwolf2.1.1"]       = true,
  508.             ["SRU_Murkwolf8.1.1"]       = true,
  509.             ["SRU_Gromp13.1.1"]         = true,
  510.             ["SRU_Gromp14.1.1"]         = true,
  511.             ["Sru_Crab16.1.1"]          = true,
  512.             ["Sru_Crab15.1.1"]          = true,
  513.             ["SRU_Red10.1.1"]           = true,
  514.             ["SRU_Red4.1.1"]            = true,
  515.             ["SRU_Krug11.1.2"]          = true,
  516.             ["SRU_Krug5.1.2"]           = true,
  517.             ["SRU_Razorbeak9.1.1"]      = true,
  518.             ["SRU_Razorbeak3.1.1"]      = true,
  519.             ["SRU_Dragon6.1.1"]         = true,
  520.             ["SRU_Baron12.1.1"]         = true
  521.         }
  522.     else
  523.         FocusJungleNames = {
  524.             ["TT_NWraith1.1.1"]         = true,
  525.             ["TT_NGolem2.1.1"]          = true,
  526.             ["TT_NWolf3.1.1"]           = true,
  527.             ["TT_NWraith4.1.1"]         = true,
  528.             ["TT_NGolem5.1.1"]          = true,
  529.             ["TT_NWolf6.1.1"]           = true,
  530.             ["TT_Spiderboss8.1.1"]      = true
  531.         }      
  532.         JungleMobNames = {
  533.             ["TT_NWraith21.1.2"]        = true,
  534.             ["TT_NWraith21.1.3"]        = true,
  535.             ["TT_NGolem22.1.2"]         = true,
  536.             ["TT_NWolf23.1.2"]          = true,
  537.             ["TT_NWolf23.1.3"]          = true,
  538.             ["TT_NWraith24.1.2"]        = true,
  539.             ["TT_NWraith24.1.3"]        = true,
  540.             ["TT_NGolem25.1.1"]         = true,
  541.             ["TT_NWolf26.1.2"]          = true,
  542.             ["TT_NWolf26.1.3"]          = true
  543.         }
  544.     end
  545.        
  546.     for i = 0, objManager.maxObjects do
  547.         local object = objManager:getObject(i)
  548.         if object and object.valid and not object.dead then
  549.             if FocusJungleNames[object.name] then
  550.                 JungleFocusMobs[#JungleFocusMobs+1] = object
  551.             elseif JungleMobNames[object.name] then
  552.                 JungleMobs[#JungleMobs+1] = object
  553.             end
  554.         end
  555.     end
  556. end
  557.  
  558. function SetPriority(table, hero, priority)
  559.     for i=1, #table, 1 do
  560.         if hero.charName:find(table[i]) ~= nil then
  561.             TS_SetHeroPriority(priority, hero.charName)
  562.         end
  563.     end
  564. end
  565.  
  566. function arrangePrioritys()
  567.         for i, enemy in ipairs(GetEnemyHeroes()) do
  568.         SetPriority(priorityTable.AD_Carry, enemy, 1)
  569.         SetPriority(priorityTable.AP,      enemy, 2)
  570.         SetPriority(priorityTable.Support,  enemy, 3)
  571.         SetPriority(priorityTable.Bruiser,  enemy, 4)
  572.         SetPriority(priorityTable.Tank,  enemy, 5)
  573.         end
  574. end
  575.  
  576. function arrangePrioritysTT()
  577.         for i, enemy in ipairs(GetEnemyHeroes()) do
  578.         SetPriority(priorityTable.AD_Carry, enemy, 1)
  579.         SetPriority(priorityTable.AP,       enemy, 1)
  580.         SetPriority(priorityTable.Support,  enemy, 2)
  581.         SetPriority(priorityTable.Bruiser,  enemy, 2)
  582.         SetPriority(priorityTable.Tank,     enemy, 3)
  583.         end
  584. end
  585.  
  586. function UseItems(unit)
  587.     if unit ~= nil then
  588.         for _, item in pairs(Items) do
  589.             item.slot = GetInventorySlotItem(item.id)
  590.             if item.slot ~= nil then
  591.                 if item.reqTarget and GetDistance(unit) < item.range then
  592.                     CastSpell(item.slot, unit)
  593.                 elseif not item.reqTarget then
  594.                     if (GetDistance(unit) - getHitBoxRadius(myHero) - getHitBoxRadius(unit)) < 50 then
  595.                         CastSpell(item.slot)
  596.                     end
  597.                 end
  598.             end
  599.         end
  600.     end
  601. end
  602.  
  603. function getHitBoxRadius(target)
  604.     return GetDistance(target.minBBox, target.maxBBox)/2
  605. end
  606.  
  607. function PriorityOnLoad()
  608.     if heroManager.iCount < 10 or (TwistedTreeline and heroManager.iCount < 6) then
  609.         print("<b><font color=\"#6699FF\">Ahri - the Nine-Tailed Fox:</font></b> <font color=\"#FFFFFF\">Too few champions to arrange priority.</font>")
  610.     elseif heroManager.iCount == 6 then
  611.         arrangePrioritysTT()
  612.     else
  613.         arrangePrioritys()
  614.     end
  615. end
  616.  
  617. function GetJungleMob()
  618.     for _, Mob in pairs(JungleFocusMobs) do
  619.         if ValidTarget(Mob, SkillQ.range) then return Mob end
  620.     end
  621.     for _, Mob in pairs(JungleMobs) do
  622.         if ValidTarget(Mob, SkillQ.range) then return Mob end
  623.     end
  624. end
  625.  
  626. function OnCreateObj(obj)
  627.     if obj.valid then
  628.         if FocusJungleNames[obj.name] then
  629.             JungleFocusMobs[#JungleFocusMobs+1] = obj
  630.         elseif JungleMobNames[obj.name] then
  631.             JungleMobs[#JungleMobs+1] = obj
  632.         end
  633.     end
  634. end
  635.  
  636. function OnDeleteObj(obj)
  637.     for i, Mob in pairs(JungleMobs) do
  638.         if obj.name == Mob.name then
  639.             table.remove(JungleMobs, i)
  640.         end
  641.     end
  642.     for i, Mob in pairs(JungleFocusMobs) do
  643.         if obj.name == Mob.name then
  644.             table.remove(JungleFocusMobs, i)
  645.         end
  646.     end
  647. end
  648.  
  649. function TrueRange()
  650.     return myHero.range + GetDistance(myHero, myHero.minBBox)
  651. end
  652.  
  653. -- Trees
  654. function GetCustomTarget()
  655.     TargetSelector:update()    
  656.     if _G.MMA_Target and _G.MMA_Target.type == myHero.type then return _G.MMA_Target end
  657.     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 return _G.AutoCarry.Attack_Crosshair.target end
  658.     return TargetSelector.target
  659. end
  660.  
  661. -- shalzuth
  662. function GenModelPacket(champ, skinId)
  663.     p = CLoLPacket(0x97)
  664.     p:EncodeF(myHero.networkID)
  665.     p.pos = 1
  666.     t1 = p:Decode1()
  667.     t2 = p:Decode1()
  668.     t3 = p:Decode1()
  669.     t4 = p:Decode1()
  670.     p:Encode1(t1)
  671.     p:Encode1(t2)
  672.     p:Encode1(t3)
  673.     p:Encode1(bit32.band(t4,0xB))
  674.     p:Encode1(1)--hardcode 1 bitfield
  675.     p:Encode4(skinId)
  676.     for i = 1, #champ do
  677.         p:Encode1(string.byte(champ:sub(i,i)))
  678.     end
  679.     for i = #champ + 1, 64 do
  680.         p:Encode1(0)
  681.     end
  682.     p:Hide()
  683.     RecvPacket(p)
  684. end
  685.  
  686. function ChooseSkin()
  687.     if Settings.misc.skinList ~= lastSkin then
  688.         lastSkin = Settings.misc.skinList
  689.         GenModelPacket("Ahri", Settings.misc.skinList)
  690.     end
  691. end
  692.  
  693. function GetBestLineFarmPosition(range, width, objects)
  694.     local BestPos
  695.     local BestHit = 0
  696.     for i, object in ipairs(objects) do
  697.         local EndPos = Vector(myHero.visionPos) + range * (Vector(object) - Vector(myHero.visionPos)):normalized()
  698.         local hit = CountObjectsOnLineSegment(myHero.visionPos, EndPos, width, objects)
  699.         if hit > BestHit then
  700.             BestHit = hit
  701.             BestPos = Vector(object)
  702.             if BestHit == #objects then
  703.                break
  704.             end
  705.          end
  706.     end
  707.  
  708.     return BestPos, BestHit
  709. end
  710.  
  711. function CountObjectsOnLineSegment(StartPos, EndPos, width, objects)
  712.     local n = 0
  713.     for i, object in ipairs(objects) do
  714.         local pointSegment, pointLine, isOnSegment = VectorPointProjectionOnLineSegment(StartPos, EndPos, object)
  715.         if isOnSegment and GetDistanceSqr(pointSegment, object) < width * width then
  716.             n = n + 1
  717.         end
  718.     end
  719.  
  720.     return n
  721. end
  722.  
  723. -- Barasia, vadash, viseversa
  724. function DrawCircleNextLvl(x, y, z, radius, width, color, chordlength)
  725.   radius = radius or 300
  726.   quality = math.max(8,round(180/math.deg((math.asin((chordlength/(2*radius)))))))
  727.   quality = 2 * math.pi / quality
  728.   radius = radius*.92
  729.  
  730.   local points = {}
  731.   for theta = 0, 2 * math.pi + quality, quality do
  732.     local c = WorldToScreen(D3DXVECTOR3(x + radius * math.cos(theta), y, z - radius * math.sin(theta)))
  733.     points[#points + 1] = D3DXVECTOR2(c.x, c.y)
  734.   end
  735.  
  736.   DrawLines2(points, width or 1, color or 4294967295)
  737. end
  738.  
  739. function round(num)
  740.   if num >= 0 then return math.floor(num+.5) else return math.ceil(num-.5) end
  741. end
  742.  
  743. function DrawCircle2(x, y, z, radius, color)
  744.   local vPos1 = Vector(x, y, z)
  745.   local vPos2 = Vector(cameraPos.x, cameraPos.y, cameraPos.z)
  746.   local tPos = vPos1 - (vPos1 - vPos2):normalized() * radius
  747.   local sPos = WorldToScreen(D3DXVECTOR3(tPos.x, tPos.y, tPos.z))
  748.  
  749.   if OnScreen({ x = sPos.x, y = sPos.y }, { x = sPos.x, y = sPos.y }) then
  750.     DrawCircleNextLvl(x, y, z, radius, Settings.drawing.lfc.Width, color, Settings.drawing.lfc.CL)
  751.   end
  752. end
Advertisement
Add Comment
Please, Sign In to add comment