Advertisement
Guest User

beta

a guest
Jan 11th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.96 KB | None | 0 0
  1. local Menu_GSO = MenuElement({type = MENU, id = "menugso", name = "TEST"})
  2. Menu_GSO:MenuElement({name = "Color Minion", id = "colmin", color = Draw.Color(150, 49, 210, 0)})
  3. Menu_GSO:MenuElement({name = "Color Missile", id = "colmis", color = Draw.Color(150, 153, 0, 76)})
  4. Menu_GSO:MenuElement({id = "lhit", name = "LastHit Key", key = string.byte("X")})
  5.  
  6. local ActiveAttacks = {}
  7. local FarmMinions = {}
  8. local LastAA = 0
  9. local DelayedMouse = nil
  10. local LastMove = 0
  11.  
  12. local function IsValidTarget_GSO(range, unit)
  13. local type = unit.type
  14. local isUnit = type == Obj_AI_Hero or type == Obj_AI_Minion or type == Obj_AI_Turret
  15. local isValid = isUnit and unit.valid or true
  16. if unit.distance<=range and not unit.dead and unit.isTargetable and unit.visible and isValid then
  17. return true
  18. end
  19. return false
  20. end
  21.  
  22. local function GetAllyMinions_GSO(range)
  23. local result = {}
  24. for i = 1, Game.MinionCount() do
  25. local minion = Game.Minion(i)
  26. if minion.isAlly and IsValidTarget_GSO(range, minion) then
  27. result[#result + 1] = minion
  28. end
  29. end
  30. return result
  31. end
  32.  
  33. local function GetEnemyMinions_GSO(range)
  34. local result = {}
  35. for i = 1, Game.MinionCount() do
  36. local minion = Game.Minion(i)
  37. local isotherminion = minion.maxHealth <= 6
  38. if minion.isEnemy and not isotherminion and IsValidTarget_GSO(range, minion) then
  39. result[#result + 1] = minion
  40. end
  41. end
  42. return result
  43. end
  44.  
  45. Callback.Add("Tick", function()
  46. if DelayedMouse ~= nil and GetTickCount() - DelayedMouse[2] > DelayedMouse[3] then
  47. DelayedMouse[1]()
  48. DelayedMouse = nil
  49. end
  50. local tEnemyMinions = GetEnemyMinions_GSO(2000)
  51. for i = 1, #tEnemyMinions do
  52. local minion = tEnemyMinions[i]
  53. if not FarmMinions[minion.handle] then
  54. FarmMinions[minion.handle] = { obj = minion, lastHit = false, lastHitSoon = false, laneClear = false }
  55. end
  56. end
  57. local tAllyMinions = GetAllyMinions_GSO(2000)
  58. for i = 1, #tAllyMinions do
  59. local minion = tAllyMinions[i]
  60. local minion_id = minion.handle
  61. local minion_aadata = minion.attackData
  62. local minion_target = minion.attackData.target
  63. local canNext = true
  64. if minion_target and minion_aadata.endTime > Game.Timer() then
  65. for k,v in pairs(FarmMinions) do
  66. if k == minion_target then
  67. if ActiveAttacks[minion_id] then
  68. for k2,v2 in pairs(ActiveAttacks[minion_id]) do
  69. if k2 == math.floor(minion_aadata.endTime) then
  70. canNext = false
  71. end
  72. end
  73. end
  74. if canNext then
  75. local minion_projspeed = minion_aadata.projectileSpeed
  76. local minion_animT = minion_aadata.animationTime
  77. local minion_projT = minion_projspeed > 0 and minion.pos:DistanceTo(v.obj.pos) / minion_projspeed or 0
  78. local projStartT = minion_aadata.endTime - ( minion_animT - minion_aadata.windUpTime )
  79. local aacompleteT = minion_aadata.endTime + minion_projT - minion_aadata.windDownTime
  80. local checkT = Game.Timer()
  81. if not ActiveAttacks[minion_id] then
  82. ActiveAttacks[minion_id] = {}
  83. end
  84. if aacompleteT > checkT then--and minion_projspeed > 0 then
  85. if checkT > projStartT + Game.Latency()*0.001 then
  86. if not ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] then
  87. local doneT = Game.Timer() - projStartT
  88. local speed = minion_projspeed
  89. local pos = minion.pos:Extended(v.obj.pos, speed*doneT)
  90. ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] = {
  91. projSpeed = minion_projspeed,
  92. startProjT = projStartT,
  93. startT = Game.Timer(),
  94. completeT = aacompleteT,
  95. canceled = false,
  96. missilePos = pos,
  97. from = minion,
  98. fromPos = minion.pos,
  99. to = v.obj,
  100. damageTo = minion.totalDamage*(1+minion.bonusDamagePercent) - 0.01,
  101. toID = minion_target
  102. }
  103. end
  104. elseif minion.pathing.hasMovePath or minion.dead then
  105. --print("attack canceled")
  106. ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] = { canceled = true, from = minion }
  107. end
  108. end
  109. end
  110. break
  111. end
  112. end
  113. end
  114. end
  115. local ActiveAttacks2 = ActiveAttacks
  116. for k1,v1 in pairs(ActiveAttacks2) do
  117. local count = 0
  118. for k2,v2 in pairs(ActiveAttacks[k1]) do
  119. count = count + 1
  120. if not v2.from or v2.from == nil or v2.from.dead then
  121. --print("dead")
  122. ActiveAttacks[k1] = nil
  123. break
  124. end
  125. if v2.canceled == false then
  126. if Game.Timer() > v2.completeT then
  127. ActiveAttacks[k1][k2] = nil
  128. else
  129. local doneT = Game.Timer() + Game.Latency()*0.001 - v2.startProjT
  130. local speed = v2.projSpeed
  131. local pos = v2.fromPos:Extended(v2.to.pos, speed*doneT)
  132. ActiveAttacks[k1][k2].missilePos = pos
  133. end
  134. end
  135. end
  136. if count == 0 then
  137. --print("no active attacks")
  138. ActiveAttacks[k1] = nil
  139. end
  140. end
  141. local FarmMinions2 = FarmMinions
  142. for k1,v1 in pairs(FarmMinions2) do
  143. local canNext = true
  144. if not v1.obj or v1.obj == nil or v1.obj.dead then
  145. FarmMinions[k1] = nil
  146. canNext = false
  147. end
  148. if canNext then
  149. local aacompleteT = myHero.attackData.windUpTime + (v1.obj.distance / myHero.attackData.projectileSpeed)
  150. local hp = v1.obj.health
  151. for k2,v2 in pairs(ActiveAttacks) do
  152. for k3,v3 in pairs(ActiveAttacks[k2]) do
  153. if v3.canceled == false and v3.toID == k1 then
  154. if v3.completeT - Game.Timer() < aacompleteT - Game.Latency()*0.0005 then
  155. hp = hp - v3.from.totalDamage*(1+v3.from.bonusDamagePercent) - 0.01
  156. end
  157. end
  158. end
  159. end
  160. if hp - myHero.totalDamage < 0 then
  161. v1.lastHit = true
  162. else
  163. v1.lastHit = false
  164. end
  165. end
  166. end
  167. if Menu_GSO.lhit:Value() then
  168. local AAtarget = nil
  169. for k1,v1 in pairs(FarmMinions) do
  170. if v1.lastHit and v1.obj.distance < myHero.range + myHero.boundingRadius + v1.obj.boundingRadius - 30 then
  171. AAtarget = v1.obj
  172. break
  173. end
  174. end
  175. local checkT = GetTickCount()
  176. if checkT > LastAA + (myHero.attackData.animationTime*1000) + 125 and AAtarget ~= nil then
  177. local cPos = cursorPos
  178. Control.SetCursorPos(AAtarget.pos)
  179. Control.mouse_event(MOUSEEVENTF_RIGHTDOWN)
  180. Control.mouse_event(MOUSEEVENTF_RIGHTUP)
  181. LastAA = GetTickCount()
  182. LastMove = 0
  183. DelayedMouse = { function() Control.SetCursorPos(cPos.x, cPos.y) end, GetTickCount(), 50 }
  184. elseif checkT > LastAA + (myHero.attackData.windUpTime*1000) + 150 and GetTickCount() > LastMove + 200 then
  185. Control.mouse_event(0x0008)
  186. Control.mouse_event(0x0010)
  187. LastMove = GetTickCount()
  188. end
  189.  
  190. end
  191. end)
  192.  
  193. Callback.Add("Draw", function()
  194. for k1,v1 in pairs(FarmMinions) do
  195. if v1.lastHit then
  196. Draw.Circle(v1.obj.pos, v1.obj.boundingRadius, 5, Menu_GSO.colmin:Value())
  197. end
  198. end
  199. for k1,v1 in pairs(ActiveAttacks) do
  200. for k2,v2 in pairs(ActiveAttacks[k1]) do
  201. if v2.to and not v2.to.dead and Game.Timer() > v2.startProjT then
  202. Draw.Circle(v2.missilePos, 10, 10, Menu_GSO.colmis:Value())
  203. end
  204. end
  205. end
  206. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement