Merge [SD2]

r1321 Add support for quest 863.
      Some cleanup in existing script.
r1322 Correct database info for current supported Mangos revision (8273+) (Windows may use from 8190+) - skip
r1323 Make escortAI function IsPlayerOrGroupInRange and move existing code to this.
r1324 Fixed IsEncounterInProgress for Arcatraz, The Eye and Shadow Labyrinth
r1325 Renamed aunchindoun to auchindoun. Fixed comment typos.

--HG--
branch : trunk
This commit is contained in:
Kudlaty committed 2009-08-16 22:21:57 +02:00
1 parent 91f3d69edf
commit 5d2d8d8074
25 files changed
+362 -101

No files matched your search

+27 -25
View File
@@ -130,6 +130,32 @@ void npc_escortAI::EnterEvadeMode()
Reset();
}
bool npc_escortAI::IsPlayerOrGroupInRange()
{
if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))
{
if (Group* pGroup = pPlayer->GetGroup())
{
for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next())
{
Player* pMember = pRef->getSource();
if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance()))
{
return true;
break;
}
}
}
else
{
if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance()))
return true;
}
}
return false;
}
void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
//Waypoint Updating
@@ -194,31 +220,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff)
{
if (m_uiPlayerCheckTimer < uiDiff)
{
bool bIsMaxRangeExceeded = true;
if (Player* pPlayer = Unit::GetPlayer(PlayerGUID))
{
if (Group* pGroup = pPlayer->GetGroup())
{
for(GroupReference* pRef = pGroup->GetFirstMember(); pRef != NULL; pRef = pRef->next())
{
Player* pMember = pRef->getSource();
if (pMember && m_creature->IsWithinDistInMap(pMember, GetMaxPlayerDistance()))
{
bIsMaxRangeExceeded = false;
break;
}
}
}
else
{
if (m_creature->IsWithinDistInMap(pPlayer, GetMaxPlayerDistance()))
bIsMaxRangeExceeded = false;
}
}
if (DespawnAtFar && bIsMaxRangeExceeded)
if (DespawnAtFar && !IsPlayerOrGroupInRange())
{
debug_log("TSCR: EscortAI failed because player/group was to far away or not found");
+2
View File
@@ -56,6 +56,8 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI
// EscortAI functions
void AddWaypoint(uint32 id, float x, float y, float z, uint32 WaitTimeMs = 0);
bool IsPlayerOrGroupInRange();
void FillPointMovementListForCreature();
void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false);