mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-03-16 05:55:07 +00:00
feat(Core/Unit): NPCFlags helpers (#11286)
* cherry-pick commit (TrinityCore/TrinityCore@d611925) Co-Authored-By: Shauren <shauren.trinity@gmail.com>
This commit is contained in:
@@ -53,7 +53,7 @@ namespace FactorySelector
|
||||
ai_factory = ai_registry.GetRegistryItem("VehicleAI");
|
||||
else if (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)
|
||||
ai_factory = ai_registry.GetRegistryItem("PetAI");
|
||||
else if (creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK))
|
||||
else if (creature->HasNpcFlag(UNIT_NPC_FLAG_SPELLCLICK))
|
||||
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
|
||||
else if (creature->IsGuard())
|
||||
ai_factory = ai_registry.GetRegistryItem("GuardAI");
|
||||
|
||||
@@ -496,7 +496,7 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
|
||||
}
|
||||
|
||||
//disable npcflags
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
|
||||
if (me->HasUnitFlag(UNIT_FLAG_IMMUNE_TO_NPC))
|
||||
{
|
||||
HasImmuneToNPCFlags = true;
|
||||
|
||||
@@ -293,7 +293,7 @@ void FollowerAI::StartFollow(Player* player, uint32 factionForFollower, const Qu
|
||||
LOG_DEBUG("scripts.ai", "FollowerAI start with WAYPOINT_MOTION_TYPE, set to MoveIdle.");
|
||||
}
|
||||
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
|
||||
|
||||
AddFollowState(STATE_FOLLOW_INPROGRESS);
|
||||
|
||||
|
||||
@@ -199,8 +199,8 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
|
||||
|
||||
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
|
||||
mEscortNPCFlags = me->GetNpcFlags();
|
||||
me->ReplaceAllNpcFlags(UNIT_NPC_FLAG_NONE);
|
||||
}
|
||||
|
||||
Movement::PointsArray pathPoints;
|
||||
@@ -287,7 +287,7 @@ void SmartAI::EndPath(bool fail)
|
||||
|
||||
if (mEscortNPCFlags)
|
||||
{
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags);
|
||||
me->ReplaceAllNpcFlags(NPCFlags(mEscortNPCFlags));
|
||||
mEscortNPCFlags = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2167,7 +2167,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToUnit()->SetUInt32Value(UNIT_NPC_FLAGS, e.action.flag.flag);
|
||||
(*itr)->ToUnit()->ReplaceAllNpcFlags(NPCFlags(e.action.flag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2180,7 +2180,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToUnit()->SetFlag(UNIT_NPC_FLAGS, e.action.flag.flag);
|
||||
(*itr)->ToUnit()->SetNpcFlag(NPCFlags(e.action.flag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
@@ -2193,7 +2193,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
|
||||
|
||||
for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr)
|
||||
if (IsCreature(*itr))
|
||||
(*itr)->ToUnit()->RemoveFlag(UNIT_NPC_FLAGS, e.action.flag.flag);
|
||||
(*itr)->ToUnit()->RemoveNpcFlag(NPCFlags(e.action.flag.flag));
|
||||
|
||||
delete targets;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user