Many cmangos commits applied

Many cmangos commits applied
This commit is contained in:
Charles A Edwards 2016-09-11 10:26:49 +01:00 committed by Antz
parent cba86c231e
commit 8431568536
38 changed files with 173 additions and 83 deletions

View file

@ -38,11 +38,18 @@ namespace FactorySelector
{
CreatureAI* selectAI(Creature* creature)
{
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if ((!creature->IsPet() || !((Pet*)creature)->isControlled()) && !creature->IsCharmed())
if (CreatureAI* scriptedAI = sScriptMgr.GetCreatureAI(creature))
CreatureAI* scriptedAI = sScriptMgr.GetCreatureAI(creature);
if (scriptedAI)
{
// charmed creature may have some script even if its not supposed to be that way (ex: Eye of Acherus)
if (creature->IsCharmed())
return scriptedAI;
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if (!creature->IsPet() || !static_cast<Pet*>(creature)->isControlled())
return scriptedAI;
}
CreatureAIRegistry& ai_registry(CreatureAIRepository::Instance());
const CreatureAICreator* ai_factory = NULL;