コード例 #1
0
ファイル: AuctionMgr.cpp プロジェクト: Carbinfibre/ArcPro
void AuctionMgr::LoadAuctionHouses()
{
    Log.Notice("AuctionMgr", "Loading Auction Houses...");

    QueryResult* res = CharacterDatabase.Query("SELECT MAX(auctionId) FROM auctions");
    if(res)
    {
        maxId.SetVal(res->Fetch()[0].GetUInt32());
        delete res;
    }

    res = WorldDatabase.Query("SELECT DISTINCT ahgroup FROM auctionhouse");
    AuctionHouse* ah;
    map<uint32, AuctionHouse*> tempmap;
    if(res)
    {
        uint32 period = (res->GetRowCount() / 20) + 1;
        uint32 c = 0;
        do
        {
            ah = new AuctionHouse(res->Fetch()[0].GetUInt32());
            ah->LoadAuctions();
            auctionHouses.push_back(ah);
            tempmap.insert(make_pair(res->Fetch()[0].GetUInt32(), ah));
            if(!((++c) % period))
                Log.Notice("AuctionHouse", "Done %u/%u, %u%% complete.", c, res->GetRowCount(), c * 100 / res->GetRowCount());

        }
        while(res->NextRow());
        delete res;
    }

    res = WorldDatabase.Query("SELECT creature_entry, ahgroup FROM auctionhouse");
    if(res)
    {
        do
        {
            auctionHouseEntryMap.insert(make_pair(res->Fetch()[0].GetUInt32(), tempmap[res->Fetch()[1].GetUInt32()]));
        }
        while(res->NextRow());
        delete res;
    }
}
コード例 #2
0
ファイル: AuctionMgr.cpp プロジェクト: jameyboor/Antrix
void AuctionMgr::LoadAuctionHouses()
{
	sLog.outString("Loading Auction Houses...");

	QueryResult * res = CharacterDatabase.Query("SELECT MAX(auctionId) FROM auctions");
	if(res)
	{
		maxId = res->Fetch()[0].GetUInt32();
		delete res;
	}

	res = WorldDatabase.Query("SELECT DISTINCT AHid FROM auctionhouse ORDER BY AHid");
	AuctionHouse * ah;
	map<uint32, AuctionHouse*> tempmap;
	if(res)
	{
		do
		{
			ah = new AuctionHouse(res->Fetch()[0].GetUInt32());
			ah->LoadAuctions();
			auctionHouses.push_back(ah);
			tempmap.insert( make_pair( res->Fetch()[0].GetUInt32(), ah ) );
		}while(res->NextRow());
		delete res;
	}

	res = WorldDatabase.Query("SELECT auctioneer, AHid FROM auctionhouse");
	if(res)
	{
		do 
		{
			auctionHouseEntryMap.insert( make_pair( res->Fetch()[0].GetUInt32(), tempmap[res->Fetch()[1].GetUInt32()] ) );
		} while(res->NextRow());
		delete res;
	}
}
コード例 #3
0
ファイル: AuctionMgr.cpp プロジェクト: Goatform/ascent
void AuctionMgr::LoadAuctionHouses()
{
	Log.Notice("AuctionMgr", "Loading Auction Houses...");

	QueryResult * res = CharacterDatabase.Query("SELECT MAX(auctionId) FROM auctions");
	if(res)
	{
		maxId = res->Fetch()[0].GetUInt32();
		delete res;
	}

	res = WorldDatabase.Query("SELECT DISTINCT `group` FROM auctionhouse");
	AuctionHouse * ah;
	map<uint32, AuctionHouse*> tempmap;
	if(res)
	{
		do
		{
			ah = new AuctionHouse(res->Fetch()[0].GetUInt32());
			ah->LoadAuctions();
			auctionHouses.push_back(ah);
			tempmap.insert( make_pair( res->Fetch()[0].GetUInt32(), ah ) );
		}while(res->NextRow());
		delete res;
	}

	res = WorldDatabase.Query("SELECT creature_entry, `group` FROM auctionhouse");
	if(res)
	{
		do 
		{
			auctionHouseEntryMap.insert( make_pair( res->Fetch()[0].GetUInt32(), tempmap[res->Fetch()[1].GetUInt32()] ) );
		} while(res->NextRow());
		delete res;
	}
}