Core/Object: Localization objects. (#226)

This commit is contained in:
HeartWell
2016-11-05 22:43:11 +03:00
committed by Shin
parent f54f7ce7dc
commit c8cc99be37
6 changed files with 157456 additions and 16 deletions

View File

@@ -6439,13 +6439,10 @@ void ObjectMgr::LoadGameObjectLocales()
{
uint32 oldMSTime = getMSTime();
_gameObjectLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, "
"name_loc1, name_loc2, name_loc3, name_loc4, name_loc5, name_loc6, name_loc7, name_loc8, "
"castbarcaption_loc1, castbarcaption_loc2, castbarcaption_loc3, castbarcaption_loc4, "
"castbarcaption_loc5, castbarcaption_loc6, castbarcaption_loc7, castbarcaption_loc8 FROM locales_gameobject");
_gameObjectLocaleStore.clear(); // need for reload case
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, locale, name, castBarCaption FROM gameobject_template_locale");
if (!result)
return;
@@ -6453,15 +6450,20 @@ void ObjectMgr::LoadGameObjectLocales()
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 id = fields[0].GetUInt32();
std::string localeName = fields[1].GetString();
GameObjectLocale& data = _gameObjectLocaleStore[entry];
std::string name = fields[2].GetString();
std::string castBarCaption = fields[3].GetString();
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name);
GameObjectLocale& data = _gameObjectLocaleStore[id];
LocaleConstant locale = GetLocaleByName(localeName);
if (locale == LOCALE_enUS)
continue;
AddLocaleString(name, locale, data.Name);
AddLocaleString(castBarCaption, locale, data.CastBarCaption);
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
AddLocaleString(fields[i + (TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption);
} while (result->NextRow());
sLog->outString(">> Loaded %lu gameobject locale strings in %u ms", (unsigned long)_gameObjectLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));