//
// GameStatsManager::dataLoaded from 0x1401f24a0 to 0x1401f35e9 (4425 bytes)
//
// 2 xrefs:
// > GameManager::dataLoaded @ 0x1401872a0
// > ??> @ 0x1406cc6e4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=5
void GameStatsManager::dataLoaded(GameStatsManager *a1, DS_Dictionary *a2)
{
DS_Dictionary *v2; // r13
int v4; // eax
int v5; // r14d
bool m_pathBugFixed; // al
cocos2d::CCDictionary *DictForKey; // rax
cocos2d::CCDictionary *v8; // rsi
cocos2d::CCDictionary *m_playerStats; // rcx
int v10; // r14d
signed int i; // esi
const char *v12; // rax
int Stat; // ebx
int v14; // ebx
unsigned int v15; // ebx
cocos2d::CCString *v16; // rax
const char *CString; // rbx
size_t v18; // r8
cocos2d::CCString *v19; // rax
int v20; // r12d
size_t v21; // r8
cocos2d::CCString *v22; // rax
int v23; // r15d
size_t v24; // r8
size_t v25; // r14
void **v26; // rcx
__int64 v27; // rsi
size_t v28; // r8
struct cocos2d::CCString *v29; // rax
__int64 v30; // rcx
size_t v31; // r8
int v32; // r14d
char v33; // si
void *v34; // rcx
size_t v35; // r8
void *v36; // rcx
const char *v37; // rax
cocos2d::CCDictionary *v38; // rax
cocos2d::CCDictionary *v39; // rbx
cocos2d::CCDictionary *m_verifiedUserCoins; // rcx
cocos2d::CCArray *v41; // r14
unsigned int j; // ebx
cocos2d::CCString *v43; // rax
const char *v44; // rsi
cocos2d::CCDictionary *v45; // rax
cocos2d::CCDictionary *v46; // rbx
cocos2d::CCDictionary *m_pendingUserCoins; // rcx
cocos2d::CCDictionary *v48; // rcx
struct cocos2d::CCDictionary *v49; // rax
cocos2d::CCDictionary *v50; // rbx
cocos2d::CCDictionary *m_completedLevels; // rcx
cocos2d::CCDictionary *v52; // rax
cocos2d::CCDictionary *v53; // rbx
cocos2d::CCDictionary *m_completedMappacks; // rcx
cocos2d::CCDictionary *v55; // rcx
cocos2d::CCDictionary *v56; // rax
cocos2d::CCDictionary *v57; // rbx
cocos2d::CCDictionary *m_purchasedItems; // rcx
cocos2d::CCDictionary *v59; // rcx
cocos2d::CCDictionary *v60; // rax
cocos2d::CCDictionary *v61; // rbx
cocos2d::CCDictionary *m_onlineCurrencyScores; // rcx
cocos2d::CCDictionary *v63; // rcx
cocos2d::CCDictionary *v64; // rax
cocos2d::CCDictionary *v65; // rbx
cocos2d::CCDictionary *m_gauntletCurrencyScores; // rcx
cocos2d::CCDictionary *v67; // rcx
cocos2d::CCDictionary *v68; // rax
cocos2d::CCDictionary *v69; // rbx
cocos2d::CCDictionary *m_mainCurrencyScores; // rcx
cocos2d::CCDictionary *v71; // rcx
cocos2d::CCDictionary *v72; // rax
cocos2d::CCDictionary *v73; // rbx
cocos2d::CCDictionary *m_timelyCurrencyScores; // rcx
cocos2d::CCDictionary *v75; // rcx
cocos2d::CCDictionary *v76; // rax
cocos2d::CCDictionary *v77; // rbx
cocos2d::CCDictionary *m_onlineStars; // rcx
cocos2d::CCDictionary *v79; // rcx
cocos2d::CCDictionary *v80; // rax
cocos2d::CCDictionary *v81; // rbx
cocos2d::CCDictionary *m_timelyStars; // rcx
cocos2d::CCDictionary *v83; // rcx
cocos2d::CCDictionary *v84; // rax
cocos2d::CCDictionary *v85; // rbx
cocos2d::CCDictionary *m_gauntletDiamondScores; // rcx
cocos2d::CCDictionary *v87; // rcx
cocos2d::CCDictionary *v88; // rax
cocos2d::CCDictionary *v89; // rbx
cocos2d::CCDictionary *m_timelyDiamondScores; // rcx
cocos2d::CCDictionary *v91; // rcx
cocos2d::CCDictionary *v92; // rax
cocos2d::CCDictionary *v93; // rbx
cocos2d::CCDictionary *m_unusedCurrencyAwardDict; // rcx
cocos2d::CCDictionary *v95; // rcx
cocos2d::CCDictionary *v96; // rax
cocos2d::CCDictionary *v97; // rbx
cocos2d::CCDictionary *m_dailyChests; // rcx
cocos2d::CCDictionary *v99; // rcx
cocos2d::CCDictionary *v100; // rax
cocos2d::CCDictionary *v101; // rbx
cocos2d::CCDictionary *m_weeklyChest; // rcx
cocos2d::CCDictionary *v103; // rcx
cocos2d::CCDictionary *v104; // rax
cocos2d::CCDictionary *v105; // rbx
cocos2d::CCDictionary *m_eventChest; // rcx
cocos2d::CCDictionary *v107; // rcx
cocos2d::CCDictionary *v108; // rax
cocos2d::CCDictionary *v109; // rbx
cocos2d::CCDictionary *m_worldAdvertChests; // rcx
cocos2d::CCDictionary *v111; // rcx
cocos2d::CCDictionary *v112; // rax
cocos2d::CCDictionary *v113; // r12
cocos2d::CCDictionary *m_activeChallenges; // rcx
struct cocos2d::CCArray *v115; // rax
cocos2d::ccArray *data; // r15
__int64 num; // rax
cocos2d::CCString **arr; // r15
cocos2d::CCString **k; // r13
const char *v120; // rax
size_t v121; // r8
__int64 v122; // rsi
_DWORD *v123; // rbx
int v124; // r14d
float v125; // xmm0_4
void *v126; // rcx
struct cocos2d::CCDictionary *v127; // rax
cocos2d::CCDictionary *v128; // rbx
cocos2d::CCDictionary *m_upcomingChallenges; // rcx
cocos2d::CCDictionary *v130; // rax
cocos2d::CCDictionary *v131; // rbx
cocos2d::CCDictionary *m_challengeDiamonds; // rcx
cocos2d::CCDictionary *v133; // rcx
cocos2d::CCDictionary *v134; // rax
cocos2d::CCDictionary *v135; // rbx
cocos2d::CCDictionary *m_completedLists; // rcx
cocos2d::CCDictionary *v137; // rcx
cocos2d::CCDictionary *v138; // rax
cocos2d::CCDictionary *v139; // rbx
cocos2d::CCDictionary *m_treasureRoomChests; // rcx
cocos2d::CCDictionary *v141; // rcx
cocos2d::CCDictionary *v142; // rax
cocos2d::CCDictionary *v143; // rbx
cocos2d::CCDictionary *m_wraithChests; // rcx
cocos2d::CCDictionary *v145; // rcx
cocos2d::CCDictionary *v146; // rax
cocos2d::CCDictionary *v147; // rbx
cocos2d::CCDictionary *m_miscChests; // rcx
cocos2d::CCDictionary *v149; // rcx
cocos2d::CCDictionary *v150; // rax
cocos2d::CCDictionary *v151; // rbx
cocos2d::CCDictionary *m_enabledItems; // rcx
cocos2d::CCDictionary *v153; // rcx
cocos2d::CCDictionary *v154; // rax
cocos2d::CCDictionary *v155; // rbx
cocos2d::CCDictionary *m_unlockedGauntlets; // rcx
cocos2d::CCDictionary *v157; // rcx
int v158; // ebx
int v159; // eax
int v160; // esi
int v161; // ecx
int v162; // eax
unsigned int v163; // [rsp+28h] [rbp-99h]
int v164; // [rsp+2Ch] [rbp-95h]
unsigned int v165; // [rsp+30h] [rbp-91h]
cocos2d::CCDictionary *v166; // [rsp+40h] [rbp-81h]
cocos2d::CCArray *v168; // [rsp+50h] [rbp-71h]
void *Buf1[2]; // [rsp+58h] [rbp-69h] BYREF
unsigned __int64 v170; // [rsp+68h] [rbp-59h]
unsigned __int64 v171; // [rsp+70h] [rbp-51h]
__int128 v172; // [rsp+78h] [rbp-49h] BYREF
__int64 v173; // [rsp+88h] [rbp-39h]
__int64 v174; // [rsp+90h] [rbp-31h]
__int128 v175; // [rsp+98h] [rbp-29h] BYREF
__int64 v176; // [rsp+A8h] [rbp-19h]
__int64 v177; // [rsp+B0h] [rbp-11h]
v2 = a2;
v163 = 0;
DS_Dictionary::getIntegerForKey(a2, "binaryVersion");
v5 = v4;
v164 = v4;
m_pathBugFixed = a1->m_pathBugFixed;
if ( !m_pathBugFixed )
{
m_pathBugFixed = DS_Dictionary::getBoolForKey(v2, "GS_29");
a1->m_pathBugFixed = m_pathBugFixed;
}
if ( v5 == 38 && !m_pathBugFixed )
a1->m_tryFixPathBug = 1;
DictForKey = DS_Dictionary::getDictForKey(v2, "GS_value", 0);
v8 = DictForKey;
v166 = DictForKey;
if ( a1->m_playerStats )
{
v168 = cocos2d::CCDictionary::allKeys(DictForKey);
v15 = 0;
v165 = 0;
if ( !cocos2d::CCArray::count(v168) )
goto LABEL_11;
while ( 1 )
{
v16 = cocos2d::CCArray::stringAtIndex(v168, v15);
CString = cocos2d::CCString::getCString(v16);
switch ( atoi(CString) )
{
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 40:
case 41:
case 42:
case 43:
goto LABEL_63;
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
if ( v5 != 38 || a1->m_tryFixPathBug )
goto LABEL_22;
goto LABEL_63;
default:
LABEL_22:
v175 = 0;
v176 = 0;
v177 = 0;
v18 = -1;
do
++v18;
while ( CString[v18] );
sub_14003A930(&v175, CString, v18);
v19 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v8, &v175);
v20 = cocos2d::CCString::intValue(v19);
sub_14003A830((__int64)&v175);
*(_OWORD *)Buf1 = 0;
v170 = 0;
v171 = 0;
v21 = -1;
do
++v21;
while ( CString[v21] );
sub_14003A930(Buf1, CString, v21);
v22 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(a1->m_playerStats, Buf1);
v23 = cocos2d::CCString::intValue(v22);
sub_14003A830((__int64)Buf1);
*(_OWORD *)Buf1 = 0;
v170 = 0;
v171 = 0;
v24 = -1;
do
++v24;
while ( CString[v24] );
sub_14003A930(Buf1, CString, v24);
v25 = 7;
if ( v170 < 7 )
v25 = v170;
v26 = Buf1;
if ( v171 > 0xF )
v26 = (void **)Buf1[0];
LODWORD(v27) = memcmp(v26, "unique_", v25);
if ( !(_DWORD)v27 )
{
if ( v25 >= 7 )
v27 = v25 > 7;
else
LODWORD(v27) = -1;
}
sub_14003A830((__int64)Buf1);
v28 = -1;
do
++v28;
while ( CString[v28] );
if ( !(_DWORD)v27 )
{
v172 = 0;
v173 = 0;
v174 = 0;
sub_14003A930(&v172, CString, v28);
if ( GameStatsManager::isSecretCoinValid(v30, (__int64 *)&v172) )
{
*(_OWORD *)Buf1 = 0;
v170 = 0;
v171 = 0;
v31 = -1;
do
++v31;
while ( CString[v31] );
sub_14003A930(Buf1, CString, v31);
v32 = v163 | 1;
v163 |= 1u;
if ( !cocos2d::CCDictionary::objectForKey(a1->m_playerStats, Buf1) )
{
v33 = 1;
goto LABEL_49;
}
}
else
{
v32 = v163;
}
v33 = 0;
LABEL_49:
if ( (v32 & 1) != 0 )
{
v163 = v32 & 0xFFFFFFFE;
if ( v171 > 0xF )
{
v34 = Buf1[0];
if ( v171 + 1 >= 0x1000 )
{
v34 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v34 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v34);
}
}
if ( v33 )
{
*(_OWORD *)Buf1 = 0;
v170 = 0;
v171 = 0;
v35 = -1;
do
++v35;
while ( CString[v35] );
sub_14003A930(Buf1, CString, v35);
cocos2d::CCDictionary::setObject(a1->m_playerStats, a1->m_trueString, Buf1);
if ( v171 > 0xF )
{
v36 = Buf1[0];
if ( v171 + 1 >= 0x1000 )
{
v36 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v36 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v36);
}
GameStatsManager::incrementStat(a1, "8", 1);
}
goto LABEL_62;
}
*(_OWORD *)Buf1 = 0;
v170 = 0;
v171 = 0;
sub_14003A930(Buf1, CString, v28);
if ( v20 > v23 )
v23 = v20;
v29 = cocos2d::CCString::createWithFormat("%i", v23);
cocos2d::CCDictionary::setObject(a1->m_playerStats, v29, Buf1);
sub_14003A830((__int64)Buf1);
LABEL_62:
v8 = v166;
v5 = v164;
LABEL_63:
v15 = ++v165;
if ( v165 >= cocos2d::CCArray::count(v168) )
goto LABEL_11;
break;
}
}
}
if ( DictForKey )
{
cocos2d::CCObject::retain(DictForKey);
m_playerStats = a1->m_playerStats;
if ( m_playerStats )
cocos2d::CCObject::release(m_playerStats);
a1->m_playerStats = v8;
}
LABEL_11:
if ( !a1->m_pathBugFixed && !a1->m_tryFixPathBug )
{
v10 = 0;
for ( i = 30; i <= 39; ++i )
{
v12 = (const char *)GameToolbox::intToString(&v172, i);
if ( *((_QWORD *)v12 + 3) > 0xFu )
v12 = *(const char **)v12;
Stat = GameStatsManager::getStat(a1, v12);
sub_14003A830((__int64)&v172);
if ( Stat <= 1000 )
{
v37 = (const char *)GameToolbox::intToString(&v172, i);
if ( *((_QWORD *)v37 + 3) > 0xFu )
v37 = *(const char **)v37;
v14 = GameStatsManager::getStat(a1, v37);
sub_14003A830((__int64)&v172);
}
else
{
v14 = 1000;
}
v10 += v14;
}
if ( v10 > 1000 )
a1->m_pathBugFixed = 1;
}
v38 = DS_Dictionary::getDictForKey(v2, "GS_3", 0);
v39 = v38;
if ( a1->m_verifiedUserCoins )
{
v41 = cocos2d::CCDictionary::allKeys(v38);
for ( j = 0; j < cocos2d::CCArray::count(v41); ++j )
{
v43 = cocos2d::CCArray::stringAtIndex(v41, j);
v44 = cocos2d::CCString::getCString(v43);
if ( !GameStatsManager::hasUserCoin(a1, v44) )
{
GameStatsManager::storeUserCoin(a1, v44);
GameStatsManager::incrementStat(a1, "12", 1);
}
}
}
else if ( v38 )
{
cocos2d::CCObject::retain(v38);
m_verifiedUserCoins = a1->m_verifiedUserCoins;
if ( m_verifiedUserCoins )
cocos2d::CCObject::release(m_verifiedUserCoins);
a1->m_verifiedUserCoins = v39;
}
v45 = DS_Dictionary::getDictForKey(v2, "GS_4", 0);
v46 = v45;
m_pendingUserCoins = a1->m_pendingUserCoins;
if ( m_pendingUserCoins )
{
GameToolbox::mergeDictsSaveLargestInt(m_pendingUserCoins, v45);
}
else if ( v45 )
{
cocos2d::CCObject::retain(v45);
v48 = a1->m_pendingUserCoins;
if ( v48 )
cocos2d::CCObject::release(v48);
a1->m_pendingUserCoins = v46;
}
v49 = DS_Dictionary::getDictForKey(v2, "GS_completed", 0);
v50 = v49;
if ( !a1->m_completedLevels && v49 )
{
cocos2d::CCObject::retain(v49);
m_completedLevels = a1->m_completedLevels;
if ( m_completedLevels )
cocos2d::CCObject::release(m_completedLevels);
a1->m_completedLevels = v50;
}
v52 = DS_Dictionary::getDictForKey(v2, "GS_5", 0);
v53 = v52;
m_completedMappacks = a1->m_completedMappacks;
if ( m_completedMappacks )
{
GameToolbox::mergeDictsSaveLargestInt(m_completedMappacks, v52);
}
else if ( v52 )
{
cocos2d::CCObject::retain(v52);
v55 = a1->m_completedMappacks;
if ( v55 )
cocos2d::CCObject::release(v55);
a1->m_completedMappacks = v53;
}
v56 = DS_Dictionary::getDictForKey(v2, "GS_6", 0);
v57 = v56;
m_purchasedItems = a1->m_purchasedItems;
if ( m_purchasedItems )
{
GameToolbox::mergeDictsSaveLargestInt(m_purchasedItems, v56);
}
else if ( v56 )
{
cocos2d::CCObject::retain(v56);
v59 = a1->m_purchasedItems;
if ( v59 )
cocos2d::CCObject::release(v59);
a1->m_purchasedItems = v57;
}
v60 = DS_Dictionary::getDictForKey(v2, "GS_7", 0);
v61 = v60;
m_onlineCurrencyScores = a1->m_onlineCurrencyScores;
if ( m_onlineCurrencyScores )
{
GameToolbox::mergeDictsSaveLargestInt(m_onlineCurrencyScores, v60);
}
else if ( v60 )
{
cocos2d::CCObject::retain(v60);
v63 = a1->m_onlineCurrencyScores;
if ( v63 )
cocos2d::CCObject::release(v63);
a1->m_onlineCurrencyScores = v61;
}
v64 = DS_Dictionary::getDictForKey(v2, "GS_23", 0);
v65 = v64;
m_gauntletCurrencyScores = a1->m_gauntletCurrencyScores;
if ( m_gauntletCurrencyScores )
{
GameToolbox::mergeDictsSaveLargestInt(m_gauntletCurrencyScores, v64);
}
else if ( v64 )
{
cocos2d::CCObject::retain(v64);
v67 = a1->m_gauntletCurrencyScores;
if ( v67 )
cocos2d::CCObject::release(v67);
a1->m_gauntletCurrencyScores = v65;
}
v68 = DS_Dictionary::getDictForKey(v2, "GS_10", 0);
v69 = v68;
m_mainCurrencyScores = a1->m_mainCurrencyScores;
if ( m_mainCurrencyScores )
{
GameToolbox::mergeDictsSaveLargestInt(m_mainCurrencyScores, v68);
}
else if ( v68 )
{
cocos2d::CCObject::retain(v68);
v71 = a1->m_mainCurrencyScores;
if ( v71 )
cocos2d::CCObject::release(v71);
a1->m_mainCurrencyScores = v69;
}
v72 = DS_Dictionary::getDictForKey(v2, "GS_16", 0);
v73 = v72;
m_timelyCurrencyScores = a1->m_timelyCurrencyScores;
if ( m_timelyCurrencyScores )
{
GameToolbox::mergeDictsSaveLargestInt(m_timelyCurrencyScores, v72);
}
else if ( v72 )
{
cocos2d::CCObject::retain(v72);
v75 = a1->m_timelyCurrencyScores;
if ( v75 )
cocos2d::CCObject::release(v75);
a1->m_timelyCurrencyScores = v73;
}
v76 = DS_Dictionary::getDictForKey(v2, "GS_9", 0);
v77 = v76;
m_onlineStars = a1->m_onlineStars;
if ( m_onlineStars )
{
GameToolbox::mergeDictsSaveLargestInt(m_onlineStars, v76);
}
else if ( v76 )
{
cocos2d::CCObject::retain(v76);
v79 = a1->m_onlineStars;
if ( v79 )
cocos2d::CCObject::release(v79);
a1->m_onlineStars = v77;
}
v80 = DS_Dictionary::getDictForKey(v2, "GS_17", 0);
v81 = v80;
m_timelyStars = a1->m_timelyStars;
if ( m_timelyStars )
{
GameToolbox::mergeDictsSaveLargestInt(m_timelyStars, v80);
}
else if ( v80 )
{
cocos2d::CCObject::retain(v80);
v83 = a1->m_timelyStars;
if ( v83 )
cocos2d::CCObject::release(v83);
a1->m_timelyStars = v81;
}
v84 = DS_Dictionary::getDictForKey(v2, "GS_18", 0);
v85 = v84;
m_gauntletDiamondScores = a1->m_gauntletDiamondScores;
if ( m_gauntletDiamondScores )
{
GameToolbox::mergeDictsSaveLargestInt(m_gauntletDiamondScores, v84);
}
else if ( v84 )
{
cocos2d::CCObject::retain(v84);
v87 = a1->m_gauntletDiamondScores;
if ( v87 )
cocos2d::CCObject::release(v87);
a1->m_gauntletDiamondScores = v85;
}
v88 = DS_Dictionary::getDictForKey(v2, "GS_24", 0);
v89 = v88;
m_timelyDiamondScores = a1->m_timelyDiamondScores;
if ( m_timelyDiamondScores )
{
GameToolbox::mergeDictsSaveLargestInt(m_timelyDiamondScores, v88);
}
else if ( v88 )
{
cocos2d::CCObject::retain(v88);
v91 = a1->m_timelyDiamondScores;
if ( v91 )
cocos2d::CCObject::release(v91);
a1->m_timelyDiamondScores = v89;
}
v92 = DS_Dictionary::getDictForKey(v2, "GS_8", 0);
v93 = v92;
m_unusedCurrencyAwardDict = a1->m_unusedCurrencyAwardDict;
if ( m_unusedCurrencyAwardDict )
{
GameToolbox::mergeDictsSaveLargestInt(m_unusedCurrencyAwardDict, v92);
}
else if ( v92 )
{
cocos2d::CCObject::retain(v92);
v95 = a1->m_unusedCurrencyAwardDict;
if ( v95 )
cocos2d::CCObject::release(v95);
a1->m_unusedCurrencyAwardDict = v93;
}
v96 = DS_Dictionary::getDictForKey(v2, "GS_11", 0);
v97 = v96;
m_dailyChests = a1->m_dailyChests;
if ( m_dailyChests )
{
GameToolbox::mergeDictsSkipConflict(m_dailyChests, v96);
}
else if ( v96 )
{
cocos2d::CCObject::retain(v96);
v99 = a1->m_dailyChests;
if ( v99 )
cocos2d::CCObject::release(v99);
a1->m_dailyChests = v97;
}
v100 = DS_Dictionary::getDictForKey(v2, "GS_25", 0);
v101 = v100;
m_weeklyChest = a1->m_weeklyChest;
if ( m_weeklyChest )
{
GameToolbox::mergeDictsSkipConflict(m_weeklyChest, v100);
}
else if ( v100 )
{
cocos2d::CCObject::retain(v100);
v103 = a1->m_weeklyChest;
if ( v103 )
cocos2d::CCObject::release(v103);
a1->m_weeklyChest = v101;
}
v104 = DS_Dictionary::getDictForKey(v2, "GS_31", 0);
v105 = v104;
m_eventChest = a1->m_eventChest;
if ( m_eventChest )
{
GameToolbox::mergeDictsSkipConflict(m_eventChest, v104);
}
else if ( v104 )
{
cocos2d::CCObject::retain(v104);
v107 = a1->m_eventChest;
if ( v107 )
cocos2d::CCObject::release(v107);
a1->m_eventChest = v105;
}
v108 = DS_Dictionary::getDictForKey(v2, "GS_22", 0);
v109 = v108;
m_worldAdvertChests = a1->m_worldAdvertChests;
if ( m_worldAdvertChests )
{
GameToolbox::mergeDictsSkipConflict(m_worldAdvertChests, v108);
}
else if ( v108 )
{
cocos2d::CCObject::retain(v108);
v111 = a1->m_worldAdvertChests;
if ( v111 )
cocos2d::CCObject::release(v111);
a1->m_worldAdvertChests = v109;
}
v112 = DS_Dictionary::getDictForKey(v2, "GS_12", 0);
v113 = v112;
if ( a1->m_activeChallenges )
{
v115 = cocos2d::CCDictionary::allKeys(v112);
if ( v115 )
{
data = v115->data;
num = data->num;
if ( (_DWORD)num )
{
arr = (cocos2d::CCString **)data->arr;
for ( k = &arr[num - 1]; arr <= k; ++arr )
{
if ( !*arr )
break;
v120 = cocos2d::CCString::getCString(*arr);
*(_OWORD *)Buf1 = 0;
v170 = 0;
v171 = 0;
v121 = -1;
do
++v121;
while ( v120[v121] );
sub_14003A930(Buf1, v120, v121);
v122 = cocos2d::CCDictionary::objectForKey(v113, Buf1);
v123 = (_DWORD *)cocos2d::CCDictionary::objectForKey(a1->m_activeChallenges, Buf1);
if ( v123 )
{
if ( v123[24] == *(_DWORD *)(v122 + 96) && v123[14] == *(_DWORD *)(v122 + 56) )
{
v124 = *(_DWORD *)(v122 + 60) - *(_DWORD *)(v122 + 64);
if ( v123[15] - v123[16] < v124 )
{
v123[17] = v124;
v125 = (float)((float)rand() / 32767.0) * 1000.0;
v123[16] = (int)v125;
v123[15] = v124 + (int)v125;
}
}
}
else if ( !GameStatsManager::hasCompletedChallenge(a1, (GJChallengeItem *)v122) )
{
cocos2d::CCDictionary::setObject(a1->m_activeChallenges, v122, Buf1);
}
if ( v171 > 0xF )
{
v126 = Buf1[0];
if ( v171 + 1 >= 0x1000 )
{
v126 = *((void **)Buf1[0] - 1);
if ( (unsigned __int64)((char *)Buf1[0] - (char *)v126 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v126);
}
}
v2 = a2;
}
}
}
else if ( v112 )
{
cocos2d::CCObject::retain(v112);
m_activeChallenges = a1->m_activeChallenges;
if ( m_activeChallenges )
cocos2d::CCObject::release(m_activeChallenges);
a1->m_activeChallenges = v113;
}
v127 = DS_Dictionary::getDictForKey(v2, "GS_15", 0);
v128 = v127;
if ( !a1->m_upcomingChallenges && v127 )
{
cocos2d::CCObject::retain(v127);
m_upcomingChallenges = a1->m_upcomingChallenges;
if ( m_upcomingChallenges )
cocos2d::CCObject::release(m_upcomingChallenges);
a1->m_upcomingChallenges = v128;
}
v130 = DS_Dictionary::getDictForKey(v2, "GS_14", 0);
v131 = v130;
m_challengeDiamonds = a1->m_challengeDiamonds;
if ( m_challengeDiamonds )
{
GameToolbox::mergeDictsSaveLargestInt(m_challengeDiamonds, v130);
}
else if ( v130 )
{
cocos2d::CCObject::retain(v130);
v133 = a1->m_challengeDiamonds;
if ( v133 )
cocos2d::CCObject::release(v133);
a1->m_challengeDiamonds = v131;
}
v134 = DS_Dictionary::getDictForKey(v2, "GS_27", 0);
v135 = v134;
m_completedLists = a1->m_completedLists;
if ( m_completedLists )
{
GameToolbox::mergeDictsSaveLargestInt(m_completedLists, v134);
}
else if ( v134 )
{
cocos2d::CCObject::retain(v134);
v137 = a1->m_completedLists;
if ( v137 )
cocos2d::CCObject::release(v137);
a1->m_completedLists = v135;
}
v138 = DS_Dictionary::getDictForKey(v2, "GS_19", 0);
v139 = v138;
m_treasureRoomChests = a1->m_treasureRoomChests;
if ( m_treasureRoomChests )
{
GameToolbox::mergeDictsSkipConflict(m_treasureRoomChests, v138);
}
else if ( v138 )
{
cocos2d::CCObject::retain(v138);
v141 = a1->m_treasureRoomChests;
if ( v141 )
cocos2d::CCObject::release(v141);
a1->m_treasureRoomChests = v139;
}
v142 = DS_Dictionary::getDictForKey(v2, "GS_30", 0);
v143 = v142;
m_wraithChests = a1->m_wraithChests;
if ( m_wraithChests )
{
GameToolbox::mergeDictsSkipConflict(m_wraithChests, v142);
}
else if ( v142 )
{
cocos2d::CCObject::retain(v142);
v145 = a1->m_wraithChests;
if ( v145 )
cocos2d::CCObject::release(v145);
a1->m_wraithChests = v143;
}
v146 = DS_Dictionary::getDictForKey(v2, "GS_21", 0);
v147 = v146;
m_miscChests = a1->m_miscChests;
if ( m_miscChests )
{
GameToolbox::mergeDictsSkipConflict(m_miscChests, v146);
}
else if ( v146 )
{
cocos2d::CCObject::retain(v146);
v149 = a1->m_miscChests;
if ( v149 )
cocos2d::CCObject::release(v149);
a1->m_miscChests = v147;
}
v150 = DS_Dictionary::getDictForKey(v2, "GS_28", 0);
v151 = v150;
m_enabledItems = a1->m_enabledItems;
if ( m_enabledItems )
{
GameToolbox::mergeDictsSkipConflict(m_enabledItems, v150);
}
else if ( v150 )
{
cocos2d::CCObject::retain(v150);
v153 = a1->m_enabledItems;
if ( v153 )
cocos2d::CCObject::release(v153);
a1->m_enabledItems = v151;
}
v154 = DS_Dictionary::getDictForKey(v2, "GS_32", 0);
v155 = v154;
m_unlockedGauntlets = a1->m_unlockedGauntlets;
if ( m_unlockedGauntlets )
{
GameToolbox::mergeDictsSkipConflict(m_unlockedGauntlets, v154);
}
else if ( v154 )
{
cocos2d::CCObject::retain(v154);
v157 = a1->m_unlockedGauntlets;
if ( v157 )
cocos2d::CCObject::release(v157);
a1->m_unlockedGauntlets = v155;
}
GameStatsManager::removeErrorFromSpecialChests(a1);
v158 = a1->m_bonusKey.random - a1->m_bonusKey.seed;
DS_Dictionary::getIntegerForKey(v2, "GS_20");
v160 = v159;
if ( v159 > v158 )
{
a1->m_bonusKey.value = v159;
v161 = (int)(float)((float)((float)rand() / 32767.0) * 1000.0);
a1->m_bonusKey.seed = v161;
a1->m_bonusKey.random = v160 + v161;
}
DS_Dictionary::getIntegerForKey(v2, "GS_26");
if ( (unsigned int)(v162 - 30) > 9 )
v162 = 0;
a1->m_activePath = v162;
GameStatsManager::postLoadGameStats(a1);
}