diff options
author | Antonio MartÃn Berti <15972392+BertiRean@users.noreply.github.com> | 2024-06-03 19:44:22 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-04 00:44:22 +0200 |
commit | 3fd967754388b7b859dbd8b954ec68a844e172f0 (patch) | |
tree | 447c456bc9cad7e35c54ae4c5de937a478a7beac /src | |
parent | 18fd59d965694b5cd0f62c011875a5d8beaac7e2 (diff) |
Core/Misc: Added Loading.Locales to enable/disable the load of locales (#30013)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/DataStores/DB2Stores.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 5 | ||||
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 5 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Quests/QuestDef.cpp | 17 | ||||
-rw-r--r-- | src/server/game/World/World.cpp | 51 | ||||
-rw-r--r-- | src/server/game/World/World.h | 1 | ||||
-rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 16 |
8 files changed, 80 insertions, 19 deletions
diff --git a/src/server/game/DataStores/DB2Stores.cpp b/src/server/game/DataStores/DB2Stores.cpp index 5d4090f0cf8..502d813c008 100644 --- a/src/server/game/DataStores/DB2Stores.cpp +++ b/src/server/game/DataStores/DB2Stores.cpp @@ -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; diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index b4e5dba8d5f..3a9aaf7b317 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -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 diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index eaa8c05f0dc..75464e7441e 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -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 diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 3d08f636d4f..b0d86166f3d 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -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)) diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index a77b6f8d3b4..cfe33834173 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -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 diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index cb144ecb4f2..3ddeb2d96e5 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -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 diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 80bd856a94a..4d6ef2211f5 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -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 }; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 4de9747b876..b8a3392e9fd 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -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 + +# +################################################################################################### |