diff options
-rw-r--r-- | src/server/game/Handlers/QuestHandler.cpp | 44 |
1 files changed, 20 insertions, 24 deletions
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: |