Advertisement
Guest User

Untitled

a guest
Jan 11th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.69 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 checkT + Game.Latency()*0.0005 < aacompleteT then
  85. if minion_projspeed > 0 then
  86. if checkT + Game.Latency()*0.0005 > projStartT then
  87. if not ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] then
  88. local doneT = Game.Timer() - projStartT
  89. local speed = minion_projspeed
  90. local pos = minion.pos:Extended(v.obj.pos, speed*doneT)
  91. ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] = {
  92. melee = false,
  93. canceled = false,
  94. projSpeed = minion_projspeed,
  95. startProjT = projStartT,
  96. completeT = aacompleteT,
  97. missilePos = pos,
  98. from = minion,
  99. to = v.obj,
  100. damageTo = minion.totalDamage*(1+minion.bonusDamagePercent) - 0.01
  101. }
  102. end
  103. elseif minion.pathing.hasMovePath then
  104. --print("attack canceled")
  105. ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] = { canceled = true, melee = false, from = minion }
  106. end
  107. else
  108. --cancancel
  109. if not ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] then
  110. ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] = {
  111. melee = true,
  112. canceled = false,
  113. startProjT = aacompleteT - minion_animT,
  114. completeT = aacompleteT,
  115. from = minion,
  116. to = v.obj,
  117. damageTo = minion.totalDamage*(1+minion.bonusDamagePercent) - 0.01
  118. }
  119. elseif minion.pathing.hasMovePath then
  120. ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)].canceled = true;
  121. end
  122.  
  123. end
  124. end
  125. end
  126. break
  127. end
  128. end
  129. end
  130. end
  131. local ActiveAttacks2 = ActiveAttacks
  132. for k1,v1 in pairs(ActiveAttacks2) do
  133. local count = 0
  134. for k2,v2 in pairs(ActiveAttacks[k1]) do
  135. count = count + 1
  136. if not v2.from or v2.from == nil or v2.from.dead then
  137. --print("dead")
  138. ActiveAttacks[k1] = nil
  139. break
  140. end
  141. if v2.canceled == false then
  142. if Game.Timer() > v2.completeT then
  143. ActiveAttacks[k1][k2] = nil
  144. elseif v2.melee == false then
  145. local doneT = Game.Timer() + Game.Latency()*0.0005 - v2.startProjT
  146. local speed = v2.projSpeed
  147. local pos = v2.from.pos:Extended(v2.to.pos, speed*doneT)
  148. ActiveAttacks[k1][k2].missilePos = pos
  149. end
  150. end
  151. end
  152. if count == 0 then
  153. --print("no active attacks")
  154. ActiveAttacks[k1] = nil
  155. end
  156. end
  157. local FarmMinions2 = FarmMinions
  158. for k1,v1 in pairs(FarmMinions2) do
  159. local canNext = true
  160. if not v1.obj or v1.obj == nil or v1.obj.dead then
  161. FarmMinions[k1] = nil
  162. canNext = false
  163. end
  164. if canNext then
  165. local aacompleteT = myHero.attackData.windUpTime + (v1.obj.distance / myHero.attackData.projectileSpeed)
  166. local hp = v1.obj.health
  167. for k2,v2 in pairs(ActiveAttacks) do
  168. for k3,v3 in pairs(ActiveAttacks[k2]) do
  169. if v3.canceled == false and v3.to.handle == k1 and Game.Timer() > v3.startProjT then
  170. if v3.completeT - Game.Timer() + Game.Latency()*0.0005 < aacompleteT then
  171. hp = hp - v3.damageTo
  172. end
  173. end
  174. end
  175. end
  176. if hp - myHero.totalDamage < 0 then
  177. v1.lastHit = true
  178. else
  179. v1.lastHit = false
  180. end
  181. end
  182. end
  183. if Menu_GSO.lhit:Value() then
  184. local AAtarget = nil
  185. for k1,v1 in pairs(FarmMinions) do
  186. if v1.lastHit and v1.obj.distance < myHero.range + myHero.boundingRadius + v1.obj.boundingRadius - 30 then
  187. AAtarget = v1.obj
  188. break
  189. end
  190. end
  191. local checkT = GetTickCount()
  192. if checkT > LastAA + (myHero.attackData.animationTime*1000) + 125 and AAtarget ~= nil then
  193. local cPos = cursorPos
  194. Control.SetCursorPos(AAtarget.pos)
  195. Control.mouse_event(MOUSEEVENTF_RIGHTDOWN)
  196. Control.mouse_event(MOUSEEVENTF_RIGHTUP)
  197. LastAA = GetTickCount()
  198. LastMove = 0
  199. DelayedMouse = { function() Control.SetCursorPos(cPos.x, cPos.y) end, GetTickCount(), 50 }
  200. elseif checkT > LastAA + (myHero.attackData.windUpTime*1000) + 150 and GetTickCount() > LastMove + 200 then
  201. Control.mouse_event(0x0008)
  202. Control.mouse_event(0x0010)
  203. LastMove = GetTickCount()
  204. end
  205.  
  206. end
  207. end)
  208.  
  209. Callback.Add("Draw", function()
  210. for k1,v1 in pairs(FarmMinions) do
  211. if v1.lastHit then
  212. Draw.Circle(v1.obj.pos, v1.obj.boundingRadius, 5, Menu_GSO.colmin:Value())
  213. end
  214. end
  215. for k1,v1 in pairs(ActiveAttacks) do
  216. for k2,v2 in pairs(ActiveAttacks[k1]) do
  217. if v2.to and not v2.to.dead and Game.Timer() > v2.startProjT then
  218. if v2.melee == false then
  219. Draw.Circle(v2.missilePos, 10, 10, Menu_GSO.colmis:Value())
  220. else
  221. Draw.Circle(v2.from.pos, 10, 10, Menu_GSO.colmis:Value())
  222. end
  223. end
  224. end
  225. end
  226. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement