-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLibertyCityCustoms.cs
1525 lines (1431 loc) · 60.9 KB
/
LibertyCityCustoms.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
// Decompiled with JetBrains decompiler
// Type: LibertyCityCustoms.Scripts.LibertyCityCustoms
// Assembly: LibertyCityCustoms.net, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: D3EE84B4-074E-4ABA-99F6-4F1E1EEBF973
// Assembly location: D:\Games\Grand Theft Auto IV - The Complete Edition\scripts\LibertyCityCustoms.net.dll
using GTA;
using GTA.@base;
using GTA.Native;
using GTA.value;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using System.Reflection;
using System.Windows.Forms;
using System.Runtime.Serialization;
namespace LibertyCityCustoms.Scripts
{
internal class LibertyCityCustoms : Script
{
private Vector3 out1 = new Vector3(858.73f, -122.11f, 5.4f);
private Vector3 in1 = new Vector3(877.74f, -115.06f, 5.52f);
private Vector3 out2 = new Vector3(737.59f, 1381.7f, 13.69f);
private Vector3 in2 = new Vector3(724.17f, 1381.92f, 13.86f);
private Vector3 out3 = new Vector3(-967.1f, 1880.72f, 21.87f);
private Vector3 in3 = new Vector3(-968.58f, 1895.34f, 21.89f);
private Vector3 out4 = new Vector3(168.33f, 164.44f, 14.3f);
private Vector3 in4 = new Vector3(877.74f, -115.06f, 5.52f);
private Vector3 out5 = new Vector3(-475.43f, 1746.02f, 8.19f);
private Vector3 in5 = new Vector3(877.74f, -115.06f, 5.52f);
private Vector3 out6 = new Vector3(-1099.43f, 660.4f, 8.07f);
private Vector3 in6 = new Vector3(877.74f, -115.06f, 5.52f);
private Vector3 out7 = new Vector3(1185.16f, 1418.91f, 16.77f);
private Vector3 in7 = new Vector3(1185.97f, 1393f, 16.99f);
private Vector3 out8 = new Vector3(618.01f, 1466.86f, 11.35f);
private Vector3 in8 = new Vector3(618.12f, 1477.94f, 12.42f);
private Vector3 exit_pos = new Vector3();
private bool Inside;
private bool SaveMenu;
private List<string> menu = new List<string>();
private List<Vector3> vec = new List<Vector3>();
private List<string> ten_items = new List<string>();
private List<Vehicle> spawned_veh = new List<Vehicle>();
private List<Vehicle> veh_brakes_fast = new List<Vehicle>();
private List<Vehicle> veh_brakes_fastest = new List<Vehicle>();
private Texture arrow;
private Texture bought;
private string menu_name = "";
private int i_num;
private string cur_i = "";
private int repair_cost;
private string category_text = "";
private bool menu_count;
private string previous_menu = "";
private bool show_arrows;
private string i_info = "";
int saveMade;
private int show_from;
private int show_to = 11;
private List<ColorIndex> cols = new List<ColorIndex>();
private ColorIndex base_col;
private ColorIndex specular_col;
private ColorIndex extra_col;
private ColorIndex extra2_col;
private ColorIndex chosen_col;
private Light garage_light;
private Color garage_light_current_color;
private float light_y;
private float light_x;
private float light_z;
private Vector3 garage_light_position;
private string garage_light_name;
private bool Lighting;
private float intensity;
private float light_range;
private Dictionary<Vehicle, Light> lst;
private Vehicle antiTeftCarSave = null;
private List<Vehicle> saved_vehicle = new List<Vehicle>();
private System.Type colors = typeof (Color);
private PropertyInfo[] colorInfo;
private Color cur_light;
private Color chosen_light;
private List<VehicleExtra> extr = new List<VehicleExtra>();
private GTA.Font f;
private GTA.Font f2 = new GTA.Font("AR DESTINE", 0.9f, (FontScaling) 0, true, false);
Blip current_saved_car_blip = null;
// prices
int repair_price = 0;
int color_price = 500;
int wash_price = 20;
int ATS_Basic_price = 1452;
int specular_color_price = 700;
int extra_color_price = 200;
int extra2_color_price = 170;
int basic_defense_price = 20000;
int advance_defense_price = 50000;
public LibertyCityCustoms()
{
this.colorInfo = this.colors.GetProperties(BindingFlags.Static | BindingFlags.Public);
this.lst = new Dictionary<Vehicle, Light>();
this.f = new GTA.Font(0.4f, (FontScaling) 0, true, false);
this.arrow = new Texture(File.ReadAllBytes("./Scripts/LibertyCityCustoms/arrows.png"));
this.bought = new Texture(File.ReadAllBytes("./Scripts/LibertyCityCustoms/bought.png"));
saveMade = Game.GetIntegerStatistic(IntegerStatistic.SAVES_MADE);
if (!File.Exists(this.Settings.Filename))
{
this.Settings.Load();
this.Settings.SetValue("Go_in_garage", "Menu", Keys.Y);
this.Settings.SetValue("Up", "Menu", Keys.Left);
this.Settings.SetValue("Down", "Menu", Keys.Right);
this.Settings.SetValue("x", "Menu", 2f);
this.Settings.SetValue("y", "Menu", 3.5f);
this.Settings.SetValue("Do_function", "Menu", Keys.Return);
this.Settings.SetValue("Back", "Menu", Keys.Back);
this.Settings.SetValue("enabled", "Garage lighting", false);
this.Settings.SetValue("range", "Garage lighting", 10f);
this.Settings.SetValue(nameof (intensity), "Garage lighting", 8f);
this.Settings.SetValue("x", "Garage lighting", 0.0f);
this.Settings.SetValue("y", "Garage lighting", 0.0f);
this.Settings.SetValue("z", "Garage lighting", 4f);
this.Settings.SetValue("color", "Garage lighting", "Green");
this.Settings.Save();
}
this.garage_light = new Light();
this.garage_light_position = new Vector3();
// ISSUE: method pointer
this.BindKey(this.Settings.GetValueKey("Up", "Menu", Keys.W), new KeyPressDelegate(Move_up));
// ISSUE: method pointer
this.BindKey(this.Settings.GetValueKey("Down", "Menu", Keys.S), new KeyPressDelegate(Move_down));
// ISSUE: method pointer
this.PerFrameDrawing += new GraphicsEventHandler(menu_draw);
// ISSUE: method pointer
this.PerFrameDrawing += new GraphicsEventHandler(goin_draw);
// ISSUE: method pointer
this.PerFrameDrawing += new GraphicsEventHandler(money_state);
this.KeyDown += new GTA.KeyEventHandler(menu_nav);
this.Tick += new EventHandler(this.ticks);
this.vec.Add(this.out1);
this.vec.Add(this.out2);
this.vec.Add(this.out3);
this.vec.Add(this.out4);
this.vec.Add(this.out5);
this.vec.Add(this.out6);
this.vec.Add(this.out7);
this.vec.Add(this.out8);
foreach (Vector3 vector3 in this.vec)
{
Blip blip = Blip.AddBlipContact(vector3);
blip.Display = (BlipDisplay) 2;
blip.Icon = (BlipIcon) 75;
blip.Name = "Liberty City Customs";
}
this.light_x = this.Settings.GetValueFloat("x", "Garage lighting", 0.0f);
this.light_y = this.Settings.GetValueFloat("y", "Garage lighting", 0.0f);
this.light_z = this.Settings.GetValueFloat("z", "Garage lighting", 4f);
this.garage_light_name = this.Settings.GetValueString("color", "Garage lighting", "Green");
this.intensity = this.Settings.GetValueFloat(nameof (intensity), "Garage lighting", 8f);
this.light_range = this.Settings.GetValueFloat("range", "Garage lighting", 10f);
this.Lighting = this.Settings.GetValueBool("enabled", "Garage lighting", false);
Game.Console.Print("LibertyCityCustoms V2.2 by Elon loaded !");
this.BindPhoneNumber("000", new PhoneDialDelegate(()=>{ Game.DisplayText("you made a call"); }));
load_veicle();
}
void load_veicle()
{
if (Directory.Exists("scripts\\cars"))
{
int i = 0;
string[] files = Directory.GetFiles(@"scripts\\cars", "*.dat");
foreach (var v in files)
{
//Game.DisplayText(v);
Stream s = File.Open(v, FileMode.Open);
BinaryFormatter b = new BinaryFormatter();
saved_vehicle.Add((Vehicle)b.Deserialize(s));
s.Close();
i++;
}
foreach(Vehicle v in saved_vehicle)
{
//Vehicle vc =GTA.World.CreateVehicle(v.Model, v.Position);
//vc = v;
}
}
}
private void ticks(object sender, EventArgs e)
{
//Game.DisplayText("called " + Game.GetIntegerStatistic(IntegerStatistic.CALLS_MADE_FROM_PHONE));
if (antiTeftCarSave != null)
{
if (saveMade < Game.GetIntegerStatistic(IntegerStatistic.SAVES_MADE))
{
if (antiTeftCarSave.HasMetadata("ATS"))
{
saveMade = Game.GetIntegerStatistic(IntegerStatistic.SAVES_MADE);
BinaryFormatter b = new BinaryFormatter();
if (!Directory.Exists("scripts\\cars"))
{
Directory.CreateDirectory("scripts\\cars");
}
int i = 0;
foreach(Vehicle v in saved_vehicle)
{
Stream s = File.Open("scripts\\cars\\car" + i + ".dat", FileMode.CreateNew);
b.Serialize(s, saved_vehicle);
s.Close();
i++;
}
Game.DisplayText("was saved!!!!");
}
}
if (!this.Player.Character.isInVehicle())
{
if (antiTeftCarSave.HasMetadata("ATS"))
{
if (current_saved_car_blip == null || !current_saved_car_blip.Exists())
{
Game.Console.Print("blip not exist");
//current_saved_car_blip.Delete();
current_saved_car_blip = antiTeftCarSave.AttachBlip();
current_saved_car_blip.Icon = BlipIcon.Building_Garage;
current_saved_car_blip.Name = "Saved car";
current_saved_car_blip.Color = BlipColor.Orange;
}
}
}
else
{
//Game.Console.Print("in car");
if ((current_saved_car_blip != null && current_saved_car_blip.Exists()))
{
current_saved_car_blip.Delete();
}
}
if (antiTeftCarSave.EngineHealth <= 0)
{
current_saved_car_blip.Delete();
antiTeftCarSave.isRequiredForMission = false;
antiTeftCarSave = null;
}
}
if (this.Player.Character.isInVehicle())
{
if(this.Player.Character.CurrentVehicle.HasMetadata("Defense_level"))
{
Player.Character.MakeProofTo(true, false, false, false, false);
}
}
else
{
Player.Character.MakeProofTo(false, false, false, false, false);
}
if (this.lst.Count > 0)
{
foreach (KeyValuePair<Vehicle, Light> keyValuePair in this.lst)
{
if ((([email protected]) keyValuePair.Key).Exists())
{
if (this.Exists((object) keyValuePair.Value))
{
keyValuePair.Value.Position = keyValuePair.Key.GetOffsetPosition(new Vector3(0.0f, 0.0f, -0.35f));
keyValuePair.Value.Intensity = 100f;
keyValuePair.Value.Range = 2.4f;
}
}
else
keyValuePair.Value.Enabled = false;
}
}
if (this.Player.Character.isInVehicle())
{
foreach (Vehicle vehicle in this.veh_brakes_fast)
{
if ((([email protected]) vehicle).Exists())
{
if (HandleObject.Equals((HandleObject) this.Player.Character.CurrentVehicle, (HandleObject) vehicle) && (double) vehicle.Speed > 10.0 && this.Player.Character.CurrentVehicle.isOnAllWheels && Game.isKeyPressed(Keys.Space))
vehicle.Speed -= 0.5f;
}
else
this.veh_brakes_fast.Remove(vehicle);
}
foreach (Vehicle vehicle in this.veh_brakes_fastest)
{
if ((([email protected]) vehicle).Exists())
{
if (HandleObject.Equals((HandleObject) this.Player.Character.CurrentVehicle, (HandleObject) vehicle) && (double) vehicle.Speed > 10.0 && this.Player.Character.CurrentVehicle.isOnAllWheels && Game.isKeyPressed(Keys.Space))
vehicle.Speed -= 3f;
}
else
this.veh_brakes_fast.Remove(vehicle);
}
}
if (!this.Inside)
return;
}
private void Open_menu()
{
repair_price = 1030 - this.Player.Character.CurrentVehicle.Health;
if (this.menu.Count > 0)
this.menu.Clear();
if (this.cols.Count > 0)
this.cols.Clear();
this.SetUpMenu("", false, "", false);
if (this.menu_name == "options")
{
this.SetUpMenu("CATEGORIES", true, "main", false);
this.menu.Add("Menu position");
this.menu.Add("Garage lighting");
}
else if (this.menu_name == "menu_pos")
this.SetUpMenu("MOVE MENU", false, "options", false);
else if (this.menu_name == "main")
{
this.SetUpMenu("CATEGORIES", true, "", false);
this.menu.Add("Respray");
this.menu.Add("Brakes");
this.menu.Add("Defense");
this.menu.Add("Neons");
this.menu.Add("Anti Theft system");
this.menu.Add("Extras");
this.menu.Add("Wash");
//this.menu.Add("Options");
this.menu.Add("Exit");
}
else if (this.menu_name == "repair")
{
this.SetUpMenu("CATEGORIES", false, "", false);
this.menu.Add("Repair " + repair_price + "$");
this.menu.Add("Exit");
}
else if (this.menu_name == "respray")
{
this.SetUpMenu("RESPRAYS", false, "main", false);
this.menu.Add("Primary color "+color_price+"$");
this.menu.Add("Specular color " + specular_color_price+"$");
this.menu.Add("Featured color "+ extra_color_price+"$");
this.menu.Add("Featured2 color " + extra2_color_price + "$");
}
else if (this.menu_name == "Anti Theft system")
{
this.SetUpMenu("Anti Theft system", false, "main", false);
this.menu.Add("Set Basic ATS " + ATS_Basic_price + "$");
}
else if (this.menu_name == "color" || this.menu_name == "specular_color" || this.menu_name == "extra_color" || this.menu_name == "extra2_color")
{
this.SetUpMenu("COLORS", true, "respray", true);
this.SetColors();
}
else if (this.menu_name == "brakes")
{
this.SetUpMenu("CHANGE QUALITY OF BRAKES", false, "main", false);
this.menu.Add("Slow");
this.menu.Add("Fast");
this.menu.Add("Fastest");
}
else if (this.menu_name == "neon")
{
this.SetUpMenu("CATEGORIES", false, "main", false);
if (this.lst.ContainsKey(this.Player.Character.CurrentVehicle))
{
foreach (KeyValuePair<Vehicle, Light> keyValuePair in this.lst)
{
if (HandleObject.Equals((HandleObject) keyValuePair.Key, (HandleObject) this.Player.Character.CurrentVehicle))
this.cur_light = keyValuePair.Value.Color;
}
this.menu.Add("Disable");
this.menu.Add("Color");
}
else
this.menu.Add("Enable");
}
else if (this.menu_name == "neon color")
{
this.SetUpMenu("BY COLORINDEX", true, "neon", true);
for (int index = 0; index < this.colorInfo.Length; ++index)
this.menu.Add(this.colorInfo[index].Name);
}
else if (this.menu_name == "extras")
{
this.SetUpMenu("EXTRAS", false, "main", false);
this.menu.Add("1");
this.menu.Add("2");
this.menu.Add("3");
this.menu.Add("4");
this.menu.Add("5");
this.menu.Add("6");
this.menu.Add("7");
this.menu.Add("8");
this.menu.Add("9");
}
else if (this.menu_name == "Defense")
{
this.SetUpMenu("Defense", false, "main", false);
this.menu.Add("Basic defense "+basic_defense_price + "$");
this.menu.Add("Advance defense " + advance_defense_price + "$");
}
this.show_from = 0;
this.i_num = 0;
this.i_info = "";
if (this.menu.Count <= 0)
return;
this.cur_i = this.menu.ToArray()[0];
}
private void SetColors()
{
this.addcol(ColorIndex.AgateGreen);
this.addcol(ColorIndex.AlabasterSolid);
this.addcol(ColorIndex.AntelopeBeige);
this.addcol(ColorIndex.AnthraciteGrayPoly);
this.addcol(ColorIndex.ArcticPearl);
this.addcol(ColorIndex.ArcticWhite);
this.addcol(ColorIndex.AscotGray);
this.addcol(ColorIndex.AstraSilverPoly);
this.addcol(ColorIndex.BisqueFrostPoly);
this.addcol(ColorIndex.BistonBrownPoly);
this.addcol(ColorIndex.Black);
this.addcol(ColorIndex.BlackPoly);
this.addcol(ColorIndex.BlazeRed);
this.addcol(ColorIndex.Blue);
this.addcol(ColorIndex.BrightBluePoly);
this.addcol(ColorIndex.BrightBluePoly2);
this.addcol(ColorIndex.BrightBluePoly3);
this.addcol(ColorIndex.BrightRed);
this.addcol(ColorIndex.BrightRed2);
this.addcol(ColorIndex.BrilliantRedPoly);
this.addcol(ColorIndex.BrilliantRedPoly2);
this.addcol(ColorIndex.CabernetRedPoly);
this.addcol(ColorIndex.CherryRed);
this.addcol(ColorIndex.ClassicRed);
this.addcol(ColorIndex.ClearCrystalBlueFrostPoly);
this.addcol(ColorIndex.ConcordBluePoly);
this.addcol(ColorIndex.CopperBeige);
this.addcol(ColorIndex.CrystalBluePoly);
this.addcol(ColorIndex.CurrantBluePoly);
this.addcol(ColorIndex.CurrantRedPoly);
this.addcol(ColorIndex.CurrantRedSolid);
this.addcol(ColorIndex.DarkBeechwoodPoly);
this.addcol(ColorIndex.DarkGreenPoly);
this.addcol(ColorIndex.DarkSablePoly);
this.addcol(ColorIndex.DarkSapphireBluePoly);
this.addcol(ColorIndex.DarkTitaniumPoly);
this.addcol(ColorIndex.DeepJewelGreen);
this.addcol(ColorIndex.DesertRed);
this.addcol(ColorIndex.DesertRed2);
this.addcol(ColorIndex.DesertTaupePoly);
this.addcol(ColorIndex.DiamondBluePoly);
this.addcol(ColorIndex.ElectricCurrantRedPoly);
this.addcol(ColorIndex.Flax);
this.addcol(ColorIndex.FormulaRed);
this.addcol(ColorIndex.FrostWhite);
this.addcol(ColorIndex.GarnetRedPoly);
this.addcol(ColorIndex.GracefulRedMica);
this.addcol(ColorIndex.GrayPoly);
this.addcol(ColorIndex.Green);
this.addcol(ColorIndex.Green2);
this.addcol(ColorIndex.GunMetalPoly);
this.addcol(ColorIndex.HarborBluePoly);
this.addcol(ColorIndex.HoneyBeigePoly);
this.addcol(ColorIndex.Hoods);
this.addcol(ColorIndex.JasperGreenPoly);
this.addcol(ColorIndex.LammyOrange);
this.addcol(ColorIndex.LammyYellow);
this.addcol(ColorIndex.LightBeechwoodPoly);
this.addcol(ColorIndex.LightBlueGrey);
this.addcol(ColorIndex.LightChampagnePoly);
this.addcol(ColorIndex.LightCrystalBluePoly);
this.addcol(ColorIndex.LightDriftwoodPoly);
this.addcol(ColorIndex.LightIvory);
this.addcol(ColorIndex.LightSapphireBluePoly);
this.addcol(ColorIndex.LightSapphireBluePoly2);
this.addcol(ColorIndex.LightTitaniumPoly);
this.addcol(ColorIndex.MalachitePoly);
this.addcol(ColorIndex.MarinerBlue);
this.addcol(ColorIndex.MediumBeechwoodPoly);
this.addcol(ColorIndex.MediumCabernetSolid);
this.addcol(ColorIndex.MediumFlax);
this.addcol(ColorIndex.MediumGarnetRedPoly);
this.addcol(ColorIndex.MediumGrayPoly);
this.addcol(ColorIndex.MediumGrayPoly2);
this.addcol(ColorIndex.MediumMauiBluePoly);
this.addcol(ColorIndex.MediumRedSolid);
this.addcol(ColorIndex.MediumSandalwoodPoly);
this.addcol(ColorIndex.MediumSapphireBlueFiremist);
this.addcol(ColorIndex.MediumSapphireBluePoly);
this.addcol(ColorIndex.MedRegattaBluePoly);
this.addcol(ColorIndex.MellowBurgundy);
this.addcol(ColorIndex.MidnightBlue);
this.addcol(ColorIndex.NassauBluePoly);
this.addcol(ColorIndex.NauticalBluePoly);
this.addcol(ColorIndex.OxfordWhiteSolid);
this.addcol(ColorIndex.PastelAlabaster);
this.addcol(ColorIndex.PastelAlabasterSolid);
this.addcol(ColorIndex.PetrolBlueGreenPoly);
this.addcol(ColorIndex.PewterGrayPoly);
this.addcol(ColorIndex.PoliceCarBlue);
this.addcol(ColorIndex.PoliceWhite);
this.addcol(ColorIndex.PorcelainSilverPoly);
this.addcol(ColorIndex.PuebloBeige);
this.addcol(ColorIndex.RaceYellowSolid);
this.addcol(ColorIndex.RioRed);
this.addcol(ColorIndex.SandalwoodFrostPoly);
this.addcol(ColorIndex.SaxonyBluePoly);
this.addcol(ColorIndex.SeafoamPoly);
this.addcol(ColorIndex.SeafoamPoly2);
this.addcol(ColorIndex.SecuricorDarkGreen);
this.addcol(ColorIndex.SecuricorDarkGreen2);
this.addcol(ColorIndex.SecuricorLightGray);
this.addcol(ColorIndex.ShadowSilverPoly);
this.addcol(ColorIndex.SilverPoly);
this.addcol(ColorIndex.SilverStonePoly);
this.addcol(ColorIndex.SilverStonePoly2);
this.addcol(ColorIndex.SlateGray);
this.addcol(ColorIndex.SmokeSilverPoly);
this.addcol(ColorIndex.SpinnakerBlueSolid);
this.addcol(ColorIndex.SteelBluePoly);
this.addcol(ColorIndex.SteelGrayPoly);
this.addcol(ColorIndex.SteelGrayPoly2);
this.addcol(ColorIndex.StrikingBlue);
this.addcol(ColorIndex.SurfBlue);
this.addcol(ColorIndex.TaxiYellow);
this.addcol(ColorIndex.TaxiYellow2);
this.addcol(ColorIndex.TempleCurtainPurple);
this.addcol(ColorIndex.TitaniumFrostPoly);
this.addcol(ColorIndex.TorchRed);
this.addcol(ColorIndex.TorinoRedPearl);
this.addcol(ColorIndex.TurismoRed);
this.addcol(ColorIndex.TwilightBluePoly);
this.addcol(ColorIndex.TwilightBluePoly2);
this.addcol(ColorIndex.UltraBluePoly);
this.addcol(ColorIndex.VermilionSolid);
this.addcol(ColorIndex.VermillionSolid);
this.addcol(ColorIndex.VeryRed);
this.addcol(ColorIndex.VeryWhite);
this.addcol(ColorIndex.WarmGreyMica);
this.addcol(ColorIndex.White);
this.addcol(ColorIndex.WhiteDiamondPearl);
this.addcol(ColorIndex.WildStrawberryPoly);
this.addcol(ColorIndex.WinningSilverPoly);
this.addcol(ColorIndex.WoodrosePoly);
if (Game.CurrentEpisode == GameEpisode.TBOGT)
{
//this.addcol(ColorIndex.));
//this.addcol(ColorIndex.(135));
//this.addcol(ColorIndex.op_Implicit(136));
}
foreach (ColorIndex col in this.cols)
this.menu.Add(((ColorIndex) col).Name);
}
private void SetUpMenu(string category, bool m_count, string prev_menu, bool show_arrow)
{
this.category_text = category;
this.menu_count = m_count;
this.previous_menu = prev_menu;
this.show_arrows = show_arrow;
}
private void addcol(ColorIndex c) => this.cols.Add(c);
private void Move_up()
{
if (this.menu.Count <= 0 || this.i_num <= 0)
return;
--this.i_num;
this.cur_i = this.menu[this.i_num];
if (this.menu.Count <= 11 || this.i_num >= this.show_from || this.show_from <= 0)
return;
this.ten_items.Clear();
--this.show_from;
this.ten_items = this.menu.GetRange(this.show_from, this.show_to);
}
private void Move_down()
{
if (this.menu.Count <= 0 || this.i_num >= this.menu.Count - 1)
return;
++this.i_num;
this.cur_i = this.menu[this.i_num];
if (this.menu.Count <= 11 || this.i_num <= this.show_from + 10 || this.show_from >= this.menu.Count)
return;
this.ten_items.Clear();
++this.show_from;
this.ten_items = this.menu.GetRange(this.show_from, this.show_to);
}
private void SetInGarage(Vector3 position, float heading, Vector3 ex_pos)
{
Function.Call("FORCE_LOADING_SCREEN", new Parameter[1] { 1 });
Vehicle currentVehicle = this.Player.Character.CurrentVehicle;
this.Player.Character.CurrentVehicle.Position = ((Vector3) position).ToGround();
this.Wait(3000);
Function.Call("FORCE_LOADING_SCREEN", new Parameter[1] { 0 });
currentVehicle.Heading = heading;
this.exit_pos = ex_pos;
currentVehicle.PlaceOnGroundProperly();
currentVehicle.FreezePosition = true;
currentVehicle.DoorLock = (DoorLock) 4;
currentVehicle.InteriorLightOn = false;
currentVehicle.HazardLightsOn = false;
this.Inside = true;
this.garage_light.Enabled = true;
this.garage_light.Range = this.intensity;
//make the vehicle repair
if (this.Player.Character.CurrentVehicle.Health < 1000)
{
this.repair_cost = 1000 - this.repair_cost;
this.menu_name = "repair";
this.Open_menu();
}
else
{
this.menu_name = "main";
this.Open_menu();
}
}
private void SetOutOfGarage()
{
Function.Call("FORCE_LOADING_SCREEN", new Parameter[1] { 1 });
this.Inside = false;
this.Player.Character.CurrentVehicle.Position = (this.exit_pos).ToGround();
this.Player.Character.CurrentVehicle.PlaceOnGroundProperly();
this.Player.Character.CurrentVehicle.FreezePosition = false;
this.Player.Character.CurrentVehicle.DoorLock = (DoorLock) 0;
this.i_info = "";
this.garage_light.Enabled = false;
this.Wait(2000);
Function.Call("FORCE_LOADING_SCREEN", new Parameter[1] { 0 });
}
private void GoBack()
{
if (this.previous_menu == "")
{
if (this.SaveMenu)
this.SaveMenu = false;
else
this.SetOutOfGarage();
}
else
{
this.menu_name = this.previous_menu;
this.Open_menu();
}
}
private void NextMenu(string next_menu)
{
this.menu_name = next_menu;
this.Open_menu();
}
private bool paying(int amount)
{
if (this.Player.Money - amount < 0)
{
Game.DisplayText("not enough money, lack of " + amount + "$");
return false;
}
this.Player.Money = this.Player.Money - amount;
return true;
}
private void menu_nav(object sender, GTA.KeyEventArgs e)
{
if (!this.Inside)
{
if (this.SaveMenu || e.Key != this.Settings.GetValueKey("Go_in_garage", "Menu", Keys.Y)||!this.Player.Character.isInVehicle())
return;
Model model = this.Player.Character.CurrentVehicle.Model;
if (!((Model) model).isCar)
return;
Vector3 position1 = this.Player.Character.Position;
if ((double) ((Vector3) position1).DistanceTo(this.out1) < 4.0)
{
this.SetInGarage(((Vector3) this.in1).ToGround(), 88.77f, this.out1);
}
else
{
Vector3 position2 = this.Player.Character.Position;
if ((double) ((Vector3) position2).DistanceTo(this.out2) < 4.0)
{
this.SetInGarage(((Vector3) this.in2).ToGround(), 359.8f, this.out2);
}
else
{
Vector3 position3 = this.Player.Character.Position;
if ((double) ((Vector3) position3).DistanceTo(this.out3) < 4.0)
{
this.SetInGarage(((Vector3) this.in3).ToGround(), this.Player.Character.CurrentVehicle.Heading, this.out3);
}
else
{
Vector3 position4 = this.Player.Character.Position;
if ((double) ((Vector3) position4).DistanceTo(this.out4) < 4.0)
{
this.SetInGarage(((Vector3) this.in4).ToGround(), this.Player.Character.CurrentVehicle.Heading, this.out4);
}
else
{
Vector3 position5 = this.Player.Character.Position;
if ((double) ((Vector3) position5).DistanceTo(this.out5) < 4.0)
{
this.SetInGarage(((Vector3) this.in5).ToGround(), this.Player.Character.CurrentVehicle.Heading, this.out5);
}
else
{
Vector3 position6 = this.Player.Character.Position;
if ((double) ((Vector3) position6).DistanceTo(this.out6) < 4.0)
{
this.SetInGarage(((Vector3) this.in6).ToGround(), this.Player.Character.CurrentVehicle.Heading, this.out6);
}
else
{
Vector3 position7 = this.Player.Character.Position;
if ((double) ((Vector3) position7).DistanceTo(this.out7) < 4.0)
{
this.SetInGarage(((Vector3) this.in7).ToGround(), this.Player.Character.CurrentVehicle.Heading, this.out7);
}
else
{
Vector3 position8 = this.Player.Character.Position;
if ((double) ((Vector3) position8).DistanceTo(this.out8) >= 4.0)
return;
this.SetInGarage(((Vector3) this.in8).ToGround(), this.Player.Character.CurrentVehicle.Heading, this.out8);
}
}
}
}
}
}
}
}
else if (e.Key == this.Settings.GetValueKey("Do_function", "Menu", Keys.Return))
{
if (this.menu.Count <= 0)
return;
if (this.cur_i == "Back" || this.cur_i == "Exit")
this.GoBack();
else if (this.menu_name == "repair")
{
if (!(this.cur_i == ("Repair " + repair_price + "$")))
return;
if(paying(repair_price))
{
this.Player.Character.CurrentVehicle.Repair();
}
this.NextMenu("main");
}
else if (this.menu_name == "main")
{
if (this.cur_i == "Respray")
this.NextMenu("respray");
else if (this.cur_i == "Options")
this.NextMenu("options");
else if (this.cur_i == "Brakes")
this.NextMenu("brakes");
else if (this.cur_i == "Anti Theft system")
this.NextMenu("Anti Theft system");
else if (this.cur_i == "Neons")
this.NextMenu("neon");
else if (this.cur_i == "Wash")
{
if (paying(wash_price))
{
Function.Call<int>("START_PTFX_ON_VEH", new Parameter[9]{"shot_directed_water",
this.Player.Character.CurrentVehicle,-4.7f,-5f,8f,130f,0.0f,500f,5f });
Function.Call<int>("START_PTFX_ON_VEH", new Parameter[9] {"shot_directed_water",
this.Player.Character.CurrentVehicle,7f,0.0f,8f,130f,0.0f,3500f,5f});
this.Inside = false;
this.Wait(2000);
this.Player.Character.CurrentVehicle.Wash();
this.Wait(2000);
this.Inside = true;
}
}
else if (this.cur_i == "Extras")
{
this.NextMenu("extras");
}
else if(this.cur_i == "Defense")
this.NextMenu("Defense");
}
else if (this.menu_name == "respray")
{
if (this.cur_i.Contains("Primary color"))
this.NextMenu("color");
else if (this.cur_i.Contains("Specular color"))
this.NextMenu("specular_color");
else if (this.cur_i.Contains("Featured color"))
this.NextMenu("extra_color");
else if (this.cur_i.Contains("Featured2 color"))
this.NextMenu("extra2_color");
}
else if (this.menu_name == "color")
{
if (this.Player.Money - color_price < 0)
Game.DisplayText("Not enough money");
else
{
this.Player.Money = this.Player.Money - color_price;
this.base_col = this.chosen_col;
}
}
else if (this.menu_name == "specular_color")
{
if (paying(specular_color_price))
this.specular_col = this.chosen_col;
}
else if (this.menu_name == "extra_color")
{
if (paying(specular_color_price))
this.extra_col = this.chosen_col;
}
else if (this.menu_name == "extra2_color")
{
if (paying(extra2_color_price))
this.extra2_col = this.chosen_col;
}
else if (this.menu_name == "garage lightin")
{
this.garage_light_current_color = Color.FromName(this.garage_light_name);
this.garage_light_name = this.garage_light_current_color.Name;
if (this.cur_i == "Position")
this.NextMenu("light position");
else if (this.cur_i == "Intensity")
this.NextMenu("light intensity");
else if (this.cur_i == "Color")
this.NextMenu("light color");
else if (this.cur_i == "Enable" | this.cur_i == "Disable")
{
this.Lighting = !this.Lighting;
this.Settings.SetValue("enabled", "Garage lighting", this.Lighting);
this.NextMenu("garage lighting");
}
else
{
if (!(this.cur_i == "Range"))
return;
this.NextMenu("light range");
}
}
else if (this.menu_name == "light color")
this.garage_light_current_color = Color.FromName(this.garage_light_name);
else if (this.menu_name == "brakes")
{
Vehicle currentVehicle = this.Player.Character.CurrentVehicle;
if (this.cur_i == "Slow")
{
if (this.veh_brakes_fast.Contains(currentVehicle))
{
this.veh_brakes_fast.Remove(currentVehicle);
}
else
{
if (!this.veh_brakes_fastest.Contains(currentVehicle))
return;
this.veh_brakes_fastest.Remove(currentVehicle);
}
}
else if (this.cur_i == "Fast")
{
if (this.veh_brakes_fast.Contains(currentVehicle))
return;
if (this.veh_brakes_fastest.Contains(currentVehicle))
{
this.veh_brakes_fastest.Remove(currentVehicle);
this.veh_brakes_fast.Add(currentVehicle);
}
else
this.veh_brakes_fast.Add(currentVehicle);
}
else
{
if (!(this.cur_i == "Fastest"))
return;
if (this.veh_brakes_fast.Contains(currentVehicle))
{
this.veh_brakes_fast.Remove(currentVehicle);
this.veh_brakes_fastest.Add(currentVehicle);
}
else
{
if (this.veh_brakes_fastest.Contains(currentVehicle))
return;
this.veh_brakes_fastest.Add(currentVehicle);
}
}
}
else if (this.menu_name == "neon")
{
Vehicle currentVehicle = this.Player.Character.CurrentVehicle;
Light light = new Light();
light.Enabled = true;
Dictionary<Vehicle, Light> dictionary = new Dictionary<Vehicle, Light>((IDictionary<Vehicle, Light>)this.lst);
if (this.lst.ContainsKey(currentVehicle))
{
foreach (KeyValuePair<Vehicle, Light> keyValuePair in dictionary)
{
if (HandleObject.Equals((HandleObject)keyValuePair.Key, (HandleObject)this.Player.Character.CurrentVehicle))
{
if (this.cur_i == "Disable")
{
keyValuePair.Value.Disable();
this.lst.Remove(keyValuePair.Key);
this.NextMenu("neon");
}
else if (this.cur_i == "Color")
this.NextMenu("neon color");
}
}
}
else
{
if (!(this.cur_i == "Enable"))
return;
this.lst.Add(currentVehicle, light);
this.NextMenu("neon");
}
}
else if (this.menu_name == "neon color")
{
Dictionary<Vehicle, Light> dictionary = new Dictionary<Vehicle, Light>((IDictionary<Vehicle, Light>)this.lst);
if (!this.lst.ContainsKey(this.Player.Character.CurrentVehicle))
return;
foreach (KeyValuePair<Vehicle, Light> keyValuePair in dictionary)
{
if (HandleObject.Equals((HandleObject)keyValuePair.Key, (HandleObject)this.Player.Character.CurrentVehicle))
{
this.cur_light = this.chosen_light;
keyValuePair.Value.Color = this.cur_light;
}
}
}
else if (this.menu_name == "extras")
{
Vehicle currentVehicle = this.Player.Character.CurrentVehicle;
if (this.cur_i == "1")
this.turn_extra(1);
else if (this.cur_i == "2")