Guest User

Rengar the Rapist

a guest
Dec 11th, 2012
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.     Rengar The Rapist by jbman
  3. ]]
  4. if myHero.charName ~= "Rengar" then return end
  5. require "AllClass"
  6. --[[        Code        ]]
  7.  
  8. local mousemoving = true
  9. local movedelay = 0
  10. local unitScanDelay = 0
  11. local waitDelay = 300
  12. local scanAdditionalRange = 500
  13. local units = {}
  14. local oldDelayTick = 0
  15. local unitScanTick = 0
  16. local holding = 0
  17. local animPlayedTick = nil
  18. local nextTick = 0
  19.  
  20. local lasthiton = true
  21.  
  22. local wrange = 475
  23. local range = 750
  24. local erange = 650
  25.  
  26. local lastBasicAttack = 0
  27. local swingDelay = 0.15
  28. local swing = 0
  29. local tick = nil
  30.  
  31. local targetSelected = true
  32.  
  33. local ts
  34.  
  35. local ignite = nil
  36. local GPLSlot, BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil, nil, nil
  37. local QREADY, WREADY, EREADY, RREADY, BRKREADY, DFGREADY, HXGREADY, BWCREADY = false, false, false, false, false, false, false, false
  38.  
  39.  
  40. function OnLoad()
  41.     RCConfig = scriptConfig("Rengar the Rapist", "rengartherapist ")
  42.     RCConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 88)
  43.     RCConfig:addParam("scriptActive2", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 90)
  44.     RCConfig:addParam("scriptActive3", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 67)
  45.     RCConfig:addParam("escape", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 89)
  46.     RCConfig:addParam("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, 84)
  47.     RCConfig:addParam("SHIELD", "Shield", SCRIPT_PARAM_ONKEYDOWN, false, 85) -- Uu
  48.     RCConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  49.     RCConfig:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  50.     RCConfig:addParam("autoAAFarm", "Auto AA Farm", SCRIPT_PARAM_ONKEYDOWN, false, 192) -- `~  
  51.     RCConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
  52.     RCConfig:permaShow("autoAAFarm")
  53.     ts = TargetSelector(TARGET_LOW_HP,range+200,DAMAGE_PHYSICAL,true)  
  54.     ts.name = "Rengar"
  55.     RCConfig:addTS(ts)
  56.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  57.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
  58.   end
  59.  
  60. end
  61.  
  62.     function OnProcessSpell(unit, spell)
  63.         if unit.isMe then
  64.             if spell and spell.name:find("RengarBasicAttack" or "RengarCritAttack") then
  65.                 swing = 1
  66.                 lastBasicAttack = os.clock()
  67.             end
  68.       if spell and spell.name:find("RengarQ")then
  69.                 swing = 0
  70.             end
  71.         end
  72.     end
  73.    
  74.     function OnCreateObj(obj)
  75.         if obj and (obj.name == "Rengar_LeapEnd.troy") and GetDistance(obj) < 150 then         
  76.       swing = 1
  77.       lastBasicAttack = os.clock()
  78.       --leap = 1
  79.             --PrintChat(" >> Rengar Leap!")  
  80.     end
  81.     end
  82.  
  83. function OnTick()
  84.     if myHero.dead then
  85.         return
  86.     end
  87.    
  88.     if swing == 1 and os.clock() > lastBasicAttack + 0.5 then
  89.         swing = 0
  90.     end
  91.            
  92.     if ignite ~= nil and myHero:CanUseSpell(ignite) == READY then
  93.         if IREADY then
  94.             local ignitedmg = 0
  95.             for j = 1, heroManager.iCount, 1 do
  96.                 local enemyhero = heroManager:getHero(j)
  97.                 if ValidTarget(enemyhero,600) then
  98.                     ignitedmg = 50 + 20 * myHero.level
  99.                     if enemyhero.health <= (ignitedmg - 50) then
  100.                         CastSpell(ignite, enemyhero)
  101.                     end
  102.                 end
  103.             end
  104.         end
  105.     end
  106.    
  107.    
  108.    
  109.     GPLSlot, BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3159), GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057), GetInventorySlotItem(3078), GetInventorySlotItem(3100)
  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.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  115.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  116.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  117.     GPLREADY = (GPLSlot ~= nil and myHero:CanUseSpell(GPLSlot) == READY)
  118.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  119.            
  120.     ts:update()
  121.  
  122.     if RCConfig.harass and ts.target ~= nil then
  123.         if EREADY and GetDistance(ts.target) < erange then
  124.             CastSpell(_E, ts.target)
  125.         end
  126.     end
  127.    
  128.     if RCConfig.scriptActive and ts.target ~= nil then
  129.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  130.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  131.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  132.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  133.     if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then         
  134.                 CastSpell(_W)
  135.         end
  136.         if swing == 0 then
  137.       if (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then        
  138.                 CastSpell(_E, ts.target)
  139.             end
  140.             if ValidTarget(ts.target, wrange) then
  141.                 myHero:Attack(ts.target)
  142.             end                    
  143. elseif swing == 1 then
  144.             if EREADY and os.clock() - lastBasicAttack > swingDelay then
  145.                 CastSpell(_E, ts.target)
  146.                 swing = 0  
  147.     elseif myHero.mana < 5 and QREADY and not EREADY and os.clock() - lastBasicAttack > swingDelay then
  148.                 CastSpell(_Q)
  149.         myHero:Attack(ts.target)
  150.                 swing = 0
  151.             end
  152.         end                
  153.     end
  154.  
  155.    
  156.     if RCConfig.scriptActive2 and ts.target ~= nil then
  157.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  158.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  159.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  160.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  161.     if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then         
  162.                 CastSpell(_W)
  163.         end            
  164.         if swing == 0 then
  165.       if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then        
  166.                 CastSpell(_E, ts.target)
  167.             end
  168.             if ts.target ~= nil and ValidTarget(ts.target, wrange) then
  169.                 myHero:Attack(ts.target)
  170.             end
  171. elseif swing == 1 then
  172.        if QREADY and os.clock() - lastBasicAttack > swingDelay then
  173.          CastSpell(_Q)
  174.          myHero:Attack(ts.target)
  175.          swing = 0
  176.     elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
  177.                 CastSpell(_E, ts.target)
  178.                 swing = 0
  179.             end
  180.         end                        
  181.     end
  182.    
  183.     if RCConfig.scriptActive3 and ts.target ~= nil then
  184.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  185.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  186.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  187.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  188.    
  189.     if GetDistance(ts.target) < wrange and WREADY then         
  190.                 CastSpell(_W)
  191.         end            
  192.         if swing == 0 then
  193.       if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then        
  194.                 CastSpell(_E, ts.target)
  195.             end
  196.             if ts.target ~= nil and ValidTarget(ts.target, wrange) then
  197.                 myHero:Attack(ts.target)
  198.             end
  199. elseif swing == 1 then
  200.       if myHero.mana < 5 and QREADY and os.clock() - lastBasicAttack > swingDelay then
  201.          CastSpell(_Q)
  202.          myHero:Attack(ts.target)
  203.          swing = 0
  204.     elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
  205.                 CastSpell(_E, ts.target)
  206.                 swing = 0
  207.       end
  208.         end                        
  209.     end
  210.  
  211.     if RCConfig.autoAAFarm then
  212.         if mousemoving and GetTickCount() > nextTick then
  213.             player:MoveTo(mousePos.x, mousePos.z)
  214.         end
  215.                        
  216.         local tick = GetTickCount()
  217.         if lasthiton then
  218.         unitScanTick = tick
  219.             for i = 1, objManager.maxObjects, 1 do
  220.                 local object = objManager:getObject(i)
  221.                 if object ~= nil and object.team ~= player.team and object.type == "obj_AI_Minion" and string.find(object.charName,"Minion") then
  222.                     if not object.dead and GetDistance(object,player) <= (player.range + scanAdditionalRange) then
  223.                         if units[object.name] == nil then
  224.                             units[object.name] = { obj = object, markTick = 0 }
  225.                         end
  226.                     else
  227.                         units[object.name] = nil
  228.                     end
  229.                 end
  230.             end
  231.         end
  232.         for i, unit in pairs(units) do
  233.             if unit.obj == nil or unit.obj.dead or GetDistance(player,unit.obj) > (player.range + scanAdditionalRange) then
  234.                 units[i] = nil
  235.             else
  236.                 if unit.obj.health <= (myHero:CalcDamage(unit.obj,myHero.totalDamage)) then --
  237.                     if lasthiton and GetTickCount() > nextTick then
  238.                         player:Attack(unit.obj) ---PrintChat("ATTACKING")
  239.                         nextTick = GetTickCount() + waitDelay  
  240.                         return
  241.                     end
  242.                 end
  243.             end    
  244.         end
  245.     end
  246.    
  247. end
  248. function OnDraw()
  249.     if RCConfig.drawcircles and not myHero.dead then       
  250.         if WREADY then DrawCircle(myHero.x, myHero.y, myHero.z, wrange, 0x992D3D) end
  251.         if EREADY then DrawCircle(myHero.x, myHero.y, myHero.z, erange, 0xFFFFFF) end
  252.         if ts.target ~= nil then
  253.             for j=0, 10 do DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00) end
  254.         end
  255.     end
  256.     SC__OnDraw()
  257. end
  258. function OnWndMsg(msg,key)
  259.     SC__OnWndMsg(msg,key)
  260. end
  261. function OnSendChat(msg)
  262.     TargetSelector__OnSendChat(msg)
  263.     ts:OnSendChat(msg, "pri")
  264. end
  265. PrintChat(" >> Rengar the Rapist loaded!")
Advertisement
Add Comment
Please, Sign In to add comment