35 template <
class T,
class Value>
48 template <
class Value>
49 bool operator()(Value
const& left, Value
const& right)
const
58 template <
class AI,
class T>
61 static_assert(std::is_same<AI, CreatureAI>::value || std::is_same<AI, GameObjectAI>::value,
"Invalid template parameter");
62 static_assert(std::is_same<AI, CreatureAI>::value == std::is_same<T, Creature>::value,
"Incompatible AI for type");
63 static_assert(std::is_same<AI, GameObjectAI>::value == std::is_same<T, GameObject>::value,
"Incompatible AI for type");
68 std::string
const& aiName = obj->GetAIName();
73 typename AIRegistry::RegistryMapType
const& items = AIRegistry::instance()->GetRegisteredItems();
76 return itr->second.get();
86 if (creature->
IsPet())
97 TC_LOG_ERROR(
"entities.unit",
"Exception trying to assign script '{}' to Creature (Entry: {}), this Creature will have a default AI. Exception message: {}",
101 return SelectFactory<CreatureAI>(creature)->Create(creature);
106 if (creature->
IsPet())
112 return factory->GetScriptId();
126 return factory->GetScriptId();
133 if (!creature->GetPlayerMovingMe())
134 type = creature->GetDefaultMovementType();
146 return SelectFactory<GameObjectAI>(go)->Create(go);
162 return factory->GetScriptId();
167 return sObjectMgr->GetScriptId(
"NullAreaTriggerAI",
false);
#define sCreatureAIRegistry
#define ASSERT_NOTNULL(pointer)
#define TC_LOG_ERROR(filterType__, message__,...)
#define sMovementGeneratorRegistry
uint32 GetScriptId() const
uint32 GetScriptId() const
std::string GetScriptName() const
uint32 GetScriptId() const
T const * GetRegistryItem(Key const &key) const
Returns a registry item.
static Creature * ToCreature(Object *o)
virtual int32 Permit(T const *) const =0
virtual MovementGeneratorType GetDefaultMovementType() const
uint32 GetSelectedAIId(Creature const *creature)
MovementGenerator * SelectMovementGenerator(Unit *unit)
CreatureAI * SelectAI(Creature *creature)
static uint32 GetNullAreaTriggerAIScriptId()
GameObjectAI * SelectGameObjectAI(GameObject *go)
AreaTriggerAI * SelectAreaTriggerAI(AreaTrigger *at)
int32 GetPermitFor(T const *obj, Value const &value)
FactoryHolder< AI, T > const * SelectFactory(T const *obj)
PermissibleOrderPred(T const *obj)
bool operator()(Value const &left, Value const &right) const