Skip to content

Commit

Permalink
Log/Metric Log trades between players
Browse files Browse the repository at this point in the history
  • Loading branch information
Traesh committed Aug 13, 2018
1 parent 7b4d699 commit 2be25f6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/server/game/Handlers/TradeHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,11 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
trader->GetName().c_str(), trader->GetSession()->GetAccountId());
}

TC_LOG_INFO("metric", "%s (Account: %u) trade: %s (Entry: %d Count: %u) to %s (Account: %u)",
_player->GetName().c_str(), _player->GetSession()->GetAccountId(),
myItems[i]->GetTemplate()->GetDefaultLocaleName(), myItems[i]->GetEntry(), myItems[i]->GetCount(),
trader->GetName().c_str(), trader->GetSession()->GetAccountId());

// adjust time (depends on /played)
if (myItems[i]->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE))
myItems[i]->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, trader->GetTotalPlayedTime()-(_player->GetTotalPlayedTime()-myItems[i]->GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)));
Expand All @@ -151,6 +156,11 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
_player->GetName().c_str(), _player->GetSession()->GetAccountId());
}

TC_LOG_INFO("metric", "%s (Account: %u) trade: %s (Entry: %d Count: %u) to %s (Account: %u)",
trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
hisItems[i]->GetTemplate()->GetDefaultLocaleName(), hisItems[i]->GetEntry(), hisItems[i]->GetCount(),
_player->GetName().c_str(), _player->GetSession()->GetAccountId());

// adjust time (depends on /played)
if (hisItems[i]->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_BOP_TRADEABLE))
hisItems[i]->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, _player->GetTotalPlayedTime()-(trader->GetTotalPlayedTime()-hisItems[i]->GetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME)));
Expand Down Expand Up @@ -491,6 +501,11 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPackets::Trade::AcceptTrade& acc
_player->GetName().c_str(), _player->GetSession()->GetAccountId(),
my_trade->GetMoney(),
trader->GetName().c_str(), trader->GetSession()->GetAccountId());

TC_LOG_INFO("metric", "%s (Account: %u) give money (Amount: " UI64FMTD ") to %s (Account: %u)",
_player->GetName().c_str(), _player->GetSession()->GetAccountId(),
my_trade->GetMoney(),
trader->GetName().c_str(), trader->GetSession()->GetAccountId());
}

if (his_trade->GetMoney() > 0)
Expand All @@ -499,6 +514,11 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPackets::Trade::AcceptTrade& acc
trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
his_trade->GetMoney(),
_player->GetName().c_str(), _player->GetSession()->GetAccountId());

TC_LOG_INFO("metric", "%s (Account: %u) give money (Amount: " UI64FMTD ") to %s (Account: %u)",
trader->GetName().c_str(), trader->GetSession()->GetAccountId(),
my_trade->GetMoney(),
_player->GetName().c_str(), _player->GetSession()->GetAccountId());
}
}

Expand Down

0 comments on commit 2be25f6

Please sign in to comment.