Kain2030

Auto Carry Plugin - Ziggs Edition - v1.03

Jul 12th, 2013
517
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.82 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Ziggs Edition
  4.         Author: Kain
  5.         Version: 1.03 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.     AutoCarry.SkillsCrosshair.range = QMaxRange
  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.ziggscombo 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 OnAttacked()
  103.     -- AA > Q > AA
  104.     CastQ()
  105. end
  106.  
  107. function SpellCheck()
  108.     DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3128),
  109.     GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057),
  110.     GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  111.  
  112.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  113.     WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
  114.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  115.     RReady = (myHero:CanUseSpell(SkillR.spellKey) == READY)
  116.  
  117.     DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  118.     HXGReady = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  119.     BWCReady = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  120.     IReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  121. end
  122.  
  123. -- Handle SBTW Skill Shots
  124.  
  125. function Combo()
  126.     CastSlots()
  127.     CastE()
  128.     CastQ()
  129.     CastW()
  130.     if AutoCarry.PluginMenu.ultimate and doUlt then
  131.         CastR()
  132.     end
  133. end
  134.  
  135. function CastSlots()
  136.     if Target ~= nil then
  137.         if GetDistance(Target) <= QMaxRange then
  138.             if DFGReady then CastSpell(DFGSlot, Target) end
  139.             if HXGReady then CastSpell(HXGSlot, Target) end
  140.             if BWCReady then CastSpell(BWCSlot, Target) end
  141.         end
  142.     end
  143. end
  144.  
  145. function Harass()
  146.     CastQ()
  147. end
  148.  
  149. function CastQ()
  150.     if Target ~= nil and ValidTarget(Target, QMaxRange) then
  151.         if QReady and GetDistance(Target) <= QMaxRange then
  152.             AutoCarry.CastSkillshot(SkillQ, Target)
  153.         end
  154.     end
  155. end
  156.  
  157. function CastW()
  158.     if Target ~= nil and ValidTarget(Target, WRange) then
  159.         if WReady and GetDistance(Target) <= WRange then
  160.             AutoCarry.CastSkillshot(SkillW, Target)
  161.         end
  162.     end
  163. end
  164.  
  165. function CastE()
  166.     if Target ~= nil and ValidTarget(Target, ERange) then
  167.         if EReady and GetDistance(Target) <= ERange then
  168.             AutoCarry.CastSkillshot(SkillE, Target)
  169.         end
  170.     end
  171. end
  172.  
  173. function CastR()
  174.     if Target ~= nil and ValidTarget(enemy, RRange) then
  175.         if RReady and GetDistance(Target) <= RRange then
  176.             AutoCarry.CastSkillshot(SkillR, Target)
  177.         end
  178.     end
  179. end
  180.  
  181. function KillSteal()
  182.     for _, enemy in pairs(AutoCarry.EnemyTable) do
  183.         if ValidTarget(enemy, RRange) then
  184.             if enemy.health < getDmg("R", enemy, myHero) then
  185.                 AutoCarry.CastSkillshot(SkillR, enemy)
  186.             end
  187.         end
  188.     end
  189. end
  190.  
  191. -- This is an override to AutoCarry's Skillshot routine, with one minor change,
  192. -- because there is something wrong with hitchance percentages over 90 for skill shots.
  193. --[[
  194. function CastSkillshot(skill, target)
  195.     if Target ~= nil then
  196.         if VIP_USER then
  197.             pred = TargetPredictionVIP(skill.range, skill.speed*1000, skill.delay/1000, skill.width)
  198.         elseif not VIP_USER then
  199.             pred = TargetPrediction(skill.range, skill.speed, skill.delay, skill.width)
  200.         end
  201.         local predPos = pred:GetPrediction(target)
  202.         if predPos and GetDistance(predPos) <= skill.range then
  203.             if VIP_USER and pred:GetHitChance(target) > AutoCarry.PluginMenu.hitChance/100 then
  204.                 if not skill.minions or not AutoCarry.GetCollision(skill, myHero, predPos) then
  205.                     CastSpell(skill.spellKey, predPos.x, predPos.z)
  206.                 end
  207.             elseif not VIP_USER then
  208.                 if not skill.minions or not AutoCarry.GetCollision(skill, myHero, predPos) then
  209.                     CastSpell(skill.spellKey, predPos.x, predPos.z)
  210.                 end
  211.             end
  212.         end
  213.     end
  214. end
  215. ]]--
  216.  
  217. -- Handle Manual Skill Shots
  218.  
  219. function PluginOnWndMsg(msg,key)
  220.     Target = AutoCarry.GetAttackTarget()
  221.     if Target ~= nil then
  222.         if msg == KEY_DOWN and key == KeyQ then CastQ() end
  223.         if msg == KEY_DOWN and key == KeyW then CastW() end
  224.         if msg == KEY_DOWN and key == KeyE then CastE() end
  225.         if msg == KEY_DOWN and key == KeyR then CastR() end
  226.     end
  227. end
  228.  
  229. -- Drawing
  230.  
  231. function PluginOnDraw()
  232.     if AutoCarry.PluginMenu.draw then
  233.         if myHero:CanUseSpell(SkillQ.spellKey) then
  234.             DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0xFF0000)
  235.         end
  236.        
  237.         if myHero:CanUseSpell(SkillW.spellKey) then
  238.             DrawCircle(myHero.x, myHero.y, myHero.z, WRange, 0xFF0000)
  239.         end
  240.        
  241.         if myHero:CanUseSpell(SkillE.spellKey) then
  242.             DrawCircle(myHero.x, myHero.y, myHero.z, ERange, 0xFF0000)
  243.         end
  244.  
  245.         if AutoCarry.PluginMenu.drawult then
  246.             if myHero:CanUseSpell(SkillR.spellKey) then
  247.                 DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000)
  248.             end
  249.         end
  250.  
  251.         Target = AutoCarry.GetAttackTarget()
  252.         if Target ~= nil then
  253.             for j=0, 10 do
  254.                 DrawCircle(Target.x, Target.y, Target.z, 40 + j*1.5, 0x00FF00)
  255.             end
  256.         end
  257.     end
  258.    
  259.     DrawKillable()
  260. end
  261.  
  262. function CalculateDamage()
  263.         if ValidTarget(Target) then
  264.                 local dfgdamage, hxgdamage, bwcdamage, ignitedamage, Sheendamage, Trinitydamage, LichBanedamage  = 0, 0, 0, 0, 0, 0, 0
  265.                 local pdamage = getDmg("P",Target,myHero)
  266.                 local qdamage = getDmg("Q",Target,myHero)
  267.                 local wdamage = getDmg("W",Target,myHero)
  268.                 local edamage = getDmg("E",Target,myHero)
  269.                 local rdamage = getDmg("R",Target,myHero)
  270.                 local hitdamage = getDmg("AD",Target,myHero)
  271.                 local dfgdamage = (DFGSlot and getDmg("DFG",Target,myHero) or 0)
  272.                 local hxgdamage = (HXGSlot and getDmg("HXG",Target,myHero) or 0)
  273.                 local bwcdamage = (BWCSlot and getDmg("BWC",Target,myHero) or 0)
  274.                 local ignitedamage = (ignite and getDmg("IGNITE",Target,myHero) or 0)
  275.                 local Sheendamage = (SheenSlot and getDmg("SHEEN",Target,myHero) or 0)
  276.                 local Trinitydamage = (TrinitySlot and getDmg("TRINITY",Target,myHero) or 0)
  277.                 local LichBanedamage = (LichBaneSlot and getDmg("LICHBANE",Target,myHero) or 0)
  278.                 local combo1 = hitdamage + qdamage + wdamage + edamage + rdamage + Sheendamage + Trinitydamage + LichBanedamage --0 cd
  279.                 local combo2 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  280.                 local combo3 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  281.                 local combo4 = 0
  282.                
  283.                 if QREADY then
  284.                         combo2 = combo2 + qdamage
  285.                         combo3 = combo3 + qdamage
  286.                         --combo4 = combo4 + qdamage
  287.                 end
  288.                 if WREADY then
  289.                         combo2 = combo2 + wdamage
  290.                         combo3 = combo3 + wdamage
  291.                 end
  292.                 if EREADY then
  293.                         combo2 = combo2 + edamage
  294.                         combo3 = combo3 + edamage
  295.                         --combo4 = combo4 + edamage
  296.                 end
  297.                 if RREADY then
  298.                         combo2 = combo2 + rdamage
  299.                         combo3 = combo3 + rdamage
  300.                         combo4 = combo4 + rdamage
  301.                 end
  302.                 if DFGREADY then        
  303.                         combo1 = combo1 + dfgdamage            
  304.                         combo2 = combo2 + dfgdamage
  305.                         combo3 = combo3 + dfgdamage
  306.                         --combo4 = combo4 + dfgdamage
  307.                 end
  308.                 if HXGREADY then              
  309.                         combo1 = combo1 + hxgdamage    
  310.                         combo2 = combo2 + hxgdamage
  311.                         combo3 = combo3 + hxgdamage
  312.                         --combo4 = combo4 + hxgdamage
  313.                 end
  314.                 if BWCREADY then
  315.                         combo1 = combo1 + bwcdamage
  316.                         combo2 = combo2 + bwcdamage
  317.                         combo3 = combo3 + bwcdamage
  318.                         combo4 = combo4 + bwcdamage
  319.                 end
  320.                 if IREADY then
  321.                         combo1 = combo1 + ignitedamage
  322.                         combo2 = combo2 + ignitedamage
  323.                         combo3 = combo3 + ignitedamage
  324.                 end
  325.                 if combo4 >= Target.health then killable[calculationenemy] = 4 doUlt = true
  326.                 elseif combo3 >= Target.health then killable[calculationenemy] = 3 doUlt = false
  327.                 elseif combo2 >= Target.health then killable[calculationenemy] = 2 doUlt = false
  328.                 elseif combo1 >= Target.health then killable[calculationenemy] = 1  doCombo = true doUlt = false
  329.                 else killable[calculationenemy] = 0 doCombo = false doUlt = false end
  330.         end
  331.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  332.         else calculationenemy = calculationenemy-1 end
  333. end
  334.  
  335. function DrawKillable()
  336.     if 1 == 2 and Target ~= nil and AutoCarry.PluginMenu.drawprediction then
  337.         if VIP_USER then
  338.             pred = TargetPredictionVIP(SkillQ.range, SkillQ.speed*1000, SkillQ.delay/1000, SkillQ.width)
  339.         elseif not VIP_USER then
  340.             pred = TargetPrediction(SkillQ.range, SkillQ.speed, SkillQ.delay, SkillQ.width)
  341.         end
  342.         predPos = pred:GetPrediction(Target)
  343.         DrawCircle(predPos.x, Target.y, predPos.z, 200, 0x0000FF)
  344.     end
  345.     for i=1, heroManager.iCount do
  346.         local enemydraw = heroManager:GetHero(i)
  347.         if ValidTarget(enemydraw) then
  348.             if AutoCarry.PluginMenu.drawkillableenemy then
  349.                 if killable[i] == 1 then
  350.                     for j=0, 20 do
  351.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  352.                     end
  353.                 elseif killable[i] == 2 then
  354.                     for j=0, 10 do
  355.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  356.                     end
  357.                 elseif killable[i] == 3 then
  358.                     for j=0, 10 do
  359.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  360.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  361.                     end
  362.                 elseif killable[i] == 4 then
  363.                     for j=0, 10 do
  364.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  365.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  366.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  367.                     end
  368.                 end
  369.             end
  370.             if AutoCarry.PluginMenu.drawtext and waittxt[i] == 1 and killable[i] ~= 0 then
  371.                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  372.             end
  373.         end
  374.         if waittxt[i] == 1 then waittxt[i] = 30
  375.         else waittxt[i] = waittxt[i]-1 end
  376.     end
  377. end
Advertisement
Add Comment
Please, Sign In to add comment