//
// GameStatsManager::claimListReward from 0x7bb614 to 0x7bb7b4 (416 bytes)
//
// 2 xrefs:
// > LevelListLayer::onClaimReward @ 0xa73968
// > ??> @ 0x6a9f8
//
// 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
//
bool GameStatsManager::claimListReward(GameStatsManager *a1, GJLevelList *a2)
{
int v4; // w0
int m_diamonds; // w22
bool v6; // w19
cocos2d::CCDictionary *m_completedLists; // x26
cocos2d::CCObject *v9; // x25
void *v10; // x0
unsigned int *v11; // x2
int v12; // w1
__int64 v13; // [xsp+70h] [xbp+70h] BYREF
v4 = GJLevelList::completedLevels(a2);
m_diamonds = a2->m_diamonds;
v6 = v4 >= a2->m_levelsToClaim && a2->m_levelsToClaim > 0 && m_diamonds > 0;
if ( !v6 || GameStatsManager::hasClaimedListReward(a1, a2) )
return 0;
m_completedLists = a1->m_completedLists;
v9 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)(unsigned int)m_diamonds);
GameStatsManager::getListRewardKey(a1, a2, (__int64)&v13);
cocos2d::CCDictionary::setObject((int)m_completedLists, v9);
v10 = (void *)(v13 - 24);
if ( (__int64 *)(v13 - 24) != &qword_124B6B0 )
{
if ( &pthread_create )
{
v11 = (unsigned int *)(v13 - 8);
do
v12 = __ldaxr(v11);
while ( __stlxr(v12 - 1, v11) );
}
else
{
v12 = *(_DWORD *)(v13 - 8);
*(_DWORD *)(v13 - 8) = v12 - 1;
}
if ( v12 <= 0 )
operator delete(v10);
}
GameStatsManager::incrementStat(a1, "13", m_diamonds);
GameStatsManager::incrementStat(a1, "41");
return v6;
}