forked from root-cause/v-decompiled-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
achievement_controller.c
18116 lines (14880 loc) · 396 KB
/
achievement_controller.c
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
#region Local Var
var uLocal_0 = 0;
var uLocal_1 = 0;
int iLocal_2 = 0;
int iLocal_3 = 0;
int iLocal_4 = 0;
int iLocal_5 = 0;
int iLocal_6 = 0;
int iLocal_7 = 0;
int iLocal_8 = 0;
int iLocal_9 = 0;
int iLocal_10 = 0;
int iLocal_11 = 0;
float fLocal_12 = 0f;
var uLocal_13 = 0;
var uLocal_14 = 0;
int iLocal_15 = 0;
char* sLocal_16 = NULL;
var uLocal_17 = 0;
var uLocal_18 = 0;
int iLocal_19 = 0;
float fLocal_20 = 0f;
var uLocal_21 = 0;
var uLocal_22 = 0;
var uLocal_23 = 0;
float fLocal_24 = 0f;
float fLocal_25 = 0f;
var uLocal_26 = 0;
var uLocal_27 = 0;
float fLocal_28 = 0f;
float fLocal_29 = 0f;
float fLocal_30 = 0f;
var uLocal_31 = 0;
var uLocal_32 = 0;
var uLocal_33 = 0;
var uLocal_34 = 0;
var uLocal_35 = 0;
var uLocal_36 = 0;
var uLocal_37 = 0;
int iLocal_38 = 0;
int iLocal_39 = 0;
int iLocal_40 = 0;
int iLocal_41 = 0;
var uLocal_42 = 0;
var uLocal_43 = 0;
var uLocal_44 = 0;
var uLocal_45 = 0;
var uLocal_46 = 0;
var uLocal_47 = 0;
var uLocal_48 = 0;
var uLocal_49 = 0;
var uLocal_50 = 0;
var uLocal_51 = 0;
var uLocal_52 = 0;
int iLocal_53 = 0;
int iLocal_54 = 0;
int iLocal_55 = 0;
int iLocal_56 = 0;
int iLocal_57 = 0;
int* iLocal_58 = NULL;
var uLocal_59 = 0;
var uLocal_60 = 0;
int iLocal_61 = 0;
int iLocal_62 = 0;
float fLocal_63 = 0f;
int iLocal_64 = 0;
int iLocal_65 = 0;
int iLocal_66 = 0;
int* iLocal_67 = NULL;
var uLocal_68 = 0;
var uLocal_69 = 0;
bool bLocal_70 = 0;
int iLocal_71 = 0;
int iLocal_72 = 0;
#endregion
void __EntryFunction__()//Position - 0x0
{
int iVar0;
iLocal_2 = 1;
iLocal_3 = 134;
iLocal_4 = 134;
iLocal_5 = 1;
iLocal_6 = 1;
iLocal_7 = 1;
iLocal_8 = 134;
iLocal_9 = 1;
iLocal_10 = 12;
iLocal_11 = 12;
fLocal_12 = 0.001f;
iLocal_15 = -1;
sLocal_16 = "NULL";
iLocal_19 = 3;
fLocal_20 = 0f;
fLocal_24 = -0.0375f;
fLocal_25 = 0.17f;
fLocal_28 = 80f;
fLocal_29 = 140f;
fLocal_30 = 180f;
iLocal_38 = 1;
iLocal_39 = 65;
iLocal_40 = 49;
iLocal_41 = 64;
iLocal_61 = 1000;
iLocal_62 = 3333;
fLocal_63 = 0f;
bLocal_70 = true;
MISC::NETWORK_SET_SCRIPT_IS_SAFE_FOR_NETWORK_GAME();
if (PLAYER::HAS_FORCE_CLEANUP_OCCURRED(32))
{
SCRIPT::TERMINATE_THIS_THREAD();
}
iLocal_56 = MISC::GET_GAME_TIMER();
iLocal_65 = 0;
func_186(iLocal_66);
func_185();
func_183(&Global_4543283);
func_182(&Global_4543283, 1);
func_180(&iLocal_67);
while (true)
{
if (Global_33079 != iLocal_65)
{
if (iLocal_65 == 0 && Global_33079 != 0)
{
if (MISC::IS_PS3_VERSION() || func_179())
{
func_178("CHEAT_TROPHIE" /* GXT: Cheats have been activated. Trophies will not be awarded for the duration of this session. */, -1);
}
else
{
func_178("CHEAT_ACHIEVE" /* GXT: Cheats have been activated. Achievements will not be awarded for the duration of this session. */, -1);
}
}
if (iLocal_65 != 0 && Global_33079 == 0)
{
}
}
iLocal_65 = Global_33079;
if (!func_177(14))
{
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(24))
{
func_168();
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(25))
{
func_166();
}
if (Global_32838)
{
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(12))
{
iVar0 = func_151(1);
if (iVar0 > 0)
{
func_150(12, iVar0);
STATS::STAT_SET_INT(joaat("NUM_GOLD_MEDALS_OBTAINED"), iVar0, true);
}
if (iVar0 >= 70)
{
func_144(12, 1);
}
}
Global_32838 = 0;
}
if (ENTITY::DOES_ENTITY_EXIST(PLAYER::PLAYER_PED_ID()))
{
if (!ENTITY::IS_ENTITY_DEAD(PLAYER::PLAYER_PED_ID(), false))
{
iLocal_66++;
if (MISC::GET_GAME_TIMER() > iLocal_56)
{
func_133(0);
iLocal_56 = (MISC::GET_GAME_TIMER() + iLocal_61);
}
if (MISC::GET_GAME_TIMER() > iLocal_57)
{
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(14) || iLocal_64 == 1)
{
if (func_132(53))
{
func_131();
}
}
iLocal_57 = (MISC::GET_GAME_TIMER() + iLocal_62);
}
}
}
func_123(&Global_4543283);
func_1();
}
else
{
func_123(&Global_4543283);
func_1();
}
SYSTEM::WAIT(0);
}
}
void func_1()//Position - 0x20A
{
bool bVar0;
int iVar1;
if (!func_122(&Global_4543283))
{
return;
}
if (!Global_79248)
{
if (iLocal_72)
{
iLocal_72 = 0;
}
return;
}
if (!func_119())
{
return;
}
if (bLocal_70)
{
if (!func_117(3, -1))
{
return;
}
if (!func_117(5, -1))
{
return;
}
}
if (iLocal_72)
{
return;
}
bVar0 = SOCIALCLUB::SC_ACHIEVEMENT_INFO_STATUS(&iVar1);
if (iVar1 == -1 && iLocal_71 == 0)
{
}
if (bVar0 && iVar1 == 0)
{
func_116();
iLocal_72 = 1;
}
else
{
func_2();
}
}
void func_2()//Position - 0x29A
{
int iVar0;
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(33))
{
if (func_113())
{
func_144(33, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(29))
{
if (func_109(&iLocal_67) > 5f)
{
func_22(PLAYER::PLAYER_PED_ID());
func_180(&iLocal_67);
}
}
iVar0 = func_19(func_21(-1), 0);
if (iVar0 >= 100)
{
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(36))
{
func_144(36, 1);
}
}
if (iVar0 >= 50)
{
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(35))
{
func_144(35, 1);
}
}
if (iVar0 >= 25)
{
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(34))
{
func_144(34, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(37))
{
func_16(0);
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(38))
{
if (func_15(joaat("MPPLY_TOTAL_CUSTOM_RACES_WON")) >= 5)
{
func_144(38, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(39))
{
if (func_13(48, -1) >= 10)
{
func_144(39, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(40))
{
if (func_13(52, -1) > 0)
{
func_144(40, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(41))
{
if (BitTest(Global_2738587.f_2327.f_18, 1))
{
func_144(41, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(43))
{
if (func_11(756, -1) >= 30)
{
func_144(43, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(44))
{
if (func_13(14, -1) >= 20)
{
func_144(44, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(45))
{
func_9(0);
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(48))
{
if (func_8(11, -1))
{
func_144(48, 1);
}
}
if (!PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(49))
{
func_3(0);
}
}
int func_3(bool bParam0)//Position - 0x438
{
if (!func_119())
{
return 0;
}
if (!Global_79248)
{
return 0;
}
if (PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(49))
{
return 0;
}
if (bParam0 == 1)
{
}
if (!func_4(100, -1))
{
if (bParam0 == 1)
{
}
return 0;
}
if (!func_4(102, -1))
{
if (bParam0 == 1)
{
}
return 0;
}
if (!func_4(101, -1))
{
if (bParam0 == 1)
{
}
return 0;
}
func_144(49, 1);
return 1;
}
int func_4(int iParam0, int iParam1)//Position - 0x4B3
{
int iVar0;
var uVar1;
iVar0 = func_5(iParam0, iParam1);
if (STATS::STAT_GET_BOOL(iVar0, &uVar1, -1))
{
return uVar1;
}
return 0;
}
int func_5(int iParam0, var uParam1)//Position - 0x4D7
{
return STATS::_GET_STAT_HASH_FOR_CHARACTER_STAT(2, iParam0, func_6(uParam1));
}
int func_6(var uParam0)//Position - 0x4EC
{
int iVar0;
int iVar1;
iVar0 = uParam0;
if (iVar0 == -1)
{
iVar1 = func_7();
if (iVar1 > -1)
{
Global_2750546 = 0;
iVar0 = iVar1;
}
else
{
iVar0 = 0;
Global_2750546 = 1;
}
}
return iVar0;
}
int func_7()//Position - 0x520
{
return Global_1574925;
}
bool func_8(int iParam0, int iParam1)//Position - 0x52C
{
if (iParam1 == -1)
{
iParam1 = func_7();
}
return STATS::GET_PACKED_STAT_BOOL_CODE(iParam0, iParam1);
}
int func_9(bool bParam0)//Position - 0x548
{
int iVar0;
int iVar1;
var uVar2;
if (!func_119())
{
return 0;
}
if (PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(45))
{
return 0;
}
if (!Global_79248)
{
return 0;
}
uVar2 = func_11(757, -1);
iVar0 = 0;
while (iVar0 < 9)
{
if (func_10(uVar2, iVar0, bParam0))
{
iVar1++;
}
iVar0++;
}
if (iVar1 == 9)
{
func_144(45, 1);
return 1;
}
return 0;
}
int func_10(var uParam0, int iParam1, bool bParam2)//Position - 0x5B9
{
var uVar0;
uVar0 = BitTest(uParam0, iParam1);
if (!bParam2)
{
return uVar0;
}
switch (iParam1)
{
case 0:
return uVar0;
case 1:
return uVar0;
case 2:
return uVar0;
case 3:
return uVar0;
case 4:
return uVar0;
case 5:
return uVar0;
case 6:
return uVar0;
case 7:
return uVar0;
case 8:
return uVar0;
default:
}
return 0;
}
int func_11(int iParam0, int iParam1)//Position - 0x63E
{
int iVar0;
var uVar1;
if (iParam0 != 14626)
{
iVar0 = func_12(iParam0, iParam1);
if (STATS::STAT_GET_INT(iVar0, &uVar1, -1))
{
return uVar1;
}
}
return 0;
}
int func_12(int iParam0, var uParam1)//Position - 0x66D
{
return STATS::_GET_STAT_HASH_FOR_CHARACTER_STAT(0, iParam0, func_6(uParam1));
}
int func_13(int iParam0, int iParam1)//Position - 0x682
{
int iVar0;
var uVar1;
iVar0 = func_14(iParam0, iParam1);
if (STATS::STAT_GET_INT(iVar0, &uVar1, -1))
{
return uVar1;
}
return 0;
}
int func_14(int iParam0, var uParam1)//Position - 0x6A6
{
return STATS::_GET_STAT_HASH_FOR_CHARACTER_STAT(8, iParam0, func_6(uParam1));
}
int func_15(int iParam0)//Position - 0x6BC
{
int iVar0;
var uVar1;
iVar0 = iParam0;
if (STATS::STAT_GET_INT(iVar0, &uVar1, -1))
{
return uVar1;
}
return 0;
}
int func_16(bool bParam0)//Position - 0x6DA
{
int iVar0;
if (PLAYER::HAS_ACHIEVEMENT_BEEN_PASSED(37))
{
return 0;
}
if (!func_119())
{
return 0;
}
if (!Global_79248)
{
return 0;
}
if (bParam0)
{
iVar0 = func_13(21, -1);
iVar0 = (iVar0 - func_13(58, -1));
iVar0 = (iVar0 - func_13(57, -1));
}
if (func_17(8, -1))
{
func_144(37, 1);
return 1;
}
return 0;
}
int func_17(int iParam0, int iParam1)//Position - 0x744
{
int iVar0;
var uVar1;
iVar0 = func_18(iParam0, iParam1);
if (STATS::STAT_GET_BOOL(iVar0, &uVar1, -1))
{
return uVar1;
}
return 0;
}
int func_18(int iParam0, var uParam1)//Position - 0x768
{
return STATS::_GET_STAT_HASH_FOR_CHARACTER_STAT(10, iParam0, func_6(uParam1));
}
int func_19(int iParam0, int iParam1)//Position - 0x77E
{
int iVar0;
int iVar1;
int iVar2;
int iVar3;
float fVar4;
if (iParam1 == 0)
{
}
iVar1 = 8000;
iVar2 = 0;
iVar3 = ((iVar1 - iVar2) / 2);
iVar0 = 0;
while (iVar0 <= 100)
{
if (iVar1 == iVar2)
{
iVar0 = 8000;
if (iVar3 == 0)
{
iVar3 = 1;
}
return iVar3;
}
if (func_20(iVar3) == iParam0)
{
iVar1 = iVar3;
iVar2 = iVar3;
}
else if (func_20(iVar3) < iParam0)
{
if (iVar2 == iVar3)
{
iVar2++;
}
else
{
iVar2 = iVar3;
}
}
else if (iVar1 == iVar3)
{
iVar1 = (iVar1 - 1);
}
else
{
iVar1 = iVar3;
}
fVar4 = (((SYSTEM::TO_FLOAT(iVar1) - SYSTEM::TO_FLOAT(iVar2)) / 2f) + SYSTEM::TO_FLOAT(iVar2));
iVar3 = SYSTEM::ROUND(fVar4);
iVar0++;
}
return 8000;
}
int func_20(int iParam0)//Position - 0x839
{
int iVar0;
int iVar1;
if (iParam0 < 100)
{
switch (iParam0)
{
case 1:
return 0;
case 2:
return 800;
case 3:
return 2100;
case 4:
return 3800;
case 5:
return 6100;
case 6:
return 9500;
case 7:
return 12500;
case 8:
return 16000;
case 9:
return 19800;
case 10:
return 24000;
case 11:
return 28500;
case 12:
return 33400;
case 13:
return 38700;
case 14:
return 44200;
case 15:
return 50200;
case 16:
return 56400;
case 17:
return 63000;
case 18:
return 69900;
case 19:
return 77100;
case 20:
return 84700;
case 21:
return 92500;
case 22:
return 100700;
case 23:
return 109200;
case 24:
return 118000;
case 25:
return 127100;
case 26:
return 136500;
case 27:
return 146200;
case 28:
return 156200;
case 29:
return 166500;
case 30:
return 177100;
case 31:
return 188000;
case 32:
return 199200;
case 33:
return 210700;
case 34:
return 222400;
case 35:
return 234500;
case 36:
return 246800;
case 37:
return 259400;
case 38:
return 272300;
case 39:
return 285500;
case 40:
return 299000;
case 41:
return 312700;
case 42:
return 326800;
case 43:
return 341000;
case 44:
return 355600;
case 45:
return 370500;
case 46:
return 385600;
case 47:
return 401000;
case 48:
return 416600;
case 49:
return 432600;
case 50:
return 448800;
case 51:
return 465200;
case 52:
return 482000;
case 53:
return 499000;
case 54:
return 516300;
case 55:
return 533800;
case 56:
return 551600;
case 57:
return 569600;
case 58:
return 588000;
case 59:
return 606500;
case 60:
return 625400;
case 61:
return 644500;
case 62:
return 663800;
case 63:
return 683400;
case 64:
return 703300;
case 65:
return 723400;
case 66:
return 743800;
case 67:
return 764500;
case 68:
return 785400;
case 69:
return 806500;
case 70:
return 827900;
case 71:
return 849600;
case 72:
return 871500;
case 73:
return 893600;
case 74:
return 916000;
case 75:
return 938700;
case 76:
return 961600;
case 77:
return 984700;
case 78:
return 1008100;
case 79:
return 1031800;
case 80:
return 1055700;
case 81:
return 1079800;
case 82:
return 1104200;
case 83:
return 1128800;
case 84:
return 1153700;
case 85:
return 1178800;
case 86:
return 1204200;
case 87:
return 1229800;
case 88:
return 1255600;
case 89:
return 1281700;
case 90:
return 1308100;
case 91:
return 1334600;
case 92:
return 1361400;
case 93:
return 1388500;
case 94:
return 1415800;
case 95:
return 1443300;
case 96:
return 1471100;
case 97:
return 1499100;
case 98:
return 1527300;
case 99:
return 1555800;
default:
}
}
else