diff options
author | megamage <none@none> | 2009-02-13 19:50:20 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-02-13 19:50:20 -0600 |
commit | a72c0d223d41bcea12a320b0f6b021b0367aef43 (patch) | |
tree | 8b1b4d71a39fe28d8a4dda8b42292d4f2ea5a94a /src/game/World.cpp | |
parent | 468132696af25b8192320635970f53cc447297e7 (diff) |
[7266] Use DBC data for auction cut/deposit percents and location (auiction house id in fact).
More auction related code refactoring,
Move auction related code from ObjectMgr to AuctionHouseMgr.
Author: VladimirMangos
--HG--
branch : trunk
Diffstat (limited to 'src/game/World.cpp')
-rw-r--r-- | src/game/World.cpp | 57 |
1 files changed, 6 insertions, 51 deletions
diff --git a/src/game/World.cpp b/src/game/World.cpp index 97938058d27..bad4eeef0c2 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -38,6 +38,7 @@ #include "World.h" #include "AccountMgr.h" #include "AchievementMgr.h" +#include "AuctionHouseMgr.h" #include "ObjectMgr.h" #include "SpellMgr.h" #include "Chat.h" @@ -609,7 +610,7 @@ void World::LoadConfigSettings(bool reload) m_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL] = sConfig.GetBoolDefault("AllowTwoSide.Interaction.Channel",false); m_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP] = sConfig.GetBoolDefault("AllowTwoSide.Interaction.Group",false); m_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD] = sConfig.GetBoolDefault("AllowTwoSide.Interaction.Guild",false); - m_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION] = sConfig.GetBoolDefault("AllowTwoSide.Interaction.Auction",false); + m_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION] = sConfig.GetBoolDefault("AllowTwoSide.Interaction.Auction",false); m_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL] = sConfig.GetBoolDefault("AllowTwoSide.Interaction.Mail",false); m_configs[CONFIG_ALLOW_TWO_SIDE_WHO_LIST] = sConfig.GetBoolDefault("AllowTwoSide.WhoList", false); m_configs[CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND] = sConfig.GetBoolDefault("AllowTwoSide.AddFriend", false); @@ -1317,8 +1318,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(); @@ -1579,54 +1580,8 @@ void World::Update(uint32 diff) objmgr.ReturnOrDeleteOldMails(true); } - AuctionHouseObject* AuctionMap; - for (int i = 0; i < 3; i++) - { - switch (i) - { - case 0: - AuctionMap = objmgr.GetAuctionsMap(AUCTION_HORDE); - break; - case 1: - AuctionMap = objmgr.GetAuctionsMap(AUCTION_ALLIANCE); - break; - case 2: - AuctionMap = objmgr.GetAuctionsMap(AUCTION_NEUTRAL); - break; - } - - ///- Handle expired auctions - AuctionHouseObject::AuctionEntryMap::iterator itr,next; - for (itr = AuctionMap->GetAuctionsBegin(); itr != AuctionMap->GetAuctionsEnd();itr = next) - { - next = itr; - ++next; - if (m_gameTime > (itr->second->time)) - { - ///- Either cancel the auction if there was no bidder - if (itr->second->bidder == 0) - { - objmgr.SendAuctionExpiredMail( itr->second ); - } - ///- Or perform the transaction - else - { - //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 ); - } - - ///- 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); - delete itr->second; - AuctionMap->RemoveAuction(itr->first); - } - } - } + ///- Handle expired auctions + auctionmgr.Update(); } RecordTimeDiff(NULL); |