*Allow guardian to use scripts.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-06-05 22:43:02 -05:00
parent d2c30bd9f0
commit c8e398281a

View File

@@ -38,8 +38,7 @@ namespace FactorySelector
const CreatureAICreator *ai_factory = NULL;
CreatureAIRegistry &ai_registry(CreatureAIRepository::Instance());
//player-controlled guardians with pet bar
if(creature->HasSummonMask(SUMMON_MASK_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
if(creature->isPet())
ai_factory = ai_registry.GetRegistryItem("PetAI");
//scriptname in db
@@ -55,7 +54,9 @@ namespace FactorySelector
// select by NPC flags
if(!ai_factory)
{
if(creature->isVehicle() || creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
if(creature->isGuardian() && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
ai_factory = ai_registry.GetRegistryItem("PetAI");
else if(creature->isVehicle() || creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
else if(creature->isGuard())
ai_factory = ai_registry.GetRegistryItem("GuardAI");