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