fix(DB/broadcast_text): align some column names (#10090)

This commit is contained in:
Kitzunu
2022-01-13 15:20:20 +01:00
committed by GitHub
parent 3fe82ff268
commit 2ff4e85578
3 changed files with 42 additions and 29 deletions

View File

@@ -0,0 +1,13 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1641686782891083700');
ALTER TABLE `broadcast_text`
CHANGE `Language` `LanguageID` MEDIUMINT,
CHANGE `EmoteID2` `EmoteID3` MEDIUMINT,
CHANGE `EmoteID1` `EmoteID2` MEDIUMINT,
CHANGE `EmoteID0` `EmoteID1` MEDIUMINT,
CHANGE `EmoteDelay2` `EmoteDelay3` MEDIUMINT,
CHANGE `EmoteDelay1` `EmoteDelay2` MEDIUMINT,
CHANGE `EmoteDelay0` `EmoteDelay1` MEDIUMINT,
CHANGE `SoundId` `SoundEntriesId` MEDIUMINT,
CHANGE `Unk1` `EmotesID` MEDIUMINT,
CHANGE `Unk2` `Flags` MEDIUMINT;

View File

@@ -8981,8 +8981,8 @@ void ObjectMgr::LoadBroadcastTexts()
_broadcastTextStore.clear(); // for reload case
// 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");
// 0 1 2 3 4 5 6 7 8 9 10 11 12
QueryResult result = WorldDatabase.Query("SELECT ID, LanguageID, MaleText, FemaleText, EmoteID1, EmoteID2, EmoteID3, EmoteDelay1, EmoteDelay2, EmoteDelay3, SoundEntriesID, EmotesID, Flags FROM broadcast_text");
if (!result)
{
LOG_INFO("server.loading", ">> Loaded 0 broadcast texts. DB table `broadcast_text` is empty.");
@@ -9002,22 +9002,22 @@ void ObjectMgr::LoadBroadcastTexts()
bct.LanguageID = fields[1].GetUInt32();
bct.MaleText[DEFAULT_LOCALE] = fields[2].GetString();
bct.FemaleText[DEFAULT_LOCALE] = fields[3].GetString();
bct.EmoteId0 = fields[4].GetUInt32();
bct.EmoteId1 = fields[5].GetUInt32();
bct.EmoteId2 = fields[6].GetUInt32();
bct.EmoteDelay0 = fields[7].GetUInt32();
bct.EmoteDelay1 = fields[8].GetUInt32();
bct.EmoteDelay2 = fields[9].GetUInt32();
bct.SoundId = fields[10].GetUInt32();
bct.Unk1 = fields[11].GetUInt32();
bct.Unk2 = fields[12].GetUInt32();
bct.EmoteId1 = fields[4].GetUInt32();
bct.EmoteId2 = fields[5].GetUInt32();
bct.EmoteId3 = fields[6].GetUInt32();
bct.EmoteDelay1 = fields[7].GetUInt32();
bct.EmoteDelay2 = fields[8].GetUInt32();
bct.EmoteDelay3 = fields[9].GetUInt32();
bct.SoundEntriesId = fields[10].GetUInt32();
bct.EmotesID = fields[11].GetUInt32();
bct.Flags = fields[12].GetUInt32();
if (bct.SoundId)
if (bct.SoundEntriesId)
{
if (!sSoundEntriesStore.LookupEntry(bct.SoundId))
if (!sSoundEntriesStore.LookupEntry(bct.SoundEntriesId))
{
LOG_DEBUG("misc", "BroadcastText (Id: %u) in table `broadcast_text` has SoundId %u but sound does not exist.", bct.Id, bct.SoundId);
bct.SoundId = 0;
LOG_DEBUG("misc", "BroadcastText (Id: %u) in table `broadcast_text` has SoundEntriesId %u but sound does not exist.", bct.Id, bct.SoundEntriesId);
bct.SoundEntriesId = 0;
}
}
@@ -9027,15 +9027,6 @@ void ObjectMgr::LoadBroadcastTexts()
bct.LanguageID = LANG_UNIVERSAL;
}
if (bct.EmoteId0)
{
if (!sEmotesStore.LookupEntry(bct.EmoteId0))
{
LOG_DEBUG("misc", "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 (!sEmotesStore.LookupEntry(bct.EmoteId1))
@@ -9054,6 +9045,15 @@ void ObjectMgr::LoadBroadcastTexts()
}
}
if (bct.EmoteId3)
{
if (!sEmotesStore.LookupEntry(bct.EmoteId3))
{
LOG_DEBUG("misc", "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;
} while (result->NextRow());

View File

@@ -442,15 +442,15 @@ struct BroadcastText
uint32 LanguageID{0};
std::vector<std::string> MaleText;
std::vector<std::string> FemaleText;
uint32 EmoteId0{0};
uint32 EmoteId1{0};
uint32 EmoteId2{0};
uint32 EmoteDelay0{0};
uint32 EmoteId3{0};
uint32 EmoteDelay1{0};
uint32 EmoteDelay2{0};
uint32 SoundId{0};
uint32 Unk1{0};
uint32 Unk2{0};
uint32 EmoteDelay3{0};
uint32 SoundEntriesId{0};
uint32 EmotesID{0};
uint32 Flags{0};
// uint32 VerifiedBuild;
[[nodiscard]] std::string const& GetText(LocaleConstant locale = DEFAULT_LOCALE, uint8 gender = GENDER_MALE, bool forceGender = false) const