-
-
Notifications
You must be signed in to change notification settings - Fork 392
/
Copy pathMpPedCustomization.cs
2031 lines (1829 loc) · 114 KB
/
MpPedCustomization.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.Linq;
using System.Text;
using System.Threading.Tasks;
using MenuAPI;
using Newtonsoft.Json;
using CitizenFX.Core;
using static CitizenFX.Core.UI.Screen;
using static CitizenFX.Core.Native.API;
using static vMenuClient.CommonFunctions;
using static vMenuClient.MpPedDataManager;
using static vMenuShared.PermissionsManager;
namespace vMenuClient
{
public class MpPedCustomization
{
// Variables
private Menu menu;
public Menu createCharacterMenu = new Menu("Create Character", "Create A New Character");
public Menu savedCharactersMenu = new Menu("vMenu", "Manage Saved Characters");
public Menu inheritanceMenu = new Menu("vMenu", "Character Inheritance Options");
public Menu appearanceMenu = new Menu("vMenu", "Character Appearance Options");
public Menu faceShapeMenu = new Menu("vMenu", "Character Face Shape Options");
public Menu tattoosMenu = new Menu("vMenu", "Character Tattoo Options");
public Menu clothesMenu = new Menu("vMenu", "Character Clothing Options");
public Menu propsMenu = new Menu("vMenu", "Character Props Options");
private Menu manageSavedCharacterMenu = new Menu("vMenu", "Manage MP Character");
public static bool DontCloseMenus { get { return MenuController.PreventExitingMenu; } set { MenuController.PreventExitingMenu = value; } }
public static bool DisableBackButton { get { return MenuController.DisableBackButton; } set { MenuController.DisableBackButton = value; } }
string selectedSavedCharacterManageName = "";
private bool isEdidtingPed = false;
private readonly List<string> facial_expressions = new List<string>() { "mood_Normal_1", "mood_Happy_1", "mood_Angry_1", "mood_Aiming_1", "mood_Injured_1", "mood_stressed_1", "mood_smug_1", "mood_sulk_1", };
private MultiplayerPedData currentCharacter = new MultiplayerPedData();
/// <summary>
/// Makes or updates the character creator menu. Also has an option to load data from the <see cref="currentCharacter"/> data, to allow for editing an existing ped.
/// </summary>
/// <param name="male"></param>
/// <param name="editPed"></param>
private void MakeCreateCharacterMenu(bool male, bool editPed = false)
{
isEdidtingPed = editPed;
if (!editPed)
{
currentCharacter = new MultiplayerPedData();
currentCharacter.DrawableVariations.clothes = new Dictionary<int, KeyValuePair<int, int>>();
currentCharacter.PropVariations.props = new Dictionary<int, KeyValuePair<int, int>>();
currentCharacter.PedHeadBlendData = Game.PlayerPed.GetHeadBlendData();
currentCharacter.Version = 1;
currentCharacter.ModelHash = male ? (uint)GetHashKey("mp_m_freemode_01") : (uint)GetHashKey("mp_f_freemode_01");
currentCharacter.IsMale = male;
SetPedComponentVariation(Game.PlayerPed.Handle, 3, 15, 0, 0);
SetPedComponentVariation(Game.PlayerPed.Handle, 8, 15, 0, 0);
SetPedComponentVariation(Game.PlayerPed.Handle, 11, 15, 0, 0);
}
if (currentCharacter.DrawableVariations.clothes == null)
{
currentCharacter.DrawableVariations.clothes = new Dictionary<int, KeyValuePair<int, int>>();
}
if (currentCharacter.PropVariations.props == null)
{
currentCharacter.PropVariations.props = new Dictionary<int, KeyValuePair<int, int>>();
}
// Set the facial expression to default in case it doesn't exist yet, or keep the current one if it does.
currentCharacter.FacialExpression = currentCharacter.FacialExpression ?? facial_expressions[0];
// Set the facial expression on the ped itself.
SetFacialIdleAnimOverride(Game.PlayerPed.Handle, currentCharacter.FacialExpression ?? facial_expressions[0], null);
// Set the facial expression item list to the correct saved index.
if (createCharacterMenu.GetMenuItems().ElementAt(6) is MenuListItem li)
{
int index = facial_expressions.IndexOf(currentCharacter.FacialExpression ?? facial_expressions[0]);
if (index < 0)
{
index = 0;
}
li.ListIndex = index;
}
appearanceMenu.ClearMenuItems();
tattoosMenu.ClearMenuItems();
clothesMenu.ClearMenuItems();
propsMenu.ClearMenuItems();
#region appearance menu.
List<string> opacity = new List<string>() { "0%", "10%", "20%", "30%", "40%", "50%", "60%", "70%", "80%", "90%", "100%" };
List<string> overlayColorsList = new List<string>();
for (int i = 0; i < GetNumHairColors(); i++)
{
overlayColorsList.Add($"Color #{i + 1}");
}
List<string> hairStylesList = new List<string>();
for (int i = 0; i < GetNumberOfPedDrawableVariations(Game.PlayerPed.Handle, 2); i++)
{
hairStylesList.Add($"Style #{i + 1}");
}
hairStylesList.Add($"Style #{GetNumberOfPedDrawableVariations(Game.PlayerPed.Handle, 2)}");
List<string> blemishesStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(0); i++)
{
blemishesStyleList.Add($"Style #{i + 1}");
}
List<string> beardStylesList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(1); i++)
{
beardStylesList.Add($"Style #{i + 1}");
}
List<string> eyebrowsStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(2); i++)
{
eyebrowsStyleList.Add($"Style #{i + 1}");
}
List<string> ageingStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(3); i++)
{
ageingStyleList.Add($"Style #{i + 1}");
}
List<string> makeupStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(4); i++)
{
makeupStyleList.Add($"Style #{i + 1}");
}
List<string> blushStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(5); i++)
{
blushStyleList.Add($"Style #{i + 1}");
}
List<string> complexionStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(6); i++)
{
complexionStyleList.Add($"Style #{i + 1}");
}
List<string> sunDamageStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(7); i++)
{
sunDamageStyleList.Add($"Style #{i + 1}");
}
List<string> lipstickStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(8); i++)
{
lipstickStyleList.Add($"Style #{i + 1}");
}
List<string> molesFrecklesStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(9); i++)
{
molesFrecklesStyleList.Add($"Style #{i + 1}");
}
List<string> chestHairStyleList = new List<string>();
for (int i = 0; i < GetNumHeadOverlayValues(10); i++)
{
chestHairStyleList.Add($"Style #{i + 1}");
}
List<string> eyeColorList = new List<string>();
for (int i = 0; i < 32; i++)
{
eyeColorList.Add($"Eye Color #{i + 1}");
}
/*
0 Blemishes 0 - 23, 255
1 Facial Hair 0 - 28, 255
2 Eyebrows 0 - 33, 255
3 Ageing 0 - 14, 255
4 Makeup 0 - 74, 255
5 Blush 0 - 6, 255
6 Complexion 0 - 11, 255
7 Sun Damage 0 - 10, 255
8 Lipstick 0 - 9, 255
9 Moles/Freckles 0 - 17, 255
10 Chest Hair 0 - 16, 255
11 Body Blemishes 0 - 11, 255
12 Add Body Blemishes 0 - 1, 255
*/
// hair
int currentHairStyle = editPed ? currentCharacter.PedAppearance.hairStyle : GetPedDrawableVariation(Game.PlayerPed.Handle, 2);
int currentHairColor = editPed ? currentCharacter.PedAppearance.hairColor : 0;
int currentHairHighlightColor = editPed ? currentCharacter.PedAppearance.hairHighlightColor : 0;
// 0 blemishes
int currentBlemishesStyle = editPed ? currentCharacter.PedAppearance.blemishesStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 0) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 0) : 0;
float currentBlemishesOpacity = editPed ? currentCharacter.PedAppearance.blemishesOpacity : 0f;
SetPedHeadOverlay(Game.PlayerPed.Handle, 0, currentBlemishesStyle, currentBlemishesOpacity);
// 1 beard
int currentBeardStyle = editPed ? currentCharacter.PedAppearance.beardStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 1) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 1) : 0;
float currentBeardOpacity = editPed ? currentCharacter.PedAppearance.beardOpacity : 0f;
int currentBeardColor = editPed ? currentCharacter.PedAppearance.beardColor : 0;
SetPedHeadOverlay(Game.PlayerPed.Handle, 1, currentBeardStyle, currentBeardOpacity);
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 1, 1, currentBeardColor, currentBeardColor);
// 2 eyebrows
int currentEyebrowStyle = editPed ? currentCharacter.PedAppearance.eyebrowsStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 2) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 2) : 0;
float currentEyebrowOpacity = editPed ? currentCharacter.PedAppearance.eyebrowsOpacity : 0f;
int currentEyebrowColor = editPed ? currentCharacter.PedAppearance.eyebrowsColor : 0;
SetPedHeadOverlay(Game.PlayerPed.Handle, 2, currentEyebrowStyle, currentEyebrowOpacity);
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 2, 1, currentEyebrowColor, currentEyebrowColor);
// 3 ageing
int currentAgeingStyle = editPed ? currentCharacter.PedAppearance.ageingStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 3) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 3) : 0;
float currentAgeingOpacity = editPed ? currentCharacter.PedAppearance.ageingOpacity : 0f;
SetPedHeadOverlay(Game.PlayerPed.Handle, 3, currentAgeingStyle, currentAgeingOpacity);
// 4 makeup
int currentMakeupStyle = editPed ? currentCharacter.PedAppearance.makeupStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 4) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 4) : 0;
float currentMakeupOpacity = editPed ? currentCharacter.PedAppearance.makeupOpacity : 0f;
int currentMakeupColor = editPed ? currentCharacter.PedAppearance.makeupColor : 0;
SetPedHeadOverlay(Game.PlayerPed.Handle, 4, currentMakeupStyle, currentMakeupOpacity);
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 4, 2, currentMakeupColor, currentMakeupColor);
// 5 blush
int currentBlushStyle = editPed ? currentCharacter.PedAppearance.blushStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 5) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 5) : 0;
float currentBlushOpacity = editPed ? currentCharacter.PedAppearance.blushOpacity : 0f;
int currentBlushColor = editPed ? currentCharacter.PedAppearance.blushColor : 0;
SetPedHeadOverlay(Game.PlayerPed.Handle, 5, currentBlushStyle, currentBlushOpacity);
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 5, 2, currentBlushColor, currentBlushColor);
// 6 complexion
int currentComplexionStyle = editPed ? currentCharacter.PedAppearance.complexionStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 6) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 6) : 0;
float currentComplexionOpacity = editPed ? currentCharacter.PedAppearance.complexionOpacity : 0f;
SetPedHeadOverlay(Game.PlayerPed.Handle, 6, currentComplexionStyle, currentComplexionOpacity);
// 7 sun damage
int currentSunDamageStyle = editPed ? currentCharacter.PedAppearance.sunDamageStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 7) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 7) : 0;
float currentSunDamageOpacity = editPed ? currentCharacter.PedAppearance.sunDamageOpacity : 0f;
SetPedHeadOverlay(Game.PlayerPed.Handle, 7, currentSunDamageStyle, currentSunDamageOpacity);
// 8 lipstick
int currentLipstickStyle = editPed ? currentCharacter.PedAppearance.lipstickStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 8) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 8) : 0;
float currentLipstickOpacity = editPed ? currentCharacter.PedAppearance.lipstickOpacity : 0f;
int currentLipstickColor = editPed ? currentCharacter.PedAppearance.lipstickColor : 0;
SetPedHeadOverlay(Game.PlayerPed.Handle, 8, currentLipstickStyle, currentLipstickOpacity);
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 8, 2, currentLipstickColor, currentLipstickColor);
// 9 moles/freckles
int currentMolesFrecklesStyle = editPed ? currentCharacter.PedAppearance.molesFrecklesStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 9) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 9) : 0;
float currentMolesFrecklesOpacity = editPed ? currentCharacter.PedAppearance.molesFrecklesOpacity : 0f;
SetPedHeadOverlay(Game.PlayerPed.Handle, 9, currentMolesFrecklesStyle, currentMolesFrecklesOpacity);
// 10 chest hair
int currentChesthairStyle = editPed ? currentCharacter.PedAppearance.chestHairStyle : GetPedHeadOverlayValue(Game.PlayerPed.Handle, 10) != 255 ? GetPedHeadOverlayValue(Game.PlayerPed.Handle, 10) : 0;
float currentChesthairOpacity = editPed ? currentCharacter.PedAppearance.chestHairOpacity : 0f;
int currentChesthairColor = editPed ? currentCharacter.PedAppearance.chestHairColor : 0;
SetPedHeadOverlay(Game.PlayerPed.Handle, 10, currentChesthairStyle, currentChesthairOpacity);
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 10, 1, currentChesthairColor, currentChesthairColor);
int currentEyeColor = editPed ? currentCharacter.PedAppearance.eyeColor : 0;
SetPedEyeColor(Game.PlayerPed.Handle, currentEyeColor);
MenuListItem hairStyles = new MenuListItem("Hair Style", hairStylesList, currentHairStyle, "Select a hair style.");
//MenuListItem hairColors = new MenuListItem("Hair Color", overlayColorsList, currentHairColor, "Select a hair color.");
MenuListItem hairColors = new MenuListItem("Hair Color", overlayColorsList, currentHairColor, "Select a hair color.") { ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair };
//MenuListItem hairHighlightColors = new MenuListItem("Hair Highlight Color", overlayColorsList, currentHairHighlightColor, "Select a hair highlight color.");
MenuListItem hairHighlightColors = new MenuListItem("Hair Highlight Color", overlayColorsList, currentHairHighlightColor, "Select a hair highlight color.") { ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair };
MenuListItem blemishesStyle = new MenuListItem("Blemishes Style", blemishesStyleList, currentBlemishesStyle, "Select a blemishes style.");
//MenuSliderItem blemishesOpacity = new MenuSliderItem("Blemishes Opacity", "Select a blemishes opacity.", 0, 10, (int)(currentBlemishesOpacity * 10f), false);
MenuListItem blemishesOpacity = new MenuListItem("Blemishes Opacity", opacity, (int)(currentBlemishesOpacity * 10f), "Select a blemishes opacity.") { ShowOpacityPanel = true };
MenuListItem beardStyles = new MenuListItem("Beard Style", beardStylesList, currentBeardStyle, "Select a beard/facial hair style.");
MenuListItem beardOpacity = new MenuListItem("Beard Opacity", opacity, (int)(currentBeardOpacity * 10f), "Select the opacity for your beard/facial hair.") { ShowOpacityPanel = true };
MenuListItem beardColor = new MenuListItem("Beard Color", overlayColorsList, currentBeardColor, "Select a beard color.") { ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair };
//MenuSliderItem beardOpacity = new MenuSliderItem("Beard Opacity", "Select the opacity for your beard/facial hair.", 0, 10, (int)(currentBeardOpacity * 10f), false);
//MenuListItem beardColor = new MenuListItem("Beard Color", overlayColorsList, currentBeardColor, "Select a beard color");
MenuListItem eyebrowStyle = new MenuListItem("Eyebrows Style", eyebrowsStyleList, currentEyebrowStyle, "Select an eyebrows style.");
MenuListItem eyebrowOpacity = new MenuListItem("Eyebrows Opacity", opacity, (int)(currentEyebrowOpacity * 10f), "Select the opacity for your eyebrows.") { ShowOpacityPanel = true };
MenuListItem eyebrowColor = new MenuListItem("Eyebrows Color", overlayColorsList, currentEyebrowColor, "Select an eyebrows color.") { ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair };
//MenuSliderItem eyebrowOpacity = new MenuSliderItem("Eyebrows Opacity", "Select the opacity for your eyebrows.", 0, 10, (int)(currentEyebrowOpacity * 10f), false);
MenuListItem ageingStyle = new MenuListItem("Ageing Style", ageingStyleList, currentAgeingStyle, "Select an ageing style.");
MenuListItem ageingOpacity = new MenuListItem("Ageing Opacity", opacity, (int)(currentAgeingOpacity * 10f), "Select an ageing opacity.") { ShowOpacityPanel = true };
//MenuSliderItem ageingOpacity = new MenuSliderItem("Ageing Opacity", "Select an ageing opacity.", 0, 10, (int)(currentAgeingOpacity * 10f), false);
MenuListItem makeupStyle = new MenuListItem("Makeup Style", makeupStyleList, currentMakeupStyle, "Select a makeup style.");
MenuListItem makeupOpacity = new MenuListItem("Makeup Opacity", opacity, (int)(currentMakeupOpacity * 10f), "Select a makeup opacity") { ShowOpacityPanel = true };
//MenuSliderItem makeupOpacity = new MenuSliderItem("Makeup Opacity", 0, 10, (int)(currentMakeupOpacity * 10f), "Select a makeup opacity.");
MenuListItem makeupColor = new MenuListItem("Makeup Color", overlayColorsList, currentMakeupColor, "Select a makeup color.") { ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Makeup };
MenuListItem blushStyle = new MenuListItem("Blush Style", blushStyleList, currentBlushStyle, "Select a blush style.");
MenuListItem blushOpacity = new MenuListItem("Blush Opacity", opacity, (int)(currentBlushOpacity * 10f), "Select a blush opacity.") { ShowOpacityPanel = true };
//MenuSliderItem blushOpacity = new MenuSliderItem("Blush Opacity", 0, 10, (int)(currentBlushOpacity * 10f), "Select a blush opacity.");
MenuListItem blushColor = new MenuListItem("Blush Color", overlayColorsList, currentBlushColor, "Select a blush color.") { ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Makeup };
MenuListItem complexionStyle = new MenuListItem("Complexion Style", complexionStyleList, currentComplexionStyle, "Select a complexion style.");
//MenuSliderItem complexionOpacity = new MenuSliderItem("Complexion Opacity", 0, 10, (int)(currentComplexionOpacity * 10f), "Select a complexion opacity.");
MenuListItem complexionOpacity = new MenuListItem("Complexion Opacity", opacity, (int)(currentComplexionOpacity * 10f), "Select a complexion opacity.") { ShowOpacityPanel = true };
MenuListItem sunDamageStyle = new MenuListItem("Sun Damage Style", sunDamageStyleList, currentSunDamageStyle, "Select a sun damage style.");
//MenuSliderItem sunDamageOpacity = new MenuSliderItem("Sun Damage Opacity", 0, 10, (int)(currentSunDamageOpacity * 10f), "Select a sun damage opacity.");
MenuListItem sunDamageOpacity = new MenuListItem("Sun Damage Opacity", opacity, (int)(currentSunDamageOpacity * 10f), "Select a sun damage opacity.") { ShowOpacityPanel = true };
MenuListItem lipstickStyle = new MenuListItem("Lipstick Style", lipstickStyleList, currentLipstickStyle, "Select a lipstick style.");
//MenuSliderItem lipstickOpacity = new MenuSliderItem("Lipstick Opacity", 0, 10, (int)(currentLipstickOpacity * 10f), "Select a lipstick opacity.");
MenuListItem lipstickOpacity = new MenuListItem("Lipstick Opacity", opacity, (int)(currentLipstickOpacity * 10f), "Select a lipstick opacity.") { ShowOpacityPanel = true };
MenuListItem lipstickColor = new MenuListItem("Lipstick Color", overlayColorsList, currentLipstickColor, "Select a lipstick color.") { ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Makeup };
MenuListItem molesFrecklesStyle = new MenuListItem("Moles and Freckles Style", molesFrecklesStyleList, currentMolesFrecklesStyle, "Select a moles and freckles style.");
//MenuSliderItem molesFrecklesOpacity = new MenuSliderItem("Moles and Freckles Opacity", 0, 10, (int)(currentMolesFrecklesOpacity * 10f), "Select a moles and freckles opacity.");
MenuListItem molesFrecklesOpacity = new MenuListItem("Moles and Freckles Opacity", opacity, (int)(currentMolesFrecklesOpacity * 10f), "Select a moles and freckles opacity.") { ShowOpacityPanel = true };
MenuListItem chestHairStyle = new MenuListItem("Chest Hair Style", chestHairStyleList, currentChesthairStyle, "Select a chest hair style.");
//MenuSliderItem chestHairOpacity = new MenuSliderItem("Chest Hair Opacity", 0, 10, (int)(currentChesthairOpacity * 10f), "Select a chest hair opacity.");
MenuListItem chestHairOpacity = new MenuListItem("Chest Hair Opacity", opacity, (int)(currentChesthairOpacity * 10f), "Select a chest hair opacity.") { ShowOpacityPanel = true };
MenuListItem chestHairColor = new MenuListItem("Chest Hair Color", overlayColorsList, currentChesthairColor, "Select a chest hair color.") { ShowColorPanel = true, ColorPanelColorType = MenuListItem.ColorPanelType.Hair };
MenuListItem eyeColor = new MenuListItem("Eye Colors", eyeColorList, currentEyeColor, "Select an eye/contact lens color.");
appearanceMenu.AddMenuItem(hairStyles);
appearanceMenu.AddMenuItem(hairColors);
appearanceMenu.AddMenuItem(hairHighlightColors);
appearanceMenu.AddMenuItem(blemishesStyle);
appearanceMenu.AddMenuItem(blemishesOpacity);
appearanceMenu.AddMenuItem(beardStyles);
appearanceMenu.AddMenuItem(beardOpacity);
appearanceMenu.AddMenuItem(beardColor);
appearanceMenu.AddMenuItem(eyebrowStyle);
appearanceMenu.AddMenuItem(eyebrowOpacity);
appearanceMenu.AddMenuItem(eyebrowColor);
appearanceMenu.AddMenuItem(ageingStyle);
appearanceMenu.AddMenuItem(ageingOpacity);
appearanceMenu.AddMenuItem(makeupStyle);
appearanceMenu.AddMenuItem(makeupOpacity);
appearanceMenu.AddMenuItem(makeupColor);
appearanceMenu.AddMenuItem(blushStyle);
appearanceMenu.AddMenuItem(blushOpacity);
appearanceMenu.AddMenuItem(blushColor);
appearanceMenu.AddMenuItem(complexionStyle);
appearanceMenu.AddMenuItem(complexionOpacity);
appearanceMenu.AddMenuItem(sunDamageStyle);
appearanceMenu.AddMenuItem(sunDamageOpacity);
appearanceMenu.AddMenuItem(lipstickStyle);
appearanceMenu.AddMenuItem(lipstickOpacity);
appearanceMenu.AddMenuItem(lipstickColor);
appearanceMenu.AddMenuItem(molesFrecklesStyle);
appearanceMenu.AddMenuItem(molesFrecklesOpacity);
appearanceMenu.AddMenuItem(chestHairStyle);
appearanceMenu.AddMenuItem(chestHairOpacity);
appearanceMenu.AddMenuItem(chestHairColor);
appearanceMenu.AddMenuItem(eyeColor);
if (male)
{
// There are weird people out there that wanted makeup for male characters
// so yeah.... here you go I suppose... strange...
/*
makeupStyle.Enabled = false;
makeupStyle.LeftIcon = MenuItem.Icon.LOCK;
makeupStyle.Description = "This is not available for male characters.";
makeupOpacity.Enabled = false;
makeupOpacity.LeftIcon = MenuItem.Icon.LOCK;
makeupOpacity.Description = "This is not available for male characters.";
makeupColor.Enabled = false;
makeupColor.LeftIcon = MenuItem.Icon.LOCK;
makeupColor.Description = "This is not available for male characters.";
blushStyle.Enabled = false;
blushStyle.LeftIcon = MenuItem.Icon.LOCK;
blushStyle.Description = "This is not available for male characters.";
blushOpacity.Enabled = false;
blushOpacity.LeftIcon = MenuItem.Icon.LOCK;
blushOpacity.Description = "This is not available for male characters.";
blushColor.Enabled = false;
blushColor.LeftIcon = MenuItem.Icon.LOCK;
blushColor.Description = "This is not available for male characters.";
lipstickStyle.Enabled = false;
lipstickStyle.LeftIcon = MenuItem.Icon.LOCK;
lipstickStyle.Description = "This is not available for male characters.";
lipstickOpacity.Enabled = false;
lipstickOpacity.LeftIcon = MenuItem.Icon.LOCK;
lipstickOpacity.Description = "This is not available for male characters.";
lipstickColor.Enabled = false;
lipstickColor.LeftIcon = MenuItem.Icon.LOCK;
lipstickColor.Description = "This is not available for male characters.";
*/
}
else
{
beardStyles.Enabled = false;
beardStyles.LeftIcon = MenuItem.Icon.LOCK;
beardStyles.Description = "This is not available for female characters.";
beardOpacity.Enabled = false;
beardOpacity.LeftIcon = MenuItem.Icon.LOCK;
beardOpacity.Description = "This is not available for female characters.";
beardColor.Enabled = false;
beardColor.LeftIcon = MenuItem.Icon.LOCK;
beardColor.Description = "This is not available for female characters.";
chestHairStyle.Enabled = false;
chestHairStyle.LeftIcon = MenuItem.Icon.LOCK;
chestHairStyle.Description = "This is not available for female characters.";
chestHairOpacity.Enabled = false;
chestHairOpacity.LeftIcon = MenuItem.Icon.LOCK;
chestHairOpacity.Description = "This is not available for female characters.";
chestHairColor.Enabled = false;
chestHairColor.LeftIcon = MenuItem.Icon.LOCK;
chestHairColor.Description = "This is not available for female characters.";
}
#endregion
#region clothing options menu
string[] clothingCategoryNames = new string[12] { "Unused (head)", "Masks", "Unused (hair)", "Upper Body", "Lower Body", "Bags & Parachutes", "Shoes", "Scarfs & Chains", "Shirt & Accessory", "Body Armor & Accessory 2", "Badges & Logos", "Shirt Overlay & Jackets" };
for (int i = 0; i < 12; i++)
{
if (i != 0 && i != 2)
{
int currentVariationIndex = editPed && currentCharacter.DrawableVariations.clothes.ContainsKey(i) ? currentCharacter.DrawableVariations.clothes[i].Key : GetPedDrawableVariation(Game.PlayerPed.Handle, i);
int currentVariationTextureIndex = editPed && currentCharacter.DrawableVariations.clothes.ContainsKey(i) ? currentCharacter.DrawableVariations.clothes[i].Value : GetPedTextureVariation(Game.PlayerPed.Handle, i);
List<string> items = new List<string>();
for (int x = 0; x < GetNumberOfPedDrawableVariations(Game.PlayerPed.Handle, i); x++)
{
items.Add($"Drawable #{x} (of {GetNumberOfPedDrawableVariations(Game.PlayerPed.Handle, i)})");
}
MenuListItem listItem = new MenuListItem(clothingCategoryNames[i], items, currentVariationIndex, $"Select a drawable using the arrow keys and press ~o~enter~s~ to cycle through all available textures. Currently selected texture: #{currentVariationTextureIndex}.");
clothesMenu.AddMenuItem(listItem);
}
}
#endregion
#region props options menu
string[] propNames = new string[5] { "Hats & Helmets", "Glasses", "Misc Props", "Watches", "Bracelets" };
for (int x = 0; x < 5; x++)
{
int propId = x;
if (x > 2)
{
propId += 3;
}
int currentProp = editPed && currentCharacter.PropVariations.props.ContainsKey(propId) ? currentCharacter.PropVariations.props[propId].Key : GetPedPropIndex(Game.PlayerPed.Handle, propId);
int currentPropTexture = editPed && currentCharacter.PropVariations.props.ContainsKey(propId) ? currentCharacter.PropVariations.props[propId].Value : GetPedPropTextureIndex(Game.PlayerPed.Handle, propId);
List<string> propsList = new List<string>();
for (int i = 0; i < GetNumberOfPedPropDrawableVariations(Game.PlayerPed.Handle, propId); i++)
{
propsList.Add($"Prop #{i} (of {GetNumberOfPedPropDrawableVariations(Game.PlayerPed.Handle, propId)})");
}
propsList.Add("No Prop");
if (GetPedPropIndex(Game.PlayerPed.Handle, propId) != -1)
{
MenuListItem propListItem = new MenuListItem($"{propNames[x]}", propsList, currentProp, $"Select a prop using the arrow keys and press ~o~enter~s~ to cycle through all available textures. Currently selected texture: #{currentPropTexture}.");
propsMenu.AddMenuItem(propListItem);
}
else
{
MenuListItem propListItem = new MenuListItem($"{propNames[x]}", propsList, currentProp, "Select a prop using the arrow keys and press ~o~enter~s~ to cycle through all available textures.");
propsMenu.AddMenuItem(propListItem);
}
}
#endregion
#region face features menu
foreach (MenuSliderItem item in faceShapeMenu.GetMenuItems())
{
if (editPed)
{
if (currentCharacter.FaceShapeFeatures.features == null)
{
currentCharacter.FaceShapeFeatures.features = new Dictionary<int, float>();
}
else
{
if (currentCharacter.FaceShapeFeatures.features.ContainsKey(faceShapeMenu.GetMenuItems().IndexOf(item)))
{
item.Position = (int)(currentCharacter.FaceShapeFeatures.features[faceShapeMenu.GetMenuItems().IndexOf(item)] * 10f) + 10;
SetPedFaceFeature(Game.PlayerPed.Handle, faceShapeMenu.GetMenuItems().IndexOf(item), currentCharacter.FaceShapeFeatures.features[faceShapeMenu.GetMenuItems().IndexOf(item)]);
}
else
{
item.Position = 10;
SetPedFaceFeature(Game.PlayerPed.Handle, faceShapeMenu.GetMenuItems().IndexOf(item), 0f);
}
}
}
else
{
item.Position = 10;
SetPedFaceFeature(PlayerPedId(), faceShapeMenu.GetMenuItems().IndexOf(item), 0f);
}
}
#endregion
#region Tattoos menu
List<string> headTattoosList = new List<string>();
List<string> torsoTattoosList = new List<string>();
List<string> leftArmTattoosList = new List<string>();
List<string> rightArmTattoosList = new List<string>();
List<string> leftLegTattoosList = new List<string>();
List<string> rightLegTattoosList = new List<string>();
if (male)
{
int counter = 1;
foreach (var tattoo in TattoosData.MaleTattoos.HEAD)
{
headTattoosList.Add($"Tattoo #{counter} (of {TattoosData.MaleTattoos.HEAD.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.MaleTattoos.TORSO)
{
torsoTattoosList.Add($"Tattoo #{counter} (of {TattoosData.MaleTattoos.TORSO.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.MaleTattoos.LEFT_ARM)
{
leftArmTattoosList.Add($"Tattoo #{counter} (of {TattoosData.MaleTattoos.LEFT_ARM.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.MaleTattoos.RIGHT_ARM)
{
rightArmTattoosList.Add($"Tattoo #{counter} (of {TattoosData.MaleTattoos.RIGHT_ARM.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.MaleTattoos.LEFT_LEG)
{
leftLegTattoosList.Add($"Tattoo #{counter} (of {TattoosData.MaleTattoos.LEFT_LEG.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.MaleTattoos.RIGHT_LEG)
{
rightLegTattoosList.Add($"Tattoo #{counter} (of {TattoosData.MaleTattoos.RIGHT_LEG.Count})");
counter++;
}
}
else
{
int counter = 1;
foreach (var tattoo in TattoosData.FemaleTattoos.HEAD)
{
headTattoosList.Add($"Tattoo #{counter} (of {TattoosData.FemaleTattoos.HEAD.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.FemaleTattoos.TORSO)
{
torsoTattoosList.Add($"Tattoo #{counter} (of {TattoosData.FemaleTattoos.TORSO.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.FemaleTattoos.LEFT_ARM)
{
leftArmTattoosList.Add($"Tattoo #{counter} (of {TattoosData.FemaleTattoos.LEFT_ARM.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.FemaleTattoos.RIGHT_ARM)
{
rightArmTattoosList.Add($"Tattoo #{counter} (of {TattoosData.FemaleTattoos.RIGHT_ARM.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.FemaleTattoos.LEFT_LEG)
{
leftLegTattoosList.Add($"Tattoo #{counter} (of {TattoosData.FemaleTattoos.LEFT_LEG.Count})");
counter++;
}
counter = 1;
foreach (var tattoo in TattoosData.FemaleTattoos.RIGHT_LEG)
{
rightLegTattoosList.Add($"Tattoo #{counter} (of {TattoosData.FemaleTattoos.RIGHT_LEG.Count})");
counter++;
}
}
const string tatDesc = "Cycle through the list to preview tattoos. If you like one, press enter to select it, selecting it will add the tattoo if you don't already have it. If you already have that tattoo then the tattoo will be removed.";
MenuListItem headTatts = new MenuListItem("Head Tattoos", headTattoosList, 0, tatDesc);
MenuListItem torsoTatts = new MenuListItem("Torso Tattoos", torsoTattoosList, 0, tatDesc);
MenuListItem leftArmTatts = new MenuListItem("Left Arm Tattoos", leftArmTattoosList, 0, tatDesc);
MenuListItem rightArmTatts = new MenuListItem("Right Arm Tattoos", rightArmTattoosList, 0, tatDesc);
MenuListItem leftLegTatts = new MenuListItem("Left Leg Tattoos", leftLegTattoosList, 0, tatDesc);
MenuListItem rightLegTatts = new MenuListItem("Right Leg Tattoos", rightLegTattoosList, 0, tatDesc);
tattoosMenu.AddMenuItem(headTatts);
tattoosMenu.AddMenuItem(torsoTatts);
tattoosMenu.AddMenuItem(leftArmTatts);
tattoosMenu.AddMenuItem(rightArmTatts);
tattoosMenu.AddMenuItem(leftLegTatts);
tattoosMenu.AddMenuItem(rightLegTatts);
tattoosMenu.AddMenuItem(new MenuItem("Remove All Tattoos", "Click this if you want to remove all tattoos and start over."));
#endregion
createCharacterMenu.RefreshIndex();
appearanceMenu.RefreshIndex();
inheritanceMenu.RefreshIndex();
tattoosMenu.RefreshIndex();
}
/// <summary>
/// Saves the mp character and quits the editor if successful.
/// </summary>
/// <returns></returns>
private async Task<bool> SavePed()
{
currentCharacter.PedHeadBlendData = Game.PlayerPed.GetHeadBlendData();
if (isEdidtingPed)
{
string json = JsonConvert.SerializeObject(currentCharacter);
if (StorageManager.SaveJsonData(currentCharacter.SaveName, json, true))
{
Notify.Success("Your character was saved successfully.");
return true;
}
else
{
Notify.Error("Your character could not be saved. Reason unknown. :(");
return false;
}
}
else
{
string name = await GetUserInput(windowTitle: "Enter a save name.", maxInputLength: 30);
if (string.IsNullOrEmpty(name))
{
Notify.Error(CommonErrors.InvalidInput);
return false;
}
else
{
currentCharacter.SaveName = "mp_ped_" + name;
string json = JsonConvert.SerializeObject(currentCharacter);
if (StorageManager.SaveJsonData("mp_ped_" + name, json, false))
{
Notify.Success($"Your character (~g~<C>{name}</C>~s~) has been saved.");
Log($"Saved Character {name}. Data: {json}");
return true;
}
else
{
Notify.Error($"Saving failed, most likely because this name (~y~<C>{name}</C>~s~) is already in use.");
return false;
}
}
}
}
/// <summary>
/// Creates the menu.
/// </summary>
private void CreateMenu()
{
// Create the menu.
menu = new Menu("vMenu", "About vMenu");
MenuItem createMale = new MenuItem("Create Male Character", "Create a new male character.");
createMale.Label = "→→→";
MenuItem createFemale = new MenuItem("Create Female Character", "Create a new female character.");
createFemale.Label = "→→→";
MenuItem savedCharacters = new MenuItem("Saved Characters", "Spawn, edit or delete your existing saved multiplayer characters.");
savedCharacters.Label = "→→→";
MenuController.AddMenu(createCharacterMenu);
//MainMenu.Mp.Add(createCharacterMenu);
MenuController.AddMenu(savedCharactersMenu);
MenuController.AddMenu(inheritanceMenu);
MenuController.AddMenu(appearanceMenu);
MenuController.AddMenu(faceShapeMenu);
MenuController.AddMenu(tattoosMenu);
MenuController.AddMenu(clothesMenu);
MenuController.AddMenu(propsMenu);
CreateSavedPedsMenu();
menu.AddMenuItem(createMale);
MenuController.BindMenuItem(menu, createCharacterMenu, createMale);
//menu.BindMenuToItem(createCharacterMenu, createMale);
menu.AddMenuItem(createFemale);
MenuController.BindMenuItem(menu, createCharacterMenu, createFemale);
//menu.BindMenuToItem(createCharacterMenu, createFemale);
menu.AddMenuItem(savedCharacters);
MenuController.BindMenuItem(menu, savedCharactersMenu, savedCharacters);
//menu.BindMenuToItem(savedCharactersMenu, savedCharacters);
menu.RefreshIndex();
//menu.UpdateScaleform();
createCharacterMenu.InstructionalButtons.Add(Control.MoveLeftRight, "Turn Head");
inheritanceMenu.InstructionalButtons.Add(Control.MoveLeftRight, "Turn Head");
appearanceMenu.InstructionalButtons.Add(Control.MoveLeftRight, "Turn Head");
faceShapeMenu.InstructionalButtons.Add(Control.MoveLeftRight, "Turn Head");
tattoosMenu.InstructionalButtons.Add(Control.MoveLeftRight, "Turn Head");
clothesMenu.InstructionalButtons.Add(Control.MoveLeftRight, "Turn Head");
propsMenu.InstructionalButtons.Add(Control.MoveLeftRight, "Turn Head");
createCharacterMenu.InstructionalButtons.Add(Control.PhoneExtraOption, "Turn Character");
inheritanceMenu.InstructionalButtons.Add(Control.PhoneExtraOption, "Turn Character");
appearanceMenu.InstructionalButtons.Add(Control.PhoneExtraOption, "Turn Character");
faceShapeMenu.InstructionalButtons.Add(Control.PhoneExtraOption, "Turn Character");
tattoosMenu.InstructionalButtons.Add(Control.PhoneExtraOption, "Turn Character");
clothesMenu.InstructionalButtons.Add(Control.PhoneExtraOption, "Turn Character");
propsMenu.InstructionalButtons.Add(Control.PhoneExtraOption, "Turn Character");
tattoosMenu.InstructionalButtons.Add(Control.ParachuteBrakeRight, "Turn Camera Right");
tattoosMenu.InstructionalButtons.Add(Control.ParachuteBrakeLeft, "Turn Camera Left");
MenuItem inheritanceButton = new MenuItem("Character Inheritance", "Character inheritance options.");
MenuItem appearanceButton = new MenuItem("Character Appearance", "Character appearance options.");
MenuItem faceButton = new MenuItem("Character Face Shape Options", "Character face shape options.");
MenuItem tattoosButton = new MenuItem("Character Tattoo Options", "Character tattoo options.");
MenuItem clothesButton = new MenuItem("Character Clothes", "Character clothes.");
MenuItem propsButton = new MenuItem("Character Props", "Character props.");
MenuItem saveButton = new MenuItem("Save Character", "Save your character.");
MenuItem exitNoSave = new MenuItem("Exit Without Saving", "Are you sure? All unsaved work will be lost.");
MenuListItem faceExpressionList = new MenuListItem("Facial Expression", new List<string> { "Normal", "Happy", "Angry", "Aiming", "Injured", "Stressed", "Smug", "Sulk" }, 0, "Set a facial expression that will be used whenever your ped is idling.");
inheritanceButton.Label = "→→→";
appearanceButton.Label = "→→→";
faceButton.Label = "→→→";
tattoosButton.Label = "→→→";
clothesButton.Label = "→→→";
propsButton.Label = "→→→";
createCharacterMenu.AddMenuItem(inheritanceButton);
createCharacterMenu.AddMenuItem(appearanceButton);
createCharacterMenu.AddMenuItem(faceButton);
createCharacterMenu.AddMenuItem(tattoosButton);
createCharacterMenu.AddMenuItem(clothesButton);
createCharacterMenu.AddMenuItem(propsButton);
createCharacterMenu.AddMenuItem(faceExpressionList);
createCharacterMenu.AddMenuItem(saveButton);
createCharacterMenu.AddMenuItem(exitNoSave);
MenuController.BindMenuItem(createCharacterMenu, inheritanceMenu, inheritanceButton);
MenuController.BindMenuItem(createCharacterMenu, appearanceMenu, appearanceButton);
MenuController.BindMenuItem(createCharacterMenu, faceShapeMenu, faceButton);
MenuController.BindMenuItem(createCharacterMenu, tattoosMenu, tattoosButton);
MenuController.BindMenuItem(createCharacterMenu, clothesMenu, clothesButton);
MenuController.BindMenuItem(createCharacterMenu, propsMenu, propsButton);
#region inheritance
List<string> parents = new List<string>();
for (int i = 0; i < 46; i++)
{
parents.Add($"#{i}");
}
var inheritanceDads = new MenuListItem("Father", parents, 0, "Select a father.");
var inheritanceMoms = new MenuListItem("Mother", parents, 0, "Select a mother.");
List<float> mixValues = new List<float>() { 0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1f };
var inheritanceShapeMix = new MenuSliderItem("Head Shape Mix", "Select how much of your head shape should be inherited from your father or mother. All the way on the left is your dad, all the way on the right is your mom.", 0, 10, 5, true) { SliderLeftIcon = MenuItem.Icon.MALE, SliderRightIcon = MenuItem.Icon.FEMALE };
var inheritanceSkinMix = new MenuSliderItem("Body Skin Mix", "Select how much of your body skin tone should be inherited from your father or mother. All the way on the left is your dad, all the way on the right is your mom.", 0, 10, 5, true) { SliderLeftIcon = MenuItem.Icon.MALE, SliderRightIcon = MenuItem.Icon.FEMALE };
inheritanceMenu.AddMenuItem(inheritanceDads);
inheritanceMenu.AddMenuItem(inheritanceMoms);
inheritanceMenu.AddMenuItem(inheritanceShapeMix);
inheritanceMenu.AddMenuItem(inheritanceSkinMix);
void SetHeadBlend()
{
SetPedHeadBlendData(Game.PlayerPed.Handle, inheritanceDads.ListIndex, inheritanceMoms.ListIndex, 0, inheritanceDads.ListIndex, inheritanceMoms.ListIndex, 0, mixValues[inheritanceShapeMix.Position], mixValues[inheritanceSkinMix.Position], 0f, false);
}
inheritanceMenu.OnListIndexChange += (_menu, listItem, oldSelectionIndex, newSelectionIndex, itemIndex) =>
{
SetHeadBlend();
};
inheritanceMenu.OnSliderPositionChange += (sender, item, oldPosition, newPosition, itemIndex) =>
{
SetHeadBlend();
};
#endregion
#region appearance
Dictionary<int, KeyValuePair<string, string>> hairOverlays = new Dictionary<int, KeyValuePair<string, string>>()
{
{ 0, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_a") },
{ 1, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 2, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 3, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_003_a") },
{ 4, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 5, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 6, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 7, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 8, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_008_a") },
{ 9, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 10, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 11, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 12, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 13, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 14, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_long_a") },
{ 15, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_long_a") },
{ 16, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_z") },
{ 17, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_a") },
{ 18, new KeyValuePair<string, string>("mpbusiness_overlays", "FM_Bus_M_Hair_000_a") },
{ 19, new KeyValuePair<string, string>("mpbusiness_overlays", "FM_Bus_M_Hair_001_a") },
{ 20, new KeyValuePair<string, string>("mphipster_overlays", "FM_Hip_M_Hair_000_a") },
{ 21, new KeyValuePair<string, string>("mphipster_overlays", "FM_Hip_M_Hair_001_a") },
{ 22, new KeyValuePair<string, string>("multiplayer_overlays", "FM_M_Hair_001_a") },
};
// manage the list changes for appearance items.
appearanceMenu.OnListIndexChange += (_menu, listItem, oldSelectionIndex, newSelectionIndex, itemIndex) =>
{
//int itemIndex = sender.MenuItems.IndexOf(item);
if (itemIndex == 0) // hair style
{
ClearPedFacialDecorations(Game.PlayerPed.Handle);
currentCharacter.PedAppearance.HairOverlay = new KeyValuePair<string, string>("", "");
if (newSelectionIndex >= GetNumberOfPedDrawableVariations(Game.PlayerPed.Handle, 2))
{
SetPedComponentVariation(Game.PlayerPed.Handle, 2, 0, 0, 0);
currentCharacter.PedAppearance.hairStyle = 0;
}
else
{
SetPedComponentVariation(Game.PlayerPed.Handle, 2, newSelectionIndex, 0, 0);
currentCharacter.PedAppearance.hairStyle = newSelectionIndex;
if (hairOverlays.ContainsKey(newSelectionIndex))
{
SetPedFacialDecoration(Game.PlayerPed.Handle, (uint)GetHashKey(hairOverlays[newSelectionIndex].Key), (uint)GetHashKey(hairOverlays[newSelectionIndex].Value));
currentCharacter.PedAppearance.HairOverlay = new KeyValuePair<string, string>(hairOverlays[newSelectionIndex].Key, hairOverlays[newSelectionIndex].Value);
}
}
}
else if (itemIndex == 1 || itemIndex == 2) // hair colors
{
var tmp = (MenuListItem)_menu.GetMenuItems()[1];
int hairColor = tmp.ListIndex;
tmp = (MenuListItem)_menu.GetMenuItems()[2];
int hairHighlightColor = tmp.ListIndex;
SetPedHairColor(Game.PlayerPed.Handle, hairColor, hairHighlightColor);
currentCharacter.PedAppearance.hairColor = hairColor;
currentCharacter.PedAppearance.hairHighlightColor = hairHighlightColor;
}
else if (itemIndex == 31) // eye color
{
int selection = ((MenuListItem)_menu.GetMenuItems()[itemIndex]).ListIndex;
SetPedEyeColor(Game.PlayerPed.Handle, selection);
currentCharacter.PedAppearance.eyeColor = selection;
}
else
{
int selection = ((MenuListItem)_menu.GetMenuItems()[itemIndex]).ListIndex;
float opacity = 0f;
if (_menu.GetMenuItems()[itemIndex + 1] is MenuListItem)
opacity = (((float)((MenuListItem)_menu.GetMenuItems()[itemIndex + 1]).ListIndex + 1) / 10f) - 0.1f;
else if (_menu.GetMenuItems()[itemIndex - 1] is MenuListItem)
opacity = (((float)((MenuListItem)_menu.GetMenuItems()[itemIndex - 1]).ListIndex + 1) / 10f) - 0.1f;
else if (_menu.GetMenuItems()[itemIndex] is MenuListItem)
opacity = (((float)((MenuListItem)_menu.GetMenuItems()[itemIndex]).ListIndex + 1) / 10f) - 0.1f;
else
opacity = 1f;
switch (itemIndex)
{
case 3: // blemishes
SetPedHeadOverlay(Game.PlayerPed.Handle, 0, selection, opacity);
currentCharacter.PedAppearance.blemishesStyle = selection;
currentCharacter.PedAppearance.blemishesOpacity = opacity;
break;
case 5: // beards
SetPedHeadOverlay(Game.PlayerPed.Handle, 1, selection, opacity);
currentCharacter.PedAppearance.beardStyle = selection;
currentCharacter.PedAppearance.beardOpacity = opacity;
break;
case 7: // beards color
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 1, 1, selection, selection);
currentCharacter.PedAppearance.beardColor = selection;
break;
case 8: // eyebrows
SetPedHeadOverlay(Game.PlayerPed.Handle, 2, selection, opacity);
currentCharacter.PedAppearance.eyebrowsStyle = selection;
currentCharacter.PedAppearance.eyebrowsOpacity = opacity;
break;
case 10: // eyebrows color
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 2, 1, selection, selection);
currentCharacter.PedAppearance.eyebrowsColor = selection;
break;
case 11: // ageing
SetPedHeadOverlay(Game.PlayerPed.Handle, 3, selection, opacity);
currentCharacter.PedAppearance.ageingStyle = selection;
currentCharacter.PedAppearance.ageingOpacity = opacity;
break;
case 13: // makeup
SetPedHeadOverlay(Game.PlayerPed.Handle, 4, selection, opacity);
currentCharacter.PedAppearance.makeupStyle = selection;
currentCharacter.PedAppearance.makeupOpacity = opacity;
break;
case 15: // makeup color
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 4, 2, selection, selection);
currentCharacter.PedAppearance.makeupColor = selection;
break;
case 16: // blush style
SetPedHeadOverlay(Game.PlayerPed.Handle, 5, selection, opacity);
currentCharacter.PedAppearance.blushStyle = selection;
currentCharacter.PedAppearance.blushOpacity = opacity;
break;
case 18: // blush color
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 5, 2, selection, selection);
currentCharacter.PedAppearance.blushColor = selection;
break;
case 19: // complexion
SetPedHeadOverlay(Game.PlayerPed.Handle, 6, selection, opacity);
currentCharacter.PedAppearance.complexionStyle = selection;
currentCharacter.PedAppearance.complexionOpacity = opacity;
break;
case 21: // sun damage
SetPedHeadOverlay(Game.PlayerPed.Handle, 7, selection, opacity);
currentCharacter.PedAppearance.sunDamageStyle = selection;
currentCharacter.PedAppearance.sunDamageOpacity = opacity;
break;
case 23: // lipstick
SetPedHeadOverlay(Game.PlayerPed.Handle, 8, selection, opacity);
currentCharacter.PedAppearance.lipstickStyle = selection;
currentCharacter.PedAppearance.lipstickOpacity = opacity;
break;
case 25: // lipstick color
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 8, 2, selection, selection);
currentCharacter.PedAppearance.lipstickColor = selection;
break;
case 26: // moles and freckles
SetPedHeadOverlay(Game.PlayerPed.Handle, 9, selection, opacity);
currentCharacter.PedAppearance.molesFrecklesStyle = selection;
currentCharacter.PedAppearance.molesFrecklesOpacity = opacity;
break;
case 28: // chest hair
SetPedHeadOverlay(Game.PlayerPed.Handle, 10, selection, opacity);
currentCharacter.PedAppearance.chestHairStyle = selection;
currentCharacter.PedAppearance.chestHairOpacity = opacity;
break;
case 30: // chest hair color
SetPedHeadOverlayColor(Game.PlayerPed.Handle, 10, 1, selection, selection);
currentCharacter.PedAppearance.chestHairColor = selection;
break;
}
}
};
// manage the slider changes for opacity on the appearance items.
appearanceMenu.OnListIndexChange += (_menu, listItem, oldSelectionIndex, newSelectionIndex, itemIndex) =>
{
//int itemIndex = sender.MenuItems.IndexOf(item);