Guest User

Rengar the Rapist v1.4

a guest
Jan 17th, 2013
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2.     Rengar The Rapist v1.4 by jbman
  3. ]]
  4. if myHero.charName ~= "Rengar" then return end
  5. --[[        Code        ]]
  6.  
  7. local mousemoving = true
  8. local waitDelay = 400
  9. local scanAdditionalRange = 750
  10. local nextTick = 0
  11.  
  12. local wrange = 450
  13. local range = 750
  14. local erange = 575
  15. local canQ = false
  16.  
  17. local lastBasicAttack = 0
  18. local swingDelay = 0.15
  19. local swing = 0
  20. local tick = nil
  21.  
  22. local targetSelected = true
  23.  
  24. local ts
  25.  
  26. local ignite = nil
  27. local TMATSlot, SotDSlot BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = nil, nil, nil, nil, nil, nil, nil, nil, nil
  28. local QREADY, WREADY, EREADY, RREADY, TMATREADY, SotDREADY, BRKREADY, DFGREADY, HXGREADY, BWCREADY = false, false, false, false, false, false, false, false, false, false
  29.  
  30.  
  31. function OnLoad()
  32.     velocityTimer = {}
  33.     oldPos = {}
  34.     Velocity = {}
  35.     oldTick = {}
  36.  
  37.     velocity = 0
  38.     velocityTimeOut = 5
  39.  
  40.     conversionFactor = 975 --estimate. Converts coordinate velocity to game movement speed.
  41.     msVarianceTrigger = 100 --will knock back when velocity > hero.ms + variance
  42.     minMovementSpeed = 300 --minimum hero.ms to condemn. Sometimes hero.ms bugs and shows lesser values.    
  43.  
  44.     for i = 1, heroManager.iCount, 1 do
  45.       local hero = heroManager:getHero(i)
  46.       if hero.team == TEAM_ENEMY then
  47.         oldPos[hero.name] = {}
  48.         oldTick[hero.name] = {}
  49.         Velocity[hero.name] = 0
  50.         velocityTimer[hero.name] = 0
  51.       end
  52.     end
  53.     RCConfig = scriptConfig("Rengar the Rapist", "rengartherapist v1.4")
  54.     RCConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 88)
  55.     RCConfig:addParam("scriptActive2", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 90)
  56.     RCConfig:addParam("scriptActive3", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 67)
  57.     RCConfig:addParam("escape", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 89)
  58.     RCConfig:addParam("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, 84)
  59.     RCConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  60.     RCConfig:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  61.   RCConfig:addParam("autoEKS", "E Kill Steal", SCRIPT_PARAM_ONOFF, true)
  62.     RCConfig:addParam("autoAAFarm", "Auto AA Farm", SCRIPT_PARAM_ONKEYDOWN, false, 192) -- `~
  63.   RCConfig:addParam("autoEFarm", "Auto E Farm", SCRIPT_PARAM_ONKEYDOWN, false, 112) -- F1
  64.     RCConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
  65.   RCConfig:addParam("autoW", "Auto W", SCRIPT_PARAM_ONKEYTOGGLE, false, 84)
  66.     RCConfig:permaShow("autoAAFarm")
  67.   RCConfig:permaShow("autoEFarm")
  68.   RCConfig:permaShow("autoW")
  69.   RCConfig:permaShow("autoEKS")
  70.     ts = TargetSelector(TARGET_LOW_HP,range+150,DAMAGE_PHYSICAL,true)  
  71.     ts.name = "Rengar"
  72.     RCConfig:addTS(ts)
  73.   enemyMinions = minionManager(MINION_ENEMY, range+150, player, MINION_SORT_HEALTH_ASC)
  74.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  75.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
  76.   end
  77.  
  78. end
  79.  
  80.     function OnProcessSpell(unit, spell)
  81.         if unit.isMe then
  82.       if spell and spell.name:find("RengarQ")then
  83.         canQ = false
  84.                 swing = 0
  85.             end
  86.             if spell and spell.name:find("RengarBasicAttack" or "RengarCritAttack") then
  87.                 swing = 1
  88.                 lastBasicAttack = os.clock()
  89.         canQ = true
  90.             end      
  91.         end
  92.     end
  93.    
  94.     function OnCreateObj(obj)
  95.     if canQ == true and obj and obj.name:find("RengarQ") then
  96.       canQ = false
  97.       swing = 0
  98.     end
  99.         if obj and (obj.name == "Rengar_LeapEnd.troy") and GetDistance(obj) < 150 then         
  100.       swing = 1
  101.       lastBasicAttack = os.clock()
  102.       canQ = true
  103.     end
  104.     --minionManager__OnCreateObj(object) -- OnCreateObj
  105.     end
  106.  
  107.   function findmyHeroVelocity(target, oldPos, oldTick)
  108.     if oldPos.x and oldPos.z and target.x and target.z then
  109.         local dis = math.sqrt((oldPos.x - target.x) ^ 2 + (oldPos.z - target.z) ^ 2)
  110.         Velocity[target.name] = (dis / (GetTickCount() - oldTick)) * conversionFactor
  111.     end
  112.   end
  113.  
  114.   --[[function OnDeleteObj(obj)
  115.      minionManager__OnDeleteObj(object) -- OnDeleteObj
  116.   end]]
  117.  
  118.  
  119. function OnTick()
  120.     if myHero.dead then
  121.         return
  122.     end
  123.    
  124.     if swing == 1 and os.clock() > lastBasicAttack + 0.5 then
  125.         swing = 0
  126.     end
  127.            
  128.     --[[if ignite ~= nil and myHero:CanUseSpell(ignite) == READY then
  129.         if IREADY then
  130.             local ignitedmg = 0
  131.             for j = 1, heroManager.iCount, 1 do
  132.                 local enemyhero = heroManager:getHero(j)
  133.                 if ValidTarget(enemyhero,600) then
  134.                     ignitedmg = 50 + 20 * myHero.level
  135.                     if enemyhero.health <= (ignitedmg - 50) then
  136.                         CastSpell(ignite, enemyhero)
  137.                     end
  138.                 end
  139.             end
  140.         end
  141.     end]]
  142.    
  143.    
  144.    
  145.     TMATSlot, SotDSlot, BRKSlot, DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot = GetInventorySlotItem(3077) or GetInventorySlotItem(3074) , GetInventorySlotItem(3131), GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057), GetInventorySlotItem(3078), GetInventorySlotItem(3100) --
  146.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  147.     WREADY = (myHero:CanUseSpell(_W) == READY)
  148.     EREADY = (myHero:CanUseSpell(_E) == READY)
  149.     RREADY = (myHero:CanUseSpell(_R) == READY)
  150.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  151.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  152.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  153.     TMATREADY = (TMATSlot ~= nil and myHero:CanUseSpell(TMATSlot) == READY)
  154.   SotDREADY = (SotDSlot ~= nil and myHero:CanUseSpell(SotDSlot) == READY)
  155.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  156.            
  157.     ts:update()
  158.  
  159.     if RCConfig.harass and ts.target ~= nil then
  160.         if EREADY and GetDistance(ts.target) < erange then
  161.             CastSpell(_E, ts.target)
  162.         end
  163.     end
  164.    
  165.   if RCConfig.autoW or RCConfig.autoEKS then
  166.         for i = 1, heroManager.iCount, 1 do
  167.       local hero = heroManager:getHero(i)
  168.       if RCConfig.autoW then
  169.         if ValidTarget(hero, nil, true) then
  170.           if velocityTimer[hero.name] <= GetTickCount() and hero and hero.x and hero.z then
  171.             velocityTimer[hero.name] = GetTickCount() + velocityTimeOut
  172.             findmyHeroVelocity(hero, oldPos[hero.name], oldTick[hero.name])
  173.             oldPos[hero.name].x = hero.x
  174.             oldPos[hero.name].z = hero.z
  175.             oldTick[hero.name] = GetTickCount()
  176.           end
  177.           if Velocity[hero.name] > (hero.ms + msVarianceTrigger) and hero.ms > minMovementSpeed and GetDistance(myHero, hero) < 475 then
  178.             if WREADY then
  179.               CastSpell(_W)            
  180.             end
  181.           end
  182.         end
  183.         if ValidTarget(hero) and GetDistance(myHero, hero) < 450 then
  184.           if myHero.mana < 5 and WREADY then
  185.             CastSpell(_W)            
  186.           end
  187.         end
  188.       end
  189.       if RCConfig.autoEKS then
  190.         local edamage = getDmg("E",hero,myHero)
  191.         if ValidTarget(hero) and GetDistance(myHero, hero) < erange and hero.health < edamage then
  192.           if myHero.mana < 5 and EREADY then
  193.             CastSpell(_E)            
  194.           end                    
  195.         end
  196.       end
  197.     end    
  198.     end
  199.  
  200.   if (RCConfig.scriptActive or RCConfig.scriptActive1 or RCConfig.scriptActive2 or RCConfig.scriptActive3) and ts.target ~= nil and RCConfig.autoignite and IREADY then    
  201.         local QWEDmg = RENDmgCalculation(ts.target)
  202.         local IDmg = getDmg("IGNITE",ts.target,myHero)    
  203.         if GetDistance(ts.target) < 600 and ts.target.health > QWEDmg and ts.target.health <= IDmg+QWEDmg then CastSpell(ignite, ts.target) end
  204.     end  
  205.  
  206.     if RCConfig.scriptActive and ts.target ~= nil then
  207.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  208.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  209.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  210.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  211.     if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then         
  212.                 CastSpell(_W)
  213.         end
  214.         if swing == 0 then
  215.       if (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then        
  216.                 CastSpell(_E, ts.target)
  217.             end
  218.       if ts.target ~= nil and ValidTarget(ts.target, wrange) then
  219.                 myHero:Attack(ts.target)
  220.             end
  221.     elseif swing == 1 then
  222.       if TMATREADY and GetDistance(ts.target) < 375 and  QREADY == false and os.clock() - lastBasicAttack > swingDelay then
  223.         CastSpell(TMATSlot)
  224.         swing = 0
  225.       end
  226.       if SotDREADY then
  227.         if ts.target.type == "obj_AI_Hero" and GetDistance(ts.target) < 400 then
  228.           CastSpell(SotDSlot)
  229.         end
  230.       end      
  231.             if EREADY and os.clock() - lastBasicAttack > swingDelay then
  232.                 CastSpell(_E, ts.target)
  233.                 swing = 0  
  234.     elseif myHero.mana < 5 and QREADY and not EREADY and os.clock() - lastBasicAttack > swingDelay then
  235.                 CastSpell(_Q)
  236.         myHero:Attack(ts.target)
  237.                 swing = 0
  238.             end
  239.         end                
  240.     end
  241.    
  242.     if RCConfig.scriptActive2 and ts.target ~= nil then
  243.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  244.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  245.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  246.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  247.     if myHero.mana < 5 and GetDistance(ts.target) < wrange and WREADY then         
  248.                 CastSpell(_W)
  249.         end            
  250.         if swing == 0 then
  251.       if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then        
  252.                 CastSpell(_E, ts.target)
  253.             end
  254.             if ts.target ~= nil and ValidTarget(ts.target, wrange) then
  255.                 myHero:Attack(ts.target)
  256.             end
  257.     elseif swing == 1 then
  258.       if TMATREADY and GetDistance(ts.target) < 375 and  QREADY == false and os.clock() - lastBasicAttack > swingDelay then
  259.         CastSpell(TMATSlot)
  260.         swing = 0
  261.       end      
  262.       if SotDREADY then
  263.         if ts.target.type == "obj_AI_Hero" and GetDistance(ts.target) < 400 then
  264.           CastSpell(SotDSlot)
  265.         end
  266.       end      
  267.       if canQ == true then
  268.        if QREADY and os.clock() - lastBasicAttack > swingDelay and canQ == true then
  269.          canQ = false
  270.          CastSpell(_Q)        
  271.          myHero:Attack(ts.target)
  272.          swing = 0
  273.     elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
  274.                 CastSpell(_E, ts.target)
  275.                 swing = 0
  276.         end
  277.             end
  278.         end                        
  279.     end
  280.    
  281.     if RCConfig.scriptActive3 and ts.target ~= nil then
  282.         if DFGREADY then CastSpell(DFGSlot, ts.target) end
  283.         if HXGREADY then CastSpell(HXGSlot, ts.target) end
  284.         if BWCREADY then CastSpell(BWCSlot, ts.target) end
  285.         if BRKREADY then CastSpell(BRKSlot, ts.target) end
  286.    
  287.     if GetDistance(ts.target) < wrange and WREADY then         
  288.                 CastSpell(_W)
  289.         end            
  290.         if swing == 0 then
  291.       if myHero.mana == 4 and not (WREADY or QREADY) and (GetDistance(ts.target) < erange and GetDistance(ts.target) > 225) and EREADY then        
  292.                 CastSpell(_E, ts.target)
  293.             end
  294.             if ts.target ~= nil and ValidTarget(ts.target, wrange) then
  295.                 myHero:Attack(ts.target)
  296.             end
  297.     elseif swing == 1 then
  298.       if TMATREADY and GetDistance(ts.target) < 375 and  QREADY == false and os.clock() - lastBasicAttack > swingDelay then
  299.         CastSpell(TMATSlot)
  300.         swing = 0
  301.       end
  302.       if SotDREADY then
  303.         if ts.target.type == "obj_AI_Hero" and GetDistance(ts.target) < 400 then
  304.           CastSpell(SotDSlot)
  305.         end
  306.       end
  307.       if myHero.mana < 5 and QREADY and os.clock() - lastBasicAttack > swingDelay then
  308.          CastSpell(_Q)
  309.          myHero:Attack(ts.target)
  310.          swing = 0
  311.     elseif myHero.mana == 4 and not (WREADY or QREADY) and os.clock() - lastBasicAttack > swingDelay then
  312.                 CastSpell(_E, ts.target)
  313.                 swing = 0
  314.       end
  315.         end                        
  316.     end
  317.  
  318.  
  319.   if RCConfig.autoEFarm then
  320.     enemyMinions:update()
  321.     if mousemoving and GetTickCount() > nextTick then
  322.             player:MoveTo(mousePos.x, mousePos.z)
  323.         end    
  324.     for index, minion in pairs(enemyMinions.objects) do
  325.         if minion and minion.dead == false then
  326.         local myE = getDmg("E",minion,myHero)
  327.         local myAA = getDmg("AD",minion,myHero)
  328.         if EREADY then
  329.           if player:GetDistance(minion) < range and minion.health <= myE and EREADY then   
  330.             CastSpell(_E, minion)
  331.           end
  332.         elseif EREADY == false then
  333.           if minion and minion.health <= myAA and GetDistance(minion) <= (player.range + scanAdditionalRange) and GetTickCount() > nextTick then
  334.             player:Attack(minion) ---PrintChat("ATTACKING")
  335.             nextTick = GetTickCount() + waitDelay
  336.           end
  337.                 end
  338.       end
  339.     end
  340.   end
  341.    
  342.    
  343.     --[[if mousemoving and GetTickCount() > nextTick then
  344.             player:MoveTo(mousePos.x, mousePos.z)
  345.         end
  346.     for index, minion in pairs(enemyMinions.objects) do
  347.             local myE = getDmg("E",minion,myHero)
  348.             if minion and EREADY and myHero:GetDistance(minion) <= erange and minion.health <= myE and minion.dead == false then
  349.                 CastSpell(_E, minion)
  350.             end
  351.         end
  352.   end
  353.  
  354.         for k = 1, objManager.maxObjects do
  355.             local minionObjectI = objManager:GetObject(k)      
  356.             if minionObjectI ~= nil and string.find(minionObjectI.name,"Minion_") == 1 and minionObjectI.team ~= myHero.team and minionObjectI.dead == false then
  357.         local myE = getDmg("E",minionObjectI,myHero)
  358.                 if myHero:GetDistance(minionObjectI) < 575 and minionObjectI.health <= myHero:CalcDamage(minionObjectI, myE) then
  359.                     CastSpell(_E, minionObjectI)
  360.                 end
  361.             end
  362.         end
  363.     end]]
  364.    
  365.  
  366.     if RCConfig.autoAAFarm then
  367.     enemyMinions:update()
  368.         if mousemoving and GetTickCount() > nextTick then
  369.             player:MoveTo(mousePos.x, mousePos.z)
  370.         end                    
  371.         local tick = GetTickCount()
  372.         if lasthiton then
  373.             for index, minion in pairs(enemyMinions.objects) do
  374.         if minion and minion.dead == false then
  375.           local myAA = getDmg("AD",minion,myHero)
  376.           if minion and minion.health <= myAA and GetDistance(minion) <= (player.range + scanAdditionalRange) and GetTickCount() > nextTick then
  377.               player:Attack(minion)
  378.               nextTick = GetTickCount() + waitDelay
  379.           end
  380.                 end
  381.             end    
  382.         end
  383.     end
  384. end
  385.  
  386. function RENDmgCalculation(enemy)
  387.   local hitdamage = getDmg("AD",enemy,myHero)
  388.     local qdamage = getDmg("Q",enemy,myHero)
  389.   local qdamage2 = getDmg("Q",enemy,myHero,2) --to Isolated Target
  390.     local wdamage = getDmg("W",enemy,myHero)
  391.     local edamage = getDmg("E",enemy,myHero)
  392.     local combo5 = 0
  393.  
  394.   if GetDistance(enemy) < 350 then
  395.       combo5 = hitdamage
  396.     if QREADY and myHero.mana < 5 then
  397.       combo5 = combo5 + qdamage + hitdamage
  398.     elseif QREADY and myHero.mana == 5 then
  399.       combo5 = combo5 + qdamage2 + hitdamage
  400.     end    
  401.   end
  402.     if WREADY and GetDistance(enemy) < wrange then
  403.         combo5 = combo5 + wdamage
  404.     end
  405.     if EREADY and GetDistance(enemy) < erange then
  406.         combo5 = combo5 + edamage
  407.     end
  408.     return combo5
  409. end
  410.  
  411. function OnDraw()
  412.     if RCConfig.drawcircles and not myHero.dead then       
  413.         if WREADY then DrawCircle(myHero.x, myHero.y, myHero.z, wrange, 0x992D3D) end
  414.         if EREADY then DrawCircle(myHero.x, myHero.y, myHero.z, erange, 0xFFFFFF) end
  415.         if ts.target ~= nil then
  416.             for j=0, 10 do DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + j*1.5, 0x00FF00) end
  417.         end
  418.     end
  419. end
  420. function OnSendChat(msg)
  421.     ts:OnSendChat(msg, "pri")
  422. end
  423. PrintChat(" >> Rengar the Rapist v1.4 loaded!")
Advertisement
Add Comment
Please, Sign In to add comment