Advertisement
Guest User

Untitled

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