//
// GJShopLayer::onSelectItem from 0x100324b90 to 0x100324c7a (234 bytes)
//
// 1 xrefs:
// > GJShopLayer::init @ 0x10032403f
//
// 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::onSelectItem(GJShopLayer *a1, cocos2d::CCObject *a2)
{
int v2; // r14d
GameStatsManager *v3; // rax
GameStatsManager *v4; // rax
GJStoreItem *StoreItem_1; // r14
int random; // r12d
int seed; // r13d
GameStatsManager *v8; // r15
const char *v9; // rsi
int Stat; // r15d
int v11; // r12d
PurchaseItemPopup *v12; // rax
char v13; // [rsp+0h] [rbp-40h] BYREF
char v14; // [rsp+1h] [rbp-3Fh] BYREF
void *__p; // [rsp+10h] [rbp-30h]
if ( !a1->m_closing )
{
v2 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
v3 = GameStatsManager::sharedState();
if ( !GameStatsManager::isStoreItemUnlocked(v3, v2) )
{
v4 = GameStatsManager::sharedState();
StoreItem_1 = GameStatsManager::getStoreItem_1(v4, v2);
random = StoreItem_1->m_price.random;
seed = StoreItem_1->m_price.seed;
v8 = GameStatsManager::sharedState();
GJStoreItem::getCurrencyKey((__int64)&v13, (__int64)StoreItem_1);
if ( (v13 & 1) != 0 )
v9 = (const char *)__p;
else
v9 = &v14;
Stat = GameStatsManager::getStat(v8, v9);
v11 = random - seed;
if ( (v13 & 1) != 0 )
operator delete(__p);
if ( v11 <= Stat )
{
v12 = PurchaseItemPopup::create(StoreItem_1);
v12->m_delegate = &a1->GJPurchaseDelegate;
((void (__fastcall *)(PurchaseItemPopup *))v12->show)(v12);
}
else
{
GJShopLayer::showCantAffordMessage(a1, StoreItem_1);
}
}
}
}