summaryrefslogtreecommitdiff
path: root/src/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/game/Globals/ObjectMgr.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/game/Globals/ObjectMgr.cpp b/src/game/Globals/ObjectMgr.cpp
index 085be3cca5..cc44f916aa 100644
--- a/src/game/Globals/ObjectMgr.cpp
+++ b/src/game/Globals/ObjectMgr.cpp
@@ -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));