mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
Core/Misc: Update game creature template locale in simple system
(cherry picked from commit 8aa55a0b57)
This commit is contained in:
43
sql/updates/world/2015_10_31_02_world_2015_08_01_01.sql
Normal file
43
sql/updates/world/2015_10_31_02_world_2015_08_01_01.sql
Normal file
@@ -0,0 +1,43 @@
|
||||
DROP TABLE IF EXISTS `creature_template_locale`;
|
||||
CREATE TABLE IF NOT EXISTS `creature_template_locale` (
|
||||
`entry` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0',
|
||||
`locale` VARCHAR(4) NOT NULL,
|
||||
`Name` TEXT,
|
||||
`Title` TEXT,
|
||||
`VerifiedBuild` SMALLINT(5) DEFAULT '0',
|
||||
PRIMARY KEY (`entry`,`locale`)
|
||||
) ENGINE=MYISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
-- koKR
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "koKR", `name_loc1`, `subname_loc1`, `VerifiedBuild` FROM `locales_creature` WHERE LENGTH(`name_loc1`) > 0 OR LENGTH(`subname_loc1`) > 0);
|
||||
|
||||
-- frFR
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "frFR", `name_loc2`, `subname_loc2`, `VerifiedBuild` FROM `locales_creature` WHERE LENGTH(`name_loc2`) > 0 OR LENGTH(`subname_loc2`) > 0);
|
||||
|
||||
-- deDE
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "deDE", `name_loc3`, `subname_loc3`, `VerifiedBuild` FROM `locales_creature` WHERE LENGTH(`name_loc3`) > 0 OR LENGTH(`subname_loc3`) > 0);
|
||||
|
||||
-- zhCN
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "zhCN", `name_loc4`, `subname_loc4`, `VerifiedBuild` FROM `locales_creature` WHERE LENGTH(`name_loc4`) > 0 OR LENGTH(`subname_loc4`) > 0);
|
||||
|
||||
-- zhTW
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "zhTW", `name_loc5`, `subname_loc5`, `VerifiedBuild` FROM `locales_creature` WHERE LENGTH(`name_loc5`) > 0 OR LENGTH(`subname_loc5`) > 0);
|
||||
|
||||
-- esES
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "esES", `name_loc6`, `subname_loc6`, `VerifiedBuild` FROM `locales_creature` WHERE LENGTH(`name_loc6`) > 0 OR LENGTH(`subname_loc6`) > 0);
|
||||
|
||||
-- esMX
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "esMX", `name_loc7`, `subname_loc7`, `VerifiedBuild` FROM `locales_creature` WHERE LENGTH(`name_loc7`) > 0 OR LENGTH(`subname_loc7`) > 0);
|
||||
|
||||
-- ruRU
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "ruRU", `name_loc8`, `subname_loc8`, `VerifiedBuild` FROM `locales_creature` WHERE LENGTH(`name_loc8`) > 0 OR LENGTH(`subname_loc8`) > 0);
|
||||
|
||||
DROP TABLE IF EXISTS `locales_creature`;
|
||||
@@ -83,7 +83,7 @@ struct CreatureTemplate
|
||||
uint32 Modelid3;
|
||||
uint32 Modelid4;
|
||||
std::string Name;
|
||||
std::string SubName;
|
||||
std::string Title;
|
||||
std::string IconName;
|
||||
uint32 GossipMenuId;
|
||||
uint8 minlevel;
|
||||
@@ -218,7 +218,7 @@ typedef std::unordered_map<uint16, CreatureBaseStats> CreatureBaseStatsContainer
|
||||
struct CreatureLocale
|
||||
{
|
||||
StringVector Name;
|
||||
StringVector SubName;
|
||||
StringVector Title;
|
||||
};
|
||||
|
||||
struct GossipMenuItemsLocale
|
||||
|
||||
@@ -291,8 +291,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;
|
||||
|
||||
@@ -300,16 +300,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 = TOTAL_LOCALES - 1; i > 0; --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());
|
||||
|
||||
TC_LOG_INFO("server.loading", ">> Loaded %u creature locale strings in %u ms", uint32(_creatureLocaleStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
||||
@@ -442,7 +446,7 @@ void ObjectMgr::LoadCreatureTemplate(Field* fields)
|
||||
creatureTemplate.Modelid3 = fields[8].GetUInt32();
|
||||
creatureTemplate.Modelid4 = fields[9].GetUInt32();
|
||||
creatureTemplate.Name = fields[10].GetString();
|
||||
creatureTemplate.SubName = fields[11].GetString();
|
||||
creatureTemplate.Title = fields[11].GetString();
|
||||
creatureTemplate.IconName = fields[12].GetString();
|
||||
creatureTemplate.GossipMenuId = fields[13].GetUInt32();
|
||||
creatureTemplate.minlevel = fields[14].GetUInt8();
|
||||
@@ -6520,6 +6524,8 @@ void ObjectMgr::LoadGameObjectLocales()
|
||||
|
||||
GameObjectLocale& data = _gameObjectLocaleStore[id];
|
||||
LocaleConstant locale = GetLocaleByName(localeName);
|
||||
if (locale == LOCALE_enUS)
|
||||
continue;
|
||||
|
||||
AddLocaleString(name, locale, data.Name);
|
||||
AddLocaleString(castBarCaption, locale, data.CastBarCaption);
|
||||
|
||||
@@ -96,9 +96,9 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
|
||||
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
|
||||
if (ci)
|
||||
{
|
||||
std::string Name, SubName;
|
||||
std::string Name, Title;
|
||||
Name = ci->Name;
|
||||
SubName = ci->SubName;
|
||||
Title = ci->Title;
|
||||
|
||||
int loc_idx = GetSessionDbLocaleIndex();
|
||||
if (loc_idx >= 0)
|
||||
@@ -106,7 +106,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
|
||||
if (CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(entry))
|
||||
{
|
||||
ObjectMgr::GetLocaleString(cl->Name, loc_idx, Name);
|
||||
ObjectMgr::GetLocaleString(cl->SubName, loc_idx, SubName);
|
||||
ObjectMgr::GetLocaleString(cl->Title, loc_idx, Title);
|
||||
}
|
||||
}
|
||||
TC_LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY '%s' - Entry: %u.", ci->Name.c_str(), entry);
|
||||
@@ -115,7 +115,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
|
||||
data << uint32(entry); // creature entry
|
||||
data << Name;
|
||||
data << uint8(0) << uint8(0) << uint8(0); // name2, name3, name4, always empty
|
||||
data << SubName;
|
||||
data << Title;
|
||||
data << ci->IconName; // "Directions" for guard, string for Icons 2.3.0
|
||||
data << uint32(ci->type_flags); // flags
|
||||
data << uint32(ci->type); // CreatureType.dbc
|
||||
|
||||
Reference in New Issue
Block a user