aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.cpp53
-rw-r--r--src/server/game/AuctionHouse/AuctionHouseMgr.h22
-rw-r--r--src/server/game/Handlers/AuctionHouseHandler.cpp130
-rw-r--r--src/server/game/Server/Protocol/Opcodes.cpp30
-rwxr-xr-xsrc/server/game/Server/Protocol/Opcodes.h4
-rwxr-xr-xsrc/server/game/Server/WorldSession.h3
6 files changed, 135 insertions, 107 deletions
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
index 952c49ffdf5..4c934991d44 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp
@@ -89,7 +89,7 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
//does not clear ram
void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans)
{
- Item* pItem = GetAItem(auction->item_guidlow);
+ Item* pItem = GetAItem(auction->itemGUIDLow);
if (!pItem)
return;
@@ -143,7 +143,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
if (bidder)
{
- bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->item_template);
+ bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidder_guid, 0, 0, auction->itemEntry);
// FIXME: for offline player need also
bidder->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
}
@@ -195,7 +195,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans)
{
//return an item in auction to its owner by mail
- Item* pItem = GetAItem(auction->item_guidlow);
+ Item* pItem = GetAItem(auction->itemGUIDLow);
if (!pItem)
return;
@@ -228,7 +228,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
if (oldBidder || oldBidder_accId)
{
if (oldBidder && newBidder)
- oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->item_template);
+ oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->itemEntry);
MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
.AddMoney(auction->bid)
@@ -237,7 +237,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
}
//this function sends mail, when auction is cancelled to old bidder
-void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans)
+void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans, Item* item)
{
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
Player* bidder = ObjectAccessor::FindPlayer(bidder_guid);
@@ -246,6 +246,9 @@ void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQ
if (!bidder)
bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid);
+ if (bidder)
+ bidder->GetSession()->SendAuctionRemovedNotification(auction->Id, auction->itemEntry, item->GetItemRandomPropertyId());
+
// bidder exist
if (bidder || bidder_accId)
MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELLED_TO_BIDDER), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, 0))
@@ -275,17 +278,17 @@ void AuctionHouseMgr::LoadAuctionItems()
Field* fields = result->Fetch();
uint32 item_guid = fields[11].GetUInt32();
- uint32 item_template = fields[12].GetUInt32();
+ uint32 itemEntry = fields[12].GetUInt32();
- ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template);
+ ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemEntry);
if (!proto)
{
- sLog->outError(LOG_FILTER_GENERAL, "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, itemEntry);
continue;
}
Item* item = NewItemOrBag(proto);
- if (!item->LoadFromDB(item_guid, 0, fields, item_template))
+ if (!item->LoadFromDB(item_guid, 0, fields, itemEntry))
{
delete item;
continue;
@@ -411,7 +414,7 @@ void AuctionHouseObject::AddAuction(AuctionEntry* auction)
sScriptMgr->OnAuctionAdd(this, auction);
}
-bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*item_template*/)
+bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*itemEntry*/)
{
bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false;
@@ -465,14 +468,14 @@ void AuctionHouseObject::Update()
sScriptMgr->OnAuctionSuccessful(this, auction);
}
- uint32 item_template = auction->item_template;
+ uint32 itemEntry = auction->itemEntry;
///- In any case clear the auction
auction->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
- RemoveAuction(auction, item_template);
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
+ RemoveAuction(auction, itemEntry);
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
}
while (result->NextRow());
}
@@ -518,7 +521,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
{
AuctionEntry* Aentry = itr->second;
- Item* item = sAuctionMgr->GetAItem(Aentry->item_guidlow);
+ Item* item = sAuctionMgr->GetAItem(Aentry->itemGUIDLow);
if (!item)
continue;
@@ -601,10 +604,10 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
//this function inserts to WorldPacket auction's data
bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
{
- Item* item = sAuctionMgr->GetAItem(item_guidlow);
+ Item* item = sAuctionMgr->GetAItem(itemGUIDLow);
if (!item)
{
- sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, item_guidlow);
+ sLog->outError(LOG_FILTER_GENERAL, "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: %u", Id, itemGUIDLow);
return false;
}
data << uint32(Id);
@@ -658,7 +661,7 @@ void AuctionEntry::SaveToDB(SQLTransaction& trans) const
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_AUCTION);
stmt->setUInt32(0, Id);
stmt->setUInt32(1, auctioneer);
- stmt->setUInt32(2, item_guidlow);
+ stmt->setUInt32(2, itemGUIDLow);
stmt->setUInt32(3, owner);
stmt->setInt32 (4, int32(buyout));
stmt->setUInt64(5, uint64(expire_time));
@@ -673,8 +676,8 @@ bool AuctionEntry::LoadFromDB(Field* fields)
{
Id = fields[0].GetUInt32();
auctioneer = fields[1].GetUInt32();
- item_guidlow = fields[2].GetUInt32();
- item_template = fields[3].GetUInt32();
+ itemGUIDLow = fields[2].GetUInt32();
+ itemEntry = fields[3].GetUInt32();
itemCount = fields[4].GetUInt32();
owner = fields[5].GetUInt32();
buyout = fields[6].GetUInt32();
@@ -707,10 +710,10 @@ bool AuctionEntry::LoadFromDB(Field* fields)
}
// check if sold item exists for guid
- // and item_template in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
- if (!sAuctionMgr->GetAItem(item_guidlow))
+ // and itemEntry in fact (GetAItem will fail if problematic in result check in AuctionHouseMgr::LoadAuctionItems)
+ if (!sAuctionMgr->GetAItem(itemGUIDLow))
{
- sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing item : %u", Id, item_guidlow);
+ sLog->outError(LOG_FILTER_GENERAL, "Auction %u has not a existing item : %u", Id, itemGUIDLow);
return false;
}
return true;
@@ -795,8 +798,8 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
Id = fields[0].GetUInt32();
auctioneer = fields[1].GetUInt32();
- item_guidlow = fields[2].GetUInt32();
- item_template = fields[3].GetUInt32();
+ itemGUIDLow = fields[2].GetUInt32();
+ itemEntry = fields[3].GetUInt32();
itemCount = fields[4].GetUInt32();
owner = fields[5].GetUInt32();
buyout = fields[6].GetUInt32();
@@ -835,7 +838,7 @@ bool AuctionEntry::LoadFromFieldList(Field* fields)
std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const
{
std::ostringstream strm;
- strm << item_template << ":0:" << response << ':' << Id << ':' << itemCount;
+ strm << itemEntry << ":0:" << response << ':' << Id << ':' << itemCount;
return strm.str();
}
diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h
index 049440f99d0..b7080101588 100644
--- a/src/server/game/AuctionHouse/AuctionHouseMgr.h
+++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h
@@ -34,11 +34,15 @@ class WorldPacket;
enum AuctionError
{
- AUCTION_OK = 0,
- AUCTION_INTERNAL_ERROR = 2,
- AUCTION_NOT_ENOUGHT_MONEY = 3,
- AUCTION_ITEM_NOT_FOUND = 4,
- CANNOT_BID_YOUR_AUCTION_ERROR = 10
+ ERR_AUCTION_OK = 0,
+ ERR_AUCTION_INVENTORY = 1,
+ ERR_AUCTION_DATABASE_ERROR = 2,
+ ERR_AUCTION_NOT_ENOUGHT_MONEY = 3,
+ ERR_AUCTION_ITEM_NOT_FOUND = 4,
+ ERR_AUCTION_HIGHER_BID = 5,
+ ERR_AUCTION_BID_INCREMENT = 7,
+ ERR_AUCTION_BID_OWN = 10,
+ ERR_RESTRICTED_ACCOUNT = 13,
};
enum AuctionAction
@@ -63,8 +67,8 @@ struct AuctionEntry
{
uint32 Id;
uint32 auctioneer; // creature low guid
- uint32 item_guidlow;
- uint32 item_template;
+ uint32 itemGUIDLow;
+ uint32 itemEntry;
uint32 itemCount;
uint32 owner;
uint32 startbid; //maybe useless
@@ -118,7 +122,7 @@ class AuctionHouseObject
void AddAuction(AuctionEntry* auction);
- bool RemoveAuction(AuctionEntry* auction, uint32 item_template);
+ bool RemoveAuction(AuctionEntry* auction, uint32 itemEntry);
void Update();
@@ -166,7 +170,7 @@ class AuctionHouseMgr
void SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans);
void SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans);
void SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans);
- void SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans);
+ void SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans, Item* item);
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp
index 122102b76f3..3e2d0e1310a 100644
--- a/src/server/game/Handlers/AuctionHouseHandler.cpp
+++ b/src/server/game/Handlers/AuctionHouseHandler.cpp
@@ -73,19 +73,34 @@ void WorldSession::SendAuctionHello(uint64 guid, Creature* unit)
}
//call this method when player bids, creates, or deletes auction
-void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError)
+void WorldSession::SendAuctionCommandResult(AuctionEntry* auction, uint32 action, uint32 errorCode, uint32 bidError)
{
- WorldPacket data(SMSG_AUCTION_COMMAND_RESULT, 16);
- data << auctionId;
- data << Action;
- data << ErrorCode;
- if (!ErrorCode && Action)
- data << bidError; //when bid, then send 0, once...
+ WorldPacket data(SMSG_AUCTION_COMMAND_RESULT);
+ data << uint32(auction ? auction->Id : 0);
+ data << uint32(action);
+ data << uint32(errorCode);
+
+ switch (errorCode)
+ {
+ case ERR_AUCTION_OK:
+ if (action == AUCTION_PLACE_BID)
+ data << uint64(auction->bid ? auction->GetAuctionOutBid() : 0);
+ break;
+ case ERR_AUCTION_INVENTORY:
+ data << uint32(bidError);
+ break;
+ case ERR_AUCTION_HIGHER_BID:
+ data << uint64(auction->bidder);
+ data << uint64(auction->bid);
+ data << uint64(auction->bid ? auction->GetAuctionOutBid() : 0);
+ break;
+ }
+
SendPacket(&data);
}
//this function sends notification, if bidder is online
-void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
+void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 itemEntry)
{
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
data << uint32(location);
@@ -93,7 +108,7 @@ void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auction
data << uint64(bidder);
data << uint64(bidSum);
data << uint64(diff);
- data << uint32(item_template);
+ data << uint32(itemEntry);
data << uint32(0);
SendPacket(&data);
}
@@ -106,17 +121,26 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
data << uint64(auction->bid);
data << uint64(0); //unk
data << uint64(0); //unk
- data << uint32(auction->item_template);
+ data << uint32(auction->itemEntry);
data << uint32(0); //unk
data << float(0); //unk
SendPacket(&data);
}
+void WorldSession::SendAuctionRemovedNotification(uint32 auctionId, uint32 itemEntry, int32 randomPropertyId)
+{
+ WorldPacket data(SMSG_AUCTION_REMOVED_NOTIFICATION, (4+4+4));
+ data << uint32(auctionId);
+ data << uint32(itemEntry);
+ data << uint32(randomPropertyId);
+ SendPacket(&data);
+}
+
//this void creates new auction and adds auction to some auctionhouse
void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
{
- uint64 auctioneer;
- uint32 itemsCount, etime, bid, buyout;
+ uint64 auctioneer, bid, buyout;
+ uint32 itemsCount, etime;
recvData >> auctioneer;
recvData >> itemsCount;
@@ -125,7 +149,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (itemsCount > MAX_AUCTION_ITEMS)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -184,7 +208,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (!item)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_ITEM_NOT_FOUND);
+ SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_ITEM_NOT_FOUND);
return;
}
@@ -192,7 +216,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
item->GetTemplate()->Flags & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
item->GetCount() < count[i])
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -202,7 +226,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (!finalCount)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -212,7 +236,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (item->GetMaxStackCount() < finalCount)
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
}
@@ -227,7 +251,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
if (!_player->HasEnoughMoney((uint64)deposit))
{
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_NOT_ENOUGHT_MONEY);
+ SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_NOT_ENOUGHT_MONEY);
return;
}
@@ -250,8 +274,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
GetPlayerName().c_str(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount());
}
- AH->item_guidlow = item->GetGUIDLow();
- AH->item_template = item->GetEntry();
+ AH->itemGUIDLow = item->GetGUIDLow();
+ AH->itemEntry = item->GetEntry();
AH->itemCount = item->GetCount();
AH->owner = _player->GetGUIDLow();
AH->startbid = bid;
@@ -275,7 +299,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
_player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
- SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
+ SendAuctionCommandResult(AH, AUCTION_SELL_ITEM, ERR_AUCTION_OK);
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
return;
@@ -286,7 +310,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
if (!newItem)
{
sLog->outError(LOG_FILTER_NETWORKIO, "CMSG_AUCTION_SELL_ITEM: Could not create clone of item %u", item->GetEntry());
- SendAuctionCommandResult(0, AUCTION_SELL_ITEM, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
return;
}
@@ -296,8 +320,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
GetPlayerName().c_str(), GetAccountId(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetCount());
}
- AH->item_guidlow = newItem->GetGUIDLow();
- AH->item_template = newItem->GetEntry();
+ AH->itemGUIDLow = newItem->GetGUIDLow();
+ AH->itemEntry = newItem->GetEntry();
AH->itemCount = newItem->GetCount();
AH->owner = _player->GetGUIDLow();
AH->startbid = bid;
@@ -345,7 +369,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
_player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
- SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, AUCTION_OK);
+ SendAuctionCommandResult(AH, AUCTION_SELL_ITEM, ERR_AUCTION_OK);
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1);
return;
@@ -387,18 +411,18 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
if (!auction || auction->owner == player->GetGUIDLow())
{
//you cannot bid your own auction:
- SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
+ SendAuctionCommandResult(NULL, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
return;
}
// impossible have online own another character (use this for speedup check in case online owner)
- Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
+ /*Player* auction_owner = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == player->GetSession()->GetAccountId())
{
//you cannot bid your another character auction:
- SendAuctionCommandResult(0, AUCTION_PLACE_BID, CANNOT_BID_YOUR_AUCTION_ERROR);
+ SendAuctionCommandResult(NULL, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
return;
- }
+ }*/
// cheating
if (price <= auction->bid || price < auction->startbid)
@@ -408,14 +432,15 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
if ((price < auction->buyout || auction->buyout == 0) &&
price < auction->bid + auction->GetAuctionOutBid())
{
- //auction has already higher bid, client tests it!
+ // client already test it but just in case ...
+ SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_HIGHER_BID);
return;
}
if (!player->HasEnoughMoney(price))
{
- //you don't have enought money!, client tests!
- //SendAuctionCommandResult(auction->auctionId, AUCTION_PLACE_BID, ???);
+ // client already test it but just in case ...
+ SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_NOT_ENOUGHT_MONEY);
return;
}
@@ -447,7 +472,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
stmt->setUInt32(2, auction->Id);
trans->Append(stmt);
- SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK, 0);
+ SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_OK);
}
else
{
@@ -469,13 +494,13 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
sAuctionMgr->SendAuctionWonMail(auction, trans);
- SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, AUCTION_OK);
+ SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_OK);
auction->DeleteFromDB(trans);
- uint32 item_template = auction->item_template;
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
- auctionHouse->RemoveAuction(auction, item_template);
+ uint32 itemEntry = auction->itemEntry;
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
+ auctionHouse->RemoveAuction(auction, itemEntry);
}
player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
@@ -510,7 +535,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
SQLTransaction trans = CharacterDatabase.BeginTransaction();
if (auction && auction->owner == player->GetGUIDLow())
{
- Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
+ Item* pItem = sAuctionMgr->GetAItem(auction->itemGUIDLow);
if (pItem)
{
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
@@ -518,8 +543,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
uint32 auctionCut = auction->GetAuctionCut();
if (!player->HasEnoughMoney((uint64)auctionCut)) //player doesn't have enough money, maybe message needed
return;
- //some auctionBidderNotification would be needed, but don't know that parts..
- sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
+ sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans, pItem);
player->ModifyMoney(-int64(auctionCut));
}
@@ -530,21 +554,21 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
}
else
{
- sLog->outError(LOG_FILTER_NETWORKIO, "Auction id: %u got non existing item (item guid : %u)!", auction->Id, auction->item_guidlow);
- SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
+ sLog->outError(LOG_FILTER_NETWORKIO, "Auction id: %u got non existing item (item guid : %u)!", auction->Id, auction->itemGUIDLow);
+ SendAuctionCommandResult(NULL, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
return;
}
}
else
{
- SendAuctionCommandResult(0, AUCTION_CANCEL, AUCTION_INTERNAL_ERROR);
+ SendAuctionCommandResult(NULL, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
//this code isn't possible ... maybe there should be assert
sLog->outError(LOG_FILTER_NETWORKIO, "CHEATER: %u tried to cancel auction (id: %u) of another player or auction is NULL", player->GetGUIDLow(), auctionId);
return;
}
//inform player, that auction is removed
- SendAuctionCommandResult(auction->Id, AUCTION_CANCEL, AUCTION_OK);
+ SendAuctionCommandResult(auction, AUCTION_CANCEL, ERR_AUCTION_OK);
// Now remove the auction
@@ -552,9 +576,9 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recvData)
auction->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
- uint32 item_template = auction->item_template;
- sAuctionMgr->RemoveAItem(auction->item_guidlow);
- auctionHouse->RemoveAuction(auction, item_template);
+ uint32 itemEntry = auction->itemEntry;
+ sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
+ auctionHouse->RemoveAuction(auction, itemEntry);
}
//called when player lists his bids
@@ -670,15 +694,11 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recvData)
recvData >> quality >> usable;
recvData.read_skip<uint8>(); // unk
+ recvData.read_skip<uint8>(); // unk
// this block looks like it uses some lame byte packing or similar...
- uint8 unkCnt;
- recvData >> unkCnt;
- for (uint8 i = 0; i < unkCnt; i++)
- {
- recvData.read_skip<uint8>();
+ for (uint8 i = 0; i < 15; i++)
recvData.read_skip<uint8>();
- }
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
if (!creature)
@@ -699,7 +719,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recvData)
WorldPacket data(SMSG_AUCTION_LIST_RESULT, (4+4+4));
uint32 count = 0;
uint32 totalcount = 0;
- data << (uint32) 0;
+ data << uint32(0);
// converting string that we try to find to lower case
std::wstring wsearchedname;
@@ -733,7 +753,7 @@ void WorldSession::HandleAuctionListPendingSales(WorldPacket & recvData)
{
data << ""; // string
data << ""; // string
- data << uint32(0);
+ data << uint64(0);
data << uint32(0);
data << float(0);
}*/
diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp
index 7138b90ba23..a3c807c09c8 100644
--- a/src/server/game/Server/Protocol/Opcodes.cpp
+++ b/src/server/game/Server/Protocol/Opcodes.cpp
@@ -83,13 +83,13 @@ void InitOpcodes()
DEFINE_OPCODE_HANDLER(CMSG_ARENA_TEAM_ROSTER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleArenaTeamRosterOpcode );
DEFINE_OPCODE_HANDLER(CMSG_ATTACKSTOP, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleAttackStopOpcode );
DEFINE_OPCODE_HANDLER(CMSG_ATTACKSWING, STATUS_LOGGEDIN, PROCESS_INPLACE, &WorldSession::HandleAttackSwingOpcode );
- DEFINE_OPCODE_HANDLER(CMSG_AUCTION_LIST_BIDDER_ITEMS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListBidderItems );
- DEFINE_OPCODE_HANDLER(CMSG_AUCTION_LIST_ITEMS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListItems );
- DEFINE_OPCODE_HANDLER(CMSG_AUCTION_LIST_OWNER_ITEMS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListOwnerItems );
- DEFINE_OPCODE_HANDLER(CMSG_AUCTION_LIST_PENDING_SALES, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListPendingSales );
- DEFINE_OPCODE_HANDLER(CMSG_AUCTION_PLACE_BID, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionPlaceBid );
- DEFINE_OPCODE_HANDLER(CMSG_AUCTION_REMOVE_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionRemoveItem );
- DEFINE_OPCODE_HANDLER(CMSG_AUCTION_SELL_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionSellItem );
+ DEFINE_OPCODE_HANDLER(CMSG_AUCTION_LIST_BIDDER_ITEMS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListBidderItems );
+ DEFINE_OPCODE_HANDLER(CMSG_AUCTION_LIST_ITEMS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListItems );
+ DEFINE_OPCODE_HANDLER(CMSG_AUCTION_LIST_OWNER_ITEMS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListOwnerItems );
+ DEFINE_OPCODE_HANDLER(CMSG_AUCTION_LIST_PENDING_SALES, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListPendingSales );
+ DEFINE_OPCODE_HANDLER(CMSG_AUCTION_PLACE_BID, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionPlaceBid );
+ DEFINE_OPCODE_HANDLER(CMSG_AUCTION_REMOVE_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionRemoveItem );
+ DEFINE_OPCODE_HANDLER(CMSG_AUCTION_SELL_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionSellItem );
DEFINE_OPCODE_HANDLER(CMSG_AUTH_SESSION, STATUS_NEVER, PROCESS_THREADUNSAFE, &WorldSession::Handle_EarlyProccess );
DEFINE_OPCODE_HANDLER(CMSG_AUTOBANK_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAutoBankItemOpcode );
DEFINE_OPCODE_HANDLER(CMSG_AUTOEQUIP_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, &WorldSession::HandleAutoEquipItemOpcode );
@@ -648,14 +648,14 @@ void InitOpcodes()
DEFINE_OPCODE_HANDLER(SMSG_ATTACKSWING_CANT_ATTACK, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_ATTACKSWING_DEADTARGET, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_ATTACKSWING_NOTINRANGE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
- DEFINE_OPCODE_HANDLER(SMSG_AUCTION_BIDDER_LIST_RESULT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
- DEFINE_OPCODE_HANDLER(SMSG_AUCTION_BIDDER_NOTIFICATION, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
- DEFINE_OPCODE_HANDLER(SMSG_AUCTION_COMMAND_RESULT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
- DEFINE_OPCODE_HANDLER(SMSG_AUCTION_LIST_PENDING_SALES, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
- DEFINE_OPCODE_HANDLER(SMSG_AUCTION_LIST_RESULT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
- DEFINE_OPCODE_HANDLER(SMSG_AUCTION_OWNER_LIST_RESULT, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
- DEFINE_OPCODE_HANDLER(SMSG_AUCTION_OWNER_NOTIFICATION, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
- DEFINE_OPCODE_HANDLER(SMSG_AUCTION_REMOVED_NOTIFICATION, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+ DEFINE_OPCODE_HANDLER(SMSG_AUCTION_BIDDER_LIST_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+ DEFINE_OPCODE_HANDLER(SMSG_AUCTION_BIDDER_NOTIFICATION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+ DEFINE_OPCODE_HANDLER(SMSG_AUCTION_COMMAND_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+ DEFINE_OPCODE_HANDLER(SMSG_AUCTION_LIST_PENDING_SALES, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+ DEFINE_OPCODE_HANDLER(SMSG_AUCTION_LIST_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+ DEFINE_OPCODE_HANDLER(SMSG_AUCTION_OWNER_LIST_RESULT, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+ DEFINE_OPCODE_HANDLER(SMSG_AUCTION_OWNER_NOTIFICATION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
+ DEFINE_OPCODE_HANDLER(SMSG_AUCTION_REMOVED_NOTIFICATION, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_AURA_POINTS_DEPLETED, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_AURA_UPDATE, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
DEFINE_OPCODE_HANDLER(SMSG_AURA_UPDATE_ALL, STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide );
diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h
index b4ccb87f204..07cfdf39bb1 100755
--- a/src/server/game/Server/Protocol/Opcodes.h
+++ b/src/server/game/Server/Protocol/Opcodes.h
@@ -703,11 +703,11 @@ enum Opcodes
SMSG_ATTACKSWING_CANT_ATTACK = 0x0016,
SMSG_ATTACKSWING_DEADTARGET = 0x2B26,
SMSG_ATTACKSWING_NOTINRANGE = 0x6C07,
- SMSG_AUCTION_BIDDER_LIST_RESULT = 0x6637,
+ SMSG_AUCTION_BIDDER_LIST_RESULT = 0x0027,
SMSG_AUCTION_BIDDER_NOTIFICATION = 0x4E27,
SMSG_AUCTION_COMMAND_RESULT = 0x4C25,
SMSG_AUCTION_LIST_PENDING_SALES = 0x6A27,
- SMSG_AUCTION_LIST_RESULT = 0x0027,
+ SMSG_AUCTION_LIST_RESULT = 0x6637,
SMSG_AUCTION_OWNER_LIST_RESULT = 0x6C34,
SMSG_AUCTION_OWNER_NOTIFICATION = 0x4116,
SMSG_AUCTION_REMOVED_NOTIFICATION = 0x2334,
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index a35cd7cc595..ac8e48a0c04 100755
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -352,9 +352,10 @@ class WorldSession
bool SendItemInfo(uint32 itemid, WorldPacket data);
//auction
void SendAuctionHello(uint64 guid, Creature* unit);
- void SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
+ void SendAuctionCommandResult(AuctionEntry* auction, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
void SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template);
void SendAuctionOwnerNotification(AuctionEntry* auction);
+ void SendAuctionRemovedNotification(uint32 auctionId, uint32 itemEntry, int32 randomPropertyId);
//Item Enchantment
void SendEnchantmentLog(uint64 Target, uint64 Caster, uint32 ItemID, uint32 SpellID);