Advertisement
samipote

[Script] Malbert's InSec Lee v.5.5

Aug 12th, 2014
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 85.07 KB | None | 0 0
  1. require "Utils"
  2. require "spell_damage"
  3. require 'winapi'
  4. require 'SKeys'
  5. require 'yprediction'
  6. local YP = YPrediction()
  7. local send = require 'SendInputScheduled'
  8.  
  9. local metakey = SKeys.Control
  10. print("\nMalbert's")
  11. print("\nPrivate LeeSin")
  12. print("\nVersion 5.5")
  13. local target
  14. local targeti
  15. local target2
  16. local _registry = {}
  17. local targetItems={3144,3153,3128,3092,3146}
  18. --Bilgewater,BoTRK,DFG,FrostQueen,Hextech
  19. local aoeItems={3184,3143,3180,3131,3069,3023,3290,3142}
  20. --Entropy,Randuins,Odyns,SwordDivine,TalismanAsc,TwinShadows,TwinShadows,YoGBlade
  21. local hydraItems={3074,3077}
  22. --Hydra,Tiamat
  23.  
  24. local egg = {team = 0, enemy = 0}
  25. local zac = {team = 0, enemy = 0}
  26. local aatrox = {team = 0, enemy = 0}
  27. local range = myHero.range + GetDistance(GetMinBBox(myHero))
  28. local wards = {3340, 3350, 3154, 3160, 3361, 3362, 2044, 2043, 2045, 2049}
  29. --[[
  30. 2043, Vision Ward
  31. 2044, Sight Ward
  32. 2045, Ruby Sightstone
  33. 2049, Sightstone
  34. 2050, Explorer's Ward (Removed)
  35. 3154, Wriggle's Lantern
  36. 3340, Warding Totem (60s/3 max) (lv 0)
  37. 3350, Greater Totem (120s/3 max) (lv 9)
  38. 3361, Greater Stealth Totem (180s/3 max) (lv 9+purchase)
  39. 3362, Graeter Vision Totem (--s/1 max) (lv 9+purchase)
  40. ]]--
  41. local eye={unit=nil,x=nil,y=nil,z=nil}
  42.        
  43.         local success=false
  44.         local wardsuccess=false
  45.         local wardx
  46.         local wardy
  47.         local wardz
  48.         local wardNear={}
  49.         local lastWardJump=0
  50.         local wardObject=nil
  51.         local lastWardObject=nil
  52.         local TI
  53.         local startCombo=false
  54.         local PMod=0
  55.         local PTimer=0
  56.         local startHarass=false
  57.         local wardhx,wardhy,wardhz
  58.         local something
  59.         local enemies={}
  60.         local enemyIndex=2
  61.         local wardFound=false
  62.         local TITimer=0
  63. local www=nil
  64. local wUsedAt = 0
  65. local vUsedAt = 0
  66. local timer=os.clock()
  67. local bluePill = nil
  68. local QRDY=0
  69. local WRDY=0
  70. local ERDY=0
  71. local RRDY=0
  72. local targetR=nil
  73. local qdelay=0
  74. local qspeed=0
  75. local tfa={x=0,y=0,z=0}
  76. local tfax,tfay,tfaz
  77.  
  78.         LeeConfig = scriptConfig("LeeSin", "LeeSin Hotkeys")
  79. LeeConfig:addParam("Combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("T"))--T
  80. LeeConfig:addParam("initiate", "InSec Ult Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("X"))
  81. LeeConfig:addParam("harass", "Harass Jump", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("C"))
  82. LeeConfig:addParam("ward", "Ward Jump", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("Z"))
  83. LeeConfig:addParam("smite", "Smitesteal", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("7"))
  84. LeeConfig:addParam("ultLow", "Ult When Low", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("8"))
  85. LeeConfig:addParam("ultKS", "Ult KS", SCRIPT_PARAM_ONKEYTOGGLE, true, string.byte("9"))
  86. LeeConfig:addParam("ultC", "Stylish Ult in Combo", SCRIPT_PARAM_ONKEYTOGGLE, false, string.byte("0"))
  87. LeeConfig:addParam("PU", "Prioritize InSec", SCRIPT_PARAM_NUMERICUPDOWN, 1,189,1,objManager:GetMaxHeroes()/2+2,1)-- "-" objManager:GetMaxHeroes()/2+1
  88. LeeConfig:addParam("iskey", "What to Insec To", SCRIPT_PARAM_DOMAINUPDOWN, 1, 187, {"Inventory Wards","Minions & Placed Wards","Both"})
  89.  
  90. LeeConfig:addParam('distanceR', "RA Distance", SCRIPT_PARAM_NUMERICUPDOWN, 550, 219,100,700,50)
  91. LeeConfig:addParam('distanceNR', "NRA Distance", SCRIPT_PARAM_NUMERICUPDOWN, 400, 221,100,700,50)
  92. LeeConfig:addParam('distanceNM', "NM Distance", SCRIPT_PARAM_NUMERICUPDOWN, 450, 191,100,700,50)
  93. LeeConfig:addParam('qd', "Q Delay", SCRIPT_PARAM_NUMERICUPDOWN, 2, 190,2,6,0.1)
  94. LeeConfig:addParam('qs', "Q Speed", SCRIPT_PARAM_NUMERICUPDOWN, 16, 191,14,17,0.1)
  95. LeeConfig:addParam("wardH", "Harass Can Use Ward", SCRIPT_PARAM_ONOFF, false)
  96. LeeConfig:addParam("wardF", "Ward Farthest", SCRIPT_PARAM_ONOFF, true)
  97. LeeConfig:addParam("mqi", "Manual Q Insec", SCRIPT_PARAM_ONOFF, true)
  98. LeeConfig:addParam("ignite", "Ignite KS", SCRIPT_PARAM_ONOFF, true)
  99. LeeConfig:addParam("insec2group", "Insec To Friendlies", SCRIPT_PARAM_ONOFF, true)
  100. LeeConfig:addParam("noPassive", "Dont Use Passive in Combo", SCRIPT_PARAM_ONOFF, false)
  101. LeeConfig:addParam('cw', "Circle Width", SCRIPT_PARAM_NUMERICUPDOWN, 5, 40,0,10,1)
  102. LeeConfig:addParam("circles", "Circles", SCRIPT_PARAM_ONOFF, true)
  103. LeeConfig:addParam("pots", "Auto Potions", SCRIPT_PARAM_ONOFF, true)
  104. LeeConfig:permaShow("smite")
  105. LeeConfig:permaShow("ultLow")
  106. LeeConfig:permaShow("ultKS")
  107. LeeConfig:permaShow("ultC")
  108. LeeConfig:permaShow("ignite")
  109.        
  110. function LeeRun()
  111.  
  112.         ------------
  113.         if myHero.SpellTimeQ > 1.0 and GetSpellLevel('Q') > 0 then
  114.                 QRDY = 1
  115.                 else QRDY = 0
  116.         end
  117.         if myHero.SpellTimeW > 1.0 and GetSpellLevel('W') > 0 then
  118.                 WRDY = 1
  119.                 else WRDY = 0
  120.         end
  121.         if myHero.SpellTimeE > 1.0 and GetSpellLevel('E') > 0 then
  122.                 ERDY = 1
  123.                 else ERDY = 0
  124.         end
  125.         if myHero.SpellTimeR > 1.0 and GetSpellLevel('R') > 0 then
  126.                 RRDY = 1
  127.         else
  128.                         RRDY = 0                      
  129.                                 TI=nil
  130.                                 startCombo=false
  131.                                 wardFound=false
  132.                                 success=false
  133.                         end
  134.         --------------------------
  135.  
  136.         qdelay=LeeConfig.qd
  137.         qspeed=LeeConfig.qs
  138.  
  139.         target = GetBestEnemy("PHYS", 1100, "NEARMOUSE")
  140.     target2 = GetBestEnemy('TRUE',600)
  141.         targetR = GetBestEnemy('PHYS',400)
  142.        
  143.         for i=1, objManager:GetMaxHeroes(), 1 do
  144.                 hero = objManager:GetHero(i)
  145.                 if hero~=nil and hero.team~=myHero.team and hero.name~="" then
  146.                         if enemies[hero.name]==nil then
  147.                                 enemies[hero.name]={unit=hero,number=enemyIndex}
  148.                                 enemyIndex=enemyIndex+1
  149.                         end
  150.                 end
  151.         end
  152.                
  153.         targeti =nil--GetWeakEnemy("PHYS", 975)
  154.         if RRDY==1 then
  155.                 findtargeti()
  156.     end
  157.  
  158.         www=nil
  159.                 for _, ward in pairs(wards) do
  160.                         if ward~=nil and GetWardSlot(ward) ~= nil and os.clock() > lastWardJump  then
  161.                                
  162.                                 www=GetWardSlot(ward)
  163.                                 --print("\nHere1 "..tostring(ward))
  164.                                 break
  165.                                
  166.                         end
  167.                 end
  168.                
  169.         if LeeConfig.ultKS and targetR~=nil then
  170.                 local rdmg= getDmg('R',targetR,myHero)*RRDY
  171.                 local edmg = getDmg("E",targetR,myHero)*ERDY
  172.                 if targetR.health<rdmg and ((targetR.health>getDmg("AD",targetR,myHero)+edmg or GetD(targetR)>200 or myHero.health<myHero.maxHealth*0.20)) then
  173.                         CastSpellTarget('R',targetR)
  174.                 end
  175.         end
  176.         if target~=nil and QRDY==1 then
  177.                 tfax,tfay,tfaz=GetFireahead(target,qdelay,qspeed)
  178.                 tfa={x=tfax,y=tfay,z=tfaz}
  179.         end
  180.     if IsChatOpen()==0 and LeeConfig.Combo then Combo() end    
  181.     if IsChatOpen()==0 and LeeConfig.harass then Harass() end    
  182.     if IsChatOpen()==0 and LeeConfig.initiate then initiate() end  
  183.     if IsChatOpen()==0 and myHero.dead~=1 and LeeConfig.ward and LeeConfig.wardF then ward(mousePos.x,mousePos.y,mousePos.z)
  184.     elseif IsChatOpen()==0 and myHero.dead~=1 and LeeConfig.ward and LeeConfig.wardF==false then ward() end  
  185.         if LeeConfig.mqi and RRDY==1 then
  186.                 if (TI==nil or TI.dead==1 or TITimer<os.clock()) and eye~=nil and eye.x~=nil and myHero.SpellNameQ == "blindmonkqtwo" and targeti~=nil then
  187.                         local TIHolder=nil
  188.                         for i = 1, objManager:GetMaxHeroes()  do
  189.             local enemy = objManager:GetHero(i)
  190.                         local invul=IsInvulnerable(enemy).status
  191.                                 if enemy~=nil and enemy.team~=myHero.team and enemy.dead==0 and enemy.visible==1 and invul~=1 and (TIHolder==nil or TIHolder.dead==1 or TIHolder.visible==0 or IsInvulnerable(TIHolder).status==1) and eye~=nil and GetD(enemy)<2000 then
  192.                                         TIHolder=enemy
  193.                                 elseif enemy~=nil and enemy.team~=myHero.team and enemy.dead==0 and enemy.visible==1 and invul~=1 and TIHolder~=nil and TIHolder.dead==0 and TIHolder.visible==1 and eye~=nil and GetD(enemy,eye)<GetD(TIHolder,eye) then
  194.                                         TIHolder=enemy                        
  195.                                 end
  196.                         end
  197.                         if TIHolder~=nil then
  198.                                 TI=TIHolder
  199.                                 startCombo=false
  200.                                 wardFound=false
  201.                                 success=false
  202.                                 TITimer=os.clock()+5
  203.                         end
  204.                 end
  205.         end  
  206.     if LeeConfig.smite then Smite() end
  207.         if LeeConfig.ignite then ignite() end
  208.         if LeeConfig.ultLow then ultSave() end
  209.         if LeeConfig.pots then RedElixir() end
  210. end
  211.  
  212. function findtargeti()
  213.         if LeeConfig.PU==1 then
  214.                 for j=1, objManager:GetMaxHeroes(), 1 do
  215.                         local herotarget = objManager:GetHero(j)
  216.                         local invul=IsInvulnerable(herotarget).status
  217.                         if herotarget~=nil and herotarget.team~=myHero.team and herotarget.dead~=1 and herotarget.visible==1 and invul~=1 and (targeti==nil or targeti.dead==1) and GetD(herotarget)<1500 then
  218.                                 targeti=herotarget
  219.                         elseif herotarget~=nil and herotarget.team~=myHero.team and herotarget.dead~=1 and herotarget.visible==1 and invul~=1 and GetD(herotarget)<1500 and herotarget.addDamage+herotarget.baseDamage>targeti.addDamage+targeti.baseDamage then
  220.                                 targeti=herotarget
  221.                         end
  222.                 end
  223.         elseif LeeConfig.PU==2 then
  224.                 targeti=GetBestEnemy("PHYS", 1100, "NEARMOUSE")
  225.         elseif LeeConfig.PU>2 then
  226.                
  227.                 for i, enemy in pairs(enemies) do
  228.                         local invul=IsInvulnerable(enemy.unit).status
  229.                         if enemy~=nil and enemy.unit~=nil and enemy.unit.dead~=1 and invul~=1 and enemy.unit.visible==1 and enemy.unit.x~=nil and enemy.number==LeeConfig.PU and myHero.dead~=1 and GetD(enemy.unit)<1500 then
  230.                                 targeti=enemy.unit
  231.                         end
  232.                 end
  233.         end
  234. end
  235.  
  236. function ignite()
  237.         local damage = (myHero.selflevel*20)+50
  238.         if target2 ~= nil then
  239.                 if myHero.SummonerD == "SummonerDot" then
  240.                         if target2.health < damage then
  241.                                 CastSpellTarget("D",target2)
  242.                         end
  243.                 end
  244.                 if myHero.SummonerF == "SummonerDot" then
  245.                         if target2.health < damage then
  246.                                 CastSpellTarget("F",target2)
  247.                         end
  248.                 end
  249.         end
  250. end
  251.  
  252. function Combo()
  253.     if target ~= nil then
  254.                
  255.         if myHero.SpellNameQ == "BlindMonkQOne" and QRDY==1 and (PMod>2 or PTimer<os.clock() or LeeConfig.noPassive) then
  256.                         Qprediction(target)
  257.                 elseif myHero.SpellNameQ == "blindmonkqtwo" and RRDY==1 and LeeConfig.ultC and GetD(target)<400 and eye~=nil and eye.unit~=nil and eye.unit.x~=nil and GetD(eye.unit,target)<100 then
  258.                         CastSpellTarget("R",target) --printtext("\nR")
  259.                 elseif myHero.SpellNameQ == "blindmonkqtwo" and QRDY==1 and (PMod>2 or PTimer<os.clock()  or LeeConfig.noPassive or GetD(target) > 320 or (LeeConfig.ultC and GetD(target)>370)) and eye~=nil and eye.unit~=nil and eye.unit.x~=nil and GetD(eye.unit,target)<50 then
  260.                         CastSpellTarget("Q",target)  
  261.                 end
  262.         if ERDY==1 and myHero.SpellNameE == "BlindMonkEOne" and GetD(target) < 350 and (PMod>2 or PTimer<os.clock()  or LeeConfig.noPassive or GetD(target) > 340-35) then
  263.                         CastSpellXYZ('E',myHero.x,myHero.y,myHero.z) --printtext("\nE")
  264.                 elseif ERDY==1 and myHero.SpellNameE == "blindmonketwo" and (PMod>2 or PTimer<os.clock()  or LeeConfig.noPassive or GetD(target) > 320 ) then
  265.                         CastSpellXYZ('E',myHero.x,myHero.y,myHero.z) --printtext("\nE")
  266.                 elseif myHero.SpellNameW == "BlindMonkWOne" and WRDY==1 and GetD(target) < 350 and (PMod>2 or PTimer<os.clock()  or LeeConfig.noPassive) then
  267.                         run_every(0.2,WSpell,myHero)  
  268.                 end
  269.                 if myHero.SpellNameW == "blindmonkwtwo" and WRDY==1 and GetD(target) < 350 and (PMod>2  or PTimer<os.clock()  or LeeConfig.noPassive) then
  270.                         run_every(0.2,WSpell,myHero)  
  271.                 end
  272.                 if RRDY==1 then
  273.                         local rdmg = getDmg("R",target,myHero)*RRDY
  274.                         local edmg = getDmg("E",target,myHero)*ERDY
  275.                         if GetD(target)<400 and target.health<rdmg and (target.health>getDmg("AD",target,myHero)+edmg or myHero.health<myHero.maxHealth*0.20) and LeeConfig.ultKS then
  276.                                 CastSpellTarget('R',target)
  277.                         end
  278.                 end
  279.                 if  GetD(target)<400 then
  280.                         for _, item in pairs(hydraItems) do
  281.                                         if GetInventorySlot(item)~=nil and myHero["SpellTime"..GetInventorySlot(item)]>1.0 then
  282.                                                         CastSpellTarget(tostring(GetInventorySlot(item)),target)
  283.                                         end
  284.                         end
  285.                         for _, item in pairs(aoeItems) do
  286.                                         if GetInventorySlot(item)~=nil and myHero["SpellTime"..GetInventorySlot(item)]>1.0 then
  287.                                                         CastSpellTarget(tostring(GetInventorySlot(item)),target)
  288.                                         end
  289.                         end
  290.                         for _, item in pairs(targetItems) do
  291.                                         if GetInventorySlot(item)~=nil and myHero["SpellTime"..GetInventorySlot(item)]>1.0 then
  292.                                                         CastSpellTarget(tostring(GetInventorySlot(item)),target)
  293.                                         end
  294.                         end
  295.                 elseif GetD(target)<600 then
  296.                         for _, item in pairs(targetItems) do
  297.                                         if GetInventorySlot(item)~=nil and myHero["SpellTime"..GetInventorySlot(item)]>1.0 then
  298.                                                         CastSpellTarget(tostring(GetInventorySlot(item)),target)
  299.                                         end
  300.                         end
  301.                 end
  302.         if IsAttackReady() and GetDistance(target)<250 then
  303.                         AttackTarget(target)
  304.                 else
  305.                         local xx,yy,zz=GetFireahead(target,2,0)
  306.                         MoveToMouse()
  307.                 end
  308.                
  309.         else
  310.                 MoveToMouse()
  311.     end
  312. end
  313. function Qspell(target)
  314. if target~=nil then
  315. local Qrange,Qwidth,Qspeed,Qdelay = 1000.0000,60,1800.0000,.5
  316. local CastPosition,HitChance,Position = YP:GetLineCastPosition(target, Qdelay, Qwidth, Qrange, Qspeed, myHero, true)
  317. if HitChance==2 and GetDistance(myHero,CastPosition)<1000 then
  318. local x,y,z =  CastPosition.x,CastPosition.y,CastPosition.z          
  319. CastSpellXYZ('Q',x,0,z)
  320. end
  321. end
  322. end
  323. function Qprediction(target)
  324. if target~=nil then
  325. local range,width,speed2,delay = 1000.0000,60,1800.0000,.5*100
  326. local ms = target.movespeed
  327. local speed=18
  328. local from = myHero
  329. local CastPosition= YP:GetPredictedPos(target, delay, speed2, myHero, true)
  330. local CastPosition2 = CastPosition.x,CastPosition.y,CastPosition.z
  331. local Position = YP:GetPredictedPos(myHero, delay, speed2, target, false)
  332. local Position2 = Position.x,Position.y,Position.z
  333. local delay = delay*100
  334. local velocity = (Position2 + (((speed * speed + speed) * ms) / 2) - CastPosition2) * -1 / ms
  335. local FX,FY,FZ = target.x+velocity+delay*speed*10/(delay-100),0,target.z+velocity+delay*speed*10/(delay-100)
  336. if target~= nil and GetDistance(myHero,target) < 1000 and CreepBlock(FX,FY,FZ) == 0 then
  337. CastSpellXYZ("Q",FX,FY,FZ)
  338. end
  339. end
  340. end
  341. function WSpell(tt)
  342. CastSpellTarget('W',tt)
  343. end
  344. function ultSave()
  345.         if RRDY==1 and myHero.health<myHero.maxHealth*0.20 then
  346.                 local kicktarget=nil
  347.                 for j=1, objManager:GetMaxHeroes(), 1 do
  348.                         local herotarget = objManager:GetHero(j)
  349.                         local invul=IsInvulnerable(herotarget).status
  350.                         if herotarget~=nil and herotarget.team~=myHero.team and invul~=1 and invul~=2 and GetD(herotarget)<400 and (kicktarget==nil or kicktarget.dead==1) then
  351.                                 kicktarget=herotarget
  352.                         elseif herotarget~=nil and herotarget.team~=myHero.team and invul~=1 and invul~=2 and GetD(herotarget)<400 and GetD(herotarget)<GetD(kicktarget) then
  353.                                 kicktarget=herotarget
  354.                         end
  355.                 end
  356.                 if kicktarget~=nil then
  357.                         CastSpellTarget('R',kicktarget)
  358.                 end
  359.         end
  360. end
  361.  
  362. function ward(hx,hy,hz)
  363.         if hx~=nil and hy~=nil and hz~=nil then
  364.                
  365.                                 --print("\nHere38 "..tostring(WRDY).." "..myHero.SpellNameW.. " "..lastWardJump.." "..os.clock())
  366.                 if WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and os.clock() > lastWardJump then
  367.                        
  368.                                 --print("\nHere39")
  369.                         wardsuccess=false
  370.                         --wx,wy,wz=GetFireahead(myHero,5,0)
  371.                        
  372.                         if www~=nil and os.clock() > lastWardJump then
  373.                                 --print("\nHere40")
  374.                                 local wx,wy,wz=getWardSpot(hx,hy,hz)
  375.                                 CastSpellXYZ(www,wx,wy,wz,0)
  376.                                 lastWardJump=os.clock()+3
  377.                                 wardsuccess=true
  378.                         end    
  379.                 end
  380.                
  381.                 if WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and wardsuccess==true and lastWardObject~=nil and GetD(lastWardObject)<700 then
  382.                         run_every(0.2,WSpell, lastWardObject)
  383.                
  384.                 end
  385.  
  386.                 if ( WRDY==0 or myHero.SpellNameW=="blindmonkwtwo" or not gotAWard()) then
  387.                         MoveToMouse()
  388.                 end
  389.         else
  390.                                 --print("\nHere41")
  391.                 if WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and os.clock() > lastWardJump then
  392.                        
  393.                                 --print("\nHere42")
  394.                         wardsuccess=false
  395.                         --wx,wy,wz=GetFireahead(myHero,5,0)
  396.                         if www~=nil and os.clock() > lastWardJump then
  397.                                 --print("\nHere43")
  398.                                 CastSpellXYZ(www, mousePos.x,mousePos.y,mousePos.z,0)
  399.                                 lastWardJump=os.clock()+3
  400.                                 wardsuccess=true
  401.                         end    
  402.                        
  403.                 end
  404.                
  405.                 if WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and wardsuccess==true and lastWardObject~=nil and GetD(lastWardObject)<700 then
  406.                         run_every(0.2,WSpell, lastWardObject)
  407.                
  408.                 end
  409.                 if ( WRDY==0 or myHero.SpellNameW=="blindmonkwtwo" or not gotAWard()) then
  410.                         MoveToMouse()
  411.                 end
  412.         end
  413. end
  414.  
  415. function Harass()
  416.         if target~=nil and WRDY==1 then
  417.                 if myHero.SpellNameQ == "BlindMonkQOne" and QRDY==1 and (somethingNear(target)~=nil or gotAWard()) and (GetD(tfa)>100 or runningAway(target)) then
  418.                         startHarass=false
  419.                         Qprediction(target)
  420.                 elseif myHero.SpellNameQ == "BlindMonkQOne" and QRDY==1 and (somethingNear(target)~=nil or gotAWard()) and GetD(tfa)<=100 then
  421.                         startHarass=false
  422.                         CastSpellXYZ('Q',target.x,target.y,target.z)
  423.                 end
  424.                 if myHero.SpellNameQ == "blindmonkqtwo" and QRDY==1 and WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and eye~=nil and eye.unit~=nil and eye.unit.x~=nil then
  425.                         if GetD(eye.unit,target)<50 and somethingNear(target)~=nil then
  426.                                 something=somethingNear(target)
  427.                                 startHarass=true
  428.                                 --
  429.                                 CastSpellTarget('Q',myHero)
  430.                         elseif GetD(eye.unit,target)<50 and LeeConfig.wardH and gotAWard() then
  431.                                 wardhx,wardhy,wardhz=getWardHarassSpot()
  432.                                 startHarass=true
  433.                                 --CastSpellTarget('E',myHero)
  434.                                 CastSpellTarget('Q',myHero)
  435.                         end
  436.                 end
  437.                 if startHarass==true and  QRDY==0 and WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and something~=nil and something.dead~=1 then
  438.                         if ERDY==1 then CastSpellTarget('E',myHero) end
  439.                         run_every(0.2,WSpell, something)
  440.                 elseif startHarass==true and  QRDY==0 and WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and (LeeConfig.wardH and gotAWard()) then
  441.                         ward(wardhx,wardhy,wardhz)
  442.                         if ERDY==1 then CastSpellTarget('E',myHero) end
  443.                         if WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and wardsuccess==true and lastWardObject~=nil and GetD(lastWardObject)<700 then
  444.                                 run_every(0.2,WSpell, lastWardObject)
  445.                         end
  446.                 end
  447.                
  448.         else
  449.                 something=nil
  450.                 MoveToMouse()
  451.         end
  452. end
  453.  
  454. function getWardHarassSpot()
  455.         if QRDY==1 then
  456.                 local dist=GetD(target,myHero)
  457.                         if target.x==myHero.x then
  458.                                         tx = target.x
  459.                                         if target.z>myHero.z then
  460.                                                         tz = target.z-450
  461.                                         else
  462.                                                         tz = target.z+(450)
  463.                                         end
  464.                    
  465.                         elseif target.z==myHero.z then
  466.                                         tz = target.z
  467.                                         if target.x>myHero.x then
  468.                                                         tx = target.x-(450)
  469.                                         else
  470.                                                         tx = target.x+(450)
  471.                                         end
  472.                    
  473.                         elseif target.x>myHero.x then
  474.                                         angle = math.asin((target.x-myHero.x)/dist)
  475.                                         zs = (450)*math.cos(angle)
  476.                                         xs = (450)*math.sin(angle)
  477.                                         if target.z>myHero.z then
  478.                                                         tx = target.x-xs
  479.                                                         tz = target.z-zs
  480.                                         elseif target.z<myHero.z then
  481.                                                         tx = target.x-xs
  482.                                                         tz = target.z+zs
  483.                                         end
  484.                    
  485.                         elseif target.x<myHero.x then
  486.                                         angle = math.asin((myHero.x-target.x)/dist)
  487.                                         zs = (450)*math.cos(angle)
  488.                                         xs = (450)*math.sin(angle)
  489.                                         if target.z>myHero.z then
  490.                                                         tx = target.x+xs
  491.                                                         tz = target.z-zs
  492.                                         elseif target.z<myHero.z then
  493.                                                         tx = target.x+xs
  494.                                                         tz = target.z+zs
  495.                                         end
  496.                         end
  497.                 return tx,target.y,tz
  498.         end
  499. end
  500.  
  501. function getWardSpot(a,b,c)
  502.         --print("\n
  503.                                 --print("\nHere37")
  504.                 local spot={x=a,y=b,z=c}
  505.                 local dist=GetD(spot,myHero)
  506.                         if myHero.x==spot.x then
  507.                                         tx = myHero.x
  508.                                         if myHero.z>spot.z then
  509.                                                         tz = myHero.z-610
  510.                                         else
  511.                                                         tz = myHero.z+(610)
  512.                                         end
  513.                    
  514.                         elseif spot.z==myHero.z then
  515.                                         tz = myHero.z
  516.                                         if myHero.x>spot.x then
  517.                                                         tx = myHero.x-(610)
  518.                                         else
  519.                                                         tx = myHero.x+(610)
  520.                                         end
  521.                    
  522.                         elseif myHero.x>spot.x then
  523.                                         angle = math.asin((myHero.x-spot.x)/dist)
  524.                                         zs = (610)*math.cos(angle)
  525.                                         xs = (610)*math.sin(angle)
  526.                                         if myHero.z>spot.z then
  527.                                                         tx = myHero.x-xs
  528.                                                         tz = myHero.z-zs
  529.                                         elseif myHero.z<spot.z then
  530.                                                         tx = myHero.x-xs
  531.                                                         tz = myHero.z+zs
  532.                                         end
  533.                    
  534.                         elseif myHero.x<spot.x then
  535.                                         angle = math.asin((spot.x-myHero.x)/dist)
  536.                                         zs = (610)*math.cos(angle)
  537.                                         xs = (610)*math.sin(angle)
  538.                                         if myHero.z>spot.z then
  539.                                                         tx = myHero.x+xs
  540.                                                         tz = myHero.z-zs
  541.                                         elseif myHero.z<spot.z then
  542.                                                         tx = myHero.x+xs
  543.                                                         tz = myHero.z+zs
  544.                                         end
  545.                         end
  546.                 return tx,spot.y,tz
  547.         end
  548.  
  549. function somethingNear(enemy)
  550.         local rturn=nil
  551.         if WRDY==1 and myHero.SpellNameW == "BlindMonkWOne" then
  552.         if enemy~=nil then
  553.                 for i=1, objManager:GetMaxObjects(), 1 do
  554.                         local object = objManager:GetObject(i)
  555.                         if object~=nil and object.x~=nil and object.dead~=1 and object.visible==1 and object.invulnerable==0 and (rturn==nil or (rturn.dead~=nil and rturn.dead==1)) and ((string.find(object.charName,"inion") and object.team==myHero.team) or string.find(object.charName,"SightWard") or string.find(object.charName,"VisionWard")) and GetD(object,enemy)<650 and GetD(object)<GetD(enemy) and nearAngle(enemy,object) then
  556.                                 rturn=object
  557.                         elseif object~=nil and object.x~=nil and object.dead~=1 and object.visible==1 and object.invulnerable==0 and rturn~=nil and rturn.x~=nil and ((string.find(object.charName,"inion") and object.team==myHero.team) or string.find(object.charName,"SightWard") or string.find(object.charName,"VisionWard")) and GetD(object,enemy)<650 and GetD(object)<GetD(enemy) and nearAngle(enemy,object) and GetD(rturn)>GetD(object) then
  558.                                 rturn=object
  559.                         end
  560.                 end
  561.                
  562.         end
  563.         end
  564.                 return rturn
  565. end
  566.  
  567. function initiate()
  568.         if (targeti~=nil or TI~=nil) and RRDY==1 then
  569.                 if myHero.SpellNameQ == "BlindMonkQOne" and QRDY==1 and targeti~=nil then
  570.                         local tfix,tfiy,tfiz=GetFireahead(targeti,qdelay,qspeed)
  571.                         local tfi={x=tfix,y=tfiy,z=tfiz}
  572.                         if GetD(tfi)<975 and CreepBlock(targeti.x, targeti.y, targeti.z) == 0 then --and CreepBlock(targeti.x,targeti.y,targeti.z) == 0 then
  573.                                 TI=targeti
  574.                                 startCombo=false
  575.                                 wardFound=false
  576.                                 success=false
  577.                                 Qspell(target)
  578.                                 --CastSpellXYZ('Q',GetFireahead(targeti,1.6,18))
  579.                                 --CastSpellXYZ('Q',mousePos.x,mousePos.y,mousePos.z)
  580.                                 --print("\nQ1")
  581.                                 TITimer=os.clock()+5
  582.                         end
  583.                 end
  584.                 if TI~=nil and TI.x~=nil and myHero.SpellNameQ == "blindmonkqtwo" and QRDY==1 and startCombo==false and eye~=nil and eye.unit~=nil and eye.unit.x~=nil then
  585.                         print("\nQ2")
  586.                         if GetD(eye.unit,TI)<255 then
  587.                         print("\nQ3")
  588.                                 if LeeConfig.iskey>1 and findWard()~=nil then
  589.                                 print("\nQ4")
  590.                                         success=true
  591.                                         startCombo=false
  592.                                         wardObject=findWard()
  593.                                         wardFound=true
  594.                                         CastSpellTarget('Q',myHero)
  595.                                         lastWardJump = os.clock()+5
  596.                                 elseif (LeeConfig.iskey==1 or LeeConfig.iskey==3) and gotAWard() then
  597.                                         print("\nQ5")
  598.                                         CastSpellTarget('Q',myHero)
  599.                                         startCombo=true
  600.                                 end
  601.                         end
  602.                 end
  603.                 if startCombo==true and wardz==nil and TI~=nil and GetD(TI)<300 and QRDY==0 then
  604.                 print("\nQ6")
  605.                         inSec(TI)
  606.                 elseif WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and QRDY==0 and os.clock() > lastWardJump and startCombo==true and wardz~=nil and TI~=nil and TI.x~=nil then                                            
  607.                         print("\nQ9")
  608.                         if www~=nil then
  609.                                 print("\nQ10")
  610.                                 CastSpellXYZ(www, wardx,wardy,wardz,0)
  611.                                 success=true
  612.                                 wardFound=true
  613.                                 startCombo=false
  614.                                 lastWardJump=os.clock()+5
  615.                                 wardx=nil
  616.                                 wardy=nil
  617.                                 wardz=nil
  618.                         end    
  619.                         --if wardFound==false then
  620.                                 --findWard()
  621.                         --end
  622.                 end
  623.                 if WRDY==1 and myHero.SpellNameW=="BlindMonkWOne" and QRDY==0 and success==true and lastWardJump>os.clock() and wardObject~=nil and GetD(wardObject)<600 then
  624.                         run_every(0.2,WSpell, wardObject)
  625.                 end
  626.                 if TI~=nil and TI.x~=nil and RRDY==1 and (myHero.SpellNameW=="blindmonkwtwo" or WRDY==0) then
  627.                         CastSpellTarget('R',TI)
  628.                 --elseif  RRDY==0 then
  629.                         --success=false
  630.                 end
  631.         else
  632.                 MoveToMouse()
  633.         end
  634. end
  635.  
  636. function findWard()
  637. --print("\nQ7")
  638.                 local wO=nil
  639.         if TI~=nil and TI.x~=nil then
  640.                 local check=false
  641.                 for i=1, objManager:GetMaxObjects(), 1 do
  642.                         local object = objManager:GetObject(i)
  643.                         if object~=nil and object.x~=nil and object.dead~=1 and object.visible==1 and object.invulnerable==0 and (wO==nil or (wO.dead~=nil and wO.dead==1)) and object.team==myHero.team and ((string.find(object.charName,"inion")) or string.find(object.charName,"SightWard") or string.find(object.charName,"VisionWard")) and TI~=nil and TI.x~=nil and ((GetD(object,TI)>0.15*TI.movespeed and not runningAway(TI) and isMoving(TI))  or (GetD(object,TI)>0.4*TI.movespeed and not isMoving(TI)) or (GetD(object,TI)>1.5*TI.movespeed and runningAway(TI) and isMoving(TI))) and GetD(object,TI)<600 and GetD(TI)<GetD(object) and nearAngle(TI,object) then
  644.                                 wO=object
  645.                         elseif object~=nil and object.x~=nil and object.dead~=1 and object.visible==1 and object.invulnerable==0 and wO~=nil and wO.x~=nil and object.team==myHero.team and ((string.find(object.charName,"inion")) or string.find(object.charName,"SightWard") or string.find(object.charName,"VisionWard")) and TI~=nil and TI.x~=nil and ((GetD(object,TI)>0.15*TI.movespeed and not runningAway(TI) and isMoving(TI))  or (GetD(object,TI)>0.4*TI.movespeed and not isMoving(TI)) or (GetD(object,TI)>1.5*TI.movespeed and runningAway(TI) and isMoving(TI))) and GetD(object,TI)<600 and GetD(TI)<GetD(object) and nearAngle(TI,object) and GetD(wO,TI)>GetD(object,TI) then
  646.                                 wO=object
  647.                         end
  648.                 end
  649.         end
  650.         return wO
  651. end
  652.  
  653. function inSec(enemy)
  654.         if WRDY==1 then
  655.         print("\nQ8")
  656.                 if LeeConfig.insec2group then
  657.                         if enemy~=nil then
  658.                                 local spot={x=enemy.x,y=enemy.y,z=enemy.z}
  659.                                 local Theta=0
  660.                                 for j=1, objManager:GetMaxHeroes(), 1 do
  661.                                         local herotarget = objManager:GetHero(j)
  662.                                         if herotarget.team==myHero.team and myHero.name~=herotarget.name and GetD(herotarget,enemy)<=1000 then
  663.                                                 local ThetaAngle=0                                            
  664.                                                 local zz=herotarget.z-enemy.z
  665.                                                 if enemy.z<=herotarget.z then
  666.                                                         if enemy.x<=herotarget.x then
  667.                                                                 ThetaAngle=math.asin(zz/GetD(enemy,herotarget))
  668.                                                                 spot.x=spot.x+math.floor(math.cos(ThetaAngle)*400)
  669.                                                                 spot.z=spot.z+math.floor(math.sin(ThetaAngle)*400)
  670.                                                         elseif enemy.x>herotarget.x then
  671.                                                                 ThetaAngle=math.asin(zz/GetD(enemy,herotarget))
  672.                                                                 spot.x=spot.x-math.floor(math.cos(ThetaAngle)*400)
  673.                                                                 spot.z=spot.z+math.floor(math.sin(ThetaAngle)*400)
  674.                                                         end
  675.                                                 else
  676.                                                         if enemy.x<=herotarget.x then
  677.                                                                 ThetaAngle=math.asin(zz/GetD(enemy,herotarget))
  678.                                                                 spot.x=spot.x+math.floor(math.cos(ThetaAngle)*400)
  679.                                                                 spot.z=spot.z+math.floor(math.sin(ThetaAngle)*400)
  680.                                                         elseif enemy.x>herotarget.x then
  681.                                                                 ThetaAngle=math.asin(zz/GetD(enemy,herotarget))
  682.                                                                 spot.x=spot.x-math.floor(math.cos(ThetaAngle)*400)
  683.                                                                 spot.z=spot.z+math.floor(math.sin(ThetaAngle)*400)
  684.                                                         end    
  685.                                                 end
  686.                                         end
  687.                                 end
  688.                                 if math.abs(spot.x-enemy.x)<=20 then
  689.                                         spot=myHero
  690.                                 end
  691.                                 local RDIST=LeeConfig.distanceR*340/enemy.movespeed
  692.                                 local NRDIST=LeeConfig.distanceNR*enemy.movespeed/340
  693.                                 local NMDIST=LeeConfig.distanceNM
  694.                                 local angle
  695.                                 local dist=GetD(enemy,spot)
  696.                                 local tx,tz
  697.                                 if not isMoving(enemy) then
  698.                                         if enemy.x==spot.x then
  699.                                                 tx = enemy.x
  700.                                                 if enemy.z>spot.z then
  701.                                                         tz = enemy.z+NMDIST
  702.                                                 else
  703.                                                         tz = enemy.z-NMDIST
  704.                                                 end
  705.                                        
  706.                                         elseif enemy.z==spot.z then
  707.                                                 tz = enemy.z
  708.                                                 if enemy.x>spot.x then
  709.                                                         tx = enemy.x+NMDIST
  710.                                                 else
  711.                                                         tx = enemy.x-NMDIST
  712.                                                 end
  713.                                        
  714.                                         elseif enemy.x>spot.x then
  715.                                                 angle = math.acos((enemy.x-spot.x)/dist)
  716.                                                 xs = NRDIST*math.cos(angle)
  717.                                                 zs = NRDIST*math.sin(angle)
  718.                                                 if enemy.z>spot.z then
  719.                                                         tx = enemy.x+xs
  720.                                                         tz = enemy.z+zs
  721.                                                 elseif enemy.z<spot.z then
  722.                                                         tx = enemy.x+xs
  723.                                                         tz = enemy.z-zs
  724.                                                 end
  725.                                        
  726.                                         elseif enemy.x<spot.x then
  727.                                                 angle = math.acos((spot.x-enemy.x)/dist)
  728.                                                 xs = NRDIST*math.cos(angle)
  729.                                                 zs = NRDIST*math.sin(angle)
  730.                                                 if enemy.z>spot.z then
  731.                                                         tx = enemy.x-xs
  732.                                                         tz = enemy.z+zs
  733.                                                 elseif enemy.z<spot.z then
  734.                                                         tx = enemy.x-xs
  735.                                                         tz = enemy.z-zs
  736.                                                 end                                            
  737.                                         end
  738.                                 elseif not runningAway(enemy) then
  739.                                         if enemy.x==spot.x then
  740.                                                 tx = enemy.x
  741.                                                 if enemy.z>spot.z then
  742.                                                         tz = enemy.z+NRDIST
  743.                                                 else
  744.                                                         tz = enemy.z-NRDIST
  745.                                                 end
  746.                                        
  747.                                         elseif enemy.z==spot.z then
  748.                                                 tz = enemy.z
  749.                                                 if enemy.x>spot.x then
  750.                                                         tx = enemy.x+NRDIST
  751.                                                 else
  752.                                                         tx = enemy.x-NRDIST
  753.                                                 end
  754.                                        
  755.                                         elseif enemy.x>spot.x then
  756.                                                 angle = math.acos((enemy.x-spot.x)/dist)
  757.                                                 xs = NRDIST*math.cos(angle)
  758.                                                 zs = NRDIST*math.sin(angle)
  759.                                                 if enemy.z>spot.z then
  760.                                                         tx = enemy.x+xs
  761.                                                         tz = enemy.z+zs
  762.                                                 elseif enemy.z<spot.z then
  763.                                                         tx = enemy.x+xs
  764.                                                         tz = enemy.z-zs
  765.                                                 end
  766.                                        
  767.                                         elseif enemy.x<spot.x then
  768.                                                 angle = math.acos((spot.x-enemy.x)/dist)
  769.                                                 xs = NRDIST*math.cos(angle)
  770.                                                 zs = NRDIST*math.sin(angle)
  771.                                                 if enemy.z>spot.z then
  772.                                                         tx = enemy.x-xs
  773.                                                         tz = enemy.z+zs
  774.                                                 elseif enemy.z<spot.z then
  775.                                                         tx = enemy.x-xs
  776.                                                         tz = enemy.z-zs
  777.                                                 end                                            
  778.                                         end
  779.                                 elseif runningAway(enemy) then
  780.                                         if enemy.x==spot.x then
  781.                                                 tx = enemy.x
  782.                                                 if enemy.z>spot.z then
  783.                                                         tz = enemy.z+RDIST
  784.                                                 else
  785.                                                         tz = enemy.z-RDIST
  786.                                                 end
  787.                                        
  788.                                         elseif enemy.z==spot.z then
  789.                                                 tz = enemy.z
  790.                                                 if enemy.x>spot.x then
  791.                                                         tx = enemy.x+RDIST
  792.                                                 else
  793.                                                         tx = enemy.x-RDIST
  794.                                                 end
  795.                                        
  796.                                         elseif enemy.x>spot.x then
  797.                                                 angle = math.acos((enemy.x-spot.x)/dist)
  798.                                                 xs = RDIST*math.cos(angle)
  799.                                                 zs = RDIST*math.sin(angle)
  800.                                                 if enemy.z>spot.z then
  801.                                                         tx = enemy.x+xs
  802.                                                         tz = enemy.z+zs
  803.                                                 elseif enemy.z<spot.z then
  804.                                                         tx = enemy.x+xs
  805.                                                         tz = enemy.z-zs
  806.                                                 end
  807.                                        
  808.                                         elseif enemy.x<spot.x then
  809.                                                 angle = math.acos((spot.x-enemy.x)/dist)
  810.                                                 xs = RDIST*math.cos(angle)
  811.                                                 zs = RDIST*math.sin(angle)
  812.                                                 if enemy.z>spot.z then
  813.                                                         tx = enemy.x-xs
  814.                                                         tz = enemy.z+zs
  815.                                                 elseif enemy.z<spot.z then
  816.                                                         tx = enemy.x-xs
  817.                                                         tz = enemy.z-zs
  818.                                                 end                                            
  819.                                         end                                    
  820.                                
  821.                                 end
  822.                                
  823.                         wardx=tx
  824.                         wardy=enemy.y
  825.                         wardz=tz
  826.                         wardNear={x=wardx,y=wardy,z=wardz}
  827.                         end
  828.                
  829.                 else
  830.                         if enemy~=nil then
  831.                                 local RDIST=LeeConfig.distanceR*340/enemy.movespeed
  832.                                 local NRDIST=LeeConfig.distanceNR*enemy.movespeed/340
  833.                                 local NMDIST=LeeConfig.distanceNM
  834.                                 local angle
  835.                                 local dist=GetD(enemy,myHero)
  836.                                 local tx,tz
  837.                                 if not isMoving(enemy) then
  838.                                         if enemy.x==myHero.x then
  839.                                                 tx = enemy.x
  840.                                                 if enemy.z>myHero.z then
  841.                                                         tz = enemy.z+NMDIST
  842.                                                 else
  843.                                                         tz = enemy.z-NMDIST
  844.                                                 end
  845.                                        
  846.                                         elseif enemy.z==myHero.z then
  847.                                                 tz = enemy.z
  848.                                                 if enemy.x>myHero.x then
  849.                                                         tx = enemy.x+NMDIST
  850.                                                 else
  851.                                                         tx = enemy.x-NMDIST
  852.                                                 end
  853.                                        
  854.                                         elseif enemy.x>myHero.x then
  855.                                                 angle = math.acos((enemy.x-myHero.x)/dist)
  856.                                                 xs = NRDIST*math.cos(angle)
  857.                                                 zs = NRDIST*math.sin(angle)
  858.                                                 if enemy.z>myHero.z then
  859.                                                         tx = enemy.x+xs
  860.                                                         tz = enemy.z+zs
  861.                                                 elseif enemy.z<myHero.z then
  862.                                                         tx = enemy.x+xs
  863.                                                         tz = enemy.z-zs
  864.                                                 end
  865.                                        
  866.                                         elseif enemy.x<myHero.x then
  867.                                                 angle = math.acos((myHero.x-enemy.x)/dist)
  868.                                                 xs = NRDIST*math.cos(angle)
  869.                                                 zs = NRDIST*math.sin(angle)
  870.                                                 if enemy.z>myHero.z then
  871.                                                         tx = enemy.x-xs
  872.                                                         tz = enemy.z+zs
  873.                                                 elseif enemy.z<myHero.z then
  874.                                                         tx = enemy.x-xs
  875.                                                         tz = enemy.z-zs
  876.                                                 end                                            
  877.                                         end
  878.                                 elseif not runningAway(enemy) then
  879.                                         if enemy.x==myHero.x then
  880.                                                 tx = enemy.x
  881.                                                 if enemy.z>myHero.z then
  882.                                                         tz = enemy.z+NRDIST
  883.                                                 else
  884.                                                         tz = enemy.z-NRDIST
  885.                                                 end
  886.                                        
  887.                                         elseif enemy.z==myHero.z then
  888.                                                 tz = enemy.z
  889.                                                 if enemy.x>myHero.x then
  890.                                                         tx = enemy.x+NRDIST
  891.                                                 else
  892.                                                         tx = enemy.x-NRDIST
  893.                                                 end
  894.                                        
  895.                                         elseif enemy.x>myHero.x then
  896.                                                 angle = math.acos((enemy.x-myHero.x)/dist)
  897.                                                 xs = NRDIST*math.cos(angle)
  898.                                                 zs = NRDIST*math.sin(angle)
  899.                                                 if enemy.z>myHero.z then
  900.                                                         tx = enemy.x+xs
  901.                                                         tz = enemy.z+zs
  902.                                                 elseif enemy.z<myHero.z then
  903.                                                         tx = enemy.x+xs
  904.                                                         tz = enemy.z-zs
  905.                                                 end
  906.                                        
  907.                                         elseif enemy.x<myHero.x then
  908.                                                 angle = math.acos((myHero.x-enemy.x)/dist)
  909.                                                 xs = NRDIST*math.cos(angle)
  910.                                                 zs = NRDIST*math.sin(angle)
  911.                                                 if enemy.z>myHero.z then
  912.                                                         tx = enemy.x-xs
  913.                                                         tz = enemy.z+zs
  914.                                                 elseif enemy.z<myHero.z then
  915.                                                         tx = enemy.x-xs
  916.                                                         tz = enemy.z-zs
  917.                                                 end                                            
  918.                                         end
  919.                                 elseif runningAway(enemy) then
  920.                                         if enemy.x==myHero.x then
  921.                                                 tx = enemy.x
  922.                                                 if enemy.z>myHero.z then
  923.                                                         tz = enemy.z+RDIST
  924.                                                 else
  925.                                                         tz = enemy.z-RDIST
  926.                                                 end
  927.                                        
  928.                                         elseif enemy.z==myHero.z then
  929.                                                 tz = enemy.z
  930.                                                 if enemy.x>myHero.x then
  931.                                                         tx = enemy.x+RDIST
  932.                                                 else
  933.                                                         tx = enemy.x-RDIST
  934.                                                 end
  935.                                        
  936.                                         elseif enemy.x>myHero.x then
  937.                                                 angle = math.acos((enemy.x-myHero.x)/dist)
  938.                                                 xs = RDIST*math.cos(angle)
  939.                                                 zs = RDIST*math.sin(angle)
  940.                                                 if enemy.z>myHero.z then
  941.                                                         tx = enemy.x+xs
  942.                                                         tz = enemy.z+zs
  943.                                                 elseif enemy.z<myHero.z then
  944.                                                         tx = enemy.x+xs
  945.                                                         tz = enemy.z-zs
  946.                                                 end
  947.                                        
  948.                                         elseif enemy.x<myHero.x then
  949.                                                 angle = math.acos((myHero.x-enemy.x)/dist)
  950.                                                 xs = RDIST*math.cos(angle)
  951.                                                 zs = RDIST*math.sin(angle)
  952.                                                 if enemy.z>myHero.z then
  953.                                                         tx = enemy.x-xs
  954.                                                         tz = enemy.z+zs
  955.                                                 elseif enemy.z<myHero.z then
  956.                                                         tx = enemy.x-xs
  957.                                                         tz = enemy.z-zs
  958.                                                 end                                            
  959.                                         end                                    
  960.                                
  961.                                 end
  962.                                
  963.                         wardx=tx
  964.                         wardy=enemy.y
  965.                         wardz=tz
  966.                         wardNear={x=wardx,y=wardy,z=wardz}
  967.                         end
  968.                 end
  969.         end
  970. end
  971.  
  972. function gotAWard()
  973.  
  974.         if myHero.dead~=1 then
  975.                 for _, ward in pairs(wards) do
  976.                                 if GetWardSlot(ward) ~= nil then
  977.                                                 return true
  978.                                 end
  979.                         end
  980.         end
  981.         return false
  982. end
  983.  
  984. function isMoving(unitM)
  985.         local mx,my,mz=GetFireahead(unitM,5,0)
  986.         if math.abs(mx-unitM.x)<20 and math.abs(mz-unitM.z)<20 then
  987.                 return false
  988.         else
  989.                 return true
  990.         end
  991. end
  992.  
  993. function Smite()
  994.     if myHero.SummonerD == "SummonerSmite" then
  995.         CastHotkey("AUTO 100,0 SPELLD:SMITESTEAL RANGE=700 TRUE COOLDOWN")
  996.         return
  997.     end
  998.     if myHero.SummonerF == "SummonerSmite" then
  999.         CastHotkey("AUTO 100,0 SPELLF:SMITESTEAL RANGE=700 TRUE COOLDOWN")
  1000.         return
  1001.     end
  1002.    
  1003.     for i=1, objManager:GetMaxObjects(), 1 do
  1004.         local object = objManager:GetObject(i)
  1005.         if object ~= nil and object.name ~= nil and (string.find(object.name,"Dragon") or string.find(object.name,"Worm")) then
  1006.             if GetD(object,myHero) < 1200 then
  1007.                 local damage = 460+(30*myHero.selflevel)
  1008.                 if object.health <= damage then
  1009.                     CustomCircle(100,10,7,object)
  1010.                 end
  1011.             end
  1012.         end
  1013.     end
  1014. end
  1015.  
  1016. function runningAway(slowtarget)
  1017.    local d1 = GetD(slowtarget)
  1018.    local x, y, z = GetFireahead(slowtarget,2,0)
  1019.    local d2 = GetD({x=x, y=y, z=z})
  1020.    local d3 = GetD({x=x, y=y, z=z},slowtarget)
  1021.    local angle = math.acos((d2*d2-d3*d3-d1*d1)/(-2*d3*d1))
  1022.    
  1023.    return angle%(2*math.pi)>math.pi/2 and angle%(2*math.pi)<math.pi*3/2
  1024.  
  1025. end
  1026.  
  1027. function OnCreateObj(obj)
  1028.         --if GetD(obj)<600 then
  1029.         --print("\n obj "..obj.charName)
  1030.         --end
  1031.         if string.find(obj.charName,"blindMonk_Q_tar_indicator") and myHero.SpellNameQ == "blindmonkqtwo" then
  1032.                 eye.unit=obj
  1033.                 eye.x=obj.x
  1034.                 eye.y=obj.y
  1035.                 eye.z=obj.z
  1036.         end
  1037.        
  1038.         if LeeConfig.initiate and GetD(obj)<800 and (string.find(obj.charName,"SightWard") or string.find(obj.charName,"VisionWard")) then
  1039.                 wardObject=obj        
  1040.                 lastWardJump = os.clock()+5
  1041.         elseif (LeeConfig.ward or LeeConfig.harass) and GetD(obj)<800 and (string.find(obj.charName,"SightWard") or string.find(obj.charName,"VisionWard")) then
  1042.                 lastWardObject=obj
  1043.                 lastWardJump = os.clock()+5
  1044.         end
  1045.         if (GetD(myHero, obj)) < 100 and LeeConfig.pots then
  1046.                 if string.find(obj.charName,"FountainHeal") then
  1047.                         timer=os.clock()
  1048.                         bluePill = obj
  1049.                 end
  1050.         end
  1051.         if obj.charName == 'EggTimer.troy' then
  1052.                 for i= 1,objManager:GetMaxHeroes(),1 do
  1053.                         local hero=objManager:GetHero(i)
  1054.                         if hero.name == 'Anivia' and GetDistance(obj, hero) < 10 then
  1055.                                 if hero.team == myHero.team then egg = {team = GetTickCount(), enemy = egg.enemy}
  1056.                                 else egg = {team = egg.team, enemy = GetTickCount()} end
  1057.                                 break
  1058.                         end
  1059.                 end
  1060.         elseif obj.charName == 'Aatrox_Passive_Death_Activate.troy' then
  1061.                 for i= 1,objManager:GetMaxHeroes(),1 do
  1062.                         local hero=objManager:GetHero(i)
  1063.                         if hero.name == 'Aatrox' and GetDistance(obj, hero) < 10 then
  1064.                                 if hero.team == myHero.team then aatrox = {team = GetTickCount(), enemy = aatrox.enemy}
  1065.                                 else aatrox = {team = aatrox.team, enemy = GetTickCount()} end
  1066.                                 break
  1067.                         end
  1068.                 end
  1069.         elseif obj.charName == 'ZacPassiveExplosion.troy' then
  1070.                 for i= 1,objManager:GetMaxHeroes(),1 do
  1071.                         local hero=objManager:GetHero(i)
  1072.                         if hero.name == 'Zac' and GetDistance(obj, hero) < 10 then
  1073.                                 if hero.team == myHero.team then zac = {team = GetTickCount(), enemy = zac.enemy}
  1074.                                 else zac = {team = zac.team, enemy = GetTickCount()} end
  1075.                                 break
  1076.                         end
  1077.                 end
  1078.         end
  1079. end
  1080.  
  1081. function OnProcessSpell(unit,spell)
  1082.         if unit.charName==myHero.charName then
  1083.                 --print("\nSP: "..spell.name)
  1084.                 --if string.find(spell.name,"BlindMonkRKick") then
  1085.                         --success=false
  1086.  
  1087.                 if string.find(spell.name,"BlindMonkQ") and LeeConfig.Combo then
  1088.                         PTimer=os.clock()+math.min(1.5,2/myHero.attackspeed)
  1089.                         PMod=0
  1090.                 elseif string.find(spell.name,"BlindMonkW") and LeeConfig.Combo then
  1091.                         PTimer=os.clock()+math.min(1.5,2/myHero.attackspeed)
  1092.                         PMod=0
  1093.                 elseif string.find(spell.name,"BlindMonkE") and LeeConfig.Combo then
  1094.                         PTimer=os.clock()+math.min(1.5,2/myHero.attackspeed)
  1095.                         PMod=0
  1096.                 elseif string.find(spell.name,"blindmonk") and LeeConfig.Combo then
  1097.                         PTimer=os.clock()+math.min(1.5,2/myHero.attackspeed)
  1098.                         PMod=0
  1099.                 elseif string.find(spell.name,"Attack") and LeeConfig.Combo then
  1100.                         PMod=PMod+1
  1101.                 end
  1102.         end
  1103. end
  1104.  
  1105. function OnDraw()
  1106. end
  1107.  
  1108. function nearWard()
  1109.         local ok=false
  1110.         if targeti~=nil and targeti.x~=nil and myHero.dead~=1 and GetD(targeti)<1000 then
  1111.                 local mt=wardObject
  1112.  
  1113.                         if mt~=nil and mt.dead~=nil and mt.dead~=1 and TI~=nil and TI.dead~=nil and TI.dead~=1 and nearAngle(mt,TI) then
  1114.                                 CustomCircle(100,20,3,mt)
  1115.                                 ok=true
  1116.                         elseif mt~=nil and mt.dead~=nil and mt.dead~=1 and nearAngle(mt,targeti) then
  1117.                                 CustomCircle(100,20,3,mt)
  1118.                                 ok=true
  1119.                         end
  1120.         end
  1121.        
  1122.                 if ok==true then
  1123.                 return true
  1124.                 else
  1125.                 return false
  1126.                 end
  1127. end
  1128.  
  1129.  
  1130. function nearAngle(unit1,unit2)
  1131.         if myHero.dead~=1 and unit1.z~=nil and unit2.z~=nil then
  1132.         local Theta=0
  1133.         local zz=unit1.z-myHero.z
  1134.         if unit1.x>=myHero.x then
  1135.                 Theta=math.acos(zz/GetD(unit1))
  1136.         elseif unit1.x<myHero.x then
  1137.                 Theta=-math.acos(zz/GetD(unit1))
  1138.         end
  1139.        
  1140.         local HTheta=0
  1141.         local Hzz=unit2.z-myHero.z
  1142.         if unit2.x>=myHero.x then
  1143.                 HTheta=math.acos(Hzz/GetD(unit2))
  1144.         elseif unit2.x<myHero.x then
  1145.                 HTheta=-math.acos(Hzz/GetD(unit2))
  1146.         end
  1147.         if HTheta>=Theta and HTheta-Theta<=2*math.pi/10 then
  1148.                 return true
  1149.         elseif HTheta<Theta and Theta-HTheta<=2*math.pi/10 then
  1150.                 return true
  1151.         end
  1152.         end
  1153.         return false
  1154. end
  1155. ------------------------------------Pots
  1156.  
  1157. function RedElixir()
  1158.         if bluePill == nil then
  1159.                 if myHero.health < 4/10*myHero.maxHealth and os.clock() > wUsedAt + 15 then
  1160.                         usePotion()
  1161.                         wUsedAt = os.clock()
  1162.                 end
  1163.                 if myHero.health < 0.5*myHero.maxHealth and os.clock() > vUsedAt + 10 then
  1164.                         useFlask()
  1165.                         vUsedAt = os.clock()
  1166.                 end
  1167.                 if myHero.health < 3/10*myHero.maxHealth then
  1168.                         useElixir()
  1169.                 end
  1170.         end
  1171.         if (os.clock() < timer + 5) then
  1172.                 bluePill = nil
  1173.         end
  1174. end
  1175.  
  1176.  
  1177. function usePotion()
  1178.         GetInventorySlot(2003)
  1179.         UseItemOnTarget(2003,myHero)
  1180. end
  1181.  
  1182. function useFlask()
  1183.         GetInventorySlot(2041)
  1184.         UseItemOnTarget(2041,myHero)
  1185. end
  1186.  
  1187.  
  1188. function useElixir()
  1189.         GetInventorySlot(2037)
  1190.         UseItemOnTarget(2037,myHero)
  1191. end
  1192.  
  1193. function GetWardSlot(item)
  1194.     if GetInventoryItem(1) == item then
  1195.                                 --print("\nHere2")
  1196.                 if item == 3154 or item == 3340 or item == 3350 or item == 3361 or item == 3362 then                      
  1197.                                         --print("\nHere3")
  1198.                                                 if myHero.SpellTime1 >= 1 then
  1199.                                                         --print("\nHere4")
  1200.                                                         return 1
  1201.                         else
  1202.                                                         --print("\nHere5")
  1203.                                                         return nil end
  1204.                 else
  1205.                                                 --print("\nHere6")
  1206.                         return 1
  1207.                 end
  1208.     elseif GetInventoryItem(2) == item then
  1209.                                 --print("\nHere7")
  1210.                 if item == 3154 or item == 3340 or item == 3350 or item == 3361 or item == 3362 then
  1211.                                         --print("\nHere8")
  1212.                         if myHero.SpellTime2 >= 1 then
  1213.                                                         --print("\nHere9")
  1214.                                                         return 2
  1215.                         else
  1216.                                                         --print("\nHere10")
  1217.                                                         return nil end
  1218.                 else
  1219.                                                 --print("\nHere11")
  1220.                         return 2
  1221.                 end
  1222.     elseif GetInventoryItem(3) == item then
  1223.                                 --print("\nHere12")
  1224.                 if item == 3154 or item == 3340 or item == 3350 or item == 3361 or item == 3362 then
  1225.                                         --print("\nHere13")
  1226.                         if myHero.SpellTime3 >= 1 then
  1227.                                                         --print("\nHere14")
  1228.                                                         return 3
  1229.                         else
  1230.                                                         --print("\nHere15")
  1231.                                                         return nil end
  1232.                 else
  1233.                                                 --print("\nHere16")
  1234.                         return 3
  1235.                 end
  1236.     elseif GetInventoryItem(4) == item then
  1237.                                 --print("\nHere17")
  1238.                 if item == 3154 or item == 3340 or item == 3350 or item == 3361 or item == 3362 then
  1239.                                         --print("\nHere18")
  1240.                         if myHero.SpellTime4 >= 1 then
  1241.                                                         --print("\nHere19")
  1242.                                                         return 4
  1243.                         else
  1244.                                                         --print("\nHere20")
  1245.                                                         return nil end
  1246.                 else
  1247.                                                 --print("\nHere21")
  1248.                         return 4
  1249.                 end
  1250.     elseif GetInventoryItem(5) == item then
  1251.                                 --print("\nHere22")
  1252.                 if item == 3154 or item == 3340 or item == 3350 or item == 3361 or item == 3362 then
  1253.                                         --print("\nHere23")
  1254.                         if myHero.SpellTime5 >= 1 then
  1255.                                                         --print("\nHere24")
  1256.                                                         return 5
  1257.                         else
  1258.                                                         --print("\nHere25")
  1259.                                                         return nil end
  1260.                 else
  1261.                                                 --print("\nHere26")
  1262.                         return 5
  1263.                 end
  1264.     elseif GetInventoryItem(6) == item then
  1265.                                 --print("\nHere27")
  1266.                 if item == 3154 or item == 3340 or item == 3350 or item == 3361 or item == 3362 then
  1267.                                         --print("\nHere28")
  1268.                         if myHero.SpellTime6 >= 1 then
  1269.                                                         --print("\nHere29")
  1270.                                                         return 6
  1271.                         else
  1272.                                                         --print("\nHere30")
  1273.                                                         return nil end
  1274.                 else
  1275.                                                 --print("\nHere31")
  1276.                         return 6
  1277.                 end
  1278.     elseif GetInventoryItem(7) == item then
  1279.                                 --print("\nHere32")
  1280.                 if item == 3154 or item == 3340 or item == 3350 or item == 3361 or item == 3362 then
  1281.                                         --print("\nHere33")
  1282.                         if myHero.SpellTime7 >= 1 then
  1283.                                                         --print("\nHere34")
  1284.                                                         return 7
  1285.                         else
  1286.                                                         --print("\nHere35")
  1287.                                                         return nil end
  1288.                 else
  1289.                                                 --print("\nHere36")
  1290.                         return 7
  1291.                 end
  1292.     end
  1293.     return nil
  1294. end
  1295.  
  1296. function GetTeamSize()
  1297.     return math.floor(objManager:GetMaxHeroes()/2)
  1298. end
  1299.  
  1300. function GetBestEnemy(damage_type, range, tag)
  1301.     if tag == nil then tag = "BASIC" end
  1302.         local QDMG=0
  1303.         local WDMG=0
  1304.         local EDMG=0
  1305.         local RDMG=0
  1306.         local ADMG=0
  1307.     local enemy, prospect
  1308.     for i=1,GetTeamSize() do    
  1309.         prospect = GetWeakEnemy(damage_type, range, tag, i)
  1310.         if prospect == nil then
  1311.             -- pass        
  1312.         else
  1313.                         if spellDmg[myHero.name] then
  1314.                                 if QRDY==1 and getDmg("Q",prospect,myHero)~=nil then
  1315.                                         QDMG=getDmg("Q",prospect,myHero)
  1316.                                 else
  1317.                                         QDMG=0
  1318.                                 end
  1319.                                 if WRDY==1 and getDmg("W",prospect,myHero)~=nil then
  1320.                                         WDMG=getDmg("W",prospect,myHero)
  1321.                                 else
  1322.                                         WDMG=0
  1323.                                 end
  1324.                                 if ERDY==1 and getDmg("E",prospect,myHero)~=nil then
  1325.                                         EDMG=getDmg("E",prospect,myHero)
  1326.                                 else
  1327.                                         EDMG=0
  1328.                                 end
  1329.                                 if RRDY==1 and getDmg("R",prospect,myHero)~=nil then
  1330.                                         RDMG=getDmg("R",prospect,myHero)
  1331.                                 else
  1332.                                         RDMG=0
  1333.                                 end
  1334.                                 if getDmg("AD",prospect,myHero)~=nil then
  1335.                                         ADMG=getDmg("AD",prospect,myHero)
  1336.                                 else
  1337.                                         ADMG=0
  1338.                                 end
  1339.                        
  1340.                         end
  1341.                        
  1342.                         local invul=IsInvulnerable(prospect).status
  1343.             if invul==1 or (invul==4 and QDMG+WDMG+EDMG+RDMG+ADMG>prospect.health) then
  1344.                 local msg = "*** target invulnerable, cycling ***"
  1345.                 print(msg)
  1346.                 DrawTextObject(msg,myHero,0xFFFF0000)
  1347.             else
  1348.                 enemy = prospect
  1349.                 break -- <-------- *** important ***
  1350.             end
  1351.         end
  1352.     end
  1353.     -- we should return nil if everyone is invuln, same as the original api when no enemies are in range
  1354.     --if target == nil then
  1355.     --    target = GetWeakEnemy(damage_type, range, tag)
  1356.     --end
  1357.     return enemy
  1358. end
  1359.  
  1360. local StatusReturn={}
  1361. local ChampList={}
  1362. function IsInvulnerable(target)
  1363.         if target ~= nil and target.dead == 0 then
  1364.                 if target.invulnerable == 1 then
  1365.                     ChampList[target.charName]={status = 1, name = nil, amount = nil, type = nil}
  1366.                     return {status = 1, name = nil, amount = nil, type = nil}
  1367.                 else
  1368.                     StatusReturn=nil
  1369.                                         run_every(0.3,getStatus,target)
  1370.                     if StatusReturn~=nil then
  1371.                         ChampList[target.charName]=StatusReturn
  1372.                         return  StatusReturn
  1373.                     end
  1374.                 end
  1375.                                 if ChampList[target.charName] then
  1376.                                         return ChampList[target.charName]
  1377.                                 else
  1378.                                         ChampList[target.charName]={status = 0, name = nil, amount = nil, type = nil}
  1379.                                         return {status = 0, name = nil, amount = nil, type = nil}
  1380.                                 end
  1381.         elseif target~=nil then
  1382.             ChampList[target.charName]={status = 0, name = nil, amount = nil, type = nil}
  1383.             return {status = 0, name = nil, amount = nil, type = nil}
  1384.         end
  1385. end
  1386.  
  1387. function getStatus(target)
  1388.         for i=1, objManager:GetMaxObjects(), 1 do
  1389.                         local object = objManager:GetObject(i)
  1390.                         if object ~= nil then
  1391.                                         if string.find(object.charName,"eyeforaneye") ~= nil and GetDistance(target,object) <= 20 then
  1392.                                                 StatusReturn = {status = 1, name = 'Intervention', amount = 0, type = 'ALL'}
  1393.                                                 return
  1394.                                         elseif string.find(object.charName,"nickoftime") ~= nil and GetDistance(target,object) <= 20 then
  1395.                                                 StatusReturn = {status = 4, name = 'Chrono Shift', amount = 0, type = 'REVIVE'}
  1396.                                                 return
  1397.                                         elseif target.name == 'Poppy' and string.find(object.charName,"DiplomaticImmunity_tar") ~= nil and GetDistance(myHero,object) > 20 then
  1398.                                                         for i=1, objManager:GetMaxObjects(), 1 do
  1399.                                                                         local diObject = objManager:GetObject(i)
  1400.                                                                         if diObject ~= nil and string.find(diObject.charName,"DiplomaticImmunity_buf") ~= nil and GetDistance(target,diObject) <= 20 then
  1401.                                                                                 StatusReturn = {status = 1, name = 'Diplomatic Immunity', amount = 0, type = 'ALL'} end
  1402.                                                                 return
  1403.                                                         end
  1404.                                         elseif target.name == 'Vladimir' and string.find(object.charName,"VladSanguinePool_buf") ~= nil and GetDistance(myHero,object) <= 20 then
  1405.                                                 StatusReturn = {status = 1, name = 'Sanguine Pool', amount = 0, type = 'ALL'}
  1406.                                                 return
  1407.                                                 --                                      elseif string.find(object.charName,"Summoner_Barrier") ~= nil and GetDistance(target,object) <= 20 then return 2--, 'NONE'
  1408.                                         elseif (string.find(object.charName,"Global_Spellimmunity") ~= nil or string.find(object.charName,"Morgana_Blackthorn_Blackshield") ~= nil) and GetDistance(target,object) <= 20 then
  1409.                                                         local amount = 0
  1410.                                                         for i= 1,objManager:GetMaxHeroes(),1 do
  1411.                                                                         local hero=objManager:GetHero(i)
  1412.                                                                         if hero.team == target.team and hero.name == 'Morgana' then
  1413.                                                                                         amount = 30+(65*hero.SpellLevelE)+(hero.ap*0.7)
  1414.                                                                                         StatusReturn = {status = 2, name = 'Black Shield', amount = amount, type = 'MAGIC'}
  1415.                                                                                 return
  1416.                                                                         end
  1417.                                                         end
  1418.                                         elseif string.find(object.charName,"bansheesveil_buf") ~= nil and GetDistance(target,object) <= 20 then
  1419.                                                 StatusReturn = {status = 2, name = 'Banshees Veil', amount = 0, type = 'SPELL'}
  1420.                                                 return
  1421.                                         elseif target.name == 'Sivir' and string.find(object.charName,"Sivir_Base_E_shield") ~= nil and GetDistance(target,object) <= 20 then
  1422.                                                 StatusReturn = {status = 2, name = 'Spell Shield', amount = 0, type = 'SPELL'}
  1423.                                                 return
  1424.                                         elseif target.name == 'Nocturne' and string.find(object.charName,"nocturne_shroudofDarkness_shield") ~= nil and GetDistance(target,object) <= 20 then
  1425.                                                 StatusReturn = {status = 2, name = 'Shroud of Darkness', amount = 0, type = 'SPELL'}
  1426.                                                 return
  1427.                                         elseif target.name == 'Tryndamere' and string.find(object.charName,"UndyingRage_buf") ~= nil and GetDistance(target,object) <= 20 then
  1428.                                                 StatusReturn = {status = 4, name = 'Undying Rage', amount = 0, type = 'NONE'}
  1429.                                                 return
  1430.                                         elseif string.find(object.charName,"rebirthready") ~= nil and GetDistance(target,object) <= 20 then
  1431.                                                 StatusReturn = {status = 3, name = 'Guardian Angel', amount = 0, type = 'REVIVE'}
  1432.                                                 return
  1433.                                         elseif target.name == 'Anivia' then
  1434.                                                         if target.team == myHero.team then
  1435.                                                                         if GetTickCount()-egg.allied.time > 240000 or egg.allied.time == 0 then
  1436.                                                                                 StatusReturn = {status = 3, name = 'Egg', amount = 0, type = 'REVIVE'}
  1437.                                                                                 return
  1438.                                                                         else
  1439.                                                                                 StatusReturn = {status = 0, name = nil, amount = nil, type = nil} end
  1440.                                                                                 return
  1441.                                                         else
  1442.                                                                         if GetTickCount()-egg.enemy.time > 240000 or egg.enemy.time == 0 then
  1443.                                                                                 StatusReturn = {status = 3, name = 'Egg', amount = 0, type = 'REVIVE'}
  1444.                                                                                 return
  1445.                                                                         else
  1446.                                                                                 StatusReturn = {status = 0, name = nil, amount = nil, type = nil} end
  1447.                                                                                 return
  1448.                                                         end
  1449.                                         elseif target.name == 'Zac' then
  1450.                                                         if target.team == myHero.team then
  1451.                                                                         if GetTickCount()-zac.allied.time > 300000 or zac.allied.time == 0 then
  1452.                                                                                 StatusReturn = {status = 3, name = 'Zac', amount = 0, type = 'REVIVE'}
  1453.                                                                                 return
  1454.                                                                         else
  1455.                                                                                 StatusReturn = {status = 0, name = nil, amount = nil, type = nil}
  1456.                                                                                 return
  1457.                                                                         end
  1458.                                                         elseif target.team ~= myHero.team then
  1459.                                                                         if GetTickCount()-zac.enemy > 300000 or zac.enemy.time == 0 then
  1460.                                                                                 StatusReturn = {status = 3, name = 'Zac', amount = 0, type = 'REVIVE'}
  1461.                                                                                 return
  1462.                                                                         else
  1463.                                                                                 StatusReturn = {status = 0, name = nil, amount = nil, type = nil}
  1464.                                                                                 return
  1465.                                                                         end
  1466.                                                         end
  1467. --                                      elseif string.find(object.charName,"GLOBAL_Item_FoM_Shield") ~= nil and GetDistance(target,object) <= 30 then return 2--, 'NONE'
  1468. --                                      elseif target.name == 'Nautilus' and string.find(object.charName,"Nautilus_W_shield_cas") ~= nil and GetDistance(target,object) <= 20 then return 2--, 'NONE'
  1469.                                         end
  1470.                         end
  1471.         end
  1472.         StatusReturn = {status = 0, name = nil, amount = nil, type = nil}
  1473.         return
  1474. end
  1475.  
  1476. function run_every(interval, fn, ...)
  1477.     return internal_run({fn=fn, interval=interval}, ...)
  1478. end
  1479.  
  1480. function internal_run(t, ...)    
  1481.     local fn = t.fn
  1482.     local key = t.key or fn
  1483.    
  1484.     local now = os.clock()
  1485.     local data = _registry[key]
  1486.        
  1487.     if data == nil or t.reset then
  1488.         local args = {}
  1489.         local n = select('#', ...)
  1490.         local v
  1491.         for i=1,n do
  1492.             v = select(i, ...)
  1493.             table.insert(args, v)
  1494.         end  
  1495.         -- the first t and args are stored in registry        
  1496.         data = {count=0, last=0, complete=false, t=t, args=args}
  1497.         _registry[key] = data
  1498.     end
  1499.        
  1500.     --assert(data~=nil, 'data==nil')
  1501.     --assert(data.count~=nil, 'data.count==nil')
  1502.     --assert(now~=nil, 'now==nil')
  1503.     --assert(data.t~=nil, 'data.t==nil')
  1504.     --assert(data.t.start~=nil, 'data.t.start==nil')
  1505.     --assert(data.last~=nil, 'data.last==nil')
  1506.     -- run
  1507.     local countCheck = (t.count==nil or data.count < t.count)
  1508.     local startCheck = (data.t.start==nil or now >= data.t.start)
  1509.     local intervalCheck = (t.interval==nil or now-data.last >= t.interval)
  1510.     --print('', 'countCheck', tostring(countCheck))
  1511.     --print('', 'startCheck', tostring(startCheck))
  1512.     --print('', 'intervalCheck', tostring(intervalCheck))
  1513.     --print('')
  1514.     if not data.complete and countCheck and startCheck and intervalCheck then                
  1515.         if t.count ~= nil then -- only increment count if count matters
  1516.             data.count = data.count + 1
  1517.         end
  1518.         data.last = now        
  1519.        
  1520.         if t._while==nil and t._until==nil then
  1521.             return fn(...)
  1522.         else
  1523.             -- while/until handling
  1524.             local signal = t._until ~= nil
  1525.             local checker = t._while or t._until
  1526.             local result
  1527.             if fn == checker then            
  1528.                 result = fn(...)
  1529.                 if result == signal then
  1530.                     data.complete = true
  1531.                 end
  1532.                 return result
  1533.             else
  1534.                 result = checker(...)
  1535.                 if result == signal then
  1536.                     data.complete = true
  1537.                 else
  1538.                     return fn(...)
  1539.                 end
  1540.             end            
  1541.         end
  1542.     end    
  1543. end
  1544.  
  1545. function GetD(p1, p2)
  1546. if p2 == nil then p2 = myHero end
  1547. if (p1.z == nil or p2.z == nil) and p1.x~=nil and p1.y ~=nil and p2.x~=nil and p2.y~=nil then
  1548. px=p1.x-p2.x
  1549. py=p1.y-p2.y
  1550. if px~=nil and py~=nil then
  1551. px2=px*px
  1552. py2=py*py
  1553. if px2~=nil and py2~=nil then
  1554. return math.sqrt(px2+py2)
  1555. else
  1556. return 99999
  1557. end
  1558. else
  1559. return 99999
  1560. end
  1561.  
  1562. elseif p1.x~=nil and p1.z ~=nil and p2.x~=nil and p2.z~=nil then
  1563. px=p1.x-p2.x
  1564. pz=p1.z-p2.z
  1565. if px~=nil and pz~=nil then
  1566. px2=px*px
  1567. pz2=pz*pz
  1568. if px2~=nil and pz2~=nil then
  1569. return math.sqrt(px2+pz2)
  1570. else
  1571. return 99999
  1572. end
  1573. else    
  1574. return 99999
  1575. end
  1576.  
  1577. else
  1578. return 99999
  1579. end
  1580. end
  1581.  
  1582. SetTimerCallback("LeeRun")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement