コード例 #1
0
void AuctionHouse::SendOwnerListPacket(Player * plr, WorldPacket * packet)
{
	uint32 count = 0;

	WorldPacket data( SMSG_AUCTION_OWNER_LIST_RESULT, 1024);
	data << uint32(0);										  // Placeholder

	Auction * auct;
	auctionLock.AcquireReadLock();
	HM_NAMESPACE::hash_map<uint32, Auction*>::iterator itr = auctions.begin();
	for(; itr != auctions.end(); ++itr)
	{
		auct = itr->second;
		if(auct->Owner == plr->GetGUID())
		{
			if(auct->Deleted) continue;

			auct->AddToPacket(data);
			(*(uint32*)&data.contents()[0])++;
			++count;
		}			
	}
	data << count;
#ifdef USING_BIG_ENDIAN
	swap32((uint32*)&data.contents()[0]);
#endif
	auctionLock.ReleaseReadLock();
	plr->GetSession()->SendPacket(&data);
}
コード例 #2
0
ファイル: AuctionHouse.cpp プロジェクト: Lbniese/AscEmu
void AuctionHouse::SendBidListPacket(Player* plr, WorldPacket* packet)
{
    uint32 count = 0;

    WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, 1024);
    data << uint32(0);                                  // Placeholder

    Auction* auct;
    auctionLock.AcquireReadLock();
    std::unordered_map<uint32, Auction*>::iterator itr = auctions.begin();
    for (; itr != auctions.end(); ++itr)
    {
        auct = itr->second;
        if (auct->HighestBidder == plr->GetGUID())
        {
            if (auct->Deleted) continue;

            auct->AddToPacket(data);
            (*(uint32*)&data.contents()[0])++;
            ++count;
        }
    }

    data << count;
    auctionLock.ReleaseReadLock();
    plr->GetSession()->SendPacket(&data);
}