//
// CreatorLayer::onTreasureRoom from 0x1002840c0 to 0x1002845b3 (1267 bytes)
//
// 1 xrefs:
// > CreatorLayer::init @ 0x100282dcd
//
// This function is hookable on this platform (idp: pc, 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:27:44 +0000
//
void __fastcall CreatorLayer::onTreasureRoom(__int64 a1, __m128 a2)
{
__int64 v3; // rdi
int Stat; // r14d
__int64 v5; // rdx
double v6; // xmm0_8
__int64 v7; // rax
__int64 v8; // rdi
__int64 v9; // rbx
__int64 v10; // rax
char *v11; // rax
__int64 v12; // r14
__int64 v13; // rax
__int64 v14; // rax
__int64 v15; // rax
_QWORD *v16; // r14
__int64 v17; // rax
const std::string::value_type *CString; // rax
__int64 v19; // rax
__int64 v20; // r14
char v21; // [rsp+0h] [rbp-100h]
_QWORD v22[2]; // [rsp+8h] [rbp-F8h] BYREF
void *__p; // [rsp+18h] [rbp-E8h]
_QWORD v24[2]; // [rsp+20h] [rbp-E0h] BYREF
void *v25; // [rsp+30h] [rbp-D0h]
_QWORD v26[2]; // [rsp+38h] [rbp-C8h] BYREF
void *v27; // [rsp+48h] [rbp-B8h]
__int128 v28; // [rsp+50h] [rbp-B0h] BYREF
void *data; // [rsp+60h] [rbp-A0h]
char v30; // [rsp+68h] [rbp-98h] BYREF
_BYTE v31[23]; // [rsp+69h] [rbp-97h] BYREF
char v32; // [rsp+80h] [rbp-80h] BYREF
_BYTE v33[23]; // [rsp+81h] [rbp-7Fh] BYREF
char v34; // [rsp+98h] [rbp-68h] BYREF
_BYTE v35[23]; // [rsp+99h] [rbp-67h] BYREF
std::string v36; // [rsp+B0h] [rbp-50h] BYREF
char v37; // [rsp+C8h] [rbp-38h] BYREF
void *v38[6]; // [rsp+C9h] [rbp-37h] BYREF
v3 = GameStatsManager::sharedState();
Stat = GameStatsManager::getStat(v3, "21", a2);
*(_QWORD *)&v6 = GameManager::sharedState(v3, "21", v5).u64[0];
v8 = v7;
if ( (unsigned __int8)GameManager::getUGV(v7, "5", v6) )
{
v9 = cocos2d::CCDirector::sharedDirector(v8, "5");
v10 = SecretRewardsLayer::scene(0);
v11 = cocos2d::CCTransitionFade::create_1(v10, 0.5);
cocos2d::CCDirector::replaceScene(v9, v11);
return;
}
if ( Stat >= 5 )
{
v12 = sub_1007FE900(v8);
v30 = 26;
strcpy(v31, "The Keymaster");
__p = operator new(0x28u);
v22[0] = 41;
v22[1] = 39;
strcpy((char *)__p, "Well, well, well.\nLook who it is.");
v13 = DialogObject::create(&v30, v22, 2, 0, 0xFFFFFF, 1.0);
sub_1007FEBF0(v12, v13);
if ( (v22[0] & 1) != 0 )
operator delete(__p);
if ( (v30 & 1) != 0 )
operator delete(*(void **)&v31[15]);
v32 = 26;
strcpy(v33, "The Keymaster");
v25 = operator new(0x40u);
v24[0] = 65;
v24[1] = 59;
strcpy((char *)v25, "I see you have the keys.\nBut what comes next?");
v14 = DialogObject::create(&v32, v24, 2, 0, 0xFFFFFF, 1.0);
sub_1007FEBF0(v12, v14);
if ( (v24[0] & 1) != 0 )
operator delete(v25);
if ( (v32 & 1) != 0 )
operator delete(*(void **)&v33[15]);
v34 = 26;
strcpy(v35, "The Keymaster");
v27 = operator new(0x48u);
v26[0] = 73;
v26[1] = 69;
strcpy((char *)v27, "The door is open.\nTime to find out...");
v15 = DialogObject::create(&v34, v26, 2, 0, 0xFFFFFF, 1.0);
sub_1007FEBF0(v12, v15);
if ( (v26[0] & 1) != 0 )
operator delete(v27);
if ( (v34 & 1) != 0 )
operator delete(*(void **)&v35[15]);
v16 = (_QWORD *)DialogLayer::createWithObjects(v12, 2);
v16[78] = a1 + 416;
(*(void (__fastcall **)(_QWORD *, _QWORD))(*v16 + 72LL))(v16, 0);
(*(void (__fastcall **)(__int64, _QWORD *, __int64))(*(_QWORD *)a1 + 464LL))(a1, v16, 100);
DialogLayer::updateChatPlacement(v16, 0);
DialogLayer::animateIn(v16, 2);
return;
}
v36.__r_.__value_.__r.__words[2] = (std::string::size_type)operator new(0x40u);
v36.__r_.__value_.__r.__words[0] = 65;
v36.__r_.__value_.__l.__size_ = 63;
strcpy(v36.__r_.__value_.__l.__data_, "Bring me 5 keys,\nand I will let you pass.");
if ( Stat <= 0 )
{
v37 = 26;
strcpy((char *)v38, "The Keymaster");
goto LABEL_21;
}
v17 = sub_10088E820("Collect %i more key%s,\nand I will let you pass.", v21);
CString = (const std::string::value_type *)cocos2d::CCString::getCString(v17);
std::string::assign(&v36, CString);
v37 = 26;
strcpy((char *)v38, "The Keymaster");
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
{
LABEL_21:
sub_10001AD30(&v28, v36.__r_.__value_.__l.__data_, v36.__r_.__value_.__l.__size_);
goto LABEL_22;
}
data = v36.__r_.__value_.__l.__data_;
v28 = *(_OWORD *)&v36.__r_.__value_.__l.0;
LABEL_22:
v19 = DialogObject::create(&v37, &v28, 2, 0, 0xFFFFFF, 1.0);
v20 = DialogLayer::create(v19, 2);
if ( (v28 & 1) != 0 )
operator delete(data);
if ( (v37 & 1) != 0 )
operator delete(*(void **)((char *)&v38[1] + 7));
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 464LL))(a1, v20, 100);
DialogLayer::updateChatPlacement(v20, 0);
DialogLayer::animateInRandomSide(v20);
if ( (*(_BYTE *)&v36.__r_.__value_.__s.0 & 1) != 0 )
operator delete(v36.__r_.__value_.__l.__data_);
}