Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. ByteBuffer& operator<<(ByteBuffer& b, LootItem const& li)
  2. {
  3.     b << uint32(li.itemid);
  4.     b << uint32(li.count);                                  // nr of items of this type
  5.     b << uint32(ObjectMgr::GetItemPrototype(li.itemid)->DisplayInfoID);
  6.     b << int32(li.randomSuffix);
  7.     b << uint32(li.randomPropertyId);
  8.     return b;
  9. }
  10.  
  11. ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv)
  12. {
  13.     if (lv.permission == NONE_PERMISSION)
  14.     {
  15.         b << uint32(0);                                     //gold
  16.         b << uint8(0);                                      // item count
  17.         b << uint8(0);                                      // unk
  18.         return b;                                           // nothing output more
  19.     }
  20.  
  21.     Loot &l = lv.loot;
  22.  
  23.     uint8 itemsShown = 0;
  24.  
  25.     //gold
  26.     b << uint32(l.gold);
  27.  
  28.     size_t count_pos = b.wpos();                            // pos of item count byte
  29.     b << uint8(0);                                          // item count placeholder
  30.     b << uint8(0);                                          // unk
  31.  
  32.     // тут код формирующий предметы для лута
  33.  
  34.     b << uint8(i) << l.items[i];
  35.     b << uint8(slot_type);
  36. }
  37.  
  38. // Формирование самого пакета
  39. {
  40.     WorldPacket data(SMSG_LOOT_RESPONSE, (8+1+50));
  41.  
  42.     data << uint64(guid);
  43.     data << uint8(loot_type);
  44.     data << LootView(*loot, this, permission);
  45.  
  46.     SendDirectMessage(&data);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement