Advertisement
Kain2030

Auto Carry Plugin - Ziggs Edition - v1.0

Jul 9th, 2013
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 13.51 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Ziggs Edition
  4.         Author: Kain
  5.         Version: 1.00 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 = QRange, 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("combo", "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.combo 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 then
  145.         if QReady and GetDistance(Target) < QMaxRange then
  146.                 CastSkillshot(SkillQ, Target)
  147.         end
  148.     end
  149. end
  150.  
  151. function CastW()
  152.     if Target ~= nil then
  153.         if WReady and GetDistance(Target) < WRange then
  154.             CastSkillshot(SkillW, Target)
  155.         end
  156.     end
  157. end
  158.  
  159. function CastE()
  160.     if Target ~= nil then
  161.         if EReady and GetDistance(Target) < ERange then
  162.             CastSkillshot(SkillE, Target)
  163.         end
  164.     end
  165. end
  166.  
  167. function CastR()
  168.     if Target ~= nil then
  169.         if RReady and GetDistance(Target) < RRange then
  170.             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.                 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. function CastSkillshot(skill, target)
  188.     if Target ~= nil then
  189.         if VIP_USER then
  190.             pred = TargetPredictionVIP(skill.range, skill.speed*1000, skill.delay/1000, skill.width)
  191.         elseif not VIP_USER then
  192.             pred = TargetPrediction(skill.range, skill.speed, skill.delay, skill.width)
  193.         end
  194.         local predPos = pred:GetPrediction(target)
  195.         if predPos and GetDistance(predPos) <= skill.range then
  196.             if VIP_USER and pred:GetHitChance(target) > AutoCarry.PluginMenu.hitChance/100 then
  197.                 if not skill.minions or not AutoCarry.GetCollision(skill, myHero, predPos) then
  198.                     CastSpell(skill.spellKey, predPos.x, predPos.z)
  199.                 end
  200.             elseif not VIP_USER then
  201.                 if not skill.minions or not AutoCarry.GetCollision(skill, myHero, predPos) then
  202.                     CastSpell(skill.spellKey, predPos.x, predPos.z)
  203.                 end
  204.             end
  205.         end
  206.     end
  207. end
  208.  
  209. -- Handle Manual Skill Shots
  210.  
  211. function PluginOnWndMsg(msg,key)
  212.     Target = AutoCarry.GetAttackTarget()
  213.     if Target ~= nil then
  214.         if msg == KEY_DOWN and key == KeyQ then CastQ() end
  215.         if msg == KEY_DOWN and key == KeyW then CastW() end
  216.         if msg == KEY_DOWN and key == KeyE then CastE() end
  217.         if msg == KEY_DOWN and key == KeyR then CastR() end
  218.     end
  219. end
  220.  
  221. -- Drawing
  222.  
  223. function PluginOnDraw()
  224.     if AutoCarry.PluginMenu.draw then
  225.         if myHero:CanUseSpell(SkillQ.spellKey) then
  226.             DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0xFF0000)
  227.         end
  228.        
  229.         if myHero:CanUseSpell(SkillW.spellKey) then
  230.             DrawCircle(myHero.x, myHero.y, myHero.z, WRange, 0xFF0000)
  231.         end
  232.        
  233.         if myHero:CanUseSpell(SkillE.spellKey) then
  234.             DrawCircle(myHero.x, myHero.y, myHero.z, ERange, 0xFF0000)
  235.         end
  236.  
  237.         if AutoCarry.PluginMenu.drawult then
  238.             if myHero:CanUseSpell(SkillR.spellKey) then
  239.                 DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000)
  240.             end
  241.         end
  242.  
  243.         Target = AutoCarry.GetAttackTarget()
  244.         if Target ~= nil then
  245.             for j=0, 10 do
  246.                 DrawCircle(Target.x, Target.y, Target.z, 40 + j*1.5, 0x00FF00)
  247.             end
  248.         end
  249.     end
  250.    
  251.     DrawKillable()
  252. end
  253.  
  254. function CalculateDamage()
  255.         if ValidTarget(Target) then
  256.                 local dfgdamage, hxgdamage, bwcdamage, ignitedamage, Sheendamage, Trinitydamage, LichBanedamage  = 0, 0, 0, 0, 0, 0, 0
  257.                 local pdamage = getDmg("P",Target,myHero)
  258.                 local qdamage = getDmg("Q",Target,myHero)
  259.                 local wdamage = getDmg("W",Target,myHero)
  260.                 local edamage = getDmg("E",Target,myHero)
  261.                 local rdamage = getDmg("R",Target,myHero)
  262.                 local hitdamage = getDmg("AD",Target,myHero)
  263.                 local dfgdamage = (DFGSlot and getDmg("DFG",Target,myHero) or 0)
  264.                 local hxgdamage = (HXGSlot and getDmg("HXG",Target,myHero) or 0)
  265.                 local bwcdamage = (BWCSlot and getDmg("BWC",Target,myHero) or 0)
  266.                 local ignitedamage = (ignite and getDmg("IGNITE",Target,myHero) or 0)
  267.                 local Sheendamage = (SheenSlot and getDmg("SHEEN",Target,myHero) or 0)
  268.                 local Trinitydamage = (TrinitySlot and getDmg("TRINITY",Target,myHero) or 0)
  269.                 local LichBanedamage = (LichBaneSlot and getDmg("LICHBANE",Target,myHero) or 0)
  270.                 local combo1 = hitdamage + qdamage + wdamage + edamage + rdamage + Sheendamage + Trinitydamage + LichBanedamage --0 cd
  271.                 local combo2 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  272.                 local combo3 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  273.                 local combo4 = 0
  274.                
  275.                 if QREADY then
  276.                         combo2 = combo2 + qdamage
  277.                         combo3 = combo3 + qdamage
  278.                         --combo4 = combo4 + qdamage
  279.                 end
  280.                 if WREADY then
  281.                         combo2 = combo2 + wdamage
  282.                         combo3 = combo3 + wdamage
  283.                 end
  284.                 if EREADY then
  285.                         combo2 = combo2 + edamage
  286.                         combo3 = combo3 + edamage
  287.                         --combo4 = combo4 + edamage
  288.                 end
  289.                 if RREADY then
  290.                         combo2 = combo2 + rdamage
  291.                         combo3 = combo3 + rdamage
  292.                         combo4 = combo4 + rdamage
  293.                 end
  294.                 if DFGREADY then        
  295.                         combo1 = combo1 + dfgdamage            
  296.                         combo2 = combo2 + dfgdamage
  297.                         combo3 = combo3 + dfgdamage
  298.                         --combo4 = combo4 + dfgdamage
  299.                 end
  300.                 if HXGREADY then              
  301.                         combo1 = combo1 + hxgdamage    
  302.                         combo2 = combo2 + hxgdamage
  303.                         combo3 = combo3 + hxgdamage
  304.                         --combo4 = combo4 + hxgdamage
  305.                 end
  306.                 if BWCREADY then
  307.                         combo1 = combo1 + bwcdamage
  308.                         combo2 = combo2 + bwcdamage
  309.                         combo3 = combo3 + bwcdamage
  310.                         combo4 = combo4 + bwcdamage
  311.                 end
  312.                 if IREADY then
  313.                         combo1 = combo1 + ignitedamage
  314.                         combo2 = combo2 + ignitedamage
  315.                         combo3 = combo3 + ignitedamage
  316.                 end
  317.                 if combo4 >= Target.health then killable[calculationenemy] = 4 doUlt = true
  318.                 elseif combo3 >= Target.health then killable[calculationenemy] = 3 doUlt = false
  319.                 elseif combo2 >= Target.health then killable[calculationenemy] = 2 doUlt = false
  320.                 elseif combo1 >= Target.health then killable[calculationenemy] = 1  doCombo = true doUlt = false
  321.                 else killable[calculationenemy] = 0 doCombo = false doUlt = false end
  322.         end
  323.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  324.         else calculationenemy = calculationenemy-1 end
  325. end
  326.  
  327. function DrawKillable()
  328.     if 1 == 2 and Target ~= nil and AutoCarry.PluginMenu.drawprediction then
  329.         if VIP_USER then
  330.             pred = TargetPredictionVIP(SkillQ.range, SkillQ.speed*1000, SkillQ.delay/1000, SkillQ.width)
  331.         elseif not VIP_USER then
  332.             pred = TargetPrediction(SkillQ.range, SkillQ.speed, SkillQ.delay, SkillQ.width)
  333.         end
  334.         predPos = pred:GetPrediction(Target)
  335.         DrawCircle(predPos.x, Target.y, predPos.z, 200, 0x0000FF)
  336.     end
  337.     for i=1, heroManager.iCount do
  338.         local enemydraw = heroManager:GetHero(i)
  339.         if ValidTarget(enemydraw) then
  340.             if AutoCarry.PluginMenu.drawkillableenemy then
  341.                 if killable[i] == 1 then
  342.                     for j=0, 20 do
  343.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  344.                     end
  345.                 elseif killable[i] == 2 then
  346.                     for j=0, 10 do
  347.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  348.                     end
  349.                 elseif killable[i] == 3 then
  350.                     for j=0, 10 do
  351.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  352.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  353.                     end
  354.                 elseif killable[i] == 4 then
  355.                     for j=0, 10 do
  356.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  357.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  358.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  359.                     end
  360.                 end
  361.             end
  362.             if AutoCarry.PluginMenu.drawtext and waittxt[i] == 1 and killable[i] ~= 0 then
  363.                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  364.             end
  365.         end
  366.         if waittxt[i] == 1 then waittxt[i] = 30
  367.         else waittxt[i] = waittxt[i]-1 end
  368.     end
  369. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement