//
// GameStatsManager::recountSpecialStats from 0x1402e7ef0 to 0x1402e8ecc (4060 bytes)
//
// 2 xrefs:
// > GameManager::dataLoaded @ 0x1402833d3
// > ??> @ 0x14091e068
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:29:51 +0000
//
// Hidden C++ exception states: #wind=10
__int64 __fastcall GameStatsManager::recountSpecialStats(__int64 a1)
{
__int64 v1; // rbx
unsigned int v2; // edi
int v3; // esi
signed int TotalCollectedCurrency; // r13d
__int64 v5; // rcx
__int64 v6; // rcx
int v7; // r12d
float v8; // xmm0_4
int v9; // ecx
int v10; // ecx
__int64 v11; // rbx
__int64 v12; // rbx
__int64 i; // r15
__int64 v14; // rbx
cocos2d::CCArray *v15; // rcx
int v16; // r14d
unsigned int v17; // esi
struct cocos2d::CCObject *v18; // rax
cocos2d::CCArray *v19; // rcx
int v20; // r14d
unsigned int v21; // esi
struct cocos2d::CCObject *v22; // rax
cocos2d::CCArray *v23; // rcx
int v24; // r14d
unsigned int v25; // esi
struct cocos2d::CCObject *v26; // rax
cocos2d::CCArray *v27; // rcx
int v28; // r14d
unsigned int v29; // esi
struct cocos2d::CCObject *v30; // rax
cocos2d::CCArray *v31; // rcx
int v32; // r14d
unsigned int v33; // esi
struct cocos2d::CCObject *v34; // rax
cocos2d::CCArray *v35; // rcx
int v36; // r14d
unsigned int v37; // esi
struct cocos2d::CCObject *v38; // rax
cocos2d::CCArray *v39; // rcx
int v40; // r14d
unsigned int v41; // esi
struct cocos2d::CCObject *v42; // rax
cocos2d::CCArray *v43; // rcx
int v44; // r14d
unsigned int v45; // esi
struct cocos2d::CCObject *v46; // rax
cocos2d::CCArray *v47; // rcx
int v48; // r14d
unsigned int v49; // esi
struct cocos2d::CCObject *v50; // rax
cocos2d::CCArray *v51; // rcx
int v52; // r14d
unsigned int v53; // esi
struct cocos2d::CCObject *v54; // rax
cocos2d::CCArray *v55; // rcx
int v56; // r14d
unsigned int v57; // esi
struct cocos2d::CCObject *v58; // rax
cocos2d::CCArray *v59; // rcx
int v60; // r14d
unsigned int v61; // esi
struct cocos2d::CCObject *v62; // rax
cocos2d::CCArray *v63; // rcx
int v64; // r14d
unsigned int v65; // esi
struct cocos2d::CCObject *v66; // rax
cocos2d::CCArray *v67; // rcx
int v68; // r14d
unsigned int v69; // esi
struct cocos2d::CCObject *v70; // rax
__int64 v71; // rcx
__int64 v72; // rcx
__int64 j; // rbx
int v74; // eax
int v75; // ecx
struct cocos2d::CCArray *v76; // rax
int v77; // r15d
unsigned int *v78; // rcx
__int64 v79; // rax
cocos2d::CCString **v80; // r14
cocos2d::CCString **v81; // r12
const char *CString; // rax
size_t v83; // r8
const char *v84; // rcx
int v85; // ecx
int v86; // eax
__int64 v87; // rax
cocos2d::CCArray *v88; // rsi
unsigned int v89; // ebx
unsigned int v90; // r12d
unsigned int v91; // r15d
unsigned int v92; // edi
unsigned int v93; // r14d
struct cocos2d::CCObject *v94; // rax
signed int v95; // r12d
struct cocos2d::CCArray *v96; // rax
unsigned int *v97; // r14
__int64 v98; // rax
cocos2d::CCString **v99; // r14
cocos2d::CCString **v100; // r13
const char *v101; // rax
size_t v102; // r8
const char *v103; // rcx
__int64 v104; // r15
struct cocos2d::CCObject *v105; // rsi
cocos2d::CCString *v106; // rax
int v107; // ebx
struct cocos2d::CCObject *v108; // rax
char *v109; // rcx
struct cocos2d::CCArray *v110; // rax
unsigned __int64 v111; // rdx
cocos2d::CCString *v112; // rcx
__int64 v113; // r8
unsigned int *v114; // rbx
__int64 v115; // rax
cocos2d::CCString **v116; // rbx
cocos2d::CCString **m; // rsi
const char *v118; // rax
size_t v119; // r8
cocos2d::CCString *v120; // rax
int v121; // eax
char *v122; // rcx
char v123; // r13
__int64 v124; // rdx
__int64 v125; // rcx
__int64 v126; // r8
__int64 v127; // rcx
int n; // esi
cocos2d::CCString *v129; // rax
const char *v130; // rax
size_t v131; // r8
__int64 v132; // rdx
__int64 v133; // rcx
__int64 v134; // r8
char **v135; // rbx
__int64 v136; // r14
__int64 v137; // rax
size_t v138; // r8
__int64 v139; // rdx
__int64 v140; // rcx
__int64 v141; // r8
__int64 v142; // rax
__int64 v143; // rbx
__int64 v144; // rax
char isSpecialChestUnlocked; // bl
__int64 v146; // rcx
unsigned int v147; // ebx
__int64 v148; // rcx
__int64 v149; // rcx
__int64 v150; // rdx
__int64 v151; // rcx
__int64 v152; // r8
unsigned __int8 v155; // [rsp+38h] [rbp-81h]
signed int v156; // [rsp+3Ch] [rbp-7Dh]
unsigned int TotalCollectedDiamonds; // [rsp+40h] [rbp-79h]
signed int v158; // [rsp+44h] [rbp-75h]
unsigned int v159; // [rsp+48h] [rbp-71h]
unsigned int v160; // [rsp+4Ch] [rbp-6Dh]
unsigned int v161; // [rsp+50h] [rbp-69h]
unsigned int v162; // [rsp+54h] [rbp-65h]
unsigned int v163; // [rsp+58h] [rbp-61h]
unsigned int v164; // [rsp+5Ch] [rbp-5Dh]
unsigned int v165; // [rsp+60h] [rbp-59h]
unsigned int v166; // [rsp+64h] [rbp-55h]
unsigned int v167; // [rsp+68h] [rbp-51h]
unsigned int v168; // [rsp+6Ch] [rbp-4Dh]
void *v169; // [rsp+70h] [rbp-49h]
void *v170; // [rsp+70h] [rbp-49h]
cocos2d::CCString **k; // [rsp+70h] [rbp-49h]
void *v172; // [rsp+70h] [rbp-49h]
void *v173; // [rsp+70h] [rbp-49h]
void *v174; // [rsp+70h] [rbp-49h]
void *v175; // [rsp+70h] [rbp-49h]
void *v176; // [rsp+70h] [rbp-49h]
int v177; // [rsp+78h] [rbp-41h]
cocos2d::CCString **v178; // [rsp+78h] [rbp-41h]
void *v179; // [rsp+78h] [rbp-41h]
unsigned int v180; // [rsp+80h] [rbp-39h]
char v181[32]; // [rsp+88h] [rbp-31h] BYREF
char *String[2]; // [rsp+A8h] [rbp-11h] BYREF
__int64 v183; // [rsp+B8h] [rbp-1h]
unsigned __int64 v184; // [rsp+C0h] [rbp+7h]
__int128 v185; // [rsp+C8h] [rbp+Fh] BYREF
__int64 v186; // [rsp+D8h] [rbp+1Fh]
__int64 v187; // [rsp+E0h] [rbp+27h]
v1 = a1;
v2 = 0;
v160 = 0;
v161 = 0;
v162 = 0;
v163 = 0;
v164 = 0;
v165 = 0;
v166 = 0;
v167 = 0;
v168 = 0;
v180 = 0;
v3 = 0;
v159 = 0;
TotalCollectedCurrency = GameStatsManager::getTotalCollectedCurrency(a1);
v156 = TotalCollectedCurrency;
v5 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v169 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v169);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v5 = qword_14090BFE0;
}
if ( (unsigned int)GameStatsManager::getStat(v5, "22") != TotalCollectedCurrency )
{
v6 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v170 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v170);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v6 = qword_14090BFE0;
}
GameStatsManager::setStat(v6, "22", TotalCollectedCurrency);
}
TotalCollectedDiamonds = GameStatsManager::getTotalCollectedDiamonds(v1);
v7 = (int)floorf((float)TotalCollectedCurrency / 500.0);
v158 = v7;
*(_DWORD *)(v1 + 880) = v7;
v8 = (float)((float)rand() / 32767.0) * 1000.0;
*(_DWORD *)(v1 + 876) = (int)v8;
*(_DWORD *)(v1 + 872) = v7 + (int)v8;
GameStatsManager::removeErrorFromSpecialChests(v1);
v9 = 0;
v177 = 0;
do
{
if ( v9 )
{
v10 = v9 - 1;
if ( v10 )
{
if ( v10 != 1 )
goto LABEL_91;
v11 = *(_QWORD *)(v1 + 840);
}
else
{
v11 = *(_QWORD *)(v1 + 888);
}
}
else
{
v11 = *(_QWORD *)(v1 + 536);
}
if ( v11 )
{
v12 = *(_QWORD *)(v11 + 56);
if ( v12 )
{
for ( i = *(_QWORD *)(v12 + 288); ; i = *(_QWORD *)(i + 288) )
{
v14 = *(_QWORD *)(v12 + 264);
v15 = *(cocos2d::CCArray **)(v14 + 72);
v16 = 0;
if ( v15 )
{
v17 = 0;
if ( cocos2d::CCArray::count(v15) )
{
do
{
v18 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v17);
if ( *((_DWORD *)v18 + 14) == 7 )
v16 += *((_DWORD *)v18 + 17);
++v17;
}
while ( v17 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
TotalCollectedCurrency += v16;
v19 = *(cocos2d::CCArray **)(v14 + 72);
v20 = 0;
if ( v19 )
{
v21 = 0;
if ( cocos2d::CCArray::count(v19) )
{
do
{
v22 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v21);
if ( *((_DWORD *)v22 + 14) == 8 )
v20 += *((_DWORD *)v22 + 17);
++v21;
}
while ( v21 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
TotalCollectedDiamonds += v20;
v23 = *(cocos2d::CCArray **)(v14 + 72);
v24 = 0;
if ( v23 )
{
v25 = 0;
if ( cocos2d::CCArray::count(v23) )
{
do
{
v26 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v25);
if ( *((_DWORD *)v26 + 14) == 1 )
v24 += *((_DWORD *)v26 + 17);
++v25;
}
while ( v25 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v160 += v24;
v27 = *(cocos2d::CCArray **)(v14 + 72);
v28 = 0;
if ( v27 )
{
v29 = 0;
if ( cocos2d::CCArray::count(v27) )
{
do
{
v30 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v29);
if ( *((_DWORD *)v30 + 14) == 2 )
v28 += *((_DWORD *)v30 + 17);
++v29;
}
while ( v29 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v161 += v28;
v31 = *(cocos2d::CCArray **)(v14 + 72);
v32 = 0;
if ( v31 )
{
v33 = 0;
if ( cocos2d::CCArray::count(v31) )
{
do
{
v34 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v33);
if ( *((_DWORD *)v34 + 14) == 3 )
v32 += *((_DWORD *)v34 + 17);
++v33;
}
while ( v33 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v162 += v32;
v35 = *(cocos2d::CCArray **)(v14 + 72);
v36 = 0;
if ( v35 )
{
v37 = 0;
if ( cocos2d::CCArray::count(v35) )
{
do
{
v38 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v37);
if ( *((_DWORD *)v38 + 14) == 4 )
v36 += *((_DWORD *)v38 + 17);
++v37;
}
while ( v37 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v163 += v36;
v39 = *(cocos2d::CCArray **)(v14 + 72);
v40 = 0;
if ( v39 )
{
v41 = 0;
if ( cocos2d::CCArray::count(v39) )
{
do
{
v42 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v41);
if ( *((_DWORD *)v42 + 14) == 5 )
v40 += *((_DWORD *)v42 + 17);
++v41;
}
while ( v41 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v164 += v40;
v43 = *(cocos2d::CCArray **)(v14 + 72);
v44 = 0;
if ( v43 )
{
v45 = 0;
if ( cocos2d::CCArray::count(v43) )
{
do
{
v46 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v45);
if ( *((_DWORD *)v46 + 14) == 10 )
v44 += *((_DWORD *)v46 + 17);
++v45;
}
while ( v45 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v165 += v44;
v47 = *(cocos2d::CCArray **)(v14 + 72);
v48 = 0;
if ( v47 )
{
v49 = 0;
if ( cocos2d::CCArray::count(v47) )
{
do
{
v50 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v49);
if ( *((_DWORD *)v50 + 14) == 11 )
v48 += *((_DWORD *)v50 + 17);
++v49;
}
while ( v49 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v166 += v48;
v51 = *(cocos2d::CCArray **)(v14 + 72);
v52 = 0;
if ( v51 )
{
v53 = 0;
if ( cocos2d::CCArray::count(v51) )
{
do
{
v54 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v53);
if ( *((_DWORD *)v54 + 14) == 12 )
v52 += *((_DWORD *)v54 + 17);
++v53;
}
while ( v53 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v167 += v52;
v55 = *(cocos2d::CCArray **)(v14 + 72);
v56 = 0;
if ( v55 )
{
v57 = 0;
if ( cocos2d::CCArray::count(v55) )
{
do
{
v58 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v57);
if ( *((_DWORD *)v58 + 14) == 13 )
v56 += *((_DWORD *)v58 + 17);
++v57;
}
while ( v57 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v168 += v56;
v59 = *(cocos2d::CCArray **)(v14 + 72);
v60 = 0;
if ( v59 )
{
v61 = 0;
if ( cocos2d::CCArray::count(v59) )
{
do
{
v62 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v61);
if ( *((_DWORD *)v62 + 14) == 14 )
v60 += *((_DWORD *)v62 + 17);
++v61;
}
while ( v61 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v180 += v60;
v63 = *(cocos2d::CCArray **)(v14 + 72);
v64 = 0;
if ( v63 )
{
v65 = 0;
if ( cocos2d::CCArray::count(v63) )
{
do
{
v66 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v65);
if ( *((_DWORD *)v66 + 14) == 6 )
v64 += *((_DWORD *)v66 + 17);
++v65;
}
while ( v65 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v7 += v64;
v67 = *(cocos2d::CCArray **)(v14 + 72);
v68 = 0;
if ( v67 )
{
v69 = 0;
if ( cocos2d::CCArray::count(v67) )
{
do
{
v70 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)(v14 + 72), v69);
if ( *((_DWORD *)v70 + 14) == 15 )
v68 += *((_DWORD *)v70 + 17);
++v69;
}
while ( v69 < cocos2d::CCArray::count(*(cocos2d::CCArray **)(v14 + 72)) );
}
}
v3 = v68 + v159;
v159 += v68;
v12 = i;
if ( !i )
break;
}
v158 = v7;
v156 = TotalCollectedCurrency;
}
}
v1 = a1;
LABEL_91:
v9 = v177 + 1;
v177 = v9;
}
while ( v9 < 3 );
v71 = *(_QWORD *)(v1 + 544);
if ( v71 )
{
v72 = *(_QWORD *)(v71 + 56);
if ( v72 )
{
for ( j = *(_QWORD *)(v72 + 288); ; j = *(_QWORD *)(j + 288) )
{
v74 = cocos2d::CCString::intValue(*(cocos2d::CCString **)(v72 + 264));
v75 = 200;
if ( v74 < 200 )
v75 = v74;
TotalCollectedCurrency += v75;
v72 = j;
if ( !j )
break;
}
v156 = TotalCollectedCurrency;
v1 = a1;
}
}
v76 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(v1 + 864));
v77 = 1;
if ( v76 )
{
v78 = *((unsigned int **)v76 + 7);
v79 = *v78;
if ( (_DWORD)v79 )
{
v80 = *((cocos2d::CCString ***)v78 + 2);
v178 = v80;
v81 = &v80[v79 - 1];
for ( k = v81; v80 <= v81; v3 = v159 )
{
if ( !*v80 )
break;
CString = cocos2d::CCString::getCString(*v80);
*(_OWORD *)String = 0;
v183 = 0;
v184 = 0;
v83 = -1;
do
++v83;
while ( CString[v83] );
sub_14003D230(String, CString, v83);
v84 = (const char *)String;
if ( v184 > 0xF )
v84 = String[0];
v85 = atoi(v84);
if ( v85 <= 6000 )
{
if ( v85 <= 5000 )
{
if ( v85 <= 4000 )
{
if ( v85 <= 3000 )
{
if ( v85 <= 2000 )
{
v86 = 1;
if ( v85 > 1000 )
v86 = 5;
}
else
{
v86 = 10;
}
}
else
{
v86 = 25;
}
}
else
{
v86 = 50;
}
}
else
{
v86 = 100;
}
if ( v158 >= v86 )
{
v158 -= v86;
LABEL_123:
v87 = cocos2d::CCDictionary::objectForKey(*(_QWORD *)(v1 + 864), String);
v88 = *(cocos2d::CCArray **)(v87 + 72);
if ( v88 )
{
v89 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(v87 + 72)) )
{
v90 = TotalCollectedDiamonds;
v91 = v160;
v92 = v161;
v93 = v162;
do
{
v94 = cocos2d::CCArray::objectAtIndex(v88, v89);
switch ( *((_DWORD *)v94 + 14) )
{
case 1:
v91 += *((_DWORD *)v94 + 17);
break;
case 2:
v92 += *((_DWORD *)v94 + 17);
break;
case 3:
v93 += *((_DWORD *)v94 + 17);
break;
case 4:
v163 += *((_DWORD *)v94 + 17);
break;
case 5:
v164 += *((_DWORD *)v94 + 17);
break;
case 7:
TotalCollectedCurrency += *((_DWORD *)v94 + 17);
break;
case 8:
v90 += *((_DWORD *)v94 + 17);
break;
case 0xA:
v165 += *((_DWORD *)v94 + 17);
break;
case 0xB:
v166 += *((_DWORD *)v94 + 17);
break;
case 0xC:
v167 += *((_DWORD *)v94 + 17);
break;
case 0xD:
v168 += *((_DWORD *)v94 + 17);
break;
case 0xE:
v180 += *((_DWORD *)v94 + 17);
break;
default:
break;
}
++v89;
}
while ( v89 < cocos2d::CCArray::count(v88) );
v162 = v93;
v161 = v92;
v160 = v91;
TotalCollectedDiamonds = v90;
v156 = TotalCollectedCurrency;
v2 = 0;
v80 = v178;
v77 = 1;
v81 = k;
}
v1 = a1;
}
goto LABEL_142;
}
}
else if ( v3 >= 1 )
{
v159 = v3 - 1;
goto LABEL_123;
}
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(v1 + 864), String);
LABEL_142:
sub_14003D310((__int64)String);
v178 = ++v80;
}
}
}
v95 = TotalCollectedDiamonds;
v96 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(v1 + 736));
if ( v96 )
{
v97 = *((unsigned int **)v96 + 7);
v98 = *v97;
if ( (_DWORD)v98 )
{
v99 = *((cocos2d::CCString ***)v97 + 2);
v100 = &v99[v98 - 1];
if ( v99 <= v100 )
{
while ( 2 )
{
if ( !*v99 )
{
LABEL_167:
v77 = 1;
break;
}
v101 = cocos2d::CCString::getCString(*v99);
*(_OWORD *)String = 0;
v183 = 0;
v184 = 0;
v102 = -1;
do
++v102;
while ( v101[v102] );
sub_14003D230(String, v101, v102);
v103 = (const char *)String;
if ( v184 > 0xF )
v103 = String[0];
v104 = atoi(v103);
v105 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v1 + 344), v104);
v106 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(v1 + 736), String);
v107 = cocos2d::CCString::intValue(v106);
if ( v107 <= 0 )
goto LABEL_161;
if ( v105 )
v107 = *((_DWORD *)v105 + 89) - *((_DWORD *)v105 + 90);
v108 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 344), v104);
if ( v108 && *((_DWORD *)v108 + 92) == 4 )
{
if ( v95 >= v107 )
{
v95 -= v107;
v1 = a1;
goto LABEL_162;
}
LABEL_161:
v1 = a1;
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 736), String);
}
else
{
if ( v156 < v107 )
goto LABEL_161;
v156 -= v107;
v1 = a1;
}
LABEL_162:
if ( v184 > 0xF )
{
v109 = String[0];
if ( v184 + 1 >= 0x1000 )
{
v109 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v109 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v109);
}
if ( ++v99 > v100 )
goto LABEL_167;
continue;
}
}
}
}
v110 = cocos2d::CCDictionary::allKeys(*(cocos2d::CCDictionary **)(v1 + 856));
if ( v110 )
{
v114 = *((unsigned int **)v110 + 7);
v115 = *v114;
if ( (_DWORD)v115 )
{
v116 = *((cocos2d::CCString ***)v114 + 2);
for ( m = &v116[v115 - 1]; v116 <= m; ++v116 )
{
v112 = *v116;
if ( !*v116 )
break;
v118 = cocos2d::CCString::getCString(v112);
*(_OWORD *)String = 0;
v183 = 0;
v184 = 0;
v119 = -1;
do
++v119;
while ( v118[v119] );
sub_14003D230(String, v118, v119);
v120 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(*(_QWORD *)(a1 + 856), String);
v121 = cocos2d::CCString::intValue(v120);
if ( v121 <= 0 || v158 < v121 )
{
cocos2d::CCDictionary::removeObjectForKey(*(_QWORD *)(a1 + 856), String);
}
else
{
v112 = (cocos2d::CCString *)(unsigned int)(v158 - v121);
v158 -= v121;
}
v111 = v184;
if ( v184 > 0xF )
{
v122 = String[0];
if ( v184 + 1 >= 0x1000 )
{
v122 = *((char **)String[0] - 1);
if ( (unsigned __int64)(String[0] - v122 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v122);
}
}
}
v1 = a1;
}
v123 = *(_BYTE *)(AchievementManager::sharedState(v112, v111, v113) + 360);
v155 = *(_BYTE *)(v1 + 912);
*(_BYTE *)(AchievementManager::sharedState(v125, v124, v126) + 360) = 1;
*(_BYTE *)(v1 + 912) = 1;
GameStatsManager::resetSpecialStatAchievements();
GameStatsManager::setStat(v1, &word_140737D98, v156);
GameStatsManager::setStat(v1, "13", TotalCollectedDiamonds);
GameStatsManager::setStat(v1, &word_14075A858, v95);
GameStatsManager::setStat(v1, &word_140737620, v158);
GameStatsManager::setStat(v1, &word_1407380E4, v159);
GameStatsManager::setStat(v1, &word_140737FE8, v160);
GameStatsManager::setStat(v1, &word_140737FE4, v161);
GameStatsManager::setStat(v1, &word_140737FF0, v162);
GameStatsManager::setStat(v1, &word_140737FEC, v163);
GameStatsManager::setStat(v1, &word_1407380D0, v164);
GameStatsManager::setStat(v1, byte_1407380CC, v165);
GameStatsManager::setStat(v1, byte_1407380D8, v166);
GameStatsManager::setStat(v1, &word_1407380D4, v167);
GameStatsManager::setStat(v1, byte_1407380E0, v168);
GameStatsManager::setStat(v1, byte_1407380DC, v180);
for ( n = 6; n <= 15; ++n )
{
if ( !qword_14090BFE0 )
{
v172 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v172);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
}
if ( (unsigned __int8)GameStatsManager::isItemUnlocked(v127, 12, (unsigned int)n) )
{
v129 = cocos2d::CCString::createWithFormat("geometry.ach.path%02d.00", n - 5);
v130 = cocos2d::CCString::getCString(v129);
*(_OWORD *)String = 0;
v183 = 0;
v184 = 0;
v131 = -1;
do
++v131;
while ( v130[v131] );
sub_14003D230(String, v130, v131);
v135 = String;
if ( v184 > 0xF )
v135 = (char **)String[0];
v136 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v179 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v179);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v136 = qword_14090BFD0;
}
v137 = AchievementManager::sharedState(v133, v132, v134);
if ( (int)AchievementManager::percentForAchievement(v137, (__int64)v135) < 100 )
{
v185 = 0;
v186 = 0;
v187 = 0;
v138 = -1;
do
++v138;
while ( *((_BYTE *)v135 + v138) );
sub_14003D230(&v185, v135, v138);
GameManager::completedAchievement(v136, (__int64)&v185);
v142 = AchievementManager::sharedState(v140, v139, v141);
AchievementManager::reportAchievementWithID(v142, (__int64)v135, 100);
}
sub_14003D310((__int64)String);
}
}
do
{
v143 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v173 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v173);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v143 = qword_14090BFE0;
}
GameStatsManager::getGauntletRewardKey(v127, &v185, (unsigned int)v77);
v144 = sub_14003F4F0((__int64)v181, (__int64)&v185);
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v143, v144);
sub_14003D310((__int64)&v185);
if ( isSpecialChestUnlocked )
++v2;
++v77;
}
while ( v77 <= 62 );
v146 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v174 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v174);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v146 = qword_14090BFE0;
}
GameStatsManager::setStat(v146, "40", v2);
v147 = cocos2d::CCDictionary::count(*(cocos2d::CCDictionary **)(a1 + 832));
v148 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v175 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v175);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v148 = qword_14090BFE0;
}
GameStatsManager::setStat(v148, "41", v147);
v149 = qword_14090BFD0;
if ( !qword_14090BFD0 )
{
v176 = operator new(0x6E8u);
qword_14090BFD0 = GameManager::GameManager((__int64)v176);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFD0 + 72LL))(qword_14090BFD0);
v149 = qword_14090BFD0;
}
GameManager::checkUsedIcons(v149);
*(_BYTE *)(AchievementManager::sharedState(v151, v150, v152) + 360) = v123;
*(_BYTE *)(a1 + 912) = v155;
return v155;
}