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,
|
ListenRangeSay,
|
||||||
ListenRangeTextemote,
|
ListenRangeTextemote,
|
||||||
ListenRangeYell,
|
ListenRangeYell,
|
||||||
|
LoadLocales,
|
||||||
LogdbClearinterval,
|
LogdbClearinterval,
|
||||||
LogdbCleartime,
|
LogdbCleartime,
|
||||||
MailDeliveryDelay,
|
MailDeliveryDelay,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Game.DataStorage
|
|||||||
foreach (var dir in Directory.GetDirectories(db2Path))
|
foreach (var dir in Directory.GetDirectories(db2Path))
|
||||||
{
|
{
|
||||||
Locale locale = Path.GetFileName(dir).ToEnum<Locale>();
|
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;
|
availableDb2Locales[(int)locale] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,7 +141,12 @@ namespace Game.Entities
|
|||||||
public void InitializeQueryData()
|
public void InitializeQueryData()
|
||||||
{
|
{
|
||||||
for (var loc = Locale.enUS; loc < Locale.Total; ++loc)
|
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);
|
QueryData[(int)loc] = BuildQueryData(loc, Difficulty.None);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryCreatureResponse BuildQueryData(Locale locale, Difficulty difficulty)
|
public QueryCreatureResponse BuildQueryData(Locale locale, Difficulty difficulty)
|
||||||
|
|||||||
@@ -3257,10 +3257,7 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var unusedSpells in spellsByTrainer)
|
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");
|
SQLResult trainerLocalesResult = DB.World.Query("SELECT Id, locale, Greeting_lang FROM trainer_locale");
|
||||||
if (!trainerLocalesResult.IsEmpty())
|
if (!trainerLocalesResult.IsEmpty())
|
||||||
@@ -3271,7 +3268,7 @@ namespace Game
|
|||||||
string localeName = trainerLocalesResult.Read<string>(1);
|
string localeName = trainerLocalesResult.Read<string>(1);
|
||||||
|
|
||||||
Locale locale = localeName.ToEnum<Locale>();
|
Locale locale = localeName.ToEnum<Locale>();
|
||||||
if (!SharedConst.IsValidLocale(locale) || locale == Locale.enUS)
|
if (!SharedConst.IsValidLocale(locale) || !WorldConfig.GetBoolValue(WorldCfg.LoadLocales) || locale == Locale.enUS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Trainer trainer = trainers.LookupByKey(trainerId);
|
Trainer trainer = trainers.LookupByKey(trainerId);
|
||||||
|
|||||||
@@ -304,6 +304,9 @@ namespace Game
|
|||||||
void LoadConditionalConditionalQuestDescription(SQLFields fields)
|
void LoadConditionalConditionalQuestDescription(SQLFields fields)
|
||||||
{
|
{
|
||||||
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
||||||
|
if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && locale != SharedConst.DefaultLocale)
|
||||||
|
return;
|
||||||
|
|
||||||
if (locale >= Locale.Total)
|
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.");
|
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)
|
void LoadConditionalConditionalRequestItemsText(SQLFields fields)
|
||||||
{
|
{
|
||||||
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
||||||
|
if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && locale != SharedConst.DefaultLocale)
|
||||||
|
return;
|
||||||
|
|
||||||
if (locale >= Locale.Total)
|
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.");
|
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)
|
void LoadConditionalConditionalOfferRewardText(SQLFields fields)
|
||||||
{
|
{
|
||||||
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
||||||
|
if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && locale != SharedConst.DefaultLocale)
|
||||||
|
return;
|
||||||
|
|
||||||
if (locale >= Locale.Total)
|
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.");
|
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)
|
void LoadConditionalConditionalQuestCompletionLog(SQLFields fields)
|
||||||
{
|
{
|
||||||
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
Locale locale = fields.Read<string>(4).ToEnum<Locale>();
|
||||||
|
if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && locale != SharedConst.DefaultLocale)
|
||||||
|
return;
|
||||||
|
|
||||||
if (locale >= Locale.Total)
|
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.");
|
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()
|
public void InitializeQueryData()
|
||||||
{
|
{
|
||||||
for (var loc = Locale.enUS; loc < Locale.Total; ++loc)
|
for (var loc = Locale.enUS; loc < Locale.Total; ++loc)
|
||||||
|
{
|
||||||
|
if (!WorldConfig.GetBoolValue(WorldCfg.LoadLocales) && loc != SharedConst.DefaultLocale)
|
||||||
|
continue;
|
||||||
|
|
||||||
response[(int)loc] = BuildQueryData(loc, null);
|
response[(int)loc] = BuildQueryData(loc, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public QueryQuestInfoResponse BuildQueryData(Locale loc, Player player)
|
public QueryQuestInfoResponse BuildQueryData(Locale loc, Player player)
|
||||||
|
|||||||
@@ -1009,6 +1009,9 @@ namespace Game
|
|||||||
// Enable AE loot
|
// Enable AE loot
|
||||||
Values[WorldCfg.EnableAeLoot] = GetDefaultValue("Loot.EnableAELoot", true);
|
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
|
// call ScriptMgr if we're reloading the configuration
|
||||||
if (reload)
|
if (reload)
|
||||||
Global.ScriptMgr.OnConfigLoad(reload);
|
Global.ScriptMgr.OnConfigLoad(reload);
|
||||||
|
|||||||
@@ -520,15 +520,19 @@ namespace Game
|
|||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Localization strings...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Localization strings...");
|
||||||
uint oldMSTime = Time.GetMSTime();
|
uint oldMSTime = Time.GetMSTime();
|
||||||
Global.ObjectMgr.LoadCreatureLocales();
|
if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales))
|
||||||
Global.ObjectMgr.LoadGameObjectLocales();
|
{
|
||||||
Global.ObjectMgr.LoadQuestTemplateLocale();
|
Global.ObjectMgr.LoadCreatureLocales();
|
||||||
Global.ObjectMgr.LoadQuestOfferRewardLocale();
|
Global.ObjectMgr.LoadGameObjectLocales();
|
||||||
Global.ObjectMgr.LoadQuestRequestItemsLocale();
|
Global.ObjectMgr.LoadQuestTemplateLocale();
|
||||||
Global.ObjectMgr.LoadQuestObjectivesLocale();
|
Global.ObjectMgr.LoadQuestOfferRewardLocale();
|
||||||
Global.ObjectMgr.LoadPageTextLocales();
|
Global.ObjectMgr.LoadQuestRequestItemsLocale();
|
||||||
Global.ObjectMgr.LoadGossipMenuItemsLocales();
|
Global.ObjectMgr.LoadQuestObjectivesLocale();
|
||||||
Global.ObjectMgr.LoadPointOfInterestLocales();
|
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, "Localization strings loaded in {0} ms", Time.GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Account Roles and Permissions...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Account Roles and Permissions...");
|
||||||
@@ -702,7 +706,8 @@ namespace Game
|
|||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Quest Greetings...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Quest Greetings...");
|
||||||
Global.ObjectMgr.LoadQuestGreetings();
|
Global.ObjectMgr.LoadQuestGreetings();
|
||||||
Global.ObjectMgr.LoadQuestGreetingLocales();
|
if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales))
|
||||||
|
Global.ObjectMgr.LoadQuestGreetingLocales();
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Objects Pooling Data...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Objects Pooling Data...");
|
||||||
Global.PoolMgr.LoadFromDB();
|
Global.PoolMgr.LoadFromDB();
|
||||||
@@ -797,8 +802,11 @@ namespace Game
|
|||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Player Choices...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Player Choices...");
|
||||||
Global.ObjectMgr.LoadPlayerChoices();
|
Global.ObjectMgr.LoadPlayerChoices();
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Player Choices Locales...");
|
if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales))
|
||||||
Global.ObjectMgr.LoadPlayerChoicesLocale();
|
{
|
||||||
|
Log.outInfo(LogFilter.ServerLoading, "Loading Player Choices Locales...");
|
||||||
|
Global.ObjectMgr.LoadPlayerChoicesLocale();
|
||||||
|
}
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Jump Charge Params...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Jump Charge Params...");
|
||||||
Global.ObjectMgr.LoadJumpChargeParams();
|
Global.ObjectMgr.LoadJumpChargeParams();
|
||||||
@@ -844,8 +852,13 @@ namespace Game
|
|||||||
Global.AchievementMgr.LoadAchievementScripts();
|
Global.AchievementMgr.LoadAchievementScripts();
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Achievement Rewards...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Achievement Rewards...");
|
||||||
Global.AchievementMgr.LoadRewards();
|
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...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Completed Achievements...");
|
||||||
Global.AchievementMgr.LoadCompletedAchievements();
|
Global.AchievementMgr.LoadCompletedAchievements();
|
||||||
|
|
||||||
@@ -985,8 +998,11 @@ namespace Game
|
|||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Creature Texts...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading Creature Texts...");
|
||||||
Global.CreatureTextMgr.LoadCreatureTexts();
|
Global.CreatureTextMgr.LoadCreatureTexts();
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading Creature Text Locales...");
|
if (WorldConfig.GetBoolValue(WorldCfg.LoadLocales))
|
||||||
Global.CreatureTextMgr.LoadCreatureTextLocales();
|
{
|
||||||
|
Log.outInfo(LogFilter.ServerLoading, "Loading Creature Text Locales...");
|
||||||
|
Global.CreatureTextMgr.LoadCreatureTextLocales();
|
||||||
|
}
|
||||||
|
|
||||||
Log.outInfo(LogFilter.ServerLoading, "Loading creature StaticFlags overrides...");
|
Log.outInfo(LogFilter.ServerLoading, "Loading creature StaticFlags overrides...");
|
||||||
Global.ObjectMgr.LoadCreatureStaticFlagsOverride(); // must be after LoadCreatures
|
Global.ObjectMgr.LoadCreatureStaticFlagsOverride(); // must be after LoadCreatures
|
||||||
|
|||||||
@@ -4018,5 +4018,20 @@ Pvp.FactionBalance.Pct10 = 0.7
|
|||||||
|
|
||||||
Pvp.FactionBalance.Pct20 = 0.8
|
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