Move auction related code from ObjectMgr to AuctionHouseMgr.

This commit is contained in:
VladimirMangos 2009-02-11 04:29:49 +03:00
parent ef1c243187
commit 7c3ab4b453
12 changed files with 572 additions and 513 deletions

View file

@ -36,6 +36,7 @@
#include "World.h"
#include "AccountMgr.h"
#include "AchievementMgr.h"
#include "AuctionHouseMgr.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
#include "Chat.h"
@ -1265,8 +1266,8 @@ void World::SetInitialWorldSettings()
///- Load dynamic data tables from the database
sLog.outString( "Loading Auctions..." );
sLog.outString();
objmgr.LoadAuctionItems();
objmgr.LoadAuctions();
auctionmgr.LoadAuctionItems();
auctionmgr.LoadAuctions();
sLog.outString( ">>> Auctions loaded" );
sLog.outString();
@ -1477,13 +1478,13 @@ void World::Update(uint32 diff)
switch (i)
{
case 0:
AuctionMap = objmgr.GetAuctionsMap(AUCTION_HORDE);
AuctionMap = auctionmgr.GetAuctionsMap(AUCTION_HORDE);
break;
case 1:
AuctionMap = objmgr.GetAuctionsMap(AUCTION_ALLIANCE);
AuctionMap = auctionmgr.GetAuctionsMap(AUCTION_ALLIANCE);
break;
case 2:
AuctionMap = objmgr.GetAuctionsMap(AUCTION_NEUTRAL);
AuctionMap = auctionmgr.GetAuctionsMap(AUCTION_NEUTRAL);
break;
}
@ -1498,7 +1499,7 @@ void World::Update(uint32 diff)
///- Either cancel the auction if there was no bidder
if (itr->second->bidder == 0)
{
objmgr.SendAuctionExpiredMail( itr->second );
auctionmgr.SendAuctionExpiredMail( itr->second );
}
///- Or perform the transaction
else
@ -1506,14 +1507,14 @@ void World::Update(uint32 diff)
//we should send an "item sold" message if the seller is online
//we send the item to the winner
//we send the money to the seller
objmgr.SendAuctionSuccessfulMail( itr->second );
objmgr.SendAuctionWonMail( itr->second );
auctionmgr.SendAuctionSuccessfulMail( itr->second );
auctionmgr.SendAuctionWonMail( itr->second );
}
///- In any case clear the auction
//No SQL injection (Id is integer)
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE id = '%u'",itr->second->Id);
objmgr.RemoveAItem(itr->second->item_guidlow);
auctionmgr.RemoveAItem(itr->second->item_guidlow);
delete itr->second;
AuctionMap->RemoveAuction(itr->first);
}