Code:
int __cdecl Script_PickupContainerItem(int a1)
{
int ActivePlayer; // eax
int v3; // edx
CGPlayer_C *v4; // esi
int ItemPointer; // eax
int v6; // edi
int Record; // edx
int v8; // ebx
CDataStore *v9; // edx
int v10; // edi
int Item; // eax
unsigned int RepairCost; // edi
__int64 v13; // rax
int v14; // eax
int v15; // eax
int v16; // edx
CGPlayer_C *v17; // eax
int VirtualItemCount; // eax
CGPlayer_C *v19; // [esp+0h] [ebp-1B8h]
unsigned __int64 v20; // [esp+4h] [ebp-1B4h]
unsigned __int64 v21; // [esp+4h] [ebp-1B4h]
unsigned __int64 v22; // [esp+4h] [ebp-1B4h]
int v23; // [esp+4h] [ebp-1B4h]
int v24; // [esp+4h] [ebp-1B4h]
char v25; // [esp+4h] [ebp-1B4h]
CDataStore *v26; // [esp+4h] [ebp-1B4h]
unsigned int *v27; // [esp+8h] [ebp-1B0h]
int v28; // [esp+8h] [ebp-1B0h]
int v29; // [esp+8h] [ebp-1B0h]
int v30; // [esp+8h] [ebp-1B0h]
unsigned int *v31; // [esp+Ch] [ebp-1ACh]
unsigned __int64 v32; // [esp+Ch] [ebp-1ACh]
const char *v33; // [esp+1Ch] [ebp-19Ch]
int v34; // [esp+20h] [ebp-198h]
unsigned __int64 v35; // [esp+30h] [ebp-188h]
char v36; // [esp+3Ch] [ebp-17Ch]
unsigned __int64 v37; // [esp+40h] [ebp-178h]
unsigned __int64 v38; // [esp+48h] [ebp-170h]
char SlotIndex; // [esp+53h] [ebp-165h]
CGGuildBankInfo *v40; // [esp+54h] [ebp-164h]
__int64 v41; // [esp+58h] [ebp-160h]
int *v42; // [esp+64h] [ebp-154h] BYREF
int v43; // [esp+68h] [ebp-150h] BYREF
int v44; // [esp+6Ch] [ebp-14Ch] BYREF
int v45[2]; // [esp+70h] [ebp-148h] BYREF
int v46; // [esp+78h] [ebp-140h]
int v47[2]; // [esp+88h] [ebp-130h] BYREF
unsigned __int64 v48; // [esp+90h] [ebp-128h] BYREF
unsigned __int64 v49; // [esp+98h] [ebp-120h] BYREF
CGGuildBankInfo *v50; // [esp+A0h] [ebp-118h] BYREF
CGGuildBankInfo *v51; // [esp+A4h] [ebp-114h] BYREF
CGMerchantInfo *v52; // [esp+A8h] [ebp-110h] BYREF
CGGuildBankInfo *v53; // [esp+ACh] [ebp-10Ch] BYREF
unsigned __int64 v54; // [esp+B0h] [ebp-108h] BYREF
CGItem_C *v55; // [esp+B8h] [ebp-100h] BYREF
CGPlayer_C *v56; // [esp+BCh] [ebp-FCh] BYREF
char v57[12]; // [esp+C0h] [ebp-F8h] BYREF
int v58; // [esp+CCh] [ebp-ECh]
int v59; // [esp+184h] [ebp-34h]
int v60; // [esp+188h] [ebp-30h]
int v61; // [esp+18Ch] [ebp-2Ch]
if ( !lua_isnumber(a1, 1) || !lua_isnumber(a1, 2) )
{
luaL_error(a1, "Usage: PickupContainerItem(index, slot)");
return 0;
}
ActivePlayer = ClntObjMgrGetActivePlayer();
v4 = (CGPlayer_C *)ClntObjMgrObjectPtr(ActivePlayer, v3, 16, (char)"../Object/ObjectClient/Player_C.h", 199);
if ( v4
&& (CGGameUI::m_hasControl || (*(_BYTE *)(*((_DWORD *)v4 + 50) + 186) & 0x10) != 0)
&& CGContainerInfo::GetLuaBagAndSlot(a1, &v56, &v55, (char *)&v54 + 4)
&& (!*((_BYTE *)v56 + 16)
|| (unsigned int)v55 - 39 > 0x22
|| *((_DWORD *)&CGBankInfo::m_banker + 1) | CGBankInfo::m_banker) )
{
CGGameUI::GetCursorItem((CGGameUI *)&v49, &v48, &v54, v31);
CGGameUI::GetCursorVirtualItem((CGGameUI *)&v53, (unsigned int *)&v52, v27);
ItemPointer = CGBag_C::GetItemPointer(v56, (int)v55);
v6 = ItemPointer;
v38 = 0LL;
if ( ItemPointer )
v38 = *(_QWORD *)*(_DWORD *)(ItemPointer + 8);
if ( v49 )
{
if ( v49 != v38 )
{
if ( CGGameUI::m_stackSplit )
{
CGPlayer_C::SplitItem(v4, v49, v48, v54, *((_QWORD *)v56 + 1), (int)v55, (int)CGGameUI::m_stackSplit);
CGGameUI::ClearCursor(0, 1, v29);
}
else if ( (!v38 || v48) && (!ItemPointer || (*(_BYTE *)(ItemPointer + 1148) & 1) == 0) )
{
LODWORD(v20) = HIDWORD(v38);
CGGameUI::LockItem((CGGameUI *)v38, v20);
CGPlayer_C::SwapItems(v4, v49, v48, v54, *((_QWORD *)v56 + 1), (int)v55, 0);
}
return 0;
}
LABEL_42:
CGGameUI::ClearCursor((CGGameUI *)1, 1, SHIDWORD(v20));
return 0;
}
if ( !v53 )
{
if ( ItemPointer )
{
if ( (unsigned __int8)Spell_C_IsTargeting() )
Spell_C_StopTargeting();
if ( CursorGetResetMode() == 17 && CGMerchantInfo::CanRepair(v19) )
{
RepairCost = CGMerchantInfo::GetRepairCost((CGMerchantInfo *)v6, (CGItem_C *)v20);
v41 = *(_QWORD *)*((_DWORD *)v4 + 2);
LODWORD(v13) = ClntObjMgrGetActivePlayer();
v35 = 0LL;
if ( v41 == v13 )
{
v14 = *((_DWORD *)v4 + 1180);
if ( !v14 )
{
SErrDisplayError(-2062548992, "../Object/Player.h", 632, "m_plyr", 0, 1, 0, 286331153);
v14 = *((_DWORD *)v4 + 1180);
}
v35 = *(_QWORD *)(v14 + 6376);
}
if ( v35 >= RepairCost )
{
v59 = 0;
v60 = 0;
v61 = 0;
v58 = -1;
SE3SoundKitProperties::ResetToDefaults((SE3SoundKitProperties *)v57);
SE3::PlaySoundKit(
(SE3 *)"ITEM_REPAIR",
0,
(const C3Vector *)v57,
0,
(unsigned int *)"/Users/patchman/buildserver/wow-b/work/WoW-code/trunk/WoW/Source/Mac/../Ui/ContainerFrame.cpp",
(const char *)0x40A,
(int)"Script_PickupContainerItem()",
v33);
v43 = 0;
v44 = 0;
v45[0] = 0;
v45[1] = 0;
v46 = -1;
v42 = &`vtable for'WDataStore + 2;
((void (__cdecl *)(int **, int *, int *, int *))*(&`vtable for'WDataStore + 2))(&v42, &v43, &v44, v45);
CDataStore::Put((CDataStore *)&v42, 3042);
CDataStore::Put((CDataStore *)&v42, CGMerchantInfo::m_merchant);
CDataStore::Put((CDataStore *)&v42, v38);
CDataStore::Put((CDataStore *)&v42, 0);
if ( v46 != -1 )
SErrDisplayError(
-2062548992,
"../../../Engine/Source/Base/CDataStore.h",
478,
"!IsFinal()",
0,
1,
0,
286331153);
v46 = 0;
ClientServices::Send2((ClientServices *)&v42, v26);
v42 = &`vtable for'WDataStore + 2;
if ( v45[0] != -1 )
((void (__cdecl *)(int **, int *, int *, int *))*(&`vtable for'WDataStore + 3))(&v42, &v43, &v44, v45);
v42 = &`vtable for'CDataStore + 2;
if ( v45[0] != -1 )
((void (__cdecl *)(int **, int *, int *, int *))*(&`vtable for'CDataStore + 3))(&v42, &v43, &v44, v45);
}
else
{
CGGameUI::DisplayError(40, v25);
}
}
else if ( (unsigned __int8)CGPlayer_C::IsGiftWrapping(v19) )
{
v15 = ClntObjMgrGetActivePlayer();
v17 = (CGPlayer_C *)ClntObjMgrObjectPtr(v15, v16, 16, (char)"../Object/ObjectClient/Player_C.h", 199);
if ( v17 )
CGPlayer_C::GiftWrap(v17, (CGItem_C *)v6);
}
else if ( (*(_BYTE *)(v6 + 1148) & 1) == 0 )
{
HIDWORD(v32) = v55;
HIDWORD(v21) = *((_DWORD *)v56 + 2);
LODWORD(v32) = *((_DWORD *)v56 + 3);
LODWORD(v21) = HIDWORD(v38);
CGGameUI::SetCursorItem((CGGameUI *)v38, v21, v32, (CGGameUI *)1, 0, 1u, v34);
LODWORD(v22) = HIDWORD(v38);
CGGameUI::LockItem((CGGameUI *)v38, v22);
}
}
return 0;
}
if ( CGGameUI::m_cursorItemType != 5 )
{
if ( CGGameUI::m_cursorItemType != 10 )
goto LABEL_42;
if ( !(*((_DWORD *)&CGGuildBankInfo::m_banker + 1) | CGGuildBankInfo::m_banker) )
return 0;
v51 = 0;
v50 = 0;
CGGameUI::GetCursorVirtualItem((CGGameUI *)&v51, (unsigned int *)&v50, (unsigned int *)HIDWORD(v20));
if ( !v53 )
return 0;
SlotIndex = CGPlayer_C::FindSlotIndex(v4, *((_QWORD *)v56 + 1));
v47[0] = 0;
v47[1] = 0;
Record = WowClientDB2<ItemRecSparse_C>::GetRecord(&g_itemSparseDB, v51, v47, 0, 0, 0);
v40 = 0;
if ( v6 )
v40 = *(CGGuildBankInfo **)(*(_DWORD *)(v6 + 8) + 20);
if ( !Record )
goto LABEL_40;
v8 = *(_DWORD *)(Record + 88);
if ( !v8 )
goto LABEL_40;
if ( v40 )
{
if ( v40 != v51 )
{
LABEL_40:
v9 = 0;
if ( v40 == v53 )
{
CGGameUI::ClearCursor((CGGameUI *)1, 1, v28);
CGGameUI::UnlockVirtualItem(v51, (int)v50, 0);
return 0;
}
goto LABEL_41;
}
if ( CGGameUI::m_stackSplit )
{
v9 = (CDataStore *)(v8 - *(_DWORD *)(*(_DWORD *)(v6 + 204) + 32));
if ( (int)v9 > (int)CGGameUI::m_stackSplit )
v9 = CGGameUI::m_stackSplit;
}
else
{
VirtualItemCount = CGGameUI::GetVirtualItemCount((int)v40, v50, 0);
v9 = (CDataStore *)(v8 - *(_DWORD *)(*(_DWORD *)(v6 + 204) + 32));
if ( VirtualItemCount < (int)v9 )
v9 = (CDataStore *)CGGameUI::GetVirtualItemCount((int)v51, v50, 0);
}
}
else
{
v9 = CGGameUI::m_stackSplit;
}
LABEL_41:
CGPlayer_C::SwapGuildBankItem(v4, (unsigned int)v51, (unsigned int)v50, SlotIndex, (char)v55, (int)v9);
goto LABEL_42;
}
if ( *((_DWORD *)&CGMerchantInfo::m_merchant + 1) | CGMerchantInfo::m_merchant && CGMerchantInfo::GetItem(v52, v20) )
{
v36 = (char)v55;
v37 = *((_QWORD *)v56 + 1);
v10 = *(_DWORD *)(CGMerchantInfo::GetItem(v52, v23) + 28);
Item = CGMerchantInfo::GetItem(v52, v24);
CGPlayer_C::XBuyItem(CGMerchantInfo::m_merchant, Item, v10, v37, v36);
CGGameUI::ClearCursor((CGGameUI *)1, 1, v30);
}
}
return 0;
}
and this is how SendMail looks in the macOS dump:
Code:
int __cdecl Script_SendMail(int a1)
{
__int64 *v2; // edi
int v3; // eax
unsigned int *v4; // eax
unsigned int v5; // ebx
unsigned int v6; // esi
__int64 v7; // rax
unsigned int v8; // edi
int v9; // ebx
char *v10; // ecx
int v11; // edx
char v12; // al
char *v13; // ecx
int v14; // edx
char v15; // al
char *v16; // ecx
int v17; // edx
char v18; // al
unsigned int v19; // esi
unsigned int i; // ecx
unsigned int v21; // edx
JamCliStructMailAttachment *v22; // esi
unsigned int v23; // ebx
int v24; // ebx
int v25; // edi
int v26; // eax
int v27; // ebx
int v28; // esi
int GameError; // eax
int v30; // eax
int v31; // ebx
unsigned int v32; // eax
const JamCliStructMailAttachment *v33; // ebx
int v34; // esi
JamClientMessage *v35; // [esp+4h] [ebp-9D4h]
int v36; // [esp+28h] [ebp-9B0h]
int v37; // [esp+2Ch] [ebp-9ACh]
char *v38; // [esp+30h] [ebp-9A8h]
const char *v39; // [esp+34h] [ebp-9A4h]
const char *v40; // [esp+38h] [ebp-9A0h]
int v41; // [esp+3Ch] [ebp-99Ch]
__int64 v42; // [esp+40h] [ebp-998h]
__int64 v43; // [esp+48h] [ebp-990h]
unsigned int v44; // [esp+54h] [ebp-984h]
unsigned int v45; // [esp+58h] [ebp-980h]
JamCliStructMailAttachment *v46; // [esp+5Ch] [ebp-97Ch]
int v47; // [esp+60h] [ebp-978h]
__int64 *v48; // [esp+64h] [ebp-974h]
unsigned int v49; // [esp+68h] [ebp-970h]
unsigned int v50; // [esp+6Ch] [ebp-96Ch]
char v51[16]; // [esp+7Ch] [ebp-95Ch] BYREF
int v52; // [esp+8Ch] [ebp-94Ch]
int v53; // [esp+90h] [ebp-948h]
char v54; // [esp+94h] [ebp-944h] BYREF
char v55; // [esp+C4h] [ebp-914h] BYREF
char v56; // [esp+1C4h] [ebp-814h] BYREF
int v57; // [esp+994h] [ebp-44h]
int v58; // [esp+998h] [ebp-40h]
unsigned int v59; // [esp+99Ch] [ebp-3Ch]
unsigned int v60; // [esp+9A0h] [ebp-38h]
JamCliStructMailAttachment *v61; // [esp+9A4h] [ebp-34h]
unsigned int v62; // [esp+9A8h] [ebp-30h]
__int64 v63; // [esp+9ACh] [ebp-2Ch]
__int64 v64; // [esp+9B4h] [ebp-24h]
if ( lua_isstring(a1, 1) )
{
if ( !CGMailInfo::m_commandPending )
{
v36 = CGMailInfo::m_object;
v37 = *(&CGMailInfo::m_object + 1);
if ( CGMailInfo::m_object )
{
if ( !CGMailInfo::m_sendPending )
{
v38 = (char *)lua_tolstring(a1, 1, 0);
if ( *v38 )
{
v39 = "";
if ( lua_isstring(a1, 2) )
v39 = (const char *)lua_tolstring(a1, 2, 0);
if ( *v39 )
{
v40 = "";
if ( lua_isstring(a1, 3) )
v40 = (const char *)lua_tolstring(a1, 3, 0);
v41 = CGMailInfo::m_selectedStationery;
if ( CGMailInfo::m_selectedStationery )
{
v48 = &CGMailInfo::m_sendItems;
v2 = &CGMailInfo::m_sendItems;
v50 = 0;
v49 = 0;
do
{
if ( *v2 )
{
v3 = ClntObjMgrObjectPtr(
*(_DWORD *)v2,
*((_DWORD *)v2 + 1),
2,
(char)"/Users/patchman/buildserver/wow-b/work/WoW-code/trunk/WoW/Source/Mac/../Ui/MailInfo.cpp",
1704);
if ( !v3
|| (v4 = *(unsigned int **)(v3 + 204),
v5 = *v4,
v6 = v4[1],
LODWORD(v7) = ClntObjMgrGetActivePlayer(),
v7 != __PAIR64__(v6, v5)) )
{
GameError = CGBag_C::GetGameError(23);
CGGameUI::DisplayError(GameError, (char)v35);
if ( v50 <= 0xB )
{
v30 = 5 * v50;
*((_DWORD *)&CGMailInfo::m_sendItems + v30) = 0;
*((_DWORD *)&CGMailInfo::m_sendItems + v30 + 1) = 0;
dword_16A8E48[v30] = 0;
dword_16A8E4C[v30] = 0;
LOBYTE(dword_16A8E50[v30]) = 0;
}
FrameScript_SignalEvent(161, 0);
return 0;
}
++v49;
}
++v50;
v2 = (__int64 *)((char *)v2 + 20);
}
while ( v50 != 16 );
v8 = v49;
v9 = 0;
if ( v49 )
v9 = CGMailInfo::m_selectedPackage;
v42 = CGMailInfo::m_sendMoney;
v43 = CGMailInfo::m_sendCOD;
if ( CGMailInfo::m_sendMoney )
{
if ( CGMailInfo::m_sendCOD )
return 0;
}
else if ( CGMailInfo::m_sendCOD && !v49 )
{
return 0;
}
UserClientSendMail::UserClientSendMail((UserClientSendMail *)v51);
v52 = v36;
v53 = v37;
v10 = &v54;
v11 = 47;
while ( 1 )
{
v12 = *v38;
*v10++ = *v38++;
if ( !v12 )
break;
if ( !--v11 )
{
*v10 = 0;
break;
}
}
v13 = &v55;
v14 = 255;
while ( 1 )
{
v15 = *v39;
*v13++ = *v39++;
if ( !v15 )
break;
if ( !--v14 )
{
*v13 = 0;
break;
}
}
if ( !v40 )
SErrDisplayError(0, (int)"../../../Storm/H/SStr.inl", 111, (char)"source", 0, 1, 0);
v16 = &v56;
v17 = 1999;
while ( 1 )
{
v18 = *v40;
*v16++ = *v40++;
if ( !v18 )
break;
if ( !--v17 )
{
*v16 = 0;
break;
}
}
v57 = v41;
v58 = v9;
v19 = v60;
if ( v60 >= v49 )
{
if ( v60 > v49 )
{
v31 = 12 * v49;
do
{
JamCliStructMailAttachment::~JamCliStructMailAttachment((JamCliStructMailAttachment *)((char *)v61 + v31));
++v49;
v31 += 12;
}
while ( v60 > v49 );
}
}
else
{
if ( v59 >= v49 )
goto LABEL_58;
i = v62;
if ( v62 )
{
v21 = v49 % v62;
}
else if ( v49 > 0x14 )
{
v62 = 21;
v21 = v49 % 0x15;
i = 21;
}
else
{
for ( i = v49; (i & (i - 1)) != 0; i &= i - 1 )
;
if ( i )
{
v21 = v49 % i;
}
else
{
i = 1;
v21 = 0;
}
}
if ( v21 )
v49 = i + v49 - v21;
v46 = v61;
if ( v49 < v60 )
{
v22 = (JamCliStructMailAttachment *)((char *)v61 + 12 * v49);
v23 = v49;
do
{
JamCliStructMailAttachment::~JamCliStructMailAttachment(v22);
++v23;
v22 = (JamCliStructMailAttachment *)((char *)v22 + 12);
}
while ( v60 > v23 );
}
v59 = v49;
v61 = (JamCliStructMailAttachment *)SMemReAlloc(v46, 12 * v49, "", -2, 16);
if ( !v61 )
{
v61 = (JamCliStructMailAttachment *)SMemAlloc(12 * v49, (int)"", -2, 0);
if ( v46 )
{
v32 = v60;
if ( v49 <= v60 )
v32 = v49;
v45 = v32;
if ( v32 )
{
v33 = v46;
v47 = 0;
v34 = 0;
do
{
if ( (JamCliStructMailAttachment *)((char *)v61 + v34) )
JamCliStructMailAttachment::Copy((JamCliStructMailAttachment *)((char *)v61 + v34), v33);
JamCliStructMailAttachment::~JamCliStructMailAttachment(v33);
++v47;
v34 += 12;
v33 = (const JamCliStructMailAttachment *)((char *)v33 + 12);
}
while ( v47 != v45 );
}
v35 = (JamClientMessage *)"";
SMemFree(v46);
}
}
v19 = v60;
if ( v60 < v8 )
{
LABEL_58:
v24 = 12 * v19;
do
{
if ( (JamCliStructMailAttachment *)((char *)v61 + v24) )
JamCliStructMailAttachment::JamCliStructMailAttachment((JamCliStructMailAttachment *)((char *)v61 + v24));
++v19;
v24 += 12;
}
while ( v19 < v8 );
}
}
v60 = v8;
v25 = 0;
v44 = 0;
do
{
v27 = *(_DWORD *)v48;
v28 = *((_DWORD *)v48 + 1);
if ( *v48 )
{
if ( v44 >= v60 )
SErrDisplayErrorFmt(-2062548864, "", -2, 1, 1, "index (0x%08X), array size (0x%08X)", v44, v60);
*((_BYTE *)v61 + 12 * v44 + 8) = v25;
if ( v44 >= v60 )
SErrDisplayErrorFmt(-2062548864, "", -2, 1, 1, "index (0x%08X), array size (0x%08X)", v44, v60);
v26 = (int)v61;
*((_DWORD *)v61 + 3 * v44) = v27;
*(_DWORD *)(v26 + 12 * v44++ + 4) = v28;
}
++v25;
v48 = (__int64 *)((char *)v48 + 20);
}
while ( v25 != 16 );
v63 = v42;
v64 = v43;
ClientServices::Send((ClientServices *)v51, v35);
CGMailInfo::m_sendPending = 1;
CGMailInfo::m_commandPending = 1;
UserClientSendMail::~UserClientSendMail((UserClientSendMail *)v51);
}
}
}
}
}
}
}
else
{
luaL_error(a1, "Usage: SendMail(target, subject, body)");
}
return 0;
}
i tried passing a pointer to WoWItem for PickupContainerItem, it didn't work. i do not think that there should be parameters that are written on wowwiki. any ideas?