void AuctionHouseMgr::LoadAuctionItems() { // data needs to be at first place for Item::LoadFromDB QueryResult *result = CharacterDatabase.Query( "SELECT data,itemguid,item_template FROM auctionhouse JOIN item_instance ON itemguid = guid" ); if( !result ) { barGoLink bar(1); bar.step(); sLog.outString(); sLog.outString(">> Loaded 0 auction items"); return; } barGoLink bar( result->GetRowCount() ); uint32 count = 0; Field *fields; do { bar.step(); fields = result->Fetch(); uint32 item_guid = fields[1].GetUInt32(); uint32 item_template = fields[2].GetUInt32(); ItemPrototype const *proto = objmgr.GetItemPrototype(item_template); if(!proto) { sLog.outError( "ObjectMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid,item_template); continue; } Item *item = NewItemOrBag(proto); if(!item->LoadFromDB(item_guid,0, result)) { delete item; continue; } AddAItem(item); ++count; } while( result->NextRow() ); delete result; sLog.outString(); sLog.outString( ">> Loaded %u auction items", count ); }
void AuctionHouseMgr::LoadAuctionItems() { uint32 oldMSTime = getMSTime(); // data needs to be at first place for Item::LoadFromDB PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_AUCTION_ITEMS); PreparedQueryResult result = CharacterDatabase.Query(stmt); if (!result) { sLog->outString(">> Loaded 0 auction items. DB table `auctionhouse` or `item_instance` is empty!"); sLog->outString(); return; } uint32 count = 0; do { Field* fields = result->Fetch(); uint32 item_guid = fields[11].GetUInt32(); uint32 item_template = fields[12].GetUInt32(); ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template); if (!proto) { sLog->outError("AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid,item_template); continue; } Item *item = NewItemOrBag(proto); if (!item->LoadFromDB(item_guid, 0, fields, item_template)) { delete item; continue; } AddAItem(item); ++count; } while (result->NextRow()); sLog->outString(">> Loaded %u auction items in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); sLog->outString(); }
void ObjectMgr::LoadAuctionItems() { QueryResult *result = sDatabase.Query( "SELECT `guid` FROM `auctionhouse_item`" ); if( !result ) return; Field *fields; do { fields = result->Fetch(); Item* item = new Item; if(!item->LoadFromDB(fields[0].GetUInt32(),0, 2)) continue; AddAItem(item); } while( result->NextRow() ); delete result; }