//
// LevelListLayer::onClaimReward from 0xbabf28 to 0xbac2a8 (896 bytes)
//
// 3 xrefs:
// > ??> @ 0x67900
// > LevelListLayer::updateStatsArt @ 0xbabbfc
// > ??> @ 0x1542848
//
// This function is hookable on this platform (idp: arm, 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 13:02:52 +0000
//
__int64 __fastcall LevelListLayer::onClaimReward(LevelListLayer *this, cocos2d::CCObject *a2)
{
unsigned __int64 v4; // x0
int v5; // w20
GameStatsManager *v6; // x0
int v7; // w20
const char *v8; // x1
size_t v9; // x0
char *v10; // x2
cocos2d::CCString *v11; // x0
size_t v12; // x0
DialogLayer *v13; // x0
DialogLayer *v14; // x19
GameStatsManager *v16; // x0
_BOOL8 v17; // x0
__int64 v18; // x23
__int64 v19; // x0
char *v20; // [xsp+58h] [xbp+48h]
char *CString; // [xsp+58h] [xbp+48h]
int v22; // [xsp+58h] [xbp+48h]
_BYTE v23[8]; // [xsp+60h] [xbp+50h] BYREF
__int64 v24[2]; // [xsp+68h] [xbp+58h] BYREF
void *v25; // [xsp+78h] [xbp+68h]
__int64 v26; // [xsp+80h] [xbp+70h] BYREF
size_t v27; // [xsp+88h] [xbp+78h]
void *v28; // [xsp+90h] [xbp+80h]
__int64 v29[2]; // [xsp+98h] [xbp+88h] BYREF
void *v30; // [xsp+A8h] [xbp+98h]
__int64 v31; // [xsp+B0h] [xbp+A0h] BYREF
size_t v32; // [xsp+B8h] [xbp+A8h]
void *v33; // [xsp+C0h] [xbp+B0h]
v4 = *((_QWORD *)this + 114);
v5 = *(_DWORD *)(v4 + 388);
v6 = (GameStatsManager *)GJLevelList::completedLevels(v4);
v7 = v5 - (_DWORD)v6;
if ( v7 <= 0 )
{
v16 = (GameStatsManager *)GameStatsManager::sharedState(v6);
v17 = GameStatsManager::claimListReward(v16, *((GJLevelList **)this + 114));
if ( v17 )
{
v18 = FMODAudioEngine::sharedEngine((FMODAudioEngine *)v17);
v31 = 0;
v32 = 0;
v33 = nullptr;
std::string::__init(&v31, "gold02.ogg", 0xAu);
FMODAudioEngine::playEffect(v18, (char *)&v31);
if ( (v31 & 1) != 0 )
operator delete(v33);
v22 = *(_DWORD *)(*((_QWORD *)this + 114) + 384LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v23, (LevelListLayer *)((char *)this + 1000));
v19 = CurrencyRewardLayer::create(0, 0, 0, v22, 0, 0, 0, 0, 0.0, 1.0, (const cocos2d::CCPoint *)v23, 0);
(*(void (__fastcall **)(LevelListLayer *, __int64, __int64))(*(_QWORD *)this + 464LL))(this, v19, 14);
}
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)a2 + 1056LL))(a2, 0);
(*(void (__fastcall **)(cocos2d::CCObject *, _QWORD))(*(_QWORD *)a2 + 344LL))(a2, 0);
}
else
{
if ( v7 == 1 )
v8 = "level";
else
v8 = "levels";
v20 = (char *)v8;
v24[0] = 0;
v24[1] = 0;
v25 = nullptr;
v9 = strlen(v8);
std::string::__init(v24, v20, v9);
v10 = (char *)v24 + 1;
if ( (v24[0] & 1) != 0 )
v10 = (char *)v25;
v11 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"Complete %i more %s from this list to clai"
"m the reward!",
(const char *)(unsigned int)v7,
v10);
CString = (char *)cocos2d::CCString::getCString(v11);
v26 = 0;
v27 = 0;
v28 = nullptr;
v12 = strlen(CString);
std::string::__init(&v26, CString, v12);
v29[0] = 0;
v29[1] = 0;
v30 = nullptr;
std::string::__init(v29, "The Mechanic", 0xCu);
v31 = 0;
v32 = 0;
v33 = nullptr;
if ( (v26 & 1) != 0 )
{
std::string::__init(&v31, v28, v27);
}
else
{
v31 = v26;
v32 = v27;
v33 = v28;
}
v13 = (DialogLayer *)DialogObject::create((char *)v29, (char *)&v31, 37, 0, 0xFFFFFF, 1.0);
v14 = (DialogLayer *)DialogLayer::create(v13, (DialogObject *)byte_4);
if ( (v31 & 1) != 0 )
operator delete(v33);
if ( (v29[0] & 1) != 0 )
operator delete(v30);
DialogLayer::addToMainScene(v14);
DialogLayer::updateChatPlacement((__int64)v14, 0);
DialogLayer::animateIn(v14, 1u);
if ( (v26 & 1) != 0 )
operator delete(v28);
if ( (v24[0] & 1) != 0 )
operator delete(v25);
}
return _stack_chk_guard;
}