//
// GameStatsManager::getAwardedCurrencyForLevel from 0x40d238 to 0x40d32a (242 bytes)
//
// 9 xrefs:
// > LevelCell::loadCustomLevelCell @ 0x333026
// > LevelInfoLayer::updateLabelValues @ 0x3b2d64
// > LevelPage::updateDynamicPage @ 0x40b438
// > GameStatsManager::getTotalCollectedCurrency @ 0x40dacc
// > GameStatsManager::getTotalCollectedCurrency @ 0x40db48
// > GameStatsManager::getTotalCollectedCurrency @ 0x40dbc4
// > GameStatsManager::getTotalCollectedCurrency @ 0x40dc60
// > GameStatsManager::getTotalCollectedCurrency @ 0x40dcec
// > GameStatsManager::getTotalCollectedCurrency @ 0x40dd7a
//
// 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 GameStatsManager::getAwardedCurrencyForLevel(GameStatsManager *a1, GJGameLevel *a2)
{
int seed; // r0
GJLevelType m_levelType; // r1
cocos2d::CCDictionary *m_mainCurrencyScores; // r6
cocos2d::CCString *v7; // r0
int v8; // r6
int BaseCurrencyForLevel; // r0
float v10; // s15
int v11; // r4
char *v13; // [sp+4h] [bp-10h] BYREF
std::string v14; // [sp+8h] [bp-Ch] BYREF
seed = a2->m_dailyID.seed;
m_levelType = a2->m_levelType;
if ( a2->m_dailyID.random - seed <= 0 )
{
if ( m_levelType == Main )
{
m_mainCurrencyScores = a1->m_mainCurrencyScores;
}
else if ( a2->m_gauntletLevel )
{
m_mainCurrencyScores = a1->m_gauntletCurrencyScores;
}
else
{
m_mainCurrencyScores = a1->m_onlineCurrencyScores;
}
}
else
{
m_mainCurrencyScores = a1->m_timelyCurrencyScores;
}
GameStatsManager::getCurrencyKey((GameStatsManager *)&v13, (GJGameLevel *)a1, a2);
sub_776584((int)&v14, v13);
v7 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(m_mainCurrencyScores, &v14);
v8 = cocos2d::CCString::intValue(v7);
sub_774008(&v14);
BaseCurrencyForLevel = GameStatsManager::getBaseCurrencyForLevel(a1, a2);
v10 = (float)BaseCurrencyForLevel;
if ( v8 > 99 )
v11 = (int)(float)(v10 * 0.25) + BaseCurrencyForLevel;
else
v11 = (int)floorf(v10 * (float)((float)v8 / 100.0));
sub_774008(&v13);
return v11;
}