diff options
Diffstat (limited to 'src/server/scripts/EasternKingdoms/hinterlands.cpp')
-rw-r--r-- | src/server/scripts/EasternKingdoms/hinterlands.cpp | 399 |
1 files changed, 202 insertions, 197 deletions
diff --git a/src/server/scripts/EasternKingdoms/hinterlands.cpp b/src/server/scripts/EasternKingdoms/hinterlands.cpp index 081d1b157e6..1ce459560d1 100644 --- a/src/server/scripts/EasternKingdoms/hinterlands.cpp +++ b/src/server/scripts/EasternKingdoms/hinterlands.cpp @@ -51,96 +51,104 @@ enum eOOX FACTION_ESCORTEE_A = 774, FACTION_ESCORTEE_H = 775 }; - -struct npc_00x09hlAI : public npc_escortAI +
class npc_00x09hl : public CreatureScript { - npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - void Reset() { } +public: + npc_00x09hl() : CreatureScript("npc_00x09hl") { } - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09) { - case 26: - DoScriptText(SAY_OOX_AMBUSH, me); - break; - case 43: - DoScriptText(SAY_OOX_AMBUSH, me); - break; - case 64: - DoScriptText(SAY_OOX_END, me); - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me); - break; + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (pPlayer->GetTeam() == ALLIANCE) + pCreature->setFaction(FACTION_ESCORTEE_A); + else if (pPlayer->GetTeam() == HORDE) + pCreature->setFaction(FACTION_ESCORTEE_H); + + DoScriptText(SAY_OOX_START, pCreature, pPlayer); + + if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hl::npc_00x09hlAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void WaypointStart(uint32 uiPointId) + CreatureAI* GetAI(Creature* pCreature) const { - switch(uiPointId) - { - case 27: - for (uint8 i = 0; i < 3; ++i) - { - const Position src = {147.927444f, -3851.513428f, 130.893f, 0}; - Position dst; - me->GetRandomPoint(src, 7.0f, dst); - DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); - } - break; - case 44: - for (uint8 i = 0; i < 3; ++i) - { - const Position src = {-141.151581f, -4291.213867f, 120.130f, 0}; - Position dst; - me->GetRandomPoint(src, 7.0f, dst); - me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); - } - break; - } + return new npc_00x09hlAI(pCreature); } - void EnterCombat(Unit* pWho) + struct npc_00x09hlAI : public npc_escortAI { - if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER) - return; + npc_00x09hlAI(Creature* pCreature) : npc_escortAI(pCreature) { } - if (rand()%1) - DoScriptText(SAY_OOX_AGGRO1, me); - else - DoScriptText(SAY_OOX_AGGRO2, me); - } + void Reset() { } - void JustSummoned(Creature* pSummoned) - { - pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); - } -}; + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 26: + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 43: + DoScriptText(SAY_OOX_AMBUSH, me); + break; + case 64: + DoScriptText(SAY_OOX_END, me); + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_RESQUE_OOX_09, me); + break; + } + } -bool QuestAccept_npc_00x09hl(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_RESQUE_OOX_09) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); + void WaypointStart(uint32 uiPointId) + { + switch(uiPointId) + { + case 27: + for (uint8 i = 0; i < 3; ++i) + { + const Position src = {147.927444f, -3851.513428f, 130.893f, 0}; + Position dst; + me->GetRandomPoint(src, 7.0f, dst); + DoSummon(NPC_MARAUDING_OWL, dst, 25000, TEMPSUMMON_CORPSE_TIMED_DESPAWN); + } + break; + case 44: + for (uint8 i = 0; i < 3; ++i) + { + const Position src = {-141.151581f, -4291.213867f, 120.130f, 0}; + Position dst; + me->GetRandomPoint(src, 7.0f, dst); + me->SummonCreature(NPC_VILE_AMBUSHER, dst, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 25000); + } + break; + } + } - if (pPlayer->GetTeam() == ALLIANCE) - pCreature->setFaction(FACTION_ESCORTEE_A); - else if (pPlayer->GetTeam() == HORDE) - pCreature->setFaction(FACTION_ESCORTEE_H); + void EnterCombat(Unit* pWho) + { + if (pWho->GetEntry() == NPC_MARAUDING_OWL || pWho->GetEntry() == NPC_VILE_AMBUSHER) + return; - DoScriptText(SAY_OOX_START, pCreature, pPlayer); + if (rand()%1) + DoScriptText(SAY_OOX_AGGRO1, me); + else + DoScriptText(SAY_OOX_AGGRO2, me); + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->GetMotionMaster()->MovePoint(0, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()); + } + }; + +}; - if (npc_00x09hlAI* pEscortAI = CAST_AI(npc_00x09hlAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} -CreatureAI* GetAI_npc_00x09hl(Creature* pCreature) -{ - return new npc_00x09hlAI(pCreature); -} /*###### ## npc_rinji @@ -178,175 +186,172 @@ Location m_afAmbushMoveTo[] = {166.630386, -2824.780273, 108.153}, {70.886589, -2874.335449, 116.675} }; - -struct npc_rinjiAI : public npc_escortAI +
class npc_rinji : public CreatureScript { - npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature) +public: + npc_rinji() : CreatureScript("npc_rinji") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - m_bIsByOutrunner = false; - m_iSpawnId = 0; - } + if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED) + { + if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE)) + pGo->UseDoorOrButton(); - bool m_bIsByOutrunner; - uint32 m_uiPostEventCount; - uint32 m_uiPostEventTimer; - int m_iSpawnId; + if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinji::npc_rinjiAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); + } + return true; + } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiPostEventCount = 0; - m_uiPostEventTimer = 3000; + return new npc_rinjiAI(pCreature); } - void JustRespawned() + struct npc_rinjiAI : public npc_escortAI { - m_bIsByOutrunner = false; - m_iSpawnId = 0; + npc_rinjiAI(Creature* pCreature) : npc_escortAI(pCreature) + { + m_bIsByOutrunner = false; + m_iSpawnId = 0; + } - npc_escortAI::JustRespawned(); - } + bool m_bIsByOutrunner; + uint32 m_uiPostEventCount; + uint32 m_uiPostEventTimer; + int m_iSpawnId; - void EnterCombat(Unit* pWho) - { - if (HasEscortState(STATE_ESCORT_ESCORTING)) + void Reset() { - if (pWho->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner) - { - DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho); - m_bIsByOutrunner = true; - } + m_uiPostEventCount = 0; + m_uiPostEventTimer = 3000; + } - if (rand()%4) - return; + void JustRespawned() + { + m_bIsByOutrunner = false; + m_iSpawnId = 0; - //only if attacked and escorter is not in combat? - DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me); + npc_escortAI::JustRespawned(); } - } - void DoSpawnAmbush(bool bFirst) - { - if (!bFirst) - m_iSpawnId = 1; + void EnterCombat(Unit* pWho) + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + if (pWho->GetEntry() == NPC_OUTRUNNER && !m_bIsByOutrunner) + { + DoScriptText(SAY_RIN_BY_OUTRUNNER, pWho); + m_bIsByOutrunner = true; + } - me->SummonCreature(NPC_RANGER, - m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, - TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + if (rand()%4) + return; - for (int i = 0; i < 2; ++i) + //only if attacked and escorter is not in combat? + DoScriptText(RAND(SAY_RIN_HELP_1,SAY_RIN_HELP_2), me); + } + } + + void DoSpawnAmbush(bool bFirst) { - me->SummonCreature(NPC_OUTRUNNER, + if (!bFirst) + m_iSpawnId = 1; + + me->SummonCreature(NPC_RANGER, m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + + for (int i = 0; i < 2; ++i) + { + me->SummonCreature(NPC_OUTRUNNER, + m_afAmbushSpawn[m_iSpawnId].m_fX, m_afAmbushSpawn[m_iSpawnId].m_fY, m_afAmbushSpawn[m_iSpawnId].m_fZ, 0.0f, + TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 60000); + } } - } - void JustSummoned(Creature* pSummoned) - { - pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pSummoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ); - } + void JustSummoned(Creature* pSummoned) + { + pSummoned->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pSummoned->GetMotionMaster()->MovePoint(0, m_afAmbushMoveTo[m_iSpawnId].m_fX, m_afAmbushMoveTo[m_iSpawnId].m_fY, m_afAmbushMoveTo[m_iSpawnId].m_fZ); + } - void WaypointReached(uint32 uiPointId) - { - Player* pPlayer = GetPlayerForEscort(); + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; + if (!pPlayer) + return; - switch(uiPointId) - { - case 1: - DoScriptText(SAY_RIN_FREE, me, pPlayer); - break; - case 7: - DoSpawnAmbush(true); - break; - case 13: - DoSpawnAmbush(false); - break; - case 17: - DoScriptText(SAY_RIN_COMPLETE, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me); - SetRun(); - m_uiPostEventCount = 1; - break; + switch(uiPointId) + { + case 1: + DoScriptText(SAY_RIN_FREE, me, pPlayer); + break; + case 7: + DoSpawnAmbush(true); + break; + case 13: + DoSpawnAmbush(false); + break; + case 17: + DoScriptText(SAY_RIN_COMPLETE, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_RINJI_TRAPPED, me); + SetRun(); + m_uiPostEventCount = 1; + break; + } } - } - void UpdateEscortAI(const uint32 uiDiff) - { - //Check if we have a current target - if (!UpdateVictim()) + void UpdateEscortAI(const uint32 uiDiff) { - if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount) + //Check if we have a current target + if (!UpdateVictim()) { - if (m_uiPostEventTimer <= uiDiff) + if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPostEventCount) { - m_uiPostEventTimer = 3000; - - if (Unit* pPlayer = GetPlayerForEscort()) + if (m_uiPostEventTimer <= uiDiff) { - switch(m_uiPostEventCount) + m_uiPostEventTimer = 3000; + + if (Unit* pPlayer = GetPlayerForEscort()) + { + switch(m_uiPostEventCount) + { + case 1: + DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer); + ++m_uiPostEventCount; + break; + case 2: + DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer); + m_uiPostEventCount = 0; + break; + } + } + else { - case 1: - DoScriptText(SAY_RIN_PROGRESS_1, me, pPlayer); - ++m_uiPostEventCount; - break; - case 2: - DoScriptText(SAY_RIN_PROGRESS_2, me, pPlayer); - m_uiPostEventCount = 0; - break; + me->ForcedDespawn(); + return; } } else - { - me->ForcedDespawn(); - return; - } + m_uiPostEventTimer -= uiDiff; } - else - m_uiPostEventTimer -= uiDiff; + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -bool QuestAccept_npc_rinji(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_RINJI_TRAPPED) - { - if (GameObject* pGo = pCreature->FindNearestGameObject(GO_RINJI_CAGE, INTERACTION_DISTANCE)) - pGo->UseDoorOrButton(); - - if (npc_rinjiAI* pEscortAI = CAST_AI(npc_rinjiAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} -CreatureAI* GetAI_npc_rinji(Creature* pCreature) -{ - return new npc_rinjiAI(pCreature); -} void AddSC_hinterlands() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_00x09hl"; - newscript->GetAI = &GetAI_npc_00x09hl; - newscript->pQuestAccept = &QuestAccept_npc_00x09hl; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rinji"; - newscript->GetAI = &GetAI_npc_rinji; - newscript->pQuestAccept = &QuestAccept_npc_rinji; - newscript->RegisterSelf(); + new npc_00x09hl(); + new npc_rinji(); } |