@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user