//
// SecretLayer5::claimOnlineReward from 0x1000769a8 to 0x100076b34 (396 bytes)
//
// 1 xrefs:
// > SecretLayer5::showSuccessAnimation @ 0x100076380
//
// 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)
{
GameStatsManager *v2; // x20
std::string *p_m_chestID; // x21
char isSpecialChestUnlocked; // w0
char v5; // w20
GameStatsManager *v6; // x20
__int64 v7; // x0
__int64 v8; // x20
RewardUnlockLayer *v9; // x21
__int64 v10; // x22
int v11; // w0
cocos2d::CCDelayTime *v12; // x20
cocos2d::CCAction *v13; // x0
void *__dst[2]; // [xsp+10h] [xbp-60h] BYREF
char *v15; // [xsp+20h] [xbp-50h]
void *__p[2]; // [xsp+30h] [xbp-40h] BYREF
char *longStorage; // [xsp+40h] [xbp-30h]
cocos2d::SEL_CallFunc v18; // 0:x1.16
v2 = GameStatsManager::sharedState();
p_m_chestID = &a1->m_chestID;
if ( a1->m_chestID.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(__p, (void *)a1->m_chestID.m_data.m_long.capacitym1, a1->m_chestID.m_data.m_long.size);
}
else
{
*(_OWORD *)__p = *(_OWORD *)&p_m_chestID->m_data.m_short.sizex2;
longStorage = a1->m_chestID.m_data.m_long.longStorage;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v2, __p);
v5 = isSpecialChestUnlocked;
if ( SHIBYTE(longStorage) < 0 )
{
operator delete(__p[0]);
if ( (v5 & 1) != 0 )
goto LABEL_15;
}
else if ( (isSpecialChestUnlocked & 1) != 0 )
{
goto LABEL_15;
}
v6 = GameStatsManager::sharedState();
if ( a1->m_chestID.m_data.m_short.shortStorage.__elems_[22] < 0 )
{
sub_1000097D0(__dst, (void *)a1->m_chestID.m_data.m_long.capacitym1, a1->m_chestID.m_data.m_long.size);
}
else
{
*(_OWORD *)__dst = *(_OWORD *)&p_m_chestID->m_data.m_short.sizex2;
v15 = a1->m_chestID.m_data.m_long.longStorage;
}
v7 = GameStatsManager::unlockOnlineChest(v6, __dst);
v8 = v7;
if ( SHIBYTE(v15) < 0 )
{
operator delete(__dst[0]);
if ( v8 )
goto LABEL_13;
}
else if ( v7 )
{
LABEL_13:
v9 = RewardUnlockLayer::create(*(_DWORD *)(v8 + 64), nullptr);
v10 = ((__int64 (__fastcall *)(SecretLayer5 *))a1->getParent)(a1);
v11 = ((__int64 (__fastcall *)(SecretLayer5 *))a1->getZOrder)(a1);
(*(void (__fastcall **)(__int64, RewardUnlockLayer *, _QWORD))(*(_QWORD *)v10 + 448LL))(
v10,
v9,
(unsigned int)(v11 + 1));
RewardUnlockLayer::showCollectReward(v9, (GJRewardItem *)v8);
v12 = cocos2d::CCDelayTime::create(0.5);
v18.ptr = (void (*)(void))SecretLayer5::unlockUI;
v18.adj = 0;
cocos2d::CCCallFunc::create(a1, v18);
v13 = (cocos2d::CCAction *)sub_10018A494(v12);
cocos2d::CCNode::runAction(a1, v13);
return;
}
LABEL_15:
a1->m_uiLocked = 0;
SecretLayer5::showTextInput(a1);
}