16HeX16

Smart Jump 2.0

Apr 5th, 2013
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.49 KB | None | 0 0
  1. --[[    Smart Jump 2.0
  2.  
  3. Original Author and All Credits to ikita
  4. Updated by HeX
  5.    
  6. Attempts to ward jump (Stones->Vision->Sight->Wriggles) before trying to flash.
  7.  
  8. ]]
  9.  
  10. --[[        Config      ]]
  11. local myObjectsTable = {}
  12. local flashRange = 540
  13. local wardRange = 600
  14. local jumpDelay = 0
  15. local SWard, VWard, SStone, RSStone, Wriggles = 2044, 2043, 2049, 2045, 3154
  16. local SWardSlot, VWardSlot, SStoneSlot, RSStoneSlot, WrigglesSlot = nil, nil, nil, nil, nil
  17. local lastJump = 0
  18. local wardTarget
  19. local jumpReady = false
  20.  
  21. function OnLoad()
  22.     PrintChat("<font color='#CCCCCC'> >> Smart Jump 2.0 loaded! <<</font>")
  23.     PrintChat("<font color='#CCCCCC'> >> Credit to ikita <<</font>")
  24.     PrintChat("<font color='#CCCCCC'> >> Updated by HeX <<</font>")
  25.     SJConfig = scriptConfig("Smart Jump Config", "SmartJump")
  26.     SJConfig:addParam("drawActive", "Ward jump", SCRIPT_PARAM_ONKEYDOWN, false, 71)
  27.     SJConfig:addParam("jumpActive", "Ward jump", SCRIPT_PARAM_ONKEYDOWN, false, 71)
  28.     SJConfig:addParam("includeFlash", "Use Flash", SCRIPT_PARAM_ONKEYTOGGLE, false, 48)
  29.     SJConfig:permaShow("jumpActive")
  30.     SJConfig:permaShow("includeFlash")
  31.    
  32.     if player.charName == "Katarina" then
  33.         jumpSlot = _E
  34.         jumpRange = 700
  35.         elseif player.charName == "Jax" then
  36.         jumpSlot = _Q
  37.         jumpRange = 700
  38.         elseif player.charName == "LeeSin" then
  39.         jumpSlot = _W
  40.         jumpRange = 700
  41.         else
  42.         jumpSlot = nil
  43.         jumpRange = 0
  44.     end
  45.    
  46.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerFlash") then
  47.         flashSlot = SUMMONER_1
  48.         elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerFlash") then
  49.             flashSlot = SUMMONER_2
  50.             else flashSlot = nil
  51.     end
  52.     for i = 0, objManager.maxObjects, 1 do
  53.         local object = objManager:GetObject(i)
  54.         if objectIsValid(object) then table.insert(myObjectsTable, object) end
  55.     end
  56. end
  57.  
  58. function OnTick()
  59.     if jumpReady == true and GetTickCount() - lastJump > jumpDelay then
  60.         jumpNowAlready()
  61.     end
  62.     if SJConfig.jumpActive then
  63.         local x = mousePos.x
  64.         local z = mousePos.z
  65.         local dx = x - player.x
  66.         local dz = z - player.z
  67.         local rad1 = math.atan2(dz, dx)
  68.         SWardSlot = GetInventorySlotItem(SWard)
  69.         VWardSlot = GetInventorySlotItem(VWard)
  70.         SStoneSlot = GetInventorySlotItem(SStone)
  71.         RSStoneSlot = GetInventorySlotItem(RSStone)
  72.         WrigglesSlot = GetInventorySlotItem(Wriggles)
  73.        
  74.         if RSStoneSlot ~= nil and CanUseSpell(RSStoneSlot) == READY then
  75.             wardSlot = RSStoneSlot else
  76.             if SStoneSlot ~= nil and CanUseSpell(SStoneSlot) == READY then
  77.                 wardSlot = SStoneSlot else
  78.                 if SWardSlot ~= nil then
  79.                     wardSlot = SWardSlot else
  80.                     if VWardSlot ~= nil then
  81.                         wardSlot = VWardSlot else  
  82.                         if WrigglesSlot ~= nil then
  83.                             wardSlot = WrigglesSlot
  84.                             else wardSlot = nil
  85.                         end
  86.                     end
  87.                 end
  88.             end
  89.         end
  90.  
  91.         if wardSlot ~= nil and jumpSlot ~= nil then
  92.             local dx1 = flashRange*math.cos(rad1)
  93.             local dz1 = flashRange*math.sin(rad1)
  94.             local x1 = x - dx1
  95.             local z1 = z - dz1
  96.             if player:CanUseSpell(jumpSlot) == READY and GetTickCount() - lastJump > 2000 and math.sqrt(dx*dx + dz*dz) <= 600 then
  97.                 CastSpell( wardSlot, x, z )
  98.                 jumpReady = true
  99.                 lastJump = GetTickCount()
  100.                 elseif player:CanUseSpell(jumpSlot) == READY then
  101.                     player:MoveTo(x1, z1)
  102.                     else myHero:StopPosition()
  103.             end
  104.         end
  105.  
  106.         if SJConfig.includeFlash and (not (jumpSlot ~= nil and wardSlot ~= nil and player:CanUseSpell(jumpSlot) == READY)) and flashSlot ~= nil then
  107.             local dx1 = flashRange*math.cos(rad1)
  108.             local dz1 = flashRange*math.sin(rad1)
  109.             local x1 = x - dx1
  110.             local z1 = z - dz1
  111.             if GetTickCount() - lastJump > 2000 and math.sqrt(dx*dx + dz*dz) < flashRange + 90 then
  112.                 CastSpell( flashSlot, x, z )
  113.                 lastJump = GetTickCount()
  114.                 else player:MoveTo(x1, z1)
  115.             end
  116.         end
  117.     end
  118. end
  119.  
  120. function objectIsValid(object)
  121.    return object and object.valid and (string.find(object.name, "Ward") ~= nil or string.find(object.name, "Wriggle") ~= nil)
  122. end
  123.  
  124. function jumpNowAlready()
  125.     if SJConfig.jumpActive and jumpReady == true then
  126.         for i,object in ipairs(myObjectsTable) do
  127.             if object ~= nil and object.valid and math.sqrt((object.x-mousePos.x)^2+(object.z-mousePos.z)^2) < 150 then
  128.                 CastSpell(jumpSlot, object)
  129.                 jumpReady = false
  130.                 else table.remove(myObjectsTable, i) i = i - 1
  131.             end
  132.         end
  133.     end
  134. end
  135.  
  136. function OnCreateObj(object)
  137.     if objectIsValid(object) then table.insert(myObjectsTable, object) end
  138. end
  139.  
  140. function OnDraw()
  141.     if SJConfig.drawActive and not myHero.dead then
  142.         DrawCircle(myHero.x, myHero.y, myHero.z, wardRange, 0x0000FF)
  143.     end
  144. end
Advertisement
Add Comment
Please, Sign In to add comment