//
// GJRewardItem::init from 0x7a6b1c to 0x7a6cc0 (420 bytes)
//
// 2 xrefs:
// > GJRewardItem::create @ 0x7a6d48
// > ??> @ 0x40050
//
// 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
//
__int64 __fastcall GJRewardItem::init(__int64 a1, int a2, int a3, __int64 *a4)
{
__int64 v4; // x4
__int64 v5; // x1
cocos2d::CCArray *v8; // x20
int v9; // w25
cocos2d::CCString *v10; // x0
int v11; // w24
cocos2d::CCString *v12; // x0
int v13; // w23
cocos2d::CCString *v14; // x0
SpecialRewardItem v15; // w22
cocos2d::CCString *v16; // x0
cocos2d::CCArray *v17; // x0
SpecialRewardItem v18; // w21
cocos2d::CCArray *v19; // x20
GJRewardObject *v20; // x0
GJRewardObject *v21; // x0
cocos2d::CCObject *v22; // x0
GJRewardObject *v23; // x0
GJRewardObject *v24; // x0
v4 = *a4;
*(_DWORD *)(a1 + 56) = a2;
v5 = *(_QWORD *)(v4 - 24);
*(_DWORD *)(a1 + 60) = a3;
if ( v5 )
{
v8 = sub_7A19E8(a4, &byte_F804F8);
if ( (unsigned int)cocos2d::CCArray::count(v8) > 3 )
{
v9 = 1;
v10 = cocos2d::CCArray::stringAtIndex(v8, 0);
v11 = cocos2d::CCString::intValue(v10);
v12 = cocos2d::CCArray::stringAtIndex(v8, 1u);
v13 = cocos2d::CCString::intValue(v12);
v14 = cocos2d::CCArray::stringAtIndex(v8, 2u);
v15 = cocos2d::CCString::intValue(v14);
v16 = cocos2d::CCArray::stringAtIndex(v8, 3u);
v17 = (cocos2d::CCArray *)cocos2d::CCString::intValue(v16);
v18 = (int)v17;
if ( v15 == (_DWORD)v17 )
{
v9 = 2;
v18 = 0;
}
v19 = (cocos2d::CCArray *)cocos2d::CCArray::create(v17);
if ( v11 > 0 )
{
v20 = GJRewardObject::create(BonusKey|FireShard, v11, 0);
cocos2d::CCArray::addObject(v19, v20);
}
if ( v13 > 0 )
{
v21 = GJRewardObject::create(Diamonds, v13, 0);
cocos2d::CCArray::addObject(v19, v21);
}
if ( v15 )
{
v23 = GJRewardObject::create(v15, v9, 0);
cocos2d::CCArray::addObject(v19, v23);
}
if ( v18 )
{
v24 = GJRewardObject::create(v18, 1, 0);
cocos2d::CCArray::addObject(v19, v24);
}
if ( (unsigned int)cocos2d::CCArray::count(v19) )
{
v22 = *(cocos2d::CCObject **)(a1 + 72);
if ( v22 != v19 )
{
if ( v19 )
{
cocos2d::CCObject::retain(v19);
v22 = *(cocos2d::CCObject **)(a1 + 72);
}
if ( v22 )
cocos2d::CCObject::release(v22);
*(_QWORD *)(a1 + 72) = v19;
}
}
}
}
return 1;
}