From f0bf1fc77aa304ad278618aae25274ed46d308d5 Mon Sep 17 00:00:00 2001 From: Xyventh Date: Sun, 23 Apr 2017 23:55:07 +0200 Subject: [3.3.5] Core/Quest: always send the specified RewardNextQuest regardless of eventual scripts (#19498) - Fixes certain situations in which the quest window would get stuck after completing a quest --- src/server/game/Handlers/QuestHandler.cpp | 44 ++++++++++++++----------------- 1 file changed, 20 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index 4c464b9df63..c549a49adf3 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -303,45 +303,41 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData) case TYPEID_UNIT: { Creature* questgiver = object->ToCreature(); - if (!sScriptMgr->OnQuestReward(_player, questgiver, quest, reward)) + // Send next quest + if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { - // Send next quest - if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) + // Only send the quest to the player if the conditions are met + if (_player->CanTakeQuest(nextQuest, false)) { - // Only send the quest to the player if the conditions are met - if (_player->CanTakeQuest(nextQuest, false)) - { - if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true)) - _player->AddQuestAndCheckCompletion(nextQuest, object); - - _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); - } + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true)) + _player->AddQuestAndCheckCompletion(nextQuest, object); + + _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); } + } + if (!sScriptMgr->OnQuestReward(_player, questgiver, quest, reward)) questgiver->AI()->sQuestReward(_player, quest, reward); - } break; } case TYPEID_GAMEOBJECT: { GameObject* questGiver = object->ToGameObject(); - if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, reward)) + // Send next quest + if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) { - // Send next quest - if (Quest const* nextQuest = _player->GetNextQuest(guid, quest)) + // Only send the quest to the player if the conditions are met + if (_player->CanTakeQuest(nextQuest, false)) { - // Only send the quest to the player if the conditions are met - if (_player->CanTakeQuest(nextQuest, false)) - { - if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true)) - _player->AddQuestAndCheckCompletion(nextQuest, object); - - _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); - } + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true)) + _player->AddQuestAndCheckCompletion(nextQuest, object); + + _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, guid, true); } + } + if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, reward)) questGiver->AI()->QuestReward(_player, quest, reward); - } break; } default: -- cgit v1.2.3