Guest User

Beta6

a guest
Jan 14th, 2018
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.47 KB | None | 0 0
  1.  
  2.  
  3.  
  4.  
  5.  
  6. --[[ START MENU ]]
  7. local menu_GSO = MenuElement({type = MENU, id = "menugso", name = "TEST"})
  8. menu_GSO:MenuElement({name = "Color MinionLH", id = "colminLH", color = Draw.Color(255, 255, 255, 255)})
  9. menu_GSO:MenuElement({name = "Color MinionLHS", id = "colminLHS", color = Draw.Color(255, 255, 102, 102)})
  10. menu_GSO:MenuElement({name = "Color Missile", id = "colmis", color = Draw.Color(255, 255, 102, 0)})
  11. menu_GSO:MenuElement({id = "lhit", name = "LastHit Key", key = string.byte("X")})
  12. menu_GSO:MenuElement({id = "lclr", name = "LaneClear Key", key = string.byte("V")})
  13. --[[ END MENU ]]
  14.  
  15.  
  16.  
  17.  
  18.  
  19. --[[ START VARIABLES ]]
  20. local lAttack = 0 -- lastAttackTime
  21. local lMove = 0 -- lastMoveTime
  22. local dMouse = nil -- delayedMouseAction
  23. local aAttacks = {} -- activeAttacks
  24. local latency = Game.Latency()*0.001
  25.  
  26. local aMinions = {} -- allyMinions
  27. local aMinionsC = 0
  28. local eMinions = {} -- enemyMinions
  29. local eMinionsC = 0
  30. local eMinionsLH = {} -- enemyMinionsLastHitable
  31. local eMinionsLHC = 0
  32. local eMinionsLC = {} -- enemyMinionsLaneClearable
  33. local eMinionsLCC = 0
  34. local eMinionsLHS = {} -- enemyMinionsLastHitableSoon
  35. local eMinionsLHSC = 0
  36.  
  37. local eMinionsLHD = {} -- drawLastHitableMinion
  38. local eMinionsLHSD = {} -- drawLastHitableSoonMinion
  39. --[[ END VARIABLES ]]
  40.  
  41.  
  42.  
  43.  
  44.  
  45. --[[ START OBJECT MANAGER ]]
  46. local function isValidTarget_GSO(range, unit)
  47. --local type = unit.type
  48. --local isUnit = type == Obj_AI_Hero or type == Obj_AI_Minion or type == Obj_AI_Turret
  49. --local isValid = isUnit and unit.valid or true
  50. if unit.distance < range and unit.dead == false and unit.isTargetable == true and unit.visible == true then--and isValid then
  51. return true
  52. end
  53. return false
  54. end
  55. local function addUnits()
  56. local countMinions = Game.MinionCount()
  57. for i = 1, countMinions do
  58. local minion = Game.Minion(i)
  59. if isValidTarget_GSO(2000, minion) then
  60. if minion.isEnemy then
  61. eMinionsC = eMinionsC + 1
  62. eMinions[eMinionsC] = minion
  63. else
  64. aMinionsC = aMinionsC + 1
  65. aMinions[aMinionsC] = minion
  66. end
  67. end
  68. end
  69. end
  70. local function removeUnits()
  71. aMinions = {}
  72. aMinionsC = 0
  73. eMinions = {}
  74. eMinionsC = 0
  75. eMinionsLC = {}
  76. eMinionsLCC = 0
  77. eMinionsLH = {}
  78. eMinionsLHC = 0
  79. eMinionsLHS = {}
  80. eMinionsLHSC = 0
  81. end
  82. --[[ END OBJECT MANAGER ]]
  83.  
  84.  
  85.  
  86.  
  87.  
  88. --[[ START DELAY ACTION ]]
  89. local function doDelayedAction()
  90. if dMouse ~= nil and GetTickCount() - dMouse[2] > dMouse[3] then
  91. dMouse[1]()
  92. dMouse = nil
  93. end
  94. end
  95. --[[ END DELAY ACTION ]]
  96.  
  97.  
  98.  
  99.  
  100.  
  101. --[[ START PREDICTED POS ]]
  102. local function predictedPosition(speed, pPos, unit)
  103. local result = unit.pos
  104. if unit.pathing.hasMovePath == true then
  105. local uPos = unit.pos
  106. local ePos = unit.pathing.endPos
  107. local d_uPos_pPos = pPos:DistanceTo(uPos)
  108. local d_ePos_pPos = pPos:DistanceTo(ePos)
  109. if d_ePos_pPos > d_uPos_pPos then
  110. result = uPos:Extended(ePos, 50+(unit.ms*(d_uPos_pPos / (speed - unit.ms))))
  111. else
  112. result = uPos:Extended(ePos, 50+(unit.ms*(d_uPos_pPos / (speed + unit.ms))))
  113. end
  114. end
  115. return result
  116. end
  117. --[[ START PREDICTED POS ]]
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124. --[[ START HEALTH PREDICTION ]]
  125. local function getPossibleDmg(unit, time)
  126. local result = 0
  127. for i = 1, aMinionsC do
  128. local aMinion = aMinions[i]
  129. local distance = aMinion.pos:DistanceTo(unit.pos)
  130. local aMinion_aaData = aMinion.attackData
  131. local pSpeed = aMinion_aaData.projectileSpeed
  132. local range = 170
  133. if pSpeed > 600 and pSpeed < 1100 then
  134. range = 550
  135. elseif pSpeed > 1100 then
  136. range = 300
  137. end
  138. if distance < range + 250 then
  139. result = result + 15
  140. local checkT = Game.Timer()
  141. local dmg = (aMinion.totalDamage*(1+aMinion.bonusDamagePercent))-unit.flatDamageReduction
  142. local pEndTime = aMinion_aaData.endTime - aMinion_aaData.windDownTime
  143. if aMinion.pathing.hasMovePath == true or checkT > pEndTime then
  144. result = result + dmg
  145. elseif aMinion_aaData.target == unit.handle then
  146. while pEndTime - checkT < time do
  147. pEndTime = pEndTime + aMinion_aaData.animationTime
  148. result = result + dmg
  149. end
  150. end
  151. end
  152. end
  153. return result
  154. end
  155. local function setEnemyMinions()
  156. for i = 1, eMinionsC do
  157. local eMinion = eMinions[i]
  158. if eMinion.distance < myHero.range + myHero.boundingRadius + eMinion.boundingRadius - 30 then
  159. local eMinion_handle = eMinion.handle
  160. local eMinion_health = eMinion.health
  161. local myHero_aaData = myHero.attackData
  162. local myHero_pFlyTime = myHero_aaData.windUpTime + (eMinion.distance / myHero_aaData.projectileSpeed) + latency + 0.05
  163. for k1,v1 in pairs(aAttacks) do
  164. for k2,v2 in pairs(aAttacks[k1]) do
  165. if v2.canceled == false and eMinion_handle == v2.to.handle then
  166. local checkT = Game.Timer()
  167. local pEndTime = v2.startTime + v2.pTime
  168. if pEndTime > checkT and pEndTime - checkT < myHero_pFlyTime then
  169. eMinion_health = eMinion_health - v2.dmg
  170. end
  171. end
  172. end
  173. end
  174. local myHero_dmg = myHero.totalDamage + 3
  175. if eMinion_health - myHero_dmg < 0 then
  176. eMinionsLHC = eMinionsLHC + 1
  177. eMinionsLH[eMinionsLHC] = { eMinion, eMinion_health - myHero_dmg }
  178. else
  179. if eMinion.health - getPossibleDmg(eMinion, myHero_aaData.animationTime*2) - myHero_dmg < 0 then
  180. eMinionsLHSC = eMinionsLHSC + 1
  181. eMinionsLHS[eMinionsLHSC] = eMinion
  182. else
  183. eMinionsLCC = eMinionsLCC + 1
  184. eMinionsLC[eMinionsLCC] = eMinion
  185. end
  186. end
  187. end
  188. end
  189. eMinionsLHD = eMinionsLH
  190. eMinionsLHSD = eMinionsLHS
  191. end
  192. --[[ END HEALTH PREDICTION ]]
  193.  
  194.  
  195.  
  196.  
  197.  
  198. --[[ START ACTIVE ATTACKS ]]
  199. local function setActiveAttacks()
  200. for i = 1, aMinionsC do
  201. local aMinion = aMinions[i]
  202. local aMinion_handle = aMinion.handle
  203. local aMinion_aaData = aMinion.attackData
  204. if aMinion_aaData.endTime > Game.Timer() then
  205. for i = 1, eMinionsC do
  206. local eMinion = eMinions[i]
  207. local eMinion_handle = eMinion.handle
  208. if eMinion_handle == aMinion_aaData.target then
  209. local checkT = Game.Timer()
  210. -- p -> projectile
  211. local pSpeed = aMinion_aaData.projectileSpeed
  212. local pFlyTime = pSpeed > 0 and aMinion.pos:DistanceTo(eMinion.pos) / pSpeed or 0
  213. local pStartTime = aMinion_aaData.endTime - aMinion_aaData.windDownTime
  214. if not aAttacks[aMinion_handle] then
  215. aAttacks[aMinion_handle] = {}
  216. end
  217. local aaID = math.floor(aMinion_aaData.endTime)
  218. if checkT < pStartTime + pFlyTime then
  219. if pSpeed > 0 then
  220. if checkT > pStartTime then
  221. if not aAttacks[aMinion_handle][aaID] then
  222. aAttacks[aMinion_handle][aaID] = {
  223. canceled = false,
  224. speed = pSpeed,
  225. startTime = pStartTime,
  226. pTime = pFlyTime,
  227. pos = aMinion.pos:Extended(eMinion.pos, pSpeed*(checkT-pStartTime)),
  228. from = aMinion,
  229. fromPos = aMinion.pos,
  230. to = eMinion,
  231. dmg = (aMinion.totalDamage*(1+aMinion.bonusDamagePercent))-eMinion.flatDamageReduction
  232. }
  233. end
  234. elseif aMinion.pathing.hasMovePath == true then
  235. --print("attack canceled")
  236. aAttacks[aMinion_handle][aaID] = {
  237. canceled = true,
  238. from = aMinion
  239. }
  240. end
  241. elseif not aAttacks[aMinion_handle][aaID] then
  242. aAttacks[aMinion_handle][aaID] = {
  243. canceled = false,
  244. speed = pSpeed,
  245. startTime = pStartTime - aMinion_aaData.windUpTime,
  246. pTime = aMinion_aaData.windUpTime,
  247. pos = aMinion.pos,
  248. from = aMinion,
  249. fromPos = aMinion.pos,
  250. to = eMinion,
  251. dmg = (aMinion.totalDamage*(1+aMinion.bonusDamagePercent))-eMinion.flatDamageReduction
  252. }
  253. end
  254. end
  255. break
  256. end
  257. end
  258. end
  259. end
  260. end
  261. local function handleActiveAttacks()
  262. local aAttacks2 = aAttacks
  263. for k1,v1 in pairs(aAttacks2) do
  264. local count = 0
  265. local checkT = Game.Timer()
  266. for k2,v2 in pairs(aAttacks[k1]) do
  267. count = count + 1
  268. if v2.speed == 0 and (not v2.from or v2.from == nil or v2.from.dead) then
  269. --print("dead")
  270. aAttacks[k1] = nil
  271. break
  272. end
  273. if v2.canceled == false then
  274. local ranged = v2.speed > 0
  275. if ranged == true then
  276. aAttacks[k1][k2].pTime = v2.fromPos:DistanceTo(predictedPosition(v2.speed, v2.pos, v2.to)) / v2.speed
  277. end
  278. if checkT > v2.startTime + aAttacks[k1][k2].pTime - latency - 0.02 or not v2.to or v2.to == nil or v2.to.dead then
  279. aAttacks[k1][k2] = nil
  280. elseif ranged == true then
  281. aAttacks[k1][k2].pos = v2.fromPos:Extended(v2.to.pos, (checkT-v2.startTime)*v2.speed)
  282. end
  283. end
  284. end
  285. if count == 0 then
  286. --print("no active attacks")
  287. aAttacks[k1] = nil
  288. end
  289. end
  290. end
  291. --[[ END ACTIVE ATTACKS ]]
  292.  
  293.  
  294.  
  295.  
  296.  
  297. --[[ START TARGET SELECTOR ]]
  298. local function lastHit()
  299. local result = nil
  300. local min = 10000000
  301. if eMinionsLHC > 0 then
  302. for i = 1, eMinionsLHC do
  303. local eMinionLH = eMinionsLH[i]
  304. local minion = eMinionLH[1]
  305. local hp = eMinionLH[2]
  306. if hp < min then
  307. min = hp
  308. result = minion
  309. end
  310. end
  311. end
  312. return result
  313. end
  314. local function laneClear()
  315. local result = nil
  316. local min = 10000000
  317. if eMinionsLHC > 0 then
  318. for i = 1, eMinionsLHC do
  319. local eMinionLH = eMinionsLH[i]
  320. local minion = eMinionLH[1]
  321. local hp = eMinionLH[2]
  322. if hp < min then
  323. min = hp
  324. result = minion
  325. end
  326. end
  327. elseif eMinionsLHSC == 0 then
  328. for i = 1, eMinionsLCC do
  329. local minion = eMinionsLC[i]
  330. local hp = minion.health
  331. if hp < min then
  332. min = hp
  333. result = minion
  334. end
  335. end
  336. end
  337. return result
  338. end
  339. --[[ END TARGET SELECTOR ]]
  340.  
  341.  
  342.  
  343.  
  344.  
  345. --[[ START ORBWALKER ]]
  346. local function Orb(unit)
  347. local checkT = GetTickCount()
  348. if checkT > lAttack + (myHero.attackData.animationTime*1000) + 125 and unit ~= nil then
  349. local cPos = cursorPos
  350. Control.SetCursorPos(unit.pos)
  351. Control.mouse_event(MOUSEEVENTF_RIGHTDOWN)
  352. Control.mouse_event(MOUSEEVENTF_RIGHTUP)
  353. lAttack = GetTickCount()
  354. lMove = 0
  355. dMouse = { function() Control.SetCursorPos(cPos.x, cPos.y) end, GetTickCount(), 50 }
  356. elseif checkT > lAttack + (myHero.attackData.windUpTime*1000) + 150 and GetTickCount() > lMove + 200 then
  357. Control.mouse_event(0x0008)
  358. Control.mouse_event(0x0010)
  359. lMove = GetTickCount()
  360. end
  361. end
  362. --[[ END ORBWALKER ]]
  363.  
  364.  
  365.  
  366.  
  367.  
  368. --[[ START TICK ]]
  369. Callback.Add("Tick", function()
  370. latency = Game.Latency()*0.001
  371. doDelayedAction()
  372. addUnits()
  373. setActiveAttacks()
  374. handleActiveAttacks()
  375. setEnemyMinions()
  376. local lh = menu_GSO.lhit:Value()
  377. local lc = menu_GSO.lclr:Value()
  378. if lh or lc then
  379. local AAtarget = nil
  380. if lh then
  381. AAtarget = lastHit()
  382. elseif lc then
  383. AAtarget = laneClear()
  384. end
  385. Orb(AAtarget)
  386. end
  387. removeUnits()
  388. end)
  389. --[[ END TICK ]]
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396. --[[ START DRAWS ]]
  397. Callback.Add("Draw", function()
  398. local countLH = #eMinionsLHD
  399. for i = 1, countLH do
  400. local eMinionLHD = eMinionsLHD[i]
  401. local minion = eMinionLHD[1]
  402. Draw.Circle(minion.pos, 75, 1, menu_GSO.colminLH:Value())
  403. end
  404. local countLHS = #eMinionsLHSD
  405. for i = 1, countLHS do
  406. local eMinionLHSD = eMinionsLHSD[i]
  407. Draw.Circle(eMinionLHSD.pos, 75, 1, menu_GSO.colminLHS:Value())
  408. end
  409. for k1,v1 in pairs(aAttacks) do
  410. for k2,v2 in pairs(aAttacks[k1]) do
  411. local checkT = Game.Timer()
  412. if v2.to and v2.to ~= nil and not v2.to.dead and checkT > v2.startTime and v2.canceled == false then
  413. if v2.speed > 0 then
  414. Draw.Circle(v2.pos, 10, 10, menu_GSO.colmis:Value())
  415. else
  416. Draw.Circle(v2.from.pos, 10, 10, menu_GSO.colmis:Value())
  417. end
  418. end
  419. end
  420. end
  421. end)
  422. --[[ END DRAWS]]
Add Comment
Please, Sign In to add comment