mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Lots of cmangos commirs applied
This commit is contained in:
parent
8431568536
commit
18dd18780d
44 changed files with 677 additions and 323 deletions
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue