feat(Core/Misc): add log types player trade, mail & auctionhouse (#25430)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Kitzunu
2026-04-12 16:46:03 +02:00
committed by GitHub
parent eff2cac905
commit bcdc3ae403
5 changed files with 65 additions and 0 deletions
@@ -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);
+8
View File
@@ -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
+19
View File
@@ -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);