//
// DailyLevelPage::claimLevelReward from 0x140172590 to 0x14017286d (733 bytes)
//
// 2 xrefs:
// > DailyLevelNode::onClaimReward @ 0x140173948
// > ??> @ 0x14091838c
//
// This function is hookable on this platform (idp: pc, 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 11:27:31 +0000
//
// Hidden C++ exception states: #wind=3
char *__fastcall DailyLevelPage::claimLevelReward(
_DWORD *a1,
cocos2d::CCNode *a2,
_DWORD *a3,
const struct cocos2d::CCPoint *a4)
{
__int64 v8; // rcx
__int64 v9; // rax
__int64 v10; // rbp
int v11; // edi
__int64 v12; // rsi
cocos2d::CCObject *v13; // rcx
int v14; // esi
int v15; // esi
const struct cocos2d::CCPoint *v16; // rax
char *v17; // rax
_DWORD *v18; // rdx
int v19; // ecx
int v20; // ecx
void *v22; // [rsp+A0h] [rbp+8h] BYREF
v8 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v22 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v8 = qword_14090BFE0;
}
v9 = GameStatsManager::completedDailyLevel(v8, a3);
v10 = v9;
v11 = 0;
if ( v9 )
{
v12 = RewardUnlockLayer::create(*(unsigned int *)(v9 + 64), 0);
(*(void (__fastcall **)(_DWORD *, __int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v12, 100);
v13 = *(cocos2d::CCObject **)(v12 + 704);
if ( v13 )
cocos2d::CCObject::release(v13);
*(_QWORD *)(v12 + 704) = v10;
cocos2d::CCObject::retain((cocos2d::CCObject *)v10);
if ( !*(_BYTE *)(v10 + 80) || *(_DWORD *)(v10 + 64) == *(_DWORD *)(v12 + 696) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v12 + 720) + 336LL))(*(_QWORD *)(v12 + 720), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v12 + 720) + 936LL))(*(_QWORD *)(v12 + 720), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v12 + 712) + 336LL))(*(_QWORD *)(v12 + 712), 0);
*(_BYTE *)(v12 + 700) = 1;
if ( *(_BYTE *)(v12 + 701) )
RewardUnlockLayer::playRewardEffect(v12);
}
}
else
{
v14 = a3[255] - a3[256];
if ( !qword_14090BFE0 )
{
v22 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
}
if ( (unsigned int)(v14 - 2) > 8 )
{
v15 = 0;
}
else if ( v14 == 10 )
{
v15 = 20;
}
else
{
v15 = (int)floorf((float)(v14 + 2) * 0.5);
}
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v22, a4);
v17 = CurrencyRewardLayer::create(0, 0, 0, v15, 0, 0, 0, 0, v16, 0, 0, 1065353216);
(*(void (__fastcall **)(_DWORD *, char *, __int64))(*(_QWORD *)a1 + 456LL))(a1, v17, 14);
}
DailyLevelPage::exitDailyNode((__int64)a1, a2, 0.0);
v18 = *(_DWORD **)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v22 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager(v22);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v18 = *(_DWORD **)&qword_14090BFB0;
}
v19 = a1[183];
if ( v19 )
{
v20 = v19 - 1;
if ( v20 )
{
if ( v20 == 1 )
v11 = v18[245];
}
else
{
v11 = v18[242];
}
}
else
{
v11 = v18[239];
}
if ( v11 <= a3[248] - a3[249] )
return DailyLevelPage::createDailyNode((__int64)a1, 0, 0, 0.5, 0);
else
return (char *)DailyLevelPage::downloadAndCreateNode((__int64)a1);
}