-
Notifications
You must be signed in to change notification settings - Fork 11
/
Timers.cs
1204 lines (1113 loc) · 54 KB
/
Timers.cs
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
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using LeagueSharp;
using LeagueSharp.Common;
using SharpDX;
using SharpDX.Direct3D9;
using Color = System.Drawing.Color;
namespace SAwareness
{
internal class ImmuneTimer //TODO: Maybe add Packetcheck
{
private static readonly List<Ability> Abilities = new List<Ability>();
private readonly Render.Text _textF = new Render.Text("", 0, 0, 24, SharpDX.Color.Goldenrod);
private bool _drawActive = true;
public ImmuneTimer()
{
Abilities.Add(new Ability("zhonyas_ring_activate", 2.5f)); //Zhonya
Abilities.Add(new Ability("Aatrox_Passive_Death_Activate", 3f)); //Aatrox Passive
Abilities.Add(new Ability("LifeAura", 4f)); //Zil und GA
Abilities.Add(new Ability("nickoftime_tar", 7f)); //Zil before death
Abilities.Add(new Ability("eyeforaneye", 2f)); // Kayle
Abilities.Add(new Ability("UndyingRage_buf", 5f)); //Tryn
Abilities.Add(new Ability("EggTimer", 6f)); //Anivia
GameObject.OnCreate += Obj_AI_Base_OnCreate;
Game.OnGameUpdate += Game_OnGameUpdate;
//Drawing.OnDraw += Drawing_OnDraw;
Drawing.OnEndScene += Drawing_OnEndScene;
Drawing.OnPreReset += Drawing_OnPreReset;
Drawing.OnPostReset += Drawing_OnPostReset;
}
~ImmuneTimer()
{
GameObject.OnCreate -= Obj_AI_Base_OnCreate;
Game.OnGameUpdate -= Game_OnGameUpdate;
//Drawing.OnDraw -= Drawing_OnDraw;
Drawing.OnEndScene -= Drawing_OnEndScene;
Drawing.OnPreReset -= Drawing_OnPreReset;
Drawing.OnPostReset -= Drawing_OnPostReset;
}
public bool IsActive()
{
return Menu.Timers.GetActive() && Menu.ImmuneTimer.GetActive();
}
private void Game_OnGameUpdate(EventArgs args)
{
if (!IsActive())
return;
foreach (Ability ability in Abilities)
{
if ((ability.TimeCasted + ability.Delay) < Game.ClockTime)
{
ability.Casted = false;
ability.TimeCasted = 0;
}
}
}
private void Drawing_OnEndScene(EventArgs args)
{
if (!IsActive() || !_drawActive)
return;
foreach (Ability ability in Abilities)
{
if (ability.Casted && ability.TimeCasted > 0)
{
Vector2 hpPos = new Vector2();
if(ability.Target != null && ability.Target.IsValid)
hpPos = ability.Target.HPBarPosition;
else if(ability.Owner != null && ability.Owner.IsValid)
hpPos = ability.Owner.HPBarPosition;
float endTime = ability.TimeCasted - (int)Game.ClockTime + ability.Delay;
var m = (float)Math.Floor(endTime / 60);
var s = (float)Math.Ceiling(endTime % 60);
String ms = (s < 10 ? m + ":0" + s : m + ":" + s);
_textF.Centered = true;
_textF.text = ms;
_textF.X = (int)hpPos.X + 80;
_textF.Y = (int)hpPos.Y;
_textF.OutLined = true;
_textF.OnEndScene();
}
}
}
private void Obj_AI_Base_OnCreate(GameObject sender, EventArgs args)
{
if (!IsActive())
return;
foreach (Obj_AI_Hero hero in ObjectManager.Get<Obj_AI_Hero>())
{
if (!hero.IsEnemy)
{
foreach (Ability ability in Abilities)
{
if (sender.Name.Contains(ability.SpellName) &&
/*variable*/ Vector3.Distance(sender.Position, ObjectManager.Player.ServerPosition) <= 4000)
{
ability.Owner = hero;
ability.Casted = true;
ability.TimeCasted = (int) Game.ClockTime;
if (Vector3.Distance(sender.Position, hero.ServerPosition) <= 100)
ability.Target = hero;
}
}
}
}
}
private void Drawing_OnPostReset(EventArgs args)
{
_textF.OnPostReset();
_drawActive = true;
}
private void Drawing_OnPreReset(EventArgs args)
{
_textF.OnPreReset();
_drawActive = false;
}
public class Ability
{
public bool Casted;
public float Delay;
public Obj_AI_Hero Owner;
public int Range;
public String SpellName;
public Obj_AI_Hero Target;
public int TimeCasted;
public Ability(string spellName, float delay)
{
SpellName = spellName;
Delay = delay;
}
}
}
public class Timers
{
private static readonly Utility.Map GMap = Utility.Map.GetMap();
private static Inhibitor _inhibitors;
private static readonly List<Relic> Relics = new List<Relic>();
private static readonly List<Altar> Altars = new List<Altar>();
private static readonly List<Health> Healths = new List<Health>();
private static readonly List<JungleMob> JungleMobs = new List<JungleMob>();
private static readonly List<JungleCamp> JungleCamps = new List<JungleCamp>();
private static readonly List<Obj_AI_Minion> JungleMobList = new List<Obj_AI_Minion>();
private static readonly Dictionary<Obj_AI_Hero, Summoner> Summoners = new Dictionary<Obj_AI_Hero, Summoner>();
private readonly Font _font;
private bool _drawActive = true;
public Timers()
{
try
{
_font = new Font(Drawing.Direct3DDevice, new System.Drawing.Font("Times New Roman", 8));
}
catch (Exception)
{
Menu.Timers.ForceDisable = true;
Console.WriteLine("Timer: Cannot create Font");
return;
}
GameObject.OnCreate += Obj_AI_Base_OnCreate;
Game.OnGameUpdate += Game_OnGameUpdate;
Game.OnGameProcessPacket += Game_OnGameProcessPacket;
Drawing.OnPreReset += Drawing_OnPreReset;
Drawing.OnPostReset += Drawing_OnPostReset;
Drawing.OnEndScene += Drawing_OnEndScene;
AppDomain.CurrentDomain.DomainUnload += delegate { Drawing_OnPreReset(new EventArgs()); };
AppDomain.CurrentDomain.ProcessExit += delegate { Drawing_OnPreReset(new EventArgs()); };
InitJungleMobs();
}
~Timers()
{
GameObject.OnCreate -= Obj_AI_Base_OnCreate;
Game.OnGameUpdate -= Game_OnGameUpdate;
Game.OnGameProcessPacket -= Game_OnGameProcessPacket;
Drawing.OnPreReset -= Drawing_OnPreReset;
Drawing.OnPostReset -= Drawing_OnPostReset;
Drawing.OnEndScene -= Drawing_OnEndScene;
}
public bool IsActive()
{
return Menu.Timers.GetActive();
}
private String AlignTime(float endTime)
{
if (!float.IsInfinity(endTime) && !float.IsNaN(endTime))
{
var m = (float) Math.Floor(endTime/60);
var s = (float) Math.Ceiling(endTime%60);
String ms = (s < 10 ? m + ":0" + s : m + ":" + s);
return ms;
}
return "";
}
private bool PingAndCall(String text, Vector3 pos, bool call = true, bool ping = true)
{
if(ping)
{
for (int i = 0; i < Menu.Timers.GetMenuItem("SAwarenessTimersPingTimes").GetValue<Slider>().Value; i++)
{
GamePacket gPacketT;
if (Menu.Timers.GetMenuItem("SAwarenessTimersLocalPing").GetValue<bool>())
{
gPacketT =
Packet.S2C.Ping.Encoded(new Packet.S2C.Ping.Struct(pos[0], pos[1], 0, 0,
Packet.PingType.Normal));
gPacketT.Process();
}
else if (!Menu.Timers.GetMenuItem("SAwarenessTimersLocalPing").GetValue<bool>() &&
Menu.GlobalSettings.GetMenuItem("SAwarenessGlobalSettingsServerChatPingActive")
.GetValue<bool>())
{
gPacketT = Packet.C2S.Ping.Encoded(new Packet.C2S.Ping.Struct(pos.X, pos.Y));
gPacketT.Send();
}
}
}
if(call)
{
if (Menu.Timers.GetMenuItem("SAwarenessTimersChatChoice").GetValue<StringList>().SelectedIndex == 1)
{
Game.PrintChat(text);
}
else if (Menu.Timers.GetMenuItem("SAwarenessTimersChatChoice").GetValue<StringList>().SelectedIndex == 2 &&
Menu.GlobalSettings.GetMenuItem("SAwarenessGlobalSettingsServerChatPingActive").GetValue<bool>())
{
Game.Say(text);
}
}
return true;
}
private void Drawing_OnPostReset(EventArgs args)
{
if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed)
return;
_font.OnResetDevice();
_drawActive = true;
}
private void Drawing_OnPreReset(EventArgs args)
{
_font.OnLostDevice();
_drawActive = false;
}
private void Drawing_OnEndScene(EventArgs args)
{
if (!IsActive() || !_drawActive)
return;
if (Menu.JungleTimer.GetActive())
{
foreach (JungleCamp jungleCamp in JungleCamps)
{
if (jungleCamp.NextRespawnTime <= 0 || jungleCamp.MapType != GMap._MapType)
continue;
Vector2 sPos = Drawing.WorldToMinimap(jungleCamp.MinimapPosition);
DirectXDrawer.DrawText(_font, (jungleCamp.NextRespawnTime - (int) Game.ClockTime).ToString(),
(int) sPos[0], (int) sPos[1], SharpDX.Color.White);
int time = Menu.Timers.GetMenuItem("SAwarenessTimersRemindTime").GetValue<Slider>().Value;
if (!jungleCamp.Called && jungleCamp.NextRespawnTime - (int) Game.ClockTime <= time &&
jungleCamp.NextRespawnTime - (int) Game.ClockTime >= time - 1)
{
jungleCamp.Called = true;
PingAndCall(jungleCamp.Name + " respawns in " + time + " seconds!", jungleCamp.MinimapPosition);
}
}
}
if (Menu.AltarTimer.GetActive())
{
foreach (Altar altar in Altars)
{
if (altar.Locked)
{
if (altar.NextRespawnTime <= 0 || altar.MapType != GMap._MapType)
continue;
Vector2 sPos = Drawing.WorldToMinimap(altar.Obj.ServerPosition);
DirectXDrawer.DrawText(_font, (altar.NextRespawnTime - (int) Game.ClockTime).ToString(), (int) sPos[0],
(int) sPos[1], SharpDX.Color.White);
int time = Menu.Timers.GetMenuItem("SAwarenessTimersRemindTime").GetValue<Slider>().Value;
if (!altar.Called && altar.NextRespawnTime - (int) Game.ClockTime <= time &&
altar.NextRespawnTime - (int) Game.ClockTime >= time - 1)
{
altar.Called = true;
PingAndCall(altar.Name + " unlocks in " + time + " seconds!", altar.Obj.ServerPosition);
}
}
}
}
if (Menu.RelictTimer.GetActive())
{
foreach (Relic relic in Relics)
{
if (relic.Locked)
{
if (relic.NextRespawnTime <= 0 || relic.MapType != GMap._MapType)
continue;
Vector2 sPos = Drawing.WorldToMinimap(relic.MinimapPosition);
DirectXDrawer.DrawText(_font, (relic.NextRespawnTime - (int) Game.ClockTime).ToString(), (int) sPos[0],
(int) sPos[1], SharpDX.Color.White);
int time = Menu.Timers.GetMenuItem("SAwarenessTimersRemindTime").GetValue<Slider>().Value;
if (!relic.Called && relic.NextRespawnTime - (int) Game.ClockTime <= time &&
relic.NextRespawnTime - (int) Game.ClockTime >= time - 1)
{
relic.Called = true;
PingAndCall(relic.Name + " respawns in " + time + " seconds!", relic.MinimapPosition);
}
}
}
}
if (Menu.InhibitorTimer.GetActive())
{
if (_inhibitors.Inhibitors == null)
return;
foreach (Inhibitor inhibitor in _inhibitors.Inhibitors)
{
if (inhibitor.Locked)
{
if (inhibitor.NextRespawnTime <= 0)
continue;
Vector2 sPos = Drawing.WorldToMinimap(inhibitor.Obj.Position);
DirectXDrawer.DrawText(_font, (inhibitor.NextRespawnTime - (int) Game.ClockTime).ToString(),
(int) sPos[0], (int) sPos[1], SharpDX.Color.White);
int time = Menu.Timers.GetMenuItem("SAwarenessTimersRemindTime").GetValue<Slider>().Value;
if (!inhibitor.Called && inhibitor.NextRespawnTime - (int) Game.ClockTime <= time &&
inhibitor.NextRespawnTime - (int) Game.ClockTime >= time - 1)
{
inhibitor.Called = true;
PingAndCall("Inhibitor respawns in " + time + " seconds!", inhibitor.Obj.Position);
}
}
}
}
if (Menu.HealthTimer.GetActive())
{
foreach (Health health in Healths)
{
if (health.Locked)
{
if (health.NextRespawnTime - (int) Game.ClockTime <= 0 || health.MapId != GMap._MapType)
continue;
Vector2 sPos = Drawing.WorldToMinimap(health.Position);
DirectXDrawer.DrawText(_font, (health.NextRespawnTime - (int) Game.ClockTime).ToString(),
(int) sPos[0], (int) sPos[1], SharpDX.Color.White);
int time = Menu.Timers.GetMenuItem("SAwarenessTimersRemindTime").GetValue<Slider>().Value;
if (!health.Called && health.NextRespawnTime - (int) Game.ClockTime <= time &&
health.NextRespawnTime - (int) Game.ClockTime >= time - 1)
{
health.Called = true;
PingAndCall("Heal respawns in " + time + " seconds!", health.Position);
}
}
}
}
if (Menu.SummonerTimer.GetActive())
{
foreach (var hero in Summoners)
{
Obj_AI_Hero enemy = hero.Key;
for (int i = 0; i < enemy.SummonerSpellbook.Spells.Count(); i++)
{
SpellDataInst spellData = enemy.SummonerSpellbook.Spells[i];
if (hero.Value.Called[i])
{
if (Menu.Timers.GetMenuItem("SAwarenessTimersRemindTime").GetValue<Slider>().Value < spellData.CooldownExpires - Game.ClockTime)
{
hero.Value.Called[i] = false;
}
}
if (!hero.Value.Called[i] && Menu.Timers.GetMenuItem("SAwarenessTimersRemindTime").GetValue<Slider>().Value > spellData.CooldownExpires - Game.ClockTime)
{
hero.Value.Called[i] = true;
String text = enemy.ChampionName + " ";
switch (spellData.Name.ToLower())
{
case "summonerbarrier":
text = text + "Barrier";
break;
case "summonerboost":
text = text + "Cleanse";
break;
case "summonerclairvoyance":
text = text + "Clairvoyance";
break;
case "summonerdot":
text = text + "Ignite";
break;
case "summonerexhaust":
text = text + "Exhaust";
break;
case "summonerflash":
text = text + "Flash";
break;
case "summonerhaste":
text = text + "Ghost";
break;
case "summonerheal":
text = text + "Heal";
break;
case "summonermana":
text = text + "Clarity";
break;
case "summonerodingarrison":
text = text + "Garrison";
break;
case "summonerrevive":
text = text + "Revive";
break;
case "summonersmite":
text = text + "Smite";
break;
case "summonerteleport":
text = text + "Teleport";
break;
}
text = text + " " + Menu.Timers.GetMenuItem("SAwarenessTimersRemindTime").GetValue<Slider>().Value + " sec";
PingAndCall(text, new Vector3(), true, false);
}
}
}
}
}
private void Obj_AI_Base_OnCreate(GameObject sender, EventArgs args)
{
if (!IsActive())
return;
if (sender.IsValid)
{
if (Menu.JungleTimer.GetActive())
{
if (sender.Type == GameObjectType.obj_AI_Minion
&& sender.Team == GameObjectTeam.Neutral)
{
if (JungleMobs.Any(mob => sender.Name.Contains(mob.Name)))
{
JungleMobList.Add((Obj_AI_Minion) sender);
}
}
}
if (Menu.RelictTimer.GetActive())
{
foreach (Relic relic in Relics)
{
if (sender.Name.Contains(relic.ObjectName))
{
relic.Obj = sender;
relic.Locked = false;
}
}
}
}
}
public bool IsBigMob(Obj_AI_Minion jungleBigMob)
{
foreach (JungleMob jungleMob in JungleMobs)
{
if (jungleBigMob.Name.Contains(jungleMob.Name))
{
return jungleMob.Smite;
}
}
return false;
}
public bool IsBossMob(Obj_AI_Minion jungleBossMob)
{
foreach (JungleMob jungleMob in JungleMobs)
{
if (jungleBossMob.SkinName.Contains(jungleMob.Name))
{
return jungleMob.Boss;
}
}
return false;
}
public bool HasBuff(Obj_AI_Minion jungleBigMob)
{
foreach (JungleMob jungleMob in JungleMobs)
{
if (jungleBigMob.SkinName.Contains(jungleMob.Name))
{
return jungleMob.Buff;
}
}
return false;
}
private JungleMob GetJungleMobByName(string name, Utility.Map.MapType mapType)
{
return JungleMobs.Find(jm => jm.Name == name && jm.MapType == mapType);
}
private JungleCamp GetJungleCampByID(int id, Utility.Map.MapType mapType)
{
return JungleCamps.Find(jm => jm.CampId == id && jm.MapType == mapType);
}
public void InitJungleMobs()
{
//All
//_inhibitors = new Inhibitor("Inhibitor", new[] { "Order_Inhibit_Gem.troy", "Chaos_Inhibit_Gem.troy" }, new[] { "Order_Inhibit_Crystal_Shatter.troy", "Chaos_Inhibit_Crystal_Shatter.troy" });
//Summoner's Rift
//JungleMobs.Add(new JungleMob("GreatWraith", null, true, false, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("AncientGolem", null, true, true, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("GiantWolf", null, true, false, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("Wraith", null, true, false, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("LizardElder", null, true, true, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("Golem", null, true, false, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("Worm", null, true, true, true, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("Dragon", null, true, false, true, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("Wight", null, true, false, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("YoungLizard", null, false, false, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("Wolf", null, false, false, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("LesserWraith", null, false, false, false, Utility.Map.MapType.SummonersRift));
//JungleMobs.Add(new JungleMob("SmallGolem", null, false, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Blue", null, true, true, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Murkwolf", null, true, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Razorbeak", null, true, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Red", null, true, true, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Krug", null, true, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Baron", null, true, true, true, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Dragon", null, true, false, true, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Gromp", null, true, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_Crab", null, true, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_RedMini", null, false, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_MurkwolfMini", null, false, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_RazorbeakMini", null, false, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_KrugMini", null, false, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_BlueMini", null, false, false, false, Utility.Map.MapType.SummonersRift));
JungleMobs.Add(new JungleMob("SRU_BlueMini2", null, false, false, false, Utility.Map.MapType.SummonersRift));
//Twisted Treeline
JungleMobs.Add(new JungleMob("TT_NWraith", null, false, false, false, Utility.Map.MapType.TwistedTreeline));
JungleMobs.Add(new JungleMob("TT_NGolem", null, false, false, false, Utility.Map.MapType.TwistedTreeline));
JungleMobs.Add(new JungleMob("TT_NWolf", null, false, false, false, Utility.Map.MapType.TwistedTreeline));
JungleMobs.Add(new JungleMob("TT_Spiderboss", null, true, true, true, Utility.Map.MapType.TwistedTreeline));
JungleMobs.Add(new JungleMob("TT_Relic", null, false, false, false, Utility.Map.MapType.TwistedTreeline));
//Altars.Add(new Altar("Left Altar", "TT_Buffplat_L", null, 180, 85, new[] { "TT_Lock_Blue_L.troy", "TT_Lock_Purple_L.troy", "TT_Lock_Neutral_L.troy" }, new[] { "TT_Unlock_Blue_L.troy", "TT_Unlock_purple_L.troy", "TT_Unlock_Neutral_L.troy" }, 1));
//Altars.Add(new Altar("Right Altar", "TT_Buffplat_R", null, 180, 85, new[] { "TT_Lock_Blue_R.troy", "TT_Lock_Purple_R.troy", "TT_Lock_Neutral_R.troy" }, new[] { "TT_Unlock_Blue_R.troy", "TT_Unlock_purple_R.troy", "TT_Unlock_Neutral_R.troy" }, 1));
//Crystal Scar
Relics.Add(new Relic("Relic",
ObjectManager.Player.Team == GameObjectTeam.Order ? "Odin_Prism_Green.troy" : "Odin_Prism_Red.troy",
GameObjectTeam.Order, null, 180, 180, new Vector3(5500, 6500, 60), new Vector3(5500, 6500, 60)));
Relics.Add(new Relic("Relic",
ObjectManager.Player.Team == GameObjectTeam.Chaos ? "Odin_Prism_Green.troy" : "Odin_Prism_Red.troy",
GameObjectTeam.Chaos, null, 180, 180, new Vector3(7550, 6500, 60), new Vector3(7550, 6500, 60)));
//Howling Abyss
//JungleMobs.Add(new JungleMob("HA_AP_HealthRelic", null, false, false, false, 1));
JungleCamps.Add(new JungleCamp("blue", GameObjectTeam.Order, 1, 115, 300, Utility.Map.MapType.SummonersRift,
new Vector3(3570, 7670, 54), new Vector3(3641.058f, 8144.426f, 1105.46f),
new[]
{
GetJungleMobByName("SRU_Blue", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_BlueMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_BlueMini2", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("wolves", GameObjectTeam.Order, 2, 115, 100, Utility.Map.MapType.SummonersRift,
new Vector3(3430, 6300, 56), new Vector3(3730.419f, 6744.748f, 1100.24f),
new[]
{
GetJungleMobByName("SRU_Murkwolf", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_MurkwolfMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_MurkwolfMini", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("wraiths", GameObjectTeam.Order, 3, 115, 100, Utility.Map.MapType.SummonersRift,
new Vector3(6540, 7230, 56), new Vector3(7069.483f, 5800.1f, 1064.815f),
new[]
{
GetJungleMobByName("SRU_Razorbeak", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RazorbeakMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RazorbeakMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RazorbeakMini", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("red", GameObjectTeam.Order, 4, 115, 300, Utility.Map.MapType.SummonersRift,
new Vector3(7370, 3830, 58), new Vector3(7710.639f, 3963.267f, 1200.182f),
new[]
{
GetJungleMobByName("SRU_Red", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RedMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RedMini", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("golems", GameObjectTeam.Order, 5, 115, 100, Utility.Map.MapType.SummonersRift,
new Vector3(7990, 2550, 54), new Vector3(8419.813f, 3239.516f, 1280.222f),
new[]
{
GetJungleMobByName("SRU_Krug", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_KrugMini", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("wight", GameObjectTeam.Order, 13, 115, 100, Utility.Map.MapType.SummonersRift,
new Vector3(1688, 8248, 54), new Vector3(2263.463f, 8571.541f, 1136.772f),
new[] { GetJungleMobByName("SRU_Gromp", Utility.Map.MapType.SummonersRift) }));
JungleCamps.Add(new JungleCamp("blue", GameObjectTeam.Chaos, 7, 115, 300, Utility.Map.MapType.SummonersRift,
new Vector3(10455, 6800, 55), new Vector3(11014.81f, 7251.099f, 1073.918f),
new[]
{
GetJungleMobByName("SRU_Blue", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_BlueMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_BlueMini2", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("wolves", GameObjectTeam.Chaos, 8, 115, 100, Utility.Map.MapType.SummonersRift,
new Vector3(10570, 8150, 63), new Vector3(11233.96f, 8789.653f, 1051.235f),
new[]
{
GetJungleMobByName("SRU_Murkwolf", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_MurkwolfMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_MurkwolfMini", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("wraiths", GameObjectTeam.Chaos, 9, 115, 100,
Utility.Map.MapType.SummonersRift, new Vector3(7465, 9220, 56), new Vector3(7962.764f, 10028.573f, 1023.06f),
new[]
{
GetJungleMobByName("SRU_Razorbeak", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RazorbeakMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RazorbeakMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RazorbeakMini", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("red", GameObjectTeam.Chaos, 10, 115, 300, Utility.Map.MapType.SummonersRift,
new Vector3(6620, 10637, 55), new Vector3(7164.198f, 11113.5f, 1093.54f),
new[]
{
GetJungleMobByName("SRU_Red", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RedMini", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_RedMini", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("golems", GameObjectTeam.Chaos, 11, 115, 100,
Utility.Map.MapType.SummonersRift, new Vector3(6010, 11920, 40), new Vector3(6508.562f, 12127.83f, 1185.667f),
new[]
{
GetJungleMobByName("SRU_Krug", Utility.Map.MapType.SummonersRift),
GetJungleMobByName("SRU_KrugMini", Utility.Map.MapType.SummonersRift)
}));
JungleCamps.Add(new JungleCamp("wight", GameObjectTeam.Chaos, 14, 115, 100, Utility.Map.MapType.SummonersRift,
new Vector3(12266, 6215, 54), new Vector3(12671.58f, 6617.756f, 1118.074f),
new[] { GetJungleMobByName("SRU_Gromp", Utility.Map.MapType.SummonersRift) }));
JungleCamps.Add(new JungleCamp("crab", GameObjectTeam.Neutral, 15, 2 * 60 + 30, 180, Utility.Map.MapType.SummonersRift,
new Vector3(12266, 6215, 54), new Vector3(10557.22f, 5481.414f, 1068.042f),
new[] { GetJungleMobByName("SRU_Crab", Utility.Map.MapType.SummonersRift) }));
JungleCamps.Add(new JungleCamp("crab", GameObjectTeam.Neutral, 16, 2 * 60 + 30, 180, Utility.Map.MapType.SummonersRift,
new Vector3(12266, 6215, 54), new Vector3(4535.956f, 10104.067f, 1029.071f),
new[] { GetJungleMobByName("SRU_Crab", Utility.Map.MapType.SummonersRift) }));
JungleCamps.Add(new JungleCamp("dragon", GameObjectTeam.Neutral, 6, 2*60 + 30, 360,
Utility.Map.MapType.SummonersRift, new Vector3(9400, 4130, -61), new Vector3(10109.18f, 4850.93f, 1032.274f),
new[] {GetJungleMobByName("Dragon", Utility.Map.MapType.SummonersRift)}));
JungleCamps.Add(new JungleCamp("nashor", GameObjectTeam.Neutral, 12, 20*60, 420,
Utility.Map.MapType.SummonersRift, new Vector3(4620, 10265, -63), new Vector3(4951.034f, 10831.035f, 1027.482f),
new[] {GetJungleMobByName("Worm", Utility.Map.MapType.SummonersRift)}));
JungleCamps.Add(new JungleCamp("wraiths", GameObjectTeam.Order, 1, 100, 50,
Utility.Map.MapType.TwistedTreeline, new Vector3(4414, 5774, 60), new Vector3(4414, 5774, 60),
new[]
{
GetJungleMobByName("TT_NWraith", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NWraith", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NWraith", Utility.Map.MapType.TwistedTreeline)
}));
JungleCamps.Add(new JungleCamp("golems", GameObjectTeam.Order, 2, 100, 50,
Utility.Map.MapType.TwistedTreeline, new Vector3(5088, 8065, 60), new Vector3(5088, 8065, 60),
new[]
{
GetJungleMobByName("TT_NGolem", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NGolem", Utility.Map.MapType.TwistedTreeline)
}));
JungleCamps.Add(new JungleCamp("wolves", GameObjectTeam.Order, 3, 100, 50,
Utility.Map.MapType.TwistedTreeline, new Vector3(6148, 5993, 60), new Vector3(6148, 5993, 60),
new[]
{
GetJungleMobByName("TT_NWolf", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NWolf", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NWolf", Utility.Map.MapType.TwistedTreeline)
}));
JungleCamps.Add(new JungleCamp("wraiths", GameObjectTeam.Chaos, 4, 100, 50,
Utility.Map.MapType.TwistedTreeline, new Vector3(11008, 5775, 60), new Vector3(11008, 5775, 60),
new[]
{
GetJungleMobByName("TT_NWraith", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NWraith", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NWraith", Utility.Map.MapType.TwistedTreeline)
}));
JungleCamps.Add(new JungleCamp("golems", GameObjectTeam.Chaos, 5, 100, 50,
Utility.Map.MapType.TwistedTreeline, new Vector3(10341, 8084, 60), new Vector3(10341, 8084, 60),
new[]
{
GetJungleMobByName("TT_NGolem", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NGolem", Utility.Map.MapType.TwistedTreeline)
}));
JungleCamps.Add(new JungleCamp("wolves", GameObjectTeam.Chaos, 6, 100, 50,
Utility.Map.MapType.TwistedTreeline, new Vector3(9239, 6022, 60), new Vector3(9239, 6022, 60),
new[]
{
GetJungleMobByName("TT_NWolf", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NWolf", Utility.Map.MapType.TwistedTreeline),
GetJungleMobByName("TT_NWolf", Utility.Map.MapType.TwistedTreeline)
}));
JungleCamps.Add(new JungleCamp("heal", GameObjectTeam.Neutral, 7, 115, 90,
Utility.Map.MapType.TwistedTreeline, new Vector3(7711, 6722, 60), new Vector3(7711, 6722, 60),
new[] {GetJungleMobByName("TT_Relic", Utility.Map.MapType.TwistedTreeline)}));
JungleCamps.Add(new JungleCamp("vilemaw", GameObjectTeam.Neutral, 8, 10*60, 300,
Utility.Map.MapType.TwistedTreeline, new Vector3(7711, 10080, 60), new Vector3(7711, 10080, 60),
new[] {GetJungleMobByName("TT_Spiderboss", Utility.Map.MapType.TwistedTreeline)}));
//JungleCamps.Add(new JungleCamp("heal", GameObjectTeam.Neutral, 1, 190, 40, 3, new Vector3(8922, 7868, 60), new Vector3(8922, 7868, 60), new[] { GetJungleMobByName("HA_AP_HealthRelic", 3) }));
//JungleCamps.Add(new JungleCamp("heal", GameObjectTeam.Neutral, 2, 190, 40, 3, new Vector3(7473, 6617, 60), new Vector3(7473, 6617, 60), new[] { GetJungleMobByName("HA_AP_HealthRelic", 3) }));
//JungleCamps.Add(new JungleCamp("heal", GameObjectTeam.Neutral, 3, 190, 40, 3, new Vector3(5929, 5190, 60), new Vector3(5929, 5190, 60), new[] { GetJungleMobByName("HA_AP_HealthRelic", 3) }));
//JungleCamps.Add(new JungleCamp("heal", GameObjectTeam.Neutral, 4, 190, 40, 3, new Vector3(4751, 3901, 60), new Vector3(4751, 3901, 60), new[] { GetJungleMobByName("HA_AP_HealthRelic", 3) }));
foreach (GameObject objAiBase in ObjectManager.Get<GameObject>())
{
Obj_AI_Base_OnCreate(objAiBase, new EventArgs());
}
_inhibitors = new Inhibitor();
foreach (Obj_BarracksDampener inhib in ObjectManager.Get<Obj_BarracksDampener>())
{
_inhibitors.Inhibitors.Add(new Inhibitor(inhib));
}
foreach (Obj_AI_Minion objectType in ObjectManager.Get<Obj_AI_Minion>())
{
if (objectType.Name.Contains("Health"))
Healths.Add(new Health(objectType));
if (objectType.Name.Contains("Buffplat"))
{
if (objectType.Name.Contains("_L"))
Altars.Add(new Altar("Left Altar", objectType));
else
Altars.Add(new Altar("Right Altar", objectType));
}
}
foreach (var hero in ObjectManager.Get<Obj_AI_Hero>())
{
if (hero.IsEnemy)
{
Summoners.Add(hero, new Summoner());
}
}
//foreach (JungleCamp jungleCamp in JungleCamps) //Game.ClockTime BUGGED
//{
// if (Game.ClockTime > 30) //TODO: Reduce when Game.ClockTime got fixed
// {
// jungleCamp.NextRespawnTime = 0;
// }
// int nextRespawnTime = jungleCamp.SpawnTime - (int)Game.ClockTime;
// if (nextRespawnTime > 0)
// {
// jungleCamp.NextRespawnTime = nextRespawnTime;
// }
//}
}
private void Game_OnGameUpdate(EventArgs args)
{
if (!IsActive())
return;
if (Menu.JungleTimer.GetActive())
{
foreach (JungleCamp jungleCamp in JungleCamps)
{
if ((jungleCamp.NextRespawnTime - (int) Game.ClockTime) < 0)
{
jungleCamp.NextRespawnTime = 0;
jungleCamp.Called = false;
}
}
}
if (Menu.AltarTimer.GetActive())
{
var altarDestroyed = new Altar(null, null);
foreach (Altar altar in Altars)
{
if (altar.Obj.IsValid)
{
bool hasBuff = false;
foreach (BuffInstance buff in altar.Obj.Buffs)
{
if (buff.Name == "treelinelanternlock")
{
hasBuff = true;
break;
}
}
if (!hasBuff)
{
altar.Locked = false;
altar.NextRespawnTime = 0;
altar.Called = false;
}
else if (hasBuff && altar.Locked == false)
{
altar.Locked = true;
altar.NextRespawnTime = altar.RespawnTime + (int) Game.ClockTime;
}
}
else
{
if (altar.NextRespawnTime < (int) Game.ClockTime)
{
altarDestroyed = altar;
}
}
}
if (Altars.Remove(altarDestroyed))
{
}
foreach (Obj_AI_Minion altar in ObjectManager.Get<Obj_AI_Minion>())
{
Altar nAltar = null;
if (altar.Name.Contains("Buffplat"))
{
Altar health1 = Altars.Find(jm => jm.Obj.NetworkId == altar.NetworkId);
if (health1 == null)
if (altar.Name.Contains("_L"))
nAltar = new Altar("Left Altar", altar);
else
nAltar = new Altar("Right Altar", altar);
}
if (nAltar != null)
Altars.Add(nAltar);
}
}
if (Menu.RelictTimer.GetActive())
{
foreach (Relic relic in Relics)
{
if (!relic.Locked && (relic.Obj != null && (!relic.Obj.IsValid || relic.Obj.IsDead)))
{
if (Game.ClockTime < relic.SpawnTime)
{
relic.NextRespawnTime = relic.SpawnTime - (int) Game.ClockTime;
}
else
{
relic.NextRespawnTime = relic.RespawnTime + (int) Game.ClockTime;
}
relic.Locked = true;
}
if ((relic.NextRespawnTime - (int) Game.ClockTime) < 0)
{
relic.NextRespawnTime = 0;
relic.Called = false;
}
}
}
//if (Menu.InhibitorTimer.GetActive())
//{
// if (_inhibitors.Inhibitors == null)
// return;
// foreach (var inhibitor in _inhibitors.Inhibitors)
// {
// if (inhibitor.Locked)
// {
// if (inhibitor.NextRespawnTime < Game.ClockTime)
// {
// inhibitor.Locked = false;
// }
// }
// }
//}
if (Menu.HealthTimer.GetActive())
{
var healthDestroyed = new Health(null);
foreach (Health health in Healths)
{
if (health.Obj.IsValid)
if (health.Obj.Health > 0)
{
health.Locked = false;
health.NextRespawnTime = 0;
health.Called = false;
}
else if (health.Obj.Health < 1 && health.Locked == false)
{
health.Locked = true;
health.NextRespawnTime = health.RespawnTime + (int) Game.ClockTime;
}
else
{
if (health.NextRespawnTime < (int) Game.ClockTime)
{
healthDestroyed = health;
}
}
}
if (Healths.Remove(healthDestroyed))
{
}
foreach (Obj_AI_Minion health in ObjectManager.Get<Obj_AI_Minion>())
{
Health nHealth = null;
if (health.Name.Contains("Health"))
{
Health health1 = Healths.Find(jm => jm.Obj.NetworkId == health.NetworkId);
if (health1 == null)
nHealth = new Health(health);
}
if (nHealth != null)
Healths.Add(nHealth);
}
}
if (Menu.InhibitorTimer.GetActive())
{
if (_inhibitors.Inhibitors == null)
return;
foreach (Inhibitor inhibitor in _inhibitors.Inhibitors)
{
if (inhibitor.Obj.Health > 0)
{
inhibitor.Locked = false;
inhibitor.NextRespawnTime = 0;
inhibitor.Called = false;
}
else if (inhibitor.Obj.Health < 1 && inhibitor.Locked == false)
{
inhibitor.Locked = true;
inhibitor.NextRespawnTime = inhibitor.RespawnTime + (int) Game.ClockTime;
}
}
}
}
private void UpdateCamps(int networkId, int campId, byte emptyType)
{
if (emptyType != 3)
{
JungleCamp jungleCamp = GetJungleCampByID(campId, GMap._MapType);
if (jungleCamp != null)
{
jungleCamp.NextRespawnTime = (int) Game.ClockTime + jungleCamp.RespawnTime;
}
}
}
private void EmptyCamp(BinaryReader b)
{
byte[] h = b.ReadBytes(4);
int nwId = BitConverter.ToInt32(h, 0);
h = b.ReadBytes(4);
int cId = BitConverter.ToInt32(h, 0);
byte emptyType = b.ReadByte();
UpdateCamps(nwId, cId, emptyType);
}
private void Game_OnGameProcessPacket(GamePacketEventArgs args) //TODO: Check if Packet is right