//
// CreatorLayer::onTreasureRoom from 0x1000b66c4 to 0x1000b6a04 (832 bytes)
//
// 1 xrefs:
// > CreatorLayer::init @ 0x1000b5aac
//
// 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; // x0
int Stat; // w20
GameManager *v5; // x0
_BOOL8 UGV; // x0
cocos2d::CCDirector *v7; // x19
cocos2d::CCScene *v8; // x0
cocos2d::CCTransitionFade *v9; // x0
cocos2d::CCArray *v10; // x20
char *v11; // x0
char *v12; // x0
char *v13; // x0
DialogLayer *v14; // x20
const char *v15; // x9
cocos2d::CCString *v16; // x0
const char *CString; // x0
char *v18; // x0
DialogLayer *v19; // x20
std::string __dst; // [xsp+10h] [xbp-100h] BYREF
void *v21[2]; // [xsp+30h] [xbp-E0h] BYREF
char v22; // [xsp+47h] [xbp-C9h]
std::string v23; // [xsp+48h] [xbp-C8h] BYREF
void *__p[2]; // [xsp+60h] [xbp-B0h] BYREF
char v25; // [xsp+77h] [xbp-99h]
void *v26[2]; // [xsp+78h] [xbp-98h] BYREF
char v27; // [xsp+8Fh] [xbp-81h]
void *v28[2]; // [xsp+90h] [xbp-80h] BYREF
char v29; // [xsp+A7h] [xbp-69h]
void *v30[2]; // [xsp+A8h] [xbp-68h] BYREF
char v31; // [xsp+BFh] [xbp-51h]
void *v32[2]; // [xsp+C0h] [xbp-50h] BYREF
char v33; // [xsp+D7h] [xbp-39h]
void *v34[2]; // [xsp+D8h] [xbp-38h] BYREF
char v35; // [xsp+EFh] [xbp-21h]
v3 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v3, "21");
v5 = GameManager::sharedState();
UGV = GameManager::getUGV(v5, "5");
if ( UGV )
{
v7 = cocos2d::CCDirector::sharedDirector();
v8 = SecretRewardsLayer::scene(0);
v9 = cocos2d::CCTransitionFade::create_1(0.5, v8);
cocos2d::CCDirector::replaceScene(v7, v9);
}
else if ( Stat < 5 )
{
sub_100009900(&v23, "Bring me 5 keys,\nand I will let you pass.");
if ( Stat >= 1 )
{
v15 = "s";
if ( Stat == 4 )
v15 = "";
v16 = (cocos2d::CCString *)sub_100268F4C(
"Collect %i more key%s,\nand I will let you pass.",
5 - Stat,
v15);
CString = cocos2d::CCString::getCString(v16);
std::string::assign(&v23, CString);
}
sub_100009900(v21, "The Keymaster");
if ( SHIBYTE(v23.__r_.__value_.__r.__words[2]) < 0 )
sub_1000097D0(&__dst, v23.__r_.__value_.__l.__data_, v23.__r_.__value_.__l.__size_);
else
__dst = v23;
v18 = DialogObject::create((__int64)v21, (__int64)&__dst, 2, 0, 0xFFFFFF, 1.0);
v19 = DialogLayer::create((DialogObject *)v18, 2);
if ( SHIBYTE(__dst.__r_.__value_.__r.__words[2]) < 0 )
operator delete(__dst.__r_.__value_.__l.__data_);
if ( v22 < 0 )
operator delete(v21[0]);
((void (__fastcall *)(CreatorLayer *, DialogLayer *, __int64))a1->addChild_0)(a1, v19, 100);
DialogLayer::updateChatPlacement(v19, Center);
DialogLayer::animateInRandomSide(v19);
if ( SHIBYTE(v23.__r_.__value_.__r.__words[2]) < 0 )
operator delete(v23.__r_.__value_.__l.__data_);
}
else
{
v10 = (cocos2d::CCArray *)sub_10024A15C(UGV);
sub_100009900(v34, "The Keymaster");
sub_100009900(v32, "Well, well, well.\nLook who it is.");
v11 = DialogObject::create((__int64)v34, (__int64)v32, 2, 0, 0xFFFFFF, 1.0);
sub_10024A2D0(v10, v11);
if ( v33 < 0 )
operator delete(v32[0]);
if ( v35 < 0 )
operator delete(v34[0]);
sub_100009900(v30, "The Keymaster");
sub_100009900(v28, "I see you have the keys.\nBut what comes next?");
v12 = DialogObject::create((__int64)v30, (__int64)v28, 2, 0, 0xFFFFFF, 1.0);
sub_10024A2D0(v10, v12);
if ( v29 < 0 )
operator delete(v28[0]);
if ( v31 < 0 )
operator delete(v30[0]);
sub_100009900(v26, "The Keymaster");
sub_100009900(__p, "The door is open.\nTime to find out...");
v13 = DialogObject::create((__int64)v26, (__int64)__p, 2, 0, 0xFFFFFF, 1.0);
sub_10024A2D0(v10, v13);
if ( v25 < 0 )
operator delete(__p[0]);
if ( v27 < 0 )
operator delete(v26[0]);
v14 = DialogLayer::createWithObjects(v10, 2);
v14->m_delegate = &a1->DialogDelegate;
((void (__fastcall *)(DialogLayer *, _QWORD))v14->setTag)(v14, 0);
((void (__fastcall *)(CreatorLayer *, DialogLayer *, __int64))a1->addChild_0)(a1, v14, 100);
DialogLayer::updateChatPlacement(v14, Center);
DialogLayer::animateIn(v14, FromLeft);
}
}