aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKandera <KanderaDev@gmail.com>2012-07-10 17:27:13 -0400
committerKandera <KanderaDev@gmail.com>2012-07-10 17:27:13 -0400
commit0ac9c5b0399ee6fba0e2334ceddba87b0f67b053 (patch)
tree98f4098e23c6921e01124e3cfefb9ad40ee22072
parent450f9e7d99879903bc919981668b1ac847631bc2 (diff)
Core/Escort: few modifications to add the IMMUNE_TO_NPC flag after npc does a full reset.
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp11
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedEscortAI.h1
2 files changed, 10 insertions, 2 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
index 863040142be..c7751fc7383 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.cpp
@@ -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);
diff --git a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
index 24d15f9079b..7a7fab014dc 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
+++ b/src/server/game/AI/ScriptedAI/ScriptedEscortAI.h
@@ -120,6 +120,7 @@ struct npc_escortAI : public ScriptedAI
bool DespawnAtEnd;
bool DespawnAtFar;
bool ScriptWP;
+ bool HasImmuneToNPCFlags;
};
#endif