Guest User

SOW Script

a guest
Nov 26th, 2014
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.02 KB | None | 0 0
  1. local version = 1.03
  2. local AUTOUPDATE = false
  3. local SCRIPT_NAME = "Orbwalker"
  4.  
  5. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  6. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  7. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  8.  
  9. local SOURCELIB_URL = "https://raw.github.com/TheRealSource/public/master/common/SourceLib.lua"
  10. local SOURCELIB_PATH = LIB_PATH.."SourceLib.lua"
  11.  
  12. if FileExist(SOURCELIB_PATH) then
  13.     require("SourceLib")
  14. else
  15.     DOWNLOADING_SOURCELIB = true
  16.     DownloadFile(SOURCELIB_URL, SOURCELIB_PATH, function() print("Required libraries downloaded successfully, please reload") end)
  17. end
  18.  
  19. if DOWNLOADING_SOURCELIB then print("Downloading required libraries, please wait...") return end
  20.  
  21. if AUTOUPDATE then
  22.      SourceUpdater(SCRIPT_NAME, version, "raw.github.com", "/honda7/BoL/master/"..SCRIPT_NAME..".lua", SCRIPT_PATH .. GetCurrentEnv().FILE_NAME, "/honda7/BoL/master/VersionFiles/"..SCRIPT_NAME..".version"):CheckUpdate()
  23. end
  24.  
  25. local RequireI = Require("SourceLib")
  26. RequireI:Add("vPrediction", "https://raw.github.com/honda7/BoL/master/Common/VPrediction.lua")
  27. RequireI:Add("SOW", "https://raw.github.com/honda7/BoL/master/Common/SOW.lua")
  28. RequireI:Check()
  29.  
  30. if RequireI.downloadNeeded == true then return end
  31.  
  32. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  33. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  34. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  35.  
  36. local _TOMOUSE, _TOTARGET, _EMPOWER = 100, 101, 201
  37.  
  38. local MySpells = {}
  39.  
  40. local Spells =
  41. {
  42.     ["MissFortune"] = {
  43.         [_Q] = {name = "Double Up", spellType = _TOTARGET, range = 650},
  44.         [_W] = {name = "Impure shots", spellType = _EMPOWER, range = -1}
  45.     },
  46.  
  47.     ["Sivir"] = {
  48.         [_Q] = {name = "Boomerang blade", skillshot = true, spellType = SKILLSHOT_LINEAR, range = 1175, width = 90, speed = 1350, delay = 0.25, collision = false},
  49.         [_W] = {name = "Ricochet", spellType = _EMPOWER, range = -1}
  50.     },
  51.  
  52.     ["Jax"] = {
  53.         [_Q] = {name = "Leap Strike", spellType = _TOTARGET, range = 700},
  54.         [_W] = {name = "Empower", spellType = _EMPOWER, range = -1},
  55.         [_E] = {name = "Counter Strike", spellType = _EMPOWER, range = -1},
  56.         [_R] = {name = "Grandmaster's Might", spellType = _EMPOWER, range = -1},
  57.     },
  58.  
  59.     ["Tristana"] = {
  60.         [_Q] = {name = "Rapid Fire", spellType = _EMPOWER, range = -1},
  61.         [_E] = {name = "Explosive Shot", spellType = _TOTARGET, range = -1},
  62.     },
  63.  
  64.     ["Teemo"] = {
  65.         [_Q] = {name = "Blinding dart", spellType = _TOTARGET, range = 680}
  66.     },
  67.  
  68.     ["Taric"] = {
  69.         [_E] = {name = "Dazzle", spellType = _TOTARGET, range = 625}
  70.     },
  71.  
  72.     ["Lucian"] = {
  73.         [_Q] = {name = "Piercing Light", spellType = _TOTARGET, range = 550},
  74.         [_W] = {name = "Mistic Shot", skillshot = true, spellType = SKILLSHOT_LINEAR, range = 1000, width = 55, speed = 1600, delay = 0.25, collision = false},
  75.     },
  76.  
  77.     ["Khazix"] = {
  78.         [_Q] = {name = "Taste Their Fear", spellType = _TOTARGET, range = -1},
  79.         [_W] = {name = "Void Spikes", skillshot = true, spellType = SKILLSHOT_LINEAR, range = 1025, width = 70, speed = 1700, delay = 0.25, collision = true},
  80.         [_E] = {name = "Leap", skillshot = true, spellType = SKILLSHOT_CIRCULAR, range = function() return myHero:GetSpellData(_E).range end, width = 100, speed = 1000, delay = 0.25, AOE = true},
  81.     },
  82.  
  83.     ["Vayne"] = {
  84.         [_Q] = {name = "Tumble", spellType = _TOMOUSE, range = -1}
  85.     },
  86.  
  87.     ["Zed"] = {
  88.         [_Q] = {name = "Razor Shuriken", skillshot = true, spellType = SKILLSHOT_CONE, range = 925, width = 50, speed = 1700, delay = 0.25, AOE = true, collision = false},
  89.         [_E] = {name = "Shadow Slash", spellType = SKILLSHOT_CIRCULAR, range = 290, width = 1, speed = math.huge, delay = 0.25, AOE = false, collision = false},
  90.     },
  91.  
  92.     ["Graves"] = {
  93.         [_Q] = {name = "Buckshot", skillshot = true, spellType = SKILLSHOT_CONE, range = 700, width = 15.32 * math.pi / 180, speed = 902, delay = 0.25, AOE = true, collision = false},
  94.         [_W] = {name = "Smoke screen", spellType = SKILLSHOT_CIRCULAR, range = 900, width = 250, speed = 1650, delay = 0.25, AOE = true, collision = false},
  95.         [_E] = {name = "Quckdraw", spellType = _TOMOUSE, range = -1},
  96.     },
  97.  
  98.     ["Ezreal"] = {
  99.         [_Q] = {name = "Mistic Shot", skillshot = true, spellType = SKILLSHOT_LINEAR, range = 1200, width = 60, speed = 2000, delay = 0.25, collision = true},
  100.         [_W] = {name = "Essence Flux", skillshot = true, spellType = SKILLSHOT_LINEAR, range = 1050, width = 80, speed = 1600, delay = 0.25, AOE = true},
  101.     },
  102.  
  103.     ["Ashe"] = {
  104.         [_W] = {name = "Volley", skillshot = true, spellType = SKILLSHOT_CONE, range = 1050, width = 57.5 * math.pi / 180, speed = 1600, delay = 0.25, AOE = true, collision = false},
  105.     },
  106. }
  107.  
  108. function OnLoad()
  109.     DelayAction(DelayedLoad, 1)
  110. end
  111.  
  112. function CastSpells(target, mode)
  113.     for id, spell in pairs(Spells[myHero.charName]) do
  114.         if Menu["Spells"..myHero.charName]["id"..id].Enabled and Menu["Spells"..myHero.charName]["id"..id]["Mode"..mode] and Menu["Spells"..myHero.charName]["id"..id][tostring(string.gsub(target.type, "_", ""))] then
  115.             local range = spell.range == -1 and SOWi:MyRange() or spell.range
  116.             if type(range) == "function" then
  117.                 range = range(target)
  118.             end
  119.             MySpells[id]:SetRange(range)
  120.  
  121.             if spell.spellType == _TOMOUSE and GetDistanceSqr(target) < MySpells[id].rangeSqr then
  122.                 CastSpell(id, mousePos.x, mousePos.z)
  123.             elseif spell.spellType == _TOTARGET and GetDistanceSqr(target) < MySpells[id].rangeSqr then
  124.                 CastSpell(id, target)
  125.             elseif spell.spellType == _EMPOWER and GetDistanceSqr(target) < MySpells[id].rangeSqr then
  126.                 CastSpell(id)
  127.             elseif GetDistanceSqr(target) < MySpells[id].rangeSqr then
  128.                 MySpells[id]:Cast(target)
  129.             end
  130.         end
  131.     end
  132. end
  133.  
  134. function AfterAttack(target, mode)
  135.     if target and target.type and Spells[myHero.charName] and ValidTarget(target) then
  136.         CastSpells(target, mode)
  137.     end
  138. end
  139.  
  140. function DelayedLoad()
  141.     if not _G.SOWLoaded then
  142.         DManager = DrawManager()
  143.         VP = VPrediction(true)
  144.         STS = SimpleTS(STS_LESS_CAST_PHYSICAL)
  145.         SOWi = SOW(VP, STS)
  146.  
  147.         --Load the spells:
  148.         if Spells[myHero.charName]  then
  149.             for id, spell in pairs(Spells[myHero.charName]) do
  150.                 local range = spell.range == -1 and SOWi:MyRange() or spell.range
  151.                 if type(range) == "function" then
  152.                     range = range(target)
  153.                 end
  154.                 MySpells[id] = Spell(id, range)
  155.  
  156.                 if spell.skillshot then
  157.                     MySpells[id]:SetSkillshot(VP, spell.spellType, spell.width, spell.delay, spell.speed, spell.collision)
  158.                 end
  159.  
  160.                 if spell.AOE then
  161.                     MySpells[id]:SetAOE(true)
  162.                 end
  163.             end
  164.         end
  165.         Menu = scriptConfig("Simple Orbwalker", "Simple Orbwalker")
  166.         Menu:addSubMenu("Target selector", "STS")
  167.         STS:AddToMenu(Menu.STS)
  168.        
  169.         if Spells[myHero.charName] then
  170.             Menu:addSubMenu("Spells", "Spells"..myHero.charName)
  171.             for id, spell in pairs(Spells[myHero.charName]) do
  172.                 Menu["Spells"..myHero.charName]:addSubMenu(SpellToString(id).." - "..spell.name, "id"..id)
  173.                 Menu["Spells"..myHero.charName]["id"..id]:addParam("Enabled", "Enabled", SCRIPT_PARAM_ONOFF, false)
  174.  
  175.                 Menu["Spells"..myHero.charName]["id"..id]:addParam("Mode3", "Enabled in Last Hit mode", SCRIPT_PARAM_ONOFF, true)
  176.                 Menu["Spells"..myHero.charName]["id"..id]:addParam("Mode2", "Enabled in Lane Clear mode", SCRIPT_PARAM_ONOFF, true)
  177.                 Menu["Spells"..myHero.charName]["id"..id]:addParam("Mode1", "Enabled in Mixed mode", SCRIPT_PARAM_ONOFF, true)
  178.                 Menu["Spells"..myHero.charName]["id"..id]:addParam("Mode0", "Enabled in CarryMe mode", SCRIPT_PARAM_ONOFF, true)
  179.  
  180.                 Menu["Spells"..myHero.charName]["id"..id]:addParam(tostring(string.gsub(myHero.type, "_", "")), "Use against champions", SCRIPT_PARAM_ONOFF, true)
  181.                 Menu["Spells"..myHero.charName]["id"..id]:addParam(tostring(string.gsub("obj_AI_Minion", "_", "")), "Use against minions", SCRIPT_PARAM_ONOFF, true)
  182.             end
  183.         end
  184.         Menu:addSubMenu("Drawing", "Drawing")
  185.  
  186.         AArangeCircle = DManager:CreateCircle(myHero, SOWi:MyRange()+50, 1, {255, 255, 255, 255})
  187.         AArangeCircle:AddToMenu(Menu.Drawing, "Auto Attack range", true, true, true)
  188.  
  189.         SOWi:LoadToMenu(Menu)
  190.         SOWi:RegisterAfterAttackCallback(AfterAttack)
  191.     end
  192. end
  193.  
  194. function OnTick()
  195.     if SOWi and AArangeCircle then
  196.         AArangeCircle.radius = SOWi:MyRange() + 50
  197.     end
  198.  
  199.     if SOWi and not SOWi:GetTarget() and Spells[myHero.charName] then
  200.         for id, spell in pairs(Spells[myHero.charName]) do
  201.             local range = spell.range == -1 and SOWi:MyRange() or spell.range
  202.             if type(range) == "function" then
  203.                 range = range(target)
  204.             end
  205.             local target = STS:GetTarget(range)
  206.             if target then
  207.                 CastSpells(target, SOWi.mode)
  208.             end
  209.         end
  210.     end
  211. end
Add Comment
Please, Sign In to add comment