diff options
| author | jackpoz <giacomopoz@gmail.com> | 2014-09-30 21:25:58 +0200 |
|---|---|---|
| committer | jackpoz <giacomopoz@gmail.com> | 2014-09-30 21:25:58 +0200 |
| commit | 5150222f19c40958d364f7f1118f6f211176d114 (patch) | |
| tree | 81c3200bcd0ac73076879f9d97e12aa8ec0783b6 /src/server/game/AuctionHouse/AuctionHouseMgr.cpp | |
| parent | 6daba66baf70d45e3b8ce681f588e4e9349d63ab (diff) | |
Revert "Core/AuctionHouse: Delete expired auctions at startup."
This reverts commit a92038feaf440abe797ee4b0344612b6176e43a8 which caused items of expired auctions not being mailed back to the owner and leaving those items in item_instance table.
Please refer to the forum for steps to verify the integrity of your database and remove old unneeded rows in item_instance table.
Fixes #12699
Diffstat (limited to 'src/server/game/AuctionHouse/AuctionHouseMgr.cpp')
| -rw-r--r-- | src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 118 |
1 files changed, 0 insertions, 118 deletions
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 015109e70ee..3c27453fa7e 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -737,124 +737,6 @@ bool AuctionEntry::LoadFromDB(Field* fields) } return true; } - -void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() -{ - // Deletes expired auctions. Should be called at server start before loading auctions. - - // DO NOT USE after auctions are already loaded since this deletes from the DB - // and assumes the auctions HAVE NOT been loaded into a list or AuctionEntryMap yet - - uint32 oldMSTime = getMSTime(); - uint32 expirecount = 0; - time_t curTime = sWorld->GetGameTime(); - - // Query the DB to see if there are any expired auctions - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_EXPIRED_AUCTIONS); - stmt->setUInt32(0, (uint32)curTime+60); - PreparedQueryResult expAuctions = CharacterDatabase.Query(stmt); - - if (!expAuctions) - { - TC_LOG_INFO("server.loading", ">> No expired auctions to delete"); - - return; - } - - do - { - Field* fields = expAuctions->Fetch(); - - AuctionEntry* auction = new AuctionEntry(); - - // Can't use LoadFromDB() because it assumes the auction map is loaded - if (!auction->LoadFromFieldList(fields)) - { - // For some reason the record in the DB is broken (possibly corrupt - // faction info). Delete the object and move on. - delete auction; - continue; - } - - SQLTransaction trans = CharacterDatabase.BeginTransaction(); - - if (auction->bidder==0) - { - // Cancel the auction, there was no bidder - sAuctionMgr->SendAuctionExpiredMail(auction, trans); - } - else - { - // Send the item to the winner and money to seller - sAuctionMgr->SendAuctionSuccessfulMail(auction, trans); - sAuctionMgr->SendAuctionWonMail(auction, trans); - } - - // Call the appropriate AuctionHouseObject script - // ** Do we need to do this while core is still loading? ** - sScriptMgr->OnAuctionExpire(GetAuctionsMap(auction->factionTemplateId), auction); - - // Delete the auction from the DB - auction->DeleteFromDB(trans); - CharacterDatabase.CommitTransaction(trans); - - // Release memory - delete auction; - ++expirecount; - - } - while (expAuctions->NextRow()); - - TC_LOG_INFO("server.loading", ">> Deleted %u expired auctions in %u ms", expirecount, GetMSTimeDiffToNow(oldMSTime)); - - -} - -bool AuctionEntry::LoadFromFieldList(Field* fields) -{ - // Loads an AuctionEntry item from a field list. Unlike "LoadFromDB()", this one - // does not require the AuctionEntryMap to have been loaded with items. It simply - // acts as a wrapper to fill out an AuctionEntry struct from a field list - - Id = fields[0].GetUInt32(); - auctioneer = fields[1].GetUInt32(); - itemGUIDLow = fields[2].GetUInt32(); - itemEntry = fields[3].GetUInt32(); - itemCount = fields[4].GetUInt32(); - owner = fields[5].GetUInt32(); - buyout = fields[6].GetUInt32(); - expire_time = fields[7].GetUInt32(); - bidder = fields[8].GetUInt32(); - bid = fields[9].GetUInt32(); - startbid = fields[10].GetUInt32(); - deposit = fields[11].GetUInt32(); - - CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(auctioneer); - if (!auctioneerData) - { - TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u)", Id, auctioneer); - return false; - } - - CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id); - if (!auctioneerInfo) - { - TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has not a existing auctioneer (GUID : %u Entry: %u)", Id, auctioneer, auctioneerData->id); - return false; - } - - factionTemplateId = auctioneerInfo->faction; - auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(factionTemplateId); - - if (!auctionHouseEntry) - { - TC_LOG_ERROR("misc", "AuctionEntry::LoadFromFieldList() - Auction %u has auctioneer (GUID : %u Entry: %u) with wrong faction %u", Id, auctioneer, auctioneerData->id, factionTemplateId); - return false; - } - - return true; -} - std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const { std::ostringstream strm; |
