Illprotectjew

Draven w/Auto Carry Beta v0.1

Jun 6th, 2013
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.92 KB | None | 0 0
  1. require "Utils"
  2. require "spell_damage"
  3.  
  4. p = printtext
  5.  
  6. local target
  7. local target2
  8. local targetHero
  9. local startAttackSpeed
  10. local projSpeed = 1
  11. local lastAttack = GetTickCount()
  12. local shotFired = false
  13. local range = myHero.range + GetDistance(GetMinBBox(myHero))
  14. local attackDelayOffset = 415
  15. local isMoving = false
  16. local startAttackSpeed = 0.625
  17. local script_loaded=1
  18. local active = false
  19.  
  20. DravenConfig = scriptConfig('Draven AutoCarry Config', 'dravenACconfig')
  21.     DravenConfig:addParam('catchaxe', 'CatchAxe', SCRIPT_PARAM_ONKEYTOGGLE, false, string.byte("Z"))
  22. OrbConfig = scriptConfig("AutoCarry", "Orb")
  23. OrbConfig:addParam("AutoCarry", "OrbWalk", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
  24. OrbConfig:addParam("Hybrid", "Hybrid", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("X"))
  25. OrbConfig:addParam("Farm", "Farm", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("C"))
  26. OrbConfig:addParam("Kite", "Kite", SCRIPT_PARAM_ONOFF, true,string.byte("O"))
  27. OrbConfig:addParam("Draw", "Draw Circles", SCRIPT_PARAM_ONOFF, true,string.byte("P"))
  28. OrbConfig:permaShow("AutoCarry")
  29. OrbConfig:permaShow("Hybrid")
  30. OrbConfig:permaShow("Farm")
  31. DravenConfig:permaShow("catchaxe")
  32.  
  33. function OnCreateObj(obj)
  34.     if obj ~= nil and DravenConfig.catchaxe then
  35.         if string.find(obj.charName, "Draven_Q_reticle") then
  36.             if GetDistance(obj,myHero)<300 then
  37.                 MoveToXYZ(obj.x,obj.y,obj.z)
  38.             end
  39.             if GetDistance(obj,myHero)>300 and GetDistance(obj,myHero)<700 then
  40.                 CastSpellTarget('W',myHero)
  41.                 MoveToXYZ(obj.x,obj.y,obj.z)
  42.             end
  43.             if GetDistance(obj) < 5 then StopMove() end
  44.         end
  45.         if string.find(obj.charName, "Draven_Q_ReticleCatchSuccess") then
  46.                 target = GetWeakEnemy('PHYS',900,'NEARMOUSE')
  47.                 if (target~=nil) and GetDistance(target,myHero)<900 then
  48.                     CastSpellTarget('W',myHero)
  49.                     Action()
  50.             else
  51.                 target = GetLowestHealthEnemyMinion(550)
  52.                 if target ~= nil then
  53.                 CastHotkey('AUTO 100,0 ATTACK:WEAKMINION RANGE=550 ONESPELLHIT=(((.35+(spellq_level*.1))*player_ad)+player_ad)')
  54.                 end
  55.             end
  56.             end
  57.         end
  58.     end
  59.  
  60. function OnTick()
  61. targetReset()
  62.     if target and target.dead == 1 then target = nil end
  63.  
  64.     if OrbConfig.AutoCarry and IsChatOpen() == 0 then
  65.     CustomCircle(range,2,4,myHero)
  66.         if target2 ~= nil then target = target2 else target = GetWeakEnemy("PHYS",range) end
  67.         if target ~= nil then
  68.         UseAllItems(target)
  69.         Action()
  70.         else
  71.         moveToCursor()
  72.         end
  73.     end
  74.    
  75.     if OrbConfig.Hybrid and IsChatOpen() == 0 then
  76.             CustomCircle(range,2,4,myHero)
  77.             targetHero = GetWeakEnemy("PHYS",range)
  78.             if targetHero ~= nil then
  79.                 target = targetHero
  80.                 Action()
  81.             else target = GetLowestHealthEnemyMinion(range) end
  82.             if target ~= nil then
  83.                 if getDmg("AD",target,myHero) >= target.health then
  84.                     Action()
  85.                 end
  86.             else
  87.                 moveToCursor()
  88.             end
  89.         end
  90.            
  91.    
  92.     if OrbConfig.Farm and IsChatOpen() == 0 then
  93.     CustomCircle(range,2,4,myHero)
  94.         if target2 ~= nil then target = target2 elseif GetLowestHealthEnemyMinion(range) ~= nil then target = GetLowestHealthEnemyMinion(range) end
  95.         if target ~= nil then
  96.         if getDmg("AD",target,myHero) >= target.health then
  97.         Action()
  98.         end
  99.         else
  100.         moveToCursor()
  101.         end
  102.     end
  103.        
  104.     if OrbConfig.AutoCarry or OrbConfig.Hybrid or OrbConfig.Farm then
  105.     moveToCursor()
  106.     end
  107.    
  108.     if OrbConfig.Draw then
  109.     if myHero.dead ~= 1 then
  110.     CustomCircle(trueRange(),2,5,myHero)
  111.     end
  112.     end
  113. end
  114.  
  115. function OnLoad()
  116.     if GetAAData()[myHero.name] ~= nil then
  117.         if GetAAData()[myHero.name].projSpeed ~= nil then
  118.             projSpeed = GetAAData()[myHero.name].projSpeed
  119.         end
  120.     end
  121.     if GetAAData()[myHero.name] ~= nil then
  122.         if GetAAData()[myHero.name].startAttackSpeed ~= nil then
  123.             startAttackSpeed = GetAAData()[myHero.name].startAttackSpeed
  124.         end
  125.     end
  126.     p("\nTrue Range: "..math.ceil(range).."\nTraditional Range: "..myHero.range)
  127. end
  128.  
  129. function trueRange()
  130. local trueRangeValue
  131.     if target ~= nil and GetDistance(target) < range then
  132.         trueRangeValue = range -(range-GetDistance(target))
  133.     else
  134.         trueRangeValue = range
  135.     end
  136.     return trueRangeValue
  137. end
  138.  
  139. function targetReset()
  140.     if not target and not target2 and not targetHero then
  141.     target = nil
  142.     target2 = nil
  143.     targetHero = nil
  144.     end
  145. end
  146.  
  147. function Action()
  148.         if timeToShoot() and string.find(obj.charName, "Draven_Q_reticle") == nil then
  149.             attackEnemy(target)
  150.             CustomCircle(100,10,1,target)
  151.         else
  152.             CustomCircle(100,5,2,target)
  153.             if heroCanMove() then moveToCursor() end
  154.         end
  155. end
  156.  
  157. function attackEnemy(target)
  158.     if ValidTarget(target) then
  159.     AttackTarget(target)
  160.     shotFired = True
  161.     end
  162. end
  163.  
  164. function GetNextAttackTime()
  165. return lastAttack + attackDelayOffset / GetAttackSpeed()
  166. end
  167.  
  168. function GetAttackSpeed()
  169. return myHero.attackspeed/(1/startAttackSpeed)
  170. end
  171.  
  172. function timeToShoot()
  173.     if GetTickCount() > GetNextAttackTime() then
  174.     return true
  175.     end
  176.     return false
  177. end
  178.  
  179. function heroCanMove()
  180.     if string.find(obj.charName, "Draven_Q_reticle") == nil then
  181.     if shotFired == false or timeToShoot() then
  182.         return true
  183.     end
  184.     return false
  185.     end
  186. end
  187.  
  188. function moveToCursor() -- Removes derping when mouse is in one position instead of myHero:MoveTo mousePos
  189.     if string.find(obj.charName, "Draven_Q_reticle") == nil then
  190.     isMoving = true
  191.     local moveSqr = math.sqrt((mousePos.x - myHero.x)^2+(mousePos.z - myHero.z)^2)
  192.     local moveX = myHero.x + 300*((mousePos.x - myHero.x)/moveSqr)
  193.     local moveZ = myHero.z + 300*((mousePos.z - myHero.z)/moveSqr)
  194.     MoveToXYZ(moveX,0,moveZ)
  195.     end
  196. end
  197.  
  198. function OnCreateObj(object)
  199.     if GetAAData()[myHero.name] ~= nil then
  200.         for _, v in pairs(GetAAData()[myHero.name].aaParticles) do
  201.             if string.find(object.charName,v)  
  202.                 then
  203.                 shotFired = false
  204.                 lastAttack = GetTickCount()
  205.             end
  206.         end
  207.     end
  208. end
  209.  
  210. function OnProcessSpell(obj,spell)
  211.     if obj ~= nil and obj.name == myHero.name then
  212.         if string.find(spell.name,aaSpellName) then        
  213.             lastAttack = GetTickCount()
  214.         end
  215.     end
  216. end
  217.  
  218. function GetAAData()
  219.     return {
  220.         Draven       = { projSpeed = 1.4, aaParticles = {"Draven_BasicAttack_mis","Draven_Q_mis", "Draven_Q_mis_bloodless", "Draven_Q_mis_shadow", "Draven_Q_mis_shadow_bloodless", "Draven_Qcrit_mis", "Draven_Qcrit_mis_bloodless", "Draven_Qcrit_mis_shadow", "Draven_Qcrit_mis_shadow_bloodless", "Draven_BasicAttack_mis_shadow", "Draven_BasicAttack_mis_shadow_bloodless", "Draven_BasicAttack_mis_bloodless", "Draven_crit_mis", "Draven_crit_mis_shadow_bloodless", "Draven_crit_mis_bloodless", "Draven_crit_mis_shadow", "Draven_Q_mis", "Draven_Qcrit_mis", "Draven_BasicAttackAlt_mis", "Draven_Q_Alt_mis"}, aaSpellName = {"DravenBasicAttack", "DravenBasicAttack2", "dravenspinningattack"}, startAttackSpeed = "0.679" }
  221.     }
  222. end
  223.  
  224. OnLoad()
  225. if GetAAData()[myHero.name] ~= nil then p("\n\nAuto Carry Loaded: "..myHero.name.."\n") end
  226.  
  227. SetTimerCallback("OnTick")
Advertisement
Add Comment
Please, Sign In to add comment