diff options
-rw-r--r-- | sql/updates/world/2015_07_19_00_world_2015_07_18_04.sql | 45 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 28 | ||||
-rw-r--r-- | src/server/game/Handlers/QueryHandler.cpp | 13 |
3 files changed, 65 insertions, 21 deletions
diff --git a/sql/updates/world/2015_07_19_00_world_2015_07_18_04.sql b/sql/updates/world/2015_07_19_00_world_2015_07_18_04.sql new file mode 100644 index 00000000000..852eae9ecf2 --- /dev/null +++ b/sql/updates/world/2015_07_19_00_world_2015_07_18_04.sql @@ -0,0 +1,45 @@ +DROP TABLE IF EXISTS `gameobject_template_locale`; +CREATE TABLE IF NOT EXISTS `gameobject_template_locale` ( + `entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0', + `locale` VARCHAR(4) NOT NULL, + `name` TEXT, + `castBarCaption` TEXT, + `VerifiedBuild` SMALLINT(5) DEFAULT '0' +) ENGINE=MYISAM DEFAULT CHARSET=utf8; + +ALTER TABLE `gameobject_template_locale` + ADD PRIMARY KEY (`entry`,`locale`); + +-- koKR +INSERT INTO `gameobject_template_locale` (`entry`, `locale`, `name`, `castBarCaption`, `VerifiedBuild`) + (SELECT `entry`, "koKR", `name_loc1`, `castbarcaption_loc1`, `VerifiedBuild` FROM `locales_gameobject`); + +-- frFR +INSERT INTO `gameobject_template_locale` (`entry`, `locale`, `name`, `castBarCaption`, `VerifiedBuild`) + (SELECT `entry`, "frFR", `name_loc2`, `castbarcaption_loc2`, `VerifiedBuild` FROM `locales_gameobject`); + +-- deDE +INSERT INTO `gameobject_template_locale` (`entry`, `locale`, `name`, `castBarCaption`, `VerifiedBuild`) + (SELECT `entry`, "deDE", `name_loc3`, `castbarcaption_loc3`, `VerifiedBuild` FROM `locales_gameobject`); + +-- zhCN +INSERT INTO `gameobject_template_locale` (`entry`, `locale`, `name`, `castBarCaption`, `VerifiedBuild`) + (SELECT `entry`, "zhCN", `name_loc4`, `castbarcaption_loc4`, `VerifiedBuild` FROM `locales_gameobject`); + +-- zhTW +INSERT INTO `gameobject_template_locale` (`entry`, `locale`, `name`, `castBarCaption`, `VerifiedBuild`) + (SELECT `entry`, "zhTW", `name_loc5`, `castbarcaption_loc5`, `VerifiedBuild` FROM `locales_gameobject`); + +-- esES +INSERT INTO `gameobject_template_locale` (`entry`, `locale`, `name`, `castBarCaption`, `VerifiedBuild`) + (SELECT `entry`, "esES", `name_loc6`, `castbarcaption_loc6`, `VerifiedBuild` FROM `locales_gameobject`); + +-- esMX +INSERT INTO `gameobject_template_locale` (`entry`, `locale`, `name`, `castBarCaption`, `VerifiedBuild`) + (SELECT `entry`, "esMX", `name_loc7`, `castbarcaption_loc7`, `VerifiedBuild` FROM `locales_gameobject`); + +-- ruRU +INSERT INTO `gameobject_template_locale` (`entry`, `locale`, `name`, `castBarCaption`, `VerifiedBuild`) + (SELECT `entry`, "ruRU", `name_loc8`, `castbarcaption_loc8`, `VerifiedBuild` FROM `locales_gameobject`); + +DROP TABLE IF EXISTS `locales_gameobject`; diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index acf7dcb79e9..c65e52c8de7 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -6527,13 +6527,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; @@ -6541,18 +6538,21 @@ 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(); + + GameObjectLocale& data = _gameObjectLocaleStore[id]; + LocaleConstant locale = GetLocaleByName(localeName); + + AddLocaleString(name, locale, data.Name); + AddLocaleString(castBarCaption, locale, data.CastBarCaption); - for (uint8 i = TOTAL_LOCALES - 1; i > 0; --i) - { - AddLocaleString(fields[i].GetString(), LocaleConstant(i), data.Name); - AddLocaleString(fields[i + (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 03782481ef7..fda3551bf2b 100644 --- a/src/server/game/Handlers/QueryHandler.cpp +++ b/src/server/game/Handlers/QueryHandler.cpp @@ -174,15 +174,14 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData) IconName = info->IconName; CastBarCaption = info->castBarCaption; - int loc_idx = GetSessionDbLocaleIndex(); - if (loc_idx >= 0) - { - if (GameObjectLocale const* gl = sObjectMgr->GetGameObjectLocale(entry)) + LocaleConstant localeConstant = GetSessionDbLocaleIndex(); + if (localeConstant >= LOCALE_enUS) + if (GameObjectLocale const* gameObjectLocale = sObjectMgr->GetGameObjectLocale(entry)) { - ObjectMgr::GetLocaleString(gl->Name, loc_idx, Name); - ObjectMgr::GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption); + ObjectMgr::GetLocaleString(gameObjectLocale->Name, localeConstant, Name); + ObjectMgr::GetLocaleString(gameObjectLocale->CastBarCaption, localeConstant, CastBarCaption); } - } + TC_LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY '%s' - Entry: %u. ", info->name.c_str(), entry); WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 150); data << uint32(entry); |