//
// GameStatsManager::createReward from 0x4132f4 to 0x4133c6 (210 bytes)
//
// 2 xrefs:
// > GameLevelManager::onGetGJSecretRewardCompleted @ 0x3c3766
// > GameLevelManager::onGetGJDailyLevelStateCompleted @ 0x3c4434
//
// 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
//
GJRewardItem *__fastcall GameStatsManager::createReward(int a1, GJRewardType a2, int a3, _DWORD *a4)
{
cocos2d::CCArray *v6; // r0
cocos2d::CCArray *v7; // r4
unsigned int i; // r9
const char **v9; // r11
SpecialRewardItem v10; // r10
int v11; // r1
GJRewardObject *ItemUnlock; // r0
GJRewardItem *v13; // r0
GJRewardItem *v14; // r4
const char **v16; // [sp+8h] [bp-14h] BYREF
int v17; // [sp+Ch] [bp-10h]
int v18; // [sp+10h] [bp-Ch]
v16 = nullptr;
v17 = 0;
v18 = 0;
v6 = (cocos2d::CCArray *)sub_41324C(a4, ",", (int)&v16);
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create(v6);
for ( i = 0; ; i += 2 )
{
v9 = v16;
if ( i >= ((v17 - (int)v16) >> 2) - 1 )
break;
v10 = atoi(v16[i]);
v11 = atoi(v9[i + 1]);
if ( v10 > 1000 )
{
ItemUnlock = GJRewardObject::createItemUnlock((UnlockType)(v10 - 1000), v11);
goto LABEL_8;
}
if ( (unsigned int)(v10 - 1) <= 0xE && v10 != CustomItem )
{
ItemUnlock = GJRewardObject::create(v10, v11, 0);
LABEL_8:
if ( ItemUnlock )
cocos2d::CCArray::addObject(v7, ItemUnlock);
continue;
}
}
v13 = (GJRewardItem *)cocos2d::CCArray::count(v7);
if ( v13 )
{
v13 = GJRewardItem::createWithObjects(a2, v7);
v13->m_chestID = a3;
}
v14 = v13;
std::vector::~vector((void **)&v16);
return v14;
}