From bcdc3ae4032f6377d5bad472d476087ff3db86ed Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sun, 12 Apr 2026 16:46:03 +0200 Subject: [PATCH] feat(Core/Misc): add log types player trade, mail & auctionhouse (#25430) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> --- .../apps/worldserver/worldserver.conf.dist | 3 +++ .../game/AuctionHouse/AuctionHouseMgr.cpp | 13 +++++++++++ .../game/Handlers/AuctionHouseHandler.cpp | 22 +++++++++++++++++++ src/server/game/Handlers/MailHandler.cpp | 8 +++++++ src/server/game/Handlers/TradeHandler.cpp | 19 ++++++++++++++++ 5 files changed, 65 insertions(+) diff --git a/src/server/apps/worldserver/worldserver.conf.dist b/src/server/apps/worldserver/worldserver.conf.dist index 0990fb4e6..361b32e8e 100644 --- a/src/server/apps/worldserver/worldserver.conf.dist +++ b/src/server/apps/worldserver/worldserver.conf.dist @@ -766,11 +766,14 @@ Logger.spells.scripts=2,Console Errors #Logger.entities.gameobject=4,Console Server #Logger.entities.object=4,Console Server #Logger.entities.pet=4,Console Server +#Logger.entities.player.auctionhouse=4,Console Server #Logger.entities.player.character=4,Console Server #Logger.entities.player.dump=4,Console Server #Logger.entities.player.items=4,Console Server #Logger.entities.player.loading=4,Console Server +#Logger.entities.player.mail=4,Console Server #Logger.entities.player.skills=4,Console Server +#Logger.entities.player.trade=4,Console Server #Logger.entities.player=4,Console Server #Logger.entities.transport=4,Console Server #Logger.entities.unit.ai=4,Console Server diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 2cf588a0d..481847d9d 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -153,6 +153,10 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, CharacterDatabas .AddItem(pItem) .SendMailTo(trans, MailReceiver(bidder, auction->bidder.GetCounter()), auction, MAIL_CHECK_MASK_COPIED); } + + LOG_INFO("entities.player.auctionhouse", "AuctionHouse: Auction #{} won: Bidder {} (GUID: {}), Item (Entry: {}) x{}, Bid: {} copper, Seller: {}", + auction->Id, bidder ? bidder->GetName() : "offline", auction->bidder.GetCounter(), + auction->item_template, auction->itemCount, auction->bid, auction->owner.GetCounter()); } else RemoveAItem(auction->item_guid, true, &trans); @@ -212,6 +216,11 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, Character .AddMoney(profit) .SendMailTo(trans, MailReceiver(owner, auction->owner.GetCounter()), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY)); + LOG_INFO("entities.player.auctionhouse", "AuctionHouse: Auction #{} sold: Seller {} (GUID: {}), Buyer: {} (GUID: {}), Item (Entry: {}) x{}, Sale Price: {} copper, Profit: {} copper (cut: {} copper)", + auction->Id, owner ? owner->GetName() : "offline", auction->owner.GetCounter(), + auction->bidder.GetCounter(), auction->item_template, auction->itemCount, + auction->bid, profit, auction->GetAuctionCut()); + if (auction->bid >= 500 * GOLD) if (CharacterCacheEntry const* gpd = sCharacterCache->GetCharacterCacheByGuid(auction->bidder)) { @@ -254,6 +263,10 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, CharacterDat .AddItem(pItem) .SendMailTo(trans, MailReceiver(owner, auction->owner.GetCounter()), auction, MAIL_CHECK_MASK_COPIED, 0); } + + LOG_INFO("entities.player.auctionhouse", "AuctionHouse: Auction #{} expired: Seller {} (GUID: {}), Item (Entry: {}) x{}, Buyout was: {} copper", + auction->Id, owner ? owner->GetName() : "offline", auction->owner.GetCounter(), + auction->item_template, auction->itemCount, auction->buyout); } else RemoveAItem(auction->item_guid, true, &trans); diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 50df6f4d3..5c0329186 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -322,6 +322,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, ERR_AUCTION_OK); GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1); + + LOG_INFO("entities.player.auctionhouse", "AuctionHouse: Account: {} (IP: {}), Player [{}] (GUID: {}) created auction #{}: Item '{}' (Entry: {}) x{}, StartBid: {} copper, Buyout: {} copper, Deposit: {} copper", + GetAccountId(), GetRemoteAddress(), _player->GetName(), _player->GetGUID().GetCounter(), AH->Id, + item->GetTemplate()->Name1, item->GetEntry(), item->GetCount(), bid, buyout, deposit); + return; } else // Required stack size of auction does not match to current item stack size, clone item and set correct stack size @@ -384,6 +389,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) SendAuctionCommandResult(AH->Id, AUCTION_SELL_ITEM, ERR_AUCTION_OK); GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CREATE_AUCTION, 1); + + LOG_INFO("entities.player.auctionhouse", "AuctionHouse: Account: {} (IP: {}), Player [{}] (GUID: {}) created auction #{}: Item '{}' (Entry: {}) x{}, StartBid: {} copper, Buyout: {} copper, Deposit: {} copper", + GetAccountId(), GetRemoteAddress(), _player->GetName(), _player->GetGUID().GetCounter(), AH->Id, + newItem->GetTemplate()->Name1, newItem->GetEntry(), newItem->GetCount(), bid, buyout, deposit); + return; } } @@ -490,6 +500,10 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) trans->Append(stmt); SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, ERR_AUCTION_OK, 0); + + LOG_INFO("entities.player.auctionhouse", "AuctionHouse: Account: {} (IP: {}), Player [{}] (GUID: {}) placed bid on auction #{}: Item (Entry: {}) x{}, Bid: {} copper, Owner: {} (GUID: {})", + GetAccountId(), GetRemoteAddress(), player->GetName(), player->GetGUID().GetCounter(), + auction->Id, auction->item_template, auction->itemCount, price, auction->owner.GetCounter(), auction->owner.GetCounter()); } else { @@ -514,6 +528,10 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData) SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, ERR_AUCTION_OK); + LOG_INFO("entities.player.auctionhouse", "AuctionHouse: Account: {} (IP: {}), Player [{}] (GUID: {}) bought out auction #{}: Item (Entry: {}) x{}, Buyout: {} copper, Owner: {} (GUID: {})", + GetAccountId(), GetRemoteAddress(), player->GetName(), player->GetGUID().GetCounter(), + auction->Id, auction->item_template, auction->itemCount, auction->buyout, auction->owner.GetCounter(), auction->owner.GetCounter()); + auction->DeleteFromDB(trans); sAuctionMgr->RemoveAItem(auction->item_guid); @@ -580,6 +598,10 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData) //inform player, that auction is removed SendAuctionCommandResult(auction->Id, AUCTION_CANCEL, ERR_AUCTION_OK); + LOG_INFO("entities.player.auctionhouse", "AuctionHouse: Account: {} (IP: {}), Player [{}] (GUID: {}) cancelled auction #{}: Item (Entry: {}) x{}, Buyout: {} copper", + GetAccountId(), GetRemoteAddress(), player->GetName(), player->GetGUID().GetCounter(), + auction->Id, auction->item_template, auction->itemCount, auction->buyout); + // Now remove the auction player->SaveInventoryAndGoldToDB(trans); diff --git a/src/server/game/Handlers/MailHandler.cpp b/src/server/game/Handlers/MailHandler.cpp index bcf370162..387a69238 100644 --- a/src/server/game/Handlers/MailHandler.cpp +++ b/src/server/game/Handlers/MailHandler.cpp @@ -295,12 +295,16 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction(); + std::string itemLogStr = ""; if (items_count > 0 || money > 0) { if (items_count > 0) { for (uint8 i = 0; i < items_count; ++i) { + // log item + itemLogStr += Acore::StringFormat("{} (Entry: {}) x{}, ", items[i]->GetTemplate()->Name1, items[i]->GetEntry(), items[i]->GetCount()); + Item* item = items[i]; item->SetNotRefundable(GetPlayer()); // makes the item no longer refundable @@ -342,6 +346,10 @@ void WorldSession::HandleSendMail(WorldPacket& recvData) player->SaveInventoryAndGoldToDB(trans); CharacterDatabase.CommitTransaction(trans); + + LOG_INFO("entities.player.mail", "Mail: Account: {} (IP: {}), Player [{}] ({}) sent mail to Player [{}] ({}): subject='{}', body='{}', {} copper, {} COD copper, sent item(s) [{}]", + GetAccountId(), GetRemoteAddress(), player->GetName(), player->GetGUID().GetCounter(), + receiver, receiverGuid.GetCounter(), subject, body, money, COD, itemLogStr); } //called when mail is read diff --git a/src/server/game/Handlers/TradeHandler.cpp b/src/server/game/Handlers/TradeHandler.cpp index d87207a36..37c5bfbae 100644 --- a/src/server/game/Handlers/TradeHandler.cpp +++ b/src/server/game/Handlers/TradeHandler.cpp @@ -494,6 +494,25 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) trader->ModifyMoney(-int32(his_trade->GetMoney())); trader->ModifyMoney(my_trade->GetMoney()); + // log completed trade + { + std::string myItemsStr, hisItemsStr = ""; + + for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i) + { + if (myItems[i]) + myItemsStr += Acore::StringFormat("{} (Entry:{}) x{}, ", myItems[i]->GetTemplate()->Name1, myItems[i]->GetEntry(), myItems[i]->GetCount()); + if (hisItems[i]) + hisItemsStr += Acore::StringFormat("{} (Entry:{}) x{}, ", hisItems[i]->GetTemplate()->Name1, hisItems[i]->GetEntry(), hisItems[i]->GetCount()); + } + + LOG_INFO("entities.player.trade", "Trade: Account: {} (IP: {}), Player [{}] ({}) traded with Player [{}] ({}): gave {} copper, received {} copper, gave item(s) [{}], received item(s) [{}]", + GetAccountId(), GetRemoteAddress(), _player->GetName(), _player->GetGUID().GetCounter(), + trader->GetName(), trader->GetGUID().GetCounter(), + my_trade->GetMoney(), his_trade->GetMoney(), + myItemsStr, hisItemsStr); + } + if (my_spell) my_spell->prepare(&my_targets);