Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Menu_GSO = MenuElement({type = MENU, id = "menugso", name = "TEST"})
- Menu_GSO:MenuElement({name = "Color Minion", id = "colmin", color = Draw.Color(150, 49, 210, 0)})
- Menu_GSO:MenuElement({name = "Color Missile", id = "colmis", color = Draw.Color(150, 153, 0, 76)})
- Menu_GSO:MenuElement({id = "lhit", name = "LastHit Key", key = string.byte("X")})
- local ActiveAttacks = {}
- local FarmMinions = {}
- local LastAA = 0
- local DelayedMouse = nil
- local LastMove = 0
- 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 not unit.dead and unit.isTargetable and unit.visible and isValid then
- return true
- end
- return false
- end
- local function GetAllyMinions_GSO(range)
- local result = {}
- for i = 1, Game.MinionCount() do
- local minion = Game.Minion(i)
- if minion.isAlly and IsValidTarget_GSO(range, minion) then
- result[#result + 1] = minion
- end
- end
- return result
- end
- local function GetEnemyMinions_GSO(range)
- local result = {}
- for i = 1, Game.MinionCount() do
- local minion = Game.Minion(i)
- local isotherminion = minion.maxHealth <= 6
- if minion.isEnemy and not isotherminion and IsValidTarget_GSO(range, minion) then
- result[#result + 1] = minion
- end
- end
- return result
- end
- Callback.Add("Tick", function()
- if DelayedMouse ~= nil and GetTickCount() - DelayedMouse[2] > DelayedMouse[3] then
- DelayedMouse[1]()
- DelayedMouse = nil
- end
- local tEnemyMinions = GetEnemyMinions_GSO(2000)
- for i = 1, #tEnemyMinions do
- local minion = tEnemyMinions[i]
- if not FarmMinions[minion.handle] then
- FarmMinions[minion.handle] = { obj = minion, lastHit = false, lastHitSoon = false, laneClear = false }
- end
- end
- local tAllyMinions = GetAllyMinions_GSO(2000)
- for i = 1, #tAllyMinions do
- local minion = tAllyMinions[i]
- local minion_id = minion.handle
- local minion_aadata = minion.attackData
- local minion_target = minion.attackData.target
- local canNext = true
- if minion_target and minion_aadata.endTime > Game.Timer() then
- for k,v in pairs(FarmMinions) do
- if k == minion_target then
- if ActiveAttacks[minion_id] then
- for k2,v2 in pairs(ActiveAttacks[minion_id]) do
- if k2 == math.floor(minion_aadata.endTime) then
- canNext = false
- end
- end
- end
- if canNext then
- local minion_projspeed = minion_aadata.projectileSpeed
- local minion_animT = minion_aadata.animationTime
- local minion_projT = minion_projspeed > 0 and minion.pos:DistanceTo(v.obj.pos) / minion_projspeed or 0
- local projStartT = minion_aadata.endTime - ( minion_animT - minion_aadata.windUpTime )
- local aacompleteT = minion_aadata.endTime + minion_projT - minion_aadata.windDownTime
- local checkT = Game.Timer()
- if not ActiveAttacks[minion_id] then
- ActiveAttacks[minion_id] = {}
- end
- if checkT + Game.Latency()*0.0005 < aacompleteT then
- if minion_projspeed > 0 then
- if checkT + Game.Latency()*0.0005 > projStartT then
- if not ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] then
- local doneT = Game.Timer() - projStartT
- local speed = minion_projspeed
- local pos = minion.pos:Extended(v.obj.pos, speed*doneT)
- ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] = {
- melee = false,
- canceled = false,
- projSpeed = minion_projspeed,
- startProjT = projStartT,
- completeT = aacompleteT,
- missilePos = pos,
- from = minion,
- to = v.obj,
- damageTo = minion.totalDamage*(1+minion.bonusDamagePercent) - 0.01
- }
- end
- elseif minion.pathing.hasMovePath then
- --print("attack canceled")
- ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] = { canceled = true, melee = false, from = minion }
- end
- else
- --cancancel
- if not ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] then
- ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)] = {
- melee = true,
- canceled = false,
- startProjT = aacompleteT - minion_animT,
- completeT = aacompleteT,
- from = minion,
- to = v.obj,
- damageTo = minion.totalDamage*(1+minion.bonusDamagePercent) - 0.01
- }
- elseif minion.pathing.hasMovePath then
- ActiveAttacks[minion_id][math.floor(minion_aadata.endTime)].canceled = true;
- end
- end
- end
- end
- break
- end
- end
- end
- end
- local ActiveAttacks2 = ActiveAttacks
- for k1,v1 in pairs(ActiveAttacks2) do
- local count = 0
- for k2,v2 in pairs(ActiveAttacks[k1]) do
- count = count + 1
- if not v2.from or v2.from == nil or v2.from.dead then
- --print("dead")
- ActiveAttacks[k1] = nil
- break
- end
- if v2.canceled == false then
- if Game.Timer() > v2.completeT then
- ActiveAttacks[k1][k2] = nil
- elseif v2.melee == false then
- local doneT = Game.Timer() + Game.Latency()*0.0005 - v2.startProjT
- local speed = v2.projSpeed
- local pos = v2.from.pos:Extended(v2.to.pos, speed*doneT)
- ActiveAttacks[k1][k2].missilePos = pos
- end
- end
- end
- if count == 0 then
- --print("no active attacks")
- ActiveAttacks[k1] = nil
- end
- end
- local FarmMinions2 = FarmMinions
- for k1,v1 in pairs(FarmMinions2) do
- local canNext = true
- if not v1.obj or v1.obj == nil or v1.obj.dead then
- FarmMinions[k1] = nil
- canNext = false
- end
- if canNext then
- local aacompleteT = myHero.attackData.windUpTime + (v1.obj.distance / myHero.attackData.projectileSpeed)
- local hp = v1.obj.health
- for k2,v2 in pairs(ActiveAttacks) do
- for k3,v3 in pairs(ActiveAttacks[k2]) do
- if v3.canceled == false and v3.to.handle == k1 and Game.Timer() > v3.startProjT then
- if v3.completeT - Game.Timer() + Game.Latency()*0.0005 < aacompleteT then
- hp = hp - v3.damageTo
- end
- end
- end
- end
- if hp - myHero.totalDamage < 0 then
- v1.lastHit = true
- else
- v1.lastHit = false
- end
- end
- end
- if Menu_GSO.lhit:Value() then
- local AAtarget = nil
- for k1,v1 in pairs(FarmMinions) do
- if v1.lastHit and v1.obj.distance < myHero.range + myHero.boundingRadius + v1.obj.boundingRadius - 30 then
- AAtarget = v1.obj
- break
- end
- end
- local checkT = GetTickCount()
- if checkT > LastAA + (myHero.attackData.animationTime*1000) + 125 and AAtarget ~= nil then
- local cPos = cursorPos
- Control.SetCursorPos(AAtarget.pos)
- Control.mouse_event(MOUSEEVENTF_RIGHTDOWN)
- Control.mouse_event(MOUSEEVENTF_RIGHTUP)
- LastAA = GetTickCount()
- LastMove = 0
- DelayedMouse = { function() Control.SetCursorPos(cPos.x, cPos.y) end, GetTickCount(), 50 }
- elseif checkT > LastAA + (myHero.attackData.windUpTime*1000) + 150 and GetTickCount() > LastMove + 200 then
- Control.mouse_event(0x0008)
- Control.mouse_event(0x0010)
- LastMove = GetTickCount()
- end
- end
- end)
- Callback.Add("Draw", function()
- for k1,v1 in pairs(FarmMinions) do
- if v1.lastHit then
- Draw.Circle(v1.obj.pos, v1.obj.boundingRadius, 5, Menu_GSO.colmin:Value())
- end
- end
- for k1,v1 in pairs(ActiveAttacks) do
- for k2,v2 in pairs(ActiveAttacks[k1]) do
- if v2.to and not v2.to.dead and Game.Timer() > v2.startProjT then
- if v2.melee == false then
- Draw.Circle(v2.missilePos, 10, 10, Menu_GSO.colmis:Value())
- else
- Draw.Circle(v2.from.pos, 10, 10, Menu_GSO.colmis:Value())
- end
- end
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement