mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 15:58:04 +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_GRAVEYARD = 27, // don't use on 3.3.5a
|
||||||
CONDITION_SOURCE_TYPE_PLAYER_LOOT_TEMPLATE = 28,
|
CONDITION_SOURCE_TYPE_PLAYER_LOOT_TEMPLATE = 28,
|
||||||
CONDITION_SOURCE_TYPE_CREATURE_RESPAWN = 29,
|
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
|
enum RelationType
|
||||||
|
|||||||
@@ -1908,8 +1908,22 @@ bool WorldObject::CanSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
|||||||
|
|
||||||
// Creature scripts
|
// Creature scripts
|
||||||
if (Creature const* cObj = obj->ToCreature())
|
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
|
// Gameobject scripts
|
||||||
if (GameObject const* goObj = obj->ToGameObject())
|
if (GameObject const* goObj = obj->ToGameObject())
|
||||||
|
|||||||
Reference in New Issue
Block a user