16HeX16

Ahri 1.3.2 - VIP Collision

Jun 5th, 2013
10,257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 12.70 KB | None | 0 0
  1. --[[    Ahri Helper by HeX 1.3.2 VIP Prediction
  2.  
  3. Hot Keys:
  4.     -Basic Combo: Space
  5.     -Harass(Toggle): Z
  6.     -Charm: C
  7. Features:
  8.     -Basic Combo: Items-> R-> E-> Q-> W-> R*2
  9.     -Harass: Q
  10.     -Use ulti in combo ON/OFF option in ingame menu.
  11.     -Use E in combo ON/OFF option in ingame menu.
  12.     -Mark killable target with a combo.
  13.     -Target configuration, Press shift to configure.
  14.     -Auto ignite and/or Ulti killable enemy ON/OFF option in ingame menu.
  15.     -Item Support: DFG, Hextech Gunblade, Bligewater Cutlass, Blade of the Ruined King.
  16.     -Basic orb walking ON/OFF option in ingame menu. It will follow your mouse so you can kite targets if you want.
  17.    
  18. Explanation of the marks:
  19.     -Green circle: Marks the current target to which you will do the combo
  20.     -Blue circle: Killed with a combo, if all the skills were available
  21.     -Red circle: Killed using Items + Q + W + E + R + Ignite(if available)
  22.     -2 Red circles: Killed using Items + Q + W + E + Ignite(if available)
  23.     -3 Red circles: Killed using Q + W 
  24. ]]--
  25.  
  26. if myHero.charName ~= "Ahri" then return end
  27. --[[    Settings    ]]--
  28. local rBuffer = 300 --Wont use R unless they are further than this.
  29. --[[ Ranges ]]--
  30. local qRange = 800
  31. local wRange = 800
  32. local eRange = 975
  33. local rRange = 1000
  34. --[[    Damage Calculation  ]]--
  35. local calculationenemy = 1
  36. local killable = {}
  37. --[[    Prediction  ]]--
  38. if VIP_USER then
  39.     require "Collision"
  40.     qp = TargetPredictionVIP(880, 1700, 0.25)
  41.     ep = TargetPredictionVIP(975, 1600, 0.1)
  42.     PrintChat("Ahri Helper - VIP Prediction Used")
  43. else
  44.     qp = TargetPrediction(880, 1.7, 250)
  45.     ep = TargetPrediction(975, 1.6, 100)
  46.     PrintChat("Ahri Helper - Basic Prediction Used")
  47. end
  48. --[[    Attacks ]]--
  49. local lastBasicAttack = 0
  50. local swing = 0
  51. local startAttackSpeed = 0.625
  52. local nextTick = 0
  53. --[[    Items   ]]--
  54. local ignite = nil
  55. local QREADY, WREADY, EREADY, RREADY = false, false, false, false
  56. local BRKSlot, DFGSlot, HXGSlot, BWCSlot = nil, nil, nil, nil
  57. local BRKREADY, DFGREADY, HXGREADY, BWCREADY = false, false, false, false
  58.  
  59. function OnLoad()
  60.     PrintChat("<font color='#CCCCCC'> >> Ahri Helper 1.3.2 loaded! <<</font>")
  61.     AHConfig = scriptConfig("AhriHelper", "Ahri Helper")
  62.     AHConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  63.     AHConfig:addParam("Harass", "Harass", SCRIPT_PARAM_ONKEYTOGGLE, false, 90)
  64.     AHConfig:addParam("Charm", "Charm", SCRIPT_PARAM_ONKEYDOWN, false, 67)
  65.     AHConfig:addParam("useE", "Use E in combo", SCRIPT_PARAM_ONOFF, true)
  66.     AHConfig:addParam("useR", "Use R in combo", SCRIPT_PARAM_ONOFF, true)
  67.     AHConfig:addParam("mouseDash", "Dash to Mouse", SCRIPT_PARAM_ONOFF, true)
  68.     AHConfig:addParam("movement", "Use basic orb walking", SCRIPT_PARAM_ONOFF, true)
  69.     AHConfig:addParam("attacks", "Use Auto Attacks", SCRIPT_PARAM_ONOFF, true)
  70.     AHConfig:addParam("autoignite", "Ignite when Killable", SCRIPT_PARAM_ONOFF, true)
  71.     AHConfig:addParam("drawcirclesSelf", "Draw Circles - Self", SCRIPT_PARAM_ONOFF, false)
  72.     AHConfig:addParam("drawcirclesEnemy", "Draw Circles - Enemy", SCRIPT_PARAM_ONOFF, true)
  73.     AHConfig:permaShow("scriptActive")
  74.     AHConfig:permaShow("Harass")
  75.    
  76.     ts = TargetSelector(TARGET_LOW_HP, wRange+100, DAMAGE_MAGIC)
  77.     ts.name = "Ahri"
  78.     AHConfig:addTS(ts)
  79.    
  80.     lastBasicAttack = os.clock()
  81.     enemyMinions = minionManager(MINION_ENEMY, 1200, player)
  82.    
  83.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  84.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
  85.     end
  86. end
  87.  
  88. function OnProcessSpell(unit, spell)
  89.     if unit.isMe and (spell.name:find("Attack") ~= nil) then
  90.         swing = 1
  91.         lastBasicAttack = os.clock()
  92.     end
  93. end
  94.  
  95. function OnTick()
  96.     ts:update()
  97.     enemyMinions:update()
  98.     enemyMinions = minionManager(MINION_ENEMY, 1200, player)
  99.    
  100.     AttackDelay = 1/(myHero.attackSpeed*startAttackSpeed)
  101.     if swing == 1 and os.clock() > lastBasicAttack + AttackDelay then
  102.         swing = 0
  103.     end
  104.  
  105.     BRKSlot, DFGSlot, HXGSlot, BWCSlot = GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144)
  106.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  107.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  108.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  109.     BRKREADY = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  110.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  111.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  112.     WREADY = (myHero:CanUseSpell(_W) == READY)
  113.     EREADY = (myHero:CanUseSpell(_E) == READY)
  114.     RREADY = (myHero:CanUseSpell(_R) == READY)
  115.  
  116.     if ts.target ~= nil then
  117.         qPred = qp:GetPrediction(ts.target)
  118.         ePred = ep:GetPrediction(ts.target)
  119.     end
  120.     if tick == nil or GetTickCount()-tick>=100 then
  121.         tick = GetTickCount()
  122.         DmgCalculation()
  123.     end
  124.    
  125.     --[[    Auto Ignite ]]--
  126.     if AHConfig.autoignite then    
  127.         if IREADY then
  128.             local ignitedmg = 0    
  129.             for i = 1, heroManager.iCount, 1 do
  130.                 local enemyhero = heroManager:getHero(i)
  131.                 if ValidTarget(enemyhero,600) then
  132.                     ignitedmg = 50 + 20 * myHero.level
  133.                     if enemyhero.health <= ignitedmg then
  134.                         CastSpell(ignite, enemyhero)
  135.                     end
  136.                 end
  137.             end
  138.         end
  139.     end
  140.  
  141.     --[[    Harass  ]]--
  142.     if ts.target ~= nil and AHConfig.Harass then
  143.         if qPred ~= nil and GetDistance(ts.target) < qRange then
  144.             if VIP_USER and qp:GetHitChance(ts.target) > 0.5 then
  145.                 CastSpell(_Q, qPred.x, qPred.z)
  146.             elseif not VIP_USER then
  147.                 CastSpell(_Q, qPred.x, qPred.z)
  148.             end
  149.         end
  150.     end
  151.    
  152.     --[[    Charm   ]]--
  153.     if AHConfig.Charm then
  154.         if EREADY and findClosestEnemy() ~= nil then
  155.             ePred2 = ep:GetPrediction(findClosestEnemy())
  156.             if ePred2 and GetDistance(ePred2) <= eRange then
  157.                 if VIP_USER and ep:GetHitChance(findClosestEnemy()) > 0.5 then
  158.                     local col = Collision(975, 1600, 0.1, 70)
  159.                     if not col:GetMinionCollision(myHero, ePred2) then
  160.                         CastSpell(_E, ePred2.x, ePred2.z)
  161.                     end
  162.                 elseif not VIP_USER then
  163.                     if not minionCollision(ePred2, 90, eRange) then
  164.                         CastSpell(_E, ePred2.x, ePred2.z)
  165.                     end
  166.                 end
  167.             end
  168.         end
  169.     end
  170.  
  171.     --[[    Combo   ]]--
  172.     if ts.target ~= nil and AHConfig.scriptActive then
  173.         --[[    Items   ]]--
  174.         if GetDistance(ts.target) < 600 then
  175.             if DFGREADY then CastSpell(DFGSlot, ts.target) end
  176.             if HXGREADY then CastSpell(HXGSlot, ts.target) end
  177.             if BWCREADY then CastSpell(BWCSlot, ts.target) end
  178.             if BRKREADY then CastSpell(BRKSlot, ts.target) end
  179.         end
  180.         --[[    Combo   ]]--
  181.         if RREADY and AHConfig.useR and GetDistance(ts.target) > rBuffer and GetDistance(ts.target) < rRange and not AHConfig.mouseDash then
  182.             CastSpell(_R, ts.target.x, ts.target.z)
  183.         elseif RREADY and AHConfig.useR and GetDistance(ts.target) < rRange and AHConfig.mouseDash then
  184.             CastSpell(_R, mousePos.x, mousePos.z)
  185.         end
  186.         if EREADY and AHConfig.useE and ePred and GetDistance(ePred) <= eRange then
  187.             if VIP_USER and ep:GetHitChance(ts.target) > 0.5 then
  188.                 local col = Collision(975, 1600, 0.1, 70)
  189.                 if not col:GetMinionCollision(myHero, ePred) then
  190.                     CastSpell(_E, ePred.x, ePred.z)
  191.                 end
  192.             elseif not VIP_USER then
  193.                 if not minionCollision(ePred, 90, eRange) then
  194.                     CastSpell(_E, ePred.x, ePred.z)
  195.                 end
  196.             end
  197.         end
  198.         if QREADY and qPred ~= nil and GetDistance(ts.target) < qRange then
  199.             if VIP_USER and qp:GetHitChance(ts.target) > 0.5 then
  200.                 CastSpell(_Q, qPred.x, qPred.z)
  201.             elseif not VIP_USER then
  202.                 CastSpell(_Q, qPred.x, qPred.z)
  203.             end
  204.         end
  205.         if WREADY and GetDistance(ts.target) < wRange then
  206.             CastSpell(_W)
  207.         end
  208.         --[[    Attacks ]]--
  209.         if swing == 0 then
  210.             if GetDistance(ts.target) < (myHero.range+100) and AHConfig.attacks then
  211.                 myHero:Attack(ts.target)
  212.                 nextTick = GetTickCount()
  213.             end
  214.         elseif swing == 1 then
  215.             if AHConfig.movement and GetTickCount() > (nextTick + 250) then
  216.                 myHero:MoveTo(mousePos.x, mousePos.z)
  217.             end
  218.         end
  219.     end
  220. end
  221.  
  222. --[[
  223. Explanation of the marks:
  224.     -Green circle: Marks the current target to which you will do the combo
  225.     -Blue circle: Killed with a combo, if all the skills were available
  226.     -Red circle: Killed using Items + Q + W + E + R + Ignite(if available)
  227.     -2 Red circles: Killed using Items + Q + W + E + Ignite(if available)
  228.     -3 Red circles: Killed using Q + W 
  229. ]]
  230. function DmgCalculation()
  231.     local enemy = heroManager:GetHero(calculationenemy)
  232.     if ValidTarget(enemy) then
  233.         local ignitedamage, dfgdamage, hxgdamage, bwcdamage, brkdamage = 0, 0, 0, 0, 0
  234.         local qdamage = getDmg("Q",enemy,myHero)
  235.         local wdamage = getDmg("W",enemy,myHero)
  236.         local edamage = getDmg("E",enemy,myHero)
  237.         local rdamage = getDmg("R",enemy,myHero,1)
  238.         local ignitedamage = (ignite and getDmg("IGNITE",enemy,myHero) or 0)
  239.         local dfgdamage = (DFGSlot and getDmg("DFG",enemy,myHero) or 0)
  240.         local hxgdamage = (HXGSlot and getDmg("HXG",enemy,myHero) or 0)
  241.         local bwcdamage = (BWCSlot and getDmg("BWC",enemy,myHero) or 0)
  242.         local brkdamage = (BRKSlot and getDmg("RUINEDKING",enemy,myHero) or 0)
  243.         local combo1 = qdamage + wdamage + edamage + rdamage
  244.         local combo2 = 0
  245.         local combo3 = 0
  246.         local combo4 = 0
  247.     if QREADY then
  248.         combo2 = combo2 + qdamage
  249.         combo3 = combo3 + qdamage
  250.         combo4 = combo4 + qdamage
  251.     end
  252.     if WREADY then
  253.         combo2 = combo2 + wdamage
  254.         combo3 = combo3 + wdamage
  255.         combo4 = combo4 + wdamage
  256.     end
  257.     if EREADY then
  258.         combo2 = combo2 + edamage
  259.         combo3 = combo3 + edamage
  260.     end
  261.     if RREADY then
  262.         combo2 = combo2 + rdamage
  263.     end
  264.     if DFGREADY then
  265.         combo1 = combo1 + dfgdamage
  266.         combo2 = combo2 + dfgdamage
  267.         combo3 = combo3 + dfgdamage
  268.     end
  269.     if HXGREADY then
  270.         combo1 = combo1 + hxgdamage
  271.         combo2 = combo2 + hxgdamage
  272.         combo3 = combo3 + hxgdamage
  273.     end
  274.     if BWCREADY then
  275.         combo1 = combo1 + bwcdamage
  276.         combo2 = combo2 + bwcdamage
  277.         combo3 = combo3 + bwcdamage
  278.     end
  279.     if BRKREADY then
  280.         combo1 = combo1 + brkdamage
  281.         combo2 = combo2 + brkdamage
  282.         combo3 = combo3 + brkdamage
  283.     end
  284.     if IREADY then
  285.         combo1 = combo1 + ignitedamage
  286.         combo2 = combo2 + ignitedamage
  287.         combo3 = combo3 + ignitedamage
  288.     end
  289.     if combo4 >= enemy.health then killable[calculationenemy] = 4
  290.         elseif combo3 >= enemy.health then killable[calculationenemy] = 3
  291.         elseif combo2 >= enemy.health then killable[calculationenemy] = 2
  292.         elseif combo1 >= enemy.health then killable[calculationenemy] = 1
  293.         else killable[calculationenemy] = 0 end
  294.     end
  295.         if calculationenemy == 1 then calculationenemy = heroManager.iCount
  296.             else calculationenemy = calculationenemy-1
  297.         end
  298. end
  299.  
  300. function OnDraw()  
  301.     if AHConfig.drawcirclesSelf and not myHero.dead then
  302.         DrawCircle(myHero.x,myHero.y,myHero.z, qRange, 0x00FF00)
  303.         DrawCircle(myHero.x,myHero.y,myHero.z, eRange, 0x00FFFF)
  304.     end
  305.     if ts.target ~= nil and AHConfig.drawcirclesEnemy then
  306.         for j=0, 10 do
  307.             DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00)
  308.         end
  309.     end
  310.     for i=1, heroManager.iCount do
  311.         local enemydraw = heroManager:GetHero(i)
  312.         if ValidTarget(enemydraw) then
  313.             if AHConfig.drawcirclesEnemy then
  314.                 if killable[i] == 1 then
  315.                     for e=0, 15 do
  316.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0x0000FF)
  317.                     end
  318.                     elseif killable[i] == 2 then
  319.                     for e=0, 10 do
  320.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  321.                     end
  322.                     elseif killable[i] == 3 then
  323.                     for e=0, 10 do
  324.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  325.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + e*1.5, 0xFF0000)
  326.                     end
  327.                     elseif killable[i] == 4 then
  328.                     for e=0, 10 do
  329.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  330.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + e*1.5, 0xFF0000)
  331.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + e*1.5, 0xFF0000)
  332.                     end
  333.                 end
  334.             end
  335.         end
  336.     end
  337. end
  338.  
  339. function findClosestEnemy()
  340.     local closestEnemy = nil
  341.     local currentEnemy = nil
  342.     for i=1, heroManager.iCount do
  343.         currentEnemy = heroManager:GetHero(i)
  344.         if currentEnemy.team ~= myHero.team and not currentEnemy.dead and currentEnemy.visible then
  345.             if closestEnemy == nil then
  346.                 closestEnemy = currentEnemy
  347.                 elseif GetDistance(currentEnemy) < GetDistance(closestEnemy) then
  348.                     closestEnemy = currentEnemy
  349.             end
  350.         end
  351.     end
  352. return closestEnemy
  353. end
  354.  
  355. function minionCollision(predic, width, range)
  356.     for _, minionObjectE in pairs(enemyMinions.objects) do
  357.         if predic ~= nil and player:GetDistance(minionObjectE) < range then
  358.             ex = player.x
  359.             ez = player.z
  360.             tx = predic.x
  361.             tz = predic.z
  362.             dx = ex - tx
  363.             dz = ez - tz
  364.             if dx ~= 0 then
  365.                 m = dz/dx
  366.                 c = ez - m*ex
  367.             end
  368.             mx = minionObjectE.x
  369.             mz = minionObjectE.z
  370.             distanc = (math.abs(mz - m*mx - c))/(math.sqrt(m*m+1))
  371.             if distanc < width and math.sqrt((tx - ex)*(tx - ex) + (tz - ez)*(tz - ez)) > math.sqrt((tx - mx)*(tx - mx) + (tz - mz)*(tz - mz)) then
  372.                 return true
  373.             end
  374.         end
  375.     end
  376. return false
  377. end
Advertisement
Add Comment
Please, Sign In to add comment