//
// GameStatsManager::getTotalCollectedCurrency from 0x1003349bc to 0x100334f0c (1360 bytes)
//
// 1 xrefs:
// > GameStatsManager::recountSpecialStats @ 0x100335190
//
// 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 GameStatsManager::getTotalCollectedCurrency(GameStatsManager *a1)
{
int v2; // w20
float v3; // s8
GameLevelManager *v4; // x0
GJGameLevel *MainLevel; // x0
cocos2d::CCString *v6; // x0
char *CString; // x0
cocos2d::CCDictionary *m_mainCurrencyScores; // x22
char *v9; // x1
int v10; // w23
int v11; // w20
GameLevelManager *v12; // x0
GJGameLevel *v13; // x0
cocos2d::CCString *v14; // x0
char *v15; // x0
cocos2d::CCDictionary *v16; // x22
char *v17; // x1
int i; // w20
GameLevelManager *v19; // x0
GJGameLevel *v20; // x0
cocos2d::CCString *v21; // x0
char *v22; // x0
cocos2d::CCDictionary *v23; // x22
char *v24; // x1
cocos2d::CCArray *v25; // x20
unsigned int v26; // w21
cocos2d::CCString *v27; // x0
int v28; // w23
GameLevelManager *v29; // x0
GJGameLevel *SavedLevel; // x0
cocos2d::CCString *v31; // x0
char *v32; // x0
cocos2d::CCDictionary *m_onlineCurrencyScores; // x23
char *v34; // x1
cocos2d::CCArray *v35; // x20
unsigned int v36; // w21
cocos2d::CCString *v37; // x0
int v38; // w23
GameLevelManager *v39; // x0
GJGameLevel *SavedGauntletLevel; // x0
cocos2d::CCString *v41; // x0
char *v42; // x0
cocos2d::CCDictionary *m_gauntletCurrencyScores; // x23
char *v44; // x1
cocos2d::CCArray *v45; // x20
unsigned int v46; // w21
cocos2d::CCString *v47; // x0
int v48; // w23
GameLevelManager *v49; // x0
GJGameLevel *SavedDailyLevel; // x0
cocos2d::CCString *v51; // x0
char *v52; // x0
cocos2d::CCDictionary *m_timelyCurrencyScores; // x23
char *v54; // x1
cocos2d::CCDictionary *m_timelyStars; // x23
char *v56; // x1
void *__p[2]; // [xsp+10h] [xbp-80h] BYREF
char v59; // [xsp+27h] [xbp-69h]
void *v60[2]; // [xsp+28h] [xbp-68h] BYREF
char v61; // [xsp+3Fh] [xbp-51h]
v2 = 1;
v3 = 0.0;
do
{
v4 = GameLevelManager::sharedState();
MainLevel = GameLevelManager::getMainLevel(v4, v2, 1);
if ( MainLevel )
{
v3 = v3 + (float)GameStatsManager::getAwardedCurrencyForLevel(a1, MainLevel);
}
else
{
v6 = (cocos2d::CCString *)sub_100268F4C("%i", MEMORY[0x148] - MEMORY[0x14C]);
CString = (char *)cocos2d::CCString::getCString(v6);
sub_100009900(v60, CString);
m_mainCurrencyScores = a1->m_mainCurrencyScores;
if ( v61 >= 0 )
v9 = (char *)v60;
else
v9 = (char *)v60[0];
sub_100009900(__p, v9);
cocos2d::CCDictionary::removeObjectForKey_1((int)m_mainCurrencyScores, (char *)__p);
if ( v59 < 0 )
operator delete(__p[0]);
if ( v61 < 0 )
operator delete(v60[0]);
}
++v2;
}
while ( v2 != 23 );
v10 = 4;
v11 = 5001;
do
{
v12 = GameLevelManager::sharedState();
v13 = GameLevelManager::getMainLevel(v12, v11, 1);
if ( v13 )
{
v3 = v3 + (float)GameStatsManager::getAwardedCurrencyForLevel(a1, v13);
}
else
{
v14 = (cocos2d::CCString *)sub_100268F4C("%i", MEMORY[0x148] - MEMORY[0x14C]);
v15 = (char *)cocos2d::CCString::getCString(v14);
sub_100009900(v60, v15);
v16 = a1->m_mainCurrencyScores;
if ( v61 >= 0 )
v17 = (char *)v60;
else
v17 = (char *)v60[0];
sub_100009900(__p, v17);
cocos2d::CCDictionary::removeObjectForKey_1((int)v16, (char *)__p);
if ( v59 < 0 )
operator delete(__p[0]);
if ( v61 < 0 )
operator delete(v60[0]);
}
++v11;
--v10;
}
while ( v10 );
for ( i = 2001; i != 2011; ++i )
{
v19 = GameLevelManager::sharedState();
v20 = GameLevelManager::getMainLevel(v19, i, 1);
if ( v20 )
{
v3 = v3 + (float)GameStatsManager::getAwardedCurrencyForLevel(a1, v20);
}
else
{
v21 = (cocos2d::CCString *)sub_100268F4C("%i", MEMORY[0x148] - MEMORY[0x14C]);
v22 = (char *)cocos2d::CCString::getCString(v21);
sub_100009900(v60, v22);
v23 = a1->m_mainCurrencyScores;
if ( v61 >= 0 )
v24 = (char *)v60;
else
v24 = (char *)v60[0];
sub_100009900(__p, v24);
cocos2d::CCDictionary::removeObjectForKey_1((int)v23, (char *)__p);
if ( v59 < 0 )
operator delete(__p[0]);
if ( v61 < 0 )
operator delete(v60[0]);
}
}
v25 = cocos2d::CCDictionary::allKeys(a1->m_onlineCurrencyScores);
if ( (unsigned int)sub_10024A36C((__int64)v25) )
{
v26 = 0;
do
{
v27 = cocos2d::CCArray::stringAtIndex(v25, v26);
v28 = cocos2d::CCString::intValue(v27);
v29 = GameLevelManager::sharedState();
SavedLevel = GameLevelManager::getSavedLevel(v29, v28);
if ( SavedLevel )
{
v3 = v3 + (float)GameStatsManager::getAwardedCurrencyForLevel(a1, SavedLevel);
}
else
{
v31 = (cocos2d::CCString *)sub_100268F4C("%i", v28);
v32 = (char *)cocos2d::CCString::getCString(v31);
sub_100009900(v60, v32);
m_onlineCurrencyScores = a1->m_onlineCurrencyScores;
if ( v61 >= 0 )
v34 = (char *)v60;
else
v34 = (char *)v60[0];
sub_100009900(__p, v34);
cocos2d::CCDictionary::removeObjectForKey_1((int)m_onlineCurrencyScores, (char *)__p);
if ( v59 < 0 )
operator delete(__p[0]);
if ( v61 < 0 )
operator delete(v60[0]);
}
++v26;
}
while ( v26 < (unsigned int)sub_10024A36C((__int64)v25) );
}
v35 = cocos2d::CCDictionary::allKeys(a1->m_gauntletCurrencyScores);
if ( (unsigned int)sub_10024A36C((__int64)v35) )
{
v36 = 0;
do
{
v37 = cocos2d::CCArray::stringAtIndex(v35, v36);
v38 = cocos2d::CCString::intValue(v37);
v39 = GameLevelManager::sharedState();
SavedGauntletLevel = GameLevelManager::getSavedGauntletLevel(v39, v38);
if ( SavedGauntletLevel )
{
v3 = v3 + (float)GameStatsManager::getAwardedCurrencyForLevel(a1, SavedGauntletLevel);
}
else
{
v41 = (cocos2d::CCString *)sub_100268F4C("%i", v38);
v42 = (char *)cocos2d::CCString::getCString(v41);
sub_100009900(v60, v42);
m_gauntletCurrencyScores = a1->m_gauntletCurrencyScores;
if ( v61 >= 0 )
v44 = (char *)v60;
else
v44 = (char *)v60[0];
sub_100009900(__p, v44);
cocos2d::CCDictionary::removeObjectForKey_1((int)m_gauntletCurrencyScores, (char *)__p);
if ( v59 < 0 )
operator delete(__p[0]);
if ( v61 < 0 )
operator delete(v60[0]);
}
++v36;
}
while ( v36 < (unsigned int)sub_10024A36C((__int64)v35) );
}
v45 = cocos2d::CCDictionary::allKeys(a1->m_timelyCurrencyScores);
if ( (unsigned int)sub_10024A36C((__int64)v45) )
{
v46 = 0;
do
{
v47 = cocos2d::CCArray::stringAtIndex(v45, v46);
v48 = cocos2d::CCString::intValue(v47);
v49 = GameLevelManager::sharedState();
SavedDailyLevel = GameLevelManager::getSavedDailyLevel(v49, v48);
if ( SavedDailyLevel )
{
v3 = v3 + (float)GameStatsManager::getAwardedCurrencyForLevel(a1, SavedDailyLevel);
}
else
{
v51 = (cocos2d::CCString *)sub_100268F4C("%i", v48);
v52 = (char *)cocos2d::CCString::getCString(v51);
sub_100009900(v60, v52);
m_timelyCurrencyScores = a1->m_timelyCurrencyScores;
if ( v61 >= 0 )
v54 = (char *)v60;
else
v54 = (char *)v60[0];
sub_100009900(__p, v54);
cocos2d::CCDictionary::removeObjectForKey_1((int)m_timelyCurrencyScores, (char *)__p);
if ( v59 < 0 )
operator delete(__p[0]);
m_timelyStars = a1->m_timelyStars;
if ( v61 >= 0 )
v56 = (char *)v60;
else
v56 = (char *)v60[0];
sub_100009900(__p, v56);
cocos2d::CCDictionary::removeObjectForKey_1((int)m_timelyStars, (char *)__p);
if ( v59 < 0 )
operator delete(__p[0]);
if ( v61 < 0 )
operator delete(v60[0]);
}
++v46;
}
while ( v46 < (unsigned int)sub_10024A36C((__int64)v45) );
}
return (int)v3;
}