Kain2030

Auto Carry Plugin - Ziggs Edition - v1.05

Jul 14th, 2013
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.89 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Ziggs Edition
  4.         Author: Kain
  5.         Version: 1.05
  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("fullcombo", "Full Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("Z"))
  44. AutoCarry.PluginMenu:addParam("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("A"))
  45. AutoCarry.PluginMenu:addParam("satcheljump", "Satchel Jump", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
  46. AutoCarry.PluginMenu:addParam("ultimate", "Use Ultimate with Combo", SCRIPT_PARAM_ONOFF, true)
  47. AutoCarry.PluginMenu:addParam("killsteal", "Ultimate Mega Killsteal", SCRIPT_PARAM_ONOFF, true)
  48. AutoCarry.PluginMenu:addParam("drawkillableenemy", "Draw Killable Enemy", SCRIPT_PARAM_ONOFF, true)
  49. AutoCarry.PluginMenu:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  50. AutoCarry.PluginMenu:addParam("drawprediction", "Draw Prediction", SCRIPT_PARAM_ONOFF, true)
  51. AutoCarry.PluginMenu:addParam("draw", "Draw range circles", SCRIPT_PARAM_ONOFF, true)
  52. AutoCarry.PluginMenu:addParam("drawult", "Draw Ult range circle", SCRIPT_PARAM_ONOFF, true)
  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. local satchelChargeExists = false
  73. local pendingSatchelChargeActivation = nil
  74. local debugMode = false
  75.  
  76. -- Main
  77. function PluginOnLoad()
  78.     AutoCarry.SkillsCrosshair.range = QMaxRange
  79.  
  80.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  81.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end
  82.     for i=1, heroManager.iCount do waittxt[i] = i*3 end
  83. end
  84.  
  85. function PluginOnTick()
  86.     Target = AutoCarry.GetAttackTarget(true)
  87.  
  88.     SpellCheck()
  89.  
  90.     if tick == nil or GetTickCount()-tick >= 200 then
  91.         tick = GetTickCount()
  92.         CalculateDamage()
  93.     end
  94.  
  95.     if AutoCarry.PluginMenu.satcheljump then
  96.         SatchelJump()
  97.     end
  98.  
  99.     if (AutoCarry.MainMenu.AutoCarry or AutoCarry.MainMenu.MixedMode) then
  100.         Combo()
  101.     end
  102.    
  103.     if AutoCarry.PluginMenu.fullcombo then
  104.         FullCombo()
  105.     end
  106.  
  107.     if AutoCarry.PluginMenu.harass then
  108.         Harass()
  109.     end
  110.  
  111.     if AutoCarry.PluginMenu.killsteal then
  112.         KillSteal()
  113.     end
  114. end
  115.  
  116. function PluginOnCreateObj(obj)
  117.     if obj.name == "ZiggsW_mis_ground.troy" then
  118.         satchelChargeExists = true
  119.         CastWActivate()
  120.     end
  121. end
  122.  
  123. function PluginOnDeleteObj(obj)
  124.     if obj.name == "ZiggsW_mis_ground.troy" then
  125.         satchelChargeExists = false
  126.         pendingSatchelChargeActivation = nil
  127.     end
  128. end
  129.  
  130. function OnAttacked()
  131.     -- AA > Q > AA
  132.     CastQ()
  133. end
  134.  
  135. function SpellCheck()
  136.     DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3128),
  137.     GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057),
  138.     GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  139.  
  140.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  141.     WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
  142.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  143.     RReady = (myHero:CanUseSpell(SkillR.spellKey) == READY)
  144.  
  145.     DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  146.     HXGReady = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  147.     BWCReady = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  148.     IReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  149. end
  150.  
  151. -- Handle SBTW Skill Shots
  152.  
  153. function Combo()
  154.     CastSlots()
  155.     CastE()
  156.     CastQ()
  157.     if AutoCarry.PluginMenu.ultimate and doUlt then
  158.         CastR()
  159.     end
  160. end
  161.  
  162. function FullCombo()
  163.     CastSlots()
  164.     CastE()
  165.     CastQ()
  166.     CastW()
  167.     CastWActivate()
  168.     if AutoCarry.PluginMenu.ultimate and doUlt then
  169.         CastR()
  170.     end
  171. end
  172.  
  173. function CastSlots()
  174.     if Target ~= nil then
  175.         if GetDistance(Target) <= QMaxRange then
  176.             if DFGReady then CastSpell(DFGSlot, Target) end
  177.             if HXGReady then CastSpell(HXGSlot, Target) end
  178.             if BWCReady then CastSpell(BWCSlot, Target) end
  179.         end
  180.     end
  181. end
  182.  
  183. function Harass()
  184.     CastQ()
  185. end
  186.  
  187. function CastQ()
  188.     if Target ~= nil then
  189.         if QReady and ValidTarget(Target, QRange) then
  190.             AutoCarry.CastSkillshot(SkillQ, Target)
  191.         elseif QReady and ValidTarget(Target, QMaxRange) then
  192.             -- Full Bouncing Bomb three bounce range
  193.             local PredictedPos = AutoCarry.GetPrediction(SkillQ, Target)
  194.  
  195.             if PredictedPos and AutoCarry.IsValidHitChance(SkillQ, Target) then
  196.                 local MyPos = Vector(myHero.x, myHero.y, myHero.z)
  197.                 local EnemyPos = Vector(PredictedPos.x, PredictedPos.y, PredictedPos.z)
  198.                 local CastPos = MyPos - (MyPos - EnemyPos):normalized() * QRange
  199.                 if CastPos then CastSpell(SkillQ.spellKey, CastPos.x, CastPos.z) end
  200.             end
  201.         end
  202.     end
  203. end
  204.  
  205. function CastW(noTarget)
  206.     if noTarget and WReady then
  207.         AutoCarry.CastSkillshot(SkillW, myHero)
  208.     elseif Target ~= nil and ValidTarget(Target, WRange) then
  209.         if WReady and GetDistance(Target) <= WRange then
  210.             AutoCarry.CastSkillshot(SkillW, Target)
  211.         end
  212.     end
  213. end
  214.  
  215. function CastWActivate()
  216.     if satchelChargeExists and pendingSatchelChargeActivation ~= nil then
  217.         if pendingSatchelChargeActivation == "satcheljump" then
  218.             CastSpell(SkillW.spellKey)
  219.             CastE()
  220.             pendingSatchelChargeActivation = nil
  221.         end
  222.     end
  223. end
  224.  
  225. function CastE()
  226.     if Target ~= nil and ValidTarget(Target, ERange) then
  227.         if EReady and GetDistance(Target) <= ERange then
  228.             AutoCarry.CastSkillshot(SkillE, Target)
  229.         end
  230.     end
  231. end
  232.  
  233. function CastR()
  234.     if Target ~= nil and ValidTarget(enemy, RRange) then
  235.         if RReady and GetDistance(Target) <= RRange then
  236.             AutoCarry.CastSkillshot(SkillR, Target)
  237.         end
  238.     end
  239. end
  240.  
  241. function KillSteal()
  242.     for _, enemy in pairs(AutoCarry.EnemyTable) do
  243.         if ValidTarget(enemy, RRange) then
  244.             if enemy.health < getDmg("R", enemy, myHero) and IsValidHitChanceCustom(SkillR, enemy) then
  245.                 AutoCarry.CastSkillshot(SkillR, enemy)
  246.             end
  247.         end
  248.     end
  249. end
  250.  
  251. function SatchelJump()
  252.     -- E is cast before and after jump to insure that a target near either location can be hit.
  253.     pendingSatchelChargeActivation = "satcheljump"
  254.     CastW(true)
  255.     CastE()
  256. end
  257.  
  258. -- Sliding scale hitchance based on target distance.
  259. function getScalingHitChanceFromDistance(SkillRange, Target)
  260.     local minHitChance = 60
  261.     local maxHitChance = 95
  262.  
  263.     hitChance = minHitChance + ((1 - (SkillRange - GetDistance(Target)) / (SkillRange - 0))) * (maxHitChance - minHitChance)
  264.     if debugMode then PrintChat("HitChance Info: skillrange="..SkillRange..", targetdistance="..GetDistance(Target)..", hitchance:"..hitChance) end
  265.     return hitChance
  266. end
  267.  
  268. function IsValidHitChanceCustom(skill, target)
  269.     if VIP_USER then
  270.         pred = TargetPredictionVIP(skill.range, skill.speed*1000, skill.delay/1000, skill.width)
  271.         return pred:GetHitChance(target) > getScalingHitChanceFromDistance(skill.range, target)/100 and true or false
  272.     elseif not VIP_USER then
  273.         local nonVIPMaxHitChance = 70
  274.         return getScalingHitChanceFromDistance(skill.range, target) < nonVIPMaxHitChance and true or false
  275.     end
  276. end
  277.  
  278. --[[
  279. function satchelChargeExistsDelete()
  280.     for i=1, objManager.maxObjects do
  281.         local obj = objManager:getObject(i)
  282.  
  283.         if obj ~= nil and obj.name:find("Satchel Charge") then
  284.             return true
  285.         end
  286.     end
  287.     return false
  288. end
  289. --]]
  290.  
  291. -- Handle Manual Skill Shots
  292.  
  293. function PluginOnWndMsg(msg,key)
  294.     Target = AutoCarry.GetAttackTarget()
  295.     if Target ~= nil then
  296.         if msg == KEY_DOWN and key == KeyQ then CastQ() end
  297.         if msg == KEY_DOWN and key == KeyW then CastW() end
  298.         if msg == KEY_DOWN and key == KeyE then CastE() end
  299.         if msg == KEY_DOWN and key == KeyR then CastR() end
  300.     end
  301. end
  302.  
  303. -- Drawing
  304.  
  305. function PluginOnDraw()
  306.     if AutoCarry.PluginMenu.draw then
  307.         DrawCircle(myHero.x, myHero.y, myHero.z, AutoCarry.SkillsCrosshair.range, 0x19A712)
  308.  
  309.         if myHero:CanUseSpell(SkillQ.spellKey) then
  310.             DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0xFF0000)
  311.         end
  312.        
  313.         if myHero:CanUseSpell(SkillW.spellKey) then
  314.             DrawCircle(myHero.x, myHero.y, myHero.z, WRange, 0xFF0000)
  315.         end
  316.        
  317.         if myHero:CanUseSpell(SkillE.spellKey) then
  318.             DrawCircle(myHero.x, myHero.y, myHero.z, ERange, 0xFF0000)
  319.         end
  320.  
  321.         if AutoCarry.PluginMenu.drawult then
  322.             if myHero:CanUseSpell(SkillR.spellKey) then
  323.                 DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000)
  324.             end
  325.         end
  326.  
  327.         Target = AutoCarry.GetAttackTarget()
  328.         if Target ~= nil then
  329.             for j=0, 10 do
  330.                 DrawCircle(Target.x, Target.y, Target.z, 40 + j*1.5, 0x00FF00)
  331.             end
  332.         end
  333.     end
  334.    
  335.     DrawKillable()
  336. end
  337.  
  338. function CalculateDamage()
  339.         if ValidTarget(Target) then
  340.                 local dfgdamage, hxgdamage, bwcdamage, ignitedamage, Sheendamage, Trinitydamage, LichBanedamage  = 0, 0, 0, 0, 0, 0, 0
  341.                 local pdamage = getDmg("P",Target,myHero)
  342.                 local qdamage = getDmg("Q",Target,myHero)
  343.                 local wdamage = getDmg("W",Target,myHero)
  344.                 local edamage = getDmg("E",Target,myHero)
  345.                 local rdamage = getDmg("R",Target,myHero)
  346.                 local hitdamage = getDmg("AD",Target,myHero)
  347.                 local dfgdamage = (DFGSlot and getDmg("DFG",Target,myHero) or 0)
  348.                 local hxgdamage = (HXGSlot and getDmg("HXG",Target,myHero) or 0)
  349.                 local bwcdamage = (BWCSlot and getDmg("BWC",Target,myHero) or 0)
  350.                 local ignitedamage = (ignite and getDmg("IGNITE",Target,myHero) or 0)
  351.                 local Sheendamage = (SheenSlot and getDmg("SHEEN",Target,myHero) or 0)
  352.                 local Trinitydamage = (TrinitySlot and getDmg("TRINITY",Target,myHero) or 0)
  353.                 local LichBanedamage = (LichBaneSlot and getDmg("LICHBANE",Target,myHero) or 0)
  354.                 local combo1 = hitdamage + qdamage + wdamage + edamage + rdamage + Sheendamage + Trinitydamage + LichBanedamage --0 cd
  355.                 local combo2 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  356.                 local combo3 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  357.                 local combo4 = 0
  358.                
  359.                 if QREADY then
  360.                         combo2 = combo2 + qdamage
  361.                         combo3 = combo3 + qdamage
  362.                         --combo4 = combo4 + qdamage
  363.                 end
  364.                 if WREADY then
  365.                         combo2 = combo2 + wdamage
  366.                         combo3 = combo3 + wdamage
  367.                 end
  368.                 if EREADY then
  369.                         combo2 = combo2 + edamage
  370.                         combo3 = combo3 + edamage
  371.                         --combo4 = combo4 + edamage
  372.                 end
  373.                 if RREADY then
  374.                         combo2 = combo2 + rdamage
  375.                         combo3 = combo3 + rdamage
  376.                         combo4 = combo4 + rdamage
  377.                 end
  378.                 if DFGREADY then        
  379.                         combo1 = combo1 + dfgdamage            
  380.                         combo2 = combo2 + dfgdamage
  381.                         combo3 = combo3 + dfgdamage
  382.                         --combo4 = combo4 + dfgdamage
  383.                 end
  384.                 if HXGREADY then              
  385.                         combo1 = combo1 + hxgdamage    
  386.                         combo2 = combo2 + hxgdamage
  387.                         combo3 = combo3 + hxgdamage
  388.                         --combo4 = combo4 + hxgdamage
  389.                 end
  390.                 if BWCREADY then
  391.                         combo1 = combo1 + bwcdamage
  392.                         combo2 = combo2 + bwcdamage
  393.                         combo3 = combo3 + bwcdamage
  394.                         combo4 = combo4 + bwcdamage
  395.                 end
  396.                 if IREADY then
  397.                         combo1 = combo1 + ignitedamage
  398.                         combo2 = combo2 + ignitedamage
  399.                         combo3 = combo3 + ignitedamage
  400.                 end
  401.                 if combo4 >= Target.health then killable[calculationenemy] = 4 doUlt = true
  402.                 elseif combo3 >= Target.health then killable[calculationenemy] = 3 doUlt = false
  403.                 elseif combo2 >= Target.health then killable[calculationenemy] = 2 doUlt = false
  404.                 elseif combo1 >= Target.health then killable[calculationenemy] = 1  doCombo = true doUlt = false
  405.                 else killable[calculationenemy] = 0 doCombo = false doUlt = false end
  406.         end
  407.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  408.         else calculationenemy = calculationenemy-1 end
  409. end
  410.  
  411. function DrawKillable()
  412.     if 1 == 2 and Target ~= nil and AutoCarry.PluginMenu.drawprediction then
  413.         if VIP_USER then
  414.             pred = TargetPredictionVIP(SkillQ.range, SkillQ.speed*1000, SkillQ.delay/1000, SkillQ.width)
  415.         elseif not VIP_USER then
  416.             pred = TargetPrediction(SkillQ.range, SkillQ.speed, SkillQ.delay, SkillQ.width)
  417.         end
  418.         predPos = pred:GetPrediction(Target)
  419.         DrawCircle(predPos.x, Target.y, predPos.z, 200, 0x0000FF)
  420.     end
  421.     for i=1, heroManager.iCount do
  422.         local enemydraw = heroManager:GetHero(i)
  423.         if ValidTarget(enemydraw) then
  424.             if AutoCarry.PluginMenu.drawkillableenemy then
  425.                 if killable[i] == 1 then
  426.                     for j=0, 20 do
  427.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  428.                     end
  429.                 elseif killable[i] == 2 then
  430.                     for j=0, 10 do
  431.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  432.                     end
  433.                 elseif killable[i] == 3 then
  434.                     for j=0, 10 do
  435.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  436.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  437.                     end
  438.                 elseif killable[i] == 4 then
  439.                     for j=0, 10 do
  440.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  441.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  442.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  443.                     end
  444.                 end
  445.             end
  446.             if AutoCarry.PluginMenu.drawtext and waittxt[i] == 1 and killable[i] ~= 0 then
  447.                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  448.             end
  449.         end
  450.         if waittxt[i] == 1 then waittxt[i] = 30
  451.         else waittxt[i] = waittxt[i]-1 end
  452.     end
  453. end
Advertisement
Add Comment
Please, Sign In to add comment