Kain2030

Auto Carry Plugin - Ziggs Edition - v1.02

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