//
// GameStatsManager::getAwardedCurrencyForLevel from 0x517d20 to 0x517e4e (302 bytes)
//
// 2 xrefs:
// > GameStatsManager::getAwardedCurrencyForLevel @ 0x517e6a
// > GameStatsManager::orbInfoForLevel @ 0x517e9a
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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:51:43 +0000
//
int __fastcall GameStatsManager::getAwardedCurrencyForLevel(GameStatsManager *this, GJGameLevel *a2, const char *a3)
{
int v5; // r0
int v6; // r3
const char *v7; // r1
int v8; // r6
cocos2d::CCString *v9; // r0
char *CString; // r10
size_t v11; // r0
size_t v12; // r0
cocos2d::CCString *v13; // r0
int v14; // r6
int BaseCurrencyForLevel; // r0
float v16; // s15
int v17; // r4
int v19[2]; // [sp+4h] [bp-1Ch] BYREF
char *v20; // [sp+Ch] [bp-14h]
int v21[3]; // [sp+10h] [bp-10h] BYREF
v5 = *((_DWORD *)a2 + 238);
v6 = *((unsigned __int8 *)a2 + 477);
v7 = a3;
if ( (int)a3 <= 0 )
{
if ( v5 == 1 )
{
v8 = *((_DWORD *)this + 108);
}
else if ( v6 )
{
v8 = *((_DWORD *)this + 109);
}
else
{
v8 = *((_DWORD *)this + 107);
}
v7 = (const char *)(*((_DWORD *)a2 + 67) - *((_DWORD *)a2 + 68));
}
else
{
v8 = *((_DWORD *)this + 110);
}
v9 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", v7);
v19[0] = 0;
v19[1] = 0;
v20 = nullptr;
CString = (char *)cocos2d::CCString::getCString(v9);
v11 = strlen(CString);
std::string::__init(v19, CString, v11);
v21[0] = 0;
v21[1] = 0;
if ( (v19[0] & 1) == 0 )
CString = (char *)v19 + 1;
v21[2] = 0;
if ( (v19[0] & 1) != 0 )
CString = v20;
v12 = strlen(CString);
std::string::__init(v21, CString, v12);
v13 = (cocos2d::CCString *)cocos2d::CCDictionary::valueForKey(v8, v21);
v14 = cocos2d::CCString::intValue(v13);
std::string::~string((int)v21);
BaseCurrencyForLevel = GameStatsManager::getBaseCurrencyForLevel(this, a2);
v16 = (float)BaseCurrencyForLevel;
if ( v14 > 99 )
v17 = (int)(float)(v16 * 0.25) + BaseCurrencyForLevel;
else
v17 = (int)floorf(v16 * (float)((float)v14 / 100.0));
std::string::~string((int)v19);
return v17;
}