//
// GameLevelManager::getCompletedEventLevels from 0x100098794 to 0x1000988ec (344 bytes)
//
// 2 xrefs:
// > GameLevelManager::updateUserScore @ 0x1000a2044
// > GameLevelManager::updateUserScore @ 0x1000a21ec
//
// 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
//
int __fastcall GameLevelManager::getCompletedEventLevels(GameLevelManager *a1, int a2, int a3)
{
cocos2d::CCArray *v6; // x0
cocos2d::ccArray *data; // x9
__int64 num; // x8
int v9; // w22
cocos2d::CCString **arr; // x27
unsigned __int64 v11; // x28
cocos2d::CCString *v12; // x25
cocos2d::CCDictionary *m_dailyLevels; // x26
char *CString; // x0
const void *v15; // x0
GJGameLevel *v16; // x25
int v17; // w8
GameStatsManager *v18; // x0
void *__p[2]; // [xsp+8h] [xbp-68h] BYREF
char v21; // [xsp+1Fh] [xbp-51h]
v6 = cocos2d::CCDictionary::allKeys(a1->m_dailyLevels);
if ( v6 )
{
data = v6->data;
num = data->num;
if ( (_DWORD)num )
{
v9 = 0;
arr = (cocos2d::CCString **)data->arr;
v11 = (unsigned __int64)&arr[num - 1];
while ( 1 )
{
v12 = *arr;
if ( !*arr )
return v9;
if ( cocos2d::CCString::intValue(*arr) >= 200001 )
{
m_dailyLevels = a1->m_dailyLevels;
CString = (char *)cocos2d::CCString::getCString(v12);
sub_100009900(__p, CString);
v15 = (const void *)cocos2d::CCDictionary::objectForKey_1(m_dailyLevels, __p);
if ( v15 )
v16 = (GJGameLevel *)__dynamic_cast(
v15,
(const struct __class_type_info *)&`typeinfo for'cocos2d::CCObject,
(const struct __class_type_info *)&`typeinfo for'GJGameLevel,
0);
else
v16 = nullptr;
if ( v21 < 0 )
{
operator delete(__p[0]);
if ( v16 )
{
LABEL_13:
v17 = v16->m_stars.random - v16->m_stars.seed;
if ( v17 >= a2 && v17 <= a3 && v16->m_normalPercent.random - v16->m_normalPercent.seed == 100 )
{
v18 = GameStatsManager::sharedState();
v9 += GameStatsManager::hasCompletedLevel(v18, v16);
}
}
}
else if ( v16 )
{
goto LABEL_13;
}
}
if ( (unsigned __int64)++arr > v11 )
return v9;
}
}
}
return 0;
}