Guest User

iBunny by Apple v1.5

a guest
Dec 1st, 2012
10,346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.42 KB | None | 0 0
  1. --[[ iBunny by Apple - Getting Riven ready for bunny style rampage
  2.  
  3. Special thanks to Jbman for the large amount of help.]]--
  4.  
  5. if myHero.charName ~= "Riven" then return end
  6.  
  7. require "spellDmg"
  8.  
  9. --[[ Config ]]--
  10. local HK1 = 32 -- Spacebar - PewPew! Hotkey
  11. local HK2 = 88 -- X - Stun Combo HotKey
  12. local HK3 = 84 -- T - Q-Spam
  13. local DevVersion = false
  14.  
  15. --[[ Constants ]]--
  16. local QRange = 260
  17. local QRadius = 112.5
  18. local WRange = 125
  19. local ERange = 325
  20. local RRange = 900
  21. local AARange = 125
  22. local BRKid, DFGid, EXECid, YOGHid, RANOid, BWCid, HXGid = 3153, 3128, 3123, 3142, 3143, 3144, 3146
  23. local BRKSlot, DFGSlot, EXECSlot, YOGHSlot, RANOSlot, BWCSlot, HXGSlot = nil, nil, nil, nil, nil, nil, nil
  24.  
  25. --[[ Script Variables ]]--
  26. local ts = TargetSelector(TARGET_LOW_HP,ERange)
  27. local lastQ
  28. local QCount = 0
  29. local lastHasUlt
  30. local pCount = 0
  31. local lastPassive
  32. local lastdirection = 0
  33. local lastBasicAttack = 0
  34. local swingDelay = 150
  35. local swing = 0
  36. local lastSpellCast = 0
  37. local qCast = 0
  38.  
  39. function OnLoad()
  40.     acConfig = scriptConfig("iBunny", "rivenhelper")
  41.     acConfig:addParam("HasUlt", "Ultimate", SCRIPT_PARAM_ONOFF, false)
  42.     acConfig:addParam("scriptActive", "PewPew!", SCRIPT_PARAM_ONKEYDOWN, false, HK1)
  43.     acConfig:addParam("stunComboActive", "Stun Combo!", SCRIPT_PARAM_ONKEYDOWN, false, HK2)
  44.     acConfig:addParam("qspam", "Q-Spam!", SCRIPT_PARAM_ONKEYDOWN, false, HK3)
  45.     acConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  46.     acConfig:addParam("AutoUlt", "AutoUlt on killable targets?", SCRIPT_PARAM_ONOFF, true)
  47.     acConfig:addParam("AutoAA", "No right click to AA?", SCRIPT_PARAM_ONOFF, true)
  48.     acConfig:addParam("AlwaysStun", "Always stun when an enemy is within range?", SCRIPT_PARAM_ONOFF, false)
  49.     acConfig:addParam("FirstUlt", "Start casting ult early?", SCRIPT_PARAM_ONOFF, true)
  50.     acConfig:addParam("ultpercentage", "When to start casting ult early?", SCRIPT_PARAM_SLICE, 5, 0, 25, 1)
  51.     acConfig:addParam("Weaving", "Q-AA-Q Weaving?", SCRIPT_PARAM_ONOFF, true)
  52.     acConfig:permaShow("scriptActive")
  53.     acConfig:permaShow("stunComboActive")
  54.     if DevVersion then
  55.         acConfig:permaShow("HasPassive")
  56.         acConfig:permaShow("HasUlt")
  57.     end
  58.     acConfig:permaShow("qspam")
  59.     ts.name = "Riven"
  60.     acConfig:addTS(ts)
  61. end
  62.  
  63. function OnTick()
  64.     ts:update()
  65.     if QCount ~= nil and lastQ ~= nil and lastQ < (GetTickCount() - 4000) then
  66.         QCount = 0
  67.     end
  68.     if lastHasUlt ~= nil and lastHasUlt < (GetTickCount() - 15000) then
  69.         acConfig.HasUlt = false
  70.     end
  71.     if swing and GetTickCount() > (lastBasicAttack + (1000/myHero.attackSpeed)) then
  72.         swing = false
  73.     end
  74.     if acConfig.HasUlt then
  75.         WRange = 135
  76.         AARange = 200
  77.         if QCount <= 1 then
  78.             QRadius = 162.5
  79.         elseif QCount == 2 then
  80.             QRadius = 200
  81.         end
  82.     elseif not acConfig.HasUlt then
  83.         AARange = 125
  84.         WRange = 125
  85.         if QCount <= 1 then
  86.             QRadius = 112.5
  87.         elseif QCount == 2 then
  88.             QRadius = 150
  89.         end
  90.     end
  91.     if TargetHaveBuff("rivenwindslashready") then
  92.         acConfig.HasUlt = true
  93.         lastHasUlt = GetTickCount()
  94.         if DevVersion then
  95.             PrintChat("Riven Ultimate Ready!")
  96.         end
  97.     end
  98.     if acConfig.AutoUlt then TerminatorVisionScanningForKillableTargetsWithUltimate() end
  99.     if acConfig.scriptActive then PewPew() end
  100.     if acConfig.qspam then SpamQ() end
  101.     if acConfig.stunComboActive then StunCombo() end
  102.     if acConfig.AlwaysStun then StunCheck() end
  103.     DFGSlot = GetInventorySlotItem(DFGid)
  104.     EXECSlot = GetInventorySlotItem(EXECid)
  105.     YOGHSlot = GetInventorySlotItem(YOGHid)
  106.     RANOSlot = GetInventorySlotItem(RANOid)
  107.     BWCSlot = GetInventorySlotItem(BWCid)
  108.     HXGSlot = GetInventorySlotItem(HXGid)
  109.     BRKSlot = GetInventorySlotItem(BRKid)
  110. end
  111.  
  112. function PewPew()
  113.     if TargetValid(ts.target) then
  114.         if myHero:CanUseSpell(_E) == READY and GetDistance(ts.target) < ERange and GetDistance(ts.target) > WRange then
  115.             CastSpell(_E, ts.target.x, ts.target.z)
  116.         end
  117.         if myHero:CanUseSpell(_W) == READY and GetDistance(ts.target) < WRange and not (ts.target.isFeared or ts.target.isTaunted or ts.target.isCharmed) then
  118.             CastSpell(_W)
  119.         end
  120.         if acConfig.Weaving then
  121.             if not swing then
  122.                 if AutoAA and GetDistance(ts.target) < AARange+200 then
  123.                     myHero:Attack(ts.target)
  124.                 end
  125.                 if GetDistance(ts.target) < (QRange+QRadius) and not qCast then
  126.                     if GetDistance(ts.target) < QRange then
  127.                         CastSpell(_Q,ts.target.x,ts.target.z)
  128.                     else
  129.                         EnemyPos = Vector(ts.target.x,ts.target.z)
  130.                         HeroPos = Vector(myHero.x,myHero.z)
  131.                         QPos = HeroPos + ( HeroPos - EnemyPos ):normalized()
  132.                         QPos2 = QPos * ( -1 * (1-(QRange/GetDistance(ts.target)) ))
  133.                         CastSpell(_Q, QPos2.x, QPos2.z)
  134.                     end
  135.                     qCast = true
  136.                 end
  137.             else
  138.                 if GetDistance(ts.target) < (QRange+QRadius) and (GetTickCount() - lastBasicAttack > swingDelay) and not qCast then
  139.                     if GetDistance(ts.target) < QRange then
  140.                         CastSpell(_Q,ts.target.x,ts.target.z)
  141.                     else
  142.                         EnemyPos = Vector(ts.target.x,ts.target.z)
  143.                         HeroPos = Vector(myHero.x,myHero.z)
  144.                         QPos = HeroPos + ( HeroPos - EnemyPos ):normalized()
  145.                         QPos2 = QPos * ( -1 * (1-(QRange/GetDistance(ts.target)) ))
  146.                         CastSpell(_Q, QPos2.x, QPos2.z)
  147.                     end
  148.                     qCast = true
  149.                     swing = false
  150.                 end
  151.             end
  152.         elseif GetDistance(ts.target) < QRange then
  153.             CastSpell(_Q, ts.target.x, ts.target.z)
  154.         elseif GetDistance(ts.target) < (QRadius+QRange) then
  155.             EnemyPos = Vector(ts.target.x,ts.target.z)
  156.             HeroPos = Vector(myHero.x,myHero.z)
  157.             QPos = HeroPos + ( HeroPos - EnemyPos ):normalized()
  158.             QPos2 = QPos * ( -1 * (1-(QRange/GetDistance(ts.target)) ))
  159.             CastSpell(_Q, QPos2.x, QPos2.z)
  160.         end
  161.         if acConfig.HasUlt and GetDistance(ts.target) < QRange then
  162.             if iReady(DFGSlot) then CastSpell(DFGSlot, ts.target) end
  163.             if iReady(EXECSlot) then CastSpell(EXECSlot, ts.target) end
  164.             if iReady(YOGHSlot) then CastSpell(YOGHSlot) end
  165.             if iReady(RANOSlot) then CastSpell(RANOSlot, ts.target) end
  166.             if iReady(BWCSlot) then CastSpell(BWCSlot, ts.target) end
  167.             if iReady(HXGSlot) then CastSpell(HXGSlot, ts.target) end
  168.             if iReady(BRKSlot) then CastSpell(BRKSlot, ts.target) end
  169.         end
  170.     end
  171. end
  172.  
  173. function StunCheck()
  174.     if not myHero.dead and myHero:CanUseSpell(_W) == READY then
  175.         for i=1, heroManager.iCount do
  176.             local enemy = heroManager:GetHero(i)
  177.             if enemy.team ~= myHero.team and enemy ~= nil then
  178.                 if GetDistance(enemy) < WRange then
  179.                     CastSpell(_W)
  180.                 end
  181.             end
  182.         end
  183.     end
  184. end
  185.  
  186. function StunCombo()
  187.     if TargetValid(ts.target) then
  188.         if myHero:CanUseSpell(_E) == READY and myHero:CanUseSpell(_W) == READY and GetDistance(ts.target) < ERange and GetDistance(ts.target) > WRange then
  189.             CastSpell(_E, ts.target.x, ts.target.z)
  190.             lastPassive = GetTickCount()
  191.             if GetDistance(ts.target) < WRange then
  192.                 CastSpell(_W)
  193.             end
  194.         end
  195.     end
  196. end
  197.  
  198. function TerminatorVisionScanningForKillableTargetsWithUltimate()
  199.     if myHero:GetSpellData(_R).level ~= 0 and myHero:CanUseSpell(_R) == READY then
  200.         for i=1, heroManager.iCount do
  201.             local enemy = heroManager:GetHero(i)
  202.             if enemy.team ~= myHero.team and enemy ~= nil then
  203.                 local RDamage = getDmg("R",enemy,myHero)
  204.                     if TargetValid(enemy) then
  205.                     if RDamage > enemy.health and GetDistance(enemy) < RRange then
  206.                         if acConfig.HasUlt then
  207.                             CastSpell(_R, enemy.x, enemy.z)
  208.                             acConfig.HasUlt = false
  209.                         else
  210.                             CastSpell(_R)
  211.                             if not enemy.dead then
  212.                                 CastSpell(_R, enemy.x, enemy.z)
  213.                                 acConfig.HasUlt = false
  214.                             end
  215.                         end
  216.                     elseif (RDamage+enemy.maxHealth*(acConfig.ultpercentage/100)) > enemy.health and GetDistance(enemy) < RRange then
  217.                         if not acConfig.HasUlt and acConfig.FirstUlt then
  218.                             CastSpell(_R)
  219.                         end
  220.                     end
  221.                 end
  222.             end
  223.         end
  224.     end
  225. end
  226.  
  227. function SpamQ()
  228.     if not myHero.dead then
  229.         if IsKeyDown(HK3) then  
  230.             if GetTickCount()-lastdirection >= 500 then
  231.                 local absposxy = math.min(math.abs(mousePos.x-myHero.x),math.abs(mousePos.y-myHero.y))
  232.                 myHero:MoveTo(myHero.x+(mousePos.x-myHero.x)*100/absposxy,myHero.z+(mousePos.z-myHero.z)*100/absposxy)
  233.                 lastdirection = GetTickCount()
  234.             elseif GetTickCount()-lastdirection >= 100 then
  235.                 myHero:MoveTo(mousePos.x,mousePos.z)
  236.                 CastSpell(_Q, mousePos.x,mousePos.z)  
  237.                 CastSpell(SPELL_1, mousePos.x,mousePos.z)
  238.                 CastSpell(_Q, mousePos.x,mousePos.z)
  239.                 CastSpell(SPELL_1, mousePos.x,mousePos.z)
  240.             end
  241.         elseif IsKeyDown(HK3) then  
  242.             if GetTickCount()-lastdirection >= 500 then
  243.                 local absposxy = math.min(math.abs(mousePos.x-myHero.x),math.abs(mousePos.y-myHero.y))
  244.                 myHero:MoveTo(myHero.x+(mousePos.x-myHero.x)*100/absposxy,myHero.z+(mousePos.z-myHero.z)*100/absposxy)
  245.                 lastdirection = GetTickCount()
  246.             elseif GetTickCount()-lastdirection >= 100 then
  247.                 myHero:MoveTo(mousePos.x,mousePos.z)
  248.                 CastSpell(_Q, mousePos.x,mousePos.z)  
  249.                 CastSpell(SPELL_1, mousePos.x,mousePos.z)
  250.                 CastSpell(_Q, mousePos.x,mousePos.z)
  251.                 CastSpell(SPELL_1, mousePos.x,mousePos.z)
  252.             end
  253.         elseif IsKeyDown(HK3) then  
  254.             if GetTickCount()-lastdirection >= 500 then
  255.                 local absposxy = math.min(math.abs(mousePos.x-myHero.x),math.abs(mousePos.y-myHero.y))
  256.                 myHero:MoveTo(myHero.x+(mousePos.x-myHero.x)*100/absposxy,myHero.z+(mousePos.z-myHero.z)*100/absposxy)
  257.                 lastdirection = GetTickCount()
  258.             elseif GetTickCount()-lastdirection >= 100 then
  259.                 myHero:MoveTo(mousePos.x,mousePos.z)
  260.                 CastSpell(_Q, mousePos.x,mousePos.z)  
  261.                 CastSpell(SPELL_1, mousePos.x,mousePos.z)
  262.                 CastSpell(_Q, mousePos.x,mousePos.z)
  263.                 CastSpell(SPELL_1, mousePos.x,mousePos.z)
  264.             end
  265.         end
  266.     end
  267. end
  268.  
  269. function TargetValid(target)
  270.     if target ~= nil and target.dead == false and target.team == TEAM_ENEMY and target.visible == true then
  271.         return true
  272.     else
  273.         return false
  274.     end
  275. end
  276.  
  277. function iReady(itemslot)
  278.     if itemslot ~= nil and myHero:CanUseSpell(itemslot) then
  279.         return true
  280.     else
  281.         return false
  282.     end
  283. end
  284.  
  285. function OnDraw()
  286.     if acConfig.drawcircles and not myHero.dead then
  287.         DrawCircle(myHero.x,myHero.y,myHero.z, QRange, 0xFF80FF00)
  288.         if ts.target ~= nil then
  289.             DrawText("Targetting: " .. ts.target.charName, 18, 100, 100, 0xFFFF0000)
  290.             DrawCircle(ts.target.x, ts.target.y, ts.target.z, 100, 0xFF80FF00)
  291.         end
  292.         if QPos2 ~= nil and DevVersion then
  293.             DrawCircle(QPos2.x, QPos2.y, QPos2.z, 100, 0xFFFF0000)
  294.         end
  295.     end
  296.     SC__OnDraw()
  297. end
  298.  
  299. function OnProcessSpell(unit, spell)
  300.     if unit.isMe and spell.name:find("Attack") ~= nil then
  301.         lastBasicAttack = GetTickCount()
  302.         swing = true
  303.         qCast = false
  304.     end
  305. end
  306.  
  307. function OnWndMsg(msg,key)
  308.     SC__OnWndMsg(msg,key)
  309. end
Advertisement
Add Comment
Please, Sign In to add comment