//
// GameStatsManager::completedDailyLevel from 0x52ade8 to 0x52b004 (540 bytes)
//
// 2 xrefs:
// > LevelBrowserLayer::claimRecallChest @ 0x4a8ff6
// > DailyLevelPage::claimLevelReward @ 0x607c1e
//
// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!
//
// 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 11:52:00 +0000
//
cocos2d::CCObject *__fastcall GameStatsManager::completedDailyLevel(GameStatsManager *this, GJGameLevel *a2)
{
const char *v4; // r6
int v5; // r8
char *BonusDiamonds; // r0
int v8; // r8
cocos2d::CCArray *v9; // r5
cocos2d::CCObject *v10; // r0
cocos2d::CCObject *v11; // r0
cocos2d::CCObject *v12; // r0
GJRewardItem *v13; // r0
int v14; // r1
char *v15; // r2
int v16; // r3
GameStatsManager *RandomNonMaxShardType; // r0
int v18; // r2
int v19; // r3
int v20; // r9
cocos2d::CCObject *v21; // r5
int *v22; // r8
int v23; // r10
cocos2d::CCObject *v24; // r9
GameStatsManager *v25; // r10
const char *v26; // r1
int Stat; // r10
int v28; // r1
cocos2d::CCObject *v29; // r0
_BYTE v30[12]; // [sp+0h] [bp-28h] BYREF
int v31[3]; // [sp+Ch] [bp-1Ch] BYREF
int v32[3]; // [sp+18h] [bp-10h] BYREF
if ( !a2 )
return nullptr;
v4 = (const char *)(*((_DWORD *)a2 + 186) - *((_DWORD *)a2 + 187));
if ( (int)v4 <= 0 )
return nullptr;
v5 = *((_DWORD *)a2 + 193) - *((_DWORD *)a2 + 194);
if ( v5 <= 0
|| GameStatsManager::hasCompletedDailyLevel(this, v4)
|| *((_DWORD *)a2 + 172) - *((_DWORD *)a2 + 173) <= 99 && !GameStatsManager::hasCompletedDailyStars(this, (int)v4) )
{
return nullptr;
}
if ( (int)v4 <= 100000 && GameStatsManager::isDailyRecall(this, v4) )
return nullptr;
BonusDiamonds = (char *)GameStatsManager::getBonusDiamonds(this, v5);
v8 = (int)BonusDiamonds;
if ( (int)v4 <= 99999 )
{
v23 = *((_DWORD *)this + 116);
v24 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", BonusDiamonds);
GameStatsManager::getDailyLevelKey((GameStatsManager *)v32, (int)this, v4);
cocos2d::CCDictionary::setObject(v23, v24);
std::string::~string((int)v32);
GameStatsManager::incrementStat(this, "13", v8);
return nullptr;
}
if ( (int)v4 > 199999 )
{
v22 = (int *)v30;
GameStatsManager::getDailyLevelKey((GameStatsManager *)v30, (int)this, v4);
v21 = (cocos2d::CCObject *)cocos2d::CCDictionary::objectForKey(*((_DWORD *)this + 120), v30);
if ( v21 )
{
std::string::basic_string(v31, (int)v30);
GameStatsManager::storeOnlineChest((int)this, (int)v31, v21);
std::string::~string((int)v31);
std::string::basic_string(v32, (int)v30);
v21 = GameStatsManager::unlockOnlineChest((int *)this, (int)v32);
std::string::~string((int)v32);
}
goto LABEL_16;
}
v9 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)BonusDiamonds);
v10 = GJRewardObject::create(8, v8, 0);
cocos2d::CCArray::addObject(v9, v10);
v11 = GJRewardObject::create(7, 500, 0);
cocos2d::CCArray::addObject(v9, v11);
v12 = GJRewardObject::create(6, 1, 0);
v13 = (GJRewardItem *)cocos2d::CCArray::addObject(v9, v12);
RandomNonMaxShardType = (GameStatsManager *)GJRewardItem::getRandomNonMaxShardType(v13, v14, v15, v16);
v20 = (int)RandomNonMaxShardType;
if ( RandomNonMaxShardType )
{
v25 = (GameStatsManager *)GameStatsManager::sharedState(RandomNonMaxShardType);
GJRewardItem::rewardItemToStat(v32, v20);
if ( (v32[0] & 1) != 0 )
v26 = (const char *)v32[2];
else
v26 = (char *)v32 + 1;
Stat = GameStatsManager::getStat(v25, v26);
std::string::~string((int)v32);
if ( Stat <= 98 )
v28 = 2;
else
v28 = 1;
v29 = GJRewardObject::create(v20, v28, 0);
cocos2d::CCArray::addObject(v9, v29);
}
v21 = GJRewardItem::createWithObjects((GJRewardItem *)((char *)&dword_0 + 3), v9, v18, v19);
if ( !v21 )
return nullptr;
v22 = v32;
GameStatsManager::getDailyLevelKey((GameStatsManager *)v32, (int)this, v4);
if ( !cocos2d::CCDictionary::objectForKey(*((_DWORD *)this + 119), v32) )
{
GameStatsManager::registerRewardsFromItem((unsigned int)this, v21);
cocos2d::CCDictionary::setObject(*((_DWORD *)this + 119), v21);
}
LABEL_16:
std::string::~string((int)v22);
return v21;
}