//
// LevelBrowserLayer::claimRecallChest from 0x1403eb250 to 0x1403eb54c (764 bytes)
//
// 2 xrefs:
// > LevelBrowserLayer::cellPerformedAction @ 0x1403eabe5
// > ??> @ 0x1409251b4
//
// 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:31:45 +0000
//
// Hidden C++ exception states: #wind=4
__int64 __fastcall LevelBrowserLayer::claimRecallChest(__int64 a1, __int64 a2)
{
_DWORD *v3; // rbx
_QWORD *v4; // rcx
__int64 v5; // rax
__int64 v6; // rdx
__int64 v7; // r8
__int64 v8; // r9
__int64 v9; // rdi
int v10; // edi
_QWORD *v11; // rcx
int v12; // edi
unsigned int v13; // esi
cocos2d::CCActionManager **v14; // rcx
__int64 v15; // rax
cocos2d::CCObject *v16; // rbx
__int64 v18; // rbx
cocos2d::CCObject *v19; // rcx
__int128 v20; // [rsp+50h] [rbp-48h] BYREF
__int64 v21; // [rsp+60h] [rbp-38h]
__int64 v22; // [rsp+68h] [rbp-30h]
_BYTE v23[32]; // [rsp+70h] [rbp-28h] BYREF
void *v24; // [rsp+B0h] [rbp+18h]
void *v25; // [rsp+B0h] [rbp+18h]
void *v26; // [rsp+B0h] [rbp+18h]
v3 = LevelCell::recallLevel(a2);
v4 = (_QWORD *)qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v24 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v4 = (_QWORD *)qword_14090BFE0;
}
v5 = GameStatsManager::completedDailyLevel(v4, v3);
v9 = v5;
if ( v5 )
{
v18 = RewardUnlockLayer::create(*(unsigned int *)(v5 + 64), 0);
(*(void (__fastcall **)(__int64, __int64, __int64))(*(_QWORD *)a1 + 456LL))(a1, v18, 100);
v19 = *(cocos2d::CCObject **)(v18 + 704);
if ( v19 )
cocos2d::CCObject::release(v19);
*(_QWORD *)(v18 + 704) = v9;
cocos2d::CCObject::retain((cocos2d::CCObject *)v9);
if ( !*(_BYTE *)(v9 + 80) || *(_DWORD *)(v9 + 64) == *(_DWORD *)(v18 + 696) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v18 + 720) + 336LL))(*(_QWORD *)(v18 + 720), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v18 + 720) + 936LL))(*(_QWORD *)(v18 + 720), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v18 + 712) + 336LL))(*(_QWORD *)(v18 + 712), 0);
*(_BYTE *)(v18 + 700) = 1;
if ( *(_BYTE *)(v18 + 701) )
RewardUnlockLayer::playRewardEffect(v18);
}
return LevelBrowserLayer::reloadPageRows(a1, v6, v7, v8);
}
v10 = v3[248] - v3[249];
if ( v10 <= 200000 )
return LevelBrowserLayer::reloadPageRows(a1, v6, v7, v8);
v11 = (_QWORD *)qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v25 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v11 = (_QWORD *)qword_14090BFE0;
}
if ( GameStatsManager::hasCompletedDailyLevel(v11, v10) )
return LevelBrowserLayer::reloadPageRows(a1, v6, v7, v8);
v12 = v3[248] - v3[249];
v13 = v3[82] - v3[83];
v14 = *(cocos2d::CCActionManager ***)&qword_14090BFB0;
if ( !*(_QWORD *)&qword_14090BFB0 )
{
v26 = operator new(0x690u);
*(_QWORD *)&qword_14090BFB0 = GameLevelManager::GameLevelManager((__int64)v26);
(*(void (__fastcall **)(_QWORD))(**(_QWORD **)&qword_14090BFB0 + 72LL))(*(_QWORD *)&qword_14090BFB0);
v14 = *(cocos2d::CCActionManager ***)&qword_14090BFB0;
}
GameLevelManager::downloadLevel(v14, v13, 0, v12);
v20 = 0;
*(_QWORD *)&v20 = sub_14003D460(0x30u);
v21 = 45;
v22 = 47;
strcpy((char *)v20, "Fetching the chest, tap it again in a moment.");
v15 = sub_14003F4F0((__int64)v23, (__int64)&v20);
v16 = FLAlertLayer::create(0, (int)"Chest", v15, (__int64)"OK", 0, 1133903872, 0, 0, 1065353216);
sub_14003D310((__int64)&v20);
return (*(__int64 (__fastcall **)(cocos2d::CCObject *))(*(_QWORD *)v16 + 1064LL))(v16);
}