2011-10-03 14:41:19 -04:00
|
|
|
#include "cPacket_InventorySlot.h"
|
2011-12-21 15:42:34 -05:00
|
|
|
#include "cPacket_WholeInventory.h"
|
|
|
|
#include "cPacket_ItemData.h"
|
2011-10-03 14:41:19 -04:00
|
|
|
|
|
|
|
bool cPacket_InventorySlot::Send(cSocket & a_Socket)
|
|
|
|
{
|
|
|
|
unsigned int TotalSize = c_Size;
|
2011-12-21 15:42:34 -05:00
|
|
|
|
|
|
|
cPacket_ItemData Item;
|
|
|
|
|
|
|
|
TotalSize += Item.GetSize(m_ItemID);
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
char* Message = new char[TotalSize];
|
|
|
|
|
|
|
|
unsigned int i = 0;
|
2011-12-21 15:42:34 -05:00
|
|
|
AppendByte ( (char)m_PacketID, Message, i );
|
2011-10-03 14:41:19 -04:00
|
|
|
AppendByte ( m_WindowID, Message, i );
|
|
|
|
AppendShort ( m_SlotNum, Message, i );
|
2011-12-21 15:42:34 -05:00
|
|
|
|
|
|
|
|
|
|
|
Item.AppendItem(Message, i, m_ItemID, m_ItemCount, m_ItemUses);
|
|
|
|
|
2011-10-03 14:41:19 -04:00
|
|
|
|
|
|
|
bool RetVal = !cSocket::IsSocketError( SendData( a_Socket, Message, TotalSize, 0 ) );
|
|
|
|
delete [] Message;
|
|
|
|
return RetVal;
|
|
|
|
}
|