Advertisement
Guest User

Untitled

a guest
Jan 15th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.54 KB | None | 0 0
  1.  
  2.  
  3. -- orbwalker class
  4. class "__gsoOrb"
  5.  
  6. -- init
  7. function __gsoOrb:__init()
  8.  
  9. self.menu = MenuElement({type = MENU, id = "menu", name = "TEST"})
  10. self.menu:MenuElement({name = "Combo Key", id = "combo", key = string.byte(" ")})
  11.  
  12. self.lAttack = 0 -- lastAttackTime
  13. self.lMove = 0 -- lastMoveTime
  14. self.latency = Game.Latency() * 0.001
  15. self.stopOrb = false
  16. self.stopSpell = false
  17. self.lastSpellT = {}
  18. self.inAAT = false
  19. self.canAASpell = true
  20.  
  21. self.endTime = myHero.attackData.endTime
  22. self.windUpT = myHero.attackData.windUpTime
  23. self.animT = myHero.attackData.animationTime
  24. self.firstAA = 0
  25. self.countAA = 0
  26.  
  27. self.dActions = {} -- delayedActions
  28.  
  29. Callback.Add('Tick', function() self:_tick() end)
  30. Callback.Add('Tick', function() self:_tick2() end)
  31. Callback.Add("WndMsg", function(msg, wParam) self:_wndmsg(msg, wParam) end)
  32. end
  33.  
  34. function __gsoOrb:_wndmsg(msg, wParam)
  35. local i = wParam
  36. if i == HK_Q or i == HK_W or i == HK_E or i == HK_R or i == HK_SUMMONER_1 or i == HK_SUMMONER_2 then
  37. local checkT = Game.Timer()
  38. local inAATime = checkT < self.lAttack + self.windUpT + 0.05
  39. self.lastSpellT[checkT] = inAATime == true
  40. self.stopSpell = true
  41. end
  42. end
  43.  
  44. function __gsoOrb:_tick()
  45. if self.menu.combo:Value() then
  46. local target = nil
  47. for i = 1, Game.HeroCount() do
  48. local hero = Game.Hero(i)
  49. local range = myHero.range + myHero.boundingRadius + hero.boundingRadius - 30
  50. if hero.isEnemy and hero.distance < range and hero.dead == false and hero.isTargetable == true and hero.visible == true then
  51. target = hero
  52. break
  53. end
  54. end
  55. local checkT = Game.Timer()
  56. if self.stopOrb == false and self.stopSpell == false and target ~= nil and (checkT + 0.13 > self.endTime or self.canAASpell == true) then
  57. -- checkT > self.lAttack + myHero.attackData.animationTime + 0.075 then
  58. self.canAASpell = false
  59. self.stopOrb = true
  60. self.lAttack = Game.Timer()
  61. Control.mouse_event(MOUSEEVENTF_RIGHTDOWN)
  62. Control.mouse_event(MOUSEEVENTF_RIGHTUP)
  63. local cPos = cursorPos
  64. Control.SetCursorPos(target.pos)
  65. Control.mouse_event(MOUSEEVENTF_RIGHTDOWN)
  66. Control.mouse_event(MOUSEEVENTF_RIGHTUP)
  67. self.dActions[GetTickCount()] = { function() Control.SetCursorPos(cPos.x, cPos.y) end, 50 }
  68. elseif self.stopOrb == false and checkT > self.lMove + 0.2 then--and checkT + 0.05 > self.endTime - (self.animT - self.windUpT) then
  69. --and checkT > self.lAttack + myHero.attackData.windUpTime + 0.075 then
  70. Control.mouse_event(MOUSEEVENTF_RIGHTDOWN)
  71. Control.mouse_event(MOUSEEVENTF_RIGHTUP)
  72. self.lMove = checkT
  73. end
  74. end
  75. end
  76.  
  77. function __gsoOrb:_tick2()
  78. local checkT = Game.Timer()
  79. local spellTimers = self.lastSpellT
  80. local countLess = 0
  81. for k,v in pairs(spellTimers) do
  82. if checkT > k + 2 then
  83. self.lastSpellT[k] = nil
  84. elseif checkT < k + 0.25 then
  85. countLess = countLess + 1
  86. self.stopSpell = true
  87. if v == true then
  88. self.inAAT = true
  89. end
  90. break
  91. end
  92. end
  93. if countLess == 0 then
  94. if self.stopSpell == true then
  95. self.stopSpell = false
  96. end
  97. if self.inAAT == true then
  98. self.canAASpell = true
  99. print("Spell in aa time: reset attack")
  100. end
  101. self.inAAT = false
  102. end
  103. local dActions = self.dActions
  104. for k,v in pairs(dActions) do
  105. if GetTickCount() - k > dActions[k][2] then
  106. dActions[k][1]()
  107. self.dActions[k] = nil
  108. end
  109. end
  110. self.latency = Game.Latency() * 0.001
  111. local aaData = myHero.attackData
  112. local endTime = aaData.endTime
  113. self.windUpT = aaData.windUpTime
  114. self.animT = aaData.animationTime
  115. if endTime > self.endTime then
  116. self.stopOrb = false
  117. self.endTime = endTime
  118. self.lMove = 0
  119. if self.countAA == 0 then
  120. self.firstAA = checkT
  121. end
  122. self.countAA = self.countAA + 1
  123. if self.countAA == 5 then
  124. print("5 auto attacks in: "..tostring((checkT-self.firstAA)*1000).."ms")
  125. self.firstAA = 0
  126. self.countAA = 0
  127. end
  128. elseif self.stopOrb == true and checkT > self.lAttack + self.windUpT + 0.15 then
  129. print("Bad issue: reset attack")
  130. self.stopOrb = false
  131. end
  132. end
  133.  
  134. function OnLoad()
  135. __gsoOrb()
  136. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement