16HeX16

Lee Sin 2.0 - VIP Pred/Collision

Jun 4th, 2013
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 15.85 KB | None | 0 0
  1. --[[ Ultimate Lee Sin 2.0 by HeX    ]]--
  2. --[[    VIP Prediction  ]]--
  3.  
  4. if myHero.charName ~= "LeeSin" then return end
  5. require "Collision"
  6.  
  7. --[[    Variables   ]]--
  8. --[[    Ranges  ]]--
  9. local qRange = 975
  10. local qWidth = 75 -- Increase if Q is hitting creep with collision ON.
  11. local wRange = 700
  12. local eRange = 425
  13. local eBuffer = 275
  14. local rRange = 375
  15. --[[    Draw    ]]--
  16. local waittxt = {}
  17. local floattext = {"Skills on cooldown.","Killable","Easy kill","Ultimate him!"}
  18. local killable = {}
  19. local calculationenemy = 1
  20. --[[    Ready   ]]--
  21. local ignite = nil
  22. local BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot, YGBSlot = nil, nil, nil, nil, nil, nil, nil, nil
  23. local QREADY, WREADY, EREADY, RREADY, IREADY = false, false, false, false, false
  24. --[ [Q Prediction   ]]--
  25. local rCast = false
  26. local qp = TargetPredictionVIP(qRange, 1500, 0.25, qWidth)
  27. local Col = Collision(qRange, 1500, 0.25, qWidth)
  28. --[[    Auto Attacks    ]]--
  29. local lastBasicAttack = 0
  30. local swingDelay = 0.25
  31. local swing = 0
  32. --[[    Q Dodge ]]--
  33. local qDelay = nil
  34. local qCast = false
  35. local dodgeMinion = nil
  36. local dodgeHero = nil
  37. local wDelay = 0
  38. local qMultiplier = 1.1 --Increase if Q-Shield combo is too fast
  39. --[[    Ward Jump   ]]--
  40. local WardTable = {}
  41. local SWard, VWard, SStone, RSStone, Wriggles = 2044, 2043, 2049, 2045, 3154
  42. local SWardSlot, VWardSlot, SStoneSlot, RSStoneSlot, WrigglesSlot = nil, nil, nil, nil, nil
  43. local jumpReady = false
  44. local jumpRange = 540
  45. local wardRange = 600
  46. local jumpDelay = 0
  47.  
  48. function OnLoad()
  49.     Menu()
  50. end
  51.  
  52. --[[======================================Tick/Combo======================================]]--
  53. function OnTick()
  54.     ts:update()
  55.     allyMinions:update()
  56.     enemyMinions:update()
  57.     Checks()
  58.  
  59. --[[    Ultimate Close  ]]--
  60.     if LeeSinConfig.rClose then
  61.         ClosestUlt()
  62.     end
  63.    
  64. --[[    Auto Ultimate   ]]--
  65.     if not myHero.dead and LeeSinConfig.autoult then
  66.         AutoUlt()
  67.     end
  68.    
  69. --[[    Q Dodge ]]--
  70.     if LeeSinConfig.qDodge and ts.target ~= nil then
  71.         DodgeBall()
  72.     end
  73.    
  74. --[[    Basic Combo ]]--
  75.     if LeeSinConfig.scriptActive and ts.target ~= nil then
  76.         UseItems(ts.target)
  77.         BasicCombo(ts.target)
  78.     end
  79.    
  80. --[[    Quick Jump  ]]--
  81. --  if LeeSinConfig.quickJump then
  82. --      QuickJump()
  83. --  end
  84.    
  85. --[[    Ignite  ]]--
  86.     if LeeSinConfig.autoignite then    
  87.         AutoIgnite()
  88.     end
  89.    
  90. --[[    Ward Jump   ]]--
  91.     if jumpReady == true then
  92.         JumpReady()
  93.     end
  94.     if LeeSinConfig.wardjump then
  95.         JumpCheck()
  96.     end
  97. end
  98.  
  99. function OnDraw()
  100.     Draw()
  101. end
  102.  
  103. --[ [DONT GO BELOW THIS LINE    ]]--
  104. function OnCreateObj(object)
  105.   if WardCheck(object) then table.insert(WardTable, object) end
  106. end
  107.  
  108. function OnProcessSpell(unit, spell)
  109.     if unit.isMe and (spell.name:find("Attack") ~= nil) then
  110.         swing = 1
  111.         lastBasicAttack = os.clock()
  112.     end
  113. end
  114.  
  115. function findClosestEnemy()
  116.     local closestEnemy = nil
  117.     local currentEnemy = nil
  118.     for i=1, heroManager.iCount do
  119.         currentEnemy = heroManager:GetHero(i)
  120.         if currentEnemy.team ~= myHero.team and not currentEnemy.dead and currentEnemy.visible then
  121.             if closestEnemy == nil then
  122.                 closestEnemy = currentEnemy
  123.                 elseif GetDistance(currentEnemy) < GetDistance(closestEnemy) then
  124.                     closestEnemy = currentEnemy
  125.             end
  126.         end
  127.     end
  128. return closestEnemy
  129. end
  130.  
  131. function findFurthestMinion()
  132.     local FurthestMinion = nil
  133.     local currentMinion = nil
  134.     for _, minion in pairs(allyMinions.objects) do
  135.         currentMinion = minion
  136.         if FurthestMinion == nil then
  137.             FurthestMinion = currentMinion
  138.         elseif GetDistance(currentMinion) > GetDistance(FurthestMinion) then
  139.             FurthestMinion = currentMinion
  140.         end
  141.     end
  142. return FurthestMinion
  143. end
  144.  
  145. --[[    Combo Functions ]]--
  146. function AutoUlt()
  147.     if RREADY then
  148.         local rDmg = 0    
  149.         for i = 1, heroManager.iCount, 1 do
  150.             local enemyhero = heroManager:getHero(i)
  151.             rDmg = getDmg("R", enemyhero, myHero)
  152.             if enemyhero.health <= rDmg and GetDistance(enemyhero) <= rRange then
  153.                 CastSpell(_R, enemyhero)
  154.             end
  155.         end
  156.     end
  157. end
  158.  
  159. function ClosestUlt()
  160.     findClosestEnemy()
  161.     if RREADY and findClosestEnemy() ~= nil and GetDistance(findClosestEnemy()) <= (rRange) then
  162.         CastSpell(_R, findClosestEnemy())
  163.     end
  164. end
  165.  
  166. function BasicCombo(target)
  167.     if predic ~= nil and QREADY and GetDistance(predic) <= qRange and myHero:GetSpellData(_Q).name == "BlindMonkQOne" then
  168.         if not Col:GetMinionCollision(myHero, predic) and not Col:GetHeroCollision(myHero, predic, HERO_ENEMY) and qp:GetHitChance(target) > 0.5 then
  169.             CastSpell(_Q, predic.x, predic.z)
  170.         end
  171.     end
  172.     if GetDistance(target) <= 1100 and QREADY and not rCast then
  173.         CastSpell(_Q)
  174.     elseif QREADY and GetDistance(target) <= 1100 and LeeSinConfig.useUlti and rCast then
  175.         CastSpell(_Q)
  176.     end
  177.     if swing == 0 and GetDistance(target) <= eRange then
  178.         myHero:Attack(target)
  179.         if EREADY and GetDistance(target) <= eBuffer and myHero:GetSpellData(_E).name == "blindmonketwo" then
  180.             CastSpell(_E)
  181.         end
  182.     elseif swing == 1 then
  183.         if EREADY and GetDistance(target) <= eBuffer and myHero:GetSpellData(_E).name == "BlindMonkEOne" then
  184.             CastSpell(_E)
  185.             myHero:Attack(target)
  186.         end
  187.     end
  188.     if EREADY and GetDistance(target) >= eRange and myHero:GetSpellData(_E).name == "blindmonketwo" then
  189.         CastSpell(_E)
  190.         myHero:Attack(target)
  191.     end
  192.     if RREADY and GetDistance(target) <= rRange and LeeSinConfig.useUlti and QREADY then
  193.         CastSpell(_R, target)
  194.         rCast = true
  195.     end
  196. end
  197.  
  198. function DodgeBall()
  199. --  Setting
  200.     for i=1, heroManager.iCount do
  201.         local allytarget = heroManager:GetHero(i)
  202.         if allytarget.team == myHero.team and not allytarget.dead and GetDistance(allytarget, targetPosition) < 750 and allytarget.charName ~= myHero.charName then
  203.             dodgeHero = allytarget
  204.         end
  205.     end
  206.  
  207.     dodgeMinion = findFurthestMinion()
  208. --  Cast
  209.     if predic ~= nil and QREADY and GetDistance(predic) <= qRange and myHero:GetSpellData(_Q).name == "BlindMonkQOne" then
  210.         if not Col:GetMinionCollision(myHero, predic) and not Col:GetHeroCollision(myHero, predic, HERO_ENEMY) and qp:GetHitChance(ts.target) > 0.5 then
  211.             CastSpell(_Q, predic.x, predic.z)
  212.         end
  213.     end
  214.     if (dodgeMinion ~= nil and dodgeMinion ~= dead) or (dodgeHero ~= nil and dodgeHero ~= dead) then
  215.         if GetDistance(ts.target) <= 1100 and myHero:GetSpellData(_Q).name == "blindmonkqtwo" and WREADY then
  216.             CastSpell(_Q)
  217.             qCast = true
  218.             qDelay = os.clock()
  219.             wDelay = ((GetDistance(predic)/1600) * qMultiplier)
  220.         end
  221.        
  222.         if qCast == true and not QREADY and dodgeMinion ~= nil and GetDistance(dodgeMinion, ts.target) < 750 then
  223.             if os.clock() - qDelay > wDelay then
  224.                 CastSpell(_W, dodgeMinion)
  225.                 qCast = false
  226.             end
  227.         elseif qCast == true and not QREADY and dodgeHero ~= nil then
  228.             if os.clock() - qDelay > wDelay then
  229.                 CastSpell(_W, dodgeHero)
  230.                 qCast = false
  231.             end
  232.         end
  233.     end
  234. end
  235.  
  236. --[[    Ward Jump   ]]--
  237. function WardCheck(object)
  238.     return object and object.valid and (string.find(object.name, "Ward") ~= nil or string.find(object.name, "Wriggle") ~= nil)
  239. end
  240.  
  241. function JumpReady()
  242.     if jumpReady == true then
  243.         for i,object in ipairs(WardTable) do
  244.             if object ~= nil and object.valid and math.sqrt((object.x-mousePos.x)^2+(object.z-mousePos.z)^2) < 150 and myHero:GetSpellData(_W).name == "BlindMonkWOne" then
  245.                 CastSpell(_W, object)
  246.                 jumpReady = false
  247.             end
  248.    end
  249.     end
  250. end
  251.  
  252. function JumpCheck()
  253.     local x = mousePos.x
  254.     local z = mousePos.z
  255.     local dx = x - player.x
  256.     local dz = z - player.z
  257.     local rad1 = math.atan2(dz, dx)
  258.    
  259.     SWardSlot = GetInventorySlotItem(SWard)
  260.     VWardSlot = GetInventorySlotItem(VWard)
  261.     SStoneSlot = GetInventorySlotItem(SStone)
  262.     RSStoneSlot = GetInventorySlotItem(RSStone)
  263.     WrigglesSlot = GetInventorySlotItem(Wriggles)
  264.  
  265.     if RSStoneSlot ~= nil and CanUseSpell(RSStoneSlot) == READY then
  266.         wardSlot = RSStoneSlot
  267.     elseif SStoneSlot ~= nil and CanUseSpell(SStoneSlot) == READY then
  268.         wardSlot = SStoneSlot
  269.     elseif SWardSlot ~= nil then
  270.         wardSlot = SWardSlot
  271.     elseif VWardSlot ~= nil then
  272.         wardSlot = VWardSlot
  273.     elseif WrigglesSlot ~= nil then
  274.         wardSlot = WrigglesSlot
  275.     else wardSlot = nil
  276.     end
  277.  
  278.     if wardSlot ~= nil then
  279.         local dx1 = jumpRange*math.cos(rad1)
  280.         local dz1 = jumpRange*math.sin(rad1)
  281.         local x1 = x - dx1
  282.         local z1 = z - dz1
  283.         if WREADY and math.sqrt(dx*dx + dz*dz) <= 600 then
  284.             CastSpell( wardSlot, x, z )
  285.             jumpReady = true
  286.         elseif WREADY then player:MoveTo(x1, z1)
  287.             else myHero:StopPosition()
  288.         end
  289.     end
  290. end
  291.  
  292. --[[    Auto Ignite ]]--
  293. function AutoIgnite()
  294.     if IREADY then
  295.         local ignitedmg = 0    
  296.         for i = 1, heroManager.iCount, 1 do
  297.             local enemyhero = heroManager:getHero(i)
  298.             if ValidTarget(enemyhero, 600) then
  299.                 ignitedmg = 50 + 20 * myHero.level
  300.                 if enemyhero.health <= ignitedmg then
  301.                     CastSpell(ignite, enemyhero)
  302.                 end
  303.             end
  304.         end
  305.     end
  306. end
  307.  
  308. --[[    Ready and Items ]]--
  309. function Checks()
  310.     BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot, YGBSlot = GetInventorySlotItem(3153), GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3077), GetInventorySlotItem(3074),  GetInventorySlotItem(3143), GetInventorySlotItem(3142)
  311.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  312.     WREADY = (myHero:CanUseSpell(_W) == READY)
  313.     EREADY = (myHero:CanUseSpell(_E) == READY)
  314.     RREADY = (myHero:CanUseSpell(_R) == READY)
  315.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  316.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  317.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  318.     BRKREADY = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  319.     TMTREADY = (TMTSlot ~= nil and myHero:CanUseSpell(TMTSlot) == READY)
  320.     RAHREADY = (RAHSlot ~= nil and myHero:CanUseSpell(RAHSlot) == READY)
  321.     RNDREADY = (RNDSlot ~= nil and myHero:CanUseSpell(RNDSlot) == READY)
  322.     YGBREADY = (YGBSlot ~= nil and myHero:CanUseSpell(YGBSlot) == READY)
  323.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  324.    
  325.     if tick == nil or GetTickCount()-tick>=200 then
  326.         tick = GetTickCount()
  327.         SCDmgCalculation()
  328.     end
  329.     if swing == 1 and os.clock() > lastBasicAttack + 0.4 then
  330.         swing = 0
  331.     end
  332.     if ts.target ~= nil then
  333.         predic = qp:GetPrediction(ts.target)
  334.     end
  335. end
  336.    
  337. function UseItems(target)
  338.     if GetDistance(target) < 550 then
  339.         if DFGREADY then CastSpell(DFGSlot, target) end
  340.         if HXGREADY then CastSpell(HXGSlot, target) end
  341.         if BWCREADY then CastSpell(BWCSlot, target) end
  342.         if BRKREADY then CastSpell(BRKSlot, target) end
  343.         if YGBREADY then CastSpell(YGBSlot, target) end
  344.         if TMTREADY and GetDistance(target) < 275 then CastSpell(TMTSlot) end
  345.         if RAHREADY and GetDistance(target) < 275 then CastSpell(RAHSlot) end
  346.         if RNDREADY and GetDistance(target) < 275 then CastSpell(RNDSlot) end
  347.     end
  348. end
  349.  
  350. --[[    Base Functions  ]]--
  351. function Menu()
  352.     PrintChat("<font color='#CCCCCC'> >> Ultimate Lee Sin 2.0 loaded! <<</font>")
  353.     LeeSinConfig = scriptConfig("LeeSin Config", "LeeSincombo")
  354.     LeeSinConfig:addParam("scriptActive", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  355.     LeeSinConfig:addParam("wardjump", "Ward Jump", SCRIPT_PARAM_ONKEYDOWN, false, 71)
  356.     LeeSinConfig:addParam("qDodge", "Jump Shield Combo", SCRIPT_PARAM_ONKEYDOWN, false, 84)
  357.     --LeeSinConfig:addParam("quickJump", "Quick Jump", SCRIPT_PARAM_ONKEYDOWN, false, 90)
  358.     LeeSinConfig:addParam("rClose", "Ult Closest Enemy", SCRIPT_PARAM_ONKEYDOWN, false, 88)
  359.     LeeSinConfig:addParam("useUlti", "Use Ult in combo", SCRIPT_PARAM_ONOFF, false)
  360.     LeeSinConfig:addParam("drawcirclesEnemy", "DrawCircles - Enemies", SCRIPT_PARAM_ONOFF, false)
  361.     LeeSinConfig:addParam("drawcirclesSelf", "DrawCircles - Self", SCRIPT_PARAM_ONOFF, false)
  362.     LeeSinConfig:addParam("drawtext", "DrawText - Enemies", SCRIPT_PARAM_ONOFF, true)
  363.     LeeSinConfig:addParam("autoult", "Ult when killable", SCRIPT_PARAM_ONOFF, false)
  364.     LeeSinConfig:addParam("autoignite", "Auto Ignite", SCRIPT_PARAM_ONOFF, true)
  365.     LeeSinConfig:permaShow("scriptActive")
  366.     LeeSinConfig:permaShow("wardjump")
  367.     LeeSinConfig:permaShow("qDodge")
  368.     --LeeSinConfig:permaShow("quickJump")
  369.     LeeSinConfig:permaShow("autoult")
  370.    
  371.     ts = TargetSelector(TARGET_LOW_HP,1250,DAMAGE_PHYSICAL)
  372.     ts.name = "LeeSin"
  373.     LeeSinConfig:addTS(ts)
  374.    
  375.     enemyMinions = minionManager(MINION_ENEMY, 1200, player)
  376.     allyMinions = minionManager(MINION_ALLY, 1000, player)
  377.    
  378.     for i = 0, objManager.maxObjects, 1 do
  379.         local object = objManager:GetObject(i)
  380.             if WardCheck(object) then table.insert(WardTable, object) end
  381.   end  
  382.  
  383.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then ignite = SUMMONER_1
  384.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then ignite = SUMMONER_2
  385.     end
  386.     for i=1, heroManager.iCount do waittxt[i] = i*3 end
  387. end
  388.  
  389. function Draw()
  390.     if LeeSinConfig.wardjump and not myHero.dead then
  391.         DrawCircle(myHero.x, myHero.y, myHero.z, 600, 0x0000FF)
  392.     end
  393.     if LeeSinConfig.drawcirclesSelf and not myHero.dead then
  394.         DrawCircle(myHero.x, myHero.y, myHero.z, qRange, 0xCCFF33)
  395.         DrawCircle(myHero.x, myHero.y, myHero.z, rRange, 0xFF0000)
  396.         DrawCircle(myHero.x, myHero.y, myHero.z, 600, 0x0000FF)
  397.     end
  398.     if ts.target ~= nil and LeeSinConfig.drawcirclesEnemy then
  399.         for e=0, 10 do
  400.             DrawCircle(ts.target.x, ts.target.y, ts.target.z, 40 + e*1.5, 0x00FF00)
  401.         end
  402.     end
  403.     for i=1, heroManager.iCount do
  404.         local enemydraw = heroManager:GetHero(i)
  405.         if ValidTarget(enemydraw) then
  406.             if LeeSinConfig.drawcirclesEnemy then
  407.                 if killable[i] == 1 then
  408.                     for e=0, 15 do
  409.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0x0000FF)
  410.                     end
  411.                     elseif killable[i] == 2 then
  412.                     for e=0, 10 do
  413.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  414.                     end
  415.                     elseif killable[i] == 3 then
  416.                     for e=0, 10 do
  417.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  418.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + e*1.5, 0xFF0000)
  419.                     end
  420.                     elseif killable[i] == 4 then
  421.                     for e=0, 10 do
  422.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 80 + e*1.5, 0xFF0000)
  423.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 110 + e*1.5, 0xFF0000)
  424.                         DrawCircle(enemydraw.x, enemydraw.y, enemydraw.z, 140 + e*1.5, 0xFF0000)
  425.                     end
  426.                 end
  427.             end
  428.             if LeeSinConfig.drawtext and waittxt[i] == 1 and killable[i] ~= 0 then
  429.                 PrintFloatText(enemydraw,0,floattext[killable[i]])
  430.             end
  431.         end
  432.         if waittxt[i] == 1 then waittxt[i] = 30
  433.             else waittxt[i] = waittxt[i]-1
  434.         end
  435.     end
  436. end
  437.  
  438. function SCDmgCalculation()
  439.     local enemy = heroManager:GetHero(calculationenemy)
  440.     if ValidTarget(enemy) then
  441.         local ignitedamage, bwcdamage, brkdamage = 0, 0, 0
  442.         local qdamage = getDmg("Q",enemy,myHero)
  443.         local edamage = getDmg("E",enemy,myHero)
  444.         local rdamage = getDmg("R",enemy,myHero,1)
  445.         local hitdamage = getDmg("AD",enemy,myHero)
  446.         local ignitedamage = (ignite and getDmg("IGNITE",enemy,myHero) or 0)
  447.         local bwcdamage = (BWCSlot and getDmg("BWC",enemy,myHero) or 0)
  448.         local brkdamage = (BRKSlot and getDmg("RUINEDKING",enemy,myHero) or 0)
  449.         local combo1 = hitdamage*2 + qdamage + edamage + rdamage
  450.         local combo2 = hitdamage*2
  451.         local combo3 = hitdamage*1
  452.         local combo4 = 0
  453.     if QREADY then
  454.         combo2 = combo2 + qdamage
  455.         combo3 = combo3 + qdamage
  456.         end
  457.     if EREADY then
  458.         combo2 = combo2 + edamage
  459.     end
  460.     if RREADY then
  461.         combo2 = combo2 + rdamage
  462.         combo4 = combo4 + rdamage
  463.     end
  464.     if BWCREADY then
  465.         combo1 = combo1 + bwcdamage
  466.         combo2 = combo2 + bwcdamage
  467.         combo3 = combo3 + bwcdamage
  468.     end
  469.     if BRKREADY then
  470.         combo1 = combo1 + brkdamage
  471.         combo2 = combo2 + brkdamage
  472.         combo3 = combo3 + brkdamage
  473.     end
  474.     if IREADY then
  475.         combo1 = combo1 + ignitedamage
  476.         combo2 = combo2 + ignitedamage
  477.         combo3 = combo3 + ignitedamage
  478.     end
  479.     if combo4 >= enemy.health then killable[calculationenemy] = 4
  480.         elseif combo3 >= enemy.health then killable[calculationenemy] = 3
  481.         elseif combo2 >= enemy.health then killable[calculationenemy] = 2
  482.         elseif combo1 >= enemy.health then killable[calculationenemy] = 1
  483.         else killable[calculationenemy] = 0 end
  484.     end
  485.     if calculationenemy == 1 then calculationenemy = heroManager.iCount
  486.         else calculationenemy = calculationenemy-1
  487.     end
  488. end
Advertisement
Add Comment
Please, Sign In to add comment