//
// CreatorLayer::onTreasureRoom from 0x100299170 to 0x100299663 (1267 bytes)
//
// 1 xrefs:
// > CreatorLayer::init @ 0x1002981ef
//
// 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
//
void __fastcall CreatorLayer::onTreasureRoom(CreatorLayer *a1, cocos2d::CCObject *a2)
{
GameStatsManager *v3; // rax
int Stat; // r14d
GameManager *v5; // rdi
cocos2d::CCDirector *v6; // rbx
cocos2d::CCScene *v7; // rax
cocos2d::CCTransitionFade *v8; // rax
cocos2d::CCArray *v9; // r14
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
DialogLayer *v13; // r14
cocos2d::CCString *v14; // rax
const char *CString; // rax
DialogObject *v16; // rax
DialogLayer *v17; // r14
char v18; // [rsp+0h] [rbp-100h]
_QWORD v19[2]; // [rsp+8h] [rbp-F8h] BYREF
void *__p; // [rsp+18h] [rbp-E8h]
_QWORD v21[2]; // [rsp+20h] [rbp-E0h] BYREF
void *v22; // [rsp+30h] [rbp-D0h]
_QWORD v23[2]; // [rsp+38h] [rbp-C8h] BYREF
void *v24; // [rsp+48h] [rbp-B8h]
__int128 v25; // [rsp+50h] [rbp-B0h] BYREF
void *data; // [rsp+60h] [rbp-A0h]
char v27; // [rsp+68h] [rbp-98h] BYREF
_BYTE v28[23]; // [rsp+69h] [rbp-97h] BYREF
char v29; // [rsp+80h] [rbp-80h] BYREF
_BYTE v30[23]; // [rsp+81h] [rbp-7Fh] BYREF
char v31; // [rsp+98h] [rbp-68h] BYREF
_BYTE v32[23]; // [rsp+99h] [rbp-67h] BYREF
std::string v33; // [rsp+B0h] [rbp-50h] BYREF
char v34; // [rsp+C8h] [rbp-38h] BYREF
void *v35[6]; // [rsp+C9h] [rbp-37h] BYREF
v3 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v3, "21");
v5 = GameManager::sharedState();
if ( GameManager::getUGV(v5, "5") )
{
v6 = cocos2d::CCDirector::sharedDirector();
v7 = SecretRewardsLayer::scene(0);
v8 = cocos2d::CCTransitionFade::create_1(0.5, v7);
cocos2d::CCDirector::replaceScene(v6, v8);
return;
}
if ( Stat >= 5 )
{
v9 = (cocos2d::CCArray *)sub_10071F9E0(v5, "5");
v27 = 26;
strcpy(v28, "The Keymaster");
__p = operator new(0x28u);
v19[0] = 41;
v19[1] = 39;
strcpy((char *)__p, "Well, well, well.\nLook who it is.");
v10 = DialogObject::create(&v27, v19, 2, 0, 0xFFFFFF, 1.0);
sub_10071FCD0(v9, v10);
if ( (v19[0] & 1) != 0 )
operator delete(__p);
if ( (v27 & 1) != 0 )
operator delete(*(void **)&v28[15]);
v29 = 26;
strcpy(v30, "The Keymaster");
v22 = operator new(0x40u);
v21[0] = 65;
v21[1] = 59;
strcpy((char *)v22, "I see you have the keys.\nBut what comes next?");
v11 = DialogObject::create(&v29, v21, 2, 0, 0xFFFFFF, 1.0);
sub_10071FCD0(v9, v11);
if ( (v21[0] & 1) != 0 )
operator delete(v22);
if ( (v29 & 1) != 0 )
operator delete(*(void **)&v30[15]);
v31 = 26;
strcpy(v32, "The Keymaster");
v24 = operator new(0x48u);
v23[0] = 73;
v23[1] = 69;
strcpy((char *)v24, "The door is open.\nTime to find out...");
v12 = DialogObject::create(&v31, v23, 2, 0, 0xFFFFFF, 1.0);
sub_10071FCD0(v9, v12);
if ( (v23[0] & 1) != 0 )
operator delete(v24);
if ( (v31 & 1) != 0 )
operator delete(*(void **)&v32[15]);
v13 = DialogLayer::createWithObjects(v9, 2);
v13->m_delegate = &a1->DialogDelegate;
((void (__fastcall *)(DialogLayer *, _QWORD))v13->setTag)(v13, 0);
((void (__fastcall *)(CreatorLayer *, DialogLayer *, __int64))a1->addChild_0)(a1, v13, 100);
DialogLayer::updateChatPlacement(v13, Center);
DialogLayer::animateIn(v13, FromLeft);
return;
}
v33.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v33.__r_.__value_.__r.__words[0] = 65;
v33.__r_.__value_.__l.__size_ = 63;
strcpy(v33.__r_.__value_.__l.__data_, "Bring me 5 keys,\nand I will let you pass.");
if ( Stat <= 0 )
{
v34 = 26;
strcpy((char *)v35, "The Keymaster");
goto LABEL_21;
}
v14 = (cocos2d::CCString *)sub_1007AB580(
"Collect %i more key%s,\nand I will let you pass.",
v18);
CString = cocos2d::CCString::getCString(v14);
std::string::assign(&v33, CString);
v34 = 26;
strcpy((char *)v35, "The Keymaster");
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_21:
sub_100006B70(&v25, v33.__r_.__value_.__l.__data_, v33.__r_.__value_.__l.__size_, 3.776912183122014e180);
goto LABEL_22;
}
data = v33.__r_.__value_.__l.__data_;
v25 = *(_OWORD *)&v33.__r_.__value_.__l.0;
LABEL_22:
v16 = (DialogObject *)DialogObject::create(&v34, &v25, 2, 0, 0xFFFFFF, 1.0);
v17 = DialogLayer::create(v16, 2);
if ( (v25 & 1) != 0 )
operator delete(data);
if ( (v34 & 1) != 0 )
operator delete(*(void **)((char *)&v35[1] + 7));
((void (__fastcall *)(CreatorLayer *, DialogLayer *, __int64))a1->addChild_0)(a1, v17, 100);
DialogLayer::updateChatPlacement(v17, Center);
DialogLayer::animateInRandomSide(v17);
if ( (*(_BYTE *)&v33.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v33.__r_.__value_.__l.__data_);
}