16.07.2012, 11:51 | #1 |
MaNGOS Dev
Регистрация: 16.01.2011
Сообщений: 262
Сказал(а) спасибо: 57
Поблагодарили 73 раз(а) в 59 сообщениях
|
SMSG_TRADE_ITEM_EXTENDED (15595)
Набросал хендлер для SMSG_TRADE_STATUS_EXTENDED
http://paste2.org/p/2075442 Код:
void WorldSession::SendUpdateTrade(bool trader_state /*= true*/) { TradeData* view_trade = trader_state ? _player->GetTradeData()->GetTraderData() : _player->GetTradeData(); WorldPacket data(SMSG_TRADE_STATUS_EXTENDED, (100)); // guess size data << uint32(0); // added in 2.4.0, this value must be equal to value from TRADE_STATUS_OPEN_WINDOW status packet (different value for different players to block multiple trades?) data << uint32(0); // unk 2 data << uint64(view_trade->GetMoney()); // trader gold data << uint32(view_trade->GetSpell()); // spell casted on lowest slot item data << uint32(TRADE_SLOT_COUNT); // trade slots count/number?, = next field in most cases data << uint32(0); // unk 5 data << uint8(trader_state ? 1 : 0); // send trader or own trade windows state (last need for proper show spell apply to non-trade slot) data << uint32(TRADE_SLOT_COUNT); // trade slots count/number?, = prev field in most cases uint8 itemCount = 0; for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) if (Item* item = view_trade->GetItem(TradeSlots(i))) ++itemCount; data.WriteBits(itemCount, 22); uint8 creatorGuidMask[] = { 7, 1, 4, 6, 2, 3, 5, 0 }; uint8 giftCreatorGuidMask[] = { 7, 1, 3, 6, 4, 2, 0, 5 }; uint8 creatorGuidBytes[] = { 1, 6, 2, 7, 4, 3, 0, 5 }; uint8 giftCreatorGuidBytes[] = { 6, 1, 7, 4, 0, 5, 2, 3 }; for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) { if (Item* item = view_trade->GetItem(TradeSlots(i))) { ObjectGuid creatorGuid = item->GetGuidValue(ITEM_FIELD_CREATOR); ObjectGuid giftCreatorGuid = item->GetGuidValue(ITEM_FIELD_GIFTCREATOR); data.WriteGuidMask(giftCreatorGuid, giftCreatorGuidMask, 2, 0); data.WriteBit(!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED)); data.WriteGuidMask(giftCreatorGuid, giftCreatorGuidMask, 1, 2); if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED)) { data.WriteGuidMask(creatorGuid, creatorGuidMask, 7, 0); data.WriteBit(item->GetProto()->LockID && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_UNLOCKED)); data.WriteGuidMask(creatorGuid, creatorGuidMask, 1, 7); } data.WriteGuidMask(giftCreatorGuid, giftCreatorGuidMask, 5, 3); } } for (uint8 i = 0; i < TRADE_SLOT_COUNT; ++i) { if (Item* item = view_trade->GetItem(TradeSlots(i))) { ObjectGuid creatorGuid = item->GetGuidValue(ITEM_FIELD_CREATOR); ObjectGuid giftCreatorGuid = item->GetGuidValue(ITEM_FIELD_GIFTCREATOR); if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_DYNFLAG_WRAPPED)) { data.WriteGuidBytes(creatorGuid, creatorGuidBytes, 1, 0); data << uint32(item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT)); for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) data << uint32(item->GetEnchantmentId(EnchantmentSlot(enchant_slot))); data << uint32(item->GetUInt32Value(ITEM_FIELD_MAXDURABILITY)); data.WriteGuidBytes(creatorGuid, creatorGuidBytes, 4, 1); data << uint32(0); // reforge Id data << uint32(item->GetUInt32Value(ITEM_FIELD_DURABILITY)); data << uint32(item->GetItemRandomPropertyId()); data.WriteGuidBytes(creatorGuid, creatorGuidBytes, 1, 5); data << uint32(0); // UnkInt32_4 data.WriteGuidBytes(creatorGuid, creatorGuidBytes, 1, 6); data << uint32(item->GetSpellCharges()); // charges data << uint32(item->GetItemSuffixFactor()); data.WriteGuidBytes(creatorGuid, creatorGuidBytes, 1, 7); } data.WriteGuidBytes(giftCreatorGuid, giftCreatorGuidBytes, 4, 0); data << uint32(item->GetProto()->ItemId); // entry data.WriteGuidBytes(giftCreatorGuid, giftCreatorGuidBytes, 1, 4); data << uint32(item->GetCount()); // stack count data.WriteGuidBytes(giftCreatorGuid, giftCreatorGuidBytes, 1, 5); data << uint8(i); data.WriteGuidBytes(giftCreatorGuid, giftCreatorGuidBytes, 2, 6); } } SendPacket(&data); } Последний раз редактировалось Amaru; 17.07.2012 в 13:06. |
|
|
Похожие темы | ||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
IDB WoW 5.2.0 Build 16650 | TOM_RUS | Копаем клиент | 74 | 26.03.2016 03:04 |