mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Misc: Update game creature template locale in simple system
This commit is contained in:
47
sql/updates/world/2015_08_01_01_world.sql
Normal file
47
sql/updates/world/2015_08_01_01_world.sql
Normal file
@@ -0,0 +1,47 @@
|
||||
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,
|
||||
`NameAlt` TEXT,
|
||||
`Title` TEXT,
|
||||
`TitleAlt` TEXT,
|
||||
`VerifiedBuild` SMALLINT(5) DEFAULT '0'
|
||||
) ENGINE=MYISAM DEFAULT CHARSET=utf8;
|
||||
|
||||
ALTER TABLE `creature_template_locale`
|
||||
ADD PRIMARY KEY (`entry`,`locale`);
|
||||
|
||||
-- koKR
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `NameAlt`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "koKR", `name_loc1`, `femaleName_loc1`, `subname_loc1`, `VerifiedBuild` FROM `locales_creature`);
|
||||
|
||||
-- frFR
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `NameAlt`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "frFR", `name_loc2`, `femaleName_loc2`, `subname_loc2`, `VerifiedBuild` FROM `locales_creature`);
|
||||
|
||||
-- deDE
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `NameAlt`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "deDE", `name_loc3`, `femaleName_loc3`, `subname_loc3`, `VerifiedBuild` FROM `locales_creature`);
|
||||
|
||||
-- zhCN
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `NameAlt`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "zhCN", `name_loc4`, `femaleName_loc4`, `subname_loc4`, `VerifiedBuild` FROM `locales_creature`);
|
||||
|
||||
-- zhTW
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `NameAlt`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "zhTW", `name_loc5`, `femaleName_loc5`, `subname_loc5`, `VerifiedBuild` FROM `locales_creature`);
|
||||
|
||||
-- esES
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `NameAlt`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "esES", `name_loc6`, `femaleName_loc6`, `subname_loc6`, `VerifiedBuild` FROM `locales_creature`);
|
||||
|
||||
-- esMX
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `NameAlt`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "esMX", `name_loc7`, `femaleName_loc7`, `subname_loc7`, `VerifiedBuild` FROM `locales_creature`);
|
||||
|
||||
-- ruRU
|
||||
INSERT INTO `creature_template_locale` (`entry`, `locale`, `Name`, `NameAlt`, `Title`, `VerifiedBuild`)
|
||||
(SELECT `entry`, "ruRU", `name_loc8`, `femaleName_loc8`, `subname_loc8`, `VerifiedBuild` FROM `locales_creature`);
|
||||
|
||||
DROP TABLE IF EXISTS `locales_creature`;
|
||||
@@ -254,8 +254,9 @@ typedef std::unordered_map<uint16, CreatureBaseStats> CreatureBaseStatsContainer
|
||||
struct CreatureLocale
|
||||
{
|
||||
StringVector Name;
|
||||
StringVector FemaleName;
|
||||
StringVector SubName;
|
||||
StringVector NameAlt;
|
||||
StringVector Title;
|
||||
StringVector TitleAlt;
|
||||
};
|
||||
|
||||
struct GossipMenuItemsLocale
|
||||
|
||||
@@ -302,17 +302,8 @@ void ObjectMgr::LoadCreatureLocales()
|
||||
|
||||
_creatureLocaleStore.clear(); // need for reload case
|
||||
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, "
|
||||
"name_loc1, femaleName_loc1, subname_loc1, "
|
||||
"name_loc2, femaleName_loc2, subname_loc2, "
|
||||
"name_loc3, femaleName_loc3, subname_loc3, "
|
||||
"name_loc4, femaleName_loc4, subname_loc4, "
|
||||
"name_loc5, femaleName_loc5, subname_loc5, "
|
||||
"name_loc6, femaleName_loc6, subname_loc6, "
|
||||
"name_loc7, femaleName_loc7, subname_loc7, "
|
||||
"name_loc8, femaleName_loc8, subname_loc8 "
|
||||
"FROM locales_creature");
|
||||
|
||||
// 0 1 2 3 4 5
|
||||
QueryResult result = WorldDatabase.Query("SELECT entry, locale, Name, NameAlt, Title, TitleAlt FROM creature_template_locale");
|
||||
if (!result)
|
||||
return;
|
||||
|
||||
@@ -320,17 +311,24 @@ 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 nameAlt = fields[3].GetString();
|
||||
std::string title = fields[4].GetString();
|
||||
std::string titleAlt = fields[5].GetString();
|
||||
|
||||
CreatureLocale& data = _creatureLocaleStore[id];
|
||||
LocaleConstant locale = GetLocaleByName(localeName);
|
||||
if (locale == LOCALE_enUS)
|
||||
continue;
|
||||
|
||||
AddLocaleString(name, locale, data.Name);
|
||||
AddLocaleString(nameAlt, locale, data.NameAlt);
|
||||
AddLocaleString(title, locale, data.Title);
|
||||
AddLocaleString(titleAlt, locale, data.TitleAlt);
|
||||
|
||||
for (uint8 i = OLD_TOTAL_LOCALES - 1; i > 0; --i)
|
||||
{
|
||||
LocaleConstant locale = (LocaleConstant) i;
|
||||
AddLocaleString(fields[1 + 3 * (i - 1)].GetString(), locale, data.Name);
|
||||
AddLocaleString(fields[1 + 3 * (i - 1) + 1].GetString(), locale, data.FemaleName);
|
||||
AddLocaleString(fields[1 + 3 * (i - 1) + 2].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));
|
||||
@@ -394,6 +392,8 @@ void ObjectMgr::LoadPointOfInterestLocales()
|
||||
|
||||
PointOfInterestLocale& data = _pointOfInterestLocaleStore[id];
|
||||
LocaleConstant locale = GetLocaleByName(localeName);
|
||||
if (locale == LOCALE_enUS)
|
||||
continue;
|
||||
|
||||
AddLocaleString(name, locale, data.Name);
|
||||
} while (result->NextRow());
|
||||
@@ -4467,6 +4467,8 @@ void ObjectMgr::LoadQuestTemplateLocale()
|
||||
|
||||
QuestTemplateLocale& data = _questTemplateLocaleStore[id];
|
||||
LocaleConstant locale = GetLocaleByName(localeName);
|
||||
if (locale == LOCALE_enUS)
|
||||
continue;
|
||||
|
||||
AddLocaleString(logTitle, locale, data.LogTitle);
|
||||
AddLocaleString(logDescription, locale, data.LogDescription);
|
||||
@@ -4503,6 +4505,8 @@ void ObjectMgr::LoadQuestObjectivesLocale()
|
||||
|
||||
QuestObjectivesLocale& data = _questObjectivesLocaleStore[id];
|
||||
LocaleConstant locale = GetLocaleByName(localeName);
|
||||
if (locale == LOCALE_enUS)
|
||||
continue;
|
||||
|
||||
AddLocaleString(Description, locale, data.Description);
|
||||
}
|
||||
@@ -5116,6 +5120,8 @@ void ObjectMgr::LoadPageTextLocales()
|
||||
|
||||
PageTextLocale& data = _pageTextLocaleStore[id];
|
||||
LocaleConstant locale = GetLocaleByName(localeName);
|
||||
if (locale == LOCALE_enUS)
|
||||
continue;
|
||||
|
||||
AddLocaleString(text, locale, data.Text);
|
||||
} while (result->NextRow());
|
||||
@@ -6403,6 +6409,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);
|
||||
|
||||
@@ -77,35 +77,50 @@ void WorldSession::HandleCreatureQuery(WorldPackets::Query::QueryCreature& packe
|
||||
|
||||
WorldPackets::Query::CreatureStats& stats = response.Stats;
|
||||
|
||||
stats.Title = creatureInfo->SubName;
|
||||
stats.CursorName = creatureInfo->IconName;
|
||||
stats.Leader = creatureInfo->RacialLeader;
|
||||
|
||||
stats.Name[0] = creatureInfo->Name;
|
||||
stats.NameAlt[0] = creatureInfo->FemaleName;
|
||||
|
||||
stats.Flags[0] = creatureInfo->type_flags;
|
||||
stats.Flags[1] = creatureInfo->type_flags2;
|
||||
|
||||
stats.CreatureType = creatureInfo->type;
|
||||
stats.CreatureFamily = creatureInfo->family;
|
||||
stats.Classification = creatureInfo->rank;
|
||||
stats.HpMulti = creatureInfo->ModHealth;
|
||||
stats.EnergyMulti = creatureInfo->ModMana;
|
||||
stats.Leader = creatureInfo->RacialLeader;
|
||||
|
||||
CreatureQuestItemList const* items = sObjectMgr->GetCreatureQuestItemList(packet.CreatureID);
|
||||
if (items)
|
||||
for (uint32 item : *items)
|
||||
stats.QuestItems.push_back(item);
|
||||
|
||||
stats.CreatureMovementInfoID = creatureInfo->movementId;
|
||||
stats.RequiredExpansion = creatureInfo->expansionUnknown;
|
||||
stats.Flags[0] = creatureInfo->type_flags;
|
||||
stats.Flags[1] = creatureInfo->type_flags2;
|
||||
for (uint32 i = 0; i < MAX_KILL_CREDIT; ++i)
|
||||
stats.ProxyCreatureID[i] = creatureInfo->KillCredit[i];
|
||||
|
||||
stats.CreatureDisplayID[0] = creatureInfo->Modelid1;
|
||||
stats.CreatureDisplayID[1] = creatureInfo->Modelid2;
|
||||
stats.CreatureDisplayID[2] = creatureInfo->Modelid3;
|
||||
stats.CreatureDisplayID[3] = creatureInfo->Modelid4;
|
||||
stats.Name[0] = creatureInfo->Name;
|
||||
stats.NameAlt[0] = creatureInfo->FemaleName;
|
||||
|
||||
stats.HpMulti = creatureInfo->ModHealth;
|
||||
stats.EnergyMulti = creatureInfo->ModMana;
|
||||
|
||||
stats.CreatureMovementInfoID = creatureInfo->movementId;
|
||||
stats.RequiredExpansion = creatureInfo->expansionUnknown;
|
||||
|
||||
stats.Title = creatureInfo->SubName;
|
||||
//stats.TitleAlt = ;
|
||||
stats.CursorName = creatureInfo->IconName;
|
||||
|
||||
if (CreatureQuestItemList const* items = sObjectMgr->GetCreatureQuestItemList(packet.CreatureID))
|
||||
for (uint32 item : *items)
|
||||
stats.QuestItems.push_back(item);
|
||||
|
||||
LocaleConstant localeConstant = GetSessionDbLocaleIndex();
|
||||
if (localeConstant >= LOCALE_enUS)
|
||||
if (CreatureLocale const* creatureLocale = sObjectMgr->GetCreatureLocale(packet.CreatureID))
|
||||
{
|
||||
ObjectMgr::GetLocaleString(creatureLocale->Name, localeConstant, stats.Name[0]);
|
||||
ObjectMgr::GetLocaleString(creatureLocale->NameAlt, localeConstant, stats.NameAlt[0]);
|
||||
ObjectMgr::GetLocaleString(creatureLocale->Title, localeConstant, stats.Title);
|
||||
ObjectMgr::GetLocaleString(creatureLocale->TitleAlt, localeConstant, stats.TitleAlt);
|
||||
}
|
||||
}
|
||||
else
|
||||
response.Allow = false;
|
||||
|
||||
SendPacket(response.Write());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user