diff options
author | pete318 <pete318@hotmail.com> | 2015-09-27 21:27:23 +0100 |
---|---|---|
committer | r00ty <pete318@hotmail.com> | 2015-09-28 22:26:23 +0200 |
commit | 01ae5c4bf6bce7e2a9a0621eb8edcf0197bc3d2c (patch) | |
tree | af09d9126eb633bf75cd387396a5349dac8a2081 /src/server/game/Handlers/AuctionHouseHandler.cpp | |
parent | fcc6ef6b1881196bbcebf5949fe682056b366b46 (diff) |
Auction house changes:
- Stop storing guid for auctioneer.
- Store instead house ID
- No separate ID for various houses. Only Horde, Alliance and Neutral.
- Removed non-needed faction checks.
- Use enum for auction house IDs
NOTE: This will expire all current auctions and return item to player (or
award to high bidder) in order to prepare database for the changes.
Diffstat (limited to 'src/server/game/Handlers/AuctionHouseHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/AuctionHouseHandler.cpp | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index aa51b19a659..0293901c9e3 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -154,7 +154,6 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) return; } - Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { @@ -259,9 +258,26 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AuctionEntry* AH = new AuctionEntry(); if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) - AH->auctioneer = 23442; ///@TODO - HARDCODED DB GUID, BAD BAD BAD + AH->houseId = AUCTIONHOUSE_NEUTRAL; else - AH->auctioneer = auctioneer.GetCounter(); + { + CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(creature->GetSpawnId()); + if (!auctioneerData) + { + TC_LOG_ERROR("misc", "Data for auctioneer not found (%s)", auctioneer.ToString().c_str()); + return; + } + + CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id); + if (!auctioneerInfo) + { + TC_LOG_ERROR("misc", "Non existing auctioneer (%s)", auctioneer.ToString().c_str()); + return; + } + + const AuctionHouseEntry* AHEntry = sAuctionMgr->GetAuctionHouseEntry(auctioneerInfo->faction); + AH->houseId = AHEntry->houseId; + } // Required stack size of auction matches to current item stack size, just move item to auctionhouse if (itemsCount == 1 && item->GetCount() == count[0]) @@ -285,8 +301,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", - _player->GetName().c_str(), _player->GetGUID().GetCounter(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUID().GetCounter(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", + _player->GetName().c_str(), _player->GetGUID().GetCounter(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUID().GetCounter(), item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); sAuctionMgr->AddAItem(item); auctionHouse->AddAuction(AH); @@ -333,8 +349,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) AH->deposit = deposit; AH->auctionHouseEntry = auctionHouseEntry; - TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", - _player->GetName().c_str(), _player->GetGUID().GetCounter(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUID().GetCounter(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); + TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", + _player->GetName().c_str(), _player->GetGUID().GetCounter(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUID().GetCounter(), newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId()); sAuctionMgr->AddAItem(newItem); auctionHouse->AddAuction(AH); |