47 TC_LOG_DEBUG(
"network",
"WORLD: HandleAuctionHelloOpcode - Unit ({}) not found or you can't interact with him.", guid.
ToString());
82 data <<
int32(auction ? auction->
Id : 0);
83 data <<
int32(command);
84 data <<
int32(errorCode);
112 data <<
uint32(auctionId);
116 data <<
uint32(itemEntry);
138 data <<
uint32(auctionId);
139 data <<
uint32(itemEntry);
140 data <<
uint32(randomPropertyId);
148 uint32 itemsCount, etime, bid, buyout;
149 recvData >> auctioneer;
150 recvData >> itemsCount;
154 memset(count, 0,
sizeof(count));
163 for (
uint32 i = 0; i < itemsCount; ++i)
165 recvData >> itemGUIDs[i];
166 recvData >> count[i];
168 if (!itemGUIDs[i] || !count[i] || count[i] > 1000)
192 TC_LOG_DEBUG(
"network",
"WORLD: HandleAuctionSellItem - Unit ({}) not found or you can't interact with him.", auctioneer.
ToString());
197 if (!auctionHouseEntry)
199 TC_LOG_DEBUG(
"network",
"WORLD: HandleAuctionSellItem - Unit ({}) has wrong faction.", auctioneer.
ToString());
223 for (
uint32 i = 0; i < itemsCount; ++i)
245 finalCount += count[i];
255 for (
uint32 i = 0; i < itemsCount - 1; ++i)
257 for (
uint32 j = i + 1; j < itemsCount; ++j)
259 if (itemGUIDs[i] == itemGUIDs[j])
267 for (
uint32 i = 0; i < itemsCount; ++i)
269 Item* item = items[i];
278 Item* item = items[0];
283 uint32 deposit =
sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, item, finalCount);
319 if (itemsCount == 1 && item->
GetCount() == count[0])
323 sLog->OutCommand(
GetAccountId(),
"GM {} (Account: {}) create auction: {} (Entry: {} Count: {})",
342 TC_LOG_INFO(
"network",
"CMSG_AUCTION_SELL_ITEM: {} {} is selling item {} {} to auctioneer {} with count {} with initial bid {} with buyout {} and with time {} (in sec) in auctionhouse {}",
374 TC_LOG_ERROR(
"network",
"CMSG_AUCTION_SELL_ITEM: Could not create clone of item {}", item->
GetEntry());
382 sLog->OutCommand(
GetAccountId(),
"GM {} (Account: {}) create auction: {} (Entry: {} Count: {})",
401 TC_LOG_INFO(
"network",
"CMSG_AUCTION_SELL_ITEM: {} {} is selling item {} {} to auctioneer {} with count {} with initial bid {} with buyout {} and with time {} (in sec) in auctionhouse {}",
414 for (
uint32 j = 0; j < itemsCount; ++j)
416 Item* item2 = items[j];
457 TC_LOG_DEBUG(
"network",
"WORLD: Received CMSG_AUCTION_PLACE_BID");
462 recvData >> auctioneer;
463 recvData >> auctionId >> price;
465 if (!auctionId || !price)
471 TC_LOG_DEBUG(
"network",
"WORLD: HandleAuctionPlaceBid - {} not found or you can't interact with him.", auctioneer.
ToString());
492 ObjectGuid ownerGuid = ObjectGuid::Create<HighGuid::Player>(auction->
owner);
502 if (price <= auction->bid || price < auction->startbid)
506 if ((price < auction->buyout || auction->
buyout == 0) &&
523 if (price < auction->buyout || auction->
buyout == 0)
540 auction->
bid = price;
588 sAuctionMgr->SendAuctionSalePendingMail(auction, trans);
589 sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
606 TC_LOG_DEBUG(
"network",
"WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
610 recvData >> auctioneer;
611 recvData >> auctionId;
616 TC_LOG_DEBUG(
"network",
"WORLD: HandleAuctionRemoveItem - {} not found or you can't interact with him.", auctioneer.
ToString());
640 sAuctionMgr->SendAuctionCancelledToBidderMail(auction, trans, pItem);
660 TC_LOG_ERROR(
"entities.player.cheat",
"CHEATER : {} tried to cancel auction (id: {}) of another player or auction is NULL", player->
GetGUID().
ToString(), auctionId);
680 TC_LOG_DEBUG(
"network",
"WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
687 recvData >> listfrom;
688 recvData >> outbiddedCount;
689 if (recvData.
size() != (16 + outbiddedCount * 4))
691 TC_LOG_ERROR(
"network",
"Client sent bad opcode!!! with count: {} and size : {} (must be: {})", outbiddedCount, (
unsigned long)recvData.
size(), (16 + outbiddedCount * 4));
698 TC_LOG_DEBUG(
"network",
"WORLD: HandleAuctionListBidderItems - {} not found or you can't interact with him.", guid.
ToString());
714 while (outbiddedCount > 0)
717 uint32 outbiddedAuctionId;
718 recvData >> outbiddedAuctionId;
737 TC_LOG_DEBUG(
"network",
"WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
743 recvData >> listfrom;
748 TC_LOG_DEBUG(
"network",
"WORLD: HandleAuctionListOwnerItems - {} not found or you can't interact with him.", guid.
ToString());
766 data <<
uint32(totalcount);
774 TC_LOG_DEBUG(
"network",
"WORLD: Received CMSG_AUCTION_LIST_ITEMS");
776 std::string searchedname;
777 uint8 levelmin, levelmax, usable, getAll;
778 uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
782 recvData >> listfrom;
783 recvData >> searchedname;
785 recvData >> levelmin >> levelmax;
786 recvData >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
787 recvData >> quality >> usable;
794 for (
uint8 i = 0; i < unkCnt; i++)
803 TC_LOG_DEBUG(
"network",
"WORLD: HandleAuctionListItems - {} not found or you can't interact with him.", guid.
ToString());
813 TC_LOG_DEBUG(
"auctionHouse",
"Auctionhouse search ({}) list from: {}, searchedname: {}, levelmin: {}, levelmax: {}, auctionSlotID: {}, auctionMainCategory: {}, auctionSubCategory: {}, quality: {}, usable: {}",
814 guid.
ToString(), listfrom, searchedname, levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable);
822 std::wstring wsearchedname;
829 wsearchedname, listfrom, levelmin, levelmax, usable,
830 auctionSlotID, auctionMainCategory, auctionSubCategory, quality,
834 data <<
uint32(totalcount);
841 TC_LOG_DEBUG(
"network",
"WORLD: Received CMSG_AUCTION_LIST_PENDING_SALES");
@ AUCTION_ENTRY_FLAG_NONE
@ AUCTION_ENTRY_FLAG_GM_LOG_BUYER
@ ERR_AUCTION_NOT_ENOUGHT_MONEY
@ ERR_AUCTION_ITEM_NOT_FOUND
@ ERR_AUCTION_DATABASE_ERROR
#define MAX_AUCTION_ITEMS
@ CHAR_INS_AUCTION_BIDDERS
@ ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION
@ ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
#define TC_LOG_DEBUG(filterType__,...)
#define TC_LOG_ERROR(filterType__,...)
#define TC_LOG_INFO(filterType__,...)
@ MAIL_CHECK_MASK_COPIED
This mail was returned. Do not allow returning mail back again.
uint32 const MAX_MONEY_AMOUNT
@ UNIT_NPC_FLAG_AUCTIONEER
void wstrToLower(std::wstring &str)
bool Utf8toWStr(char const *utf8str, size_t csize, wchar_t *wstr, size_t &wsize)
static AuctionHouseEntry const * GetAuctionHouseEntry(uint32 factionTemplateId)
void BuildListBidderItems(WorldPacket &data, Player *player, uint32 &count, uint32 &totalcount)
AuctionEntry * GetAuction(uint32 id) const
void AddAuction(AuctionEntry *auction)
void BuildListAuctionItems(WorldPacket &data, 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, bool getall=false)
void BuildListOwnerItems(WorldPacket &data, Player *player, uint32 &count, uint32 &totalcount)
bool RemoveAuction(AuctionEntry *auction)
void put(std::size_t pos, T value)
ObjectGuid::LowType GetSpawnId() const
static void DeleteFromInventoryDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
virtual void SaveToDB(CharacterDatabaseTransaction trans)
Item * CloneItem(uint32 count, Player const *player=nullptr) const
bool CanBeTraded(bool mail=false, bool trade=false) const
void SetCount(uint32 value)
ItemTemplate const * GetTemplate() const
bool IsNotEmptyBag() const
uint32 GetMaxStackCount() const
static void DeleteFromDB(CharacterDatabaseTransaction trans, ObjectGuid::LowType itemGuid)
void SendMailTo(CharacterDatabaseTransaction trans, MailReceiver const &receiver, MailSender const &sender, MailCheckMask checked=MAIL_CHECK_MASK_NONE, uint32 deliver_delay=0)
MailDraft & AddItem(Item *item)
LowType GetCounter() const
std::string ToString() const
uint32 GetUInt32Value(uint16 index) const
static ObjectGuid GetGUID(Object const *o)
void SendUpdateToPlayer(Player *player)
void ItemRemovedQuestCheck(uint32 entry, uint32 count)
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, WorldObject *ref=nullptr)
bool ModifyMoney(int32 amount, bool sendError=true)
WorldSession * GetSession() const
bool HasEnoughMoney(uint32 amount) const
void MoveItemFromInventory(uint8 bag, uint8 slot, bool update)
Creature * GetNPCIfCanInteractWith(ObjectGuid const &guid, NPCFlags npcFlags) const
Item * GetItemByGuid(ObjectGuid guid) const
void setUInt32(uint8 index, uint32 value)
void setUInt8(uint8 index, uint8 value)
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
uint32 GetFaction() const override
std::string const & GetName() const
void HandleAuctionListPendingSales(WorldPacket &recvData)
void HandleAuctionListItems(WorldPacket &recvData)
char const * GetTrinityString(uint32 entry) const
void HandleAuctionListOwnerItems(WorldPacket &recvData)
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
void SendNotification(const char *format,...) ATTR_PRINTF(2
void SendAuctionRemovedNotification(uint32 auctionId, uint32 itemEntry, int32 randomPropertyId)
void HandleAuctionSellItem(WorldPacket &recvData)
void SendAuctionOwnerNotification(AuctionEntry *auction)
Player * GetPlayer() const
void HandleAuctionHelloOpcode(WorldPacket &recvPacket)
bool HasPermission(uint32 permissionId)
void HandleAuctionListBidderItems(WorldPacket &recvData)
uint32 GetAccountId() const
void SendAuctionHello(ObjectGuid guid, Unit const *unit)
void SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template)
void HandleAuctionRemoveItem(WorldPacket &recvData)
void HandleAuctionPlaceBid(WorldPacket &recvData)
std::string const & GetPlayerName() const
void SendAuctionCommandResult(AuctionEntry const *auction, AuctionAction command, AuctionError errorCode, InventoryResult bagResult=InventoryResult(0))
Notifies the client of the result of his last auction operation. It is called when the player bids,...
@ SMSG_AUCTION_BIDDER_LIST_RESULT
@ SMSG_AUCTION_BIDDER_NOTIFICATION
@ SMSG_AUCTION_LIST_RESULT
@ SMSG_AUCTION_COMMAND_RESULT
@ SMSG_AUCTION_REMOVED_NOTIFICATION
@ SMSG_AUCTION_OWNER_LIST_RESULT
@ SMSG_AUCTION_LIST_PENDING_SALES
@ SMSG_AUCTION_OWNER_NOTIFICATION
@ CONFIG_AUCTION_GETALL_DELAY
@ CONFIG_AUCTION_LEVEL_REQ
@ CONFIG_AUCTION_SEARCH_DELAY
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
ObjectGuid::LowType bidder
uint32 GetAuctionOutBid() const
the sum of outbid is (1% from current bid)*5, if bid is very small, it is 1c
void DeleteFromDB(CharacterDatabaseTransaction trans) const
AuctionHouseEntry const * auctionHouseEntry
std::unordered_set< ObjectGuid > bidders
void SaveToDB(CharacterDatabaseTransaction trans) const
ObjectGuid::LowType owner
std::string BuildAuctionMailSubject(MailAuctionAnswers response) const
uint32 GetAuctionCut() const
ObjectGuid::LowType itemGUIDLow
bool BuildAuctionInfo(WorldPacket &data, Item *sourceItem=nullptr) const
bool HasFlag(ItemFlags flag) const