diff options
author | Shauren <shauren.trinity@gmail.com> | 2023-08-15 20:10:04 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2023-08-15 20:10:04 +0200 |
commit | aaa6e73c8ca6d60e943cb964605536eb78219db2 (patch) | |
tree | f5a0187925e646ef071d647efa7a5dac20501813 /src/server/game/Handlers/MovementHandler.cpp | |
parent | 825c697a764017349ca94ecfca8f30a8365666c0 (diff) |
Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api)
(cherry picked from commit d791afae1dfcfaf592326f787755ca32d629e4d3)
Diffstat (limited to 'src/server/game/Handlers/MovementHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/MovementHandler.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index f458eca6f41..382a6206a19 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -79,7 +79,7 @@ void WorldSession::HandleMoveWorldportAck() if (player->IsInWorld()) { - TC_LOG_ERROR("network", "%s %s is still in world when teleported from map %s (%u) to new map %s (%u)", player->GetGUID().ToString().c_str(), player->GetName().c_str(), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId()); + TC_LOG_ERROR("network", "{} {} is still in world when teleported from map {} ({}) to new map {} ({})", player->GetGUID().ToString(), player->GetName(), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId()); oldMap->RemovePlayerFromMap(player, false); } @@ -88,7 +88,7 @@ void WorldSession::HandleMoveWorldportAck() // while the player is in transit, for example the map may get full if (!newMap || newMap->CannotEnter(player)) { - TC_LOG_ERROR("network", "Map %d (%s) could not be created for player %s (%s), porting player to homebind", loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown", player->GetGUID().ToString().c_str(), player->GetName().c_str()); + TC_LOG_ERROR("network", "Map {} ({}) could not be created for player {} ({}), porting player to homebind", loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown", player->GetGUID().ToString(), player->GetName()); player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); return; } @@ -103,8 +103,8 @@ void WorldSession::HandleMoveWorldportAck() player->SendInitialPacketsBeforeAddToMap(); if (!player->GetMap()->AddPlayerToMap(player)) { - TC_LOG_ERROR("network", "WORLD: failed to teleport player %s %s to map %d (%s) because of unknown reason!", - player->GetName().c_str(), player->GetGUID().ToString().c_str(), loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown"); + TC_LOG_ERROR("network", "WORLD: failed to teleport player {} {} to map {} ({}) because of unknown reason!", + player->GetName(), player->GetGUID().ToString(), loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown"); player->ResetMap(); player->SetMap(oldMap); player->TeleportTo(player->m_homebindMapId, player->m_homebindX, player->m_homebindY, player->m_homebindZ, player->GetOrientation()); @@ -412,7 +412,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData) /// @todo discard movement packets after the player is rooted if (plrMover->IsAlive()) { - TC_LOG_DEBUG("entities.player.falldamage", "FALLDAMAGE Below map. Map min height: %f , Player debug info:\n%s", plrMover->GetMap()->GetMinHeight(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY()), plrMover->GetDebugInfo().c_str()); + TC_LOG_DEBUG("entities.player.falldamage", "FALLDAMAGE Below map. Map min height: {} , Player debug info:\n{}", plrMover->GetMap()->GetMinHeight(movementInfo.pos.GetPositionX(), movementInfo.pos.GetPositionY()), plrMover->GetDebugInfo()); plrMover->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_IS_OUT_OF_BOUNDS); plrMover->EnvironmentalDamage(DAMAGE_FALL_TO_VOID, GetPlayer()->GetMaxHealth()); // player can be alive if GM/etc @@ -444,7 +444,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) if (!client->IsAllowedToMove(guid)) { recvData.rfinish(); // prevent warnings spam - TC_LOG_DEBUG("entities.unit", "Ignoring ACK. Bad or outdated movement data by Player %s", _player->GetName().c_str()); + TC_LOG_DEBUG("entities.unit", "Ignoring ACK. Bad or outdated movement data by Player {}", _player->GetName()); return; } @@ -463,7 +463,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; break; case CMSG_FORCE_PITCH_RATE_CHANGE_ACK: move_type = MOVE_PITCH_RATE; break; default: - TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %s", GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvData.GetOpcode())).c_str()); + TC_LOG_ERROR("network", "WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: {}", GetOpcodeNameForLogging(static_cast<OpcodeClient>(recvData.GetOpcode()))); return; } @@ -481,7 +481,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) // verify that indeed the client is replying with the changes that were send to him if (!mover->HasPendingMovementChange() || mover->PeakFirstPendingMovementChange().movementCounter > movementCounter) { - TC_LOG_DEBUG("entities.unit", "Ignoring ACK. Bad or outdated movement data by Player %s", _player->GetName().c_str()); + TC_LOG_DEBUG("entities.unit", "Ignoring ACK. Bad or outdated movement data by Player {}", _player->GetName()); return; } @@ -501,8 +501,8 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) case MovementChangeType::SPEED_CHANGE_FLIGHT_BACK_SPEED: moveTypeSent = MOVE_FLIGHT_BACK; break; case MovementChangeType::RATE_CHANGE_PITCH: moveTypeSent = MOVE_PITCH_RATE; break; default: - TC_LOG_INFO("cheat", "WorldSession::HandleForceSpeedChangeAck: Player %s from account id %u kicked for incorrect data returned in an ack. movementChangeType: %u", - _player->GetName().c_str(), _player->GetSession()->GetAccountId(), static_cast<uint32>(AsUnderlyingType(changeType))); + TC_LOG_INFO("cheat", "WorldSession::HandleForceSpeedChangeAck: Player {} from account id {} kicked for incorrect data returned in an ack. movementChangeType: {}", + _player->GetName(), _player->GetSession()->GetAccountId(), static_cast<uint32>(AsUnderlyingType(changeType))); if (sWorld->getIntConfig(CONFIG_PENDING_MOVE_CHANGES_TIMEOUT) != 0) _player->GetSession()->KickPlayer("incorrect movementChangeType returned in an ack"); return; @@ -510,8 +510,8 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) if (pendingChange.movementCounter != movementCounter) { - TC_LOG_INFO("cheat", "WorldSession::HandleForceSpeedChangeAck: Player %s from account id %u kicked for incorrect data returned in an ack. pendingChange.movementCounter: %u, movementCounter: %u", - _player->GetName().c_str(), _player->GetSession()->GetAccountId(), pendingChange.movementCounter, movementCounter); + TC_LOG_INFO("cheat", "WorldSession::HandleForceSpeedChangeAck: Player {} from account id {} kicked for incorrect data returned in an ack. pendingChange.movementCounter: {}, movementCounter: {}", + _player->GetName(), _player->GetSession()->GetAccountId(), pendingChange.movementCounter, movementCounter); if (sWorld->getIntConfig(CONFIG_PENDING_MOVE_CHANGES_TIMEOUT) != 0) _player->GetSession()->KickPlayer("incorrect movementCounter returned in an ack"); return; @@ -519,8 +519,8 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) if (std::fabs(speedSent - speedReceived) > 0.01f) { - TC_LOG_INFO("cheat", "WorldSession::HandleForceSpeedChangeAck: Player %s from account id %u kicked for incorrect data returned in an ack. speedSent - speedReceived: %f", - _player->GetName().c_str(), _player->GetSession()->GetAccountId(), std::fabs(speedSent - speedReceived)); + TC_LOG_INFO("cheat", "WorldSession::HandleForceSpeedChangeAck: Player {} from account id {} kicked for incorrect data returned in an ack. speedSent - speedReceived: {}", + _player->GetName(), _player->GetSession()->GetAccountId(), std::fabs(speedSent - speedReceived)); if (sWorld->getIntConfig(CONFIG_PENDING_MOVE_CHANGES_TIMEOUT) != 0) _player->GetSession()->KickPlayer("incorrect speed returned in an ack"); return; @@ -528,8 +528,8 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recvData) if (moveTypeSent != move_type) { - TC_LOG_INFO("cheat", "WorldSession::HandleForceSpeedChangeAck: Player %s from account id %u kicked for incorrect data returned in an ack. moveTypeSent: %u, move_type: %u", - _player->GetName().c_str(), _player->GetSession()->GetAccountId(), static_cast<uint32>(AsUnderlyingType(moveTypeSent)), static_cast<uint32>(AsUnderlyingType(move_type))); + TC_LOG_INFO("cheat", "WorldSession::HandleForceSpeedChangeAck: Player {} from account id {} kicked for incorrect data returned in an ack. moveTypeSent: {}, move_type: {}", + _player->GetName(), _player->GetSession()->GetAccountId(), static_cast<uint32>(AsUnderlyingType(moveTypeSent)), static_cast<uint32>(AsUnderlyingType(move_type))); if (sWorld->getIntConfig(CONFIG_PENDING_MOVE_CHANGES_TIMEOUT) != 0) _player->GetSession()->KickPlayer("incorrect moveType returned in an ack"); return; @@ -569,12 +569,12 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recvData) if (!client->IsAllowedToMove(guid)) { // @todo log or kick or do nothing depending on configuration - TC_LOG_DEBUG("entities.unit", "set active mover FAILED for client of player %s. GUID %s.", _player->GetName().c_str(), guid.ToString().c_str()); + TC_LOG_DEBUG("entities.unit", "set active mover FAILED for client of player {}. GUID {}.", _player->GetName(), guid.ToString()); return; } // step 2: - TC_LOG_DEBUG("entities.unit", "set active mover OK for client of player %s. GUID %s.", _player->GetName().c_str(), guid.ToString().c_str()); + TC_LOG_DEBUG("entities.unit", "set active mover OK for client of player {}. GUID {}.", _player->GetName(), guid.ToString()); Unit* newActivelyMovedUnit = ObjectAccessor::GetUnit(*_player, guid); client->SetActivelyMovedUnit(newActivelyMovedUnit); } @@ -592,11 +592,11 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recvData) if (client->GetActivelyMovedUnit() == nullptr || client->GetActivelyMovedUnit()->GetGUID() != old_mover_guid) { - TC_LOG_DEBUG("entities.unit", "unset active mover FAILED for client of player %s. GUID %s.", _player->GetName().c_str(), old_mover_guid.ToString().c_str()); + TC_LOG_DEBUG("entities.unit", "unset active mover FAILED for client of player {}. GUID {}.", _player->GetName(), old_mover_guid.ToString()); return; } - TC_LOG_DEBUG("entities.unit", "unset active mover OK for client of player %s. GUID %s.", _player->GetName().c_str(), old_mover_guid.ToString().c_str()); + TC_LOG_DEBUG("entities.unit", "unset active mover OK for client of player {}. GUID {}.", _player->GetName(), old_mover_guid.ToString()); client->SetActivelyMovedUnit(nullptr); } |