//
// SecretLayer5::claimOnlineReward from 0xbc63cc to 0xbc65b8 (492 bytes)
//
// 3 xrefs:
// > ??> @ 0x6f580
// > SecretLayer5::showSuccessAnimation @ 0xbc458c
// > ??> @ 0x1542c60
//
// 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 13:03:32 +0000
//
__int64 __fastcall SecretLayer5::claimOnlineReward(SecretLayer5 *this)
{
char *v2; // x21
__int64 v3; // x23
char v4; // w0
__int64 v5; // x0
__int64 v6; // x1
_BOOL8 isSpecialChestUnlocked; // x0
_BOOL4 v8; // w23
GameStatsManager *v9; // x23
char v10; // w0
__int64 v11; // x0
__int64 v12; // x1
RewardsPage *v13; // x2
unsigned int *v14; // x21
RewardUnlockLayer *v15; // x22
__int64 v16; // x23
void (__fastcall *v17)(__int64, RewardUnlockLayer *, _QWORD); // x24
int v18; // w0
cocos2d::CCDelayTime *v19; // x0
cocos2d::CCSequence *v20; // x21
cocos2d::CCFiniteTimeAction *v21; // x0
cocos2d::CCAction *v22; // x0
__int64 v24; // [xsp+40h] [xbp+40h] BYREF
__int64 v25; // [xsp+48h] [xbp+48h]
void *v26; // [xsp+50h] [xbp+50h]
v2 = (char *)this + 520;
v3 = GameStatsManager::sharedState(_stack_chk_guard);
v4 = *((_BYTE *)this + 520);
v24 = 0;
v25 = 0;
v26 = nullptr;
if ( (v4 & 1) != 0 )
{
std::string::__init(&v24, *((void **)v2 + 2), *((_QWORD *)v2 + 1));
}
else
{
v5 = *(_QWORD *)v2;
v6 = *((_QWORD *)v2 + 1);
v26 = *((void **)v2 + 2);
v24 = v5;
v25 = v6;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v3, (char *)&v24);
v8 = isSpecialChestUnlocked;
if ( (v24 & 1) != 0 )
operator delete(v26);
if ( v8 )
goto LABEL_12;
v9 = (GameStatsManager *)GameStatsManager::sharedState((GameStatsManager *)isSpecialChestUnlocked);
v10 = *((_BYTE *)this + 520);
v24 = 0;
v25 = 0;
v26 = nullptr;
if ( (v10 & 1) != 0 )
{
std::string::__init(&v24, *((void **)v2 + 2), *((_QWORD *)v2 + 1));
}
else
{
v11 = *(_QWORD *)v2;
v12 = *((_QWORD *)v2 + 1);
v26 = *((void **)v2 + 2);
v24 = v11;
v25 = v12;
}
v14 = (unsigned int *)GameStatsManager::unlockOnlineChest(v9, (char *)&v24);
if ( (v24 & 1) != 0 )
operator delete(v26);
if ( !v14 )
{
LABEL_12:
SecretLayer5::unlockUI(this);
}
else
{
v15 = (RewardUnlockLayer *)RewardUnlockLayer::create((RewardUnlockLayer *)v14[16], nullptr, v13);
v16 = (*(__int64 (__fastcall **)(SecretLayer5 *))(*(_QWORD *)this + 512LL))(this);
v17 = *(void (__fastcall **)(__int64, RewardUnlockLayer *, _QWORD))(*(_QWORD *)v16 + 464LL);
v18 = (*(__int64 (__fastcall **)(SecretLayer5 *))(*(_QWORD *)this + 104LL))(this);
v17(v16, v15, (unsigned int)(v18 + 1));
v19 = (cocos2d::CCDelayTime *)RewardUnlockLayer::showCollectReward(v15, (GJRewardItem *)v14);
v20 = (cocos2d::CCSequence *)cocos2d::CCDelayTime::create(v19, 0.5);
v21 = (cocos2d::CCFiniteTimeAction *)cocos2d::CCCallFunc::create(this, SecretLayer5::unlockUI, 0);
v22 = (cocos2d::CCAction *)cocos2d::CCSequence::create(v20, v21, 0);
cocos2d::CCNode::runAction(this, v22);
}
return _stack_chk_guard;
}