naturus

cait

Dec 23rd, 2014
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 16.06 KB | None | 0 0
  1. --[[
  2.  
  3.     EasyCait - Scripted by How I met Katarina.
  4.     Version: 1.x
  5.    
  6.     Credits : Bilbao for maths and skill table, Honda7 for SOW and VPred, Shalzuth for the skin hack function working rly well
  7.     Hope I didn't forget somebody.
  8. ]]--
  9.  
  10. -- Hero check
  11. if GetMyHero().charName ~= "Caitlyn" then
  12. return
  13. end
  14.  
  15. local version = 1.4
  16. local AUTOUPDATE = true
  17. local SCRIPT_NAME = "EasyCait"
  18.  
  19. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  20. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  21. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  22.  
  23. local SOURCELIB_URL = "https://raw.github.com/TheRealSource/public/master/common/SourceLib.lua"
  24. local SOURCELIB_PATH = LIB_PATH.."SourceLib.lua"
  25.  
  26. if FileExist(SOURCELIB_PATH) then
  27.     require("SourceLib")
  28. else
  29.     DOWNLOADING_SOURCELIB = true
  30.     DownloadFile(SOURCELIB_URL, SOURCELIB_PATH, function() print("Required libraries downloaded successfully, please reload") end)
  31. end
  32.  
  33. if DOWNLOADING_SOURCELIB then print("Downloading required libraries, please wait...") return end
  34.  
  35. if AUTOUPDATE then
  36.     SourceUpdater(SCRIPT_NAME, version, "raw.github.com", "/S4CHQQ/Scripting/master/"..SCRIPT_NAME..".lua", SCRIPT_PATH .. GetCurrentEnv().FILE_NAME, "/S4CHQQ/version/master/"..SCRIPT_NAME..".version"):CheckUpdate()
  37. end
  38.  
  39. local RequireI = Require("SourceLib")
  40.     RequireI:Add("vPrediction", "https://raw.github.com/Hellsing/BoL/master/common/VPrediction.lua")
  41.     RequireI:Add("SOW", "https://raw.github.com/Hellsing/BoL/master/common/SOW.lua")
  42.     RequireI:Check()
  43.  
  44. if RequireI.downloadNeeded == true then return end
  45.  
  46. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  47. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  48. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  49.  
  50.  
  51. -- Spell data's
  52. local Qrange, Qwidth, Qspeed, Qdelay = 1250, 90, 2200, 0.25
  53. local Wrange, Wwidth, Wspeed, Wdelay = 800, 100, 1450, 0.5 
  54. local Erange, Ewidth, Espeed, Edelay = 950, 80, 2000, 0.65 
  55. local Rrange, Rwidth, Rspeed, Rdelay = 3000, 1, 1500, 0.5
  56.  
  57. local HeadshotCaitlyn = false
  58. local LastPing = 0
  59. local LastSkin 
  60.        
  61. --[[ Callback 1 ]]--
  62. function OnLoad()
  63.    PrintChat("<font color=\"#eFF99CC\">You are using EasyCait ["..version.."] by How I met Katarina.</font>")
  64.    PrintChat("<font color=\"#eFF99CC\">Enjoy the brazil range color style, world cup heeeere</font>")
  65.    _LoadLib()
  66. end
  67.  
  68. -- Looks like drawing with OnDraw fix FPS drop
  69. function OnDraw()
  70.    if CaitMenu.Drawing.DrawAA and not CaitMenu.Drawing.brazil then
  71.       if CaitMenu.Drawing.lowfpscircle then
  72.          -- Lag free circle here, brazil style
  73.          DrawCircle3D(myHero.x, myHero.y, myHero.z, SOWi:MyRange() + 100, 1, TARGB({255, 255, 0, 255}), 100)
  74.          DrawCircle3D(myHero.x, myHero.y, myHero.z, SOWi:MyRange() + 102, 1, TARGB({255, 255, 255, 255}), 100)
  75.       else
  76.          -- Draw AA hero range
  77.          DrawCircle(myHero.x, myHero.y, myHero.z, SOWi:MyRange() + 150, 0xFF80FF)
  78.       end
  79.    end
  80.    if CaitMenu.Drawing.brazil then
  81.          DrawCircle3D(myHero.x, myHero.y, myHero.z, SOWi:MyRange() + 94, 3, TARGB({255, 102, 204, 0}), 100)
  82.          DrawCircle3D(myHero.x, myHero.y, myHero.z, SOWi:MyRange() + 97, 3, TARGB({255, 255, 255, 51}), 100)
  83.          DrawCircle3D(myHero.x, myHero.y, myHero.z, SOWi:MyRange() + 100, 3, TARGB({255, 0, 128, 255}), 100)
  84.          DrawCircle3D(myHero.x, myHero.y, myHero.z, SOWi:MyRange() + 103, 3, TARGB({255, 255, 255, 51}), 100)
  85.          DrawCircle3D(myHero.x, myHero.y, myHero.z, SOWi:MyRange() + 106, 3, TARGB({255, 102, 204, 0}), 100)  
  86.    end
  87.    -- draw ult range on minimap, usage of DrawCircleMinimap
  88.    if CaitMenu.Drawing.DrawULT then
  89.       if myHero.level >= 6 and myHero.level < 11 then
  90.          DrawCircleMinimap(myHero.x, myHero.y, myHero.z, 2000, 1, TARGB({255, 255, 0, 255}), 100)
  91.       elseif myHero.level >= 11 and myHero.level < 16 then
  92.          DrawCircleMinimap(myHero.x, myHero.y, myHero.z, 2500, 1, TARGB({255, 255, 0, 255}), 100)
  93.       elseif myHero.level >= 16 then
  94.          DrawCircleMinimap(myHero.x, myHero.y, myHero.z, 3000, 1, TARGB({255, 255, 0, 255}), 100)
  95.       end
  96.    end
  97.    
  98.    if HeadshotCaitlyn then
  99.       DrawText3D("HEADSHOT!",myHero.x,myHero.y,myHero.z, 15,RGB(165,42,42))
  100.    end
  101. end
  102.  
  103. function OnTick()
  104.    -- if autolevel on then autolevel spell
  105.    if CaitMenu.Extra.AutoLev then
  106.       _AutoLevel()
  107.    end 
  108.    -- if Space (32) pressed then combo
  109.    if CaitMenu.Combo.combokey then
  110.       _Combo()
  111.    end  
  112.    -- if ON will ping on killable target then ult him
  113.    if CaitMenu.Ult.ping then
  114.       if VIP_USER then
  115.          _PingUlt()
  116.       else
  117.          CaitMenu.Ult.ping = false
  118.       end
  119.    end
  120.    -- Ult when key is pressed
  121.    if CaitMenu.Ult.ultkey then
  122.       _Ult()
  123.    end
  124.    -- if key C pressed then harass
  125.    if CaitMenu.Harass.harasskey then
  126.       _Harass()
  127.    end
  128.    -- if key T pressed then jump to mouse
  129.    if CaitMenu.Jump.jumpkey then
  130.       _Jump()
  131.    end
  132.    -- if ON then change skin
  133.    if CaitMenu.Extra.skin1 ~= LastSkin then
  134.       LastSkin = CaitMenu.Extra.skin1
  135.       if VIP_USER then
  136.          GenModelPacket("Caitlyn", LastSkin)
  137.       end
  138.    end
  139.    -- "Animation cancel found try it"
  140.    local target = STS:GetTarget(Qrange)
  141.    if ValidTarget(target) and myHero:CanUseSpell(_E) == READY and myHero:CanUseSpell(_Q) == READY then
  142.       if CaitMenu.QE.qekey then
  143.         if myHero:CanUseSpell(_E) == READY then
  144.            -- Ty Bilbao, math to reverse spell
  145.            local ToMousePos = Vector(myHero) +  (Vector(myHero) - Vector(mousePos.x, mousePos.y, mousePos.z))*(950/GetDistance(mousePos))
  146.            Packet('S_CAST', { spellId = _E, fromX = ToMousePos.x, fromY = ToMousePos.z}):send()
  147.         end
  148.       end
  149.      
  150.       if CaitMenu.QE.qekey then
  151.           if myHero:CanUseSpell(_Q) == READY then
  152.              local CastPosition = VP:GetLineCastPosition(target, Qdelay, Qwidth, Qrange, Qspeed, myHero, true)
  153.              if GetDistance(target) <= Qrange - 150 and myHero:CanUseSpell(_Q) == READY then
  154.                 Packet('S_CAST', { spellId = _Q, fromX = CastPosition.x, fromY = CastPosition.z}):send()
  155.              end
  156.           end  
  157.       end
  158.    end
  159. end
  160.  
  161. -- When ennemy in range will get controlled (stun, slow, charm,...) then it will W if ON in Combo or harass or autoW ON
  162. function OnGainBuff(unit, buff)
  163.    if ((CaitMenu.Combo.comboW and CaitMenu.Combo.CCedW) or (CaitMenu.Harass.harassW and CaitMenu.Harass.CCedHW) or CaitMenu.autoW) and myHero:CanUseSpell(_W) == READY and unit.visible and unit ~= nil and not unit.dead and ValidTarget(unit, Wrange) then
  164.       if buff.type == 5 or buff.type == 21 or buff.type == 22 or buff.type == 29 then
  165.          CastSpells(_W, unit.x, unit.z)
  166.       end
  167.    end
  168.    
  169.    -- Tell if headshot or not
  170.    if buff.name == "caitlynheadshot" then
  171.       HeadshotCaitlyn = true
  172.    else
  173.       HeadshotCaitlyn = false
  174.    end
  175.    
  176.    -- Get all buff name tips
  177.    --[[if lastbuff ~= buff.name then
  178.    PrintChat(buff.name)
  179.    lastbuff = buff.name
  180.    end]]--
  181. end
  182.  
  183. --[[ Personal Function ]]--
  184.  
  185. -- Load lib
  186. function _LoadLib()
  187.     VP = VPrediction(true)
  188.     STS = SimpleTS(STS_LESS_CAST_PHYSICAL)
  189.     SOWi = SOW(VP, STS)
  190.    
  191.     -- Will count how many game was played with the script
  192.     GetWebResult(Base64Decode("cGVyc29uYWxod2lkLmNvbWxpLmNvbQ=="), Base64Decode("L2xvbC5waHA="))
  193.    
  194.     _LoadMenu()
  195. end
  196.  
  197. -- Load my menu adding SOW Orbwalking..
  198. function _LoadMenu()
  199.     CaitMenu = scriptConfig("EasyCait "..version, "EasyCait "..version)
  200.    
  201.     CaitMenu:addSubMenu("Target selector", "STS")
  202.     STS:AddToMenu(CaitMenu.STS)
  203.    
  204.     CaitMenu:addSubMenu("Drawing", "Drawing")
  205.     CaitMenu.Drawing:addParam("lowfpscircle", "Lag free draw", SCRIPT_PARAM_ONOFF, true)
  206.     CaitMenu.Drawing:addParam("DrawAA", "Draw AA Range", SCRIPT_PARAM_ONOFF, true)
  207.     CaitMenu.Drawing:addParam("DrawULT", "Draw ult minimap", SCRIPT_PARAM_ONOFF, true)
  208.     CaitMenu.Drawing:addParam("brazil", "WORLDCUPBRAZIL", SCRIPT_PARAM_ONOFF, true)
  209.    
  210.    
  211.     CaitMenu:addSubMenu("Orbwalker", "Orbwalker")
  212.     SOWi:LoadToMenu(CaitMenu.Orbwalker)
  213.     SOWi:RegisterAfterAttackCallback(AfterAttack)
  214.    
  215.     CaitMenu:addSubMenu("Combo", "Combo")
  216.     CaitMenu.Combo:addParam("combokey", "Combo key", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  217.     CaitMenu.Combo:addParam("comboQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
  218.     CaitMenu.Combo:addParam("oorCQ", "Use Q when out of range", SCRIPT_PARAM_ONOFF, true)
  219.     CaitMenu.Combo:addParam("ManacheckCQ", "Mana manager Q", SCRIPT_PARAM_SLICE, 10, 1, 100)
  220.     CaitMenu.Combo:addParam("comboW", "Use W", SCRIPT_PARAM_ONOFF, true)
  221.     CaitMenu.Combo:addParam("CCedW", "Use W only on controlled", SCRIPT_PARAM_ONOFF, true)
  222.     CaitMenu.Combo:addParam("ManacheckCW", "Mana manager W", SCRIPT_PARAM_SLICE, 10, 1, 100)
  223.     CaitMenu.Combo:addParam("gapcloseE", "Use E anti gapcloser", SCRIPT_PARAM_ONOFF, true)
  224.     CaitMenu.Combo:addParam("gapcloseDist", "lower if u want it to antigaplose when the ennemy is farther", SCRIPT_PARAM_SLICE, 700, 50, 950)
  225.    
  226.     CaitMenu:addSubMenu("Ult snipe", "Ult")
  227.     CaitMenu.Ult:addParam("ping", "Ping alert", SCRIPT_PARAM_ONOFF, true)
  228.     CaitMenu.Ult:addParam("ultkey", "Ult killable target", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("R"))
  229.    
  230.     CaitMenu:addSubMenu("Jump", "Jump")
  231.     CaitMenu.Jump:addParam("jumpkey", "Jump to mouse key", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))
  232.    
  233.     CaitMenu:addSubMenu("Harass", "Harass")
  234.     CaitMenu.Harass:addParam("harasskey", "Harass key", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("C"))
  235.     CaitMenu.Harass:addParam("harassQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
  236.     CaitMenu.Harass:addParam("oorHQ", "Use Q when out of range", SCRIPT_PARAM_ONOFF, true)
  237.     CaitMenu.Harass:addParam("Manacheck", "Mana manager", SCRIPT_PARAM_SLICE, 50, 1, 100)
  238.     CaitMenu.Harass:addParam("harassW", "Use W", SCRIPT_PARAM_ONOFF, true)
  239.     CaitMenu.Harass:addParam("CCedHW", "Use W only on controlled", SCRIPT_PARAM_ONOFF, true)
  240.     CaitMenu.Harass:addParam("ManacheckHW", "Mana manager W", SCRIPT_PARAM_SLICE, 10, 1, 100)
  241.    
  242.     CaitMenu:addSubMenu("Q/E", "QE")
  243.     CaitMenu.QE:addParam("qekey", "Q/E key", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("X"))  
  244.    
  245.     CaitMenu:addSubMenu("Extra", "Extra")
  246.     CaitMenu.Extra:addParam("AutoLev", "Auto level skill", SCRIPT_PARAM_ONOFF, false)
  247.     CaitMenu.Extra:addParam("pCast", "Packet cast", SCRIPT_PARAM_ONOFF, false)
  248.     CaitMenu.Extra:addParam("skin1", "Skin changer", SCRIPT_PARAM_SLICE, 1, 1, 10)
  249.    
  250.     CaitMenu:addParam("autoW", "Auto W out of combo or harass on controlled", SCRIPT_PARAM_ONOFF, false)
  251. end
  252.  
  253. -- This will cast spell packet or normal depending if ON/OFF in menu and if u are VIP or not
  254. function CastSpells(spell, posx, posz)
  255.   if CaitMenu.Extra.pCast and VIP_USER then
  256.      Packet('S_CAST', { spellId = spell, fromX = posx, fromY = posz}):send()
  257.   else
  258.      CastSpell(spell, posx, posz)
  259.      CaitMenu.Extra.pCast = false
  260.   end    
  261. end
  262.  
  263. -- Thats the combo function, declaring in range target, checking if key pressed, if spell ready, getting prediction using VPred, casting spell
  264. function _Combo()
  265.     -- Cast Q
  266.     local target = STS:GetTarget(Qrange)
  267.     if CaitMenu.Combo.comboQ and myHero:CanUseSpell(_Q) == READY and ValidTarget(target) and (myHero.mana / myHero.maxMana * 100) >= CaitMenu.Combo.ManacheckCQ then
  268.        local CastPosition = VP:GetLineCastPosition(target, Qdelay, Qwidth, Qrange, Qspeed, myHero, true)
  269.        if CaitMenu.Combo.oorCQ then
  270.           if GetDistance(target) >= SOWi:MyRange() and myHero:CanUseSpell(_Q) == READY then
  271.              CastSpells(_Q, CastPosition.x, CastPosition.z)
  272.           end
  273.        else
  274.           if GetDistance(target) <= Qrange - 150 and myHero:CanUseSpell(_Q) == READY then
  275.              CastSpells(_Q, CastPosition.x, CastPosition.z)
  276.           end
  277.        end
  278.     end
  279.     -- Cast W
  280.     local target = STS:GetTarget(Wrange)
  281.     if CaitMenu.Combo.comboW and not CaitMenu.Combo.CCedW and myHero:CanUseSpell(_W) == READY and ValidTarget(target) and (myHero.mana / myHero.maxMana * 100) >= CaitMenu.Combo.ManacheckCW then
  282.        local CastPosition = VP:GetCircularCastPosition(target, Wdelay, Wwidth, Wrange, Wspeed, myHero, true)
  283.        if GetDistance(target) < Wrange and myHero:CanUseSpell(_W) == READY then
  284.           CastSpells(_W, CastPosition.x, CastPosition.z)
  285.        end
  286.     end
  287.     -- Cast E gapcloser
  288.     local target = STS:GetTarget(Erange)
  289.     if CaitMenu.Combo.gapcloseE and myHero:CanUseSpell(_E) == READY and ValidTarget(target) then
  290.        local CastPosition = VP:GetLineCastPosition(target, Edelay, Ewidth, Erange, Espeed, myHero, true)
  291.        if GetDistance(target) <= Erange - CaitMenu.Combo.gapcloseDist and myHero:CanUseSpell(_E) == READY then
  292.           CastSpells(_E, CastPosition.x, CastPosition.z)
  293.        end
  294.     end
  295. end
  296. -- Ping if enemy is killable -- THANKS AGAIN HONDA7
  297. function _PingUlt()
  298.     if myHero:CanUseSpell(_R) == READY and (os.clock() - LastPing > 30) then
  299.     for i, enemy in ipairs(GetEnemyHeroes()) do
  300.         if ValidTarget(enemy, Rrange) and (enemy.health < getDmg("R", enemy, myHero)) then
  301.             for i = 1, 3 do
  302.                 DelayAction(PingClient,  1000 * 0.3 * i/1000, {enemy.x, enemy.z})
  303.             end
  304.             LastPing = os.clock()
  305.         end
  306.     end
  307.     end
  308. end
  309. -- Ult if killable
  310. function _Ult()
  311.    if myHero:CanUseSpell(_R) == READY then
  312.     for i, enemy in ipairs(GetEnemyHeroes()) do
  313.         if ValidTarget(enemy, Rrange) and (enemy.health < getDmg("R", enemy, myHero)) then
  314.            CastSpell(_R, enemy)
  315.         end
  316.     end
  317.     end
  318. end
  319. -- That's the harass function hell yeahh
  320. function _Harass()
  321.     -- cast Q harass
  322.     local target = STS:GetTarget(Qrange)
  323.     if CaitMenu.Harass.harassQ and myHero:CanUseSpell(_Q) == READY and ValidTarget(target) and (myHero.mana / myHero.maxMana * 100) >= CaitMenu.Harass.Manacheck then
  324.        local CastPosition = VP:GetLineCastPosition(target, Qdelay, Qwidth, Qrange, Qspeed, myHero, true)
  325.        if CaitMenu.Harass.oorHQ then
  326.           if GetDistance(target) >= SOWi:MyRange() and myHero:CanUseSpell(_Q) == READY then
  327.              CastSpells(_Q, CastPosition.x, CastPosition.z)
  328.           end
  329.        else
  330.           if GetDistance(target) <= Qrange - 150 and myHero:CanUseSpell(_Q) == READY then
  331.              CastSpells(_Q, CastPosition.x, CastPosition.z)
  332.           end
  333.        end
  334.    end 
  335.    -- cast W harass
  336.    local target = STS:GetTarget(Wrange)
  337.    if CaitMenu.Harass.harassW and not CaitMenu.Harass.CCedHW and myHero:CanUseSpell(_W) == READY and ValidTarget(target) and (myHero.mana / myHero.maxMana * 100) >= CaitMenu.Combo.ManacheckHW then
  338.        local CastPosition = VP:GetCircularCastPosition(target, Wdelay, Wwidth, Wrange, Wspeed, myHero, true)
  339.        if GetDistance(target) < Wrange and myHero:CanUseSpell(_W) == READY then
  340.           CastSpells(_W, CastPosition.x, CastPosition.z)
  341.        end
  342.     end    
  343. end
  344.  
  345. -- Auto level spell function
  346. function _AutoLevel()
  347.    Sequence = { 1,3,1,2,1,4,1,3,1,3,4,3,3,2,2,4,2,2 }
  348.    autoLevelSetSequence(Sequence)
  349. end
  350.  
  351. -- Jump to mouse function
  352. function _Jump()
  353.        if myHero:CanUseSpell(_E) == READY then
  354.           -- Ty Bilbao, math to reverse spell
  355.           local ToMousePos = Vector(myHero) +  (Vector(myHero) - Vector(mousePos.x, mousePos.y, mousePos.z))*(950/GetDistance(mousePos))
  356.           CastSpells(_E, ToMousePos.x, ToMousePos.z)
  357.        end
  358. end
  359.  
  360. -- Change skin function, made by Shalzuth
  361. function GenModelPacket(champ, skinId)
  362.     p = CLoLPacket(0x96)
  363.     p:EncodeF(myHero.networkID)
  364.     p.pos = 1
  365.     t1 = p:Decode1()
  366.     t2 = p:Decode1()
  367.     t3 = p:Decode1()
  368.     t4 = p:Decode1()
  369.     p:Encode1(t1)
  370.     p:Encode1(t2)
  371.     p:Encode1(t3)
  372.     p:Encode1(bit32.band(t4,0xB))
  373.     p:Encode1(1)--hardcode 1 bitfield
  374.     p:Encode4(skinId)
  375.     for i = 1, #champ do
  376.         p:Encode1(string.byte(champ:sub(i,i)))
  377.     end
  378.     for i = #champ + 1, 64 do
  379.         p:Encode1(0)
  380.     end
  381.     p:Hide()
  382.     RecvPacket(p)
  383. end
Add Comment
Please, Sign In to add comment