From 4305129672f2b4401b5dada5162dd96f7863c651 Mon Sep 17 00:00:00 2001 From: Aokromes Date: Wed, 20 Jul 2016 18:23:26 +0200 Subject: [PATCH] =?UTF-8?q?Core/Loading:=20output=20error=20when=20specifi?= =?UTF-8?q?ed=20emote=20id=20for=20some=20quest-rel=E2=80=A6=20=E2=80=A6at?= =?UTF-8?q?ed=20tables=20is=20invalid=20(#17469)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Core/Loading: output error when specified emote id for some quest-related tables is invalid * Apply suggested changes (and kill whitespace) --- src/server/game/Quests/QuestDef.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 807833af035..0783d045aad 100644 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -167,7 +167,15 @@ Quest::Quest(Field* questRecord) void Quest::LoadQuestDetails(Field* fields) { for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) + { + if (!sEmotesStore.LookupEntry(fields[1+i].GetUInt16())) + { + TC_LOG_ERROR("sql.sql", "Table `quest_details` has non-existing Emote%i (%u) set for quest %u. Skipped.", 1+i, fields[1+i].GetUInt16(), fields[0].GetUInt32()); + continue; + } + DetailsEmote[i] = fields[1 + i].GetUInt16(); + } for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) DetailsEmoteDelay[i] = fields[5 + i].GetUInt32(); @@ -177,13 +185,28 @@ void Quest::LoadQuestRequestItems(Field* fields) { EmoteOnComplete = fields[1].GetUInt16(); EmoteOnIncomplete = fields[2].GetUInt16(); + + if (!sEmotesStore.LookupEntry(EmoteOnComplete)) + TC_LOG_ERROR("sql.sql", "Table `quest_request_items` has non-existing EmoteOnComplete (%u) set for quest %u.", EmoteOnComplete, fields[0].GetUInt32()); + + if (!sEmotesStore.LookupEntry(EmoteOnIncomplete)) + TC_LOG_ERROR("sql.sql", "Table `quest_request_items` has non-existing EmoteOnIncomplete (%u) set for quest %u.", EmoteOnIncomplete, fields[0].GetUInt32()); + RequestItemsText = fields[3].GetString(); } void Quest::LoadQuestOfferReward(Field* fields) { for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) + { + if (!sEmotesStore.LookupEntry(fields[1+i].GetUInt16())) + { + TC_LOG_ERROR("sql.sql", "Table `quest_offer_reward` has non-existing Emote%i (%u) set for quest %u. Skipped.", 1+i, fields[1+i].GetUInt16(), fields[0].GetUInt32()); + continue; + } + OfferRewardEmote[i] = fields[1 + i].GetUInt16(); + } for (int i = 0; i < QUEST_EMOTE_COUNT; ++i) OfferRewardEmoteDelay[i] = fields[5 + i].GetUInt32();