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
@@ -2648,6 +2648,24 @@ void Player::ResetAllPowers()
}
}
bool Player::CanInteractWithQuestGiver(Object* questGiver)
{
switch (questGiver->GetTypeId())
{
case TYPEID_UNIT:
return GetNPCIfCanInteractWith(questGiver->GetGUID(), UNIT_NPC_FLAG_QUESTGIVER) != NULL;
case TYPEID_GAMEOBJECT:
return GetGameObjectIfCanInteractWith(questGiver->GetGUID(), GAMEOBJECT_TYPE_QUESTGIVER) != NULL;
case TYPEID_PLAYER:
return isAlive() && questGiver->ToPlayer()->isAlive();
case TYPEID_ITEM:
return isAlive();
default:
break;
}
return false;
}
Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
{
// unit checks
+1
View File
@@ -1081,6 +1081,7 @@ class Player : public Unit, public GridObject<Player>
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0);
void SendInstanceResetWarning(uint32 mapid, Difficulty difficulty, uint32 time);
bool CanInteractWithQuestGiver(Object* questGiver);
Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;