//
// GameStatsManager::getBaseCurrencyForLevel from 0x1402e3e90 to 0x1402e4154 (708 bytes)
//
// 6 xrefs:
// > LevelCell::loadCustomLevelCell @ 0x14014bf52
// > GameStatsManager::getAwardedCurrencyForLevel @ 0x1402e42cc
// > GameStatsManager::awardCurrencyForLevel @ 0x1402e4564
// > LevelInfoLayer::updateLabelValues @ 0x140424c3a
// > LevelPage::updateDynamicPage @ 0x14044480d
// > ??> @ 0x14091df3c
//
// This function is hookable on this platform (idp: pc, 32 bit: False, 64 bit: True!
//
// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings
// Generated at Fri, 27 Nov 2026 11:29:49 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall GameStatsManager::getBaseCurrencyForLevel(__int64 a1, _DWORD *a2)
{
unsigned 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
__int64 v11; // rax
__int64 v12; // rbp
void **v13; // rdx
cocos2d::CCString *v14; // rax
int v15; // edi
void *v16; // rcx
void *v17; // rcx
int v18; // ecx
void *v20[2]; // [rsp+38h] [rbp-60h] BYREF
__int128 v21; // [rsp+48h] [rbp-50h]
void *Block[2]; // [rsp+58h] [rbp-40h] BYREF
__int128 v23; // [rsp+68h] [rbp-30h]
v3 = 0;
v4 = a2[255] - a2[256];
v5 = a2[248] - a2[249];
if ( a2[305] == 1 )
{
v18 = a2[82] - a2[83];
if ( v18 == 14 || ((v18 - 18) & 0xFFFFFFFD) == 0 )
return 400;
else
return (unsigned int)(20 * (v4 + 1));
}
else
{
if ( v5 <= 0 )
{
v10 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)(a2[82] - a2[83]));
CString = cocos2d::CCString::getCString(v10);
*(_OWORD *)v20 = 0;
v21 = 0;
v8 = -1;
v9 = -1;
do
++v9;
while ( CString[v9] );
}
else
{
v6 = cocos2d::CCString::createWithFormat((const char *)&word_1406ED6F8, (unsigned int)v5);
CString = cocos2d::CCString::getCString(v6);
*(_OWORD *)v20 = 0;
v21 = 0;
v8 = -1;
v9 = -1;
do
++v9;
while ( CString[v9] );
}
sub_14003D230(v20, CString, v9);
v11 = 784;
if ( v5 <= 0 )
v11 = 776;
v12 = *(_QWORD *)(v11 + a1);
v13 = v20;
if ( *((_QWORD *)&v21 + 1) > 0xFu )
v13 = (void **)v20[0];
*(_OWORD *)Block = 0;
v23 = 0;
do
++v8;
while ( *((_BYTE *)v13 + v8) );
sub_14003D230(Block, v13, v8);
v14 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v12, Block);
v15 = cocos2d::CCString::intValue(v14);
if ( *((_QWORD *)&v23 + 1) > 0xFu )
{
v16 = Block[0];
if ( (unsigned __int64)(*((_QWORD *)&v23 + 1) + 1LL) >= 0x1000 )
{
v16 = *((void **)Block[0] - 1);
if ( (unsigned __int64)((char *)Block[0] - (char *)v16 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v16);
}
if ( v15 > v4 )
v4 = v15;
if ( *((_QWORD *)&v21 + 1) > 0xFu )
{
v17 = v20[0];
if ( (unsigned __int64)(*((_QWORD *)&v21 + 1) + 1LL) >= 0x1000 )
{
v17 = *((void **)v20[0] - 1);
if ( (unsigned __int64)((char *)v20[0] - (char *)v17 - 8) > 0x1F )
invoke_watson(nullptr, nullptr, nullptr, 0, 0);
}
j_j_free(v17);
}
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;
}