reis114

ahri

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