Advertisement
Guest User

AutoSmite 2.3

a guest
Dec 1st, 2012
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 10.24 KB | None | 0 0
  1. --[[
  2.     AutoSmite 2.3
  3.  
  4.     Credits to Zynox for original AutoSmite v1.2
  5.     Mod by Manciuszz
  6.     Modified by Mariopart for BoL
  7. 1.0 : First release
  8. 1.1 : Update for new Animation Lib v0.3
  9. 1.2 : Added Nunu Q-Consume and ChoGath's R-Feast.
  10.     : Will now attempt to use Q + Smite for Nunu and Smite + R for ChoGath
  11.     : Will load the script on Nunu and ChoGath without Smite.
  12. 1.3 : Edited slightly and Modified for BoL Studio by eXtragoZ
  13. 1.9 : nginx "isBusy" system
  14. 2.0 (Husky) : Removed Bugsplatting by consequently using the isBusy system in all methods
  15.             : Smiteable targets will now be highlighted if you are in range
  16.             : Different colors for the highlighting when smite is on cooldown
  17.             : Added Nashor smite spot
  18. 2.1 : Added Range indicator of smite
  19.     : Added options on the menu Nashor spot, Draw Circles and Draw Text
  20.     : Now says the percentage of life remaining will be left after use smite , Q and R in case of Nunu or Chogath
  21.     : Added Vilemaw of Twisted Treeline
  22.     : Removed Blue Dragon and Lizard Elder of Twisted Treeline
  23.  
  24.     1) Hotkey for switching AutoSmite On/Off (by default: N). Remember that AutoSmite is OFF until you switch it.
  25.     2) Hold-Hotkey for using AutoSmite (by default: CTRL) if you want to use it in this way.
  26.     3) Hotkey for moving to a nashor smite spot, that enables you to smite nashor safely without moving into the pit or risking your life (by default: C)
  27.  
  28. ]]
  29. function file_exists(name)
  30.     local f=io.open(name,"r")
  31.     if f~=nil then io.close(f) return true else return false end
  32. end
  33. local LIB_PATH = debug.getinfo(1).source:sub(debug.getinfo(1).source:find(".*\\")):sub(2).."Common/"
  34. local AllClassFile = LIB_PATH.."AllClass.lua"
  35. if file_exists(AllClassFile) then require "AllClass" end
  36. --[[            Config          ]]
  37. local range = 800         -- Range of smite (~800)
  38. local scanInterval = 10   -- Interval for Smite part of the script. Recommended to set from 10 to 500. If it drops FPS hard for you then try to set it to 500. (default: 50 ms)
  39. --[[            Globals         ]]
  40. local isBusy = false
  41. local scanTick = 0
  42. local smiteSlot = nil
  43. local objminionTable = {}
  44. local smiteDamage, qDamage, mixDamage, rDamage, mixdDamage = 0, 0, 0, 0, 0
  45. local canuseQ = false
  46. local canuseR = false
  47. local canusesmite = false
  48. local turnoff = false --true/false
  49. local Smiteison = false
  50.  
  51. local Vilemaw = nil
  52. local Nashor = nil
  53. local Dragon = nil
  54. local Golem1 = nil
  55. local Golem2 = nil
  56. local Lizard1 = nil
  57. local Lizard2 = nil
  58.  
  59. --[[            Code            ]]
  60. function OnLoad()
  61.     if myHero:GetSpellData(SUMMONER_1).name:find("Smite") then smiteSlot = SUMMONER_1
  62.     elseif myHero:GetSpellData(SUMMONER_2).name:find("Smite") then smiteSlot = SUMMONER_2 end
  63.     if myHero.charName == "Nunu" or myHero.charName == "Chogath" or smiteSlot or not turnoff then
  64.         SmiteConfig = scriptConfig("AutoSmite 2.3", "autosmite")
  65.         SmiteConfig:addParam("switcher", "Switcher Hotkey", SCRIPT_PARAM_ONKEYTOGGLE, false, 78)
  66.         SmiteConfig:addParam("hold", "Hold Hotkey", SCRIPT_PARAM_ONKEYDOWN, false, 17)
  67.         SmiteConfig:addParam("active", "AutoSmite Active", SCRIPT_PARAM_INFO, false)
  68.         SmiteConfig:addParam("nashorspot", "Nashor spot", SCRIPT_PARAM_ONKEYDOWN, false, 67)
  69.         SmiteConfig:addParam("drawcircles", "Draw Circles", SCRIPT_PARAM_ONOFF, true)
  70.         SmiteConfig:addParam("drawtext", "Draw Text", SCRIPT_PARAM_ONOFF, true)
  71.         SmiteConfig:permaShow("active")
  72.        
  73.         ASLoadMinions()
  74.         Smiteison = true
  75.         PrintChat(" >> AutoSmite 2.3 loaded!")
  76.     end
  77. end
  78.  
  79. function OnTick()
  80.     if not Smiteison then return end
  81.     SmiteConfig.active = ((SmiteConfig.hold and not SmiteConfig.switcher) or (not SmiteConfig.hold and SmiteConfig.switcher))
  82.     smiteDamage = 420 + 25 * myHero.level
  83.     qDamage = 400 + 100 * myHero:GetSpellData(_Q).level
  84.     mixDamage = qDamage + smiteDamage
  85.     rDamage = 1000+.7*myHero.ap
  86.     mixdDamage = rDamage + smiteDamage
  87.     canuseQ = (myHero.charName == "Nunu" and myHero:CanUseSpell(_Q) == READY)
  88.     canuseR = (myHero.charName == "Chogath" and myHero:CanUseSpell(_R) == READY)
  89.     if smiteSlot ~= nil then canusesmite = (myHero:CanUseSpell(smiteSlot) == READY) end
  90.     if SmiteConfig.nashorspot then myHero:MoveTo(5381, 10283) end
  91.     if GetTickCount()-scanTick<scanInterval or not SmiteConfig.active or myHero.dead then return end
  92.     scanTick = GetTickCount()
  93.     if canusesmite or canuseQ or canuseR then
  94.         while isBusy do end
  95.         isBusy = true
  96.         if Vilemaw ~= nil then checkMonster(Vilemaw) end
  97.         if Nashor ~= nil then checkMonster(Nashor) end
  98.         if Dragon ~= nil then checkMonster(Dragon) end
  99.         if Golem1 ~= nil then checkMonster(Golem1) end
  100.         if Golem2 ~= nil then checkMonster(Golem2) end
  101.         if Lizard1 ~= nil then checkMonster(Lizard1) end
  102.         if Lizard2 ~= nil then checkMonster(Lizard2) end
  103.         isBusy = false
  104.     end
  105. end
  106. function checkMonster(object)
  107.     if object ~= nil and not object.dead and object.visible and object.bTargetable then
  108.         local DistanceMonster = GetDistance(object)
  109.         if canusesmite and DistanceMonster <= range and object.health <= smiteDamage then
  110.             CastSpell(smiteSlot, object)
  111.         elseif canuseQ and DistanceMonster <= 125+200 then
  112.             if canusesmite and object.health <= mixDamage then
  113.                 CastSpell(_Q, object)
  114.                 CastSpell(smiteSlot, object)
  115.             elseif object.health <= qDamage then
  116.                 CastSpell(_Q, object)
  117.             end
  118.         elseif canuseR and DistanceMonster <= 150+200 then--!
  119.             if canusesmite and object.health <= mixdDamage then
  120.                 CastSpell(_R, object)
  121.                 CastSpell(smiteSlot, object)
  122.             elseif object.health <= rDamage then
  123.                 CastSpell(_R, object)
  124.             end
  125.         end
  126.     end
  127. end
  128. function OnWndMsg(msg,key)
  129.     if not Smiteison then return end
  130.     SC__OnWndMsg(msg,key)
  131. end
  132. function OnDraw()
  133.     if not Smiteison then return end
  134.     SC__OnDraw()
  135.     if smiteSlot ~= nil and SmiteConfig.drawcircles and not myHero.dead then
  136.         DrawCircle(myHero.x, myHero.y, myHero.z, range, 0x992D3D)
  137.     end
  138.     if SmiteConfig.nashorspot and SmiteConfig.drawtext then
  139.         DrawText("Moving to nashor smite spot", 18, GetCursorPos().x-100, GetCursorPos().y-20, 0xFF00FF00)
  140.     end
  141.     if not myHero.dead and (SmiteConfig.drawtext or SmiteConfig.drawcircles) then
  142.         while isBusy do end
  143.         isBusy = true
  144.         if Vilemaw ~= nil then MonsterDraw(Vilemaw) end
  145.         if Nashor ~= nil then MonsterDraw(Nashor) end
  146.         if Dragon ~= nil then MonsterDraw(Dragon) end
  147.         if Golem1 ~= nil then MonsterDraw(Golem1) end
  148.         if Golem2 ~= nil then MonsterDraw(Golem2) end
  149.         if Lizard1 ~= nil then MonsterDraw(Lizard1) end
  150.         if Lizard2 ~= nil then MonsterDraw(Lizard2) end
  151.         isBusy = false
  152.     end
  153. end
  154. function MonsterDraw(object)
  155.     if object ~= nil and not object.dead and object.visible and object.bTargetable then
  156.         local DistanceMonster = GetDistance(object)
  157.         if smiteSlot ~= nil and SmiteConfig.drawcircles and DistanceMonster <= range then
  158.             local circleColor = (canusesmite and 0xFF0000 or 0x0000FF)
  159.             for j = 0, 10 do DrawCircle(object.x, object.y, object.z, 120 + j*3, circleColor) end
  160.             DrawCircle(object.x, object.y, object.z, 115, 0x00FF00)
  161.         end
  162.         if SmiteConfig.drawtext and DistanceMonster <= range*2 then
  163.             local statusdmgS = tostring(math.round((object.health-smiteDamage)*100/object.maxHealth, 2))
  164.             local statuscolorS = (canusesmite and 0xFF00FF00 or 0xFFFF0000)
  165.             DrawText(statusdmgS.."% - Smite", 18, GetCursorPos().x-40, GetCursorPos().y+38, statuscolorS)
  166.             if myHero.charName == "Nunu" and myHero:GetSpellData(_Q).level>0 then
  167.                 local statusdmgQ = tostring(math.round((object.health-qDamage)*100/object.maxHealth, 2))
  168.                 local statusdmgSQ = tostring(math.round((object.health-mixDamage)*100/object.maxHealth, 2))
  169.                 local statuscolorQ = (canuseQ and 0xFF00FF00 or 0xFFFF0000)
  170.                 local statuscolorSQ = ((canusesmite and canuseQ) and 0xFF00FF00 or 0xFFFF0000)
  171.                 DrawText(statusdmgQ.."% - Q", 18, GetCursorPos().x-40, GetCursorPos().y+56, statuscolorQ)
  172.                 DrawText(statusdmgSQ.."% - Smite+Q", 18, GetCursorPos().x-40, GetCursorPos().y+74, statuscolorSQ)
  173.             end
  174.             if myHero.charName == "Chogath" and myHero:GetSpellData(_R).level>0 then
  175.                 local statusdmgR = tostring(math.round((object.health-rDamage)*100/object.maxHealth, 2))
  176.                 local statusdmgSR = tostring(math.round((object.health-mixdDamage)*100/object.maxHealth, 2))
  177.                 local statuscolorR = (canuseR and 0xFF00FF00 or 0xFFFF0000)
  178.                 local statuscolorSR = ((canusesmite and canuseR) and 0xFF00FF00 or 0xFFFF0000)
  179.                 DrawText(statusdmgR.."% - R", 18, GetCursorPos().x-40, GetCursorPos().y+56, statuscolorR)
  180.                 DrawText(statusdmgSR.."% - Smite+R", 18, GetCursorPos().x-40, GetCursorPos().y+74, statuscolorSR)
  181.             end
  182.         end
  183.     end
  184. end
  185. function OnCreateObj(obj)
  186.     if not Smiteison then return end
  187.     while isBusy do end
  188.     isBusy = true
  189.     if obj ~= nil and obj.type == "obj_AI_Minion" and obj.name ~= nil then
  190.         if obj.name == "TT_Spiderboss7.1.1" then Vilemaw = obj
  191.         elseif obj.name == "Worm12.1.1" then Nashor = obj
  192.         elseif obj.name == "Dragon6.1.1" then Dragon = obj
  193.         elseif obj.name == "AncientGolem1.1.1" then Golem1 = obj
  194.         elseif obj.name == "AncientGolem7.1.1" then Golem2 = obj
  195.         elseif obj.name == "LizardElder4.1.1" then Lizard1 = obj
  196.         elseif obj.name == "LizardElder10.1.1" then Lizard2 = obj end
  197.     end
  198.     isBusy = false
  199. end
  200. function OnDeleteObj(obj)
  201.     if not Smiteison then return end
  202.     while isBusy do end
  203.     isBusy = true
  204.     if obj ~= nil and obj.type == "obj_AI_Minion" and obj.name ~= nil then
  205.         if obj.name == "TT_Spiderboss7.1.1" then Vilemaw = nil
  206.         elseif obj.name == "Worm12.1.1" then Nashor = nil
  207.         elseif obj.name == "Dragon6.1.1" then Dragon = nil
  208.         elseif obj.name == "AncientGolem1.1.1" then Golem1 = nil
  209.         elseif obj.name == "AncientGolem7.1.1" then Golem2 = nil
  210.         elseif obj.name == "LizardElder4.1.1" then Lizard1 = nil
  211.         elseif obj.name == "LizardElder10.1.1" then Lizard2 = nil end
  212.     end
  213.     isBusy = false
  214. end
  215. function ASLoadMinions()
  216.     while isBusy do end
  217.     isBusy = true
  218.     for i = 1, objManager.maxObjects do
  219.         local obj = objManager:getObject(i)
  220.         if obj ~= nil and obj.type == "obj_AI_Minion" and obj.name ~= nil then
  221.             if obj.name == "TT_Spiderboss7.1.1" then Vilemaw = obj
  222.             elseif obj.name == "Worm12.1.1" then Nashor = obj
  223.             elseif obj.name == "Dragon6.1.1" then Dragon = obj
  224.             elseif obj.name == "AncientGolem1.1.1" then Golem1 = obj
  225.             elseif obj.name == "AncientGolem7.1.1" then Golem2 = obj
  226.             elseif obj.name == "LizardElder4.1.1" then Lizard1 = obj
  227.             elseif obj.name == "LizardElder10.1.1" then Lizard2 = obj end
  228.         end
  229.     end
  230.     isBusy = false
  231. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement