roach_

[1.0a] SidasAutoCarryPlugin - Blitzcrank

Oct 6th, 2013
1,204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.91 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Blitzcrank Edition
  4.         Author: Roach_
  5.         Version: 1.0a
  6.         Copyright 2013
  7.  
  8.         Dependency: Sida's Auto Carry: Revamped
  9.  
  10.         How to install:
  11.             Make sure you already have AutoCarry installed.
  12.             Name the script EXACTLY "SidasAutoCarryPlugin - Blitzcrank.lua" without the quotes.
  13.             Place the plugin in BoL/Scripts/Common folder.
  14.  
  15.         Features:
  16.             Combo with Autocarry
  17.             Fully supports Q with movement/attack disable
  18.             Killsteal with R
  19.             Stop enemy ultimates with R
  20.             Draw Q and R Range
  21.             Escape Artist(with Flash)
  22.  
  23.         History:
  24.             Version: 1.0a
  25.                 First release
  26. --]]
  27. if myHero.charName ~= "Blitzcrank" then return end
  28.  
  29. local Target
  30. local bEscapeHotkey = string.byte("T")
  31.  
  32. -- Prediction
  33. local aRange, qRange, rRange = 125, 1050, 600
  34.  
  35. local FlashSlot = nil
  36.  
  37. local bPred = nil
  38.  
  39. local SkillQ = {spellKey = _Q, range = qRange, speed = 1.8, delay = 0, width = 120, configName = "rocketGrab", displayName = "Q (Rocket Grab)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  40. local SkillW = {spellKey = _W, range = 0, speed = 2, delay = 0, width = 75, configName = "overdrive", displayName = "W (Overdrive)", enabled = true, skillShot = false, minions = false, reset = false, reqTarget = false }
  41. local SkillE = {spellKey = _E, range = eRange, speed = 2, delay = 0, width = 25, configName = "powerFist", displayName = "E (Power Fist)", enabled = true, skillShot = false, minions = false, reset = false, reqTarget = true }
  42.  
  43. local QReady, WReady, EReady, RReady, FlashReady = false, false, false, false, false
  44.  
  45. function PluginOnLoad()
  46.     -- Params
  47.     AutoCarry.PluginMenu:addParam("bCombo", "Use Combo With Auto Carry", SCRIPT_PARAM_ONOFF, true)
  48.     AutoCarry.PluginMenu:addParam("bWC", "Use W in Combo", SCRIPT_PARAM_ONOFF, false)
  49.     AutoCarry.PluginMenu:addParam("bUltSilence", "Silence Enemy Ultimates", SCRIPT_PARAM_ONOFF, false)
  50.     AutoCarry.PluginMenu:addParam("bKillsteal", "Killsteal with Ultimate", SCRIPT_PARAM_ONOFF, true)
  51.     AutoCarry.PluginMenu:addParam("bDQR", "Draw Q Range", SCRIPT_PARAM_ONOFF, true)
  52.     AutoCarry.PluginMenu:addParam("bDRR", "Draw Ultimate Range", SCRIPT_PARAM_ONOFF, false)
  53.     AutoCarry.PluginMenu:addParam("bEscape", "Escape Artist", SCRIPT_PARAM_ONKEYDOWN, false, bEscapeHotkey)
  54.     AutoCarry.PluginMenu:addParam("bEscapeFlash", "Escape: Flash to Mouse", SCRIPT_PARAM_ONOFF, false)
  55.    
  56.     -- Range
  57.     AutoCarry.SkillsCrosshair.range = qRange
  58.    
  59.     lastAnimation = nil
  60. end
  61.  
  62.  
  63. function PluginOnTick()
  64.     -- Get Attack Target
  65.     Target = AutoCarry.GetAttackTarget()
  66.    
  67.     -- Prediction
  68.     if ValidTarget(Target) then
  69.         travelDuration = (SkillQ.delay + GetDistance(myHero, Target)/SkillQ.speed)
  70.         Target:SetPrediction(travelDuration)
  71.         bPred = Target.nextPosition
  72.     end
  73.  
  74.     -- Check Spells
  75.     bSpellCheck()
  76.  
  77.     -- Check if myHero is using _Q
  78.     if isChanneling("Spell1") then
  79.         AutoCarry.CanAttack = false
  80.         AutoCarry.CanMove = false
  81.     else
  82.         AutoCarry.CanAttack = true
  83.         AutoCarry.CanMove = true
  84.     end
  85.  
  86.     -- Combo, Ultimate Silence, Killsteal, Escape Combo - Checks
  87.     if AutoCarry.PluginMenu.bCombo and AutoCarry.MainMenu.AutoCarry then bCombo() end
  88.     if AutoCarry.PluginMenu.bUltSilence then bUltCombo() end
  89.     if AutoCarry.PluginMenu.bKillsteal then bKillsteal() end
  90.     if AutoCarry.PluginMenu.bEscape then bEscapeCombo() end
  91. end
  92.  
  93. function PluginOnDraw()
  94.     -- Draw Blitzcrank's Ranges = 1050, 600
  95.     if not myHero.dead and AutoCarry.PluginMenu.bDQR then
  96.         DrawCircle(myHero.x, myHero.y, myHero.z, qRange, 0x00FF00)
  97.     end
  98.     if not myHero.dead and AutoCarry.PluginMenu.bDRR then
  99.         DrawCircle(myHero.x, myHero.y, myHero.z, rRange, 0xFF0000)
  100.     end
  101. end
  102.  
  103. function PluginOnAnimation(unit, animationName)
  104.     -- Set lastAnimation = Last Animation used
  105.     if unit.isMe and lastAnimation ~= animationName then lastAnimation = animationName end
  106.    
  107.     if AutoCarry.PluginMenu.bUltSilence and ValidTarget(unit) and unit.team == TEAM_ENEMY and RReady and GetDistance(unit) <= (rRange-10) then
  108.         if spell.name == "KatarinaR"                or  spell.name == "GalioIdolOfDurand"           or  spell.name == "Crowstorm"           or  spell.name == "DrainChannel"
  109.         or spell.name == "AbsoluteZero"             or  spell.name == "ShenStandUnited"             or  spell.name == "UrgotSwap2"          or  spell.name =="AlZaharNetherGrasp"
  110.         or spell.name == "FallenOne"                or  spell.name == "Pantheon_GrandSkyfall_Jump"  or  spell.name == "CaitlynAceintheHole" or  spell.name == "MissFortuneBulletTime"
  111.         or spell.name == "InfiniteDuress"           or  spell.name == "Teleport"                    or  spell.name == "Meditate" then
  112.             CastSpell(_R, unit)
  113.         end
  114.     end
  115. end
  116.  
  117. -- Custom Functions
  118. function bCombo()
  119.     if ValidTarget(Target) then
  120.         if QReady and bPred ~= nil and GetDistance(bPred) < (qRange-10) and not minionCollision(bPred, SkillQ.width, qRange) then
  121.             AutoCarry.CastSkillshot(SkillQ.spellKey, bPred.x, bPred.y)
  122.         end
  123.        
  124.         if WReady and AutoCarry.PluginMenu.bWC then
  125.             CastSpell(SkillW.spellKey)
  126.         end
  127.        
  128.         if EReady then
  129.             CastSpell(SkillE.spellKey)
  130.         end
  131.     end
  132. end
  133.  
  134. function bKillsteal()
  135.     for _, enemy in pairs(AutoCarry.EnemyTable) do
  136.         if ValidTarget(enemy) and GetDistance(enemy) < rRange and enemy.health < (getDmg("R", enemy, myHero)) then
  137.             CastSpell(_R)
  138.         end
  139.     end
  140. end
  141.  
  142. function bEscapeCombo()
  143.     if QReady and bPred ~= nil and GetDistance(bPred) < (qRange-10) and not minionCollision(bPred, SkillQ.width, qRange) then
  144.         AutoCarry.CastSkillshot(SkillQ.spellKey, bPred.x, bPred.y)
  145.         CastSpell(SkillE.spellKey)
  146.         if AutoCarry.PluginMenu.bEscapeFlash and FlashReady and GetDistance(mousePos) > 300 and isChanneling("Attack") then
  147.             CastSpell(FlashSlot, mousePos.x, mousePos.z)
  148.         end
  149.     end
  150.    
  151.     if AutoCarry.PluginMenu.bEscapeFlash then
  152.         myHero:MoveTo(mousePos.x, mousePos.z)
  153.     end
  154. end
  155.  
  156. function isChanneling(animationName)
  157.     if lastAnimation == animationName then
  158.         return true
  159.     else
  160.         return false
  161.     end
  162. end
  163.  
  164. function bSpellCheck()
  165.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerFlash") then
  166.         FlashSlot = SUMMONER_1
  167.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerFlash") then
  168.         FlashSlot = SUMMONER_2
  169.     end
  170.  
  171.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  172.     WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
  173.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  174.     RReady = (myHero:CanUseSpell(_R) == READY)
  175.  
  176.     FlashReady = (FlashSlot ~= nil and myHero:CanUseSpell(FlashSlot) == READY)
  177. end
  178.  
  179. function minionCollision(pred, width, range)
  180.     for _, minionObjectE in pairs(enemyMinions.objects) do
  181.         if bPred ~= nil and player:GetDistance(minionObjectE) < range then
  182.             ex = player.x
  183.             ez = player.z
  184.             tx = bPred.x
  185.             tz = bPred.z
  186.             dx = ex - tx
  187.             dz = ez - tz
  188.             if dx ~= 0 then
  189.                 m = dz/dx
  190.                 c = ez - m*ex
  191.             end
  192.             mx = minionObjectE.x
  193.             mz = minionObjectE.z
  194.             distanc = (math.abs(mz - m*mx - c))/(math.sqrt(m*m+1))
  195.             if distanc < width and math.sqrt((tx - ex)*(tx - ex) + (tz - ez)*(tz - ez)) > math.sqrt((tx - mx)*(tx - mx) + (tz - mz)*(tz - mz)) then
  196.                 return true
  197.             end
  198.         end
  199.     end
  200.     return false
  201. end
Advertisement
Add Comment
Please, Sign In to add comment