diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2015-07-18 19:58:13 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2015-07-18 19:58:13 +0200 |
commit | f4536f38123c536d90733d047e1072b4dd88e910 (patch) | |
tree | d7bf87863679f79e95e88545459c7452d602c2d8 /src | |
parent | 21b11e67fe2e3e630954ac52d3bf04c5cb17e993 (diff) |
Core/Misc: Update game object template locale in simple system
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.h | 1 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 30 | ||||
-rw-r--r-- | src/server/game/Handlers/QueryHandler.cpp | 28 |
3 files changed, 34 insertions, 25 deletions
diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index c00cbe1d350..efd2eba2d00 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -804,6 +804,7 @@ struct GameObjectLocale { StringVector Name; StringVector CastBarCaption; + StringVector Unk1; }; // `gameobject_addon` table diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 1e412e5796f..a4a12215c05 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6388,13 +6388,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 4 + QueryResult result = WorldDatabase.Query("SELECT entry, locale, name, castBarCaption, unk1 FROM gameobject_template_locale"); if (!result) return; @@ -6402,18 +6399,23 @@ 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(); + std::string unk1 = fields[4].GetString(); + + GameObjectLocale& data = _gameObjectLocaleStore[id]; + LocaleConstant locale = GetLocaleByName(localeName); + + AddLocaleString(name, locale, data.Name); + AddLocaleString(castBarCaption, locale, data.CastBarCaption); + AddLocaleString(unk1, locale, data.Unk1); - for (uint8 i = OLD_TOTAL_LOCALES - 1; i > 0; --i) - { - AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name); - AddLocaleString(fields[i + (OLD_TOTAL_LOCALES - 1)].GetString(), LocaleConstant(i), data.CastBarCaption); - } } while (result->NextRow()); - TC_LOG_INFO("server.loading", ">> Loaded %u gameobject locale strings in %u ms", uint32(_gameObjectLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); + TC_LOG_INFO("server.loading", ">> Loaded %u gameobject_template_locale strings in %u ms", uint32(_gameObjectLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime)); } inline void CheckGOLockId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N) diff --git a/src/server/game/Handlers/QueryHandler.cpp b/src/server/game/Handlers/QueryHandler.cpp index 5d40165df04..fdbe74fd123 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -126,26 +126,32 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPackets::Query::QueryGameObj response.Allow = true; WorldPackets::Query::GameObjectStats& stats = response.Stats; - stats.CastBarCaption = gameObjectInfo->castBarCaption; + stats.Type = gameObjectInfo->type; stats.DisplayID = gameObjectInfo->displayId; - stats.IconName = gameObjectInfo->IconName; + stats.Name[0] = gameObjectInfo->name; + stats.IconName = gameObjectInfo->IconName; + stats.CastBarCaption = gameObjectInfo->castBarCaption; + stats.UnkString = gameObjectInfo->unk1; - GameObjectQuestItemList const* items = sObjectMgr->GetGameObjectQuestItemList(packet.GameObjectID); - if (items) + LocaleConstant localeConstant = GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) + if (GameObjectLocale const* gameObjectLocale = sObjectMgr->GetGameObjectLocale(packet.GameObjectID)) + { + ObjectMgr::GetLocaleString(gameObjectLocale->Name, localeConstant, stats.Name[0]); + ObjectMgr::GetLocaleString(gameObjectLocale->CastBarCaption, localeConstant, stats.CastBarCaption); + ObjectMgr::GetLocaleString(gameObjectLocale->Unk1, localeConstant, stats.UnkString); + } + + stats.Size = gameObjectInfo->size; + + if (GameObjectQuestItemList const* items = sObjectMgr->GetGameObjectQuestItemList(packet.GameObjectID)) for (uint32 item : *items) stats.QuestItems.push_back(item); for (uint32 i = 0; i < MAX_GAMEOBJECT_DATA; i++) stats.Data[i] = gameObjectInfo->raw.data[i]; - - stats.Size = gameObjectInfo->size; - stats.Type = gameObjectInfo->type; - stats.UnkString = gameObjectInfo->unk1; - stats.Expansion = 0; } - else - response.Allow = false; SendPacket(response.Write()); } |