//
// GameStatsManager::completedMapPack from 0x1401dee00 to 0x1401def81 (385 bytes)
//
// 3 xrefs:
// > MapPackCell::onClaimReward @ 0x1400b28eb
// > GJAccountManager::onSyncAccountCompleted @ 0x140203536
// > ??> @ 0x1406cc444
//
// 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=1
void GameStatsManager::completedMapPack(GameStatsManager *a1, GJMapPack *a2)
{
cocos2d::CCString *v4; // rax
const char *CString; // rax
size_t v6; // r8
void *v7; // rcx
cocos2d::CCArray *m_levels; // rcx
int m_coins; // edi
int v10; // ebx
int m_stars; // esi
void *Block[2]; // [rsp+20h] [rbp-48h] BYREF
__int128 v13; // [rsp+30h] [rbp-38h]
if ( !GameStatsManager::hasCompletedMapPack(a1, a2->m_packID) )
{
v4 = cocos2d::CCString::createWithFormat("pack_%i", a2->m_packID);
CString = cocos2d::CCString::getCString(v4);
*(_OWORD *)Block = 0;
v13 = 0;
v6 = -1;
do
++v6;
while ( CString[v6] );
sub_14003A930(Block, CString, v6);
cocos2d::CCDictionary::setObject(a1->m_completedLevels, a1->m_trueString, Block);
if ( *((_QWORD *)&v13 + 1) > 0xFu )
{
v7 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v13 + 1) + 1LL) >= 0x1000 )
{
v7 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v7 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v7);
}
m_levels = a2->m_levels;
if ( m_levels && (int)cocos2d::CCArray::count(m_levels) >= 3 )
{
m_coins = a2->m_coins;
v10 = 0;
m_stars = 0;
if ( a2->m_stars <= 10 )
m_stars = a2->m_stars;
GameStatsManager::incrementStat(a1, "6", m_stars);
if ( m_coins <= 2 )
v10 = m_coins;
GameStatsManager::incrementStat(a1, "8", v10);
GameStatsManager::incrementStat(a1, (const char *)&word_140531E88, 1);
GameStatsManager::setStarsForMapPack(a1, a2->m_packID, m_stars);
}
}
}