//
// GameStatsManager::registerRewardsFromItem from 0x1401f1500 to 0x1401f19e4 (1252 bytes)
//
// 6 xrefs:
// > GameStatsManager::completedDailyLevel @ 0x1401e3583
// > GameStatsManager::unlockSpecialChest @ 0x1401ea665
// > GameStatsManager::unlockSecretChest @ 0x1401eaa1e
// > RewardsPage::rewardsStatusFinished @ 0x1403cd62a
// > SecretRewardsLayer::onGoldChest @ 0x1403d7526
// > ??> @ 0x1406cc6b4
//
// 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=14
void GameStatsManager::registerRewardsFromItem(GameStatsManager *a1, GJRewardItem *a2)
{
bool m_skipIncrementChallenge; // r14
cocos2d::CCArray *m_rewardObjects; // rsi
unsigned int v5; // edi
struct cocos2d::CCObject *v6; // rbx
GameStatsManager *v7; // rcx
const char *v8; // rdx
void *v9; // [rsp+20h] [rbp-88h]
void *v10; // [rsp+28h] [rbp-80h]
void *v11; // [rsp+30h] [rbp-78h]
void *v12; // [rsp+38h] [rbp-70h]
void *v13; // [rsp+40h] [rbp-68h]
void *v14; // [rsp+48h] [rbp-60h]
void *v15; // [rsp+50h] [rbp-58h]
void *v16; // [rsp+58h] [rbp-50h]
void *v17; // [rsp+60h] [rbp-48h]
void *v18; // [rsp+68h] [rbp-40h]
void *v19; // [rsp+B0h] [rbp+8h]
void *v20; // [rsp+B8h] [rbp+10h]
void *v21; // [rsp+C0h] [rbp+18h]
void *v22; // [rsp+C8h] [rbp+20h]
m_skipIncrementChallenge = a1->m_skipIncrementChallenge;
a1->m_skipIncrementChallenge = 1;
m_rewardObjects = a2->m_rewardObjects;
if ( m_rewardObjects )
{
v5 = 0;
if ( cocos2d::CCArray::count(a2->m_rewardObjects) )
{
do
{
v6 = cocos2d::CCArray::objectAtIndex(m_rewardObjects, v5);
switch ( LODWORD(v6[1].__vftable) )
{
case 1:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v21 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = (const char *)&word_140544458;
goto LABEL_46;
case 2:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v22 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = (const char *)&word_14054445C;
goto LABEL_46;
case 3:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v9 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = (const char *)&word_140544450;
goto LABEL_46;
case 4:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v10 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = (const char *)&word_140544454;
goto LABEL_46;
case 5:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v11 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = (const char *)&word_140544448;
goto LABEL_46;
case 6:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v12 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = (const char *)&word_140543238;
goto LABEL_46;
case 7:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v19 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = "14";
goto LABEL_46;
case 8:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v20 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = "13";
goto LABEL_46;
case 0xA:
v7 = (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);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = (const char *)&word_14054444C;
goto LABEL_46;
case 0xB:
v7 = (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);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = "24";
goto LABEL_46;
case 0xC:
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;
}
v8 = "25";
goto LABEL_46;
case 0xD:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v17 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = "26";
goto LABEL_46;
case 0xE:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v18 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = "27";
goto LABEL_46;
case 0xF:
v7 = (GameStatsManager *)qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v13 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = (GameStatsManager *)qword_1406C2EE8;
}
v8 = "43";
LABEL_46:
GameStatsManager::incrementStat(v7, v8, v6[1].m_nLuaID);
break;
default:
break;
}
++v5;
}
while ( v5 < cocos2d::CCArray::count(m_rewardObjects) );
}
a1->m_skipIncrementChallenge = m_skipIncrementChallenge;
}
else
{
a1->m_skipIncrementChallenge = m_skipIncrementChallenge;
}
}