Advertisement
Guest User

Untitled

a guest
Aug 30th, 2014
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 60.66 KB | None | 0 0
  1. local version = "1.16"
  2. --[[
  3.  
  4. Velkoz, The Geometry Nightmare
  5. by Dienofail
  6.  
  7.  
  8. Changelog
  9.  
  10. v0.01 - release
  11.  
  12. v0.02 - Hotfixes to W and etc. Turned autoupdate on.
  13.  
  14. v0.03 - more hotfixes
  15.  
  16. v0.04 - Q fixes
  17.  
  18. v0.05 - Few more fixes
  19.  
  20. v0.06 - Battlecast skin particles added. If it doesn't work, revert back to normal skin.
  21.  
  22. v0.07 - Added Harass Options
  23.  
  24. v0.08 - Added R packet block option (will block R packets while R is casting), lowered W max range, and made fixes for W farm. Split Q farm added. Added max distance slider for Q splits
  25.  
  26. v1.00 - Added additional hit chance slider for initial Q split casts (will not affect normal non-collision casts). Added Double Q code checks. Added Mancusizz orbwalker and ignite KS. Should be usable standalone now.
  27.  
  28. v1.01 - E delay fixes. Should now cast more often and feel more responsive
  29.  
  30. v1.02 - updated with correct Q split speeds
  31.  
  32. v1.03 - Draw R kill text and kalman filter implemented, added AOE skill shot position for VPrediction v2.34
  33.  
  34. v1.04 - Fixed ignite KS.
  35.  
  36. v1.05 - Added better R killtext. Added drawing Q split calculations to Q draw (red -> not detonating, blue -> detonating). Added secondary Q split algorithm. Added Q split target locking
  37.  
  38. v1.06 - Fixed debug info
  39.  
  40. v1.07 - Fixed critical error in Q angle collision calculations. Also lowered debug font.
  41.  
  42. v1.08 - Added some buffer distance to Q projectile, should now detonate more often and faster. Let me know what you think of accuracy vs 1.07.
  43.  
  44. v1.09 - Some minor fixes to split Q calculations.
  45.  
  46. v1.10 - Small bug fixes to farm calculations
  47.  
  48. v1.11 - Added E dashes
  49.  
  50. v1.12 - Fixed E and Q range
  51.  
  52. v1.13 - Added option to disable autoattacks. Added toggle mode.
  53.  
  54. v1.14 - Fixed compatibility with VPred 2.404
  55.  
  56. v1.15 - ???
  57.  
  58. v1.16 - Fixed R autolock packet changes
  59.  
  60. Todo:
  61.  
  62.  
  63. ]]--
  64.  
  65. --Start Honda7 credit
  66. if myHero.charName ~= "Velkoz" then return end
  67. require 'VPrediction'
  68.  
  69. local autoupdateenabled = true
  70. local UPDATE_SCRIPT_NAME = "Velkoz"
  71. local UPDATE_HOST = "raw.github.com"
  72. local UPDATE_PATH = "/Dienofail/BoL/master/Velkoz.lua"
  73. local UPDATE_FILE_PATH = SCRIPT_PATH..GetCurrentEnv().FILE_NAME
  74. local UPDATE_URL = "https://"..UPDATE_HOST..UPDATE_PATH
  75.  
  76. local ServerData
  77. if autoupdateenabled then
  78. GetAsyncWebResult(UPDATE_HOST, UPDATE_PATH, function(d) ServerData = d end)
  79. function update()
  80. if ServerData ~= nil then
  81. local ServerVersion
  82. local send, tmp, sstart = nil, string.find(ServerData, "local version = \"")
  83. if sstart then
  84. send, tmp = string.find(ServerData, "\"", sstart+1)
  85. end
  86. if send then
  87. ServerVersion = tonumber(string.sub(ServerData, sstart+1, send-1))
  88. end
  89.  
  90. if ServerVersion ~= nil and tonumber(ServerVersion) ~= nil and tonumber(ServerVersion) > tonumber(version) then
  91. DownloadFile(UPDATE_URL.."?nocache"..myHero.charName..os.clock(), UPDATE_FILE_PATH, function () print("<font color=\"#FF0000\"><b>"..UPDATE_SCRIPT_NAME..":</b> successfully updated. Reload (double F9) Please. ("..version.." => "..ServerVersion..")</font>") end)
  92. elseif ServerVersion then
  93. print("<font color=\"#FF0000\"><b>"..UPDATE_SCRIPT_NAME..":</b> You have got the latest version: <u><b>"..ServerVersion.."</b></u></font>")
  94. end
  95. ServerData = nil
  96. end
  97. end
  98. AddTickCallback(update)
  99. end
  100. --End Honda7 credit
  101. --Start Vadash Credit
  102. class 'Kalman' -- {
  103. function Kalman:__init()
  104. self.current_state_estimate = 0
  105. self.current_prob_estimate = 0
  106. self.Q = 1
  107. self.R = 15
  108. end
  109. function Kalman:STEP(control_vector, measurement_vector)
  110. local predicted_state_estimate = self.current_state_estimate + control_vector
  111. local predicted_prob_estimate = self.current_prob_estimate + self.Q
  112. local innovation = measurement_vector - predicted_state_estimate
  113. local innovation_covariance = predicted_prob_estimate + self.R
  114. local kalman_gain = predicted_prob_estimate / innovation_covariance
  115. self.current_state_estimate = predicted_state_estimate + kalman_gain * innovation
  116. self.current_prob_estimate = (1 - kalman_gain) * predicted_prob_estimate
  117. return self.current_state_estimate
  118. end
  119. --[[ Velocities ]]
  120. local kalmanFilters = {}
  121. local velocityTimers = {}
  122. local oldPosx = {}
  123. local oldPosz = {}
  124. local oldTick = {}
  125. local velocity = {}
  126. local lastboost = {}
  127. local velocity_TO = 10
  128. local CONVERSATION_FACTOR = 975
  129. local MS_MIN = 500
  130. local MS_MEDIUM = 750
  131. --End Vadash Credit
  132.  
  133.  
  134.  
  135. local VP = VPrediction()
  136. local OriginalCastVector1 = nil
  137. local OriginalCastVector2 = nil
  138. local RotatedUnitVector1 = nil
  139. local RotatedUnitVector2 = nil
  140. local RotatedVector1 = nil
  141. local RotatedVector2 = nil
  142. local QObject = nil
  143. local QEndObject = nil
  144. local ToRotateVector = nil
  145. local isPressedR = false
  146. local BlockQ = false
  147. local ignite = nil
  148. local igniteReady = nil
  149. local QAdditionalDistance = 435
  150. local SpellQ = {Range = 1050, Speed = 1300, Delay = 0.066, Width = 50}
  151. local SpellW = {Range = 1050, Speed = 1700, Delay = 0.064, Width = 65}
  152. local SpellE = {Range = 850, Speed = 1500, Delay = 0.333, Width = 120}
  153. local SpellR = {Range = 1500, Speed = 20000, Delay = 0.250, Width = 50}
  154. local QSplitSpeed = 2100
  155. local InitialTarget = nil
  156. local LastPacketSend = 0
  157. local LastPacketBlock = false
  158. initDone = false
  159. local buffer = false
  160. target = nil
  161. local DoubleCast = false
  162. local StoredPosition = nil
  163. local QStartPos = nil
  164. local DeflectedPosition = nil
  165. local pointLine, pointSegment = nil, nil
  166. local current_distance = nil
  167. local EndPos1, EndPos2 = nil, nil
  168. local SplitQPosition, SplitQHitChance = nil, nil
  169. local pointSegment2, pointLine2, isOnSegment2 = nil, nil, nil
  170. local pointSegment3, pointLine3, isOnSegment3 = nil, nil, nil
  171. local AngleTable = nil
  172. local VectorTable = nil
  173. local VectorTable2 = nil
  174. local CheckPoint = nil
  175. local DoubleQTarget = nil
  176. local lastAnimation = nil
  177. local lastAttack = 0
  178. local lastAttackCD = 0
  179. local ignite
  180. local lastWindUpTime = 0
  181. local eneplayeres = {}
  182. local lastdistance = nil
  183. local LastUnitVector1 = nil
  184. local LastUnitVector2 = nil
  185. local LastDetonateTime = nil
  186. local detonate1 = false
  187. local Qlocktarget = nil
  188. local detonate2 = false
  189. -- if VIP_USER then
  190. -- AdvancedCallback:bind('OnSendPacket', function(packet) OnSendPacket(packet) end)
  191. -- AdvancedCallback:bind('OnLoseBuff', function(unit, buff) OnLoseBuff(unit, buff) end)
  192. -- AdvancedCallback:bind('OnCreateObj', function(unit, buff) OnCreateObj(unit, buff) end)
  193. -- AdvancedCallback:bind('OnDeleteObj', function(unit, buff) OnDeleteObj(unit, buff) end)
  194. -- end
  195.  
  196. function OnLoad()
  197.  
  198.  
  199.  
  200. Menu()
  201. Init()
  202. -- ts = TargetSelector(TARGET_NEAR_MOUSE, 1500, DAMAGE_MAGICAL)
  203. -- ts.name = "Vel'Koz"
  204. -- Config:addTS(ts)
  205. -- EnemyMinions = minionManager(MINION_ENEMY, 1200, myHero, MINION_SORT_MAXHEALTH_DEC)
  206. -- JungleMinions = minionManager(MINION_JUNGLE, 1200, myHero, MINION_SORT_MAXHEALTH_DEC)
  207. if VP.version < 2.404 then
  208. print('You need latest version of VPREDICTION (2.404 or above) for this script to function')
  209. end
  210. end
  211.  
  212. function Init()
  213. --print('Init called')
  214. --Start Vadash Credit
  215. for i = 1, heroManager.iCount do
  216. local hero = heroManager:GetHero(i)
  217. if hero.team ~= player.team then
  218. table.insert(eneplayeres, hero)
  219. kalmanFilters[hero.networkID] = Kalman()
  220. velocityTimers[hero.networkID] = 0
  221. oldPosx[hero.networkID] = 0
  222. oldPosz[hero.networkID] = 0
  223. oldTick[hero.networkID] = 0
  224. velocity[hero.networkID] = 0
  225. lastboost[hero.networkID] = 0
  226. end
  227. end
  228. --End Vadash Credit
  229. ts = TargetSelector(TARGET_LESS_CAST_PRIORITY, 1200, DAMAGE_MAGICAL)
  230. ts2 = TargetSelector(TARGET_LESS_CAST_PRIORITY, 1600, DAMAGE_MAGICAL)
  231. ts3 = TargetSelector(TARGET_NEAR_MOUSE, 1500, DAMAGE_MAGICAL)
  232. ts.name = "Vel'Koz main"
  233. ts2.name = "Q SPLITTING"
  234. ts3.name = "R TARGETTING"
  235. Config:addTS(ts3)
  236. Config:addTS(ts2)
  237. Config:addTS(ts)
  238. EnemyMinions = minionManager(MINION_ENEMY, 1200, myHero, MINION_SORT_MAXHEALTH_DEC)
  239. JungleMinions = minionManager(MINION_JUNGLE, 1200, myHero, MINION_SORT_MAXHEALTH_DEC)
  240. initDone = true
  241. print('Dienofail Velkoz ' .. tostring(version) .. ' loaded!')
  242. end
  243.  
  244. function OnWndMsg(msg,key)
  245. if key == string.byte("Q") and msg == KEY_DOWN and QObject ~= nil and QObject then
  246. -- mark Q key is release
  247. if Config.Extras.Debug then
  248. print('Q key override enabled')
  249. end
  250. Cast2ndQPacket(myHero)
  251. end
  252. end
  253.  
  254. function Menu()
  255. Config = scriptConfig("Velkoz", "velkoz")
  256. Config:addParam("Combo", "Combo", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('C'))
  257. Config:addParam("Harass", "Harass (PRESS)", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('T'))
  258. Config:addParam("Harass2", "Harass (TOGGLE)", SCRIPT_PARAM_ONKEYTOGGLE, false, string.byte('Y'))
  259. Config:addParam("Farm", "Farm", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('V'))
  260. --Config:addParam("ManualQSplit", "QSplit", SCRIPT_PARAM_ONKEYDOWN, false, string.byte('T'))
  261. Config:addParam("TrackR", "Track R ON/OFF", SCRIPT_PARAM_ONOFF, true)
  262. Config:addSubMenu("Combo options", "ComboSub")
  263. Config:addSubMenu("Harass options", "HarassSub")
  264. Config:addSubMenu("Farm", "FarmSub")
  265. Config:addSubMenu("Extra Config", "Extras")
  266. Config:addSubMenu("Draw", "Draw")
  267. --Combo options
  268. Config.ComboSub:addParam("useQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
  269. Config.ComboSub:addParam("useW", "Use W", SCRIPT_PARAM_ONOFF, true)
  270. Config.ComboSub:addParam("useE", "Use E", SCRIPT_PARAM_ONOFF, true)
  271. Config.ComboSub:addParam("Orbwalk", "Orbwalk", SCRIPT_PARAM_ONOFF, true)
  272. Config.ComboSub:addParam("Autoattack", "Autoattack in Orbwalk", SCRIPT_PARAM_ONOFF, true)
  273. --Farm
  274. Config.FarmSub:addParam("useQ", "Use Q", SCRIPT_PARAM_ONOFF, true)
  275. Config.FarmSub:addParam("useW", "Use W", SCRIPT_PARAM_ONOFF, true)
  276. Config.FarmSub:addParam("useE", "Use E", SCRIPT_PARAM_ONOFF, true)
  277. --Harass
  278. Config.HarassSub:addParam("UseWHarass", "Use W", SCRIPT_PARAM_ONOFF, true)
  279. Config.HarassSub:addParam("Orbwalk", "Orbwalk", SCRIPT_PARAM_ONOFF, true)
  280. Config.HarassSub:addParam("Autoattack", "Autoattack in Orbwalk", SCRIPT_PARAM_ONOFF, true)
  281. --Draw
  282. Config.Draw:addParam("DrawQ", "Draw Q Prediction", SCRIPT_PARAM_ONOFF, true)
  283. Config.Draw:addParam("DrawQ2", "Draw Q Angle Prediction", SCRIPT_PARAM_ONOFF, true)
  284. Config.Draw:addParam("DrawW", "Draw W Range", SCRIPT_PARAM_ONOFF, false)
  285. Config.Draw:addParam("DrawE", "Draw E Range", SCRIPT_PARAM_ONOFF, false)
  286. Config.Draw:addParam("DrawR", "Draw R Range", SCRIPT_PARAM_ONOFF, false)
  287. Config.Draw:addParam("DrawTarget", "Draw Target Range", SCRIPT_PARAM_ONOFF, true)
  288. Config.Draw:addParam("DrawRDamage", "Draw R Damage Counter", SCRIPT_PARAM_ONOFF, true)
  289. --Extras
  290. Config.Extras:addParam("Debug", "Debug", SCRIPT_PARAM_ONOFF, false)
  291. Config.Extras:addParam("DetonateQ", "Auto Detonate Q", SCRIPT_PARAM_ONOFF, true)
  292. Config.Extras:addParam("SplitQ", "Calculate Q splitting", SCRIPT_PARAM_ONOFF, true)
  293. Config.Extras:addParam("SplitQMode", "Check Min Q First", SCRIPT_PARAM_ONOFF, false)
  294. Config.Extras:addParam("SplitQDistance", "Split Q Extra Distance", SCRIPT_PARAM_SLICE, 700, 100, 900, 0)
  295. Config.Extras:addParam("SplitQMinimumDistance", "Split Q Minimum Distance", SCRIPT_PARAM_SLICE, 250, 200, 900, 0)
  296. Config.Extras:addParam("SplitQMaximumDistance", "Split Q Maximum Distance To Check", SCRIPT_PARAM_SLICE, 1000, 500, 1100, 0)
  297. Config.Extras:addParam("SplitQDelay", "Split Q Delay (miliseconds)", SCRIPT_PARAM_SLICE, 66, 50, 350, 0)
  298. Config.Extras:addParam("CheckAngle", "Attempt to Check Angles", SCRIPT_PARAM_ONOFF, true)
  299. Config.Extras:addParam("CheckAngleOnly", "Only use Check Angles Prediction", SCRIPT_PARAM_ONOFF, false)
  300. Config.Extras:addParam("MaxAngle", "Max Angle for Q Check", SCRIPT_PARAM_SLICE, 30, 1, 90, 0)
  301. Config.Extras:addParam("AngleIncrement", "Increment Angle Degree", SCRIPT_PARAM_SLICE, 5, 1, 90, 0)
  302. Config.Extras:addParam("DoubleQ", "Attempt multiple target Q checks (WILL LAG)", SCRIPT_PARAM_ONOFF, true)
  303. Config.Extras:addParam("DoubleQDistance", "Multiple Q check distance interval", SCRIPT_PARAM_SLICE, 50, 1, 300, 0)
  304. Config.Extras:addParam("FocusRTarget", "Focus Initial R Target", SCRIPT_PARAM_ONOFF, true)
  305. Config.Extras:addParam("MinHitchance", "Minimum Hit Chance", SCRIPT_PARAM_SLICE, 1, 0, 5, 0)
  306. Config.Extras:addParam("MinSplitQHitchance", "Minimum Initial Split Q Hit Chance", SCRIPT_PARAM_SLICE, 2, 0, 5, 0)
  307. Config.Extras:addParam("RDelay", "R Delay", SCRIPT_PARAM_SLICE, 100, 0, 500, 0)
  308. Config.Extras:addParam("BlockR", "Block packets during R cast", SCRIPT_PARAM_ONOFF, false)
  309. Config.Extras:addParam("EGapClosers", "E Gap Closers", SCRIPT_PARAM_ONOFF, true)
  310. Config:permaShow("Combo")
  311. Config:permaShow("Farm")
  312. Config:permaShow("Harass")
  313. Config:permaShow("Harass2")
  314. end
  315.  
  316.  
  317. function OnTick()
  318. --print(initDone)
  319. UpdateSpeed()
  320. UpdateVector()
  321. Check()
  322. CurrentTick = GetTickCount()
  323. --Cast2ndR()
  324. if initDone then
  325. ts:update()
  326. ts2:update()
  327. ts3:update()
  328. EnemyMinions:update()
  329. JungleMinions:update()
  330. target = ts.target
  331. if not target then target = nil end
  332. target2 = ts2.target
  333. target3 = ts3.target
  334. if not target2 then
  335. target2 = nil
  336. Best_Position = nil
  337. DoubleQTarget = nil
  338. Qlocktarget = nil
  339. --BlockQ = false
  340. end
  341.  
  342.  
  343.  
  344. if Config.Extras.DoubleQ and QObject ~= nil and Config.Extras.DetonateQ and target2 ~= nil and DoubleQTarget ~= nil then
  345. SplitQ(target2)
  346. SplitQ(DoubleQTarget)
  347. elseif Qlocktarget ~= nil and QObject ~= nil and Config.Extras.DetonateQ then
  348. SplitQ(Qlocktarget)
  349. elseif target ~= nil and QObject ~= nil and Config.Extras.DetonateQ then
  350. SplitQ(target)
  351. elseif target2 ~= nil and Config.Extras.DetonateQ and QObject ~= nil then
  352. SplitQ(target2)
  353. else
  354. LastDetonateTime = nil
  355. LastUnitVector1 = nil
  356. LastUnitVector2 = nil
  357. detonate2 = false
  358. detonate1 = false
  359. EndPos1 = nil
  360. EndPos2 = nil
  361. end
  362.  
  363. if target2 ~= nil and Config.Extras.SplitQ and Config.Extras.CheckAngle and Config.Extras.DrawQ2 and not BlockQ then
  364. DeflectedPosition = CalculateDeflectedCastPosition(target2)
  365. end
  366. -- if Config.Extras.Debug and target ~= nil then
  367. -- print(target.charName)
  368. -- end
  369. -- ContinueR(mousePos)
  370.  
  371. if Config.Combo then
  372. if ValidTarget(target) then
  373. Combo(target)
  374. elseif ValidTarget(target2) then
  375. CastQ(target2)
  376. end
  377. end
  378.  
  379. if (Config.Harass or Config.Harass2) and ValidTarget(target) then
  380. if ValidTarget(target) then
  381. Harass(target)
  382. elseif ValidTarget(target2) then
  383. CastQHarass(target2)
  384. end
  385. end
  386.  
  387. if Config.Farm then
  388. Farm()
  389. end
  390.  
  391. if Config.Combo and Config.ComboSub.Orbwalk and Config.ComboSub.Autoattack then
  392. if target and ValidTarget(target) and GetDistance(target) < 560 then
  393. OrbWalking(target)
  394. else
  395. moveToCursor()
  396. end
  397. end
  398. if Config.Harass and Config.HarassSub.Orbwalk then
  399. if target and ValidTarget(target) and GetDistance(target) < 560 and Config.HarassSub.Autoattack then
  400. OrbWalking(target)
  401. else
  402. moveToCursor()
  403. end
  404. end
  405. if Config.Extras.EGapClosers then
  406. CheckDashes()
  407. end
  408. end
  409. IgniteKS()
  410. end
  411.  
  412. function OnProcessSpell(unit, spell)
  413. if unit.isMe and spell.name == 'VelkozQ' then
  414. BlockQ = true
  415. --LastPacketBlock = false
  416. end
  417. -- if unit.isMe and spell.name == 'velkozqsplitactive' then
  418. -- BlockQ = false
  419. -- end
  420. -- if unit.isMe and spell.name == 'VelkozR' then
  421. -- isPressedR = true
  422. -- end
  423. if unit.isMe then
  424. if spell.name:lower():find("attack") then
  425. lastAttack = GetTickCount() - GetLatency()/2
  426. lastWindUpTime = spell.windUpTime*1000
  427. lastAttackCD = spell.animationTime*1000
  428. end
  429. end
  430. end
  431.  
  432. function Combo(Target)
  433. if Target ~= nil and ValidTarget(Target, 1500) then
  434. if EReady and Config.ComboSub.useE then
  435. CastE(Target)
  436. elseif WReady and Config.ComboSub.useW then
  437. CastW(Target)
  438. elseif QReady and Config.ComboSub.useQ then
  439. CastQ(Target)
  440. -- elseif RReady and Config.ComboSub.useR then
  441. -- --CastRCombo(Target)
  442. -- end
  443. end
  444. end
  445. end
  446.  
  447. function Harass(Target)
  448. if Target ~= nil and ValidTarget(Target, 1500) then
  449. if WReady and Config.HarassSub.UseWHarass then
  450. CastW(Target)
  451. elseif QReady then
  452. CastQHarass(Target)
  453. -- elseif RReady and Config.ComboSub.useR then
  454. -- --CastRCombo(Target)
  455. -- end
  456. end
  457. end
  458. end
  459.  
  460. function Farm()
  461. if Config.FarmSub.useQ then
  462. FarmQ()
  463. end
  464. if Config.FarmSub.useW then
  465. FarmW()
  466. end
  467. if Config.FarmSub.useE then
  468. FarmE()
  469. end
  470.  
  471. end
  472.  
  473. function CastQ(Target)
  474. if not Config.Extras.SplitQ and not BlockQ and HaveMediumVelocity(Target, 600) then
  475. local CastPosition, HitChance, Position = VP:GetLineCastPosition(Target, SpellQ.Delay, SpellQ.Width, SpellQ.Range, SpellQ.Speed, myHero, true)
  476. if CastPosition ~= nil and HitChance ~= nil and GetDistance(CastPosition, myHero) < SpellQ.Range and HitChance >= Config.Extras.MinHitchance and QReady then
  477. CastSpell(_Q, CastPosition.x, CastPosition.z)
  478. end
  479. elseif not BlockQ and HaveMediumVelocity(Target, 600) then
  480. local Best_Position = CalculateBestInitialCastPosition(Target)
  481. if Best_Position ~= nil then
  482. CastSpell(_Q, Best_Position.x, Best_Position.z)
  483. Qlocktarget = Target
  484. end
  485. end
  486. end
  487.  
  488. function CastQHarass(Target)
  489. if not Config.Extras.SplitQ and not BlockQ and HaveLowVelocity(Target, 750) then
  490. local CastPosition, HitChance, Position = VP:GetLineCastPosition(Target, SpellQ.Delay, SpellQ.Width, SpellQ.Range, SpellQ.Speed, myHero, true)
  491. if CastPosition ~= nil and HitChance ~= nil and GetDistance(CastPosition, myHero) < SpellQ.Range and HitChance >= Config.Extras.MinHitchance and QReady then
  492. CastSpell(_Q, CastPosition.x, CastPosition.z)
  493. end
  494. elseif not BlockQ and HaveLowVelocity(Target, 750) then
  495. local Best_Position = CalculateBestInitialCastPosition(Target)
  496. if Best_Position ~= nil then
  497. CastSpell(_Q, Best_Position.x, Best_Position.z)
  498. end
  499. end
  500.  
  501. end
  502.  
  503. function CastW(Target)
  504. local CastPosition, HitChance, Position = VP:GetLineCastPosition(Target, SpellW.Delay, SpellW.Width, SpellW.Range, SpellW.Speed, myHero, false)
  505. if CastPosition ~= nil and HitChance ~= nil and GetDistance(CastPosition, myHero) < SpellW.Range and HitChance >= Config.Extras.MinHitchance and WReady then
  506. CastSpell(_W, CastPosition.x, CastPosition.z)
  507. end
  508. end
  509.  
  510. function CastE(Target)
  511. local CastPosition, HitChance, Position = VP:GetCircularAOECastPosition(Target, SpellE.Delay, SpellE.Width, SpellE.Range, SpellE.Speed, myHero)
  512. if CastPosition ~= nil and HitChance ~= nil and GetDistance(CastPosition, myHero) < SpellE.Range and HitChance >= Config.Extras.MinHitchance and EReady then
  513. CastSpell(_E, CastPosition.x, CastPosition.z)
  514. end
  515. end
  516.  
  517. function CastRCombo(Target)
  518. local CastPosition, HitChance, Position = VP:GetLineCastPosition(Target, 1, SpellR.Width, SpellR.Range, SpellR.Speed, myHero, false)
  519. if HitChance ~= nil and CastPosition ~= nil and ValidTarget(Target) and GetDistance(Target, myHero) < 1500 and not isPressedR and HitChance > 1 then
  520. Cast1stR(Target)
  521. InitialTarget = Target
  522. end
  523. -- elseif isPressedR then
  524. -- if Target ~= InitialTarget and GetDistance(InitialTarget, myHero) < 1500 and Config.Extras.FocusRTarget then
  525. -- Cast2ndR(InitialTarget)
  526. -- elseif GetDistance(Target, myHero) < 1500 then
  527. -- Cast2ndR(Target)
  528. -- else
  529. -- Cast2ndR(mousePos)
  530. -- end
  531. -- end
  532. end
  533.  
  534. function ContinueR(Target)
  535. -- if Config.Extras.Debug then
  536. -- print('Continuing R')
  537. -- end
  538. --Cast2ndR()
  539. -- if ValidTarget(Target) and ValidTarget(InitialTarget) and Target ~= InitialTarget and GetDistance(InitialTarget, myHero) < 1500 and Config.Extras.FocusRTarget then
  540. -- Cast2ndR(InitialTarget)
  541. -- if Config.Extras.Debug then
  542. -- print('Continuing R initial target')
  543. -- end
  544. -- elseif GetDistance(Target, myHero) < 1500 thenm
  545. -- Cast2ndR(Target)
  546. -- if Config.Extras.Debug then
  547. -- print('Continuing R 2nd target')
  548. -- end
  549. -- else
  550. -- Cast2ndR(mousePos)
  551. -- if Config.Extras.Debug then
  552. -- print('Continuing R mouse pos')
  553. -- end
  554. -- end
  555. end
  556.  
  557.  
  558. function UpdateVector()
  559. if QObject ~= nil and QEndObject ~= nil then
  560. -- if Config.Extras.Debug then
  561. -- print('Update Vector called!')
  562. -- end
  563. OriginalCastVector1 = (Vector(QEndObject) - QStartPos):normalized()
  564. -- if Config.Extras.Debug then
  565. -- print(OriginalCastVector1)
  566. -- end
  567. current_distance = GetDistance(QObject, QEndObject)
  568. OriginalCastVector2 = Vector(QObject) + OriginalCastVector1*(current_distance+50)
  569. RotatedUnitVector1 = OriginalCastVector1:perpendicular()
  570. RotatedUnitVector2 = OriginalCastVector1:perpendicular2()
  571. RotatedVector1 = Vector(QObject) + RotatedUnitVector1 * Config.Extras.SplitQDistance
  572. RotatedVector2 = Vector(QObject) + RotatedUnitVector2 * Config.Extras.SplitQDistance
  573. end
  574. end
  575.  
  576. --Credit Honda7
  577. function DrawLine(From, To, Color)
  578. DrawLine3D(From.x, From.y, From.z, To.x, To.y, To.z, 1, Color)
  579. end
  580.  
  581. function Cast1stR(Target)
  582. if GetDistance(Target, myHero) < SpellR.Range and not isPressedR and buffer == false then
  583. CastSpell(_R, Target.x, Target.z)
  584. buffer = true
  585. DelayAction(function() buffer = false end, 0.5)
  586. if Config.Extras.Debug then
  587. print('Cast1stRCalled')
  588. end
  589. end
  590. end
  591.  
  592.  
  593.  
  594.  
  595.  
  596. function CalculateDeflectedCastPosition(Target)
  597. local tempdelay = GetDistance(Target)/SpellQ.Speed
  598. local PredictedPos3, PredictedHitChance3 = VP:GetPredictedPos(Target, 0.300+tempdelay, math.huge, myHero, false)
  599. if PredictedPos3 ~= nil and PredictedHitChance3 ~= nil then
  600. local pointSegment1, pointLine1, isOnSegment1 = VectorPointProjectionOnLineSegment(Vector(Target), Vector(PredictedPos3), Vector(myHero))
  601. if Config.Extras.Debug then
  602. --print(pointSegment1)
  603. --print(pointLine)
  604. --print(isOnSegment)
  605. --print(GetDistance(pointLine))
  606. end
  607. local myHeroPoint = { x = myHero.x, y = myHero.z}
  608. local newpointSegment1 = {x = pointSegment1.x, y = myHero.y, z = pointSegment1.y}
  609. local newpointLine1 = {x = pointLine1.x, y= myHero.y, z = pointLine1.y}
  610. local predictedpoint = {x = PredictedPos3.x, y = PredictedPos3.z}
  611. local refactored_newpointline = Vector(myHero) + Vector(Vector(newpointLine1) - Vector(myHero)):normalized()*SpellQ.Range
  612. local collision1 = VP:CheckMinionCollision(myHero, newpointLine1, (GetDistance(myHero, newpointSegment1)/SpellQ.Speed) + SpellQ.Delay, SpellQ.Width, GetDistance(myHero, newpointSegment1), SpellQ.Speed, myHero, false)
  613. local collision2 = VP:CheckMinionCollision(myHero, newpointSegment1, (GetDistance(PredictedPos3, newpointSegment1)/QSplitSpeed) + SpellQ.Delay + (GetDistance(myHero, newpointSegment1)/SpellQ.Speed), SpellQ.Width, GetDistance(PredictedPos3, newpointSegment1), QSplitSpeed, newpointSegment1, false)
  614. if not collision1 and not collision2 and pointSegment1.x and PredictedHitChance3 >= Config.Extras.MinHitchance and Config.Extras.SplitQMode and GetDistance(PredictedPos3, newpointLine1) < Config.Extras.SplitQDistance and GetDistance(myHero, newpointLine1) < SpellQ.Range and GetDistance(myHero, newpointLine1) >= Config.Extras.SplitQMinimumDistance then
  615. pointSegment, pointLine, isOnSegment = newpointSegment1, newpointLine1, isOnSegment1
  616. if Config.Extras.Debug then
  617. --print('Case 2 returned value')
  618. end
  619. return refactored_newpointline
  620. --return nil
  621. else
  622. pointSegment, pointLine, isOnSegment = nil, nil, nil
  623. if Config.Extras.Debug then
  624. --print('Case 3 called')
  625. end
  626. if Config.Extras.CheckAngle and Config.Extras.MaxAngle > 0 and Config.Extras.AngleIncrement > 0 and PredictedHitChance3 >= Config.Extras.MinSplitQHitchance then
  627. local iter = math.ceil(Config.Extras.MaxAngle/Config.Extras.AngleIncrement)
  628. for i= 1, iter do
  629. if Config.Extras.Debug then
  630. --print(i*Config.Extras.AngleIncrement*0.0174532925)
  631. end
  632. table.insert(AngleTable, i*Config.Extras.AngleIncrement*0.0174532925)
  633. table.insert(AngleTable, 2*math.pi - i*Config.Extras.AngleIncrement*0.0174532925)
  634. end
  635. ToRotateVector = Vector(Vector(PredictedPos3) - Vector(myHero)):normalized()*SpellQ.Range
  636. if Config.Extras.Debug then
  637. --print('Rotated vector generated')
  638. --print(ToRotateVector)
  639. end
  640. if ToRotateVector ~= nil then
  641. for idx, val in ipairs(AngleTable) do
  642. if Config.Extras.Debug then
  643. --print('Rotating at ' .. tostring(val))
  644. end
  645. local ToInsertVector = ToRotateVector:rotated(val, 0.001, val)
  646. --CheckPoint = Vector(myHero) + Vector(ToInsertVector)
  647. table.insert(VectorTable2, ToInsertVector)
  648. -- if Config.Extras.Debug then
  649. -- print('insertvector is' .. tostring(ToInsertVector.x) .. "\t" .. tostring(ToInsertVector.z))
  650. -- print(#VectorTable2)
  651. -- print(ToRotateVector:angle(ToInsertVector))
  652. -- end
  653. if idx == 3 then
  654. CheckPoint = Vector(myHero) + Vector(ToInsertVector)
  655. -- if Config.Extras.Debug then
  656. -- print('insertvector is' .. tostring(ToInsertVector.x) .. "\t" .. tostring(ToInsertVector.z))
  657. -- print(#VectorTable2)
  658. -- print(ToRotateVector:angle(ToInsertVector))
  659. -- end
  660. --return CheckPoint
  661. end
  662. TempSegment, TempLine, TempIsOnSegment = VectorPointProjectionOnLineSegment(Vector(myHero), Vector(Vector(myHero) + ToInsertVector), Vector(PredictedPos3))
  663. local TempSegment3D = {x=TempSegment.x, y=myHero.y, z=TempSegment.y}
  664. local TempLine3D = {x=TempLine.x, y=myHero.y, z=TempLine.y}
  665. -- local myherotemppos = {x=myHero.x, y=myHero.z}
  666. -- local enemytemppos = {x=Target.x, y=Target.z}
  667. -- local pushvector1 = Vector(myHero)
  668. -- local pushvector2 = {x=TempSegment.x - myHero.x, y=myHero.y, z=TempSegment.y - myHero.z}
  669. -- local topush = {pushvector1, pushvector2}
  670. -- -- if Config.Extras.Debug then
  671. -- -- print('Pushing to Vector table' .. tostring(topush[1].x))
  672. -- -- print(#VectorTable)
  673. -- -- end
  674. -- table.insert(VectorTable, topush)
  675. -- if Config.Extras.Debug then
  676. -- print(' TempSegment3D is' .. tostring(TempSegment3D.x) .. "\t" .. tostring(TempSegment3D.z))
  677. -- -- print(#VectorTable2)
  678. -- -- print(ToRotateVector:angle(ToInsertVector))
  679. -- end
  680. refactored_TempSegment3D = Vector(myHero) + Vector(Vector(TempSegment3D) - Vector(myHero)):normalized()*SpellQ.Range
  681. if TempIsOnSegment and TempSegment3D ~= nil and TempLine3D ~= nil then
  682. if TempIsOnSegment then
  683. local newdelay = (GetDistance(myHero, TempSegment3D)/SpellQ.Speed) + (GetDistance(TempSegment3D, PredictedPos3))/SpellQ.Speed + Config.Extras.SplitQDelay/1000 + SpellQ.Delay
  684. local col1 = VP:CheckMinionCollision(myHero, TempSegment3D, SpellQ.Delay, SpellQ.Width, GetDistance(myHero, TempSegment3D), SpellQ.Speed, myHero, false)
  685. local col2 = VP:CheckMinionCollision(myHero, PredictedPos3, (GetDistance(myHero, TempSegment3D)/SpellQ.Speed) + Config.Extras.SplitQDelay/1000 + SpellQ.Delay, SpellQ.Width, Config.Extras.SplitQDistance, QSplitSpeed, TempSegment3D, false)
  686. if Config.Extras.Debug then
  687. --print(' TempSegment3D is' .. tostring(col1) .. "\t" .. tostring(col2) .. "\t" .. tostring(newdelay))
  688. --print('Refactored TempSegment3D ' .. tostring(GetDistance(refactored_TempSegment3D)))
  689. -- print(#VectorTable2)
  690. -- print(ToRotateVector:angle(ToInsertVector))
  691. end
  692. if not col1 and not col2 and GetDistance(TempSegment3D) > Config.Extras.SplitQMinimumDistance and GetDistance(TempSegment3D, PredictedPos3) < Config.Extras.SplitQDistance and GetDistance(TempSegment3D, myHero) < Config.Extras.SplitQMaximumDistance then
  693. if Config.Extras.Debug then
  694. --print('Case 3 returned')
  695. end
  696. return refactored_TempSegment3D
  697. -- local placeholder2, hitchance2, pos2 = VP:GetPredictedPos(Target, newdelay, math.huge, myHero, false)
  698. -- local TempPos43D = {x=pos2.x, y=myHero.y, z=pos2.y}
  699. -- if hitchance2 >= Config.Extras.MinHitchance then
  700. -- local TempSegment2, TempLine2, TempIsOnSegment2 = VectorPointProjectionOnLineSegment(Vector(myHero), Vector(pos2), Vector(refactored_TempSegment3D))
  701. -- local TempSegment23D = {x=TempSegment2.x, y=myHero.y, z=TempSegment2.y}
  702. -- if TempSegment23D ~= nil and GetDistance(TempSegment23D, myHero) < SpellQ.Range and GetDistance(pos2, TempSegment23D) < Config.Extras.SplitQMinimumDistance then
  703. -- return TempSegment23D
  704. -- end
  705. -- end
  706. end
  707. end
  708. end
  709. end
  710. end
  711. end
  712. end
  713.  
  714. -- return nil
  715. end
  716. -- local col1 = VP:CheckMinionCollision(pointSegment, 0.400, SpellQ.Width, Config.Extras.SplitQDistance, SpellQ.Speed, myHero)
  717. -- local col2 = VP:CheckMinionCollision(pointLine, 0.400, SpellQ.Width, Config.Extras.SplitQDistance, SpellQ.Speed, myHero)
  718. -- local col3 = VP:CheckMinionCollision(pointSegment, 0.600, SpellQ.Width, Config.Extras.SplitQDistance, SpellQ.Speed, pointLine)
  719. -- if Config.Extras.Debug then
  720. -- print(col1)
  721. -- print(col2)
  722. -- print(col3)
  723. -- end
  724. -- if isOnSegment ~= nil and pointSegment ~= nil and isOnSegment and GetDistance(pointSegment) < SpellQ.range and col1 == false and PredictedHitChance >= Config.Extras.MinHitchance then
  725. -- ShouldCastPosition = Vector(myHero) + SpellQ.Range * (Vector(pointSegment) - Vector(myHero)):normalized()
  726. -- StoredPosition = ShouldCastPosition
  727. -- if Config.Extras.Debug then
  728. -- print('Single Q 2nd case found (segment)')
  729. -- end
  730. -- return ShouldCastPosition
  731. -- elseif not isOnSegment and pointLine and GetDistance(pointLine, myHero) < SpellQ.range and col2 == false and col3 == false then
  732. -- ShouldCastPosition = Vector(myHero) + SpellQ.Range * (Vector(pointLine) - Vector(myHero)):normalized()
  733. -- StoredPosition = ShouldCastPosition
  734. -- if Config.Extras.Debug then
  735. -- print('Single Q 2nd case found (line)')
  736. -- end
  737. -- return ShouldCastPosition
  738. -- else
  739. -- return nil
  740. -- end
  741. end
  742.  
  743. function CheckQWillHit(startvec, endvec, Target, mode)
  744. local qpointSegment, qpointLine, qIsOnSegment = VectorPointProjectionOnLineSegment(Vector(startvec), Vector(endvec), Vector(Target))
  745. if qpointSegment ~= nil and qpointSegment.x and qIsOnSegment then
  746. local qpointSegment3D = {x=qpointSegment.x, y=Target.y, z=qpointSegment.y}
  747. if GetDistance(Target,qpointSegment3D) < 45 + VP:GetHitBox(Target) then
  748. if mode then
  749. return true
  750. else
  751. return qpointSegment3D
  752. end
  753. end
  754. else
  755. if mode then
  756. return false
  757. else
  758. return nil
  759. end
  760. end
  761. end
  762.  
  763. function CalculateDoubleQPosition(Target)
  764. local ShouldCastPosition= nil
  765. local Enemies = GetEnemyHeroes()
  766. local tocheckpairs = {}
  767. if Config.Extras.DoubleQ then
  768. for index, value in ipairs(Enemies) do
  769. if value.networkID ~= Target.networkID and GetDistance(Target, value) < 2*Config.Extras.SplitQDistance+150 then
  770. -- local Throwaway, CollisionChance = VP:GetPredictedPos(value, 0.600, math.huge, Target, true) --check to see if line connecting the two will have minion collision
  771. -- if CollisionChance >= Config.Extras.MinSplitQHitchance then
  772. table.insert(tocheckpairs, value)
  773. if Config.Extras.Debug then
  774. --print('Double Q champion inserted')
  775. end
  776. --end
  777. end
  778. end
  779. for _, champion in ipairs(tocheckpairs) do
  780. if Config.Extras.Debug then
  781. --print(champion.charName)
  782. end
  783. local current_distance = Config.Extras.SplitQMinimumDistance
  784. while current_distance < SpellQ.Range do
  785. local current_delay = current_distance/SpellQ.Speed + SpellQ.Delay + Config.Extras.SplitQDelay/1000
  786. local enemyPos1, enemyHitchance1 = VP:GetPredictedPos(Target, current_delay, math.huge, myHero, false)
  787. local enemyPos2, enemyHitchance2 = VP:GetPredictedPos(champion, current_delay, math.huge, myHero, false)
  788. if enemyPos1 ~= nil and enemyPos2 ~= nil and enemyHitchance1 ~= nil and enemyHitchance2 ~= nil and GetDistance(enemyPos1) < 1400 and GetDistance(enemyPos2) < 1400 then
  789. local fromposition = Vector(enemyPos1):center(Vector(enemyPos2))
  790. local fromposition_refactored = Vector(myHero) + Vector(Vector(fromposition) - Vector(myHero)):normalized()*SpellQ.Range
  791. if Config.Extras.Debug then
  792. --print(fromposition_refactored)
  793. end
  794. local col = VP:CheckMinionCollision(myHero, fromposition, SpellQ.Delay, SpellQ.Width, GetDistance(myHero, fromposition), SpellQ.Speed, myHero, false)
  795. if not col then
  796. local ExtendedQVector = Vector(Vector(fromposition) - Vector(myHero)):normalized()
  797. local EnemyQUnitVector1 = ExtendedQVector:perpendicular()
  798. local EnemyQUnitVector2 = ExtendedQVector:perpendicular2()
  799. local EnemyQVector1 = Vector(fromposition) + EnemyQUnitVector1*Config.Extras.SplitQDistance
  800. local EnemyQVector2 = Vector(fromposition) + EnemyQUnitVector2*Config.Extras.SplitQDistance
  801. local col2 = VP:CheckMinionCollision(myHero, EnemyQVector1, SpellQ.Delay + Config.Extras.SplitQDelay/1000 + (GetDistance(myHero,fromposition)/SpellQ.Speed), SpellQ.Width, GetDistance(EnemyQVector1, fromposition), QSplitSpeed, fromposition, false)
  802. local col3 = VP:CheckMinionCollision(myHero, EnemyQVector2, SpellQ.Delay + Config.Extras.SplitQDelay/1000 + (GetDistance(myHero,fromposition)/SpellQ.Speed), SpellQ.Width, GetDistance(EnemyQVector2, fromposition), QSplitSpeed, fromposition, false)
  803. if not col2 and not col3 then
  804. if (CheckQWillHit(fromposition, EnemyQVector1, Target, true) or CheckQWillHit(fromposition, EnemyQVector1, champion, true)) and (CheckQWillHit(fromposition, EnemyQVector2, Target, true) or CheckQWillHit(fromposition, EnemyQVector2, champion, true)) then
  805. local fromposition_refactored = Vector(myHero) + Vector(Vector(fromposition) - Vector(myHero)):normalized()*SpellQ.Range
  806. DoubleQTarget = champion
  807. if Config.Extras.Debug then
  808. --print('Double Q champion returned with ' .. tostring(champion.charName))
  809. end
  810. return fromposition_refactored
  811. end
  812. end
  813. end
  814. end
  815.  
  816. -- local Pos1, HitChance1 = VP:GetPredictedPos(Target, current_delay, math.huge, fromposition, true)
  817. -- local Pos2, HitChance2 = VP:GetPredictedPos(champion, current_delay, math.huge, fromposition, true)
  818.  
  819.  
  820. -- if Config.Extras.Debug then
  821. -- print('Double Q Pos Generated at ' .. tostring(Pos1) .. "\t" .. tostring(Pos2) .. "\n")
  822. -- end
  823. -- if HitChance1 >= Config.Extras.MinHitchance and HitChance1 >= Config.Extras.MinHitchance and Pos1 ~= nil and Pos2 ~= nil and GetDistance(Pos1) < SpellQ.Range and GetDistance(Pos2) < SpellQ.Range then
  824. -- local pointSegment, pointLine, isOnSegment = VectorPointProjectionOnLineSegment(Vector(Pos1), Vector(Pos2), Vector(myHero))
  825. -- if isOnSegment and GetDistance(isOnSegment) < SpellQ.Range then
  826. -- ShouldCastPosition = Vector(myHero) + SpellQ.Range * (Vector(pointSegment) - Vector(myHero)):normalized()
  827. -- if Config.Extras.Debug then
  828. -- print('Double Q ShouldCastPositionfound')
  829. -- end
  830. -- DoubleCast = true
  831. -- StoredPosition = ShouldCastPosition
  832. -- return ShouldCastPosition
  833. -- end
  834. -- end
  835. current_distance = current_distance + Config.Extras.DoubleQDistance
  836. end
  837. end
  838. end
  839. return nil
  840. end
  841.  
  842.  
  843. function CalculateBestInitialCastPosition(Target)
  844. local ShouldCastPosition= nil
  845. local Enemies = GetEnemyHeroes()
  846. local tocheckpairs = {}
  847. if Config.Extras.SplitQ then
  848. --Trivial Case - Target lies with no collision -> and within Q range
  849. -- if Config.Extras.Debug then
  850. -- print('Single Q called')
  851. -- end
  852. if Config.Extras.DoubleQ then
  853. ShouldCastPosition = CalculateDoubleQPosition(Target)
  854. if ShouldCastPosition ~= nil then
  855. return ShouldCastPosition
  856. end
  857. end
  858. local CastPosition, HitChance, Position = VP:GetLineCastPosition(Target, SpellQ.Delay, SpellQ.Width, SpellQ.Range, SpellQ.Speed, myHero, true)
  859. if HitChance >= Config.Extras.MinHitchance and not Config.Extras.CheckAngleOnly then
  860. ShouldCastPosition = Vector(myHero) + SpellQ.Range * (Vector(CastPosition) - Vector(myHero)):normalized()
  861. DoubleCast = false
  862. StoredPosition = nil
  863. if Config.Extras.Debug then
  864. print('Single Q trivial case found')
  865. end
  866. return ShouldCastPosition
  867. else
  868. --Easiest case: Find predicted vector -> cast at orthogonal point on infinite line
  869. local PredictedPos2 = CalculateDeflectedCastPosition(Target)
  870. --ShouldCastPosition = Vector(myHero) + SpellQ.Range*(Vector(PredictedPos2) - Vector(myHero)):normalized()
  871. StoredPosition = PredictedPos2
  872. return PredictedPos2
  873. end
  874. end
  875. return nil
  876. end
  877.  
  878. function SplitQ(Target)
  879. Throwaway, SplitQHitChance, SplitQPosition = VP:GetLineCastPosition(Target, Config.Extras.SplitQDelay/1000, 45, Config.Extras.SplitQDistance, QSplitSpeed, QObject, true)
  880. if SplitQHitChance >= 0 and SplitQPosition ~= nil then
  881. EndPos1 = Vector(RotatedVector1)
  882. EndPos2 = Vector(RotatedVector2)
  883. pointSegment2, pointLine2, isOnSegment2 = VectorPointProjectionOnLineSegment(Vector(QObject), Vector(EndPos1), Vector(SplitQPosition))
  884. pointSegment3, pointLine3, isOnSegment3 = VectorPointProjectionOnLineSegment(Vector(QObject), Vector(EndPos2), Vector(SplitQPosition))
  885. local newPos = {x=SplitQPosition.x, y=SplitQPosition.z}
  886. if Config.Extras.Debug then
  887. -- print(GetDistance(newPos, pointSegment2))
  888. -- print(GetDistance(newPos, pointSegment3))
  889. end
  890.  
  891. -- if isOnSegment2 then
  892. -- if lastdistance == nil then
  893. -- lastdistance = GetDistance(newPos, pointSegment2)
  894. -- elseif GetDistance(newPos, pointSegment2) - lastdistance < 55 then
  895. -- lastdistance = GetDistance(newPos, pointSegment2)
  896. -- else
  897. -- Cast2ndQPacket(Target)
  898. -- if Config.Extras.Debug then
  899. -- print('Failsafe Split Q 1')
  900. -- end
  901. -- end
  902. -- elseif isOnSegment3 then
  903. -- if lastdistance == nil then
  904. -- lastdistance = GetDistance(newPos, pointSegment3)
  905. -- elseif GetDistance(newPos, pointSegment2) - lastdistance < 55 then
  906. -- lastdistance = GetDistance(newPos, pointSegment3)
  907. -- else
  908. -- Cast2ndQPacket(Target)
  909. -- if Config.Extras.Debug then
  910. -- print('Faile Split Q 1')
  911. -- end
  912. -- end
  913. -- end
  914.  
  915.  
  916.  
  917.  
  918. if isOnSegment2 and GetDistance(newPos, pointSegment2) < 50 + VP:GetHitBox(Target) then
  919. Cast2ndQPacket(Target)
  920. detonate1 = true
  921. BlockQ = false
  922. CastSpell(_Q)
  923. if Config.Extras.Debug then
  924. print('Split Q 1')
  925. end
  926.  
  927. elseif isOnSegment3 and GetDistance(newPos, pointSegment3) < 50 + VP:GetHitBox(Target) then
  928. Cast2ndQPacket(Target)
  929. detonate2 = true
  930. BlockQ = false
  931. CastSpell(_Q)
  932. if Config.Extras.Debug then
  933. print('Split Q 2')
  934. end
  935. end
  936.  
  937.  
  938. if isOnSegment2 then
  939. local current_unit_vector1 = Vector(Vector(newPos) - Vector(pointSegment2)):normalized()
  940. if LastUnitVector1 ~= nil then
  941. if Config.Extras.Debug then
  942. print('Angle1 is ' ..LastUnitVector2:angle(current_unit_vector1))
  943. end
  944. if LastUnitVector1:angle(current_unit_vector1) > math.pi/3 then
  945. Cast2ndQPacket(Target)
  946. detonate1 = true
  947. BlockQ = false
  948. CastSpell(_Q)
  949. if Config.Extras.Debug then
  950. print('Split Q 3')
  951. end
  952. else
  953. LastUnitVector1 = current_unit_vector1
  954. end
  955. else
  956. LastUnitVector1 = current_unit_vector1
  957. end
  958. elseif isOnSegment3 then
  959. local current_unit_vector2 = Vector(Vector(newPos) - Vector(pointSegment3)):normalized()
  960. if LastUnitVector2 ~= nil then
  961. if Config.Extras.Debug then
  962. print('Angle2 is ' ..LastUnitVector2:angle(current_unit_vector2))
  963. end
  964. if LastUnitVector2:angle(current_unit_vector2) > math.pi/3 then
  965. Cast2ndQPacket(Target)
  966. detonate2 = true
  967. BlockQ = false
  968. CastSpell(_Q)
  969. if Config.Extras.Debug then
  970. print('Split Q 4')
  971. end
  972. else
  973. LastUnitVector2 = current_unit_vector2
  974. end
  975. else
  976. LastUnitVector2 = current_unit_vector2
  977. end
  978. end
  979. end
  980. end
  981.  
  982. --Farm Stuff--
  983.  
  984. --Start Credit Honda7
  985. function FarmW()
  986. if WReady and #EnemyMinions.objects > 0 then
  987. local WPos = GetBestWPositionFarm()
  988. if WPos then
  989. CastSpell(_W, WPos.x, WPos.z)
  990. end
  991. end
  992. end
  993.  
  994. function FarmE()
  995. if EReady and #EnemyMinions.objects > 0 then
  996. local EPos = GetBestEPositionFarm()
  997. if EPos then
  998. CastSpell(_E, EPos.x, EPos.z)
  999. end
  1000. end
  1001. end
  1002.  
  1003. function FarmQ()
  1004. if QReady and #EnemyMinions.objects > 0 then
  1005. local QPos = GetBestQPositionFarm()
  1006. if QPos then
  1007. CastSpell(_Q, QPos.x, QPos.z)
  1008. end
  1009. end
  1010. end
  1011.  
  1012. function countminionshitW(pos)
  1013. local n = 0
  1014. local ExtendedVector = Vector(myHero) + Vector(Vector(pos) - Vector(myHero)):normalized()*SpellW.Range
  1015. local EndPoint = Vector(myHero) + ExtendedVector
  1016. for i, minion in ipairs(EnemyMinions.objects) do
  1017. local MinionPointSegment, MinionPointLine, MinionIsOnSegment = VectorPointProjectionOnLineSegment(Vector(myHero), Vector(EndPoint), Vector(minion))
  1018. local MinionPointSegment3D = {x=MinionPointSegment.x, y=pos.y, z=MinionPointSegment.y}
  1019. if MinionIsOnSegment and GetDistance(MinionPointSegment3D, pos) < SpellW.Width then
  1020. n = n +1
  1021. -- if Config.Extras.Debug then
  1022. -- print('count minions W returend ' .. tostring(n))
  1023. -- end
  1024. end
  1025. end
  1026. return n
  1027. end
  1028.  
  1029. function countminionshitQ(pos)
  1030. local n = 0
  1031. if Config.Extras.Debug then
  1032. print('count minions Q called')
  1033. end
  1034. local ExtendedQVector = Vector(Vector(pos) - Vector(myHero)):normalized()
  1035. local MinionQUnitVector1 = ExtendedQVector:perpendicular()
  1036. local MinionQUnitVector2 = ExtendedQVector:perpendicular2()
  1037. local MinionQVector1 = Vector(pos) + MinionQUnitVector1*Config.Extras.SplitQDistance
  1038. local MinionQVector2 = Vector(pos) + MinionQUnitVector2*Config.Extras.SplitQDistance
  1039. for i, minion in ipairs(EnemyMinions.objects) do
  1040. local MinionPointSegment1, MinionPointLine1, MinionIsOnSegment1 = VectorPointProjectionOnLineSegment(Vector(pos), Vector(MinionQVector1), Vector(minion))
  1041. local MinionPointSegment2, MinionPointLine2, MinionIsOnSegment2 = VectorPointProjectionOnLineSegment(Vector(pos), Vector(MinionQVector2), Vector(minion))
  1042. local MinionPointSegment13D = {x=MinionPointSegment1.x, y=pos.y, z=MinionPointSegment1.y}
  1043. local MinionPointSegment23D = {x=MinionPointSegment2.x, y=pos.y, z=MinionPointSegment2.y}
  1044. if MinionIsOnSegment1 and GetDistance(MinionPointSegment13D, pos) < SpellQ.Width then
  1045. n = n +1
  1046. if Config.Extras.Debug then
  1047. print('count minions Q returend ' .. tostring(n))
  1048. end
  1049. end
  1050. if MinionIsOnSegment2 and GetDistance(MinionPointSegment23D, pos) < SpellQ.Width then
  1051. n = n +1
  1052. if Config.Extras.Debug then
  1053. print('count minions Q returend ' .. tostring(n))
  1054. end
  1055. end
  1056. end
  1057. return n
  1058. end
  1059.  
  1060. function countminionshitE(pos)
  1061. local n = 0
  1062. for i, minion in ipairs(EnemyMinions.objects) do
  1063. if GetDistance(minion, pos) < SpellE.Width then
  1064. n = n +1
  1065. end
  1066. end
  1067. return n
  1068. end
  1069.  
  1070. function GetBestWPositionFarm()
  1071. local MaxW = 0
  1072. local MaxWPos
  1073. for i, minion in pairs(EnemyMinions.objects) do
  1074. local hitW = countminionshitW(minion)
  1075. if hitW > MaxW or MaxWPos == nil then
  1076. MaxWPos = minion
  1077. MaxW = hitW
  1078. end
  1079. end
  1080.  
  1081. if MaxWPos then
  1082. local CastPosition, HitChance, Position = VP:GetCircularCastPosition(MaxWPos, SpellW.Delay, SpellW.Width, WRange)
  1083. return Position
  1084. else
  1085. return nil
  1086. end
  1087. end
  1088.  
  1089. function GetBestQPositionFarm()
  1090. local MaxQ = 0
  1091. local MaxQPos
  1092. if Config.Extras.Debug then
  1093. print('GetBestQPositionFarm')
  1094. end
  1095. for i, minion in pairs(EnemyMinions.objects) do
  1096. local hitQ = countminionshitQ(minion)
  1097. if hitQ ~= nil and hitQ > MaxQ or MaxQPos == nil then
  1098. MaxQPos = minion
  1099. MaxQ = hitQ
  1100. end
  1101. end
  1102.  
  1103. if MaxQPos then
  1104. local CastPosition = Vector(myHero) + Vector(Vector(MaxQPos) - Vector(myHero)):normalized()*SpellQ.Range
  1105. return CastPosition
  1106. else
  1107. return nil
  1108. end
  1109. end
  1110.  
  1111. function GetBestEPositionFarm()
  1112. local MaxE = 0
  1113. local MaxEPos
  1114. for i, minion in pairs(EnemyMinions.objects) do
  1115. local hitE = countminionshitE(minion)
  1116. if hitE > MaxE or MaxEPos == nil then
  1117. MaxEPos = minion
  1118. MaxE = hitE
  1119. end
  1120. end
  1121.  
  1122. if MaxEPos then
  1123. local CastPosition, HitChance, Position = VP:GetCircularCastPosition(MaxEPos, SpellE.Delay, SpellE.Width, ERange)
  1124. return Position
  1125. else
  1126. return nil
  1127. end
  1128. end
  1129. --End Credit Honda7
  1130.  
  1131. function round(num, idp)
  1132. return string.format("%." .. (idp or 0) .. "f", num)
  1133. end
  1134.  
  1135. function OnDraw()
  1136. if Config.Extras.Debug then
  1137. DrawText3D("Current isPressedR status is " .. tostring(isPressedR), myHero.x, myHero.y, myHero.z, 25, ARGB(255,255,0,0), true)
  1138. DrawText3D("Current BlockQ status is " .. tostring(BlockQ), myHero.x+100, myHero.y+100, myHero.z+100, 25, ARGB(255,255,0,0), true)
  1139. --DrawText3D("current LastDetonateTime is " .. tostring(LastDetonateTime), myHero.x-100, myHero.y-100, myHero.z-100, 25, ARGB(255,255,0,0), true )
  1140. if target ~= nil then
  1141. DrawText3D("Current target status is " .. tostring(target2.charName), myHero.x+200, myHero.y+200, myHero.z+200, 25, ARGB(255,255,0,0), true)
  1142. end
  1143. if LastDetonateTime ~= nil then
  1144. DrawText3D("current LastDetonateTime is " .. tostring(LastDetonateTime), myHero.x-100, myHero.y-100, myHero.z-100, 25, ARGB(255,255,0,0), true )
  1145. end
  1146. end
  1147.  
  1148. if Config.Draw.DrawR and RREady then
  1149. DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellR.Range, 1, ARGB(255, 0, 255, 255))
  1150. end
  1151.  
  1152. if Config.Draw.DrawW then
  1153. DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellW.Range, 1, ARGB(255, 0, 255, 255))
  1154. end
  1155.  
  1156. if Config.Draw.DrawE then
  1157. DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellE.Range, 1, ARGB(255, 0, 255, 255))
  1158. end
  1159.  
  1160. if Config.Draw.DrawQ then
  1161. DrawCircle3D(myHero.x, myHero.y, myHero.z, SpellQ.Range, 1, ARGB(255, 0, 255, 255))
  1162. end
  1163.  
  1164. if Config.Draw.DrawTarget and ValidTarget(target) then
  1165. DrawCircle3D(target.x, target.y, target.z, VP:GetHitBox(target), 1, ARGB(255, 0, 255, 255))
  1166. end
  1167.  
  1168. if Config.Draw.DrawRDamage and RReady then
  1169. local Enemies = GetEnemyHeroes()
  1170. for idx, champ in ipairs(Enemies) do
  1171. local pertickdamage = getDmg("R", champ, myHero)
  1172. local total_damage = pertickdamage*8
  1173. local dps = total_damage/2
  1174. if champ.health < total_damage and GetDistance(champ) < 2500 and ValidTarget(champ, 2500) then
  1175. local time_to_death = champ.health/dps
  1176. local overkill = total_damage - champ.health
  1177. DrawText3D("R time to death: " .. round(time_to_death,2) .. " (" .. round(overkill,1) .. " hp overkill)", champ.x, champ.y, champ.z, 15, ARGB(255,255,0,0), true)
  1178. end
  1179. end
  1180. end
  1181.  
  1182. if Config.Draw.DrawQ then
  1183. if ToRotateVector ~= nil and target2 then
  1184. DrawLine3D(myHero.x, myHero.y, myHero.z, myHero.x + ToRotateVector.x, myHero.y, myHero.z + ToRotateVector.z, 1, ARGB(255, 255, 0, 0))
  1185. end
  1186. if Config.DrawQ2 and VectorTable2 ~= nil and #VectorTable2 >= 0 then
  1187. for idx, val in ipairs(VectorTable2) do
  1188. DrawLine3D(myHero.x, myHero.y, myHero.z, myHero.x+val.x, myHero.y, myHero.z+val.z, 2, ARGB(255, 0, 255, 255))
  1189. end
  1190. end
  1191.  
  1192. if TempSegment2 ~= nil then
  1193. DrawCircle3D(TempSegment2.x, myHero.y, TempSegment2.z, 100, 1, ARGB(255, 255, 255, 0))
  1194. end
  1195.  
  1196. if refactored_TempSegment3D ~= nil then
  1197. DrawCircle3D(refactored_TempSegment3D.x, myHero.y, refactored_TempSegment3D.z, 100, 1, ARGB(255, 255, 255, 255))
  1198. end
  1199.  
  1200. -- if Config.DrawQ2 and VectorTable ~= nil and #VectorTable >= 1 and QObject == nil then
  1201. -- for idx, val in ipairs(VectorTable) do
  1202. -- DrawLine3D(val[1].x, val[1].y, val[1].z, val[2].x, val[2].y, val[2].z, 2, ARGB(255, 0, 255, 255))
  1203. -- end
  1204. -- end
  1205.  
  1206. -- if BestPosition ~= nil and target2 and ValidTarget(target2) then
  1207. -- DrawCircle3D(BestPosition.x, myHero.y, BestPosition.z, 50, 1, ARGB(255, 0, 255, 0))
  1208. -- end
  1209.  
  1210. -- -- if Config.DrawQ2 and ToRotateVector ~= nil then
  1211. -- -- DrawLine3D(myHero.x, myHero.y, myHero.z, myHero.x + ToRotateVector.x, myHero.y, myHero.z + ToRotateVector.z, 2, ARGB(255, 255, 0, 0))
  1212.  
  1213. -- -- end
  1214. if QObject ~= nil and OriginalCastVector2 ~= nil and EndPos1 ~= nil and EndPos2 ~= nil then
  1215. DrawLine3D(QObject.x, myHero.y, QObject.z, OriginalCastVector2.x, OriginalCastVector2.y, OriginalCastVector2.z, 1, ARGB(255, 255, 255, 255))
  1216. DrawLine3D(QObject.x, myHero.y, QObject.z, EndPos2.x, myHero.y, EndPos2.z, 1, ARGB(255, 255, 255, 255))
  1217. DrawLine3D(QObject.x, myHero.y, QObject.z, EndPos1.x, myHero.y, EndPos1.z, 1, ARGB(255, 255, 255, 255))
  1218. if EndPos1 ~= nil and pointSegment2 ~= nil and pointSegment2.x and pointSegment2.y and not(detonate2 or detonate1)then
  1219. DrawLine3D(SplitQPosition.x, myHero.y, SplitQPosition.z, pointSegment2.x, myHero.y, pointSegment2.y, 2, ARGB(255, 255, 0, 0))
  1220. elseif EndPos1 ~= nil and pointSegment2 ~= nil and pointSegment2.x and pointSegment2.y and (detonate2 or detonate1) then
  1221. DrawLine3D(SplitQPosition.x, myHero.y, SplitQPosition.z, pointSegment2.x, myHero.y, pointSegment2.y, 2, ARGB(255, 0, 0, 255))
  1222. end
  1223. if EndPos2 ~= nil and pointSegment3 ~= nil and pointSegment3.x and pointSegment3.y and not (detonate2 or detonate1) then
  1224. DrawLine3D(SplitQPosition.x, myHero.y, SplitQPosition.z, pointSegment3.x, myHero.y, pointSegment3.y, 2, ARGB(255, 255, 0, 0))
  1225. elseif EndPos2 ~= nil and pointSegment3 ~= nil and pointSegment3.x and pointSegment3.y and (detonate2 or detonate1) then
  1226. DrawLine3D(SplitQPosition.x, myHero.y, SplitQPosition.z, pointSegment3.x, myHero.y, pointSegment3.y, 2, ARGB(255, 0, 0, 255))
  1227. end
  1228. end
  1229. --pointSegment, pointLine, isOnSegment
  1230. -- if pointSegment ~= nil and pointSegment.x and pointSegment.y and target ~= nil and ValidTarget(target, 1500) then
  1231. -- DrawLine3D(myHero.x, myHero.y, myHero.z, pointSegment.x, myHero.y, pointSegment.z, 1, ARGB(255, 255, 255, 255))
  1232. -- end
  1233. -- --pointSegment, pointLine, isOnSegment
  1234. -- if pointLine ~= nil and pointLine.x and pointLine.y and target ~= nil and ValidTarget(target, 1500) then
  1235. -- DrawLine3D(myHero.x, myHero.y, myHero.z, pointLine.x, myHero.y, pointLine.z, 1, ARGB(255, 255, 0, 0))
  1236. -- end
  1237.  
  1238. -- if SplitQPosition ~= nil then
  1239. -- DrawCircle3D(SplitQPosition.x, myHero.y, SplitQPosition.z, 100, 2, ARGB(255, 255, 255, 255))
  1240. -- end
  1241.  
  1242. -- if EndPos2 ~= nil then
  1243. -- DrawCircle3D(EndPos2.x, myHero.y, EndPos2.z, 100, 2, ARGB(255, 0, 255, 0))
  1244. -- end
  1245.  
  1246. -- if EndPos1 ~= nil then
  1247. -- DrawCircle3D(EndPos1.x, myHero.y, EndPos1.z, 100, 2, ARGB(255, 0, 255, 0))
  1248. -- end
  1249.  
  1250. -- if BestPosition ~= nil then
  1251. -- DrawCircle3D(BestPosition.x, myHero.y, BestPosition.z, 50, 1, ARGB(255, 0, 255, 0))
  1252. -- end
  1253. -- if DeflectedPosition ~= nil then
  1254. -- DrawCircle3D(DeflectedPosition.x, myHero.y, DeflectedPosition.y, 50, 1, ARGB(255, 0, 0, 0))
  1255. -- end
  1256. end
  1257. end
  1258.  
  1259. function OnCreateObj(obj)
  1260. if (obj.name == "Velkoz_Base_Q_mis.troy" or obj.name == "Velkoz_Skin01_Q_mis.troy" or obj.name == "Velkoz_Skin01_Q_Mis.troy") and obj.team ~= TEAM_ENEMY and GetDistance(obj, myHero) < 600 then
  1261. QObject = obj
  1262. --BlockQ = true
  1263. QStartPos = Vector(obj)
  1264. end
  1265.  
  1266. if (obj.name == "Velkoz_Base_Q_EndIndicator.troy" or obj.name == 'Velkoz_Skin01_Q_EndIndicator.troy') and obj.team ~= TEAM_ENEMY and GetDistance(obj, myHero) < 1200 then
  1267. QEndObject = obj
  1268. BlockQ = true
  1269. end
  1270.  
  1271. -- if obj.name == "Velkoz_Base_R_Lensbeam.troy" and obj.team ~= TEAM_ENEMY then
  1272. -- isPressedR = true
  1273. -- end
  1274. end
  1275.  
  1276. function OnDeleteObj(obj)
  1277. if (obj.name == "Velkoz_Base_Q_mis.troy" or obj.name == "Velkoz_Skin01_Q_mis.troy" or obj.name == "Velkoz_Skin01_Q_Mis.troy")and obj.team ~= TEAM_ENEMY then
  1278. QObject = nil
  1279. QStartPos = nil
  1280. BlockQ = false
  1281. end
  1282.  
  1283. if (obj.name == "Velkoz_Base_Q_EndIndicator.troy" or obj.name == 'Velkoz_Skin01_Q_EndIndicator.troy') and obj.team ~= TEAM_ENEMY then
  1284. QEndObject = nil
  1285. BlockQ = false
  1286. end
  1287.  
  1288. -- if obj.name == 'Velkoz_Base_R_beam.troy' and obj.team ~= TEAM_ENEMY then
  1289. -- isPressedR = false
  1290. -- end
  1291. end
  1292.  
  1293. function OnGainBuff(unit, buff)
  1294. if unit.isMe and buff.name == 'VelkozR' then
  1295. isPressedR = true
  1296. end
  1297. end
  1298.  
  1299. function OnLoseBuff(unit, buff)
  1300. if unit.isMe and buff.name == 'VelkozR' then
  1301. isPressedR = false
  1302. end
  1303. end
  1304.  
  1305.  
  1306. -- function Cast2ndR()
  1307. -- print('sending 2nd packet')
  1308. -- local packet = CLoLPacket(0xE5)
  1309. -- packet.dwArg1 = 1
  1310. -- packet.dwArg2 = 0
  1311. -- packet:EncodeF(myHero.networkID)
  1312. -- packet:Encode1(0x83)
  1313. -- packet:EncodeF(mousePos.x)
  1314. -- packet:EncodeF(mousePos.y)
  1315. -- packet:EncodeF(mousePos.z)
  1316. -- SendPacket(packet)
  1317. -- end
  1318.  
  1319. function Cast2ndQPacket(unit)
  1320. Packet("S_CAST", {spellId = _Q, toX=unit.x, toY=unit.z, fromX=unit.x, fromY=unit.z}):send()
  1321. end
  1322.  
  1323. function CastRPacket(unit)
  1324. Packet("S_CAST", {spellId = _R, toX=unit.x, toY=unit.z, fromX=unit.x, fromY=unit.z}):send()
  1325. end
  1326.  
  1327. function OnRecvPacket(p)
  1328. -- if p.header == 0x4F then
  1329. -- DelayAction(Cast2ndR, 0.1)
  1330. -- -- print('0x4f received')
  1331. -- -- local result = {
  1332. -- -- dwArg1 = p.dwArg1,
  1333. -- -- dwArg2 = p.dwArg2,
  1334. -- -- pos1 = p.DecodeF(),
  1335. -- -- pos2 = p.DecodeF(),
  1336. -- -- pos3 = p.DecodeF(),
  1337. -- -- pos4 = p.DecodeF(),
  1338. -- -- pos5 = p.DecodeF(),
  1339. -- -- pos6 = p.DecodeF(),
  1340. -- -- pos7 = p.DecodeF(),
  1341. -- -- pos8 = p.DecodeF(),
  1342. -- -- pos9 = p.DecodeF()
  1343. -- -- }
  1344. -- -- print(result)
  1345. -- --Cast2ndR()
  1346. -- end
  1347. end
  1348.  
  1349. function OnSendPacket(p)
  1350.  
  1351. -- if p.header == 0x4F then
  1352. -- Cast2ndR()
  1353. -- end
  1354. if p.header == Packet.headers.S_CAST and BlockQ then
  1355. result = {
  1356. dwArg1 = p.dwArg1,
  1357. dwArg2 = p.dwArg2,
  1358. sourceNetworkId = p:DecodeF(),
  1359. spellId = p:Decode1(),
  1360. fromX = p:DecodeF(),
  1361. fromY = p:DecodeF(),
  1362. toX = p:DecodeF(),
  1363. toY = p:DecodeF(),
  1364. targetNetworkId = p:DecodeF()
  1365. }
  1366. if result.spellId == '128'or result.spellId == _Q or result.spellId == "Q" then
  1367. p:Block()
  1368. if Config.Extras.Debug then
  1369. print('Block Q packet blocked')
  1370. end
  1371. end
  1372. end
  1373.  
  1374. if p.header == 229 or p.header == 230 and Config.TrackR then
  1375. -- if Config.Extras.Debug then
  1376. -- print('p blocked')
  1377. -- end
  1378. -- p:Block()
  1379. -- Cast2ndR()
  1380. p.pos = 1
  1381. result = {
  1382. dwArg1 = p.dwArg1,
  1383. dwArg2 = p.dwArg2,
  1384. sourceNetworkId = p:DecodeF(),
  1385. spellId = p:Decode1(),
  1386. fromX = p:DecodeF(),
  1387. fromY = p:DecodeF(),
  1388. fromZ = p:DecodeF(),
  1389. }
  1390. -- if Config.Extras.Debug then
  1391. -- print('p blocked')
  1392. -- end
  1393. p:Block()
  1394.  
  1395. if ValidTarget(target) and GetDistance(target) < 1500 then
  1396. -- if Config.Extras.Debug then
  1397. -- print('r_target_acquired')
  1398. -- end
  1399. local packet = CLoLPacket(230)
  1400. packet.dwArg1 = result.dwArg1
  1401. packet.dwArg2 = result.dwArg2
  1402. packet:EncodeF(result.sourceNetworkId)
  1403. packet:Encode1(result.spellId)
  1404. packet:EncodeF(target3.x)
  1405. packet:EncodeF(target3.y)
  1406. packet:EncodeF(target3.z)
  1407. --SendPacket(packet)\
  1408. SendPacket(packet)
  1409. else
  1410. local packet = CLoLPacket(230)
  1411. packet.dwArg1 = result.dwArg1
  1412. packet.dwArg2 = result.dwArg2
  1413. packet:EncodeF(result.sourceNetworkId)
  1414. packet:Encode1(result.spellId)
  1415. packet:EncodeF(result.fromX)
  1416. packet:EncodeF(result.fromY)
  1417. packet:EncodeF(result.fromZ)
  1418. --SendPacket(packet)\
  1419. SendPacket(packet)
  1420. end
  1421. end
  1422.  
  1423. if p.header == Packet.headers.S_CAST and isPressedR and Config.Extras.BlockR then
  1424. if Config.Extras.Debug then
  1425. print('Block R Packet Called')
  1426. end
  1427. result = {
  1428. dwArg1 = p.dwArg1,
  1429. dwArg2 = p.dwArg2,
  1430. sourceNetworkId = p:DecodeF(),
  1431. spellId = p:Decode1(),
  1432. fromX = p:DecodeF(),
  1433. fromY = p:DecodeF(),
  1434. toX = p:DecodeF(),
  1435. toY = p:DecodeF(),
  1436. targetNetworkId = p:DecodeF()
  1437. }
  1438. if result.spellId == '131'or result.spellId == _R or result.spellId == "R" then
  1439. p:Block()
  1440. if Config.Extras.Debug then
  1441. print('isPressedR packet 0x99 blocked')
  1442. end
  1443. end
  1444. if Config.Extras.Debug then
  1445. print('isPressedR packet 0x99 blocked')
  1446. end
  1447. end
  1448.  
  1449.  
  1450. -- if p.header == Packet.headers.S_MOVE and isPressedR and not Config.ManualR then
  1451. -- p:Block()
  1452. -- if Config.Extras.Debug then
  1453. -- print('isPressedR packet 0x71 blocked')
  1454. -- end
  1455. -- end
  1456. end
  1457.  
  1458. function IgniteKS()
  1459. if igniteReady then
  1460. local Enemies = GetEnemyHeroes()
  1461. for idx,val in ipairs(Enemies) do
  1462. if ValidTarget(val, 600) then
  1463. if getDmg("IGNITE", val, myHero) > val.health and GetDistance(val) <= 600 then
  1464. CastSpell(ignite, val)
  1465. end
  1466. end
  1467. end
  1468. end
  1469. end
  1470.  
  1471. function Check()
  1472. QReady = (myHero:CanUseSpell(_Q) == READY)
  1473. WReady = (myHero:CanUseSpell(_W) == READY)
  1474. EReady = (myHero:CanUseSpell(_E) == READY)
  1475. RReady = (myHero:CanUseSpell(_R) == READY)
  1476. -- if not RReady then
  1477. -- isPressedR = false
  1478. -- end
  1479.  
  1480. -- if not QReady then
  1481. -- BlockQ = false
  1482. -- end
  1483. AngleTable = {}
  1484. VectorTable = {}
  1485. VectorTable2 = {}
  1486. if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then
  1487. ignite = SUMMONER_1
  1488. elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then
  1489. ignite = SUMMONER_2
  1490. end
  1491. igniteReady = (ignite ~= nil and myHero:CanUseSpell(ignite) == READY)
  1492.  
  1493. -- if not RReady then
  1494. -- isPressedR = false
  1495. -- end
  1496.  
  1497. -- if not QReady then
  1498. -- BlockQ = false
  1499. -- end
  1500.  
  1501. if not QReady then
  1502. lastdistance = nil
  1503. end
  1504. end
  1505.  
  1506.  
  1507.  
  1508. function CheckDashes()
  1509. local Enemies = GetEnemyHeroes()
  1510. for idx, enemy in ipairs(Enemies) do
  1511. if not enemy.dead and ValidTarget(enemy) and GetDistance(enemy) < SpellE.Range and Config.Extras.EGapClosers then
  1512. local IsDashing, CanHit, Position = VP:IsDashing(enemy, SpellE.Delay, SpellE.Width, SpellE.Speed, myHero)
  1513. if IsDashing and CanHit and GetDistance(Position) < SpellE.Range and EReady then
  1514. CastSpell(_E, Position.x, Position.z)
  1515. end
  1516. end
  1517. end
  1518. end
  1519. --Start Manciuszz orbwalker credit
  1520. function OrbWalking(target)
  1521. if TimeToAttack() and GetDistance(target) <= 565 then
  1522. myHero:Attack(target)
  1523. elseif heroCanMove() then
  1524. moveToCursor()
  1525. end
  1526. end
  1527.  
  1528. function TimeToAttack()
  1529. return (GetTickCount() + GetLatency()/2 > lastAttack + lastAttackCD)
  1530. end
  1531.  
  1532. function heroCanMove()
  1533. return (GetTickCount() + GetLatency()/2 > lastAttack + lastWindUpTime + 20)
  1534. end
  1535.  
  1536. function moveToCursor()
  1537. if GetDistance(mousePos) then
  1538. local moveToPos = myHero + (Vector(mousePos) - myHero):normalized()*300
  1539. myHero:MoveTo(moveToPos.x, moveToPos.z)
  1540. end
  1541. end
  1542.  
  1543. function OnProcessSpell(object, spell)
  1544. if object == myHero then
  1545. if spell.name:lower():find("attack") then
  1546. lastAttack = GetTickCount() - GetLatency()/2
  1547. lastWindUpTime = spell.windUpTime*1000
  1548. lastAttackCD = spell.animationTime*1000
  1549. end
  1550. end
  1551. end
  1552.  
  1553.  
  1554. function OnAnimation(unit,animationName)
  1555. if unit.isMe and lastAnimation ~= animationName then lastAnimation = animationName end
  1556. end
  1557. --End Manciuszz orbwalker credit
  1558.  
  1559. --Start Vadash Credit
  1560. function HaveLowVelocity(target, time)
  1561. if ValidTarget(target, 1500) then
  1562. return (velocity[target.networkID] < MS_MIN and target.ms < MS_MIN and GetTickCount() - lastboost[target.networkID] > time)
  1563. else
  1564. return nil
  1565. end
  1566. end
  1567.  
  1568. function HaveMediumVelocity(target, time)
  1569. if ValidTarget(target, 1500) then
  1570. return (velocity[target.networkID] < MS_MEDIUM and target.ms < MS_MEDIUM and GetTickCount() - lastboost[target.networkID] > time)
  1571. else
  1572. return nil
  1573. end
  1574. end
  1575.  
  1576.  
  1577. function _calcHeroVelocity(target, oldPosx, oldPosz, oldTick)
  1578. if oldPosx and oldPosz and target.x and target.z then
  1579. local dis = math.sqrt((oldPosx - target.x) ^ 2 + (oldPosz - target.z) ^ 2)
  1580. velocity[target.networkID] = kalmanFilters[target.networkID]:STEP(0, (dis / (GetTickCount() - oldTick)) * CONVERSATION_FACTOR)
  1581. end
  1582. end
  1583.  
  1584. function UpdateSpeed()
  1585. local tick = GetTickCount()
  1586. for i=1, #eneplayeres do
  1587. local hero = eneplayeres[i]
  1588. if ValidTarget(hero) then
  1589. if velocityTimers[hero.networkID] <= tick and hero and hero.x and hero.z and (tick - oldTick[hero.networkID]) > (velocity_TO-1) then
  1590. velocityTimers[hero.networkID] = tick + velocity_TO
  1591. _calcHeroVelocity(hero, oldPosx[hero.networkID], oldPosz[hero.networkID], oldTick[hero.networkID])
  1592. oldPosx[hero.networkID] = hero.x
  1593. oldPosz[hero.networkID] = hero.z
  1594. oldTick[hero.networkID] = tick
  1595. if velocity[hero.networkID] > MS_MIN then
  1596. lastboost[hero.networkID] = tick
  1597. end
  1598. end
  1599. end
  1600. end
  1601. end
  1602.  
  1603.  
  1604. --End Vadash Credit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement