TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ItemPackets.cpp File Reference
#include "ItemPackets.h"
#include "Player.h"
+ Include dependency graph for ItemPackets.cpp:

Functions

ByteBufferoperator<< (ByteBuffer &data, WorldPackets::Item::ItemPurchaseRefundItem &refundItem)
 
ByteBufferoperator<< (ByteBuffer &data, WorldPackets::Item::ItemPurchaseRefundCurrency &refundCurrency)
 
ByteBufferoperator<< (ByteBuffer &data, WorldPackets::Item::ItemPurchaseContents &purchaseContents)
 
ByteBufferoperator<< (ByteBuffer &data, WorldPackets::Item::ItemBonusInstanceData const &itemBonusInstanceData)
 
ByteBufferoperator>> (ByteBuffer &data, Optional< WorldPackets::Item::ItemBonusInstanceData > &itemBonusInstanceData)
 
ByteBufferoperator<< (ByteBuffer &data, WorldPackets::Item::ItemInstance const &itemInstance)
 
ByteBufferoperator>> (ByteBuffer &data, WorldPackets::Item::ItemInstance &itemInstance)
 
ByteBufferoperator>> (ByteBuffer &data, WorldPackets::Item::TransmogrifyItem &transmogItem)
 

Function Documentation

ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::Item::ItemPurchaseRefundItem refundItem 
)
75 {
76  data << refundItem.ItemID;
77  data << refundItem.ItemCount;
78 
79  return data;
80 }
int32 ItemCount
Definition: ItemPackets.h:121
int32 ItemID
Definition: ItemPackets.h:120
ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::Item::ItemPurchaseRefundCurrency refundCurrency 
)
83 {
84  data << refundCurrency.CurrencyID;
85  data << refundCurrency.CurrencyCount;
86 
87  return data;
88 }
int32 CurrencyID
Definition: ItemPackets.h:126
int32 CurrencyCount
Definition: ItemPackets.h:127
ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::Item::ItemPurchaseContents purchaseContents 
)
91 {
92  data << purchaseContents.Money;
93  for (uint32 i = 0; i < 5; ++i)
94  data << purchaseContents.Items[i];
95 
96  for (uint32 i = 0; i < 5; ++i)
97  data << purchaseContents.Currencies[i];
98 
99  return data;
100 }
uint32_t uint32
Definition: Define.h:150
ItemPurchaseRefundCurrency Currencies[5]
Definition: ItemPackets.h:134
uint32 Money
Definition: ItemPackets.h:132
ItemPurchaseRefundItem Items[5]
Definition: ItemPackets.h:133
ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::Item::ItemBonusInstanceData const itemBonusInstanceData 
)
167 {
168  data << itemBonusInstanceData.Context;
169  data << uint32(itemBonusInstanceData.BonusListIDs.size());
170  for (uint32 bonusID : itemBonusInstanceData.BonusListIDs)
171  data << bonusID;
172 
173  return data;
174 }
uint32_t uint32
Definition: Define.h:150
uint32_t uint32
Definition: g3dmath.h:168
ByteBuffer& operator<< ( ByteBuffer data,
WorldPackets::Item::ItemInstance const itemInstance 
)
196 {
197  data << int32(itemInstance.ItemID);
198  data << int32(itemInstance.RandomPropertiesSeed);
199  data << int32(itemInstance.RandomPropertiesID);
200 
201  data.WriteBit(itemInstance.ItemBonus.is_initialized());
202  data.WriteBit(itemInstance.Modifications.is_initialized());
203  data.FlushBits();
204 
205  if (itemInstance.ItemBonus)
206  data << *itemInstance.ItemBonus;
207 
208  if (itemInstance.Modifications)
209  data << *itemInstance.Modifications;
210 
211  return data;
212 }
void FlushBits()
Definition: ByteBuffer.h:150
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
int32_t int32
Definition: g3dmath.h:167

+ Here is the call graph for this function:

ByteBuffer& operator>> ( ByteBuffer data,
Optional< WorldPackets::Item::ItemBonusInstanceData > &  itemBonusInstanceData 
)
177 {
178  uint32 bonusListIdSize;
179 
180  itemBonusInstanceData = boost::in_place();
181 
182  data >> itemBonusInstanceData->Context;
183  data >> bonusListIdSize;
184 
185  for (uint32 i = 0u; i < bonusListIdSize; ++i)
186  {
187  uint32 bonusId;
188  data >> bonusId;
189  itemBonusInstanceData->BonusListIDs.push_back(bonusId);
190  }
191 
192  return data;
193 }
uint32_t uint32
Definition: Define.h:150
ByteBuffer& operator>> ( ByteBuffer data,
WorldPackets::Item::ItemInstance itemInstance 
)
215 {
216  data >> itemInstance.ItemID;
217  data >> itemInstance.RandomPropertiesSeed;
218  data >> itemInstance.RandomPropertiesID;
219 
220  bool const hasItemBonus = data.ReadBit();
221  bool const hasModifications = data.ReadBit();
222 
223  if (hasItemBonus)
224  data >> itemInstance.ItemBonus;
225 
226  if (hasModifications)
227  {
228  WorldPackets::CompactArray<int32> modifications;
229  data >> modifications;
230  itemInstance.Modifications = std::move(modifications);
231  }
232 
233  return data;
234 }
Optional< CompactArray< int32 > > Modifications
Definition: ItemPackets.h:50
uint32 RandomPropertiesSeed
Definition: ItemPackets.h:47
Definition: PacketUtilities.h:133
uint32 RandomPropertiesID
Definition: ItemPackets.h:48
Optional< ItemBonusInstanceData > ItemBonus
Definition: ItemPackets.h:49
bool ReadBit()
Definition: ByteBuffer.h:186
uint32 ItemID
Definition: ItemPackets.h:46

+ Here is the call graph for this function:

ByteBuffer& operator>> ( ByteBuffer data,
WorldPackets::Item::TransmogrifyItem transmogItem 
)
500 {
501  if (data.ReadBit())
502  transmogItem.SrcItemGUID = boost::in_place();
503 
504  if (data.ReadBit())
505  transmogItem.SrcVoidItemGUID = boost::in_place();
506 
507  data >> transmogItem.Item;
508  data >> transmogItem.Slot;
509 
510  if (transmogItem.SrcItemGUID.is_initialized())
511  data >> *transmogItem.SrcItemGUID;
512 
513  if (transmogItem.SrcVoidItemGUID.is_initialized())
514  data >> *transmogItem.SrcVoidItemGUID;
515 
516  return data;
517 }
uint32 Slot
Definition: ItemPackets.h:476
Optional< ObjectGuid > SrcItemGUID
Definition: ItemPackets.h:473
Optional< ObjectGuid > SrcVoidItemGUID
Definition: ItemPackets.h:474
ItemInstance Item
Definition: ItemPackets.h:475
bool ReadBit()
Definition: ByteBuffer.h:186

+ Here is the call graph for this function: