//
// GameStatsManager::unlockGoldChest from 0x10033e15c to 0x10033e238 (220 bytes)
//
// 1 xrefs:
// > SecretRewardsLayer::onGoldChest @ 0x1002e9dc4
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
GJRewardItem *__fastcall GameStatsManager::unlockGoldChest(GameStatsManager *a1, int a2)
{
GJRewardItem *v4; // x19
int Stat; // w0
cocos2d::CCDictionary *m_treasureRoomChests; // x21
cocos2d::CCString *v7; // x0
char *CString; // x0
void *__p[2]; // [xsp+8h] [xbp-38h] BYREF
char v11; // [xsp+1Fh] [xbp-21h]
if ( GameStatsManager::isSecretChestUnlocked(a1, a2) )
return nullptr;
v4 = (GJRewardItem *)cocos2d::CCDictionary::objectForKey(a1->m_allTreasureRoomChests, a2);
if ( !v4 )
return v4;
Stat = GameStatsManager::getStat(a1, "43");
if ( Stat < 1 )
return nullptr;
GameStatsManager::setStat(a1, "43", Stat - 1);
GameStatsManager::preProcessReward(a1, v4);
GameStatsManager::registerRewardsFromItem(a1, v4);
m_treasureRoomChests = a1->m_treasureRoomChests;
v7 = (cocos2d::CCString *)sub_100268F4C("%i", a2);
CString = (char *)cocos2d::CCString::getCString(v7);
sub_100009900(__p, CString);
cocos2d::CCDictionary::setObject_1(m_treasureRoomChests, v4, __p);
if ( v11 < 0 )
operator delete(__p[0]);
return v4;
}