Core/Escort: few modifications to add the IMMUNE_TO_NPC flag after npc does a full reset.
This commit is contained in:
@@ -32,7 +32,8 @@ npc_escortAI::npc_escortAI(Creature* creature) : ScriptedAI(creature),
|
||||
m_bCanReturnToStart(false),
|
||||
DespawnAtEnd(true),
|
||||
DespawnAtFar(true),
|
||||
ScriptWP(false)
|
||||
ScriptWP(false),
|
||||
HasImmuneToNPCFlags(false)
|
||||
{}
|
||||
|
||||
void npc_escortAI::AttackStart(Unit* who)
|
||||
@@ -179,6 +180,8 @@ void npc_escortAI::EnterEvadeMode()
|
||||
else
|
||||
{
|
||||
me->GetMotionMaster()->MoveTargetedHome();
|
||||
if (HasImmuneToNPCFlags)
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
Reset();
|
||||
}
|
||||
}
|
||||
@@ -462,7 +465,11 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
|
||||
|
||||
//disable npcflags
|
||||
me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC))
|
||||
{
|
||||
HasImmuneToNPCFlags = true;
|
||||
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
|
||||
}
|
||||
|
||||
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI started with " UI64FMTD " waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = " UI64FMTD "", uint64(WaypointList.size()), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID);
|
||||
|
||||
|
||||
@@ -120,6 +120,7 @@ struct npc_escortAI : public ScriptedAI
|
||||
bool DespawnAtEnd;
|
||||
bool DespawnAtFar;
|
||||
bool ScriptWP;
|
||||
bool HasImmuneToNPCFlags;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user