mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/Misc: Minor fixes in preparation to support fmt v10
This commit is contained in:
@@ -43,7 +43,7 @@ namespace Trinity
|
||||
}
|
||||
catch (std::exception const& formatError)
|
||||
{
|
||||
return fmt::format("An error occurred formatting string \"{}\" : {}", fmt, formatError.what());
|
||||
return fmt::format("An error occurred formatting string \"{}\" : {}", FormatStringView(fmt), formatError.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Trinity
|
||||
}
|
||||
catch (std::exception const& formatError)
|
||||
{
|
||||
return fmt::format_to(out, "An error occurred formatting string \"{}\" : {}", fmt, formatError.what());
|
||||
return fmt::format_to(out, "An error occurred formatting string \"{}\" : {}", FormatStringView(fmt), formatError.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ struct fmt::formatter<Optional<T>, Char> : formatter<T, Char>
|
||||
if (value.has_value())
|
||||
return formatter<T, Char>::format(*value, ctx);
|
||||
|
||||
return formatter<std::string_view, Char>().format("(nullopt)", ctx);
|
||||
return formatter<string_view, Char>().format("(nullopt)", ctx);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ void WorldSession::HandleGuildDelete(WorldPackets::Guild::GuildDelete& /*packet*
|
||||
|
||||
void WorldSession::HandleGuildUpdateMotdText(WorldPackets::Guild::GuildUpdateMotdText& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_UPDATE_MOTD_TEXT [{}]: MOTD: {}", GetPlayerInfo(), packet.MotdText);
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_UPDATE_MOTD_TEXT [{}]: MOTD: {}", GetPlayerInfo(), std::string_view(packet.MotdText));
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->HandleSetMOTD(this, packet.MotdText);
|
||||
@@ -133,7 +133,7 @@ void WorldSession::HandleGuildUpdateMotdText(WorldPackets::Guild::GuildUpdateMot
|
||||
void WorldSession::HandleGuildSetMemberNote(WorldPackets::Guild::GuildSetMemberNote& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_NOTE [{}]: Target: {}, Note: {}, Public: {}",
|
||||
GetPlayerInfo(), packet.NoteeGUID.ToString(), packet.Note, packet.IsPublic);
|
||||
GetPlayerInfo(), packet.NoteeGUID.ToString(), std::string_view(packet.Note), packet.IsPublic);
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->HandleSetMemberNote(this, packet.Note, packet.NoteeGUID, packet.IsPublic);
|
||||
@@ -151,7 +151,7 @@ void WorldSession::HandleGuildGetRanks(WorldPackets::Guild::GuildGetRanks& packe
|
||||
|
||||
void WorldSession::HandleGuildAddRank(WorldPackets::Guild::GuildAddRank& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_ADD_RANK [{}]: Rank: {}", GetPlayerInfo(), packet.Name);
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_ADD_RANK [{}]: Rank: {}", GetPlayerInfo(), std::string_view(packet.Name));
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->HandleAddNewRank(this, packet.Name);
|
||||
@@ -175,7 +175,7 @@ void WorldSession::HandleGuildShiftRank(WorldPackets::Guild::GuildShiftRank& shi
|
||||
|
||||
void WorldSession::HandleGuildUpdateInfoText(WorldPackets::Guild::GuildUpdateInfoText& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_UPDATE_INFO_TEXT [{}]: {}", GetPlayerInfo(), packet.InfoText);
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_UPDATE_INFO_TEXT [{}]: {}", GetPlayerInfo(), std::string_view(packet.InfoText));
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->HandleSetInfo(this, packet.InfoText);
|
||||
@@ -475,7 +475,7 @@ void WorldSession::HandleGuildBankBuyTab(WorldPackets::Guild::GuildBankBuyTab& p
|
||||
void WorldSession::HandleGuildBankUpdateTab(WorldPackets::Guild::GuildBankUpdateTab& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [{}]: [{}], TabId: {}, Name: {}, Icon: {}"
|
||||
, GetPlayerInfo(), packet.Banker.ToString(), packet.BankTab, packet.Name, packet.Icon);
|
||||
, GetPlayerInfo(), packet.Banker.ToString(), packet.BankTab, std::string_view(packet.Name), std::string_view(packet.Icon));
|
||||
|
||||
if (!packet.Name.empty() && !packet.Icon.empty())
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(packet.Banker, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
@@ -501,7 +501,7 @@ void WorldSession::HandleGuildBankTextQuery(WorldPackets::Guild::GuildBankTextQu
|
||||
|
||||
void WorldSession::HandleGuildBankSetTabText(WorldPackets::Guild::GuildBankSetTabText& packet)
|
||||
{
|
||||
TC_LOG_DEBUG("guild", "CMSG_SET_GUILD_BANK_TEXT [{}]: TabId: {}, Text: {}", GetPlayerInfo(), packet.Tab, packet.TabText);
|
||||
TC_LOG_DEBUG("guild", "CMSG_SET_GUILD_BANK_TEXT [{}]: TabId: {}, Text: {}", GetPlayerInfo(), packet.Tab, std::string_view(packet.TabText));
|
||||
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
guild->SetBankTabText(packet.Tab, packet.TabText);
|
||||
@@ -517,7 +517,7 @@ void WorldSession::HandleGuildSetRankPermissions(WorldPackets::Guild::GuildSetRa
|
||||
for (uint8 tabId = 0; tabId < GUILD_BANK_MAX_TABS; ++tabId)
|
||||
rightsAndSlots[tabId] = GuildBankRightsAndSlots(tabId, uint8(packet.TabFlags[tabId]), uint32(packet.TabWithdrawItemLimit[tabId]));
|
||||
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_RANK_PERMISSIONS [{}]: Rank: {} ({})", GetPlayerInfo(), packet.RankName, packet.RankOrder);
|
||||
TC_LOG_DEBUG("guild", "CMSG_GUILD_SET_RANK_PERMISSIONS [{}]: Rank: {} ({})", GetPlayerInfo(), std::string_view(packet.RankName), packet.RankOrder);
|
||||
|
||||
guild->HandleSetRankInfo(this, GuildRankId(packet.RankID), packet.RankName, packet.Flags, packet.WithdrawGoldLimit, rightsAndSlots);
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public:
|
||||
std::string occurenceStr = secsToTimeString(eventData.occurence * MINUTE);
|
||||
std::string lengthStr = secsToTimeString(eventData.length * MINUTE);
|
||||
|
||||
handler->PSendSysMessage(LANG_EVENT_INFO, eventId, eventData.description.c_str(), activeStr,
|
||||
handler->PSendSysMessage(LANG_EVENT_INFO, *eventId, eventData.description.c_str(), activeStr,
|
||||
startTimeStr.c_str(), endTimeStr.c_str(), occurenceStr.c_str(), lengthStr.c_str(),
|
||||
nextStr.c_str());
|
||||
return true;
|
||||
@@ -142,7 +142,7 @@ public:
|
||||
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
|
||||
if (activeEvents.find(eventId) != activeEvents.end())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE, eventId);
|
||||
handler->PSendSysMessage(LANG_EVENT_ALREADY_ACTIVE, *eventId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -174,7 +174,7 @@ public:
|
||||
|
||||
if (activeEvents.find(eventId) == activeEvents.end())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_EVENT_NOT_ACTIVE, eventId);
|
||||
handler->PSendSysMessage(LANG_EVENT_NOT_ACTIVE, *eventId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ public:
|
||||
TaxiNodesEntry const* node = sTaxiNodesStore.LookupEntry(nodeId);
|
||||
if (!node)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, nodeId);
|
||||
handler->PSendSysMessage(LANG_COMMAND_GOTAXINODENOTFOUND, *nodeId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ public:
|
||||
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(areaTriggerId);
|
||||
if (!at)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, areaTriggerId);
|
||||
handler->PSendSysMessage(LANG_COMMAND_GOAREATRNOTFOUND, *areaTriggerId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
GameObjectTemplate const* objectInfo = sObjectMgr->GetGameObjectTemplate(objectId);
|
||||
if (!objectInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, objectId);
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, *objectId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
{
|
||||
// report to DB errors log as in loading case
|
||||
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->PSendSysMessage(LANG_GAMEOBJECT_HAVE_INVALID_DATA, *objectId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -155,7 +155,7 @@ public:
|
||||
/// @todo is it really necessary to add both the real and DB table guid here ?
|
||||
sObjectMgr->AddGameobjectToGrid(ASSERT_NOTNULL(sObjectMgr->GetGameObjectData(spawnId)));
|
||||
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, objectId, objectInfo->name.c_str(), std::to_string(spawnId).c_str(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_ADD, *objectId, objectInfo->name.c_str(), std::to_string(spawnId).c_str(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
|
||||
if (!sObjectMgr->GetGameObjectTemplate(objectId))
|
||||
{
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, objectId);
|
||||
handler->PSendSysMessage(LANG_GAMEOBJECT_NOT_EXIST, *objectId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -303,7 +303,7 @@ public:
|
||||
Unit* owner = ObjectAccessor::GetUnit(*player, ownerGuid);
|
||||
if (!owner || !ownerGuid.IsPlayer())
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, ownerGuid.GetCounter(), spawnId);
|
||||
handler->PSendSysMessage(LANG_COMMAND_DELOBJREFERCREATURE, std::to_string(*spawnId).c_str(), ownerGuid.ToString().c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creatureId);
|
||||
if (!cInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, creatureId);
|
||||
handler->PSendSysMessage(LANG_COMMAND_INVALIDCREATUREID, *creatureId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, creatureId, creatureCount);
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTCREATUREMESSAGE, *creatureId, creatureCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -350,7 +350,7 @@ public:
|
||||
GameObjectTemplate const* gInfo = sObjectMgr->GetGameObjectTemplate(gameObjectId);
|
||||
if (!gInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, gameObjectId);
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTOBJINVALIDID, *gameObjectId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -416,7 +416,7 @@ public:
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, gameObjectId, objectCount);
|
||||
handler->PSendSysMessage(LANG_COMMAND_LISTOBJMESSAGE, *gameObjectId, objectCount);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1472,7 +1472,7 @@ public:
|
||||
// prevent generation all items with itemset field value '0'
|
||||
if (*itemSetId == 0)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
|
||||
handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, *itemSetId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -1535,7 +1535,7 @@ public:
|
||||
|
||||
if (!found)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, itemSetId);
|
||||
handler->PSendSysMessage(LANG_NO_ITEMS_FROM_ITEMSET_FOUND, *itemSetId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -1588,7 +1588,7 @@ public:
|
||||
SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillId);
|
||||
if (!skillLine)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_INVALID_SKILL_ID, skillId);
|
||||
handler->PSendSysMessage(LANG_INVALID_SKILL_ID, *skillId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -1606,7 +1606,7 @@ public:
|
||||
// add the skill to the player's book with step 1 (which is the first rank, in most cases something
|
||||
// like 'Apprentice <skill>'.
|
||||
target->SetSkill(skillId, targetHasSkill ? target->GetSkillStep(skillId) : 1, level, max);
|
||||
handler->PSendSysMessage(LANG_SET_SKILL, skillId, skillLine->DisplayName[handler->GetSessionDbcLocale()], handler->GetNameLink(target).c_str(), level, max);
|
||||
handler->PSendSysMessage(LANG_SET_SKILL, *skillId, skillLine->DisplayName[handler->GetSessionDbcLocale()], handler->GetNameLink(target).c_str(), level, max);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
|
||||
if (!titleInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, titleId);
|
||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, *titleId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ public:
|
||||
target->SetTitle(titleInfo);
|
||||
target->SetChosenTitle(titleInfo->MaskID);
|
||||
|
||||
handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, titleId, titleNameStr.c_str(), tNameLink.c_str());
|
||||
handler->PSendSysMessage(LANG_TITLE_CURRENT_RES, *titleId, titleNameStr.c_str(), tNameLink.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public:
|
||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
|
||||
if (!titleInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, titleId);
|
||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, *titleId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public:
|
||||
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.c_str(), tNameLink.c_str());
|
||||
handler->PSendSysMessage(LANG_TITLE_ADD_RES, *titleId, titleNameStr.c_str(), tNameLink.c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(titleId);
|
||||
if (!titleInfo)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, titleId);
|
||||
handler->PSendSysMessage(LANG_INVALID_TITLE_ID, *titleId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
std::string tNameLink = handler->GetNameLink(target);
|
||||
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.c_str(), tNameLink.c_str());
|
||||
handler->PSendSysMessage(LANG_TITLE_REMOVE_RES, *titleId, titleNameStr.c_str(), tNameLink.c_str());
|
||||
|
||||
if (!target->HasTitle(target->m_playerData->PlayerTitle))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user