diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 75b9453e9..2c619f623 100644 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -149,7 +149,8 @@ enum ConditionSourceType CONDITION_SOURCE_TYPE_GRAVEYARD = 27, // don't use on 3.3.5a CONDITION_SOURCE_TYPE_PLAYER_LOOT_TEMPLATE = 28, CONDITION_SOURCE_TYPE_CREATURE_RESPAWN = 29, - CONDITION_SOURCE_TYPE_MAX = 30 // placeholder + CONDITION_SOURCE_TYPE_CREATURE_VISIBILITY = 30, + CONDITION_SOURCE_TYPE_MAX = 31 // placeholder }; enum RelationType diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index 72bb2d164..863466aae 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1908,8 +1908,22 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo // Creature scripts if (Creature const* cObj = obj->ToCreature()) - if (cObj->IsAIEnabled && this->ToPlayer() && !cObj->AI()->CanBeSeen(this->ToPlayer())) - return false; + { + if (Player const* player = this->ToPlayer()) + { + if (cObj->IsAIEnabled && !cObj->AI()->CanBeSeen(player)) + { + return false; + } + + ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_VISIBILITY, cObj->GetEntry()); + + if (!sConditionMgr->IsObjectMeetToConditions((WorldObject*)this, conditions)) + { + return false; + } + } + } // Gameobject scripts if (GameObject const* goObj = obj->ToGameObject())