Advertisement
Guest User

Varus

a guest
Jul 26th, 2014
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 14.92 KB | None | 0 0
  1. if myHero.charName ~= "Varus" then return end
  2.  
  3.  
  4. local version = 0.2
  5. local AUTOUPDATE = true
  6.  
  7.  
  8. local SCRIPT_NAME = "Varus"
  9. local SOURCELIB_URL = "https://raw.github.com/TheRealSource/public/master/common/SourceLib.lua"
  10. local SOURCELIB_PATH = LIB_PATH.."SourceLib.lua"
  11. if FileExist(SOURCELIB_PATH) then
  12.     require("SourceLib")
  13. else
  14.     DOWNLOADING_SOURCELIB = true
  15.     DownloadFile(SOURCELIB_URL, SOURCELIB_PATH, function() print("Required libraries downloaded successfully, please reload") end)
  16. end
  17.  
  18. if DOWNLOADING_SOURCELIB then print("Downloading required libraries, please wait...") return end
  19.  
  20. if AUTOUPDATE then
  21.     SourceUpdater(SCRIPT_NAME, version, "raw.github.com", "/gmlyra/BolScripts/master/"..SCRIPT_NAME..".lua", SCRIPT_PATH .. GetCurrentEnv().FILE_NAME, "/gmlyra/BolScripts/VersionFiles/master/"..SCRIPT_NAME..".version"):CheckUpdate()
  22. end
  23.  
  24. local RequireI = Require("SourceLib")
  25. RequireI:Add("vPrediction", "https://raw.github.com/Hellsing/BoL/master/common/VPrediction.lua")
  26. RequireI:Add("SOW", "https://raw.github.com/Hellsing/BoL/master/common/SOW.lua")
  27. --RequireI:Add("mrLib", "https://raw.githubusercontent.com/gmlyra/BolScripts/master/common/mrLib.lua")
  28.  
  29. RequireI:Check()
  30.  
  31. if RequireI.downloadNeeded == true then return end
  32.  
  33.  
  34. require 'VPrediction'
  35. require 'SOW'
  36.  
  37. -- Constants --
  38. local QREADY, WREADY, EREADY, RREADY = false, false, false, false
  39. local ignite, igniteReady = nil, nil
  40. local ts = nil
  41. local VP = nil
  42. local qMode = false
  43. local qOff, wOff, eOff, rOff = 0,0,0,0
  44. local abilitySequence = {1, 3, 1, 2, 1, 4, 1, 3, 1, 3, 4, 3, 3, 2, 2, 4, 2, 2}
  45. local Ranges = { AA = 576 }
  46. local skills = {
  47.   skillQ = {spellName = "Piercing Arrow", range = 48, speed = 1500, delay = .250, width = 0},
  48.   skillW = {spellName = "Blighted Quiver", range = 798, speed = 1200, delay = .250, width = 50},
  49.   skillE = {spellName = "Hail of Arrows", range = 48, speed = 1750, delay = .250, width = 0},
  50.   skillR = {spellName = "Chain of Corruption", range = 48, speed = 1200, delay = .250, width = 450},
  51. }
  52. local AnimationCancel =
  53. {
  54.     [1]=function() myHero:MoveTo(mousePos.x,mousePos.z) end, --"Move"
  55.     [2]=function() SendChat('/l') end, --"Laugh"
  56.     [3]=function() SendChat('/d') end, --"Dance"
  57.     [4]=function() SendChat('/t') end, --"Taunt"
  58.     [5]=function() SendChat('/j') end, --"joke"
  59.     [6]=function() end,
  60. }
  61.  
  62. local QREADY, WREADY, EREADY, RREADY= false, false, false, false
  63. local BRKSlot, DFGSlot, HXGSlot, BWCSlot, TMTSlot, RAHSlot, RNDSlot, YGBSlot = nil, nil, nil, nil, nil, nil, nil, nil
  64. local BRKREADY, DFGREADY, HXGREADY, BWCREADY, TMTREADY, RAHREADY, RNDREADY, YGBREADY = false, false, false, false, false, false, false, false
  65.  
  66. --[[Auto Attacks]]--
  67. local lastBasicAttack = 0
  68. local swingDelay = 0.25
  69. local swing = false
  70.  
  71. function OnLoad()
  72.     initComponents()
  73. end
  74.  
  75. function initComponents()
  76.     -- VPrediction Start
  77.     VP = VPrediction()
  78.     -- SOW Declare
  79.     Orbwalker = SOW(VP)
  80.     -- Target Selector
  81.     ts = TargetSelector(TARGET_NEAR_MOUSE, 900)
  82.    
  83.     Menu = scriptConfig("Varus", "Varus")
  84.    
  85.     Menu:addSubMenu("["..myHero.charName.." - Orbwalker]", "SOWorb")
  86.     Orbwalker:LoadToMenu(Menu.SOWorb)
  87.    
  88.     Menu:addSubMenu("["..myHero.charName.." - Combo]", "VarusCombo")
  89.     Menu.VarusCombo:addParam("combo", "Combo mode", SCRIPT_PARAM_ONKEYDOWN, false, 32)
  90.     --Menu.VarusCombo:addSubMenu("Q Settings", "qSet")
  91.     --Menu.VarusCombo.qSet:addParam("useQ", "Use Q in combo", SCRIPT_PARAM_ONOFF, true)
  92.     Menu.VarusCombo:addSubMenu("E Settings", "eSet")
  93.     Menu.VarusCombo.eSet:addParam("useE", "Use E in combo", SCRIPT_PARAM_ONOFF, true)
  94.     Menu.VarusCombo:addSubMenu("R Settings", "rSet")
  95.     Menu.VarusCombo.rSet:addParam("useR", "Use R in combo", SCRIPT_PARAM_ONOFF, true)
  96.    
  97.     Menu:addSubMenu("["..myHero.charName.." - Harass]", "Harass")
  98.     Menu.Harass:addParam("harass", "Harass", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("G"))
  99.     Menu.Harass:addParam("useQ", "Use Q in Harass", SCRIPT_PARAM_ONOFF, true)
  100.     Menu.Harass:addParam("useE", "Use E in Harass", SCRIPT_PARAM_ONOFF, true)
  101.    
  102.     Menu:addSubMenu("["..myHero.charName.." - Laneclear]", "Laneclear")
  103.     Menu.Laneclear:addParam("lclr", "Laneclear Key", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("V"))
  104.     Menu.Laneclear:addParam("useClearQ", "Use Q in Laneclear", SCRIPT_PARAM_ONOFF, true)
  105.     Menu.Laneclear:addParam("useClearE", "Use E in Laneclear", SCRIPT_PARAM_ONOFF, true)
  106.    
  107.     Menu:addSubMenu("["..myHero.charName.." - Jungleclear]", "Jungleclear")
  108.     Menu.Jungleclear:addParam("jclr", "Jungleclear Key", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("V"))
  109.     Menu.Jungleclear:addParam("useClearQ", "Use Q in Jungleclear", SCRIPT_PARAM_ONOFF, true)
  110.     Menu.Jungleclear:addParam("useClearE", "Use E in Jungleclear", SCRIPT_PARAM_ONOFF, true)
  111.    
  112.     Menu:addSubMenu("["..myHero.charName.." - Additionals]", "Ads")
  113.     Menu.Ads:addParam("cancel", "Animation Cancel", SCRIPT_PARAM_LIST, 1, { "Move","Laugh","Dance","Taunt","joke","Nothing" })
  114.     AddProcessSpellCallback(function(unit, spell)
  115.         if unit.isMe then
  116.             print(spell.name)
  117.         end
  118.     end)
  119.     Menu.Ads:addParam("autoLevel", "Auto-Level Spells", SCRIPT_PARAM_ONOFF, false)
  120.     Menu.Ads:addSubMenu("Killsteal", "KS")
  121.     Menu.Ads.KS:addParam("useQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
  122.     Menu.Ads.KS:addParam("ignite", "Use Ignite", SCRIPT_PARAM_ONOFF, false)
  123.     Menu.Ads.KS:addParam("igniteRange", "Minimum range to cast Ignite", SCRIPT_PARAM_SLICE, 470, 0, 600, 0)
  124.     Menu.Ads:addSubMenu("VIP", "VIP")
  125.     Menu.Ads.VIP:addParam("spellCast", "Spell by Packet", SCRIPT_PARAM_ONOFF, true)
  126.     Menu.Ads.VIP:addParam("skin", "Use custom skin (Requires Reload)", SCRIPT_PARAM_ONOFF, false)
  127.     Menu.Ads.VIP:addParam("skin1", "Skin changer", SCRIPT_PARAM_SLICE, 1, 1, 2)
  128.    
  129.     Menu:addSubMenu("["..myHero.charName.." - Target Selector]", "targetSelector")
  130.     Menu.targetSelector:addTS(ts)
  131.     ts.name = "Focus"
  132.    
  133.     Menu:addSubMenu("["..myHero.charName.." - Drawings]", "drawings")
  134.     local DManager = DrawManager()
  135.     DManager:CreateCircle(myHero, Ranges.AA, 1, {255, 0, 255, 0}):AddToMenu(Menu.drawings,"AA range", true, true, true)
  136.     DManager:CreateCircle(myHero, skills.skillQ.range, 1, {255, 0, 255, 0}):AddToMenu(Menu.drawings,"Q range", true, true, true)
  137.     DManager:CreateCircle(myHero, skills.skillW.range, 1, {255, 0, 255, 0}):AddToMenu(Menu.drawings,"W range", true, true, true)
  138.     DManager:CreateCircle(myHero, skills.skillE.range, 1, {255, 0, 255, 0}):AddToMenu(Menu.drawings,"E range", true, true, true)
  139.     DManager:CreateCircle(myHero, skills.R.range, 1, {255, 0, 255, 0}):AddToMenu(Menu.drawings,"R range", true, true, true)
  140.  
  141.     enemyMinions = minionManager(MINION_ENEMY, 360, myHero, MINION_SORT_MAXHEALTH_DEC)
  142.     allyMinions = minionManager(MINION_ALLY, 360, myHero, MINION_SORT_MAXHEALTH_DEC)
  143.     jungleMinions = minionManager(MINION_JUNGLE, 360, myHero, MINION_SORT_MAXHEALTH_DEC)
  144.    
  145.     if Menu.Ads.VIP.skin and VIP_USER then
  146.         GenModelPacket("Varus", Menu.Ads.VIP.skin1)
  147.     end
  148.    
  149.     PrintChat("<font color = \"#33CCCC\">Varus</font> <font color = \"#fff8e7\">VonSidia</font>")
  150. end
  151.  
  152. function OnTick()
  153.     ts:update()
  154.     enemyMinions:update()
  155.     allyMinions:update()
  156.     jungleMinions:update()
  157.     CDHandler()
  158.     KillSteal()
  159.  
  160.     DFGSlot, HXGSlot, BWCSlot, SheenSlot, TrinitySlot, LichBaneSlot, BRKSlot, TMTSlot, RAHSlot, RNDSlot, STDSlot = GetInventorySlotItem(3128), GetInventorySlotItem(3146), GetInventorySlotItem(3144), GetInventorySlotItem(3057), GetInventorySlotItem(3078), GetInventorySlotItem(3100), GetInventorySlotItem(3153), GetInventorySlotItem(3077), GetInventorySlotItem(3074), GetInventorySlotItem(3143), GetInventorySlotItem(3131)
  161.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  162.     WREADY = (myHero:CanUseSpell(_W) == READY)
  163.     EREADY = (myHero:CanUseSpell(_E) == READY)
  164.     RREADY = (myHero:CanUseSpell(_R) == READY)
  165.     DFGREADY = (DFGSlot ~= nil and myHero:CanUseSpell(DFGSlot) == READY)
  166.     HXGREADY = (HXGSlot ~= nil and myHero:CanUseSpell(HXGSlot) == READY)
  167.     BWCREADY = (BWCSlot ~= nil and myHero:CanUseSpell(BWCSlot) == READY)
  168.     BRKREADY = (BRKSlot ~= nil and myHero:CanUseSpell(BRKSlot) == READY)
  169.     TMTREADY = (TMTSlot ~= nil and myHero:CanUseSpell(TMTSlot) == READY)
  170.     RAHREADY = (RAHSlot ~= nil and myHero:CanUseSpell(RAHSlot) == READY)
  171.     RNDREADY = (RNDSlot ~= nil and myHero:CanUseSpell(RNDSlot) == READY)
  172.     STDREADY = (STDSlot ~= nil and myHero:CanUseSpell(STDSlot) == READY)
  173.     IREADY = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  174.  
  175.     if swing and os.clock() > lastBasicAttack + 0.625 then
  176.         --swing = false
  177.     end
  178.  
  179.     if Menu.Ads.autoLevel then
  180.         AutoLevel()
  181.     end
  182.    
  183.     if Menu.VarusCombo.combo then
  184.         Combo()
  185.     end
  186.    
  187.     if Menu.Harass.harass then
  188.         Harass()
  189.     end
  190.    
  191.     if Menu.Laneclear.lclr then
  192.         LaneClear()
  193.     end
  194.    
  195.     if Menu.Jungleclear.jclr then
  196.         JungleClear()
  197.     end
  198.  
  199. end
  200.  
  201. function CDHandler()
  202.     -- Spells
  203.     QREADY = (myHero:CanUseSpell(_Q) == READY)
  204.     WREADY = (myHero:CanUseSpell(_W) == READY)
  205.     EREADY = (myHero:CanUseSpell(_E) == READY)
  206.     RREADY = (myHero:CanUseSpell(_R) == READY)
  207.     -- Items
  208.     tiamatSlot = GetInventorySlotItem(3077)
  209.     hydraSlot = GetInventorySlotItem(3074)
  210.     youmuuSlot = GetInventorySlotItem(3142)
  211.     bilgeSlot = GetInventorySlotItem(3144)
  212.     bladeSlot = GetInventorySlotItem(3153)
  213.    
  214.     tiamatReady = (tiamatSlot ~= nil and myHero:CanUseSpell(tiamatSlot) == READY)
  215.     hydraReady = (hydraSlot ~= nil and myHero:CanUseSpell(hydraSlot) == READY)
  216.     youmuuReady = (youmuuSlot ~= nil and myHero:CanUseSpell(youmuuSlot) == READY)
  217.     bilgeReady = (bilgeSlot ~= nil and myHero:CanUseSpell(bilgeSlot) == READY)
  218.     bladeReady = (bladeSlot ~= nil and myHero:CanUseSpell(bladeSlot) == READY)
  219.     -- Summoners
  220.     if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then
  221.         ignite = SUMMONER_1
  222.     elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then
  223.         ignite = SUMMONER_2
  224.     end
  225.     igniteReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  226. end
  227.  
  228. -- Harass --
  229.  
  230. function Harass()
  231.     local enemy = ts.target
  232.    
  233.     if enemy ~= nil and ValidTarget(enemy) then
  234.         if Menu.Harass.useE and ValidTarget(enemy, Ranges.E + Ranges.AA) and EREADY then
  235.             CastSpell(_E, enemy)
  236.         end
  237.         if QREADY and Menu.Harass.useQ and ValidTarget(enemy, Ranges.AA + 175) then
  238.             --CastSpell(_Q)
  239.         end
  240.     end
  241.    
  242. end
  243.  
  244. -- End Harass --
  245.  
  246.  
  247. -- Combo Selector --
  248.  
  249. function Combo()
  250.     local typeCombo = 0
  251.     if ts.target ~= nil then
  252.         AllInCombo(ts.target, 0)
  253.     end
  254.    
  255. end
  256.  
  257. -- Combo Selector --
  258.  
  259. -- All In Combo --
  260.  
  261. function AllInCombo(target, typeCombo)
  262.     if target ~= nil and typeCombo == 0 then
  263.         if RREADY and Menu.VarusCombo.rSet.useR and ValidTarget(target, Ranges.R) then
  264.             rDmg = getDmg("R", target, myHero)
  265.  
  266.             if RREADY and target ~= nil and ValidTarget(target, Ranges.R) and target.health < rDmg then
  267.                 local rPosition, rChance = VP:GetLineCastPosition(target, skills.skillR.delay, skills.skillR.width, skills.skillR.range, skills.skillR.speed, myHero, false)
  268.  
  269.                 if rPosition ~= nil and rChance >= 2 then
  270.                   CastSpell(_R, rPosition.x, rPosition.z)
  271.                 end
  272.             end
  273.         end
  274.         if Menu.VarusCombo.eSet.useE and ValidTarget(target, skills.skillE.range) and EREADY then
  275.             local ePosition, eChance = VP:GetLineCastPosition(target, skills.skillE.delay, skills.skillE.width, skills.skillE.range, skills.skillE.speed, myHero, false)
  276.  
  277.             if ePosition ~= nil and GetDistance(ePosition) < skills.skillE.range and eChance >= 2 then
  278.               CastSpell(_E, ePosition.x, ePosition.z)
  279.             end
  280.         end
  281.         if QREADY and Menu.VarusCombo.qSet.useQ and ValidTarget(target, skills.skillW.range) then
  282.             local QPosition, QChance = VP:GetLineCastPosition(target, skills.skillQ.delay, skills.skillQ.width, skills.skillQ.range, skills.skillQ.speed, myHero, true)
  283.  
  284.             if QPosition ~= nil and GetDistance(QPosition) < skills.skillQ.range and QChance >= 2 then
  285.               CastSpell(_Q, QPosition.x, QPosition.z)
  286.             end
  287.         end
  288.     end
  289. end
  290.  
  291. -- All In Combo --
  292.  
  293.  
  294. function LaneClear()
  295.     for i, enemyMinion in pairs(enemyMinions.objects) do
  296.        
  297.     end
  298. end
  299.  
  300. function JungleClear()
  301.     for i, jungleMinion in pairs(jungleMinions.objects) do
  302.         if jungleMinion ~= nil then
  303.            
  304.         end
  305.     end
  306. end
  307.  
  308. function AutoLevel()
  309.     local qL, wL, eL, rL = player:GetSpellData(_Q).level + qOff, player:GetSpellData(_W).level + wOff, player:GetSpellData(_E).level + eOff, player:GetSpellData(_R).level + rOff
  310.     if qL + wL + eL + rL < player.level then
  311.         local spellSlot = { SPELL_1, SPELL_2, SPELL_3, SPELL_4, }
  312.         local level = { 0, 0, 0, 0 }
  313.         for i = 1, player.level, 1 do
  314.             level[abilitySequence[i]] = level[abilitySequence[i]] + 1
  315.         end
  316.         for i, v in ipairs({ qL, wL, eL, rL }) do
  317.             if v < level[i] then LevelSpell(spellSlot[i]) end
  318.         end
  319.     end
  320. end
  321.  
  322. function KillSteal()
  323.     if Menu.Ads.KS.useQ then
  324.         KSQ()
  325.     end
  326.     if Menu.Ads.KS.ignite then
  327.         IgniteKS()
  328.     end
  329. end
  330.  
  331. -- Use Q --
  332.  
  333. function KSQ()
  334.     for i, enemy in ipairs(GetEnemyHeroes()) do
  335.         rDmg = getDmg("Q", enemy, myHero)
  336.  
  337.         if RREADY and enemy ~= nil and ValidTarget(enemy, Ranges.Q) and enemy.health < rDmg then
  338.             local rPosition, rChance = VP:GetLineCastPosition(enemy, skills.skillQ.delay, skills.skillQ.width, skills.skillQ.range, skills.skillQ.speed, myHero, false)
  339.  
  340.             if rPosition ~= nil and rChance >= 2 then
  341.               CastSpell(_Q, rPosition.x, rPosition.z)
  342.             end
  343.         end
  344.     end
  345. end
  346.  
  347. -- Use Q --
  348.  
  349. -- Auto Ignite get the maximum range to avoid over kill --
  350.  
  351. function IgniteKS()
  352.     if igniteReady then
  353.         local Enemies = GetEnemyHeroes()
  354.         for i, val in ipairs(Enemies) do
  355.             if ValidTarget(val, 600) then
  356.                 if getDmg("IGNITE", val, myHero) > val.health and GetDistance(val) >= Menu.Ads.KS.igniteRange then
  357.                     CastSpell(ignite, val)
  358.                 end
  359.             end
  360.         end
  361.     end
  362. end
  363.  
  364. -- Auto Ignite --
  365.  
  366. function HealthCheck(unit, HealthValue)
  367.     if unit.health > (unit.maxHealth * (HealthValue/100)) then
  368.         return true
  369.     else
  370.         return false
  371.     end
  372. end
  373.  
  374. function animationCancel(unit, spell)
  375.     if not unit.isMe then return end
  376.  
  377. end
  378.  
  379. function ItemUsage(target)
  380.  
  381.     if DFGREADY then CastSpell(DFGSlot, target) end
  382.     if HXGREADY then CastSpell(HXGSlot, target) end
  383.     if BWCREADY then CastSpell(BWCSlot, target) end
  384.     if BRKREADY then CastSpell(BRKSlot, target) end
  385.     if TMTREADY and GetDistance(target) < 275 then CastSpell(TMTSlot) end
  386.     if RAHREADY and GetDistance(target) < 275 then CastSpell(RAHSlot) end
  387.     if RNDREADY and GetDistance(target) < 275 then CastSpell(RNDSlot) end
  388.  
  389. end
  390.  
  391.  
  392. function spellByPacket(spell, target)
  393.     if not VIP_USER then return end
  394.  
  395.     local offset = spell.windUpTime - GetLatency / 2000
  396.  
  397.     DelayAction(function()
  398.         Packet('S_CAST', {spellId = spell, targetNetworkId = target.networkID, fromX = target.x, toX = target.x, fromY = target.z, toY = target.z})
  399.     end, offset)
  400.    
  401. end
  402.  
  403. -- Change skin function, made by Shalzuth
  404. function GenModelPacket(champ, skinId)
  405.     p = CLoLPacket(0x97)
  406.     p:EncodeF(myHero.networkID)
  407.     p.pos = 1
  408.     t1 = p:Decode1()
  409.     t2 = p:Decode1()
  410.     t3 = p:Decode1()
  411.     t4 = p:Decode1()
  412.     p:Encode1(t1)
  413.     p:Encode1(t2)
  414.     p:Encode1(t3)
  415.     p:Encode1(bit32.band(t4,0xB))
  416.     p:Encode1(1)--hardcode 1 bitfield
  417.     p:Encode4(skinId)
  418.     for i = 1, #champ do
  419.         p:Encode1(string.byte(champ:sub(i,i)))
  420.     end
  421.     for i = #champ + 1, 64 do
  422.         p:Encode1(0)
  423.     end
  424.     p:Hide()
  425.     RecvPacket(p)
  426. end
  427.  
  428. function OnDraw()
  429.    
  430. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement