naturus

corki

Dec 23rd, 2014
457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 24.72 KB | None | 0 0
  1. local version = "1.091"
  2.  
  3. --[[
  4.     Corki - Daring Bombardier
  5.         Author: Draconis
  6.         Version: 1.091
  7.         Copyright 2014
  8.            
  9.     Dependency: Standalone
  10. --]]
  11.  
  12. if myHero.charName ~= "Corki" then return end
  13.  
  14. _G.UseUpdater = true
  15.  
  16. local REQUIRED_LIBS = {
  17.     ["SxOrbwalk"] = "https://raw.githubusercontent.com/Superx321/BoL/master/common/SxOrbWalk.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\">Corki - Daring Bombardier:</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 = "Corki - Daring Bombardier"
  44. local UPDATE_HOST = "raw.github.com"
  45. local UPDATE_PATH = "/DraconisBoL/BoL/master/Corki%20-%20Daring%20Bombardier.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\">Corki - Daring Bombardier:</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.     end
  133. end
  134.  
  135. ------------------------------------------------------
  136. --           Functions             
  137. ------------------------------------------------------
  138.  
  139. function Combo(unit)
  140.     if ValidTarget(unit) and unit ~= nil and unit.type == myHero.type then
  141.         if Settings.combo.comboItems then
  142.             UseItems(unit)
  143.         end
  144.        
  145.         CastW(unit)
  146.         CastQ(unit)
  147.         CastE(unit)
  148.         HandleRCast(unit)
  149.     end
  150. end
  151.  
  152. function Harass(unit)
  153.     if ValidTarget(unit) and unit ~= nil and unit.type == myHero.type and not IsMyManaLow() then
  154.         if Settings.harass.useQ then CastQ(unit) end
  155.         if Settings.harass.useR then HandleRCast(unit) end
  156.     end
  157. end
  158.  
  159. function LaneClear()
  160.     enemyMinions:update()
  161.     if LaneClearKey then
  162.         for i, minion in pairs(enemyMinions.objects) do
  163.             if ValidTarget(minion) and minion ~= nil then
  164.                 if Settings.lane.laneQ and GetDistance(minion) <= SkillQ.range and SkillQ.ready then
  165.                     local BestPos, BestHit = GetBestCircularFarmPosition(SkillQ.range, SkillQ.width, enemyMinions.objects)
  166.                         if BestPos ~= nil then
  167.                             CastSpell(_Q, BestPos.x, BestPos.z)
  168.                         end
  169.                 end
  170.                
  171.                 if Settings.lane.laneR and GetDistance(minion) <= SkillR.range and SkillR.ready then
  172.                     CastSpell(_R, minion.x, minion.z)
  173.                 end
  174.             end      
  175.         end
  176.     end
  177. end
  178.  
  179. function JungleClear()
  180.     if Settings.jungle.jungleKey then
  181.         local JungleMob = GetJungleMob()
  182.        
  183.         if JungleMob ~= nil then
  184.             if Settings.jungle.jungleQ and GetDistance(JungleMob) <= SkillQ.range and SkillQ.ready then
  185.                 CastSpell(_Q, JungleMob.x, JungleMob.z)
  186.             end
  187.             if Settings.jungle.jungleR and GetDistance(JungleMob) <= SkillR.range and SkillR.ready then
  188.                 CastSpell(_R, JungleMob.x, JungleMob.z)
  189.             end
  190.         end
  191.     end
  192. end
  193.  
  194. function CastQ(unit)
  195.     if unit ~= nil and GetDistance(unit) <= SkillQ.range and SkillQ.ready then
  196.         local AOECastPosition, MainTargetHitChance, nTargets = VP:GetCircularAOECastPosition(unit, SkillQ.delay, SkillQ.width, SkillQ.range, SkillQ.speed, myHero)
  197.        
  198.         if MainTargetHitChance >= 2 then
  199.             CastSpell(_Q, AOECastPosition.x, AOECastPosition.z)
  200.         end
  201.     end
  202. end
  203.  
  204. function CastW(unit)
  205.     if unit ~= nil then
  206.         if SkillW.ready and GetDistance(unit) <= SkillW.range and Settings.combo.useW == 1 then
  207.             local Mouse = Vector(myHero) + 400 * (Vector(mousePos) - Vector(myHero)):normalized()
  208.             CastSpell(_W, Mouse.x, Mouse.z)
  209.         elseif SkillW.ready and GetDistance(unit) <= SkillW.range and Settings.combo.useW == 2 then
  210.             CastSpell(_W, unit.x, unit.z)
  211.         elseif Settings.combo.useW == 3 then
  212.             return
  213.         end
  214.     end
  215. end
  216.  
  217. function CastE(unit)
  218.     if unit ~= nil and SkillE.ready and GetDistance(unit) <= SkillE.range then
  219.         CastSpell(_E, unit.x, unit.z)
  220.     end
  221. end
  222.  
  223. function HandleRCast(unit)
  224.     if unit ~= nil and ValidTarget(unit) then
  225.         if TheBigOne == true then
  226.             CastR_TBO(unit)
  227.         else
  228.             CastR(unit)
  229.         end
  230.     end
  231. end
  232.  
  233. function CastR(unit)
  234.     if unit ~= nil and GetDistance(unit) <= SkillR.range and SkillR.ready then
  235.         local CastPosition,  HitChance,  Position = VP:GetLineCastPosition(unit, SkillR.delay, SkillR.width, SkillR.range, SkillR.speed, myHero, true)
  236.        
  237.         if HitChance >= 2 then
  238.             CastSpell(_R, CastPosition.x, CastPosition.z)
  239.         end
  240.     end
  241. end
  242.  
  243. function CastR_TBO(unit)
  244.     if unit ~= nil and GetDistance(unit) <= SkillR.range and SkillR.ready then
  245.         local CastPosition,  HitChance,  Position = VP:GetLineCastPosition(unit, SkillR.delay, SkillR.width*2, SkillR.range, SkillR.speed, myHero, true)
  246.        
  247.         if HitChance >= 2 then
  248.             CastSpell(_R, CastPosition.x, CastPosition.z)
  249.         end
  250.     end
  251. end
  252.  
  253. function KillSteal()
  254.     for _, enemy in ipairs(GetEnemyHeroes()) do
  255.         if ValidTarget(enemy) and enemy.visible then
  256.             local qDmg = getDmg("Q", enemy, myHero)
  257.             local rDmg = getDmg("R", enemy, myHero)
  258.            
  259.             if enemy.health <= qDmg then
  260.                 CastQ(enemy)
  261.             elseif enemy.health <= (qDmg + rDmg) and GetDistance(enemy) <= SkillQ.range then
  262.                 CastQ(enemy)
  263.                 HandleRCast(enemy)
  264.             elseif enemy.health <= rDmg then
  265.                 HandleRCast(enemy)
  266.             end
  267.  
  268.             if Settings.ks.autoIgnite then
  269.                 AutoIgnite(enemy)
  270.             end
  271.         end
  272.     end
  273. end
  274.  
  275. function AutoIgnite(unit)
  276.     if ValidTarget(unit, Ignite.range) and unit.health <= 50 + (20 * myHero.level) then
  277.         if Ignite.ready then
  278.             CastSpell(Ignite.slot, unit)
  279.         end
  280.     end
  281. end
  282.  
  283. ------------------------------------------------------
  284. --           Checks, menu & stuff              
  285. ------------------------------------------------------
  286.  
  287. function Checks()
  288.     SkillQ.ready = (myHero:CanUseSpell(_Q) == READY)
  289.     SkillW.ready = (myHero:CanUseSpell(_W) == READY)
  290.     SkillE.ready = (myHero:CanUseSpell(_E) == READY)
  291.     SkillR.ready = (myHero:CanUseSpell(_R) == READY)
  292.    
  293.     if myHero:GetSpellData(SUMMONER_1).name:find(Ignite.name) then
  294.         Ignite.slot = SUMMONER_1
  295.     elseif myHero:GetSpellData(SUMMONER_2).name:find(Ignite.name) then
  296.         Ignite.slot = SUMMONER_2
  297.     end
  298.    
  299.     Ignite.ready = (Ignite.slot ~= nil and myHero:CanUseSpell(Ignite.slot) == READY)
  300.    
  301.     TargetSelector:update()
  302.     Target = GetCustomTarget()
  303.     SxOrb:ForceTarget(Target)
  304.    
  305.     --if VIP_USER and Settings.misc.skinList then ChooseSkin() end
  306.     if Settings.drawing.lfc.lfc then _G.DrawCircle = DrawCircle2 else _G.DrawCircle = _G.oldDrawCircle end
  307.    
  308.     if TargetHaveBuff("mbcheck2", myHero) then TheBigOne = true else TheBigOne = false end
  309. end
  310.  
  311. function IsMyManaLow()
  312.     if myHero.mana < (myHero.maxMana * ( Settings.harass.harassMana / 100)) then
  313.         return true
  314.     else
  315.         return false
  316.     end
  317. end
  318.  
  319. function Menu()
  320.     Settings = scriptConfig("Corki - Daring Bombardier "..version.."", "DraconisCorki")
  321.    
  322.     Settings:addSubMenu("["..myHero.charName.."] - Combo Settings", "combo")
  323.         Settings.combo:addParam("comboKey", "Combo Key", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  324.         Settings.combo:addParam("useW", "Use "..SkillW.name.." (W) in Combo", SCRIPT_PARAM_LIST, 1, { "To mouse", "Toward enemy", "Don't use"})
  325.         Settings.combo:addParam("comboItems", "Use Items in Combo", SCRIPT_PARAM_ONOFF, true)
  326.         Settings.combo:permaShow("comboKey")
  327.    
  328.     Settings:addSubMenu("["..myHero.charName.."] - Harass Settings", "harass")
  329.         Settings.harass:addParam("harassKey", "Harass Key", SCRIPT_PARAM_ONKEYDOWN, false, GetKey("C"))
  330.         Settings.harass:addParam("useQ", "Use "..SkillQ.name.." (Q) in Harass", SCRIPT_PARAM_ONOFF, true)
  331.         Settings.harass:addParam("useR", "Use "..SkillR.name.." (R) in Harass", SCRIPT_PARAM_ONOFF, true)
  332.         Settings.harass:addParam("harassMana", "Min. Mana Percent: ", SCRIPT_PARAM_SLICE, 50, 0, 100, 0)
  333.         Settings.harass:permaShow("harassKey")
  334.        
  335.     Settings:addSubMenu("["..myHero.charName.."] - Lane Clear Settings", "lane")
  336.         Settings.lane:addParam("laneKey", "Lane Clear Key", SCRIPT_PARAM_ONKEYDOWN, false, GetKey("V"))
  337.         Settings.lane:addParam("laneQ", "Clear with "..SkillQ.name.." (Q)", SCRIPT_PARAM_ONOFF, true)
  338.         Settings.lane:addParam("laneR", "Clear with "..SkillR.name.." (R)", SCRIPT_PARAM_ONOFF, true)
  339.         Settings.lane:permaShow("laneKey")
  340.        
  341.     Settings:addSubMenu("["..myHero.charName.."] - Jungle Clear Settings", "jungle")
  342.         Settings.jungle:addParam("jungleKey", "Jungle Clear Key", SCRIPT_PARAM_ONKEYDOWN, false, GetKey("V"))
  343.         Settings.jungle:addParam("jungleQ", "Clear with "..SkillQ.name.." (Q)", SCRIPT_PARAM_ONOFF, true)
  344.         Settings.jungle:addParam("jungleR", "Clear with "..SkillR.name.." (R)", SCRIPT_PARAM_ONOFF, true)
  345.         Settings.jungle:permaShow("jungleKey")
  346.        
  347.     Settings:addSubMenu("["..myHero.charName.."] - KillSteal Settings", "ks")
  348.         Settings.ks:addParam("killSteal", "Use Smart Kill Steal", SCRIPT_PARAM_ONOFF, true)
  349.         Settings.ks:addParam("autoIgnite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
  350.         Settings.ks:permaShow("killSteal")
  351.            
  352.     Settings:addSubMenu("["..myHero.charName.."] - Draw Settings", "drawing")  
  353.         Settings.drawing:addParam("mDraw", "Disable All Range Draws", SCRIPT_PARAM_ONOFF, false)
  354.         Settings.drawing:addParam("Target", "Draw Circle on Target", SCRIPT_PARAM_ONOFF, true)
  355.         Settings.drawing:addParam("Text", "Draw Text on Target", SCRIPT_PARAM_ONOFF, true)
  356.         Settings.drawing:addParam("myHero", "Draw My Range", SCRIPT_PARAM_ONOFF, true)
  357.         Settings.drawing:addParam("myColor", "Draw My Range Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  358.         Settings.drawing:addParam("qDraw", "Draw "..SkillQ.name.." (Q) Range", SCRIPT_PARAM_ONOFF, true)
  359.         Settings.drawing:addParam("qColor", "Draw "..SkillQ.name.." (Q) Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  360.         Settings.drawing:addParam("wDraw", "Draw "..SkillW.name.." (W) Range", SCRIPT_PARAM_ONOFF, true)
  361.         Settings.drawing:addParam("wColor", "Draw "..SkillW.name.." (W) Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  362.         Settings.drawing:addParam("eDraw", "Draw "..SkillE.name.." (E) Range", SCRIPT_PARAM_ONOFF, true)
  363.         Settings.drawing:addParam("eColor", "Draw "..SkillE.name.." (E) Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  364.         Settings.drawing:addParam("rDraw", "Draw "..SkillR.name.." (R) Range", SCRIPT_PARAM_ONOFF, true)
  365.         Settings.drawing:addParam("rColor", "Draw "..SkillR.name.." (R) Color", SCRIPT_PARAM_COLOR, {255, 74, 26, 255})
  366.        
  367.         Settings.drawing:addSubMenu("Lag Free Circles", "lfc") 
  368.             Settings.drawing.lfc:addParam("lfc", "Lag Free Circles", SCRIPT_PARAM_ONOFF, false)
  369.             Settings.drawing.lfc:addParam("CL", "Quality", 4, 75, 75, 2000, 0)
  370.             Settings.drawing.lfc:addParam("Width", "Width", 4, 1, 1, 10, 0)
  371.    
  372.     Settings:addSubMenu("["..myHero.charName.."] - Misc Settings", "misc")
  373.         Settings.misc:addParam("skinList", "Choose your skin", SCRIPT_PARAM_LIST, 8, { "UFO", "Ice Toboggan", "Red Baron", "Hot Rod", "Urfrider", "Dragonwing", "Fnatic", "Classic" })
  374.  
  375.    
  376.     Settings:addSubMenu("["..myHero.charName.."] - Orbwalking Settings", "Orbwalking")
  377.         SxOrb:LoadToMenu(Settings.Orbwalking)
  378.    
  379.     TargetSelector = TargetSelector(TARGET_LESS_CAST, SkillR.range, DAMAGE_PHYSICAL, true)
  380.     TargetSelector.name = "Corki"
  381.     Settings:addTS(TargetSelector)
  382. end
  383.  
  384. function Variables()
  385.     SkillQ = { name = "Phosphorus Bomb", range = 825, delay = 0.5, speed = 1125, width = 450, ready = false }
  386.     SkillW = { name = "Valkyrie", range = 800, delay = nil, speed = nil, width = nil, ready = false }
  387.     SkillE = { name = "Gatling Gun", range = 600, delay = nil, speed = nil, width = nil, ready = false }
  388.     SkillR = { name = "Missile Barrage", range = 1225, delay = 0.25, speed = 2000, width = 75, ready = false }
  389.     Ignite = { name = "summonerdot", range = 600, slot = nil }
  390.    
  391.     enemyMinions = minionManager(MINION_ENEMY, SkillR.range, myHero, MINION_SORT_HEALTH_ASC)
  392.    
  393.     VP = VPrediction()
  394.    
  395.     JungleMobs = {}
  396.     JungleFocusMobs = {}
  397.    
  398.     lastSkin = 0
  399.    
  400.     TheBigOne = false
  401.    
  402.     if GetGame().map.shortName == "twistedTreeline" then
  403.         TwistedTreeline = true
  404.     else
  405.         TwistedTreeline = false
  406.     end
  407.    
  408.     _G.oldDrawCircle = rawget(_G, 'DrawCircle')
  409.     _G.DrawCircle = DrawCircle2
  410.    
  411.     priorityTable = {
  412.             AP = {
  413.                 "Annie", "Ahri", "Akali", "Anivia", "Annie", "Brand", "Cassiopeia", "Diana", "Evelynn", "FiddleSticks", "Fizz", "Gragas", "Heimerdinger", "Karthus",
  414.                 "Kassadin", "Katarina", "Kayle", "Kennen", "Leblanc", "Lissandra", "Lux", "Malzahar", "Mordekaiser", "Morgana", "Nidalee", "Orianna",
  415.                 "Ryze", "Sion", "Swain", "Syndra", "Teemo", "TwistedFate", "Veigar", "Viktor", "Vladimir", "Xerath", "Ziggs", "Zyra", "Velkoz"
  416.             },
  417.            
  418.             Support = {
  419.                 "Alistar", "Blitzcrank", "Janna", "Karma", "Leona", "Lulu", "Nami", "Nunu", "Sona", "Soraka", "Taric", "Thresh", "Zilean", "Braum"
  420.             },
  421.            
  422.             Tank = {
  423.                 "Amumu", "Chogath", "DrMundo", "Galio", "Hecarim", "Malphite", "Maokai", "Nasus", "Rammus", "Sejuani", "Nautilus", "Shen", "Singed", "Skarner", "Volibear",
  424.                 "Warwick", "Yorick", "Zac"
  425.             },
  426.            
  427.             AD_Carry = {
  428.                 "Ashe", "Caitlyn", "Corki", "Draven", "Ezreal", "Graves", "Jayce", "Jinx", "KogMaw", "Lucian", "MasterYi", "MissFortune", "Pantheon", "Quinn", "Shaco", "Sivir",
  429.                 "Talon","Tryndamere", "Tristana", "Twitch", "Urgot", "Varus", "Vayne", "Yasuo", "Zed"
  430.             },
  431.            
  432.             Bruiser = {
  433.                 "Aatrox", "Darius", "Elise", "Fiora", "Gangplank", "Garen", "Irelia", "JarvanIV", "Jax", "Khazix", "LeeSin", "Nocturne", "Olaf", "Poppy",
  434.                 "Renekton", "Rengar", "Riven", "Rumble", "Shyvana", "Trundle", "Udyr", "Vi", "MonkeyKing", "XinZhao"
  435.             }
  436.     }
  437.  
  438.     Items = {
  439.         BRK = { id = 3153, range = 450, reqTarget = true, slot = nil },
  440.         BWC = { id = 3144, range = 400, reqTarget = true, slot = nil },
  441.         DFG = { id = 3128, range = 750, reqTarget = true, slot = nil },
  442.         HGB = { id = 3146, range = 400, reqTarget = true, slot = nil },
  443.         RSH = { id = 3074, range = 350, reqTarget = false, slot = nil },
  444.         STD = { id = 3131, range = 350, reqTarget = false, slot = nil },
  445.         TMT = { id = 3077, range = 350, reqTarget = false, slot = nil },
  446.         YGB = { id = 3142, range = 350, reqTarget = false, slot = nil },
  447.         BFT = { id = 3188, range = 750, reqTarget = true, slot = nil },
  448.         RND = { id = 3143, range = 275, reqTarget = false, slot = nil }
  449.     }
  450.    
  451.     if not TwistedTreeline then
  452.         JungleMobNames = {
  453.             ["SRU_MurkwolfMini2.1.3"]   = true,
  454.             ["SRU_MurkwolfMini2.1.2"]   = true,
  455.             ["SRU_MurkwolfMini8.1.3"]   = true,
  456.             ["SRU_MurkwolfMini8.1.2"]   = true,
  457.             ["SRU_BlueMini1.1.2"]       = true,
  458.             ["SRU_BlueMini7.1.2"]       = true,
  459.             ["SRU_BlueMini21.1.3"]      = true,
  460.             ["SRU_BlueMini27.1.3"]      = true,
  461.             ["SRU_RedMini10.1.2"]       = true,
  462.             ["SRU_RedMini10.1.3"]       = true,
  463.             ["SRU_RedMini4.1.2"]        = true,
  464.             ["SRU_RedMini4.1.3"]        = true,
  465.             ["SRU_KrugMini11.1.1"]      = true,
  466.             ["SRU_KrugMini5.1.1"]       = true,
  467.             ["SRU_RazorbeakMini9.1.2"]  = true,
  468.             ["SRU_RazorbeakMini9.1.3"]  = true,
  469.             ["SRU_RazorbeakMini9.1.4"]  = true,
  470.             ["SRU_RazorbeakMini3.1.2"]  = true,
  471.             ["SRU_RazorbeakMini3.1.3"]  = true,
  472.             ["SRU_RazorbeakMini3.1.4"]  = true
  473.         }
  474.        
  475.         FocusJungleNames = {
  476.             ["SRU_Blue1.1.1"]           = true,
  477.             ["SRU_Blue7.1.1"]           = true,
  478.             ["SRU_Murkwolf2.1.1"]       = true,
  479.             ["SRU_Murkwolf8.1.1"]       = true,
  480.             ["SRU_Gromp13.1.1"]         = true,
  481.             ["SRU_Gromp14.1.1"]         = true,
  482.             ["Sru_Crab16.1.1"]          = true,
  483.             ["Sru_Crab15.1.1"]          = true,
  484.             ["SRU_Red10.1.1"]           = true,
  485.             ["SRU_Red4.1.1"]            = true,
  486.             ["SRU_Krug11.1.2"]          = true,
  487.             ["SRU_Krug5.1.2"]           = true,
  488.             ["SRU_Razorbeak9.1.1"]      = true,
  489.             ["SRU_Razorbeak3.1.1"]      = true,
  490.             ["SRU_Dragon6.1.1"]         = true,
  491.             ["SRU_Baron12.1.1"]         = true
  492.         }
  493.     else
  494.         FocusJungleNames = {
  495.             ["TT_NWraith1.1.1"]         = true,
  496.             ["TT_NGolem2.1.1"]          = true,
  497.             ["TT_NWolf3.1.1"]           = true,
  498.             ["TT_NWraith4.1.1"]         = true,
  499.             ["TT_NGolem5.1.1"]          = true,
  500.             ["TT_NWolf6.1.1"]           = true,
  501.             ["TT_Spiderboss8.1.1"]      = true
  502.         }      
  503.         JungleMobNames = {
  504.             ["TT_NWraith21.1.2"]        = true,
  505.             ["TT_NWraith21.1.3"]        = true,
  506.             ["TT_NGolem22.1.2"]         = true,
  507.             ["TT_NWolf23.1.2"]          = true,
  508.             ["TT_NWolf23.1.3"]          = true,
  509.             ["TT_NWraith24.1.2"]        = true,
  510.             ["TT_NWraith24.1.3"]        = true,
  511.             ["TT_NGolem25.1.1"]         = true,
  512.             ["TT_NWolf26.1.2"]          = true,
  513.             ["TT_NWolf26.1.3"]          = true
  514.         }
  515.     end
  516.        
  517.     for i = 0, objManager.maxObjects do
  518.         local object = objManager:getObject(i)
  519.         if object and object.valid and not object.dead then
  520.             if FocusJungleNames[object.name] then
  521.                 JungleFocusMobs[#JungleFocusMobs+1] = object
  522.             elseif JungleMobNames[object.name] then
  523.                 JungleMobs[#JungleMobs+1] = object
  524.             end
  525.         end
  526.     end
  527. end
  528.  
  529. function SetPriority(table, hero, priority)
  530.     for i=1, #table, 1 do
  531.         if hero.charName:find(table[i]) ~= nil then
  532.             TS_SetHeroPriority(priority, hero.charName)
  533.         end
  534.     end
  535. end
  536.  
  537. function arrangePrioritys()
  538.         for i, enemy in ipairs(GetEnemyHeroes()) do
  539.         SetPriority(priorityTable.AD_Carry, enemy, 1)
  540.         SetPriority(priorityTable.AP,      enemy, 2)
  541.         SetPriority(priorityTable.Support,  enemy, 3)
  542.         SetPriority(priorityTable.Bruiser,  enemy, 4)
  543.         SetPriority(priorityTable.Tank,  enemy, 5)
  544.         end
  545. end
  546.  
  547. function arrangePrioritysTT()
  548.         for i, enemy in ipairs(GetEnemyHeroes()) do
  549.         SetPriority(priorityTable.AD_Carry, enemy, 1)
  550.         SetPriority(priorityTable.AP,       enemy, 1)
  551.         SetPriority(priorityTable.Support,  enemy, 2)
  552.         SetPriority(priorityTable.Bruiser,  enemy, 2)
  553.         SetPriority(priorityTable.Tank,     enemy, 3)
  554.         end
  555. end
  556.  
  557. function UseItems(unit)
  558.     if unit ~= nil then
  559.         for _, item in pairs(Items) do
  560.             item.slot = GetInventorySlotItem(item.id)
  561.             if item.slot ~= nil then
  562.                 if item.reqTarget and GetDistance(unit) < item.range then
  563.                     CastSpell(item.slot, unit)
  564.                 elseif not item.reqTarget then
  565.                     if (GetDistance(unit) - getHitBoxRadius(myHero) - getHitBoxRadius(unit)) < 50 then
  566.                         CastSpell(item.slot)
  567.                     end
  568.                 end
  569.             end
  570.         end
  571.     end
  572. end
  573.  
  574. function getHitBoxRadius(target)
  575.     return GetDistance(target.minBBox, target.maxBBox)/2
  576. end
  577.  
  578. function PriorityOnLoad()
  579.     if heroManager.iCount < 10 or (TwistedTreeline and heroManager.iCount < 6) then
  580.         print("<b><font color=\"#6699FF\">Corki - Daring Bombardier:</font></b> <font color=\"#FFFFFF\">Too few champions to arrange priority.</font>")
  581.     elseif heroManager.iCount == 6 then
  582.         arrangePrioritysTT()
  583.     else
  584.         arrangePrioritys()
  585.     end
  586. end
  587.  
  588. function GetJungleMob()
  589.     for _, Mob in pairs(JungleFocusMobs) do
  590.         if ValidTarget(Mob, SkillR.range) then return Mob end
  591.     end
  592.     for _, Mob in pairs(JungleMobs) do
  593.         if ValidTarget(Mob, SkillR.range) then return Mob end
  594.     end
  595. end
  596.  
  597. function OnCreateObj(obj)
  598.     if obj.valid then
  599.         if FocusJungleNames[obj.name] then
  600.             JungleFocusMobs[#JungleFocusMobs+1] = obj
  601.         elseif JungleMobNames[obj.name] then
  602.             JungleMobs[#JungleMobs+1] = obj
  603.         end
  604.     end
  605. end
  606.  
  607. function OnDeleteObj(obj)
  608.     for i, Mob in pairs(JungleMobs) do
  609.         if obj.name == Mob.name then
  610.             table.remove(JungleMobs, i)
  611.         end
  612.     end
  613.     for i, Mob in pairs(JungleFocusMobs) do
  614.         if obj.name == Mob.name then
  615.             table.remove(JungleFocusMobs, i)
  616.         end
  617.     end
  618. end
  619.  
  620. function TrueRange()
  621.     return myHero.range + GetDistance(myHero, myHero.minBBox)
  622. end
  623.  
  624. -- Trees
  625. function GetCustomTarget()
  626.     TargetSelector:update()    
  627.     if _G.MMA_Target and _G.MMA_Target.type == myHero.type then return _G.MMA_Target end
  628.     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
  629.     return TargetSelector.target
  630. end
  631.  
  632. -- shalzuth
  633. function GenModelPacket(champ, skinId)
  634.     p = CLoLPacket(0x97)
  635.     p:EncodeF(myHero.networkID)
  636.     p.pos = 1
  637.     t1 = p:Decode1()
  638.     t2 = p:Decode1()
  639.     t3 = p:Decode1()
  640.     t4 = p:Decode1()
  641.     p:Encode1(t1)
  642.     p:Encode1(t2)
  643.     p:Encode1(t3)
  644.     p:Encode1(bit32.band(t4,0xB))
  645.     p:Encode1(1)--hardcode 1 bitfield
  646.     p:Encode4(skinId)
  647.     for i = 1, #champ do
  648.         p:Encode1(string.byte(champ:sub(i,i)))
  649.     end
  650.     for i = #champ + 1, 64 do
  651.         p:Encode1(0)
  652.     end
  653.     p:Hide()
  654.     RecvPacket(p)
  655. end
  656.  
  657. function ChooseSkin()
  658.     if Settings.misc.skinList ~= lastSkin then
  659.         lastSkin = Settings.misc.skinList
  660.         GenModelPacket("Corki", Settings.misc.skinList)
  661.     end
  662. end
  663.  
  664. function GetBestCircularFarmPosition(range, radius, objects)
  665.     local BestPos
  666.     local BestHit = 0
  667.     for i, object in ipairs(objects) do
  668.         local hit = CountObjectsNearPos(object.visionPos or object, range, radius, objects)
  669.         if hit > BestHit then
  670.             BestHit = hit
  671.             BestPos = Vector(object)
  672.             if BestHit == #objects then
  673.                break
  674.             end
  675.          end
  676.     end
  677.     return BestPos, BestHit
  678. end
  679.  
  680. function CountObjectsNearPos(pos, range, radius, objects)
  681.     local n = 0
  682.     for i, object in ipairs(objects) do
  683.         if GetDistance(pos, object) <= radius then
  684.             n = n + 1
  685.         end
  686.     end
  687.     return n
  688. end
  689.  
  690. -- Barasia, vadash, viseversa
  691. function DrawCircleNextLvl(x, y, z, radius, width, color, chordlength)
  692.   radius = radius or 300
  693.   quality = math.max(8,round(180/math.deg((math.asin((chordlength/(2*radius)))))))
  694.   quality = 2 * math.pi / quality
  695.   radius = radius*.92
  696.  
  697.   local points = {}
  698.   for theta = 0, 2 * math.pi + quality, quality do
  699.     local c = WorldToScreen(D3DXVECTOR3(x + radius * math.cos(theta), y, z - radius * math.sin(theta)))
  700.     points[#points + 1] = D3DXVECTOR2(c.x, c.y)
  701.   end
  702.  
  703.   DrawLines2(points, width or 1, color or 4294967295)
  704. end
  705.  
  706. function round(num)
  707.   if num >= 0 then return math.floor(num+.5) else return math.ceil(num-.5) end
  708. end
  709.  
  710. function DrawCircle2(x, y, z, radius, color)
  711.   local vPos1 = Vector(x, y, z)
  712.   local vPos2 = Vector(cameraPos.x, cameraPos.y, cameraPos.z)
  713.   local tPos = vPos1 - (vPos1 - vPos2):normalized() * radius
  714.   local sPos = WorldToScreen(D3DXVECTOR3(tPos.x, tPos.y, tPos.z))
  715.  
  716.   if OnScreen({ x = sPos.x, y = sPos.y }, { x = sPos.x, y = sPos.y }) then
  717.     DrawCircleNextLvl(x, y, z, radius, Settings.drawing.lfc.Width, color, Settings.drawing.lfc.CL)
  718.   end
  719. end
Advertisement
Add Comment
Please, Sign In to add comment