Kain2030

Auto Carry Plugin - Ziggs Edition - v1.01

Jul 9th, 2013
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.53 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Ziggs Edition
  4.         Author: Kain
  5.         Version: 1.01 Beta
  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 - Ziggs.lua" without the quotes.
  13.             Place the plugin in BoL/Scripts/Common folder.
  14. --]]
  15.  
  16. if myHero.charName ~= "Ziggs" then return end
  17.  
  18. local Target
  19.  
  20. -- Prediction
  21. -- local QRange = 850
  22. -- local QMaxRange = 1400
  23. local QRange = 1400
  24. local WRange = 1000
  25. local ERange = 900
  26. local RRange = 5300
  27.  
  28. local QSpeed = 1.2
  29. local WSpeed = 1.5
  30. local ESpeed = 1.45
  31. local RSpeed = 1.5
  32.  
  33. local QWidth = 150
  34. local WWidth = 225
  35. local EWidth = 250
  36. local RWidth = 550
  37.  
  38. local SkillQ = {spellKey = _Q, range = QRange, speed = QSpeed, delay = 0, width = QWidth, configName = "bouncingbomb", displayName = "Q (Bouncing Bomb)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  39. local SkillW = {spellKey = _W, range = WRange, speed = WSpeed, delay = 0, width = WWidth, configName = "satchelcharge", displayName = "W (Satchel Charge)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = false }
  40. local SkillE = {spellKey = _E, range = ERange, speed = ESpeed, delay = 0, width = EWidth, configName = "hexplosiveminefield", displayName = "E (Hexplosive Minefield)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = false }
  41. local SkillR = {spellKey = _R, range = RRange, speed = RSpeed, delay = 0, width = RWidth, configName = "megainfernobomb", displayName = "R (Mega Inferno Bomb)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  42.  
  43. AutoCarry.PluginMenu:addParam("combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  44. AutoCarry.PluginMenu:addParam("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("A"))
  45. AutoCarry.PluginMenu:addParam("ultimate", "Use Ultimate with Combo", SCRIPT_PARAM_ONOFF, true)
  46. AutoCarry.PluginMenu:addParam("killsteal", "Ultimate Mega Killsteal", SCRIPT_PARAM_ONOFF, true)
  47. AutoCarry.PluginMenu:addParam("drawkillableenemy", "Draw Killable Enemy", SCRIPT_PARAM_ONOFF, true)
  48. AutoCarry.PluginMenu:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  49. AutoCarry.PluginMenu:addParam("drawprediction", "Draw Prediction", SCRIPT_PARAM_ONOFF, true)
  50. AutoCarry.PluginMenu:addParam("draw", "Draw range circles", SCRIPT_PARAM_ONOFF, true)
  51. AutoCarry.PluginMenu:addParam("drawult", "Draw Ult range circle", SCRIPT_PARAM_ONOFF, true)
  52. AutoCarry.PluginMenu:addParam("hitChance", "Ziggs Ability Hitchance", SCRIPT_PARAM_SLICE, 70, 0, 100, 0)
  53.  
  54. local KeyQ = string.byte("Q")
  55. local KeyW = string.byte("W")
  56. local KeyE = string.byte("E")
  57. local KeyR = string.byte("R")
  58.  
  59. local tick = nil
  60. local doUlt = false
  61.  
  62. -- Draw
  63. local waittxt = {}
  64. local calculationenemy = 1
  65. local floattext = {"Skills not available", "Able to fight", "Killable", "Murder him!"}
  66. local killable = {}
  67.  
  68. local ignite = nil
  69. local DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil
  70. local QReady, WReady, EReady, RReady, DFGReady, HXGReady, BWCReady, IReady = false, false, false, false, false, false, false, false
  71.  
  72. -- Main
  73. function PluginOnLoad()
  74.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  75.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end
  76.     for i=1, heroManager.iCount do waittxt[i] = i*3 end
  77. end
  78.  
  79. function PluginOnTick()
  80.     Target = AutoCarry.GetAttackTarget()
  81.    
  82.     SpellCheck()
  83.  
  84.     if tick == nil or GetTickCount()-tick >= 200 then
  85.         tick = GetTickCount()
  86.         CalculateDamage()
  87.     end
  88.  
  89.     if AutoCarry.PluginMenu.combo then
  90.         Combo()
  91.     end
  92.  
  93.     if AutoCarry.PluginMenu.harass then
  94.         Harass()
  95.     end
  96.  
  97.     if AutoCarry.PluginMenu.killsteal then
  98.         KillSteal()
  99.     end
  100. end
  101.  
  102. function SpellCheck()
  103.     DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3128),
  104.     GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057),
  105.     GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  106.  
  107.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  108.     WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
  109.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  110.     RReady = (myHero:CanUseSpell(SkillR.spellKey) == READY)
  111.  
  112.     DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  113.     HXGReady = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  114.     BWCReady = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  115.     IReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  116. end
  117.  
  118. -- Handle SBTW Skill Shots
  119.  
  120. function Combo()
  121.     CastSlots()
  122.     CastE()
  123.     CastQ()
  124.     CastW()
  125.     if AutoCarry.PluginMenu.ultimate and doUlt then
  126.         CastR()
  127.     end
  128. end
  129.  
  130. function CastSlots()
  131.     if Target ~= nil then
  132.         if GetDistance(Target) < QRange then
  133.             if DFGReady then CastSpell(DFGSlot, Target) end
  134.             if HXGReady then CastSpell(HXGSlot, Target) end
  135.             if BWCReady then CastSpell(BWCSlot, Target) end
  136.         end
  137.     end
  138. end
  139.  
  140. function Harass()
  141.     CastQ()
  142. end
  143.  
  144. function CastQ()
  145.     if Target ~= nil then
  146.         if QReady and GetDistance(Target) < QRange then
  147.                 CastSkillshot(SkillQ, Target)
  148.         end
  149.     end
  150. end
  151.  
  152. function CastW()
  153.     if Target ~= nil then
  154.         if WReady and GetDistance(Target) < WRange then
  155.             CastSkillshot(SkillW, Target)
  156.         end
  157.     end
  158. end
  159.  
  160. function CastE()
  161.     if Target ~= nil then
  162.         if EReady and GetDistance(Target) < ERange then
  163.             CastSkillshot(SkillE, Target)
  164.         end
  165.     end
  166. end
  167.  
  168. function CastR()
  169.     if Target ~= nil then
  170.         if RReady and GetDistance(Target) < RRange then
  171.             CastSkillshot(SkillR, Target)
  172.         end
  173.     end
  174. end
  175.  
  176. function KillSteal()
  177.     for _, enemy in pairs(AutoCarry.EnemyTable) do
  178.         if ValidTarget(enemy, RRange) then
  179.             if enemy.health < getDmg("R", enemy, myHero) then
  180.                 CastSkillshot(SkillR, enemy)
  181.             end
  182.         end
  183.     end
  184. end
  185.  
  186. -- This is an override to AutoCarry's Skillshot routine, with one minor change,
  187. -- because there is something wrong with hitchance percentages over 90 for skill shots.
  188. function CastSkillshot(skill, target)
  189.     if Target ~= nil then
  190.         if VIP_USER then
  191.             pred = TargetPredictionVIP(skill.range, skill.speed*1000, skill.delay/1000, skill.width)
  192.         elseif not VIP_USER then
  193.             pred = TargetPrediction(skill.range, skill.speed, skill.delay, skill.width)
  194.         end
  195.         local predPos = pred:GetPrediction(target)
  196.         if predPos and GetDistance(predPos) <= skill.range then
  197.             if VIP_USER and pred:GetHitChance(target) > AutoCarry.PluginMenu.hitChance/100 then
  198.                 if not skill.minions or not AutoCarry.GetCollision(skill, myHero, predPos) then
  199.                     CastSpell(skill.spellKey, predPos.x, predPos.z)
  200.                 end
  201.             elseif not VIP_USER then
  202.                 if not skill.minions or not AutoCarry.GetCollision(skill, myHero, predPos) then
  203.                     CastSpell(skill.spellKey, predPos.x, predPos.z)
  204.                 end
  205.             end
  206.         end
  207.     end
  208. end
  209.  
  210. -- Handle Manual Skill Shots
  211.  
  212. function PluginOnWndMsg(msg,key)
  213.     Target = AutoCarry.GetAttackTarget()
  214.     if Target ~= nil then
  215.         if msg == KEY_DOWN and key == KeyQ then CastQ() end
  216.         if msg == KEY_DOWN and key == KeyW then CastW() end
  217.         if msg == KEY_DOWN and key == KeyE then CastE() end
  218.         if msg == KEY_DOWN and key == KeyR then CastR() end
  219.     end
  220. end
  221.  
  222. -- Drawing
  223.  
  224. function PluginOnDraw()
  225.     if AutoCarry.PluginMenu.draw then
  226.         if myHero:CanUseSpell(SkillQ.spellKey) then
  227.             DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0xFF0000)
  228.         end
  229.        
  230.         if myHero:CanUseSpell(SkillW.spellKey) then
  231.             DrawCircle(myHero.x, myHero.y, myHero.z, WRange, 0xFF0000)
  232.         end
  233.        
  234.         if myHero:CanUseSpell(SkillE.spellKey) then
  235.             DrawCircle(myHero.x, myHero.y, myHero.z, ERange, 0xFF0000)
  236.         end
  237.  
  238.         if AutoCarry.PluginMenu.drawult then
  239.             if myHero:CanUseSpell(SkillR.spellKey) then
  240.                 DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000)
  241.             end
  242.         end
  243.  
  244.         Target = AutoCarry.GetAttackTarget()
  245.         if Target ~= nil then
  246.             for j=0, 10 do
  247.                 DrawCircle(Target.x, Target.y, Target.z, 40 + j*1.5, 0x00FF00)
  248.             end
  249.         end
  250.     end
  251.    
  252.     DrawKillable()
  253. end
  254.  
  255. function CalculateDamage()
  256.         if ValidTarget(Target) then
  257.                 local dfgdamage, hxgdamage, bwcdamage, ignitedamage, Sheendamage, Trinitydamage, LichBanedamage  = 0, 0, 0, 0, 0, 0, 0
  258.                 local pdamage = getDmg("P",Target,myHero)
  259.                 local qdamage = getDmg("Q",Target,myHero)
  260.                 local wdamage = getDmg("W",Target,myHero)
  261.                 local edamage = getDmg("E",Target,myHero)
  262.                 local rdamage = getDmg("R",Target,myHero)
  263.                 local hitdamage = getDmg("AD",Target,myHero)
  264.                 local dfgdamage = (DFGSlot and getDmg("DFG",Target,myHero) or 0)
  265.                 local hxgdamage = (HXGSlot and getDmg("HXG",Target,myHero) or 0)
  266.                 local bwcdamage = (BWCSlot and getDmg("BWC",Target,myHero) or 0)
  267.                 local ignitedamage = (ignite and getDmg("IGNITE",Target,myHero) or 0)
  268.                 local Sheendamage = (SheenSlot and getDmg("SHEEN",Target,myHero) or 0)
  269.                 local Trinitydamage = (TrinitySlot and getDmg("TRINITY",Target,myHero) or 0)
  270.                 local LichBanedamage = (LichBaneSlot and getDmg("LICHBANE",Target,myHero) or 0)
  271.                 local combo1 = hitdamage + qdamage + wdamage + edamage + rdamage + Sheendamage + Trinitydamage + LichBanedamage --0 cd
  272.                 local combo2 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  273.                 local combo3 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  274.                 local combo4 = 0
  275.                
  276.                 if QREADY then
  277.                         combo2 = combo2 + qdamage
  278.                         combo3 = combo3 + qdamage
  279.                         --combo4 = combo4 + qdamage
  280.                 end
  281.                 if WREADY then
  282.                         combo2 = combo2 + wdamage
  283.                         combo3 = combo3 + wdamage
  284.                 end
  285.                 if EREADY then
  286.                         combo2 = combo2 + edamage
  287.                         combo3 = combo3 + edamage
  288.                         --combo4 = combo4 + edamage
  289.                 end
  290.                 if RREADY then
  291.                         combo2 = combo2 + rdamage
  292.                         combo3 = combo3 + rdamage
  293.                         combo4 = combo4 + rdamage
  294.                 end
  295.                 if DFGREADY then        
  296.                         combo1 = combo1 + dfgdamage            
  297.                         combo2 = combo2 + dfgdamage
  298.                         combo3 = combo3 + dfgdamage
  299.                         --combo4 = combo4 + dfgdamage
  300.                 end
  301.                 if HXGREADY then              
  302.                         combo1 = combo1 + hxgdamage    
  303.                         combo2 = combo2 + hxgdamage
  304.                         combo3 = combo3 + hxgdamage
  305.                         --combo4 = combo4 + hxgdamage
  306.                 end
  307.                 if BWCREADY then
  308.                         combo1 = combo1 + bwcdamage
  309.                         combo2 = combo2 + bwcdamage
  310.                         combo3 = combo3 + bwcdamage
  311.                         combo4 = combo4 + bwcdamage
  312.                 end
  313.                 if IREADY then
  314.                         combo1 = combo1 + ignitedamage
  315.                         combo2 = combo2 + ignitedamage
  316.                         combo3 = combo3 + ignitedamage
  317.                 end
  318.                 if combo4 >= Target.health then killable[calculationenemy] = 4 doUlt = true
  319.                 elseif combo3 >= Target.health then killable[calculationenemy] = 3 doUlt = false
  320.                 elseif combo2 >= Target.health then killable[calculationenemy] = 2 doUlt = false
  321.                 elseif combo1 >= Target.health then killable[calculationenemy] = 1  doCombo = true doUlt = false
  322.                 else killable[calculationenemy] = 0 doCombo = false doUlt = false end
  323.         end
  324.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  325.         else calculationenemy = calculationenemy-1 end
  326. end
  327.  
  328. function DrawKillable()
  329.     if 1 == 2 and Target ~= nil and AutoCarry.PluginMenu.drawprediction then
  330.         if VIP_USER then
  331.             pred = TargetPredictionVIP(SkillQ.range, SkillQ.speed*1000, SkillQ.delay/1000, SkillQ.width)
  332.         elseif not VIP_USER then
  333.             pred = TargetPrediction(SkillQ.range, SkillQ.speed, SkillQ.delay, SkillQ.width)
  334.         end
  335.         predPos = pred:GetPrediction(Target)
  336.         DrawCircle(predPos.x, Target.y, predPos.z, 200, 0x0000FF)
  337.     end
  338.     for i=1, heroManager.iCount do
  339.         local enemydraw = heroManager:GetHero(i)
  340.         if ValidTarget(enemydraw) then
  341.             if AutoCarry.PluginMenu.drawkillableenemy then
  342.                 if killable[i] == 1 then
  343.                     for j=0, 20 do
  344.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  345.                     end
  346.                 elseif killable[i] == 2 then
  347.                     for j=0, 10 do
  348.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  349.                     end
  350.                 elseif killable[i] == 3 then
  351.                     for j=0, 10 do
  352.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  353.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  354.                     end
  355.                 elseif killable[i] == 4 then
  356.                     for j=0, 10 do
  357.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  358.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  359.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  360.                     end
  361.                 end
  362.             end
  363.             if AutoCarry.PluginMenu.drawtext and waittxt[i] == 1 and killable[i] ~= 0 then
  364.                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  365.             end
  366.         end
  367.         if waittxt[i] == 1 then waittxt[i] = 30
  368.         else waittxt[i] = waittxt[i]-1 end
  369.     end
  370. end
Advertisement
Add Comment
Please, Sign In to add comment