//
// SecretLayer5::claimOnlineReward from 0x10047d6e0 to 0x10047d8a0 (448 bytes)
//
// 1 xrefs:
// > SecretLayer5::showSuccessAnimation @ 0x10047cfef
//
// 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 SecretLayer5::claimOnlineReward(SecretLayer5 *a1)
{
__m128 v1; // xmm0
cocos2d::CCNode *m_inputBackground; // rbx
GameStatsManager *v3; // r14
std::string *p_m_chestID; // r15
bool isSpecialChestUnlocked; // r14
GameStatsManager *v6; // r14
__int64 v7; // r14
RewardUnlockLayer *v8; // r15
__int64 v9; // r12
int v10; // eax
cocos2d::CCDelayTime *v11; // r14
cocos2d::CCCallFunc *v12; // rax
cocos2d::CCAction *v13; // rax
__int128 v14; // [rsp+0h] [rbp-60h] BYREF
void *__p; // [rsp+10h] [rbp-50h]
__int128 v16; // [rsp+20h] [rbp-40h] BYREF
void *longStorage; // [rsp+30h] [rbp-30h]
m_inputBackground = a1;
v3 = GameStatsManager::sharedState();
p_m_chestID = &a1->m_chestID;
if ( (a1->m_chestID.m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v14, a1->m_chestID.m_data.m_long.longStorage, a1->m_chestID.m_data.m_long.size, *(double *)v1.i64);
}
else
{
__p = a1->m_chestID.m_data.m_long.longStorage;
v1 = *(__m128 *)&p_m_chestID->m_data.m_short.sizex2;
v14 = *(_OWORD *)&p_m_chestID->m_data.m_short.sizex2;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked((__int64)v3, (__int64)&v14, *(double *)v1.i64);
if ( (v14 & 1) != 0 )
operator delete(__p);
if ( isSpecialChestUnlocked )
goto LABEL_14;
v6 = GameStatsManager::sharedState();
if ( (p_m_chestID->m_data.m_short.sizex2 & 1) != 0 )
{
sub_100006B70(&v16, a1->m_chestID.m_data.m_long.longStorage, a1->m_chestID.m_data.m_long.size, *(double *)v1.i64);
}
else
{
longStorage = a1->m_chestID.m_data.m_long.longStorage;
v1 = *(__m128 *)&p_m_chestID->m_data.m_short.sizex2;
v16 = *(_OWORD *)&p_m_chestID->m_data.m_short.sizex2;
}
v7 = GameStatsManager::unlockOnlineChest((__int64)v6, (__int64)&v16, v1);
if ( (v16 & 1) != 0 )
operator delete(longStorage);
if ( !v7 )
{
LABEL_14:
a1->m_uiLocked = 0;
((void (__fastcall *)(CCTextInputNode *, __int64))a1->m_textInput->setTouchEnabled)(a1->m_textInput, 1);
((void (__fastcall *)(CCTextInputNode *, __int64))a1->m_textInput->setVisible)(a1->m_textInput, 1);
cocos2d::CCNode::stopAllActions(a1->m_inputBackground);
m_inputBackground = a1->m_inputBackground;
v13 = cocos2d::CCFadeTo::create(1.2, 0x64u);
}
else
{
v8 = RewardUnlockLayer::create(*(_DWORD *)(v7 + 64), nullptr);
v9 = ((__int64 (__fastcall *)(SecretLayer5 *))a1->getParent)(a1);
v10 = ((__int64 (__fastcall *)(SecretLayer5 *))a1->getZOrder)(a1);
(*(void (__fastcall **)(__int64, RewardUnlockLayer *, _QWORD))(*(_QWORD *)v9 + 448LL))(
v9,
v8,
(unsigned int)(v10 + 1));
RewardUnlockLayer::showCollectReward(v8, (GJRewardItem *)v7);
v11 = cocos2d::CCDelayTime::create(0.5);
v12 = cocos2d::CCCallFunc::create(a1, (cocos2d::SEL_CallFunc)(unsigned __int64)SecretLayer5::unlockUI);
v13 = sub_1003B5760(v11, v12, 0);
}
cocos2d::CCNode::runAction(m_inputBackground, v13);
}