//
// GJShopLayer::didPurchaseItem from 0x100325590 to 0x100325b48 (1464 bytes)
//
// 2 xrefs:
// > sub_100325C70 @ 0x100325c7c
// > ??> @ 0x100913b68
//
// 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
//
void __fastcall GJShopLayer::didPurchaseItem(GJShopLayer *a1, GJStoreItem *a2)
{
FMODAudioEngine *v4; // rax
CCCounterLabel *m_currencyLabel; // r15
GameStatsManager *v6; // r12
const char *v7; // rsi
int Stat; // eax
cocos2d::CCDictionary *m_shopItems; // rdi
intptr_t m_type; // rsi
cocos2d::CCObject *v11; // rax
cocos2d::CCObject *v12; // r15
GJItemIcon *v13; // r12
__int64 v14; // rax
cocos2d::CCDictionary *v15; // r15
unsigned int v16; // r12d
__int64 v17; // r13
cocos2d::CCArray *v18; // r14
__int64 v19; // rax
__int64 v20; // rax
__int64 v21; // rax
__int64 v22; // rax
__int64 v23; // rax
DialogLayer *v24; // r14
char v25; // [rsp+8h] [rbp-148h] BYREF
char v26; // [rsp+9h] [rbp-147h] BYREF
void *v27; // [rsp+18h] [rbp-138h]
_QWORD v28[2]; // [rsp+20h] [rbp-130h] BYREF
void *v29; // [rsp+30h] [rbp-120h]
_QWORD v30[2]; // [rsp+38h] [rbp-118h] BYREF
void *v31; // [rsp+48h] [rbp-108h]
_QWORD v32[2]; // [rsp+50h] [rbp-100h] BYREF
void *v33; // [rsp+60h] [rbp-F0h]
_QWORD v34[2]; // [rsp+68h] [rbp-E8h] BYREF
void *v35; // [rsp+78h] [rbp-D8h]
char v36; // [rsp+80h] [rbp-D0h] BYREF
_BYTE v37[23]; // [rsp+81h] [rbp-CFh] BYREF
char v38; // [rsp+98h] [rbp-B8h] BYREF
char v39[15]; // [rsp+99h] [rbp-B7h] BYREF
void *v40; // [rsp+A8h] [rbp-A8h]
char v41; // [rsp+B0h] [rbp-A0h] BYREF
char v42[15]; // [rsp+B1h] [rbp-9Fh] BYREF
void *v43; // [rsp+C0h] [rbp-90h]
char v44; // [rsp+C8h] [rbp-88h] BYREF
char v45[15]; // [rsp+C9h] [rbp-87h] BYREF
void *v46; // [rsp+D8h] [rbp-78h]
char v47; // [rsp+E0h] [rbp-70h] BYREF
char v48[15]; // [rsp+E1h] [rbp-6Fh] BYREF
void *v49; // [rsp+F0h] [rbp-60h]
char v50; // [rsp+F8h] [rbp-58h] BYREF
char v51[15]; // [rsp+F9h] [rbp-57h] BYREF
void *v52; // [rsp+108h] [rbp-48h]
void *v53[8]; // [rsp+110h] [rbp-40h] BYREF
v4 = FMODAudioEngine::sharedEngine();
v36 = 26;
strcpy(v37, "buyItem03.ogg");
FMODAudioEngine::playEffect_1(v4, &v36);
if ( (v36 & 1) != 0 )
operator delete(*(void **)&v37[15]);
m_currencyLabel = a1->m_currencyLabel;
v6 = GameStatsManager::sharedState();
GJStoreItem::getCurrencyKey((__int64)&v25, (__int64)a2);
if ( (v25 & 1) != 0 )
v7 = (const char *)v27;
else
v7 = &v26;
Stat = GameStatsManager::getStat(v6, v7);
CCCounterLabel::setTargetCount(m_currencyLabel, Stat);
if ( (v25 & 1) != 0 )
operator delete(v27);
m_shopItems = a1->m_shopItems;
m_type = a2->m_index.random - (__int64)a2->m_index.seed;
v11 = cocos2d::CCDictionary::objectForKey(m_shopItems, m_type);
if ( v11 )
{
v12 = v11;
v13 = (GJItemIcon *)((__int64 (__fastcall *)(cocos2d::CCObject *))v11->__vftable[13].~CCObject_0)(v11);
((void (__fastcall *)(cocos2d::CCObject *, _QWORD))v12->__vftable[13].copyWithZone)(v12, 0);
m_type = (unsigned int)a1->m_type;
GJItemIcon::darkenStoreItem_1(v13, (ShopType)m_type);
m_shopItems = (cocos2d::CCDictionary *)v13;
v14 = ((__int64 (__fastcall *)(GJItemIcon *))v13->getChildren)(v13);
if ( v14 )
{
v15 = (cocos2d::CCDictionary *)v14;
m_shopItems = (cocos2d::CCDictionary *)v14;
if ( (unsigned int)sub_100720070(v14) )
{
v16 = 0;
do
{
m_type = v16;
v17 = sub_1007200C0(v15, v16);
if ( (*(unsigned int (__fastcall **)(__int64))(*(_QWORD *)v17 + 64LL))(v17) == 1234 )
{
m_type = 0;
(*(void (__fastcall **)(__int64, _QWORD))(*(_QWORD *)v17 + 328LL))(v17, 0);
}
++v16;
m_shopItems = v15;
}
while ( v16 < (unsigned int)sub_100720070(v15) );
}
}
}
if ( a2->m_unlockType.random - a2->m_unlockType.seed == 12 && a2->m_typeID.random - a2->m_typeID.seed == 4 )
{
v18 = (cocos2d::CCArray *)sub_10071F9E0(m_shopItems, m_type);
v38 = 14;
strcpy(v39, "Scratch");
v29 = operator new(0x30u);
v28[0] = 49;
v28[1] = 45;
strcpy((char *)v29, "Ah the shiny thing, excellent choice.");
v19 = DialogObject::create(&v38, v28, 10, 0, 0xFFFFFF, 1.0);
sub_10071FCD0(v18, v19);
if ( (v28[0] & 1) != 0 )
operator delete(v29);
if ( (v38 & 1) != 0 )
operator delete(v40);
v41 = 14;
strcpy(v42, "Scratch");
v31 = operator new(0x58u);
v30[0] = 89;
v30[1] = 80;
strcpy((char *)v31, "I found it a while ago.\nYea... 'Found' is a good word...");
v20 = DialogObject::create(&v41, v30, 13, 0, 0xFFFFFF, 1.0);
sub_10071FCD0(v18, v20);
if ( (v30[0] & 1) != 0 )
operator delete(v31);
if ( (v41 & 1) != 0 )
operator delete(v43);
v44 = 14;
strcpy(v45, "Scratch");
v33 = operator new(0x48u);
v32[0] = 73;
v32[1] = 66;
strcpy((char *)v33, "Not sure what it does. If anyone asks you didnt buy it here.");
v21 = DialogObject::create(&v44, v32, 11, 0, 0xFFFFFF, 1.0);
sub_10071FCD0(v18, v21);
if ( (v32[0] & 1) != 0 )
operator delete(v33);
if ( (v44 & 1) != 0 )
operator delete(v46);
v47 = 14;
strcpy(v48, "Scratch");
v35 = operator new(0x20u);
v34[0] = 33;
v34[1] = 27;
strcpy((char *)v35, "I mean, buy it where?");
v22 = DialogObject::create(&v47, v34, 13, 0, 0xFFFFFF, 1.0);
sub_10071FCD0(v18, v22);
if ( (v34[0] & 1) != 0 )
operator delete(v35);
if ( (v47 & 1) != 0 )
operator delete(v49);
v50 = 14;
strcpy(v51, "Scratch");
strcpy((char *)v53, "*...");
v23 = DialogObject::create(&v50, v53, 8, 0, 0xFFFFFF, 1.0);
sub_10071FCD0(v18, v23);
if ( ((__int64)v53[0] & 1) != 0 )
operator delete(v53[2]);
if ( (v50 & 1) != 0 )
operator delete(v52);
v24 = DialogLayer::createWithObjects(v18, 2);
((void (__fastcall *)(GJShopLayer *, DialogLayer *, __int64))a1->addChild_0)(a1, v24, 100);
DialogLayer::updateChatPlacement(v24, Center);
DialogLayer::animateInRandomSide(v24);
}
}