Lots of cmangos commirs applied

This commit is contained in:
Charles A Edwards 2016-09-12 17:52:23 +01:00 committed by Antz
parent 8431568536
commit 18dd18780d
44 changed files with 677 additions and 323 deletions

View file

@ -59,9 +59,12 @@ namespace FactorySelector
// select by NPC flags _first_ - otherwise EventAI might be choosen for pets/totems
// excplicit check for isControlled() and owner type to allow guardian, mini-pets and pets controlled by NPCs to be scripted by EventAI
Unit* owner = NULL;
if ((creature->IsPet() && ((Pet*)creature)->isControlled() &&
((owner = creature->GetOwner()) && owner->GetTypeId() == TYPEID_PLAYER)) || creature->IsCharmed())
ai_factory = ai_registry.GetRegistryItem("PetAI");
if (creature->IsPet() && ((Pet*)creature)->isControlled())
{
Unit* controler = creature->GetOwner() ? creature->GetOwner() : creature->GetCharmer();
if (controler && controler->GetTypeId() == TYPEID_PLAYER && controler->IsAlive())
ai_factory = ai_registry.GetRegistryItem("PetAI");
}
else if (creature->IsTotem())
ai_factory = ai_registry.GetRegistryItem("TotemAI");