//
// GJShopLayer::showCantAffordMessage from 0xa80544 to 0xa8093c (1016 bytes)
//
// 2 xrefs:
// > GJShopLayer::onSelectItem @ 0xa81708
// > ??> @ 0x816a0
//
// 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:00:31 +0000
//
__int64 __fastcall GJShopLayer::showCantAffordMessage(GJShopLayer *this, GJStoreItem *a2)
{
const char *v4; // x1
size_t v5; // x0
int v6; // w0
int v7; // w24
DialogLayer *v8; // x0
cocos2d::CCNode *v9; // x21
char v10; // w1
__int64 v12; // x0
size_t v13; // x3
char v14; // w1
__int64 v15; // x0
size_t v16; // x3
char v17; // w1
char *v18; // [xsp+48h] [xbp+48h]
__int64 v19; // [xsp+58h] [xbp+58h] BYREF
size_t v20; // [xsp+60h] [xbp+60h]
void *v21; // [xsp+68h] [xbp+68h]
__int64 v22[2]; // [xsp+70h] [xbp+70h] BYREF
void *v23; // [xsp+80h] [xbp+80h]
unsigned __int64 v24[3]; // [xsp+88h] [xbp+88h] BYREF
unsigned __int64 v25[3]; // [xsp+A0h] [xbp+A0h] BYREF
__int64 v26[2]; // [xsp+B8h] [xbp+B8h] BYREF
void *v27; // [xsp+C8h] [xbp+C8h]
__int64 v28; // [xsp+D0h] [xbp+D0h] BYREF
size_t v29; // [xsp+D8h] [xbp+D8h]
void *v30; // [xsp+E0h] [xbp+E0h]
v19 = 0;
v20 = 0;
v21 = nullptr;
std::string::__init(&v19, &byte_11B8890, 0);
if ( *((_DWORD *)a2 + 91) == 4 )
v4 = "Diamond Shards";
else
v4 = "Mana Orbs";
v18 = (char *)v4;
v22[0] = 0;
v22[1] = 0;
v23 = nullptr;
v5 = strlen(v4);
std::string::__init(v22, v18, v5);
v6 = *((_DWORD *)this + 131);
if ( v6 > 2 )
{
*((_DWORD *)this + 131) = 0;
goto LABEL_5;
}
if ( v6 == 1 )
{
std::operator+("Collect more ", (__int64)v22, v24);
v15 = std::string::append((__int64)v24, &byte_116FB00, 1u);
v16 = *(_QWORD *)(v15 + 8);
v28 = *(_QWORD *)v15;
v29 = v16;
v30 = *(void **)(v15 + 16);
*(_QWORD *)v15 = 0;
*(_QWORD *)(v15 + 8) = 0;
v17 = v19;
*(_QWORD *)(v15 + 16) = 0;
if ( (v17 & 1) != 0 )
{
*(_BYTE *)v21 = 0;
v20 = 0;
}
else
{
LOWORD(v19) = 0;
}
std::string::reserve(&v19, 0);
v21 = v30;
v19 = v28;
v20 = v29;
if ( (v24[0] & 1) != 0 )
operator delete((void *)v24[2]);
goto LABEL_6;
}
if ( v6 != 2 )
{
if ( v6 )
{
std::string::assign(&v19, &byte_11E1A70);
goto LABEL_6;
}
LABEL_5:
std::string::assign(&v19, "You cannot afford that item.");
LABEL_6:
v7 = 5;
goto LABEL_7;
}
std::operator+("You do not have enough ", (__int64)v22, v25);
v12 = std::string::append((__int64)v25, &byte_116FB00, 1u);
v13 = *(_QWORD *)(v12 + 8);
v28 = *(_QWORD *)v12;
v29 = v13;
v30 = *(void **)(v12 + 16);
*(_QWORD *)v12 = 0;
*(_QWORD *)(v12 + 8) = 0;
v14 = v19;
*(_QWORD *)(v12 + 16) = 0;
if ( (v14 & 1) != 0 )
{
*(_BYTE *)v21 = 0;
v20 = 0;
}
else
{
LOWORD(v19) = 0;
}
std::string::reserve(&v19, 0);
v21 = v30;
v19 = v28;
v20 = v29;
v7 = 6;
if ( (v25[0] & 1) != 0 )
operator delete((void *)v25[2]);
LABEL_7:
v26[0] = 0;
v26[1] = 0;
v27 = nullptr;
std::string::__init(v26, "The Shopkeeper", 0xEu);
v28 = 0;
v29 = 0;
v30 = nullptr;
if ( (v19 & 1) != 0 )
{
std::string::__init(&v28, v21, v20);
}
else
{
v30 = v21;
v28 = v19;
v29 = v20;
}
v8 = (DialogLayer *)DialogObject::create((char *)v26, (char *)&v28, v7, 0, 0xFFFFFF, 1.0);
v9 = (cocos2d::CCNode *)DialogLayer::create(v8, (DialogObject *)((char *)&dword_0 + 2));
if ( (v28 & 1) != 0 )
operator delete(v30);
if ( (v26[0] & 1) != 0 )
operator delete(v27);
(*(void (__fastcall **)(GJShopLayer *, cocos2d::CCNode *, __int64))(*(_QWORD *)this + 464LL))(this, v9, 100);
DialogLayer::updateChatPlacement((__int64)v9, 0);
DialogLayer::animateIn(v9, 1u);
v10 = v22[0];
++*((_DWORD *)this + 131);
if ( (v10 & 1) != 0 )
operator delete(v23);
if ( (v19 & 1) != 0 )
operator delete(v21);
return _stack_chk_guard;
}