예제 #1
0
void BlackMarketMgr::BuildBlackMarketAuctionsPacket(WorldPacket& data, uint32 guidLow)
{
    uint32 count = 0;
    ByteBuffer datas;

    data << uint32(time(NULL));

    for (BMAuctionEntryMap::const_iterator itr = GetAuctionsBegin(); itr != GetAuctionsEnd(); ++itr)
        if (itr->second->IsActive())
            ++count;

    data.WriteBits(count, 18);

    for (BMAuctionEntryMap::const_iterator itr = GetAuctionsBegin(); itr != GetAuctionsEnd(); ++itr)
    {
        BMAuctionEntry* auction = itr->second;

        if (!auction->IsActive())
            continue;

        data.WriteBit(guidLow == auction->bidder);          // Is owner

        uint64 currentBid = auction->bidder ? auction->bid : 0;
        uint64 nextBidPrice = auction->bidder ? auction->bid + GetAuctionOutBid(auction->bid) : auction->bid;
        uint64 upPrice = auction->bidder ? nextBidPrice - currentBid : 1;

        datas << uint32(auction->bm_template->itemEntry);
        datas << uint64(nextBidPrice);
        datas << uint64(currentBid);
        datas << uint32(0);                                 // Unk
        datas << uint32(auction->id);
        datas << uint32(auction->bm_template->seller);
        datas << uint64(upPrice);
        datas << uint32(auction->TimeLeft());
        datas << uint32(auction->bidderCount);
        datas << uint32(auction->bm_template->itemCount);
    }

    data.FlushBits();
    if (datas.size())
        data.append(datas);

    sLog->outInfo(LOG_FILTER_NETWORKIO, ">> Sent %u BlackMarket Auctions", count);
}
void BlackMarketMgr::BuildBlackMarketAuctionsPacket(WorldPacket& data, uint32 guidLow)
{
	uint32 count = 0;

	data << uint32(1); // unk
	data.WriteBits(count, 20); // placeholder

	for(BMAuctionEntryMap::const_iterator itr = GetAuctionsBegin(); itr != GetAuctionsEnd(); ++itr)
	{
		BMAuctionEntry* auction = itr->second;

		if (!auction->IsActive())
			continue;

		data.WriteBit((guidLow == auction->bidder));
		
		++count;
	}

	data.FlushBits();

	for(BMAuctionEntryMap::const_iterator itr = GetAuctionsBegin(); itr != GetAuctionsEnd(); ++itr)
	{
		BMAuctionEntry* auction = itr->second;

		if (!auction->IsActive())
			continue;

		data << uint32(auction->bm_template->seller); //seller
		data << uint32(auction->TimeLeft()); //time left
		data << uint64(0); //unk
		data << uint64(0); //unk
		data << uint64(auction->bid); // price
		data << uint32(auction->id); // auction id
		data << uint32(0); //unk
		data << uint32(auction->bm_template->itemCount); //stack count
		data << uint32(auction->bm_template->itemEntry); //item id
		data << uint32(0); //unk
	}

	data.PutBits<uint32>(32, count, 20);

	sLog->outInfo(LOG_FILTER_NETWORKIO, ">> Sent %u BlackMarket Auctions", count);
}