Core/Misc: Added Loading.Locales to enable/disable the load of locales (#30013)

This commit is contained in:
Antonio Martín Berti
2024-06-04 00:44:22 +02:00
committed by GitHub
parent 18fd59d965
commit 3fd9677543
8 changed files with 80 additions and 19 deletions
+1 -1
View File
@@ -635,7 +635,7 @@ uint32 DB2Manager::LoadStores(std::string const& dataPath, LocaleConstant defaul
while (db2PathItr != end)
{
LocaleConstant locale = GetLocaleByName(db2PathItr->path().filename().string());
if (IsValidLocale(locale))
if (IsValidLocale(locale) && (sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) || locale == defaultLocale))
foundLocales[locale] = true;
++db2PathItr;
@@ -162,7 +162,12 @@ CreatureModel const* CreatureTemplate::GetFirstVisibleModel() const
void CreatureTemplate::InitializeQueryData()
{
for (uint8 loc = LOCALE_enUS; loc < TOTAL_LOCALES; ++loc)
{
if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && loc != DEFAULT_LOCALE)
continue;
QueryData[loc] = BuildQueryData(static_cast<LocaleConstant>(loc), DIFFICULTY_NONE);
}
}
WorldPacket CreatureTemplate::BuildQueryData(LocaleConstant loc, Difficulty difficulty) const
@@ -63,7 +63,12 @@
void GameObjectTemplate::InitializeQueryData()
{
for (uint8 loc = LOCALE_enUS; loc < TOTAL_LOCALES; ++loc)
{
if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && loc != DEFAULT_LOCALE)
continue;
QueryData[loc] = BuildQueryData(static_cast<LocaleConstant>(loc));
}
}
WorldPacket GameObjectTemplate::BuildQueryData(LocaleConstant loc) const
+1 -1
View File
@@ -9408,7 +9408,7 @@ void ObjectMgr::LoadTrainers()
std::string localeName = fields[1].GetString();
LocaleConstant locale = GetLocaleByName(localeName);
if (!IsValidLocale(locale) || locale == LOCALE_enUS)
if (!IsValidLocale(locale) || !sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) || locale == LOCALE_enUS)
continue;
if (Trainer::Trainer* trainer = Trinity::Containers::MapGetValuePtr(_trainers, trainerId))
+17
View File
@@ -309,6 +309,9 @@ void Quest::LoadQuestObjectiveVisualEffect(Field* fields)
void Quest::LoadConditionalConditionalQuestDescription(Field* fields)
{
LocaleConstant locale = GetLocaleByName(fields[4].GetStringView());
if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && locale != DEFAULT_LOCALE)
return;
if (locale >= TOTAL_LOCALES)
{
TC_LOG_ERROR("sql.sql", "Table `quest_description_conditional` has invalid locale {} set for quest {}. Skipped.", fields[4].GetCString(), fields[0].GetUInt32());
@@ -329,6 +332,9 @@ void Quest::LoadConditionalConditionalQuestDescription(Field* fields)
void Quest::LoadConditionalConditionalRequestItemsText(Field* fields)
{
LocaleConstant locale = GetLocaleByName(fields[4].GetStringView());
if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && locale != DEFAULT_LOCALE)
return;
if (locale >= TOTAL_LOCALES)
{
TC_LOG_ERROR("sql.sql", "Table `quest_request_items_conditional` has invalid locale {} set for quest {}. Skipped.", fields[4].GetCString(), fields[0].GetUInt32());
@@ -349,6 +355,9 @@ void Quest::LoadConditionalConditionalRequestItemsText(Field* fields)
void Quest::LoadConditionalConditionalOfferRewardText(Field* fields)
{
LocaleConstant locale = GetLocaleByName(fields[4].GetStringView());
if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && locale != DEFAULT_LOCALE)
return;
if (locale >= TOTAL_LOCALES)
{
TC_LOG_ERROR("sql.sql", "Table `quest_offer_reward_conditional` has invalid locale {} set for quest {}. Skipped.", fields[4].GetCString(), fields[0].GetUInt32());
@@ -369,6 +378,9 @@ void Quest::LoadConditionalConditionalOfferRewardText(Field* fields)
void Quest::LoadConditionalConditionalQuestCompletionLog(Field* fields)
{
LocaleConstant locale = GetLocaleByName(fields[4].GetStringView());
if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && locale != DEFAULT_LOCALE)
return;
if (locale >= TOTAL_LOCALES)
{
TC_LOG_ERROR("sql.sql", "Table `quest_completion_log_conditional` has invalid locale {} set for quest {}. Skipped.", fields[4].GetCString(), fields[0].GetUInt32());
@@ -604,7 +616,12 @@ bool Quest::CanIncreaseRewardedQuestCounters() const
void Quest::InitializeQueryData()
{
for (uint8 loc = LOCALE_enUS; loc < TOTAL_LOCALES; ++loc)
{
if (!sWorld->getBoolConfig(CONFIG_LOAD_LOCALES) && loc != DEFAULT_LOCALE)
continue;
QueryData[loc] = BuildQueryData(static_cast<LocaleConstant>(loc), nullptr);
}
}
WorldPacket Quest::BuildQueryData(LocaleConstant loc, Player* player) const
+34 -17
View File
@@ -1724,6 +1724,9 @@ void World::LoadConfigSettings(bool reload)
// Enable AE loot
m_bool_configs[CONFIG_ENABLE_AE_LOOT] = sConfigMgr->GetBoolDefault("Loot.EnableAELoot", true);
// Loading of Locales
m_bool_configs[CONFIG_LOAD_LOCALES] = sConfigMgr->GetBoolDefault("Load.Locales", true);
// call ScriptMgr if we're reloading the configuration
if (reload)
sScriptMgr->OnConfigLoad(reload);
@@ -1905,15 +1908,18 @@ bool World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading Localization strings...");
uint32 oldMSTime = getMSTime();
sObjectMgr->LoadCreatureLocales();
sObjectMgr->LoadGameObjectLocales();
sObjectMgr->LoadQuestTemplateLocale();
sObjectMgr->LoadQuestOfferRewardLocale();
sObjectMgr->LoadQuestRequestItemsLocale();
sObjectMgr->LoadQuestObjectivesLocale();
sObjectMgr->LoadPageTextLocales();
sObjectMgr->LoadGossipMenuItemsLocales();
sObjectMgr->LoadPointOfInterestLocales();
if (m_bool_configs[CONFIG_LOAD_LOCALES])
{
sObjectMgr->LoadCreatureLocales();
sObjectMgr->LoadGameObjectLocales();
sObjectMgr->LoadQuestTemplateLocale();
sObjectMgr->LoadQuestOfferRewardLocale();
sObjectMgr->LoadQuestRequestItemsLocale();
sObjectMgr->LoadQuestObjectivesLocale();
sObjectMgr->LoadPageTextLocales();
sObjectMgr->LoadGossipMenuItemsLocales();
sObjectMgr->LoadPointOfInterestLocales();
}
sObjectMgr->SetDBCLocaleIndex(GetDefaultDbcLocale()); // Get once for all the locale index of DBC language (console/broadcasts)
TC_LOG_INFO("server.loading", ">> Localization strings loaded in {} ms", GetMSTimeDiffToNow(oldMSTime));
@@ -2089,7 +2095,9 @@ bool World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading Quest Greetings...");
sObjectMgr->LoadQuestGreetings();
sObjectMgr->LoadQuestGreetingLocales();
if (m_bool_configs[CONFIG_LOAD_LOCALES])
sObjectMgr->LoadQuestGreetingLocales();
TC_LOG_INFO("server.loading", "Loading Objects Pooling Data...");
sPoolMgr->LoadFromDB();
@@ -2183,9 +2191,11 @@ bool World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading Player Choices...");
sObjectMgr->LoadPlayerChoices();
TC_LOG_INFO("server.loading", "Loading Player Choices Locales...");
sObjectMgr->LoadPlayerChoicesLocale();
if (m_bool_configs[CONFIG_LOAD_LOCALES])
{
TC_LOG_INFO("server.loading", "Loading Player Choices Locales...");
sObjectMgr->LoadPlayerChoicesLocale();
}
TC_LOG_INFO("server.loading", "Loading Jump Charge Params...");
sObjectMgr->LoadJumpChargeParams();
@@ -2230,8 +2240,12 @@ bool World::SetInitialWorldSettings()
sAchievementMgr->LoadAchievementScripts();
TC_LOG_INFO("server.loading", "Loading Achievement Rewards...");
sAchievementMgr->LoadRewards();
TC_LOG_INFO("server.loading", "Loading Achievement Reward Locales...");
sAchievementMgr->LoadRewardLocales();
if (m_bool_configs[CONFIG_LOAD_LOCALES])
{
TC_LOG_INFO("server.loading", "Loading Achievement Reward Locales...");
sAchievementMgr->LoadRewardLocales();
}
TC_LOG_INFO("server.loading", "Loading Completed Achievements...");
sAchievementMgr->LoadCompletedAchievements();
@@ -2370,8 +2384,11 @@ bool World::SetInitialWorldSettings()
TC_LOG_INFO("server.loading", "Loading Creature Texts...");
sCreatureTextMgr->LoadCreatureTexts();
TC_LOG_INFO("server.loading", "Loading Creature Text Locales...");
sCreatureTextMgr->LoadCreatureTextLocales();
if (m_bool_configs[CONFIG_LOAD_LOCALES])
{
TC_LOG_INFO("server.loading", "Loading Creature Text Locales...");
sCreatureTextMgr->LoadCreatureTextLocales();
}
TC_LOG_INFO("server.loading", "Loading creature StaticFlags overrides...");
sObjectMgr->LoadCreatureStaticFlagsOverride(); // must be after LoadCreatures
+1
View File
@@ -198,6 +198,7 @@ enum WorldBoolConfigs
CONFIG_CHARACTER_CREATING_DISABLE_ALLIED_RACE_ACHIEVEMENT_REQUIREMENT,
CONFIG_BATTLEGROUNDMAP_LOAD_GRIDS,
CONFIG_ENABLE_AE_LOOT,
CONFIG_LOAD_LOCALES,
BOOL_CONFIG_VALUE_COUNT
};
@@ -41,6 +41,7 @@
# PACKET SPOOF PROTECTION SETTINGS
# METRIC SETTINGS
# PVP SETTINGS
# LOAD SETTINGS
#
###################################################################################################
@@ -4423,3 +4424,18 @@ Pvp.FactionBalance.Pct20 = 0.8
#
###################################################################################################
###################################################################################################
# LOAD SETTINGS
#
# These settings control content loading
#
# Load.Locales
# Description: Toggles the loading of Locales.
# Default: 0 - (Disabled)
# 1 - (Enabled)
Load.Locales = 1
#
###################################################################################################