mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-06 04:23:47 +00:00
feat(Core/Conditions): Implement CONDITION_AI_DATA and support for st… (#22879)
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
#include "ConditionMgr.h"
|
||||
#include "AchievementMgr.h"
|
||||
#include "GameEventMgr.h"
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Pet.h"
|
||||
@@ -576,6 +578,14 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
|
||||
condMeets = sWorldState->IsConditionFulfilled(ConditionValue1, ConditionValue2);
|
||||
break;
|
||||
}
|
||||
case CONDITION_AI_DATA:
|
||||
{
|
||||
if (Creature* creature = object->ToCreature())
|
||||
condMeets = creature->AI() && creature->AI()->GetData(ConditionValue1) == ConditionValue2;
|
||||
else if (GameObject* go = object->ToGameObject())
|
||||
condMeets = go->AI() && go->AI()->GetData(ConditionValue1) == ConditionValue2;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
condMeets = false;
|
||||
break;
|
||||
@@ -779,6 +789,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
|
||||
case CONDITION_WORLD_SCRIPT:
|
||||
mask |= GRID_MAP_TYPE_MASK_ALL;
|
||||
break;
|
||||
case CONDITION_AI_DATA:
|
||||
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_GAMEOBJECT;
|
||||
break;
|
||||
default:
|
||||
ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
|
||||
break;
|
||||
|
||||
@@ -87,8 +87,9 @@ enum ConditionTypes
|
||||
CONDITION_QUEST_SATISFY_EXCLUSIVE = 101, // quest_id 0 0 true if satisfied exclusive group
|
||||
CONDITION_HAS_AURA_TYPE = 102, // aura_type 0 0 true if has aura type
|
||||
CONDITION_WORLD_SCRIPT = 103, // conditionId state 0 true if WorldState::IsConditionFulfilled returns true
|
||||
CONDITION_AI_DATA = 104, // dataId value 0 true if AI::GetData returns value
|
||||
|
||||
CONDITION_AC_END = 104 // placeholder
|
||||
CONDITION_AC_END = 105 // placeholder
|
||||
};
|
||||
|
||||
/*! Documentation on implementing a new ConditionSourceType:
|
||||
|
||||
Reference in New Issue
Block a user