diff options
author | azazel <none@none> | 2010-08-08 22:54:58 +0600 |
---|---|---|
committer | azazel <none@none> | 2010-08-08 22:54:58 +0600 |
commit | 590199d8e17405a0717eaf2e2d39f0d671b6f844 (patch) | |
tree | 36755767c89c4639c7cb0e2f31d8a99f53bb8cf5 /src/server/scripts/EasternKingdoms/westfall.cpp | |
parent | 8a69e50d6aff8ea75100a1fb660deecf03b3ea07 (diff) |
* Rename InstanceData to InstanceScript
* Rename *mgr to their new names in scripts project
* Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker.
--HG--
branch : trunk
rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp
rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h
Diffstat (limited to 'src/server/scripts/EasternKingdoms/westfall.cpp')
-rw-r--r-- | src/server/scripts/EasternKingdoms/westfall.cpp | 321 |
1 files changed, 163 insertions, 158 deletions
diff --git a/src/server/scripts/EasternKingdoms/westfall.cpp b/src/server/scripts/EasternKingdoms/westfall.cpp index e706594dcf5..14e33177555 100644 --- a/src/server/scripts/EasternKingdoms/westfall.cpp +++ b/src/server/scripts/EasternKingdoms/westfall.cpp @@ -48,138 +48,146 @@ enum eEnums NPC_DEFIAS_RAIDER = 6180, EQUIP_ID_RIFLE = 2511 }; - -struct npc_daphne_stilwellAI : public npc_escortAI +
class npc_daphne_stilwell : public CreatureScript { - npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {} - - uint32 uiWPHolder; - uint32 uiShootTimer; +public: + npc_daphne_stilwell() : CreatureScript("npc_daphne_stilwell") { } - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - if (HasEscortState(STATE_ESCORT_ESCORTING)) + if (pQuest->GetQuestId() == QUEST_TOME_VALOR) { - switch(uiWPHolder) - { - case 7: DoScriptText(SAY_DS_DOWN_1, me); break; - case 8: DoScriptText(SAY_DS_DOWN_2, me); break; - case 9: DoScriptText(SAY_DS_DOWN_3, me); break; - } + DoScriptText(SAY_DS_START, pCreature); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwell::npc_daphne_stilwellAI, pCreature->AI())) + pEscortAI->Start(true, true, pPlayer->GetGUID()); } - else - uiWPHolder = 0; - uiShootTimer = 0; + return true; } - void WaypointReached(uint32 uiPoint) + CreatureAI* GetAI(Creature* pCreature) const { - Player* pPlayer = GetPlayerForEscort(); + return new npc_daphne_stilwellAI(pCreature); + } - if (!pPlayer) - return; + struct npc_daphne_stilwellAI : public npc_escortAI + { + npc_daphne_stilwellAI(Creature* pCreature) : npc_escortAI(pCreature) {} - uiWPHolder = uiPoint; + uint32 uiWPHolder; + uint32 uiShootTimer; - switch(uiPoint) + void Reset() { - case 4: - SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE); - me->SetSheath(SHEATH_STATE_RANGED); - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); - break; - case 7: - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 8: - me->SetSheath(SHEATH_STATE_RANGED); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 9: - me->SetSheath(SHEATH_STATE_RANGED); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.018, 1570.738, 54.828, 4.220, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 10: - SetRun(false); - break; - case 11: - DoScriptText(SAY_DS_PROLOGUE, me); - break; - case 13: - SetEquipmentSlots(true); - me->SetSheath(SHEATH_STATE_UNARMED); - me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); - break; - case 17: - pPlayer->GroupEventHappens(QUEST_TOME_VALOR, me); - break; - } - } + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + switch(uiWPHolder) + { + case 7: DoScriptText(SAY_DS_DOWN_1, me); break; + case 8: DoScriptText(SAY_DS_DOWN_2, me); break; + case 9: DoScriptText(SAY_DS_DOWN_3, me); break; + } + } + else + uiWPHolder = 0; - void AttackStart(Unit* pWho) - { - if (!pWho) - return; + uiShootTimer = 0; + } - if (me->Attack(pWho, false)) + void WaypointReached(uint32 uiPoint) { - me->AddThreat(pWho, 0.0f); - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + uiWPHolder = uiPoint; - me->GetMotionMaster()->MoveChase(pWho, 30.0f); + switch(uiPoint) + { + case 4: + SetEquipmentSlots(false, EQUIP_NO_CHANGE, EQUIP_NO_CHANGE, EQUIP_ID_RIFLE); + me->SetSheath(SHEATH_STATE_RANGED); + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); + break; + case 7: + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 8: + me->SetSheath(SHEATH_STATE_RANGED); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 9: + me->SetSheath(SHEATH_STATE_RANGED); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11450.836, 1569.755, 54.267, 4.230, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.697, 1569.124, 54.421, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.237, 1568.307, 54.620, 4.206, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11448.037, 1570.213, 54.961, 4.283, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_DEFIAS_RAIDER, -11449.018, 1570.738, 54.828, 4.220, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 10: + SetRun(false); + break; + case 11: + DoScriptText(SAY_DS_PROLOGUE, me); + break; + case 13: + SetEquipmentSlots(true); + me->SetSheath(SHEATH_STATE_UNARMED); + me->HandleEmoteCommand(EMOTE_STATE_USESTANDING_NOSHEATHE); + break; + case 17: + pPlayer->GroupEventHappens(QUEST_TOME_VALOR, me); + break; + } } - } - void JustSummoned(Creature* pSummoned) - { - pSummoned->AI()->AttackStart(me); - } + void AttackStart(Unit* pWho) + { + if (!pWho) + return; - void Update(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (me->Attack(pWho, false)) + { + me->AddThreat(pWho, 0.0f); + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); - if (!UpdateVictim()) - return; + me->GetMotionMaster()->MoveChase(pWho, 30.0f); + } + } - if (uiShootTimer <= diff) + void JustSummoned(Creature* pSummoned) { - uiShootTimer = 1500; + pSummoned->AI()->AttackStart(me); + } - if (!me->IsWithinDist(me->getVictim(), ATTACK_DISTANCE)) - DoCast(me->getVictim(), SPELL_SHOOT); - } else uiShootTimer -= diff; - } -}; + void Update(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); -bool QuestAccept_npc_daphne_stilwell(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_TOME_VALOR) - { - DoScriptText(SAY_DS_START, pCreature); + if (!UpdateVictim()) + return; - if (npc_escortAI* pEscortAI = CAST_AI(npc_daphne_stilwellAI, pCreature->AI())) - pEscortAI->Start(true, true, pPlayer->GetGUID()); - } + if (uiShootTimer <= diff) + { + uiShootTimer = 1500; + + if (!me->IsWithinDist(me->getVictim(), ATTACK_DISTANCE)) + DoCast(me->getVictim(), SPELL_SHOOT); + } else uiShootTimer -= diff; + } + }; + +}; - return true; -} -CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature) -{ - return new npc_daphne_stilwellAI(pCreature); -} /*###### ## npc_defias_traitor @@ -192,74 +200,71 @@ CreatureAI* GetAI_npc_daphne_stilwell(Creature* pCreature) #define SAY_AGGRO_2 -1000105 #define QUEST_DEFIAS_BROTHERHOOD 155 - -struct npc_defias_traitorAI : public npc_escortAI +
class npc_defias_traitor : public CreatureScript { - npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); } +public: + npc_defias_traitor() : CreatureScript("npc_defias_traitor") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch (i) + if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD) { - case 35: - SetRun(false); - break; - case 36: - DoScriptText(SAY_PROGRESS, me, pPlayer); - break; - case 44: - DoScriptText(SAY_END, me, pPlayer); - { - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,me); - } - break; + if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitor::npc_defias_traitorAI, pCreature->AI())) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + + DoScriptText(SAY_START, pCreature, pPlayer); } + + return true; } - void EnterCombat(Unit* who) + + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + return new npc_defias_traitorAI(pCreature); } - void Reset() {} -}; - -bool QuestAccept_npc_defias_traitor(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_DEFIAS_BROTHERHOOD) + struct npc_defias_traitorAI : public npc_escortAI { - if (npc_escortAI* pEscortAI = CAST_AI(npc_defias_traitorAI, pCreature->AI())) - pEscortAI->Start(true, true, pPlayer->GetGUID()); + npc_defias_traitorAI(Creature *c) : npc_escortAI(c) { Reset(); } - DoScriptText(SAY_START, pCreature, pPlayer); - } + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + case 35: + SetRun(false); + break; + case 36: + DoScriptText(SAY_PROGRESS, me, pPlayer); + break; + case 44: + DoScriptText(SAY_END, me, pPlayer); + { + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_DEFIAS_BROTHERHOOD,me); + } + break; + } + } + void EnterCombat(Unit* who) + { + DoScriptText(RAND(SAY_AGGRO_1,SAY_AGGRO_2), me, who); + } + + void Reset() {} + }; + +}; - return true; -} -CreatureAI* GetAI_npc_defias_traitor(Creature* pCreature) -{ - return new npc_defias_traitorAI(pCreature); -} void AddSC_westfall() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_daphne_stilwell"; - newscript->GetAI = &GetAI_npc_daphne_stilwell; - newscript->pQuestAccept = &QuestAccept_npc_daphne_stilwell; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_defias_traitor"; - newscript->GetAI = &GetAI_npc_defias_traitor; - newscript->pQuestAccept = &QuestAccept_npc_defias_traitor; - newscript->RegisterSelf(); + new npc_daphne_stilwell(); + new npc_defias_traitor(); } |