mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
@@ -87,8 +87,8 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32
|
||||
//does not clear ram
|
||||
void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans)
|
||||
{
|
||||
Item* pItem = GetAItem(auction->itemGUIDLow);
|
||||
if (!pItem)
|
||||
Item* item = GetAItem(auction->itemGUIDLow);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
uint32 bidderAccId = 0;
|
||||
@@ -123,7 +123,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
||||
uint32 ownerAccId = ObjectMgr::GetPlayerAccountIdByGUID(ownerGuid);
|
||||
|
||||
sLog->outCommand(bidderAccId, "GM %s (Account: %u) won item in auction: %s (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)",
|
||||
bidderName.c_str(), bidderAccId, pItem->GetTemplate()->GetDefaultLocaleName(), pItem->GetEntry(), pItem->GetCount(), auction->bid, ownerName.c_str(), ownerAccId);
|
||||
bidderName.c_str(), bidderAccId, item->GetTemplate()->GetDefaultLocaleName(), item->GetEntry(), item->GetCount(), auction->bid, ownerName.c_str(), ownerAccId);
|
||||
}
|
||||
|
||||
// receiver exist
|
||||
@@ -133,18 +133,18 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
|
||||
// owner in `data` will set at mail receive and item extracting
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ITEM_OWNER);
|
||||
stmt->setUInt64(0, auction->bidder);
|
||||
stmt->setUInt64(1, pItem->GetGUID().GetCounter());
|
||||
stmt->setUInt64(1, item->GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
if (bidder)
|
||||
{
|
||||
bidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, bidderGuid, 0, 0, auction->itemEntry);
|
||||
bidder->GetSession()->SendAuctionWonNotification(auction, item);
|
||||
// FIXME: for offline player need also
|
||||
bidder->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WON_AUCTIONS, 1);
|
||||
}
|
||||
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_WON), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, 0, 0))
|
||||
.AddItem(pItem)
|
||||
.AddItem(item)
|
||||
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
else
|
||||
@@ -171,18 +171,20 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
|
||||
ObjectGuid owner_guid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
|
||||
Player* owner = ObjectAccessor::FindConnectedPlayer(owner_guid);
|
||||
uint32 owner_accId = ObjectMgr::GetPlayerAccountIdByGUID(owner_guid);
|
||||
Item* item = GetAItem(auction->itemGUIDLow);
|
||||
|
||||
// owner exist
|
||||
if (owner || owner_accId)
|
||||
{
|
||||
uint32 profit = auction->bid + auction->deposit - auction->GetAuctionCut();
|
||||
|
||||
//FIXME: what do if owner offline
|
||||
if (owner)
|
||||
if (owner && item)
|
||||
{
|
||||
owner->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS, profit);
|
||||
owner->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_SOLD, auction->bid);
|
||||
//send auction owner notification, bidder must be current!
|
||||
owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||
owner->GetSession()->SendAuctionClosedNotification(auction, (float)sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY), true, item);
|
||||
}
|
||||
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_SUCCESSFUL), AuctionEntry::BuildAuctionMailBody(auction->bidder, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
|
||||
@@ -195,8 +197,8 @@ 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->itemGUIDLow);
|
||||
if (!pItem)
|
||||
Item* item = GetAItem(auction->itemGUIDLow);
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
ObjectGuid owner_guid = ObjectGuid::Create<HighGuid::Player>(auction->owner);
|
||||
@@ -206,10 +208,10 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
|
||||
if (owner || owner_accId)
|
||||
{
|
||||
if (owner)
|
||||
owner->GetSession()->SendAuctionOwnerNotification(auction);
|
||||
owner->GetSession()->SendAuctionClosedNotification(auction, 0.0f, false, item);
|
||||
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_EXPIRED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
|
||||
.AddItem(pItem)
|
||||
.AddItem(item)
|
||||
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0);
|
||||
}
|
||||
else
|
||||
@@ -220,7 +222,7 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
|
||||
}
|
||||
|
||||
//this function sends mail to old bidder
|
||||
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans)
|
||||
void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 /*newPrice*/, Player* /*newBidder*/, SQLTransaction& trans)
|
||||
{
|
||||
ObjectGuid oldBidder_guid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
|
||||
Player* oldBidder = ObjectAccessor::FindConnectedPlayer(oldBidder_guid);
|
||||
@@ -229,11 +231,13 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 new
|
||||
if (!oldBidder)
|
||||
oldBidder_accId = ObjectMgr::GetPlayerAccountIdByGUID(oldBidder_guid);
|
||||
|
||||
Item* item = GetAItem(auction->itemGUIDLow);
|
||||
|
||||
// old bidder exist
|
||||
if (oldBidder || oldBidder_accId)
|
||||
{
|
||||
if (oldBidder && newBidder)
|
||||
oldBidder->GetSession()->SendAuctionBidderNotification(auction->GetHouseId(), auction->Id, newBidder->GetGUID(), newPrice, auction->GetAuctionOutBid(), auction->itemEntry);
|
||||
if (oldBidder && item)
|
||||
oldBidder->GetSession()->SendAuctionOutBidNotification(auction, item);
|
||||
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_OUTBIDDED), AuctionEntry::BuildAuctionMailBody(auction->owner, auction->bid, auction->buyout, auction->deposit, auction->GetAuctionCut()))
|
||||
.AddMoney(auction->bid)
|
||||
@@ -242,18 +246,16 @@ 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, Item* item)
|
||||
void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans)
|
||||
{
|
||||
ObjectGuid bidder_guid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
|
||||
Player* bidder = ObjectAccessor::FindConnectedPlayer(bidder_guid);
|
||||
|
||||
uint32 bidder_accId = 0;
|
||||
|
||||
if (!bidder)
|
||||
bidder_accId = ObjectMgr::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))
|
||||
@@ -452,7 +454,6 @@ void AuctionHouseObject::Update()
|
||||
if (AuctionsMap.empty())
|
||||
return;
|
||||
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
for (AuctionEntryMap::iterator it = AuctionsMap.begin(); it != AuctionsMap.end();)
|
||||
@@ -494,40 +495,35 @@ void AuctionHouseObject::Update()
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount)
|
||||
void AuctionHouseObject::BuildListBidderItems(WorldPackets::AuctionHouse::AuctionListBidderItemsResult& packet, Player* player, uint32& totalcount)
|
||||
{
|
||||
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
|
||||
{
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry && Aentry->bidder == player->GetGUID().GetCounter())
|
||||
{
|
||||
if (itr->second->BuildAuctionInfo(data))
|
||||
++count;
|
||||
|
||||
itr->second->BuildAuctionInfo(packet.Items, false);
|
||||
++totalcount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount)
|
||||
void AuctionHouseObject::BuildListOwnerItems(WorldPackets::AuctionHouse::AuctionListOwnerItemsResult& packet, Player* player, uint32& totalcount)
|
||||
{
|
||||
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
|
||||
{
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry && Aentry->owner == player->GetGUID().GetCounter())
|
||||
{
|
||||
if (Aentry->BuildAuctionInfo(data))
|
||||
++count;
|
||||
|
||||
Aentry->BuildAuctionInfo(packet.Items, false);
|
||||
++totalcount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player,
|
||||
void AuctionHouseObject::BuildListAuctionItems(WorldPackets::AuctionHouse::AuctionListItemsResult& packet, Player* player,
|
||||
std::wstring const& wsearchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
|
||||
uint32& count, uint32& totalcount)
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& totalcount)
|
||||
{
|
||||
time_t curTime = sWorld->GetGameTime();
|
||||
|
||||
@@ -612,48 +608,53 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
|
||||
}
|
||||
|
||||
// Add the item if no search term or if entered search term was found
|
||||
if (count < 50 && totalcount >= listfrom)
|
||||
{
|
||||
++count;
|
||||
Aentry->BuildAuctionInfo(data);
|
||||
}
|
||||
if (packet.Items.size() < 50 && totalcount >= listfrom)
|
||||
Aentry->BuildAuctionInfo(packet.Items, true);
|
||||
|
||||
++totalcount;
|
||||
}
|
||||
}
|
||||
|
||||
//this function inserts to WorldPacket auction's data
|
||||
bool AuctionEntry::BuildAuctionInfo(WorldPacket& data) const
|
||||
void AuctionEntry::BuildAuctionInfo(std::vector<WorldPackets::AuctionHouse::AuctionItem>& items, bool listAuctionItems) const
|
||||
{
|
||||
Item* item = sAuctionMgr->GetAItem(itemGUIDLow);
|
||||
if (!item)
|
||||
{
|
||||
TC_LOG_ERROR("misc", "AuctionEntry::BuildAuctionInfo: Auction %u has a non-existent item: " UI64FMTD, Id, itemGUIDLow);
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
data << uint32(Id);
|
||||
data << uint32(item->GetEntry());
|
||||
|
||||
for (uint8 i = 0; i < PROP_ENCHANTMENT_SLOT_0; ++i) // PROP_ENCHANTMENT_SLOT_0 = 10
|
||||
WorldPackets::AuctionHouse::AuctionItem auctionItem;
|
||||
|
||||
auctionItem.AuctionItemID = Id;
|
||||
auctionItem.Item.Initalize(item);
|
||||
auctionItem.BuyoutPrice = buyout;
|
||||
auctionItem.CensorBidInfo = false;
|
||||
auctionItem.CensorServerSideInfo = listAuctionItems;
|
||||
auctionItem.Charges = item->GetSpellCharges();
|
||||
auctionItem.Count = item->GetCount();
|
||||
auctionItem.DeleteReason = 0; // Always 0 ?
|
||||
auctionItem.DurationLeft = (expire_time - time(NULL)) * IN_MILLISECONDS;
|
||||
auctionItem.EndTime = expire_time;
|
||||
auctionItem.Flags = 0; // todo
|
||||
auctionItem.ItemGuid = item->GetGUID();
|
||||
auctionItem.MinBid = startbid;
|
||||
auctionItem.Owner = ObjectGuid::Create<HighGuid::Player>(owner);
|
||||
auctionItem.OwnerAccountID = ObjectGuid::Create<HighGuid::WowAccount>(ObjectMgr::GetPlayerAccountIdByGUID(auctionItem.Owner));
|
||||
auctionItem.MinIncrement = bidder ? GetAuctionOutBid() : 0;
|
||||
auctionItem.Bidder = bidder ? ObjectGuid::Create<HighGuid::Player>(bidder) : ObjectGuid::Empty;
|
||||
auctionItem.BidAmount = bidder ? bid : 0;
|
||||
|
||||
for (uint8 i = 0; i < MAX_INSPECTED_ENCHANTMENT_SLOT; i++)
|
||||
{
|
||||
data << uint32(item->GetEnchantmentId(EnchantmentSlot(i)));
|
||||
data << uint32(item->GetEnchantmentDuration(EnchantmentSlot(i)));
|
||||
data << uint32(item->GetEnchantmentCharges(EnchantmentSlot(i)));
|
||||
if (!item->GetEnchantmentId((EnchantmentSlot) i))
|
||||
continue;
|
||||
|
||||
auctionItem.Enchantments.emplace_back(item->GetEnchantmentId((EnchantmentSlot) i), item->GetEnchantmentDuration((EnchantmentSlot) i), item->GetEnchantmentCharges((EnchantmentSlot) i), i);
|
||||
}
|
||||
|
||||
data << int32(item->GetItemRandomPropertyId()); // Random item property id
|
||||
data << uint32(item->GetItemSuffixFactor()); // SuffixFactor
|
||||
data << uint32(item->GetCount()); // item->count
|
||||
data << uint32(item->GetSpellCharges()); // item->charge FFFFFFF
|
||||
data << uint32(0); // Unknown
|
||||
data << uint64(owner); // Auction->owner
|
||||
data << uint64(startbid); // Auction->startbid (not sure if useful)
|
||||
data << uint64(bid ? GetAuctionOutBid() : 0);
|
||||
// Minimal outbid
|
||||
data << uint64(buyout); // Auction->buyout
|
||||
data << uint32((expire_time - time(NULL)) * IN_MILLISECONDS); // time left
|
||||
data << uint64(bidder); // auction->bidder current
|
||||
data << uint64(bid); // current bid
|
||||
return true;
|
||||
items.emplace_back(auctionItem);
|
||||
}
|
||||
|
||||
uint32 AuctionEntry::GetAuctionCut() const
|
||||
@@ -738,6 +739,7 @@ bool AuctionEntry::LoadFromDB(Field* fields)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AuctionEntry::BuildAuctionMailSubject(MailAuctionAnswers response) const
|
||||
{
|
||||
std::ostringstream strm;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include "DatabaseEnv.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "AuctionHousePackets.h"
|
||||
|
||||
class Item;
|
||||
class Player;
|
||||
@@ -84,7 +85,7 @@ struct AuctionEntry
|
||||
uint32 GetHouseFaction() const { return auctionHouseEntry->FactionID; }
|
||||
uint32 GetAuctionCut() const;
|
||||
uint32 GetAuctionOutBid() const;
|
||||
bool BuildAuctionInfo(WorldPacket & data) const;
|
||||
void BuildAuctionInfo(std::vector<WorldPackets::AuctionHouse::AuctionItem>& items, bool listAuctionItems) const;
|
||||
void DeleteFromDB(SQLTransaction& trans) const;
|
||||
void SaveToDB(SQLTransaction& trans) const;
|
||||
bool LoadFromDB(Field* fields);
|
||||
@@ -122,12 +123,11 @@ class AuctionHouseObject
|
||||
|
||||
void Update();
|
||||
|
||||
void BuildListBidderItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
||||
void BuildListOwnerItems(WorldPacket& data, Player* player, uint32& count, uint32& totalcount);
|
||||
void BuildListAuctionItems(WorldPacket& data, Player* player,
|
||||
void BuildListBidderItems(WorldPackets::AuctionHouse::AuctionListBidderItemsResult& packet, Player* player, uint32& totalcount);
|
||||
void BuildListOwnerItems(WorldPackets::AuctionHouse::AuctionListOwnerItemsResult& packet, Player* player, uint32& totalcount);
|
||||
void BuildListAuctionItems(WorldPackets::AuctionHouse::AuctionListItemsResult& packet, Player* player,
|
||||
std::wstring const& searchedname, uint32 listfrom, uint8 levelmin, uint8 levelmax, uint8 usable,
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
|
||||
uint32& count, uint32& totalcount);
|
||||
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality, uint32& totalcount);
|
||||
|
||||
private:
|
||||
AuctionEntryMap AuctionsMap;
|
||||
@@ -166,7 +166,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, Item* item);
|
||||
void SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans);
|
||||
|
||||
static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count);
|
||||
static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId);
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "World.h"
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "Log.h"
|
||||
#include "Language.h"
|
||||
@@ -29,7 +28,6 @@
|
||||
#include "UpdateMask.h"
|
||||
#include "Util.h"
|
||||
#include "AccountMgr.h"
|
||||
|
||||
#include "AuctionHousePackets.h"
|
||||
|
||||
//void called when player click on auctioneer npc
|
||||
@@ -72,88 +70,62 @@ void WorldSession::SendAuctionCommandResult(AuctionEntry* auction, uint32 action
|
||||
{
|
||||
WorldPackets::AuctionHouse::AuctionCommandResult auctionCommandResult;
|
||||
auctionCommandResult.InitializeAuction(auction);
|
||||
auctionCommandResult.Action = action;
|
||||
auctionCommandResult.Command = action;
|
||||
auctionCommandResult.ErrorCode = errorCode;
|
||||
SendPacket(auctionCommandResult.Write());
|
||||
}
|
||||
|
||||
//this function sends notification, if bidder is online
|
||||
void WorldSession::SendAuctionBidderNotification(uint32 /*location*/, uint32 /*auctionId*/, ObjectGuid /*bidder*/, uint32 /*bidSum*/, uint32 /*diff*/, uint32 /*itemEntry*/)
|
||||
void WorldSession::SendAuctionOutBidNotification(AuctionEntry const* auction, Item const* item)
|
||||
{
|
||||
//WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8*4));
|
||||
//data << uint32(location);
|
||||
//data << uint32(auctionId);
|
||||
//data << bidder;
|
||||
//data << uint64(bidSum);
|
||||
//data << uint64(diff);
|
||||
//data << uint32(itemEntry);
|
||||
//data << uint32(0);
|
||||
//SendPacket(&data);
|
||||
WorldPackets::AuctionHouse::AuctionOutBidNotification packet;
|
||||
packet.BidAmount = auction->bid;
|
||||
packet.MinIncrement = auction->GetAuctionOutBid();
|
||||
packet.Info.Initialize(auction, item);
|
||||
SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
// this void causes on client to display: "Your auction sold"
|
||||
void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
|
||||
void WorldSession::SendAuctionClosedNotification(AuctionEntry const* auction, float mailDelay, bool sold, Item const* item)
|
||||
{
|
||||
WorldPacket data(SMSG_AUCTION_CLOSED_NOTIFICATION, 40);
|
||||
data << uint32(auction->Id);
|
||||
data << uint64(auction->bid);
|
||||
data << uint64(0); //unk
|
||||
data << uint64(0); //unk
|
||||
data << uint32(auction->itemEntry);
|
||||
data << uint32(0); //unk
|
||||
data << float(0); //unk
|
||||
SendPacket(&data);
|
||||
WorldPackets::AuctionHouse::AuctionClosedNotification packet;
|
||||
packet.Info.Initialize(auction, item);
|
||||
packet.ProceedsMailDelay = mailDelay;
|
||||
packet.Sold = sold;
|
||||
SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
void WorldSession::SendAuctionRemovedNotification(uint32 /*auctionId*/, uint32 /*itemEntry*/, int32 /*randomPropertyId*/)
|
||||
void WorldSession::SendAuctionWonNotification(AuctionEntry const* auction, Item const* item)
|
||||
{
|
||||
//WorldPacket data(SMSG_AUCTION_REMOVED_NOTIFICATION, (4+4+4));
|
||||
//data << uint32(auctionId);
|
||||
//data << uint32(itemEntry);
|
||||
//data << uint32(randomPropertyId);
|
||||
//SendPacket(&data);
|
||||
WorldPackets::AuctionHouse::AuctionWonNotification packet;
|
||||
packet.Info.Initialize(auction, item);
|
||||
SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
void WorldSession::SendAuctionOwnerBidNotification(AuctionEntry const* auction, Item const* item)
|
||||
{
|
||||
WorldPackets::AuctionHouse::AuctionOwnerBidNotification packet;
|
||||
packet.Info.Initialize(auction, item);
|
||||
packet.Bidder = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
|
||||
packet.MinIncrement = auction->GetAuctionOutBid();
|
||||
SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
//this void creates new auction and adds auction to some auctionhouse
|
||||
void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
void WorldSession::HandleAuctionSellItem(WorldPackets::AuctionHouse::AuctionSellItem& packet)
|
||||
{
|
||||
ObjectGuid auctioneer;
|
||||
uint64 bid, buyout;
|
||||
uint32 itemsCount, etime;
|
||||
recvData >> auctioneer;
|
||||
recvData >> itemsCount;
|
||||
|
||||
ObjectGuid itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
|
||||
uint32 count[MAX_AUCTION_ITEMS];
|
||||
memset(count, 0, sizeof(count));
|
||||
|
||||
if (itemsCount > MAX_AUCTION_ITEMS)
|
||||
if (packet.Items.size() > MAX_AUCTION_ITEMS)
|
||||
{
|
||||
SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||
recvData.rfinish();
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < itemsCount; ++i)
|
||||
{
|
||||
recvData >> itemGUIDs[i];
|
||||
recvData >> count[i];
|
||||
|
||||
if (!itemGUIDs[i] || !count[i] || count[i] > 1000)
|
||||
{
|
||||
recvData.rfinish();
|
||||
for (auto const& item : packet.Items)
|
||||
if (!item.Guid || !item.UseCount || item.UseCount > 1000)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
recvData >> bid;
|
||||
recvData >> buyout;
|
||||
recvData >> etime;
|
||||
|
||||
if (!bid || !etime)
|
||||
if (!packet.MinBid || !packet.RunTime)
|
||||
return;
|
||||
|
||||
if (bid > MAX_MONEY_AMOUNT || buyout > MAX_MONEY_AMOUNT)
|
||||
if (packet.MinBid > MAX_MONEY_AMOUNT || packet.BuyoutPrice > MAX_MONEY_AMOUNT)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Player %s (%s) attempted to sell item with higher price than max gold amount.", _player->GetName().c_str(), _player->GetGUID().ToString().c_str());
|
||||
SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||
@@ -161,27 +133,27 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) not found or you can't interact with him.", auctioneer.ToString().c_str());
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) not found or you can't interact with him.", packet.Auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->getFaction());
|
||||
if (!auctionHouseEntry)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) has wrong faction.", auctioneer.ToString().c_str());
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) has wrong faction.", packet.Auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
etime *= MINUTE;
|
||||
packet.RunTime *= MINUTE;
|
||||
|
||||
switch (etime)
|
||||
switch (packet.RunTime)
|
||||
{
|
||||
case 1*MIN_AUCTION_TIME:
|
||||
case 2*MIN_AUCTION_TIME:
|
||||
case 4*MIN_AUCTION_TIME:
|
||||
case 1 * MIN_AUCTION_TIME:
|
||||
case 2 * MIN_AUCTION_TIME:
|
||||
case 4 * MIN_AUCTION_TIME:
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
@@ -190,14 +162,10 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
|
||||
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
|
||||
|
||||
Item* items[MAX_AUCTION_ITEMS];
|
||||
|
||||
uint32 finalCount = 0;
|
||||
uint32 itemEntry = 0;
|
||||
|
||||
for (uint32 i = 0; i < itemsCount; ++i)
|
||||
for (auto const& packetItem : packet.Items)
|
||||
{
|
||||
Item* item = _player->GetItemByGuid(itemGUIDs[i]);
|
||||
Item* item = _player->GetItemByGuid(packetItem.Guid);
|
||||
|
||||
if (!item)
|
||||
{
|
||||
@@ -205,19 +173,21 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemEntry == 0)
|
||||
itemEntry = item->GetTemplate()->GetId();
|
||||
|
||||
if (sAuctionMgr->GetAItem(item->GetGUID().GetCounter()) || !item->CanBeTraded() || item->IsNotEmptyBag() ||
|
||||
item->GetTemplate()->GetFlags() & ITEM_PROTO_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
|
||||
item->GetCount() < count[i] || itemEntry != item->GetTemplate()->GetId())
|
||||
item->GetCount() < packetItem.UseCount)
|
||||
{
|
||||
SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
items[i] = item;
|
||||
finalCount += count[i];
|
||||
finalCount += packetItem.UseCount;
|
||||
}
|
||||
|
||||
if (packet.Items.empty())
|
||||
{
|
||||
SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!finalCount)
|
||||
@@ -227,21 +197,21 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// check if there are 2 identical guids, in this case user is most likely cheating
|
||||
for (uint32 i = 0; i < itemsCount - 1; ++i)
|
||||
for (uint32 i = 0; i < packet.Items.size() - 1; ++i)
|
||||
{
|
||||
for (uint32 j = i + 1; j < itemsCount; ++j)
|
||||
for (uint32 j = i + 1; j < packet.Items.size(); ++j)
|
||||
{
|
||||
if (itemGUIDs[i] == itemGUIDs[j])
|
||||
if (packet.Items[i].Guid == packet.Items[j].Guid)
|
||||
{
|
||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||
SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32 i = 0; i < itemsCount; ++i)
|
||||
for (auto const& packetItem : packet.Items)
|
||||
{
|
||||
Item* item = items[i];
|
||||
Item* item = _player->GetItemByGuid(packetItem.Guid);
|
||||
|
||||
if (item->GetMaxStackCount() < finalCount)
|
||||
{
|
||||
@@ -250,12 +220,12 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
Item* item = items[0];
|
||||
Item* item = _player->GetItemByGuid(packet.Items[0].Guid);
|
||||
|
||||
uint32 auctionTime = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME));
|
||||
uint32 auctionTime = uint32(packet.RunTime * sWorld->getRate(RATE_AUCTION_TIME));
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
|
||||
uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, packet.RunTime, item, finalCount);
|
||||
if (!_player->HasEnoughMoney((uint64)deposit))
|
||||
{
|
||||
SendAuctionCommandResult(NULL, AUCTION_SELL_ITEM, ERR_AUCTION_NOT_ENOUGHT_MONEY);
|
||||
@@ -267,10 +237,10 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
AH->auctioneer = UI64LIT(23442); ///@TODO - HARDCODED DB GUID, BAD BAD BAD
|
||||
else
|
||||
AH->auctioneer = auctioneer.GetCounter();
|
||||
AH->auctioneer = packet.Auctioneer.GetCounter();
|
||||
|
||||
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
|
||||
if (itemsCount == 1 && item->GetCount() == count[0])
|
||||
if (packet.Items.size() == 1 && item->GetCount() == packet.Items[0].UseCount)
|
||||
{
|
||||
if (HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
|
||||
{
|
||||
@@ -283,16 +253,16 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->itemEntry = item->GetEntry();
|
||||
AH->itemCount = item->GetCount();
|
||||
AH->owner = _player->GetGUID().GetCounter();
|
||||
AH->startbid = bid;
|
||||
AH->startbid = packet.MinBid;
|
||||
AH->bidder = UI64LIT(0);
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->buyout = packet.BuyoutPrice;
|
||||
AH->expire_time = time(NULL) + auctionTime;
|
||||
AH->deposit = deposit;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: %s %s is selling item %s %s to auctioneer " UI64FMTD " with count %u with initial bid " UI64FMTD " with buyout " UI64FMTD " and with time %u (in sec) in auctionhouse %u",
|
||||
_player->GetGUID().ToString().c_str(), _player->GetName().c_str(), item->GetGUID().ToString().c_str(), item->GetTemplate()->GetDefaultLocaleName(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
|
||||
_player->GetGUID().ToString().c_str(), _player->GetName().c_str(), item->GetGUID().ToString().c_str(), item->GetTemplate()->GetDefaultLocaleName(), AH->auctioneer, item->GetCount(), packet.MinBid, packet.BuyoutPrice, auctionTime, AH->GetHouseId());
|
||||
sAuctionMgr->AddAItem(item);
|
||||
auctionHouse->AddAuction(AH);
|
||||
|
||||
@@ -331,25 +301,25 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->itemEntry = newItem->GetEntry();
|
||||
AH->itemCount = newItem->GetCount();
|
||||
AH->owner = _player->GetGUID().GetCounter();
|
||||
AH->startbid = bid;
|
||||
AH->startbid = packet.MinBid;
|
||||
AH->bidder = UI64LIT(0);
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->buyout = packet.BuyoutPrice;
|
||||
AH->expire_time = time(NULL) + auctionTime;
|
||||
AH->deposit = deposit;
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
TC_LOG_INFO("network", "CMSG_AUCTION_SELL_ITEM: %s %s is selling %s %s to auctioneer " UI64FMTD " with count %u with initial bid " UI64FMTD " with buyout " UI64FMTD " and with time %u (in sec) in auctionhouse %u",
|
||||
_player->GetGUID().ToString().c_str(), _player->GetName().c_str(), newItem->GetGUID().ToString().c_str(), newItem->GetTemplate()->GetDefaultLocaleName(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
|
||||
_player->GetGUID().ToString().c_str(), _player->GetName().c_str(), newItem->GetGUID().ToString().c_str(), newItem->GetTemplate()->GetDefaultLocaleName(), AH->auctioneer, newItem->GetCount(), packet.MinBid, packet.BuyoutPrice, auctionTime, AH->GetHouseId());
|
||||
sAuctionMgr->AddAItem(newItem);
|
||||
auctionHouse->AddAuction(AH);
|
||||
|
||||
for (uint32 j = 0; j < itemsCount; ++j)
|
||||
for (auto const& packetItem : packet.Items)
|
||||
{
|
||||
Item* item2 = items[j];
|
||||
Item* item2 = _player->GetItemByGuid(packetItem.Guid);
|
||||
|
||||
// Item stack count equals required count, ready to delete item - cloned item will be used for auction
|
||||
if (item2->GetCount() == count[j])
|
||||
if (item2->GetCount() == packetItem.UseCount)
|
||||
{
|
||||
_player->MoveItemFromInventory(item2->GetBagSlot(), item2->GetSlot(), true);
|
||||
|
||||
@@ -361,9 +331,9 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
}
|
||||
else // Item stack count is bigger than required count, update item stack count and save to database - cloned item will be used for auction
|
||||
{
|
||||
item2->SetCount(item2->GetCount() - count[j]);
|
||||
item2->SetCount(item2->GetCount() - packetItem.UseCount);
|
||||
item2->SetState(ITEM_CHANGED, _player);
|
||||
_player->ItemRemovedQuestCheck(item2->GetEntry(), count[j]);
|
||||
_player->ItemRemovedQuestCheck(item2->GetEntry(), packetItem.UseCount);
|
||||
item2->SendUpdateToPlayer(_player);
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
@@ -387,24 +357,15 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// this function is called when client bids or buys out auction
|
||||
void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
void WorldSession::HandleAuctionPlaceBid(WorldPackets::AuctionHouse::AuctionPlaceBid& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_PLACE_BID");
|
||||
if (!packet.AuctionItemID || !packet.BidAmount)
|
||||
return; // check for cheaters
|
||||
|
||||
ObjectGuid auctioneer;
|
||||
uint32 auctionId;
|
||||
uint64 price;
|
||||
recvData >> auctioneer;
|
||||
recvData >> auctionId;
|
||||
recvData >> price;
|
||||
|
||||
if (!auctionId || !price)
|
||||
return; // check for cheaters
|
||||
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - %s not found or you can't interact with him.", auctioneer.ToString().c_str());
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - %s not found or you can't interact with him.", packet.Auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -414,7 +375,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(packet.AuctionItemID);
|
||||
Player* player = GetPlayer();
|
||||
|
||||
if (!auction || auction->owner == player->GetGUID().GetCounter())
|
||||
@@ -435,19 +396,19 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// cheating
|
||||
if (price <= auction->bid || price < auction->startbid)
|
||||
if (packet.BidAmount <= auction->bid || packet.BidAmount < auction->startbid)
|
||||
return;
|
||||
|
||||
// price too low for next bid if not buyout
|
||||
if ((price < auction->buyout || auction->buyout == 0) &&
|
||||
price < auction->bid + auction->GetAuctionOutBid())
|
||||
if ((packet.BidAmount < auction->buyout || auction->buyout == 0) &&
|
||||
packet.BidAmount < auction->bid + auction->GetAuctionOutBid())
|
||||
{
|
||||
// client already test it but just in case ...
|
||||
SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_HIGHER_BID);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->HasEnoughMoney(price))
|
||||
if (!player->HasEnoughMoney(packet.BidAmount))
|
||||
{
|
||||
// client already test it but just in case ...
|
||||
SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_NOT_ENOUGHT_MONEY);
|
||||
@@ -456,25 +417,25 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
if (price < auction->buyout || auction->buyout == 0)
|
||||
if (packet.BidAmount < auction->buyout || auction->buyout == 0)
|
||||
{
|
||||
if (auction->bidder)
|
||||
{
|
||||
if (auction->bidder == player->GetGUID().GetCounter())
|
||||
player->ModifyMoney(-int64(price - auction->bid));
|
||||
player->ModifyMoney(-int64(packet.BidAmount - auction->bid));
|
||||
else
|
||||
{
|
||||
// mail to last bidder and return money
|
||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, price, GetPlayer(), trans);
|
||||
player->ModifyMoney(-int64(price));
|
||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, packet.BidAmount, GetPlayer(), trans);
|
||||
player->ModifyMoney(-int64(packet.BidAmount));
|
||||
}
|
||||
}
|
||||
else
|
||||
player->ModifyMoney(-int64(price));
|
||||
player->ModifyMoney(-int64(packet.BidAmount));
|
||||
|
||||
auction->bidder = player->GetGUID().GetCounter();
|
||||
auction->bid = price;
|
||||
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
|
||||
auction->bid = packet.BidAmount;
|
||||
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, packet.BidAmount);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_AUCTION_BID);
|
||||
stmt->setUInt64(0, auction->bidder);
|
||||
@@ -483,6 +444,12 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
trans->Append(stmt);
|
||||
|
||||
SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_OK);
|
||||
|
||||
// Not sure if we must send this now.
|
||||
Player* owner = sObjectAccessor->FindConnectedPlayer(ObjectGuid::Create<HighGuid::Player>(auction->owner));
|
||||
Item* item = sAuctionMgr->GetAItem(auction->itemGUIDLow);
|
||||
if (owner && item)
|
||||
owner->GetSession()->SendAuctionOwnerBidNotification(auction, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -499,36 +466,30 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
auction->bid = auction->buyout;
|
||||
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
|
||||
|
||||
SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_OK);
|
||||
|
||||
//- Mails must be under transaction control too to prevent data loss
|
||||
sAuctionMgr->SendAuctionSalePendingMail(auction, trans);
|
||||
sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
|
||||
sAuctionMgr->SendAuctionWonMail(auction, trans);
|
||||
|
||||
SendAuctionCommandResult(auction, AUCTION_PLACE_BID, ERR_AUCTION_OK);
|
||||
|
||||
auction->DeleteFromDB(trans);
|
||||
|
||||
sAuctionMgr->RemoveAItem(auction->itemGUIDLow);
|
||||
auctionHouse->RemoveAuction(auction);
|
||||
}
|
||||
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
|
||||
//this void is called when auction_owner cancels his auction
|
||||
void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
void WorldSession::HandleAuctionRemoveItem(WorldPackets::AuctionHouse::AuctionRemoveItem& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
|
||||
|
||||
ObjectGuid auctioneer;
|
||||
uint32 auctionId;
|
||||
recvData >> auctioneer;
|
||||
recvData >> auctionId;
|
||||
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - %s not found or you can't interact with him.", auctioneer.ToString().c_str());
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - %s not found or you can't interact with him.", packet.Auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -538,27 +499,27 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(packet.AuctionItemID);
|
||||
Player* player = GetPlayer();
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
if (auction && auction->owner == player->GetGUID().GetCounter())
|
||||
{
|
||||
Item* pItem = sAuctionMgr->GetAItem(auction->itemGUIDLow);
|
||||
if (pItem)
|
||||
Item* item = sAuctionMgr->GetAItem(auction->itemGUIDLow);
|
||||
if (item)
|
||||
{
|
||||
if (auction->bidder) // If we have a bidder, we have to send him the money he paid
|
||||
{
|
||||
uint32 auctionCut = auction->GetAuctionCut();
|
||||
if (!player->HasEnoughMoney((uint64)auctionCut)) //player doesn't have enough money, maybe message needed
|
||||
return;
|
||||
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans, pItem);
|
||||
sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans);
|
||||
player->ModifyMoney(-int64(auctionCut));
|
||||
}
|
||||
|
||||
// item will deleted or added to received mail list
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
|
||||
.AddItem(pItem)
|
||||
.AddItem(item)
|
||||
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
else
|
||||
@@ -572,7 +533,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
{
|
||||
SendAuctionCommandResult(NULL, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
|
||||
//this code isn't possible ... maybe there should be assert
|
||||
TC_LOG_ERROR("network", "CHEATER: %s tried to cancel auction (id: %u) of another player or auction is NULL", player->GetGUID().ToString().c_str(), auctionId);
|
||||
TC_LOG_ERROR("network", "CHEATER: %s tried to cancel auction (id: %u) of another player or auction is NULL", player->GetGUID().ToString().c_str(), packet.AuctionItemID);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -590,28 +551,12 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
//called when player lists his bids
|
||||
void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
|
||||
void WorldSession::HandleAuctionListBidderItems(WorldPackets::AuctionHouse::AuctionListBidderItems& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
|
||||
|
||||
ObjectGuid guid; //NPC guid
|
||||
uint32 listfrom; //page of auctions
|
||||
uint32 outbiddedCount; //count of outbidded auctions
|
||||
|
||||
recvData >> guid;
|
||||
recvData >> listfrom; // not used in fact (this list not have page control in client)
|
||||
recvData >> outbiddedCount;
|
||||
if (recvData.size() != (16 + outbiddedCount * 4))
|
||||
{
|
||||
TC_LOG_ERROR("network", "Client sent bad opcode!!! with count: %u and size : %lu (must be: %u)", outbiddedCount, (unsigned long)recvData.size(), (16 + outbiddedCount * 4));
|
||||
outbiddedCount = 0;
|
||||
}
|
||||
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - %s not found or you can't interact with him.", guid.ToString().c_str());
|
||||
recvData.rfinish();
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - %s not found or you can't interact with him.", packet.Auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -621,46 +566,21 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
WorldPacket data(SMSG_AUCTION_LIST_BIDDER_ITEMS_RESULT, (4+4+4));
|
||||
Player* player = GetPlayer();
|
||||
data << uint32(0); //add 0 as count
|
||||
uint32 count = 0;
|
||||
uint32 totalcount = 0;
|
||||
while (outbiddedCount > 0) //add all data, which client requires
|
||||
{
|
||||
--outbiddedCount;
|
||||
uint32 outbiddedAuctionId;
|
||||
recvData >> outbiddedAuctionId;
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId);
|
||||
if (auction && auction->BuildAuctionInfo(data))
|
||||
{
|
||||
++totalcount;
|
||||
++count;
|
||||
}
|
||||
}
|
||||
WorldPackets::AuctionHouse::AuctionListBidderItemsResult result;
|
||||
|
||||
auctionHouse->BuildListBidderItems(data, player, count, totalcount);
|
||||
data.put<uint32>(0, count); // add count to placeholder
|
||||
data << totalcount;
|
||||
data << uint32(300); //unk 2.3.0
|
||||
SendPacket(&data);
|
||||
Player* player = GetPlayer();
|
||||
auctionHouse->BuildListBidderItems(result, player, result.TotalCount);
|
||||
result.DesiredDelay = 300;
|
||||
SendPacket(result.Write());
|
||||
}
|
||||
|
||||
//this void sends player info about his auctions
|
||||
void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
|
||||
void WorldSession::HandleAuctionListOwnerItems(WorldPackets::AuctionHouse::AuctionListOwnerItems& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
|
||||
|
||||
uint32 listfrom;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
recvData >> listfrom; // not used in fact (this list not have page control in client)
|
||||
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - %s not found or you can't interact with him.", guid.ToString().c_str());
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - %s not found or you can't interact with him.", packet.Auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -670,48 +590,20 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
WorldPacket data(SMSG_AUCTION_LIST_OWNER_ITEMS_RESULT, (4+4+4));
|
||||
data << uint32(0); // amount place holder
|
||||
WorldPackets::AuctionHouse::AuctionListOwnerItemsResult result;
|
||||
|
||||
uint32 count = 0;
|
||||
uint32 totalcount = 0;
|
||||
|
||||
auctionHouse->BuildListOwnerItems(data, _player, count, totalcount);
|
||||
data.put<uint32>(0, count);
|
||||
data << uint32(totalcount);
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
auctionHouse->BuildListOwnerItems(result, _player, result.TotalCount);
|
||||
result.DesiredDelay = 300;
|
||||
SendPacket(result.Write());
|
||||
}
|
||||
|
||||
//this void is called when player clicks on search button
|
||||
void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
|
||||
void WorldSession::HandleAuctionListItems(WorldPackets::AuctionHouse::AuctionListItems& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_ITEMS");
|
||||
|
||||
std::string searchedname;
|
||||
uint8 levelmin, levelmax, usable;
|
||||
uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
recvData >> listfrom; // start, used for page control listing by 50 elements
|
||||
recvData >> searchedname;
|
||||
|
||||
recvData >> levelmin >> levelmax;
|
||||
recvData >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
|
||||
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...
|
||||
for (uint8 i = 0; i < 15; i++)
|
||||
recvData.read_skip<uint8>();
|
||||
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(packet.Auctioneer, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!creature)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - %s not found or you can't interact with him.", guid.ToString().c_str());
|
||||
TC_LOG_DEBUG("network", "WORLD: HandleAuctionListItems - %s not found or you can't interact with him.", packet.Auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -721,49 +613,42 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
|
||||
|
||||
AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction());
|
||||
|
||||
TC_LOG_DEBUG("auctionHouse", "Auctionhouse search (%s) list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u",
|
||||
guid.ToString().c_str(), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
|
||||
TC_LOG_DEBUG("auctionHouse", "Auctionhouse search (%s), searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u",
|
||||
packet.Auctioneer.ToString().c_str(), packet.Name.c_str(), packet.MinLevel, packet.MaxLevel , packet.InvType, packet.ItemClass, packet.ItemSubclass, packet.Quality, packet.OnlyUsable);
|
||||
|
||||
WorldPacket data(SMSG_AUCTION_LIST_ITEMS_RESULT, (4+4+4));
|
||||
uint32 count = 0;
|
||||
uint32 totalcount = 0;
|
||||
data << uint32(0);
|
||||
WorldPackets::AuctionHouse::AuctionListItemsResult result;
|
||||
|
||||
// converting string that we try to find to lower case
|
||||
std::wstring wsearchedname;
|
||||
if (!Utf8toWStr(searchedname, wsearchedname))
|
||||
if (!Utf8toWStr(packet.Name, wsearchedname))
|
||||
return;
|
||||
|
||||
wstrToLower(wsearchedname);
|
||||
|
||||
auctionHouse->BuildListAuctionItems(data, _player,
|
||||
wsearchedname, listfrom, levelmin, levelmax, usable,
|
||||
auctionSlotID, auctionMainCategory, auctionSubCategory, quality,
|
||||
count, totalcount);
|
||||
auctionHouse->BuildListAuctionItems(result, _player,
|
||||
wsearchedname, packet.Offset, packet.MinLevel, packet.MaxLevel, packet.OnlyUsable,
|
||||
packet.InvType, packet.ItemClass, packet.ItemSubclass, packet.Quality, result.TotalCount);
|
||||
|
||||
data.put<uint32>(0, count);
|
||||
data << uint32(totalcount);
|
||||
data << uint32(300); //unk 2.3.0
|
||||
SendPacket(&data);
|
||||
result.DesiredDelay = 300;
|
||||
result.OnlyUsable = packet.OnlyUsable;
|
||||
SendPacket(result.Write());
|
||||
}
|
||||
|
||||
void WorldSession::HandleAuctionListPendingSales(WorldPacket& recvData)
|
||||
void WorldSession::HandleAuctionListPendingSales(WorldPackets::AuctionHouse::AuctionListPendingSales& /*packet*/)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES");
|
||||
|
||||
recvData.read_skip<uint64>();
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
WorldPacket data(SMSG_AUCTION_LIST_PENDING_SALES_RESULT, 4);
|
||||
data << uint32(count); // count
|
||||
/*for (uint32 i = 0; i < count; ++i)
|
||||
{
|
||||
data << ""; // string
|
||||
data << ""; // string
|
||||
data << uint64(0);
|
||||
data << uint32(0);
|
||||
data << float(0);
|
||||
}*/
|
||||
SendPacket(&data);
|
||||
WorldPackets::AuctionHouse::AuctionListPendingSalesResult result;
|
||||
result.TotalNumRecords = 0;
|
||||
SendPacket(result.Write());
|
||||
}
|
||||
|
||||
void WorldSession::HandleReplicateItems(WorldPackets::AuctionHouse::AuctionReplicateItems& packet)
|
||||
{
|
||||
//@todo implement this properly
|
||||
WorldPackets::AuctionHouse::AuctionReplicateResponse response;
|
||||
response.ChangeNumberCursor = packet.ChangeNumberCursor;
|
||||
response.ChangeNumberGlobal = packet.ChangeNumberGlobal;
|
||||
response.ChangeNumberTombstone = packet.ChangeNumberTombstone;
|
||||
response.DesiredDelay = 300;
|
||||
response.Result = 0;
|
||||
SendPacket(response.Write());
|
||||
}
|
||||
|
||||
@@ -19,6 +19,80 @@
|
||||
#include "AuctionHouseMgr.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::AuctionHouse::AuctionItem const& auctionItem)
|
||||
{
|
||||
data << auctionItem.Item; // ItemInstance
|
||||
data << int32(auctionItem.Count);
|
||||
data << int32(auctionItem.Charges);
|
||||
data << int32(auctionItem.Enchantments.size());
|
||||
data << int32(auctionItem.Flags);
|
||||
data << int32(auctionItem.AuctionItemID);
|
||||
data << auctionItem.Owner;
|
||||
data << uint64(auctionItem.MinBid);
|
||||
data << uint64(auctionItem.MinIncrement);
|
||||
data << uint64(auctionItem.BuyoutPrice);
|
||||
data << int32(auctionItem.DurationLeft);
|
||||
data << uint8(auctionItem.DeleteReason);
|
||||
|
||||
for (auto const& enchant : auctionItem.Enchantments)
|
||||
{
|
||||
data << int32(enchant.ID);
|
||||
data << uint32(enchant.Expiration);
|
||||
data << int32(enchant.Charges);
|
||||
data << uint8(enchant.Slot);
|
||||
}
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
bool censorServerSideInfo = !data.WriteBit(auctionItem.CensorServerSideInfo);
|
||||
bool censorBidInfo = !data.WriteBit(auctionItem.CensorBidInfo);
|
||||
|
||||
if (censorServerSideInfo)
|
||||
{
|
||||
data << auctionItem.ItemGuid;
|
||||
data << auctionItem.OwnerAccountID;
|
||||
data << int32(auctionItem.EndTime);
|
||||
}
|
||||
|
||||
if (censorBidInfo)
|
||||
{
|
||||
data << auctionItem.Bidder;
|
||||
data << uint64(auctionItem.BidAmount);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::AuctionHouse::AuctionOwnerNotification const& ownerNotification)
|
||||
{
|
||||
data << int32(ownerNotification.AuctionItemID);
|
||||
data << uint64(ownerNotification.BidAmount);
|
||||
data << ownerNotification.Item;
|
||||
return data;
|
||||
}
|
||||
|
||||
ByteBuffer& operator<<(ByteBuffer& data, WorldPackets::AuctionHouse::AuctionBidderNotification const& bidderNotification)
|
||||
{
|
||||
data << int32(bidderNotification.AuctionItemID);
|
||||
data << bidderNotification.Bidder;
|
||||
data << bidderNotification.Item;
|
||||
return data;
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionOwnerNotification::Initialize(::AuctionEntry const* auction, ::Item const* item)
|
||||
{
|
||||
AuctionItemID = auction->Id;
|
||||
Item.Initalize(item);
|
||||
BidAmount = auction->bid;
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionBidderNotification::Initialize(::AuctionEntry const* auction, ::Item const* item)
|
||||
{
|
||||
AuctionItemID = auction->Id;
|
||||
Item.Initalize(item);
|
||||
Bidder = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionHelloRequest::Read()
|
||||
{
|
||||
_worldPacket >> Guid;
|
||||
@@ -36,38 +110,218 @@ WorldPacket const* WorldPackets::AuctionHouse::AuctionHelloResponse::Write()
|
||||
WorldPackets::AuctionHouse::AuctionCommandResult::AuctionCommandResult()
|
||||
: ServerPacket(SMSG_AUCTION_COMMAND_RESULT, 4 + 4 + 4 + 8 + 4 + 8 + 8 + 8) { }
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionCommandResult::InitializeAuction(AuctionEntry* auction)
|
||||
void WorldPackets::AuctionHouse::AuctionCommandResult::InitializeAuction(::AuctionEntry* auction)
|
||||
{
|
||||
if (auction)
|
||||
{
|
||||
AuctionId = auction->Id;
|
||||
Bid = auction->bid;
|
||||
AuctionOutBid = auction->GetAuctionOutBid();
|
||||
Bidder = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
|
||||
AuctionItemID = auction->Id;
|
||||
Money = auction->bid == auction->buyout ? 0 : auction->bid;
|
||||
MinIncrement = auction->bid == auction->buyout ? 0 : auction->GetAuctionOutBid();
|
||||
Guid = ObjectGuid::Create<HighGuid::Player>(auction->bidder);
|
||||
}
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionCommandResult::Write()
|
||||
{
|
||||
_worldPacket << uint32(AuctionId);
|
||||
_worldPacket << uint32(Action);
|
||||
_worldPacket << uint32(ErrorCode);
|
||||
|
||||
switch (ErrorCode)
|
||||
{
|
||||
case ERR_AUCTION_OK:
|
||||
if (Action == AUCTION_PLACE_BID)
|
||||
_worldPacket << uint64(Bid ? AuctionOutBid : 0);
|
||||
break;
|
||||
case ERR_AUCTION_INVENTORY:
|
||||
_worldPacket << uint32(BidError);
|
||||
break;
|
||||
case ERR_AUCTION_HIGHER_BID:
|
||||
_worldPacket << Bidder;
|
||||
_worldPacket << uint64(Bid);
|
||||
_worldPacket << uint64(Bid ? AuctionOutBid : 0);
|
||||
break;
|
||||
}
|
||||
_worldPacket << uint32(AuctionItemID);
|
||||
_worldPacket << int32(Command);
|
||||
_worldPacket << int32(ErrorCode);
|
||||
_worldPacket << int32(BagResult);
|
||||
_worldPacket << Guid;
|
||||
_worldPacket << uint64(MinIncrement);
|
||||
_worldPacket << uint64(Money);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionSellItem::Read()
|
||||
{
|
||||
_worldPacket >> Auctioneer;
|
||||
_worldPacket >> MinBid;
|
||||
_worldPacket >> BuyoutPrice;
|
||||
_worldPacket >> RunTime;
|
||||
|
||||
uint8 ItemsCount = _worldPacket.ReadBits(5);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
for (uint8 i = 0; i < ItemsCount; i++)
|
||||
{
|
||||
WorldPackets::AuctionHouse::AuctionSellItem::AuctionItemForSale item;
|
||||
_worldPacket >> item.Guid;
|
||||
_worldPacket >> item.UseCount;
|
||||
Items.emplace_back(item);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionPlaceBid::Read()
|
||||
{
|
||||
_worldPacket >> Auctioneer;
|
||||
_worldPacket >> AuctionItemID;
|
||||
_worldPacket >> BidAmount;
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionListBidderItems::Read()
|
||||
{
|
||||
_worldPacket >> Auctioneer;
|
||||
_worldPacket >> Offset;
|
||||
uint8 auctionItemIDsCount = _worldPacket.ReadBits(7);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
for (uint8 i = 0; i < auctionItemIDsCount; i++)
|
||||
{
|
||||
uint32 AuctionItemID = 0;
|
||||
_worldPacket >> AuctionItemID;
|
||||
AuctionItemIDs.emplace_back(AuctionItemID);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionRemoveItem::Read()
|
||||
{
|
||||
_worldPacket >> Auctioneer;
|
||||
_worldPacket >> AuctionItemID;
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionReplicateItems::Read()
|
||||
{
|
||||
_worldPacket >> Auctioneer;
|
||||
_worldPacket >> Count;
|
||||
_worldPacket >> ChangeNumberGlobal;
|
||||
_worldPacket >> ChangeNumberCursor;
|
||||
_worldPacket >> ChangeNumberTombstone;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionListItemsResult::Write()
|
||||
{
|
||||
_worldPacket << int32(Items.size());
|
||||
_worldPacket << int32(TotalCount);
|
||||
_worldPacket << int32(DesiredDelay);
|
||||
|
||||
for (auto const& item : Items)
|
||||
_worldPacket << item;
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
_worldPacket.WriteBit(OnlyUsable);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionListOwnerItemsResult::Write()
|
||||
{
|
||||
_worldPacket << int32(Items.size());
|
||||
_worldPacket << uint32(TotalCount);
|
||||
_worldPacket << uint32(DesiredDelay);
|
||||
|
||||
for (auto const& item : Items)
|
||||
_worldPacket << item;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionListBidderItemsResult::Write()
|
||||
{
|
||||
_worldPacket << int32(Items.size());
|
||||
_worldPacket << uint32(TotalCount);
|
||||
_worldPacket << uint32(DesiredDelay);
|
||||
|
||||
for (auto const& item : Items)
|
||||
_worldPacket << item;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionListItems::Read()
|
||||
{
|
||||
_worldPacket >> Offset;
|
||||
_worldPacket >> Auctioneer;
|
||||
_worldPacket >> MinLevel;
|
||||
_worldPacket >> MaxLevel;
|
||||
_worldPacket >> ItemClass;
|
||||
_worldPacket >> InvType;
|
||||
_worldPacket >> ItemSubclass;
|
||||
_worldPacket >> Quality;
|
||||
_worldPacket >> SortCount;
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
uint32 nameLength = _worldPacket.ReadBits(8);
|
||||
Name = _worldPacket.ReadString(nameLength);
|
||||
OnlyUsable = _worldPacket.ReadBit();
|
||||
ExactMatch = _worldPacket.ReadBit();
|
||||
|
||||
_worldPacket.read_skip<uint32>(); // DataSize = (SortCount * 2)
|
||||
for (int32 i = 0; i < SortCount; i++)
|
||||
{
|
||||
WorldPackets::AuctionHouse::AuctionListItems::Sort sort;
|
||||
_worldPacket >> sort.UnkByte1;
|
||||
_worldPacket >> sort.UnkByte2;
|
||||
DataSort.emplace_back(sort);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldPackets::AuctionHouse::AuctionListOwnerItems::Read()
|
||||
{
|
||||
_worldPacket >> Auctioneer;
|
||||
_worldPacket >> Offset;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionListPendingSalesResult::Write()
|
||||
{
|
||||
_worldPacket << int32(Mails.size());
|
||||
_worldPacket << int32(TotalNumRecords);
|
||||
|
||||
for (auto const& mail : Mails)
|
||||
_worldPacket << mail;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionClosedNotification::Write()
|
||||
{
|
||||
_worldPacket << Info;
|
||||
_worldPacket << float(ProceedsMailDelay);
|
||||
_worldPacket.WriteBit(Sold);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionOwnerBidNotification::Write()
|
||||
{
|
||||
_worldPacket << Info;
|
||||
_worldPacket << uint64(MinIncrement);
|
||||
_worldPacket << Bidder;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionWonNotification::Write()
|
||||
{
|
||||
_worldPacket << Info;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionOutBidNotification::Write()
|
||||
{
|
||||
_worldPacket << Info;
|
||||
_worldPacket << uint64(BidAmount);
|
||||
_worldPacket << uint64(MinIncrement);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::AuctionHouse::AuctionReplicateResponse::Write()
|
||||
{
|
||||
//Todo order
|
||||
_worldPacket << int32(ChangeNumberCursor);
|
||||
_worldPacket << int32(ChangeNumberGlobal);
|
||||
_worldPacket << int32(DesiredDelay);
|
||||
_worldPacket << int32(ChangeNumberTombstone);
|
||||
_worldPacket << int32(Result);
|
||||
_worldPacket << int32(Items.size());
|
||||
|
||||
for (auto const& item : Items)
|
||||
_worldPacket << item;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -16,16 +16,67 @@
|
||||
*/
|
||||
|
||||
#ifndef AuctionHousePackets_h__
|
||||
#define AuctionHousePackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
|
||||
struct AuctionEntry;
|
||||
#include "ItemPackets.h"
|
||||
#include "MailPackets.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace AuctionHouse
|
||||
{
|
||||
struct AuctionItem
|
||||
{
|
||||
struct AuctionItemEnchant
|
||||
{
|
||||
AuctionItemEnchant(int32 id, uint32 expiration, int32 charges, uint8 slot) : ID(id), Expiration(expiration), Charges(charges), Slot(slot) { }
|
||||
int32 ID = 0;
|
||||
uint32 Expiration = 0;
|
||||
int32 Charges = 0;
|
||||
uint8 Slot = 0;
|
||||
};
|
||||
|
||||
Item::ItemInstance Item;
|
||||
int32 Count = 0;
|
||||
int32 Charges = 0;
|
||||
std::vector<AuctionItemEnchant> Enchantments;
|
||||
int32 Flags = 0;
|
||||
int32 AuctionItemID = 0;
|
||||
ObjectGuid Owner;
|
||||
uint64 MinBid = 0;
|
||||
uint64 MinIncrement = 0;
|
||||
uint64 BuyoutPrice = 0;
|
||||
int32 DurationLeft = 0;
|
||||
uint8 DeleteReason = 0;
|
||||
bool CensorServerSideInfo = false;
|
||||
bool CensorBidInfo = false;
|
||||
ObjectGuid ItemGuid;
|
||||
ObjectGuid OwnerAccountID;
|
||||
uint32 EndTime = 0;
|
||||
ObjectGuid Bidder;
|
||||
uint64 BidAmount = 0;
|
||||
};
|
||||
|
||||
struct AuctionOwnerNotification
|
||||
{
|
||||
void Initialize(::AuctionEntry const* auction, ::Item const* item);
|
||||
|
||||
int32 AuctionItemID = 0;
|
||||
uint64 BidAmount = 0;
|
||||
Item::ItemInstance Item;
|
||||
};
|
||||
|
||||
struct AuctionBidderNotification
|
||||
{
|
||||
void Initialize(::AuctionEntry const* auction, ::Item const* item);
|
||||
|
||||
int32 AuctionItemID = 0;
|
||||
ObjectGuid Bidder;
|
||||
Item::ItemInstance Item;
|
||||
};
|
||||
|
||||
class AuctionHelloRequest final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
@@ -58,17 +109,242 @@ namespace WorldPackets
|
||||
*
|
||||
* @param auction The relevant auction object
|
||||
*/
|
||||
void InitializeAuction(AuctionEntry* auction);
|
||||
void InitializeAuction(::AuctionEntry* auction);
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 AuctionId = 0; ///< the id of the auction that triggered this notification
|
||||
uint32 Action = 0; ///< the type of action that triggered this notification. Possible values are @ref AuctionAction
|
||||
uint32 ErrorCode = 0; ///< the error code that was generated when trying to perform the action. Possible values are @ref AuctionError
|
||||
uint64 Bid = 0; ///< the amount of money that the player bid in copper
|
||||
uint32 BidError = 0; ///< the bid error. Possible values are @ref AuctionError
|
||||
ObjectGuid Bidder; ///< the GUID of the bidder for this auction.
|
||||
uint64 AuctionOutBid = 0; ///< the sum of outbid is (1% of current bid) * 5, if the bid is too small, then this value is 1 copper.
|
||||
uint32 AuctionItemID = 0; ///< the id of the auction that triggered this notification
|
||||
uint32 Command = 0; ///< the type of action that triggered this notification. Possible values are @ref AuctionAction
|
||||
int32 ErrorCode = 0; ///< the error code that was generated when trying to perform the action. Possible values are @ref AuctionError
|
||||
uint64 Money = 0; ///< the amount of money that the player bid in copper
|
||||
int32 BagResult = 0; ///< the bid error. Possible values are @ref AuctionError
|
||||
ObjectGuid Guid; ///< the GUID of the bidder for this auction.
|
||||
uint64 MinIncrement = 0; ///< the sum of outbid is (1% of current bid) * 5, if the bid is too small, then this value is 1 copper.
|
||||
};
|
||||
|
||||
class AuctionSellItem final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
struct AuctionItemForSale
|
||||
{
|
||||
ObjectGuid Guid;
|
||||
uint32 UseCount = 0;
|
||||
};
|
||||
|
||||
AuctionSellItem(WorldPacket&& packet) : ClientPacket(CMSG_AUCTION_SELL_ITEM, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint64 BuyoutPrice = 0;
|
||||
ObjectGuid Auctioneer;
|
||||
uint64 MinBid = 0;
|
||||
uint32 RunTime = 0;
|
||||
std::vector<AuctionItemForSale> Items;
|
||||
};
|
||||
|
||||
class AuctionPlaceBid final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AuctionPlaceBid(WorldPacket&& packet) : ClientPacket(CMSG_AUCTION_PLACE_BID, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Auctioneer;
|
||||
uint64 BidAmount = 0;
|
||||
int32 AuctionItemID = 0;
|
||||
};
|
||||
|
||||
class AuctionListBidderItems final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AuctionListBidderItems(WorldPacket&& packet) : ClientPacket(CMSG_AUCTION_LIST_BIDDER_ITEMS, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 Offset = 0;
|
||||
std::vector<uint32> AuctionItemIDs;
|
||||
ObjectGuid Auctioneer;
|
||||
};
|
||||
|
||||
class AuctionRemoveItem final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AuctionRemoveItem(WorldPacket&& packet) : ClientPacket(CMSG_AUCTION_REMOVE_ITEM, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Auctioneer;
|
||||
int32 AuctionItemID = 0;
|
||||
};
|
||||
|
||||
class AuctionReplicateItems final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AuctionReplicateItems(WorldPacket&& packet) : ClientPacket(CMSG_AUCTION_REPLICATE_ITEMS, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Auctioneer;
|
||||
int32 Count = 0;
|
||||
int32 ChangeNumberGlobal = 0;
|
||||
int32 ChangeNumberCursor = 0;
|
||||
int32 ChangeNumberTombstone = 0;
|
||||
};
|
||||
|
||||
class AuctionListPendingSales final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AuctionListPendingSales(WorldPacket&& packet) : ClientPacket(CMSG_AUCTION_LIST_PENDING_SALES, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class AuctionListItemsResult final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionListItemsResult() : ServerPacket(SMSG_AUCTION_LIST_ITEMS_RESULT, 150) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 DesiredDelay = 0;
|
||||
std::vector<AuctionItem> Items;
|
||||
bool OnlyUsable = true;
|
||||
uint32 TotalCount = 0;
|
||||
};
|
||||
|
||||
class AuctionListOwnerItemsResult final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionListOwnerItemsResult() : ServerPacket(SMSG_AUCTION_LIST_OWNER_ITEMS_RESULT, 149) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 DesiredDelay = 0;
|
||||
uint32 TotalCount = 0;
|
||||
std::vector<AuctionItem> Items;
|
||||
};
|
||||
|
||||
class AuctionListBidderItemsResult final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionListBidderItemsResult() : ServerPacket(SMSG_AUCTION_LIST_BIDDER_ITEMS_RESULT, 149) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 DesiredDelay = 0;
|
||||
uint32 TotalCount = 0;
|
||||
std::vector<AuctionItem> Items;
|
||||
};
|
||||
|
||||
class AuctionListOwnerItems final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AuctionListOwnerItems(WorldPacket&& packet) : ClientPacket(CMSG_AUCTION_LIST_OWNER_ITEMS, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Auctioneer;
|
||||
uint32 Offset = 0;
|
||||
};
|
||||
|
||||
class AuctionListItems final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
struct Sort
|
||||
{
|
||||
uint8 UnkByte1 = 0;
|
||||
uint8 UnkByte2 = 0;
|
||||
};
|
||||
|
||||
AuctionListItems(WorldPacket&& packet) : ClientPacket(CMSG_AUCTION_LIST_ITEMS, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Auctioneer;
|
||||
uint8 SortCount = 0;
|
||||
uint8 MaxLevel = 100;
|
||||
uint32 Offset = 0;
|
||||
int32 ItemClass = 0;
|
||||
uint8 MinLevel = 1;
|
||||
int32 InvType = 0;
|
||||
int32 Quality = 0;
|
||||
int32 ItemSubclass = 0;
|
||||
bool ExactMatch = true;
|
||||
std::string Name;
|
||||
bool OnlyUsable = false;
|
||||
std::vector<Sort> DataSort;
|
||||
};
|
||||
|
||||
class AuctionListPendingSalesResult final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionListPendingSalesResult() : ServerPacket(SMSG_AUCTION_LIST_PENDING_SALES_RESULT, 140) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::vector<Mail::MailListEntry> Mails;
|
||||
int32 TotalNumRecords = 0;
|
||||
};
|
||||
|
||||
class AuctionClosedNotification final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionClosedNotification() : ServerPacket(SMSG_AUCTION_CLOSED_NOTIFICATION, 45) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
AuctionOwnerNotification Info;
|
||||
float ProceedsMailDelay = 0.0f;
|
||||
bool Sold = true;
|
||||
};
|
||||
|
||||
class AuctionOwnerBidNotification final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionOwnerBidNotification() : ServerPacket(SMSG_AUCTION_OWNER_BID_NOTIFICATION, 62) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
AuctionOwnerNotification Info;
|
||||
ObjectGuid Bidder;
|
||||
uint64 MinIncrement = 0;
|
||||
};
|
||||
|
||||
class AuctionWonNotification final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionWonNotification() : ServerPacket(SMSG_AUCTION_WON_NOTIFICATION, 46) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
AuctionBidderNotification Info;
|
||||
};
|
||||
|
||||
class AuctionOutBidNotification final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionOutBidNotification() : ServerPacket(SMSG_AUCTION_OUTBID_NOTIFICATION, 62) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
AuctionBidderNotification Info;
|
||||
uint64 BidAmount = 0;
|
||||
uint64 MinIncrement = 0;
|
||||
};
|
||||
|
||||
class AuctionReplicateResponse final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AuctionReplicateResponse() : ServerPacket(SMSG_AUCTION_REPLICATE_RESPONSE, 165) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 ChangeNumberCursor = 0;
|
||||
uint32 ChangeNumberGlobal = 0;
|
||||
uint32 DesiredDelay = 0;
|
||||
uint32 ChangeNumberTombstone = 0;
|
||||
uint32 Result = 0;
|
||||
std::vector<AuctionItem> Items;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,15 +163,15 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_HANDLER(CMSG_AREA_TRIGGER, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Misc::AreaTrigger, &WorldSession::HandleAreaTriggerOpcode);
|
||||
DEFINE_HANDLER(CMSG_ATTACK_STOP, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Combat::AttackStop, &WorldSession::HandleAttackStopOpcode);
|
||||
DEFINE_HANDLER(CMSG_ATTACK_SWING, STATUS_LOGGEDIN, PROCESS_INPLACE, WorldPackets::Combat::AttackSwing, &WorldSession::HandleAttackSwingOpcode);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_HELLO_REQUEST, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionHelloRequest, &WorldSession::HandleAuctionHelloOpcode);
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_LIST_BIDDER_ITEMS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListBidderItems );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_LIST_ITEMS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListItems );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_LIST_OWNER_ITEMS, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListOwnerItems );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_LIST_PENDING_SALES, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionListPendingSales );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_PLACE_BID, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionPlaceBid );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_REMOVE_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionRemoveItem );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_REPLICATE_ITEMS, STATUS_UNHANDLED, PROCESS_INPLACE, &WorldSession::Handle_NULL );
|
||||
DEFINE_OPCODE_HANDLER_OLD(CMSG_AUCTION_SELL_ITEM, STATUS_UNHANDLED, PROCESS_THREADUNSAFE, &WorldSession::HandleAuctionSellItem );
|
||||
DEFINE_HANDLER(CMSG_AUCTION_HELLO_REQUEST, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionHelloRequest, &WorldSession::HandleAuctionHelloOpcode);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_LIST_BIDDER_ITEMS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionListBidderItems, &WorldSession::HandleAuctionListBidderItems);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_LIST_ITEMS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionListItems, &WorldSession::HandleAuctionListItems);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_LIST_OWNER_ITEMS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionListOwnerItems, &WorldSession::HandleAuctionListOwnerItems);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_LIST_PENDING_SALES, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionListPendingSales, &WorldSession::HandleAuctionListPendingSales);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_PLACE_BID, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionPlaceBid, &WorldSession::HandleAuctionPlaceBid);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_REMOVE_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionRemoveItem, &WorldSession::HandleAuctionRemoveItem);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_REPLICATE_ITEMS, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionReplicateItems, &WorldSession::HandleReplicateItems);
|
||||
DEFINE_HANDLER(CMSG_AUCTION_SELL_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::AuctionHouse::AuctionSellItem, &WorldSession::HandleAuctionSellItem);
|
||||
DEFINE_HANDLER(CMSG_AUTH_CONTINUED_SESSION, STATUS_NEVER, PROCESS_INPLACE, WorldPacket, &WorldSession::Handle_EarlyProccess);
|
||||
DEFINE_HANDLER(CMSG_AUTH_SESSION, STATUS_NEVER, PROCESS_INPLACE, WorldPacket, &WorldSession::Handle_EarlyProccess);
|
||||
DEFINE_HANDLER(CMSG_AUTOBANK_ITEM, STATUS_LOGGEDIN, PROCESS_THREADUNSAFE, WorldPackets::Bank::AutoBankItem, &WorldSession::HandleAutoBankItemOpcode);
|
||||
@@ -867,17 +867,17 @@ void OpcodeTable::Initialize()
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ATTACK_STOP, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ATTACK_SWING_ERROR, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_ATTACK_SWING_LANDED_LOG, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_CLOSED_NOTIFICATION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_COMMAND_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_HELLO_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_LIST_BIDDER_ITEMS_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_LIST_ITEMS_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_LIST_OWNER_ITEMS_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_LIST_PENDING_SALES_RESULT, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_OUTBID_NOTIFICATION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_OWNER_BID_NOTIFICATION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_REPLICATE_RESPONSE, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_WON_NOTIFICATION, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_CLOSED_NOTIFICATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_COMMAND_RESULT, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_HELLO_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_LIST_BIDDER_ITEMS_RESULT, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_LIST_ITEMS_RESULT, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_LIST_OWNER_ITEMS_RESULT, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_LIST_PENDING_SALES_RESULT, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_OUTBID_NOTIFICATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_OWNER_BID_NOTIFICATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_REPLICATE_RESPONSE, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUCTION_WON_NOTIFICATION, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AURA_POINTS_DEPLETED, STATUS_UNHANDLED, CONNECTION_TYPE_REALM);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AURA_UPDATE, STATUS_NEVER, CONNECTION_TYPE_INSTANCE);
|
||||
DEFINE_SERVER_OPCODE_HANDLER(SMSG_AUTH_CHALLENGE, STATUS_NEVER, CONNECTION_TYPE_REALM);
|
||||
|
||||
@@ -82,6 +82,14 @@ namespace WorldPackets
|
||||
namespace AuctionHouse
|
||||
{
|
||||
class AuctionHelloRequest;
|
||||
class AuctionListBidderItems;
|
||||
class AuctionListItems;
|
||||
class AuctionListOwnerItems;
|
||||
class AuctionListPendingSales;
|
||||
class AuctionPlaceBid;
|
||||
class AuctionRemoveItem;
|
||||
class AuctionReplicateItems;
|
||||
class AuctionSellItem;
|
||||
}
|
||||
|
||||
namespace Auth
|
||||
@@ -747,7 +755,7 @@ class WorldSession
|
||||
}
|
||||
//used with item_page table
|
||||
bool SendItemInfo(uint32 itemid, WorldPacket data);
|
||||
//auction
|
||||
// Auction
|
||||
void SendAuctionHello(ObjectGuid guid, Creature* unit);
|
||||
|
||||
/**
|
||||
@@ -761,10 +769,10 @@ class WorldSession
|
||||
* @param bidError (Optional) the bid error.
|
||||
*/
|
||||
void SendAuctionCommandResult(AuctionEntry* auction, uint32 Action, uint32 ErrorCode, uint32 bidError = 0);
|
||||
|
||||
void SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template);
|
||||
void SendAuctionOwnerNotification(AuctionEntry* auction);
|
||||
void SendAuctionRemovedNotification(uint32 auctionId, uint32 itemEntry, int32 randomPropertyId);
|
||||
void SendAuctionOutBidNotification(AuctionEntry const* auction, Item const* item);
|
||||
void SendAuctionClosedNotification(AuctionEntry const* auction, float mailDelay, bool sold, Item const* item);
|
||||
void SendAuctionWonNotification(AuctionEntry const* auction, Item const* item);
|
||||
void SendAuctionOwnerBidNotification(AuctionEntry const* auction, Item const* item);
|
||||
|
||||
// Black Market
|
||||
void SendBlackMarketOpenResult(ObjectGuid guid, Creature* auctioneer);
|
||||
@@ -1106,13 +1114,14 @@ class WorldSession
|
||||
void HandleUnacceptTradeOpcode(WorldPackets::Trade::UnacceptTrade& unacceptTrade);
|
||||
|
||||
void HandleAuctionHelloOpcode(WorldPackets::AuctionHouse::AuctionHelloRequest& packet);
|
||||
void HandleAuctionListItems(WorldPacket& recvData);
|
||||
void HandleAuctionListBidderItems(WorldPacket& recvData);
|
||||
void HandleAuctionSellItem(WorldPacket& recvData);
|
||||
void HandleAuctionRemoveItem(WorldPacket& recvData);
|
||||
void HandleAuctionListOwnerItems(WorldPacket& recvData);
|
||||
void HandleAuctionPlaceBid(WorldPacket& recvData);
|
||||
void HandleAuctionListPendingSales(WorldPacket& recvData);
|
||||
void HandleAuctionListItems(WorldPackets::AuctionHouse::AuctionListItems& packet);
|
||||
void HandleAuctionListBidderItems(WorldPackets::AuctionHouse::AuctionListBidderItems& packet);
|
||||
void HandleAuctionSellItem(WorldPackets::AuctionHouse::AuctionSellItem& packet);
|
||||
void HandleAuctionRemoveItem(WorldPackets::AuctionHouse::AuctionRemoveItem& packet);
|
||||
void HandleAuctionListOwnerItems(WorldPackets::AuctionHouse::AuctionListOwnerItems& packet);
|
||||
void HandleAuctionPlaceBid(WorldPackets::AuctionHouse::AuctionPlaceBid& packet);
|
||||
void HandleAuctionListPendingSales(WorldPackets::AuctionHouse::AuctionListPendingSales& packet);
|
||||
void HandleReplicateItems(WorldPackets::AuctionHouse::AuctionReplicateItems& packet);
|
||||
|
||||
// Bank
|
||||
void HandleAutoBankItemOpcode(WorldPackets::Bank::AutoBankItem& packet);
|
||||
|
||||
Reference in New Issue
Block a user