//
// ChallengesPage::createChallengeNode from 0x14009e790 to 0x14009eabc (812 bytes)
//
// 4 xrefs:
// > ChallengesPage::init @ 0x14009de40
// > ChallengesPage::challengeStatusFinished @ 0x14009e598
// > ChallengesPage::claimItem @ 0x14009f3bb
// > ??> @ 0x140912fec
//
// 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:26:05 +0000
//
// Hidden C++ exception states: #wind=5
char *__fastcall ChallengesPage::createChallengeNode(__int64 a1, int a2, char a3, float a4, unsigned __int8 a5)
{
__int64 v6; // rsi
__int64 v8; // rcx
__int64 v10; // rax
unsigned __int8 v11; // r14
__int64 v12; // rcx
__int64 v13; // rcx
__int64 v14; // rcx
__int64 Challenge; // rbx
char *v16; // rdi
__int64 v17; // rax
const struct cocos2d::CCPoint *v18; // rax
__int64 v19; // rbx
__int64 v20; // rcx
cocos2d::CCDirector *v21; // rax
float v22; // xmm0_4
__int64 v23; // rax
struct cocos2d::CCFiniteTimeAction *v24; // rbx
struct cocos2d::CCActionInterval *v25; // rax
struct cocos2d::CCEaseElasticOut *v26; // rax
struct cocos2d::CCAction *v27; // rax
char *v28; // [rsp+20h] [rbp-58h] BYREF
char v29[8]; // [rsp+28h] [rbp-50h] BYREF
_BYTE v30[16]; // [rsp+30h] [rbp-48h] BYREF
float v31; // [rsp+80h] [rbp+8h] BYREF
float v32; // [rsp+84h] [rbp+Ch]
v6 = a2;
if ( cocos2d::CCDictionary::objectForKey(*(cocos2d::CCDictionary **)(a1 + 728), a2) )
return nullptr;
v10 = cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize(v10, &v31);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v29, v31 * 0.5, (float)((float)(v32 * 0.5) + 80.0) + 5.0);
v11 = a5;
v12 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v28 = (char *)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v12 = qword_14090BFE0;
}
if ( !GameStatsManager::getChallenge(v12, (unsigned int)v6) )
{
v13 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v28 = (char *)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v13 = qword_14090BFE0;
}
GameStatsManager::processChallengeQueue(v13, (unsigned int)v6);
v11 = 1;
}
v14 = qword_14090BFE0;
if ( !qword_14090BFE0 )
{
v28 = (char *)operator new(0x3E8u);
qword_14090BFE0 = sub_1402D6480(v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_14090BFE0 + 72LL))(qword_14090BFE0);
v14 = qword_14090BFE0;
}
Challenge = GameStatsManager::getChallenge(v14, (unsigned int)v6);
v16 = (char *)operator new(0x168u);
v28 = v16;
cocos2d::CCNode::CCNode((cocos2d::CCNode *)v16);
*(_QWORD *)v16 = &ChallengeNode::`vftable';
*((_QWORD *)v16 + 41) = 0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)(v16 + 336));
*((_QWORD *)v16 + 43) = 0;
v16[352] = 0;
if ( (unsigned __int8)ChallengeNode::init(v16, Challenge, a1, v11, v28) )
{
cocos2d::CCObject::autorelease((cocos2d::CCObject *)v16);
}
else
{
(*(void (__fastcall **)(char *, __int64))(*(_QWORD *)v16 + 8LL))(v16, 1);
v16 = nullptr;
}
(*(void (__fastcall **)(_QWORD, char *))(**(_QWORD **)(a1 + 584) + 464LL))(*(_QWORD *)(a1 + 584), v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, 0.0, (float)(v6 - 1) * -80.0);
cocos2d::CCPoint::operator+(v29, &v28, v17);
(*(void (__fastcall **)(char *, char **))(*(_QWORD *)v16 + 184LL))(v16, &v28);
cocos2d::CCDictionary::setObject(*(cocos2d::CCDictionary **)(a1 + 728), (struct cocos2d::CCObject *)v16, v6);
if ( !a3 )
{
v18 = (const struct cocos2d::CCPoint *)(*(__int64 (__fastcall **)(char *))(*(_QWORD *)v16 + 200LL))(v16);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v28, v18);
v19 = *(_QWORD *)v16;
v21 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v20);
v22 = cocos2d::CCDirector::getScreenRight(v21) + 160.0;
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v30, v22, *((float *)&v28 + 1));
(*(void (__fastcall **)(char *, __int64))(v19 + 184))(v16, v23);
v24 = cocos2d::CCDelayTime::create(a4);
v25 = cocos2d::CCMoveTo::create(0.5, (const struct cocos2d::CCPoint *)&v28);
v26 = cocos2d::CCEaseElasticOut::create(v25, 0.60000002);
v27 = cocos2d::CCSequence::create(v24, v26, 0);
cocos2d::CCNode::runAction((cocos2d::CCNode *)v16, v27);
}
return v16;
}