aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/scripts/Commands')
-rw-r--r--src/server/scripts/Commands/cs_account.cpp70
-rw-r--r--src/server/scripts/Commands/cs_ban.cpp8
-rw-r--r--src/server/scripts/Commands/cs_character.cpp12
-rw-r--r--src/server/scripts/Commands/cs_debug.cpp10
-rw-r--r--src/server/scripts/Commands/cs_event.cpp12
-rw-r--r--src/server/scripts/Commands/cs_gobject.cpp16
-rw-r--r--src/server/scripts/Commands/cs_list.cpp16
-rw-r--r--src/server/scripts/Commands/cs_message.cpp2
-rw-r--r--src/server/scripts/Commands/cs_modify.cpp5
-rw-r--r--src/server/scripts/Commands/cs_npc.cpp2
-rw-r--r--src/server/scripts/Commands/cs_reload.cpp2
-rw-r--r--src/server/scripts/Commands/cs_reset.cpp2
-rw-r--r--src/server/scripts/Commands/cs_server.cpp6
-rw-r--r--src/server/scripts/Commands/cs_tele.cpp2
-rw-r--r--src/server/scripts/Commands/cs_titles.cpp6
-rw-r--r--src/server/scripts/Commands/cs_wp.cpp8
16 files changed, 89 insertions, 90 deletions
diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp
index 111beebe989..41664a47f20 100644
--- a/src/server/scripts/Commands/cs_account.cpp
+++ b/src/server/scripts/Commands/cs_account.cpp
@@ -109,7 +109,7 @@ public:
if (!result)
{
- TC_LOG_ERROR("misc", "Account %u not found in login database when processing .account 2fa setup command.", accountId);
+ TC_LOG_ERROR("misc", "Account {} not found in login database when processing .account 2fa setup command.", accountId);
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
handler->SetSentErrorMessage(true);
return false;
@@ -173,7 +173,7 @@ public:
if (!result)
{
- TC_LOG_ERROR("misc", "Account %u not found in login database when processing .account 2fa setup command.", accountId);
+ TC_LOG_ERROR("misc", "Account {} not found in login database when processing .account 2fa setup command.", accountId);
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
handler->SetSentErrorMessage(true);
return false;
@@ -197,7 +197,7 @@ public:
bool success = Trinity::Crypto::AEDecrypt<Trinity::Crypto::AES>(secret, *masterKey);
if (!success)
{
- TC_LOG_ERROR("misc", "Account %u has invalid ciphertext in TOTP token.", accountId);
+ TC_LOG_ERROR("misc", "Account {} has invalid ciphertext in TOTP token.", accountId);
handler->SendSysMessage(LANG_UNKNOWN_ERROR);
handler->SetSentErrorMessage(true);
return false;
@@ -258,10 +258,10 @@ public:
handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
if (handler->GetSession())
{
- TC_LOG_INFO("entities.player.character", "Account: %d (IP: %s) Character:[%s] %s) created Account %s (Email: '%s')",
- handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str(),
- accountName.c_str(), email.value_or("").c_str());
+ TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Character:[{}] {}) created Account {} (Email: '{}')",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
+ handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString(),
+ accountName, email.value_or(""));
}
break;
case AccountOpResult::AOR_NAME_TOO_LONG:
@@ -485,10 +485,10 @@ public:
handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL);
sScriptMgr->OnFailedEmailChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
- TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] %s Tried to change email, but the provided email [%s] is not equal to registration email [%s].",
- handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str(),
- email.c_str(), oldEmail.c_str());
+ TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Character:[{}] {} Tried to change email, but the provided email [{}] is not equal to registration email [{}].",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
+ handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString(),
+ email, oldEmail);
return false;
}
@@ -497,9 +497,9 @@ public:
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
sScriptMgr->OnFailedEmailChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
- TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] %s Tried to change email, but the provided password is wrong.",
- handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str());
+ TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Character:[{}] {} Tried to change email, but the provided password is wrong.",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
+ handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString());
return false;
}
@@ -516,9 +516,9 @@ public:
handler->SendSysMessage(LANG_NEW_EMAILS_NOT_MATCH);
sScriptMgr->OnFailedEmailChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
- TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] %s Tried to change email, but the confirm email does not match.",
- handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str());
+ TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Character:[{}] {} Tried to change email, but the confirm email does not match.",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
+ handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString());
return false;
}
@@ -528,10 +528,10 @@ public:
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_EMAIL);
sScriptMgr->OnEmailChange(handler->GetSession()->GetAccountId());
- TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] %s Changed Email from [%s] to [%s].",
- handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str(),
- oldEmail.c_str(), email.c_str());
+ TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Character:[{}] {} Changed Email from [{}] to [{}].",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
+ handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString(),
+ oldEmail, email);
break;
case AccountOpResult::AOR_EMAIL_TOO_LONG:
handler->SendSysMessage(LANG_EMAIL_TOO_LONG);
@@ -558,9 +558,9 @@ public:
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
- TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] %s Tried to change password, but the provided old password is wrong.",
- handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str());
+ TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Character:[{}] {} Tried to change password, but the provided old password is wrong.",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
+ handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString());
return false;
}
@@ -571,10 +571,10 @@ public:
handler->SendSysMessage(LANG_COMMAND_WRONGEMAIL);
sScriptMgr->OnFailedPasswordChange(handler->GetSession()->GetAccountId());
handler->SetSentErrorMessage(true);
- TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] %s Tried to change password, but the entered email [%s] is wrong.",
- handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str(),
- confirmEmail.value_or("").c_str());
+ TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Character:[{}] {} Tried to change password, but the entered email [{}] is wrong.",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
+ handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString(),
+ confirmEmail.value_or(""));
return false;
}
@@ -594,9 +594,9 @@ public:
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_PASSWORD);
sScriptMgr->OnPasswordChange(handler->GetSession()->GetAccountId());
- TC_LOG_INFO("entities.player.character", "Account: %u (IP: %s) Character:[%s] %s changed password.",
- handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
- handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUID().ToString().c_str());
+ TC_LOG_INFO("entities.player.character", "Account: {} (IP: {}) Character:[{}] {} changed password.",
+ handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress(),
+ handler->GetSession()->GetPlayer()->GetName(), handler->GetSession()->GetPlayer()->GetGUID().ToString());
break;
case AccountOpResult::AOR_PASS_TOO_LONG:
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
@@ -944,8 +944,8 @@ public:
{
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_EMAIL);
- TC_LOG_INFO("entities.player.character", "ChangeEmail: Account %s [Id: %u] had it's email changed to %s.",
- accountName.c_str(), targetAccountId, email.c_str());
+ TC_LOG_INFO("entities.player.character", "ChangeEmail: Account {} [Id: {}] had it's email changed to {}.",
+ accountName, targetAccountId, email);
break;
case AccountOpResult::AOR_NAME_NOT_EXIST:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
@@ -999,8 +999,8 @@ public:
{
case AccountOpResult::AOR_OK:
handler->SendSysMessage(LANG_COMMAND_EMAIL);
- TC_LOG_INFO("entities.player.character", "ChangeRegEmail: Account %s [Id: %u] had it's Registration Email changed to %s.",
- accountName.c_str(), targetAccountId, email.c_str());
+ TC_LOG_INFO("entities.player.character", "ChangeRegEmail: Account {} [Id: {}] had it's Registration Email changed to {}.",
+ accountName, targetAccountId, email);
break;
case AccountOpResult::AOR_NAME_NOT_EXIST:
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index c2318c616f5..d3abce72b30 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -277,7 +277,7 @@ public:
static bool HandleBanInfoHelper(uint32 accountId, char const* accountName, ChatHandler* handler)
{
- QueryResult result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '%u' ORDER BY bandate ASC", accountId);
+ QueryResult result = LoginDatabase.PQuery("SELECT FROM_UNIXTIME(bandate), unbandate-bandate, active, unbandate, banreason, bannedby FROM account_banned WHERE id = '{}' ORDER BY bandate ASC", accountId);
if (!result)
{
handler->PSendSysMessage(LANG_BANINFO_NOACCOUNTBAN, accountName);
@@ -376,7 +376,7 @@ public:
std::string IP = ipStr;
LoginDatabase.EscapeString(IP);
- QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '%s'", IP.c_str());
+ QueryResult result = LoginDatabase.PQuery("SELECT ip, FROM_UNIXTIME(bandate), FROM_UNIXTIME(unbandate), unbandate-UNIX_TIMESTAMP(), banreason, bannedby, unbandate-bandate FROM ip_banned WHERE ip = '{}'", IP);
if (!result)
{
handler->PSendSysMessage(LANG_BANINFO_NOIP);
@@ -437,7 +437,7 @@ public:
Field* fields = result->Fetch();
uint32 accountid = fields[0].GetUInt32();
- QueryResult banResult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='%u' AND account_banned.id = account.id", accountid);
+ QueryResult banResult = LoginDatabase.PQuery("SELECT account.username FROM account, account_banned WHERE account_banned.id='{}' AND account_banned.id = account.id", accountid);
if (banResult)
{
Field* fields2 = banResult->Fetch();
@@ -468,7 +468,7 @@ public:
AccountMgr::GetName(accountId, accountName);
// No SQL injection. id is uint32.
- QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = %u ORDER BY unbandate", accountId);
+ QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = {} ORDER BY unbandate", accountId);
if (banInfo)
{
Field* fields2 = banInfo->Fetch();
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index d5a6e348ae2..4ebe7e0f9b6 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -269,7 +269,7 @@ public:
if (target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->MaskID)
activeStr = handler->GetTrinityString(LANG_ACTIVE);
- std::string titleName = Trinity::StringFormat(name, player->GetName().c_str());
+ std::string titleName = fmt::sprintf(name, player->GetName());
// send title in "id (idx:idx) - [namedlink locale]" format
if (handler->GetSession())
@@ -360,10 +360,10 @@ public:
if (WorldSession* session = handler->GetSession())
{
if (Player* player = session->GetPlayer())
- sLog->outCommand(session->GetAccountId(), "GM %s (Account: %u) forced rename %s to player %s (Account: %u)", player->GetName().c_str(), session->GetAccountId(), newName.c_str(), player->GetName().c_str(), sCharacterCache->GetCharacterAccountIdByGuid(player->GetGUID()));
+ sLog->OutCommand(session->GetAccountId(), "GM %s (Account: %u) forced rename %s to player %s (Account: %u)", player->GetName().c_str(), session->GetAccountId(), newName.c_str(), player->GetName().c_str(), sCharacterCache->GetCharacterAccountIdByGuid(player->GetGUID()));
}
else
- sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (%s)", player->GetName().c_str(), newName.c_str(), player->GetGUID().ToString().c_str());
+ sLog->OutCommand(0, "CONSOLE forced rename '%s' to '%s' (%s)", player->GetName().c_str(), newName.c_str(), player->GetGUID().ToString().c_str());
}
else
{
@@ -508,14 +508,14 @@ public:
handler->PSendSysMessage(LANG_CHANGEACCOUNT_SUCCESS, player->GetName().c_str(), newAccount.GetName().c_str());
- std::string logString = Trinity::StringFormat("changed ownership of player %s (%s) from account %u to account %u", player->GetName().c_str(), player->GetGUID().ToString().c_str(), oldAccountId, newAccount.GetID());
+ std::string logString = Trinity::StringFormat("changed ownership of player {} ({}) from account {} to account {}", player->GetName(), player->GetGUID().ToString(), oldAccountId, newAccount.GetID());
if (WorldSession* session = handler->GetSession())
{
if (Player* player = session->GetPlayer())
- sLog->outCommand(session->GetAccountId(), "GM %s (Account: %u) %s", player->GetName().c_str(), session->GetAccountId(), logString.c_str());
+ sLog->OutCommand(session->GetAccountId(), "GM %s (Account: %u) %s", player->GetName().c_str(), session->GetAccountId(), logString.c_str());
}
else
- sLog->outCommand(0, "%s %s", handler->GetTrinityString(LANG_CONSOLE), logString.c_str());
+ sLog->OutCommand(0, "%s %s", handler->GetTrinityString(LANG_CONSOLE), logString.c_str());
return true;
}
diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp
index 05d970cf4a9..e6f44cc4762 100644
--- a/src/server/scripts/Commands/cs_debug.cpp
+++ b/src/server/scripts/Commands/cs_debug.cpp
@@ -445,11 +445,11 @@ public:
}
else
{
- TC_LOG_ERROR("misc", "Sending opcode that has unknown type '%s'", type.c_str());
+ TC_LOG_ERROR("misc", "Sending opcode that has unknown type '{}'", type);
break;
}
}
- TC_LOG_DEBUG("network", "Sending opcode %u", data.GetOpcode());
+ TC_LOG_DEBUG("network", "Sending opcode {}", data.GetOpcode());
data.hexlike();
player->SendDirectMessage(&data);
handler->PSendSysMessage(LANG_COMMAND_OPCODESENT, data.GetOpcode(), unit->GetName().c_str());
@@ -1164,12 +1164,12 @@ public:
if (value.holds_alternative<uint32>())
{
target->SetUInt32Value(index, value.get<uint32>());
- handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().GetCounter(), index, value);
+ handler->PSendSysMessage(LANG_SET_UINT_FIELD, target->GetGUID().GetCounter(), index, value.get<uint32>());
}
else if (value.holds_alternative<float>())
{
target->SetFloatValue(index, value.get<float>());
- handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().GetCounter(), index, value);
+ handler->PSendSysMessage(LANG_SET_FLOAT_FIELD, target->GetGUID().GetCounter(), index, value.get<float>());
}
return true;
@@ -1341,7 +1341,7 @@ public:
{
Player* player = handler->GetPlayer();
- TC_LOG_INFO("sql.dev", "(@PATH, XX, %.3f, %.3f, %.5f, %.5f, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
+ TC_LOG_INFO("sql.dev", "(@PATH, XX, {:.3f}, {:.3f}, {:.5f}, {:.5f}, 0, 0, 0, 100, 0),", player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetOrientation());
handler->PSendSysMessage("Waypoint SQL written to SQL Developer log");
return true;
diff --git a/src/server/scripts/Commands/cs_event.cpp b/src/server/scripts/Commands/cs_event.cpp
index f13592aa3aa..225ae5ce515 100644
--- a/src/server/scripts/Commands/cs_event.cpp
+++ b/src/server/scripts/Commands/cs_event.cpp
@@ -81,7 +81,7 @@ public:
return true;
}
- static bool HandleEventInfoCommand(ChatHandler* handler, Variant<Hyperlink<gameevent>, uint16> const eventId)
+ static bool HandleEventInfoCommand(ChatHandler* handler, Variant<Hyperlink<gameevent>, uint16> eventId)
{
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
@@ -92,7 +92,7 @@ public:
return false;
}
- GameEventData const& eventData = events[eventId];
+ GameEventData const& eventData = events[*eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
@@ -120,7 +120,7 @@ public:
return true;
}
- static bool HandleEventStartCommand(ChatHandler* handler, Variant<Hyperlink<gameevent>, uint16> const eventId)
+ static bool HandleEventStartCommand(ChatHandler* handler, Variant<Hyperlink<gameevent>, uint16> eventId)
{
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
@@ -131,7 +131,7 @@ public:
return false;
}
- GameEventData const& eventData = events[eventId];
+ GameEventData const& eventData = events[*eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
@@ -151,7 +151,7 @@ public:
return true;
}
- static bool HandleEventStopCommand(ChatHandler* handler, Variant<Hyperlink<gameevent>, uint16> const eventId)
+ static bool HandleEventStopCommand(ChatHandler* handler, Variant<Hyperlink<gameevent>, uint16> eventId)
{
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
@@ -162,7 +162,7 @@ public:
return false;
}
- GameEventData const& eventData = events[eventId];
+ GameEventData const& eventData = events[*eventId];
if (!eventData.isValid())
{
handler->SendSysMessage(LANG_EVENT_NOT_EXIST);
diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
index 0293ae9a93c..38861797e85 100644
--- a/src/server/scripts/Commands/cs_gobject.cpp
+++ b/src/server/scripts/Commands/cs_gobject.cpp
@@ -118,7 +118,7 @@ public:
if (objectInfo->displayId && !sGameObjectDisplayInfoStore.LookupEntry(objectInfo->displayId))
{
// report to DB errors log as in loading case
- TC_LOG_ERROR("sql.sql", "Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", *objectId, objectInfo->type, objectInfo->displayId);
+ TC_LOG_ERROR("sql.sql", "Gameobject (Entry {} GoType: {}) have invalid displayId ({}), not spawned.", *objectId, objectInfo->type, objectInfo->displayId);
handler->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, objectId);
handler->SetSentErrorMessage(true);
return false;
@@ -193,7 +193,7 @@ public:
{
if (objectId->holds_alternative<GameObjectEntry>())
{
- result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1",
+ result = WorldDatabase.PQuery("SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - '{}', 2) + POW(position_y - '{}', 2) + POW(position_z - '{}', 2)) AS order_ FROM gameobject WHERE map = '{}' AND id = '{}' ORDER BY order_ ASC LIMIT 1",
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), static_cast<uint32>(objectId->get<GameObjectEntry>()));
}
else
@@ -201,9 +201,9 @@ public:
std::string name = std::string(objectId->get<std::string_view>());
WorldDatabase.EscapeString(name);
result = WorldDatabase.PQuery(
- "SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
- "FROM gameobject LEFT JOIN gameobject_template ON gameobject_template.entry = gameobject.id WHERE map = %i AND name LIKE '%%%s%%' ORDER BY order_ ASC LIMIT 1",
- player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str());
+ "SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - {}, 2) + POW(position_y - {}, 2) + POW(position_z - {}, 2)) AS order_ "
+ "FROM gameobject LEFT JOIN gameobject_template ON gameobject_template.entry = gameobject.id WHERE map = {} AND name LIKE '%{}%' ORDER BY order_ ASC LIMIT 1",
+ player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name);
}
}
else
@@ -229,10 +229,10 @@ public:
eventFilter << ')';
result = WorldDatabase.PQuery("SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, phaseMask, "
- "(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
- "LEFT OUTER JOIN game_event_gameobject on gameobject.guid = game_event_gameobject.guid WHERE map = '%i' %s ORDER BY order_ ASC LIMIT 10",
+ "(POW(position_x - {}, 2) + POW(position_y - {}, 2) + POW(position_z - {}, 2)) AS order_ FROM gameobject "
+ "LEFT OUTER JOIN game_event_gameobject on gameobject.guid = game_event_gameobject.guid WHERE map = '{}' {} ORDER BY order_ ASC LIMIT 10",
handler->GetSession()->GetPlayer()->GetPositionX(), handler->GetSession()->GetPlayer()->GetPositionY(), handler->GetSession()->GetPlayer()->GetPositionZ(),
- handler->GetSession()->GetPlayer()->GetMapId(), eventFilter.str().c_str());
+ handler->GetSession()->GetPlayer()->GetMapId(), eventFilter.str());
}
if (!result)
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 6d70d7ec308..e076acad15e 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -91,18 +91,18 @@ public:
QueryResult result;
uint32 creatureCount = 0;
- result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='%u'", creatureId);
+ result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM creature WHERE id='{}'", creatureId);
if (result)
creatureCount = (*result)[0].GetUInt64();
if (handler->GetSession())
{
Player* player = handler->GetSession()->GetPlayer();
- result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM creature WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
+ result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, (POW(position_x - '{}', 2) + POW(position_y - '{}', 2) + POW(position_z - '{}', 2)) AS order_ FROM creature WHERE id = '{}' ORDER BY order_ ASC LIMIT {}",
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), creatureId, count);
}
else
- result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '%u' LIMIT %u",
+ result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map FROM creature WHERE id = '{}' LIMIT {}",
creatureId, count);
if (result)
@@ -369,18 +369,18 @@ public:
QueryResult result;
uint32 objectCount = 0;
- result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='%u'", gameObjectId);
+ result = WorldDatabase.PQuery("SELECT COUNT(guid) FROM gameobject WHERE id='{}'", gameObjectId);
if (result)
objectCount = (*result)[0].GetUInt64();
if (handler->GetSession())
{
Player* player = handler->GetSession()->GetPlayer();
- result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE id = '%u' ORDER BY order_ ASC LIMIT %u",
+ result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id, (POW(position_x - '{}', 2) + POW(position_y - '{}', 2) + POW(position_z - '{}', 2)) AS order_ FROM gameobject WHERE id = '{}' ORDER BY order_ ASC LIMIT {}",
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), gameObjectId, count);
}
else
- result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '%u' LIMIT %u",
+ result = WorldDatabase.PQuery("SELECT guid, position_x, position_y, position_z, map, id FROM gameobject WHERE id = '{}' LIMIT {}",
gameObjectId, count);
if (result)
@@ -580,7 +580,7 @@ public:
if (hasItem == 1)
{
QueryResult result2;
- result2 = CharacterDatabase.PQuery("SELECT item_guid FROM mail_items WHERE mail_id = '%u'", messageId);
+ result2 = CharacterDatabase.PQuery("SELECT item_guid FROM mail_items WHERE mail_id = '{}'", messageId);
if (result2)
{
do
@@ -597,7 +597,7 @@ public:
uint32 item_entry = fields3[0].GetUInt32();
uint32 item_count = fields3[1].GetUInt32();
QueryResult result4;
- result4 = WorldDatabase.PQuery("SELECT name, quality FROM item_template WHERE entry = '%u'", item_entry);
+ result4 = WorldDatabase.PQuery("SELECT name, quality FROM item_template WHERE entry = '{}'", item_entry);
Field* fields1 = result4->Fetch();
std::string item_name = fields1[0].GetString();
int item_quality = fields1[1].GetUInt8();
diff --git a/src/server/scripts/Commands/cs_message.cpp b/src/server/scripts/Commands/cs_message.cpp
index 1cd21ab021e..c34a586ad05 100644
--- a/src/server/scripts/Commands/cs_message.cpp
+++ b/src/server/scripts/Commands/cs_message.cpp
@@ -151,7 +151,7 @@ public:
if (message.empty())
return false;
- sWorld->SendServerMessage(SERVER_MSG_STRING, Trinity::StringFormat(handler->GetTrinityString(LANG_SYSTEMMESSAGE), message.data()).c_str());
+ sWorld->SendServerMessage(SERVER_MSG_STRING, handler->PGetParseString(LANG_SYSTEMMESSAGE, message.data()));
return true;
}
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp
index da9b6ad5ec7..bfbda9be376 100644
--- a/src/server/scripts/Commands/cs_modify.cpp
+++ b/src/server/scripts/Commands/cs_modify.cpp
@@ -168,7 +168,6 @@ public:
NotifyModification(handler, target, LANG_YOU_CHANGE_ENERGY, LANG_YOURS_ENERGY_CHANGED, energy / energyMultiplier, energymax / energyMultiplier);
target->SetMaxPower(POWER_ENERGY, energymax);
target->SetPower(POWER_ENERGY, energy);
- TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_CURRENT_ENERGY), target->GetMaxPower(POWER_ENERGY));
return true;
}
return false;
@@ -578,7 +577,7 @@ public:
{
int32 newmoney = int32(targetMoney) + moneyToAdd;
- TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_CURRENT_MONEY), targetMoney, moneyToAdd, newmoney);
+ TC_LOG_DEBUG("misc", "{}", handler->PGetParseString(LANG_CURRENT_MONEY, targetMoney, moneyToAdd, newmoney));
if (newmoney <= 0)
{
NotifyModification(handler, target, LANG_YOU_TAKE_ALL_MONEY, LANG_YOURS_ALL_MONEY_GONE);
@@ -607,7 +606,7 @@ public:
target->ModifyMoney(moneyToAdd);
}
- TC_LOG_DEBUG("misc", handler->GetTrinityString(LANG_NEW_MONEY), targetMoney, moneyToAdd, target->GetMoney());
+ TC_LOG_DEBUG("misc", "{}", handler->PGetParseString(LANG_NEW_MONEY, targetMoney, moneyToAdd, target->GetMoney()));
return true;
}
diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp
index b2c6cef3229..e85636f282d 100644
--- a/src/server/scripts/Commands/cs_npc.cpp
+++ b/src/server/scripts/Commands/cs_npc.cpp
@@ -1122,7 +1122,7 @@ public:
continue;
ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(pair.first);
Player const* player = ObjectAccessor::FindConnectedPlayer(guid);
- handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_SUBLABEL, player ? player->GetName() : Trinity::StringFormat("Offline player (GuidLow 0x%08x)", pair.first).c_str(), pair.second->size());
+ handler->PSendSysMessage(LANG_COMMAND_NPC_SHOWLOOT_SUBLABEL, player ? player->GetName() : Trinity::StringFormat("Offline player (GuidLow 0x{:08X})", pair.first), pair.second->size());
for (auto it = pair.second->cbegin(); it != pair.second->cend(); ++it)
{
diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp
index 23e1ea13925..125f83a15f4 100644
--- a/src/server/scripts/Commands/cs_reload.cpp
+++ b/src/server/scripts/Commands/cs_reload.cpp
@@ -446,7 +446,7 @@ public:
continue;
}
- TC_LOG_INFO("misc", "Reloading creature template entry %u", entry);
+ TC_LOG_INFO("misc", "Reloading creature template entry {}", entry);
Field* fields = result->Fetch();
sObjectMgr->LoadCreatureTemplate(fields);
diff --git a/src/server/scripts/Commands/cs_reset.cpp b/src/server/scripts/Commands/cs_reset.cpp
index be78a9054b7..0680f7985b5 100644
--- a/src/server/scripts/Commands/cs_reset.cpp
+++ b/src/server/scripts/Commands/cs_reset.cpp
@@ -99,7 +99,7 @@ public:
ChrClassesEntry const* classEntry = sChrClassesStore.LookupEntry(player->GetClass());
if (!classEntry)
{
- TC_LOG_ERROR("misc", "Class %u not found in DBC (Wrong DBC files?)", player->GetClass());
+ TC_LOG_ERROR("misc", "Class {} not found in DBC (Wrong DBC files?)", player->GetClass());
return false;
}
diff --git a/src/server/scripts/Commands/cs_server.cpp b/src/server/scripts/Commands/cs_server.cpp
index c32662b992a..10978ef3782 100644
--- a/src/server/scripts/Commands/cs_server.cpp
+++ b/src/server/scripts/Commands/cs_server.cpp
@@ -130,13 +130,13 @@ public:
{
uint16 dbPort = 0;
- if (QueryResult res = LoginDatabase.PQuery("SELECT port FROM realmlist WHERE id = %u", realm.Id.Realm))
+ if (QueryResult res = LoginDatabase.PQuery("SELECT port FROM realmlist WHERE id = {}", realm.Id.Realm))
dbPort = (*res)[0].GetUInt16();
if (dbPort)
- dbPortOutput = Trinity::StringFormat("Realmlist (Realm Id: %u) configured in port %" PRIu16, realm.Id.Realm, dbPort);
+ dbPortOutput = Trinity::StringFormat("Realmlist (Realm Id: {}) configured in port %" PRIu16, realm.Id.Realm, dbPort);
else
- dbPortOutput = Trinity::StringFormat("Realm Id: %u not found in `realmlist` table. Please check your setup", realm.Id.Realm);
+ dbPortOutput = Trinity::StringFormat("Realm Id: {} not found in `realmlist` table. Please check your setup", realm.Id.Realm);
}
handler->PSendSysMessage("%s", GitRevision::GetFullVersion());
diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp
index db98dbd630f..57227f93b1f 100644
--- a/src/server/scripts/Commands/cs_tele.cpp
+++ b/src/server/scripts/Commands/cs_tele.cpp
@@ -365,7 +365,7 @@ public:
std::string normalizedName(name);
WorldDatabase.EscapeString(normalizedName);
- QueryResult result = WorldDatabase.PQuery("SELECT c.position_x, c.position_y, c.position_z, c.orientation, c.map, ct.name FROM creature c INNER JOIN creature_template ct ON c.id = ct.entry WHERE ct.name LIKE '%s'", normalizedName.c_str());
+ QueryResult result = WorldDatabase.PQuery("SELECT c.position_x, c.position_y, c.position_z, c.orientation, c.map, ct.name FROM creature c INNER JOIN creature_template ct ON c.id = ct.entry WHERE ct.name LIKE '{}'", normalizedName);
if (!result)
{
handler->SendSysMessage(LANG_COMMAND_GOCREATNOTFOUND);
diff --git a/src/server/scripts/Commands/cs_titles.cpp b/src/server/scripts/Commands/cs_titles.cpp
index 0175d72ca59..954d5ab813b 100644
--- a/src/server/scripts/Commands/cs_titles.cpp
+++ b/src/server/scripts/Commands/cs_titles.cpp
@@ -79,7 +79,7 @@ public:
}
std::string tNameLink = handler->GetNameLink(target);
- std::string titleNameStr = Trinity::StringFormat(target->GetNativeGender() == GENDER_MALE ? titleInfo->Name[handler->GetSessionDbcLocale()] : titleInfo->Name1[handler->GetSessionDbcLocale()], target->GetName());
+ std::string titleNameStr = fmt::sprintf(target->GetNativeGender() == GENDER_MALE ? titleInfo->Name[handler->GetSessionDbcLocale()] : titleInfo->Name1[handler->GetSessionDbcLocale()], target->GetName());
target->SetTitle(titleInfo);
target->SetUInt32Value(PLAYER_CHOSEN_TITLE, titleInfo->MaskID);
@@ -112,7 +112,7 @@ public:
}
std::string tNameLink = handler->GetNameLink(target);
- std::string titleNameStr = Trinity::StringFormat(target->GetNativeGender() == GENDER_MALE ? titleInfo->Name[handler->GetSessionDbcLocale()] : titleInfo->Name1[handler->GetSessionDbcLocale()], target->GetName());
+ std::string titleNameStr = fmt::sprintf(target->GetNativeGender() == GENDER_MALE ? titleInfo->Name[handler->GetSessionDbcLocale()] : titleInfo->Name1[handler->GetSessionDbcLocale()], target->GetName());
target->SetTitle(titleInfo);
handler->PSendSysMessage(LANG_TITLE_ADD_RES, titleId, titleNameStr, tNameLink);
@@ -145,7 +145,7 @@ public:
target->SetTitle(titleInfo, true);
std::string tNameLink = handler->GetNameLink(target);
- std::string titleNameStr = Trinity::StringFormat(target->GetNativeGender() == GENDER_MALE ? titleInfo->Name[handler->GetSessionDbcLocale()] : titleInfo->Name1[handler->GetSessionDbcLocale()], target->GetName());
+ std::string titleNameStr = fmt::sprintf(target->GetNativeGender() == GENDER_MALE ? titleInfo->Name[handler->GetSessionDbcLocale()] : titleInfo->Name1[handler->GetSessionDbcLocale()], target->GetName());
handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, titleId, titleNameStr, tNameLink);
diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp
index 1ec41265b99..d987d054bc6 100644
--- a/src/server/scripts/Commands/cs_wp.cpp
+++ b/src/server/scripts/Commands/cs_wp.cpp
@@ -525,7 +525,7 @@ public:
}
else if (arg_str_2 == "dataint")
{
- WorldDatabase.PExecute("UPDATE waypoint_scripts SET %s='%u' WHERE guid='%u'", arg_2, atoi(arg_3), id); // Query can't be a prepared statement
+ WorldDatabase.PExecute("UPDATE waypoint_scripts SET {}='{}' WHERE guid='{}'", arg_2, arg_3, id); // Query can't be a prepared statement
handler->PSendSysMessage("|cff00ff00Waypoint script: |r|cff00ffff%u|r|cff00ff00 dataint updated.|r", id);
return true;
@@ -534,7 +534,7 @@ public:
{
std::string arg_str_3 = arg_3;
WorldDatabase.EscapeString(arg_str_3);
- WorldDatabase.PExecute("UPDATE waypoint_scripts SET %s='%s' WHERE guid='%u'", arg_2, arg_str_3.c_str(), id); // Query can't be a prepared statement
+ WorldDatabase.PExecute("UPDATE waypoint_scripts SET {}='{}' WHERE guid='{}'", arg_2, arg_str_3, id); // Query can't be a prepared statement
}
}
handler->PSendSysMessage("%s%s|r|cff00ffff%u:|r|cff00ff00 %s %s|r", "|cff00ff00", "Waypoint script:", id, arg_2, "updated.");
@@ -712,14 +712,14 @@ public:
if (text == 0)
{
// show_str check for present in list of correct values, no sql injection possible
- WorldDatabase.PExecute("UPDATE waypoint_data SET %s=NULL WHERE id='%u' AND point='%u'", show_str, pathid, point); // Query can't be a prepared statement
+ WorldDatabase.PExecute("UPDATE waypoint_data SET {}=NULL WHERE id='{}' AND point='{}'", show_str, pathid, point); // Query can't be a prepared statement
}
else
{
// show_str check for present in list of correct values, no sql injection possible
std::string text2 = text;
WorldDatabase.EscapeString(text2);
- WorldDatabase.PExecute("UPDATE waypoint_data SET %s='%s' WHERE id='%u' AND point='%u'", show_str, text2.c_str(), pathid, point); // Query can't be a prepared statement
+ WorldDatabase.PExecute("UPDATE waypoint_data SET {}='{}' WHERE id='{}' AND point='{}'", show_str, text2, pathid, point); // Query can't be a prepared statement
}
handler->PSendSysMessage(LANG_WAYPOINT_CHANGED_NO, show_str);