refactor(Core/ObjectMgr): Change GetAcoreString from char const* to s… (#21213)

...ring
This commit is contained in:
Kitzunu
2025-02-01 22:46:42 +01:00
committed by GitHub
parent 137337601d
commit 9e9a2fe5e3
25 changed files with 71 additions and 95 deletions

View File

@@ -292,7 +292,7 @@ public:
Player const* target = player->GetConnectedPlayer();
LocaleConstant loc = handler->GetSessionDbcLocale();
char const* knownStr = handler->GetAcoreString(LANG_KNOWN);
std::string knownStr = handler->GetAcoreString(LANG_KNOWN);
// Search in CharTitles.dbc
for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++)
@@ -308,7 +308,7 @@ public:
if (!*name)
continue;
char const* activeStr = "";
std::string activeStr = "";
if (target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index)
activeStr = handler->GetAcoreString(LANG_ACTIVE);

View File

@@ -61,28 +61,22 @@ public:
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
char const* active = handler->GetAcoreString(LANG_ACTIVE);
std::string active = handler->GetAcoreString(LANG_ACTIVE);
for (uint16 eventId : activeEvents)
{
GameEventData const& eventData = events[eventId];
if (handler->GetSession())
{
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CHAT, eventId, eventId, eventData.description, active);
}
else
{
handler->PSendSysMessage(LANG_EVENT_ENTRY_LIST_CONSOLE, eventId, eventData.description, active);
}
++counter;
}
if (counter == 0)
{
handler->SendSysMessage(LANG_NOEVENTFOUND);
}
handler->SetSentErrorMessage(true);
@@ -108,7 +102,7 @@ public:
GameEventMgr::ActiveEvents const& activeEvents = sGameEventMgr->GetActiveEventList();
bool active = activeEvents.find(eventId) != activeEvents.end();
char const* activeStr = active ? handler->GetAcoreString(LANG_ACTIVE) : "";
std::string activeStr = active ? handler->GetAcoreString(LANG_ACTIVE) : "";
std::string startTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.start));
std::string endTimeStr = Acore::Time::TimeToTimestampStr(Seconds(eventData.end));

View File

@@ -460,8 +460,8 @@ public:
wstrToLower(namePart);
char const* talentStr = handler->GetAcoreString(LANG_TALENT);
char const* passiveStr = handler->GetAcoreString(LANG_PASSIVE);
std::string talentStr = handler->GetAcoreString(LANG_TALENT);
std::string passiveStr = handler->GetAcoreString(LANG_PASSIVE);
Unit::AuraApplicationMap const& auras = unit->GetAppliedAuras();
handler->PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, auras.size());

View File

@@ -308,7 +308,7 @@ public:
return true;
}
char const* active = activeEvents.find(id) != activeEvents.end() ? handler->GetAcoreString(LANG_ACTIVE) : "";
std::string active = activeEvents.find(id) != activeEvents.end() ? handler->GetAcoreString(LANG_ACTIVE) : "";
if (handler->GetSession())
{
@@ -806,7 +806,7 @@ public:
return true;
}
char const* statusStr = "";
std::string statusStr = "";
if (target)
{
@@ -862,7 +862,7 @@ public:
return true;
}
char const* statusStr = "";
std::string statusStr = "";
if (target)
{
@@ -1498,20 +1498,16 @@ public:
return true;
}
char const* knownStr = target && target->HasTitle(titleInfo) ? handler->GetAcoreString(LANG_KNOWN) : "";
char const* activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index ? handler->GetAcoreString(LANG_ACTIVE) : "";
std::string knownStr = target && target->HasTitle(titleInfo) ? handler->GetAcoreString(LANG_KNOWN) : "";
std::string activeStr = target && target->GetUInt32Value(PLAYER_CHOSEN_TITLE) == titleInfo->bit_index ? handler->GetAcoreString(LANG_ACTIVE) : "";
std::string titleNameStr = Acore::StringFormat(name, targetName);
// send title in "id (idx:idx) - [namedlink locale]" format
if (handler->GetSession())
{
handler->PSendSysMessage(LANG_TITLE_LIST_CHAT, titleInfo->ID, titleInfo->bit_index, titleInfo->ID, titleNameStr, localeNames[locale], knownStr, activeStr);
}
else
{
handler->PSendSysMessage(LANG_TITLE_LIST_CONSOLE, titleInfo->ID, titleInfo->bit_index, titleNameStr, localeNames[locale], knownStr, activeStr);
}
++counter;
}

View File

@@ -1992,8 +1992,8 @@ public:
uint32 mapId;
uint32 areaId;
uint32 phase = 0;
char const* areaName = nullptr;
char const* zoneName = nullptr;
std::string areaName = "";
std::string zoneName = "";
// Guild data print variables defined so that they exist, but are not necessarily used
uint32 guildId = 0;
@@ -2325,19 +2325,13 @@ public:
}
}
if (!zoneName)
{
if (zoneName.empty())
zoneName = handler->GetAcoreString(LANG_UNKNOWN);
}
if (areaName)
{
if (!areaName.empty())
handler->PSendSysMessage(LANG_PINFO_CHR_MAP_WITH_AREA, map->name[locale], zoneName, areaName);
}
else
{
handler->PSendSysMessage(LANG_PINFO_CHR_MAP, map->name[locale], zoneName);
}
// Output XVII. - XVIX. if they are not empty
if (!guildName.empty())
@@ -3022,18 +3016,9 @@ public:
return false;
}
const char* str = sObjectMgr->GetAcoreString(id, locale ? static_cast<LocaleConstant>(*locale) : DEFAULT_LOCALE);
if (!strcmp(str, "<error>"))
{
handler->PSendSysMessage(LANG_NO_ACORE_STRING_FOUND, id);
return true;
}
else
{
handler->SendSysMessage(str);
return true;
}
std::string str = sObjectMgr->GetAcoreString(id, locale ? static_cast<LocaleConstant>(*locale) : DEFAULT_LOCALE);
handler->SendSysMessage(str);
return true;
}
static bool HandleOpenDoorCommand(ChatHandler* handler, Optional<float> range)