2012-01-29 11:28:19 -08:00
|
|
|
|
|
|
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
|
|
|
|
2011-10-03 11:41:19 -07:00
|
|
|
#include "cPacket_WindowClick.h"
|
2011-12-21 12:42:34 -08:00
|
|
|
#include "cPacket_WholeInventory.h"
|
|
|
|
#include "cPacket_ItemData.h"
|
2011-10-03 11:41:19 -07:00
|
|
|
|
2012-01-29 11:28:19 -08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-07 12:49:52 -08:00
|
|
|
int cPacket_WindowClick::Parse(const char * a_Data, int a_Size)
|
2011-10-03 11:41:19 -07:00
|
|
|
{
|
2012-02-07 12:49:52 -08:00
|
|
|
int TotalBytes = 0;
|
|
|
|
HANDLE_PACKET_READ(ReadByte, m_WindowID, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadShort, m_SlotNum, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadByte, m_RightMouse, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadShort, m_NumClicks, TotalBytes);
|
|
|
|
HANDLE_PACKET_READ(ReadBool, m_Bool, TotalBytes);
|
2011-10-03 11:41:19 -07:00
|
|
|
|
2012-02-07 12:49:52 -08:00
|
|
|
// LOG("WindowClick: WindowID: %i; FromSlot: %i; Right/Le: %i; NumClick: %i", m_Type, m_SlotNum, m_RightMouse, m_NumClicks );
|
2011-10-03 11:41:19 -07:00
|
|
|
|
2011-12-21 12:42:34 -08:00
|
|
|
cPacket_ItemData Item;
|
|
|
|
|
2012-02-07 12:49:52 -08:00
|
|
|
int res = Item.Parse(a_Data + TotalBytes, a_Size - TotalBytes);
|
|
|
|
if (res < 0)
|
|
|
|
{
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
TotalBytes += res;
|
2011-12-21 12:42:34 -08:00
|
|
|
|
2012-02-07 12:49:52 -08:00
|
|
|
m_ItemID = Item.m_ItemID;
|
2011-12-21 12:42:34 -08:00
|
|
|
m_ItemCount = Item.m_ItemCount;
|
2012-02-07 12:49:52 -08:00
|
|
|
m_ItemUses = Item.m_ItemUses;
|
2011-12-21 12:42:34 -08:00
|
|
|
|
|
|
|
m_EnchantNums = Item.m_EnchantNums;
|
2011-10-03 11:41:19 -07:00
|
|
|
|
2012-02-07 12:49:52 -08:00
|
|
|
return TotalBytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|