Advertisement
Guest User

MiniJumper

a guest
Oct 23rd, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 4.85 KB | None | 0 0
  1. if myHero.charName ~= "LeeSin" and myHero.charName ~= "Jax" and myHero.charName ~= "Katarina" and myHero.charName ~= "JarvanIV" then  return end
  2.  
  3. casted = false
  4. hold = false
  5. castedWard = false
  6. Wards = {}
  7.  
  8. ID = {--[[RSStone]] 2045, --[[SStone]] 2049, --[[RSLantern]] 3340, --[[RLantern]] 3350, --[[RGLantern]] 3361, --[[Quill Coat]] 3205, --[[Wriggles]] 3154, --[[SpiritGolem]] 3207, --[[SWard]] 2044, --[[VWard]] 2043, --[[RVLantern]] 3362, --[[FFlare]] 3160}
  9.  
  10. if (myHero.charName == "LeeSin") then
  11.     JumperAbility = _W
  12. end
  13. if (myHero.charName == "Katarina") then
  14.     JumperAbility = _E
  15. end
  16. if (myHero.charName == "Jax") then
  17.     JumperAbility = _Q
  18. end
  19.  
  20. function OnLoad()
  21.     PrintChat("MiniJumper")
  22.     ConfigBasic = scriptConfig("MiniJumper", "MiniJumper")
  23.     ConfigBasic:addParam("wardjump", "Jump key", SCRIPT_PARAM_ONKEYDOWN, false, GetKey("G"))
  24.     ConfigBasic:addParam("DrawRange", "Draw Jump range", SCRIPT_PARAM_ONOFF, false)
  25.     ConfigBasic:addParam("DrawScanRange", "Draw Ward Position", SCRIPT_PARAM_ONOFF, true)
  26.  
  27.     for i = 1, objManager.maxObjects do
  28.         local object = objManager:GetObject(i)
  29.         if object ~= nil and object.valid and (object.name == "SightWard" or object.name == "VisionWard") then
  30.             table.insert(Wards, object)
  31.         end
  32.     end
  33. end
  34.  
  35. function OnDraw()
  36.     if ConfigBasic.DrawRange then
  37.         if myHero.charName == "JarvanIV" then
  38.             DrawCircle(myHero.x, myHero.y, myHero.z, 800, ARGB(0, 255, 0, 255))
  39.         else
  40.             DrawCircle(myHero.x, myHero.y, myHero.z, 625, ARGB(0, 255, 0, 255))
  41.         end
  42.  
  43.     end
  44.     if (ConfigBasic.DrawScanRange and (myHero:CanUseSpell(JumperAbility) == READY and (myHero.charName ~= "LeeSin" or myHero:GetSpellData(JumperAbility).name == "BlindMonkWOne"))) then
  45.         local pos = getMousePos()
  46.         if (GetWardSlot() == nil) then
  47.             if (GetDistance(mousePos) <= 600) then
  48.                 pos = mousePos
  49.             end
  50.         end
  51.         DrawCircle(pos.x, pos.y, pos.z, 150, ARGB(255, 255, 255, 0))
  52.     end
  53. end
  54.  
  55. function OnRecvPacket(p)
  56.     if p.header == 0x07 and castedWard then
  57.         p.pos = 5
  58.         if myHero.networkID == (p:DecodeF()) then
  59.             p.pos = 1
  60.             wardNetID = p:DecodeF()
  61.             if myHero:CanUseSpell(JumperAbility) == READY and (myHero.charName ~= "LeeSin" or myHero:GetSpellData(JumperAbility).name == "BlindMonkWOne") then
  62.                 Packet('S_CAST', { spellId = JumperAbility, targetNetworkId = wardNetID }):send()
  63.             end
  64.         end
  65.     end
  66. end
  67.  
  68. function OnSendPacket(p)
  69.     if (p.header == _G.Packet.headers.S_CAST and casted) then
  70.         local packet = Packet(p)
  71.         if (packet:get('sourceNetworkId') == myHero.networkID) then
  72.             local location = packet:get('spellId')
  73.             if (location ~= 11) then
  74.                 for i, ward in ipairs(ID) do
  75.                     if (myHero:getInventorySlot(location) == ward) then
  76.                         if not castedWard then
  77.                             castedWard = true
  78.                             DelayAction(function() castedWard = false casted = false end, 4)
  79.                         else
  80.                             p:Block()
  81.                         end
  82.                     end
  83.                 end
  84.             else
  85.                 if not castedWard then
  86.                     castedWard = true
  87.                     DelayAction(function() castedWard = false casted = false end, 4)
  88.                 else
  89.                     p:Block()
  90.                 end
  91.             end
  92.         end
  93.     end
  94. end
  95.  
  96.  
  97. function OnTick()
  98.     if not ConfigBasic.wardjump then hold = false return end
  99.  
  100.     if not hold then
  101.         hold = true
  102.  
  103.         if myHero.charName == "LeeSin" or myHero.charName == "Jax" or myHero.charName == "Katarina" then
  104.             if myHero:CanUseSpell(JumperAbility) == READY and (myHero.charName ~= "LeeSin" or myHero:GetSpellData(JumperAbility).name == "BlindMonkWOne") then
  105.                 local pos = getMousePos()
  106.  
  107.                 table.sort(Wards, function(x,y) return GetDistance(x) < GetDistance(y) end)
  108.                 for i, ward in ipairs(Wards) do
  109.                     if (GetDistance(ward, pos) <= 150) then
  110.                         CastSpell(JumperAbility, ward)
  111.                         return
  112.                     end
  113.                 end
  114.  
  115.                 slot = GetWardSlot()
  116.                 if slot == nil then PrintAlert("Error: No Wards.", 4, 255, 0, 0) return end
  117.                 casted = true
  118.                 CastSpell(slot, pos.x, pos.z)
  119.                 return true
  120.             else
  121.                 PrintAlert("Eror: Spell on CD", 4, 255, 0, 0)
  122.             end
  123.         end
  124.  
  125.         if myHero.charName == "JarvanIV" and myHero:CanUseSpell(_E) == READY and myHero:CanUseSpell(_Q) == READY and myHero:GetSpellData(_Q).mana + myHero:GetSpellData(_E).mana < myHero.mana then
  126.  
  127.             local pos = GetDistance(mousePos) <= 770 and mousePos or getMousePos(770)
  128.             CastSpell(_E, pos.x, pos.z)
  129.             CastSpell(_Q, pos.x, pos.z)
  130.         end
  131.  
  132.     end
  133. end
  134.  
  135. function OnCreateObj(obj)
  136.     if obj ~= nil and obj.valid then
  137.         if obj.name == "SightWard" or obj.name == "VisionWard" then
  138.             table.insert(Wards, obj)
  139.         end
  140.     end
  141. end
  142.  
  143. function getMousePos(range)
  144.     local temprange = range or 600
  145.     local MyPos = Vector(myHero.x, myHero.y, myHero.z)
  146.     local MousePos = Vector(mousePos.x, mousePos.y, mousePos.z)
  147.  
  148.     return MyPos - (MyPos - MousePos):normalized() * temprange
  149. end
  150.  
  151. function GetWardSlot()
  152.     for _, wardID in ipairs(ID) do
  153.         slot = GetInventorySlotItem(wardID)
  154.         if slot ~= nil and myHero:CanUseSpell(slot) == READY then
  155.             return slot
  156.         end
  157.     end
  158.     return nil
  159. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement