forked from spudgy/BoL-1
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShaco.lua
More file actions
716 lines (599 loc) · 25.1 KB
/
Shaco.lua
File metadata and controls
716 lines (599 loc) · 25.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
if myHero.charName ~= "Shaco" then return end
local version = 1.1
local AUTOUPDATE = true
local SCRIPT_NAME = "Shaco"
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local SOURCELIB_URL = "https://raw.github.com/TheRealSource/public/master/common/SourceLib.lua"
local SOURCELIB_PATH = LIB_PATH.."SourceLib.lua"
if FileExist(SOURCELIB_PATH) then
require("SourceLib")
else
DOWNLOADING_SOURCELIB = true
DownloadFile(SOURCELIB_URL, SOURCELIB_PATH, function() print("Required libraries downloaded successfully, please reload") end)
end
if DOWNLOADING_SOURCELIB then print("Downloading required libraries, please wait...") return end
if AUTOUPDATE then
SourceUpdater(SCRIPT_NAME, version, "raw.github.com", "/honda7/BoL/master/"..SCRIPT_NAME..".lua", SCRIPT_PATH .. GetCurrentEnv().FILE_NAME, "/honda7/BoL/master/VersionFiles/"..SCRIPT_NAME..".version"):CheckUpdate()
end
local RequireI = Require("SourceLib")
RequireI:Add("vPrediction", "https://raw.github.com/honda7/BoL/master/Common/VPrediction.lua")
RequireI:Add("SOW", "https://raw.github.com/honda7/BoL/master/Common/SOW.lua")
RequireI:Check()
if RequireI.downloadNeeded == true then return end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local LastAttack = 0
local Winduptime = 0
local AnimationTime = 0
local CLastAttack = 0
local CWinduptime = 0
local CAnimationTime = 0
local clone
local Qrange = 400
local Wrange = 425
local Erange = 625
local Rrange = 2400 --aprox
local wp
local TargetsWaypoints = {}
local DeceiveTime = 0
local isgrass = false
local HTarget
--23
local _HYDRA
local _DFG
local _IGNITE
local _SHEEN
local _LICH
local _TF
local DamageToHeros = {}
local lastrefresh = 0
local _RED --TODO
local Htime = 0
function OnLoad()
Menu = scriptConfig("Shaco", "Shaco")
Menu:addSubMenu("Orbwalker", "Orbwalker")
Menu.Orbwalker:addParam("Range", "Orwalk Range", SCRIPT_PARAM_SLICE, 300, 0, 1000)
Menu.Orbwalker:addParam("DrawRange", "Draw Orbwalk range", SCRIPT_PARAM_ONOFF, true)
Menu.Orbwalker:addParam("Orbwalk", "Orbwalk!", SCRIPT_PARAM_ONKEYDOWN, false, 32)
Menu:addSubMenu("Jungle Farm", "JungleFarm")
Menu.JungleFarm:addParam("Orbwalk", "Orwalk the mobs", SCRIPT_PARAM_ONOFF, true)
Menu.JungleFarm:addParam("Spells", "Use spells", SCRIPT_PARAM_ONOFF, true)
Menu.JungleFarm:addParam("Farm", "Farm!", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("V"))
Menu:addSubMenu("Q (Deceive)", "Q")
Menu.Q:addParam("DrawTime", "Draw time", SCRIPT_PARAM_ONOFF, true)
Menu.Q:addParam("DrawRange", "Draw Q range", SCRIPT_PARAM_ONOFF, false)
Menu.Q:addParam("SR", "Use Q while recalling (stealth recall)", SCRIPT_PARAM_ONOFF, true)
Menu.Q:addParam("Landing", "Draw landing position", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("Q"))
Menu:addSubMenu("W (Jack In The Box)", "W")
Menu.W:addParam("auto", "Auto W bushes if enemy chasing", SCRIPT_PARAM_ONOFF, true)
Menu.W:addParam("auto2", "Auto W if the enemy is stunned (Can cause fps drops!!)", SCRIPT_PARAM_ONOFF, false)
Menu.W:addParam("auto3", "Auto W in blitzcrank hook", SCRIPT_PARAM_ONOFF, false)
Menu.W:addParam("DrawRange", "Draw W range", SCRIPT_PARAM_ONOFF, false)
Menu:addSubMenu("E (Two-Shiv Poison)", "E")
Menu.E:addParam("DrawRange", "Draw E range", SCRIPT_PARAM_ONOFF, false)
Menu.E:addParam("Packets", "Cast E using packets", SCRIPT_PARAM_ONOFF, true)
Menu.E:addParam("B", "Cast E from the back", SCRIPT_PARAM_ONOFF, false)
Menu.E:addParam("CastE2", "Cast E!", SCRIPT_PARAM_ONKEYDOWN, false, string.byte("C"))
Menu.E:addParam("CastE", "Cast E!", SCRIPT_PARAM_ONKEYDOWN, false, 32)
Menu:addSubMenu("R (Hallucinate)", "R")
Menu.R:addSubMenu("Auto-movement", "movement")
Menu.R.movement:addParam("S", "Let the script decide the best option", SCRIPT_PARAM_ONOFF, true)
Menu.R.movement:addParam("Mouse", "Move to mouse", SCRIPT_PARAM_ONOFF, false)
Menu.R.movement:addParam("Random", "Run in random directions", SCRIPT_PARAM_ONOFF, false)
Menu.R.movement:addParam("Escape", "Run trying to escape from enemy team", SCRIPT_PARAM_ONOFF, false)
Menu.R.movement:addParam("Kamikaze", "Orbwalk the best target in a wide range", SCRIPT_PARAM_ONOFF, false)
Menu.R.movement:addParam("AlwaysOrbwalk", "Orbwalk the best target", SCRIPT_PARAM_ONOFF, false)
Menu.R.movement:addParam("CTarget", "Attack shaco's target", SCRIPT_PARAM_ONOFF, false)
Menu.R:addParam("DrawRange", "Draw R range", SCRIPT_PARAM_ONOFF, false)
Menu.R:addParam("Orbwalk", "Force orbwalking", SCRIPT_PARAM_ONKEYDOWN, false, 32)
Menu:addSubMenu("Items", "Items")
Menu.Items:addParam("Hydra", "Use Hydra", SCRIPT_PARAM_ONOFF, true)
Menu.Items:addParam("DFG", "Use DFG", SCRIPT_PARAM_ONOFF, true)
Menu:addSubMenu("Damage calculation", "DamageCalc")
Menu.DamageCalc:addSubMenu("Combo", "Combo")
Menu.DamageCalc.Combo:addParam("Q", "Q", SCRIPT_PARAM_SLICE, 1, 0, 1)
Menu.DamageCalc.Combo:addParam("W", "W", SCRIPT_PARAM_SLICE, 1, 0, 10)
Menu.DamageCalc.Combo:addParam("E", "E", SCRIPT_PARAM_SLICE, 1, 0, 3)
Menu.DamageCalc.Combo:addParam("R", "R", SCRIPT_PARAM_SLICE, 1, 0, 1)
Menu.DamageCalc.Combo:addParam("AA", "AA", SCRIPT_PARAM_SLICE, 1, 0, 5)
Menu.DamageCalc.Combo:addParam("CAA", "CAA", SCRIPT_PARAM_SLICE, 1, 0, 5)
Menu.DamageCalc.Combo:addParam("IGNITE", "IGNITE", SCRIPT_PARAM_SLICE, 1, 0, 1)
Menu.DamageCalc:addParam("Draw", "Draw health after combo in enemies", SCRIPT_PARAM_ONOFF, true)
Menu:addParam("Version", "Version", SCRIPT_PARAM_INFO, version)
if myHero:GetSpellData(SUMMONER_1).name:find("SummonerDot") then
_IGNITE = SUMMONER_1
elseif myHero:GetSpellData(SUMMONER_2).name:find("SummonerDot") then
_IGNITE = SUMMONER_2
else
_IGNITE = nil
end
JungleMinions = minionManager(MINION_JUNGLE, Erange, myHero, MINION_SORT_MAXHEALTH_DEC)
VP = VPrediction()
wp = WayPointManager()
end
function GetComboDamage(target)
local result = 0
local m = 1
local p = Facing(target) and 1 or 1.2
local Qcrit = {1, 1.4, 1.6, 1.8, 2, 2.2}
local Wdamage = {35, 50, 65, 80, 95}
local Wscaling = 0.2
local Edamage = {35, 50, 65, 80, 95}
local Escaling = 1
local Rdamage= {300, 450, 600}
local Rscaling = 1
local Qlevel = myHero:GetSpellData(_Q).level
local Wlevel = myHero:GetSpellData(_W).level
local Elevel = myHero:GetSpellData(_E).level
local Rlevel = myHero:GetSpellData(_R).level
if _HYDRA and myHero:CanUseSpell(_HYDRA) == READY then
result = result + myHero:CalcDamage(target, myHero.totalDamage)
end
if _DFG and myHero:CanUseSpell(_DFG) == READY then
result = result + myHero:CalcMagicDamage(target, target.maxHealth *0.15)
m = 1.2
end
if Menu.DamageCalc.Combo.IGNITE and _IGNITE and myHero:CanUseSpell(_IGNITE) == READY then
result = result + 50 + 20 * myHero.level
end
if Menu.DamageCalc.Combo.W > 0 and Wlevel > 0 then
for i =1, Menu.DamageCalc.Combo.W, 1 do
result = result + m * (myHero:CalcMagicDamage(target, Wdamage[Wlevel]) + myHero.ap * Wscaling)
end
end
if Menu.DamageCalc.Combo.E > 0 and Elevel > 0 then
for i =1, Menu.DamageCalc.Combo.E, 1 do
result = result + p * m * (myHero:CalcMagicDamage(target, Edamage[Elevel]) + myHero.ap * Escaling + myHero.damage * Escaling)
end
end
if Menu.DamageCalc.Combo.AA > 0 then
local sheendamage = _SHEEN and myHero.totalDamage - myHero.damage or 0
local lichdamage = _LICH and myHero.ap or 0
local tfdamage = _TF and 2 * (myHero.totalDamage - myHero.damage) or 0
result = result + p * (myHero:CalcDamage(target, Qcrit[Qlevel+1] * myHero.totalDamage + sheendamage + tfdamage)) + p * m * (myHero:CalcMagicDamage(target, lichdamage))
for i =2, Menu.DamageCalc.Combo.AA, 1 do
result = result + p * (myHero:CalcDamage(target, myHero.totalDamage))
end
end
if Menu.DamageCalc.Combo.CAA > 0 and (clone or myHero:CanUseSpell(_R) == READY) then
for i =1, Menu.DamageCalc.Combo.CAA, 1 do
result = result + (myHero:CalcDamage(target, myHero.totalDamage * 0.75))
end
end
if Menu.DamageCalc.Combo.R == 1 and (clone or myHero:CanUseSpell(_R) == READY) and Rlevel > 0 then
result = result + p * m * myHero:CalcMagicDamage(target, Rdamage[Rlevel])
end
return result
end
function TrackWaypoints()
for i, enemy in ipairs(GetEnemyHeroes()) do
if ValidTarget(enemy) then
local Waypoints = wp:GetWayPoints(enemy)
if #Waypoints > 1 and GetDistance(Waypoints[1], Waypoints[2]) > 50 then
TargetsWaypoints[enemy.charName] = Waypoints
end
end
end
for i, mob in ipairs(JungleMinions.objects) do
if ValidTarget(mob) then
local Waypoints = wp:GetWayPoints(mob)
if #Waypoints > 1 and GetDistance(Waypoints[1], Waypoints[2]) > 50 then
TargetsWaypoints[mob.networkID] = Waypoints
end
end
end
end
function Facing(target)
local b = GetBack(target)
if b.x == target.x and b.z == target.z then
return true
end
--[[does not work if getdistance(target) < 30, too lazy to check the angle :)]]
if GetDistance(b) >= GetDistance(target) then
return true
else
return false
end
end
function GetBack(target)
if target then
local CastPosition, HitChance, Position = VP:GetLineCastPosition(target, 0, 1, math.huge, myHero.ms, myHero)
if not TargetsWaypoints[target.networkID] then
return Vector(Position.x, 0, Position.z)
else
return Vector(Position.x, 0, Position.z) - 60 * Vector(TargetsWaypoints[target.networkID][2].x - Position.x, 0, TargetsWaypoints[target.networkID][2].y - Position.z):normalized()
end
end
end
function GetTrueRange()
return 240
end
function OnSendPacket(p)
if p.header == Packet.headers.S_CAST then
p.pos = 1
local decodedPacket = Packet(p)
if decodedPacket:get('spellId') == RECALL and Menu.Q.SR and myHero:CanUseSpell(_Q) then
Packet('S_CAST', { spellId = _Q, toX = myHero.x, toY = myHero.z, fromX = myHero.x, fromY = myHero.z }):send()
Packet('S_CAST', { spellId = RECALL, toX = myHero.x, toY = myHero.z, fromX = myHero.x, fromY = myHero.z }):send()
end
end
end
function OnTick()
_HYDRA = GetInventorySlotItem(3074) and GetInventorySlotItem(3074) or GetInventorySlotItem(3077)
_DFG = GetInventorySlotItem(3074) and GetInventorySlotItem(3074) or nil
_SHEEN = GetInventorySlotItem(3057) and GetInventorySlotItem(3057) or nil
_LICH = GetInventorySlotItem(3100) and GetInventorySlotItem(3100) or nil
_TF = GetInventorySlotItem(3078) and GetInventorySlotItem(3078) or nil
RefreshKillableTexts()
TrackWaypoints()
JungleMinions:update()
if Menu.JungleFarm.Farm then
if JungleMinions.objects[1] ~= nil then
local mob = JungleMinions.objects[1]
if Menu.JungleFarm.Orbwalk then
if os.clock() + GetLatency()/2000 > LastAttack + AnimationTime and GetDistance(mob) < GetTrueRange() then
Packet('S_MOVE', {type = 3, targetNetworkId=mob.networkID}):send()
elseif os.clock() + GetLatency()/2000 > LastAttack + Winduptime + 0.05 then
local Point = GetBack(mob)
if GetDistance(Point) > 30 then
--myHero:MoveTo(Point.x, Point.z)
Packet('S_MOVE', {type = 2, x = Point.x, y = Point.z}):send()
end
end
end
if Menu.JungleFarm.Spells then
if myHero:CanUseSpell(_E) == READY then
CastSpell(_E, mob)
end
if myHero:CanUseSpell(_W) == READY then
CastSpell(_W, mob.x, mob.z)
end
end
end
end
if Menu.Orbwalker.Orbwalk then
local target = GetBestTarget(myHero, Menu.Orbwalker.Range)
if target and ValidTarget(target) then
if os.clock() + GetLatency()/2000 > LastAttack + AnimationTime and GetDistance(target) < GetTrueRange() then
Packet('S_MOVE', {type = 3, targetNetworkId=target.networkID}):send()
elseif os.clock() + GetLatency()/2000 > LastAttack + Winduptime + 0.05 then
local Point = GetBack(target)
if GetDistance(Point) > 30 then
Packet('S_MOVE', {type = 2, x = Point.x, y = Point.z}):send()
end
end
else
Packet('S_MOVE', {type = 2, x = mousePos.x, y = mousePos.z}):send()
end
end
if Menu.W.auto and DeceiveTime == 0 and (false or CountEnemyHeroInRange(700, myHero)>0) and (myHero:CanUseSpell(_W) == READY) then
if isgrass == false and IsWallOfGrass(D3DXVECTOR3(myHero.x, myHero.y, myHero.z)) then
CastSpell(_W, myHero.x, myHero.z)
end
isgrass = IsWallOfGrass(D3DXVECTOR3(myHero.x, myHero.y, myHero.z))
end
if Menu.W.auto2 and DeceiveTime == 0 and (myHero:CanUseSpell(_W) == READY) then
for i, enemy in ipairs(GetEnemyHeroes()) do
if ValidTarget(enemy) then
local CastPosition, HitChance, Position = VP:GetCircularCastPosition(enemy, 0.5, 1, Wrange)
if GetDistance(CastPosition) < Wrange and HitChance == 4 then--[[enemy immobile]]
CastSpell(_W, CastPosition.x, CastPosition.z)
end
end
end
end
if Menu.E.CastE or Menu.E.CastE then
local target = GetBestTarget(myHero, Erange)
if target and ValidTarget(target) and (not Facing(target) or not Menu.E.B) then
if Menu.Items.DFG and _DFG and myHero:CanUseSpell(_DFG) == READY then
CastSpell(_DFG, target)
end
if Menu.E.Packets then
Packet("S_CAST", {spellId = _E, targetNetworkId = target.networkID}):send()
else
CastSpell(_E, target)
end
end
end
if myHero:CanUseSpell(_R) == COOLDOWN or myHero:GetSpellData(_R).name:lower():find("full") then
clone = nil
end
if clone then
local ctarget = GetBestTarget(clone, Menu.Orbwalker.Range)
if Menu.R.movement.S then
Menu.R.movement['AlwaysOrbwalk'] = false
Menu.R.movement['Mouse'] = false
Menu.R.movement['Random'] = false
Menu.R.movement['Escape'] = false
Menu.R.movement['Kamikaze'] = false
Menu.R.movement["CTarget"] = false
if ValidTarget(HTarget) and (os.clock() - Htime < 5) then
ctarget = HTarget
Menu.R.movement["CTarget"] = true
elseif ctarget and ctarget.health < ctarget.maxHealth * 0.25 then
Menu.R.movement['AlwaysOrbwalk'] = true
elseif myHero.health < myHero.maxHealth * 0.25 then
Menu.R.movement['Escape'] = true
else
Menu.R.movement['Kamikaze'] = true
end
end
if ValidTarget(HTarget) and Menu.R.movement.CTarget then
if os.clock() + GetLatency()/2000 > CLastAttack + CAnimationTime+0.05 then
CastSpell(_R, HTarget.x, HTarget.z)
end
elseif Menu.R.Orbwalk or Menu.R.movement.Kamikaze or Menu.R.movement.AlwaysOrbwalk then
if Menu.R.movement.Kamikaze then
ctarget = GetBestTarget(clone, 1000)
if not ctarget then
ctarget = GetBestTarget(clone, 2000)
end
end
if ctarget and ValidTarget(ctarget) then
if os.clock() + GetLatency()/2000 > CLastAttack + CAnimationTime and GetDistance(clone, ctarget) < GetTrueRange() then
CastSpell(_R, ctarget.x, ctarget.z)
elseif os.clock() + GetLatency()/2000 > CLastAttack + CWinduptime + 0.05 and GetDistance(clone, ctarget) < 30 then
local Point = GetBack(ctarget)
CastSpell(_R, ctarget.x, ctarget.z)
elseif os.clock() + GetLatency()/2000 > CLastAttack + CWinduptime + 0.05 then
local Point = Vector(GetBack(ctarget)) - 1000 * (Vector(clone) - Vector(GetBack(ctarget))):normalized()
CastSpell(_R, Point.x, Point.z)
--[[Casting CastSpell(_R, ctarget.x, ctarget.z) causes the clone to attack that unit instead of moving to that point]]
end
else
CastSpell(_R, mousePos.x, mousePos.z)
end
elseif Menu.R.movement.Random then
local movepoint = wp:GetWayPoints(myHero)
local line = Vector(clone) - Vector(myHero):perpendicular()
local Direction = (Vector(movepoint[#movepoint].x, 0, movepoint[#movepoint].z) - Vector(myHero)):mirrorOn(line):normalized()
local movepos = Vector(clone) + 500 * Direction
CastSpell(_R, movepos.x, movepos.z)
elseif Menu.R.movement.Mouse then
CastSpell(_R, mousePos.x, mousePos.z)
elseif Menu.R.movement.Escape then
local Point = Vector(0, 0, 0)
local Count = 0
for i, hero in ipairs(GetAllyHeroes()) do
Point = Vector(Point) + Vector(hero)
Count = Count + 1
end
Count = Count or 1
Point = 1/Count * Vector(Point)
CastSpell(_R, Point.x, Point.z)
end
end
end
function GetBestTarget(From, Range)
local MKillable = nil
local Min = 0
local Closest = 0
local D = 0
for i, enemy in ipairs(GetEnemyHeroes()) do
if ValidTarget(enemy, Range) then
local Damage = myHero.ap < 100 and myHero:CalcDamage(enemy, 200) or myHero:CalcMagicDamage(enemy, 200)
local DMG = enemy.health / Damage
if (DMG <= Min or MKillable == nil) then
MKillable = enemy
Min = DMG
end
end
end
return MKillable
end
function OnCreateObj(object)
--[[TO-Check: Different obects names depending on skins?]]
if GetDistance(object) < 500 and object.name:lower():find("jester_copy.troy") then
clone = object
end
end
function OnGainBuff(unit, buff)
--[[Q]]--
if unit.isMe and buff.name == "Deceive" then
DeceiveTime = os.clock()
end
end
function OnLoseBuff(unit, buff)
--[[Q]]--
if unit.isMe and buff.name == "Deceive" then
DeceiveTime = 0
end
end
function OnProcessSpell(unit, spell)
for i, enemy in ipairs(GetEnemyHeroes()) do
if ValidTarget(enemy) and enemy.networkID == unit.networkID and spell.target then
TargetsWaypoints[enemy.networkID] = {
[2] = {x = spell.target.x, y = spell.target.z}
}
end
end
for i, mob in ipairs(JungleMinions.objects) do
if ValidTarget(mob) and unit.networkID == mob.networkID and spell.target then
TargetsWaypoints[mob.networkID] = {
[2] = {x = spell.target.x, y = spell.target.z}
}
end
end
--[[Clone auto-attack]]
if unit.team == myHero.team and unit.charName == myHero.charName and unit.networkID ~= myHero.networkID and spell.name:lower():find("attack") then
CWinduptime = spell.windUpTime
CAnimationTime = spell.animationTime
CLastAttack = os.clock() - GetLatency()/2000
end
if unit.networkID == myHero.networkID and spell.name:lower():find("attack") then
Winduptime = spell.windUpTime
AnimationTime = spell.animationTime
LastAttack = os.clock() - GetLatency()/2000
if Menu.Items.Hydra and _HYDRA and myHero:CanUseSpell(_HYDRA) == READY and spell.target.type == myHero.type then
CastSpell(_HYDRA)
end
if spell.target then
HTarget = spell.target
Htime = os.clock()
end
end
if Menu.W.auto3 and ValidTarget(unit, 1000) and unit.charName == "Blitzcrank" and spell.name:lower():find("grab") and (myHero:CanUseSpell(_W) == READY) then
local spoint = Vector(unit)
local Direction = - (Vector(unit) - Vector(spell.endPos)):normalized()
local epoint = spoint + 1050 * Direction
local projection, line, isonsegment = VectorPointProjectionOnLineSegment(spoint, epoint, Vector(myHero) - 60 * Direction)
--[[Maybe better evade first and the put the box :)]]
if isonsegment and GetDistance(projection) < Wrange then
print("W casted in blitzcrank's grab, did it work? :o")
CastSpell(_W, projection.x, projection.z)
end
end
end
function GetLandingPos(CastPoint)
local wall = IsWall(D3DXVECTOR3(CastPoint.x, CastPoint.y, CastPoint.z))
local Point = Vector(CastPoint)
local StartPoint = Vector(Point)
--[[Checks for 500 / 10 * pi/0.2 points]]
for i = 0, 500, 10--[[Decrease for better precision, increase for less fps drops:]] do
for theta = 0, 2 * math.pi + 0.2, 0.2 --[[Same :)]] do
local c = Vector(StartPoint.x + i * math.cos(theta), StartPoint.y, StartPoint.z + i * math.sin(theta))
if not IsWall(D3DXVECTOR3(c.x, c.y, c.z)) then
return c
end
end
end
return Point
end
function DLine(From, To, Color)
DrawLine3D(From.x, From.y, From.z, To.x, To.y, To.z, 2, Color)
end
function DrawQ(To, Color)
local myPos = Vector(myHero.x, myHero.y, myHero.z)
local Direction = (Vector(To.x, To.y, To.z) - Vector(myPos)):perpendicular():normalized()
local Distance = GetDistance(To, myPos)
local Width = 75
local P1r = Vector(myPos) + Width * Vector(Direction)
local P1l = Vector(myPos) - Width * Vector(Direction)
local P2r = Vector(myPos) + Width * Direction - Vector(Direction):perpendicular() * GetDistance(To)
local P2l = Vector(myPos) - Width * Direction - Vector(Direction):perpendicular() * GetDistance(To)
DLine(P1r, P1l, Color)
DLine(P1r, P2r, Color)
DLine(P1l, P2l, Color)
DLine(P2r, P2l, Color)
end
--[[Update the bar texts]]
function RefreshKillableTexts()
if ((GetTickCount() - lastrefresh) > 1000) then
for i=1, heroManager.iCount do
local enemy = heroManager:GetHero(i)
if ValidTarget(enemy) then
DamageToHeros[i] = GetComboDamage(enemy)
end
end
lastrefresh = GetTickCount()
end
end
--[[ Credits to zikkah ]]
function GetHPBarPos(enemy)
enemy.barData = GetEnemyBarData()
local barPos = GetUnitHPBarPos(enemy)
local barPosOffset = GetUnitHPBarOffset(enemy)
local barOffset = { x = enemy.barData.PercentageOffset.x, y = enemy.barData.PercentageOffset.y }
local barPosPercentageOffset = { x = enemy.barData.PercentageOffset.x, y = enemy.barData.PercentageOffset.y }
local BarPosOffsetX = 171
local BarPosOffsetY = 46
local CorrectionY = 0
local StartHpPos = 31
barPos.x = barPos.x + (barPosOffset.x - 0.5 + barPosPercentageOffset.x) * BarPosOffsetX + StartHpPos
barPos.y = barPos.y + (barPosOffset.y - 0.5 + barPosPercentageOffset.y) * BarPosOffsetY + CorrectionY
local StartPos = Vector(barPos.x , barPos.y, 0)
local EndPos = Vector(barPos.x + 108 , barPos.y , 0)
return Vector(StartPos.x, StartPos.y, 0), Vector(EndPos.x, EndPos.y, 0)
end
function DrawIndicator(unit, health)
local SPos, EPos = GetHPBarPos(unit)
local barlenght = EPos.x - SPos.x
local Position = SPos.x + (health / unit.maxHealth) * barlenght
if Position < SPos.x then
Position = SPos.x
end
DrawText("|", 13, math.floor(Position), math.floor(SPos.y+10), ARGB(255,0,255,0))
end
function DrawOnHPBar(unit, health)
local Pos = GetHPBarPos(unit)
if health < 0 then
DrawCircle2(unit.x, unit.y, unit.z, 100, ARGB(255, 255, 0, 0))
DrawText("HP: "..health,13, math.floor(Pos.x), (Pos.y+5), ARGB(255,255,0,0))
else
DrawText("HP: "..health,13, math.floor(Pos.x), math.floor(Pos.y+5), ARGB(255,0,255,0))
end
end
function OnDraw()
--[[
debug:
for i, enemy in ipairs(GetEnemyHeroes()) do
local P = GetBack(enemy)
DrawCircle2( P.x, P.y, P.z, 100, ARGB(255, 255, 0, 0))
end
]]--
if Menu.DamageCalc.Draw then
for i=1, heroManager.iCount do
local enemy = heroManager:GetHero(i)
if ValidTarget(enemy) then
local RemainingHealth = 0
if DamageToHeros[i] ~= nil then
RemainingHealth = enemy.health - DamageToHeros[i]
end
DrawOnHPBar(enemy, math.floor(RemainingHealth))
DrawIndicator(enemy, math.floor(RemainingHealth))
end
end
end
if Menu.Orbwalker.DrawRange then
DrawCircle2(myHero.x, myHero.y, myHero.z, Menu.Orbwalker.Range, ARGB(255, 255, 0, 0))
if clone then
DrawCircle2(clone.x, clone.y, clone.z, Menu.Orbwalker.Range, ARGB(255, 0, 255, 0))
end
end
if Menu.Q.DrawRange then
DrawCircle2(myHero.x, myHero.y, myHero.z, Qrange, ARGB(255, 255, 0, 0))
end
if Menu.W.DrawRange then
DrawCircle2(myHero.x, myHero.y, myHero.z, Wrange, ARGB(255, 255, 0, 0))
end
if Menu.E.DrawRange then
DrawCircle2(myHero.x, myHero.y, myHero.z, Erange, ARGB(255, 255, 0, 0))
end
if Menu.R.DrawRange and clone then
DrawCircle(myHero.x, myHero.y, myHero.z, Rrange, ARGB(255, 0, 255, 0))
end
if Menu.Q.Landing then
local CastPoint = GetDistance(mousePos) <= Qrange and Vector(mousePos) or Vector(myHero) + Qrange * (Vector(mousePos)-Vector(myHero)):normalized()
CastPoint = GetLandingPos(CastPoint)
local Color = myHero:CanUseSpell(_Q)==READY and ARGB(255, 0, 255, 0) or ARGB(255, 255, 0, 0)
DrawQ(CastPoint, Color)
end
if Menu.Q.DrawTime and DeceiveTime and DeceiveTime ~= 0 then
local myPos = WorldToScreen(D3DXVECTOR3(myHero.x, myHero.y, myHero.z))
DrawText(tostring(math.floor(35 - 10*(os.clock() - DeceiveTime))), 16, myPos.x, myPos.y, ARGB(255,255,0,0))
end
end
function DrawCircle2(x, y, z, radius, color)
local vPos1 = Vector(x, y, z)
local vPos2 = Vector(cameraPos.x, cameraPos.y, cameraPos.z)
local tPos = vPos1 - (vPos1 - vPos2):normalized() * radius
local sPos = WorldToScreen(D3DXVECTOR3(tPos.x, tPos.y, tPos.z))
if OnScreen({ x = sPos.x, y = sPos.y }, { x = sPos.x, y = sPos.y }) then
DrawCircleNextLvl(x, y, z, radius, 1, color, 75)
end
end
function DrawCircleNextLvl(x, y, z, radius, width, color, chordlength)
radius = radius or 300
quality = math.max(8,math.floor(180/math.deg((math.asin((chordlength/(2*radius)))))))
quality = 2 * math.pi / quality
radius = radius*.92
local points = {}
for theta = 0, 2 * math.pi + quality, quality do
local c = WorldToScreen(D3DXVECTOR3(x + radius * math.cos(theta), y, z - radius * math.sin(theta)))
points[#points + 1] = D3DXVECTOR2(c.x, c.y)
end
DrawLines2(points, width or 1, color or 4294967295)
end