//
// GJPathRewardPopup::onClaim from 0x140398260 to 0x140398446 (486 bytes)
//
// 2 xrefs:
// > GJPathRewardPopup::init @ 0x140397e5c
// > ??> @ 0x14092315c
//
// 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:14 +0000
//
// Hidden C++ exception states: #wind=2
__int64 __fastcall GJPathRewardPopup::onClaim(unsigned int *a1)
{
__int64 v2; // rbx
__int64 v3; // rax
__int64 v4; // rbp
__int64 result; // rax
struct cocos2d::CCAction *v6; // rax
__int64 v7; // rbx
struct cocos2d::CCFiniteTimeAction *v8; // rax
struct cocos2d::CCAction *v9; // rax
__int64 v10; // rsi
__int64 *v11; // rdi
__int64 v12; // rbx
int v13; // eax
cocos2d::CCObject *v14; // rcx
void *v15; // [rsp+20h] [rbp-68h]
_BYTE v16[32]; // [rsp+28h] [rbp-60h] BYREF
_QWORD v17[4]; // [rsp+48h] [rbp-40h] BYREF
v2 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v15 = operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480((__int64)v15);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v2 = qword_14090BFE0;
}
GameStatsManager::getPathRewardKey((__int64)a1, v17, a1[166]);
v3 = sub_14003F4F0((__int64)v16, (__int64)v17);
v4 = GameStatsManager::unlockSpecialChest(v2, v3);
sub_14003D310((__int64)v17);
if ( !v4 )
return GJPathRewardPopup::closePopup((struct cocos2d::CCObject *)a1);
v6 = cocos2d::CCFadeTo::create(0.2, 0);
cocos2d::CCNode::runAction((cocos2d::CCNode *)a1, v6);
v7 = cocos2d::CCCallFunc::create(a1, GJPathRewardPopup::closePopup);
v8 = cocos2d::CCDelayTime::create(0.2);
v9 = cocos2d::CCSequence::create(v8, v7, 0);
cocos2d::CCNode::runAction((cocos2d::CCNode *)a1, v9);
v10 = RewardUnlockLayer::create(*(unsigned int *)(v4 + 64), 0);
v11 = (__int64 *)(*(__int64 (__fastcall **)(unsigned int *))(*(_QWORD *)a1 + 504LL))(a1);
v12 = *v11;
v13 = (*(__int64 (__fastcall **)(unsigned int *))(*(_QWORD *)a1 + 96LL))(a1);
(*(void (__fastcall **)(__int64 *, __int64, _QWORD))(v12 + 456))(v11, v10, (unsigned int)(v13 + 1));
v14 = *(cocos2d::CCObject **)(v10 + 704);
if ( v14 )
cocos2d::CCObject::release(v14);
*(_QWORD *)(v10 + 704) = v4;
cocos2d::CCObject::retain((cocos2d::CCObject *)v4);
if ( !*(_BYTE *)(v4 + 80) || (result = *(unsigned int *)(v10 + 696), *(_DWORD *)(v4 + 64) == (_DWORD)result) )
{
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v10 + 720) + 336LL))(*(_QWORD *)(v10 + 720), 0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v10 + 720) + 936LL))(*(_QWORD *)(v10 + 720), 0);
result = (*(__int64 (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(v10 + 712) + 336LL))(*(_QWORD *)(v10 + 712), 0);
*(_BYTE *)(v10 + 700) = 1;
if ( *(_BYTE *)(v10 + 701) )
return RewardUnlockLayer::playRewardEffect(v10);
}
return result;
}