//
// GameStatsManager::unlockGoldChest from 0x52ad28 to 0x52adda (178 bytes)
//
// 1 xrefs:
// > SecretRewardsLayer::onGoldChest @ 0x6cdcce
//
// 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:52:00 +0000
//
GJRewardItem *__fastcall GameStatsManager::unlockGoldChest(GameStatsManager *this, const char *a2)
{
GJRewardItem *RewardForSecretChest; // r4
int Stat; // r0
int v7; // r9
cocos2d::CCString *v8; // r0
const char *CString; // r8
size_t v10; // r0
int v11[3]; // [sp+0h] [bp-14h] BYREF
if ( GameStatsManager::isSecretChestUnlocked(this, a2) )
return nullptr;
RewardForSecretChest = (GJRewardItem *)GameStatsManager::getRewardForSecretChest(
(cocos2d::CCDictionary **)this,
(int)a2);
if ( !RewardForSecretChest )
return nullptr;
Stat = GameStatsManager::getStat(this, "43");
if ( Stat <= 0 )
return nullptr;
GameStatsManager::setStat(this, "43", (const char *)(Stat - 1));
GameStatsManager::preProcessReward(this, RewardForSecretChest);
GameStatsManager::registerRewardsFromItem((unsigned int)this, RewardForSecretChest);
v7 = *((_DWORD *)this + 122);
v8 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", a2);
memset(v11, 0, sizeof(v11));
CString = (const char *)cocos2d::CCString::getCString(v8);
v10 = strlen(CString);
std::string::__init(v11, CString, v10);
cocos2d::CCDictionary::setObject(v7, RewardForSecretChest);
std::string::~string((int)v11);
return RewardForSecretChest;
}