Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ START MENU ]]
- local menu_GSO = MenuElement({type = MENU, id = "menugso", name = "TEST"})
- menu_GSO:MenuElement({name = "Color MinionLH", id = "colminLH", color = Draw.Color(255, 255, 255, 255)})
- menu_GSO:MenuElement({name = "Color MinionLHS", id = "colminLHS", color = Draw.Color(255, 255, 102, 102)})
- menu_GSO:MenuElement({name = "Color Missile", id = "colmis", color = Draw.Color(255, 255, 102, 0)})
- menu_GSO:MenuElement({id = "lhit", name = "LastHit Key", key = string.byte("X")})
- menu_GSO:MenuElement({id = "lclr", name = "LaneClear Key", key = string.byte("V")})
- --[[ END MENU ]]
- --[[ START VARIABLES ]]
- local lAttack = 0 -- lastAttackTime
- local lMove = 0 -- lastMoveTime
- local dMouse = nil -- delayedMouseAction
- local aAttacks = {} -- activeAttacks
- local latency = Game.Latency()*0.001
- local aMinions = {} -- allyMinions
- local aMinionsC = 0
- local eMinions = {} -- enemyMinions
- local eMinionsC = 0
- local eMinionsLH = {} -- enemyMinionsLastHitable
- local eMinionsLHC = 0
- local eMinionsLC = {} -- enemyMinionsLaneClearable
- local eMinionsLCC = 0
- local eMinionsLHS = {} -- enemyMinionsLastHitableSoon
- local eMinionsLHSC = 0
- local eMinionsLHD = {} -- drawLastHitableMinion
- local eMinionsLHSD = {} -- drawLastHitableSoonMinion
- --[[ END VARIABLES ]]
- --[[ START OBJECT MANAGER ]]
- local function isValidTarget_GSO(range, unit)
- --local type = unit.type
- --local isUnit = type == Obj_AI_Hero or type == Obj_AI_Minion or type == Obj_AI_Turret
- --local isValid = isUnit and unit.valid or true
- if unit.distance < range and unit.dead == false and unit.isTargetable == true and unit.visible == true then--and isValid then
- return true
- end
- return false
- end
- local function addUnits()
- local countMinions = Game.MinionCount()
- for i = 1, countMinions do
- local minion = Game.Minion(i)
- if isValidTarget_GSO(2000, minion) then
- if minion.isEnemy then
- eMinionsC = eMinionsC + 1
- eMinions[eMinionsC] = minion
- else
- aMinionsC = aMinionsC + 1
- aMinions[aMinionsC] = minion
- end
- end
- end
- end
- local function removeUnits()
- aMinions = {}
- aMinionsC = 0
- eMinions = {}
- eMinionsC = 0
- eMinionsLC = {}
- eMinionsLCC = 0
- eMinionsLH = {}
- eMinionsLHC = 0
- eMinionsLHS = {}
- eMinionsLHSC = 0
- end
- --[[ END OBJECT MANAGER ]]
- --[[ START DELAY ACTION ]]
- local function doDelayedAction()
- if dMouse ~= nil and GetTickCount() - dMouse[2] > dMouse[3] then
- dMouse[1]()
- dMouse = nil
- end
- end
- --[[ END DELAY ACTION ]]
- --[[ START PREDICTED POS ]]
- local function predictedPosition(speed, pPos, unit)
- local result = unit.pos
- if unit.pathing.hasMovePath == true then
- local uPos = unit.pos
- local ePos = unit.pathing.endPos
- local d_uPos_pPos = pPos:DistanceTo(uPos)
- local d_ePos_pPos = pPos:DistanceTo(ePos)
- if d_ePos_pPos > d_uPos_pPos then
- result = uPos:Extended(ePos, 50+(unit.ms*(d_uPos_pPos / (speed - unit.ms))))
- else
- result = uPos:Extended(ePos, 50+(unit.ms*(d_uPos_pPos / (speed + unit.ms))))
- end
- end
- return result
- end
- --[[ START PREDICTED POS ]]
- --[[ START HEALTH PREDICTION ]]
- local function getPossibleDmg(unit, time)
- local result = 0
- for i = 1, aMinionsC do
- local aMinion = aMinions[i]
- local distance = aMinion.pos:DistanceTo(unit.pos)
- local aMinion_aaData = aMinion.attackData
- local pSpeed = aMinion_aaData.projectileSpeed
- local range = 170
- if pSpeed > 600 and pSpeed < 1100 then
- range = 550
- elseif pSpeed > 1100 then
- range = 300
- end
- if distance < range + 250 then
- result = result + 15
- local checkT = Game.Timer()
- local dmg = (aMinion.totalDamage*(1+aMinion.bonusDamagePercent))-unit.flatDamageReduction
- local pEndTime = aMinion_aaData.endTime - aMinion_aaData.windDownTime
- if aMinion.pathing.hasMovePath == true or checkT > pEndTime then
- result = result + dmg
- elseif aMinion_aaData.target == unit.handle then
- while pEndTime - checkT < time do
- pEndTime = pEndTime + aMinion_aaData.animationTime
- result = result + dmg
- end
- end
- end
- end
- return result
- end
- local function setEnemyMinions()
- for i = 1, eMinionsC do
- local eMinion = eMinions[i]
- if eMinion.distance < myHero.range + myHero.boundingRadius + eMinion.boundingRadius - 30 then
- local eMinion_handle = eMinion.handle
- local eMinion_health = eMinion.health
- local myHero_aaData = myHero.attackData
- local myHero_pFlyTime = myHero_aaData.windUpTime + (eMinion.distance / myHero_aaData.projectileSpeed) + latency + 0.05
- for k1,v1 in pairs(aAttacks) do
- for k2,v2 in pairs(aAttacks[k1]) do
- if v2.canceled == false and eMinion_handle == v2.to.handle then
- local checkT = Game.Timer()
- local pEndTime = v2.startTime + v2.pTime
- if pEndTime > checkT and pEndTime - checkT < myHero_pFlyTime then
- eMinion_health = eMinion_health - v2.dmg
- end
- end
- end
- end
- local myHero_dmg = myHero.totalDamage + 3
- if eMinion_health - myHero_dmg < 0 then
- eMinionsLHC = eMinionsLHC + 1
- eMinionsLH[eMinionsLHC] = { eMinion, eMinion_health - myHero_dmg }
- else
- if eMinion.health - getPossibleDmg(eMinion, myHero_aaData.animationTime*2) - myHero_dmg < 0 then
- eMinionsLHSC = eMinionsLHSC + 1
- eMinionsLHS[eMinionsLHSC] = eMinion
- else
- eMinionsLCC = eMinionsLCC + 1
- eMinionsLC[eMinionsLCC] = eMinion
- end
- end
- end
- end
- eMinionsLHD = eMinionsLH
- eMinionsLHSD = eMinionsLHS
- end
- --[[ END HEALTH PREDICTION ]]
- --[[ START ACTIVE ATTACKS ]]
- local function setActiveAttacks()
- for i = 1, aMinionsC do
- local aMinion = aMinions[i]
- local aMinion_handle = aMinion.handle
- local aMinion_aaData = aMinion.attackData
- if aMinion_aaData.endTime > Game.Timer() then
- for i = 1, eMinionsC do
- local eMinion = eMinions[i]
- local eMinion_handle = eMinion.handle
- if eMinion_handle == aMinion_aaData.target then
- local checkT = Game.Timer()
- -- p -> projectile
- local pSpeed = aMinion_aaData.projectileSpeed
- local pFlyTime = pSpeed > 0 and aMinion.pos:DistanceTo(eMinion.pos) / pSpeed or 0
- local pStartTime = aMinion_aaData.endTime - aMinion_aaData.windDownTime
- if not aAttacks[aMinion_handle] then
- aAttacks[aMinion_handle] = {}
- end
- local aaID = math.floor(aMinion_aaData.endTime)
- if checkT < pStartTime + pFlyTime then
- if pSpeed > 0 then
- if checkT > pStartTime then
- if not aAttacks[aMinion_handle][aaID] then
- aAttacks[aMinion_handle][aaID] = {
- canceled = false,
- speed = pSpeed,
- startTime = pStartTime,
- pTime = pFlyTime,
- pos = aMinion.pos:Extended(eMinion.pos, pSpeed*(checkT-pStartTime)),
- from = aMinion,
- fromPos = aMinion.pos,
- to = eMinion,
- dmg = (aMinion.totalDamage*(1+aMinion.bonusDamagePercent))-eMinion.flatDamageReduction
- }
- end
- elseif aMinion.pathing.hasMovePath == true then
- --print("attack canceled")
- aAttacks[aMinion_handle][aaID] = {
- canceled = true,
- from = aMinion
- }
- end
- elseif not aAttacks[aMinion_handle][aaID] then
- aAttacks[aMinion_handle][aaID] = {
- canceled = false,
- speed = pSpeed,
- startTime = pStartTime - aMinion_aaData.windUpTime,
- pTime = aMinion_aaData.windUpTime,
- pos = aMinion.pos,
- from = aMinion,
- fromPos = aMinion.pos,
- to = eMinion,
- dmg = (aMinion.totalDamage*(1+aMinion.bonusDamagePercent))-eMinion.flatDamageReduction
- }
- end
- end
- break
- end
- end
- end
- end
- end
- local function handleActiveAttacks()
- local aAttacks2 = aAttacks
- for k1,v1 in pairs(aAttacks2) do
- local count = 0
- local checkT = Game.Timer()
- for k2,v2 in pairs(aAttacks[k1]) do
- count = count + 1
- if v2.speed == 0 and (not v2.from or v2.from == nil or v2.from.dead) then
- --print("dead")
- aAttacks[k1] = nil
- break
- end
- if v2.canceled == false then
- local ranged = v2.speed > 0
- if ranged == true then
- aAttacks[k1][k2].pTime = v2.fromPos:DistanceTo(predictedPosition(v2.speed, v2.pos, v2.to)) / v2.speed
- end
- if checkT > v2.startTime + aAttacks[k1][k2].pTime - latency - 0.02 or not v2.to or v2.to == nil or v2.to.dead then
- aAttacks[k1][k2] = nil
- elseif ranged == true then
- aAttacks[k1][k2].pos = v2.fromPos:Extended(v2.to.pos, (checkT-v2.startTime)*v2.speed)
- end
- end
- end
- if count == 0 then
- --print("no active attacks")
- aAttacks[k1] = nil
- end
- end
- end
- --[[ END ACTIVE ATTACKS ]]
- --[[ START TARGET SELECTOR ]]
- local function lastHit()
- local result = nil
- local min = 10000000
- if eMinionsLHC > 0 then
- for i = 1, eMinionsLHC do
- local eMinionLH = eMinionsLH[i]
- local minion = eMinionLH[1]
- local hp = eMinionLH[2]
- if hp < min then
- min = hp
- result = minion
- end
- end
- end
- return result
- end
- local function laneClear()
- local result = nil
- local min = 10000000
- if eMinionsLHC > 0 then
- for i = 1, eMinionsLHC do
- local eMinionLH = eMinionsLH[i]
- local minion = eMinionLH[1]
- local hp = eMinionLH[2]
- if hp < min then
- min = hp
- result = minion
- end
- end
- elseif eMinionsLHSC == 0 then
- for i = 1, eMinionsLCC do
- local minion = eMinionsLC[i]
- local hp = minion.health
- if hp < min then
- min = hp
- result = minion
- end
- end
- end
- return result
- end
- --[[ END TARGET SELECTOR ]]
- --[[ START ORBWALKER ]]
- local function Orb(unit)
- local checkT = GetTickCount()
- if checkT > lAttack + (myHero.attackData.animationTime*1000) + 125 and unit ~= nil then
- local cPos = cursorPos
- Control.SetCursorPos(unit.pos)
- Control.mouse_event(MOUSEEVENTF_RIGHTDOWN)
- Control.mouse_event(MOUSEEVENTF_RIGHTUP)
- lAttack = GetTickCount()
- lMove = 0
- dMouse = { function() Control.SetCursorPos(cPos.x, cPos.y) end, GetTickCount(), 50 }
- elseif checkT > lAttack + (myHero.attackData.windUpTime*1000) + 150 and GetTickCount() > lMove + 200 then
- Control.mouse_event(0x0008)
- Control.mouse_event(0x0010)
- lMove = GetTickCount()
- end
- end
- --[[ END ORBWALKER ]]
- --[[ START TICK ]]
- Callback.Add("Tick", function()
- latency = Game.Latency()*0.001
- doDelayedAction()
- addUnits()
- setActiveAttacks()
- handleActiveAttacks()
- setEnemyMinions()
- local lh = menu_GSO.lhit:Value()
- local lc = menu_GSO.lclr:Value()
- if lh or lc then
- local AAtarget = nil
- if lh then
- AAtarget = lastHit()
- elseif lc then
- AAtarget = laneClear()
- end
- Orb(AAtarget)
- end
- removeUnits()
- end)
- --[[ END TICK ]]
- --[[ START DRAWS ]]
- Callback.Add("Draw", function()
- local countLH = #eMinionsLHD
- for i = 1, countLH do
- local eMinionLHD = eMinionsLHD[i]
- local minion = eMinionLHD[1]
- Draw.Circle(minion.pos, 75, 1, menu_GSO.colminLH:Value())
- end
- local countLHS = #eMinionsLHSD
- for i = 1, countLHS do
- local eMinionLHSD = eMinionsLHSD[i]
- Draw.Circle(eMinionLHSD.pos, 75, 1, menu_GSO.colminLHS:Value())
- end
- for k1,v1 in pairs(aAttacks) do
- for k2,v2 in pairs(aAttacks[k1]) do
- local checkT = Game.Timer()
- if v2.to and v2.to ~= nil and not v2.to.dead and checkT > v2.startTime and v2.canceled == false then
- if v2.speed > 0 then
- Draw.Circle(v2.pos, 10, 10, menu_GSO.colmis:Value())
- else
- Draw.Circle(v2.from.pos, 10, 10, menu_GSO.colmis:Value())
- end
- end
- end
- end
- end)
- --[[ END DRAWS]]
Add Comment
Please, Sign In to add comment