mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Logging: Switch from fmt::sprintf to fmt::format (c++20 standard compatible api)
This commit is contained in:
@@ -38,26 +38,26 @@ class ChatLogScript : public PlayerScript
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_SAY:
|
||||
TC_LOG_CHAT("say", "Player %s says (language %u): %s",
|
||||
player->GetName().c_str(), lang, msg.c_str());
|
||||
TC_LOG_CHAT("say", "Player {} says (language {}): {}",
|
||||
player->GetName(), lang, msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_EMOTE:
|
||||
TC_LOG_CHAT("emote", "Player %s emotes: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
TC_LOG_CHAT("emote", "Player {} emotes: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_YELL:
|
||||
TC_LOG_CHAT("yell", "Player %s yells (language %u): %s",
|
||||
player->GetName().c_str(), lang, msg.c_str());
|
||||
TC_LOG_CHAT("yell", "Player {} yells (language {}): {}",
|
||||
player->GetName(), lang, msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 /*type*/, uint32 lang, std::string& msg, Player* receiver) override
|
||||
{
|
||||
TC_LOG_CHAT("whisper", "Player %s tells %s: %s",
|
||||
player->GetName().c_str(), receiver ? receiver->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
TC_LOG_CHAT("whisper", "Player {} tells {}: {}",
|
||||
player->GetName(), receiver ? receiver->GetName().c_str() : "<unknown>", msg);
|
||||
}
|
||||
|
||||
void OnChat(Player* player, uint32 type, uint32 lang, std::string& msg, Group* group) override
|
||||
@@ -67,38 +67,38 @@ class ChatLogScript : public PlayerScript
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_PARTY:
|
||||
TC_LOG_CHAT("party", "Player %s tells group with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
TC_LOG_CHAT("party", "Player {} tells group with leader {}: {}",
|
||||
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_PARTY_LEADER:
|
||||
TC_LOG_CHAT("party", "Leader %s tells group: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
TC_LOG_CHAT("party", "Leader {} tells group: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID:
|
||||
TC_LOG_CHAT("raid", "Player %s tells raid with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
TC_LOG_CHAT("raid", "Player {} tells raid with leader {}: {}",
|
||||
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID_LEADER:
|
||||
TC_LOG_CHAT("raid", "Leader player %s tells raid: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
TC_LOG_CHAT("raid", "Leader player {} tells raid: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_RAID_WARNING:
|
||||
TC_LOG_CHAT("raid", "Leader player %s warns raid with: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
TC_LOG_CHAT("raid", "Leader player {} warns raid with: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_INSTANCE_CHAT:
|
||||
TC_LOG_CHAT("bg", "Player %s tells instance with leader %s: %s",
|
||||
player->GetName().c_str(), group ? group->GetLeaderName() : "<unknown>", msg.c_str());
|
||||
TC_LOG_CHAT("bg", "Player {} tells instance with leader {}: {}",
|
||||
player->GetName(), group ? group->GetLeaderName() : "<unknown>", msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_INSTANCE_CHAT_LEADER:
|
||||
TC_LOG_CHAT("bg", "Leader player %s tells instance: %s",
|
||||
player->GetName().c_str(), msg.c_str());
|
||||
TC_LOG_CHAT("bg", "Leader player {} tells instance: {}",
|
||||
player->GetName(), msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -108,13 +108,13 @@ class ChatLogScript : public PlayerScript
|
||||
switch (type)
|
||||
{
|
||||
case CHAT_MSG_GUILD:
|
||||
TC_LOG_CHAT("guild", "Player %s tells guild %s: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
TC_LOG_CHAT("guild", "Player {} tells guild {}: {}",
|
||||
player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg);
|
||||
break;
|
||||
|
||||
case CHAT_MSG_OFFICER:
|
||||
TC_LOG_CHAT("guild.officer", "Player %s tells guild %s officers: %s",
|
||||
player->GetName().c_str(), guild ? guild->GetName().c_str() : "<unknown>", msg.c_str());
|
||||
TC_LOG_CHAT("guild.officer", "Player {} tells guild {} officers: {}",
|
||||
player->GetName(), guild ? guild->GetName().c_str() : "<unknown>", msg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -129,14 +129,14 @@ class ChatLogScript : public PlayerScript
|
||||
|
||||
if (isSystem)
|
||||
{
|
||||
TC_LOG_CHAT("system", "Player %s tells channel %s: %s",
|
||||
player->GetName().c_str(), channel->GetName().c_str(), msg.c_str());
|
||||
TC_LOG_CHAT("system", "Player {} tells channel {}: {}",
|
||||
player->GetName(), channel->GetName(), msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::string channelName = channel ? channel->GetName() : "<unknown>";
|
||||
TC_LOG_CHAT("channel." + channelName, "Player %s tells channel %s: %s",
|
||||
player->GetName().c_str(), channelName.c_str(), msg.c_str());
|
||||
TC_LOG_CHAT("channel." + channelName, "Player {} tells channel {}: {}",
|
||||
player->GetName(), channelName, msg);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
if (Spell)
|
||||
creature->CastSpell(player, Spell, false);
|
||||
else
|
||||
TC_LOG_ERROR("scripts", "go_ethereum_prison summoned Creature (entry %u) but faction (%u) are not expected by script.", creature->GetEntry(), creature->GetFaction());
|
||||
TC_LOG_ERROR("scripts", "go_ethereum_prison summoned Creature (entry {}) but faction ({}) are not expected by script.", creature->GetEntry(), creature->GetFaction());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ bool EquippedOk(Player* player, uint32 spellId)
|
||||
if (item && item->GetTemplate()->GetRequiredSpell() == reqSpell)
|
||||
{
|
||||
//player has item equipped that require specialty. Not allow to unlearn, player has to unequip first
|
||||
TC_LOG_DEBUG("scripts", "player attempt to unlearn spell %u, but item %u is equipped.", reqSpell, item->GetEntry());
|
||||
TC_LOG_DEBUG("scripts", "player attempt to unlearn spell {}, but item {} is equipped.", reqSpell, item->GetEntry());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user