//
// GJShopLayer::onSelectItem from 0x10014bd0c to 0x10014be00 (244 bytes)
//
// 1 xrefs:
// > GJShopLayer::init @ 0x10014b460
//
// 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 v3; // w20
GameStatsManager *v4; // x0
GameStatsManager *v5; // x0
GJStoreItem *StoreItem_1; // x20
int random; // w22
int seed; // w23
GameStatsManager *v9; // x21
void **v10; // x1
int Stat; // w21
int v12; // w22
PurchaseItemPopup *v13; // x0
void *__p[2]; // [xsp+8h] [xbp-48h] BYREF
char v15; // [xsp+1Fh] [xbp-31h]
if ( !a1->m_closing )
{
v3 = ((__int64 (__fastcall *)(cocos2d::CCObject *))a2->getTag)(a2);
v4 = GameStatsManager::sharedState();
if ( !GameStatsManager::isStoreItemUnlocked(v4, v3) )
{
v5 = GameStatsManager::sharedState();
StoreItem_1 = GameStatsManager::getStoreItem_1(v5, v3);
random = StoreItem_1->m_price.random;
seed = StoreItem_1->m_price.seed;
v9 = GameStatsManager::sharedState();
GJStoreItem::getCurrencyKey(__p, StoreItem_1);
if ( v15 >= 0 )
v10 = __p;
else
v10 = (void **)__p[0];
Stat = GameStatsManager::getStat(v9, (const char *)v10);
v12 = random - seed;
if ( v15 < 0 )
operator delete(__p[0]);
if ( v12 <= Stat )
{
v13 = PurchaseItemPopup::create(StoreItem_1);
v13->m_delegate = &a1->GJPurchaseDelegate;
((void (__fastcall *)(PurchaseItemPopup *))v13->show)(v13);
}
else
{
GJShopLayer::showCantAffordMessage(a1, StoreItem_1);
}
}
}
}