//
// SetupRandAdvTriggerPopup::init from 0xaf01c8 to 0xaf0cc0 (2808 bytes)
//
// 2 xrefs:
// > SetupRandAdvTriggerPopup::create @ 0xaf0f4c
// > ??> @ 0x99fb8
//
// This function is hookable on this platform (idp: arm, 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 13:01:12 +0000
//
__int64 __fastcall SetupRandAdvTriggerPopup::init(
SetupRandAdvTriggerPopup *this,
RandTriggerGameObject *a2,
cocos2d::CCArray *a3)
{
cocos2d::CCArray *v4; // x0
unsigned int v5; // w25
cocos2d::CCObject *v7; // x0
cocos2d::CCDirector *v8; // x0
cocos2d::CCDirector *v9; // x0
const char *v10; // x6
__int64 v11; // x0
__int64 v12; // x0
__int64 v13; // x24
const char *v14; // x2
__int64 v15; // x24
__int64 v16; // x0
__int64 v17; // x24
__int64 v18; // x24
const char *v19; // x4
__int64 v20; // x0
__int64 v21; // x27
__int64 v22; // x0
__int64 (__fastcall *v23)(__int64); // x1
void (__fastcall *v24)(__int64, __int64); // x24
__int64 v25; // x0
__int64 v26; // x24
_QWORD *v27; // x24
cocos2d::CCString *v28; // x0
const char *CString; // x0
size_t v30; // x0
const char *v31; // x6
__int64 v32; // x0
__int64 v33; // x24
__int64 v34; // x24
cocos2d::CCNode *v35; // x24
const char *v36; // x1
cocos2d::CCSprite *v37; // x24
__int64 v38; // x0
__int64 v39; // x24
const char *v40; // x1
__int64 v41; // x24
__int64 v42; // x0
__int64 v43; // x24
cocos2d::CCNode *v44; // [xsp+A8h] [xbp+98h]
cocos2d::CCNode *v45; // [xsp+B0h] [xbp+A0h]
cocos2d::CCNode *v46; // [xsp+B0h] [xbp+A0h]
void (__fastcall *v47)(__int64, __int64 *); // [xsp+B8h] [xbp+A8h]
void (__fastcall *v48)(__int64, __int64 *); // [xsp+B8h] [xbp+A8h]
void (__fastcall *v49)(__int64, __int64 *); // [xsp+B8h] [xbp+A8h]
void (__fastcall *v50)(__int64, __int64 *); // [xsp+B8h] [xbp+A8h]
char *v51; // [xsp+B8h] [xbp+A8h]
__int64 v52; // [xsp+B8h] [xbp+A8h]
void (__fastcall *v53)(__int64, __int64 *); // [xsp+B8h] [xbp+A8h]
void (__fastcall *v54)(__int64, __int64 *); // [xsp+B8h] [xbp+A8h]
void (__fastcall *v55)(__int64, __int64 *); // [xsp+B8h] [xbp+A8h]
void (__fastcall *v56)(__int64, __int64 *); // [xsp+B8h] [xbp+A8h]
int v57; // [xsp+C0h] [xbp+B0h]
__int64 v58; // [xsp+C8h] [xbp+B8h] BYREF
_BYTE v59[8]; // [xsp+D0h] [xbp+C0h] BYREF
_BYTE v60[8]; // [xsp+D8h] [xbp+C8h] BYREF
__int64 v61; // [xsp+E0h] [xbp+D0h] BYREF
_BYTE v62[4]; // [xsp+E8h] [xbp+D8h] BYREF
float v63; // [xsp+ECh] [xbp+DCh]
_BYTE v64[8]; // [xsp+F0h] [xbp+E0h] BYREF
__int64 v65; // [xsp+F8h] [xbp+E8h] BYREF
__int64 v66; // [xsp+100h] [xbp+F0h] BYREF
__int64 v67[2]; // [xsp+108h] [xbp+F8h] BYREF
__int64 v68[2]; // [xsp+118h] [xbp+108h] BYREF
void *v69; // [xsp+128h] [xbp+118h]
__int64 v70; // [xsp+130h] [xbp+120h] BYREF
__int64 v71; // [xsp+138h] [xbp+128h]
void *v72; // [xsp+140h] [xbp+130h]
v4 = (cocos2d::CCArray *)(unsigned __int8)SetupTriggerPopup::init(this, a2, a3, 380.0, 300.0, 1, 0.0);
v5 = (unsigned __int8)v4;
if ( (_BYTE)v4 )
{
v7 = (cocos2d::CCObject *)cocos2d::CCArray::create(v4);
*((_QWORD *)this + 127) = v7;
cocos2d::CCObject::retain(v7);
v8 = (cocos2d::CCDirector *)(*(__int64 (__fastcall **)(SetupRandAdvTriggerPopup *))(*(_QWORD *)this + 1360LL))(this);
v9 = (cocos2d::CCDirector *)cocos2d::CCDirector::sharedDirector(v8);
cocos2d::CCDirector::getWinSize(&v58, v9);
v70 = 0;
v71 = 0;
v72 = nullptr;
std::string::__init(&v70, "Advanced Random Trigger", 0x17u);
SetupTriggerPopup::addTitle(this, &v70);
if ( (v70 & 1) != 0 )
operator delete(v72);
v11 = ButtonSprite::create(
(ButtonSprite *)"OK",
(const char *)&qword_28,
0,
1,
0.8,
"goldFont.fnt",
"GJ_button_01.png",
v10,
30.0);
v12 = CCMenuItemSpriteExtra::create(v11, 0, (__int64)this, 1368, 1);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v12);
v68[0] = 0;
v68[1] = 0;
v69 = nullptr;
std::string::__init(v68, "Help", 4u);
v70 = 0;
v71 = 0;
v72 = nullptr;
std::string::__init(
&v70,
"Triggers one of several groups randomly. Chance is how likely it is that the group is triggered. T"
"his value is then divided by the sum of the chances to calculate the chance in percentage for each group.",
0xDBu);
v13 = InfoAlertButton::create((char *)v68, (char *)&v70, 1.0);
if ( (v70 & 1) != 0 )
operator delete(v72);
if ( (v68[0] & 1) != 0 )
operator delete(v69);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v13);
v47 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v13 + 184LL);
v45 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v66,
18.0 - (float)((float)(*((float *)this + 183) * 0.5) - (float)(*(float *)&v58 * 0.5)),
(float)((float)(*((float *)this + 184) * 0.5) + (float)(*((float *)&v58 + 1) * 0.5)) - 18.0);
cocos2d::CCNode::convertToNodeSpace(v67, v45, (const cocos2d::CCPoint *)&v66);
v47(v13, v67);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v59,
(float)((float)(*(float *)&v58 * 0.5) + -50.0) - 50.0,
(float)(*((float *)&v58 + 1) * 0.5) + 65.0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v60,
(float)((float)((float)(*(float *)&v58 * 0.5) + 50.0) - 50.0) + 35.0,
(float)(*((float *)&v58 + 1) * 0.5) + 65.0);
v70 = 0;
v71 = 0;
v72 = nullptr;
std::string::__init(&v70, "GroupID", 7u);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, (const cocos2d::CCPoint *)v59);
v15 = IDNameInput::create(this, (char *)this + 544, 1, 1, &v70, v67, 6, 0, 1.0, 0, 0);
if ( (v70 & 1) != 0 )
operator delete(v72);
if ( v15 )
v16 = *(_QWORD *)(v15 + 384);
else
v16 = 0;
*((_QWORD *)this + 128) = v16;
v17 = cocos2d::CCLabelBMFont::create((cocos2d::CCLabelBMFont *)"Chance", "goldFont.fnt", v14);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v17 + 160LL))(v17, 0.7);
v48 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 296LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, 0.5, 0.0);
v48(v17, v67);
v49 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v17 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, 0.0, 25.0);
cocos2d::CCPoint::operator+(v67, v60);
v49(v17, v67);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 73) + 456LL))(*((_QWORD *)this + 73), v17);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v67, 0.0, 0.0, 40.0, 40.0);
v18 = cocos2d::extension::CCScale9Sprite::create("square02_small.png", v67);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v18 + 912LL))(v18, 100);
v50 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v18 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v67, 70.0, 30.0);
v50(v18, v67);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v18,
0xFFFFFFFFLL);
(*(void (__fastcall **)(__int64, _BYTE *))(*(_QWORD *)v18 + 184LL))(v18, v60);
v20 = CCTextInputNode::create(
(CCTextInputNode *)"Num",
60.0,
40.0,
"Thonburi",
(const char *)&off_18,
"bigFont.fnt",
v19);
*((_QWORD *)this + 129) = v20;
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v20,
20);
v21 = *((_QWORD *)this + 129);
v22 = v18;
v23 = *(__int64 (__fastcall **)(__int64))(*(_QWORD *)v18 + 192LL);
v24 = *(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v21 + 184LL);
v25 = v23(v22);
v24(v21, v25);
CCTextInputNode::setMaxLabelScale(*((CCTextInputNode **)this + 129), 0.6);
CCTextInputNode::setMaxLabelWidth(*((CCTextInputNode **)this + 129), 200.0);
(*(void (__fastcall **)(_QWORD, _QWORD))(**(_QWORD **)(*((_QWORD *)this + 129) + 576LL) + 344LL))(
*(_QWORD *)(*((_QWORD *)this + 129) + 576LL),
0);
*(_DWORD *)(*((_QWORD *)this + 129) + 592LL) = 5;
v70 = 0;
v26 = *((_QWORD *)this + 129);
v71 = 0;
v72 = nullptr;
std::string::__init(&v70, "0123456789", 0xAu);
CCTextInputNode::setAllowedChars(v26, (__int64)&v70);
if ( (v70 & 1) != 0 )
operator delete(v72);
LOWORD(v57) = -21896;
BYTE2(v57) = -16;
CCTextInputNode::setLabelPlaceholderColor(*((_QWORD *)this + 129), v57);
CCTextInputNode::setLabelPlaceholderScale(*((CCTextInputNode **)this + 129), 0.5);
*(_QWORD *)(*((_QWORD *)this + 129) + 584LL) = (char *)this + 544;
*(_BYTE *)(*((_QWORD *)this + 129) + 424LL) = 1;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 129) + 72LL))(*((_QWORD *)this + 129), 2);
v27 = *((_QWORD **)this + 129);
v28 = (cocos2d::CCString *)cocos2d::CCString::createWithFormat((cocos2d::CCString *)"%i", &byte_9[1]);
CString = (const char *)cocos2d::CCString::getCString(v28);
v70 = 0;
v51 = (char *)CString;
v71 = 0;
v72 = nullptr;
v30 = strlen(CString);
std::string::__init(&v70, v51, v30);
CCTextInputNode::setString(v27, (char *)&v70);
if ( (v70 & 1) != 0 )
operator delete(v72);
v32 = ButtonSprite::create(
(ButtonSprite *)"Add",
(const char *)&dword_30 + 2,
0,
1,
0.7,
"goldFont.fnt",
"GJ_button_04.png",
v31,
25.0);
v33 = CCMenuItemSpriteExtra::create(v32, 0, (__int64)this, (__int64)SetupRandAdvTriggerPopup::onAddChance, 0);
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v33);
v46 = *(cocos2d::CCNode **)(*(_QWORD *)v33 + 184LL);
v44 = *((cocos2d::CCNode **)this + 69);
v52 = (*(__int64 (__fastcall **)(_QWORD))(**((_QWORD **)this + 129) + 192LL))(*((_QWORD *)this + 129));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v65, 95.0, 0.0);
cocos2d::CCPoint::operator+(&v66, v52);
cocos2d::CCNode::convertToNodeSpace(v67, v44, (const cocos2d::CCPoint *)&v66);
((void (__fastcall *)(__int64, __int64 *))v46)(v33, v67);
cocos2d::CCRect::CCRect((cocos2d::CCRect *)v67, 0.0, 0.0, 80.0, 80.0);
v34 = cocos2d::extension::CCScale9Sprite::create("square02_001.png", v67);
(*(void (__fastcall **)(__int64, __int64))(*(_QWORD *)v34 + 912LL))(v34, 50);
v53 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 320LL);
cocos2d::CCSize::CCSize((cocos2d::CCSize *)v67, 350.0, 90.0);
v53(v34, v67);
(*(void (__fastcall **)(_QWORD, __int64, __int64))(**((_QWORD **)this + 73) + 464LL))(
*((_QWORD *)this + 73),
v34,
0xFFFFFFFFLL);
v54 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v34 + 184LL);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v67,
*(float *)&v58 * 0.5,
(float)(*((float *)&v58 + 1) * 0.5) + -10.0);
v54(v34, v67);
v35 = *((cocos2d::CCNode **)this + 69);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v67,
(float)(*(float *)&v58 * 0.5) + -175.0,
(float)(*((float *)&v58 + 1) * 0.5) + -10.0);
cocos2d::CCNode::convertToNodeSpace(&v61, v35, (const cocos2d::CCPoint *)v67);
v37 = (cocos2d::CCSprite *)cocos2d::CCSprite::createWithSpriteFrameName(
(cocos2d::CCSprite *)"GJ_arrow_03_001.png",
v36);
(*(void (__fastcall **)(cocos2d::CCSprite *, float))(*(_QWORD *)v37 + 160LL))(v37, 0.5);
cocos2d::CCSprite::setFlipY(v37, 1);
(*(void (__fastcall **)(cocos2d::CCSprite *, float))(*(_QWORD *)v37 + 360LL))(v37, 90.0);
v38 = CCMenuItemSpriteExtra::create(
(__int64)v37,
0,
(__int64)this,
(__int64)SetupRandAdvTriggerPopup::onGroupIDScrollUp,
0);
*((_QWORD *)this + 131) = v38;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v38);
v39 = *((_QWORD *)this + 131);
v55 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v39 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, 0.0, 20.0);
cocos2d::CCPoint::operator+(v67, &v61);
v55(v39, v67);
CCMenuItemSpriteExtra::setSizeMult(*((_QWORD *)this + 131), 1.5);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 131) + 344LL))(*((_QWORD *)this + 131), 0);
v41 = cocos2d::CCSprite::createWithSpriteFrameName((cocos2d::CCSprite *)"GJ_arrow_03_001.png", v40);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v41 + 160LL))(v41, 0.5);
(*(void (__fastcall **)(__int64, float))(*(_QWORD *)v41 + 360LL))(v41, -90.0);
v42 = CCMenuItemSpriteExtra::create(
v41,
0,
(__int64)this,
(__int64)SetupRandAdvTriggerPopup::onGroupIDScrollDown,
0);
*((_QWORD *)this + 132) = v42;
(*(void (__fastcall **)(_QWORD, __int64))(**((_QWORD **)this + 69) + 456LL))(*((_QWORD *)this + 69), v42);
v43 = *((_QWORD *)this + 132);
v56 = *(void (__fastcall **)(__int64, __int64 *))(*(_QWORD *)v43 + 184LL);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)&v66, 0.0, -20.0);
cocos2d::CCPoint::operator+(v67, &v61);
v56(v43, v67);
CCMenuItemSpriteExtra::setSizeMult(*((_QWORD *)this + 132), 1.5);
(*(void (__fastcall **)(_QWORD, _QWORD))(**((_QWORD **)this + 132) + 344LL))(*((_QWORD *)this + 132), 0);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)v62,
20.0 - (float)((float)(*((float *)this + 183) * 0.5) - (float)(*(float *)&v58 * 0.5)),
20.0 - (float)((float)(*((float *)this + 184) * 0.5) - (float)(*((float *)&v58 + 1) * 0.5)));
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v64, 0.0, 30.0);
cocos2d::CCPoint::operator+(&v65, v62);
cocos2d::CCPoint::CCPoint((cocos2d::CCPoint *)v67, (const cocos2d::CCPoint *)v62);
cocos2d::CCPoint::CCPoint(
(cocos2d::CCPoint *)&v66,
(float)((float)(*((float *)this + 183) * 0.5) + (float)(*(float *)&v58 * 0.5)) - 76.0,
v63 + 30.0);
SetupTriggerPopup::createMultiTriggerItems(this, &v65, v67, &v66);
SetupRandAdvTriggerPopup::updateGroupIDButtons((cocos2d::CCArray **)this);
*((_BYTE *)this + 744) = 0;
}
return v5;
}