Drop the manual passing through the data to not get confused, use the same struct instead, both on client and server:
// Server: input_main.cpp -> int CInputMain::Shop
case SHOP_SUBHEADER_CG_SELL2:
{
const TPacketCGShopSell* p = reinterpret_cast<const TPacketCGShopSell*>(c_pData);
sys_log(0, "INPUT: %s SHOP: SELL2", ch->GetName());
CShopManager::instance().Sell(ch, p->wPos, p->wCount, p->bType);
return sizeof(TPacketCGShopSell);
}
// Server & Client: packet.h
typedef struct command_shop_sell
{
WORD wPos;
WORD wCount;
BYTE bType;
} TPacketCGShopSell;
// Client: PythonNetworkStreamPhaseGameItem.cpp
bool CPythonNetworkStream::SendShopSellPacketNew(WORD wSlot, WORD wCount, BYTE byType)
{
if (!__CanActMainInstance())
return true;
TPacketCGShop PacketShop;
PacketShop.header = HEADER_CG_SHOP;
PacketShop.subheader = SHOP_SUBHEADER_CG_SELL2;
if (!Send(sizeof(TPacketCGShop), &PacketShop))
{
Tracef("PacketCGShop Error\n");
return false;
}
TPacketCGShopSell SellPacket;
SellPacket.bType = byType;
SellPacket.wCount = wCount;
SellPacket.wPos = wSlot;
if (!Send(sizeof(TPacketCGShopSell), &SellPacket))
{
Tracef("PacketCGShopSell Error\n");
return false;
}
Tracef(" SendShopSellPacketNew(wSlot=%d, byCount=%d, byType=%d)\n", wSlot, wCount, byType);
return SendSequence();
}
// Client: PythonNetworkStreamModule.cpp
PyObject* netSendShopSellPacketNew(PyObject* poSelf, PyObject* poArgs)
{
int iSlotNumber;
if (!PyTuple_GetInteger(poArgs, 0, &iSlotNumber))
return Py_BuildException();
int iCount;
if (!PyTuple_GetInteger(poArgs, 1, &iCount))
return Py_BuildException();
int iType;
if (!PyTuple_GetInteger(poArgs, 2, &iType))
return Py_BuildException();
CPythonNetworkStream& rkNetStream = CPythonNetworkStream::Instance();
rkNetStream.SendShopSellPacketNew(iSlotNumber, iCount, iType);
return Py_BuildNone();
}
[...]
void initnet()
{
static PyMethodDef s_methods[] =
{
[...]
{ "SendShopSellPacketNew", netSendShopSellPacketNew, METH_VARARGS },
[...]
{ NULL, NULL, NULL },
};
And double-check the way you're calling the function from python, make sure to pass the correct inventory type inside iType