//
// FollowRewardPage::updateRate from 0x14013ba40 to 0x14013bf65 (1317 bytes)
//
// 3 xrefs:
// > ??> @ 0x140557228
// > ??> @ 0x1406ca11c
// > ??> @ 0x1406ca128
//
// 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=13
void FollowRewardPage::updateRate(FollowRewardPage *a1)
{
unsigned int v2; // esi
__int64 v3; // rcx
char isSpecialChestUnlocked; // bl
GameManager *v5; // rcx
const char *v6; // rdx
__int64 v7; // rcx
__int64 v8; // rcx
__int64 v9; // rcx
__int64 v10; // rcx
__int64 v11; // rcx
struct cocos2d::CCObject *v12; // rdi
ScrollingLayer_vtbl *v13; // rbx
int v14; // eax
__int128 v15; // [rsp+20h] [rbp-39h] BYREF
__int64 v16; // [rsp+30h] [rbp-29h]
__int64 v17; // [rsp+38h] [rbp-21h]
void *v18; // [rsp+40h] [rbp-19h]
void *v19; // [rsp+48h] [rbp-11h]
void *v20; // [rsp+50h] [rbp-9h]
void *v21; // [rsp+58h] [rbp-1h]
void *v22; // [rsp+60h] [rbp+7h]
void *v23; // [rsp+68h] [rbp+Fh]
void *v24; // [rsp+70h] [rbp+17h]
void *v25; // [rsp+78h] [rbp+1Fh]
void *v26; // [rsp+80h] [rbp+27h]
void *v27; // [rsp+C8h] [rbp+6Fh]
void *v28; // [rsp+D0h] [rbp+77h]
void *v29; // [rsp+D8h] [rbp+7Fh]
v2 = 0;
if ( cocos2d::CCArray::count(*(cocos2d::CCArray **)&a1->m_nTag) )
{
while ( v2 )
{
switch ( v2 )
{
case 1u:
v15 = 0;
v16 = 4;
v17 = 15;
strcpy((char *)&v15, "0008");
v7 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v29 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v29);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v7 = qword_1406C2EE8;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v7, &v15);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v18 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v18);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
v6 = "24";
goto LABEL_38;
case 2u:
v15 = 0;
v16 = 4;
v17 = 15;
strcpy((char *)&v15, "0009");
v8 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v19 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v19);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v8 = qword_1406C2EE8;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v8, &v15);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v20 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v20);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
v6 = (const char *)&word_14054444C;
goto LABEL_38;
case 3u:
v15 = 0;
v16 = 4;
v17 = 15;
strcpy((char *)&v15, "0010");
v9 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v21 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v21);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v9 = qword_1406C2EE8;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v9, &v15);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v22 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v22);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
v6 = "26";
goto LABEL_38;
case 4u:
v15 = 0;
v16 = 4;
v17 = 15;
strcpy((char *)&v15, "0011");
v10 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v23 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v23);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v10 = qword_1406C2EE8;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v10, &v15);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v24 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v24);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
v6 = "27";
goto LABEL_38;
case 5u:
v15 = 0;
v16 = 4;
v17 = 15;
strcpy((char *)&v15, "0024");
v11 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v25 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v25);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v11 = qword_1406C2EE8;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v11, &v15);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v26 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v26);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
v6 = (const char *)&word_1405579D4;
goto LABEL_38;
}
LABEL_41:
if ( ++v2 >= cocos2d::CCArray::count(*(cocos2d::CCArray **)&a1->m_nTag) )
return;
}
v15 = 0;
v16 = 4;
v17 = 15;
strcpy((char *)&v15, "0007");
v3 = qword_1406C2EE8;
if ( !qword_1406C2EE8 )
{
v27 = operator new(0x3E0u);
qword_1406C2EE8 = sub_1401D0AE0(v27);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2EE8 + 72LL))(qword_1406C2EE8);
v3 = qword_1406C2EE8;
}
isSpecialChestUnlocked = GameStatsManager::isSpecialChestUnlocked(v3, &v15);
v5 = (GameManager *)qword_1406C2ED8;
if ( !qword_1406C2ED8 )
{
v28 = operator new(0x668u);
qword_1406C2ED8 = sub_14017AB00(v28);
(*(void (__fastcall **)(__int64))(*(_QWORD *)qword_1406C2ED8 + 72LL))(qword_1406C2ED8);
v5 = (GameManager *)qword_1406C2ED8;
}
v6 = "22";
LABEL_38:
if ( GameManager::getUGV(v5, v6) && !isSpecialChestUnlocked )
{
v12 = cocos2d::CCArray::objectAtIndex(*(cocos2d::CCArray **)&a1->m_nTag, v2);
LOBYTE(v12[10].m_uOrderOfArrival) = 0;
(**(void (__fastcall ***)(__int64, void *))&v12[5].m_unknown2)((__int64)&v12[5].m_unknown2, &unk_140529A58);
v13 = a1[-1].m_scrollingLayer->FLAlertLayer::__vftable;
v14 = v12->getTag(v12);
v13->removeChildByTag_0(a1[-1].m_scrollingLayer, v14 + 10);
}
goto LABEL_41;
}
}