Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "VPrediction"
- require "Collision"
- local farmingMode
- local wRange = 1535
- local eRange = 900
- local rRange = 50000
- local castR = string.byte("R")
- local PredictionW = nil
- function PluginOnLoad()
- AutoCarry.SkillsCrosshair.range = 1600
- PredictionW = VPrediction()
- Menu = AutoCarry.PluginMenu
- ts = TargetSelector(TARGET_LOW_HP,4000,DAMAGE_PHYSICAL, false)
- --Menu:addParam("ultR","ultR", SCRIPT_PARAM_ONKEYDOWN, false, 32)
- Menu:addParam("autoQ","Auto use Q ", SCRIPT_PARAM_ONOFF, true)
- Menu:addParam("autoW","Auto use W ", SCRIPT_PARAM_ONOFF, true)
- Menu:addParam("autoE","Auto use E ", SCRIPT_PARAM_ONOFF, true)
- Menu:addParam("autoR","Auto use R ", SCRIPT_PARAM_ONOFF, true)
- Menu:addParam("ultR","Semi-manual cast R", SCRIPT_PARAM_ONKEYDOWN, false, 32) -- space
- Menu:addParam("drawW","Draw helper W ", SCRIPT_PARAM_ONOFF, true)
- Menu:addParam("drawE","Draw helper E ", SCRIPT_PARAM_ONOFF, true)
- Menu:addParam("drawR","Draw helper R ", SCRIPT_PARAM_ONOFF, true)
- Menu:addParam("manaMenager","Mana menager", SCRIPT_PARAM_ONOFF, true)
- end
- function PluginOnTick()
- Target = AutoCarry.Crosshair:GetTarget()
- manaMenager()
- QREADY = (myHero:CanUseSpell(_Q) == READY)
- WREADY = (myHero:CanUseSpell(_W) == READY)
- EREADY = (myHero:CanUseSpell(_E) == READY)
- RREADY = (myHero:CanUseSpell(_R) == READY)
- if ( AutoCarry.Keys.MixedMode or AutoCarry.Keys.LaneClear or AutoCarry.Keys.LastHit) then
- farmingMode = true
- else
- farmingMode = false
- end
- bonusRange = 525 + 120 + 25 * myHero:GetSpellData(_Q).level
- if Target ~= nil then
- if QREADY then
- if (GetDistance(Target) > 630 or CountEnemies(Target, 130) > 1 ) and
- (myHero.mana > WMANA + RMANA or myHero.totalDamage * 3 > Target.health) then
- if AutoCarry.Keys.AutoCarry then
- minigunOn()
- elseif farmingMode and myHero.mana > WMANA + RMANA + EMANA and GetDistance(Target) < bonusRange + 150 then
- minigunOn()
- else
- minigunOff()
- end
- else
- minigunOff()
- end
- end
- if Menu.autoW and WREADY then
- wDmg = getDmg("W", Target, myHero)
- local CastPosition, HitChance, Position = PredictionW:GetLineCastPosition(Target, 0.6, 75, wRange, 1600, myHero, true)
- if not AutoCarry.Orbwalker:IsShooting() and GetDistance(Target) > 525 and wDmg > Target.health and HitChance >= 1 and GetDistance(CastPosition) < wRange then
- CastSpell(_W, CastPosition.x, CastPosition.z)
- elseif not AutoCarry.Orbwalker:IsShooting() and AutoCarry.Keys.AutoCarry and myHero.mana > WMANA + RMANA and HitChance >= 2 and CountEnemies(myHero, bonusRange) == 0 and GetDistance(CastPosition) < wRange then
- CastSpell(_W, CastPosition.x, CastPosition.z)
- elseif not AutoCarry.Orbwalker:IsShooting() and farmingMode and (myHero.mana > 2 * (WMANA + RMANA + EMANA) or HitChance >= 3) and HitChance >= 2 and CountEnemies(myHero, bonusRange) == 0 and GetDistance(CastPosition) < wRange-200 then
- CastSpell(_W, CastPosition.x, CastPosition.z)
- end
- end
- if Menu.autoE and EREADY then
- local CastPosition, HitChance, Position = PredictionW:GetCircularCastPosition(Target, 2, 30, eRange)
- local ePos = GetAoESpellPosition(350, Target, 1900)
- if (Target.canMove ~= true or HitChance >= 3) and GetDistance(Target) < 900 and myHero.mana > RMANA + EMANA then
- CastSpell(_E, CastPosition.x, CastPosition.z)
- end
- end
- else
- if AutoCarry.Keys.LaneClear and myHero.mana > myHero.maxMana * 0.9 then
- minigunOn()
- elseif myHero.mana > WMANA + RMANA and AutoCarry.Keys.AutoCarry then
- minigunOn()
- else
- minigunOff()
- end
- end
- if RREADY then
- ts:update()
- if ts.target ~= nil then
- local CastPosition, HitChance, Position = PredictionW:GetLineCastPosition(ts.target, 0.58, 150, rRange, 2165, myHero, false)
- rPredistion = CastPosition
- rDmg = getDmg("R", ts.target, myHero)
- if Menu.ultR and HitChance >= 2 then
- CastSpell(_R, CastPosition.x, CastPosition.z)
- end
- if Menu.autoR and rDmg > ts.target.health and GetDistance(ts.target, myHero) < 3000 then
- Collision:__init(rRange, 2150, 0.58, 250)
- PrintFloatText(player,0,ts.target.charName)
- PrintFloatText(ts.target,0,"KILL R")
- if HitChance >= 2 and GetDistance(ts.target) > bonusRange + 150 and CountAlly(ts.target, 600) == 0 and not Collision:GetHeroCollision(myHero, ts.target, HERO_ENEMY) then
- CastSpell(_R, CastPosition.x, CastPosition.z)
- end
- if HitChance >= 2 and CountEnemies(ts.target, 350) > 1 and rDmg * 0.9 > ts.target.health then
- CastSpell(_R, CastPosition.x, CastPosition.z)
- end
- if HitChance >= 1 and myHero.health < myHero.maxHealth * 0.5 and 2.6 * rDmg > ts.target.health then
- CastSpell(_R, CastPosition.x, CastPosition.z)
- end
- if HitChance >= 2 and ts.target.canMove ~= true and 2.6 * rDmg > ts.target.health then
- CastSpell(_R, CastPosition.x, CastPosition.z)
- end
- end
- end
- end
- end
- function PluginOnDraw()
- if Menu.drawW and Target ~= nil then
- wDmg = getDmg("W", Target, myHero)
- if wDmg > Target.health then
- PrintFloatText(player,0,Target.charName)
- PrintFloatText(Target,0,"KILL W")
- DrawCircleNextLvl(myHero.x, myHero.y, myHero.z, wRange)
- DrawLineNextLvl(myHero,Target)
- end
- if WREADY then
- DrawCircleNextLvl(myHero.x, myHero.y, myHero.z, wRange)
- end
- end
- if Menu.drawE and Target ~= nil then
- if Target.canMove ~= true and EREADY then
- PrintFloatText(player,0,Target.charName)
- PrintFloatText(Target,0,"STUNE E")
- DrawCircleNextLvl(myHero.x, myHero.y, myHero.z, eRange)
- end
- end
- if Menu.drawR and ts.target ~= nil and RREADY then
- rDmg = getDmg("R", ts.target, myHero)
- if rDmg > ts.target.health or Menu.ultR then
- DrawLineNextLvl(myHero,rPredistion)
- end
- DrawCircleNextLvl(rPredistion.x, rPredistion.y, rPredistion.z, 100)
- end
- end
- function manaMenager()
- if Menu.manaMenager then
- WMANA = 40 + 10 * myHero:GetSpellData(_W).level
- EMANA = 50
- if not RREADY then
- RMANA = WMANA-10
- else
- RMANA = 100
- end
- else
- WMANA = 0
- RMANA = 0
- EMANA = 0
- RMANA = 0
- end
- end
- function DrawLineNextLvl(point1, point2)
- local points = {}
- local c = WorldToScreen(D3DXVECTOR3(point1.x, point1.y, point1.z ))
- local c2 = WorldToScreen(D3DXVECTOR3(point2.x, point2.y, point2.z ))
- points[1] = D3DXVECTOR2(c.x, c.y)
- points[2] = D3DXVECTOR2(c2.x, c2.y)
- DrawLines2(points, 1, 4294967295)
- end
- function DrawCircleNextLvl(x, y, z, radius, width, color, chordlength)
- radius = radius or 300
- quality = math.max(8,math.floor(180/math.deg((math.asin((70/(2*radius)))))))
- quality = 2 * math.pi / quality
- radius = radius*.92
- local points = {}
- for theta = 0, 2 * math.pi + quality, quality do
- local c = WorldToScreen(D3DXVECTOR3(x + radius * math.cos(theta), y, z - radius * math.sin(theta)))
- points[#points + 1] = D3DXVECTOR2(c.x, c.y)
- end
- DrawLines2(points, width or 1, color or 6294967295)
- end
- function CountEnemies(point, range)
- local ChampCount = 0
- for j = 1, heroManager.iCount, 1 do
- local enemyhero = heroManager:getHero(j)
- if myHero.team ~= enemyhero.team and enemyhero.dead ~= true then
- if GetDistance(enemyhero, point) <= range then
- ChampCount = ChampCount + 1
- end
- end
- end
- return ChampCount
- end
- function CountAlly(point, range)
- local ChampCount = 0
- for j = 1, heroManager.iCount, 1 do
- local allyhero = heroManager:getHero(j)
- if myHero.team == allyhero.team and allyhero.dead ~= true then
- if GetDistance(allyhero, point) <= range then
- ChampCount = ChampCount + 1
- end
- end
- end
- return ChampCount
- end
- function minigunOff()
- if (farmingMode or AutoCarry.Keys.AutoCarry) and Menu.autoQ and myHero.range > 530 and not AutoCarry.Orbwalker:IsShooting() then
- CastSpell(_Q)
- end
- end
- function minigunOn()
- if (farmingMode or AutoCarry.Keys.AutoCarry) and Menu.autoQ and myHero.range < 530 and not AutoCarry.Orbwalker:IsShooting() then
- CastSpell(_Q)
- end
- end
- --[[
- AoE_Skillshot_Position 2.0 by monogato
- GetAoESpellPosition(radius, main_target, [delay]) returns best position in order to catch as many enemies as possible with your AoE skillshot, making sure you get the main target.
- Note: You can optionally add delay in ms for prediction (VIP if avaliable, normal else).
- ]]
- function GetCenter(points)
- local sum_x = 0
- local sum_z = 0
- for i = 1, #points do
- sum_x = sum_x + points[i].x
- sum_z = sum_z + points[i].z
- end
- local center = {x = sum_x / #points, y = 0, z = sum_z / #points}
- return center
- end
- function ContainsThemAll(circle, points)
- local radius_sqr = circle.radius*circle.radius
- local contains_them_all = true
- local i = 1
- while contains_them_all and i <= #points do
- contains_them_all = GetDistanceSqr(points[i], circle.center) <= radius_sqr
- i = i + 1
- end
- return contains_them_all
- end
- -- The first element (which is gonna be main_target) is untouchable.
- function FarthestFromPositionIndex(points, position)
- local index = 2
- local actual_dist_sqr
- local max_dist_sqr = GetDistanceSqr(points[index], position)
- for i = 3, #points do
- actual_dist_sqr = GetDistanceSqr(points[i], position)
- if actual_dist_sqr > max_dist_sqr then
- index = i
- max_dist_sqr = actual_dist_sqr
- end
- end
- return index
- end
- function RemoveWorst(targets, position)
- local worst_target = FarthestFromPositionIndex(targets, position)
- table.remove(targets, worst_target)
- return targets
- end
- function GetInitialTargets(radius, main_target)
- local targets = {main_target}
- local diameter_sqr = 4 * radius * radius
- for i=1, heroManager.iCount do
- target = heroManager:GetHero(i)
- if target.networkID ~= main_target.networkID and ValidTarget(target) and GetDistanceSqr(main_target, target) < diameter_sqr then table.insert(targets, target) end
- end
- return targets
- end
- function GetPredictedInitialTargets(radius, main_target, delay)
- if VIP_USER and not vip_target_predictor then vip_target_predictor = TargetPredictionVIP(nil, nil, delay/1000) end
- local predicted_main_target = VIP_USER and vip_target_predictor:GetPrediction(main_target) or GetPredictionPos(main_target, delay)
- local predicted_targets = {predicted_main_target}
- local diameter_sqr = 4 * radius * radius
- for i=1, heroManager.iCount do
- target = heroManager:GetHero(i)
- if ValidTarget(target) then
- predicted_target = VIP_USER and vip_target_predictor:GetPrediction(target) or GetPredictionPos(target, delay)
- if target.networkID ~= main_target.networkID and GetDistanceSqr(predicted_main_target, predicted_target) < diameter_sqr then table.insert(predicted_targets, predicted_target) end
- end
- end
- return predicted_targets
- end
- -- I don't need range since main_target is gonna be close enough. You can add it if you do.
- function GetAoESpellPosition(radius, main_target, delay)
- local targets = delay and GetPredictedInitialTargets(radius, main_target, delay) or GetInitialTargets(radius, main_target)
- local position = GetCenter(targets)
- local best_pos_found = true
- local circle = Circle(position, radius)
- circle.center = position
- if #targets > 2 then best_pos_found = ContainsThemAll(circle, targets) end
- while not best_pos_found do
- targets = RemoveWorst(targets, position)
- position = GetCenter(targets)
- circle.center = position
- best_pos_found = ContainsThemAll(circle, targets)
- end
- return position, #targets
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement