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; } }
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; } }
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; } }