[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 f0bf1fc77a)
This commit is contained in:
Xyventh
2017-04-23 23:55:07 +02:00
committed by funjoker
parent cf3c5dc948
commit 2bd7c9aa40

View File

@@ -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);
}
questGiver->AI()->QuestReward(_player, quest, packet.ItemChoiceID);
}
if (!sScriptMgr->OnQuestReward(_player, questGiver, quest, packet.ItemChoiceID))
questGiver->AI()->QuestReward(_player, quest, packet.ItemChoiceID);
break;
}
default: