//
// SecretRewardsLayer::onGoldChest from 0x100384e80 to 0x10038507c (508 bytes)
//
// 1 xrefs:
// > SecretRewardsLayer::init @ 0x10038415c
//
// This function is hookable on this platform (idp: arm, 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 11:03:32 +0000
//
void __fastcall SecretRewardsLayer::onGoldChest(_QWORD *a1)
{
int v2; // w0
__int64 Stat; // x0
int v4; // w20
__int64 v5; // x0
__int64 v6; // x0
__int64 v7; // x21
std::string *v9; // x0
const std::string::value_type *v10; // x1
int v11; // w10
int v12; // w9
int v13; // w19
__int64 v14; // x0
__int64 v15; // x0
__int64 v16; // x20
_QWORD *v17; // x21
__int64 v18; // x0
__int64 v19; // x20
int v20; // w0
int v21; // w0
void *v22; // x0
__int64 CString; // x0
char *v24; // x0
__int64 v25; // x19
void *__p[2]; // [xsp+10h] [xbp-70h] BYREF
__int64 v27; // [xsp+20h] [xbp-60h]
void *v28[2]; // [xsp+30h] [xbp-50h] BYREF
char v29; // [xsp+47h] [xbp-39h]
__int128 v30; // [xsp+48h] [xbp-38h] BYREF
__int64 v31; // [xsp+58h] [xbp-28h]
v2 = GameStatsManager::sharedState(a1);
Stat = GameStatsManager::getStat(v2, "43");
v4 = Stat;
v5 = GameStatsManager::sharedState(Stat);
v6 = sub_1003DCA04(v5);
v7 = v6;
if ( v4 < 1 || (_DWORD)v6 == 0 )
{
v9 = (std::string *)sub_100009900(&v30, "");
if ( (_DWORD)v7 )
v10 = "You need a Gold Key to unlock this chest.";
else
v10 = "All out of Gold Chests right now. Come back later.";
std::string::assign(v9, v10);
if ( v4 >= -9 )
v11 = 2;
else
v11 = 4;
if ( v4 >= -24 )
v12 = v11;
else
v12 = 17;
if ( v4 >= -49 )
v13 = v12;
else
v13 = 18;
sub_100009900(v28, "The Keymaster");
if ( SHIBYTE(v31) < 0 )
{
sub_1000097D0(__p, (void *)v30, *((unsigned __int64 *)&v30 + 1));
}
else
{
*(_OWORD *)__p = v30;
v27 = v31;
}
v24 = DialogObject::create((__int64)v28, (__int64)__p, v13, 0, 0xFFFFFF, 1.0);
v25 = DialogLayer::create((__int64)v24, 2);
if ( SHIBYTE(v27) < 0 )
operator delete(__p[0]);
if ( v29 < 0 )
operator delete(v28[0]);
DialogLayer::addToMainScene(v25);
DialogLayer::updateChatPlacement(v25, 0);
DialogLayer::animateInRandomSide(v25);
if ( SHIBYTE(v31) < 0 )
operator delete((void *)v30);
}
else
{
v14 = GameStatsManager::sharedState(v6);
v15 = sub_1003DCBB4(v14, v7);
if ( v15 )
{
v16 = v15;
v17 = RewardUnlockLayer::create(*(unsigned int *)(v15 + 64), 0);
(*(void (__fastcall **)(_QWORD *, _QWORD *, __int64))(*a1 + 464LL))(a1, v17, 100);
v18 = RewardUnlockLayer::showCollectReward((__int64)v17, v16);
v19 = a1[60];
v20 = GameStatsManager::sharedState(v18);
v21 = GameStatsManager::getStat(v20, "43");
v22 = sub_1003065B0("%i", v21);
CString = cocos2d::CCString::getCString((__int64)v22);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v19 + 928LL))(v19, CString);
sub_1003850CC(a1);
sub_100389BD0(a1);
}
}
}