//
// RewardsPage::rewardsStatusFinished from 0x1403cd490 to 0x1403cd6d9 (585 bytes)
//
// 2 xrefs:
// > ??> @ 0x1405cd4d0
// > ??> @ 0x1406d7bbc
//
// 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
//
// Hidden C++ exception states: #wind=5
void RewardsPage::rewardsStatusFinished(RewardsPage *a1, int a2)
{
__int64 v2; // rsi
__int64 v4; // rcx
struct cocos2d::CCObject *v5; // rbx
GameStatsManager *v6; // rcx
GameStatsManager *v7; // rcx
GameStatsManager *v8; // rdi
__int64 v9; // rcx
_QWORD *ItemKey; // rax
__int64 v11; // rdx
__int64 v12; // rdx
void *v13; // [rsp+20h] [rbp-48h]
void *v14; // [rsp+20h] [rbp-48h]
void *v15; // [rsp+20h] [rbp-48h]
void *v16; // [rsp+20h] [rbp-48h]
_QWORD v17[4]; // [rsp+28h] [rbp-40h] BYREF
v2 = a2;
if ( *(_QWORD *)&a1->m_uOrderOfArrival && (unsigned int)(a2 - 1) <= 1 )
{
v4 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v13 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v4 = qword_1406C2EE8;
}
v5 = cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(v4 + 528), v2);
if ( v5 )
{
v6 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v14 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v6 = (GameStatsManager *)qword_1406C2EE8;
}
if ( !GameStatsManager::hasRewardBeenCollected(v6, (GJRewardType)v2, (int)v5[1].__vftable)
&& v5[1].m_uID == *(_DWORD *)(*(_QWORD *)&a1->m_uOrderOfArrival + 664LL) )
{
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v15 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
GameStatsManager::preProcessReward(v7, (GJRewardItem *)v5);
if ( RewardUnlockLayer::showCollectReward(*(RewardUnlockLayer **)&a1->m_uOrderOfArrival, (GJRewardItem *)v5) )
{
v8 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v16 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v8 = (GameStatsManager *)qword_1406C2EE8;
}
if ( !GameStatsManager::hasRewardBeenCollected(v8, (GJRewardType)v2, (int)v5[1].__vftable) )
{
GameStatsManager::registerRewardsFromItem(v8, (GJRewardItem *)v5);
ItemKey = GameStatsManager::getItemKey(v9, v17, v2, (unsigned int)v5[1].__vftable);
cocos2d::CCDictionary::setObject(v8->m_dailyChests, v5, ItemKey);
sub_14003A830((__int64)v17);
}
}
}
}
}
RewardsPage::updateTimers((RewardsPage *)((char *)a1 - 640), 0.0);
LOBYTE(v11) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)&a1->m_uID + 320LL))(*(_QWORD *)&a1->m_uID, v11);
LOBYTE(v12) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**(_QWORD **)&a1->m_nTag + 320LL))(*(_QWORD *)&a1->m_nTag, v12);
cocos2d::CCNode::unschedule(&a1[-1].m_fRotationX, RewardsPage::updateTimers);
cocos2d::CCNode::schedule(&a1[-1].m_fRotationX, RewardsPage::updateTimers);
}