Core/Misc: Added Loading.Locales to enable/disable the load of locales
Port From (https://github.com/TrinityCore/TrinityCore/commit/3fd967754388b7b859dbd8b954ec68a844e172f0)
This commit is contained in:
@@ -1685,6 +1685,7 @@ namespace Framework.Constants
|
||||
ListenRangeSay,
|
||||
ListenRangeTextemote,
|
||||
ListenRangeYell,
|
||||
LoadLocales,
|
||||
LogdbClearinterval,
|
||||
LogdbCleartime,
|
||||
MailDeliveryDelay,
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Game.DataStorage
|
||||
foreach (var dir in Directory.GetDirectories(db2Path))
|
||||
{
|
||||
Locale locale = Path.GetFileName(dir).ToEnum<Locale>();
|
||||
if (SharedConst.IsValidLocale(locale))
|
||||
if (SharedConst.IsValidLocale(locale) && (WorldConfig.GetBoolValue(WorldCfg.LoadLocales) || locale == defaultLocale))
|
||||
availableDb2Locales[(int)locale] = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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<string>(1);
|
||||
|
||||
Locale locale = localeName.ToEnum<Locale>();
|
||||
if (!SharedConst.IsValidLocale(locale) || locale == Locale.enUS)
|
||||
if (!SharedConst.IsValidLocale(locale) || !WorldConfig.GetBoolValue(WorldCfg.LoadLocales) || locale == Locale.enUS)
|
||||
continue;
|
||||
|
||||
Trainer trainer = trainers.LookupByKey(trainerId);
|
||||
|
||||
@@ -304,6 +304,9 @@ namespace Game
|
||||
void LoadConditionalConditionalQuestDescription(SQLFields fields)
|
||||
{
|
||||
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
||||
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<string>(4)} set for quest {fields.Read<uint>(0)}. Skipped.");
|
||||
@@ -325,6 +328,9 @@ namespace Game
|
||||
void LoadConditionalConditionalRequestItemsText(SQLFields fields)
|
||||
{
|
||||
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
||||
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<string>(4)} set for quest {fields.Read<uint>(0)}. Skipped.");
|
||||
@@ -347,6 +353,9 @@ namespace Game
|
||||
void LoadConditionalConditionalOfferRewardText(SQLFields fields)
|
||||
{
|
||||
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
||||
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<string>(4)} set for quest {fields.Read<uint>(0)}. Skipped.");
|
||||
@@ -369,6 +378,9 @@ namespace Game
|
||||
void LoadConditionalConditionalQuestCompletionLog(SQLFields fields)
|
||||
{
|
||||
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
||||
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<string>(4)} set for quest {fields.Read<uint>(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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
#
|
||||
###################################################################################################
|
||||
Reference in New Issue
Block a user