diff options
author | Paradox <none@none> | 2009-03-06 17:47:11 -0600 |
---|---|---|
committer | Paradox <none@none> | 2009-03-06 17:47:11 -0600 |
commit | 7b47d509e3a78a04b58f1b272f4b780c5c5b5ad3 (patch) | |
tree | c8d7734f8b91c32d91d9171c030e17f2a5c79790 /src/game/World.cpp | |
parent | ae540b526bb3c0ca3c5d910da515030233f8ea55 (diff) |
New AHBot plus AuctionHouse changes
--HG--
branch : trunk
Diffstat (limited to 'src/game/World.cpp')
-rw-r--r-- | src/game/World.cpp | 62 |
1 files changed, 8 insertions, 54 deletions
diff --git a/src/game/World.cpp b/src/game/World.cpp index 9a2caa078ce..1ef570fe0d7 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -37,6 +37,7 @@ #include "SkillDiscovery.h" #include "World.h" #include "AccountMgr.h" +#include "AuctionHouseMgr.h" #include "ObjectMgr.h" #include "SpellMgr.h" #include "Chat.h" @@ -278,7 +279,7 @@ bool World::HasRecentlyDisconnected(WorldSession* session) if(!session) return false; if(uint32 tolerance = getConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE)) - { + { for(DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end(); ++i) { if(difftime(i->second, time(NULL)) < tolerance) @@ -624,7 +625,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); @@ -1268,8 +1269,8 @@ void World::SetInitialWorldSettings() ///- Load dynamic data tables from the database sLog.outString( "Loading Auctions..." ); - objmgr.LoadAuctionItems(); - objmgr.LoadAuctions(); + auctionmgr.LoadAuctionItems(); + auctionmgr.LoadAuctions(); sLog.outString( "Loading Guilds..." ); objmgr.LoadGuilds(); @@ -1513,7 +1514,7 @@ void World::Update(time_t diff) if (m_timers[WUPDATE_AUCTIONS].Passed()) { AuctionHouseBot(); - m_timers[WUPDATE_AUCTIONS].Reset(); + m_timers[WUPDATE_AUCTIONS].Reset(); ///- Update mails (return old mails with item, or delete them) //(tested... works on win) @@ -1522,55 +1523,8 @@ void World::Update(time_t diff) mail_timer = 0; objmgr.ReturnOrDeleteOldMails(true); } - - AuctionHouseObject* AuctionMap; - for (int i = 0; i < 3; i++) - { - switch (i) - { - case 0: - AuctionMap = objmgr.GetAuctionsMap( 6 );//horde - break; - case 1: - AuctionMap = objmgr.GetAuctionsMap( 2 );//alliance - break; - case 2: - AuctionMap = objmgr.GetAuctionsMap( 7 );//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); |