//
// GameStatsManager::registerRewardsFromItem from 0x1402f60d0 to 0x1402f65dc (1292 bytes)
//
// 6 xrefs:
// > GameStatsManager::completedDailyLevel @ 0x1402e6df3
// > GameStatsManager::unlockSpecialChest @ 0x1402ee915
// > GameStatsManager::unlockSecretChest @ 0x1402eee2e
// > RewardsPage::rewardsStatusFinished @ 0x140562ec6
// > SecretRewardsLayer::onGoldChest @ 0x14056cfb9
// > ??> @ 0x14091e158
//
// This function is hookable on this platform (idp: pc, 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 11:30:04 +0000
//
// Hidden C++ exception states: #wind=14
void __fastcall GameStatsManager::registerRewardsFromItem(__int64 a1, __int64 a2)
{
char v3; // r14
cocos2d::CCArray *v4; // rsi
unsigned int v5; // edi
struct cocos2d::CCObject *v6; // rbx
__int64 v7; // rcx
__int16 *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]
v3 = *(_BYTE *)(a1 + 912);
*(_BYTE *)(a1 + 912) = 1;
v4 = *(cocos2d::CCArray **)(a2 + 72);
if ( v4 )
{
v5 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)(a2 + 72)) )
{
do
{
v6 = cocos2d::CCArray::objectAtIndex(v4, v5);
switch ( *((_DWORD *)v6 + 14) )
{
case 1:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v21 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_140737FE8;
goto LABEL_46;
case 2:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v22 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_140737FE4;
goto LABEL_46;
case 3:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v9 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v9);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_140737FF0;
goto LABEL_46;
case 4:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v10 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v10);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_140737FEC;
goto LABEL_46;
case 5:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v11 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v11);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_1407380D0;
goto LABEL_46;
case 6:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v12 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v12);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_140737620;
goto LABEL_46;
case 7:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v19 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_140737D98;
goto LABEL_46;
case 8:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v20 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = (__int16 *)"13";
goto LABEL_46;
case 0xA:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v14 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v14);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = (__int16 *)byte_1407380CC;
goto LABEL_46;
case 0xB:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v16 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v16);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = (__int16 *)byte_1407380D8;
goto LABEL_46;
case 0xC:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v15 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_1407380D4;
goto LABEL_46;
case 0xD:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v17 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v17);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = (__int16 *)byte_1407380E0;
goto LABEL_46;
case 0xE:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v18 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = (__int16 *)byte_1407380DC;
goto LABEL_46;
case 0xF:
v7 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v13 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v13);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v7 = qword_14090BFE0;
}
v8 = &word_1407380E4;
LABEL_46:
GameStatsManager::incrementStat(v7, (const char *)v8, *((_DWORD *)v6 + 17));
break;
default:
break;
}
++v5;
}
while ( v5 < cocos2d::CCArray::count(v4) );
}
*(_BYTE *)(a1 + 912) = v3;
}
else
{
*(_BYTE *)(a1 + 912) = v3;
}
}