Core/Creature: Localization creatures. (#224)

This commit is contained in:
HeartWell
2016-11-05 17:28:49 +03:00
committed by Shin
parent a52fbb398f
commit 55873c1891
7 changed files with 218087 additions and 13 deletions

View File

@@ -296,8 +296,8 @@ void ObjectMgr::LoadCreatureLocales()
_creatureLocaleStore.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, name_loc1, subname_loc1, name_loc2, subname_loc2, name_loc3, subname_loc3, name_loc4, subname_loc4, name_loc5, subname_loc5, name_loc6, subname_loc6, name_loc7, subname_loc7, name_loc8, subname_loc8 FROM locales_creature");
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT entry, locale, Name, Title FROM creature_template_locale");
if (!result)
return;
@@ -305,16 +305,20 @@ void ObjectMgr::LoadCreatureLocales()
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 id = fields[0].GetUInt32();
std::string localeName = fields[1].GetString();
CreatureLocale& data = _creatureLocaleStore[entry];
std::string name = fields[2].GetString();
std::string title = fields[3].GetString();
CreatureLocale& data = _creatureLocaleStore[id];
LocaleConstant locale = GetLocaleByName(localeName);
if (locale == LOCALE_enUS)
continue;
AddLocaleString(name, locale, data.Name);
AddLocaleString(title, locale, data.Title);
for (uint8 i = 1; i < TOTAL_LOCALES; ++i)
{
LocaleConstant locale = (LocaleConstant) i;
AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.Name);
AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.SubName);
}
} while (result->NextRow());
sLog->outString(">> Loaded %lu creature locale strings in %u ms", (unsigned long)_creatureLocaleStore.size(), GetMSTimeDiffToNow(oldMSTime));