//
// GameStatsManager::unlockGoldChest from 0x8eb3a0 to 0x8eb4e8 (328 bytes)
//
// 2 xrefs:
// > SecretRewardsLayer::onGoldChest @ 0xb9ea2c
// > ??> @ 0xc4408
//
// 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 12:56:55 +0000
//
GJRewardItem *__fastcall GameStatsManager::unlockGoldChest(GameStatsManager *this, const char *a2)
{
unsigned int v2; // w23
GJRewardItem *RewardForSecretChest; // x19
int Stat; // w0
__int64 v6; // x20
cocos2d::CCString *v7; // x0
size_t v8; // x0
char *CString; // [xsp+48h] [xbp+48h]
__int64 v11[2]; // [xsp+50h] [xbp+50h] BYREF
void *v12; // [xsp+60h] [xbp+60h]
v2 = (unsigned int)a2;
if ( GameStatsManager::isSecretChestUnlocked(this, a2) )
return nullptr;
RewardForSecretChest = (GJRewardItem *)GameStatsManager::getRewardForSecretChest((cocos2d::CCDictionary **)this, v2);
if ( !RewardForSecretChest )
return nullptr;
Stat = GameStatsManager::getStat(this, "43");
if ( Stat <= 0 )
return nullptr;
GameStatsManager::setStat(this, "43", (char *)(unsigned int)(Stat - 1));
GameStatsManager::preProcessReward(this, RewardForSecretChest);
GameStatsManager::registerRewardsFromItem(this, RewardForSecretChest);
v6 = *((_QWORD *)this + 95);
v7 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", (const char *)v2);
v11[0] = 0;
CString = (char *)cocos2d::CCString::getCString(v7);
v11[1] = 0;
v12 = nullptr;
v8 = strlen(CString);
std::string::__init(v11, CString, v8);
cocos2d::CCDictionary::setObject(v6, RewardForSecretChest);
if ( (v11[0] & 1) != 0 )
operator delete(v12);
return RewardForSecretChest;
}