From cad925e31d0cf71ead219d717ce34e6fea8be251 Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Mon, 17 Aug 2009 00:29:53 +0200 Subject: Merge [SD2] r1326 Correct waypoints and details for quest 863 r1327 Add function GetPlayerForEscort to escortAI (not used by escortAI yet) r1328 Updated 0.12 patch and redesigned Karathress for better maintenance. Fixed an issue with Karathres's speech and a little casting bug. - skip r1329 Remove use of old uint64 variable for player guid in escortAI and use function to retrieve pointer to player instead. r1330 Restore compile and use FailQuest instead of no longer existing FailTimedQuest (ref Mangos 8355). Move all waypoints to db --HG-- branch : trunk --- src/bindings/scripts/base/escort_ai.cpp | 14 +++++++------- src/bindings/scripts/base/escort_ai.h | 9 +++++++-- 2 files changed, 14 insertions(+), 9 deletions(-) (limited to 'src/bindings/scripts/base') diff --git a/src/bindings/scripts/base/escort_ai.cpp b/src/bindings/scripts/base/escort_ai.cpp index 37c8c31981b..34b4efcbe60 100644 --- a/src/bindings/scripts/base/escort_ai.cpp +++ b/src/bindings/scripts/base/escort_ai.cpp @@ -22,7 +22,7 @@ enum npc_escortAI::npc_escortAI(Creature* pCreature) : ScriptedAI(pCreature), IsBeingEscorted(false), IsOnHold(false), - PlayerGUID(0), + m_uiPlayerGUID(0), MaxPlayerDistance(DEFAULT_MAX_PLAYER_DISTANCE), CanMelee(true), m_uiPlayerCheckTimer(1000), @@ -63,10 +63,10 @@ void npc_escortAI::MoveInLineOfSight(Unit* pWho) void npc_escortAI::JustDied(Unit* pKiller) { - if (!IsBeingEscorted || !PlayerGUID || !m_pQuestForEscort) + if (!IsBeingEscorted || !m_uiPlayerGUID || !m_pQuestForEscort) return; - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (Group* pGroup = pPlayer->GetGroup()) { @@ -132,7 +132,7 @@ void npc_escortAI::EnterEvadeMode() bool npc_escortAI::IsPlayerOrGroupInRange() { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (Group* pGroup = pPlayer->GetGroup()) { @@ -216,7 +216,7 @@ void npc_escortAI::UpdateAI(const uint32 uiDiff) } //Check if player or any member of his group is within range - if (IsBeingEscorted && PlayerGUID && !m_creature->getVictim() && !m_bIsReturning) + if (IsBeingEscorted && m_uiPlayerGUID && !m_creature->getVictim() && !m_bIsReturning) { if (m_uiPlayerCheckTimer < uiDiff) { @@ -404,7 +404,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, m_bIsActiveAttacker = bIsActiveAttacker; m_bIsRunning = bRun; - PlayerGUID = uiPlayerGUID; + m_uiPlayerGUID = uiPlayerGUID; m_pQuestForEscort = pQuest; m_bCanInstantRespawn = bInstantRespawn; @@ -423,7 +423,7 @@ void npc_escortAI::Start(bool bIsActiveAttacker, bool bRun, uint64 uiPlayerGUID, //disable npcflags m_creature->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE); - debug_log("TSCR: EscortAI started with %d waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, PlayerGUID); + debug_log("TSCR: EscortAI started with %d waypoints. ActiveAttacker = %d, Run = %d, PlayerGUID = %d", WaypointList.size(), m_bIsActiveAttacker, m_bIsRunning, m_uiPlayerGUID); CurrentWP = WaypointList.begin(); diff --git a/src/bindings/scripts/base/escort_ai.h b/src/bindings/scripts/base/escort_ai.h index 243e64d6d21..60e555dcfd4 100644 --- a/src/bindings/scripts/base/escort_ai.h +++ b/src/bindings/scripts/base/escort_ai.h @@ -58,6 +58,11 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool IsPlayerOrGroupInRange(); + Player* GetPlayerForEscort() + { + return Unit::GetPlayer(m_uiPlayerGUID); + } + void FillPointMovementListForCreature(); void Start(bool bIsActiveAttacker = true, bool bRun = false, uint64 uiPlayerGUID = 0, const Quest* pQuest = NULL, bool bInstantRespawn = false, bool bCanLoopPath = false); @@ -76,15 +81,15 @@ struct TRINITY_DLL_DECL npc_escortAI : public ScriptedAI bool GetIsBeingEscorted() { return IsBeingEscorted; }//used in EnterEvadeMode override void SetReturning(bool returning) { m_bIsReturning = returning; }//used in EnterEvadeMode override void SetCanAttack(bool attack) { m_bIsActiveAttacker = attack; } - uint64 GetEventStarterGUID() { return PlayerGUID; } + uint64 GetEventStarterGUID() { return m_uiPlayerGUID; } // EscortAI variables protected: - uint64 PlayerGUID; bool IsBeingEscorted; bool IsOnHold; private: + uint64 m_uiPlayerGUID; uint32 m_uiWPWaitTimer; uint32 m_uiPlayerCheckTimer; float MaxPlayerDistance; -- cgit v1.2.3