//
// LevelListLayer::onClaimReward from 0x1002460a0 to 0x1002462cc (556 bytes)
//
// 1 xrefs:
// > LevelListLayer::updateStatsArt @ 0x100245df8
//
// 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
//
void __fastcall LevelListLayer::onClaimReward(LevelListLayer *a1, cocos2d::CCObject *a2)
{
GJLevelList *m_levelList; // x0
int m_levelsToClaim; // w21
int v6; // w0
bool v7; // vf
int v8; // w21
char *v9; // x1
const char *v10; // x8
cocos2d::CCString *v11; // x0
char *CString; // x0
GameStatsManager *v13; // x0
FMODAudioEngine *v14; // x21
int m_diamonds; // w21
float v16; // s2
float v17; // s3
CurrencyRewardLayer *v18; // x0
char *v19; // x0
DialogLayer *v20; // x19
void *__p[2]; // [xsp+10h] [xbp-A0h] BYREF
__int64 v22; // [xsp+20h] [xbp-90h]
void *v23[2]; // [xsp+30h] [xbp-80h] BYREF
char v24; // [xsp+47h] [xbp-69h]
void *v25[2]; // [xsp+48h] [xbp-68h] BYREF
__int64 v26; // [xsp+58h] [xbp-58h]
void *v27[2]; // [xsp+60h] [xbp-50h] BYREF
char v28; // [xsp+77h] [xbp-39h]
void *v29[2]; // [xsp+78h] [xbp-38h] BYREF
char v30; // [xsp+8Fh] [xbp-21h]
cocos2d::CCPoint v31; // 0:s0.4,4:s1.4
m_levelList = a1->m_levelList;
m_levelsToClaim = m_levelList->m_levelsToClaim;
v6 = GJLevelList::completedLevels(m_levelList);
v7 = __OFSUB__(m_levelsToClaim, v6);
v8 = m_levelsToClaim - v6;
if ( (v8 < 0) ^ v7 | (v8 == 0) )
{
v13 = GameStatsManager::sharedState();
if ( GameStatsManager::claimListReward(v13, a1->m_levelList) )
{
v14 = FMODAudioEngine::sharedEngine();
sub_100009900(v29, "gold02.ogg");
FMODAudioEngine::playEffect_1((__int64)v14, (__int64)v29);
if ( v30 < 0 )
operator delete(v29[0]);
m_diamonds = a1->m_levelList->m_diamonds;
sub_1000229B8((__int64 *)v27, (__int64 *)&a1->m_rewardPosition);
v31.x = 0.0;
v31.y = 1.0;
v18 = CurrencyRewardLayer::create(0, 0, 0, m_diamonds, Icon, 0, Icon, 0, v31, (CurrencyRewardType)v27, v16, v17);
((void (__fastcall *)(LevelListLayer *, CurrencyRewardLayer *, __int64))a1->addChild_0)(a1, v18, 14);
}
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))a2->__vftable[13].copyWithZone)(a2, 0);
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))a2->__vftable[4].~CCObject)(a2, 0);
}
else
{
if ( v8 == 1 )
v9 = "level";
else
v9 = "levels";
sub_100009900(v27, v9);
if ( v28 >= 0 )
v10 = (const char *)v27;
else
v10 = (const char *)v27[0];
v11 = (cocos2d::CCString *)sub_100268F4C(
"Complete %i more %s from this list to claim the reward!",
v8,
v10);
CString = (char *)cocos2d::CCString::getCString(v11);
sub_100009900(v25, CString);
sub_100009900(v23, "The Mechanic");
if ( SHIBYTE(v26) < 0 )
{
sub_1000097D0(__p, v25[0], (unsigned __int64)v25[1]);
}
else
{
*(_OWORD *)__p = *(_OWORD *)v25;
v22 = v26;
}
v19 = DialogObject::create((__int64)v23, (__int64)__p, 37, 0, 0xFFFFFF, 1.0);
v20 = DialogLayer::create((DialogObject *)v19, 4);
if ( SHIBYTE(v22) < 0 )
operator delete(__p[0]);
if ( v24 < 0 )
operator delete(v23[0]);
DialogLayer::addToMainScene(v20);
DialogLayer::updateChatPlacement(v20, Center);
DialogLayer::animateIn(v20, FromCenter);
if ( SHIBYTE(v26) < 0 )
operator delete(v25[0]);
if ( v28 < 0 )
operator delete(v27[0]);
}
}