Synchronize broadcast_text namings
This commit is contained in:
1 parent
39e40f176b
commit
cb12d57666
5 files changed
+79
-62
No files matched your search
@@ -0,0 +1,17 @@
|
|||||||
|
ALTER TABLE `broadcast_text`
|
||||||
|
CHANGE COLUMN `Language` `LanguageID` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `ID`,
|
||||||
|
CHANGE COLUMN `MaleText` `Text` LONGTEXT NULL AFTER `LanguageID`,
|
||||||
|
CHANGE COLUMN `FemaleText` `Text1` LONGTEXT NULL AFTER `Text`,
|
||||||
|
CHANGE COLUMN `EmoteID0` `EmoteID1` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `Text1`,
|
||||||
|
CHANGE COLUMN `EmoteID1` `EmoteID2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `EmoteID1`,
|
||||||
|
CHANGE COLUMN `EmoteID2` `EmoteID3` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `EmoteID2`,
|
||||||
|
CHANGE COLUMN `EmoteDelay0` `EmoteDelay1` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `EmoteID3`,
|
||||||
|
CHANGE COLUMN `EmoteDelay1` `EmoteDelay2` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `EmoteDelay1`,
|
||||||
|
CHANGE COLUMN `EmoteDelay2` `EmoteDelay3` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `EmoteDelay2`,
|
||||||
|
CHANGE COLUMN `SoundId` `SoundEntriesID` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `EmoteDelay3`,
|
||||||
|
CHANGE COLUMN `Unk1` `EmotesID` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `SoundEntriesID`,
|
||||||
|
CHANGE COLUMN `Unk2` `Flags` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT '0' AFTER `EmotesID`;
|
||||||
|
|
||||||
|
ALTER TABLE `broadcast_text_locale`
|
||||||
|
CHANGE COLUMN `MaleText` `Text` TEXT NULL AFTER `locale`,
|
||||||
|
CHANGE COLUMN `FemaleText` `Text1` TEXT NULL AFTER `Text`;
|
||||||
@@ -5980,10 +5980,10 @@ void ObjectMgr::LoadGossipText()
|
|||||||
{
|
{
|
||||||
if (BroadcastText const* bcText = sObjectMgr->GetBroadcastText(gOption.BroadcastTextID))
|
if (BroadcastText const* bcText = sObjectMgr->GetBroadcastText(gOption.BroadcastTextID))
|
||||||
{
|
{
|
||||||
if (bcText->MaleText[DEFAULT_LOCALE] != gOption.Text_0)
|
if (bcText->Text[DEFAULT_LOCALE] != gOption.Text_0)
|
||||||
TC_LOG_INFO("sql.sql", "Row %u in table `npc_text` has mismatch between text%u_0 and the corresponding MaleText in `broadcast_text` row %u", id, i, gOption.BroadcastTextID);
|
TC_LOG_INFO("sql.sql", "Row %u in table `npc_text` has mismatch between text%u_0 and the corresponding Text in `broadcast_text` row %u", id, i, gOption.BroadcastTextID);
|
||||||
if (bcText->FemaleText[DEFAULT_LOCALE] != gOption.Text_1)
|
if (bcText->Text1[DEFAULT_LOCALE] != gOption.Text_1)
|
||||||
TC_LOG_INFO("sql.sql", "Row %u in table `npc_text` has mismatch between text%u_1 and the corresponding FemaleText in `broadcast_text` row %u", id, i, gOption.BroadcastTextID);
|
TC_LOG_INFO("sql.sql", "Row %u in table `npc_text` has mismatch between text%u_1 and the corresponding Text1 in `broadcast_text` row %u", id, i, gOption.BroadcastTextID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -9530,8 +9530,8 @@ void ObjectMgr::LoadBroadcastTexts()
|
|||||||
|
|
||||||
_broadcastTextStore.clear(); // for reload case
|
_broadcastTextStore.clear(); // for reload case
|
||||||
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12
|
||||||
QueryResult result = WorldDatabase.Query("SELECT ID, Language, MaleText, FemaleText, EmoteID0, EmoteID1, EmoteID2, EmoteDelay0, EmoteDelay1, EmoteDelay2, SoundId, Unk1, Unk2 FROM broadcast_text");
|
QueryResult result = WorldDatabase.Query("SELECT ID, LanguageID, Text, Text1, EmoteID1, EmoteID2, EmoteID3, EmoteDelay1, EmoteDelay2, EmoteDelay3, SoundEntriesID, EmotesID, Flags FROM broadcast_text");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded 0 broadcast texts. DB table `broadcast_text` is empty.");
|
TC_LOG_INFO("server.loading", ">> Loaded 0 broadcast texts. DB table `broadcast_text` is empty.");
|
||||||
@@ -9547,41 +9547,32 @@ void ObjectMgr::LoadBroadcastTexts()
|
|||||||
BroadcastText bct;
|
BroadcastText bct;
|
||||||
|
|
||||||
bct.Id = fields[0].GetUInt32();
|
bct.Id = fields[0].GetUInt32();
|
||||||
bct.Language = fields[1].GetUInt32();
|
bct.LanguageID = fields[1].GetUInt32();
|
||||||
bct.MaleText[DEFAULT_LOCALE] = fields[2].GetString();
|
bct.Text[DEFAULT_LOCALE] = fields[2].GetString();
|
||||||
bct.FemaleText[DEFAULT_LOCALE] = fields[3].GetString();
|
bct.Text1[DEFAULT_LOCALE] = fields[3].GetString();
|
||||||
bct.EmoteId0 = fields[4].GetUInt32();
|
bct.EmoteId1 = fields[4].GetUInt32();
|
||||||
bct.EmoteId1 = fields[5].GetUInt32();
|
bct.EmoteId2 = fields[5].GetUInt32();
|
||||||
bct.EmoteId2 = fields[6].GetUInt32();
|
bct.EmoteId3 = fields[6].GetUInt32();
|
||||||
bct.EmoteDelay0 = fields[7].GetUInt32();
|
bct.EmoteDelay1 = fields[7].GetUInt32();
|
||||||
bct.EmoteDelay1 = fields[8].GetUInt32();
|
bct.EmoteDelay2 = fields[8].GetUInt32();
|
||||||
bct.EmoteDelay2 = fields[9].GetUInt32();
|
bct.EmoteDelay3 = fields[9].GetUInt32();
|
||||||
bct.SoundId = fields[10].GetUInt32();
|
bct.SoundEntriesID = fields[10].GetUInt32();
|
||||||
bct.Unk1 = fields[11].GetUInt32();
|
bct.EmotesID = fields[11].GetUInt32();
|
||||||
bct.Unk2 = fields[12].GetUInt32();
|
bct.Flags = fields[12].GetUInt32();
|
||||||
|
|
||||||
if (bct.SoundId)
|
if (bct.SoundEntriesID)
|
||||||
{
|
{
|
||||||
if (!sSoundEntriesStore.LookupEntry(bct.SoundId))
|
if (!sSoundEntriesStore.LookupEntry(bct.SoundEntriesID))
|
||||||
{
|
{
|
||||||
TC_LOG_DEBUG("broadcasttext", "BroadcastText (Id: %u) in table `broadcast_text` has SoundId %u but sound does not exist.", bct.Id, bct.SoundId);
|
TC_LOG_DEBUG("broadcasttext", "BroadcastText (Id: %u) in table `broadcast_text` has SoundEntriesID %u but sound does not exist.", bct.Id, bct.SoundEntriesID);
|
||||||
bct.SoundId = 0;
|
bct.SoundEntriesID = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GetLanguageDescByID(bct.Language))
|
if (!GetLanguageDescByID(bct.LanguageID))
|
||||||
{
|
{
|
||||||
TC_LOG_DEBUG("broadcasttext", "BroadcastText (Id: %u) in table `broadcast_text` using Language %u but Language does not exist.", bct.Id, bct.Language);
|
TC_LOG_DEBUG("broadcasttext", "BroadcastText (Id: %u) in table `broadcast_text` using LanguageID %u but Language does not exist.", bct.Id, bct.LanguageID);
|
||||||
bct.Language = LANG_UNIVERSAL;
|
bct.LanguageID = LANG_UNIVERSAL;
|
||||||
}
|
|
||||||
|
|
||||||
if (bct.EmoteId0)
|
|
||||||
{
|
|
||||||
if (!sEmotesStore.LookupEntry(bct.EmoteId0))
|
|
||||||
{
|
|
||||||
TC_LOG_DEBUG("broadcasttext", "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId0 %u but emote does not exist.", bct.Id, bct.EmoteId0);
|
|
||||||
bct.EmoteId0 = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bct.EmoteId1)
|
if (bct.EmoteId1)
|
||||||
@@ -9602,6 +9593,15 @@ void ObjectMgr::LoadBroadcastTexts()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bct.EmoteId3)
|
||||||
|
{
|
||||||
|
if (!sEmotesStore.LookupEntry(bct.EmoteId3))
|
||||||
|
{
|
||||||
|
TC_LOG_DEBUG("broadcasttext", "BroadcastText (Id: %u) in table `broadcast_text` has EmoteId3 %u but emote does not exist.", bct.Id, bct.EmoteId3);
|
||||||
|
bct.EmoteId3 = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_broadcastTextStore[bct.Id] = bct;
|
_broadcastTextStore[bct.Id] = bct;
|
||||||
}
|
}
|
||||||
while (result->NextRow());
|
while (result->NextRow());
|
||||||
@@ -9613,8 +9613,8 @@ void ObjectMgr::LoadBroadcastTextLocales()
|
|||||||
{
|
{
|
||||||
uint32 oldMSTime = getMSTime();
|
uint32 oldMSTime = getMSTime();
|
||||||
|
|
||||||
// 0 1 2 3
|
// 0 1 2 3
|
||||||
QueryResult result = WorldDatabase.Query("SELECT ID, locale, MaleText, FemaleText FROM broadcast_text_locale");
|
QueryResult result = WorldDatabase.Query("SELECT ID, locale, Text, Text1 FROM broadcast_text_locale");
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded 0 broadcast text locales. DB table `broadcast_text_locale` is empty.");
|
TC_LOG_INFO("server.loading", ">> Loaded 0 broadcast text locales. DB table `broadcast_text_locale` is empty.");
|
||||||
@@ -9627,8 +9627,8 @@ void ObjectMgr::LoadBroadcastTextLocales()
|
|||||||
|
|
||||||
uint32 id = fields[0].GetUInt32();
|
uint32 id = fields[0].GetUInt32();
|
||||||
std::string localeName = fields[1].GetString();
|
std::string localeName = fields[1].GetString();
|
||||||
std::string MaleText = fields[2].GetString();
|
std::string Text = fields[2].GetString();
|
||||||
std::string FemaleText = fields[3].GetString();
|
std::string Text1 = fields[3].GetString();
|
||||||
|
|
||||||
BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
|
BroadcastTextContainer::iterator bct = _broadcastTextStore.find(id);
|
||||||
if (bct == _broadcastTextStore.end())
|
if (bct == _broadcastTextStore.end())
|
||||||
@@ -9641,8 +9641,8 @@ void ObjectMgr::LoadBroadcastTextLocales()
|
|||||||
if (locale == LOCALE_enUS)
|
if (locale == LOCALE_enUS)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
AddLocaleString(MaleText, locale, bct->second.MaleText);
|
AddLocaleString(Text, locale, bct->second.Text);
|
||||||
AddLocaleString(FemaleText, locale, bct->second.FemaleText);
|
AddLocaleString(Text1, locale, bct->second.Text1);
|
||||||
} while (result->NextRow());
|
} while (result->NextRow());
|
||||||
|
|
||||||
TC_LOG_INFO("server.loading", ">> Loaded %u broadcast text locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
TC_LOG_INFO("server.loading", ">> Loaded %u broadcast text locales in %u ms", uint32(_broadcastTextStore.size()), GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
|||||||
@@ -480,41 +480,41 @@ struct AccessRequirement
|
|||||||
|
|
||||||
struct BroadcastText
|
struct BroadcastText
|
||||||
{
|
{
|
||||||
BroadcastText() : Id(0), Language(0), EmoteId0(0), EmoteId1(0), EmoteId2(0),
|
BroadcastText() : Id(0), LanguageID(0), EmoteId1(0), EmoteId2(0), EmoteId3(0),
|
||||||
EmoteDelay0(0), EmoteDelay1(0), EmoteDelay2(0), SoundId(0), Unk1(0), Unk2(0)
|
EmoteDelay1(0), EmoteDelay2(0), EmoteDelay3(0), SoundEntriesID(0), EmotesID(0), Flags(0)
|
||||||
{
|
{
|
||||||
MaleText.resize(DEFAULT_LOCALE + 1);
|
Text.resize(DEFAULT_LOCALE + 1);
|
||||||
FemaleText.resize(DEFAULT_LOCALE + 1);
|
Text1.resize(DEFAULT_LOCALE + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Id;
|
uint32 Id;
|
||||||
uint32 Language;
|
uint32 LanguageID;
|
||||||
std::vector<std::string> MaleText;
|
std::vector<std::string> Text;
|
||||||
std::vector<std::string> FemaleText;
|
std::vector<std::string> Text1;
|
||||||
uint32 EmoteId0;
|
|
||||||
uint32 EmoteId1;
|
uint32 EmoteId1;
|
||||||
uint32 EmoteId2;
|
uint32 EmoteId2;
|
||||||
uint32 EmoteDelay0;
|
uint32 EmoteId3;
|
||||||
uint32 EmoteDelay1;
|
uint32 EmoteDelay1;
|
||||||
uint32 EmoteDelay2;
|
uint32 EmoteDelay2;
|
||||||
uint32 SoundId;
|
uint32 EmoteDelay3;
|
||||||
uint32 Unk1;
|
uint32 SoundEntriesID;
|
||||||
uint32 Unk2;
|
uint32 EmotesID;
|
||||||
|
uint32 Flags;
|
||||||
// uint32 VerifiedBuild;
|
// uint32 VerifiedBuild;
|
||||||
|
|
||||||
std::string const& GetText(LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false) const
|
std::string const& GetText(LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false) const
|
||||||
{
|
{
|
||||||
if ((gender == GENDER_FEMALE || gender == GENDER_NONE) && (forceGender || !FemaleText[DEFAULT_LOCALE].empty()))
|
if ((gender == GENDER_FEMALE || gender == GENDER_NONE) && (forceGender || !Text1[DEFAULT_LOCALE].empty()))
|
||||||
{
|
{
|
||||||
if (FemaleText.size() > size_t(locale) && !FemaleText[locale].empty())
|
if (Text1.size() > size_t(locale) && !Text1[locale].empty())
|
||||||
return FemaleText[locale];
|
return Text1[locale];
|
||||||
return FemaleText[DEFAULT_LOCALE];
|
return Text1[DEFAULT_LOCALE];
|
||||||
}
|
}
|
||||||
// else if (gender == GENDER_MALE)
|
// else if (gender == GENDER_MALE)
|
||||||
{
|
{
|
||||||
if (MaleText.size() > size_t(locale) && !MaleText[locale].empty())
|
if (Text.size() > size_t(locale) && !Text[locale].empty())
|
||||||
return MaleText[locale];
|
return Text[locale];
|
||||||
return MaleText[DEFAULT_LOCALE];
|
return Text[DEFAULT_LOCALE];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,13 +23,13 @@
|
|||||||
void Trinity::BroadcastTextBuilder::operator()(WorldPacket& data, LocaleConstant locale) const
|
void Trinity::BroadcastTextBuilder::operator()(WorldPacket& data, LocaleConstant locale) const
|
||||||
{
|
{
|
||||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
|
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
|
||||||
ChatHandler::BuildChatPacket(data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale);
|
ChatHandler::BuildChatPacket(data, _msgType, bct ? Language(bct->LanguageID) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Trinity::BroadcastTextBuilder::operator()(WorldPacket* data, LocaleConstant locale) const
|
size_t Trinity::BroadcastTextBuilder::operator()(WorldPacket* data, LocaleConstant locale) const
|
||||||
{
|
{
|
||||||
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
|
BroadcastText const* bct = sObjectMgr->GetBroadcastText(_textId);
|
||||||
return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->Language) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale);
|
return ChatHandler::BuildChatPacket(*data, _msgType, bct ? Language(bct->LanguageID) : LANG_UNIVERSAL, _source, _target, bct ? bct->GetText(locale, _gender) : "", _achievementId, "", locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Trinity::CustomChatTextBuilder::operator()(WorldPacket& data, LocaleConstant locale) const
|
void Trinity::CustomChatTextBuilder::operator()(WorldPacket& data, LocaleConstant locale) const
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ uint32 CreatureTextMgr::SendChat(Creature* source, uint8 textGroup, WorldObject
|
|||||||
if (sound)
|
if (sound)
|
||||||
finalSound = sound;
|
finalSound = sound;
|
||||||
else if (BroadcastText const* bct = sObjectMgr->GetBroadcastText(iter->BroadcastTextId))
|
else if (BroadcastText const* bct = sObjectMgr->GetBroadcastText(iter->BroadcastTextId))
|
||||||
if (uint32 broadcastTextSoundId = bct->SoundId)
|
if (uint32 broadcastTextSoundId = bct->SoundEntriesID)
|
||||||
finalSound = broadcastTextSoundId;
|
finalSound = broadcastTextSoundId;
|
||||||
|
|
||||||
if (range == TEXT_RANGE_NORMAL)
|
if (range == TEXT_RANGE_NORMAL)
|
||||||
|
|||||||
Reference in new issue
Block a user