Kain2030

Auto Carry Plugin - Ziggs Edition - v1.2c

Aug 13th, 2013
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 29.34 KB | None | 0 0
  1. --[[
  2.  
  3.         Auto Carry Plugin - Ziggs Edition
  4.         Author: Kain
  5.         Version: 1.2c
  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.         Version History:
  16.             Version: 1.2c: http://pastebin.com/2J8F8XFt
  17.                 Added Wall check for Q.
  18.                 Added E toggle for Satchel Jump and Harass.
  19.                 Added line draw to currently selected target.
  20.                 Cleaned up plugin menu.
  21.             Version: 1.1d: http://pastebin.com/T3rUd14Y
  22.             Version: 1.1c: http://pastebin.com/exXzdFD8
  23.                 Improved Satchel Jump to fire more accurately and also in the direction of the mouse position.
  24.                 Added low mana handling with the Mana Manager.
  25.                 Added Smart Q farming. Uses Q when it can kill multiple minions and mana is higher than the Mana Manager low limit.
  26.                 Improved prediction range logic for Q and R.
  27.                 Fixed Q to not hit minions as much.
  28.                 Added enemy low health logic.
  29.             Version: 1.08: http://pastebin.com/ebB89AnC
  30.             Version: 1.07: http://pastebin.com/Mj7i5k9X
  31.                 Added text on screen when Killsteal occurs to make it more noticeable.
  32.                 Added slider variable to set Killsteal hitchance/sensitivity.
  33.             Version: 1.06: http://pastebin.com/5j9W654G (7/23/2013)
  34.                 Fixed Karthus / Kog'maw, etc. bug where script would try to kill their 'ghost' after they were dead, but still present nearby.
  35.                 Added toggle for auto harass.
  36.                 Change range color indicators.
  37.             Version: 1.05: http://pastebin.com/CcgW9n27
  38.                 Added Satchel Jump.
  39.                 Improved "Ultimate Mega Killsteal" calculation. Now operates on a hitchance curve. The further away the target is, the higher the hitchance required to throw the Bomb. Should reduce the number of cross-map misses. Will experiment with the settings after more feedback.
  40.                 Removed Satchel from normal combo.
  41.                 Added a secondary Full Combo option.
  42.             Version: 1.04: http://pastebin.com/z4nTWmkr
  43.                 Fixed Bouncing Bomb for full range prediction. Requires SAC 4.9 or later.
  44.             Version: 1.03 Beta: http://pastebin.com/kZED9bqV
  45.             Version: 1.02 Beta: http://pastebin.com/5CzSRtdL
  46.             Version: 1.01 Beta: http://pastebin.com/hx2RYDaQ
  47.             Version: 1.0 Beta: http://pastebin.com/bGa23bFR
  48. --]]
  49.  
  50. if myHero.charName ~= "Ziggs" then return end
  51.  
  52. local Target
  53.  
  54. -- Prediction
  55. local QRange = 850
  56. local QMaxRange = 1400
  57. local WRange = 1000
  58. local ERange = 900
  59. local RRange = 5300
  60.  
  61. local QSpeed = 1.722 -- Old: 1.2
  62. local WSpeed = 1.727 -- Old: 1.5
  63. local ESpeed = 2.694 -- Old: 1.45
  64. local RSpeed = 1.856 -- Old: 1.5
  65.  
  66. local QDelay = 218
  67. local WDelay = 249
  68. local EDelay = 125
  69. local RDelay = 1014
  70.  
  71. local QWidth = 150
  72. local WWidth = 225
  73. local EWidth = 250
  74. local RWidth = 550
  75.  
  76.  
  77.  
  78. local SkillQ = {spellKey = _Q, range = QMaxRange, speed = QSpeed, delay = QDelay, width = QWidth, configName = "bouncingbomb", displayName = "Q (Bouncing Bomb)", enabled = true, skillShot = true, minions = true, reset = false, reqTarget = true }
  79. local SkillW = {spellKey = _W, range = WRange, speed = WSpeed, delay = WDelay, width = WWidth, configName = "satchelcharge", displayName = "W (Satchel Charge)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = false }
  80. local SkillE = {spellKey = _E, range = ERange, speed = ESpeed, delay = EDelay, width = EWidth, configName = "hexplosiveminefield", displayName = "E (Hexplosive Minefield)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = false }
  81. local SkillR = {spellKey = _R, range = RRange, speed = RSpeed, delay = RDelay, width = RWidth, configName = "megainfernobomb", displayName = "R (Mega Inferno Bomb)", enabled = true, skillShot = true, minions = false, reset = false, reqTarget = true }
  82.  
  83. local KeyQ = string.byte("Q")
  84. local KeyW = string.byte("W")
  85. local KeyE = string.byte("E")
  86. local KeyR = string.byte("R")
  87.  
  88. local tick = nil
  89. local doUlt = false
  90.  
  91. -- Draw
  92. local waittxt = {}
  93. local calculationenemy = 1
  94. local floattext = {"Skills not available", "Able to fight", "Killable", "Murder him!"}
  95. local killable = {}
  96.  
  97. local ignite = nil
  98. local DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil
  99. local QReady, WReady, EReady, RReady, DFGReady, HXGReady, BWCReady, IReady = false, false, false, false, false, false, false, false
  100.  
  101. local satchelChargeExists = false
  102. local pendingSatchelChargeActivation = nil
  103. local debugMode = false
  104.  
  105. local focusPos = nil
  106.  
  107. -- Main
  108.  
  109. function Menu()
  110.     AutoCarry.PluginMenu:addParam("ZiggsCombo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  111.     AutoCarry.PluginMenu:addParam("FullCombo", "Full Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("Z"))
  112.     AutoCarry.PluginMenu:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("A"))
  113.     AutoCarry.PluginMenu:addParam("SatchelJump", "Satchel Jump", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
  114.     AutoCarry.PluginMenu:addParam("AutoHarass", "Auto Harass (Mana Intensive)", SCRIPT_PARAM_ONOFF, false)
  115.     AutoCarry.PluginMenu:addParam("ManaManager", "Mana Manager %", SCRIPT_PARAM_SLICE, 40, 0, 100, 2)
  116.     AutoCarry.PluginMenu:addParam("Ultimate", "Use Ultimate with Combo", SCRIPT_PARAM_ONOFF, true)
  117.     AutoCarry.PluginMenu:addParam("Killsteal", "Ultimate Mega Killsteal", SCRIPT_PARAM_ONOFF, true)
  118.     AutoCarry.PluginMenu:addParam("SmartFarmWithQ", "Smart Farm With Q", SCRIPT_PARAM_ONOFF, true)
  119.     AutoCarry.PluginMenu:addParam("sep", "----- [ Draw ] -----", SCRIPT_PARAM_INFO, "")
  120.     AutoCarry.PluginMenu:addParam("DrawKillablEenemy", "Draw Killable Enemy", SCRIPT_PARAM_ONOFF, true)
  121.     AutoCarry.PluginMenu:addParam("DrawText", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  122.     AutoCarry.PluginMenu:addParam("DrawPrediction", "Draw Prediction", SCRIPT_PARAM_ONOFF, true)
  123.     AutoCarry.PluginMenu:addParam("Draw", "Draw range circles", SCRIPT_PARAM_ONOFF, true)
  124.     AutoCarry.PluginMenu:addParam("DrawUlt", "Draw Ult range circle", SCRIPT_PARAM_ONOFF, true)
  125.     AutoCarry.PluginMenu:addParam("sep", "----- [ Advanced ] -----", SCRIPT_PARAM_INFO, "")
  126.     AutoCarry.PluginMenu:addParam("AvoidWallsWithQ", "Avoid Hitting Walls with Q (Beta)", SCRIPT_PARAM_ONOFF, false)
  127.     AutoCarry.PluginMenu:addParam("SatchelJumpWithE", "Satchel Jump with E", SCRIPT_PARAM_ONOFF, true)
  128.     AutoCarry.PluginMenu:addParam("HarassWithE", "Harass with E", SCRIPT_PARAM_ONOFF, false)
  129.     AutoCarry.PluginMenu:addParam("KillstealMinHitchance", "Killsteal Min. Req. Hitchance", SCRIPT_PARAM_SLICE, 60, 0, 90, 0)
  130. end
  131.  
  132. function PluginOnLoad()
  133.     Menu()
  134.  
  135.     AutoCarry.SkillsCrosshair.range = QMaxRange
  136.  
  137.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  138.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2 end
  139.     for i=1, heroManager.iCount do waittxt[i] = i*3 end
  140. end
  141.  
  142. function PluginOnTick()
  143.     tick = GetTickCount()
  144.     Target = AutoCarry.GetAttackTarget(true)
  145.  
  146.     SpellCheck()
  147.  
  148.     if IsTickReady(200) then
  149.         CalculateDamage()
  150.     end
  151.  
  152.     if AutoCarry.PluginMenu.SatchelJump then
  153.         SatchelJump()
  154.     end
  155.  
  156.     if (AutoCarry.MainMenu.AutoCarry or AutoCarry.MainMenu.MixedMode) then
  157.         Combo()
  158.     end
  159.    
  160.     if AutoCarry.PluginMenu.FullCombo then
  161.         FullCombo()
  162.     end
  163.  
  164.     if AutoCarry.PluginMenu.Harass then
  165.         Harass()
  166.     end
  167.  
  168.     if AutoCarry.PluginMenu.Killsteal and IsTickReady(50) then
  169.         KillSteal()
  170.     end
  171.    
  172.     if (AutoCarry.MainMenu.LaneClear or AutoCarry.MainMenu.MixedMode) and IsTickReady(50) and AutoCarry.PluginMenu.SmartFarmWithQ and not IsMyManaLow() then
  173.         SmartFarmWithQ()
  174.     end
  175. end
  176.  
  177. function DrawArrowsToPos(pos1, pos2)
  178.     if pos1 and pos2 then
  179.         startVector = D3DXVECTOR3(pos1.x, pos1.y, pos1.z)
  180.         endVector = D3DXVECTOR3(pos2.x, pos2.y, pos2.z)
  181.         -- directionVector = (endVector-startVector):normalized()
  182.         DrawArrows(startVector, endVector, 60, 0xE97FA5, 100)
  183.     end
  184. end
  185.  
  186. function IsTickReady(tickFrequency)
  187.     -- Improves FPS
  188.     if tick ~= nil and math.fmod(tick, tickFrequency) then
  189.         return true
  190.     else
  191.         return false
  192.     end
  193. end
  194.  
  195. function PluginOnCreateObj(obj)
  196.     if obj.name == "ZiggsW_mis_ground.troy" then
  197.         satchelChargeExists = true
  198.         CastWActivate()
  199.     end
  200. end
  201.  
  202. function PluginOnDeleteObj(obj)
  203.     if obj.name == "ZiggsW_mis_ground.troy" then
  204.         satchelChargeExists = false
  205.         pendingSatchelChargeActivation = nil
  206.     end
  207. end
  208.  
  209. function OnAttacked()
  210.     -- Auto AA > Q > AA
  211.     if AutoCarry.PluginMenu.AutoHarass and not IsMyManaLow() then
  212.         CastQ()
  213.     end
  214. end
  215.  
  216. function SpellCheck()
  217.     DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3128),
  218.     GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057),
  219.     GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  220.  
  221.     QReady = (myHero:CanUseSpell(SkillQ.spellKey) == READY)
  222.     WReady = (myHero:CanUseSpell(SkillW.spellKey) == READY)
  223.     EReady = (myHero:CanUseSpell(SkillE.spellKey) == READY)
  224.     RReady = (myHero:CanUseSpell(SkillR.spellKey) == READY)
  225.  
  226.     DFGReady = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  227.     HXGReady = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  228.     BWCReady = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  229.     IReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  230. end
  231.  
  232. -- Handle SBTW Skill Shots
  233.  
  234. function Combo()
  235.     CastSlots()
  236.  
  237.     if not IsMyManaLow() or IsTargetHealthLow() then
  238.         CastE()
  239.     end
  240.  
  241.     CastQ()
  242.     Ultimate()
  243. end
  244.  
  245. function Ultimate()
  246.     if Target ~= nil and AutoCarry.PluginMenu.Ultimate and (doUlt or ((Target.health + 30) < getDmg("R", Target, myHero) and IsValidHitChanceCustom(SkillR, Target))) then
  247.         CastR()
  248.     end
  249. end
  250.  
  251. function FullCombo()
  252.     CastSlots()
  253.     CastE()
  254.     CastQ()
  255.     CastW()
  256.     CastWActivate()
  257.     Ultimate()
  258. end
  259.  
  260. function CastSlots()
  261.     if Target ~= nil and not Target.dead then
  262.         if GetDistance(Target) <= QMaxRange then
  263.             if DFGReady then CastSpell(DFGSlot, Target) end
  264.             if HXGReady then CastSpell(HXGSlot, Target) end
  265.             if BWCReady then CastSpell(BWCSlot, Target) end
  266.         end
  267.     end
  268. end
  269.  
  270. function Harass()
  271.     CastQ()
  272.     if AutoCarry.PluginMenu.HarassWithE then CastE() end
  273. end
  274.  
  275. function CastQ()
  276.     if Target ~= nil and not Target.dead then
  277.         if QReady and ValidTarget(Target, QRange) and IsQWallCheckOK(Target) then
  278.             AutoCarry.CastSkillshot(SkillQ, Target)
  279.         elseif QReady and ValidTarget(Target, QMaxRange) then
  280.             -- Full Bouncing Bomb three bounce range
  281.             local PredictedPos = AutoCarry.GetPrediction(SkillQ, Target)
  282.  
  283.             if PredictedPos and AutoCarry.IsValidHitChance(SkillQ, Target) then
  284.                 local MyPos = Vector(myHero.x, myHero.y, myHero.z)
  285.                 local EnemyPos = Vector(PredictedPos.x, PredictedPos.y, PredictedPos.z)
  286.                 local CastPos = MyPos - (MyPos - EnemyPos):normalized() * QRange
  287.                 if CastPos and GetDistance(CastPos) < QMaxRange and IsQWallCheckOK(CastPos) and IsQWallCheckOK(EnemyPos) then
  288.                     -- CastSpell(SkillQ.spellKey, CastPos.x, CastPos.z)
  289.                     CastSkillshotBounce(SkillQ, CastPos)
  290.                 end
  291.             end
  292.         end
  293.     end
  294. end
  295.  
  296. function IsQWallCheckOK(position)
  297.     if position and not AutoCarry.PluginMenu.AvoidWallsWithQ or (AutoCarry.PluginMenu.AvoidWallsWithQ and not IsWall(D3DXVECTOR3(position.x, myHero.y, position.z))) then
  298.         return true
  299.     else
  300.         return false
  301.     end
  302. end
  303.  
  304. function CastSkillshotBounce(skill, castPos)
  305.     if castPos and GetDistance(castPos) <= skill.range then
  306.         if not skill.minions or not AutoCarry.GetCollision(skill, myHero, castPos) then
  307.             CastSpell(skill.spellKey, castPos.x, castPos.z)
  308.         end
  309.     end
  310. end
  311.  
  312. function CastW(noTarget)
  313.     if noTarget and WReady then
  314.         -- Find vector from mousePos -> myHero
  315.         local vectorX,y,vectorZ = (Vector(myHero) - Vector(mousePos)):normalized():unpack()
  316.  
  317.         -- Cast Satchel behind myHero by specified distance, where behind is determined relative to mousePos -> myHero vector.
  318.         -- if hasBuff("Speed Shrine") then satchelDistance should be less, like 50.
  319.         local satchelDistance = 125
  320.         local posX = myHero.x + (vectorX * satchelDistance)
  321.         local posZ = myHero.z + (vectorZ * satchelDistance)
  322.         CastSpell(SkillW.spellKey, posX, posZ)
  323.     elseif Target ~= nil and ValidTarget(Target, WRange) and not Target.dead then
  324.         if WReady and GetDistance(Target) <= WRange then
  325.             AutoCarry.CastSkillshot(SkillW, Target)
  326.         end
  327.     end
  328. end
  329.  
  330. function CastWActivate()
  331.     if satchelChargeExists and pendingSatchelChargeActivation ~= nil then
  332.         if pendingSatchelChargeActivation == "satcheljump" then
  333.             -- Old delay method
  334.             -- local delayTime = 100
  335.             -- local endClockTime = GetTickCount() + delayTime
  336.             -- while (GetTickCount() < endClockTime) do
  337.             --  -- Sleep
  338.             -- end
  339.  
  340.             CastSpell(SkillW.spellKey)
  341.             if AutoCarry.PluginMenu.SatchelJumpWithE then CastE() end
  342.             pendingSatchelChargeActivation = nil
  343.         end
  344.     end
  345. end
  346.  
  347. function CastE()
  348.     if Target ~= nil and ValidTarget(Target, ERange) and not Target.dead then
  349.         if EReady and GetDistance(Target) <= ERange then
  350.             AutoCarry.CastSkillshot(SkillE, Target)
  351.         end
  352.     end
  353. end
  354.  
  355. function CastR()
  356.     if Target ~= nil and ValidTarget(Target, RRange) and not Target.dead then
  357.         -- if RReady and GetDistance(Target) <= RRange then
  358.         enemyPos = AutoCarry.GetPrediction(SkillR, Target)
  359.         if RReady and enemyPos and ValidTarget(enemyPos, RRange) then
  360.             AutoCarry.CastSkillshot(SkillR, Target)
  361.         end
  362.     end
  363. end
  364.  
  365. function KillSteal()
  366.     for _, enemy in pairs(AutoCarry.EnemyTable) do
  367.         if ValidTarget(enemy, RRange) and not enemy.dead then
  368.             if (enemy.health + 30) < getDmg("R", enemy, myHero) and IsValidHitChanceCustom(SkillR, enemy) then
  369.                 enemyPos = AutoCarry.GetPrediction(SkillR, enemy)
  370.                 if RReady and enemyPos and GetDistance(enemyPos) < RRange then
  371.                     -- Message.AddMessage("Killsteal!", ColorARGB.Green, myHero)
  372.                     PrintFloatText(myHero, 10, "Ultimate Mega Killsteal!")
  373.                     if debugMode then PrintChat("Ultimate Mega Killsteal!") end
  374.                     AutoCarry.CastSkillshot(SkillR, enemy)
  375.                 end
  376.             end
  377.         end
  378.     end
  379. end
  380.  
  381. function SatchelJump()
  382.     -- E is cast before and after jump to insure that a target near either location can be hit.
  383.     pendingSatchelChargeActivation = "satcheljump"
  384.     CastW(true)
  385.     if AutoCarry.PluginMenu.SatchelJumpWithE then CastE() end
  386. end
  387.  
  388. function SmartFarmWithQOld()
  389.     local minions = {}
  390.     for _, minion in pairs(AutoCarry.EnemyMinions().objects) do
  391.         if ValidTarget(minion) and QReady and GetDistance(minion) <= QMaxRange then
  392.             if minion.health < getDmg("Q", minion, myHero) then
  393.                 table.insert(minions, minion)
  394.             end
  395.         end
  396.     end
  397.  
  398.     local pos1 = {x=0,z=0}
  399.     local pos1Count = 0
  400.     local pos2 = {x=0,z=0}
  401.     local pos2Count = 0
  402.  
  403.     local closeMinion = QWidth * 1.5
  404.  
  405.     for _, minion in pairs(minions) do
  406.         if pos1Count == 0 then
  407.             pos1.x = minion.x
  408.             pos1.z = minion.z
  409.             pos1Count = 1
  410.         elseif GetDistance(pos1, minion) < closeMinion then
  411.             pos1.x = ((pos1.x * pos1Count) + minion.x) / (pos1Count + 1)
  412.             pos1.z = ((pos1.z * pos1Count) + minion.z) / (pos1Count + 1)
  413.             pos1Count = pos1Count + 1
  414.         elseif pos2Count == 0 then
  415.             pos2.x = minion.x
  416.             pos2.z = minion.z
  417.             pos2Count = 1
  418.         elseif GetDistance(pos1, minion) < closeMinion then
  419.             pos2.x = ((pos2.x * pos2Count) + minion.x) / (pos2Count + 1)
  420.             pos2.z = ((pos2.z * pos2Count) + minion.z) / (pos2Count + 1)
  421.             pos2Count = pos2Count + 1
  422.         end
  423.     end
  424.  
  425.     if debugMode and (pos1Count > 1 or pos2Count > 1) then
  426.         PrintChat("pos1Count: "..pos1Count..", pos2Count: "..pos2Count)
  427.     end
  428.  
  429.     if pos1Count > pos2Count and pos1Count >= 2 then
  430.         CastSpell(SkillQ.spellKey, pos1.x, pos1.z)
  431.     elseif pos2Count >= 2 then
  432.         CastSpell(SkillQ.spellKey, pos2.x, pos2.z)
  433.     end
  434. end
  435.  
  436. function SmartFarmWithQ()
  437.     local minions = {}
  438.     for _, minion in pairs(AutoCarry.EnemyMinions().objects) do
  439.         if ValidTarget(minion) and QReady and GetDistance(minion) <= QMaxRange then
  440.             if minion.health < getDmg("Q", minion, myHero) then
  441.                 table.insert(minions, minion)
  442.             end
  443.         end
  444.     end
  445.  
  446.     local minionClusters = {}
  447.  
  448.     local closeMinion = QWidth * 1.5
  449.  
  450.     for _, minion in pairs(minions) do
  451.         local foundCluster = false
  452.         for i, mc in ipairs(minionClusters) do
  453.             if GetDistance(mc, minion) < closeMinion then
  454.                 mc.x = ((mc.x * mc.count) + minion.x) / (mc.count + 1)
  455.                 mc.z = ((mc.z * mc.count) + minion.z) / (mc.count + 1)
  456.                 mc.count = mc.count + 1
  457.                 foundCluster = true
  458.                 break
  459.             end
  460.         end
  461.  
  462.         if not foundCluster then
  463.             local mc = {x=0, z=0, count=0}
  464.             mc.x = minion.x
  465.             mc.z = minion.z
  466.             mc.count = 1
  467.             table.insert(minionClusters, mc)
  468.         end
  469.     end
  470.  
  471.     if #minionClusters < 1 then return end
  472.  
  473.     local largestCluster = 0
  474.     local largestClusterSize = 0
  475.     for i, mc in ipairs(minionClusters) do
  476.         if mc.count > largestClusterSize then
  477.             largestCluster = i
  478.             largestClusterSize = mc.count
  479.         end
  480.     end
  481.  
  482.     if debugMode and largestClusterSize >= 2 then
  483.         PrintChat("totalClusters: "..#minionClusters..", largestCluster: "..largestCluster..", largestClusterSize: "..largestClusterSize)
  484.     end
  485.  
  486.     if largestClusterSize >= 2 then
  487.         minionCluster = minionClusters[largestCluster]
  488.        
  489.         -- Needs to be in OnDraw to function.
  490.         -- local minionClusterPoint = {x=minionCluster.x, y=myHero.y, z=minionCluster.z}
  491.         -- DrawArrowsToPos(myHero, minionClusterPoint)
  492.  
  493.         CastSpell(SkillQ.spellKey, minionCluster.x, minionCluster.z)
  494.     end
  495.  
  496.     minions = nil
  497.     minionClusters = nil
  498. end
  499.  
  500. function IsMyManaLow()
  501.     if myHero.mana < (myHero.maxMana * ( AutoCarry.PluginMenu.ManaManager / 100)) then
  502.         return true
  503.     else
  504.         return false
  505.     end
  506. end
  507.  
  508. function IsTargetHealthLow()
  509.     local targetLowHealth = .40
  510.  
  511.     if Target ~= nil and Target.health < (Target.maxHealth * targetLowHealth) then
  512.         return true
  513.     else
  514.         return false
  515.     end
  516. end
  517.  
  518. function IsTargetManaLow()
  519.     local targetLowMana = .15
  520.  
  521.     if Target ~= nil and Target.mana < (Target.maxMana * targetLowMana) then
  522.         return true
  523.     else
  524.         return false
  525.     end
  526. end
  527.  
  528. -- Sliding scale hitchance based on target distance.
  529. function getScalingHitChanceFromDistance(SkillRange, Target)
  530.     local minHitChance = AutoCarry.PluginMenu.KillstealMinHitchance
  531.     local maxHitChance = 95
  532.  
  533.     hitChance = minHitChance + ((1 - (SkillRange - GetDistance(Target)) / (SkillRange - 0))) * (maxHitChance - minHitChance)
  534.     if debugMode then PrintChat("HitChance Info: skillrange="..SkillRange..", targetdistance="..GetDistance(Target)..", hitchance:"..hitChance) end
  535.     return hitChance
  536. end
  537.  
  538. function IsValidHitChanceCustom(skill, target)
  539.     if VIP_USER then
  540.         pred = TargetPredictionVIP(skill.range, skill.speed*1000, skill.delay/1000, skill.width)
  541.         return pred:GetHitChance(target) > getScalingHitChanceFromDistance(skill.range, target)/100 and true or false
  542.     elseif not VIP_USER then
  543.         local nonVIPMaxHitChance = 70
  544.         return getScalingHitChanceFromDistance(skill.range, target) < nonVIPMaxHitChance and true or false
  545.     end
  546. end
  547.  
  548. --[[
  549. function satchelChargeExistsDelete()
  550.     for i=1, objManager.maxObjects do
  551.         local obj = objManager:getObject(i)
  552.  
  553.         if obj ~= nil and obj.name:find("Satchel Charge") then
  554.             return true
  555.         end
  556.     end
  557.     return false
  558. end
  559. --]]
  560.  
  561. -- Handle Manual Skill Shots
  562.  
  563. function PluginOnWndMsg(msg,key)
  564.     Target = AutoCarry.GetAttackTarget()
  565.     if Target ~= nil then
  566.         if msg == KEY_DOWN and key == KeyQ then CastQ() end
  567.         if msg == KEY_DOWN and key == KeyW then CastW() end
  568.         if msg == KEY_DOWN and key == KeyE then CastE() end
  569.         if msg == KEY_DOWN and key == KeyR then CastR() end
  570.     end
  571. end
  572.  
  573. -- Drawing
  574.  
  575. function PluginOnDraw()
  576.     -- if Target ~= nil and not Target.dead and QReady and ValidTarget(Target, QMaxRange) then
  577.     if Target ~= nil and not Target.dead and (AutoCarry.MainMenu.AutoCarry or AutoCarry.MainMenu.MixedMode) then
  578.         DrawArrowsToPos(myHero, Target)
  579.     end
  580.  
  581.     if AutoCarry.PluginMenu.Draw then
  582.         DrawCircle(myHero.x, myHero.y, myHero.z, AutoCarry.SkillsCrosshair.range, 0x808080) -- Gray
  583.  
  584.         if myHero:CanUseSpell(SkillQ.spellKey) then
  585.             DrawCircle(myHero.x, myHero.y, myHero.z, QRange, 0x0099CC) -- Blue
  586.         end
  587.        
  588.         if myHero:CanUseSpell(SkillW.spellKey) then
  589.             DrawCircle(myHero.x, myHero.y, myHero.z, WRange, 0xFFFF00) -- Yellow
  590.         end
  591.        
  592.         if myHero:CanUseSpell(SkillE.spellKey) then
  593.             DrawCircle(myHero.x, myHero.y, myHero.z, ERange, 0x00FF00) -- Green
  594.         end
  595.  
  596.         if AutoCarry.PluginMenu.DrawUlt then
  597.             if myHero:CanUseSpell(SkillR.spellKey) then
  598.                 DrawCircle(myHero.x, myHero.y, myHero.z, RRange, 0xFF0000) -- Red
  599.             end
  600.         end
  601.  
  602.         Target = AutoCarry.GetAttackTarget()
  603.         if Target ~= nil then
  604.             for j=0, 10 do
  605.                 DrawCircle(Target.x, Target.y, Target.z, 40 + j*1.5, 0x00FF00) -- Green
  606.             end
  607.         end
  608.     end
  609.    
  610.     DrawKillable()
  611. end
  612.  
  613. function CalculateDamage()
  614.         if ValidTarget(Target) then
  615.                 local dfgdamage, hxgdamage, bwcdamage, ignitedamage, Sheendamage, Trinitydamage, LichBanedamage  = 0, 0, 0, 0, 0, 0, 0
  616.                 local pdamage = getDmg("P",Target,myHero)
  617.                 local qdamage = getDmg("Q",Target,myHero)
  618.                 local wdamage = getDmg("W",Target,myHero)
  619.                 local edamage = getDmg("E",Target,myHero)
  620.                 local rdamage = getDmg("R",Target,myHero)
  621.                 local hitdamage = getDmg("AD",Target,myHero)
  622.                 local dfgdamage = (DFGSlot and getDmg("DFG",Target,myHero) or 0)
  623.                 local hxgdamage = (HXGSlot and getDmg("HXG",Target,myHero) or 0)
  624.                 local bwcdamage = (BWCSlot and getDmg("BWC",Target,myHero) or 0)
  625.                 local ignitedamage = (ignite and getDmg("IGNITE",Target,myHero) or 0)
  626.                 local Sheendamage = (SheenSlot and getDmg("SHEEN",Target,myHero) or 0)
  627.                 local Trinitydamage = (TrinitySlot and getDmg("TRINITY",Target,myHero) or 0)
  628.                 local LichBanedamage = (LichBaneSlot and getDmg("LICHBANE",Target,myHero) or 0)
  629.                 local combo1 = hitdamage + qdamage + wdamage + edamage + rdamage + Sheendamage + Trinitydamage + LichBanedamage --0 cd
  630.                 local combo2 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  631.                 local combo3 = hitdamage + Sheendamage + Trinitydamage + LichBanedamage
  632.                 local combo4 = 0
  633.                
  634.                 if QREADY then
  635.                         combo2 = combo2 + qdamage
  636.                         combo3 = combo3 + qdamage
  637.                         --combo4 = combo4 + qdamage
  638.                 end
  639.                 if WREADY then
  640.                         combo2 = combo2 + wdamage
  641.                         combo3 = combo3 + wdamage
  642.                 end
  643.                 if EREADY then
  644.                         combo2 = combo2 + edamage
  645.                         combo3 = combo3 + edamage
  646.                         --combo4 = combo4 + edamage
  647.                 end
  648.                 if RREADY then
  649.                         combo2 = combo2 + rdamage
  650.                         combo3 = combo3 + rdamage
  651.                         combo4 = combo4 + rdamage
  652.                 end
  653.                 if DFGREADY then        
  654.                         combo1 = combo1 + dfgdamage            
  655.                         combo2 = combo2 + dfgdamage
  656.                         combo3 = combo3 + dfgdamage
  657.                         --combo4 = combo4 + dfgdamage
  658.                 end
  659.                 if HXGREADY then              
  660.                         combo1 = combo1 + hxgdamage    
  661.                         combo2 = combo2 + hxgdamage
  662.                         combo3 = combo3 + hxgdamage
  663.                         --combo4 = combo4 + hxgdamage
  664.                 end
  665.                 if BWCREADY then
  666.                         combo1 = combo1 + bwcdamage
  667.                         combo2 = combo2 + bwcdamage
  668.                         combo3 = combo3 + bwcdamage
  669.                         combo4 = combo4 + bwcdamage
  670.                 end
  671.                 if IREADY then
  672.                         combo1 = combo1 + ignitedamage
  673.                         combo2 = combo2 + ignitedamage
  674.                         combo3 = combo3 + ignitedamage
  675.                 end
  676.                 if combo4 >= Target.health then killable[calculationenemy] = 4 doUlt = true
  677.                 elseif combo3 >= Target.health then killable[calculationenemy] = 3 doUlt = false
  678.                 elseif combo2 >= Target.health then killable[calculationenemy] = 2 doUlt = false
  679.                 elseif combo1 >= Target.health then killable[calculationenemy] = 1  doCombo = true doUlt = false
  680.                 else killable[calculationenemy] = 0 doCombo = false doUlt = false end
  681.         end
  682.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  683.         else calculationenemy = calculationenemy-1 end
  684. end
  685.  
  686. function DrawKillable()
  687.     if 1 == 2 and Target ~= nil and AutoCarry.PluginMenu.DrawPrediction then
  688.         if VIP_USER then
  689.             pred = TargetPredictionVIP(SkillQ.range, SkillQ.speed*1000, SkillQ.delay/1000, SkillQ.width)
  690.         elseif not VIP_USER then
  691.             pred = TargetPrediction(SkillQ.range, SkillQ.speed, SkillQ.delay, SkillQ.width)
  692.         end
  693.         predPos = pred:GetPrediction(Target)
  694.         DrawCircle(predPos.x, Target.y, predPos.z, 200, 0x0000FF)
  695.     end
  696.     for i=1, heroManager.iCount do
  697.         local enemydraw = heroManager:GetHero(i)
  698.         if ValidTarget(enemydraw) then
  699.             if AutoCarry.PluginMenu.DrawKillablEenemy then
  700.                 if killable[i] == 1 then
  701.                     for j=0, 20 do
  702.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0x0000FF)
  703.                     end
  704.                 elseif killable[i] == 2 then
  705.                     for j=0, 10 do
  706.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  707.                     end
  708.                 elseif killable[i] == 3 then
  709.                     for j=0, 10 do
  710.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  711.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  712.                     end
  713.                 elseif killable[i] == 4 then
  714.                     for j=0, 10 do
  715.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + j*1.5, 0xFF0000)
  716.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + j*1.5, 0xFF0000)
  717.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + j*1.5, 0xFF0000)
  718.                     end
  719.                 end
  720.             end
  721.             if AutoCarry.PluginMenu.DrawText and waittxt ~= nil and waittxt[i] == 1 and killable ~= nil and killable[i] ~= 0 then
  722.                     PrintFloatText(enemydraw,0,floattext[killable[i]])
  723.             end
  724.         end
  725.         if waittxt ~= nil then
  726.             if waittxt[i] == 1 then waittxt[i] = 30
  727.             else waittxt[i] = waittxt[i]-1 end
  728.         end
  729.     end
  730. end
  731.  
  732. --[[
  733. class 'ColorARGB' -- {
  734.  
  735.     function ColorARGB:__init(red, green, blue, alpha)
  736.         self.R = red or 255
  737.         self.G = green or 255
  738.         self.B = blue or 255
  739.         self.A = alpha or 255
  740.     end
  741.  
  742.     function ColorARGB.FromArgb(red, green, blue, alpha)
  743.         return Color(red,green,blue, alpha)
  744.     end
  745.  
  746.     function ColorARGB:ToARGB()
  747.         return ARGB(self.A, self.R, self.G, self.B)
  748.     end
  749.  
  750.     ColorARGB.Red = ColorARGB(255, 0, 0, 255)
  751.     ColorARGB.Yellow = ColorARGB(255, 255, 0, 255)
  752.     ColorARGB.Green = ColorARGB(0, 255, 0, 255)
  753.     ColorARGB.Aqua = ColorARGB(0, 255, 255, 255)
  754.     ColorARGB.Blue = ColorARGB(0, 0, 255, 255)
  755.     ColorARGB.Fuchsia = ColorARGB(255, 0, 255, 255)
  756.     ColorARGB.Black = ColorARGB(0, 0, 0, 255)
  757.     ColorARGB.White = ColorARGB(255, 255, 255, 255)
  758. -- }
  759.  
  760. --Notification class
  761. class 'Message' -- {
  762.  
  763.     Message.instance = ""
  764.  
  765.     function Message:__init()
  766.         self.notifys = {}
  767.  
  768.         AddDrawCallback(function(obj) self:OnDraw() end)
  769.     end
  770.  
  771.     function Message.Instance()
  772.         if Message.instance == "" then Message.instance = Message() end return Message.instance
  773.     end
  774.  
  775.     function Message.AddMessage(text, color, target)
  776.         return Message.Instance():PAddMessage(text, color, target)
  777.     end
  778.  
  779.     function Message:PAddMessage(text, color, target)
  780.         local x = 0
  781.         local y = 200
  782.         local tempName = "Screen"
  783.         local tempcolor = color or ColorARGB.Red
  784.  
  785.         if target then  
  786.             tempName = target.networkID
  787.         end
  788.  
  789.         self.notifys[tempName] = { text = text, color = tempcolor, duration = GetGameTimer() + 2, object = target}
  790.     end
  791.  
  792.     function Message:OnDraw()
  793.         for i, notify in pairs(self.notifys) do
  794.             if notify.duration < GetGameTimer() then notify = nil
  795.             else
  796.                 notify.color.A = math.floor((255/2)*(notify.duration - GetGameTimer()))
  797.  
  798.                 if i == "Screen" then  
  799.                     local x = 0
  800.                     local y = 200
  801.                     local gameSettings = GetGameSettings()
  802.                     if gameSettings and gameSettings.General then
  803.                         if gameSettings.General.Width then x = gameSettings.General.Width/2 end
  804.                         if gameSettings.General.Height then y = gameSettings.General.Height/4 - 100 end
  805.                     end  
  806.                     --PrintChat(tostring(notify.color))
  807.                     local p = GetTextArea(notify.text, 40).x
  808.                     self:DrawTextWithBorder(notify.text, 40, x - p/2, y, notify.color:ToARGB(), ARGB(notify.color.A, 0, 0, 0))
  809.                 else    
  810.                     local pos = WorldToScreen(D3DXVECTOR3(notify.object.x, notify.object.y, notify.object.z))
  811.                     local x = pos.x
  812.                     local y = pos.y - 25
  813.                     local p = GetTextArea(notify.text, 40).x
  814.  
  815.                     self:DrawTextWithBorder(notify.text, 30, x- p/2, y, notify.color:ToARGB(), ARGB(notify.color.A, 0, 0, 0))
  816.                 end
  817.             end
  818.         end
  819.     end
  820.  
  821.     function Message:DrawTextWithBorder(textToDraw, textSize, x, y, textColor, backgroundColor)
  822.         DrawText(textToDraw, textSize, x + 1, y, backgroundColor)
  823.         DrawText(textToDraw, textSize, x - 1, y, backgroundColor)
  824.         DrawText(textToDraw, textSize, x, y - 1, backgroundColor)
  825.         DrawText(textToDraw, textSize, x, y + 1, backgroundColor)
  826.         DrawText(textToDraw, textSize, x , y, textColor)
  827.     end
  828. -- }
  829. --]]
Advertisement
Add Comment
Please, Sign In to add comment