//
// ChallengesPage::updateTimers from 0x140086500 to 0x1400867e5 (741 bytes)
//
// 7 xrefs:
// > ChallengesPage::challengeStatusFinished @ 0x140085e32
// > ChallengesPage::challengeStatusFinished @ 0x140085f16
// > ChallengesPage::claimItem @ 0x140086cd3
// > ChallengesPage::init @ 0x1400857b5
// > ChallengesPage::challengeStatusFinished @ 0x140085f1b
// > ChallengesPage::challengeStatusFinished @ 0x140085f33
// > ??> @ 0x1406c6c6c
//
// This function is hookable on this platform!
//
// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA
// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings
//
// Hidden C++ exception states: #wind=6
void ChallengesPage::updateTimers(ChallengesPage *a1, float a2)
{
__int64 v3; // rax
double v4; // xmm0_8
__int64 v5; // rax
int v6; // r14d
const char *v7; // rdx
cocos2d::CCLabelProtocol_vtbl *v8; // rbx
cocos2d::CCString *v9; // rax
const char *CString; // rax
_BOOL8 v11; // rdx
cocos2d::CCDictionary *m_challengeNodes; // rbx
cocos2d::CCDictElement *m_pElements; // rbx
cocos2d::CCDictElement *i; // rsi
cocos2d::CCObject *m_pObject; // rbx
_QWORD *v16; // rax
__int64 v17; // rdi
__int64 v18; // rcx
_QWORD *v19; // rdx
__int64 v20; // rax
LoadingCircle *m_circle; // rcx
GameLevelManager *v22; // rcx
void *v23; // [rsp+20h] [rbp-78h]
void *v24; // [rsp+20h] [rbp-78h]
void *v25; // [rsp+20h] [rbp-78h]
void *v26; // [rsp+20h] [rbp-78h]
char v27[32]; // [rsp+28h] [rbp-70h] BYREF
_QWORD v28[4]; // [rsp+48h] [rbp-50h] BYREF
v3 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v23 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v3 = qword_1406C2EE8;
}
if ( *(double *)(v3 + 568) > 0.0 )
{
v4 = sub_14003CF30();
v5 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v24 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v5 = qword_1406C2EE8;
}
v6 = (int)(*(double *)(v5 + 568) - v4);
if ( v6 < 0 )
v6 = 0;
GameToolbox::getTimeString(v28, v6, 0);
v7 = (const char *)v28;
if ( v28[3] > 0xFu )
v7 = (const char *)v28[0];
v8 = a1->m_countdownLabel->__vftable;
v9 = cocos2d::CCString::createWithFormat("New quests in: %s", v7);
CString = cocos2d::CCString::getCString(v9);
v8->setString(&a1->m_countdownLabel->cocos2d::CCLabelProtocol, CString);
m_challengeNodes = a1->m_challengeNodes;
if ( m_challengeNodes )
{
m_pElements = m_challengeNodes->m_pElements;
if ( m_pElements )
{
for ( i = (cocos2d::CCDictElement *)m_pElements->hh.next; ; i = (cocos2d::CCDictElement *)i->hh.next )
{
m_pObject = m_pElements->m_pObject;
v16 = (_QWORD *)sub_14003BDB0((__int64)v27, (__int64)v28);
v17 = (__int64)v16;
v18 = *(_QWORD *)&m_pObject[6].m_uID;
if ( v18 )
{
v19 = v16;
if ( v16[3] > 0xFu )
v19 = (_QWORD *)*v16;
(**(void (__fastcall ***)(__int64, _QWORD *))(v18 + 360))(v18 + 360, v19);
}
sub_14003A830(v17);
m_pElements = i;
if ( !i )
break;
}
}
}
if ( v6 <= 0 && !a1->m_unkBool )
{
LOBYTE(v11) = 1;
a1->m_circle->setVisible(a1->m_circle, v11);
a1->m_countdownLabel->setVisible(a1->m_countdownLabel, 0);
*(_WORD *)&a1->m_triedToLoad = 256;
v20 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v25 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v20 = qword_1406C2EE8;
}
*(_QWORD *)(v20 + 568) = 0;
if ( a1->m_triedToLoad )
{
m_circle = a1->m_circle;
if ( m_circle )
m_circle->setVisible(m_circle, 0);
}
else
{
a1->m_triedToLoad = 1;
v22 = (GameLevelManager *)qword_1406C2EC0;
if ( !qword_1406C2EC0 )
{
v26 = operator new(0x3D0u);
qword_1406C2EC0 = sub_140141280(v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EC0 + 72LL))(qword_1406C2EC0);
v22 = (GameLevelManager *)qword_1406C2EC0;
}
GameLevelManager::getGJChallenges(v22);
}
}
sub_14003A830((__int64)v28);
}
}