void WorldSession::SendTradeStatus(TradeStatusInfo const& info) { Player* trader = GetPlayer()->GetTrader(); WorldPacket data(SMSG_TRADE_STATUS, 13); data.WriteBit(trader ? (trader->GetSession()->GetBattlenetAccountId() == GetBattlenetAccountId()) : 0); // IsSameBnetAccount, used for trading heirlooms and other battle.net bound items with your other accounts data.WriteBits(info.Status, 5); switch (info.Status) { case TRADE_STATUS_BEGIN_TRADE: data.WriteBit(info.TraderGuid[2]); data.WriteBit(info.TraderGuid[4]); data.WriteBit(info.TraderGuid[6]); data.WriteBit(info.TraderGuid[0]); data.WriteBit(info.TraderGuid[1]); data.WriteBit(info.TraderGuid[3]); data.WriteBit(info.TraderGuid[7]); data.WriteBit(info.TraderGuid[5]); data.WriteByteSeq(info.TraderGuid[4]); data.WriteByteSeq(info.TraderGuid[1]); data.WriteByteSeq(info.TraderGuid[2]); data.WriteByteSeq(info.TraderGuid[3]); data.WriteByteSeq(info.TraderGuid[0]); data.WriteByteSeq(info.TraderGuid[7]); data.WriteByteSeq(info.TraderGuid[6]); data.WriteByteSeq(info.TraderGuid[5]); break; case TRADE_STATUS_OPEN_WINDOW: data << uint32(0); // CGTradeInfo::m_tradeID break; case TRADE_STATUS_CLOSE_WINDOW: data.WriteBit(info.IsTargetResult); // bool isTargetError; used for: EQUIP_ERR_BAG_FULL, EQUIP_ERR_CANT_CARRY_MORE_OF_THIS, EQUIP_ERR_MISSING_REAGENT, EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_COUNT_EXCEEDED data << uint32(info.Result); // InventoryResult data << uint32(info.ItemLimitCategoryId); // ItemLimitCategory.dbc entry break; case TRADE_STATUS_WRONG_REALM: case TRADE_STATUS_NOT_ON_TAPLIST: data << uint8(info.Slot); // Trade slot; -1 here clears CGTradeInfo::m_tradeMoney break; case TRADE_STATUS_CURRENCY: // Not implemented case TRADE_STATUS_CURRENCY_NOT_TRADABLE: // Not implemented // Blizzard never implemented these, you can only trade currency with the field9 & 1 in CurrencyTypes.DBC, and only two test currencies have that flag data << uint32(0); // Trading Currency Id data << uint32(0); // Trading Currency Amount default: data.FlushBits(); break; } SendPacket(&data); }
void WorldSession::SendTradeStatus(WorldPackets::Trade::TradeStatus& info) { info.Clear(); // reuse packet Player* trader = _player->GetTrader(); info.PartnerIsSameBnetAccount = trader && trader->GetSession()->GetBattlenetAccountId() == GetBattlenetAccountId(); SendPacket(info.Write()); }