mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
feat(Core/Conditions): Implement CONDITION_SOURCE_CREATURE_VISIBILITY (#10208)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user