Core/DB: Update all locales to actual TrinityCore (#1160)

* Core/Misc Update all locales table structure to simple system. Port from TrinityCore
Co-Authored-By: Winfidonarleyan <dowlandtop@yandex.com>
* Core/Db/Gossip Update structure gossip_menu and gossip_menu_action to actual TrinityCore
* Core/DB Update Broadcast system to actual TC
* Core/Mail: implement Quest Mail Sender
* Core/Quest Split quest template locales
This commit is contained in:
Kargatum
2019-01-13 05:56:06 +07:00
committed by Viste(Кирилл)
parent 76772e434d
commit b34bc28e5b
26 changed files with 59397 additions and 525 deletions

View File

@@ -2878,13 +2878,12 @@ void AchievementGlobalMgr::LoadRewardLocales()
m_achievementRewardLocales.clear(); // need for reload case
QueryResult result = WorldDatabase.Query("SELECT entry, subject_loc1, text_loc1, subject_loc2, text_loc2, subject_loc3, text_loc3, subject_loc4, text_loc4, "
"subject_loc5, text_loc5, subject_loc6, text_loc6, subject_loc7, text_loc7, subject_loc8, text_loc8"
" FROM locales_achievement_reward");
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT ID, Locale, Subject, Text FROM achievement_reward_locale");
if (!result)
{
sLog->outString(">> Loaded 0 achievement reward locale strings. DB table `locales_achievement_reward` is empty");
sLog->outErrorDb(">> Loaded 0 achievement reward locale strings. DB table `achievement_reward_locale` is empty");
sLog->outString();
return;
}
@@ -2893,24 +2892,27 @@ void AchievementGlobalMgr::LoadRewardLocales()
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
uint32 ID = fields[0].GetUInt32();
std::string LocaleName = fields[1].GetString();
std::string Subject = fields[2].GetString();
std::string Text = fields[3].GetString();
if (m_achievementRewards.find(entry) == m_achievementRewards.end())
if (m_achievementRewards.find(ID) == m_achievementRewards.end())
{
sLog->outErrorDb("Table `locales_achievement_reward` (Entry: %u) has locale strings for non-existing achievement reward.", entry);
sLog->outErrorDb("Table `achievement_reward_locale` (Entry: %u) has locale strings for non-existing achievement reward.", ID);
continue;
}
AchievementRewardLocale& data = m_achievementRewardLocales[entry];
AchievementRewardLocale& data = m_achievementRewardLocales[ID];
LocaleConstant locale = GetLocaleByName(LocaleName);
if (locale == LOCALE_enUS)
continue;
ObjectMgr::AddLocaleString(Subject, locale, data.Subject);
ObjectMgr::AddLocaleString(Text, locale, data.Text);
for (int i = 1; i < TOTAL_LOCALES; ++i)
{
LocaleConstant locale = (LocaleConstant) i;
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1)].GetString(), locale, data.subject);
ObjectMgr::AddLocaleString(fields[1 + 2 * (i - 1) + 1].GetString(), locale, data.text);
}
} while (result->NextRow());
sLog->outString(">> Loaded %lu achievement reward locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString(">> Loaded %lu Achievement Reward Locale strings in %u ms", (unsigned long)m_achievementRewardLocales.size(), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}