//
// GameStatsManager::unlockSecretChest from 0x1003dca54 to 0x1003dcb98 (324 bytes)
//
// 1 xrefs:
// > SecretRewardsLayer::onSelectItem @ 0x100386670
//
// This function is hookable on this platform (idp: arm, 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:04:19 +0000
//
__int64 __fastcall GameStatsManager::unlockSecretChest(__int64 a1, int a2)
{
__int64 v4; // x0
__int64 v5; // x19
int Stat; // w0
int v7; // w8
int v8; // w8
__int64 v10; // x21
void *v11; // x0
char *CString; // x0
void *__p[2]; // [xsp+8h] [xbp-38h] BYREF
char v14; // [xsp+1Fh] [xbp-21h]
if ( sub_1003D455C(a1, a2) )
return 0;
cocos2d::CCDictionary::objectForKey_1(*(_QWORD *)(a1 + 344), a2);
v5 = v4;
if ( v4 )
{
Stat = GameStatsManager::getStat(a1, "21");
v7 = *(_DWORD *)(v5 + 56);
if ( v7 <= 6000 )
{
if ( v7 <= 5000 )
{
if ( v7 <= 4000 )
{
if ( v7 <= 3000 )
{
if ( v7 <= 2000 )
{
if ( v7 <= 1000 )
v8 = 1;
else
v8 = 5;
}
else
{
v8 = 10;
}
}
else
{
v8 = 25;
}
}
else
{
v8 = 50;
}
}
else
{
v8 = 100;
}
}
else
{
v8 = 1;
}
if ( Stat < v8 )
return 0;
GameStatsManager::setStat(a1, "21", Stat - v8);
sub_1003D1760(a1, v5);
GameStatsManager::registerRewardsFromItem(a1, v5);
v10 = *(_QWORD *)(a1 + 760);
v11 = sub_1003065B0("%i", a2);
CString = (char *)cocos2d::CCString::getCString((__int64)v11);
sub_100009900(__p, CString);
cocos2d::CCDictionary::setObject(v10, v5, __p);
if ( v14 < 0 )
operator delete(__p[0]);
}
return v5;
}