//
// GameStatsManager::completedDailyLevel from 0x8eb4e8 to 0x8eb924 (1084 bytes)
//
// 3 xrefs:
// > LevelBrowserLayer::claimRecallChest @ 0x7fc9b8
// > DailyLevelPage::claimLevelReward @ 0xa6eef0
// > ??> @ 0x84cd0
//
// 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 12:56:55 +0000
//
GJRewardItem *__fastcall GameStatsManager::completedDailyLevel(GameStatsManager *this, GJGameLevel *a2)
{
signed int v4; // w20
int v5; // w23
unsigned int BonusDiamonds; // w23
cocos2d::CCArray *v7; // x19
cocos2d::CCObject *v8; // x0
cocos2d::CCObject *v9; // x0
cocos2d::CCObject *v10; // x0
GJRewardItem *v11; // x0
GameStatsManager *RandomNonMaxShardType; // x0
int v13; // w24
GameStatsManager *v14; // x25
char *v15; // x1
int Stat; // w23
int v17; // w1
cocos2d::CCObject *v18; // x0
GJRewardItem *v19; // x19
__int64 v21; // x25
cocos2d::CCObject *v22; // x24
__int64 v23; // [xsp+60h] [xbp+60h] BYREF
size_t v24; // [xsp+68h] [xbp+68h]
void *v25; // [xsp+70h] [xbp+70h]
__int64 v26; // [xsp+78h] [xbp+78h] BYREF
size_t v27; // [xsp+80h] [xbp+80h]
void *v28; // [xsp+88h] [xbp+88h]
__int64 v29; // [xsp+90h] [xbp+90h] BYREF
size_t v30; // [xsp+98h] [xbp+98h]
char *v31; // [xsp+A0h] [xbp+A0h]
if ( !a2 )
return nullptr;
v4 = *((_DWORD *)a2 + 230) - *((_DWORD *)a2 + 231);
if ( v4 <= 0 )
return nullptr;
v5 = *((_DWORD *)a2 + 237) - *((_DWORD *)a2 + 238);
if ( v5 <= 0
|| GameStatsManager::hasCompletedDailyLevel(this, (const char *)(unsigned int)v4)
|| *((_DWORD *)a2 + 216) - *((_DWORD *)a2 + 217) <= 99 && !GameStatsManager::hasCompletedDailyStars(this, v4) )
{
return nullptr;
}
if ( v4 <= 100000 )
{
if ( GameStatsManager::isDailyRecall(this, (const char *)(unsigned int)v4) )
return nullptr;
BonusDiamonds = GameStatsManager::getBonusDiamonds(this, v5);
if ( v4 <= 99999 )
{
v21 = *((_QWORD *)this + 89);
v22 = (cocos2d::CCObject *)cocos2d::CCString::createWithFormat(
(cocos2d::CCString *)"%i",
(const char *)BonusDiamonds);
GameStatsManager::getDailyLevelKey((const char *)(unsigned int)v4, &v29);
cocos2d::CCDictionary::setObject(v21, v22);
if ( (v29 & 1) != 0 )
operator delete(v31);
GameStatsManager::incrementStat(this, "13", BonusDiamonds);
return nullptr;
}
}
else
{
BonusDiamonds = GameStatsManager::getBonusDiamonds(this, v5);
}
if ( v4 <= (int)&elf_hash_chain[17102] + 3 )
{
v7 = (cocos2d::CCArray *)cocos2d::CCArray::create((cocos2d::CCArray *)((char *)&elf_hash_chain[17102] + 3));
v8 = GJRewardObject::create(8, BonusDiamonds, 0);
cocos2d::CCArray::addObject(v7, v8);
v9 = GJRewardObject::create(7, 500, 0);
cocos2d::CCArray::addObject(v7, v9);
v10 = GJRewardObject::create(6, 1, 0);
v11 = (GJRewardItem *)cocos2d::CCArray::addObject(v7, v10);
RandomNonMaxShardType = (GameStatsManager *)GJRewardItem::getRandomNonMaxShardType(v11);
v13 = (int)RandomNonMaxShardType;
if ( (_DWORD)RandomNonMaxShardType )
{
v14 = (GameStatsManager *)GameStatsManager::sharedState(RandomNonMaxShardType);
GJRewardItem::rewardItemToStat(v13, &v29);
v15 = (char *)&v29 + 1;
if ( (v29 & 1) != 0 )
v15 = v31;
Stat = GameStatsManager::getStat(v14, v15);
if ( (v29 & 1) != 0 )
operator delete(v31);
if ( Stat > 98 )
v17 = 1;
else
v17 = 2;
v18 = GJRewardObject::create(v13, v17, 0);
cocos2d::CCArray::addObject(v7, v18);
}
v19 = (GJRewardItem *)GJRewardItem::createWithObjects((GJRewardItem *)((char *)&dword_0 + 3), v7);
if ( !v19 )
return nullptr;
GameStatsManager::getDailyLevelKey((const char *)(unsigned int)v4, &v29);
if ( !cocos2d::CCDictionary::objectForKey(*((_QWORD *)this + 92), &v29) )
{
GameStatsManager::registerRewardsFromItem(this, v19);
cocos2d::CCDictionary::setObject(*((_QWORD *)this + 92), v19);
}
if ( (v29 & 1) != 0 )
operator delete(v31);
return v19;
}
GameStatsManager::getDailyLevelKey((const char *)(unsigned int)v4, &v23);
v19 = (GJRewardItem *)cocos2d::CCDictionary::objectForKey(*((_QWORD *)this + 93), &v23);
if ( v19 )
{
v26 = 0;
v27 = 0;
v28 = nullptr;
if ( (v23 & 1) != 0 )
{
std::string::__init(&v26, v25, v24);
}
else
{
v28 = v25;
v26 = v23;
v27 = v24;
}
GameStatsManager::storeOnlineChest((__int64)this, (int)&v26, v19);
if ( (v26 & 1) != 0 )
operator delete(v28);
v29 = 0;
v30 = 0;
v31 = nullptr;
if ( (v23 & 1) != 0 )
{
std::string::__init(&v29, v25, v24);
}
else
{
v29 = v23;
v30 = v24;
v31 = (char *)v25;
}
v19 = GameStatsManager::unlockOnlineChest(this, (char *)&v29);
if ( (v29 & 1) != 0 )
operator delete(v31);
}
if ( (v23 & 1) == 0 )
return v19;
operator delete(v25);
return v19;
}