//
// GameStatsManager::getBaseCurrencyForLevel from 0x1401e0480 to 0x1401e0714 (660 bytes)
//
// 6 xrefs:
// > LevelCell::loadCustomLevelCell @ 0x1400b06b0
// > GameStatsManager::getAwardedCurrencyForLevel @ 0x1401e08b6
// > GameStatsManager::awardCurrencyForLevel @ 0x1401e0b49
// > LevelInfoLayer::updateLabelValues @ 0x1402ff6df
// > LevelPage::updateDynamicPage @ 0x14031b2d8
// > ??> @ 0x1406cc4d4
//
// 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=2
int GameStatsManager::getBaseCurrencyForLevel(GameStatsManager *a1, GJGameLevel *a2)
{
int v3; // ebx
int v4; // esi
int v5; // ebp
cocos2d::CCString *v6; // rax
const char *CString; // rax
size_t v8; // rdi
size_t v9; // r8
cocos2d::CCString *v10; // rax
cocos2d::CCDictionary *m_onlineStars; // rbp
void **v12; // rdx
cocos2d::CCString *v13; // rax
int v14; // edi
void *v15; // rcx
void *v16; // rcx
int v17; // ecx
void *v19[2]; // [rsp+28h] [rbp-60h] BYREF
__int128 v20; // [rsp+38h] [rbp-50h]
void *Block[2]; // [rsp+48h] [rbp-40h] BYREF
__int128 v22; // [rsp+58h] [rbp-30h]
v3 = 0;
v4 = a2->m_stars.random - a2->m_stars.seed;
v5 = a2->m_dailyID.random - a2->m_dailyID.seed;
if ( a2->m_levelType == Main )
{
v17 = a2->m_levelID.random - a2->m_levelID.seed;
if ( ((v17 - 14) & 0xFFFFFFF9) != 0 || v17 == 16 )
return 20 * (v4 + 1);
else
return 400;
}
else
{
if ( v5 <= 0 )
{
v10 = cocos2d::CCString::createWithFormat("%i", a2->m_levelID.random - a2->m_levelID.seed);
CString = cocos2d::CCString::getCString(v10);
*(_OWORD *)v19 = 0;
v20 = 0;
v8 = -1;
v9 = -1;
do
++v9;
while ( CString[v9] );
}
else
{
v6 = cocos2d::CCString::createWithFormat("%i", v5);
CString = cocos2d::CCString::getCString(v6);
*(_OWORD *)v19 = 0;
v20 = 0;
v8 = -1;
v9 = -1;
do
++v9;
while ( CString[v9] );
}
sub_14003A930(v19, CString, v9);
if ( v5 <= 0 )
m_onlineStars = a1->m_onlineStars;
else
m_onlineStars = a1->m_timelyStars;
v12 = v19;
if ( *((_QWORD *)&v20 + 1) > 0xFu )
v12 = (void **)v19[0];
*(_OWORD *)Block = 0;
v22 = 0;
do
++v8;
while ( *((_BYTE *)v12 + v8) );
sub_14003A930(Block, v12, v8);
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(m_onlineStars, Block);
v14 = cocos2d::CCString::intValue(v13);
if ( *((_QWORD *)&v22 + 1) > 0xFu )
{
v15 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v22 + 1) + 1LL) >= 0x1000 )
{
v15 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v15 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v15);
}
if ( v14 > v4 )
v4 = v14;
if ( *((_QWORD *)&v20 + 1) > 0xFu )
{
v16 = v19[0];
if ( (unsigned __int64)(*((_QWORD *)&v20 + 1) + 1LL) >= 0x1000 )
{
v16 = *((void **)v19[0] - 1);
if ( (unsigned __int64)((char *)v19[0] - (char *)v16 - 8) > 0x1F )
invalid_parameter_noinfo_noreturn();
}
j_j_free(v16);
}
switch ( v4 )
{
case 2:
v3 = 40;
break;
case 3:
v3 = 60;
break;
case 4:
v3 = 100;
break;
case 5:
v3 = 140;
break;
case 6:
v3 = 180;
break;
case 7:
v3 = 220;
break;
case 8:
v3 = 280;
break;
case 9:
v3 = 340;
break;
case 10:
return 400;
default:
return v3;
}
}
return v3;
}