diff options
author | Xyventh <xyventh@protonmail.com> | 2017-04-23 23:55:07 +0200 |
---|---|---|
committer | funjoker <funjoker109@gmail.com> | 2020-04-27 18:23:07 +0200 |
commit | 2bd7c9aa40cefcfc401b81cfacd7dd832a3a736b (patch) | |
tree | 1325343a52f5a2054936dd0885fa2258d41f8dea | |
parent | cf3c5dc9485d8cace0ba18e1afe1a5152f6f2ddc (diff) |
[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
(cherry picked from commit f0bf1fc77aa304ad278618aae25274ed46d308d5)
-rw-r--r-- | src/server/game/Handlers/QuestHandler.cpp | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/src/server/game/Handlers/QuestHandler.cpp b/src/server/game/Handlers/QuestHandler.cpp index b56e0ec130c..3ccee95e9e0 100644 --- a/src/server/game/Handlers/QuestHandler.cpp +++ b/src/server/game/Handlers/QuestHandler.cpp @@ -350,46 +350,41 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPackets::Quest::Quest { //For AutoSubmition was added plr case there as it almost same exclute AI script cases. Creature* creatureQGiver = object->ToCreature(); - if (!creatureQGiver || !sScriptMgr->OnQuestReward(_player, creatureQGiver, quest, packet.ItemChoiceID)) + // Send next quest + if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, quest)) { - // Send next quest - if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, 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); + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true)) + _player->AddQuestAndCheckCompletion(nextQuest, object); - _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false); - } + _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false); } - - if (creatureQGiver) - creatureQGiver->GetAI()->sQuestReward(_player, quest, packet.ItemChoiceID); } + + if (creatureQGiver && !sScriptMgr->OnQuestReward(_player, creatureQGiver, quest, packet.ItemChoiceID)) + creatureQGiver->GetAI()->sQuestReward(_player, quest, packet.ItemChoiceID); break; } case TYPEID_GAMEOBJECT: { GameObject* questGiver = object->ToGameObject(); - if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, packet.ItemChoiceID)) + // Send next quest + if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, quest)) { - // Send next quest - if (Quest const* nextQuest = _player->GetNextQuest(packet.QuestGiverGUID, 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); + if (nextQuest->IsAutoAccept() && _player->CanAddQuest(nextQuest, true)) + _player->AddQuestAndCheckCompletion(nextQuest, object); - _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false); - } + _player->PlayerTalkClass->SendQuestGiverQuestDetails(nextQuest, packet.QuestGiverGUID, true, false); } + } + if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, packet.ItemChoiceID)) questGiver->AI()->QuestReward(_player, quest, packet.ItemChoiceID); - } break; } default: |