diff --git a/Source/Framework/Constants/SharedConst.cs b/Source/Framework/Constants/SharedConst.cs index f2b6b705c..caa3d06df 100644 --- a/Source/Framework/Constants/SharedConst.cs +++ b/Source/Framework/Constants/SharedConst.cs @@ -1685,6 +1685,7 @@ namespace Framework.Constants ListenRangeSay, ListenRangeTextemote, ListenRangeYell, + LoadLocales, LogdbClearinterval, LogdbCleartime, MailDeliveryDelay, diff --git a/Source/Game/DataStorage/CliDB.cs b/Source/Game/DataStorage/CliDB.cs index c948ad938..fc88686a6 100644 --- a/Source/Game/DataStorage/CliDB.cs +++ b/Source/Game/DataStorage/CliDB.cs @@ -23,7 +23,7 @@ namespace Game.DataStorage foreach (var dir in Directory.GetDirectories(db2Path)) { Locale locale = Path.GetFileName(dir).ToEnum(); - if (SharedConst.IsValidLocale(locale)) + if (SharedConst.IsValidLocale(locale) && (WorldConfig.GetBoolValue(WorldCfg.LoadLocales) || locale == defaultLocale)) availableDb2Locales[(int)locale] = true; } diff --git a/Source/Game/Entities/Creature/CreatureData.cs b/Source/Game/Entities/Creature/CreatureData.cs index e5b1e83d1..97f72b07b 100644 --- a/Source/Game/Entities/Creature/CreatureData.cs +++ b/Source/Game/Entities/Creature/CreatureData.cs @@ -141,7 +141,12 @@ namespace Game.Entities public void InitializeQueryData() { for (var loc = Locale.enUS; loc < Locale.Total; ++loc) + { + if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && loc != SharedConst.DefaultLocale) + continue; + QueryData[(int)loc] = BuildQueryData(loc, Difficulty.None); + } } public QueryCreatureResponse BuildQueryData(Locale locale, Difficulty difficulty) diff --git a/Source/Game/Globals/ObjectManager.cs b/Source/Game/Globals/ObjectManager.cs index d48cde631..7a37954ae 100644 --- a/Source/Game/Globals/ObjectManager.cs +++ b/Source/Game/Globals/ObjectManager.cs @@ -3257,10 +3257,7 @@ namespace Game } foreach (var unusedSpells in spellsByTrainer) - { - Log.outError(LogFilter.Sql, $"Table `trainer_spell` references non-existing trainer (TrainerId: {unusedSpells.Key}) for SpellId {unusedSpells.Value.SpellId}, ignoring"); - - } + Log.outError(LogFilter.Sql, $"Table `trainer_spell` references non-existing trainer (TrainerId: {unusedSpells.Key}) for SpellId {unusedSpells.Value.SpellId}, ignoring"); SQLResult trainerLocalesResult = DB.World.Query("SELECT Id, locale, Greeting_lang FROM trainer_locale"); if (!trainerLocalesResult.IsEmpty()) @@ -3271,7 +3268,7 @@ namespace Game string localeName = trainerLocalesResult.Read(1); Locale locale = localeName.ToEnum(); - if (!SharedConst.IsValidLocale(locale) || locale == Locale.enUS) + if (!SharedConst.IsValidLocale(locale) || !WorldConfig.GetBoolValue(WorldCfg.LoadLocales) || locale == Locale.enUS) continue; Trainer trainer = trainers.LookupByKey(trainerId); diff --git a/Source/Game/Quest/Quest.cs b/Source/Game/Quest/Quest.cs index e70830342..4326e7e83 100644 --- a/Source/Game/Quest/Quest.cs +++ b/Source/Game/Quest/Quest.cs @@ -304,6 +304,9 @@ namespace Game void LoadConditionalConditionalQuestDescription(SQLFields fields) { Locale locale = fields.Read(4).ToEnum(); + if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && locale != SharedConst.DefaultLocale) + return; + if (locale >= Locale.Total) { Log.outError(LogFilter.Sql, $"Table `quest_description_conditional` has invalid locale {fields.Read(4)} set for quest {fields.Read(0)}. Skipped."); @@ -325,6 +328,9 @@ namespace Game void LoadConditionalConditionalRequestItemsText(SQLFields fields) { Locale locale = fields.Read(4).ToEnum(); + if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && locale != SharedConst.DefaultLocale) + return; + if (locale >= Locale.Total) { Log.outError(LogFilter.Sql, $"Table `quest_request_items_conditional` has invalid locale {fields.Read(4)} set for quest {fields.Read(0)}. Skipped."); @@ -347,6 +353,9 @@ namespace Game void LoadConditionalConditionalOfferRewardText(SQLFields fields) { Locale locale = fields.Read(4).ToEnum(); + if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && locale != SharedConst.DefaultLocale) + return; + if (locale >= Locale.Total) { Log.outError(LogFilter.Sql, $"Table `quest_offer_reward_conditional` has invalid locale {fields.Read(4)} set for quest {fields.Read(0)}. Skipped."); @@ -369,6 +378,9 @@ namespace Game void LoadConditionalConditionalQuestCompletionLog(SQLFields fields) { Locale locale = fields.Read(4).ToEnum(); + if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && locale != SharedConst.DefaultLocale) + return; + if (locale >= Locale.Total) { Log.outError(LogFilter.Sql, $"Table `quest_completion_log_conditional` has invalid locale {fields.Read(4)} set for quest {fields.Read(0)}. Skipped."); @@ -604,7 +616,12 @@ namespace Game public void InitializeQueryData() { for (var loc = Locale.enUS; loc < Locale.Total; ++loc) + { + if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && loc != SharedConst.DefaultLocale) + continue; + response[(int)loc] = BuildQueryData(loc, null); + } } public QueryQuestInfoResponse BuildQueryData(Locale loc, Player player) diff --git a/Source/Game/Server/WorldConfig.cs b/Source/Game/Server/WorldConfig.cs index 091d62b9b..1493c1a43 100644 --- a/Source/Game/Server/WorldConfig.cs +++ b/Source/Game/Server/WorldConfig.cs @@ -1009,6 +1009,9 @@ namespace Game // Enable AE loot Values[WorldCfg.EnableAeLoot] = GetDefaultValue("Loot.EnableAELoot", true); + // Loading of Locales + Values[WorldCfg.LoadLocales] = GetDefaultValue("Load.Locales", true); + // call ScriptMgr if we're reloading the configuration if (reload) Global.ScriptMgr.OnConfigLoad(reload); diff --git a/Source/Game/World/WorldManager.cs b/Source/Game/World/WorldManager.cs index 389a35dfd..690872f90 100644 --- a/Source/Game/World/WorldManager.cs +++ b/Source/Game/World/WorldManager.cs @@ -520,15 +520,19 @@ namespace Game Log.outInfo(LogFilter.ServerLoading, "Loading Localization strings..."); uint oldMSTime = Time.GetMSTime(); - Global.ObjectMgr.LoadCreatureLocales(); - Global.ObjectMgr.LoadGameObjectLocales(); - Global.ObjectMgr.LoadQuestTemplateLocale(); - Global.ObjectMgr.LoadQuestOfferRewardLocale(); - Global.ObjectMgr.LoadQuestRequestItemsLocale(); - Global.ObjectMgr.LoadQuestObjectivesLocale(); - Global.ObjectMgr.LoadPageTextLocales(); - Global.ObjectMgr.LoadGossipMenuItemsLocales(); - Global.ObjectMgr.LoadPointOfInterestLocales(); + if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales)) + { + Global.ObjectMgr.LoadCreatureLocales(); + Global.ObjectMgr.LoadGameObjectLocales(); + Global.ObjectMgr.LoadQuestTemplateLocale(); + Global.ObjectMgr.LoadQuestOfferRewardLocale(); + Global.ObjectMgr.LoadQuestRequestItemsLocale(); + Global.ObjectMgr.LoadQuestObjectivesLocale(); + Global.ObjectMgr.LoadPageTextLocales(); + Global.ObjectMgr.LoadGossipMenuItemsLocales(); + Global.ObjectMgr.LoadPointOfInterestLocales(); + } + Log.outInfo(LogFilter.ServerLoading, "Localization strings loaded in {0} ms", Time.GetMSTimeDiffToNow(oldMSTime)); Log.outInfo(LogFilter.ServerLoading, "Loading Account Roles and Permissions..."); @@ -702,7 +706,8 @@ namespace Game Log.outInfo(LogFilter.ServerLoading, "Loading Quest Greetings..."); Global.ObjectMgr.LoadQuestGreetings(); - Global.ObjectMgr.LoadQuestGreetingLocales(); + if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales)) + Global.ObjectMgr.LoadQuestGreetingLocales(); Log.outInfo(LogFilter.ServerLoading, "Loading Objects Pooling Data..."); Global.PoolMgr.LoadFromDB(); @@ -797,8 +802,11 @@ namespace Game Log.outInfo(LogFilter.ServerLoading, "Loading Player Choices..."); Global.ObjectMgr.LoadPlayerChoices(); - Log.outInfo(LogFilter.ServerLoading, "Loading Player Choices Locales..."); - Global.ObjectMgr.LoadPlayerChoicesLocale(); + if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales)) + { + Log.outInfo(LogFilter.ServerLoading, "Loading Player Choices Locales..."); + Global.ObjectMgr.LoadPlayerChoicesLocale(); + } Log.outInfo(LogFilter.ServerLoading, "Loading Jump Charge Params..."); Global.ObjectMgr.LoadJumpChargeParams(); @@ -844,8 +852,13 @@ namespace Game Global.AchievementMgr.LoadAchievementScripts(); Log.outInfo(LogFilter.ServerLoading, "Loading Achievement Rewards..."); Global.AchievementMgr.LoadRewards(); - Log.outInfo(LogFilter.ServerLoading, "Loading Achievement Reward Locales..."); - Global.AchievementMgr.LoadRewardLocales(); + + if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales)) + { + Log.outInfo(LogFilter.ServerLoading, "Loading Achievement Reward Locales..."); + Global.AchievementMgr.LoadRewardLocales(); + } + Log.outInfo(LogFilter.ServerLoading, "Loading Completed Achievements..."); Global.AchievementMgr.LoadCompletedAchievements(); @@ -985,8 +998,11 @@ namespace Game Log.outInfo(LogFilter.ServerLoading, "Loading Creature Texts..."); Global.CreatureTextMgr.LoadCreatureTexts(); - Log.outInfo(LogFilter.ServerLoading, "Loading Creature Text Locales..."); - Global.CreatureTextMgr.LoadCreatureTextLocales(); + if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales)) + { + Log.outInfo(LogFilter.ServerLoading, "Loading Creature Text Locales..."); + Global.CreatureTextMgr.LoadCreatureTextLocales(); + } Log.outInfo(LogFilter.ServerLoading, "Loading creature StaticFlags overrides..."); Global.ObjectMgr.LoadCreatureStaticFlagsOverride(); // must be after LoadCreatures diff --git a/Source/WorldServer/WorldServer.conf.dist b/Source/WorldServer/WorldServer.conf.dist index 171b7ce87..6f4c0e31a 100644 --- a/Source/WorldServer/WorldServer.conf.dist +++ b/Source/WorldServer/WorldServer.conf.dist @@ -4018,5 +4018,20 @@ Pvp.FactionBalance.Pct10 = 0.7 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 + # ################################################################################################### \ No newline at end of file