diff options
author | Kudlaty <none@none> | 2009-08-17 00:29:53 +0200 |
---|---|---|
committer | Kudlaty <none@none> | 2009-08-17 00:29:53 +0200 |
commit | cad925e31d0cf71ead219d717ce34e6fea8be251 (patch) | |
tree | 08786b975491a8a7f1de610b326b35e5e5c16cd1 /src | |
parent | 5d2d8d8074eb7f845627fcc97645c8d0081be2ba (diff) |
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
Diffstat (limited to 'src')
29 files changed, 265 insertions, 598 deletions
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; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp index c5325da12d3..e9169ae60f6 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/arathi_highlands.cpp @@ -55,7 +55,10 @@ struct TRINITY_DLL_DECL npc_professor_phizzlethorpeAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; switch(uiPointId) { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp index 929fea7f41a..f63baa7a18f 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/eversong_woods.cpp @@ -52,7 +52,7 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI // Pure Virtual Functions void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -65,21 +65,14 @@ struct TRINITY_DLL_DECL npc_prospector_anvilwardAI : public npc_escortAI } } - void EnterCombat(Unit* who) { } - void Reset() { - m_creature->setFaction(35); + me->RestoreFaction(); } void JustDied(Unit* killer) { - m_creature->setFaction(35); - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + me->RestoreFaction(); } }; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp index 42122c1f002..849ed2e029a 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/ghostlands.cpp @@ -159,7 +159,7 @@ struct TRINITY_DLL_DECL npc_ranger_lilathaAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp index 6b661dad5ef..f8ae2bc66ff 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/hinterlands.cpp @@ -67,7 +67,7 @@ struct MANGOS_DLL_DECL npc_00x09hlAI : public npc_escortAI break; case 64: DoScriptText(SAY_OOX_COMPLETE, m_creature); - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, m_creature); break; } @@ -247,7 +247,7 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -283,7 +283,7 @@ struct TRINITY_DLL_DECL npc_rinjiAI : public npc_escortAI { m_uiPostEventTimer = 3000; - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Unit* pPlayer = GetPlayerForEscort()) { switch(m_uiPostEventCount) { diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp index 1a081a49050..96a4dbdc2c4 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/the_scarlet_enclave.cpp @@ -564,7 +564,7 @@ struct TRINITY_DLL_DECL npc_koltira_deathweaverAI : public npc_escortAI void JustSummoned(Creature* pSummoned) { - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { pSummoned->AI()->AttackStart(pPlayer); pSummoned->AddThreat(m_creature, 0.0f); diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp index 07b1979f87f..409d6702d2b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/silverpine_forest.cpp @@ -119,7 +119,7 @@ struct TRINITY_DLL_DECL npc_deathstalker_erlandAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -176,37 +176,7 @@ bool QuestAccept_npc_deathstalker_erland(Player* pPlayer, Creature* pCreature, Q CreatureAI* GetAI_npc_deathstalker_erlandAI(Creature* pCreature) { - npc_deathstalker_erlandAI* deathstalker_erlandAI = new npc_deathstalker_erlandAI(pCreature); - - deathstalker_erlandAI->AddWaypoint(0, 1406.32, 1083.10, 52.55); - deathstalker_erlandAI->AddWaypoint(1, 1400.49, 1080.42, 52.50); //first say - deathstalker_erlandAI->AddWaypoint(2, 1388.48, 1083.10, 52.52); - deathstalker_erlandAI->AddWaypoint(3, 1370.16, 1084.02, 52.30); - deathstalker_erlandAI->AddWaypoint(4, 1359.02, 1080.85, 52.46); - deathstalker_erlandAI->AddWaypoint(5, 1341.43, 1087.39, 52.69); - deathstalker_erlandAI->AddWaypoint(6, 1321.93, 1090.51, 50.66); - deathstalker_erlandAI->AddWaypoint(7, 1312.98, 1095.91, 47.49); - deathstalker_erlandAI->AddWaypoint(8, 1301.09, 1102.94, 47.76); - deathstalker_erlandAI->AddWaypoint(9, 1297.73, 1106.35, 50.18); - deathstalker_erlandAI->AddWaypoint(10, 1295.49, 1124.32, 50.49); - deathstalker_erlandAI->AddWaypoint(11, 1294.84, 1137.25, 51.75); - deathstalker_erlandAI->AddWaypoint(12, 1292.89, 1158.99, 52.65); - deathstalker_erlandAI->AddWaypoint(13, 1290.75, 1168.67, 52.56, 1000); //complete quest and say last - deathstalker_erlandAI->AddWaypoint(14, 1287.12, 1203.49, 52.66, 5000); - deathstalker_erlandAI->AddWaypoint(15, 1287.12, 1203.49, 52.66, 4000); - deathstalker_erlandAI->AddWaypoint(16, 1287.12, 1203.49, 52.66, 5000); - deathstalker_erlandAI->AddWaypoint(17, 1287.12, 1203.49, 52.66, 4000); - deathstalker_erlandAI->AddWaypoint(18, 1290.72, 1207.44, 52.69); - deathstalker_erlandAI->AddWaypoint(19, 1297.50, 1207.18, 53.74); - deathstalker_erlandAI->AddWaypoint(20, 1301.32, 1220.90, 53.74); - deathstalker_erlandAI->AddWaypoint(21, 1298.55, 1220.43, 53.74); - deathstalker_erlandAI->AddWaypoint(22, 1297.59, 1211.23, 58.47); - deathstalker_erlandAI->AddWaypoint(23, 1305.01, 1206.10, 58.51); - deathstalker_erlandAI->AddWaypoint(24, 1310.51, 1207.36, 58.51, 5000); - deathstalker_erlandAI->AddWaypoint(25, 1310.51, 1207.36, 58.51, 5000); - deathstalker_erlandAI->AddWaypoint(26, 1310.51, 1207.36, 58.51, 2000); - - return deathstalker_erlandAI; + return new npc_deathstalker_erlandAI(pCreature); } /*###### diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp index d6cbea99fb5..0799f745a70 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/westfall.cpp @@ -73,7 +73,7 @@ struct TRINITY_DLL_DECL npc_daphne_stilwellAI : public npc_escortAI void WaypointReached(uint32 uiPoint) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -197,7 +197,7 @@ struct TRINITY_DLL_DECL npc_defias_traitorAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp index 4a9d944cb3e..3568c7e555b 100644 --- a/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp +++ b/src/bindings/scripts/scripts/eastern_kingdoms/wetlands.cpp @@ -70,7 +70,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI void Aggro(Unit* pWho) { - Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (IsBeingEscorted && !m_bFriendSummoned && pPlayer) { @@ -83,7 +83,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI void JustSummoned(Creature* pSummoned) { - if (Unit* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pSummoned->AI()->AttackStart(pPlayer); } @@ -102,7 +102,7 @@ struct TRINITY_DLL_DECL npc_tapoke_slim_jahnAI : public npc_escortAI { if (m_creature->GetHealth()*100 < m_creature->GetMaxHealth()*20) { - if (Unit* pPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (pPlayer->GetTypeId() == TYPEID_PLAYER) CAST_PLR(pPlayer)->GroupEventHappens(QUEST_MISSING_DIPLO_PT11, m_creature); diff --git a/src/bindings/scripts/scripts/examples/example_escort.cpp b/src/bindings/scripts/scripts/examples/example_escort.cpp index e603d3ce79c..4fdc1b7e1ad 100644 --- a/src/bindings/scripts/scripts/examples/example_escort.cpp +++ b/src/bindings/scripts/scripts/examples/example_escort.cpp @@ -76,12 +76,12 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI m_creature->SummonCreature(NPC_FELBOAR, m_creature->GetPositionX()+5.0f, m_creature->GetPositionY()+7.0f, m_creature->GetPositionZ(), 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 3000); break; case 4: - if (Unit* pTmpPlayer = Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { //pTmpPlayer is the target of the text - DoScriptText(SAY_WP_3, m_creature, pTmpPlayer); + DoScriptText(SAY_WP_3, m_creature, pPlayer); //pTmpPlayer is the source of the text - DoScriptText(SAY_WP_4, pTmpPlayer); + DoScriptText(SAY_WP_4, pPlayer); } break; } @@ -91,8 +91,8 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI { if (IsBeingEscorted) { - if (Unit* pTemp = Unit::GetUnit(*m_creature, PlayerGUID)) - DoScriptText(SAY_AGGRO1, m_creature, pTemp); + if (Player* pPlayer = GetPlayerForEscort()) + DoScriptText(SAY_AGGRO1, m_creature, pPlayer); } else DoScriptText(SAY_AGGRO2, m_creature); @@ -108,15 +108,15 @@ struct TRINITY_DLL_DECL example_escortAI : public npc_escortAI { if (IsBeingEscorted) { - if (Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { // not a likely case, code here for the sake of example if (pKiller == m_creature) { - DoScriptText(SAY_DEATH_1, m_creature, pTemp); + DoScriptText(SAY_DEATH_1, m_creature, pPlayer); } else - DoScriptText(SAY_DEATH_2, m_creature, pTemp); + DoScriptText(SAY_DEATH_2, m_creature, pPlayer); } } else diff --git a/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp b/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp index 88572bf3463..7bb193b98be 100644 --- a/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ashenvale.cpp @@ -59,7 +59,7 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -81,8 +81,8 @@ struct TRINITY_DLL_DECL npc_torekAI : public npc_escortAI case 20: DoScriptText(SAY_WIN, m_creature, pPlayer); Completed = true; - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_TOREK_ASSULT,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_TOREK_ASSULT, m_creature); break; case 21: DoScriptText(SAY_END, m_creature, pPlayer); @@ -160,7 +160,7 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -185,8 +185,8 @@ struct TRINITY_DLL_DECL npc_ruul_snowhoofAI : public npc_escortAI break; case 21:{ - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_FREEDOM_TO_RUUL,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_FREEDOM_TO_RUUL, m_creature); break; } } diff --git a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp index 0e21a4b310d..f881715ca64 100644 --- a/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp +++ b/src/bindings/scripts/scripts/kalimdor/azuremyst_isle.cpp @@ -338,7 +338,7 @@ struct TRINITY_DLL_DECL npc_magwinAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; diff --git a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp index 7c0290fe565..d8471deb96b 100644 --- a/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp +++ b/src/bindings/scripts/scripts/kalimdor/caverns_of_time/old_hillsbrad/old_hillsbrad.cpp @@ -329,14 +329,11 @@ struct TRINITY_DLL_DECL npc_thrall_old_hillsbradAI : public npc_escortAI case 106: { - if (!PlayerGUID) - break; - //trigger taretha to run down outside - if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA))) { - if (Creature* Taretha = (Unit::GetCreature(*m_creature, TarethaGUID))) - CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, PlayerGUID); + if (Player* pPlayer = GetPlayerForEscort()) + CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); } //kill credit Creature for quest diff --git a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp index 6c2520cd8b5..8ff16a53832 100644 --- a/src/bindings/scripts/scripts/kalimdor/darkshore.cpp +++ b/src/bindings/scripts/scripts/kalimdor/darkshore.cpp @@ -62,7 +62,7 @@ struct TRINITY_DLL_DECL npc_prospector_remtravelAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -136,11 +136,6 @@ struct TRINITY_DLL_DECL npc_prospector_remtravelAI : public npc_escortAI //unsure if it should be any //pSummoned->AI()->AttackStart(m_creature); } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; CreatureAI* GetAI_npc_prospector_remtravel(Creature* pCreature) diff --git a/src/bindings/scripts/scripts/kalimdor/feralas.cpp b/src/bindings/scripts/scripts/kalimdor/feralas.cpp index 08c00a9a5a7..99090b06039 100644 --- a/src/bindings/scripts/scripts/kalimdor/feralas.cpp +++ b/src/bindings/scripts/scripts/kalimdor/feralas.cpp @@ -111,7 +111,7 @@ struct TRINITY_DLL_DECL npc_oox22feAI : public npc_escortAI case 37: DoScriptText(SAY_END,m_creature); // Award quest credit - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { pPlayer->GroupEventHappens(QUEST_RESCUE_OOX22FE, m_creature); } diff --git a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp index 5c51e64f5a2..b24a51cb3cb 100644 --- a/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp +++ b/src/bindings/scripts/scripts/kalimdor/razorfen_kraul/razorfen_kraul.cpp @@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -114,16 +114,8 @@ struct TRINITY_DLL_DECL npc_willixAI : public npc_escortAI void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); - } - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (Player* pPlayer = GetPlayerForEscort()) + CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); } }; @@ -181,57 +173,7 @@ CreatureAI* GetAI_npc_deaths_head_ward_keeper(Creature* pCreature) CreatureAI* GetAI_npc_willix(Creature* pCreature) { - npc_willixAI* thisAI = new npc_willixAI(pCreature); - - thisAI->AddWaypoint(0, 2194.38, 1791.65, 65.48, 5000); - thisAI->AddWaypoint(1, 2188.56, 1805.87, 64.45); - thisAI->AddWaypoint(2, 2187, 1843.49, 59.33); - thisAI->AddWaypoint(3, 2163.27, 1851.67, 56.73, 5000); - thisAI->AddWaypoint(4, 2137.66, 1843.98, 48.08, 5000); - thisAI->AddWaypoint(5, 2140.22, 1845.02, 48.32); - thisAI->AddWaypoint(6, 2131.5, 1804.29, 46.85); - thisAI->AddWaypoint(7, 2096.18, 1789.03, 51.13); - thisAI->AddWaypoint(8, 2074.46, 1780.09, 55.64, 3000); - thisAI->AddWaypoint(9, 2055.12, 1768.67, 58.46, 5000); - thisAI->AddWaypoint(10, 2037.83, 1748.62, 60.27); - thisAI->AddWaypoint(11, 2037.51, 1728.94, 60.85); - thisAI->AddWaypoint(12, 2044.7, 1711.71, 59.71); - thisAI->AddWaypoint(13, 2067.66, 1701.84, 57.77, 3000); - thisAI->AddWaypoint(14, 2078.91, 1704.54, 56.77, 3000); - thisAI->AddWaypoint(15, 2097.65, 1715.24, 54.74); - thisAI->AddWaypoint(16, 2106.44, 1720.98, 54.41); - thisAI->AddWaypoint(17, 2123.96, 1732.56, 52.27); - thisAI->AddWaypoint(18, 2153.82, 1728.73, 51.92); - thisAI->AddWaypoint(19, 2163.49, 1706.33, 54.42); - thisAI->AddWaypoint(20, 2158.75, 1695.98, 55.70); - thisAI->AddWaypoint(21, 2142.6, 1680.72, 58.24); - thisAI->AddWaypoint(22, 2118.31, 1671.54, 59.21); - thisAI->AddWaypoint(23, 2086.02, 1672.04, 61.24); - thisAI->AddWaypoint(24, 2068.81, 1658.93, 61.24); - thisAI->AddWaypoint(25, 2062.82, 1633.31, 64.35, 3000); - thisAI->AddWaypoint(26, 2063.05, 1589.16, 63.26); - thisAI->AddWaypoint(27, 2063.67, 1577.22, 65.89); - thisAI->AddWaypoint(28, 2057.94, 1560.68, 68.40); - thisAI->AddWaypoint(29, 2052.56, 1548.05, 73.35); - thisAI->AddWaypoint(30, 2045.22, 1543.4, 76.65); - thisAI->AddWaypoint(31, 2034.35, 1543.01, 79.70); - thisAI->AddWaypoint(32, 2029.95, 1542.94, 80.79); - thisAI->AddWaypoint(33, 2021.34, 1538.67, 80.8); - thisAI->AddWaypoint(34, 2012.45, 1549.48, 79.93); - thisAI->AddWaypoint(35, 2008.05, 1554.92, 80.44); - thisAI->AddWaypoint(36, 2006.54, 1562.72, 81.11); - thisAI->AddWaypoint(37, 2003.8, 1576.43, 81.57); - thisAI->AddWaypoint(38, 2000.57, 1590.06, 80.62); - thisAI->AddWaypoint(39, 1998.96, 1596.87, 80.22); - thisAI->AddWaypoint(40, 1991.19, 1600.82, 79.39); - thisAI->AddWaypoint(41, 1980.71, 1601.44, 79.77, 3000); - thisAI->AddWaypoint(42, 1967.22, 1600.18, 80.62, 3000); - thisAI->AddWaypoint(43, 1956.43, 1596.97, 81.75, 3000); - thisAI->AddWaypoint(44, 1954.87, 1592.02, 82.18); - thisAI->AddWaypoint(45, 1948.35, 1571.35, 80.96, 30000); - thisAI->AddWaypoint(46, 1947.02, 1566.42, 81.80, 30000); - - return thisAI; + return new npc_willixAI(pCreature); } void AddSC_razorfen_kraul() diff --git a/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp b/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp index 2b927af4852..272cef3d33b 100644 --- a/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp +++ b/src/bindings/scripts/scripts/kalimdor/stonetalon_mountains.cpp @@ -101,7 +101,7 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -116,8 +116,8 @@ struct TRINITY_DLL_DECL npc_kaya_flathoofAI : public npc_escortAI break; case 18: m_creature->SetInFront(pPlayer); DoScriptText(SAY_END, m_creature, pPlayer); - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_PROTECT_KAYA, m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_PROTECT_KAYA, m_creature); break; } } diff --git a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp index 9745fce9966..813e178b6f0 100644 --- a/src/bindings/scripts/scripts/kalimdor/tanaris.cpp +++ b/src/bindings/scripts/scripts/kalimdor/tanaris.cpp @@ -153,7 +153,7 @@ struct TRINITY_DLL_DECL npc_custodian_of_timeAI : public npc_escortAI void WaypointReached(uint32 i) { - Player *pPlayer = Unit::GetPlayer(PlayerGUID); + Player *pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -357,7 +357,7 @@ struct TRINITY_DLL_DECL npc_OOX17AI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -424,97 +424,7 @@ bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* qu CreatureAI* GetAI_npc_OOX17(Creature* pCreature) { - npc_OOX17AI* OOX17AI = new npc_OOX17AI(pCreature); - - OOX17AI->AddWaypoint(0, -8843.73, -4374.44, 43.71); - OOX17AI->AddWaypoint(1, -8834.68, -4373.88, 45.71); - OOX17AI->AddWaypoint(2, -8832.93, -4373.85, 45.67); - OOX17AI->AddWaypoint(3, -8829.21, -4373.72, 44.14); - OOX17AI->AddWaypoint(4, -8825.10, -4373.56, 41.44); - OOX17AI->AddWaypoint(5, -8818.88, -4372.75, 36.43); - OOX17AI->AddWaypoint(6, -8803.37, -4369.68, 30.06); - OOX17AI->AddWaypoint(7, -8786.68, -4366.18, 23.91); - OOX17AI->AddWaypoint(8, -8764.97, -4366.94, 25.23); - OOX17AI->AddWaypoint(9, -8745.49, -4363.16, 22.80); - OOX17AI->AddWaypoint(10, -8724.13, -4353.55, 20.72); - OOX17AI->AddWaypoint(11, -8706.77, -4346.14, 16.12); - OOX17AI->AddWaypoint(12, -8688.27, -4372.85, 13.64); - OOX17AI->AddWaypoint(13, -8668.76, -4380.38, 11.69); - OOX17AI->AddWaypoint(14, -8645.19, -4388.62, 12.56); - OOX17AI->AddWaypoint(15, -8614.73, -4398.60, 9.86); - OOX17AI->AddWaypoint(16, -8560.33, -4411.27, 13.17); - OOX17AI->AddWaypoint(17, -8536.45, -4416.49, 11.84); - OOX17AI->AddWaypoint(18, -8503.48, -4423.70, 13.59); - OOX17AI->AddWaypoint(19, -8471.91, -4430.60, 9.56); - OOX17AI->AddWaypoint(20, -8441.36, -4435.31, 9.40); - OOX17AI->AddWaypoint(21, -8403.41, -4441.16, 11.83); - OOX17AI->AddWaypoint(22, -8371.24, -4446.13, 9.47); - OOX17AI->AddWaypoint(23, -8353.96, -4448.79, 10.10); //Scorpid - OOX17AI->AddWaypoint(24, -8336.40, -4446.39, 8.98); - OOX17AI->AddWaypoint(25, -8303.78, -4441.96, 11.89); - OOX17AI->AddWaypoint(26, -8272.20, -4433.31, 9.60); - OOX17AI->AddWaypoint(27, -8224.76, -4419.39, 13.03); - OOX17AI->AddWaypoint(28, -8193.31, -4406.04, 10.17); - OOX17AI->AddWaypoint(29, -8155.65, -4397.74, 8.99); - OOX17AI->AddWaypoint(30, -8129.25, -4394.57, 10.92); - OOX17AI->AddWaypoint(31, -8104.86, -4399.03, 8.93); - OOX17AI->AddWaypoint(32, -8063.15, -4423.40, 10.07); - OOX17AI->AddWaypoint(33, -8032.15, -4443.47, 9.97); - OOX17AI->AddWaypoint(34, -8015.39, -4454.33, 9.39); - OOX17AI->AddWaypoint(35, -7981.64, -4482.44, 10.32); - OOX17AI->AddWaypoint(36, -7958.83, -4503.98, 9.69); - OOX17AI->AddWaypoint(37, -7932.45, -4528.91, 10.08); - OOX17AI->AddWaypoint(38, -7904.09, -4566.67, 12.59); - OOX17AI->AddWaypoint(39, -7883.33, -4593.91, 12.15); - OOX17AI->AddWaypoint(40, -7862.83, -4624.53, 10.21); - OOX17AI->AddWaypoint(41, -7840.79, -4654.26, 9.45); - OOX17AI->AddWaypoint(42, -7826.17, -4673.99, 10.61); - OOX17AI->AddWaypoint(43, -7807.86, -4698.69, 11.24); - OOX17AI->AddWaypoint(44, -7793.88, -4717.55, 10.48); - OOX17AI->AddWaypoint(45, -7778.68, -4738.05, 8.89); - OOX17AI->AddWaypoint(46, -7746.42, -4780.39, 9.84); - OOX17AI->AddWaypoint(47, -7724.11, -4772.75, 10.28); - OOX17AI->AddWaypoint(48, -7697.98, -4763.80, 9.52); - OOX17AI->AddWaypoint(49, -7665.33, -4752.62, 10.56); - OOX17AI->AddWaypoint(50, -7641.47, -4750.33, 8.94); - OOX17AI->AddWaypoint(51, -7620.08, -4753.96, 8.93); - OOX17AI->AddWaypoint(52, -7603.15, -4757.53, 9.06); - OOX17AI->AddWaypoint(53, -7579.43, -4767.07, 8.93); - OOX17AI->AddWaypoint(54, -7558.51, -4779.01, 9.64); - OOX17AI->AddWaypoint(55, -7536.40, -4789.32, 8.92); - OOX17AI->AddWaypoint(56, -7512.07, -4793.50, 9.35); //Wastewander - OOX17AI->AddWaypoint(57, -7490.79, -4788.80, 10.53); - OOX17AI->AddWaypoint(58, -7469.10, -4785.11, 10.42); - OOX17AI->AddWaypoint(59, -7453.18, -4782.41, 9.15); - OOX17AI->AddWaypoint(60, -7426.27, -4777.83, 9.54); - OOX17AI->AddWaypoint(61, -7393.84, -4770.19, 12.57); - OOX17AI->AddWaypoint(62, -7367.25, -4764.17, 11.92); - OOX17AI->AddWaypoint(63, -7341.00, -4752.11, 10.17); - OOX17AI->AddWaypoint(64, -7321.62, -4744.97, 11.58); - OOX17AI->AddWaypoint(65, -7302.35, -4744.35, 11.97); - OOX17AI->AddWaypoint(66, -7281.00, -4743.66, 11.21); - OOX17AI->AddWaypoint(67, -7258.33, -4742.93, 9.64); - OOX17AI->AddWaypoint(68, -7236.70, -4742.24, 10.16); - OOX17AI->AddWaypoint(69, -7217.52, -4743.87, 10.79); - OOX17AI->AddWaypoint(70, -7201.86, -4746.32, 9.58); - OOX17AI->AddWaypoint(71, -7182.01, -4749.41, 9.09); - OOX17AI->AddWaypoint(72, -7159.61, -4752.90, 9.52); - OOX17AI->AddWaypoint(73, -7139.58, -4756.02, 9.53); - OOX17AI->AddWaypoint(74, -7122.60, -4754.91, 9.66); - OOX17AI->AddWaypoint(75, -7101.06, -4753.87, 8.92); - OOX17AI->AddWaypoint(76, -7082.79, -4752.99, 9.97); - OOX17AI->AddWaypoint(77, -7061.81, -4751.98, 9.26); - OOX17AI->AddWaypoint(78, -7035.12, -4754.39, 9.19); - OOX17AI->AddWaypoint(79, -7013.90, -4758.64, 10.28); - OOX17AI->AddWaypoint(80, -7001.71, -4769.73, 10.59); - OOX17AI->AddWaypoint(81, -6984.95, -4788.61, 9.30); - OOX17AI->AddWaypoint(82, -6970.41, -4788.77, 9.42); - OOX17AI->AddWaypoint(83, -6957.16, -4788.92, 6.26); - OOX17AI->AddWaypoint(84, -6951.29, -4802.73, 4.45); - OOX17AI->AddWaypoint(85, -6944.81, -4816.58, 1.60); - OOX17AI->AddWaypoint(86, -6942.06, -4839.40, 0.66,5000); - - return OOX17AI; + return new npc_OOX17AI(pCreature); } /*#### @@ -631,8 +541,7 @@ struct MANGOS_DLL_DECL npc_toogaAI : public ScriptedAI void JustRespawned() { - if (m_creature->getFaction() != m_creature->GetCreatureInfo()->faction_A) - m_creature->setFaction(m_creature->GetCreatureInfo()->faction_A); + me->RestoreFaction(); m_creature->SetUInt32Value(UNIT_NPC_FLAGS, m_creature->GetCreatureInfo()->npcflag); @@ -684,7 +593,10 @@ struct MANGOS_DLL_DECL npc_toogaAI : public ScriptedAI void JustDied(Unit* pKiller) { if (Player* pPlayer = Unit::GetPlayer(m_uiPlayerGUID)) - pPlayer->FailQuest(QUEST_TOOGA); + { + if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(QUEST_TOOGA); + } m_uiPlayerGUID = 0; m_creature->GetMotionMaster()->MovementExpired(); diff --git a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp index d17d0b06cd1..d957ba26ae7 100644 --- a/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp +++ b/src/bindings/scripts/scripts/kalimdor/the_barrens.cpp @@ -94,7 +94,7 @@ struct TRINITY_DLL_DECL npc_giltharesAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -507,75 +507,143 @@ CreatureAI* GetAI_npc_twiggy_flathead(Creature* pCreature) enum { - SAY_PROGRESS_1 = -1000272, - SAY_PROGRESS_2 = -1000273, - SAY_PROGRESS_3 = -1000274, - - SAY_MERCENARY_4 = -1000275, - - SAY_PROGRESS_5 = -1000276, - SAY_PROGRESS_6 = -1000277, - SAY_PROGRESS_7 = -1000278, - SAY_PROGRESS_8 = -1000279, + SAY_START = -1000272, + SAY_STARTUP1 = -1000273, + SAY_STARTUP2 = -1000274, + SAY_MERCENARY = -1000275, + SAY_PROGRESS_1 = -1000276, + SAY_PROGRESS_2 = -1000277, + SAY_PROGRESS_3 = -1000278, + SAY_END = -1000279, QUEST_ESCAPE = 863, FACTION_RATCHET = 637, - NPC_PILOT = 3451, - MOB_MERCENARY = 3282, + NPC_PILOT_WIZZ = 3451, + NPC_MERCENARY = 3282, }; struct TRINITY_DLL_DECL npc_wizzlecrank_shredderAI : public npc_escortAI { - npc_wizzlecrank_shredderAI(Creature* c) : npc_escortAI(c) { } + npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature) + { + m_bIsPostEvent = false; + m_uiPostEventTimer = 1000; + m_uiPostEventCount = 0; + } - bool Completed; + bool m_bIsPostEvent; + uint32 m_uiPostEventTimer; + uint32 m_uiPostEventCount; - void WaypointReached(uint32 i) + void Reset() { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + if (!IsBeingEscorted) + { + if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) + m_creature->SetStandState(UNIT_STAND_STATE_STAND); + + m_bIsPostEvent = false; + m_uiPostEventTimer = 1000; + m_uiPostEventCount = 0; + } + } + + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; - switch(i) + switch(uiPointId) { - case 0: DoScriptText(SAY_PROGRESS_1, m_creature); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 1: DoScriptText(SAY_PROGRESS_2, m_creature); break; - case 10: DoScriptText(SAY_PROGRESS_3, m_creature, pPlayer); - m_creature->AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 20:{ - Unit* Mercenary = m_creature->FindNearestCreature(MOB_MERCENARY, 99); - if (Mercenary) + case 0: + DoScriptText(SAY_STARTUP1, m_creature); + break; + case 9: + SetRun(false); + break; + case 17: + if (Creature* pTemp = m_creature->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) { - DoScriptText(SAY_MERCENARY_4, Mercenary); - CAST_CRE(Mercenary)->AI()->AttackStart(m_creature); - AttackStart(Mercenary); + DoScriptText(SAY_MERCENARY, pTemp); + m_creature->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); } - }break; - case 21: DoScriptText(SAY_PROGRESS_5, m_creature); - m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); break; - case 28: DoScriptText(SAY_PROGRESS_6, m_creature); break; - case 29: DoScriptText(SAY_PROGRESS_7, m_creature); break; - case 30: DoScriptText(SAY_PROGRESS_8, m_creature); break; - case 31: m_creature->SummonCreature(NPC_PILOT, 1088.77, -2985.39, 91.84, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 300000); - m_creature->setDeathState(JUST_DIED); - Completed = true; - pPlayer->GroupEventHappens(QUEST_ESCAPE, m_creature); + break; + case 24: + m_bIsPostEvent = true; break; } } - void Reset() + void WaypointStart(uint32 uiPointId) { - m_creature->setDeathState(ALIVE); - Completed = false; - if (!IsBeingEscorted) + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) { - if (m_creature->getStandState() == UNIT_STAND_STATE_DEAD) - m_creature->SetStandState(UNIT_STAND_STATE_STAND); + case 9: + DoScriptText(SAY_STARTUP2, m_creature, pPlayer); + break; + case 18: + DoScriptText(SAY_PROGRESS_1, m_creature, pPlayer); + SetRun(); + break; } } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_PILOT_WIZZ) + m_creature->SetStandState(UNIT_STAND_STATE_DEAD); + + if (pSummoned->GetEntry() == NPC_MERCENARY) + pSummoned->AI()->AttackStart(m_creature); + } + + void UpdateEscortAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + { + if (m_bIsPostEvent) + { + if (m_uiPostEventTimer < uiDiff) + { + switch(m_uiPostEventCount) + { + case 0: + DoScriptText(SAY_PROGRESS_2, m_creature); + break; + case 1: + DoScriptText(SAY_PROGRESS_3, m_creature); + break; + case 2: + DoScriptText(SAY_END, m_creature); + break; + case 3: + if (Player* pPlayer = GetPlayerForEscort()) + { + pPlayer->GroupEventHappens(QUEST_ESCAPE, m_creature); + m_creature->SummonCreature(NPC_PILOT_WIZZ, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); + } + break; + } + + ++m_uiPostEventCount; + m_uiPostEventTimer = 5000; + } + else + m_uiPostEventTimer -= uiDiff; + } + + return; + } + + DoMeleeAttackIfReady(); + } }; bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, Quest const* quest) @@ -591,42 +659,7 @@ bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature* pCreature) { - npc_wizzlecrank_shredderAI* thisAI = new npc_wizzlecrank_shredderAI(pCreature); - - thisAI->AddWaypoint(0, 1109.15, -3104.11, 82.41, 6000); - thisAI->AddWaypoint(1, 1105.39, -3102.86, 82.74, 2000); - thisAI->AddWaypoint(2, 1104.97, -3108.52, 83.10, 1000); - thisAI->AddWaypoint(3, 1110.01, -3110.48, 82.81, 1000); - thisAI->AddWaypoint(4, 1111.72, -3103.03, 82.21, 1000); - thisAI->AddWaypoint(5, 1106.98, -3099.44, 82.18, 1000); - thisAI->AddWaypoint(6, 1103.74, -3103.29, 83.05, 1000); - thisAI->AddWaypoint(7, 1112.55, -3106.56, 82.31, 1000); - thisAI->AddWaypoint(8, 1108.12, -3111.04, 82.99, 1000); - thisAI->AddWaypoint(9, 1109.32, -3100.39, 82.08, 1000); - thisAI->AddWaypoint(10, 1109.32, -3100.39, 82.08, 6000); - thisAI->AddWaypoint(11, 1098.92, -3095.14, 82.97); - thisAI->AddWaypoint(12, 1100.94, -3082.60, 82.83); - thisAI->AddWaypoint(13, 1101.12, -3068.83, 82.53); - thisAI->AddWaypoint(14, 1096.97, -3051.99, 82.50); - thisAI->AddWaypoint(15, 1094.06, -3036.79, 82.70); - thisAI->AddWaypoint(16, 1098.22, -3027.84, 83.79); - thisAI->AddWaypoint(17, 1109.51, -3015.92, 85.73); - thisAI->AddWaypoint(18, 1119.87, -3007.21, 87.08); - thisAI->AddWaypoint(19, 1130.23, -3002.49, 91.27, 5000); - thisAI->AddWaypoint(20, 1130.23, -3002.49, 91.27, 3000); - thisAI->AddWaypoint(21, 1130.23, -3002.49, 91.27, 4000); - thisAI->AddWaypoint(22, 1129.73, -2985.89, 92.46); - thisAI->AddWaypoint(23, 1124.10, -2983.29, 92.81); - thisAI->AddWaypoint(24, 1111.74, -2992.38, 91.59); - thisAI->AddWaypoint(25, 1111.06, -2976.54, 91.81); - thisAI->AddWaypoint(26, 1099.91, -2991.17, 91.67); - thisAI->AddWaypoint(27, 1096.32, -2981.55, 91.73); - thisAI->AddWaypoint(28, 1091.28, -2985.82, 91.74, 4000); - thisAI->AddWaypoint(29, 1091.28, -2985.82, 91.74, 3000); - thisAI->AddWaypoint(30, 1091.28, -2985.82, 91.74, 7000); - thisAI->AddWaypoint(31, 1091.28, -2985.82, 91.74, 3000); - - return thisAI; + return new npc_wizzlecrank_shredderAI(pCreature); } void AddSC_the_barrens() diff --git a/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp b/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp index be0c2db5aa9..24e6a21e743 100644 --- a/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp +++ b/src/bindings/scripts/scripts/kalimdor/thousand_needles.cpp @@ -60,7 +60,7 @@ struct TRINITY_DLL_DECL npc_kanatiAI : public npc_escortAI DoSpawnGalak(); break; case 1: - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_PROTECT_KANATI, m_creature); break; } @@ -149,7 +149,7 @@ struct TRINITY_DLL_DECL npc_lakota_windsongAI : public npc_escortAI DoSpawnBandits(ID_AMBUSH_3); break; case 45: - if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_FREE_AT_LAST, m_creature); break; } @@ -222,7 +222,7 @@ struct TRINITY_DLL_DECL npc_paoka_swiftmountainAI : public npc_escortAI DoScriptText(SAY_COMPLETE, m_creature); break; case 27: - if (Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_HOMEWARD, m_creature); break; } diff --git a/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp b/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp index 323faf67814..81f122d61db 100644 --- a/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp +++ b/src/bindings/scripts/scripts/kalimdor/ungoro_crater.cpp @@ -51,7 +51,7 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -76,21 +76,18 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI break; case 55: DoScriptText(SAY_FINISH, m_creature, pPlayer); - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_CHASING_AME,m_creature); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_CHASING_AME,m_creature); break; } - } + } void Reset() { DEMORALIZINGSHOUT_Timer = 5000; } - void EnterCombat(Unit* who) - {} - void JustSummoned(Creature* summoned) { summoned->AI()->AttackStart(m_creature); @@ -98,11 +95,8 @@ struct TRINITY_DLL_DECL npc_ameAI : public npc_escortAI void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(QUEST_CHASING_AME); - } + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(QUEST_CHASING_AME); } void UpdateAI(const uint32 diff) @@ -135,66 +129,7 @@ bool QuestAccept_npc_ame(Player* pPlayer, Creature* pCreature, Quest const* ques CreatureAI* GetAI_npc_ame(Creature* pCreature) { - npc_ameAI* thisAI = new npc_ameAI(pCreature); - - thisAI->AddWaypoint(1, -6380.38, -1965.14, -258.292, 5000); - thisAI->AddWaypoint(2, -6383.06, -1962.9, -258.936); - thisAI->AddWaypoint(3, -6391.09, -1956.13, -260.291); - thisAI->AddWaypoint(4, -6395.29, -1933.58, -262.949); - thisAI->AddWaypoint(5, -6396.58, -1919.93, -263.838); - thisAI->AddWaypoint(6, -6389.01, -1912.64, -260.689); - thisAI->AddWaypoint(7, -6369.19, -1892.87, -255.924); - thisAI->AddWaypoint(8, -6373.77, -1879.36, -259.268); - thisAI->AddWaypoint(9, -6377.55, -1869.56, -260.503); - thisAI->AddWaypoint(10, -6376.58, -1860.79, -260.026); - thisAI->AddWaypoint(11, -6373.13, -1847.22, -259.249); - thisAI->AddWaypoint(12, -6370.54, -1837.04, -260.007); - thisAI->AddWaypoint(13, -6372.52, -1829.16, -260.071); - thisAI->AddWaypoint(14, -6377.13, -1815.94, -262.632); - thisAI->AddWaypoint(15, -6380.27, -1806.95, -265.53); - thisAI->AddWaypoint(16, -6386.04, -1790.43, -268.546); - thisAI->AddWaypoint(17, -6386.72, -1776.29, -269.851); - thisAI->AddWaypoint(18, -6385.92, -1762.31, -271.494); - thisAI->AddWaypoint(19, -6384.69, -1744.86, -272.196); - thisAI->AddWaypoint(20, -6383.8, -1732.66, -272.222); - thisAI->AddWaypoint(21, -6382.66, -1716.96, -272.235); - thisAI->AddWaypoint(22, -6381.5, -1703.01, -272.964); - thisAI->AddWaypoint(23, -6379.96, -1685.58, -272.842); - thisAI->AddWaypoint(24, -6379.34, -1678.61, -272.34); - thisAI->AddWaypoint(25, -6364.45, -1636.27, -271.065); - thisAI->AddWaypoint(26, -6371.85, -1626.36, -272.188); - thisAI->AddWaypoint(27, -6383.5, -1629.01, -272.206); - thisAI->AddWaypoint(28, -6388.09, -1635.37, -272.105, 5000); - thisAI->AddWaypoint(29, -6375.42, -1637.33, -272.193); - thisAI->AddWaypoint(30, -6365.46, -1617.25, -272.141); - thisAI->AddWaypoint(31, -6353.79, -1603.48, -271.932); - thisAI->AddWaypoint(32, -6340.24, -1592.41, -269.435); - thisAI->AddWaypoint(33, -6329.45, -1566.89, -269.895); - thisAI->AddWaypoint(34, -6312.2, -1499.06, -269.507); - thisAI->AddWaypoint(35, -6304.55, -1468.5, -269.431); - thisAI->AddWaypoint(36, -6310.36, -1440.94, -268.427); - thisAI->AddWaypoint(37, -6321, -1418.91, -266.525); - thisAI->AddWaypoint(38, -6358.76, -1389.97, -267.522); - thisAI->AddWaypoint(39, -6378.65, -1375.67, -271.749); - thisAI->AddWaypoint(40, -6387.22, -1360.95, -272.109); - thisAI->AddWaypoint(41, -6406.95, -1323.87, -271.586); - thisAI->AddWaypoint(42, -6405, -1311.92, -271.906); - thisAI->AddWaypoint(43, -6395.56, -1303.62, -271.902); - thisAI->AddWaypoint(44, -6375.97, -1296.08, -271.865); - thisAI->AddWaypoint(45, -6364.39, -1281.23, -269.012); - thisAI->AddWaypoint(46, -6353.71, -1263.19, -267.95); - thisAI->AddWaypoint(47, -6340.09, -1248.65, -267.441); - thisAI->AddWaypoint(48, -6338.21, -1237.11, -267.844); - thisAI->AddWaypoint(49, -6336.6, -1219.69, -269.196); - thisAI->AddWaypoint(50, -6334.44, -1202.33, -271.527); - thisAI->AddWaypoint(51, -6329.56, -1189.82, -270.947); - thisAI->AddWaypoint(52, -6324.66, -1179.46, -270.103); - thisAI->AddWaypoint(53, -6315.08, -1176.74, -269.735); - thisAI->AddWaypoint(54, -6308.49, -1179.12, -269.57); - thisAI->AddWaypoint(55, -6302.43, -1181.32, -269.328, 5000); - thisAI->AddWaypoint(56, -6298.87, -1185.79, -269.278); - - return thisAI; + return new npc_ameAI(pCreature); } void AddSC_ungoro_crater() diff --git a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp index bb97fb12d18..41454f330f1 100644 --- a/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp +++ b/src/bindings/scripts/scripts/northrend/sholazar_basin.cpp @@ -64,7 +64,7 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -90,7 +90,7 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI m_creature->SetUnitMovementFlags(MOVEMENTFLAG_JUMPING); break; case 28: - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_FORTUNATE_MISUNDERSTANDINGS, m_creature); // me->RestoreFaction(); DoScriptText(SAY_END_IRO,m_creature); @@ -104,17 +104,12 @@ struct TRINITY_DLL_DECL npc_injured_rainspeaker_oracleAI : public npc_escortAI if (!IsBeingEscorted) return; - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) { if (pPlayer->GetQuestStatus(QUEST_FORTUNATE_MISUNDERSTANDINGS) != QUEST_STATUS_COMPLETE) pPlayer->FailQuest(QUEST_FORTUNATE_MISUNDERSTANDINGS); } } - - void UpdateAI(Player* pPlayer, Creature* pCreature,const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; diff --git a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp index 209d11c3509..9e7e6145178 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_peninsula.cpp @@ -70,8 +70,6 @@ struct TRINITY_DLL_DECL npc_aeranasAI : public ScriptedAI DoScriptText(SAY_SUMMON, m_creature); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (Faction_Timer) @@ -227,9 +225,9 @@ struct TRINITY_DLL_DECL npc_wounded_blood_elfAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer || pPlayer->GetTypeId() != TYPEID_PLAYER) + if (!pPlayer) return; switch (i) diff --git a/src/bindings/scripts/scripts/outland/netherstorm.cpp b/src/bindings/scripts/scripts/outland/netherstorm.cpp index 1e3c4349116..8d1aa2c3b3c 100644 --- a/src/bindings/scripts/scripts/outland/netherstorm.cpp +++ b/src/bindings/scripts/scripts/outland/netherstorm.cpp @@ -803,20 +803,15 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI npc_bessyAI(Creature *c) : npc_escortAI(c) {} - bool Completed; - void JustDied(Unit* killer) { - if (PlayerGUID) - { - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) - CAST_PLR(pPlayer)->FailQuest(Q_ALMABTRIEB); - } + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(Q_ALMABTRIEB); } void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -836,17 +831,12 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI case 12: if (pPlayer) - { - CAST_PLR(pPlayer)->GroupEventHappens(Q_ALMABTRIEB, m_creature); - Completed = true; - } - {Unit* Thadell = me->FindNearestCreature(N_THADELL, 30); - if (Thadell) - DoScriptText(SAY_THADELL_1, m_creature);}break; + pPlayer->GroupEventHappens(Q_ALMABTRIEB, m_creature); + if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) + DoScriptText(SAY_THADELL_1, m_creature); break; case 13: - {Unit* Thadell = me->FindNearestCreature(N_THADELL, 30); - if (Thadell) - DoScriptText(SAY_THADELL_2, m_creature, pPlayer);}break; + if (Unit* Thadell = me->FindNearestCreature(N_THADELL, 30)) + DoScriptText(SAY_THADELL_2, m_creature, pPlayer); break; } } @@ -855,17 +845,9 @@ struct TRINITY_DLL_DECL npc_bessyAI : public npc_escortAI summoned->AI()->AttackStart(m_creature); } - void EnterCombat(Unit* who){} - void Reset() { - Completed = false; - m_creature->setFaction(35); - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + me->RestoreFaction(); } }; @@ -883,24 +865,7 @@ bool QuestAccept_npc_bessy(Player* pPlayer, Creature* pCreature, Quest const* qu CreatureAI* GetAI_npc_bessy(Creature* pCreature) { - npc_bessyAI* bessyAI = new npc_bessyAI(pCreature); - - bessyAI->AddWaypoint(0, 2488.77, 2184.89, 104.64); - bessyAI->AddWaypoint(1, 2478.72, 2184.77, 98.58); - bessyAI->AddWaypoint(2, 2473.52, 2184.71, 99.00); - bessyAI->AddWaypoint(3, 2453.15, 2184.96, 97.09,4000); - bessyAI->AddWaypoint(4, 2424.18, 2184.15, 94.11); - bessyAI->AddWaypoint(5, 2413.18, 2184.15, 93.42); - bessyAI->AddWaypoint(6, 2402.02, 2183.90, 87.59); - bessyAI->AddWaypoint(7, 2333.31, 2181.63, 90.03,4000); - bessyAI->AddWaypoint(8, 2308.73, 2184.34, 92.04); - bessyAI->AddWaypoint(9, 2303.10, 2196.89, 94.94); - bessyAI->AddWaypoint(10, 2304.58, 2272.23, 96.67); - bessyAI->AddWaypoint(11, 2297.09, 2271.40, 95.16); - bessyAI->AddWaypoint(12, 2297.68, 2266.79, 95.07,4000); - bessyAI->AddWaypoint(13, 2297.67, 2266.76, 95.07,4000); - - return bessyAI; + return new npc_bessyAI(pCreature); } /*###### diff --git a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp index 998cedf9c1e..5ef2be74bf9 100644 --- a/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp +++ b/src/bindings/scripts/scripts/outland/shadowmoon_valley.cpp @@ -83,8 +83,6 @@ struct TRINITY_DLL_DECL mob_mature_netherwing_drakeAI : public ScriptedAI CastTimer = 5000; } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) { if (bCanEat || bIsEating) @@ -205,8 +203,6 @@ struct TRINITY_DLL_DECL mob_enslaved_netherwing_drakeAI : public ScriptedAI m_creature->SetVisibility(VISIBILITY_ON); } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) @@ -325,8 +321,6 @@ struct TRINITY_DLL_DECL mob_dragonmaw_peonAI : public ScriptedAI PoisonTimer = 0; } - void EnterCombat(Unit* who) { } - void SpellHit(Unit* caster, const SpellEntry* spell) { if (!caster) @@ -696,8 +690,6 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI Event = false; } - void EnterCombat(Unit* who){} - void StartEvent() { m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 0); @@ -891,7 +883,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI void WaypointReached(uint32 uiPointId) { - Player* pPlayer = (Player*)Unit::GetUnit(*m_creature, PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -944,7 +936,7 @@ struct TRINITY_DLL_DECL npc_earthmender_wildaAI : public npc_escortAI case 50: DoScriptText(SAY_WIL_END, m_creature, pPlayer); - if (Player* pPlayer = Unit::GetPlayer(PlayerGUID)) + if (Player* pPlayer = GetPlayerForEscort()) pPlayer->GroupEventHappens(QUEST_ESCAPE_COILSCAR, m_creature); break; } diff --git a/src/bindings/scripts/scripts/outland/shattrath_city.cpp b/src/bindings/scripts/scripts/outland/shattrath_city.cpp index 5e0904f7661..23d54ce83b6 100644 --- a/src/bindings/scripts/scripts/outland/shattrath_city.cpp +++ b/src/bindings/scripts/scripts/outland/shattrath_city.cpp @@ -61,12 +61,9 @@ struct TRINITY_DLL_DECL npc_raliq_the_drunkAI : public ScriptedAI void Reset() { Uppercut_Timer = 5000; - if (m_creature->getFaction() != m_uiNormFaction) - m_creature->setFaction(m_uiNormFaction); + me->RestoreFaction(); } - void EnterCombat(Unit *who) {} - void UpdateAI(const uint32 diff) { if (!UpdateVictim()) @@ -126,11 +123,9 @@ struct TRINITY_DLL_DECL npc_salsalabimAI : public ScriptedAI void Reset() { MagneticPull_Timer = 15000; - m_creature->setFaction(FACTION_FRIENDLY_SA); + me->RestoreFaction(); } - void EnterCombat(Unit *who) {} - void DamageTaken(Unit *done_by, uint32 &damage) { if (done_by->GetTypeId() == TYPEID_PLAYER) @@ -288,71 +283,60 @@ public: void WaypointReached(uint32 i) { - Unit *pTemp = Unit::GetUnit(*m_creature,PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pTemp) + if (!pPlayer) return; switch(i) { - case 0: DoScriptText(SAY1, m_creature, pTemp); break; - case 4: DoScriptText(WHISP1, m_creature, pTemp); break; - case 6: DoScriptText(WHISP2, m_creature, pTemp); break; - case 7: DoScriptText(WHISP3, m_creature, pTemp); break; - case 8: DoScriptText(WHISP4, m_creature, pTemp); break; - case 17: DoScriptText(WHISP5, m_creature, pTemp); break; - case 18: DoScriptText(WHISP6, m_creature, pTemp); break; - case 19: DoScriptText(WHISP7, m_creature, pTemp); break; - case 33: DoScriptText(WHISP8, m_creature, pTemp); break; - case 34: DoScriptText(WHISP9, m_creature, pTemp); break; - case 35: DoScriptText(WHISP10, m_creature, pTemp); break; - case 36: DoScriptText(WHISP11, m_creature, pTemp); break; - case 43: DoScriptText(WHISP12, m_creature, pTemp); break; - case 44: DoScriptText(WHISP13, m_creature, pTemp); break; - case 49: DoScriptText(WHISP14, m_creature, pTemp); break; - case 50: DoScriptText(WHISP15, m_creature, pTemp); break; - case 51: DoScriptText(WHISP16, m_creature, pTemp); break; - case 52: DoScriptText(WHISP17, m_creature, pTemp); break; - case 53: DoScriptText(WHISP18, m_creature, pTemp); break; - case 54: DoScriptText(WHISP19, m_creature, pTemp); break; - case 55: DoScriptText(WHISP20, m_creature, pTemp); break; - case 56: DoScriptText(WHISP21, m_creature, pTemp); - if (PlayerGUID) - { - Player* pPlayer = (Unit::GetPlayer(PlayerGUID)); - if (pPlayer) - pPlayer->GroupEventHappens(10211,m_creature); - } + case 0: DoScriptText(SAY1, m_creature, pPlayer); break; + case 4: DoScriptText(WHISP1, m_creature, pPlayer); break; + case 6: DoScriptText(WHISP2, m_creature, pPlayer); break; + case 7: DoScriptText(WHISP3, m_creature, pPlayer); break; + case 8: DoScriptText(WHISP4, m_creature, pPlayer); break; + case 17: DoScriptText(WHISP5, m_creature, pPlayer); break; + case 18: DoScriptText(WHISP6, m_creature, pPlayer); break; + case 19: DoScriptText(WHISP7, m_creature, pPlayer); break; + case 33: DoScriptText(WHISP8, m_creature, pPlayer); break; + case 34: DoScriptText(WHISP9, m_creature, pPlayer); break; + case 35: DoScriptText(WHISP10, m_creature, pPlayer); break; + case 36: DoScriptText(WHISP11, m_creature, pPlayer); break; + case 43: DoScriptText(WHISP12, m_creature, pPlayer); break; + case 44: DoScriptText(WHISP13, m_creature, pPlayer); break; + case 49: DoScriptText(WHISP14, m_creature, pPlayer); break; + case 50: DoScriptText(WHISP15, m_creature, pPlayer); break; + case 51: DoScriptText(WHISP16, m_creature, pPlayer); break; + case 52: DoScriptText(WHISP17, m_creature, pPlayer); break; + case 53: DoScriptText(WHISP18, m_creature, pPlayer); break; + case 54: DoScriptText(WHISP19, m_creature, pPlayer); break; + case 55: DoScriptText(WHISP20, m_creature, pPlayer); break; + case 56: DoScriptText(WHISP21, m_creature, pPlayer); + if (pPlayer) + pPlayer->GroupEventHappens(10211,m_creature); break; } } - void EnterCombat(Unit* who) {} - - void MoveInLineOfSight(Unit *who) + void MoveInLineOfSight(Unit* pWho) { if (IsBeingEscorted) return; - if (who->GetTypeId() == TYPEID_PLAYER) + if (pWho->GetTypeId() == TYPEID_PLAYER) { - if (CAST_PLR(who)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) + if (CAST_PLR(pWho)->GetQuestStatus(10211) == QUEST_STATUS_INCOMPLETE) { float Radius = 10.0; - if (m_creature->IsWithinDistInMap(who, Radius)) + if (m_creature->IsWithinDistInMap(pWho, Radius)) { - Start(false, false, who->GetGUID()); + Start(false, false, pWho->GetGUID()); } } } } void Reset() {} - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; CreatureAI* GetAI_npc_kservantAI(Creature* pCreature) { diff --git a/src/bindings/scripts/scripts/outland/terokkar_forest.cpp b/src/bindings/scripts/scripts/outland/terokkar_forest.cpp index b2c658c0eef..bfce48a17dd 100644 --- a/src/bindings/scripts/scripts/outland/terokkar_forest.cpp +++ b/src/bindings/scripts/scripts/outland/terokkar_forest.cpp @@ -179,7 +179,7 @@ public: void WaypointReached(uint32 i) { - Player *pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -412,11 +412,9 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI { npc_isla_starmaneAI(Creature* c) : npc_escortAI(c) {} - bool Completed; - void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if (!pPlayer) return; @@ -435,11 +433,11 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI case 29:DoScriptText(SAY_PROGRESS_4, m_creature, pPlayer); if (pPlayer) { - if (CAST_PLR(pPlayer)->GetTeam() == ALLIANCE) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_EFTW_A, m_creature); - else if (CAST_PLR(pPlayer)->GetTeam() == HORDE) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_EFTW_H, m_creature); - } Completed = true; + if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->GroupEventHappens(QUEST_EFTW_A, m_creature); + else if (pPlayer->GetTeam() == HORDE) + pPlayer->GroupEventHappens(QUEST_EFTW_H, m_creature); + } m_creature->SetInFront(pPlayer); break; case 30: m_creature->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; case 31: DoCast(m_creature, SPELL_CAT); @@ -449,31 +447,19 @@ struct TRINITY_DLL_DECL npc_isla_starmaneAI : public npc_escortAI void Reset() { - Completed = false; - m_creature->setFaction(1660); + me->RestoreFaction(); } - void EnterCombat(Unit* who){} - void JustDied(Unit* killer) { - if (PlayerGUID) + if (Player* pPlayer = GetPlayerForEscort()) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); - if (pPlayer && !Completed) - { - if (CAST_PLR(pPlayer)->GetTeam() == ALLIANCE) - CAST_PLR(pPlayer)->FailQuest(QUEST_EFTW_A); - else if (CAST_PLR(pPlayer)->GetTeam() == HORDE) - CAST_PLR(pPlayer)->FailQuest(QUEST_EFTW_H); - } + if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->FailQuest(QUEST_EFTW_A); + else if (pPlayer->GetTeam() == HORDE) + pPlayer->FailQuest(QUEST_EFTW_H); } } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest const* quest) @@ -488,45 +474,7 @@ bool QuestAccept_npc_isla_starmane(Player* pPlayer, Creature* pCreature, Quest c CreatureAI* GetAI_npc_isla_starmaneAI(Creature* pCreature) { - npc_isla_starmaneAI* thisAI = new npc_isla_starmaneAI(pCreature); - - thisAI->AddWaypoint(0, -2265.21, 3091.14, 13.91); - thisAI->AddWaypoint(1, -2266.80, 3091.33, 13.82, 1000); - thisAI->AddWaypoint(2, -2268.20, 3091.14, 13.82, 7000);//progress1 - thisAI->AddWaypoint(3, -2278.32, 3098.98, 13.82); - thisAI->AddWaypoint(4, -2294.82, 3110.59, 13.82); - thisAI->AddWaypoint(5, -2300.71, 3114.60, 13.82, 20000);//progress2 - thisAI->AddWaypoint(6, -2300.71, 3114.60, 13.82, 3000);//progress3 - thisAI->AddWaypoint(7, -2307.36, 3122.76, 13.79); - thisAI->AddWaypoint(8, -2312.83, 3130.55, 12.04); - thisAI->AddWaypoint(9, -2345.02, 3151.00, 8.38); - thisAI->AddWaypoint(10, -2351.97, 3157.61, 6.27); - thisAI->AddWaypoint(11, -2360.35, 3171.48, 3.31); - thisAI->AddWaypoint(12, -2371.44, 3185.41, 0.89); - thisAI->AddWaypoint(13, -2371.21, 3197.92, -0.96); - thisAI->AddWaypoint(14, -2380.35, 3210.45, -1.08); - thisAI->AddWaypoint(15, -2384.74, 3221.25, -1.17); - thisAI->AddWaypoint(16, -2386.15, 3233.39, -1.29); - thisAI->AddWaypoint(17, -2383.45, 3247.79, -1.32); - thisAI->AddWaypoint(18, -2367.50, 3265.64, -1.33); - thisAI->AddWaypoint(19, -2354.90, 3273.30, -1.50); - thisAI->AddWaypoint(20, -2348.88, 3280.58, -0.09); - thisAI->AddWaypoint(21, -2349.06, 3295.86, -0.95); - thisAI->AddWaypoint(22, -2350.43, 3328.27, -2.10); - thisAI->AddWaypoint(23, -2346.76, 3356.27, -2.82); - thisAI->AddWaypoint(24, -2340.56, 3370.68, -4.02); - thisAI->AddWaypoint(25, -2318.84, 3384.60, -7.61); - thisAI->AddWaypoint(26, -2313.99, 3398.61, -10.40); - thisAI->AddWaypoint(27, -2320.85, 3414.49, -11.49); - thisAI->AddWaypoint(28, -2338.26, 3426.06, -11.46); - thisAI->AddWaypoint(29, -2342.67, 3439.44, -11.32, 12000);//progress4 - thisAI->AddWaypoint(30, -2342.67, 3439.44, -11.32, 7000);//emote bye - thisAI->AddWaypoint(31, -2342.67, 3439.44, -11.32, 5000);//cat form - thisAI->AddWaypoint(32, -2344.60, 3461.27, -10.44); - thisAI->AddWaypoint(33, -2396.81, 3517.17, -3.55); - thisAI->AddWaypoint(34, -2439.23, 3523.00, -1.05); - - return thisAI; + return new npc_isla_starmaneAI(pCreature); } /*###### @@ -624,7 +572,7 @@ struct TRINITY_DLL_DECL npc_akunoAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pPlayer = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); if(!pPlayer) return; diff --git a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp index 0ce14cc0aee..2d505a5183a 100644 --- a/src/bindings/scripts/scripts/outland/zangarmarsh.cpp +++ b/src/bindings/scripts/scripts/outland/zangarmarsh.cpp @@ -284,34 +284,34 @@ struct TRINITY_DLL_DECL npc_kayra_longmaneAI : public npc_escortAI void WaypointReached(uint32 i) { - Player* pUnit = Unit::GetPlayer(PlayerGUID); + Player* pPlayer = GetPlayerForEscort(); - if (!pUnit) + if (!pPlayer) return; switch(i) { case 4: - DoScriptText(SAY_AMBUSH1, m_creature, pUnit); + DoScriptText(SAY_AMBUSH1, m_creature, pPlayer); DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; case 5: - DoScriptText(SAY_PROGRESS, m_creature, pUnit); + DoScriptText(SAY_PROGRESS, m_creature, pPlayer); SetRun(); break; case 16: - DoScriptText(SAY_AMBUSH2, m_creature, pUnit); + DoScriptText(SAY_AMBUSH2, m_creature, pPlayer); DoSpawnCreature(NPC_SLAVEBINDER, -10.0f, -5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); DoSpawnCreature(NPC_SLAVEBINDER, -8.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); break; case 17: SetRun(false); - DoScriptText(SAY_NEAR_END, m_creature, pUnit); + DoScriptText(SAY_NEAR_END, m_creature, pPlayer); break; case 25: - DoScriptText(SAY_END, m_creature, pUnit); - pUnit->GroupEventHappens(QUEST_ESCAPE_FROM, m_creature); + DoScriptText(SAY_END, m_creature, pPlayer); + pPlayer->GroupEventHappens(QUEST_ESCAPE_FROM, m_creature); break; } } |