16HeX16

Ahri Helper 1.2.1

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