Core/Quests: Fix quests that require player to be dead

Closes #1441
This commit is contained in:
tobmaps
2011-05-30 02:59:37 +07:00
parent 7fb8043b38
commit 4a0290c17b
3 changed files with 38 additions and 14 deletions
@@ -119,9 +119,6 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
uint32 unk1;
recv_data >> guid >> quest >> unk1;
if (!GetPlayer()->isAlive())
return;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), quest, unk1);
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT|TYPEMASK_ITEM|TYPEMASK_PLAYER);
@@ -135,6 +132,10 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data)
return;
}
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(pObject))
return;
Quest const* qInfo = sObjectMgr->GetQuestTemplate(quest);
if (qInfo)
{
@@ -294,16 +295,14 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket & recv_data)
return;
}
if (!GetPlayer()->isAlive())
return;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), quest, reward);
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!pObject)
if (!pObject || !pObject->hasInvolvedQuest(quest))
return;
if (!pObject->hasInvolvedQuest(quest))
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(pObject))
return;
Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest);
@@ -349,13 +348,14 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data)
uint64 guid;
recv_data >> guid >> quest;
if (!GetPlayer()->isAlive())
return;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!pObject||!pObject->hasInvolvedQuest(quest))
if (!pObject || !pObject->hasInvolvedQuest(quest))
return;
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(pObject))
return;
if (_player->CanCompleteQuest(quest))
@@ -462,10 +462,15 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data)
uint64 guid;
recv_data >> guid >> quest;
if (!_player->isAlive())
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
Object* pObject = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT|TYPEMASK_GAMEOBJECT);
if (!pObject || !pObject->hasInvolvedQuest(quest))
return;
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), quest);
// some kind of WPE protection
if (!_player->CanInteractWithQuestGiver(pObject))
return;
Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest);
if (pQuest)