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/Kalimdor | |
| 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/Kalimdor')
87 files changed, 15621 insertions, 15231 deletions
diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index f217661871c..ac3423dd882 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -31,221 +31,231 @@ enum eSpells #define GOSSIP_ITEM_MORRIDUNE "Please port me to Darnassus" const Position HomePosition = {-815.817,-145.299,-25.870, 0}; - -bool GoHello_blackfathom_altar(Player *pPlayer, GameObject* /*pGo*/) -{ - if (!pPlayer->HasAura(SPELL_BLESSING_OF_BLACKFATHOM)) - pPlayer->AddAura(SPELL_BLESSING_OF_BLACKFATHOM,pPlayer); - return true; -} - -bool GoHello_blackfathom_fire(Player * /*pPlayer*/, GameObject* pGo) +
class go_blackfathom_altar : public GameObjectScript { - ScriptedInstance *pInstance = pGo->GetInstanceData(); +public: + go_blackfathom_altar() : GameObjectScript("go_blackfathom_altar") { } - if (pInstance) + bool OnGossipHello(Player *pPlayer, GameObject* /*pGo*/) { - pGo->SetGoState(GO_STATE_ACTIVE); - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pInstance->SetData(DATA_FIRE, pInstance->GetData(DATA_FIRE) + 1); + if (!pPlayer->HasAura(SPELL_BLESSING_OF_BLACKFATHOM)) + pPlayer->AddAura(SPELL_BLESSING_OF_BLACKFATHOM,pPlayer); return true; } - return false; -} -struct npc_blackfathom_deeps_eventAI : public ScriptedAI +}; +
class go_blackfathom_fire : public GameObjectScript { - npc_blackfathom_deeps_eventAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + go_blackfathom_fire() : GameObjectScript("go_blackfathom_fire") { } + + bool OnGossipHello(Player * /*pPlayer*/, GameObject* pGo) { - if (pCreature->isSummon()) + InstanceScript *pInstance = pGo->GetInstanceScript(); + + if (pInstance) { - pCreature->SetHomePosition(HomePosition); - AttackPlayer(); + pGo->SetGoState(GO_STATE_ACTIVE); + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pInstance->SetData(DATA_FIRE, pInstance->GetData(DATA_FIRE) + 1); + return true; } + return false; + } - pInstance = pCreature->GetInstanceData(); +}; +
class npc_blackfathom_deeps_event : public CreatureScript +{ +public: + npc_blackfathom_deeps_event() : CreatureScript("npc_blackfathom_deeps_event") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_blackfathom_deeps_eventAI (pCreature); } - ScriptedInstance* pInstance; + struct npc_blackfathom_deeps_eventAI : public ScriptedAI + { + npc_blackfathom_deeps_eventAI(Creature* pCreature) : ScriptedAI(pCreature) + { + if (pCreature->isSummon()) + { + pCreature->SetHomePosition(HomePosition); + AttackPlayer(); + } - uint32 uiRavageTimer; - uint32 uiFrostNovaTimer; - uint32 uiFrostBoltVolleyTimer; + pInstance = pCreature->GetInstanceScript(); + } - bool bFlee; + InstanceScript* pInstance; - void Reset() - { - bFlee = false; + uint32 uiRavageTimer; + uint32 uiFrostNovaTimer; + uint32 uiFrostBoltVolleyTimer; - uiRavageTimer = urand(5000,8000); - uiFrostNovaTimer = urand(9000,12000); - uiFrostBoltVolleyTimer = urand(2000,4000); - } + bool bFlee; - void AttackPlayer() - { - Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); + void Reset() + { + bFlee = false; - if (PlList.isEmpty()) - return; + uiRavageTimer = urand(5000,8000); + uiFrostNovaTimer = urand(9000,12000); + uiFrostBoltVolleyTimer = urand(2000,4000); + } - for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + void AttackPlayer() { - if (Player* pPlayer = i->getSource()) - { - if (pPlayer->isGameMaster()) - continue; + Map::PlayerList const &PlList = me->GetMap()->GetPlayers(); - if (pPlayer->isAlive()) + if (PlList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) + { + if (Player* pPlayer = i->getSource()) { - me->SetInCombatWith(pPlayer); - pPlayer->SetInCombatWith(me); - me->AddThreat(pPlayer, 0.0f); + if (pPlayer->isGameMaster()) + continue; + + if (pPlayer->isAlive()) + { + me->SetInCombatWith(pPlayer); + pPlayer->SetInCombatWith(me); + me->AddThreat(pPlayer, 0.0f); + } } } } - } - - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; - switch (me->GetEntry()) + void UpdateAI(const uint32 uiDiff) { - case NPC_AKU_MAI_SNAPJAW: - { - if (uiRavageTimer <= uiDiff) - { - DoCast(me->getVictim(), SPELL_RAVAGE); - uiRavageTimer = urand(9000,14000); - } else uiRavageTimer -= uiDiff; - break; - } - case NPC_MURKSHALLOW_SOFTSHELL: - case NPC_BARBED_CRUSTACEAN: + if (!UpdateVictim()) + return; + + switch (me->GetEntry()) { - if (!bFlee && HealthBelowPct(15)) + case NPC_AKU_MAI_SNAPJAW: { - bFlee = true; - me->DoFleeToGetAssistance(); + if (uiRavageTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_RAVAGE); + uiRavageTimer = urand(9000,14000); + } else uiRavageTimer -= uiDiff; + break; } - break; - } - case NPC_AKU_MAI_SERVANT: - { - if (uiFrostBoltVolleyTimer <= uiDiff) + case NPC_MURKSHALLOW_SOFTSHELL: + case NPC_BARBED_CRUSTACEAN: { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (!bFlee && HealthBelowPct(15)) { - if (pTarget) - DoCast(pTarget, SPELL_FROST_BOLT_VOLLEY); + bFlee = true; + me->DoFleeToGetAssistance(); } - uiFrostBoltVolleyTimer = urand(5000,8000); - } else uiFrostBoltVolleyTimer -= uiDiff; - if (uiFrostNovaTimer <= uiDiff) + break; + } + case NPC_AKU_MAI_SERVANT: { - DoCastAOE(SPELL_FROST_NOVA,false); - uiFrostNovaTimer = urand(25000,30000); - } else uiFrostNovaTimer -= uiDiff; - break; + if (uiFrostBoltVolleyTimer <= uiDiff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + if (pTarget) + DoCast(pTarget, SPELL_FROST_BOLT_VOLLEY); + } + uiFrostBoltVolleyTimer = urand(5000,8000); + } else uiFrostBoltVolleyTimer -= uiDiff; + if (uiFrostNovaTimer <= uiDiff) + { + DoCastAOE(SPELL_FROST_NOVA,false); + uiFrostNovaTimer = urand(25000,30000); + } else uiFrostNovaTimer -= uiDiff; + break; + } } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*pKiller*/) + { + if (me->isSummon()) //we are not a normal spawn. + if (pInstance) + pInstance->SetData(DATA_EVENT, pInstance->GetData(DATA_EVENT) + 1); + } + }; - void JustDied(Unit* /*pKiller*/) - { - if (me->isSummon()) //we are not a normal spawn. - if (pInstance) - pInstance->SetData(DATA_EVENT, pInstance->GetData(DATA_EVENT) + 1); - } }; -CreatureAI* GetAI_npc_blackfathom_deeps_event(Creature* pCreature) -{ - return new npc_blackfathom_deeps_eventAI (pCreature); -} enum eMorridune { SAY_MORRIDUNE_1 = -1048003, SAY_MORRIDUNE_2 = -1048004 }; - -struct npc_morriduneAI : public npc_escortAI +
class npc_morridune : public CreatureScript { - npc_morriduneAI(Creature* pCreature) : npc_escortAI(pCreature) - { - DoScriptText(SAY_MORRIDUNE_1,pCreature); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - Start(false,false,NULL); - } +public: + npc_morridune() : CreatureScript("npc_morridune") { } - void WaypointReached(uint32 uiPoint) + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - switch(uiPoint) + switch(uiAction) { - case 4: - SetEscortPaused(true); - me->SetOrientation(1.775791); - me->SendMovementFlagUpdate(); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - DoScriptText(SAY_MORRIDUNE_2,me); + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->TeleportTo(1,9952.239,2284.277,1341.394,1.595); + pPlayer->CLOSE_GOSSIP_MENU(); break; } + return true; } -}; -CreatureAI* GetAI_npc_morridune(Creature* pCreature) -{ - return new npc_morriduneAI (pCreature); -} - -bool GossipHello_npc_morridune(Player* pPlayer, Creature* pCreature) -{ - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MORRIDUNE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_MORRIDUNE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } -bool GossipSelect_npc_morridune(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) + CreatureAI* GetAI(Creature* pCreature) const { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->TeleportTo(1,9952.239,2284.277,1341.394,1.595); - pPlayer->CLOSE_GOSSIP_MENU(); - break; + return new npc_morriduneAI (pCreature); } - return true; -} + + struct npc_morriduneAI : public npc_escortAI + { + npc_morriduneAI(Creature* pCreature) : npc_escortAI(pCreature) + { + DoScriptText(SAY_MORRIDUNE_1,pCreature); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + Start(false,false,NULL); + } + + void WaypointReached(uint32 uiPoint) + { + switch(uiPoint) + { + case 4: + SetEscortPaused(true); + me->SetOrientation(1.775791); + me->SendMovementFlagUpdate(); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + DoScriptText(SAY_MORRIDUNE_2,me); + break; + } + } + }; + +}; + + + void AddSC_blackfathom_deeps() { - Script *newscript; - newscript = new Script; - newscript->Name = "go_blackfathom_altar"; - newscript->pGOHello = &GoHello_blackfathom_altar; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_blackfathom_fire"; - newscript->pGOHello = &GoHello_blackfathom_fire; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_blackfathom_deeps_event"; - newscript->GetAI = &GetAI_npc_blackfathom_deeps_event; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_morridune"; - newscript->GetAI = &GetAI_npc_morridune; - newscript->pGossipHello = &GossipHello_npc_morridune; - newscript->pGossipSelect = &GossipSelect_npc_morridune; - newscript->RegisterSelf(); + new go_blackfathom_altar(); + new go_blackfathom_fire(); + new npc_blackfathom_deeps_event(); + new npc_morridune(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp index 9037fe25ff3..522af3a7aee 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp @@ -23,71 +23,73 @@ enum Spells SPELL_POISON_CLOUD = 3815, SPELL_FRENZIED_RAGE = 3490 }; - -struct boss_aku_maiAI : public ScriptedAI +
class boss_aku_mai : public CreatureScript { - boss_aku_maiAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiPoisonCloudTimer; - bool bIsEnraged; +public: + boss_aku_mai() : CreatureScript("boss_aku_mai") { } - ScriptedInstance *pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiPoisonCloudTimer = urand(5000,9000); - bIsEnraged = false; - if (pInstance) - pInstance->SetData(TYPE_AKU_MAI, NOT_STARTED); + return new boss_aku_maiAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_aku_maiAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(TYPE_AKU_MAI, IN_PROGRESS); - } + boss_aku_maiAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_AKU_MAI, DONE); - } + uint32 uiPoisonCloudTimer; + bool bIsEnraged; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + InstanceScript *pInstance; - if (uiPoisonCloudTimer < diff) + void Reset() { - DoCastVictim(SPELL_POISON_CLOUD); - uiPoisonCloudTimer = urand(25000,50000); - } else uiPoisonCloudTimer -= diff; + uiPoisonCloudTimer = urand(5000,9000); + bIsEnraged = false; + if (pInstance) + pInstance->SetData(TYPE_AKU_MAI, NOT_STARTED); + } - if (!bIsEnraged && HealthBelowPct(30)) + void EnterCombat(Unit* /*who*/) { - DoCast(me,SPELL_FRENZIED_RAGE); - bIsEnraged = true; + if (pInstance) + pInstance->SetData(TYPE_AKU_MAI, IN_PROGRESS); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_AKU_MAI, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiPoisonCloudTimer < diff) + { + DoCastVictim(SPELL_POISON_CLOUD); + uiPoisonCloudTimer = urand(25000,50000); + } else uiPoisonCloudTimer -= diff; + + if (!bIsEnraged && HealthBelowPct(30)) + { + DoCast(me,SPELL_FRENZIED_RAGE); + bIsEnraged = true; + } + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_aku_mai(Creature* pCreature) -{ - return new boss_aku_maiAI (pCreature); -} void AddSC_boss_aku_mai() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_aku_mai"; - newscript->GetAI = &GetAI_boss_aku_mai; - newscript->RegisterSelf(); + new boss_aku_mai(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp index 2525f949f89..d1a05f52ef6 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp @@ -22,63 +22,65 @@ enum Spells { SPELL_NET = 6533 }; - -struct boss_gelihastAI : public ScriptedAI +
class boss_gelihast : public CreatureScript { - boss_gelihastAI(Creature *c) : ScriptedAI(c) +public: + boss_gelihast() : CreatureScript("boss_gelihast") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_gelihastAI (pCreature); } - uint32 uiNetTimer; + struct boss_gelihastAI : public ScriptedAI + { + boss_gelihastAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - ScriptedInstance *pInstance; + uint32 uiNetTimer; - void Reset() - { - uiNetTimer = urand(2000,4000); - if (pInstance) - pInstance->SetData(TYPE_GELIHAST, NOT_STARTED); - } + InstanceScript *pInstance; - void EnterCombat(Unit* /*who*/) - { - if (pInstance) - pInstance->SetData(TYPE_GELIHAST, IN_PROGRESS); - } + void Reset() + { + uiNetTimer = urand(2000,4000); + if (pInstance) + pInstance->SetData(TYPE_GELIHAST, NOT_STARTED); + } - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(TYPE_GELIHAST, DONE); - } + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(TYPE_GELIHAST, IN_PROGRESS); + } - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(TYPE_GELIHAST, DONE); + } - if (uiNetTimer < diff) + void UpdateAI(const uint32 diff) { - DoCastVictim(SPELL_NET); - uiNetTimer = urand(4000,7000); - } else uiNetTimer -= diff; + if (!UpdateVictim()) + return; + + if (uiNetTimer < diff) + { + DoCastVictim(SPELL_NET); + uiNetTimer = urand(4000,7000); + } else uiNetTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_gelihast(Creature* pCreature) -{ - return new boss_gelihastAI (pCreature); -} void AddSC_boss_gelihast() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_gelihast"; - newscript->GetAI = &GetAI_boss_gelihast; - newscript->RegisterSelf(); + new boss_gelihast(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp index a8183971a98..28633137ddc 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp @@ -31,77 +31,79 @@ enum Yells SAY_SLEEP = -1048001, SAY_DEATH = -1048000 }; - -struct boss_kelrisAI : public ScriptedAI +
class boss_kelris : public CreatureScript { - boss_kelrisAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_kelris() : CreatureScript("boss_kelris") { } - uint32 uiMindBlastTimer; - uint32 uiSleepTimer; - - ScriptedInstance *pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiMindBlastTimer = urand(2000,5000); - uiSleepTimer = urand(9000,12000); - if (pInstance) - pInstance->SetData(TYPE_KELRIS, NOT_STARTED); + return new boss_kelrisAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_kelrisAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(TYPE_KELRIS, IN_PROGRESS); - } + boss_kelrisAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); - if (pInstance) - pInstance->SetData(TYPE_KELRIS, DONE); - } + uint32 uiMindBlastTimer; + uint32 uiSleepTimer; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + InstanceScript *pInstance; - if (uiMindBlastTimer < diff) + void Reset() { - DoCastVictim(SPELL_MIND_BLAST); - uiMindBlastTimer = urand(7000,9000); - } else uiMindBlastTimer -= diff; + uiMindBlastTimer = urand(2000,5000); + uiSleepTimer = urand(9000,12000); + if (pInstance) + pInstance->SetData(TYPE_KELRIS, NOT_STARTED); + } - if (uiSleepTimer < diff) + void EnterCombat(Unit* /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(TYPE_KELRIS, IN_PROGRESS); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(TYPE_KELRIS, DONE); + } + + void UpdateAI(const uint32 diff) + { + if (!UpdateVictim()) + return; + + if (uiMindBlastTimer < diff) { - DoScriptText(SAY_SLEEP, me); - DoCast(pTarget, SPELL_SLEEP); - } - uiSleepTimer = urand(15000,20000); - } else uiSleepTimer -= diff; + DoCastVictim(SPELL_MIND_BLAST); + uiMindBlastTimer = urand(7000,9000); + } else uiMindBlastTimer -= diff; + + if (uiSleepTimer < diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + DoScriptText(SAY_SLEEP, me); + DoCast(pTarget, SPELL_SLEEP); + } + uiSleepTimer = urand(15000,20000); + } else uiSleepTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kelris(Creature* pCreature) -{ - return new boss_kelrisAI (pCreature); -} void AddSC_boss_kelris() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_kelris"; - newscript->GetAI = &GetAI_boss_kelris; - newscript->RegisterSelf(); + new boss_kelris(); } diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index 99ddd5cdd82..2d6e43ab707 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -50,212 +50,215 @@ const Position SpawnsLocation[] = {-862.193, -174.251, -25.871, 6.182}, {-863.895, -458.899, -33.891, 5.637} }; - -struct instance_blackfathom_deeps : public ScriptedInstance +
class instance_blackfathom_deeps : public InstanceMapScript { - instance_blackfathom_deeps(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint64 m_uiTwilightLordKelrisGUID; - uint64 m_uiShrine1GUID; - uint64 m_uiShrine2GUID; - uint64 m_uiShrine3GUID; - uint64 m_uiShrine4GUID; - uint64 m_uiShrineOfGelihastGUID; - uint64 m_uiAltarOfTheDeepsGUID; - uint64 m_uiMainDoorGUID; - - uint8 m_auiEncounter[MAX_ENCOUNTER]; - uint8 m_uiCountFires; - uint8 uiDeathTimes; +public: + instance_blackfathom_deeps() : InstanceMapScript("instance_blackfathom_deeps") { } - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiTwilightLordKelrisGUID = 0; - m_uiShrine1GUID = 0; - m_uiShrine2GUID = 0; - m_uiShrine3GUID = 0; - m_uiShrine4GUID = 0; - m_uiShrineOfGelihastGUID = 0; - m_uiAltarOfTheDeepsGUID = 0; - m_uiMainDoorGUID = 0; - m_uiCountFires = 0; - uiDeathTimes = 0; + return new instance_blackfathom_deeps_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_blackfathom_deeps_InstanceMapScript : public InstanceScript { - switch (pCreature->GetEntry()) + instance_blackfathom_deeps_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 m_uiTwilightLordKelrisGUID; + uint64 m_uiShrine1GUID; + uint64 m_uiShrine2GUID; + uint64 m_uiShrine3GUID; + uint64 m_uiShrine4GUID; + uint64 m_uiShrineOfGelihastGUID; + uint64 m_uiAltarOfTheDeepsGUID; + uint64 m_uiMainDoorGUID; + + uint8 m_auiEncounter[MAX_ENCOUNTER]; + uint8 m_uiCountFires; + uint8 uiDeathTimes; + + void Initialize() { - case NPC_TWILIGHT_LORD_KELRIS: - m_uiTwilightLordKelrisGUID = pCreature->GetGUID(); - break; - case NPC_LORGUS_JETT: - pCreature->SetHomePosition(LorgusPosition[urand(0,3)]); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiTwilightLordKelrisGUID = 0; + m_uiShrine1GUID = 0; + m_uiShrine2GUID = 0; + m_uiShrine3GUID = 0; + m_uiShrine4GUID = 0; + m_uiShrineOfGelihastGUID = 0; + m_uiAltarOfTheDeepsGUID = 0; + m_uiMainDoorGUID = 0; + m_uiCountFires = 0; + uiDeathTimes = 0; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_FIRE_OF_AKU_MAI_1: - m_uiShrine1GUID = pGo->GetGUID(); - break; - case GO_FIRE_OF_AKU_MAI_2: - m_uiShrine2GUID = pGo->GetGUID(); - break; - case GO_FIRE_OF_AKU_MAI_3: - m_uiShrine3GUID = pGo->GetGUID(); - break; - case GO_FIRE_OF_AKU_MAI_4: - m_uiShrine4GUID = pGo->GetGUID(); - break; - case GO_SHRINE_OF_GELIHAST: - m_uiShrineOfGelihastGUID = pGo->GetGUID(); - if (m_auiEncounter[0] != DONE) - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - case GO_ALTAR_OF_THE_DEEPS: - m_uiAltarOfTheDeepsGUID = pGo->GetGUID(); - if (m_auiEncounter[3] != DONE) - pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - case GO_AKU_MAI_DOOR: - if (m_auiEncounter[2] == DONE) - HandleGameObject(NULL,true,pGo); - m_uiMainDoorGUID = pGo->GetGUID(); - break; + switch (pCreature->GetEntry()) + { + case NPC_TWILIGHT_LORD_KELRIS: + m_uiTwilightLordKelrisGUID = pCreature->GetGUID(); + break; + case NPC_LORGUS_JETT: + pCreature->SetHomePosition(LorgusPosition[urand(0,3)]); + break; + } } - } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case TYPE_GELIHAST: - m_auiEncounter[0] = uiData; - if (uiData == DONE) - if (GameObject *pGo = instance->GetGameObject(m_uiShrineOfGelihastGUID)) - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - break; - case TYPE_AKU_MAI: - m_auiEncounter[3] = uiData; - if (uiData == DONE) - if (GameObject *pGo = instance->GetGameObject(m_uiAltarOfTheDeepsGUID)) - { - pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); - pGo->SummonCreature(NPC_MORRIDUNE,SpawnsLocation[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - } - break; - case DATA_FIRE: - m_uiCountFires = uiData; - switch (m_uiCountFires) - { - case 1: - if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) + switch(pGo->GetEntry()) + { + case GO_FIRE_OF_AKU_MAI_1: + m_uiShrine1GUID = pGo->GetGUID(); + break; + case GO_FIRE_OF_AKU_MAI_2: + m_uiShrine2GUID = pGo->GetGUID(); + break; + case GO_FIRE_OF_AKU_MAI_3: + m_uiShrine3GUID = pGo->GetGUID(); + break; + case GO_FIRE_OF_AKU_MAI_4: + m_uiShrine4GUID = pGo->GetGUID(); + break; + case GO_SHRINE_OF_GELIHAST: + m_uiShrineOfGelihastGUID = pGo->GetGUID(); + if (m_auiEncounter[0] != DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + case GO_ALTAR_OF_THE_DEEPS: + m_uiAltarOfTheDeepsGUID = pGo->GetGUID(); + if (m_auiEncounter[3] != DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + case GO_AKU_MAI_DOOR: + if (m_auiEncounter[2] == DONE) + HandleGameObject(NULL,true,pGo); + m_uiMainDoorGUID = pGo->GetGUID(); + break; + } + } + + void SetData(uint32 uiType, uint32 uiData) + { + switch(uiType) + { + case TYPE_GELIHAST: + m_auiEncounter[0] = uiData; + if (uiData == DONE) + if (GameObject *pGo = instance->GetGameObject(m_uiShrineOfGelihastGUID)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + break; + case TYPE_AKU_MAI: + m_auiEncounter[3] = uiData; + if (uiData == DONE) + if (GameObject *pGo = instance->GetGameObject(m_uiAltarOfTheDeepsGUID)) { - pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGo->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1); + pGo->SummonCreature(NPC_MORRIDUNE,SpawnsLocation[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); } - break; - case 2: - if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) - { - for (uint8 i = 0; i < 2; ++i) + break; + case DATA_FIRE: + m_uiCountFires = uiData; + switch (m_uiCountFires) + { + case 1: + if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) { - pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SNAPJAW, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); } - } - break; - case 3: - if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) - { - pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - } - break; - case 4: - if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) - { - pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - } - break; - } - break; - case DATA_EVENT: - uiDeathTimes = uiData; - if (uiDeathTimes == 18) - HandleGameObject(m_uiMainDoorGUID,true); - break; + break; + case 2: + if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) + { + for (uint8 i = 0; i < 2; ++i) + { + pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_MURKSHALLOW_SOFTSHELL, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + } + } + break; + case 3: + if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) + { + pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_AKU_MAI_SERVANT, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + } + break; + case 4: + if (GameObject* pGO = instance->GetGameObject(m_uiShrine1GUID)) + { + pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + pGO->SummonCreature(NPC_BARBED_CRUSTACEAN, SpawnsLocation[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + } + break; + } + break; + case DATA_EVENT: + uiDeathTimes = uiData; + if (uiDeathTimes == 18) + HandleGameObject(m_uiMainDoorGUID,true); + break; + } } - } - uint32 GetData(uint32 uiType) - { - switch(uiType) + uint32 GetData(uint32 uiType) { - case TYPE_GELIHAST: - return m_auiEncounter[0]; - case TYPE_KELRIS: - return m_auiEncounter[1]; - case TYPE_SHRINE: - return m_auiEncounter[2]; - case TYPE_AKU_MAI: - return m_auiEncounter[3]; - case DATA_FIRE: - return m_uiCountFires; - case DATA_EVENT: - return uiDeathTimes; - } + switch(uiType) + { + case TYPE_GELIHAST: + return m_auiEncounter[0]; + case TYPE_KELRIS: + return m_auiEncounter[1]; + case TYPE_SHRINE: + return m_auiEncounter[2]; + case TYPE_AKU_MAI: + return m_auiEncounter[3]; + case DATA_FIRE: + return m_uiCountFires; + case DATA_EVENT: + return uiDeathTimes; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 uiData) - { - switch(uiData) + uint64 GetData64(uint32 uiData) { - case DATA_TWILIGHT_LORD_KELRIS: - return m_uiTwilightLordKelrisGUID; - case DATA_SHRINE1: - return m_uiShrine1GUID; - case DATA_SHRINE2: - return m_uiShrine2GUID; - case DATA_SHRINE3: - return m_uiShrine3GUID; - case DATA_SHRINE4: - return m_uiShrine4GUID; - case DATA_SHRINE_OF_GELIHAST: - return m_uiShrineOfGelihastGUID; - case DATA_MAINDOOR: - return m_uiMainDoorGUID; + switch(uiData) + { + case DATA_TWILIGHT_LORD_KELRIS: + return m_uiTwilightLordKelrisGUID; + case DATA_SHRINE1: + return m_uiShrine1GUID; + case DATA_SHRINE2: + return m_uiShrine2GUID; + case DATA_SHRINE3: + return m_uiShrine3GUID; + case DATA_SHRINE4: + return m_uiShrine4GUID; + case DATA_SHRINE_OF_GELIHAST: + return m_uiShrineOfGelihastGUID; + case DATA_MAINDOOR: + return m_uiMainDoorGUID; + } + + return 0; } + }; - return 0; - } }; -InstanceData* GetInstanceData_instance_blackfathom_deeps(Map* pMap) -{ - return new instance_blackfathom_deeps(pMap); -} void AddSC_instance_blackfathom_deeps() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_blackfathom_deeps"; - newscript->GetInstanceData = &GetInstanceData_instance_blackfathom_deeps; - newscript->RegisterSelf(); + new instance_blackfathom_deeps(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index e70eefe62d5..9b94335dac3 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -51,275 +51,281 @@ #define SAY_ONAGGRO "You are defenders of a doomed world! Flee here, and perhaps you will prolong your pathetic lives!" #define SOUND_ONAGGRO 10977 - -struct boss_anetheronAI : public hyjal_trashAI +
class boss_anetheron : public CreatureScript { - boss_anetheronAI(Creature *c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - SpellEntry *TempSpell = GET_SPELL(SPELL_SLEEP); - if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) - { - TempSpell->EffectImplicitTargetA[0] = 1; - TempSpell->EffectImplicitTargetB[0] = 0; - } - } - - uint32 SwarmTimer; - uint32 SleepTimer; - uint32 AuraTimer; - uint32 InfernoTimer; - bool pGo; - uint32 pos; - - void Reset() - { - damageTaken = 0; - SwarmTimer = 45000; - SleepTimer = 60000; - AuraTimer = 5000; - InfernoTimer = 45000; - - if (pInstance && IsEvent) - pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED); - } +public: + boss_anetheron() : CreatureScript("boss_anetheron") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance && IsEvent) - pInstance->SetData(DATA_ANETHERONEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); + return new boss_anetheronAI (pCreature); } - void KilledUnit(Unit * /*victim*/) + struct boss_anetheronAI : public hyjal_trashAI { - switch (urand(0,2)) + boss_anetheronAI(Creature *c) : hyjal_trashAI(c) { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0); - break; + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + SpellEntry *TempSpell = GET_SPELL(SPELL_SLEEP); + if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) + { + TempSpell->EffectImplicitTargetA[0] = 1; + TempSpell->EffectImplicitTargetB[0] = 0; + } } - } - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance) + uint32 SwarmTimer; + uint32 SleepTimer; + uint32 AuraTimer; + uint32 InfernoTimer; + bool pGo; + uint32 pos; + + void Reset() { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } - } + damageTaken = 0; + SwarmTimer = 45000; + SleepTimer = 60000; + AuraTimer = 5000; + InfernoTimer = 45000; - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - if (pInstance && IsEvent) - pInstance->SetData(DATA_ANETHERONEVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0); - } + if (pInstance && IsEvent) + pInstance->SetData(DATA_ANETHERONEVENT, NOT_STARTED); + } - void UpdateAI(const uint32 diff) - { - if (IsEvent) + void EnterCombat(Unit * /*who*/) { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - if (!pGo) - { - pGo = true; - if (pInstance) - { - AddWaypoint(0, 4896.08, -1576.35, 1333.65); - AddWaypoint(1, 4898.68, -1615.02, 1329.48); - AddWaypoint(2, 4907.12, -1667.08, 1321.00); - AddWaypoint(3, 4963.18, -1699.35, 1340.51); - AddWaypoint(4, 4989.16, -1716.67, 1335.74); - AddWaypoint(5, 5026.27, -1736.89, 1323.02); - AddWaypoint(6, 5037.77, -1770.56, 1324.36); - AddWaypoint(7, 5067.23, -1789.95, 1321.17); - Start(false, true); - SetDespawnAtEnd(false); - } - } + if (pInstance && IsEvent) + pInstance->SetData(DATA_ANETHERONEVENT, IN_PROGRESS); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); } - //Return since we have no target - if (!UpdateVictim()) - return; - - if (SwarmTimer <= diff) + void KilledUnit(Unit * /*victim*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CARRION_SWARM); - - SwarmTimer = urand(45000,60000); - switch (urand(0,1)) + switch (urand(0,2)) { case 0: - DoPlaySoundToSet(me, SOUND_SWARM1); - me->MonsterYell(SAY_SWARM1, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_ONSLAY1); + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, 0); break; case 1: - DoPlaySoundToSet(me, SOUND_SWARM2); - me->MonsterYell(SAY_SWARM2, LANG_UNIVERSAL, 0); + DoPlaySoundToSet(me, SOUND_ONSLAY2); + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, 0); + break; + case 2: + DoPlaySoundToSet(me, SOUND_ONSLAY3); + me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, 0); break; } - } else SwarmTimer -= diff; + } - if (SleepTimer <= diff) + void WaypointReached(uint32 i) { - for (uint8 i = 0; i < 3; ++i) + pos = i; + if (i == 7 && pInstance) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - pTarget->CastSpell(pTarget,SPELL_SLEEP,true); - } - SleepTimer = 60000; - switch (urand(0,1)) - { - case 0: - DoPlaySoundToSet(me, SOUND_SLEEP1); - me->MonsterYell(SAY_SLEEP1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_SLEEP2); - me->MonsterYell(SAY_SLEEP2, LANG_UNIVERSAL, 0); - break; + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); } - } else SleepTimer -= diff; - if (AuraTimer <= diff) + } + + void JustDied(Unit *victim) { - DoCast(me, SPELL_VAMPIRIC_AURA, true); - AuraTimer = urand(10000,20000); - } else AuraTimer -= diff; - if (InfernoTimer <= diff) + hyjal_trashAI::JustDied(victim); + if (pInstance && IsEvent) + pInstance->SetData(DATA_ANETHERONEVENT, DONE); + DoPlaySoundToSet(me, SOUND_ONDEATH); + me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, 0); + } + + void UpdateAI(const uint32 diff) { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_INFERNO); - InfernoTimer = 45000; - switch (urand(0,1)) + if (IsEvent) { - case 0: - DoPlaySoundToSet(me, SOUND_INFERNO1); - me->MonsterYell(SAY_INFERNO1, LANG_UNIVERSAL, 0); - break; - case 1: - DoPlaySoundToSet(me, SOUND_INFERNO2); - me->MonsterYell(SAY_INFERNO2, LANG_UNIVERSAL, 0); - break; + //Must update npc_escortAI + npc_escortAI::UpdateAI(diff); + if (!pGo) + { + pGo = true; + if (pInstance) + { + AddWaypoint(0, 4896.08, -1576.35, 1333.65); + AddWaypoint(1, 4898.68, -1615.02, 1329.48); + AddWaypoint(2, 4907.12, -1667.08, 1321.00); + AddWaypoint(3, 4963.18, -1699.35, 1340.51); + AddWaypoint(4, 4989.16, -1716.67, 1335.74); + AddWaypoint(5, 5026.27, -1736.89, 1323.02); + AddWaypoint(6, 5037.77, -1770.56, 1324.36); + AddWaypoint(7, 5067.23, -1789.95, 1321.17); + Start(false, true); + SetDespawnAtEnd(false); + } + } } - } else InfernoTimer -= diff; - DoMeleeAttackIfReady(); - } + //Return since we have no target + if (!UpdateVictim()) + return; + + if (SwarmTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CARRION_SWARM); + + SwarmTimer = urand(45000,60000); + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_SWARM1); + me->MonsterYell(SAY_SWARM1, LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_SWARM2); + me->MonsterYell(SAY_SWARM2, LANG_UNIVERSAL, 0); + break; + } + } else SwarmTimer -= diff; + + if (SleepTimer <= diff) + { + for (uint8 i = 0; i < 3; ++i) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + pTarget->CastSpell(pTarget,SPELL_SLEEP,true); + } + SleepTimer = 60000; + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_SLEEP1); + me->MonsterYell(SAY_SLEEP1, LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_SLEEP2); + me->MonsterYell(SAY_SLEEP2, LANG_UNIVERSAL, 0); + break; + } + } else SleepTimer -= diff; + if (AuraTimer <= diff) + { + DoCast(me, SPELL_VAMPIRIC_AURA, true); + AuraTimer = urand(10000,20000); + } else AuraTimer -= diff; + if (InfernoTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_INFERNO); + InfernoTimer = 45000; + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_INFERNO1); + me->MonsterYell(SAY_INFERNO1, LANG_UNIVERSAL, 0); + break; + case 1: + DoPlaySoundToSet(me, SOUND_INFERNO2); + me->MonsterYell(SAY_INFERNO2, LANG_UNIVERSAL, 0); + break; + } + } else InfernoTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_anetheron(Creature* pCreature) -{ - return new boss_anetheronAI (pCreature); -} #define SPELL_IMMOLATION 31303 #define SPELL_INFERNO_EFFECT 31302 - -struct mob_towering_infernalAI : public ScriptedAI +
class mob_towering_infernal : public CreatureScript { - mob_towering_infernalAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - if (pInstance) - AnetheronGUID = pInstance->GetData64(DATA_ANETHERON); - } - - uint32 ImmolationTimer; - uint32 CheckTimer; - uint64 AnetheronGUID; - ScriptedInstance* pInstance; +public: + mob_towering_infernal() : CreatureScript("mob_towering_infernal") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(me, SPELL_INFERNO_EFFECT); - ImmolationTimer = 5000; - CheckTimer = 5000; + return new mob_towering_infernalAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_towering_infernalAI : public ScriptedAI { - } + mob_towering_infernalAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + if (pInstance) + AnetheronGUID = pInstance->GetData64(DATA_ANETHERON); + } - void KilledUnit(Unit * /*victim*/) - { - } + uint32 ImmolationTimer; + uint32 CheckTimer; + uint64 AnetheronGUID; + InstanceScript* pInstance; - void JustDied(Unit * /*victim*/) - { - } + void Reset() + { + DoCast(me, SPELL_INFERNO_EFFECT); + ImmolationTimer = 5000; + CheckTimer = 5000; + } - void MoveInLineOfSight(Unit *who) - { - if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) - AttackStart(who); - } + void EnterCombat(Unit * /*who*/) + { + } - void UpdateAI(const uint32 diff) - { - if (CheckTimer <= diff) + void KilledUnit(Unit * /*victim*/) + { + } + + void JustDied(Unit * /*victim*/) + { + } + + void MoveInLineOfSight(Unit *who) { - if (AnetheronGUID) + if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) + AttackStart(who); + } + + void UpdateAI(const uint32 diff) + { + if (CheckTimer <= diff) { - Creature* boss = Unit::GetCreature((*me),AnetheronGUID); - if (!boss || (boss && boss->isDead())) + if (AnetheronGUID) { - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); - return; + Creature* boss = Unit::GetCreature((*me),AnetheronGUID); + if (!boss || (boss && boss->isDead())) + { + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + return; + } } - } - CheckTimer = 5000; - } else CheckTimer -= diff; + CheckTimer = 5000; + } else CheckTimer -= diff; - //Return since we have no target - if (!UpdateVictim()) - return; + //Return since we have no target + if (!UpdateVictim()) + return; - if (ImmolationTimer <= diff) - { - DoCast(me, SPELL_IMMOLATION); - ImmolationTimer = 5000; - } else ImmolationTimer -= diff; + if (ImmolationTimer <= diff) + { + DoCast(me, SPELL_IMMOLATION); + ImmolationTimer = 5000; + } else ImmolationTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_towering_infernal(Creature* pCreature) -{ - return new mob_towering_infernalAI (pCreature); -} void AddSC_boss_anetheron() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_anetheron"; - newscript->GetAI = &GetAI_boss_anetheron; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_towering_infernal"; - newscript->GetAI = &GetAI_mob_towering_infernal; - newscript->RegisterSelf(); + new boss_anetheron(); + new mob_towering_infernal(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index 04a838d9adb..1d422b1aa3f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -73,108 +73,141 @@ EndScriptData */ #define NORDRASSIL_X 5503.713 #define NORDRASSIL_Y -3523.436 #define NORDRASSIL_Z 1608.781 - -struct mob_ancient_wispAI : public ScriptedAI +
class mob_ancient_wisp : public CreatureScript { - mob_ancient_wispAI(Creature* c) : ScriptedAI(c) +public: + mob_ancient_wisp() : CreatureScript("mob_ancient_wisp") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - ArchimondeGUID = 0; + return new mob_ancient_wispAI(pCreature); } - ScriptedInstance* pInstance; - uint64 ArchimondeGUID; - uint32 CheckTimer; - - void Reset() + struct mob_ancient_wispAI : public ScriptedAI { - CheckTimer = 1000; + mob_ancient_wispAI(Creature* c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + ArchimondeGUID = 0; + } - if (pInstance) - ArchimondeGUID = pInstance->GetData64(DATA_ARCHIMONDE); + InstanceScript* pInstance; + uint64 ArchimondeGUID; + uint32 CheckTimer; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } + void Reset() + { + CheckTimer = 1000; + + if (pInstance) + ArchimondeGUID = pInstance->GetData64(DATA_ARCHIMONDE); - void EnterCombat(Unit* /*who*/) {} + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - void DamageTaken(Unit* /*done_by*/, uint32 &damage) { damage = 0; } + void EnterCombat(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) - { - if (CheckTimer <= diff) + void DamageTaken(Unit* /*done_by*/, uint32 &damage) { damage = 0; } + + void UpdateAI(const uint32 diff) { - if (Unit* Archimonde = Unit::GetUnit((*me), ArchimondeGUID)) + if (CheckTimer <= diff) { - if ((((Archimonde->GetHealth()*100) / Archimonde->GetMaxHealth()) < 2) || !Archimonde->isAlive()) - DoCast(me, SPELL_DENOUEMENT_WISP); - else - DoCast(Archimonde, SPELL_ANCIENT_SPARK); - } - CheckTimer = 1000; - } else CheckTimer -= diff; - } + if (Unit* Archimonde = Unit::GetUnit((*me), ArchimondeGUID)) + { + if ((((Archimonde->GetHealth()*100) / Archimonde->GetMaxHealth()) < 2) || !Archimonde->isAlive()) + DoCast(me, SPELL_DENOUEMENT_WISP); + else + DoCast(Archimonde, SPELL_ANCIENT_SPARK); + } + CheckTimer = 1000; + } else CheckTimer -= diff; + } + }; + }; /* This script is merely a placeholder for the Doomfire that triggers Doomfire spell. It will - MoveChase the Doomfire Spirit always, until despawn (AttackStart is called upon it's spawn) */ -struct mob_doomfireAI : public ScriptedAI + MoveChase the Doomfire Spirit always, until despawn (AttackStart is called upon it's spawn) */
class mob_doomfire : public CreatureScript { - mob_doomfireAI(Creature* c) : ScriptedAI(c) {} +public: + mob_doomfire() : CreatureScript("mob_doomfire") { } + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_doomfireAI(pCreature); + } + + struct mob_doomfireAI : public ScriptedAI + { + mob_doomfireAI(Creature* c) : ScriptedAI(c) {} - void Reset() { } + void Reset() { } + + void MoveInLineOfSight(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { damage = 0; } + }; - void MoveInLineOfSight(Unit* /*who*/) {} - void EnterCombat(Unit* /*who*/) {} - void DamageTaken(Unit * /*done_by*/, uint32 &damage) { damage = 0; } }; /* This is the script for the Doomfire Spirit Mob. This mob simply follow players or - travels in random directions if pTarget cannot be found. */ -struct mob_doomfire_targettingAI : public ScriptedAI + travels in random directions if pTarget cannot be found. */
class mob_doomfire_targetting : public CreatureScript { - mob_doomfire_targettingAI(Creature* c) : ScriptedAI(c) {} - - uint64 TargetGUID; - uint32 ChangeTargetTimer; +public: + mob_doomfire_targetting() : CreatureScript("mob_doomfire_targetting") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - TargetGUID = 0; - ChangeTargetTimer = 5000; + return new mob_doomfire_targettingAI(pCreature); } - void MoveInLineOfSight(Unit* who) + struct mob_doomfire_targettingAI : public ScriptedAI { - //will update once TargetGUID is 0. In case noone actually moves(not likely) and this is 0 - //when UpdateAI needs it, it will be forced to select randomPoint - if (!TargetGUID && who->GetTypeId() == TYPEID_PLAYER) - TargetGUID = who->GetGUID(); - } + mob_doomfire_targettingAI(Creature* c) : ScriptedAI(c) {} - void EnterCombat(Unit* /*who*/) {} + uint64 TargetGUID; + uint32 ChangeTargetTimer; - void DamageTaken(Unit * /*done_by*/, uint32 &damage) { damage = 0; } + void Reset() + { + TargetGUID = 0; + ChangeTargetTimer = 5000; + } - void UpdateAI(const uint32 diff) - { - if (ChangeTargetTimer <= diff) + void MoveInLineOfSight(Unit* who) { - if (Unit *temp = Unit::GetUnit(*me,TargetGUID)) - { - me->GetMotionMaster()->MoveFollow(temp,0.0f,0.0f); - TargetGUID = 0; - } - else + //will update once TargetGUID is 0. In case noone actually moves(not likely) and this is 0 + //when UpdateAI needs it, it will be forced to select randomPoint + if (!TargetGUID && who->GetTypeId() == TYPEID_PLAYER) + TargetGUID = who->GetGUID(); + } + + void EnterCombat(Unit* /*who*/) {} + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { damage = 0; } + + void UpdateAI(const uint32 diff) + { + if (ChangeTargetTimer <= diff) { - Position pos; - me->GetRandomNearPosition(pos, 40); - me->GetMotionMaster()->MovePoint(0, pos.m_positionX, pos.m_positionY, pos.m_positionZ); - } + if (Unit *temp = Unit::GetUnit(*me,TargetGUID)) + { + me->GetMotionMaster()->MoveFollow(temp,0.0f,0.0f); + TargetGUID = 0; + } + else + { + Position pos; + me->GetRandomNearPosition(pos, 40); + me->GetMotionMaster()->MovePoint(0, pos.m_positionX, pos.m_positionY, pos.m_positionZ); + } + + ChangeTargetTimer = 5000; + } else ChangeTargetTimer -= diff; + } + }; - ChangeTargetTimer = 5000; - } else ChangeTargetTimer -= diff; - } }; /* Finally, Archimonde's script. His script isn't extremely complex, most are simply spells on timers. @@ -184,454 +217,433 @@ struct mob_doomfire_targettingAI : public ScriptedAI is NOT the main tank (creature's victim), then we aggro that player and they become the new victim. For Doomfire, we summon a mob (Doomfire Spirit) for the Doomfire mob to follow. It's spirit will randomly select it's pTarget to follow and then we create the random movement making it unpredictable. */ - -struct boss_archimondeAI : public hyjal_trashAI +
class boss_archimonde : public CreatureScript { - boss_archimondeAI(Creature *c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_archimonde() : CreatureScript("boss_archimonde") { } - ScriptedInstance* pInstance; - - uint64 DoomfireSpiritGUID; - uint64 WorldTreeGUID; - - uint32 DrainNordrassilTimer; - uint32 FearTimer; - uint32 AirBurstTimer; - uint32 GripOfTheLegionTimer; - uint32 DoomfireTimer; - uint32 SoulChargeTimer; - uint32 SoulChargeCount; - uint32 MeleeRangeCheckTimer; - uint32 HandOfDeathTimer; - uint32 SummonWispTimer; - uint32 WispCount; - uint32 EnrageTimer; - uint32 CheckDistanceTimer; - - bool Enraged; - bool BelowTenPercent; - bool HasProtected; - bool IsChanneling; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_ARCHIMONDEEVENT, NOT_STARTED); - - DoomfireSpiritGUID = 0; - damageTaken = 0; - WorldTreeGUID = 0; - - DrainNordrassilTimer = 0; - FearTimer = 42000; - AirBurstTimer = 30000; - GripOfTheLegionTimer = urand(5000,25000); - DoomfireTimer = 20000; - SoulChargeTimer = urand(2000,30000); - SoulChargeCount = 0; - MeleeRangeCheckTimer = 15000; - HandOfDeathTimer = 2000; - WispCount = 0; // When ~30 wisps are summoned, Archimonde dies - EnrageTimer = 600000; // 10 minutes - CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage - SummonWispTimer = 0; - - Enraged = false; - BelowTenPercent = false; - HasProtected = false; - IsChanneling = false; - } - - void EnterCombat(Unit * /*who*/) - { - me->InterruptSpell(CURRENT_CHANNELED_SPELL); - DoScriptText(SAY_AGGRO, me); - DoZoneInCombat(); - - if (pInstance) - pInstance->SetData(DATA_ARCHIMONDEEVENT, IN_PROGRESS); + return new boss_archimondeAI (pCreature); } - void KilledUnit(Unit * victim) + struct boss_archimondeAI : public hyjal_trashAI { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - - if (victim && (victim->GetTypeId() == TYPEID_PLAYER)) - GainSoulCharge(CAST_PLR(victim)); - } - - void GainSoulCharge(Player* victim) - { - switch(victim->getClass()) + boss_archimondeAI(Creature *c) : hyjal_trashAI(c) { - case CLASS_PRIEST: - case CLASS_PALADIN: - case CLASS_WARLOCK: - victim->CastSpell(me, SPELL_SOUL_CHARGE_RED, true); - break; - case CLASS_MAGE: - case CLASS_ROGUE: - case CLASS_WARRIOR: - victim->CastSpell(me, SPELL_SOUL_CHARGE_YELLOW, true); - break; - case CLASS_DRUID: - case CLASS_SHAMAN: - case CLASS_HUNTER: - victim->CastSpell(me, SPELL_SOUL_CHARGE_GREEN, true); - break; + pInstance = c->GetInstanceScript(); } - SoulChargeTimer = urand(2000,30000); - ++SoulChargeCount; - } - - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - DoScriptText(SAY_DEATH, me); - - if (pInstance) - pInstance->SetData(DATA_ARCHIMONDEEVENT, DONE); - } + InstanceScript* pInstance; + + uint64 DoomfireSpiritGUID; + uint64 WorldTreeGUID; + + uint32 DrainNordrassilTimer; + uint32 FearTimer; + uint32 AirBurstTimer; + uint32 GripOfTheLegionTimer; + uint32 DoomfireTimer; + uint32 SoulChargeTimer; + uint32 SoulChargeCount; + uint32 MeleeRangeCheckTimer; + uint32 HandOfDeathTimer; + uint32 SummonWispTimer; + uint32 WispCount; + uint32 EnrageTimer; + uint32 CheckDistanceTimer; + + bool Enraged; + bool BelowTenPercent; + bool HasProtected; + bool IsChanneling; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_ARCHIMONDEEVENT, NOT_STARTED); - bool CanUseFingerOfDeath() - { - // First we check if our current victim is in melee range or not. - Unit* victim = me->getVictim(); - if (victim && me->IsWithinDistInMap(victim, me->GetAttackDistance(victim))) - return false; + DoomfireSpiritGUID = 0; + damageTaken = 0; + WorldTreeGUID = 0; - std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); - if (m_threatlist.empty()) - return false; + DrainNordrassilTimer = 0; + FearTimer = 42000; + AirBurstTimer = 30000; + GripOfTheLegionTimer = urand(5000,25000); + DoomfireTimer = 20000; + SoulChargeTimer = urand(2000,30000); + SoulChargeCount = 0; + MeleeRangeCheckTimer = 15000; + HandOfDeathTimer = 2000; + WispCount = 0; // When ~30 wisps are summoned, Archimonde dies + EnrageTimer = 600000; // 10 minutes + CheckDistanceTimer = 30000; // This checks if he's too close to the World Tree (75 yards from a point on the tree), if true then he will enrage + SummonWispTimer = 0; + + Enraged = false; + BelowTenPercent = false; + HasProtected = false; + IsChanneling = false; + } - std::list<Unit*> targets; - std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); - for (; itr != m_threatlist.end(); ++itr) + void EnterCombat(Unit * /*who*/) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) - targets.push_back(pUnit); - } + me->InterruptSpell(CURRENT_CHANNELED_SPELL); + DoScriptText(SAY_AGGRO, me); + DoZoneInCombat(); - if (targets.empty()) - return false; + if (pInstance) + pInstance->SetData(DATA_ARCHIMONDEEVENT, IN_PROGRESS); + } - targets.sort(Trinity::ObjectDistanceOrderPred(me)); - Unit *pTarget = targets.front(); - if (pTarget) + void KilledUnit(Unit * victim) { - if (!me->IsWithinDistInMap(pTarget, me->GetAttackDistance(pTarget))) - return true; // Cast Finger of Death - else // This target is closest, he is our new tank - me->AddThreat(pTarget, me->getThreatManager().getThreat(me->getVictim())); - } + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - return false; - } + if (victim && (victim->GetTypeId() == TYPEID_PLAYER)) + GainSoulCharge(CAST_PLR(victim)); + } - void JustSummoned(Creature *summoned) - { - if (summoned->GetEntry() == CREATURE_ANCIENT_WISP) - summoned->AI()->AttackStart(me); - else + void GainSoulCharge(Player* victim) { - summoned->setFaction(me->getFaction()); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + switch(victim->getClass()) + { + case CLASS_PRIEST: + case CLASS_PALADIN: + case CLASS_WARLOCK: + victim->CastSpell(me, SPELL_SOUL_CHARGE_RED, true); + break; + case CLASS_MAGE: + case CLASS_ROGUE: + case CLASS_WARRIOR: + victim->CastSpell(me, SPELL_SOUL_CHARGE_YELLOW, true); + break; + case CLASS_DRUID: + case CLASS_SHAMAN: + case CLASS_HUNTER: + victim->CastSpell(me, SPELL_SOUL_CHARGE_GREEN, true); + break; + } + + SoulChargeTimer = urand(2000,30000); + ++SoulChargeCount; } - if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT) + void JustDied(Unit *victim) { - DoomfireSpiritGUID = summoned->GetGUID(); + hyjal_trashAI::JustDied(victim); + DoScriptText(SAY_DEATH, me); + + if (pInstance) + pInstance->SetData(DATA_ARCHIMONDEEVENT, DONE); } - if (summoned->GetEntry() == CREATURE_DOOMFIRE) + bool CanUseFingerOfDeath() { - summoned->CastSpell(summoned,SPELL_DOOMFIRE_SPAWN,false); - summoned->CastSpell(summoned,SPELL_DOOMFIRE,true,0,0,me->GetGUID()); + // First we check if our current victim is in melee range or not. + Unit* victim = me->getVictim(); + if (victim && me->IsWithinDistInMap(victim, me->GetAttackDistance(victim))) + return false; + + std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); + if (m_threatlist.empty()) + return false; + + std::list<Unit*> targets; + std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); + for (; itr != m_threatlist.end(); ++itr) + { + Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (pUnit && pUnit->isAlive()) + targets.push_back(pUnit); + } - if (Unit *DoomfireSpirit = Unit::GetUnit(*me, DoomfireSpiritGUID)) + if (targets.empty()) + return false; + + targets.sort(Trinity::ObjectDistanceOrderPred(me)); + Unit *pTarget = targets.front(); + if (pTarget) { - summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit,0.0f,0.0f); - DoomfireSpiritGUID = 0; + if (!me->IsWithinDistInMap(pTarget, me->GetAttackDistance(pTarget))) + return true; // Cast Finger of Death + else // This target is closest, he is our new tank + me->AddThreat(pTarget, me->getThreatManager().getThreat(me->getVictim())); } + + return false; } - } - //this is code doing close to what the summoning spell would do (spell 31903) - void SummonDoomfire(Unit *pTarget) - { - me->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, - pTarget->GetPositionX()+15.0,pTarget->GetPositionY()+15.0,pTarget->GetPositionZ(),0, - TEMPSUMMON_TIMED_DESPAWN, 27000); + void JustSummoned(Creature *summoned) + { + if (summoned->GetEntry() == CREATURE_ANCIENT_WISP) + summoned->AI()->AttackStart(me); + else + { + summoned->setFaction(me->getFaction()); + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + summoned->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } - me->SummonCreature(CREATURE_DOOMFIRE, - pTarget->GetPositionX()-15.0,pTarget->GetPositionY()-15.0,pTarget->GetPositionZ(),0, - TEMPSUMMON_TIMED_DESPAWN, 27000); - } + if (summoned->GetEntry() == CREATURE_DOOMFIRE_SPIRIT) + { + DoomfireSpiritGUID = summoned->GetGUID(); + } - void UnleashSoulCharge() - { - me->InterruptNonMeleeSpells(false); + if (summoned->GetEntry() == CREATURE_DOOMFIRE) + { + summoned->CastSpell(summoned,SPELL_DOOMFIRE_SPAWN,false); + summoned->CastSpell(summoned,SPELL_DOOMFIRE,true,0,0,me->GetGUID()); - bool HasCast = false; - uint32 chargeSpell = 0; - uint32 unleashSpell = 0; + if (Unit *DoomfireSpirit = Unit::GetUnit(*me, DoomfireSpiritGUID)) + { + summoned->GetMotionMaster()->MoveFollow(DoomfireSpirit,0.0f,0.0f); + DoomfireSpiritGUID = 0; + } + } + } - switch (urand(0,2)) + //this is code doing close to what the summoning spell would do (spell 31903) + void SummonDoomfire(Unit *pTarget) { - case 0: - chargeSpell = SPELL_SOUL_CHARGE_RED; - unleashSpell = SPELL_UNLEASH_SOUL_RED; - break; - case 1: - chargeSpell = SPELL_SOUL_CHARGE_YELLOW; - unleashSpell = SPELL_UNLEASH_SOUL_YELLOW; - break; - case 2: - chargeSpell = SPELL_SOUL_CHARGE_GREEN; - unleashSpell = SPELL_UNLEASH_SOUL_GREEN; - break; + me->SummonCreature(CREATURE_DOOMFIRE_SPIRIT, + pTarget->GetPositionX()+15.0,pTarget->GetPositionY()+15.0,pTarget->GetPositionZ(),0, + TEMPSUMMON_TIMED_DESPAWN, 27000); + + me->SummonCreature(CREATURE_DOOMFIRE, + pTarget->GetPositionX()-15.0,pTarget->GetPositionY()-15.0,pTarget->GetPositionZ(),0, + TEMPSUMMON_TIMED_DESPAWN, 27000); } - if (me->HasAura(chargeSpell)) + void UnleashSoulCharge() { - me->RemoveAuraFromStack(chargeSpell); - DoCast(me->getVictim(), unleashSpell); - HasCast = true; - SoulChargeCount--; - } + me->InterruptNonMeleeSpells(false); - if (HasCast) - SoulChargeTimer = urand(2000,30000); - } + bool HasCast = false; + uint32 chargeSpell = 0; + uint32 unleashSpell = 0; - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat()) - { - if (pInstance) + switch (urand(0,2)) { - // Do not let the raid skip straight to Archimonde. Visible and hostile ONLY if Azagalor is finished. - if ((pInstance->GetData(DATA_AZGALOREVENT) < DONE) && ((me->GetVisibility() != VISIBILITY_OFF) || (me->getFaction() != 35))) - { - me->SetVisibility(VISIBILITY_OFF); - me->setFaction(35); - } - else if ((pInstance->GetData(DATA_AZGALOREVENT) >= DONE) && ((me->GetVisibility() != VISIBILITY_ON) || (me->getFaction() == 35))) - { - me->setFaction(1720); - me->SetVisibility(VISIBILITY_ON); - } + case 0: + chargeSpell = SPELL_SOUL_CHARGE_RED; + unleashSpell = SPELL_UNLEASH_SOUL_RED; + break; + case 1: + chargeSpell = SPELL_SOUL_CHARGE_YELLOW; + unleashSpell = SPELL_UNLEASH_SOUL_YELLOW; + break; + case 2: + chargeSpell = SPELL_SOUL_CHARGE_GREEN; + unleashSpell = SPELL_UNLEASH_SOUL_GREEN; + break; } - if (DrainNordrassilTimer <= diff) + if (me->HasAura(chargeSpell)) { - if (!IsChanneling) - { - Creature *temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 1200000); + me->RemoveAuraFromStack(chargeSpell); + DoCast(me->getVictim(), unleashSpell); + HasCast = true; + SoulChargeCount--; + } - if (temp) - WorldTreeGUID = temp->GetGUID(); + if (HasCast) + SoulChargeTimer = urand(2000,30000); + } - if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + void UpdateAI(const uint32 diff) + { + if (!me->isInCombat()) + { + if (pInstance) + { + // Do not let the raid skip straight to Archimonde. Visible and hostile ONLY if Azagalor is finished. + if ((pInstance->GetData(DATA_AZGALOREVENT) < DONE) && ((me->GetVisibility() != VISIBILITY_OFF) || (me->getFaction() != 35))) + { + me->SetVisibility(VISIBILITY_OFF); + me->setFaction(35); + } + else if ((pInstance->GetData(DATA_AZGALOREVENT) >= DONE) && ((me->GetVisibility() != VISIBILITY_ON) || (me->getFaction() == 35))) { - Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - Nordrassil->SetDisplayId(11686); - DoCast(Nordrassil, SPELL_DRAIN_WORLD_TREE); - IsChanneling = true; + me->setFaction(1720); + me->SetVisibility(VISIBILITY_ON); } } - if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + if (DrainNordrassilTimer <= diff) { - Nordrassil->CastSpell(me, SPELL_DRAIN_WORLD_TREE_2, true); - DrainNordrassilTimer = 1000; - } - } else DrainNordrassilTimer -= diff; - } + if (!IsChanneling) + { + Creature *temp = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 1200000); + + if (temp) + WorldTreeGUID = temp->GetGUID(); + + if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + { + Nordrassil->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + Nordrassil->SetDisplayId(11686); + DoCast(Nordrassil, SPELL_DRAIN_WORLD_TREE); + IsChanneling = true; + } + } - if (!UpdateVictim()) - return; + if (Unit *Nordrassil = Unit::GetUnit(*me, WorldTreeGUID)) + { + Nordrassil->CastSpell(me, SPELL_DRAIN_WORLD_TREE_2, true); + DrainNordrassilTimer = 1000; + } + } else DrainNordrassilTimer -= diff; + } - if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !BelowTenPercent && !Enraged) - BelowTenPercent = true; + if (!UpdateVictim()) + return; - if (!Enraged) - { - if (EnrageTimer <= diff) - { - if ((me->GetHealth()*100 / me->GetMaxHealth()) > 10) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - Enraged = true; - DoScriptText(SAY_ENRAGE, me); - } - } else EnrageTimer -= diff; + if (((me->GetHealth()*100 / me->GetMaxHealth()) < 10) && !BelowTenPercent && !Enraged) + BelowTenPercent = true; - if (CheckDistanceTimer <= diff) + if (!Enraged) { - // To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature - Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000); - if (Check) + if (EnrageTimer <= diff) { - Check->SetVisibility(VISIBILITY_OFF); - - if (me->IsWithinDistInMap(Check, 75)) + if ((me->GetHealth()*100 / me->GetMaxHealth()) > 10) { me->GetMotionMaster()->Clear(false); me->GetMotionMaster()->MoveIdle(); Enraged = true; DoScriptText(SAY_ENRAGE, me); } - } - CheckDistanceTimer = 5000; - } else CheckDistanceTimer -= diff; - } - - if (BelowTenPercent) - { - if (!HasProtected) - { - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); + } else EnrageTimer -= diff; - //all members of raid must get this buff - DoCast(me->getVictim(), SPELL_PROTECTION_OF_ELUNE); - HasProtected = true; - Enraged = true; + if (CheckDistanceTimer <= diff) + { + // To simplify the check, we simply summon a Creature in the location and then check how far we are from the creature + Creature* Check = me->SummonCreature(CREATURE_CHANNEL_TARGET, NORDRASSIL_X, NORDRASSIL_Y, NORDRASSIL_Z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000); + if (Check) + { + Check->SetVisibility(VISIBILITY_OFF); + + if (me->IsWithinDistInMap(Check, 75)) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + Enraged = true; + DoScriptText(SAY_ENRAGE, me); + } + } + CheckDistanceTimer = 5000; + } else CheckDistanceTimer -= diff; } - if (SummonWispTimer <= diff) + if (BelowTenPercent) { - DoSpawnCreature(CREATURE_ANCIENT_WISP, rand()%40, rand()%40, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - SummonWispTimer = 1500; - ++WispCount; - } else SummonWispTimer -= diff; + if (!HasProtected) + { + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); - if (WispCount >= 30) - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } + //all members of raid must get this buff + DoCast(me->getVictim(), SPELL_PROTECTION_OF_ELUNE); + HasProtected = true; + Enraged = true; + } - if (Enraged) - { - if (HandOfDeathTimer <= diff) + if (SummonWispTimer <= diff) + { + DoSpawnCreature(CREATURE_ANCIENT_WISP, rand()%40, rand()%40, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + SummonWispTimer = 1500; + ++WispCount; + } else SummonWispTimer -= diff; + + if (WispCount >= 30) + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + + if (Enraged) { - DoCast(me->getVictim(), SPELL_HAND_OF_DEATH); - HandOfDeathTimer = 2000; - } else HandOfDeathTimer -= diff; - return; // Don't do anything after this point. - } + if (HandOfDeathTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HAND_OF_DEATH); + HandOfDeathTimer = 2000; + } else HandOfDeathTimer -= diff; + return; // Don't do anything after this point. + } - if (SoulChargeCount) - { - if (SoulChargeTimer <= diff) - UnleashSoulCharge(); - else SoulChargeTimer -= diff; - } + if (SoulChargeCount) + { + if (SoulChargeTimer <= diff) + UnleashSoulCharge(); + else SoulChargeTimer -= diff; + } - if (GripOfTheLegionTimer <= diff) - { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_GRIP_OF_THE_LEGION); - GripOfTheLegionTimer = urand(5000,25000); - } else GripOfTheLegionTimer -= diff; + if (GripOfTheLegionTimer <= diff) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_GRIP_OF_THE_LEGION); + GripOfTheLegionTimer = urand(5000,25000); + } else GripOfTheLegionTimer -= diff; - if (AirBurstTimer <= diff) - { - if (urand(0,1)) - DoScriptText(SAY_AIR_BURST1, me); - else - DoScriptText(SAY_AIR_BURST2, me); + if (AirBurstTimer <= diff) + { + if (urand(0,1)) + DoScriptText(SAY_AIR_BURST1, me); + else + DoScriptText(SAY_AIR_BURST2, me); - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank - AirBurstTimer = urand(25000,40000); - } else AirBurstTimer -= diff; + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 1), SPELL_AIR_BURST);//not on tank + AirBurstTimer = urand(25000,40000); + } else AirBurstTimer -= diff; - if (FearTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FEAR); - FearTimer = 42000; - } else FearTimer -= diff; + if (FearTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FEAR); + FearTimer = 42000; + } else FearTimer -= diff; - if (DoomfireTimer <= diff) - { - if (urand(0,1)) - DoScriptText(SAY_DOOMFIRE1, me); - else - DoScriptText(SAY_DOOMFIRE2, me); + if (DoomfireTimer <= diff) + { + if (urand(0,1)) + DoScriptText(SAY_DOOMFIRE1, me); + else + DoScriptText(SAY_DOOMFIRE2, me); - Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 1); - if (!temp) - temp = me->getVictim(); + Unit *temp = SelectUnit(SELECT_TARGET_RANDOM, 1); + if (!temp) + temp = me->getVictim(); - //replace with spell cast 31903 once implicitTarget 73 implemented - SummonDoomfire(temp); + //replace with spell cast 31903 once implicitTarget 73 implemented + SummonDoomfire(temp); - //supposedly three doomfire can be up at the same time - DoomfireTimer = 20000; - } else DoomfireTimer -= diff; + //supposedly three doomfire can be up at the same time + DoomfireTimer = 20000; + } else DoomfireTimer -= diff; - if (MeleeRangeCheckTimer <= diff) - { - if (CanUseFingerOfDeath()) + if (MeleeRangeCheckTimer <= diff) { - DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FINGER_OF_DEATH); - MeleeRangeCheckTimer = 1000; - } + if (CanUseFingerOfDeath()) + { + DoCast(SelectUnit(SELECT_TARGET_RANDOM, 0), SPELL_FINGER_OF_DEATH); + MeleeRangeCheckTimer = 1000; + } - MeleeRangeCheckTimer = 5000; - } else MeleeRangeCheckTimer -= diff; + MeleeRangeCheckTimer = 5000; + } else MeleeRangeCheckTimer -= diff; + + DoMeleeAttackIfReady(); + } + void WaypointReached(uint32 /*i*/){} + }; - DoMeleeAttackIfReady(); - } - void WaypointReached(uint32 /*i*/){} }; -CreatureAI* GetAI_boss_archimonde(Creature* pCreature) -{ - return new boss_archimondeAI (pCreature); -} -CreatureAI* GetAI_mob_doomfire(Creature* pCreature) -{ - return new mob_doomfireAI(pCreature); -} -CreatureAI* GetAI_mob_doomfire_targetting(Creature* pCreature) -{ - return new mob_doomfire_targettingAI(pCreature); -} -CreatureAI* GetAI_mob_ancient_wisp(Creature* pCreature) -{ - return new mob_ancient_wispAI(pCreature); -} void AddSC_boss_archimonde() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_archimonde"; - newscript->GetAI = &GetAI_boss_archimonde; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_doomfire"; - newscript->GetAI = &GetAI_mob_doomfire; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_doomfire_targetting"; - newscript->GetAI = &GetAI_mob_doomfire_targetting; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ancient_wisp"; - newscript->GetAI = &GetAI_mob_ancient_wisp; - newscript->RegisterSelf(); + new boss_archimonde(); + new mob_doomfire(); + new mob_doomfire_targetting(); + new mob_ancient_wisp(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 50b86c7fa30..39ab6f2e886 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -42,260 +42,266 @@ #define SAY_ONAGGRO "Abandon all hope! The legion has returned to finish what was begun so many years ago. This time there will be no escape!" #define SOUND_ONAGGRO 10999 - -struct boss_azgalorAI : public hyjal_trashAI +
class boss_azgalor : public CreatureScript { - boss_azgalorAI(Creature *c) : hyjal_trashAI(c) +public: + boss_azgalor() : CreatureScript("boss_azgalor") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - SpellEntry *TempSpell = GET_SPELL(SPELL_HOWL_OF_AZGALOR); - if (TempSpell) - TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?! + return new boss_azgalorAI (pCreature); } - uint32 RainTimer; - uint32 DoomTimer; - uint32 HowlTimer; - uint32 CleaveTimer; - uint32 EnrageTimer; - bool enraged; + struct boss_azgalorAI : public hyjal_trashAI + { + boss_azgalorAI(Creature *c) : hyjal_trashAI(c) + { + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + SpellEntry *TempSpell = GET_SPELL(SPELL_HOWL_OF_AZGALOR); + if (TempSpell) + TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?! + } - bool pGo; - uint32 pos; + uint32 RainTimer; + uint32 DoomTimer; + uint32 HowlTimer; + uint32 CleaveTimer; + uint32 EnrageTimer; + bool enraged; - void Reset() - { - damageTaken = 0; - RainTimer = 20000; - DoomTimer = 50000; - HowlTimer = 30000; - CleaveTimer = 10000; - EnrageTimer = 600000; - enraged = false; - - if (pInstance && IsEvent) - pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED); - } + bool pGo; + uint32 pos; - void EnterCombat(Unit * /*who*/) - { - if (pInstance && IsEvent) - pInstance->SetData(DATA_AZGALOREVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); - } + void Reset() + { + damageTaken = 0; + RainTimer = 20000; + DoomTimer = 50000; + HowlTimer = 30000; + CleaveTimer = 10000; + EnrageTimer = 600000; + enraged = false; - void KilledUnit(Unit * /*victim*/) - { - switch (urand(0,2)) + if (pInstance && IsEvent) + pInstance->SetData(DATA_AZGALOREVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL); - break; + if (pInstance && IsEvent) + pInstance->SetData(DATA_AZGALOREVENT, IN_PROGRESS); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); } - } - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance) + void KilledUnit(Unit * /*victim*/) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); + switch (urand(0,2)) + { + case 0: + DoPlaySoundToSet(me, SOUND_ONSLAY1); + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_ONSLAY2); + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); + break; + case 2: + DoPlaySoundToSet(me, SOUND_ONSLAY3); + me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL); + break; + } } - } - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - if (pInstance && IsEvent) - pInstance->SetData(DATA_AZGALOREVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - } + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } - void UpdateAI(const uint32 diff) - { - if (IsEvent) + void JustDied(Unit *victim) + { + hyjal_trashAI::JustDied(victim); + if (pInstance && IsEvent) + pInstance->SetData(DATA_AZGALOREVENT, DONE); + DoPlaySoundToSet(me, SOUND_ONDEATH); + } + + void UpdateAI(const uint32 diff) { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - if (!pGo) + if (IsEvent) { - pGo = true; - if (pInstance) + //Must update npc_escortAI + npc_escortAI::UpdateAI(diff); + if (!pGo) { - AddWaypoint(0, 5492.91, -2404.61, 1462.63); - AddWaypoint(1, 5531.76, -2460.87, 1469.55); - AddWaypoint(2, 5554.58, -2514.66, 1476.12); - AddWaypoint(3, 5554.16, -2567.23, 1479.90); - AddWaypoint(4, 5540.67, -2625.99, 1480.89); - AddWaypoint(5, 5508.16, -2659.2, 1480.15); - AddWaypoint(6, 5489.62, -2704.05, 1482.18); - AddWaypoint(7, 5457.04, -2726.26, 1485.10); - Start(false, true); - SetDespawnAtEnd(false); + pGo = true; + if (pInstance) + { + AddWaypoint(0, 5492.91, -2404.61, 1462.63); + AddWaypoint(1, 5531.76, -2460.87, 1469.55); + AddWaypoint(2, 5554.58, -2514.66, 1476.12); + AddWaypoint(3, 5554.16, -2567.23, 1479.90); + AddWaypoint(4, 5540.67, -2625.99, 1480.89); + AddWaypoint(5, 5508.16, -2659.2, 1480.15); + AddWaypoint(6, 5489.62, -2704.05, 1482.18); + AddWaypoint(7, 5457.04, -2726.26, 1485.10); + Start(false, true); + SetDespawnAtEnd(false); + } } } - } - //Return since we have no target - if (!UpdateVictim()) - return; + //Return since we have no target + if (!UpdateVictim()) + return; - if (RainTimer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE); - RainTimer = 20000+rand()%15000; - } else RainTimer -= diff; + if (RainTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,30,true), SPELL_RAIN_OF_FIRE); + RainTimer = 20000+rand()%15000; + } else RainTimer -= diff; - if (DoomTimer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank - DoomTimer = 45000+rand()%5000; - } else DoomTimer -= diff; + if (DoomTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM,1,100,true), SPELL_DOOM);//never on tank + DoomTimer = 45000+rand()%5000; + } else DoomTimer -= diff; - if (HowlTimer <= diff) - { - DoCast(me, SPELL_HOWL_OF_AZGALOR); - HowlTimer = 30000; - } else HowlTimer -= diff; + if (HowlTimer <= diff) + { + DoCast(me, SPELL_HOWL_OF_AZGALOR); + HowlTimer = 30000; + } else HowlTimer -= diff; - if (CleaveTimer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - CleaveTimer = 10000+rand()%5000; - } else CleaveTimer -= diff; + if (CleaveTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + CleaveTimer = 10000+rand()%5000; + } else CleaveTimer -= diff; - if (EnrageTimer < diff && !enraged) - { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_BERSERK, true); - enraged = true; - EnrageTimer = 600000; - } else EnrageTimer -= diff; + if (EnrageTimer < diff && !enraged) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_BERSERK, true); + enraged = true; + EnrageTimer = 600000; + } else EnrageTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_azgalor(Creature* pCreature) -{ - return new boss_azgalorAI (pCreature); -} #define SPELL_THRASH 12787 #define SPELL_CRIPPLE 31406 #define SPELL_WARSTOMP 31408 - -struct mob_lesser_doomguardAI : public hyjal_trashAI +
class mob_lesser_doomguard : public CreatureScript { - mob_lesser_doomguardAI(Creature *c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - if (pInstance) - AzgalorGUID = pInstance->GetData64(DATA_AZGALOR); - } - - uint32 CrippleTimer; - uint32 WarstompTimer; - uint32 CheckTimer; - uint64 AzgalorGUID; - ScriptedInstance* pInstance; +public: + mob_lesser_doomguard() : CreatureScript("mob_lesser_doomguard") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CrippleTimer = 50000; - WarstompTimer = 10000; - DoCast(me, SPELL_THRASH); - CheckTimer = 5000; + return new mob_lesser_doomguardAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_lesser_doomguardAI : public hyjal_trashAI { - } + mob_lesser_doomguardAI(Creature *c) : hyjal_trashAI(c) + { + pInstance = c->GetInstanceScript(); + if (pInstance) + AzgalorGUID = pInstance->GetData64(DATA_AZGALOR); + } - void KilledUnit(Unit * /*victim*/) - { - } + uint32 CrippleTimer; + uint32 WarstompTimer; + uint32 CheckTimer; + uint64 AzgalorGUID; + InstanceScript* pInstance; - void WaypointReached(uint32 /*i*/) - { - } + void Reset() + { + CrippleTimer = 50000; + WarstompTimer = 10000; + DoCast(me, SPELL_THRASH); + CheckTimer = 5000; + } - void MoveInLineOfSight(Unit *who) - { - if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) - AttackStart(who); - } + void EnterCombat(Unit * /*who*/) + { + } - void JustDied(Unit * /*victim*/) - { - } + void KilledUnit(Unit * /*victim*/) + { + } - void UpdateAI(const uint32 diff) - { - if (CheckTimer <= diff) + void WaypointReached(uint32 /*i*/) + { + } + + void MoveInLineOfSight(Unit *who) + { + if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) + AttackStart(who); + } + + void JustDied(Unit * /*victim*/) + { + } + + void UpdateAI(const uint32 diff) { - if (AzgalorGUID) + if (CheckTimer <= diff) { - Creature* boss = Unit::GetCreature((*me),AzgalorGUID); - if (!boss || (boss && boss->isDead())) + if (AzgalorGUID) { - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); - return; + Creature* boss = Unit::GetCreature((*me),AzgalorGUID); + if (!boss || (boss && boss->isDead())) + { + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + return; + } } - } - CheckTimer = 5000; - } else CheckTimer -= diff; + CheckTimer = 5000; + } else CheckTimer -= diff; - //Return since we have no target - if (!UpdateVictim()) - return; + //Return since we have no target + if (!UpdateVictim()) + return; - if (WarstompTimer <= diff) - { - DoCast(me, SPELL_WARSTOMP); - WarstompTimer = 10000+rand()%5000; - } else WarstompTimer -= diff; + if (WarstompTimer <= diff) + { + DoCast(me, SPELL_WARSTOMP); + WarstompTimer = 10000+rand()%5000; + } else WarstompTimer -= diff; - if (CrippleTimer <= diff) - { - DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_CRIPPLE); - CrippleTimer = 25000+rand()%5000; - } else CrippleTimer -= diff; + if (CrippleTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true), SPELL_CRIPPLE); + CrippleTimer = 25000+rand()%5000; + } else CrippleTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_lesser_doomguard(Creature* pCreature) -{ - return new mob_lesser_doomguardAI (pCreature); -} void AddSC_boss_azgalor() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_azgalor"; - newscript->GetAI = &GetAI_boss_azgalor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_lesser_doomguard"; - newscript->GetAI = &GetAI_mob_lesser_doomguard; - newscript->RegisterSelf(); + new boss_azgalor(); + new mob_lesser_doomguard(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 2e9228b2f75..779088297f5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -39,175 +39,178 @@ #define SAY_ONAGGRO "Cry for mercy! Your meaningless lives will soon be forfeit." #define SOUND_ONAGGRO 11015 - -struct boss_kazrogalAI : public hyjal_trashAI +
class boss_kazrogal : public CreatureScript { - boss_kazrogalAI(Creature *c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - SpellEntry *TempSpell = GET_SPELL(SPELL_MARK); - if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) - { - TempSpell->EffectImplicitTargetA[0] = 1; - TempSpell->EffectImplicitTargetB[0] = 0; - } - } - - uint32 CleaveTimer; - uint32 WarStompTimer; - uint32 MarkTimer; - uint32 MarkTimerBase; - bool pGo; - uint32 pos; - - void Reset() - { - damageTaken = 0; - CleaveTimer = 5000; - WarStompTimer = 15000; - MarkTimer = 45000; - MarkTimerBase = 45000; - - if (pInstance && IsEvent) - pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED); - } +public: + boss_kazrogal() : CreatureScript("boss_kazrogal") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance && IsEvent) - pInstance->SetData(DATA_KAZROGALEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); + return new boss_kazrogalAI (pCreature); } - void KilledUnit(Unit * /*victim*/) + struct boss_kazrogalAI : public hyjal_trashAI { - switch (urand(0,2)) + boss_kazrogalAI(Creature *c) : hyjal_trashAI(c) { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); - break; - case 2: - DoPlaySoundToSet(me, SOUND_ONSLAY3); - me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL); - break; + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + SpellEntry *TempSpell = GET_SPELL(SPELL_MARK); + if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1) + { + TempSpell->EffectImplicitTargetA[0] = 1; + TempSpell->EffectImplicitTargetB[0] = 0; + } } - } - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance) + uint32 CleaveTimer; + uint32 WarStompTimer; + uint32 MarkTimer; + uint32 MarkTimerBase; + bool pGo; + uint32 pos; + + void Reset() { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); + damageTaken = 0; + CleaveTimer = 5000; + WarStompTimer = 15000; + MarkTimer = 45000; + MarkTimerBase = 45000; + + if (pInstance && IsEvent) + pInstance->SetData(DATA_KAZROGALEVENT, NOT_STARTED); } - } - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - if (pInstance && IsEvent) - pInstance->SetData(DATA_KAZROGALEVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - } + void EnterCombat(Unit * /*who*/) + { + if (pInstance && IsEvent) + pInstance->SetData(DATA_KAZROGALEVENT, IN_PROGRESS); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, NULL); + } - void UpdateAI(const uint32 diff) - { - if (IsEvent) + void KilledUnit(Unit * /*victim*/) { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - if (!pGo) + switch (urand(0,2)) { - pGo = true; - if (pInstance) - { - AddWaypoint(0, 5492.91, -2404.61, 1462.63); - AddWaypoint(1, 5531.76, -2460.87, 1469.55); - AddWaypoint(2, 5554.58, -2514.66, 1476.12); - AddWaypoint(3, 5554.16, -2567.23, 1479.90); - AddWaypoint(4, 5540.67, -2625.99, 1480.89); - AddWaypoint(5, 5508.16, -2659.2, 1480.15); - AddWaypoint(6, 5489.62, -2704.05, 1482.18); - AddWaypoint(7, 5457.04, -2726.26, 1485.10); - Start(false, true); - SetDespawnAtEnd(false); - } + case 0: + DoPlaySoundToSet(me, SOUND_ONSLAY1); + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_ONSLAY2); + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); + break; + case 2: + DoPlaySoundToSet(me, SOUND_ONSLAY3); + me->MonsterYell(SAY_ONSLAY3, LANG_UNIVERSAL, NULL); + break; } } - //Return since we have no target - if (!UpdateVictim()) - return; - - if (CleaveTimer <= diff) + void WaypointReached(uint32 i) { - DoCast(me, SPELL_CLEAVE); - CleaveTimer = 6000+rand()%15000; - } else CleaveTimer -= diff; + pos = i; + if (i == 7 && pInstance) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } - if (WarStompTimer <= diff) + void JustDied(Unit *victim) { - DoCast(me, SPELL_WARSTOMP); - WarStompTimer = 60000; - } else WarStompTimer -= diff; + hyjal_trashAI::JustDied(victim); + if (pInstance && IsEvent) + pInstance->SetData(DATA_KAZROGALEVENT, DONE); + DoPlaySoundToSet(me, SOUND_ONDEATH); + } - if (me->HasAura(SPELL_MARK)) - me->RemoveAurasDueToSpell(SPELL_MARK); - if (MarkTimer <= diff) + void UpdateAI(const uint32 diff) { - //cast dummy, useful for bos addons - me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID()); - - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + if (IsEvent) { - Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA) + //Must update npc_escortAI + npc_escortAI::UpdateAI(diff); + if (!pGo) { - pTarget->CastSpell(pTarget, SPELL_MARK,true);//only cast on mana users + pGo = true; + if (pInstance) + { + AddWaypoint(0, 5492.91, -2404.61, 1462.63); + AddWaypoint(1, 5531.76, -2460.87, 1469.55); + AddWaypoint(2, 5554.58, -2514.66, 1476.12); + AddWaypoint(3, 5554.16, -2567.23, 1479.90); + AddWaypoint(4, 5540.67, -2625.99, 1480.89); + AddWaypoint(5, 5508.16, -2659.2, 1480.15); + AddWaypoint(6, 5489.62, -2704.05, 1482.18); + AddWaypoint(7, 5457.04, -2726.26, 1485.10); + Start(false, true); + SetDespawnAtEnd(false); + } } } - MarkTimerBase -= 5000; - if (MarkTimerBase < 5500) - MarkTimerBase = 5500; - MarkTimer = MarkTimerBase; - switch (urand(0,2)) + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (CleaveTimer <= diff) { - case 0: - DoPlaySoundToSet(me, SOUND_MARK1); - me->MonsterYell(SAY_MARK1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_MARK2); - me->MonsterYell(SAY_MARK2, LANG_UNIVERSAL, NULL); - break; - } - } else MarkTimer -= diff; + DoCast(me, SPELL_CLEAVE); + CleaveTimer = 6000+rand()%15000; + } else CleaveTimer -= diff; + + if (WarStompTimer <= diff) + { + DoCast(me, SPELL_WARSTOMP); + WarStompTimer = 60000; + } else WarStompTimer -= diff; + + if (me->HasAura(SPELL_MARK)) + me->RemoveAurasDueToSpell(SPELL_MARK); + if (MarkTimer <= diff) + { + //cast dummy, useful for bos addons + me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID()); + + std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + { + Unit *pTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER && pTarget->getPowerType() == POWER_MANA) + { + pTarget->CastSpell(pTarget, SPELL_MARK,true);//only cast on mana users + } + } + MarkTimerBase -= 5000; + if (MarkTimerBase < 5500) + MarkTimerBase = 5500; + MarkTimer = MarkTimerBase; + switch (urand(0,2)) + { + case 0: + DoPlaySoundToSet(me, SOUND_MARK1); + me->MonsterYell(SAY_MARK1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_MARK2); + me->MonsterYell(SAY_MARK2, LANG_UNIVERSAL, NULL); + break; + } + } else MarkTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kazrogal(Creature* pCreature) -{ - return new boss_kazrogalAI (pCreature); -} void AddSC_boss_kazrogal() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kazrogal"; - newscript->GetAI = &GetAI_boss_kazrogal; - newscript->RegisterSelf(); + new boss_kazrogal(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp index 28b32e19063..2446bad14bb 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_rage_winterchill.cpp @@ -45,164 +45,167 @@ #define SAY_ONAGGRO "The Legion's final conquest has begun! Once again the subjugation of this world is within our grasp. Let none survive!" #define SOUND_ONAGGRO 11022 - -struct boss_rage_winterchillAI : public hyjal_trashAI +
class boss_rage_winterchill : public CreatureScript { - boss_rage_winterchillAI(Creature *c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - } - - uint32 FrostArmorTimer; - uint32 DecayTimer; - uint32 NovaTimer; - uint32 IceboltTimer; - bool pGo; - uint32 pos; - - void Reset() - { - damageTaken = 0; - FrostArmorTimer = 37000; - DecayTimer = 45000; - NovaTimer = 15000; - IceboltTimer = 10000; - - if (pInstance && IsEvent) - pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED); - } +public: + boss_rage_winterchill() : CreatureScript("boss_rage_winterchill") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance && IsEvent) - pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, IN_PROGRESS); - DoPlaySoundToSet(me, SOUND_ONAGGRO); - me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); + return new boss_rage_winterchillAI (pCreature); } - void KilledUnit(Unit * /*victim*/) + struct boss_rage_winterchillAI : public hyjal_trashAI { - switch (urand(0,1)) + boss_rage_winterchillAI(Creature *c) : hyjal_trashAI(c) { - case 0: - DoPlaySoundToSet(me, SOUND_ONSLAY1); - me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_ONSLAY2); - me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); - break; + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; } - } - void WaypointReached(uint32 i) - { - pos = i; - if (i == 7 && pInstance) + uint32 FrostArmorTimer; + uint32 DecayTimer; + uint32 NovaTimer; + uint32 IceboltTimer; + bool pGo; + uint32 pos; + + void Reset() { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0f); + damageTaken = 0; + FrostArmorTimer = 37000; + DecayTimer = 45000; + NovaTimer = 15000; + IceboltTimer = 10000; + + if (pInstance && IsEvent) + pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, NOT_STARTED); } - } - - void JustDied(Unit *victim) - { - hyjal_trashAI::JustDied(victim); - if (pInstance && IsEvent) - pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE); - DoPlaySoundToSet(me, SOUND_ONDEATH); - me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL); - } - void UpdateAI(const uint32 diff) - { - if (IsEvent) + void EnterCombat(Unit * /*who*/) { - //Must update npc_escortAI - npc_escortAI::UpdateAI(diff); - if (!pGo) - { - pGo = true; - if (pInstance) - { - AddWaypoint(0, 4896.08, -1576.35, 1333.65); - AddWaypoint(1, 4898.68, -1615.02, 1329.48); - AddWaypoint(2, 4907.12, -1667.08, 1321.00); - AddWaypoint(3, 4963.18, -1699.35, 1340.51); - AddWaypoint(4, 4989.16, -1716.67, 1335.74); - AddWaypoint(5, 5026.27, -1736.89, 1323.02); - AddWaypoint(6, 5037.77, -1770.56, 1324.36); - AddWaypoint(7, 5067.23, -1789.95, 1321.17); - Start(false, true); - SetDespawnAtEnd(false); - } - } + if (pInstance && IsEvent) + pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, IN_PROGRESS); + DoPlaySoundToSet(me, SOUND_ONAGGRO); + me->MonsterYell(SAY_ONAGGRO, LANG_UNIVERSAL, 0); } - //Return since we have no target - if (!UpdateVictim()) - return; - - if (FrostArmorTimer <= diff) + void KilledUnit(Unit * /*victim*/) { - DoCast(me, SPELL_FROST_ARMOR); - FrostArmorTimer = 40000+rand()%20000; - } else FrostArmorTimer -= diff; - if (DecayTimer <= diff) - { - DoCast(me->getVictim(), SPELL_DEATH_AND_DECAY); - DecayTimer = 60000+rand()%20000; switch (urand(0,1)) { case 0: - DoPlaySoundToSet(me, SOUND_DECAY1); - me->MonsterYell(SAY_DECAY1, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONSLAY1); + me->MonsterYell(SAY_ONSLAY1, LANG_UNIVERSAL, NULL); break; case 1: - DoPlaySoundToSet(me, SOUND_DECAY2); - me->MonsterYell(SAY_DECAY2, LANG_UNIVERSAL, NULL); + DoPlaySoundToSet(me, SOUND_ONSLAY2); + me->MonsterYell(SAY_ONSLAY2, LANG_UNIVERSAL, NULL); break; } - } else DecayTimer -= diff; - if (NovaTimer <= diff) + } + + void WaypointReached(uint32 i) { - DoCast(me->getVictim(), SPELL_FROST_NOVA); - NovaTimer = 30000+rand()%15000; - switch (urand(0,1)) + pos = i; + if (i == 7 && pInstance) { - case 0: - DoPlaySoundToSet(me, SOUND_NOVA1); - me->MonsterYell(SAY_NOVA1, LANG_UNIVERSAL, NULL); - break; - case 1: - DoPlaySoundToSet(me, SOUND_NOVA2); - me->MonsterYell(SAY_NOVA2, LANG_UNIVERSAL, NULL); - break; + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0f); } - } else NovaTimer -= diff; - if (IceboltTimer <= diff) + } + + void JustDied(Unit *victim) { - DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,40,true), SPELL_ICEBOLT); - IceboltTimer = 11000+rand()%20000; - } else IceboltTimer -= diff; + hyjal_trashAI::JustDied(victim); + if (pInstance && IsEvent) + pInstance->SetData(DATA_RAGEWINTERCHILLEVENT, DONE); + DoPlaySoundToSet(me, SOUND_ONDEATH); + me->MonsterYell(SAY_ONDEATH, LANG_UNIVERSAL, NULL); + } + + void UpdateAI(const uint32 diff) + { + if (IsEvent) + { + //Must update npc_escortAI + npc_escortAI::UpdateAI(diff); + if (!pGo) + { + pGo = true; + if (pInstance) + { + AddWaypoint(0, 4896.08, -1576.35, 1333.65); + AddWaypoint(1, 4898.68, -1615.02, 1329.48); + AddWaypoint(2, 4907.12, -1667.08, 1321.00); + AddWaypoint(3, 4963.18, -1699.35, 1340.51); + AddWaypoint(4, 4989.16, -1716.67, 1335.74); + AddWaypoint(5, 5026.27, -1736.89, 1323.02); + AddWaypoint(6, 5037.77, -1770.56, 1324.36); + AddWaypoint(7, 5067.23, -1789.95, 1321.17); + Start(false, true); + SetDespawnAtEnd(false); + } + } + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + if (FrostArmorTimer <= diff) + { + DoCast(me, SPELL_FROST_ARMOR); + FrostArmorTimer = 40000+rand()%20000; + } else FrostArmorTimer -= diff; + if (DecayTimer <= diff) + { + DoCast(me->getVictim(), SPELL_DEATH_AND_DECAY); + DecayTimer = 60000+rand()%20000; + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_DECAY1); + me->MonsterYell(SAY_DECAY1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_DECAY2); + me->MonsterYell(SAY_DECAY2, LANG_UNIVERSAL, NULL); + break; + } + } else DecayTimer -= diff; + if (NovaTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FROST_NOVA); + NovaTimer = 30000+rand()%15000; + switch (urand(0,1)) + { + case 0: + DoPlaySoundToSet(me, SOUND_NOVA1); + me->MonsterYell(SAY_NOVA1, LANG_UNIVERSAL, NULL); + break; + case 1: + DoPlaySoundToSet(me, SOUND_NOVA2); + me->MonsterYell(SAY_NOVA2, LANG_UNIVERSAL, NULL); + break; + } + } else NovaTimer -= diff; + if (IceboltTimer <= diff) + { + DoCast(SelectTarget(SELECT_TARGET_RANDOM,0,40,true), SPELL_ICEBOLT); + IceboltTimer = 11000+rand()%20000; + } else IceboltTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_rage_winterchill(Creature* pCreature) -{ - return new boss_rage_winterchillAI (pCreature); -} void AddSC_boss_rage_winterchill() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_rage_winterchill"; - newscript->GetAI = &GetAI_boss_rage_winterchill; - newscript->RegisterSelf(); + new boss_rage_winterchill(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp index 4f524587525..c39ee759a22 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.cpp @@ -44,206 +44,210 @@ EndContentData */ #define ITEM_TEAR_OF_GODDESS 24494 #define GOSSIP_ITEM_GM1 "[GM] Toggle Debug Timers" - -CreatureAI* GetAI_npc_jaina_proudmoore(Creature* pCreature) +
class npc_jaina_proudmoore : public CreatureScript { - hyjalAI* ai = new hyjalAI(pCreature); +public: + npc_jaina_proudmoore() : CreatureScript("npc_jaina_proudmoore") { } - ai->Reset(); - ai->EnterEvadeMode(); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + ai->StartEvent(pPlayer); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + ai->FirstBossDead = true; + ai->WaveCount = 9; + ai->StartEvent(pPlayer); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + ai->Retreat(); + break; + case GOSSIP_ACTION_INFO_DEF: + ai->Debug = !ai->Debug; + sLog.outDebug("TSCR: HyjalAI - Debug mode has been toggled"); + break; + } + return true; + } - ai->Spell[0].SpellId = SPELL_BLIZZARD; - ai->Spell[0].Cooldown = 15000 + rand()%20000; - ai->Spell[0].TargetType = TARGETTYPE_RANDOM; + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + if (ai->EventBegun) + return false; + + uint32 RageEncounter = ai->GetInstanceData(DATA_RAGEWINTERCHILLEVENT); + uint32 AnetheronEncounter = ai->GetInstanceData(DATA_ANETHERONEVENT); + if (RageEncounter == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEGIN_ALLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + else if (RageEncounter == DONE && AnetheronEncounter == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ANETHERON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + else if (RageEncounter == DONE && AnetheronEncounter == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + + if (pPlayer->isGameMaster()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + return true; + } - ai->Spell[1].SpellId = SPELL_PYROBLAST; - ai->Spell[1].Cooldown = 5500 + rand()%4000; - ai->Spell[1].TargetType = TARGETTYPE_RANDOM; + CreatureAI* GetAI(Creature* pCreature) const + { + hyjalAI* ai = new hyjalAI(pCreature); - ai->Spell[2].SpellId = SPELL_SUMMON_ELEMENTALS; - ai->Spell[2].Cooldown = 15000 + rand()%30000; - ai->Spell[2].TargetType = TARGETTYPE_SELF; + ai->Reset(); + ai->EnterEvadeMode(); - return ai; -} + ai->Spell[0].SpellId = SPELL_BLIZZARD; + ai->Spell[0].Cooldown = 15000 + rand()%20000; + ai->Spell[0].TargetType = TARGETTYPE_RANDOM; -bool GossipHello_npc_jaina_proudmoore(Player* pPlayer, Creature* pCreature) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - if (ai->EventBegun) - return false; - - uint32 RageEncounter = ai->GetInstanceData(DATA_RAGEWINTERCHILLEVENT); - uint32 AnetheronEncounter = ai->GetInstanceData(DATA_ANETHERONEVENT); - if (RageEncounter == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEGIN_ALLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - else if (RageEncounter == DONE && AnetheronEncounter == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ANETHERON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - else if (RageEncounter == DONE && AnetheronEncounter == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - - if (pPlayer->isGameMaster()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - return true; -} + ai->Spell[1].SpellId = SPELL_PYROBLAST; + ai->Spell[1].Cooldown = 5500 + rand()%4000; + ai->Spell[1].TargetType = TARGETTYPE_RANDOM; -bool GossipSelect_npc_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - ai->StartEvent(pPlayer); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - ai->FirstBossDead = true; - ai->WaveCount = 9; - ai->StartEvent(pPlayer); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - ai->Retreat(); - break; - case GOSSIP_ACTION_INFO_DEF: - ai->Debug = !ai->Debug; - sLog.outDebug("TSCR: HyjalAI - Debug mode has been toggled"); - break; + ai->Spell[2].SpellId = SPELL_SUMMON_ELEMENTALS; + ai->Spell[2].Cooldown = 15000 + rand()%30000; + ai->Spell[2].TargetType = TARGETTYPE_SELF; + + return ai; } - return true; -} -CreatureAI* GetAI_npc_thrall(Creature* pCreature) +}; + + +
class npc_thrall : public CreatureScript { - hyjalAI* ai = new hyjalAI(pCreature); +public: + npc_thrall() : CreatureScript("npc_thrall") { } - ai->Reset(); - ai->EnterEvadeMode(); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + ai->DeSpawnVeins();//despawn the alliance veins + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + ai->StartEvent(pPlayer); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + ai->FirstBossDead = true; + ai->WaveCount = 9; + ai->StartEvent(pPlayer); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + ai->Retreat(); + break; + case GOSSIP_ACTION_INFO_DEF: + ai->Debug = !ai->Debug; + sLog.outDebug("TSCR: HyjalAI - Debug mode has been toggled"); + break; + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + if (ai->EventBegun) + return false; + + uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT); + // Only let them start the Horde phases if Anetheron is dead. + if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT)) + { + uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT); + uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); + if (KazrogalEvent == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEGIN_HORDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + else if (KazrogalEvent == DONE && AzgalorEvent == NOT_STARTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AZGALOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + else if (AzgalorEvent == DONE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + } + + if (pPlayer->isGameMaster()) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + return true; + } - ai->Spell[0].SpellId = SPELL_CHAIN_LIGHTNING; - ai->Spell[0].Cooldown = 3000 + rand()%5000; - ai->Spell[0].TargetType = TARGETTYPE_VICTIM; + CreatureAI* GetAI(Creature* pCreature) const + { + hyjalAI* ai = new hyjalAI(pCreature); - ai->Spell[1].SpellId = SPELL_SUMMON_DIRE_WOLF; - ai->Spell[1].Cooldown = 6000 + rand()%35000; - ai->Spell[1].TargetType = TARGETTYPE_RANDOM; + ai->Reset(); + ai->EnterEvadeMode(); - return ai; -} + ai->Spell[0].SpellId = SPELL_CHAIN_LIGHTNING; + ai->Spell[0].Cooldown = 3000 + rand()%5000; + ai->Spell[0].TargetType = TARGETTYPE_VICTIM; -bool GossipHello_npc_thrall(Player* pPlayer, Creature* pCreature) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - if (ai->EventBegun) - return false; + ai->Spell[1].SpellId = SPELL_SUMMON_DIRE_WOLF; + ai->Spell[1].Cooldown = 6000 + rand()%35000; + ai->Spell[1].TargetType = TARGETTYPE_RANDOM; - uint32 AnetheronEvent = ai->GetInstanceData(DATA_ANETHERONEVENT); - // Only let them start the Horde phases if Anetheron is dead. - if (AnetheronEvent == DONE && ai->GetInstanceData(DATA_ALLIANCE_RETREAT)) - { - uint32 KazrogalEvent = ai->GetInstanceData(DATA_KAZROGALEVENT); - uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); - if (KazrogalEvent == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEGIN_HORDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - else if (KazrogalEvent == DONE && AzgalorEvent == NOT_STARTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AZGALOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - else if (AzgalorEvent == DONE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RETREAT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + return ai; } - if (pPlayer->isGameMaster()) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_TRAINER, GOSSIP_ITEM_GM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); +}; - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_thrall(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) +
class npc_tyrande_whisperwind : public CreatureScript { - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - ai->DeSpawnVeins();//despawn the alliance veins - switch(uiAction) +public: + npc_tyrande_whisperwind() : CreatureScript("npc_tyrande_whisperwind") { } + + CreatureAI* GetAI(Creature* pCreature) const { - case GOSSIP_ACTION_INFO_DEF + 1: - ai->StartEvent(pPlayer); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - ai->FirstBossDead = true; - ai->WaveCount = 9; - ai->StartEvent(pPlayer); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - ai->Retreat(); - break; - case GOSSIP_ACTION_INFO_DEF: - ai->Debug = !ai->Debug; - sLog.outDebug("TSCR: HyjalAI - Debug mode has been toggled"); - break; + hyjalAI* ai = new hyjalAI(pCreature); + ai->Reset(); + ai->EnterEvadeMode(); + return ai; } - return true; -} - -CreatureAI* GetAI_npc_tyrande_whisperwind(Creature* pCreature) -{ - hyjalAI* ai = new hyjalAI(pCreature); - ai->Reset(); - ai->EnterEvadeMode(); - return ai; -} -bool GossipHello_npc_tyrande_whisperwind(Player* pPlayer, Creature* pCreature) -{ - hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); - uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); - - // Only let them get item if Azgalor is dead. - if (AzgalorEvent == DONE && !pPlayer->HasItemCount(ITEM_TEAR_OF_GODDESS,1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1); + if (msg == EQUIP_ERR_OK) + { + Item* item = pPlayer->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true); + if (item && pPlayer) + pPlayer->SendNewItem(item,1,true,false,true); + } + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + CAST_AI(hyjalAI, pCreature->AI()); + } + return true; + } -bool GossipSelect_npc_tyrande_whisperwind(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_TEAR_OF_GODDESS, 1); - if (msg == EQUIP_ERR_OK) - { - Item* item = pPlayer->StoreNewItem(dest, ITEM_TEAR_OF_GODDESS, true); - if (item && pPlayer) - pPlayer->SendNewItem(item,1,true,false,true); - } - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - CAST_AI(hyjalAI, pCreature->AI()); + hyjalAI* ai = CAST_AI(hyjalAI, pCreature->AI()); + uint32 AzgalorEvent = ai->GetInstanceData(DATA_AZGALOREVENT); + + // Only let them get item if Azgalor is dead. + if (AzgalorEvent == DONE && !pPlayer->HasItemCount(ITEM_TEAR_OF_GODDESS,1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TYRANDE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + return true; } - return true; -} + +}; + + void AddSC_hyjal() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_jaina_proudmoore"; - newscript->GetAI = &GetAI_npc_jaina_proudmoore; - newscript->pGossipHello = &GossipHello_npc_jaina_proudmoore; - newscript->pGossipSelect = &GossipSelect_npc_jaina_proudmoore; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thrall"; - newscript->GetAI = &GetAI_npc_thrall; - newscript->pGossipHello = &GossipHello_npc_thrall; - newscript->pGossipSelect = &GossipSelect_npc_thrall; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tyrande_whisperwind"; - newscript->pGossipHello = &GossipHello_npc_tyrande_whisperwind; - newscript->pGossipSelect = &GossipSelect_npc_tyrande_whisperwind; - newscript->GetAI = &GetAI_npc_tyrande_whisperwind; - newscript->RegisterSelf(); + new npc_jaina_proudmoore(); + new npc_thrall(); + new npc_tyrande_whisperwind(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 276b62c0689..a3045446692 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -312,7 +312,7 @@ float HordeFirePos[65][8]=//spawn points for the fire visuals (GO) in the horde hyjalAI::hyjalAI(Creature *c) : npc_escortAI(c), Summons(me) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); VeinsSpawned[0] = false; VeinsSpawned[1] = false; for (uint8 i=0; i<14; ++i) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h index 245e719295a..7ffaf24f845 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.h @@ -210,7 +210,7 @@ struct hyjalAI : public npc_escortAI void Talk(uint32 id); // Searches for the appropriate yell and sound and uses it to inform the raid of various things public: - ScriptedInstance* pInstance; + InstanceScript* pInstance; uint64 PlayerGUID; uint64 BossGUID[2]; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index dd889b9fee6..c4820817ae2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -157,7 +157,7 @@ float HordeOverrunWP[21][3]=//waypoints in the horde base used in the end in the hyjal_trashAI::hyjal_trashAI(Creature *c) : npc_escortAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); IsEvent = false; Delay = 0; LastOverronPos = 0; @@ -388,1069 +388,1098 @@ void hyjal_trashAI::JustDied(Unit * /*victim*/) me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);//no loot } -struct mob_giant_infernalAI : public hyjal_trashAI +class mob_giant_infernal : public CreatureScript { - mob_giant_infernalAI(Creature* c) : hyjal_trashAI(c) +public: + mob_giant_infernal() : CreatureScript("mob_giant_infernal") { } + + struct mob_giant_infernalAI : public hyjal_trashAI { - pInstance = c->GetInstanceData(); - meteor = false;//call once! - CanMove = false; - Delay = rand()%30000; - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(MODEL_INVIS); - pGo = false; - pos = 0; - Reset(); - } + mob_giant_infernalAI(Creature* c) : hyjal_trashAI(c) + { + pInstance = c->GetInstanceScript(); + meteor = false;//call once! + CanMove = false; + Delay = rand()%30000; + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(MODEL_INVIS); + pGo = false; + pos = 0; + Reset(); + } - bool meteor; - bool CanMove; - bool WpEnabled; - bool pGo; - uint32 pos; - uint32 spawnTimer; - uint32 FlameBuffetTimer; - bool imol; + bool meteor; + bool CanMove; + bool WpEnabled; + bool pGo; + uint32 pos; + uint32 spawnTimer; + uint32 FlameBuffetTimer; + bool imol; - void Reset() - { - spawnTimer = 2000; - FlameBuffetTimer= 2000; - imol = false; - } + void Reset() + { + spawnTimer = 2000; + FlameBuffetTimer= 2000; + imol = false; + } - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} - void WaypointReached(uint32 i) - { - pos = i; - if (i == 0 && pInstance && !IsOverrun) + void WaypointReached(uint32 i) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + pos = i; + if (i == 0 && pInstance && !IsOverrun) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } } } - } - void UpdateAI(const uint32 diff) - { - if (Delay <= diff) + void UpdateAI(const uint32 diff) { - Delay=0; - }else{ - Delay-=diff; - return; - } - if (!meteor) - { - float x,y,z; - me->GetPosition(x,y,z); - Creature* trigger = me->SummonCreature(NPC_TRIGGER,x+8,y+8,z+25+rand()%10,me->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1000); - if (trigger) + if (Delay <= diff) { - trigger->SetVisibility(VISIBILITY_OFF); - trigger->setFaction(me->getFaction()); - trigger->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - trigger->CastSpell(me,SPELL_METEOR,true); + Delay=0; + }else{ + Delay-=diff; + return; } - me->GetMotionMaster()->Clear(); - meteor = true; - } else if (!CanMove){ - if (spawnTimer <= diff) + if (!meteor) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID)); - CanMove = true; - if (pInstance) + float x,y,z; + me->GetPosition(x,y,z); + Creature* trigger = me->SummonCreature(NPC_TRIGGER,x+8,y+8,z+25+rand()%10,me->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1000); + if (trigger) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && !pInstance->GetData(DATA_HORDE_RETREAT)) + trigger->SetVisibility(VISIBILITY_OFF); + trigger->setFaction(me->getFaction()); + trigger->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + trigger->CastSpell(me,SPELL_METEOR,true); + } + me->GetMotionMaster()->Clear(); + meteor = true; + } else if (!CanMove){ + if (spawnTimer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetDisplayId(me->GetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID)); + CanMove = true; + if (pInstance) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } else if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && pInstance->GetData(DATA_HORDE_RETREAT)){ - //do overrun + if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && !pInstance->GetData(DATA_HORDE_RETREAT)) + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } else if (pInstance->GetData(DATA_ALLIANCE_RETREAT) && pInstance->GetData(DATA_HORDE_RETREAT)){ + //do overrun + } } - } - } else spawnTimer -= diff; - } - if (!CanMove)return; - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) - { - if (!pGo) + } else spawnTimer -= diff; + } + if (!CanMove)return; + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) { - pGo = true; - if (pInstance) + if (!pGo) { - AddWaypoint(0, HordeWPs[7][0]+irand(-3,3), HordeWPs[7][1]+irand(-3,3), HordeWPs[7][2]);//HordeWPs[7] infront of thrall - Start(true, true); - SetDespawnAtEnd(false); + pGo = true; + if (pInstance) + { + AddWaypoint(0, HordeWPs[7][0]+irand(-3,3), HordeWPs[7][1]+irand(-3,3), HordeWPs[7][2]);//HordeWPs[7] infront of thrall + Start(true, true); + SetDespawnAtEnd(false); + } } } - } - if (!UpdateVictim()) - return; - if (!imol) - { - DoCast(me, SPELL_IMMOLATION); - imol=true; + if (!UpdateVictim()) + return; + if (!imol) + { + DoCast(me, SPELL_IMMOLATION); + imol=true; + } + if (FlameBuffetTimer <= diff) + { + DoCast(me->getVictim(), SPELL_FLAME_BUFFET, true); + FlameBuffetTimer = 7000; + } else FlameBuffetTimer -= diff; + DoMeleeAttackIfReady(); } - if (FlameBuffetTimer <= diff) - { - DoCast(me->getVictim(), SPELL_FLAME_BUFFET, true); - FlameBuffetTimer = 7000; - } else FlameBuffetTimer -= diff; - DoMeleeAttackIfReady(); + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new mob_giant_infernalAI(pCreature); } }; -CreatureAI* GetAI_mob_giant_infernal(Creature* pCreature) -{ - return new mob_giant_infernalAI(pCreature); -} - #define SPELL_DISEASE_CLOUD 31607 #define SPELL_KNOCKDOWN 31610 - -struct mob_abominationAI : public hyjal_trashAI +
class mob_abomination : public CreatureScript { - mob_abominationAI(Creature* c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } +public: + mob_abomination() : CreatureScript("mob_abomination") { } - bool pGo; - uint32 KnockDownTimer; - uint32 pos; - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - KnockDownTimer = 10000; + return new mob_abominationAI(pCreature); } - void WaypointReached(uint32 i) + struct mob_abominationAI : public hyjal_trashAI { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_abominationAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); + } + + bool pGo; + uint32 KnockDownTimer; + uint32 pos; + void Reset() + { + KnockDownTimer = 10000; } - if (i == LastOverronPos && IsOverrun) + + void WaypointReached(uint32 i) { - if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - me->setDeathState(DEAD); - me->RemoveCorpse(); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } + } + if (i == LastOverronPos && IsOverrun) + { + if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) + { + me->setDeathState(DEAD); + me->RemoveCorpse(); + } } } - } - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void UpdateAI(const uint32 diff) { - if (!pGo) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) { - pGo = true; - if (pInstance) + if (!pGo) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } } } } + if (!me->HasAura(SPELL_DISEASE_CLOUD)) + DoCast(me, SPELL_DISEASE_CLOUD); + if (!UpdateVictim()) + return; + if (KnockDownTimer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKDOWN); + KnockDownTimer = 15000+rand()%10000; + } else KnockDownTimer -= diff; + DoMeleeAttackIfReady(); } - if (!me->HasAura(SPELL_DISEASE_CLOUD)) - DoCast(me, SPELL_DISEASE_CLOUD); - if (!UpdateVictim()) - return; - if (KnockDownTimer <= diff) - { - DoCast(me->getVictim(), SPELL_KNOCKDOWN); - KnockDownTimer = 15000+rand()%10000; - } else KnockDownTimer -= diff; - DoMeleeAttackIfReady(); - } + }; + }; -CreatureAI* GetAI_mob_abomination(Creature* pCreature) -{ - return new mob_abominationAI(pCreature); -} #define SPELL_FRENZY 31540 - -struct mob_ghoulAI : public hyjal_trashAI +
class mob_ghoul : public CreatureScript { - mob_ghoulAI(Creature* c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } +public: + mob_ghoul() : CreatureScript("mob_ghoul") { } - bool pGo; - uint32 FrenzyTimer; - uint32 pos; - uint32 MoveTimer; - bool RandomMove; - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FrenzyTimer = 5000+rand()%5000; - MoveTimer = 2000; - RandomMove = false; + return new mob_ghoulAI(pCreature); } - void WaypointReached(uint32 i) + struct mob_ghoulAI : public hyjal_trashAI { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_ghoulAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall - { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); + } + + bool pGo; + uint32 FrenzyTimer; + uint32 pos; + uint32 MoveTimer; + bool RandomMove; + void Reset() + { + FrenzyTimer = 5000+rand()%5000; + MoveTimer = 2000; + RandomMove = false; } - if (i == LastOverronPos && IsOverrun) + + void WaypointReached(uint32 i) { - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACKUNARMED); - if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - me->setDeathState(DEAD); - me->RemoveCorpse(); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } } + if (i == LastOverronPos && IsOverrun) + { + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_ATTACKUNARMED); + if ((faction == 0 && LastOverronPos == 17) || (faction == 1 && LastOverronPos == 21)) + { + me->setDeathState(DEAD); + me->RemoveCorpse(); + } + } } - } - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void UpdateAI(const uint32 diff) { - if (!pGo) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) { - pGo = true; - if (pInstance) + if (!pGo) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } } } } + if (FrenzyTimer <= diff) + { + DoCast(me, SPELL_FRENZY); + FrenzyTimer = 15000+rand()%15000; + } else FrenzyTimer -= diff; + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); } - if (FrenzyTimer <= diff) - { - DoCast(me, SPELL_FRENZY); - FrenzyTimer = 15000+rand()%15000; - } else FrenzyTimer -= diff; - if (!UpdateVictim()) - return; + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_ghoul(Creature* pCreature) -{ - return new mob_ghoulAI(pCreature); -} #define SPELL_RAISE_DEAD_1 31617 #define SPELL_RAISE_DEAD_2 31624 #define SPELL_RAISE_DEAD_3 31625 #define SPELL_SHADOW_BOLT 31627 - -struct mob_necromancerAI : public hyjal_trashAI +
class mob_necromancer : public CreatureScript { - mob_necromancerAI(Creature* c) : hyjal_trashAI(c), summons(me) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } - SummonList summons; - bool pGo; - uint32 ShadowBoltTimer; - uint32 pos; - void Reset() - { - ShadowBoltTimer = 1000+rand()%5000; - summons.DespawnAll(); - } +public: + mob_necromancer() : CreatureScript("mob_necromancer") { } - void JustSummoned(Creature* summon) + CreatureAI* GetAI(Creature* pCreature) const { - Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,30,true); - if (pTarget && summon) - summon->Attack(pTarget,false); - summons.Summon(summon); + return new mob_necromancerAI(pCreature); } - void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} - void WaypointReached(uint32 i) + + struct mob_necromancerAI : public hyjal_trashAI { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_necromancerAI(Creature* c) : hyjal_trashAI(c), summons(me) + { + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); + } + SummonList summons; + bool pGo; + uint32 ShadowBoltTimer; + uint32 pos; + void Reset() { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + ShadowBoltTimer = 1000+rand()%5000; + summons.DespawnAll(); + } + + void JustSummoned(Creature* summon) + { + Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM,0,30,true); + if (pTarget && summon) + summon->Attack(pTarget,false); + summons.Summon(summon); + } + void SummonedCreatureDespawn(Creature *summon) {summons.Despawn(summon);} + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } } } - } - void KilledUnit(Unit* /*victim*/) - { - switch (urand(0,2)) + void KilledUnit(Unit* /*victim*/) { - case 0: - DoSpawnCreature(17902,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - DoSpawnCreature(17902,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - break; - case 1: - DoSpawnCreature(17903,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - DoSpawnCreature(17903,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - break; - case 2: - DoSpawnCreature(RAND(17902,17903),3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); - break; + switch (urand(0,2)) + { + case 0: + DoSpawnCreature(17902,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + DoSpawnCreature(17902,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + break; + case 1: + DoSpawnCreature(17903,3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + DoSpawnCreature(17903,-3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + break; + case 2: + DoSpawnCreature(RAND(17902,17903),3,0,0,0,TEMPSUMMON_TIMED_DESPAWN, 60000); + break; + } } - } - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void UpdateAI(const uint32 diff) { - if (!pGo) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) { - pGo = true; - if (pInstance) + if (!pGo) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(true, true); - SetDespawnAtEnd(false); - }else//use alliance WPs + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(true, true); - SetDespawnAtEnd(false); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(true, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(true, true); + SetDespawnAtEnd(false); + } } } } + if (!UpdateVictim()) + return; + if (ShadowBoltTimer <= diff) + { + DoCast(me->getVictim(), SPELL_SHADOW_BOLT); + ShadowBoltTimer = 20000+rand()%10000; + } else ShadowBoltTimer -= diff; + + DoMeleeAttackIfReady(); } - if (!UpdateVictim()) - return; - if (ShadowBoltTimer <= diff) - { - DoCast(me->getVictim(), SPELL_SHADOW_BOLT); - ShadowBoltTimer = 20000+rand()%10000; - } else ShadowBoltTimer -= diff; + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_necromancer(Creature* pCreature) -{ - return new mob_necromancerAI(pCreature); -} #define SPELL_BANSHEE_CURSE 31651 #define SPELL_BANSHEE_WAIL 38183 #define SPELL_ANTI_MAGIC_SHELL 31662 - -struct mob_bansheeAI : public hyjal_trashAI +
class mob_banshee : public CreatureScript { - mob_bansheeAI(Creature* c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } +public: + mob_banshee() : CreatureScript("mob_banshee") { } - bool pGo; - uint32 CourseTimer; - uint32 WailTimer; - uint32 ShellTimer; - uint32 pos; - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CourseTimer = 20000+rand()%5000; - WailTimer = 15000+rand()%5000; - ShellTimer = 50000+rand()%10000; + return new mob_bansheeAI(pCreature); } - void WaypointReached(uint32 i) + struct mob_bansheeAI : public hyjal_trashAI { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_bansheeAI(Creature* c) : hyjal_trashAI(c) + { + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); + } + + bool pGo; + uint32 CourseTimer; + uint32 WailTimer; + uint32 ShellTimer; + uint32 pos; + void Reset() + { + CourseTimer = 20000+rand()%5000; + WailTimer = 15000+rand()%5000; + ShellTimer = 50000+rand()%10000; + } + + void WaypointReached(uint32 i) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } } } - } - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void UpdateAI(const uint32 diff) { - if (!pGo) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) { - pGo = true; - if (pInstance) + if (!pGo) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } } } } + if (!UpdateVictim()) + return; + if (CourseTimer <= diff) + { + DoCast(me->getVictim(), SPELL_BANSHEE_CURSE); + CourseTimer = 20000+rand()%5000; + } else CourseTimer -= diff; + if (WailTimer <= diff) + { + DoCast(me->getVictim(), SPELL_BANSHEE_WAIL); + WailTimer = 15000+rand()%5000; + } else WailTimer -= diff; + if (ShellTimer <= diff) + { + DoCast(me, SPELL_ANTI_MAGIC_SHELL); + ShellTimer = 50000+rand()%10000; + } else ShellTimer -= diff; + DoMeleeAttackIfReady(); } - if (!UpdateVictim()) - return; - if (CourseTimer <= diff) - { - DoCast(me->getVictim(), SPELL_BANSHEE_CURSE); - CourseTimer = 20000+rand()%5000; - } else CourseTimer -= diff; - if (WailTimer <= diff) - { - DoCast(me->getVictim(), SPELL_BANSHEE_WAIL); - WailTimer = 15000+rand()%5000; - } else WailTimer -= diff; - if (ShellTimer <= diff) - { - DoCast(me, SPELL_ANTI_MAGIC_SHELL); - ShellTimer = 50000+rand()%10000; - } else ShellTimer -= diff; - DoMeleeAttackIfReady(); - } + }; + }; -CreatureAI* GetAI_mob_banshee(Creature* pCreature) -{ - return new mob_bansheeAI(pCreature); -} #define SPELL_WEB 28991 - -struct mob_crypt_fiendAI : public hyjal_trashAI +
class mob_crypt_fiend : public CreatureScript { - mob_crypt_fiendAI(Creature* c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } +public: + mob_crypt_fiend() : CreatureScript("mob_crypt_fiend") { } - bool pGo; - uint32 WebTimer; - uint32 pos; - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WebTimer = 20000+rand()%5000; + return new mob_crypt_fiendAI(pCreature); } - void WaypointReached(uint32 i) + struct mob_crypt_fiendAI : public hyjal_trashAI { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_crypt_fiendAI(Creature* c) : hyjal_trashAI(c) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); + } + + bool pGo; + uint32 WebTimer; + uint32 pos; + void Reset() + { + WebTimer = 20000+rand()%5000; + } + + void WaypointReached(uint32 i) + { + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } } } - } - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void UpdateAI(const uint32 diff) { - if (!pGo) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) { - pGo = true; - if (pInstance) + if (!pGo) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - } + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } + } } } + if (!UpdateVictim()) + return; + if (WebTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WEB); + WebTimer = 20000+rand()%5000; + } else WebTimer -= diff; + DoMeleeAttackIfReady(); } - if (!UpdateVictim()) - return; - if (WebTimer <= diff) - { - DoCast(me->getVictim(), SPELL_WEB); - WebTimer = 20000+rand()%5000; - } else WebTimer -= diff; - DoMeleeAttackIfReady(); - } + }; + }; -CreatureAI* GetAI_mob_crypt_fiend(Creature* pCreature) -{ - return new mob_crypt_fiendAI(pCreature); -} #define SPELL_MANA_BURN 31729 - -struct mob_fel_stalkerAI : public hyjal_trashAI +
class mob_fel_stalker : public CreatureScript { - mob_fel_stalkerAI(Creature* c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } +public: + mob_fel_stalker() : CreatureScript("mob_fel_stalker") { } - bool pGo; - uint32 ManaBurnTimer; - uint32 pos; - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ManaBurnTimer = 9000+rand()%5000; + return new mob_fel_stalkerAI(pCreature); } - void WaypointReached(uint32 i) + struct mob_fel_stalkerAI : public hyjal_trashAI { - pos = i; - if (i == 7 && pInstance && !IsOverrun) + mob_fel_stalkerAI(Creature* c) : hyjal_trashAI(c) + { + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); + } + + bool pGo; + uint32 ManaBurnTimer; + uint32 pos; + void Reset() + { + ManaBurnTimer = 9000+rand()%5000; + } + + void WaypointReached(uint32 i) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + pos = i; + if (i == 7 && pInstance && !IsOverrun) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); - }else{ - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (pTarget && pTarget->isAlive()) - me->AddThreat(pTarget,0.0); + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, attack thrall + { + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + }else{ + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (pTarget && pTarget->isAlive()) + me->AddThreat(pTarget,0.0); + } } } - } - void EnterCombat(Unit* /*who*/) {} + void EnterCombat(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) - npc_escortAI::UpdateAI(diff); - if (IsEvent) + void UpdateAI(const uint32 diff) { - if (!pGo) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + npc_escortAI::UpdateAI(diff); + if (IsEvent) { - pGo = true; - if (pInstance) + if (!pGo) { - if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + pGo = true; + if (pInstance) { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else//use alliance WPs - { - for (uint8 i = 0; i < 8; ++i) - AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - } + if (pInstance->GetData(DATA_ALLIANCE_RETREAT))//2.alliance boss down, use horde WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, HordeWPs[i][0]+irand(-3,3), HordeWPs[i][1]+irand(-3,3), HordeWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else//use alliance WPs + { + for (uint8 i = 0; i < 8; ++i) + AddWaypoint(i, AllianceWPs[i][0]+irand(-3,3), AllianceWPs[i][1]+irand(-3,3), AllianceWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } + } } } + if (!UpdateVictim()) + return; + if (ManaBurnTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MANA_BURN); + ManaBurnTimer = 9000+rand()%5000; + } else ManaBurnTimer -= diff; + DoMeleeAttackIfReady(); } - if (!UpdateVictim()) - return; - if (ManaBurnTimer <= diff) - { - DoCast(me->getVictim(), SPELL_MANA_BURN); - ManaBurnTimer = 9000+rand()%5000; - } else ManaBurnTimer -= diff; - DoMeleeAttackIfReady(); - } + }; + }; -CreatureAI* GetAI_mob_fel_stalker(Creature* pCreature) -{ - return new mob_fel_stalkerAI(pCreature); -} #define SPELL_FROST_BREATH 31688 - -struct mob_frost_wyrmAI : public hyjal_trashAI +
class mob_frost_wyrm : public CreatureScript { - mob_frost_wyrmAI(Creature* c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - Reset(); - } - - bool pGo; - uint32 FrostBreathTimer; - uint32 pos; - uint32 MoveTimer; +public: + mob_frost_wyrm() : CreatureScript("mob_frost_wyrm") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - FrostBreathTimer = 5000; - MoveTimer = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + return new mob_frost_wyrmAI(pCreature); } - void WaypointReached(uint32 i) + struct mob_frost_wyrmAI : public hyjal_trashAI { - pos = i; - if (i == 2 && pInstance && !IsOverrun) + mob_frost_wyrmAI(Creature* c) : hyjal_trashAI(c) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - { - me->AddThreat(pTarget,0.0); - DoCast(pTarget, SPELL_FROST_BREATH, true); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + Reset(); } - } - - void JustDied(Unit * /*victim*/) - { - if (pInstance && IsEvent) - pInstance->SetData(DATA_TRASH, 0);//signal trash is dead - - float x,y,z; - me->GetPosition(x,y,z); - z = me->GetMap()->GetHeight(x, y, z); - me->GetMotionMaster()->MovePoint(0,x,y,z); - me->GetMap()->CreatureRelocation(me, x,y,z,0); - } - void EnterCombat(Unit* /*who*/) {} + bool pGo; + uint32 FrostBreathTimer; + uint32 pos; + uint32 MoveTimer; - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) + void Reset() { - CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); - npc_escortAI::UpdateAI(diff); + FrostBreathTimer = 5000; + MoveTimer = 0; + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); } - if (IsEvent) + + void WaypointReached(uint32 i) { - if (!pGo) + pos = i; + if (i == 2 && pInstance && !IsOverrun) { - pGo = true; - if (pInstance) + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) { - if (!useFlyPath) - { - for (uint8 i = 0; i < 3; ++i) - AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else{//fly path FlyPathWPs - for (uint8 i = 0; i < 3; ++i) - AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - } + me->AddThreat(pTarget,0.0); + DoCast(pTarget, SPELL_FROST_BREATH, true); } } } - if (!UpdateVictim()) - return; - if (!me->IsWithinDist(me->getVictim(), 25)){ - if (MoveTimer <= diff) - { - me->GetMotionMaster()->MoveChase(me->getVictim()); - MoveTimer = 2000; - } else MoveTimer-=diff; + + void JustDied(Unit * /*victim*/) + { + if (pInstance && IsEvent) + pInstance->SetData(DATA_TRASH, 0);//signal trash is dead + + float x,y,z; + me->GetPosition(x,y,z); + z = me->GetMap()->GetHeight(x, y, z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + me->GetMap()->CreatureRelocation(me, x,y,z,0); } - if (FrostBreathTimer <= diff) + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (!me->IsWithinDist(me->getVictim(), 25)) + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) { - DoCast(me->getVictim(), SPELL_FROST_BREATH); - me->StopMoving(); - me->GetMotionMaster()->Clear(); - FrostBreathTimer = 4000; + CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); + npc_escortAI::UpdateAI(diff); } - } else FrostBreathTimer -= diff; - } + if (IsEvent) + { + if (!pGo) + { + pGo = true; + if (pInstance) + { + if (!useFlyPath) + { + for (uint8 i = 0; i < 3; ++i) + AddWaypoint(i, FrostWyrmWPs[i][0], FrostWyrmWPs[i][1], FrostWyrmWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else{//fly path FlyPathWPs + for (uint8 i = 0; i < 3; ++i) + AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } + } + } + } + if (!UpdateVictim()) + return; + if (!me->IsWithinDist(me->getVictim(), 25)){ + if (MoveTimer <= diff) + { + me->GetMotionMaster()->MoveChase(me->getVictim()); + MoveTimer = 2000; + } else MoveTimer-=diff; + } + + if (FrostBreathTimer <= diff) + { + if (!me->IsWithinDist(me->getVictim(), 25)) + { + DoCast(me->getVictim(), SPELL_FROST_BREATH); + me->StopMoving(); + me->GetMotionMaster()->Clear(); + FrostBreathTimer = 4000; + } + } else FrostBreathTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_frost_wyrm(Creature* pCreature) -{ - return new mob_frost_wyrmAI(pCreature); -} #define SPELL_GARGOYLE_STRIKE 31664 - -struct mob_gargoyleAI : public hyjal_trashAI +
class mob_gargoyle : public CreatureScript { - mob_gargoyleAI(Creature* c) : hyjal_trashAI(c) - { - pInstance = c->GetInstanceData(); - pGo = false; - pos = 0; - DummyTarget[0] = 0;DummyTarget[1] = 0;DummyTarget[2] = 0; - Reset(); - } - - bool pGo; - uint32 StrikeTimer; - uint32 pos; - uint32 MoveTimer; - float Zpos; - bool forcemove; +public: + mob_gargoyle() : CreatureScript("mob_gargoyle") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - forcemove = true; - Zpos = 10.0; - StrikeTimer = 2000+rand()%5000; - MoveTimer = 0; - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + return new mob_gargoyleAI(pCreature); } - void WaypointReached(uint32 i) + struct mob_gargoyleAI : public hyjal_trashAI { - pos = i; - if (i == 2 && pInstance && !IsOverrun) + mob_gargoyleAI(Creature* c) : hyjal_trashAI(c) { - Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); - if (pTarget && pTarget->isAlive()) - { - me->AddThreat(pTarget,0.0); - DoCast(pTarget, SPELL_GARGOYLE_STRIKE, true); - } + pInstance = c->GetInstanceScript(); + pGo = false; + pos = 0; + DummyTarget[0] = 0;DummyTarget[1] = 0;DummyTarget[2] = 0; + Reset(); } - } - void JustDied(Unit *victim) - { - float x,y,z; - me->GetPosition(x,y,z); - z = me->GetMap()->GetHeight(x, y, z); - me->GetMotionMaster()->MovePoint(0,x,y,z); - me->GetMap()->CreatureRelocation(me, x,y,z,0); - hyjal_trashAI::JustDied(victim); - } + bool pGo; + uint32 StrikeTimer; + uint32 pos; + uint32 MoveTimer; + float Zpos; + bool forcemove; - void UpdateAI(const uint32 diff) - { - hyjal_trashAI::UpdateAI(diff); - if (IsEvent || IsOverrun) + void Reset() { - CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); - npc_escortAI::UpdateAI(diff); + forcemove = true; + Zpos = 10.0; + StrikeTimer = 2000+rand()%5000; + MoveTimer = 0; + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); } - if (IsEvent) + + void WaypointReached(uint32 i) { - if (!pGo) + pos = i; + if (i == 2 && pInstance && !IsOverrun) { - pGo = true; - if (pInstance) + Unit *pTarget = Unit::GetUnit((*me), pInstance->GetData64(DATA_THRALL)); + if (pTarget && pTarget->isAlive()) { - if (!useFlyPath) - { - for (uint8 i = 0; i < 3; ++i) - AddWaypoint(i, GargoyleWPs[i][0]+irand(-10,10), GargoyleWPs[i][1]+irand(-10,10), GargoyleWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - }else{//fly path FlyPathWPs - for (uint8 i = 0; i < 3; ++i) - AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); - Start(false, true); - SetDespawnAtEnd(false); - } + me->AddThreat(pTarget,0.0); + DoCast(pTarget, SPELL_GARGOYLE_STRIKE, true); } } } - if (IsOverrun && !UpdateVictim()) + + void JustDied(Unit *victim) + { + float x,y,z; + me->GetPosition(x,y,z); + z = me->GetMap()->GetHeight(x, y, z); + me->GetMotionMaster()->MovePoint(0,x,y,z); + me->GetMap()->CreatureRelocation(me, x,y,z,0); + hyjal_trashAI::JustDied(victim); + } + + void UpdateAI(const uint32 diff) { - if (faction == 0)//alliance + hyjal_trashAI::UpdateAI(diff); + if (IsEvent || IsOverrun) + { + CAST_AI(hyjal_trashAI, me->AI())->SetCanAttack(false); + npc_escortAI::UpdateAI(diff); + } + if (IsEvent) { - if (StrikeTimer <= diff) + if (!pGo) { - me->CastSpell(DummyTarget[0],DummyTarget[1],DummyTarget[2],SPELL_GARGOYLE_STRIKE,false); - StrikeTimer = 2000+rand()%1000; - } else StrikeTimer -= diff; + pGo = true; + if (pInstance) + { + if (!useFlyPath) + { + for (uint8 i = 0; i < 3; ++i) + AddWaypoint(i, GargoyleWPs[i][0]+irand(-10,10), GargoyleWPs[i][1]+irand(-10,10), GargoyleWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + }else{//fly path FlyPathWPs + for (uint8 i = 0; i < 3; ++i) + AddWaypoint(i, FlyPathWPs[i][0]+irand(-10,10), FlyPathWPs[i][1]+irand(-10,10), FlyPathWPs[i][2]); + Start(false, true); + SetDespawnAtEnd(false); + } + } } - } - if (!UpdateVictim()) - return; - if (!me->IsWithinDist(me->getVictim(), 20) || forcemove) - { - forcemove = false; - if (forcemove) + } + if (IsOverrun && !UpdateVictim()) { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (pTarget) - me->Attack(pTarget,false); + if (faction == 0)//alliance + { + if (StrikeTimer <= diff) + { + me->CastSpell(DummyTarget[0],DummyTarget[1],DummyTarget[2],SPELL_GARGOYLE_STRIKE,false); + StrikeTimer = 2000+rand()%1000; + } else StrikeTimer -= diff; + } } - if (MoveTimer <= diff) + if (!UpdateVictim()) + return; + if (!me->IsWithinDist(me->getVictim(), 20) || forcemove) { - float x,y,z; - me->getVictim()->GetPosition(x,y,z); - me->GetMotionMaster()->MovePoint(0,x,y,z+Zpos); - Zpos-=1.0; - if (Zpos <= 0)Zpos=0; - MoveTimer = 2000; - } else MoveTimer-=diff; - } - if (StrikeTimer <= diff) - { - if (me->IsWithinDist(me->getVictim(), 20)) + forcemove = false; + if (forcemove) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + if (pTarget) + me->Attack(pTarget,false); + } + if (MoveTimer <= diff) + { + float x,y,z; + me->getVictim()->GetPosition(x,y,z); + me->GetMotionMaster()->MovePoint(0,x,y,z+Zpos); + Zpos-=1.0; + if (Zpos <= 0)Zpos=0; + MoveTimer = 2000; + } else MoveTimer-=diff; + } + if (StrikeTimer <= diff) { - DoCast(me->getVictim(), SPELL_GARGOYLE_STRIKE); - me->StopMoving(); - me->GetMotionMaster()->Clear(); - StrikeTimer = 2000+rand()%1000; - } else StrikeTimer=0; - } else StrikeTimer -= diff; - } + if (me->IsWithinDist(me->getVictim(), 20)) + { + DoCast(me->getVictim(), SPELL_GARGOYLE_STRIKE); + me->StopMoving(); + me->GetMotionMaster()->Clear(); + StrikeTimer = 2000+rand()%1000; + } else StrikeTimer=0; + } else StrikeTimer -= diff; + } + }; + }; -CreatureAI* GetAI_mob_gargoyle(Creature* pCreature) -{ - return new mob_gargoyleAI(pCreature); -} #define SPELL_EXPLODING_SHOT 7896 - -struct alliance_riflemanAI : public Scripted_NoMovementAI +
class alliance_rifleman : public CreatureScript { - alliance_riflemanAI(Creature *c) : Scripted_NoMovementAI(c) - { - Reset(); - } - - uint32 ExplodeTimer; +public: + alliance_rifleman() : CreatureScript("alliance_rifleman") { } - void JustDied(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new alliance_riflemanAI(pCreature); } - void Reset() + struct alliance_riflemanAI : public Scripted_NoMovementAI { - ExplodeTimer = 5000+rand()%5000; - } + alliance_riflemanAI(Creature *c) : Scripted_NoMovementAI(c) + { + Reset(); + } - void MoveInLineOfSight(Unit *who) - { - if (!who || me->getVictim()) - return; + uint32 ExplodeTimer; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) + void JustDied(Unit* /*who*/) { - //float attackRadius = me->GetAttackDistance(who); - if (me->IsWithinDistInMap(who, 30)) - AttackStart(who); } - } - void EnterCombat(Unit * /*who*/) - { - } + void Reset() + { + ExplodeTimer = 5000+rand()%5000; + } - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; - if (ExplodeTimer <= diff) + void MoveInLineOfSight(Unit *who) { - if (!me->IsWithinDistInMap(me->getVictim(), 30)) - { - EnterEvadeMode(); + if (!who || me->getVictim()) return; + + if (who->isTargetableForAttack() && me->IsHostileTo(who)) + { + //float attackRadius = me->GetAttackDistance(who); + if (me->IsWithinDistInMap(who, 30)) + AttackStart(who); } - int dmg = 500+rand()%700; - me->CastCustomSpell(me->getVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false); - ExplodeTimer = 5000+rand()%5000; - } else ExplodeTimer -= diff; - DoMeleeAttackIfReady(); - } -}; + } -CreatureAI* GetAI_alliance_rifleman(Creature* pCreature) -{ - return new alliance_riflemanAI(pCreature); -} + void EnterCombat(Unit * /*who*/) + { + } + + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + return; + if (ExplodeTimer <= diff) + { + if (!me->IsWithinDistInMap(me->getVictim(), 30)) + { + EnterEvadeMode(); + return; + } + int dmg = 500+rand()%700; + me->CastCustomSpell(me->getVictim(), SPELL_EXPLODING_SHOT, &dmg, 0, 0, false); + ExplodeTimer = 5000+rand()%5000; + } else ExplodeTimer -= diff; + DoMeleeAttackIfReady(); + } + }; + +}; void AddSC_hyjal_trash() { - Script *newscript = new Script; - newscript->Name = "mob_giant_infernal"; - newscript->GetAI = &GetAI_mob_giant_infernal; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_abomination"; - newscript->GetAI = &GetAI_mob_abomination; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_ghoul"; - newscript->GetAI = &GetAI_mob_ghoul; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_necromancer"; - newscript->GetAI = &GetAI_mob_necromancer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_banshee"; - newscript->GetAI = &GetAI_mob_banshee; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_crypt_fiend"; - newscript->GetAI = &GetAI_mob_crypt_fiend; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_fel_stalker"; - newscript->GetAI = &GetAI_mob_fel_stalker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_frost_wyrm"; - newscript->GetAI = &GetAI_mob_frost_wyrm; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_gargoyle"; - newscript->GetAI = &GetAI_mob_gargoyle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "alliance_rifleman"; - newscript->GetAI = &GetAI_alliance_rifleman; - newscript->RegisterSelf(); + new mob_giant_infernal(); + new mob_abomination(); + new mob_ghoul(); + new mob_necromancer(); + new mob_banshee(); + new mob_crypt_fiend(); + new mob_fel_stalker(); + new mob_frost_wyrm(); + new mob_gargoyle(); + new alliance_rifleman(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h index b18fa74e6a4..ba66e8ed41a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.h @@ -34,7 +34,7 @@ struct hyjal_trashAI : public npc_escortAI void DamageTaken(Unit *done_by, uint32 &damage); public: - ScriptedInstance* pInstance; + InstanceScript* pInstance; bool IsEvent; uint32 Delay; uint32 LastOverronPos; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 65579498210..41045ed0bf0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -40,287 +40,289 @@ enum eEnums 3 - Azgalor event 4 - Archimonde event */ - -struct instance_mount_hyjal : public ScriptedInstance +
class instance_hyjal : public InstanceMapScript { - instance_mount_hyjal(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_hyjal() : InstanceMapScript("instance_hyjal") { } - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; + InstanceScript* GetInstanceData_instance_mount_hyjal_InstanceMapScript(Map* pMap) + { + return new instance_mount_hyjal_InstanceMapScript(pMap); + } - std::list<uint64> m_uiAncientGemGUID; + struct instance_mount_hyjal_InstanceMapScript : public InstanceScript + { + instance_mount_hyjal_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint64 RageWinterchill; - uint64 Anetheron; - uint64 Kazrogal; - uint64 Azgalor; - uint64 Archimonde; - uint64 JainaProudmoore; - uint64 Thrall; - uint64 TyrandeWhisperwind; - uint64 HordeGate; - uint64 ElfGate; + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - uint32 Trash; + std::list<uint64> m_uiAncientGemGUID; - uint32 hordeRetreat; - uint32 allianceRetreat; - bool ArchiYell; + uint64 RageWinterchill; + uint64 Anetheron; + uint64 Kazrogal; + uint64 Azgalor; + uint64 Archimonde; + uint64 JainaProudmoore; + uint64 Thrall; + uint64 TyrandeWhisperwind; + uint64 HordeGate; + uint64 ElfGate; - uint32 RaidDamage; + uint32 Trash; - #define YELL_EFFORTS "All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more." - #define YELL_EFFORTS_NAME "Archimonde" + uint32 hordeRetreat; + uint32 allianceRetreat; + bool ArchiYell; - void Initialize() - { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - m_uiAncientGemGUID.clear(); - - RageWinterchill = 0; - Anetheron = 0; - Kazrogal = 0; - Azgalor = 0; - Archimonde = 0; - JainaProudmoore = 0; - Thrall = 0; - TyrandeWhisperwind = 0; - HordeGate = 0; - ElfGate = 0; - ArchiYell = false; - RaidDamage = 0; - - Trash = 0; - - hordeRetreat = 0; - allianceRetreat = 0; - } + uint32 RaidDamage; - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + #define YELL_EFFORTS "All of your efforts have been in vain, for the draining of the World Tree has already begun. Soon the heart of your world will beat no more." + #define YELL_EFFORTS_NAME "Archimonde" - return false; - } + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiAncientGemGUID.clear(); + + RageWinterchill = 0; + Anetheron = 0; + Kazrogal = 0; + Azgalor = 0; + Archimonde = 0; + JainaProudmoore = 0; + Thrall = 0; + TyrandeWhisperwind = 0; + HordeGate = 0; + ElfGate = 0; + ArchiYell = false; + RaidDamage = 0; + + Trash = 0; + + hordeRetreat = 0; + allianceRetreat = 0; + } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + bool IsEncounterInProgress() const { - case 182060: - HordeGate = pGo->GetGUID(); - if (allianceRetreat) - HandleGameObject(0, true, pGo); - else - HandleGameObject(0, false, pGo); - break; - case 182061: - ElfGate = pGo->GetGUID(); - if (hordeRetreat) - HandleGameObject(0, true, pGo); - else - HandleGameObject(0, false, pGo); - break; - case GO_ANCIENT_GEM: - m_uiAncientGemGUID.push_back(pGo->GetGUID()); - break; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case 17767: RageWinterchill = pCreature->GetGUID(); break; - case 17808: Anetheron = pCreature->GetGUID(); break; - case 17888: Kazrogal = pCreature->GetGUID(); break; - case 17842: Azgalor = pCreature->GetGUID(); break; - case 17968: Archimonde = pCreature->GetGUID(); break; - case 17772: JainaProudmoore = pCreature->GetGUID(); break; - case 17852: Thrall = pCreature->GetGUID(); break; - case 17948: TyrandeWhisperwind = pCreature->GetGUID(); break; + switch(pGo->GetEntry()) + { + case 182060: + HordeGate = pGo->GetGUID(); + if (allianceRetreat) + HandleGameObject(0, true, pGo); + else + HandleGameObject(0, false, pGo); + break; + case 182061: + ElfGate = pGo->GetGUID(); + if (hordeRetreat) + HandleGameObject(0, true, pGo); + else + HandleGameObject(0, false, pGo); + break; + case GO_ANCIENT_GEM: + m_uiAncientGemGUID.push_back(pGo->GetGUID()); + break; + } } - } - uint64 GetData64(uint32 identifier) - { - switch(identifier) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case DATA_RAGEWINTERCHILL: return RageWinterchill; - case DATA_ANETHERON: return Anetheron; - case DATA_KAZROGAL: return Kazrogal; - case DATA_AZGALOR: return Azgalor; - case DATA_ARCHIMONDE: return Archimonde; - case DATA_JAINAPROUDMOORE: return JainaProudmoore; - case DATA_THRALL: return Thrall; - case DATA_TYRANDEWHISPERWIND: return TyrandeWhisperwind; + switch(pCreature->GetEntry()) + { + case 17767: RageWinterchill = pCreature->GetGUID(); break; + case 17808: Anetheron = pCreature->GetGUID(); break; + case 17888: Kazrogal = pCreature->GetGUID(); break; + case 17842: Azgalor = pCreature->GetGUID(); break; + case 17968: Archimonde = pCreature->GetGUID(); break; + case 17772: JainaProudmoore = pCreature->GetGUID(); break; + case 17852: Thrall = pCreature->GetGUID(); break; + case 17948: TyrandeWhisperwind = pCreature->GetGUID(); break; + } } - return 0; - } + uint64 GetData64(uint32 identifier) + { + switch(identifier) + { + case DATA_RAGEWINTERCHILL: return RageWinterchill; + case DATA_ANETHERON: return Anetheron; + case DATA_KAZROGAL: return Kazrogal; + case DATA_AZGALOR: return Azgalor; + case DATA_ARCHIMONDE: return Archimonde; + case DATA_JAINAPROUDMOORE: return JainaProudmoore; + case DATA_THRALL: return Thrall; + case DATA_TYRANDEWHISPERWIND: return TyrandeWhisperwind; + } + + return 0; + } - void SetData(uint32 type, uint32 data) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case DATA_RAGEWINTERCHILLEVENT: m_auiEncounter[0] = data; break; - case DATA_ANETHERONEVENT: - m_auiEncounter[1] = data; - break; - case DATA_KAZROGALEVENT: m_auiEncounter[2] = data; break; - case DATA_AZGALOREVENT: - { - m_auiEncounter[3] = data; - if (data == DONE) + switch(type) + { + case DATA_RAGEWINTERCHILLEVENT: m_auiEncounter[0] = data; break; + case DATA_ANETHERONEVENT: + m_auiEncounter[1] = data; + break; + case DATA_KAZROGALEVENT: m_auiEncounter[2] = data; break; + case DATA_AZGALOREVENT: { - if (ArchiYell)break; - ArchiYell = true; - - Creature* pCreature = instance->GetCreature(Azgalor); - if (pCreature) + m_auiEncounter[3] = data; + if (data == DONE) { - Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000); + if (ArchiYell)break; + ArchiYell = true; - Map* pMap = pCreature->GetMap(); - if (pMap->IsDungeon() && pUnit) + Creature* pCreature = instance->GetCreature(Azgalor); + if (pCreature) { - pUnit->SetVisibility(VISIBILITY_OFF); - Map::PlayerList const &PlayerList = pMap->GetPlayers(); - if (PlayerList.isEmpty()) - return; + Creature* pUnit = pCreature->SummonCreature(21987,pCreature->GetPositionX(),pCreature->GetPositionY(),pCreature->GetPositionZ(),0,TEMPSUMMON_TIMED_DESPAWN,10000); - for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + Map* pMap = pCreature->GetMap(); + if (pMap->IsDungeon() && pUnit) { - if (i->getSource()) - { - WorldPacket data(SMSG_MESSAGECHAT, 200); - pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,YELL_EFFORTS,0,YELL_EFFORTS_NAME,i->getSource()->GetGUID()); - i->getSource()->GetSession()->SendPacket(&data); - - WorldPacket data2(SMSG_PLAY_SOUND, 4); - data2 << 10986; - i->getSource()->GetSession()->SendPacket(&data2); - } + pUnit->SetVisibility(VISIBILITY_OFF); + Map::PlayerList const &PlayerList = pMap->GetPlayers(); + if (PlayerList.isEmpty()) + return; + + for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) + { + if (i->getSource()) + { + WorldPacket data(SMSG_MESSAGECHAT, 200); + pUnit->BuildMonsterChat(&data,CHAT_MSG_MONSTER_YELL,YELL_EFFORTS,0,YELL_EFFORTS_NAME,i->getSource()->GetGUID()); + i->getSource()->GetSession()->SendPacket(&data); + + WorldPacket data2(SMSG_PLAY_SOUND, 4); + data2 << 10986; + i->getSource()->GetSession()->SendPacket(&data2); + } + } } } } } - } - break; - case DATA_ARCHIMONDEEVENT: m_auiEncounter[4] = data; break; - case DATA_RESET_TRASH_COUNT: Trash = 0; break; - - case DATA_TRASH: - if (data) Trash = data; - else Trash--; - DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash); - break; - case TYPE_RETREAT: - if (data == SPECIAL) - { - if (!m_uiAncientGemGUID.empty()) + break; + case DATA_ARCHIMONDEEVENT: m_auiEncounter[4] = data; break; + case DATA_RESET_TRASH_COUNT: Trash = 0; break; + + case DATA_TRASH: + if (data) Trash = data; + else Trash--; + DoUpdateWorldState(WORLD_STATE_ENEMYCOUNT, Trash); + break; + case TYPE_RETREAT: + if (data == SPECIAL) { - for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) + if (!m_uiAncientGemGUID.empty()) { - //don't know how long it expected - DoRespawnGameObject(*itr,DAY); + for (std::list<uint64>::const_iterator itr = m_uiAncientGemGUID.begin(); itr != m_uiAncientGemGUID.end(); ++itr) + { + //don't know how long it expected + DoRespawnGameObject(*itr,DAY); + } } } - } - break; - case DATA_ALLIANCE_RETREAT: - allianceRetreat = data; - HandleGameObject(HordeGate, true); - SaveToDB(); - break; - case DATA_HORDE_RETREAT: - hordeRetreat = data; - HandleGameObject(ElfGate, true); + break; + case DATA_ALLIANCE_RETREAT: + allianceRetreat = data; + HandleGameObject(HordeGate, true); + SaveToDB(); + break; + case DATA_HORDE_RETREAT: + hordeRetreat = data; + HandleGameObject(ElfGate, true); + SaveToDB(); + break; + case DATA_RAIDDAMAGE: + RaidDamage += data; + if (RaidDamage >= MINRAIDDAMAGE) + RaidDamage = MINRAIDDAMAGE; + break; + case DATA_RESET_RAIDDAMAGE: + RaidDamage = 0; + break; + } + + sLog.outDebug("TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data); + + if (data == DONE) + { + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3] << " " << m_auiEncounter[4] + << " " << allianceRetreat << " " << hordeRetreat + << " " << RaidDamage; + + str_data = saveStream.str(); + SaveToDB(); - break; - case DATA_RAIDDAMAGE: - RaidDamage += data; - if (RaidDamage >= MINRAIDDAMAGE) - RaidDamage = MINRAIDDAMAGE; - break; - case DATA_RESET_RAIDDAMAGE: - RaidDamage = 0; - break; - } + OUT_SAVE_INST_DATA_COMPLETE; + } - sLog.outDebug("TSCR: Instance Hyjal: Instance data updated for event %u (Data=%u)",type,data); + } - if (data == DONE) + uint32 GetData(uint32 type) { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3] << " " << m_auiEncounter[4] - << " " << allianceRetreat << " " << hordeRetreat - << " " << RaidDamage; - - str_data = saveStream.str(); - - SaveToDB(); - OUT_SAVE_INST_DATA_COMPLETE; + switch(type) + { + case DATA_RAGEWINTERCHILLEVENT: return m_auiEncounter[0]; + case DATA_ANETHERONEVENT: return m_auiEncounter[1]; + case DATA_KAZROGALEVENT: return m_auiEncounter[2]; + case DATA_AZGALOREVENT: return m_auiEncounter[3]; + case DATA_ARCHIMONDEEVENT: return m_auiEncounter[4]; + case DATA_TRASH: return Trash; + case DATA_ALLIANCE_RETREAT: return allianceRetreat; + case DATA_HORDE_RETREAT: return hordeRetreat; + case DATA_RAIDDAMAGE: return RaidDamage; + } + return 0; } - } - - uint32 GetData(uint32 type) - { - switch(type) + std::string GetSaveData() { - case DATA_RAGEWINTERCHILLEVENT: return m_auiEncounter[0]; - case DATA_ANETHERONEVENT: return m_auiEncounter[1]; - case DATA_KAZROGALEVENT: return m_auiEncounter[2]; - case DATA_AZGALOREVENT: return m_auiEncounter[3]; - case DATA_ARCHIMONDEEVENT: return m_auiEncounter[4]; - case DATA_TRASH: return Trash; - case DATA_ALLIANCE_RETREAT: return allianceRetreat; - case DATA_HORDE_RETREAT: return hordeRetreat; - case DATA_RAIDDAMAGE: return RaidDamage; + return str_data; } - return 0; - } - - std::string GetSaveData() - { - return str_data; - } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> allianceRetreat >> hordeRetreat >> RaidDamage; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead. + m_auiEncounter[i] = NOT_STARTED; + OUT_LOAD_INST_DATA_COMPLETE; } + }; - OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] >> m_auiEncounter[4] >> allianceRetreat >> hordeRetreat >> RaidDamage; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) // Do not load an encounter as IN_PROGRESS - reset it instead. - m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_mount_hyjal(Map* pMap) -{ - return new instance_mount_hyjal(pMap); -} void AddSC_instance_mount_hyjal() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_hyjal"; - newscript->GetInstanceData = &GetInstanceData_instance_mount_hyjal; - newscript->RegisterSelf(); + new instance_hyjal(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp index 7aa4b04a750..52f390e6232 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_epoch.cpp @@ -48,108 +48,110 @@ enum Yells SAY_SLAY_3 = -1595007, //"You were destined to fail. " SAY_DEATH = -1595008 //"*gurgles*" }; - -struct boss_epochAI : public ScriptedAI +
class boss_epoch : public CreatureScript { - boss_epochAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint8 uiStep; +public: + boss_epoch() : CreatureScript("boss_epoch") { } - uint32 uiStepTimer; - uint32 uiWoundingStrikeTimer; - uint32 uiTimeWarpTimer; - uint32 uiTimeStopTimer; - uint32 uiCurseOfExertionTimer; - - ScriptedInstance* pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiStep = 1; - uiStepTimer = 26000; - uiCurseOfExertionTimer = 9300; - uiTimeWarpTimer = 25300; - uiTimeStopTimer = 21300; - uiWoundingStrikeTimer = 5300; - - if (pInstance) - pInstance->SetData(DATA_EPOCH_EVENT, NOT_STARTED); + return new boss_epochAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_epochAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); + boss_epochAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (pInstance) - pInstance->SetData(DATA_EPOCH_EVENT, IN_PROGRESS); - } + uint8 uiStep; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 uiStepTimer; + uint32 uiWoundingStrikeTimer; + uint32 uiTimeWarpTimer; + uint32 uiTimeStopTimer; + uint32 uiCurseOfExertionTimer; - if (uiCurseOfExertionTimer < diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CURSE_OF_EXERTION); - uiCurseOfExertionTimer = 9300; - } else uiCurseOfExertionTimer -= diff; + InstanceScript* pInstance; - if (uiWoundingStrikeTimer < diff) + void Reset() { - DoCastVictim(SPELL_WOUNDING_STRIKE); + uiStep = 1; + uiStepTimer = 26000; + uiCurseOfExertionTimer = 9300; + uiTimeWarpTimer = 25300; + uiTimeStopTimer = 21300; uiWoundingStrikeTimer = 5300; - } else uiWoundingStrikeTimer -= diff; - if (uiTimeStopTimer < diff) - { - DoCastAOE(SPELL_TIME_STOP); - uiTimeStopTimer = 21300; - } else uiTimeStopTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, NOT_STARTED); + } - if (uiTimeWarpTimer < diff) + void EnterCombat(Unit* /*who*/) { - DoScriptText(RAND(SAY_TIME_WARP_1,SAY_TIME_WARP_2,SAY_TIME_WARP_3), me); - DoCastAOE(SPELL_TIME_WARP); - uiTimeWarpTimer = 25300; - } else uiTimeWarpTimer -= diff; + DoScriptText(SAY_AGGRO, me); - DoMeleeAttackIfReady(); - } + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, IN_PROGRESS); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiCurseOfExertionTimer < diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CURSE_OF_EXERTION); + uiCurseOfExertionTimer = 9300; + } else uiCurseOfExertionTimer -= diff; + + if (uiWoundingStrikeTimer < diff) + { + DoCastVictim(SPELL_WOUNDING_STRIKE); + uiWoundingStrikeTimer = 5300; + } else uiWoundingStrikeTimer -= diff; + + if (uiTimeStopTimer < diff) + { + DoCastAOE(SPELL_TIME_STOP); + uiTimeStopTimer = 21300; + } else uiTimeStopTimer -= diff; + + if (uiTimeWarpTimer < diff) + { + DoScriptText(RAND(SAY_TIME_WARP_1,SAY_TIME_WARP_2,SAY_TIME_WARP_3), me); + DoCastAOE(SPELL_TIME_WARP); + uiTimeWarpTimer = 25300; + } else uiTimeWarpTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); - if (pInstance) - pInstance->SetData(DATA_EPOCH_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_EPOCH_EVENT, DONE); + } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_epoch(Creature* pCreature) -{ - return new boss_epochAI (pCreature); -} void AddSC_boss_epoch() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_epoch"; - newscript->GetAI = &GetAI_boss_epoch; - newscript->RegisterSelf(); + new boss_epoch(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp index 60a46159fa7..f6b7b06bf73 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_infinite.cpp @@ -31,57 +31,59 @@ enum Yells SAY_DEATH = -1595047 }; - -struct boss_infinite_corruptorAI : public ScriptedAI +
class boss_infinite_corruptor : public CreatureScript { - boss_infinite_corruptorAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance* pInstance; +public: + boss_infinite_corruptor() : CreatureScript("boss_infinite_corruptor") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_INFINITE_EVENT, NOT_STARTED); + return new boss_infinite_corruptorAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_infinite_corruptorAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_INFINITE_EVENT, IN_PROGRESS); - } + boss_infinite_corruptorAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void AttackStart(Unit* /*who*/) {} - void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 /*diff*/) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - DoMeleeAttackIfReady(); - } + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_INFINITE_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_INFINITE_EVENT, IN_PROGRESS); + } + + void AttackStart(Unit* /*who*/) {} + void MoveInLineOfSight(Unit* /*who*/) {} + void UpdateAI(const uint32 /*diff*/) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_INFINITE_EVENT, DONE); + } + }; - void JustDied(Unit* /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_INFINITE_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_infinite_corruptor(Creature* pCreature) -{ - return new boss_infinite_corruptorAI(pCreature); -} void AddSC_boss_infinite_corruptor() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_infinite_corruptor"; - newscript->GetAI = &GetAI_boss_infinite_corruptor; - newscript->RegisterSelf(); + new boss_infinite_corruptor(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp index deabd11961f..c234c685980 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_mal_ganis.cpp @@ -66,196 +66,198 @@ enum CombatPhases COMBAT, OUTRO }; - -struct boss_mal_ganisAI : public ScriptedAI +
class boss_mal_ganis : public CreatureScript { - boss_mal_ganisAI(Creature *c) : ScriptedAI(c) +public: + boss_mal_ganis() : CreatureScript("boss_mal_ganis") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_mal_ganisAI (pCreature); } - uint32 uiCarrionSwarmTimer; - uint32 uiMindBlastTimer; - uint32 uiVampiricTouchTimer; - uint32 uiSleepTimer; + struct boss_mal_ganisAI : public ScriptedAI + { + boss_mal_ganisAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint8 uiOutroStep; - uint32 uiOutroTimer; + uint32 uiCarrionSwarmTimer; + uint32 uiMindBlastTimer; + uint32 uiVampiricTouchTimer; + uint32 uiSleepTimer; - bool bYelled; - bool bYelled2; + uint8 uiOutroStep; + uint32 uiOutroTimer; - CombatPhases Phase; + bool bYelled; + bool bYelled2; - ScriptedInstance* pInstance; + CombatPhases Phase; - void Reset() - { - bYelled = false; - bYelled2 = false; - Phase = COMBAT; - uiCarrionSwarmTimer = 6000; - uiMindBlastTimer = 11000; - uiVampiricTouchTimer = urand(10000,15000); - uiSleepTimer = urand(15000,20000); - uiOutroTimer = 1000; - - if (pInstance) - pInstance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); - } + InstanceScript* pInstance; - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO, me); - if (pInstance) - pInstance->SetData(DATA_MAL_GANIS_EVENT, IN_PROGRESS); - } + void Reset() + { + bYelled = false; + bYelled2 = false; + Phase = COMBAT; + uiCarrionSwarmTimer = 6000; + uiMindBlastTimer = 11000; + uiVampiricTouchTimer = urand(10000,15000); + uiSleepTimer = urand(15000,20000); + uiOutroTimer = 1000; + + if (pInstance) + pInstance->SetData(DATA_MAL_GANIS_EVENT, NOT_STARTED); + } - void DamageTaken(Unit *done_by, uint32 &damage) - { - if (damage >= me->GetHealth() && done_by != me) - damage = me->GetHealth()-1; - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO, me); + if (pInstance) + pInstance->SetData(DATA_MAL_GANIS_EVENT, IN_PROGRESS); + } - void UpdateAI(const uint32 diff) - { - switch(Phase) + void DamageTaken(Unit *done_by, uint32 &damage) { - case COMBAT: - //Return since we have no target - if (!UpdateVictim()) - return; - - if (!bYelled && HealthBelowPct(30)) - { - DoScriptText(SAY_30HEALTH, me); - bYelled = true; - } - - if (!bYelled2 && HealthBelowPct(15)) - { - DoScriptText(SAY_15HEALTH, me); - bYelled2 = true; - } - - if (HealthBelowPct(1)) - { - //Handle Escape Event: Don't forget to add Player::RewardPlayerAndGroupAtEvent - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - uiOutroStep = 1; - Phase = OUTRO; - return; - } - - if (Creature* pArthas = me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0)) - if (pArthas->isDead()) + if (damage >= me->GetHealth() && done_by != me) + damage = me->GetHealth()-1; + } + + void UpdateAI(const uint32 diff) + { + switch(Phase) + { + case COMBAT: + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!bYelled && HealthBelowPct(30)) { - EnterEvadeMode(); - me->DisappearAndDie(); - if (pInstance) - pInstance->SetData(DATA_MAL_GANIS_EVENT, FAIL); + DoScriptText(SAY_30HEALTH, me); + bYelled = true; } - if (uiCarrionSwarmTimer < diff) - { - DoCastVictim(SPELL_CARRION_SWARM); - uiCarrionSwarmTimer = 7000; - } else uiCarrionSwarmTimer -= diff; - - if (uiMindBlastTimer < diff) - { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_MIND_BLAST); - uiMindBlastTimer = 6000; - } else uiMindBlastTimer -= diff; - - if (uiVampiricTouchTimer < diff) - { - DoCast(me, SPELL_VAMPIRIC_TOUCH); - uiVampiricTouchTimer = 32000; - } else uiVampiricTouchTimer -= diff; - - if (uiSleepTimer < diff) - { - DoScriptText(RAND(SAY_SLEEP_1,SAY_SLEEP_2), me); - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SLEEP); - uiSleepTimer = urand(15000,20000); - } else uiSleepTimer -= diff; - - DoMeleeAttackIfReady(); - break; - case OUTRO: - if (uiOutroTimer < diff) - { - switch(uiOutroStep) + if (!bYelled2 && HealthBelowPct(15)) { - case 1: - DoScriptText(SAY_ESCAPE_SPEECH_1, me); - me->GetMotionMaster()->MoveTargetedHome(); - ++uiOutroStep; - uiOutroTimer = 8000; - break; - case 2: - me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0); - me->HandleEmoteCommand(29); - DoScriptText(SAY_ESCAPE_SPEECH_2, me); - ++uiOutroStep; - uiOutroTimer = 9000; - break; - case 3: - DoScriptText(SAY_OUTRO, me); - ++uiOutroStep; - uiOutroTimer = 16000; - break; - case 4: - me->HandleEmoteCommand(33); - ++uiOutroStep; - uiOutroTimer = 500; - break; - case 5: - me->SetVisibility(VISIBILITY_OFF); - me->Kill(me); - break; + DoScriptText(SAY_15HEALTH, me); + bYelled2 = true; + } + if (HealthBelowPct(1)) + { + //Handle Escape Event: Don't forget to add Player::RewardPlayerAndGroupAtEvent + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + uiOutroStep = 1; + Phase = OUTRO; + return; } - } else uiOutroTimer -= diff; - break; + + if (Creature* pArthas = me->GetCreature(*me, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0)) + if (pArthas->isDead()) + { + EnterEvadeMode(); + me->DisappearAndDie(); + if (pInstance) + pInstance->SetData(DATA_MAL_GANIS_EVENT, FAIL); + } + + if (uiCarrionSwarmTimer < diff) + { + DoCastVictim(SPELL_CARRION_SWARM); + uiCarrionSwarmTimer = 7000; + } else uiCarrionSwarmTimer -= diff; + + if (uiMindBlastTimer < diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_MIND_BLAST); + uiMindBlastTimer = 6000; + } else uiMindBlastTimer -= diff; + + if (uiVampiricTouchTimer < diff) + { + DoCast(me, SPELL_VAMPIRIC_TOUCH); + uiVampiricTouchTimer = 32000; + } else uiVampiricTouchTimer -= diff; + + if (uiSleepTimer < diff) + { + DoScriptText(RAND(SAY_SLEEP_1,SAY_SLEEP_2), me); + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SLEEP); + uiSleepTimer = urand(15000,20000); + } else uiSleepTimer -= diff; + + DoMeleeAttackIfReady(); + break; + case OUTRO: + if (uiOutroTimer < diff) + { + switch(uiOutroStep) + { + case 1: + DoScriptText(SAY_ESCAPE_SPEECH_1, me); + me->GetMotionMaster()->MoveTargetedHome(); + ++uiOutroStep; + uiOutroTimer = 8000; + break; + case 2: + me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance ? pInstance->GetData64(DATA_ARTHAS) : 0); + me->HandleEmoteCommand(29); + DoScriptText(SAY_ESCAPE_SPEECH_2, me); + ++uiOutroStep; + uiOutroTimer = 9000; + break; + case 3: + DoScriptText(SAY_OUTRO, me); + ++uiOutroStep; + uiOutroTimer = 16000; + break; + case 4: + me->HandleEmoteCommand(33); + ++uiOutroStep; + uiOutroTimer = 500; + break; + case 5: + me->SetVisibility(VISIBILITY_OFF); + me->Kill(me); + break; + + } + } else uiOutroTimer -= diff; + break; + } } - } - void JustDied(Unit* /*killer*/) - { - if (pInstance) + void JustDied(Unit* /*killer*/) { - pInstance->SetData(DATA_MAL_GANIS_EVENT, DONE); - - // give achievement credit to players. criteria use spell 58630 which doesn't exist. if (pInstance) - pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58630); + { + pInstance->SetData(DATA_MAL_GANIS_EVENT, DONE); + + // give achievement credit to players. criteria use spell 58630 which doesn't exist. + if (pInstance) + pInstance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 58630); + } } - } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3,SAY_SLAY_4), me); - } }; -CreatureAI* GetAI_boss_mal_ganis(Creature* pCreature) -{ - return new boss_mal_ganisAI (pCreature); -} void AddSC_boss_mal_ganis() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_mal_ganis"; - newscript->GetAI = &GetAI_boss_mal_ganis; - newscript->RegisterSelf(); + new boss_mal_ganis(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp index 4ab1c3023e6..65df6e4b6d0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_meathook.cpp @@ -44,96 +44,98 @@ enum Yells SAY_SPAWN = -1595030, SAY_DEATH = -1595031 }; - -struct boss_meathookAI : public ScriptedAI +
class boss_meathook : public CreatureScript { - boss_meathookAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - if (pInstance) - DoScriptText(SAY_SPAWN,me); - } +public: + boss_meathook() : CreatureScript("boss_meathook") { } - uint32 uiChainTimer; - uint32 uiDiseaseTimer; - uint32 uiFrenzyTimer; - - ScriptedInstance* pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiChainTimer = urand(12000,17000); //seen on video 13, 17, 15, 12, 16 - uiDiseaseTimer = urand(2000,4000); //approx 3s - uiFrenzyTimer = urand(21000,26000); //made it up - - if (pInstance) - pInstance->SetData(DATA_MEATHOOK_EVENT, NOT_STARTED); + return new boss_meathookAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_meathookAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); + boss_meathookAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + if (pInstance) + DoScriptText(SAY_SPAWN,me); + } - if (pInstance) - pInstance->SetData(DATA_MEATHOOK_EVENT, IN_PROGRESS); - } + uint32 uiChainTimer; + uint32 uiDiseaseTimer; + uint32 uiFrenzyTimer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - if (uiDiseaseTimer <= diff) + void Reset() { - DoCastAOE(SPELL_DISEASE_EXPULSION); - uiDiseaseTimer = urand(1500,4000); - } else uiDiseaseTimer -= diff; + uiChainTimer = urand(12000,17000); //seen on video 13, 17, 15, 12, 16 + uiDiseaseTimer = urand(2000,4000); //approx 3s + uiFrenzyTimer = urand(21000,26000); //made it up - if (uiFrenzyTimer <= diff) - { - DoCast(me, SPELL_FRENZY); - uiFrenzyTimer = urand(21000,26000); - } else uiFrenzyTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, NOT_STARTED); + } - if (uiChainTimer <= diff) + void EnterCombat(Unit* /*who*/) { - if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_CONSTRICTING_CHAINS); //anyone but the tank - uiChainTimer = urand(2000,4000); - } else uiChainTimer -= diff; + DoScriptText(SAY_AGGRO, me); - DoMeleeAttackIfReady(); - } + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, IN_PROGRESS); + } - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (uiDiseaseTimer <= diff) + { + DoCastAOE(SPELL_DISEASE_EXPULSION); + uiDiseaseTimer = urand(1500,4000); + } else uiDiseaseTimer -= diff; + + if (uiFrenzyTimer <= diff) + { + DoCast(me, SPELL_FRENZY); + uiFrenzyTimer = urand(21000,26000); + } else uiFrenzyTimer -= diff; + + if (uiChainTimer <= diff) + { + if (Unit *pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_CONSTRICTING_CHAINS); //anyone but the tank + uiChainTimer = urand(2000,4000); + } else uiChainTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) + { + DoScriptText(SAY_DEATH, me); - if (pInstance) - pInstance->SetData(DATA_MEATHOOK_EVENT, DONE); - } + if (pInstance) + pInstance->SetData(DATA_MEATHOOK_EVENT, DONE); + } - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + void KilledUnit(Unit * victim) + { + if (victim == me) + return; + + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_meathook(Creature* pCreature) -{ - return new boss_meathookAI (pCreature); -} void AddSC_boss_meathook() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_meathook"; - newscript->GetAI = &GetAI_boss_meathook; - newscript->RegisterSelf(); + new boss_meathook(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp index 98c8d34bb8a..f1b3d3899d9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/boss_salramm.cpp @@ -56,114 +56,116 @@ enum Yells SAY_SUMMON_GHOULS_1 = -1595043, SAY_SUMMON_GHOULS_2 = -1595044 }; - -struct boss_salrammAI : public ScriptedAI +
class boss_salramm : public CreatureScript { - boss_salrammAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - if (pInstance) - DoScriptText(SAY_SPAWN,me); - } - - uint32 uiCurseFleshTimer; - uint32 uiExplodeGhoulTimer; - uint32 uiShadowBoltTimer; - uint32 uiStealFleshTimer; - uint32 uiSummonGhoulsTimer; - - ScriptedInstance* pInstance; +public: + boss_salramm() : CreatureScript("boss_salramm") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiCurseFleshTimer = 30000; //30s DBM - uiExplodeGhoulTimer = urand(25000,28000); //approx 6 sec after summon ghouls - uiShadowBoltTimer = urand(8000,12000); // approx 10s - uiStealFleshTimer = 12345; - uiSummonGhoulsTimer = urand(19000,24000); //on a video approx 24s after aggro - - if (pInstance) - pInstance->SetData(DATA_SALRAMM_EVENT, NOT_STARTED); + return new boss_salrammAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct boss_salrammAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); + boss_salrammAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + if (pInstance) + DoScriptText(SAY_SPAWN,me); + } - if (pInstance) - pInstance->SetData(DATA_SALRAMM_EVENT, IN_PROGRESS); - } + uint32 uiCurseFleshTimer; + uint32 uiExplodeGhoulTimer; + uint32 uiShadowBoltTimer; + uint32 uiStealFleshTimer; + uint32 uiSummonGhoulsTimer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript* pInstance; - //Curse of twisted flesh timer - if (uiCurseFleshTimer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CURSE_OF_TWISTED_FLESH); - uiCurseFleshTimer = 37000; - } else uiCurseFleshTimer -= diff; + uiCurseFleshTimer = 30000; //30s DBM + uiExplodeGhoulTimer = urand(25000,28000); //approx 6 sec after summon ghouls + uiShadowBoltTimer = urand(8000,12000); // approx 10s + uiStealFleshTimer = 12345; + uiSummonGhoulsTimer = urand(19000,24000); //on a video approx 24s after aggro - //Shadow bolt timer - if (uiShadowBoltTimer <= diff) + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit* /*who*/) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_SHADOW_BOLT); - uiShadowBoltTimer = urand(8000,12000); - } else uiShadowBoltTimer -= diff; + DoScriptText(SAY_AGGRO, me); + + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, IN_PROGRESS); + } - //Steal Flesh timer - if (uiStealFleshTimer <= diff) + void UpdateAI(const uint32 diff) { - DoScriptText(RAND(SAY_STEAL_FLESH_1,SAY_STEAL_FLESH_2,SAY_STEAL_FLESH_3), me); - if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(random_pTarget, SPELL_STEAL_FLESH); - uiStealFleshTimer = 10000; - } else uiStealFleshTimer -= diff; - - //Summon ghouls timer - if (uiSummonGhoulsTimer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //Curse of twisted flesh timer + if (uiCurseFleshTimer <= diff) + { + DoCast(me->getVictim(), SPELL_CURSE_OF_TWISTED_FLESH); + uiCurseFleshTimer = 37000; + } else uiCurseFleshTimer -= diff; + + //Shadow bolt timer + if (uiShadowBoltTimer <= diff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_SHADOW_BOLT); + uiShadowBoltTimer = urand(8000,12000); + } else uiShadowBoltTimer -= diff; + + //Steal Flesh timer + if (uiStealFleshTimer <= diff) + { + DoScriptText(RAND(SAY_STEAL_FLESH_1,SAY_STEAL_FLESH_2,SAY_STEAL_FLESH_3), me); + if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(random_pTarget, SPELL_STEAL_FLESH); + uiStealFleshTimer = 10000; + } else uiStealFleshTimer -= diff; + + //Summon ghouls timer + if (uiSummonGhoulsTimer <= diff) + { + DoScriptText(RAND(SAY_SUMMON_GHOULS_1,SAY_SUMMON_GHOULS_2), me); + if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(random_pTarget, SPELL_SUMMON_GHOULS); + uiSummonGhoulsTimer = 10000; + } else uiSummonGhoulsTimer -= diff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* /*killer*/) { - DoScriptText(RAND(SAY_SUMMON_GHOULS_1,SAY_SUMMON_GHOULS_2), me); - if (Unit* random_pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(random_pTarget, SPELL_SUMMON_GHOULS); - uiSummonGhoulsTimer = 10000; - } else uiSummonGhoulsTimer -= diff; + DoScriptText(SAY_DEATH, me); - DoMeleeAttackIfReady(); - } - - void JustDied(Unit* /*killer*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + pInstance->SetData(DATA_SALRAMM_EVENT, DONE); + } - if (pInstance) - pInstance->SetData(DATA_SALRAMM_EVENT, DONE); - } + void KilledUnit(Unit * victim) + { + if (victim == me) + return; - void KilledUnit(Unit * victim) - { - if (victim == me) - return; + DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); + } + }; - DoScriptText(RAND(SAY_SLAY_1,SAY_SLAY_2,SAY_SLAY_3), me); - } }; -CreatureAI* GetAI_boss_salramm(Creature* pCreature) -{ - return new boss_salrammAI (pCreature); -} void AddSC_boss_salramm() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_salramm"; - newscript->GetAI = &GetAI_boss_salramm; - newscript->RegisterSelf(); + new boss_salramm(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp index e2c3d9cde78..11d55f333f5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.cpp @@ -218,992 +218,990 @@ float RiftAndSpawnsLocations[ENCOUNTER_CHRONO_SPAWNS][5]= {NPC_EPOCH, 2451.809326, 1112.901245, 149.220459, 3.363617} }; -struct npc_arthasAI : public npc_escortAI +#define GOSSIP_ITEM_ARTHAS_0 "I'm ready to start Culling of Stratholme." +#define GOSSIP_ITEM_ARTHAS_1 "Yes, my Prince. We're ready." +#define GOSSIP_ITEM_ARTHAS_2 "We're only doing what is best for Loarderon your Highness." +#define GOSSIP_ITEM_ARTHAS_3 "I'm ready." +#define GOSSIP_ITEM_ARTHAS_4 "For Lordaeron!" +#define GOSSIP_ITEM_ARTHAS_5 "I'm ready to battle the dreadlord, sire." +
class npc_arthas : public CreatureScript { - npc_arthasAI(Creature *pCreature) : npc_escortAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - Reset(); - } - - ScriptedInstance* pInstance; - - bool bStepping; - uint32 uiStep; - uint32 uiPhaseTimer; - uint32 uiGossipStep; - uint32 uiPlayerFaction; - uint32 uiBossEvent; - uint32 uiWave; - - uint64 uiUtherGUID; - uint64 uiJainaGUID; - uint64 uiCitymenGUID[2]; - uint64 uiWaveGUID[ENCOUNTER_WAVES_MAX_SPAWNS]; - uint64 uiInfiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER]; - uint64 uiStalkerGUID; - - uint64 uiBossGUID; //uiMeathookGUID || uiSalrammGUID - uint64 uiEpochGUID; - uint64 uiMalganisGUID; - uint64 uiInfiniteGUID; - - uint32 uiExorcismTimer; +public: + npc_arthas() : CreatureScript("npc_arthas") { } - void Reset() + bool OnGossipSelect(Player *pPlayer, Creature *pCreature, uint32 /*sender*/, uint32 action) { - uiUtherGUID = 0; - uiJainaGUID = 0; + npc_arthasAI* pAI = CAST_AI(npc_arthas::npc_arthasAI,pCreature->AI()); - for (uint8 i = 0; i < 2; ++i) - uiCitymenGUID[i] = 0; + if (!pAI) + return false; - for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) - uiWaveGUID[i] = 0; - - for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i) - uiInfiniteDraconianGUID[i] = 0; + switch (action) + { + case GOSSIP_ACTION_INFO_DEF: + pAI->Start(true,true,pPlayer->GetGUID(),0,false,false); + pAI->SetDespawnAtEnd(false); + pAI->bStepping = false; + pAI->uiStep = 1; + break; + case GOSSIP_ACTION_INFO_DEF+1: + pAI->bStepping = true; + pAI->uiStep = 24; + break; + case GOSSIP_ACTION_INFO_DEF+2: + pAI->SetHoldState(false); + pAI->bStepping = false; + pAI->uiStep = 61; + break; + case GOSSIP_ACTION_INFO_DEF+3: + pAI->SetHoldState(false); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pAI->bStepping = true; + pAI->uiStep = 84; + break; + case GOSSIP_ACTION_INFO_DEF+5: + pAI->bStepping = true; + pAI->uiStep = 85; + break; + } + pPlayer->CLOSE_GOSSIP_MENU(); + pAI->SetDespawnAtFar(true); + pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return true; + } - uiStalkerGUID = 0; - uiBossGUID = 0; - uiEpochGUID = 0; - uiMalganisGUID = 0; - uiInfiniteGUID = 0; + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + npc_arthasAI* pAI = CAST_AI(npc_arthas::npc_arthasAI,pCreature->AI()); - if (pInstance) { - pInstance->SetData(DATA_ARTHAS_EVENT, NOT_STARTED); - switch(pInstance->GetData(DATA_ARTHAS_EVENT)) + if (pAI && pAI->bStepping == false) + { + switch (pAI->uiGossipStep) { - case NOT_STARTED: - bStepping = true; - uiStep = 0; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - uiBossEvent = DATA_MEATHOOK_EVENT; - uiGossipStep = 0; + case 0: //This one is a workaround since the very beggining of the script is wrong. + if (pPlayer->GetQuestStatus(13149) != QUEST_STATUS_COMPLETE) + return false; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); + break; + case 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_1, pCreature->GetGUID()); + break; + case 2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_2, pCreature->GetGUID()); + break; + case 3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_3, pCreature->GetGUID()); + break; + case 4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_4, pCreature->GetGUID()); + break; + case 5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_5, pCreature->GetGUID()); break; + default: + return false; } - uiPhaseTimer = 1000; - uiExorcismTimer = 7300; - uiWave = 0; } + return true; } - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoCast(me, SPELL_ARTHAS_AURA); + return new npc_arthasAI(pCreature); } - void JustDied(Unit * /*killer*/) + struct npc_arthasAI : public npc_escortAI { - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, FAIL); - } + npc_arthasAI(Creature *pCreature) : npc_escortAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + Reset(); + } - void SpawnTimeRift(uint32 timeRiftID, uint64* guidVector) - { - me->SummonCreature((uint32)RiftAndSpawnsLocations[timeRiftID][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_DESPAWN,11000); + InstanceScript* pInstance; + + bool bStepping; + uint32 uiStep; + uint32 uiPhaseTimer; + uint32 uiGossipStep; + uint32 uiPlayerFaction; + uint32 uiBossEvent; + uint32 uiWave; + + uint64 uiUtherGUID; + uint64 uiJainaGUID; + uint64 uiCitymenGUID[2]; + uint64 uiWaveGUID[ENCOUNTER_WAVES_MAX_SPAWNS]; + uint64 uiInfiniteDraconianGUID[ENCOUNTER_DRACONIAN_NUMBER]; + uint64 uiStalkerGUID; + + uint64 uiBossGUID; //uiMeathookGUID || uiSalrammGUID + uint64 uiEpochGUID; + uint64 uiMalganisGUID; + uint64 uiInfiniteGUID; + + uint32 uiExorcismTimer; + + void Reset() + { + uiUtherGUID = 0; + uiJainaGUID = 0; + + for (uint8 i = 0; i < 2; ++i) + uiCitymenGUID[i] = 0; + + for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + uiWaveGUID[i] = 0; + + for (uint8 i = 0; i < ENCOUNTER_DRACONIAN_NUMBER; ++i) + uiInfiniteDraconianGUID[i] = 0; + + uiStalkerGUID = 0; + uiBossGUID = 0; + uiEpochGUID = 0; + uiMalganisGUID = 0; + uiInfiniteGUID = 0; + + if (pInstance) { + pInstance->SetData(DATA_ARTHAS_EVENT, NOT_STARTED); + switch(pInstance->GetData(DATA_ARTHAS_EVENT)) + { + case NOT_STARTED: + bStepping = true; + uiStep = 0; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + uiBossEvent = DATA_MEATHOOK_EVENT; + uiGossipStep = 0; + break; + } + uiPhaseTimer = 1000; + uiExorcismTimer = 7300; + uiWave = 0; + } + } + + void EnterCombat(Unit* /*who*/) + { + DoCast(me, SPELL_ARTHAS_AURA); + } - for (uint32 i = timeRiftID+1; i < ENCOUNTER_CHRONO_SPAWNS; ++i) + void JustDied(Unit * /*killer*/) { - if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_TIME_RIFT) break; - if (Creature* pTemp = me->SummonCreature((uint32)RiftAndSpawnsLocations[i][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, FAIL); + } + + void SpawnTimeRift(uint32 timeRiftID, uint64* guidVector) + { + me->SummonCreature((uint32)RiftAndSpawnsLocations[timeRiftID][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_DESPAWN,11000); + + for (uint32 i = timeRiftID+1; i < ENCOUNTER_CHRONO_SPAWNS; ++i) { - guidVector[i-timeRiftID-1] = pTemp->GetGUID(); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pTemp->SetReactState(REACT_PASSIVE); - pTemp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1],RiftAndSpawnsLocations[i][2],RiftAndSpawnsLocations[i][3]); - if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH) - uiEpochGUID = pTemp->GetGUID(); + if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_TIME_RIFT) break; + if (Creature* pTemp = me->SummonCreature((uint32)RiftAndSpawnsLocations[i][0],RiftAndSpawnsLocations[timeRiftID][1],RiftAndSpawnsLocations[timeRiftID][2],RiftAndSpawnsLocations[timeRiftID][3],RiftAndSpawnsLocations[timeRiftID][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + guidVector[i-timeRiftID-1] = pTemp->GetGUID(); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pTemp->SetReactState(REACT_PASSIVE); + pTemp->GetMotionMaster()->MovePoint(0, RiftAndSpawnsLocations[i][1],RiftAndSpawnsLocations[i][2],RiftAndSpawnsLocations[i][3]); + if ((uint32)RiftAndSpawnsLocations[i][0] == NPC_EPOCH) + uiEpochGUID = pTemp->GetGUID(); + } } } - } - void SpawnWaveGroup(uint32 waveID, uint64* guidVector) - { - for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + void SpawnWaveGroup(uint32 waveID, uint64* guidVector) { - if ((uint32)WavesLocations[waveID][i][0] == 0) break; - if (Creature* pTemp = me->SummonCreature((uint32)WavesLocations[waveID][i][0],WavesLocations[waveID][i][1],WavesLocations[waveID][i][2],WavesLocations[waveID][i][3],WavesLocations[waveID][i][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + for (uint32 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) { - guidVector[i] = pTemp->GetGUID(); + if ((uint32)WavesLocations[waveID][i][0] == 0) break; + if (Creature* pTemp = me->SummonCreature((uint32)WavesLocations[waveID][i][0],WavesLocations[waveID][i][1],WavesLocations[waveID][i][2],WavesLocations[waveID][i][3],WavesLocations[waveID][i][4],TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + guidVector[i] = pTemp->GetGUID(); + } } } - } - void SetHoldState(bool bOnHold) - { - SetEscortPaused(bOnHold); - } + void SetHoldState(bool bOnHold) + { + SetEscortPaused(bOnHold); + } - void JumpToNextStep(uint32 uiTimer) - { - uiPhaseTimer = uiTimer; - ++uiStep; - } + void JumpToNextStep(uint32 uiTimer) + { + uiPhaseTimer = uiTimer; + ++uiStep; + } - void WaypointReached(uint32 uiPointId) - { - switch(uiPointId) + void WaypointReached(uint32 uiPointId) { - case 0: - case 1: - case 3: - case 9: - case 10: - case 11: - case 22: - case 23: - case 26: - case 55: - case 56: - SetHoldState(true); - bStepping = true; - break; - case 7: - if (Unit* pCityman0 = me->SummonCreature(NPC_CITY_MAN,2091.977f,1275.021f,140.757f,0.558f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) - uiCitymenGUID[0] = pCityman0->GetGUID(); - if (Unit* pCityman1 = me->SummonCreature(NPC_CITY_MAN2,2093.514f,1275.842f,140.408f,3.801f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) - uiCitymenGUID[1] = pCityman1->GetGUID(); - break; - case 8: - uiGossipStep = 1; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetHoldState(true); - break; - case 12: - SetRun(true); - DoScriptText(SAY_PHASE210, me); - if (Unit* pDisguised0 = me->SummonCreature(NPC_CITY_MAN3,2398.14f,1207.81f,134.04f,5.155249f,TEMPSUMMON_DEAD_DESPAWN,180000)) - { - uiInfiniteDraconianGUID[0] = pDisguised0->GetGUID(); - if (Unit* pDisguised1 = me->SummonCreature(NPC_CITY_MAN4,2403.22f,1205.54f,134.04f,3.311264f,TEMPSUMMON_DEAD_DESPAWN,180000)) + switch(uiPointId) + { + case 0: + case 1: + case 3: + case 9: + case 10: + case 11: + case 22: + case 23: + case 26: + case 55: + case 56: + SetHoldState(true); + bStepping = true; + break; + case 7: + if (Unit* pCityman0 = me->SummonCreature(NPC_CITY_MAN,2091.977f,1275.021f,140.757f,0.558f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) + uiCitymenGUID[0] = pCityman0->GetGUID(); + if (Unit* pCityman1 = me->SummonCreature(NPC_CITY_MAN2,2093.514f,1275.842f,140.408f,3.801f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,60000)) + uiCitymenGUID[1] = pCityman1->GetGUID(); + break; + case 8: + uiGossipStep = 1; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + case 12: + SetRun(true); + DoScriptText(SAY_PHASE210, me); + if (Unit* pDisguised0 = me->SummonCreature(NPC_CITY_MAN3,2398.14f,1207.81f,134.04f,5.155249f,TEMPSUMMON_DEAD_DESPAWN,180000)) { - uiInfiniteDraconianGUID[1] = pDisguised1->GetGUID(); - - if (Unit* pDisguised2 = me->SummonCreature(NPC_CITY_MAN,2400.82f,1201.69f,134.01f,1.534082f,TEMPSUMMON_DEAD_DESPAWN,180000)) + uiInfiniteDraconianGUID[0] = pDisguised0->GetGUID(); + if (Unit* pDisguised1 = me->SummonCreature(NPC_CITY_MAN4,2403.22f,1205.54f,134.04f,3.311264f,TEMPSUMMON_DEAD_DESPAWN,180000)) { - uiInfiniteDraconianGUID[2] = pDisguised2->GetGUID(); - pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); - pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[0]); - pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); + uiInfiniteDraconianGUID[1] = pDisguised1->GetGUID(); + + if (Unit* pDisguised2 = me->SummonCreature(NPC_CITY_MAN,2400.82f,1201.69f,134.01f,1.534082f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiInfiniteDraconianGUID[2] = pDisguised2->GetGUID(); + pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); + pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[0]); + pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, uiInfiniteDraconianGUID[1]); + } } } - } - break; - case 20: - uiGossipStep = 2; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetRun(false); - SetHoldState(true); - break; - case 21: - DoScriptText(SAY_PHASE301, me); - break; - case 25: - SetRun(false); - SpawnTimeRift(0,&uiInfiniteDraconianGUID[0]); - DoScriptText(SAY_PHASE307,me); - break; - case 29: - SetRun(false); - SpawnTimeRift(5,&uiInfiniteDraconianGUID[0]); - SpawnTimeRift(8,&uiInfiniteDraconianGUID[2]); - DoScriptText(SAY_PHASE309,me); - SetHoldState(true); - bStepping = true; - break; - case 31: - SetRun(false); - SpawnTimeRift(11,&uiInfiniteDraconianGUID[0]); - SpawnTimeRift(14,&uiInfiniteDraconianGUID[2]); - DoScriptText(SAY_PHASE311,me); - SetHoldState(true); - bStepping = true; - break; - case 32: - DoScriptText(SAY_PHASE401,me); - break; - case 34: - DoScriptText(SAY_PHASE402,me); - break; - case 35: - DoScriptText(SAY_PHASE403,me); - break; - case 36: - if (pInstance) - { - GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SHKAF_GATE)); - pGate->SetGoState(GO_STATE_ACTIVE); - } - break; - case 45: - SetRun(true); - SetDespawnAtFar(false); - uiGossipStep = 4; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetHoldState(true); - break; - case 47: - SetRun(false); - DoScriptText(SAY_PHASE405,me); - break; - case 48: - SetRun(true); - DoScriptText(SAY_PHASE406,me); - break; - case 53: - DoScriptText(SAY_PHASE407,me); - break; - case 54: - uiGossipStep = 5; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetHoldState(true); - break; - } - } + break; + case 20: + uiGossipStep = 2; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetRun(false); + SetHoldState(true); + break; + case 21: + DoScriptText(SAY_PHASE301, me); + break; + case 25: + SetRun(false); + SpawnTimeRift(0,&uiInfiniteDraconianGUID[0]); + DoScriptText(SAY_PHASE307,me); + break; + case 29: + SetRun(false); + SpawnTimeRift(5,&uiInfiniteDraconianGUID[0]); + SpawnTimeRift(8,&uiInfiniteDraconianGUID[2]); + DoScriptText(SAY_PHASE309,me); + SetHoldState(true); + bStepping = true; + break; + case 31: + SetRun(false); + SpawnTimeRift(11,&uiInfiniteDraconianGUID[0]); + SpawnTimeRift(14,&uiInfiniteDraconianGUID[2]); + DoScriptText(SAY_PHASE311,me); + SetHoldState(true); + bStepping = true; + break; + case 32: + DoScriptText(SAY_PHASE401,me); + break; + case 34: + DoScriptText(SAY_PHASE402,me); + break; + case 35: + DoScriptText(SAY_PHASE403,me); + break; + case 36: + if (pInstance) + { + GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_SHKAF_GATE)); + pGate->SetGoState(GO_STATE_ACTIVE); + } + break; + case 45: + SetRun(true); + SetDespawnAtFar(false); + uiGossipStep = 4; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + case 47: + SetRun(false); + DoScriptText(SAY_PHASE405,me); + break; + case 48: + SetRun(true); + DoScriptText(SAY_PHASE406,me); + break; + case 53: + DoScriptText(SAY_PHASE407,me); + break; + case 54: + uiGossipStep = 5; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetHoldState(true); + break; + } + } - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); - DoMeleeAttackIfReady(); + DoMeleeAttackIfReady(); - if (bStepping) - { - if (uiPhaseTimer <= diff) + if (bStepping) { - switch(uiStep) + if (uiPhaseTimer <= diff) { - //After reset - case 0: - if (Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f)) - uiJainaGUID = pJaina->GetGUID(); - else if (Unit* pJaina = me->SummonCreature(NPC_JAINA,1895.48f,1292.66f,143.706f,0.023475f,TEMPSUMMON_DEAD_DESPAWN,180000)) - uiJainaGUID = pJaina->GetGUID(); - bStepping = false; - JumpToNextStep(0); - break; - //After waypoint 0 - case 1: - me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - if (Unit* pUther = me->SummonCreature(NPC_UTHER,1794.357f,1272.183f,140.558f,1.37f,TEMPSUMMON_DEAD_DESPAWN,180000)) - { - uiUtherGUID = pUther->GetGUID(); - pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); - pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f); - pUther->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiUtherGUID); - } - JumpToNextStep(17000); - break; - case 2: - DoScriptText(SAY_PHASE101, me); - JumpToNextStep(2000); - break; - case 3: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - { - DoScriptText(SAY_PHASE102, pUther); - } - JumpToNextStep(8000); - break; - case 4: - SetEscortPaused(false); - bStepping = false; - SetRun(false); - DoScriptText(SAY_PHASE103, me); - JumpToNextStep(0); - break; - //After waypoint 1 - case 5: - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - pJaina->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - DoScriptText(SAY_PHASE104, me); - JumpToNextStep(10000); - break; - case 6: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE105, pUther); - JumpToNextStep(1000); - break; - case 7: - DoScriptText(SAY_PHASE106, me); - JumpToNextStep(4000); - break; - case 8: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE107, pUther); - JumpToNextStep(6000); - break; - case 9: - DoScriptText(SAY_PHASE108, me); - JumpToNextStep(4000); - break; - case 10: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE109, pUther); - JumpToNextStep(8000); - break; - case 11: - DoScriptText(SAY_PHASE110, me); - JumpToNextStep(4000); - break; - case 12: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE111, pUther); - JumpToNextStep(4000); - break; - case 13: - DoScriptText(SAY_PHASE112, me); - JumpToNextStep(11000); - break; - case 14: - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - DoScriptText(SAY_PHASE113, pJaina); - JumpToNextStep(3000); - break; - case 15: - DoScriptText(SAY_PHASE114, me); - JumpToNextStep(9000); - break; - case 16: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - DoScriptText(SAY_PHASE115, pUther); - JumpToNextStep(4000); - break; - case 17: - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - { - pUther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pUther->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); - } - JumpToNextStep(1000); - break; - case 18: - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - { + switch(uiStep) + { + //After reset + case 0: + if (Unit* pJaina = GetClosestCreatureWithEntry(me, NPC_JAINA, 50.0f)) + uiJainaGUID = pJaina->GetGUID(); + else if (Unit* pJaina = me->SummonCreature(NPC_JAINA,1895.48f,1292.66f,143.706f,0.023475f,TEMPSUMMON_DEAD_DESPAWN,180000)) + uiJainaGUID = pJaina->GetGUID(); + bStepping = false; + JumpToNextStep(0); + break; + //After waypoint 0 + case 1: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + if (Unit* pUther = me->SummonCreature(NPC_UTHER,1794.357f,1272.183f,140.558f,1.37f,TEMPSUMMON_DEAD_DESPAWN,180000)) + { + uiUtherGUID = pUther->GetGUID(); + pUther->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + pUther->GetMotionMaster()->MovePoint(0, 1897.018f, 1287.487f, 143.481f); + pUther->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiUtherGUID); + } + JumpToNextStep(17000); + break; + case 2: + DoScriptText(SAY_PHASE101, me); + JumpToNextStep(2000); + break; + case 3: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + { + DoScriptText(SAY_PHASE102, pUther); + } + JumpToNextStep(8000); + break; + case 4: + SetEscortPaused(false); + bStepping = false; + SetRun(false); + DoScriptText(SAY_PHASE103, me); + JumpToNextStep(0); + break; + //After waypoint 1 + case 5: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + pJaina->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + DoScriptText(SAY_PHASE104, me); + JumpToNextStep(10000); + break; + case 6: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE105, pUther); + JumpToNextStep(1000); + break; + case 7: + DoScriptText(SAY_PHASE106, me); + JumpToNextStep(4000); + break; + case 8: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE107, pUther); + JumpToNextStep(6000); + break; + case 9: + DoScriptText(SAY_PHASE108, me); + JumpToNextStep(4000); + break; + case 10: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE109, pUther); + JumpToNextStep(8000); + break; + case 11: + DoScriptText(SAY_PHASE110, me); + JumpToNextStep(4000); + break; + case 12: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE111, pUther); + JumpToNextStep(4000); + break; + case 13: + DoScriptText(SAY_PHASE112, me); + JumpToNextStep(11000); + break; + case 14: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + DoScriptText(SAY_PHASE113, pJaina); + JumpToNextStep(3000); + break; + case 15: + DoScriptText(SAY_PHASE114, me); + JumpToNextStep(9000); + break; + case 16: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + DoScriptText(SAY_PHASE115, pUther); + JumpToNextStep(4000); + break; + case 17: + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + { + pUther->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pUther->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); + } + JumpToNextStep(1000); + break; + case 18: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + { + me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); + pJaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pJaina->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); + } + JumpToNextStep(1000); + break; + case 19: + DoScriptText(SAY_PHASE116, me); + JumpToNextStep(1000); + break; + case 20: + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + DoScriptText(SAY_PHASE117, pJaina); + JumpToNextStep(3000); + break; + case 21: + SetEscortPaused(false); + bStepping = false; + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After waypoint 3 + case 22: + DoScriptText(SAY_PHASE118, me); me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); - pJaina->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pJaina->GetMotionMaster()->MovePoint(0, 1794.357f,1272.183f,140.558f); - } - JumpToNextStep(1000); - break; - case 19: - DoScriptText(SAY_PHASE116, me); - JumpToNextStep(1000); - break; - case 20: - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - DoScriptText(SAY_PHASE117, pJaina); - JumpToNextStep(3000); - break; - case 21: - SetEscortPaused(false); - bStepping = false; - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - JumpToNextStep(0); - break; - //After waypoint 3 - case 22: - DoScriptText(SAY_PHASE118, me); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiJainaGUID); - JumpToNextStep(10000); - break; - case 23: - SetEscortPaused(false); - bStepping = false; - SetRun(true); + JumpToNextStep(10000); + break; + case 23: + SetEscortPaused(false); + bStepping = false; + SetRun(true); - if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) - pJaina->DisappearAndDie(); + if (Creature* pJaina = Unit::GetCreature(*me, uiJainaGUID)) + pJaina->DisappearAndDie(); - if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) - pUther->DisappearAndDie(); + if (Creature* pUther = Unit::GetCreature(*me, uiUtherGUID)) + pUther->DisappearAndDie(); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - JumpToNextStep(0); - break; - //After Gossip 1 (waypoint 8) - case 24: - if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2026.469f,1287.088f,143.596f,1.37f,TEMPSUMMON_TIMED_DESPAWN,14000)) - { - uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); - } - JumpToNextStep(1000); - break; - case 25: - DoScriptText(SAY_PHASE201, me); - JumpToNextStep(12000); - break; - case 26: - SetEscortPaused(false); - bStepping = false; - SetRun(false); - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - JumpToNextStep(0); - break; - //After waypoint 9 - case 27: - me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[0]); - if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) - { - pCityman->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - pCityman->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pCityman->GetMotionMaster()->MovePoint(0, 2088.625f,1279.191f,140.743f); - } - JumpToNextStep(2000); - break; - case 28: - if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) - DoScriptText(SAY_PHASE202, pCityman); - JumpToNextStep(4000); - break; - case 29: - SetEscortPaused(false); - bStepping = false; - DoScriptText(SAY_PHASE203, me); - JumpToNextStep(0); - break; - //After waypoint 10 - case 30: - me->HandleEmoteCommand(37); - JumpToNextStep(1000); - break; - case 31: - SetEscortPaused(false); - bStepping = false; - if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) - { - DoScriptText(SAY_PHASE204, pCityman1); - pCityman1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - if (Creature* pCityman0 = Unit::GetCreature(*me, uiCitymenGUID[0])) - pCityman0->Kill(pCityman0); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[1]); - } - JumpToNextStep(0); - break; - //After waypoint 11 - case 32: - me->HandleEmoteCommand(37); - JumpToNextStep(1000); - break; - case 33: - if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) - pCityman1->Kill(pCityman1); - JumpToNextStep(1000); - break; - case 34: - if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) - { - uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); - } - DoScriptText(SAY_PHASE205, me); - JumpToNextStep(3000); - break; - case 35: - if (Unit* pStalkerM = me->SummonCreature(NPC_INVIS_TARGET,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) - { - uiStalkerGUID = pStalkerM->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); - } - JumpToNextStep(1000); - break; - case 36: - if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) - { - if (Creature* pStalkerM = Unit::GetCreature(*me, uiStalkerGUID)) - pMalganis->CastSpell(pStalkerM,63793,false); + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After Gossip 1 (waypoint 8) + case 24: + if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2026.469f,1287.088f,143.596f,1.37f,TEMPSUMMON_TIMED_DESPAWN,14000)) + { + uiStalkerGUID = pStalker->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + JumpToNextStep(1000); + break; + case 25: + DoScriptText(SAY_PHASE201, me); + JumpToNextStep(12000); + break; + case 26: + SetEscortPaused(false); + bStepping = false; + SetRun(false); + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + JumpToNextStep(0); + break; + //After waypoint 9 + case 27: + me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[0]); + if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) + { + pCityman->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pCityman->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pCityman->GetMotionMaster()->MovePoint(0, 2088.625f,1279.191f,140.743f); + } + JumpToNextStep(2000); + break; + case 28: + if (Creature* pCityman = Unit::GetCreature(*me, uiCitymenGUID[0])) + DoScriptText(SAY_PHASE202, pCityman); + JumpToNextStep(4000); + break; + case 29: + SetEscortPaused(false); + bStepping = false; + DoScriptText(SAY_PHASE203, me); + JumpToNextStep(0); + break; + //After waypoint 10 + case 30: + me->HandleEmoteCommand(37); + JumpToNextStep(1000); + break; + case 31: + SetEscortPaused(false); + bStepping = false; + if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) + { + DoScriptText(SAY_PHASE204, pCityman1); + pCityman1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + if (Creature* pCityman0 = Unit::GetCreature(*me, uiCitymenGUID[0])) + pCityman0->Kill(pCityman0); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiCitymenGUID[1]); + } + JumpToNextStep(0); + break; + //After waypoint 11 + case 32: + me->HandleEmoteCommand(37); + JumpToNextStep(1000); + break; + case 33: + if (Creature* pCityman1 = Unit::GetCreature(*me, uiCitymenGUID[1])) + pCityman1->Kill(pCityman1); + JumpToNextStep(1000); + break; + case 34: + if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) + { + uiStalkerGUID = pStalker->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + DoScriptText(SAY_PHASE205, me); + JumpToNextStep(3000); + break; + case 35: + if (Unit* pStalkerM = me->SummonCreature(NPC_INVIS_TARGET,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) + { + uiStalkerGUID = pStalkerM->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + JumpToNextStep(1000); + break; + case 36: + if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS,2117.349f,1288.624f,136.271f,1.37f,TEMPSUMMON_TIMED_DESPAWN,60000)) + { + if (Creature* pStalkerM = Unit::GetCreature(*me, uiStalkerGUID)) + pMalganis->CastSpell(pStalkerM,63793,false); - uiMalganisGUID = pMalganis->GetGUID(); - DoScriptText(SAY_PHASE206, pMalganis); - pMalganis->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - pMalganis->SetReactState(REACT_PASSIVE); - } - JumpToNextStep(11000); - break; - case 37: - if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) - { - if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f)) - pZombie->UpdateEntry(NPC_ZOMBIE, 0); - else if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f)) - pZombie->UpdateEntry(NPC_ZOMBIE, 0); - else //There's no one else to transform + uiMalganisGUID = pMalganis->GetGUID(); + DoScriptText(SAY_PHASE206, pMalganis); + pMalganis->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + pMalganis->SetReactState(REACT_PASSIVE); + } + JumpToNextStep(11000); + break; + case 37: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + { + if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN, 100.0f)) + pZombie->UpdateEntry(NPC_ZOMBIE, 0); + else if (Creature* pZombie = GetClosestCreatureWithEntry(pMalganis, NPC_CITY_MAN2, 100.0f)) + pZombie->UpdateEntry(NPC_ZOMBIE, 0); + else //There's no one else to transform + uiStep++; + } + else uiStep++; - } - else - uiStep++; - uiPhaseTimer = 500; - break; - case 38: - if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) - DoScriptText(SAY_PHASE207, pMalganis); - JumpToNextStep(17000); - break; - case 39: - if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) - pMalganis->SetVisibility(VISIBILITY_OFF); - DoScriptText(SAY_PHASE208, me); - JumpToNextStep(7000); - break; - case 40: - if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) - { - uiStalkerGUID = pStalker->GetGUID(); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); - } - DoScriptText(SAY_PHASE209, me); + uiPhaseTimer = 500; + break; + case 38: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + DoScriptText(SAY_PHASE207, pMalganis); + JumpToNextStep(17000); + break; + case 39: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + pMalganis->SetVisibility(VISIBILITY_OFF); + DoScriptText(SAY_PHASE208, me); + JumpToNextStep(7000); + break; + case 40: + if (Unit* pStalker = me->SummonCreature(NPC_INVIS_TARGET,2081.447f,1287.770f,141.3241f,1.37f,TEMPSUMMON_TIMED_DESPAWN,10000)) + { + uiStalkerGUID = pStalker->GetGUID(); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiStalkerGUID); + } + DoScriptText(SAY_PHASE209, me); - uiBossEvent = DATA_MEATHOOK_EVENT; - if (pInstance) - pInstance->SetData(DATA_ARTHAS_EVENT, IN_PROGRESS); + uiBossEvent = DATA_MEATHOOK_EVENT; + if (pInstance) + pInstance->SetData(DATA_ARTHAS_EVENT, IN_PROGRESS); - me->SetReactState(REACT_DEFENSIVE); - SetDespawnAtFar(false); - JumpToNextStep(5000); - break; - case 41: //Summon wave group - case 43: - case 45: - case 47: - case 51: - case 53: - case 55: - case 57: - if (pInstance->GetData(uiBossEvent) != DONE) - { - SpawnWaveGroup(uiWave, uiWaveGUID); - uiWave++; - } - JumpToNextStep(500); - break; - case 42: //Wait group to die - case 44: - case 46: - case 48: - case 52: - case 54: - case 56: - case 58: - if (pInstance->GetData(uiBossEvent) != DONE) - { - uint32 mobCounter = 0; - uint32 deadCounter = 0; - for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + me->SetReactState(REACT_DEFENSIVE); + SetDespawnAtFar(false); + JumpToNextStep(5000); + break; + case 41: //Summon wave group + case 43: + case 45: + case 47: + case 51: + case 53: + case 55: + case 57: + if (pInstance->GetData(uiBossEvent) != DONE) { - if (uiWaveGUID[i] == 0) - break; - ++mobCounter; - Unit* pTemp = Unit::GetCreature(*me, uiWaveGUID[i]); - if (!pTemp || pTemp->isDead()) - ++deadCounter; + SpawnWaveGroup(uiWave, uiWaveGUID); + uiWave++; } - - if (mobCounter <= deadCounter) //If group is dead - JumpToNextStep(1000); - else - uiPhaseTimer = 1000; - } - else JumpToNextStep(500); - break; - case 49: //Summon Boss - case 59: - if (pInstance->GetData(uiBossEvent) != DONE) - { - uint32 uiBossID = 0; - if (uiBossEvent == DATA_MEATHOOK_EVENT) - uiBossID = NPC_MEATHOOK; - else if (uiBossEvent == DATA_SALRAMM_EVENT) - uiBossID = NPC_SALRAMM; - - if (Unit* pBoss = me->SummonCreature(uiBossID,2232.19f,1331.933f,126.662f,3.15f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + break; + case 42: //Wait group to die + case 44: + case 46: + case 48: + case 52: + case 54: + case 56: + case 58: + if (pInstance->GetData(uiBossEvent) != DONE) { - uiBossGUID = pBoss->GetGUID(); - pBoss->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - pBoss->GetMotionMaster()->MovePoint(0, 2194.110f,1332.00f,130.00f); + uint32 mobCounter = 0; + uint32 deadCounter = 0; + for (uint8 i = 0; i < ENCOUNTER_WAVES_MAX_SPAWNS; ++i) + { + if (uiWaveGUID[i] == 0) + break; + ++mobCounter; + Unit* pTemp = Unit::GetCreature(*me, uiWaveGUID[i]); + if (!pTemp || pTemp->isDead()) + ++deadCounter; + } + + if (mobCounter <= deadCounter) //If group is dead + JumpToNextStep(1000); + else + uiPhaseTimer = 1000; } - } - JumpToNextStep(30000); - break; - case 50: //Wait Boss death - case 60: - if (pInstance) - { - if (pInstance->GetData(uiBossEvent) == DONE) + else + JumpToNextStep(500); + break; + case 49: //Summon Boss + case 59: + if (pInstance->GetData(uiBossEvent) != DONE) { - JumpToNextStep(1000); + uint32 uiBossID = 0; if (uiBossEvent == DATA_MEATHOOK_EVENT) - uiBossEvent = DATA_SALRAMM_EVENT; + uiBossID = NPC_MEATHOOK; else if (uiBossEvent == DATA_SALRAMM_EVENT) + uiBossID = NPC_SALRAMM; + + if (Unit* pBoss = me->SummonCreature(uiBossID,2232.19f,1331.933f,126.662f,3.15f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) { - SetHoldState(false); - bStepping = false; - uiBossEvent = DATA_EPOCH_EVENT; + uiBossGUID = pBoss->GetGUID(); + pBoss->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pBoss->GetMotionMaster()->MovePoint(0, 2194.110f,1332.00f,130.00f); } } - else if (pInstance->GetData(uiBossEvent) == FAIL) - npc_escortAI::EnterEvadeMode(); - else - uiPhaseTimer = 10000; - } - break; - //After Gossip 2 (waypoint 22) - case 61: - me->SetReactState(REACT_AGGRESSIVE); - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) - pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) - pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - JumpToNextStep(1000); - break; - case 62: - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - DoScriptText(SAY_PHASE302, pDisguised0); - JumpToNextStep(7000); - break; - case 63: - DoScriptText(SAY_PHASE303, me); - SetHoldState(false); - bStepping = false; - JumpToNextStep(0); - break; - //After waypoint 23 - case 64: - me->HandleEmoteCommand(54); - JumpToNextStep(1000); - break; - case 65: - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - pDisguised0->HandleEmoteCommand(11); - JumpToNextStep(1000); - break; - case 66: - DoScriptText(SAY_PHASE304,me); - JumpToNextStep(2000); - break; - case 67: - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - DoScriptText(SAY_PHASE305,pDisguised0); - JumpToNextStep(1000); - break; - case 68: - if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) - { - pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0); - //Make them unattackable - pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pDisguised2->SetReactState(REACT_PASSIVE); - } - JumpToNextStep(2000); - break; - case 69: - if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) - { - pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0); - //Make them unattackable - pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pDisguised1->SetReactState(REACT_PASSIVE); - } - JumpToNextStep(2000); - break; - case 70: - if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) - { - pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0); - //Make them unattackable - pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pDisguised0->SetReactState(REACT_PASSIVE); - } - JumpToNextStep(2000); - break; - case 71: - //After waypoint 26,29,31 - case 73: - case 75: - case 77: - //Make cratures attackable - for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i) - if (Creature* pTemp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i])) + JumpToNextStep(30000); + break; + case 50: //Wait Boss death + case 60: + if (pInstance) { - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pTemp->SetReactState(REACT_AGGRESSIVE); + if (pInstance->GetData(uiBossEvent) == DONE) + { + JumpToNextStep(1000); + if (uiBossEvent == DATA_MEATHOOK_EVENT) + uiBossEvent = DATA_SALRAMM_EVENT; + else if (uiBossEvent == DATA_SALRAMM_EVENT) + { + SetHoldState(false); + bStepping = false; + uiBossEvent = DATA_EPOCH_EVENT; + } + } + else if (pInstance->GetData(uiBossEvent) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; } - JumpToNextStep(5000); - break; - case 72: - case 74: - case 76: - if (me->isInCombat()) - uiPhaseTimer = 1000; - else - { - if (uiStep == 72) DoScriptText(SAY_PHASE308,me); - if (uiStep == 74) DoScriptText(SAY_PHASE308,me); - if (uiStep == 76) DoScriptText(SAY_PHASE310,me); + break; + //After Gossip 2 (waypoint 22) + case 61: + me->SetReactState(REACT_AGGRESSIVE); + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + pDisguised0->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) + pDisguised1->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) + pDisguised2->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + JumpToNextStep(1000); + break; + case 62: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + DoScriptText(SAY_PHASE302, pDisguised0); + JumpToNextStep(7000); + break; + case 63: + DoScriptText(SAY_PHASE303, me); SetHoldState(false); bStepping = false; - SetRun(true); + JumpToNextStep(0); + break; + //After waypoint 23 + case 64: + me->HandleEmoteCommand(54); + JumpToNextStep(1000); + break; + case 65: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + pDisguised0->HandleEmoteCommand(11); + JumpToNextStep(1000); + break; + case 66: + DoScriptText(SAY_PHASE304,me); JumpToNextStep(2000); - } - break; - case 78: - if (me->isInCombat()) - uiPhaseTimer = 1000; - else - { - DoScriptText(SAY_PHASE312,me); - JumpToNextStep(5000); - } - break; - case 79: - DoScriptText(SAY_PHASE313,me); - JumpToNextStep(1000); - break; - case 80: - if (pInstance) - if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + break; + case 67: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) + DoScriptText(SAY_PHASE305,pDisguised0); + JumpToNextStep(1000); + break; + case 68: + if (Creature* pDisguised2 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[2])) { - SpawnTimeRift(17,&uiEpochGUID); - if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) - DoScriptText(SAY_PHASE314,pEpoch); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiEpochGUID); + pDisguised2->UpdateEntry(NPC_INFINITE_HUNTER, 0); + //Make them unattackable + pDisguised2->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised2->SetReactState(REACT_PASSIVE); } - JumpToNextStep(18000); - break; - case 81: - if (pInstance) - if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) - DoScriptText(SAY_PHASE315, me); - JumpToNextStep(6000); - break; - case 82: - if (pInstance) - if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + JumpToNextStep(2000); + break; + case 69: + if (Creature* pDisguised1 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[1])) { - if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) - { - //Make Epoch attackable - pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); - pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pEpoch->SetReactState(REACT_AGGRESSIVE); - } - + pDisguised1->UpdateEntry(NPC_INFINITE_AGENT, 0); + //Make them unattackable + pDisguised1->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised1->SetReactState(REACT_PASSIVE); } - JumpToNextStep(1000); - break; - case 83: - if (pInstance) - { - if (pInstance->GetData(DATA_EPOCH_EVENT) == DONE) + JumpToNextStep(2000); + break; + case 70: + if (Creature* pDisguised0 = Unit::GetCreature(*me, uiInfiniteDraconianGUID[0])) { - uiGossipStep = 3; - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - bStepping = false; - uiBossEvent = DATA_MAL_GANIS_EVENT; - JumpToNextStep(15000); + pDisguised0->UpdateEntry(NPC_INFINITE_ADVERSARY, 0); + //Make them unattackable + pDisguised0->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pDisguised0->SetReactState(REACT_PASSIVE); } - else if (pInstance->GetData(DATA_EPOCH_EVENT) == FAIL) - npc_escortAI::EnterEvadeMode(); + JumpToNextStep(2000); + break; + case 71: + //After waypoint 26,29,31 + case 73: + case 75: + case 77: + //Make cratures attackable + for (uint32 i = 0; i< ENCOUNTER_DRACONIAN_NUMBER; ++i) + if (Creature* pTemp = Unit::GetCreature(*me, uiInfiniteDraconianGUID[i])) + { + pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pTemp->SetReactState(REACT_AGGRESSIVE); + } + JumpToNextStep(5000); + break; + case 72: + case 74: + case 76: + if (me->isInCombat()) + uiPhaseTimer = 1000; else - uiPhaseTimer = 10000; - } - break; - //After Gossip 4 - case 84: - DoScriptText(SAY_PHASE404,me); - SetHoldState(false); - bStepping = false; - break; - //After Gossip 5 - case 85: - DoScriptText(SAY_PHASE501, me); - if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS,2296.665f,1502.362f,128.362f,4.961f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) - { - uiMalganisGUID = pMalganis->GetGUID(); - pMalganis->SetReactState(REACT_PASSIVE); - } - if (pInstance) - { - GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAL_GANIS_GATE_1)); - pGate->SetGoState(GO_STATE_ACTIVE); - } - SetHoldState(false); - bStepping = false; - JumpToNextStep(0); - break; - //After waypoint 55 - case 86: - DoScriptText(SAY_PHASE502, me); - JumpToNextStep(6000); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); - break; - case 87: - if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) - { - pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_6 | UNIT_FLAG_UNK_9 | UNIT_FLAG_UNK_15); - pMalganis->SetReactState(REACT_AGGRESSIVE); - } - JumpToNextStep(1000); - break; - case 88: - if (pInstance) - { - if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == DONE) { + if (uiStep == 72) DoScriptText(SAY_PHASE308,me); + if (uiStep == 74) DoScriptText(SAY_PHASE308,me); + if (uiStep == 76) DoScriptText(SAY_PHASE310,me); SetHoldState(false); - JumpToNextStep(1000); + bStepping = false; + SetRun(true); + JumpToNextStep(2000); } - else if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == FAIL) - npc_escortAI::EnterEvadeMode(); + break; + case 78: + if (me->isInCombat()) + uiPhaseTimer = 1000; else - uiPhaseTimer = 10000; - } - break; - //After waypoint 56 - case 89: - SetRun(true); - me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); - DoScriptText(SAY_PHASE503, me); - JumpToNextStep(7000); - break; - case 90: - if (pInstance) - { - pInstance->SetData(DATA_ARTHAS_EVENT, DONE); //Rewards: Achiev & Chest ;D - me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind - } - DoScriptText(SAY_PHASE504, me); - bStepping = false; - break; - } - } else uiPhaseTimer -= diff; - } - - //Battling skills - if (!me->getVictim()) - return; - - if (uiExorcismTimer < diff) - { - if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(target, SPELL_EXORCISM_N); - uiExorcismTimer = 7300; - } else uiExorcismTimer -= diff; - - if (HealthBelowPct(40)) - DoCast(me, SPELL_HOLY_LIGHT); - } -}; + { + DoScriptText(SAY_PHASE312,me); + JumpToNextStep(5000); + } + break; + case 79: + DoScriptText(SAY_PHASE313,me); + JumpToNextStep(1000); + break; + case 80: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + { + SpawnTimeRift(17,&uiEpochGUID); + if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) + DoScriptText(SAY_PHASE314,pEpoch); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiEpochGUID); + } + JumpToNextStep(18000); + break; + case 81: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + DoScriptText(SAY_PHASE315, me); + JumpToNextStep(6000); + break; + case 82: + if (pInstance) + if (pInstance->GetData(DATA_EPOCH_EVENT) != DONE) + { + if (Creature* pEpoch = Unit::GetCreature(*me, uiEpochGUID)) + { + //Make Epoch attackable + pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_9); + pEpoch->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pEpoch->SetReactState(REACT_AGGRESSIVE); + } -CreatureAI* GetAI_npc_arthas(Creature* pCreature) -{ - return new npc_arthasAI(pCreature); -} + } + JumpToNextStep(1000); + break; + case 83: + if (pInstance) + { + if (pInstance->GetData(DATA_EPOCH_EVENT) == DONE) + { + uiGossipStep = 3; + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + bStepping = false; + uiBossEvent = DATA_MAL_GANIS_EVENT; + JumpToNextStep(15000); + } + else if (pInstance->GetData(DATA_EPOCH_EVENT) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; + } + break; + //After Gossip 4 + case 84: + DoScriptText(SAY_PHASE404,me); + SetHoldState(false); + bStepping = false; + break; + //After Gossip 5 + case 85: + DoScriptText(SAY_PHASE501, me); + if (Creature* pMalganis = me->SummonCreature(NPC_MAL_GANIS,2296.665f,1502.362f,128.362f,4.961f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,900000)) + { + uiMalganisGUID = pMalganis->GetGUID(); + pMalganis->SetReactState(REACT_PASSIVE); + } + if (pInstance) + { + GameObject* pGate = pInstance->instance->GetGameObject(pInstance->GetData64(DATA_MAL_GANIS_GATE_1)); + pGate->SetGoState(GO_STATE_ACTIVE); + } + SetHoldState(false); + bStepping = false; + JumpToNextStep(0); + break; + //After waypoint 55 + case 86: + DoScriptText(SAY_PHASE502, me); + JumpToNextStep(6000); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); + break; + case 87: + if (Creature* pMalganis = Unit::GetCreature(*me, uiMalganisGUID)) + { + pMalganis->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_UNK_6 | UNIT_FLAG_UNK_9 | UNIT_FLAG_UNK_15); + pMalganis->SetReactState(REACT_AGGRESSIVE); + } + JumpToNextStep(1000); + break; + case 88: + if (pInstance) + { + if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == DONE) + { + SetHoldState(false); + JumpToNextStep(1000); + } + else if (pInstance->GetData(DATA_MAL_GANIS_EVENT) == FAIL) + npc_escortAI::EnterEvadeMode(); + else + uiPhaseTimer = 10000; + } + break; + //After waypoint 56 + case 89: + SetRun(true); + me->SetUInt64Value(UNIT_FIELD_TARGET, uiMalganisGUID); + DoScriptText(SAY_PHASE503, me); + JumpToNextStep(7000); + break; + case 90: + if (pInstance) + { + pInstance->SetData(DATA_ARTHAS_EVENT, DONE); //Rewards: Achiev & Chest ;D + me->SetUInt64Value(UNIT_FIELD_TARGET, pInstance->GetData64(DATA_MAL_GANIS_GATE_2)); //Look behind + } + DoScriptText(SAY_PHASE504, me); + bStepping = false; + break; + } + } else uiPhaseTimer -= diff; + } -#define GOSSIP_ITEM_ARTHAS_0 "I'm ready to start Culling of Stratholme." -#define GOSSIP_ITEM_ARTHAS_1 "Yes, my Prince. We're ready." -#define GOSSIP_ITEM_ARTHAS_2 "We're only doing what is best for Loarderon your Highness." -#define GOSSIP_ITEM_ARTHAS_3 "I'm ready." -#define GOSSIP_ITEM_ARTHAS_4 "For Lordaeron!" -#define GOSSIP_ITEM_ARTHAS_5 "I'm ready to battle the dreadlord, sire." + //Battling skills + if (!me->getVictim()) + return; -bool GossipHello_npc_arthas(Player* pPlayer, Creature* pCreature) -{ - npc_arthasAI* pAI = CAST_AI(npc_arthasAI,pCreature->AI()); + if (uiExorcismTimer < diff) + { + if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(target, SPELL_EXORCISM_N); + uiExorcismTimer = 7300; + } else uiExorcismTimer -= diff; - if (pAI && pAI->bStepping == false) - { - switch (pAI->uiGossipStep) - { - case 0: //This one is a workaround since the very beggining of the script is wrong. - if (pPlayer->GetQuestStatus(13149) != QUEST_STATUS_COMPLETE) - return false; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_0, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(907, pCreature->GetGUID()); - break; - case 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_1, pCreature->GetGUID()); - break; - case 2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_2, pCreature->GetGUID()); - break; - case 3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_3, pCreature->GetGUID()); - break; - case 4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_4, pCreature->GetGUID()); - break; - case 5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_ARTHAS_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_MENU_ARTHAS_5, pCreature->GetGUID()); - break; - default: - return false; + if (HealthBelowPct(40)) + DoCast(me, SPELL_HOLY_LIGHT); } - } - return true; -} - - -bool GossipSelect_npc_arthas(Player *pPlayer, Creature *pCreature, uint32 /*sender*/, uint32 action) -{ - npc_arthasAI* pAI = CAST_AI(npc_arthasAI,pCreature->AI()); + }; - if (!pAI) - return false; - - switch (action) - { - case GOSSIP_ACTION_INFO_DEF: - pAI->Start(true,true,pPlayer->GetGUID(),0,false,false); - pAI->SetDespawnAtEnd(false); - pAI->bStepping = false; - pAI->uiStep = 1; - break; - case GOSSIP_ACTION_INFO_DEF+1: - pAI->bStepping = true; - pAI->uiStep = 24; - break; - case GOSSIP_ACTION_INFO_DEF+2: - pAI->SetHoldState(false); - pAI->bStepping = false; - pAI->uiStep = 61; - break; - case GOSSIP_ACTION_INFO_DEF+3: - pAI->SetHoldState(false); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pAI->bStepping = true; - pAI->uiStep = 84; - break; - case GOSSIP_ACTION_INFO_DEF+5: - pAI->bStepping = true; - pAI->uiStep = 85; - break; - } - pPlayer->CLOSE_GOSSIP_MENU(); - pAI->SetDespawnAtFar(true); - pCreature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - return true; -} +}; void AddSC_culling_of_stratholme() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_arthas"; - newscript->GetAI = &GetAI_npc_arthas; - newscript->pGossipHello = &GossipHello_npc_arthas; - newscript->pGossipSelect = &GossipSelect_npc_arthas; - newscript->RegisterSelf(); + new npc_arthas(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index a64a0a03976..b325c0175c1 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -27,217 +27,220 @@ 3 - Mal'Ganis 4 - Infinite Corruptor (Heroic only) */ - -struct instance_culling_of_stratholme : public ScriptedInstance +
class instance_culling_of_stratholme : public InstanceMapScript { - instance_culling_of_stratholme(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_culling_of_stratholme() : InstanceMapScript("instance_culling_of_stratholme") { } - uint64 uiArthas; - uint64 uiMeathook; - uint64 uiSalramm; - uint64 uiEpoch; - uint64 uiMalGanis; - uint64 uiInfinite; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_culling_of_stratholme_InstanceMapScript(pMap); + } - uint64 uiShkafGate; - uint64 uiMalGanisGate1; - uint64 uiMalGanisGate2; - uint64 uiExitGate; - uint64 uiMalGanisChest; + struct instance_culling_of_stratholme_InstanceMapScript : public InstanceScript + { + instance_culling_of_stratholme_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; + uint64 uiArthas; + uint64 uiMeathook; + uint64 uiSalramm; + uint64 uiEpoch; + uint64 uiMalGanis; + uint64 uiInfinite; - bool IsEncounterInProgress() const - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + uint64 uiShkafGate; + uint64 uiMalGanisGate1; + uint64 uiMalGanisGate2; + uint64 uiExitGate; + uint64 uiMalGanisChest; - return false; - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + bool IsEncounterInProgress() const { - case NPC_ARTHAS: - uiArthas = pCreature->GetGUID(); - break; - case NPC_MEATHOOK: - uiMeathook = pCreature->GetGUID(); - break; - case NPC_SALRAMM: - uiSalramm = pCreature->GetGUID(); - break; - case NPC_EPOCH: - uiEpoch = pCreature->GetGUID(); - break; - case NPC_MAL_GANIS: - uiMalGanis = pCreature->GetGUID(); - break; - case NPC_INFINITE: - uiInfinite = pCreature->GetGUID(); - break; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; + + return false; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*add*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_SHKAF_GATE: - uiShkafGate = pGo->GetGUID(); - break; - case GO_MALGANIS_GATE_1: - uiMalGanisGate1 = pGo->GetGUID(); - break; - case GO_MALGANIS_GATE_2: - uiMalGanisGate2 = pGo->GetGUID(); - break; - case GO_EXIT_GATE: - uiExitGate = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - HandleGameObject(uiExitGate,true); - break; - case GO_MALGANIS_CHEST_N: - case GO_MALGANIS_CHEST_H: - uiMalGanisChest = pGo->GetGUID(); - if (m_auiEncounter[3] == DONE) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - break; + switch(pCreature->GetEntry()) + { + case NPC_ARTHAS: + uiArthas = pCreature->GetGUID(); + break; + case NPC_MEATHOOK: + uiMeathook = pCreature->GetGUID(); + break; + case NPC_SALRAMM: + uiSalramm = pCreature->GetGUID(); + break; + case NPC_EPOCH: + uiEpoch = pCreature->GetGUID(); + break; + case NPC_MAL_GANIS: + uiMalGanis = pCreature->GetGUID(); + break; + case NPC_INFINITE: + uiInfinite = pCreature->GetGUID(); + break; + } } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*add*/) { - case DATA_MEATHOOK_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_SALRAMM_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_EPOCH_EVENT: - m_auiEncounter[2] = data; - break; - case DATA_MAL_GANIS_EVENT: - m_auiEncounter[3] = data; - - switch(m_auiEncounter[3]) - { - case NOT_STARTED: - HandleGameObject(uiMalGanisGate2,true); - break; - case IN_PROGRESS: - HandleGameObject(uiMalGanisGate2,false); - break; - case DONE: - HandleGameObject(uiExitGate, true); - if (GameObject *pGo = instance->GetGameObject(uiMalGanisChest)) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); - break; - } - break; - case DATA_INFINITE_EVENT: - m_auiEncounter[4] = data; - break; + switch(pGo->GetEntry()) + { + case GO_SHKAF_GATE: + uiShkafGate = pGo->GetGUID(); + break; + case GO_MALGANIS_GATE_1: + uiMalGanisGate1 = pGo->GetGUID(); + break; + case GO_MALGANIS_GATE_2: + uiMalGanisGate2 = pGo->GetGUID(); + break; + case GO_EXIT_GATE: + uiExitGate = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + HandleGameObject(uiExitGate,true); + break; + case GO_MALGANIS_CHEST_N: + case GO_MALGANIS_CHEST_H: + uiMalGanisChest = pGo->GetGUID(); + if (m_auiEncounter[3] == DONE) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + break; + } } - if (data == DONE) - SaveToDB(); - } + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_MEATHOOK_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_SALRAMM_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_EPOCH_EVENT: + m_auiEncounter[2] = data; + break; + case DATA_MAL_GANIS_EVENT: + m_auiEncounter[3] = data; + + switch(m_auiEncounter[3]) + { + case NOT_STARTED: + HandleGameObject(uiMalGanisGate2,true); + break; + case IN_PROGRESS: + HandleGameObject(uiMalGanisGate2,false); + break; + case DONE: + HandleGameObject(uiExitGate, true); + if (GameObject *pGo = instance->GetGameObject(uiMalGanisChest)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_INTERACT_COND); + break; + } + break; + case DATA_INFINITE_EVENT: + m_auiEncounter[4] = data; + break; + } + + if (data == DONE) + SaveToDB(); + } - uint32 GetData(uint32 type) - { - switch(type) + uint32 GetData(uint32 type) { - case DATA_MEATHOOK_EVENT: return m_auiEncounter[0]; - case DATA_SALRAMM_EVENT: return m_auiEncounter[1]; - case DATA_EPOCH_EVENT: return m_auiEncounter[2]; - case DATA_MAL_GANIS_EVENT: return m_auiEncounter[3]; - case DATA_INFINITE_EVENT: return m_auiEncounter[4]; + switch(type) + { + case DATA_MEATHOOK_EVENT: return m_auiEncounter[0]; + case DATA_SALRAMM_EVENT: return m_auiEncounter[1]; + case DATA_EPOCH_EVENT: return m_auiEncounter[2]; + case DATA_MAL_GANIS_EVENT: return m_auiEncounter[3]; + case DATA_INFINITE_EVENT: return m_auiEncounter[4]; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 identifier) - { - switch(identifier) + uint64 GetData64(uint32 identifier) { - case DATA_ARTHAS: return uiArthas; - case DATA_MEATHOOK: return uiMeathook; - case DATA_SALRAMM: return uiSalramm; - case DATA_EPOCH: return uiEpoch; - case DATA_MAL_GANIS: return uiMalGanis; - case DATA_INFINITE: return uiInfinite; - case DATA_SHKAF_GATE: return uiShkafGate; - case DATA_MAL_GANIS_GATE_1: return uiMalGanisGate1; - case DATA_MAL_GANIS_GATE_2: return uiMalGanisGate2; - case DATA_EXIT_GATE: return uiExitGate; - case DATA_MAL_GANIS_CHEST: return uiMalGanisChest; + switch(identifier) + { + case DATA_ARTHAS: return uiArthas; + case DATA_MEATHOOK: return uiMeathook; + case DATA_SALRAMM: return uiSalramm; + case DATA_EPOCH: return uiEpoch; + case DATA_MAL_GANIS: return uiMalGanis; + case DATA_INFINITE: return uiInfinite; + case DATA_SHKAF_GATE: return uiShkafGate; + case DATA_MAL_GANIS_GATE_1: return uiMalGanisGate1; + case DATA_MAL_GANIS_GATE_2: return uiMalGanisGate2; + case DATA_EXIT_GATE: return uiExitGate; + case DATA_MAL_GANIS_CHEST: return uiMalGanisChest; + } + return 0; } - return 0; - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "C S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; + std::ostringstream saveStream; + saveStream << "C S " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4]; - str_data = saveStream.str(); + str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - void Load(const char* in) - { - if (!in) + void Load(const char* in) { - OUT_LOAD_INST_DATA_FAIL; - return; - } + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - OUT_LOAD_INST_DATA(in); + OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4; + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4; - if (dataHead1 == 'C' && dataHead2 == 'S') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; - m_auiEncounter[4] = data4; + if (dataHead1 == 'C' && dataHead2 == 'S') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + m_auiEncounter[4] = data4; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + } else OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; + } + }; - OUT_LOAD_INST_DATA_COMPLETE; - } }; -InstanceData* GetInstanceData_instance_culling_of_stratholme(Map* pMap) -{ - return new instance_culling_of_stratholme(pMap); -} void AddSC_instance_culling_of_stratholme() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_culling_of_stratholme"; - newscript->GetInstanceData = &GetInstanceData_instance_culling_of_stratholme; - newscript->RegisterSelf(); + new instance_culling_of_stratholme(); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp index e95c440a7aa..0ddd73e0a64 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp @@ -42,106 +42,108 @@ enum eEnums SPELL_SAND_BREATH = 31473, H_SPELL_SAND_BREATH = 39049 }; - -struct boss_aeonusAI : public ScriptedAI +
class boss_aeonus : public CreatureScript { - boss_aeonusAI(Creature *c) : ScriptedAI(c) +public: + boss_aeonus() : CreatureScript("boss_aeonus") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_aeonusAI (pCreature); } - ScriptedInstance *pInstance; + struct boss_aeonusAI : public ScriptedAI + { + boss_aeonusAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 SandBreath_Timer; - uint32 TimeStop_Timer; - uint32 Frenzy_Timer; + InstanceScript *pInstance; - void Reset() - { - SandBreath_Timer = 15000+rand()%15000; - TimeStop_Timer = 10000+rand()%5000; - Frenzy_Timer = 30000+rand()%15000; - } + uint32 SandBreath_Timer; + uint32 TimeStop_Timer; + uint32 Frenzy_Timer; - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } + void Reset() + { + SandBreath_Timer = 15000+rand()%15000; + TimeStop_Timer = 10000+rand()%5000; + Frenzy_Timer = 30000+rand()%15000; + } - void MoveInLineOfSight(Unit *who) - { - //Despawn Time Keeper - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } + + void MoveInLineOfSight(Unit *who) { - if (me->IsWithinDistInMap(who,20.0f)) + //Despawn Time Keeper + if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) { - DoScriptText(SAY_BANISH, me); - me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + if (me->IsWithinDistInMap(who,20.0f)) + { + DoScriptText(SAY_BANISH, me); + me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } } + + ScriptedAI::MoveInLineOfSight(who); } - ScriptedAI::MoveInLineOfSight(who); - } + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); + if (pInstance) + { + pInstance->SetData(TYPE_RIFT,DONE); + pInstance->SetData(TYPE_MEDIVH,DONE);//FIXME: later should be removed + } + } - if (pInstance) - { - pInstance->SetData(TYPE_RIFT,DONE); - pInstance->SetData(TYPE_MEDIVH,DONE);//FIXME: later should be removed - } - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + //Sand Breath + if (SandBreath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SAND_BREATH); + SandBreath_Timer = 15000+rand()%10000; + } else SandBreath_Timer -= diff; - //Sand Breath - if (SandBreath_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SAND_BREATH); - SandBreath_Timer = 15000+rand()%10000; - } else SandBreath_Timer -= diff; + //Time Stop + if (TimeStop_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TIME_STOP); + TimeStop_Timer = 20000+rand()%15000; + } else TimeStop_Timer -= diff; - //Time Stop - if (TimeStop_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_TIME_STOP); - TimeStop_Timer = 20000+rand()%15000; - } else TimeStop_Timer -= diff; + //Frenzy + if (Frenzy_Timer <= diff) + { + DoScriptText(EMOTE_FRENZY, me); + DoCast(me, SPELL_ENRAGE); + Frenzy_Timer = 20000+rand()%15000; + } else Frenzy_Timer -= diff; - //Frenzy - if (Frenzy_Timer <= diff) - { - DoScriptText(EMOTE_FRENZY, me); - DoCast(me, SPELL_ENRAGE); - Frenzy_Timer = 20000+rand()%15000; - } else Frenzy_Timer -= diff; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_aeonus(Creature* pCreature) -{ - return new boss_aeonusAI (pCreature); -} void AddSC_boss_aeonus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_aeonus"; - newscript->GetAI = &GetAI_boss_aeonus; - newscript->RegisterSelf(); + new boss_aeonus(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp index 4845a39f2fe..6187c773e76 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp @@ -42,115 +42,117 @@ enum eEnums SPELL_TIME_LAPSE = 31467, SPELL_ATTRACTION = 38540 //Not Implemented (Heroic mode) }; - -struct boss_chrono_lord_dejaAI : public ScriptedAI +
class boss_chrono_lord_deja : public CreatureScript { - boss_chrono_lord_dejaAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint32 ArcaneBlast_Timer; - uint32 TimeLapse_Timer; - uint32 Attraction_Timer; - uint32 ArcaneDischarge_Timer; - - void Reset() - { - ArcaneBlast_Timer = 18000+rand()%5000; - TimeLapse_Timer = 10000+rand()%5000; - ArcaneDischarge_Timer = 20000+rand()%10000; - Attraction_Timer = 25000+rand()%10000; - } +public: + boss_chrono_lord_deja() : CreatureScript("boss_chrono_lord_deja") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_AGGRO, me); + return new boss_chrono_lord_dejaAI (pCreature); } - void MoveInLineOfSight(Unit *who) + struct boss_chrono_lord_dejaAI : public ScriptedAI { - //Despawn Time Keeper - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + boss_chrono_lord_dejaAI(Creature *c) : ScriptedAI(c) { - if (me->IsWithinDistInMap(who,20.0f)) - { - DoScriptText(SAY_BANISH, me); - me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } + pInstance = c->GetInstanceScript(); } - ScriptedAI::MoveInLineOfSight(who); - } + InstanceScript *pInstance; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } - - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); + uint32 ArcaneBlast_Timer; + uint32 TimeLapse_Timer; + uint32 Attraction_Timer; + uint32 ArcaneDischarge_Timer; - if (pInstance) - pInstance->SetData(TYPE_RIFT,SPECIAL); - } + void Reset() + { + ArcaneBlast_Timer = 18000+rand()%5000; + TimeLapse_Timer = 10000+rand()%5000; + ArcaneDischarge_Timer = 20000+rand()%10000; + Attraction_Timer = 25000+rand()%10000; + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } - //Arcane Blast - if (ArcaneBlast_Timer <= diff) + void MoveInLineOfSight(Unit *who) { - DoCast(me->getVictim(), SPELL_ARCANE_BLAST); - ArcaneBlast_Timer = 15000+rand()%10000; - } else ArcaneBlast_Timer -= diff; + //Despawn Time Keeper + if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + { + if (me->IsWithinDistInMap(who,20.0f)) + { + DoScriptText(SAY_BANISH, me); + me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } + + ScriptedAI::MoveInLineOfSight(who); + } - //Arcane Discharge - if (ArcaneDischarge_Timer <= diff) + void KilledUnit(Unit * /*victim*/) { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - DoCast(pTarget, SPELL_ARCANE_DISCHARGE); - ArcaneDischarge_Timer = 20000+rand()%10000; - } else ArcaneDischarge_Timer -= diff; + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - //Time Lapse - if (TimeLapse_Timer <= diff) + void JustDied(Unit * /*victim*/) { - DoScriptText(SAY_BANISH, me); - DoCast(me, SPELL_TIME_LAPSE); - TimeLapse_Timer = 15000+rand()%10000; - } else TimeLapse_Timer -= diff; + DoScriptText(SAY_DEATH, me); - if (IsHeroic()) + if (pInstance) + pInstance->SetData(TYPE_RIFT,SPECIAL); + } + + void UpdateAI(const uint32 diff) { - if (Attraction_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //Arcane Blast + if (ArcaneBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_BLAST); + ArcaneBlast_Timer = 15000+rand()%10000; + } else ArcaneBlast_Timer -= diff; + + //Arcane Discharge + if (ArcaneDischarge_Timer <= diff) { - DoCast(me, SPELL_ATTRACTION); - Attraction_Timer = 25000+rand()%10000; - } else Attraction_Timer -= diff; + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); + DoCast(pTarget, SPELL_ARCANE_DISCHARGE); + ArcaneDischarge_Timer = 20000+rand()%10000; + } else ArcaneDischarge_Timer -= diff; + + //Time Lapse + if (TimeLapse_Timer <= diff) + { + DoScriptText(SAY_BANISH, me); + DoCast(me, SPELL_TIME_LAPSE); + TimeLapse_Timer = 15000+rand()%10000; + } else TimeLapse_Timer -= diff; + + if (IsHeroic()) + { + if (Attraction_Timer <= diff) + { + DoCast(me, SPELL_ATTRACTION); + Attraction_Timer = 25000+rand()%10000; + } else Attraction_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_chrono_lord_deja(Creature* pCreature) -{ - return new boss_chrono_lord_dejaAI (pCreature); -} void AddSC_boss_chrono_lord_deja() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_chrono_lord_deja"; - newscript->GetAI = &GetAI_boss_chrono_lord_deja; - newscript->RegisterSelf(); + new boss_chrono_lord_deja(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp index 61888422d60..d2102ea7d5a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp @@ -41,114 +41,116 @@ enum eEnums H_SPELL_WING_BUFFET = 38593, SPELL_REFLECT = 38592 //Not Implemented (Heroic mod) }; - -struct boss_temporusAI : public ScriptedAI +
class boss_temporus : public CreatureScript { - boss_temporusAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } +public: + boss_temporus() : CreatureScript("boss_temporus") { } - ScriptedInstance *pInstance; - - uint32 Haste_Timer; - uint32 SpellReflection_Timer; - uint32 MortalWound_Timer; - uint32 WingBuffet_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Haste_Timer = 15000+rand()%8000; - SpellReflection_Timer = 30000; - MortalWound_Timer = 8000; - WingBuffet_Timer = 25000+rand()%10000; + return new boss_temporusAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_temporusAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_temporusAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } + InstanceScript *pInstance; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); + uint32 Haste_Timer; + uint32 SpellReflection_Timer; + uint32 MortalWound_Timer; + uint32 WingBuffet_Timer; - if (pInstance) - pInstance->SetData(TYPE_RIFT,SPECIAL); - } + void Reset() + { + Haste_Timer = 15000+rand()%8000; + SpellReflection_Timer = 30000; + MortalWound_Timer = 8000; + WingBuffet_Timer = 25000+rand()%10000; + } - void MoveInLineOfSight(Unit *who) - { - //Despawn Time Keeper - if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + void EnterCombat(Unit * /*who*/) { - if (me->IsWithinDistInMap(who,20.0f)) - { - DoScriptText(SAY_BANISH, me); + DoScriptText(SAY_AGGRO, me); + } - me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - } + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); } - ScriptedAI::MoveInLineOfSight(who); - } + void JustDied(Unit * /*victim*/) + { + DoScriptText(SAY_DEATH, me); - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + if (pInstance) + pInstance->SetData(TYPE_RIFT,SPECIAL); + } - //Attack Haste - if (Haste_Timer <= diff) + void MoveInLineOfSight(Unit *who) { - DoCast(me, SPELL_HASTE); - Haste_Timer = 20000+rand()%5000; - } else Haste_Timer -= diff; + //Despawn Time Keeper + if (who->GetTypeId() == TYPEID_UNIT && who->GetEntry() == C_TIME_KEEPER) + { + if (me->IsWithinDistInMap(who,20.0f)) + { + DoScriptText(SAY_BANISH, me); - //MortalWound_Timer - if (MortalWound_Timer <= diff) - { - DoCast(me, SPELL_MORTAL_WOUND); - MortalWound_Timer = 10000+rand()%10000; - } else MortalWound_Timer -= diff; + me->DealDamage(who, who->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + } + } - //Wing ruffet - if (WingBuffet_Timer <= diff) - { - DoCast(me, SPELL_WING_BUFFET); - WingBuffet_Timer = 20000+rand()%10000; - } else WingBuffet_Timer -= diff; + ScriptedAI::MoveInLineOfSight(who); + } - if (IsHeroic()) + void UpdateAI(const uint32 diff) { - if (SpellReflection_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //Attack Haste + if (Haste_Timer <= diff) + { + DoCast(me, SPELL_HASTE); + Haste_Timer = 20000+rand()%5000; + } else Haste_Timer -= diff; + + //MortalWound_Timer + if (MortalWound_Timer <= diff) { - DoCast(me, SPELL_REFLECT); - SpellReflection_Timer = 25000+rand()%10000; - } else SpellReflection_Timer -= diff; + DoCast(me, SPELL_MORTAL_WOUND); + MortalWound_Timer = 10000+rand()%10000; + } else MortalWound_Timer -= diff; + + //Wing ruffet + if (WingBuffet_Timer <= diff) + { + DoCast(me, SPELL_WING_BUFFET); + WingBuffet_Timer = 20000+rand()%10000; + } else WingBuffet_Timer -= diff; + + if (IsHeroic()) + { + if (SpellReflection_Timer <= diff) + { + DoCast(me, SPELL_REFLECT); + SpellReflection_Timer = 25000+rand()%10000; + } else SpellReflection_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_temporus(Creature* pCreature) -{ - return new boss_temporusAI (pCreature); -} void AddSC_boss_temporus() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_temporus"; - newscript->GetAI = &GetAI_boss_temporus; - newscript->RegisterSelf(); + new boss_temporus(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp index d0387eb5a34..812846d692b 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -55,180 +55,187 @@ EndContentData */ #define SPELL_CORRUPT_AEONUS 37853 #define C_COUNCIL_ENFORCER 17023 - -struct npc_medivh_bmAI : public ScriptedAI +
class npc_medivh_bm : public CreatureScript { - npc_medivh_bmAI(Creature *c) : ScriptedAI(c) +public: + npc_medivh_bm() : CreatureScript("npc_medivh_bm") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_medivh_bmAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 SpellCorrupt_Timer; - uint32 Check_Timer; - - bool Life75; - bool Life50; - bool Life25; - - void Reset() + struct npc_medivh_bmAI : public ScriptedAI { - SpellCorrupt_Timer = 0; + npc_medivh_bmAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (!pInstance) - return; + InstanceScript *pInstance; - if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) - DoCast(me, SPELL_CHANNEL, true); - else if (me->HasAura(SPELL_CHANNEL)) - me->RemoveAura(SPELL_CHANNEL); + uint32 SpellCorrupt_Timer; + uint32 Check_Timer; - DoCast(me, SPELL_PORTAL_RUNE, true); - } + bool Life75; + bool Life50; + bool Life25; - void MoveInLineOfSight(Unit *who) - { - if (!pInstance) - return; - - if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f)) + void Reset() { - if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS || pInstance->GetData(TYPE_MEDIVH) == DONE) + SpellCorrupt_Timer = 0; + + if (!pInstance) return; - DoScriptText(SAY_INTRO, me); - pInstance->SetData(TYPE_MEDIVH,IN_PROGRESS); - DoCast(me, SPELL_CHANNEL, false); - Check_Timer = 5000; - } - else if (who->GetTypeId() == TYPEID_UNIT && me->IsWithinDistInMap(who, 15.0f)) + if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) + DoCast(me, SPELL_CHANNEL, true); + else if (me->HasAura(SPELL_CHANNEL)) + me->RemoveAura(SPELL_CHANNEL); + + DoCast(me, SPELL_PORTAL_RUNE, true); + } + + void MoveInLineOfSight(Unit *who) { - if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + if (!pInstance) return; - uint32 entry = who->GetEntry(); - if (entry == C_ASSAS || entry == C_WHELP || entry == C_CHRON || entry == C_EXECU || entry == C_VANQU) + if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 10.0f)) { - who->StopMoving(); - who->CastSpell(me,SPELL_CORRUPT,false); - } - else if (entry == C_AEONUS) + if (pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS || pInstance->GetData(TYPE_MEDIVH) == DONE) + return; + + DoScriptText(SAY_INTRO, me); + pInstance->SetData(TYPE_MEDIVH,IN_PROGRESS); + DoCast(me, SPELL_CHANNEL, false); + Check_Timer = 5000; + } + else if (who->GetTypeId() == TYPEID_UNIT && me->IsWithinDistInMap(who, 15.0f)) { - who->StopMoving(); - who->CastSpell(me,SPELL_CORRUPT_AEONUS,false); + if (pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + return; + + uint32 entry = who->GetEntry(); + if (entry == C_ASSAS || entry == C_WHELP || entry == C_CHRON || entry == C_EXECU || entry == C_VANQU) + { + who->StopMoving(); + who->CastSpell(me,SPELL_CORRUPT,false); + } + else if (entry == C_AEONUS) + { + who->StopMoving(); + who->CastSpell(me,SPELL_CORRUPT_AEONUS,false); + } } } - } - - void AttackStart(Unit * /*who*/) - { - //if (pInstance && pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) - //return; - - //ScriptedAI::AttackStart(who); - } - - void EnterCombat(Unit * /*who*/) {} - void SpellHit(Unit* /*caster*/, const SpellEntry* spell) - { - if (SpellCorrupt_Timer) - return; - - if (spell->Id == SPELL_CORRUPT_AEONUS) - SpellCorrupt_Timer = 1000; + void AttackStart(Unit * /*who*/) + { + //if (pInstance && pInstance->GetData(TYPE_MEDIVH) == IN_PROGRESS) + //return; - if (spell->Id == SPELL_CORRUPT) - SpellCorrupt_Timer = 3000; - } + //ScriptedAI::AttackStart(who); + } - void JustDied(Unit* Killer) - { - if (Killer->GetEntry() == me->GetEntry()) - return; + void EnterCombat(Unit * /*who*/) {} - DoScriptText(SAY_DEATH, me); - } + void SpellHit(Unit* /*caster*/, const SpellEntry* spell) + { + if (SpellCorrupt_Timer) + return; - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + if (spell->Id == SPELL_CORRUPT_AEONUS) + SpellCorrupt_Timer = 1000; - if (SpellCorrupt_Timer) - { - if (SpellCorrupt_Timer <= diff) - { - pInstance->SetData(TYPE_MEDIVH,SPECIAL); - - if (me->HasAura(SPELL_CORRUPT_AEONUS)) - SpellCorrupt_Timer = 1000; - else if (me->HasAura(SPELL_CORRUPT)) - SpellCorrupt_Timer = 3000; - else - SpellCorrupt_Timer = 0; - } else SpellCorrupt_Timer -= diff; + if (spell->Id == SPELL_CORRUPT) + SpellCorrupt_Timer = 3000; } - if (Check_Timer) + void JustDied(Unit* Killer) { - if (Check_Timer <= diff) - { - uint32 pct = pInstance->GetData(DATA_SHIELD); + if (Killer->GetEntry() == me->GetEntry()) + return; - Check_Timer = 5000; + DoScriptText(SAY_DEATH, me); + } - if (Life25 && pct <= 25) - { - DoScriptText(SAY_WEAK25, me); - Life25 = false; - } - else if (Life50 && pct <= 50) - { - DoScriptText(SAY_WEAK50, me); - Life50 = false; - } - else if (Life75 && pct <= 75) - { - DoScriptText(SAY_WEAK75, me); - Life75 = false; - } + void UpdateAI(const uint32 diff) + { + if (!pInstance) + return; - //if we reach this it means event was running but at some point reset. - if (pInstance->GetData(TYPE_MEDIVH) == NOT_STARTED) + if (SpellCorrupt_Timer) + { + if (SpellCorrupt_Timer <= diff) { - me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - me->RemoveCorpse(); - me->Respawn(); - return; - } + pInstance->SetData(TYPE_MEDIVH,SPECIAL); + + if (me->HasAura(SPELL_CORRUPT_AEONUS)) + SpellCorrupt_Timer = 1000; + else if (me->HasAura(SPELL_CORRUPT)) + SpellCorrupt_Timer = 3000; + else + SpellCorrupt_Timer = 0; + } else SpellCorrupt_Timer -= diff; + } - if (pInstance->GetData(TYPE_RIFT) == DONE) + if (Check_Timer) + { + if (Check_Timer <= diff) { - DoScriptText(SAY_WIN, me); - Check_Timer = 0; + uint32 pct = pInstance->GetData(DATA_SHIELD); + + Check_Timer = 5000; + + if (Life25 && pct <= 25) + { + DoScriptText(SAY_WEAK25, me); + Life25 = false; + } + else if (Life50 && pct <= 50) + { + DoScriptText(SAY_WEAK50, me); + Life50 = false; + } + else if (Life75 && pct <= 75) + { + DoScriptText(SAY_WEAK75, me); + Life75 = false; + } + + //if we reach this it means event was running but at some point reset. + if (pInstance->GetData(TYPE_MEDIVH) == NOT_STARTED) + { + me->DealDamage(me, me->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + me->RemoveCorpse(); + me->Respawn(); + return; + } + + if (pInstance->GetData(TYPE_RIFT) == DONE) + { + DoScriptText(SAY_WIN, me); + Check_Timer = 0; + + if (me->HasAura(SPELL_CHANNEL)) + me->RemoveAura(SPELL_CHANNEL); + + //TODO: start the post-event here + pInstance->SetData(TYPE_MEDIVH,DONE); + } + } else Check_Timer -= diff; + } - if (me->HasAura(SPELL_CHANNEL)) - me->RemoveAura(SPELL_CHANNEL); + //if (!UpdateVictim()) + //return; - //TODO: start the post-event here - pInstance->SetData(TYPE_MEDIVH,DONE); - } - } else Check_Timer -= diff; + //DoMeleeAttackIfReady(); } + }; - //if (!UpdateVictim()) - //return; - - //DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_medivh_bm(Creature* pCreature) -{ - return new npc_medivh_bmAI (pCreature); -} struct Wave { @@ -241,166 +248,165 @@ static Wave PortalWaves[]= {C_EXECU, C_CHRON, C_WHELP, C_ASSAS}, {C_EXECU, C_VANQU, C_CHRON, C_ASSAS} }; - -struct npc_time_riftAI : public ScriptedAI +
class npc_time_rift : public CreatureScript { - npc_time_riftAI(Creature *c) : ScriptedAI(c) +public: + npc_time_rift() : CreatureScript("npc_time_rift") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_time_riftAI (pCreature); } - ScriptedInstance *pInstance; + struct npc_time_riftAI : public ScriptedAI + { + npc_time_riftAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - uint32 TimeRiftWave_Timer; - uint8 mRiftWaveCount; - uint8 mPortalCount; - uint8 mWaveId; + InstanceScript *pInstance; - void Reset() - { + uint32 TimeRiftWave_Timer; + uint8 mRiftWaveCount; + uint8 mPortalCount; + uint8 mWaveId; - TimeRiftWave_Timer = 15000; - mRiftWaveCount = 0; + void Reset() + { - if (!pInstance) - return; + TimeRiftWave_Timer = 15000; + mRiftWaveCount = 0; - mPortalCount = pInstance->GetData(DATA_PORTAL_COUNT); + if (!pInstance) + return; - if (mPortalCount < 6) - mWaveId = 0; - else if (mPortalCount > 12) - mWaveId = 2; - else mWaveId = 1; + mPortalCount = pInstance->GetData(DATA_PORTAL_COUNT); - } - void EnterCombat(Unit * /*who*/) {} + if (mPortalCount < 6) + mWaveId = 0; + else if (mPortalCount > 12) + mWaveId = 2; + else mWaveId = 1; - void DoSummonAtRift(uint32 creature_entry) - { - if (!creature_entry) - return; + } + void EnterCombat(Unit * /*who*/) {} - if (pInstance && pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + void DoSummonAtRift(uint32 creature_entry) { - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - return; - } + if (!creature_entry) + return; - Position pos; - me->GetRandomNearPosition(pos, 10.0f); + if (pInstance && pInstance->GetData(TYPE_MEDIVH) != IN_PROGRESS) + { + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + return; + } - //normalize Z-level if we can, if rift is not at ground level. - pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); + Position pos; + me->GetRandomNearPosition(pos, 10.0f); - if (Unit *Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT)) - if (Unit *temp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_MEDIVH) : 0)) - Summon->AddThreat(temp,0.0f); - } + //normalize Z-level if we can, if rift is not at ground level. + pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); - void DoSelectSummon() - { - uint32 entry = 0; + if (Unit *Summon = DoSummon(creature_entry, pos, 30000, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT)) + if (Unit *temp = Unit::GetUnit(*me, pInstance ? pInstance->GetData64(DATA_MEDIVH) : 0)) + Summon->AddThreat(temp,0.0f); + } - if ((mRiftWaveCount > 2 && mWaveId < 1) || mRiftWaveCount > 3) - mRiftWaveCount = 0; + void DoSelectSummon() + { + uint32 entry = 0; - entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; - sLog.outDebug("TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).",mRiftWaveCount,entry); + if ((mRiftWaveCount > 2 && mWaveId < 1) || mRiftWaveCount > 3) + mRiftWaveCount = 0; - ++mRiftWaveCount; + entry = PortalWaves[mWaveId].PortalMob[mRiftWaveCount]; + sLog.outDebug("TSCR: npc_time_rift: summoning wave Creature (Wave %u, Entry %u).",mRiftWaveCount,entry); - if (entry == C_WHELP) - { - for (uint8 i = 0; i < 3; ++i) - DoSummonAtRift(entry); - } else DoSummonAtRift(entry); - } + ++mRiftWaveCount; - void UpdateAI(const uint32 diff) - { - if (!pInstance) - return; + if (entry == C_WHELP) + { + for (uint8 i = 0; i < 3; ++i) + DoSummonAtRift(entry); + } else DoSummonAtRift(entry); + } - if (TimeRiftWave_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoSelectSummon(); - TimeRiftWave_Timer = 15000; - } else TimeRiftWave_Timer -= diff; + if (!pInstance) + return; - if (me->IsNonMeleeSpellCasted(false)) - return; + if (TimeRiftWave_Timer <= diff) + { + DoSelectSummon(); + TimeRiftWave_Timer = 15000; + } else TimeRiftWave_Timer -= diff; - sLog.outDebug("TSCR: npc_time_rift: not casting anylonger, i need to die."); - me->setDeathState(JUST_DIED); + if (me->IsNonMeleeSpellCasted(false)) + return; + + sLog.outDebug("TSCR: npc_time_rift: not casting anylonger, i need to die."); + me->setDeathState(JUST_DIED); + + if (pInstance->GetData(TYPE_RIFT) == IN_PROGRESS) + pInstance->SetData(TYPE_RIFT,SPECIAL); + } + }; - if (pInstance->GetData(TYPE_RIFT) == IN_PROGRESS) - pInstance->SetData(TYPE_RIFT,SPECIAL); - } }; -CreatureAI* GetAI_npc_time_rift(Creature* pCreature) -{ - return new npc_time_riftAI (pCreature); -} #define SAY_SAAT_WELCOME -1269019 #define GOSSIP_ITEM_OBTAIN "[PH] Obtain Chrono-Beacon" #define SPELL_CHRONO_BEACON 34975 #define ITEM_CHRONO_BEACON 24289 - -bool GossipHello_npc_saat(Player* pPlayer, Creature* pCreature) +
class npc_saat : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_saat() : CreatureScript("npc_saat") { } - if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10000, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer,SPELL_CHRONO_BEACON,false); + } return true; } - else if (pPlayer->GetQuestRewardStatus(QUEST_OPENING_PORTAL) && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(10001, pCreature->GetGUID()); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(10000, pCreature->GetGUID()); + return true; + } + else if (pPlayer->GetQuestRewardStatus(QUEST_OPENING_PORTAL) && !pPlayer->HasItemCount(ITEM_CHRONO_BEACON,1)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,GOSSIP_ITEM_OBTAIN,GOSSIP_SENDER_MAIN,GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(10001, pCreature->GetGUID()); + return true; + } + + pPlayer->SEND_GOSSIP_MENU(10002, pCreature->GetGUID()); return true; } - pPlayer->SEND_GOSSIP_MENU(10002, pCreature->GetGUID()); - return true; -} +}; -bool GossipSelect_npc_saat(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer,SPELL_CHRONO_BEACON,false); - } - return true; -} void AddSC_dark_portal() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_medivh_bm"; - newscript->GetAI = &GetAI_npc_medivh_bm; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_time_rift"; - newscript->GetAI = &GetAI_npc_time_rift; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_saat"; - newscript->pGossipHello = &GossipHello_npc_saat; - newscript->pGossipSelect = &GossipSelect_npc_saat; - newscript->RegisterSelf(); + new npc_medivh_bm(); + new npc_time_rift(); + new npc_saat(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index b68310b4a18..9c8ab481a12 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -60,289 +60,290 @@ static Wave RiftWaves[]= {RIFT_BOSS, 120000}, {C_AEONUS, 0} }; - -struct instance_dark_portal : public ScriptedInstance +
class instance_dark_portal : public InstanceMapScript { - instance_dark_portal(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - uint32 mRiftPortalCount; - uint32 mShieldPercent; - uint8 mRiftWaveCount; - uint8 mRiftWaveId; - - uint32 NextPortal_Timer; +public: + instance_dark_portal() : InstanceMapScript("instance_dark_portal") { } - uint64 MedivhGUID; - uint8 CurrentRiftId; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - MedivhGUID = 0; - Clear(); + return new instance_dark_portal_InstanceMapScript(pMap); } - void Clear() + struct instance_dark_portal_InstanceMapScript : public InstanceScript { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + instance_dark_portal_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - mRiftPortalCount = 0; - mShieldPercent = 100; - mRiftWaveCount = 0; - mRiftWaveId = 0; + uint32 m_auiEncounter[MAX_ENCOUNTER]; - CurrentRiftId = 0; + uint32 mRiftPortalCount; + uint32 mShieldPercent; + uint8 mRiftWaveCount; + uint8 mRiftWaveId; - NextPortal_Timer = 0; - } + uint32 NextPortal_Timer; - void InitWorldState(bool Enable = true) - { - DoUpdateWorldState(WORLD_STATE_BM,Enable ? 1 : 0); - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, 100); - DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0); - } + uint64 MedivhGUID; + uint8 CurrentRiftId; - bool IsEncounterInProgress() - { - if (GetData(TYPE_MEDIVH) == IN_PROGRESS) - return true; + void Initialize() + { + MedivhGUID = 0; + Clear(); + } - return false; - } + void Clear() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - void OnPlayerEnter(Player* pPlayer) - { - if (GetData(TYPE_MEDIVH) == IN_PROGRESS) - return; + mRiftPortalCount = 0; + mShieldPercent = 100; + mRiftWaveCount = 0; + mRiftWaveId = 0; - pPlayer->SendUpdateWorldState(WORLD_STATE_BM,0); - } + CurrentRiftId = 0; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - if (pCreature->GetEntry() == C_MEDIVH) - MedivhGUID = pCreature->GetGUID(); - } + NextPortal_Timer = 0; + } + + void InitWorldState(bool Enable = true) + { + DoUpdateWorldState(WORLD_STATE_BM,Enable ? 1 : 0); + DoUpdateWorldState(WORLD_STATE_BM_SHIELD, 100); + DoUpdateWorldState(WORLD_STATE_BM_RIFT, 0); + } + + bool IsEncounterInProgress() + { + if (GetData(TYPE_MEDIVH) == IN_PROGRESS) + return true; - //what other conditions to check? - bool CanProgressEvent() - { - if (instance->GetPlayers().isEmpty()) return false; + } - return true; - } + void OnPlayerEnter(Player* pPlayer) + { + if (GetData(TYPE_MEDIVH) == IN_PROGRESS) + return; - uint8 GetRiftWaveId() - { - switch(mRiftPortalCount) + pPlayer->SendUpdateWorldState(WORLD_STATE_BM,0); + } + + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case 6: - mRiftWaveId = 2; - return 1; - case 12: - mRiftWaveId = 4; - return 3; - case 18: - return 5; - default: - return mRiftWaveId; + if (pCreature->GetEntry() == C_MEDIVH) + MedivhGUID = pCreature->GetGUID(); } - } - void SetData(uint32 type, uint32 data) - { - switch(type) + //what other conditions to check? + bool CanProgressEvent() { - case TYPE_MEDIVH: - if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS) - { - --mShieldPercent; + if (instance->GetPlayers().isEmpty()) + return false; - DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent); + return true; + } - if (!mShieldPercent) + uint8 GetRiftWaveId() + { + switch(mRiftPortalCount) + { + case 6: + mRiftWaveId = 2; + return 1; + case 12: + mRiftWaveId = 4; + return 3; + case 18: + return 5; + default: + return mRiftWaveId; + } + } + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case TYPE_MEDIVH: + if (data == SPECIAL && m_auiEncounter[0] == IN_PROGRESS) { - if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) + --mShieldPercent; + + DoUpdateWorldState(WORLD_STATE_BM_SHIELD, mShieldPercent); + + if (!mShieldPercent) { - if (pMedivh->isAlive()) + if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) { - pMedivh->DealDamage(pMedivh, pMedivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); - m_auiEncounter[0] = FAIL; - m_auiEncounter[1] = NOT_STARTED; + if (pMedivh->isAlive()) + { + pMedivh->DealDamage(pMedivh, pMedivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); + m_auiEncounter[0] = FAIL; + m_auiEncounter[1] = NOT_STARTED; + } } } } - } - else - { - if (data == IN_PROGRESS) - { - sLog.outDebug("TSCR: Instance Dark Portal: Starting event."); - InitWorldState(); - m_auiEncounter[1] = IN_PROGRESS; - NextPortal_Timer = 15000; - } - - if (data == DONE) + else { - //this may be completed further out in the post-event - sLog.outDebug("TSCR: Instance Dark Portal: Event completed."); - Map::PlayerList const& players = instance->GetPlayers(); + if (data == IN_PROGRESS) + { + sLog.outDebug("TSCR: Instance Dark Portal: Starting event."); + InitWorldState(); + m_auiEncounter[1] = IN_PROGRESS; + NextPortal_Timer = 15000; + } - if (!players.isEmpty()) + if (data == DONE) { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + //this may be completed further out in the post-event + sLog.outDebug("TSCR: Instance Dark Portal: Event completed."); + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - if (Player* pPlayer = itr->getSource()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL); - - if (pPlayer->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH); + if (Player* pPlayer = itr->getSource()) + { + if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL); + + if (pPlayer->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH); + } } } } - } - m_auiEncounter[0] = data; - } - break; - case TYPE_RIFT: - if (data == SPECIAL) - { - if (mRiftPortalCount < 7) - NextPortal_Timer = 5000; + m_auiEncounter[0] = data; + } + break; + case TYPE_RIFT: + if (data == SPECIAL) + { + if (mRiftPortalCount < 7) + NextPortal_Timer = 5000; + } + else + m_auiEncounter[1] = data; + break; } - else - m_auiEncounter[1] = data; - break; } - } - uint32 GetData(uint32 type) - { - switch(type) + uint32 GetData(uint32 type) { - case TYPE_MEDIVH: - return m_auiEncounter[0]; - case TYPE_RIFT: - return m_auiEncounter[1]; - case DATA_PORTAL_COUNT: - return mRiftPortalCount; - case DATA_SHIELD: - return mShieldPercent; + switch(type) + { + case TYPE_MEDIVH: + return m_auiEncounter[0]; + case TYPE_RIFT: + return m_auiEncounter[1]; + case DATA_PORTAL_COUNT: + return mRiftPortalCount; + case DATA_SHIELD: + return mShieldPercent; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 data) - { - if (data == DATA_MEDIVH) - return MedivhGUID; + uint64 GetData64(uint32 data) + { + if (data == DATA_MEDIVH) + return MedivhGUID; - return 0; - } + return 0; + } - Creature* SummonedPortalBoss(Creature* me) - { - uint32 entry = RiftWaves[GetRiftWaveId()].PortalBoss; + Creature* SummonedPortalBoss(Creature* me) + { + uint32 entry = RiftWaves[GetRiftWaveId()].PortalBoss; - if (entry == RIFT_BOSS) - entry = RandRiftBoss(); + if (entry == RIFT_BOSS) + entry = RandRiftBoss(); - sLog.outDebug("TSCR: Instance Dark Portal: Summoning rift boss entry %u.",entry); + sLog.outDebug("TSCR: Instance Dark Portal: Summoning rift boss entry %u.",entry); - Position pos; - me->GetRandomNearPosition(pos, 10.0f); + Position pos; + me->GetRandomNearPosition(pos, 10.0f); - //normalize Z-level if we can, if rift is not at ground level. - pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); + //normalize Z-level if we can, if rift is not at ground level. + pos.m_positionZ = std::max(me->GetMap()->GetHeight(pos.m_positionX, pos.m_positionY, MAX_HEIGHT), me->GetMap()->GetWaterLevel(pos.m_positionX, pos.m_positionY)); - if (Creature *summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000)) - return summon; + if (Creature *summon = me->SummonCreature(entry, pos, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000)) + return summon; - sLog.outDebug("TSCR: Instance Dark Portal: What just happened there? No boss, no loot, no fun..."); - return NULL; - } + sLog.outDebug("TSCR: Instance Dark Portal: What just happened there? No boss, no loot, no fun..."); + return NULL; + } - void DoSpawnPortal() - { - if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) + void DoSpawnPortal() { - uint8 tmp = urand(0,2); + if (Creature* pMedivh = instance->GetCreature(MedivhGUID)) + { + uint8 tmp = urand(0,2); - if (tmp >= CurrentRiftId) - ++tmp; + if (tmp >= CurrentRiftId) + ++tmp; - sLog.outDebug("TSCR: Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).",tmp,CurrentRiftId); + sLog.outDebug("TSCR: Instance Dark Portal: Creating Time Rift at locationId %i (old locationId was %u).",tmp,CurrentRiftId); - CurrentRiftId = tmp; + CurrentRiftId = tmp; - Creature *pTemp = pMedivh->SummonCreature(C_TIME_RIFT, - PortalLocation[tmp][0],PortalLocation[tmp][1],PortalLocation[tmp][2],PortalLocation[tmp][3], - TEMPSUMMON_CORPSE_DESPAWN,0); - if (pTemp) - { - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - if (Creature *pBoss = SummonedPortalBoss(pTemp)) + Creature *pTemp = pMedivh->SummonCreature(C_TIME_RIFT, + PortalLocation[tmp][0],PortalLocation[tmp][1],PortalLocation[tmp][2],PortalLocation[tmp][3], + TEMPSUMMON_CORPSE_DESPAWN,0); + if (pTemp) { - if (pBoss->GetEntry() == C_AEONUS) - pBoss->AddThreat(pMedivh,0.0f); - else + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + if (Creature *pBoss = SummonedPortalBoss(pTemp)) { - pBoss->AddThreat(pTemp,0.0f); - pTemp->CastSpell(pBoss,SPELL_RIFT_CHANNEL,false); + if (pBoss->GetEntry() == C_AEONUS) + pBoss->AddThreat(pMedivh,0.0f); + else + { + pBoss->AddThreat(pTemp,0.0f); + pTemp->CastSpell(pBoss,SPELL_RIFT_CHANNEL,false); + } } } } } - } - - void Update(uint32 diff) - { - if (m_auiEncounter[1] != IN_PROGRESS) - return; - //add delay timer? - if (!CanProgressEvent()) + void Update(uint32 diff) { - Clear(); - return; - } + if (m_auiEncounter[1] != IN_PROGRESS) + return; - if (NextPortal_Timer) - { - if (NextPortal_Timer <= diff) + //add delay timer? + if (!CanProgressEvent()) + { + Clear(); + return; + } + + if (NextPortal_Timer) { - ++mRiftPortalCount; + if (NextPortal_Timer <= diff) + { + ++mRiftPortalCount; - DoUpdateWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount); + DoUpdateWorldState(WORLD_STATE_BM_RIFT, mRiftPortalCount); - DoSpawnPortal(); - NextPortal_Timer = RiftWaves[GetRiftWaveId()].NextPortalTime; - } else NextPortal_Timer -= diff; + DoSpawnPortal(); + NextPortal_Timer = RiftWaves[GetRiftWaveId()].NextPortalTime; + } else NextPortal_Timer -= diff; + } } - } + }; + }; -InstanceData* GetInstanceData_instance_dark_portal(Map* pMap) -{ - return new instance_dark_portal(pMap); -} void AddSC_instance_dark_portal() { - Script *newscript; - - newscript = new Script; - newscript->Name = "instance_dark_portal"; - newscript->GetInstanceData = &GetInstanceData_instance_dark_portal; - newscript->RegisterSelf(); + new instance_dark_portal(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp index 013846e576a..eeb4b5a0865 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp @@ -39,116 +39,118 @@ EndScriptData */ #define SPELL_HOLY_SHIELD 31904 #define SPELL_DEVOTION_AURA 8258 #define SPELL_CONSECRATION 38385 - -struct boss_captain_skarlocAI : public ScriptedAI +
class boss_captain_skarloc : public CreatureScript { - boss_captain_skarlocAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint32 Holy_Light_Timer; - uint32 Cleanse_Timer; - uint32 HammerOfJustice_Timer; - uint32 HolyShield_Timer; - uint32 DevotionAura_Timer; - uint32 Consecration_Timer; - - void Reset() - { - Holy_Light_Timer = 20000 + rand()%10000; - Cleanse_Timer = 10000; - HammerOfJustice_Timer = 20000 + rand()%15000; - HolyShield_Timer = 240000; - DevotionAura_Timer = 3000; - Consecration_Timer = 8000; - } - - void EnterCombat(Unit * /*who*/) - { - //This is not correct. Should taunt Thrall before engage in combat - DoScriptText(SAY_TAUNT1, me); - DoScriptText(SAY_TAUNT2, me); - } +public: + boss_captain_skarloc() : CreatureScript("boss_captain_skarloc") { } - void KilledUnit(Unit * /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + return new boss_captain_skarlocAI (pCreature); } - void JustDied(Unit * /*victim*/) + struct boss_captain_skarlocAI : public ScriptedAI { - DoScriptText(SAY_DEATH, me); - - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) - pInstance->SetData(TYPE_THRALL_PART1, DONE); - } + boss_captain_skarlocAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + InstanceScript *pInstance; - //Holy_Light - if (Holy_Light_Timer <= diff) - { - DoCast(me, SPELL_HOLY_LIGHT); - Holy_Light_Timer = 30000; - } else Holy_Light_Timer -= diff; + uint32 Holy_Light_Timer; + uint32 Cleanse_Timer; + uint32 HammerOfJustice_Timer; + uint32 HolyShield_Timer; + uint32 DevotionAura_Timer; + uint32 Consecration_Timer; - //Cleanse - if (Cleanse_Timer <= diff) + void Reset() { - DoCast(me, SPELL_CLEANSE); + Holy_Light_Timer = 20000 + rand()%10000; Cleanse_Timer = 10000; - } else Cleanse_Timer -= diff; + HammerOfJustice_Timer = 20000 + rand()%15000; + HolyShield_Timer = 240000; + DevotionAura_Timer = 3000; + Consecration_Timer = 8000; + } - //Hammer of Justice - if (HammerOfJustice_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_HAMMER_OF_JUSTICE); - HammerOfJustice_Timer = 60000; - } else HammerOfJustice_Timer -= diff; + //This is not correct. Should taunt Thrall before engage in combat + DoScriptText(SAY_TAUNT1, me); + DoScriptText(SAY_TAUNT2, me); + } - //Holy Shield - if (HolyShield_Timer <= diff) + void KilledUnit(Unit * /*victim*/) { - DoCast(me, SPELL_HOLY_SHIELD); - HolyShield_Timer = 240000; - } else HolyShield_Timer -= diff; + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - //Devotion_Aura - if (DevotionAura_Timer <= diff) + void JustDied(Unit * /*victim*/) { - DoCast(me, SPELL_DEVOTION_AURA); - DevotionAura_Timer = 45000 + rand()%10000; - } else DevotionAura_Timer -= diff; + DoScriptText(SAY_DEATH, me); - //Consecration - if (Consecration_Timer <= diff) + if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) + pInstance->SetData(TYPE_THRALL_PART1, DONE); + } + + void UpdateAI(const uint32 diff) { - //DoCast(me->getVictim(), SPELL_CONSECRATION); - Consecration_Timer = 5000 + rand()%5000; - } else Consecration_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //Holy_Light + if (Holy_Light_Timer <= diff) + { + DoCast(me, SPELL_HOLY_LIGHT); + Holy_Light_Timer = 30000; + } else Holy_Light_Timer -= diff; + + //Cleanse + if (Cleanse_Timer <= diff) + { + DoCast(me, SPELL_CLEANSE); + Cleanse_Timer = 10000; + } else Cleanse_Timer -= diff; + + //Hammer of Justice + if (HammerOfJustice_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMMER_OF_JUSTICE); + HammerOfJustice_Timer = 60000; + } else HammerOfJustice_Timer -= diff; + + //Holy Shield + if (HolyShield_Timer <= diff) + { + DoCast(me, SPELL_HOLY_SHIELD); + HolyShield_Timer = 240000; + } else HolyShield_Timer -= diff; + + //Devotion_Aura + if (DevotionAura_Timer <= diff) + { + DoCast(me, SPELL_DEVOTION_AURA); + DevotionAura_Timer = 45000 + rand()%10000; + } else DevotionAura_Timer -= diff; + + //Consecration + if (Consecration_Timer <= diff) + { + //DoCast(me->getVictim(), SPELL_CONSECRATION); + Consecration_Timer = 5000 + rand()%5000; + } else Consecration_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_captain_skarloc(Creature* pCreature) -{ - return new boss_captain_skarlocAI (pCreature); -} void AddSC_boss_captain_skarloc() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_captain_skarloc"; - newscript->GetAI = &GetAI_boss_captain_skarloc; - newscript->RegisterSelf(); + new boss_captain_skarloc(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp index 92e0ac31a2b..b3c8624294c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp @@ -41,100 +41,102 @@ EndScriptData */ #define SPELL_IMPENDING_DEATH 31916 #define SPELL_MAGIC_DISRUPTION_AURA 33834 #define SPELL_WING_BUFFET 31475 - -struct boss_epoch_hunterAI : public ScriptedAI +
class boss_epoch_hunter : public CreatureScript { - boss_epoch_hunterAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; - - uint32 SandBreath_Timer; - uint32 ImpendingDeath_Timer; - uint32 WingBuffet_Timer; - uint32 Mda_Timer; - - void Reset() - { - SandBreath_Timer = 8000 + rand()%8000; - ImpendingDeath_Timer = 25000 + rand()%5000; - WingBuffet_Timer = 35000; - Mda_Timer = 40000; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2), me); - } +public: + boss_epoch_hunter() : CreatureScript("boss_epoch_hunter") { } - void KilledUnit(Unit * /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + return new boss_epoch_hunterAI (pCreature); } - void JustDied(Unit * /*victim*/) + struct boss_epoch_hunterAI : public ScriptedAI { - DoScriptText(SAY_DEATH, me); + boss_epoch_hunterAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) - pInstance->SetData(TYPE_THRALL_PART4, DONE); - } + InstanceScript *pInstance; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 SandBreath_Timer; + uint32 ImpendingDeath_Timer; + uint32 WingBuffet_Timer; + uint32 Mda_Timer; - //Sand Breath - if (SandBreath_Timer <= diff) + void Reset() { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + SandBreath_Timer = 8000 + rand()%8000; + ImpendingDeath_Timer = 25000 + rand()%5000; + WingBuffet_Timer = 35000; + Mda_Timer = 40000; + } - DoCast(me->getVictim(), SPELL_SAND_BREATH); - - DoScriptText(RAND(SAY_BREATH1,SAY_BREATH2), me); - - SandBreath_Timer = 10000 + rand()%10000; - } else SandBreath_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2), me); + } - if (ImpendingDeath_Timer <= diff) + void KilledUnit(Unit * /*victim*/) { - DoCast(me->getVictim(), SPELL_IMPENDING_DEATH); - ImpendingDeath_Timer = 25000+rand()%5000; - } else ImpendingDeath_Timer -= diff; + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - if (WingBuffet_Timer <= diff) + void JustDied(Unit * /*victim*/) { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_WING_BUFFET); - WingBuffet_Timer = 25000+rand()%10000; - } else WingBuffet_Timer -= diff; + DoScriptText(SAY_DEATH, me); - if (Mda_Timer <= diff) + if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) + pInstance->SetData(TYPE_THRALL_PART4, DONE); + } + + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_MAGIC_DISRUPTION_AURA); - Mda_Timer = 15000; - } else Mda_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; + + //Sand Breath + if (SandBreath_Timer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); + + DoCast(me->getVictim(), SPELL_SAND_BREATH); + + DoScriptText(RAND(SAY_BREATH1,SAY_BREATH2), me); + + SandBreath_Timer = 10000 + rand()%10000; + } else SandBreath_Timer -= diff; + + if (ImpendingDeath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_IMPENDING_DEATH); + ImpendingDeath_Timer = 25000+rand()%5000; + } else ImpendingDeath_Timer -= diff; + + if (WingBuffet_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_WING_BUFFET); + WingBuffet_Timer = 25000+rand()%10000; + } else WingBuffet_Timer -= diff; + + if (Mda_Timer <= diff) + { + DoCast(me, SPELL_MAGIC_DISRUPTION_AURA); + Mda_Timer = 15000; + } else Mda_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_epoch_hunter(Creature* pCreature) -{ - return new boss_epoch_hunterAI (pCreature); -} void AddSC_boss_epoch_hunter() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_epoch_hunter"; - newscript->GetAI = &GetAI_boss_epoch_hunter; - newscript->RegisterSelf(); + new boss_epoch_hunter(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp index 6fc67249925..caa70fb2bc8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_leutenant_drake.cpp @@ -30,19 +30,25 @@ EndScriptData */ /*###### ## go_barrel_old_hillsbrad ######*/ - -bool GOHello_go_barrel_old_hillsbrad(Player* /*pPlayer*/, GameObject* pGO) +
class go_barrel_old_hillsbrad : public GameObjectScript { - if (ScriptedInstance* pInstance = pGO->GetInstanceData()) +public: + go_barrel_old_hillsbrad() : GameObjectScript("go_barrel_old_hillsbrad") { } + + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGO) { - if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE) - return false; + if (InstanceScript* pInstance = pGO->GetInstanceScript()) + { + if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE) + return false; + + pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS); + } - pInstance->SetData(TYPE_BARREL_DIVERSION, IN_PROGRESS); + return false; } - return false; -} +}; /*###### ## boss_lieutenant_drake @@ -91,102 +97,99 @@ static Location DrakeWP[]= {17, 2125.50, 88.9481, 54.7953}, {18, 2128.20, 70.9763, 64.4221} }; - -struct boss_lieutenant_drakeAI : public ScriptedAI +
class boss_lieutenant_drake : public CreatureScript { - boss_lieutenant_drakeAI(Creature *c) : ScriptedAI(c) {} +public: + boss_lieutenant_drake() : CreatureScript("boss_lieutenant_drake") { } - bool CanPatrol; - uint32 wpId; - - uint32 Whirlwind_Timer; - uint32 Fear_Timer; - uint32 MortalStrike_Timer; - uint32 ExplodingShout_Timer; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - CanPatrol = true; - wpId = 0; - - Whirlwind_Timer = 20000; - Fear_Timer = 30000; - MortalStrike_Timer = 45000; - ExplodingShout_Timer = 25000; + return new boss_lieutenant_drakeAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_lieutenant_drakeAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } + boss_lieutenant_drakeAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); - } + bool CanPatrol; + uint32 wpId; - void JustDied(Unit * /*victim*/) - { - DoScriptText(SAY_DEATH, me); - } + uint32 Whirlwind_Timer; + uint32 Fear_Timer; + uint32 MortalStrike_Timer; + uint32 ExplodingShout_Timer; - void UpdateAI(const uint32 diff) - { - //TODO: make this work - if (CanPatrol && wpId == 0) + void Reset() { - me->GetMotionMaster()->MovePoint(DrakeWP[0].wpId, DrakeWP[0].x, DrakeWP[0].y, DrakeWP[0].z); - ++wpId; + CanPatrol = true; + wpId = 0; + + Whirlwind_Timer = 20000; + Fear_Timer = 30000; + MortalStrike_Timer = 45000; + ExplodingShout_Timer = 25000; } - //Return since we have no target - if (!UpdateVictim()) - return; + void EnterCombat(Unit * /*who*/) + { + DoScriptText(SAY_AGGRO, me); + } - //Whirlwind - if (Whirlwind_Timer <= diff) + void KilledUnit(Unit * /*victim*/) { - DoCast(me->getVictim(), SPELL_WHIRLWIND); - Whirlwind_Timer = 20000+rand()%5000; - } else Whirlwind_Timer -= diff; + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2), me); + } - //Fear - if (Fear_Timer <= diff) + void JustDied(Unit * /*victim*/) { - DoScriptText(SAY_SHOUT, me); - DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT); - Fear_Timer = 25000+rand()%10000; - } else Fear_Timer -= diff; + DoScriptText(SAY_DEATH, me); + } - //Mortal Strike - if (MortalStrike_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoScriptText(SAY_MORTAL, me); - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - MortalStrike_Timer = 20000+rand()%10000; - } else MortalStrike_Timer -= diff; + //TODO: make this work + if (CanPatrol && wpId == 0) + { + me->GetMotionMaster()->MovePoint(DrakeWP[0].wpId, DrakeWP[0].x, DrakeWP[0].y, DrakeWP[0].z); + ++wpId; + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //Whirlwind + if (Whirlwind_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_WHIRLWIND); + Whirlwind_Timer = 20000+rand()%5000; + } else Whirlwind_Timer -= diff; + + //Fear + if (Fear_Timer <= diff) + { + DoScriptText(SAY_SHOUT, me); + DoCast(me->getVictim(), SPELL_FRIGHTENING_SHOUT); + Fear_Timer = 25000+rand()%10000; + } else Fear_Timer -= diff; + + //Mortal Strike + if (MortalStrike_Timer <= diff) + { + DoScriptText(SAY_MORTAL, me); + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + MortalStrike_Timer = 20000+rand()%10000; + } else MortalStrike_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_lieutenant_drake(Creature* pCreature) -{ - return new boss_lieutenant_drakeAI (pCreature); -} void AddSC_boss_lieutenant_drake() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_barrel_old_hillsbrad"; - newscript->pGOHello = &GOHello_go_barrel_old_hillsbrad; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_lieutenant_drake"; - newscript->GetAI = &GetAI_boss_lieutenant_drake; - newscript->RegisterSelf(); + new go_barrel_old_hillsbrad(); + new boss_lieutenant_drake(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index 85536bacd7e..22526baf940 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -36,205 +36,207 @@ EndScriptData */ #define QUEST_ENTRY_DIVERSION 10283 #define LODGE_QUEST_TRIGGER 20155 - -struct instance_old_hillsbrad : public ScriptedInstance +
class instance_old_hillsbrad : public InstanceMapScript { - instance_old_hillsbrad(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - uint32 mBarrelCount; - uint32 mThrallEventCount; +public: + instance_old_hillsbrad() : InstanceMapScript("instance_old_hillsbrad") { } - uint64 ThrallGUID; - uint64 TarethaGUID; - uint64 EpochGUID; - - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - mBarrelCount = 0; - mThrallEventCount = 0; - ThrallGUID = 0; - TarethaGUID = 0; - EpochGUID = 0; + return new instance_old_hillsbrad_InstanceMapScript(pMap); } - Player* GetPlayerInMap() + struct instance_old_hillsbrad_InstanceMapScript : public InstanceScript { - Map::PlayerList const& players = instance->GetPlayers(); + instance_old_hillsbrad_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - if (!players.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* plr = itr->getSource()) - return plr; - } - } + uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint32 mBarrelCount; + uint32 mThrallEventCount; - sLog.outDebug("TSCR: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } + uint64 ThrallGUID; + uint64 TarethaGUID; + uint64 EpochGUID; - void UpdateQuestCredit() - { - Map::PlayerList const& players = instance->GetPlayers(); + void Initialize() + { + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + mBarrelCount = 0; + mThrallEventCount = 0; + ThrallGUID = 0; + TarethaGUID = 0; + EpochGUID = 0; + } - if (!players.isEmpty()) + Player* GetPlayerInMap() { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - if (Player* pPlayer = itr->getSource()) - pPlayer->KilledMonsterCredit(LODGE_QUEST_TRIGGER,0); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } } + + sLog.outDebug("TSCR: Instance Old Hillsbrad: GetPlayerInMap, but PlayerList is empty!"); + return NULL; } - } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch(pCreature->GetEntry()) + void UpdateQuestCredit() { - case THRALL_ENTRY: - ThrallGUID = pCreature->GetGUID(); - break; - case TARETHA_ENTRY: - TarethaGUID = pCreature->GetGUID(); - break; - case EPOCH_ENTRY: - EpochGUID = pCreature->GetGUID(); - break; - } - } + Map::PlayerList const& players = instance->GetPlayers(); - void SetData(uint32 type, uint32 data) - { - Player* pPlayer = GetPlayerInMap(); + if (!players.isEmpty()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* pPlayer = itr->getSource()) + pPlayer->KilledMonsterCredit(LODGE_QUEST_TRIGGER,0); + } + } + } - if (!pPlayer) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - sLog.outDebug("TSCR: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); - return; + switch(pCreature->GetEntry()) + { + case THRALL_ENTRY: + ThrallGUID = pCreature->GetGUID(); + break; + case TARETHA_ENTRY: + TarethaGUID = pCreature->GetGUID(); + break; + case EPOCH_ENTRY: + EpochGUID = pCreature->GetGUID(); + break; + } } - switch(type) + void SetData(uint32 type, uint32 data) { - case TYPE_BARREL_DIVERSION: + Player* pPlayer = GetPlayerInMap(); + + if (!pPlayer) + { + sLog.outDebug("TSCR: Instance Old Hillsbrad: SetData (Type: %u Data %u) cannot find any player.", type, data); + return; + } + + switch(type) { - if (data == IN_PROGRESS) + case TYPE_BARREL_DIVERSION: { - if (mBarrelCount >= 5) - return; + if (data == IN_PROGRESS) + { + if (mBarrelCount >= 5) + return; - ++mBarrelCount; - DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount); + ++mBarrelCount; + DoUpdateWorldState(WORLD_STATE_OH, mBarrelCount); - sLog.outDebug("TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u",mBarrelCount); + sLog.outDebug("TSCR: Instance Old Hillsbrad: go_barrel_old_hillsbrad count %u",mBarrelCount); - m_auiEncounter[0] = IN_PROGRESS; + m_auiEncounter[0] = IN_PROGRESS; - if (mBarrelCount == 5) - { - UpdateQuestCredit(); - pPlayer->SummonCreature(DRAKE_ENTRY, 2128.43, 71.01, 64.42, 1.74, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000); - m_auiEncounter[0] = DONE; + if (mBarrelCount == 5) + { + UpdateQuestCredit(); + pPlayer->SummonCreature(DRAKE_ENTRY, 2128.43, 71.01, 64.42, 1.74, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 1800000); + m_auiEncounter[0] = DONE; + } } + break; } - break; - } - case TYPE_THRALL_EVENT: - { - if (data == FAIL) + case TYPE_THRALL_EVENT: { - if (mThrallEventCount <= 20) + if (data == FAIL) { - ++mThrallEventCount; - m_auiEncounter[1] = NOT_STARTED; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.",mThrallEventCount); - m_auiEncounter[2] = NOT_STARTED; - m_auiEncounter[3] = NOT_STARTED; - m_auiEncounter[4] = NOT_STARTED; - m_auiEncounter[5] = NOT_STARTED; + if (mThrallEventCount <= 20) + { + ++mThrallEventCount; + m_auiEncounter[1] = NOT_STARTED; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.",mThrallEventCount); + m_auiEncounter[2] = NOT_STARTED; + m_auiEncounter[3] = NOT_STARTED; + m_auiEncounter[4] = NOT_STARTED; + m_auiEncounter[5] = NOT_STARTED; + } + else if (mThrallEventCount > 20) + { + m_auiEncounter[1] = data; + m_auiEncounter[2] = data; + m_auiEncounter[3] = data; + m_auiEncounter[4] = data; + m_auiEncounter[5] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.",mThrallEventCount); + } } - else if (mThrallEventCount > 20) - { + else m_auiEncounter[1] = data; - m_auiEncounter[2] = data; - m_auiEncounter[3] = data; - m_auiEncounter[4] = data; - m_auiEncounter[5] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event failed %u times. Resetting all sub-events.",mThrallEventCount); - } + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall escort event adjusted to data %u.",data); + break; } - else - m_auiEncounter[1] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall escort event adjusted to data %u.",data); - break; + case TYPE_THRALL_PART1: + m_auiEncounter[2] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part I adjusted to data %u.",data); + break; + case TYPE_THRALL_PART2: + m_auiEncounter[3] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part II adjusted to data %u.",data); + break; + case TYPE_THRALL_PART3: + m_auiEncounter[4] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part III adjusted to data %u.",data); + break; + case TYPE_THRALL_PART4: + m_auiEncounter[5] = data; + sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.",data); + break; } - case TYPE_THRALL_PART1: - m_auiEncounter[2] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part I adjusted to data %u.",data); - break; - case TYPE_THRALL_PART2: - m_auiEncounter[3] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part II adjusted to data %u.",data); - break; - case TYPE_THRALL_PART3: - m_auiEncounter[4] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part III adjusted to data %u.",data); - break; - case TYPE_THRALL_PART4: - m_auiEncounter[5] = data; - sLog.outDebug("TSCR: Instance Old Hillsbrad: Thrall event part IV adjusted to data %u.",data); - break; } - } - uint32 GetData(uint32 data) - { - switch(data) + uint32 GetData(uint32 data) { - case TYPE_BARREL_DIVERSION: - return m_auiEncounter[0]; - case TYPE_THRALL_EVENT: - return m_auiEncounter[1]; - case TYPE_THRALL_PART1: - return m_auiEncounter[2]; - case TYPE_THRALL_PART2: - return m_auiEncounter[3]; - case TYPE_THRALL_PART3: - return m_auiEncounter[4]; - case TYPE_THRALL_PART4: - return m_auiEncounter[5]; + switch(data) + { + case TYPE_BARREL_DIVERSION: + return m_auiEncounter[0]; + case TYPE_THRALL_EVENT: + return m_auiEncounter[1]; + case TYPE_THRALL_PART1: + return m_auiEncounter[2]; + case TYPE_THRALL_PART2: + return m_auiEncounter[3]; + case TYPE_THRALL_PART3: + return m_auiEncounter[4]; + case TYPE_THRALL_PART4: + return m_auiEncounter[5]; + } + return 0; } - return 0; - } - uint64 GetData64(uint32 data) - { - switch(data) + uint64 GetData64(uint32 data) { - case DATA_THRALL: - return ThrallGUID; - case DATA_TARETHA: - return TarethaGUID; - case DATA_EPOCH: - return EpochGUID; + switch(data) + { + case DATA_THRALL: + return ThrallGUID; + case DATA_TARETHA: + return TarethaGUID; + case DATA_EPOCH: + return EpochGUID; + } + return 0; } - return 0; - } + }; + }; -InstanceData* GetInstanceData_instance_old_hillsbrad(Map* pMap) -{ - return new instance_old_hillsbrad(pMap); -} void AddSC_instance_old_hillsbrad() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_old_hillsbrad"; - newscript->GetInstanceData = &GetInstanceData_instance_old_hillsbrad; - newscript->RegisterSelf(); + new instance_old_hillsbrad(); } - diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index 801e79cb958..b802a17d45c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -45,42 +45,49 @@ EndContentData */ /*###### ## npc_erozion ######*/ - -bool GossipHello_npc_erozion(Player* pPlayer, Creature* pCreature) +
class npc_erozion : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance && pInstance->GetData(TYPE_BARREL_DIVERSION) != DONE && !pPlayer->HasItemCount(ITEM_ENTRY_BOMBS,1)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - if (!pPlayer->GetQuestRewardStatus(QUEST_ENTRY_RETURN) && pPlayer->GetQuestStatus(QUEST_ENTRY_RETURN) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - - pPlayer->SEND_GOSSIP_MENU(9778, pCreature->GetGUID()); +public: + npc_erozion() : CreatureScript("npc_erozion") { } - return true; -} - -bool GossipSelect_npc_erozion(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_ENTRY_BOMBS, 1); - if (msg == EQUIP_ERR_OK) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - pPlayer->StoreNewItem(dest, ITEM_ENTRY_BOMBS, true); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, ITEM_ENTRY_BOMBS, 1); + if (msg == EQUIP_ERR_OK) + { + pPlayer->StoreNewItem(dest, ITEM_ENTRY_BOMBS, true); + } + pPlayer->SEND_GOSSIP_MENU(9515, pCreature->GetGUID()); + } + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); } - pPlayer->SEND_GOSSIP_MENU(9515, pCreature->GetGUID()); + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance && pInstance->GetData(TYPE_BARREL_DIVERSION) != DONE && !pPlayer->HasItemCount(ITEM_ENTRY_BOMBS,1)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + if (!pPlayer->GetQuestRewardStatus(QUEST_ENTRY_RETURN) && pPlayer->GetQuestStatus(QUEST_ENTRY_RETURN) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_EROZION2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + + pPlayer->SEND_GOSSIP_MENU(9778, pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_thrall_old_hillsbrad @@ -179,372 +186,381 @@ bool GossipSelect_npc_erozion(Player* pPlayer, Creature* pCreature, uint32 /*uiS #define GOSSIP_ID_COMPLETE 9578 //Thank you friends, I owe my freedom to you. Where is Taretha? I hoped to see her #define GOSSIP_ITEM_WALKING "[PH] Start walking." - -struct npc_thrall_old_hillsbradAI : public npc_escortAI +
class npc_thrall_old_hillsbrad : public CreatureScript { - npc_thrall_old_hillsbradAI(Creature *c) : npc_escortAI(c) +public: + npc_thrall_old_hillsbrad() : CreatureScript("npc_thrall_old_hillsbrad") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - HadMount = false; - me->setActive(true); + return new npc_thrall_old_hillsbradAI(pCreature); } - ScriptedInstance *pInstance; - - uint64 TarethaGUID; - - bool LowHp; - bool HadMount; - - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (!pInstance) - return; - - switch(i) + InstanceScript* pInstance = pCreature->GetInstanceScript(); + switch(uiAction) { - case 8: - SetRun(false); - me->SummonCreature(18764,2181.87,112.46,89.45,0.26,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 9: - DoScriptText(SAY_TH_ARMORY, me); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_MODEL); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_MODEL); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, THRALL_SHIELD_INFO); - //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+3, 1038); - break; - case 10: - me->SetDisplayId(THRALL_MODEL_EQUIPPED); - break; - case 11: - SetRun(); - break; - case 15: - me->SummonCreature(MOB_ENTRY_RIFLE,2200.28,137.37,87.93,5.07,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_WARDEN,2197.44,131.83,87.93,0.78,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2203.62,135.40,87.93,3.70,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2200.75,130.13,87.93,1.48,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 21: - me->SummonCreature(MOB_ENTRY_RIFLE,2135.80,154.01,67.45,4.98,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_WARDEN,2144.36,151.87,67.74,4.46,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2142.12,154.41,67.12,4.56,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2138.08,155.38,67.24,4.60,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 25: - me->SummonCreature(MOB_ENTRY_RIFLE,2102.98,192.17,65.24,6.02,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_WARDEN,2108.48,198.75,65.18,5.15,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2106.11,197.29,65.18,5.63,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_VETERAN,2104.18,194.82,65.18,5.75,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 29: - DoScriptText(SAY_TH_SKARLOC_MEET, me); - me->SummonCreature(ENTRY_SCARLOC,2036.48,271.22,63.43,5.27,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); - //temporary,skarloc should rather be triggered to walk up to thrall - break; - case 30: - SetEscortPaused(true); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetRun(false); - break; - case 31: - DoScriptText(SAY_TH_MOUNTS_UP, me); - DoMount(); - SetRun(); - break; - case 37: - //possibly regular patrollers? If so, remove this and let database handle them - me->SummonCreature(MOB_ENTRY_WATCHMAN,2124.26,522.16,56.87,3.99,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_WATCHMAN,2121.69,525.37,57.11,4.01,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_SENTRY,2124.65,524.55,56.63,3.98,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 59: - me->SummonCreature(SKARLOC_MOUNT,2488.64,625.77,58.26,4.71,TEMPSUMMON_TIMED_DESPAWN,10000); - DoUnmount(); - HadMount = false; - SetRun(false); - break; - case 60: - me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); - //make horsie run off - SetEscortPaused(true); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - pInstance->SetData(TYPE_THRALL_PART2, DONE); - SetRun(); - break; - case 64: - SetRun(false); - break; - case 68: - me->SummonCreature(MOB_ENTRY_BARN_PROTECTOR,2500.22,692.60,55.50,2.84,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_BARN_LOOKOUT,2500.13,696.55,55.51,3.38,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.55,693.64,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.94,695.81,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 71: - SetRun(); - break; - case 81: - SetRun(false); - break; - case 83: - me->SummonCreature(MOB_ENTRY_CHURCH_PROTECTOR,2627.33,646.82,56.03,4.28,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); - me->SummonCreature(MOB_ENTRY_CHURCH_LOOKOUT,2624.14,648.03,56.03,4.50,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); - me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2625.32,649.60,56.03,4.38,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); - me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2627.22,649.00,56.03,4.34,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); - break; - case 84: - DoScriptText(SAY_TH_CHURCH_END, me); - SetRun(); - break; - case 91: - me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - SetRun(false); - break; - case 93: - me->SummonCreature(MOB_ENTRY_INN_PROTECTOR,2652.71,660.31,61.93,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_INN_LOOKOUT,2648.96,662.59,61.93,0.79,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2657.36,662.34,61.93,2.68,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2656.39,659.77,61.93,2.61,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); - break; - case 94: - if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pInstance) { - if (Unit* Taretha = Unit::GetUnit((*me), TarethaGUID)) - DoScriptText(SAY_TA_ESCAPED, Taretha, me); + pInstance->SetData(TYPE_THRALL_EVENT,IN_PROGRESS); + pInstance->SetData(TYPE_THRALL_PART1,IN_PROGRESS); } + + DoScriptText(SAY_TH_START_EVENT_PART1, pCreature); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, pCreature->AI())) + pEscortAI->Start(true, true, pPlayer->GetGUID()); + + CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far + CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); + CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); break; - case 95: - DoScriptText(SAY_TH_MEET_TARETHA, me); - pInstance->SetData(TYPE_THRALL_PART3,DONE); - SetEscortPaused(true); - break; - case 96: - DoScriptText(SAY_TH_EPOCH_WONDER, me); - break; - case 97: - DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, me); - SetRun(); - break; - case 98: - //trigger epoch Yell("Thrall! Come outside and face your fate! ....") - //from here, thrall should not never be allowed to move to point 106 which he currently does. + + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC2, pCreature->GetGUID()); break; - case 106: - { - //trigger taretha to run down outside - if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA))) - { - if (Player* pPlayer = GetPlayerForEscort()) - CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); - } + case GOSSIP_ACTION_INFO_DEF+20: + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC3, pCreature->GetGUID()); + pCreature->SummonCreature(SKARLOC_MOUNT,2038.81,270.26,63.20,5.41,TEMPSUMMON_TIMED_DESPAWN,12000); + if (pInstance) + pInstance->SetData(TYPE_THRALL_PART2,IN_PROGRESS); - //kill credit Creature for quest - Map* pMap = me->GetMap(); - Map::PlayerList const& players = pMap->GetPlayers(); - if (!players.isEmpty() && pMap->IsDungeon()) - { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - { - if (Player* pPlayer = itr->getSource()) - pPlayer->KilledMonsterCredit(20156,me->GetGUID()); - } - } + DoScriptText(SAY_TH_START_EVENT_PART2, pCreature); - //alot will happen here, thrall and taretha talk, erozion appear at spot to explain - me->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); - } + CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); break; - case 108: - //last waypoint, just set Thrall invisible, respawn is turned off - me->SetVisibility(VISIBILITY_OFF); + + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pInstance) + pInstance->SetData(TYPE_THRALL_PART3,IN_PROGRESS); + CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); break; } + return true; } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - LowHp = false; - - if (HadMount) - DoMount(); - - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + if (pCreature->isQuestGiver()) { - DoUnmount(); - HadMount = false; - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); - me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); - me->SetDisplayId(THRALL_MODEL_UNEQUIPPED); + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + pPlayer->SendPreparedQuest(pCreature->GetGUID()); } - if (HasEscortState(STATE_ESCORT_ESCORTING)) + + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance) { - DoScriptText(RAND(SAY_TH_LEAVE_COMBAT1,SAY_TH_LEAVE_COMBAT2,SAY_TH_LEAVE_COMBAT3), me); + if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE && !pInstance->GetData(TYPE_THRALL_EVENT)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WALKING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START, pCreature->GetGUID()); + } + + if (pInstance->GetData(TYPE_THRALL_PART1) == DONE && !pInstance->GetData(TYPE_THRALL_PART2)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC1, pCreature->GetGUID()); + } + + if (pInstance->GetData(TYPE_THRALL_PART2) == DONE && !pInstance->GetData(TYPE_THRALL_PART3)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TARREN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_TARREN, pCreature->GetGUID()); + } } + return true; } - void StartWP() - { - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - SetEscortPaused(false); - } - void DoMount() - { - me->Mount(SKARLOC_MOUNT_MODEL); - me->SetSpeed(MOVE_RUN,SPEED_MOUNT); - } - void DoUnmount() - { - me->Unmount(); - me->SetSpeed(MOVE_RUN,SPEED_RUN); - } - void EnterCombat(Unit* /*who*/) + + struct npc_thrall_old_hillsbradAI : public npc_escortAI { - DoScriptText(RAND(SAY_TH_RANDOM_AGGRO1,SAY_TH_RANDOM_AGGRO2,SAY_TH_RANDOM_AGGRO3,SAY_TH_RANDOM_AGGRO4), me); - if (me->IsMounted()) + npc_thrall_old_hillsbradAI(Creature *c) : npc_escortAI(c) { - DoUnmount(); - HadMount = true; + pInstance = c->GetInstanceScript(); + HadMount = false; + me->setActive(true); } - } - void JustSummoned(Creature* summoned) - { - switch(summoned->GetEntry()) - { - //TODO: make Scarloc start into event instead, and not start attack directly - case MOB_ENTRY_BARN_GUARDSMAN: - case MOB_ENTRY_BARN_PROTECTOR: - case MOB_ENTRY_BARN_LOOKOUT: - case SKARLOC_MOUNT: - case EROZION_ENTRY: - break; - default: - summoned->AI()->AttackStart(me); - break; - } - } + InstanceScript *pInstance; - void KilledUnit(Unit * /*victim*/) - { - DoScriptText(RAND(SAY_TH_RANDOM_KILL1,SAY_TH_RANDOM_KILL2,SAY_TH_RANDOM_KILL3), me); - } - void JustDied(Unit *slayer) - { - if (pInstance) - pInstance->SetData(TYPE_THRALL_EVENT,FAIL); + uint64 TarethaGUID; - // Don't do a yell if he kills self (if player goes too far or at the end). - if (slayer == me) - return; + bool LowHp; + bool HadMount; - DoScriptText(RAND(SAY_TH_RANDOM_DIE1,SAY_TH_RANDOM_DIE2), me); - } + void WaypointReached(uint32 i) + { + if (!pInstance) + return; - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + switch(i) + { + case 8: + SetRun(false); + me->SummonCreature(18764,2181.87,112.46,89.45,0.26,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 9: + DoScriptText(SAY_TH_ARMORY, me); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, THRALL_WEAPON_MODEL); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO, THRALL_WEAPON_INFO); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+1, 781); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, THRALL_SHIELD_MODEL); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+2, THRALL_SHIELD_INFO); + //me->SetUInt32Value(UNIT_VIRTUAL_ITEM_INFO+3, 1038); + break; + case 10: + me->SetDisplayId(THRALL_MODEL_EQUIPPED); + break; + case 11: + SetRun(); + break; + case 15: + me->SummonCreature(MOB_ENTRY_RIFLE,2200.28,137.37,87.93,5.07,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_WARDEN,2197.44,131.83,87.93,0.78,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2203.62,135.40,87.93,3.70,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2200.75,130.13,87.93,1.48,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 21: + me->SummonCreature(MOB_ENTRY_RIFLE,2135.80,154.01,67.45,4.98,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_WARDEN,2144.36,151.87,67.74,4.46,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2142.12,154.41,67.12,4.56,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2138.08,155.38,67.24,4.60,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 25: + me->SummonCreature(MOB_ENTRY_RIFLE,2102.98,192.17,65.24,6.02,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_WARDEN,2108.48,198.75,65.18,5.15,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2106.11,197.29,65.18,5.63,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_VETERAN,2104.18,194.82,65.18,5.75,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 29: + DoScriptText(SAY_TH_SKARLOC_MEET, me); + me->SummonCreature(ENTRY_SCARLOC,2036.48,271.22,63.43,5.27,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,30000); + //temporary,skarloc should rather be triggered to walk up to thrall + break; + case 30: + SetEscortPaused(true); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetRun(false); + break; + case 31: + DoScriptText(SAY_TH_MOUNTS_UP, me); + DoMount(); + SetRun(); + break; + case 37: + //possibly regular patrollers? If so, remove this and let database handle them + me->SummonCreature(MOB_ENTRY_WATCHMAN,2124.26,522.16,56.87,3.99,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_WATCHMAN,2121.69,525.37,57.11,4.01,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_SENTRY,2124.65,524.55,56.63,3.98,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 59: + me->SummonCreature(SKARLOC_MOUNT,2488.64,625.77,58.26,4.71,TEMPSUMMON_TIMED_DESPAWN,10000); + DoUnmount(); + HadMount = false; + SetRun(false); + break; + case 60: + me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); + //make horsie run off + SetEscortPaused(true); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + pInstance->SetData(TYPE_THRALL_PART2, DONE); + SetRun(); + break; + case 64: + SetRun(false); + break; + case 68: + me->SummonCreature(MOB_ENTRY_BARN_PROTECTOR,2500.22,692.60,55.50,2.84,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_BARN_LOOKOUT,2500.13,696.55,55.51,3.38,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.55,693.64,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_BARN_GUARDSMAN,2500.94,695.81,55.50,3.14,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 71: + SetRun(); + break; + case 81: + SetRun(false); + break; + case 83: + me->SummonCreature(MOB_ENTRY_CHURCH_PROTECTOR,2627.33,646.82,56.03,4.28,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); + me->SummonCreature(MOB_ENTRY_CHURCH_LOOKOUT,2624.14,648.03,56.03,4.50,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); + me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2625.32,649.60,56.03,4.38,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); + me->SummonCreature(MOB_ENTRY_CHURCH_GUARDSMAN,2627.22,649.00,56.03,4.34,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,5000); + break; + case 84: + DoScriptText(SAY_TH_CHURCH_END, me); + SetRun(); + break; + case 91: + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + SetRun(false); + break; + case 93: + me->SummonCreature(MOB_ENTRY_INN_PROTECTOR,2652.71,660.31,61.93,1.67,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_INN_LOOKOUT,2648.96,662.59,61.93,0.79,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2657.36,662.34,61.93,2.68,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + me->SummonCreature(MOB_ENTRY_INN_GUARDSMAN,2656.39,659.77,61.93,2.61,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,5000); + break; + case 94: + if (uint64 TarethaGUID = pInstance->GetData64(DATA_TARETHA)) + { + if (Unit* Taretha = Unit::GetUnit((*me), TarethaGUID)) + DoScriptText(SAY_TA_ESCAPED, Taretha, me); + } + break; + case 95: + DoScriptText(SAY_TH_MEET_TARETHA, me); + pInstance->SetData(TYPE_THRALL_PART3,DONE); + SetEscortPaused(true); + break; + case 96: + DoScriptText(SAY_TH_EPOCH_WONDER, me); + break; + case 97: + DoScriptText(SAY_TH_EPOCH_KILL_TARETHA, me); + SetRun(); + break; + case 98: + //trigger epoch Yell("Thrall! Come outside and face your fate! ....") + //from here, thrall should not never be allowed to move to point 106 which he currently does. + break; + + case 106: + { + //trigger taretha to run down outside + if (Creature* Taretha = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TARETHA))) + { + if (Player* pPlayer = GetPlayerForEscort()) + CAST_AI(npc_escortAI, (Taretha->AI()))->Start(false, true, pPlayer->GetGUID()); + } - if (!UpdateVictim()) - return; + //kill credit Creature for quest + Map* pMap = me->GetMap(); + Map::PlayerList const& players = pMap->GetPlayers(); + if (!players.isEmpty() && pMap->IsDungeon()) + { + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* pPlayer = itr->getSource()) + pPlayer->KilledMonsterCredit(20156,me->GetGUID()); + } + } - //TODO: add his abilities'n-crap here - if (!LowHp && ((me->GetHealth()*100 / me->GetMaxHealth()) < 20)) - { - DoScriptText(RAND(SAY_TH_RANDOM_LOW_HP1,SAY_TH_RANDOM_LOW_HP2), me); - LowHp = true; + //alot will happen here, thrall and taretha talk, erozion appear at spot to explain + me->SummonCreature(EROZION_ENTRY,2646.47,680.416,55.38,4.16,TEMPSUMMON_TIMED_DESPAWN,120000); + } + break; + case 108: + //last waypoint, just set Thrall invisible, respawn is turned off + me->SetVisibility(VISIBILITY_OFF); + break; } - } -}; + } -CreatureAI* GetAI_npc_thrall_old_hillsbrad(Creature* pCreature) -{ - return new npc_thrall_old_hillsbradAI(pCreature); -} + void Reset() + { + LowHp = false; -bool GossipHello_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - { - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SendPreparedQuest(pCreature->GetGUID()); - } + if (HadMount) + DoMount(); - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance) - { - if (pInstance->GetData(TYPE_BARREL_DIVERSION) == DONE && !pInstance->GetData(TYPE_THRALL_EVENT)) + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + { + DoUnmount(); + HadMount = false; + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, 0); + me->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID+1, 0); + me->SetDisplayId(THRALL_MODEL_UNEQUIPPED); + } + if (HasEscortState(STATE_ESCORT_ESCORTING)) + { + DoScriptText(RAND(SAY_TH_LEAVE_COMBAT1,SAY_TH_LEAVE_COMBAT2,SAY_TH_LEAVE_COMBAT3), me); + } + } + void StartWP() { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_WALKING, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START, pCreature->GetGUID()); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SetEscortPaused(false); } - - if (pInstance->GetData(TYPE_THRALL_PART1) == DONE && !pInstance->GetData(TYPE_THRALL_PART2)) + void DoMount() + { + me->Mount(SKARLOC_MOUNT_MODEL); + me->SetSpeed(MOVE_RUN,SPEED_MOUNT); + } + void DoUnmount() { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC1, pCreature->GetGUID()); + me->Unmount(); + me->SetSpeed(MOVE_RUN,SPEED_RUN); + } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(RAND(SAY_TH_RANDOM_AGGRO1,SAY_TH_RANDOM_AGGRO2,SAY_TH_RANDOM_AGGRO3,SAY_TH_RANDOM_AGGRO4), me); + if (me->IsMounted()) + { + DoUnmount(); + HadMount = true; + } } - if (pInstance->GetData(TYPE_THRALL_PART2) == DONE && !pInstance->GetData(TYPE_THRALL_PART3)) + void JustSummoned(Creature* summoned) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TARREN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_TARREN, pCreature->GetGUID()); + switch(summoned->GetEntry()) + { + //TODO: make Scarloc start into event instead, and not start attack directly + case MOB_ENTRY_BARN_GUARDSMAN: + case MOB_ENTRY_BARN_PROTECTOR: + case MOB_ENTRY_BARN_LOOKOUT: + case SKARLOC_MOUNT: + case EROZION_ENTRY: + break; + default: + summoned->AI()->AttackStart(me); + break; + } } - } - return true; -} -bool GossipSelect_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); + void KilledUnit(Unit * /*victim*/) + { + DoScriptText(RAND(SAY_TH_RANDOM_KILL1,SAY_TH_RANDOM_KILL2,SAY_TH_RANDOM_KILL3), me); + } + void JustDied(Unit *slayer) + { if (pInstance) - { - pInstance->SetData(TYPE_THRALL_EVENT,IN_PROGRESS); - pInstance->SetData(TYPE_THRALL_PART1,IN_PROGRESS); - } + pInstance->SetData(TYPE_THRALL_EVENT,FAIL); + + // Don't do a yell if he kills self (if player goes too far or at the end). + if (slayer == me) + return; - DoScriptText(SAY_TH_START_EVENT_PART1, pCreature); + DoScriptText(RAND(SAY_TH_RANDOM_DIE1,SAY_TH_RANDOM_DIE2), me); + } - if (npc_escortAI* pEscortAI = CAST_AI(npc_thrall_old_hillsbradAI, pCreature->AI())) - pEscortAI->Start(true, true, pPlayer->GetGUID()); + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetMaxPlayerDistance(100.0f);//not really needed, because it will not despawn if player is too far - CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); - break; + if (!UpdateVictim()) + return; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_SKARLOC2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+20); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC2, pCreature->GetGUID()); - break; + //TODO: add his abilities'n-crap here + if (!LowHp && ((me->GetHealth()*100 / me->GetMaxHealth()) < 20)) + { + DoScriptText(RAND(SAY_TH_RANDOM_LOW_HP1,SAY_TH_RANDOM_LOW_HP2), me); + LowHp = true; + } + } + }; - case GOSSIP_ACTION_INFO_DEF+20: - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_SKARLOC3, pCreature->GetGUID()); - pCreature->SummonCreature(SKARLOC_MOUNT,2038.81,270.26,63.20,5.41,TEMPSUMMON_TIMED_DESPAWN,12000); - if (pInstance) - pInstance->SetData(TYPE_THRALL_PART2,IN_PROGRESS); +}; - DoScriptText(SAY_TH_START_EVENT_PART2, pCreature); - CAST_AI(npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pInstance) - pInstance->SetData(TYPE_THRALL_PART3,IN_PROGRESS); - CAST_AI(npc_thrall_old_hillsbradAI, pCreature->AI())->StartWP(); - break; - } - return true; -} /*###### ## npc_taretha @@ -554,80 +570,89 @@ bool GossipSelect_npc_thrall_old_hillsbrad(Player* pPlayer, Creature* pCreature, #define GOSSIP_ITEM_EPOCH1 "Strange wizard?" #define GOSSIP_ID_EPOCH2 9613 //Yes, friends. This man was no wizard of #define GOSSIP_ITEM_EPOCH2 "We'll get you out. Taretha. Don't worry. I doubt the wizard would wander too far away." - -struct npc_tarethaAI : public npc_escortAI +
class npc_taretha : public CreatureScript { - npc_tarethaAI(Creature *c) : npc_escortAI(c) +public: + npc_taretha() : CreatureScript("npc_taretha") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new npc_tarethaAI(pCreature); } - ScriptedInstance *pInstance; - - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - switch(i) + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - case 6: - DoScriptText(SAY_TA_FREE, me); - break; - case 7: - me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); - break; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH2, pCreature->GetGUID()); } - } - void Reset() {} - void EnterCombat(Unit* /*who*/) {} + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); + if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) + { + pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS); + if (pInstance->GetData64(DATA_EPOCH) == 0) + pCreature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); + + if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) + { + Creature* Thrall = (Unit::GetCreature((*pCreature), ThrallGUID)); + if (Thrall) + CAST_AI(npc_thrall_old_hillsbrad::npc_thrall_old_hillsbradAI, Thrall->AI())->StartWP(); + } + } + } + return true; } -}; -CreatureAI* GetAI_npc_taretha(Creature* pCreature) -{ - return new npc_tarethaAI(pCreature); -} -bool GossipHello_npc_taretha(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (pInstance && pInstance->GetData(TYPE_THRALL_PART3) == DONE && pInstance->GetData(TYPE_THRALL_PART4) == NOT_STARTED) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH1, pCreature->GetGUID()); + InstanceScript* pInstance = pCreature->GetInstanceScript(); + if (pInstance && pInstance->GetData(TYPE_THRALL_PART3) == DONE && pInstance->GetData(TYPE_THRALL_PART4) == NOT_STARTED) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH1, pCreature->GetGUID()); + } + return true; } - return true; -} -bool GossipSelect_npc_taretha(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - ScriptedInstance* pInstance = pCreature->GetInstanceData(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + struct npc_tarethaAI : public npc_escortAI { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_EPOCH2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_EPOCH2, pCreature->GetGUID()); - } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pPlayer->CLOSE_GOSSIP_MENU(); + npc_tarethaAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; - if (pInstance && pInstance->GetData(TYPE_THRALL_EVENT) == IN_PROGRESS) + void WaypointReached(uint32 i) { - pInstance->SetData(TYPE_THRALL_PART4,IN_PROGRESS); - if (pInstance->GetData64(DATA_EPOCH) == 0) - pCreature->SummonCreature(ENTRY_EPOCH,2639.13,698.55,65.43,4.59,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,120000); + switch(i) + { + case 6: + DoScriptText(SAY_TA_FREE, me); + break; + case 7: + me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); + break; + } + } + void Reset() {} + void EnterCombat(Unit* /*who*/) {} - if (uint64 ThrallGUID = pInstance->GetData64(DATA_THRALL)) - { - Creature* Thrall = (Unit::GetCreature((*pCreature), ThrallGUID)); - if (Thrall) - CAST_AI(npc_thrall_old_hillsbradAI, Thrall->AI())->StartWP(); - } + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); } - } - return true; -} + }; + +}; + + /*###### ## AddSC @@ -635,26 +660,7 @@ bool GossipSelect_npc_taretha(Player* pPlayer, Creature* pCreature, uint32 /*uiS void AddSC_old_hillsbrad() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_erozion"; - newscript->pGossipHello = &GossipHello_npc_erozion; - newscript->pGossipSelect = &GossipSelect_npc_erozion; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thrall_old_hillsbrad"; - newscript->pGossipHello = &GossipHello_npc_thrall_old_hillsbrad; - newscript->pGossipSelect = &GossipSelect_npc_thrall_old_hillsbrad; - newscript->GetAI = &GetAI_npc_thrall_old_hillsbrad; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_taretha"; - newscript->pGossipHello = &GossipHello_npc_taretha; - newscript->pGossipSelect = &GossipSelect_npc_taretha; - newscript->GetAI = &GetAI_npc_taretha; - newscript->RegisterSelf(); + new npc_erozion(); + new npc_thrall_old_hillsbrad(); + new npc_taretha(); } - diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp index 61cd06f0f1c..47c8e18757b 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_celebras_the_cursed.cpp @@ -28,73 +28,75 @@ EndScriptData */ #define SPELL_WRATH 21807 #define SPELL_ENTANGLINGROOTS 12747 #define SPELL_CORRUPT_FORCES 21968 - -struct celebras_the_cursedAI : public ScriptedAI +
class celebras_the_cursed : public CreatureScript { - celebras_the_cursedAI(Creature *c) : ScriptedAI(c) {} - - uint32 Wrath_Timer; - uint32 EntanglingRoots_Timer; - uint32 CorruptForces_Timer; +public: + celebras_the_cursed() : CreatureScript("celebras_the_cursed") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Wrath_Timer = 8000; - EntanglingRoots_Timer = 2000; - CorruptForces_Timer = 30000; + return new celebras_the_cursedAI (pCreature); } - void EnterCombat(Unit * /*who*/) { } - - void JustDied(Unit* /*Killer*/) + struct celebras_the_cursedAI : public ScriptedAI { - me->SummonCreature(13716, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 600000); - } + celebras_the_cursedAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Wrath_Timer; + uint32 EntanglingRoots_Timer; + uint32 CorruptForces_Timer; - //Wrath - if (Wrath_Timer <= diff) + void Reset() { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - DoCast(pTarget, SPELL_WRATH); Wrath_Timer = 8000; - } else Wrath_Timer -= diff; + EntanglingRoots_Timer = 2000; + CorruptForces_Timer = 30000; + } + + void EnterCombat(Unit * /*who*/) { } - //EntanglingRoots - if (EntanglingRoots_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS); - EntanglingRoots_Timer = 20000; - } else EntanglingRoots_Timer -= diff; + me->SummonCreature(13716, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 600000); + } - //CorruptForces - if (CorruptForces_Timer <= diff) + void UpdateAI(const uint32 diff) { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_CORRUPT_FORCES); - CorruptForces_Timer = 20000; - } else CorruptForces_Timer -= diff; + if (!UpdateVictim()) + return; + + //Wrath + if (Wrath_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + DoCast(pTarget, SPELL_WRATH); + Wrath_Timer = 8000; + } else Wrath_Timer -= diff; + + //EntanglingRoots + if (EntanglingRoots_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ENTANGLINGROOTS); + EntanglingRoots_Timer = 20000; + } else EntanglingRoots_Timer -= diff; + + //CorruptForces + if (CorruptForces_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_CORRUPT_FORCES); + CorruptForces_Timer = 20000; + } else CorruptForces_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_celebras_the_cursed(Creature* pCreature) -{ - return new celebras_the_cursedAI (pCreature); -} void AddSC_boss_celebras_the_cursed() { - Script *newscript; - newscript = new Script; - newscript->Name = "celebras_the_cursed"; - newscript->GetAI = &GetAI_celebras_the_cursed; - newscript->RegisterSelf(); + new celebras_the_cursed(); } - diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp index b7d89607857..1f94c146eb4 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_landslide.cpp @@ -28,70 +28,72 @@ EndScriptData */ #define SPELL_KNOCKAWAY 18670 #define SPELL_TRAMPLE 5568 #define SPELL_LANDSLIDE 21808 - -struct boss_landslideAI : public ScriptedAI +
class boss_landslide : public CreatureScript { - boss_landslideAI(Creature *c) : ScriptedAI(c) {} - - uint32 KnockAway_Timer; - uint32 Trample_Timer; - uint32 Landslide_Timer; +public: + boss_landslide() : CreatureScript("boss_landslide") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - KnockAway_Timer = 8000; - Trample_Timer = 2000; - Landslide_Timer = 0; + return new boss_landslideAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_landslideAI : public ScriptedAI { - } + boss_landslideAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 KnockAway_Timer; + uint32 Trample_Timer; + uint32 Landslide_Timer; - //KnockAway_Timer - if (KnockAway_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_KNOCKAWAY); - KnockAway_Timer = 15000; - } else KnockAway_Timer -= diff; + KnockAway_Timer = 8000; + Trample_Timer = 2000; + Landslide_Timer = 0; + } - //Trample_Timer - if (Trample_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me, SPELL_TRAMPLE); - Trample_Timer = 8000; - } else Trample_Timer -= diff; + } - //Landslide - if (me->GetHealth()*100 / me->GetMaxHealth() < 50) + void UpdateAI(const uint32 diff) { - if (Landslide_Timer <= diff) + if (!UpdateVictim()) + return; + + //KnockAway_Timer + if (KnockAway_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKAWAY); + KnockAway_Timer = 15000; + } else KnockAway_Timer -= diff; + + //Trample_Timer + if (Trample_Timer <= diff) + { + DoCast(me, SPELL_TRAMPLE); + Trample_Timer = 8000; + } else Trample_Timer -= diff; + + //Landslide + if (me->GetHealth()*100 / me->GetMaxHealth() < 50) { - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_LANDSLIDE); - Landslide_Timer = 60000; - } else Landslide_Timer -= diff; + if (Landslide_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_LANDSLIDE); + Landslide_Timer = 60000; + } else Landslide_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_landslide(Creature* pCreature) -{ - return new boss_landslideAI (pCreature); -} void AddSC_boss_landslide() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_landslide"; - newscript->GetAI = &GetAI_boss_landslide; - newscript->RegisterSelf(); + new boss_landslide(); } - diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp index f2856e89fd1..c9b229b0c8b 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_noxxion.cpp @@ -27,107 +27,109 @@ EndScriptData */ #define SPELL_TOXICVOLLEY 21687 #define SPELL_UPPERCUT 22916 - -struct boss_noxxionAI : public ScriptedAI +
class boss_noxxion : public CreatureScript { - boss_noxxionAI(Creature *c) : ScriptedAI(c) {} - - uint32 ToxicVolley_Timer; - uint32 Uppercut_Timer; - uint32 Adds_Timer; - uint32 Invisible_Timer; - bool Invisible; +public: + boss_noxxion() : CreatureScript("boss_noxxion") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ToxicVolley_Timer = 7000; - Uppercut_Timer = 16000; - Adds_Timer = 19000; - Invisible_Timer = 15000; //Too much too low? - Invisible = false; + return new boss_noxxionAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_noxxionAI : public ScriptedAI { - } + boss_noxxionAI(Creature *c) : ScriptedAI(c) {} - void SummonAdds(Unit* pVictim) - { - if (Creature *Add = DoSpawnCreature(13456, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000)) - Add->AI()->AttackStart(pVictim); - } + uint32 ToxicVolley_Timer; + uint32 Uppercut_Timer; + uint32 Adds_Timer; + uint32 Invisible_Timer; + bool Invisible; - void UpdateAI(const uint32 diff) - { - if (Invisible && Invisible_Timer <= diff) + void Reset() { - //Become visible again - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - //Noxxion model - me->SetDisplayId(11172); + ToxicVolley_Timer = 7000; + Uppercut_Timer = 16000; + Adds_Timer = 19000; + Invisible_Timer = 15000; //Too much too low? Invisible = false; - //me->m_canMove = true; - } else if (Invisible) - { - Invisible_Timer -= diff; - //Do nothing while invisible - return; } - //Return since we have no target - if (!UpdateVictim()) - return; - - //ToxicVolley_Timer - if (ToxicVolley_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_TOXICVOLLEY); - ToxicVolley_Timer = 9000; - } else ToxicVolley_Timer -= diff; + } - //Uppercut_Timer - if (Uppercut_Timer <= diff) + void SummonAdds(Unit* pVictim) { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 12000; - } else Uppercut_Timer -= diff; + if (Creature *Add = DoSpawnCreature(13456, irand(-7,7), irand(-7,7), 0, 0, TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN, 90000)) + Add->AI()->AttackStart(pVictim); + } - //Adds_Timer - if (!Invisible && Adds_Timer <= diff) + void UpdateAI(const uint32 diff) { - //Interrupt any spell casting - //me->m_canMove = true; - me->InterruptNonMeleeSpells(false); - me->setFaction(35); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - // Invisible Model - me->SetDisplayId(11686); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - SummonAdds(me->getVictim()); - Invisible = true; - Invisible_Timer = 15000; - - Adds_Timer = 40000; - } else Adds_Timer -= diff; - - DoMeleeAttackIfReady(); - } + if (Invisible && Invisible_Timer <= diff) + { + //Become visible again + me->setFaction(14); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + //Noxxion model + me->SetDisplayId(11172); + Invisible = false; + //me->m_canMove = true; + } else if (Invisible) + { + Invisible_Timer -= diff; + //Do nothing while invisible + return; + } + + //Return since we have no target + if (!UpdateVictim()) + return; + + //ToxicVolley_Timer + if (ToxicVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TOXICVOLLEY); + ToxicVolley_Timer = 9000; + } else ToxicVolley_Timer -= diff; + + //Uppercut_Timer + if (Uppercut_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + Uppercut_Timer = 12000; + } else Uppercut_Timer -= diff; + + //Adds_Timer + if (!Invisible && Adds_Timer <= diff) + { + //Interrupt any spell casting + //me->m_canMove = true; + me->InterruptNonMeleeSpells(false); + me->setFaction(35); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + // Invisible Model + me->SetDisplayId(11686); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + SummonAdds(me->getVictim()); + Invisible = true; + Invisible_Timer = 15000; + + Adds_Timer = 40000; + } else Adds_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_noxxion(Creature* pCreature) -{ - return new boss_noxxionAI (pCreature); -} void AddSC_boss_noxxion() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_noxxion"; - newscript->GetAI = &GetAI_boss_noxxion; - newscript->RegisterSelf(); + new boss_noxxion(); } - diff --git a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp index 9bd8735f4d2..e8c96242c21 100644 --- a/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/boss_princess_theradras.cpp @@ -29,83 +29,85 @@ EndScriptData */ #define SPELL_BOULDER 21832 #define SPELL_THRASH 3391 #define SPELL_REPULSIVEGAZE 21869 - -struct boss_ptheradrasAI : public ScriptedAI +
class boss_princess_theradras : public CreatureScript { - boss_ptheradrasAI(Creature *c) : ScriptedAI(c) {} - - uint32 Dustfield_Timer; - uint32 Boulder_Timer; - uint32 Thrash_Timer; - uint32 RepulsiveGaze_Timer; - - void Reset() - { - Dustfield_Timer = 8000; - Boulder_Timer = 2000; - Thrash_Timer = 5000; - RepulsiveGaze_Timer = 23000; - } +public: + boss_princess_theradras() : CreatureScript("boss_princess_theradras") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { + return new boss_ptheradrasAI (pCreature); } - void JustDied(Unit* /*killer*/) + struct boss_ptheradrasAI : public ScriptedAI { - me->SummonCreature(12238,28.067,61.875,-123.405,4.67,TEMPSUMMON_TIMED_DESPAWN,600000); - } + boss_ptheradrasAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + uint32 Dustfield_Timer; + uint32 Boulder_Timer; + uint32 Thrash_Timer; + uint32 RepulsiveGaze_Timer; - //Dustfield_Timer - if (Dustfield_Timer <= diff) + void Reset() { - DoCast(me, SPELL_DUSTFIELD); - Dustfield_Timer = 14000; - } else Dustfield_Timer -= diff; + Dustfield_Timer = 8000; + Boulder_Timer = 2000; + Thrash_Timer = 5000; + RepulsiveGaze_Timer = 23000; + } - //Boulder_Timer - if (Boulder_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - DoCast(pTarget, SPELL_BOULDER); - Boulder_Timer = 10000; - } else Boulder_Timer -= diff; - - //RepulsiveGaze_Timer - if (RepulsiveGaze_Timer <= diff) + } + + void JustDied(Unit* /*killer*/) { - DoCast(me->getVictim(), SPELL_REPULSIVEGAZE); - RepulsiveGaze_Timer = 20000; - } else RepulsiveGaze_Timer -= diff; + me->SummonCreature(12238,28.067,61.875,-123.405,4.67,TEMPSUMMON_TIMED_DESPAWN,600000); + } - //Thrash_Timer - if (Thrash_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_THRASH); - Thrash_Timer = 18000; - } else Thrash_Timer -= diff; + if (!UpdateVictim()) + return; + + //Dustfield_Timer + if (Dustfield_Timer <= diff) + { + DoCast(me, SPELL_DUSTFIELD); + Dustfield_Timer = 14000; + } else Dustfield_Timer -= diff; + + //Boulder_Timer + if (Boulder_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + DoCast(pTarget, SPELL_BOULDER); + Boulder_Timer = 10000; + } else Boulder_Timer -= diff; + + //RepulsiveGaze_Timer + if (RepulsiveGaze_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_REPULSIVEGAZE); + RepulsiveGaze_Timer = 20000; + } else RepulsiveGaze_Timer -= diff; + + //Thrash_Timer + if (Thrash_Timer <= diff) + { + DoCast(me, SPELL_THRASH); + Thrash_Timer = 18000; + } else Thrash_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ptheradras(Creature* pCreature) -{ - return new boss_ptheradrasAI (pCreature); -} void AddSC_boss_ptheradras() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_princess_theradras"; - newscript->GetAI = &GetAI_boss_ptheradras; - newscript->RegisterSelf(); + new boss_princess_theradras(); } - diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp index b346f848510..a78997410dc 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/boss_onyxia.cpp @@ -98,404 +98,406 @@ static Position aSpawnLocations[3]= //Lair Guard {-145.950, -212.831, -68.659} }; - -struct boss_onyxiaAI : public ScriptedAI +
class boss_onyxia : public CreatureScript { - boss_onyxiaAI(Creature* pCreature) : ScriptedAI(pCreature), Summons(me) +public: + boss_onyxia() : CreatureScript("boss_onyxia") { } + + CreatureAI* GetAI(Creature* pCreature) const { - m_pInstance = pCreature->GetInstanceData(); - Reset(); + return new boss_onyxiaAI (pCreature); } - ScriptedInstance* m_pInstance; - SummonList Summons; + struct boss_onyxiaAI : public ScriptedAI + { + boss_onyxiaAI(Creature* pCreature) : ScriptedAI(pCreature), Summons(me) + { + m_pInstance = pCreature->GetInstanceScript(); + Reset(); + } - uint32 m_uiPhase; + InstanceScript* m_pInstance; + SummonList Summons; - uint32 m_uiFlameBreathTimer; - uint32 m_uiCleaveTimer; - uint32 m_uiTailSweepTimer; - uint32 m_uiWingBuffetTimer; + uint32 m_uiPhase; - uint32 m_uiMovePoint; - uint32 m_uiMovementTimer; - sOnyxMove* m_pPointData; + uint32 m_uiFlameBreathTimer; + uint32 m_uiCleaveTimer; + uint32 m_uiTailSweepTimer; + uint32 m_uiWingBuffetTimer; - uint32 m_uiFireballTimer; - uint32 m_uiWhelpTimer; - uint32 m_uiLairGuardTimer; - uint32 m_uiDeepBreathTimer; + uint32 m_uiMovePoint; + uint32 m_uiMovementTimer; + sOnyxMove* m_pPointData; - uint32 m_uiBellowingRoarTimer; + uint32 m_uiFireballTimer; + uint32 m_uiWhelpTimer; + uint32 m_uiLairGuardTimer; + uint32 m_uiDeepBreathTimer; - uint8 m_uiSummonWhelpCount; - uint8 m_uiSummonLairGuardCount; - bool m_bIsMoving; - - void Reset() - { - if (!IsCombatMovement()) - SetCombatMovement(true); + uint32 m_uiBellowingRoarTimer; - m_uiPhase = PHASE_START; + uint8 m_uiSummonWhelpCount; + uint8 m_uiSummonLairGuardCount; + bool m_bIsMoving; + + void Reset() + { + if (!IsCombatMovement()) + SetCombatMovement(true); - m_uiFlameBreathTimer = urand(10000, 20000); - m_uiTailSweepTimer = urand(15000, 20000); - m_uiCleaveTimer = urand(2000, 5000); - m_uiWingBuffetTimer = urand(10000, 20000); + m_uiPhase = PHASE_START; - m_uiMovePoint = urand(0, 5); - m_uiMovementTimer = 20000; - m_pPointData = GetMoveData(); + m_uiFlameBreathTimer = urand(10000, 20000); + m_uiTailSweepTimer = urand(15000, 20000); + m_uiCleaveTimer = urand(2000, 5000); + m_uiWingBuffetTimer = urand(10000, 20000); - m_uiFireballTimer = 15000; - m_uiWhelpTimer = 1000; - m_uiLairGuardTimer = 15000; - m_uiDeepBreathTimer = 85000; + m_uiMovePoint = urand(0, 5); + m_uiMovementTimer = 20000; + m_pPointData = GetMoveData(); - m_uiBellowingRoarTimer = 30000; + m_uiFireballTimer = 15000; + m_uiWhelpTimer = 1000; + m_uiLairGuardTimer = 15000; + m_uiDeepBreathTimer = 85000; - Summons.DespawnAll(); - m_uiSummonWhelpCount = 0; - m_uiSummonLairGuardCount = 0; - m_bIsMoving = false; - - if (m_pInstance) - { - m_pInstance->SetData(DATA_ONYXIA, NOT_STARTED); - m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); - m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + m_uiBellowingRoarTimer = 30000; + + Summons.DespawnAll(); + m_uiSummonWhelpCount = 0; + m_uiSummonLairGuardCount = 0; + m_bIsMoving = false; + + if (m_pInstance) + { + m_pInstance->SetData(DATA_ONYXIA, NOT_STARTED); + m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } } - } - void EnterCombat(Unit* pWho) - { - DoScriptText(SAY_AGGRO, me); - me->SetInCombatWithZone(); - - if (m_pInstance) + void EnterCombat(Unit* pWho) { - m_pInstance->SetData(DATA_ONYXIA, IN_PROGRESS); - m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); - sLog.outBasic("[Onyxia] DoStartTimedAchievement(%u,%u)",ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + DoScriptText(SAY_AGGRO, me); + me->SetInCombatWithZone(); + + if (m_pInstance) + { + m_pInstance->SetData(DATA_ONYXIA, IN_PROGRESS); + m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + sLog.outBasic("[Onyxia] DoStartTimedAchievement(%u,%u)",ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); + } } - } - void JustDied(Unit* killer) - { - if (m_pInstance) - m_pInstance->SetData(DATA_ONYXIA, DONE); + void JustDied(Unit* killer) + { + if (m_pInstance) + m_pInstance->SetData(DATA_ONYXIA, DONE); - Summons.DespawnAll(); - } + Summons.DespawnAll(); + } - void JustSummoned(Creature *pSummoned) - { - pSummoned->SetInCombatWithZone(); - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - pSummoned->AI()->AttackStart(pTarget); - - switch (pSummoned->GetEntry()) + void JustSummoned(Creature *pSummoned) { - case NPC_WHELP: - ++m_uiSummonWhelpCount; - break; - case NPC_LAIRGUARD: - pSummoned->setActive(true); - ++m_uiSummonLairGuardCount; - break; + pSummoned->SetInCombatWithZone(); + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + pSummoned->AI()->AttackStart(pTarget); + + switch (pSummoned->GetEntry()) + { + case NPC_WHELP: + ++m_uiSummonWhelpCount; + break; + case NPC_LAIRGUARD: + pSummoned->setActive(true); + ++m_uiSummonLairGuardCount; + break; + } + Summons.Summon(pSummoned); } - Summons.Summon(pSummoned); - } - void SummonedCreatureDespawn(Creature *summon) - { - Summons.Despawn(summon); - } + void SummonedCreatureDespawn(Creature *summon) + { + Summons.Despawn(summon); + } - void KilledUnit(Unit* pVictim) - { - DoScriptText(SAY_KILL, me); - } + void KilledUnit(Unit* pVictim) + { + DoScriptText(SAY_KILL, me); + } - void SpellHit(Unit *pCaster, const SpellEntry* pSpell) - { - if (pSpell->Id == SPELL_BREATH_EAST_TO_WEST || - pSpell->Id == SPELL_BREATH_WEST_TO_EAST || - pSpell->Id == SPELL_BREATH_SE_TO_NW || - pSpell->Id == SPELL_BREATH_NW_TO_SE || - pSpell->Id == SPELL_BREATH_SW_TO_NE || - pSpell->Id == SPELL_BREATH_NE_TO_SW) + void SpellHit(Unit *pCaster, const SpellEntry* pSpell) { - m_pPointData = GetMoveData(); - m_uiMovePoint = m_pPointData->uiLocIdEnd; + if (pSpell->Id == SPELL_BREATH_EAST_TO_WEST || + pSpell->Id == SPELL_BREATH_WEST_TO_EAST || + pSpell->Id == SPELL_BREATH_SE_TO_NW || + pSpell->Id == SPELL_BREATH_NW_TO_SE || + pSpell->Id == SPELL_BREATH_SW_TO_NE || + pSpell->Id == SPELL_BREATH_NE_TO_SW) + { + m_pPointData = GetMoveData(); + m_uiMovePoint = m_pPointData->uiLocIdEnd; - me->SetSpeed(MOVE_FLIGHT, 1.5f); - me->GetMotionMaster()->MovePoint(8, MiddleRoomLocation); + me->SetSpeed(MOVE_FLIGHT, 1.5f); + me->GetMotionMaster()->MovePoint(8, MiddleRoomLocation); + } } - } - void MovementInform(uint32 type, uint32 id) - { - if (type == POINT_MOTION_TYPE) + void MovementInform(uint32 type, uint32 id) { - switch (id) + if (type == POINT_MOTION_TYPE) { - case 8: - m_pPointData = GetMoveData(); - if (m_pPointData) - { - me->SetSpeed(MOVE_FLIGHT, 1.0f); - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); - } - break; - case 9: - me->GetMotionMaster()->MoveChase(me->getVictim()); - m_uiBellowingRoarTimer = 1000; - break; - default: - m_bIsMoving = false; - break; - } + switch (id) + { + case 8: + m_pPointData = GetMoveData(); + if (m_pPointData) + { + me->SetSpeed(MOVE_FLIGHT, 1.0f); + me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + } + break; + case 9: + me->GetMotionMaster()->MoveChase(me->getVictim()); + m_uiBellowingRoarTimer = 1000; + break; + default: + m_bIsMoving = false; + break; + } + } } - } - - void SpellHitTarget(Unit* target, const SpellEntry* pSpell) - { - //Workaround - Couldn't find a way to group this spells (All Eruption) - if (((pSpell->Id >= 17086 && pSpell->Id <= 17095) || - (pSpell->Id == 17097) || - (pSpell->Id >= 18351 && pSpell->Id <= 18361) || - (pSpell->Id >= 18564 && pSpell->Id <= 18576) || - (pSpell->Id >= 18578 && pSpell->Id <= 18607) || - (pSpell->Id == 18609) || - (pSpell->Id >= 18611 && pSpell->Id <= 18628) || - (pSpell->Id >= 21132 && pSpell->Id <= 21133) || - (pSpell->Id >= 21135 && pSpell->Id <= 21139) || - (pSpell->Id >= 22191 && pSpell->Id <= 22202) || - (pSpell->Id >= 22267 && pSpell->Id <= 22268)) && - (target->GetTypeId() == TYPEID_PLAYER)) + + void SpellHitTarget(Unit* target, const SpellEntry* pSpell) { - if (m_pInstance) + //Workaround - Couldn't find a way to group this spells (All Eruption) + if (((pSpell->Id >= 17086 && pSpell->Id <= 17095) || + (pSpell->Id == 17097) || + (pSpell->Id >= 18351 && pSpell->Id <= 18361) || + (pSpell->Id >= 18564 && pSpell->Id <= 18576) || + (pSpell->Id >= 18578 && pSpell->Id <= 18607) || + (pSpell->Id == 18609) || + (pSpell->Id >= 18611 && pSpell->Id <= 18628) || + (pSpell->Id >= 21132 && pSpell->Id <= 21133) || + (pSpell->Id >= 21135 && pSpell->Id <= 21139) || + (pSpell->Id >= 22191 && pSpell->Id <= 22202) || + (pSpell->Id >= 22267 && pSpell->Id <= 22268)) && + (target->GetTypeId() == TYPEID_PLAYER)) { - m_pInstance->SetData(DATA_SHE_DEEP_BREATH_MORE, FAIL); + if (m_pInstance) + { + m_pInstance->SetData(DATA_SHE_DEEP_BREATH_MORE, FAIL); + } } } - } - - sOnyxMove* GetMoveData() - { - uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); - for (uint32 i = 0; i < uiMaxCount; ++i) + sOnyxMove* GetMoveData() { - if (aMoveData[i].uiLocId == m_uiMovePoint) - return &aMoveData[i]; - } + uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); - return NULL; - } + for (uint32 i = 0; i < uiMaxCount; ++i) + { + if (aMoveData[i].uiLocId == m_uiMovePoint) + return &aMoveData[i]; + } - void SetNextRandomPoint() - { - uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); + return NULL; + } - int iTemp = rand()%(uiMaxCount-1); + void SetNextRandomPoint() + { + uint32 uiMaxCount = sizeof(aMoveData)/sizeof(sOnyxMove); - if (iTemp >= m_uiMovePoint) - ++iTemp; + int iTemp = rand()%(uiMaxCount-1); - m_uiMovePoint = iTemp; - } + if (iTemp >= m_uiMovePoint) + ++iTemp; - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + m_uiMovePoint = iTemp; + } - //Common to PHASE_START && PHASE_END - if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END) + void UpdateAI(const uint32 uiDiff) { - //Specific to PHASE_START || PHASE_END - if (m_uiPhase == PHASE_START) + if (!UpdateVictim()) + return; + + //Common to PHASE_START && PHASE_END + if (m_uiPhase == PHASE_START || m_uiPhase == PHASE_END) { - if (me->GetHealth()*100 / me->GetMaxHealth() < 60) + //Specific to PHASE_START || PHASE_END + if (m_uiPhase == PHASE_START) { - m_uiPhase = PHASE_BREATH; - - if (m_pInstance) - m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + if (me->GetHealth()*100 / me->GetMaxHealth() < 60) + { + m_uiPhase = PHASE_BREATH; + + if (m_pInstance) + m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); - SetCombatMovement(false); - me->GetMotionMaster()->Clear(false); - me->GetMotionMaster()->MoveIdle(); - me->SetFlying(true); + SetCombatMovement(false); + me->GetMotionMaster()->Clear(false); + me->GetMotionMaster()->MoveIdle(); + me->SetFlying(true); - DoScriptText(SAY_PHASE_2_TRANS, me); + DoScriptText(SAY_PHASE_2_TRANS, me); - if (m_pPointData) - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + if (m_pPointData) + me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); - m_uiWhelpTimer = 1000; - return; + m_uiWhelpTimer = 1000; + return; + } } - } - else - { - if (m_uiBellowingRoarTimer <= uiDiff) + else { - DoCastVictim(SPELL_BELLOWING_ROAR); - // Eruption - GameObject* pFloor = NULL; - Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15); - Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, pFloor, check); - me->VisitNearbyGridObject(30, searcher); - if (m_pInstance && pFloor) - m_pInstance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID()); - m_uiBellowingRoarTimer = 30000; + if (m_uiBellowingRoarTimer <= uiDiff) + { + DoCastVictim(SPELL_BELLOWING_ROAR); + // Eruption + GameObject* pFloor = NULL; + Trinity::GameObjectInRangeCheck check(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), 15); + Trinity::GameObjectLastSearcher<Trinity::GameObjectInRangeCheck> searcher(me, pFloor, check); + me->VisitNearbyGridObject(30, searcher); + if (m_pInstance && pFloor) + m_pInstance->SetData64(DATA_FLOOR_ERUPTION_GUID, pFloor->GetGUID()); + m_uiBellowingRoarTimer = 30000; + } + else + m_uiBellowingRoarTimer -= uiDiff; + } + + if (m_uiFlameBreathTimer <= uiDiff) + { + DoCastVictim(SPELL_FLAME_BREATH); + m_uiFlameBreathTimer = urand(10000, 20000); } else - m_uiBellowingRoarTimer -= uiDiff; - } + m_uiFlameBreathTimer -= uiDiff; - if (m_uiFlameBreathTimer <= uiDiff) - { - DoCastVictim(SPELL_FLAME_BREATH); - m_uiFlameBreathTimer = urand(10000, 20000); - } - else - m_uiFlameBreathTimer -= uiDiff; + if (m_uiTailSweepTimer <= uiDiff) + { + DoCastAOE(SPELL_TAIL_SWEEP); + m_uiTailSweepTimer = urand(15000, 20000); + } + else + m_uiTailSweepTimer -= uiDiff; - if (m_uiTailSweepTimer <= uiDiff) - { - DoCastAOE(SPELL_TAIL_SWEEP); - m_uiTailSweepTimer = urand(15000, 20000); - } - else - m_uiTailSweepTimer -= uiDiff; + if (m_uiCleaveTimer <= uiDiff) + { + DoCastVictim(SPELL_CLEAVE); + m_uiCleaveTimer = urand(2000, 5000); + } + else + m_uiCleaveTimer -= uiDiff; - if (m_uiCleaveTimer <= uiDiff) - { - DoCastVictim(SPELL_CLEAVE); - m_uiCleaveTimer = urand(2000, 5000); - } - else - m_uiCleaveTimer -= uiDiff; + if (m_uiWingBuffetTimer <= uiDiff) + { + DoCastVictim(SPELL_WING_BUFFET); + m_uiWingBuffetTimer = urand(15000, 30000); + } + else + m_uiWingBuffetTimer -= uiDiff; - if (m_uiWingBuffetTimer <= uiDiff) - { - DoCastVictim(SPELL_WING_BUFFET); - m_uiWingBuffetTimer = urand(15000, 30000); + DoMeleeAttackIfReady(); } else - m_uiWingBuffetTimer -= uiDiff; - - DoMeleeAttackIfReady(); - } - else - { - if (me->GetHealth()*100 / me->GetMaxHealth() < 40) { - m_uiPhase = PHASE_END; - if (m_pInstance) - m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); - DoScriptText(SAY_PHASE_3_TRANS, me); + if (me->GetHealth()*100 / me->GetMaxHealth() < 40) + { + m_uiPhase = PHASE_END; + if (m_pInstance) + m_pInstance->SetData(DATA_ONYXIA_PHASE, m_uiPhase); + DoScriptText(SAY_PHASE_3_TRANS, me); - SetCombatMovement(true); - me->SetFlying(false); - m_bIsMoving = false; - me->GetMotionMaster()->MovePoint(9,me->GetHomePosition()); - return; - } + SetCombatMovement(true); + me->SetFlying(false); + m_bIsMoving = false; + me->GetMotionMaster()->MovePoint(9,me->GetHomePosition()); + return; + } - if (m_uiDeepBreathTimer <= uiDiff) - { - if (!m_bIsMoving) + if (m_uiDeepBreathTimer <= uiDiff) { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(false); + if (!m_bIsMoving) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(false); - DoScriptText(EMOTE_BREATH, me); - DoCast(me, m_pPointData->uiSpellId); - m_uiDeepBreathTimer = 70000; + DoScriptText(EMOTE_BREATH, me); + DoCast(me, m_pPointData->uiSpellId); + m_uiDeepBreathTimer = 70000; + } } - } - else - m_uiDeepBreathTimer -= uiDiff; + else + m_uiDeepBreathTimer -= uiDiff; - if (m_uiMovementTimer <= uiDiff) - { - if (!m_bIsMoving) + if (m_uiMovementTimer <= uiDiff) { - SetNextRandomPoint(); - m_pPointData = GetMoveData(); + if (!m_bIsMoving) + { + SetNextRandomPoint(); + m_pPointData = GetMoveData(); - if (!m_pPointData) - return; + if (!m_pPointData) + return; - me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); - m_bIsMoving = true; - m_uiMovementTimer = 25000; + me->GetMotionMaster()->MovePoint(m_pPointData->uiLocId, m_pPointData->fX, m_pPointData->fY, m_pPointData->fZ); + m_bIsMoving = true; + m_uiMovementTimer = 25000; + } } - } - else - m_uiMovementTimer -= uiDiff; + else + m_uiMovementTimer -= uiDiff; - if (m_uiFireballTimer <= uiDiff) - { - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) + if (m_uiFireballTimer <= uiDiff) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) - DoCast(pTarget, SPELL_FIREBALL); + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() != POINT_MOTION_TYPE) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0)) + DoCast(pTarget, SPELL_FIREBALL); - m_uiFireballTimer = 8000; + m_uiFireballTimer = 8000; + } } - } - else - m_uiFireballTimer -= uiDiff; + else + m_uiFireballTimer -= uiDiff; - if (m_uiLairGuardTimer <= uiDiff) - { - me->SummonCreature(NPC_LAIRGUARD, aSpawnLocations[2].GetPositionX(), aSpawnLocations[2].GetPositionY(), aSpawnLocations[2].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - if (m_uiSummonLairGuardCount >= RAID_MODE(1,2)) + if (m_uiLairGuardTimer <= uiDiff) { - m_uiSummonLairGuardCount = 0; - m_uiLairGuardTimer = 30000; + me->SummonCreature(NPC_LAIRGUARD, aSpawnLocations[2].GetPositionX(), aSpawnLocations[2].GetPositionY(), aSpawnLocations[2].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); + if (m_uiSummonLairGuardCount >= RAID_MODE(1,2)) + { + m_uiSummonLairGuardCount = 0; + m_uiLairGuardTimer = 30000; + } + else + m_uiLairGuardTimer = 2000; } else - m_uiLairGuardTimer = 2000; - } - else - m_uiLairGuardTimer -= uiDiff; + m_uiLairGuardTimer -= uiDiff; - if (m_uiWhelpTimer <= uiDiff) - { - me->SummonCreature(NPC_WHELP, aSpawnLocations[0].GetPositionX(), aSpawnLocations[0].GetPositionY(), aSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - me->SummonCreature(NPC_WHELP, aSpawnLocations[1].GetPositionX(), aSpawnLocations[1].GetPositionY(), aSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); - if (m_uiSummonWhelpCount >= RAID_MODE(20,40)) + if (m_uiWhelpTimer <= uiDiff) { - m_uiSummonWhelpCount = 0; - m_uiWhelpTimer = 90000; - } + me->SummonCreature(NPC_WHELP, aSpawnLocations[0].GetPositionX(), aSpawnLocations[0].GetPositionY(), aSpawnLocations[0].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); + me->SummonCreature(NPC_WHELP, aSpawnLocations[1].GetPositionX(), aSpawnLocations[1].GetPositionY(), aSpawnLocations[1].GetPositionZ(), 0.0f, TEMPSUMMON_CORPSE_DESPAWN); + if (m_uiSummonWhelpCount >= RAID_MODE(20,40)) + { + m_uiSummonWhelpCount = 0; + m_uiWhelpTimer = 90000; + } + else + m_uiWhelpTimer = 500; + } else - m_uiWhelpTimer = 500; + m_uiWhelpTimer -= uiDiff; } - else - m_uiWhelpTimer -= uiDiff; } - } -}; + }; -CreatureAI* GetAI_boss_onyxiaAI(Creature* pCreature) -{ - return new boss_onyxiaAI (pCreature); -} +}; void AddSC_boss_onyxia() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_onyxia"; - newscript->GetAI = &GetAI_boss_onyxiaAI; - newscript->RegisterSelf(); + new boss_onyxia(); } diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 36a2712fe6d..7aebe80247c 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -24,227 +24,230 @@ EndScriptData */ #include "ScriptPCH.h" #include "onyxias_lair.h" - -struct instance_onyxias_lair : public ScriptedInstance +
class instance_onyxias_lair : public InstanceMapScript { - instance_onyxias_lair(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - //Eruption is a BFS graph problem - //One map to remember all floor, one map to keep floor that still need to erupt and one queue to know what needs to be removed - std::map<uint64,uint32> FloorEruptionGUID[2]; - std::queue<uint64> FloorEruptionGUIDQueue; - - uint64 m_uiOnyxiasGUID; - uint32 m_uiOnyxiaLiftoffTimer; - uint32 m_uiManyWhelpsCounter; - uint32 m_uiEruptTimer; +public: + instance_onyxias_lair() : InstanceMapScript("instance_onyxias_lair") { } - uint8 m_auiEncounter[MAX_ENCOUNTER]; - - bool m_bAchievManyWhelpsHandleIt; - bool m_bAchievSheDeepBreathMore; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_onyxias_lair_InstanceMapScript(pMap); + } - void Initialize() + struct instance_onyxias_lair_InstanceMapScript : public InstanceScript { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + instance_onyxias_lair_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - m_uiOnyxiasGUID = 0; - m_uiOnyxiaLiftoffTimer = 0; - m_uiManyWhelpsCounter = 0; - m_bAchievManyWhelpsHandleIt = false; - m_bAchievSheDeepBreathMore = true; + //Eruption is a BFS graph problem + //One map to remember all floor, one map to keep floor that still need to erupt and one queue to know what needs to be removed + std::map<uint64,uint32> FloorEruptionGUID[2]; + std::queue<uint64> FloorEruptionGUIDQueue; + + uint64 m_uiOnyxiasGUID; + uint32 m_uiOnyxiaLiftoffTimer; + uint32 m_uiManyWhelpsCounter; + uint32 m_uiEruptTimer; - m_uiEruptTimer = 0; - } + uint8 m_auiEncounter[MAX_ENCOUNTER]; - void OnCreatureCreate(Creature* pCreature, bool add) - { - switch (pCreature->GetEntry()) - { - case NPC_ONYXIA: - m_uiOnyxiasGUID = pCreature->GetGUID(); - break; - } - } + bool m_bAchievManyWhelpsHandleIt; + bool m_bAchievSheDeepBreathMore; - void OnGameObjectCreate(GameObject* pGo, bool add) - { - if ((pGo->GetGOInfo()->displayId == 4392 || pGo->GetGOInfo()->displayId == 4472) && pGo->GetGOInfo()->trap.spellId == 17731) + void Initialize() { - if (add) - FloorEruptionGUID[0].insert(std::make_pair(pGo->GetGUID(),0)); - else - FloorEruptionGUID[0].erase(pGo->GetGUID()); - return; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + m_uiOnyxiasGUID = 0; + m_uiOnyxiaLiftoffTimer = 0; + m_uiManyWhelpsCounter = 0; + m_bAchievManyWhelpsHandleIt = false; + m_bAchievSheDeepBreathMore = true; + + m_uiEruptTimer = 0; } - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool add) { - case GO_WHELP_SPAWNER: - Position pGoPos; - pGo->GetPosition(&pGoPos); - if (Creature* pTemp = pGo->SummonCreature(NPC_WHELP,pGoPos,TEMPSUMMON_CORPSE_DESPAWN)) - { - pTemp->SetInCombatWithZone(); - ++m_uiManyWhelpsCounter; - } - break; + switch (pCreature->GetEntry()) + { + case NPC_ONYXIA: + m_uiOnyxiasGUID = pCreature->GetGUID(); + break; + } } - } - void FloorEruption(uint64 floorEruptedGUID) - { - if (GameObject *pFloorEruption = instance->GetGameObject(floorEruptedGUID)) + void OnGameObjectCreate(GameObject* pGo, bool add) { - //THIS GOB IS A TRAP - What shall i do? =( - //Cast it spell? Copyed Heigan method - pFloorEruption->SendCustomAnim(); - pFloorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId - - //Get all immediatly nearby floors - std::list<GameObject*> nearFloorList; - Trinity::GameObjectInRangeCheck check(pFloorEruption->GetPositionX(), pFloorEruption->GetPositionY(), pFloorEruption->GetPositionZ(), 15); - Trinity::GameObjectListSearcher<Trinity::GameObjectInRangeCheck> searcher(pFloorEruption, nearFloorList, check); - pFloorEruption->VisitNearbyGridObject(999, searcher); - //remove all that are not present on FloorEruptionGUID[1] and update treeLen on each GUID - for (std::list<GameObject*>::const_iterator itr = nearFloorList.begin(); itr != nearFloorList.end(); ++itr) + if ((pGo->GetGOInfo()->displayId == 4392 || pGo->GetGOInfo()->displayId == 4472) && pGo->GetGOInfo()->trap.spellId == 17731) { - if (((*itr)->GetGOInfo()->displayId == 4392 || (*itr)->GetGOInfo()->displayId == 4472) && (*itr)->GetGOInfo()->trap.spellId == 17731) - { - uint64 nearFloorGUID = (*itr)->GetGUID(); - if (FloorEruptionGUID[1].find(nearFloorGUID) != FloorEruptionGUID[1].end() && (*FloorEruptionGUID[1].find(nearFloorGUID)).second == 0) + if (add) + FloorEruptionGUID[0].insert(std::make_pair(pGo->GetGUID(),0)); + else + FloorEruptionGUID[0].erase(pGo->GetGUID()); + return; + } + + switch(pGo->GetEntry()) + { + case GO_WHELP_SPAWNER: + Position pGoPos; + pGo->GetPosition(&pGoPos); + if (Creature* pTemp = pGo->SummonCreature(NPC_WHELP,pGoPos,TEMPSUMMON_CORPSE_DESPAWN)) { - (*FloorEruptionGUID[1].find(nearFloorGUID)).second = (*FloorEruptionGUID[1].find(floorEruptedGUID)).second+1; - FloorEruptionGUIDQueue.push(nearFloorGUID); + pTemp->SetInCombatWithZone(); + ++m_uiManyWhelpsCounter; } - } + break; } } - FloorEruptionGUID[1].erase(floorEruptedGUID); - } - void SetData(uint32 uiType, uint32 uiData) - { - switch(uiType) + void FloorEruption(uint64 floorEruptedGUID) { - case DATA_ONYXIA: - m_auiEncounter[0] = uiData; - if (uiData == IN_PROGRESS) - SetData(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS); - break; - case DATA_ONYXIA_PHASE: - if (uiData == PHASE_BREATH) //Used to mark the liftoff phase - { - m_bAchievManyWhelpsHandleIt = false; - m_uiManyWhelpsCounter = 0; - m_uiOnyxiaLiftoffTimer = 10*IN_MILLISECONDS; - } - break; - case DATA_SHE_DEEP_BREATH_MORE: - if (uiData == IN_PROGRESS) - { - m_bAchievSheDeepBreathMore = true; - } - else if (uiData == FAIL) + if (GameObject *pFloorEruption = instance->GetGameObject(floorEruptedGUID)) + { + //THIS GOB IS A TRAP - What shall i do? =( + //Cast it spell? Copyed Heigan method + pFloorEruption->SendCustomAnim(); + pFloorEruption->CastSpell(NULL, Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL ? 17731 : 69294); //pFloorEruption->GetGOInfo()->trap.spellId + + //Get all immediatly nearby floors + std::list<GameObject*> nearFloorList; + Trinity::GameObjectInRangeCheck check(pFloorEruption->GetPositionX(), pFloorEruption->GetPositionY(), pFloorEruption->GetPositionZ(), 15); + Trinity::GameObjectListSearcher<Trinity::GameObjectInRangeCheck> searcher(pFloorEruption, nearFloorList, check); + pFloorEruption->VisitNearbyGridObject(999, searcher); + //remove all that are not present on FloorEruptionGUID[1] and update treeLen on each GUID + for (std::list<GameObject*>::const_iterator itr = nearFloorList.begin(); itr != nearFloorList.end(); ++itr) { - m_bAchievSheDeepBreathMore = false; + if (((*itr)->GetGOInfo()->displayId == 4392 || (*itr)->GetGOInfo()->displayId == 4472) && (*itr)->GetGOInfo()->trap.spellId == 17731) + { + uint64 nearFloorGUID = (*itr)->GetGUID(); + if (FloorEruptionGUID[1].find(nearFloorGUID) != FloorEruptionGUID[1].end() && (*FloorEruptionGUID[1].find(nearFloorGUID)).second == 0) + { + (*FloorEruptionGUID[1].find(nearFloorGUID)).second = (*FloorEruptionGUID[1].find(floorEruptedGUID)).second+1; + FloorEruptionGUIDQueue.push(nearFloorGUID); + } + } } - break; + } + FloorEruptionGUID[1].erase(floorEruptedGUID); } - if (uiType < MAX_ENCOUNTER && uiData == DONE) - SaveToDB(); - } - - void SetData64(uint32 uiType, uint64 uiData) - { - switch(uiType) + void SetData(uint32 uiType, uint32 uiData) { - case DATA_FLOOR_ERUPTION_GUID: - FloorEruptionGUID[1] = FloorEruptionGUID[0]; - FloorEruptionGUIDQueue.push(uiData); - m_uiEruptTimer = 2500; - break; + switch(uiType) + { + case DATA_ONYXIA: + m_auiEncounter[0] = uiData; + if (uiData == IN_PROGRESS) + SetData(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS); + break; + case DATA_ONYXIA_PHASE: + if (uiData == PHASE_BREATH) //Used to mark the liftoff phase + { + m_bAchievManyWhelpsHandleIt = false; + m_uiManyWhelpsCounter = 0; + m_uiOnyxiaLiftoffTimer = 10*IN_MILLISECONDS; + } + break; + case DATA_SHE_DEEP_BREATH_MORE: + if (uiData == IN_PROGRESS) + { + m_bAchievSheDeepBreathMore = true; + } + else if (uiData == FAIL) + { + m_bAchievSheDeepBreathMore = false; + } + break; + } + + if (uiType < MAX_ENCOUNTER && uiData == DONE) + SaveToDB(); } - } - uint32 GetData(uint32 uiType) - { - switch(uiType) + void SetData64(uint32 uiType, uint64 uiData) { - case DATA_ONYXIA: - return m_auiEncounter[0]; + switch(uiType) + { + case DATA_FLOOR_ERUPTION_GUID: + FloorEruptionGUID[1] = FloorEruptionGUID[0]; + FloorEruptionGUIDQueue.push(uiData); + m_uiEruptTimer = 2500; + break; + } } - return 0; - } - - uint64 GetData64(uint32 uiData) - { - switch(uiData) + uint32 GetData(uint32 uiType) { - case DATA_ONYXIA_GUID: - return m_uiOnyxiasGUID; - } + switch(uiType) + { + case DATA_ONYXIA: + return m_auiEncounter[0]; + } - return 0; - } + return 0; + } - void Update(uint32 uiDiff) - { - if (GetData(DATA_ONYXIA) == IN_PROGRESS) + uint64 GetData64(uint32 uiData) { - if (m_uiOnyxiaLiftoffTimer && m_uiOnyxiaLiftoffTimer <= uiDiff) + switch(uiData) { - m_uiOnyxiaLiftoffTimer = 0; - if (m_uiManyWhelpsCounter >= 50) - m_bAchievManyWhelpsHandleIt = true; - } else m_uiOnyxiaLiftoffTimer -= uiDiff; + case DATA_ONYXIA_GUID: + return m_uiOnyxiasGUID; + } + + return 0; } - if (!FloorEruptionGUIDQueue.empty()) + void Update(uint32 uiDiff) { - if (m_uiEruptTimer <= uiDiff) + if (GetData(DATA_ONYXIA) == IN_PROGRESS) { - uint32 treeHeight = 0; - do + if (m_uiOnyxiaLiftoffTimer && m_uiOnyxiaLiftoffTimer <= uiDiff) { - treeHeight = (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second; - FloorEruption(FloorEruptionGUIDQueue.front()); - FloorEruptionGUIDQueue.pop(); - } while (!FloorEruptionGUIDQueue.empty() && (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second == treeHeight); - m_uiEruptTimer = 1000; + m_uiOnyxiaLiftoffTimer = 0; + if (m_uiManyWhelpsCounter >= 50) + m_bAchievManyWhelpsHandleIt = true; + } else m_uiOnyxiaLiftoffTimer -= uiDiff; + } + + if (!FloorEruptionGUIDQueue.empty()) + { + if (m_uiEruptTimer <= uiDiff) + { + uint32 treeHeight = 0; + do + { + treeHeight = (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second; + FloorEruption(FloorEruptionGUIDQueue.front()); + FloorEruptionGUIDQueue.pop(); + } while (!FloorEruptionGUIDQueue.empty() && (*FloorEruptionGUID[1].find(FloorEruptionGUIDQueue.front())).second == treeHeight); + m_uiEruptTimer = 1000; + } + else + m_uiEruptTimer -= uiDiff; } - else - m_uiEruptTimer -= uiDiff; } - } - bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) - { - switch(criteria_id) + bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0) { - case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s - case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s - return m_bAchievManyWhelpsHandleIt; - case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath - case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath - return m_bAchievSheDeepBreathMore; + switch(criteria_id) + { + case ACHIEV_CRITERIA_MANY_WHELPS_10_PLAYER: // Criteria for achievement 4403: Many Whelps! Handle It! (10 player) Hatch 50 eggs in 10s + case ACHIEV_CRITERIA_MANY_WHELPS_25_PLAYER: // Criteria for achievement 4406: Many Whelps! Handle It! (25 player) Hatch 50 eggs in 10s + return m_bAchievManyWhelpsHandleIt; + case ACHIEV_CRITERIA_DEEP_BREATH_10_PLAYER: // Criteria for achievement 4404: She Deep Breaths More (10 player) Everybody evade Deep Breath + case ACHIEV_CRITERIA_DEEP_BREATH_25_PLAYER: // Criteria for achievement 4407: She Deep Breaths More (25 player) Everybody evade Deep Breath + return m_bAchievSheDeepBreathMore; + } + return false; } - return false; - } + }; + }; -InstanceData* GetInstanceData_instance_onyxias_lair(Map* pMap) -{ - return new instance_onyxias_lair(pMap); -} void AddSC_instance_onyxias_lair() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_onyxias_lair"; - newscript->GetInstanceData = &GetInstanceData_instance_onyxias_lair; - newscript->RegisterSelf(); + new instance_onyxias_lair(); } diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp index 4157903bf75..69cadd776cf 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/boss_amnennar_the_coldbringer.cpp @@ -35,98 +35,100 @@ EndScriptData */ #define SPELL_FROSTBOLT 15530 #define SPELL_FROST_NOVA 15531 #define SPELL_FROST_SPECTRES 12642 - -struct boss_amnennar_the_coldbringerAI : public ScriptedAI +
class boss_amnennar_the_coldbringer : public CreatureScript { - boss_amnennar_the_coldbringerAI(Creature *c) : ScriptedAI(c) {} - - uint32 AmnenarsWrath_Timer; - uint32 FrostBolt_Timer; - uint32 FrostNova_Timer; - bool Spectrals60; - bool Spectrals30; - bool Hp; - - void Reset() - { - AmnenarsWrath_Timer = 8000; - FrostBolt_Timer = 1000; - FrostNova_Timer = 10000 + rand()%5000; - Spectrals30 = false; - Spectrals60 = false; - Hp = false; - } - - void EnterCombat(Unit * /*who*/) - { - DoScriptText(SAY_AGGRO, me); - } +public: + boss_amnennar_the_coldbringer() : CreatureScript("boss_amnennar_the_coldbringer") { } - void KilledUnit() + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_KILL, me); + return new boss_amnennar_the_coldbringerAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_amnennar_the_coldbringerAI : public ScriptedAI { - if (!UpdateVictim()) - return; + boss_amnennar_the_coldbringerAI(Creature *c) : ScriptedAI(c) {} - //AmnenarsWrath_Timer - if (AmnenarsWrath_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_AMNENNARSWRATH); - AmnenarsWrath_Timer = 12000; - } else AmnenarsWrath_Timer -= diff; - - //FrostBolt_Timer - if (FrostBolt_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTBOLT); - FrostBolt_Timer = 8000; - } else FrostBolt_Timer -= diff; + uint32 AmnenarsWrath_Timer; + uint32 FrostBolt_Timer; + uint32 FrostNova_Timer; + bool Spectrals60; + bool Spectrals30; + bool Hp; - if (FrostNova_Timer <= diff) + void Reset() { - DoCast(me, SPELL_FROST_NOVA); - FrostNova_Timer = 15000; - } else FrostNova_Timer -= diff; + AmnenarsWrath_Timer = 8000; + FrostBolt_Timer = 1000; + FrostNova_Timer = 10000 + rand()%5000; + Spectrals30 = false; + Spectrals60 = false; + Hp = false; + } - if (!Spectrals60 && me->GetHealth()*100 / me->GetMaxHealth() < 60) + void EnterCombat(Unit * /*who*/) { - DoScriptText(SAY_SUMMON60, me); - DoCast(me->getVictim(), SPELL_FROST_SPECTRES); - Spectrals60 = true; + DoScriptText(SAY_AGGRO, me); } - if (!Hp && me->GetHealth()*100 / me->GetMaxHealth() < 50) + void KilledUnit() { - DoScriptText(SAY_HP, me); - Hp = true; + DoScriptText(SAY_KILL, me); } - if (!Spectrals30 && me->GetHealth()*100 / me->GetMaxHealth() < 30) + void UpdateAI(const uint32 diff) { - DoScriptText(SAY_SUMMON30, me); - DoCast(me->getVictim(), SPELL_FROST_SPECTRES); - Spectrals30 = true; + if (!UpdateVictim()) + return; + + //AmnenarsWrath_Timer + if (AmnenarsWrath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_AMNENNARSWRATH); + AmnenarsWrath_Timer = 12000; + } else AmnenarsWrath_Timer -= diff; + + //FrostBolt_Timer + if (FrostBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBOLT); + FrostBolt_Timer = 8000; + } else FrostBolt_Timer -= diff; + + if (FrostNova_Timer <= diff) + { + DoCast(me, SPELL_FROST_NOVA); + FrostNova_Timer = 15000; + } else FrostNova_Timer -= diff; + + if (!Spectrals60 && me->GetHealth()*100 / me->GetMaxHealth() < 60) + { + DoScriptText(SAY_SUMMON60, me); + DoCast(me->getVictim(), SPELL_FROST_SPECTRES); + Spectrals60 = true; + } + + if (!Hp && me->GetHealth()*100 / me->GetMaxHealth() < 50) + { + DoScriptText(SAY_HP, me); + Hp = true; + } + + if (!Spectrals30 && me->GetHealth()*100 / me->GetMaxHealth() < 30) + { + DoScriptText(SAY_SUMMON30, me); + DoCast(me->getVictim(), SPELL_FROST_SPECTRES); + Spectrals30 = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_amnennar_the_coldbringer(Creature* pCreature) -{ - return new boss_amnennar_the_coldbringerAI (pCreature); -} void AddSC_boss_amnennar_the_coldbringer() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_amnennar_the_coldbringer"; - newscript->GetAI = &GetAI_boss_amnennar_the_coldbringer; - newscript->RegisterSelf(); + new boss_amnennar_the_coldbringer(); } - diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index 6e67569f6d8..aa8ce61a908 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -19,196 +19,198 @@ #include "razorfen_downs.h" #define MAX_ENCOUNTER 1 - -struct instance_razorfen_downs : public ScriptedInstance +
class instance_razorfen_downs : public InstanceMapScript { - instance_razorfen_downs(Map* pMap) : ScriptedInstance(pMap) +public: + instance_razorfen_downs() : InstanceMapScript("instance_razorfen_downs") { } + + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - Initialize(); - }; + return new instance_razorfen_downs_InstanceMapScript(pMap); + } - uint64 uiGongGUID; + struct instance_razorfen_downs_InstanceMapScript : public InstanceScript + { + instance_razorfen_downs_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + { + Initialize(); + }; - uint32 m_auiEncounter[MAX_ENCOUNTER]; + uint64 uiGongGUID; - uint8 uiGongWaves; + uint32 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; + uint8 uiGongWaves; - void Initialize() - { - uiGongGUID = 0; + std::string str_data; - uiGongWaves = 0; + void Initialize() + { + uiGongGUID = 0; - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - } + uiGongWaves = 0; - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + } - std::ostringstream saveStream; + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - saveStream << "T C " << m_auiEncounter[0] - << " " << uiGongWaves; + std::ostringstream saveStream; - str_data = saveStream.str(); + saveStream << "T C " << m_auiEncounter[0] + << " " << uiGongWaves; - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + str_data = saveStream.str(); - void Load(const char* in) - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; } - OUT_LOAD_INST_DATA(in); + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } - char dataHead1, dataHead2; - uint16 data0, data1; + OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; + char dataHead1, dataHead2; + uint16 data0, data1; - if (dataHead1 == 'T' && dataHead2 == 'C') - { - m_auiEncounter[0] = data0; + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + if (dataHead1 == 'T' && dataHead2 == 'C') + { + m_auiEncounter[0] = data0; - uiGongWaves = data1; - } else OUT_LOAD_INST_DATA_FAIL; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + uiGongWaves = data1; + } else OUT_LOAD_INST_DATA_FAIL; - void OnGameObjectCreate(GameObject* pGo, bool /*bAdd*/) - { - switch(pGo->GetEntry()) - { - case GO_GONG: - uiGongGUID = pGo->GetGUID(); - if (m_auiEncounter[0] == DONE) - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - break; - default: - break; + OUT_LOAD_INST_DATA_COMPLETE; } - } - void SetData(uint32 uiType, uint32 uiData) - { - if (uiType == DATA_GONG_WAVES) + void OnGameObjectCreate(GameObject* pGo, bool /*bAdd*/) { - uiGongWaves = uiData; - - switch(uiGongWaves) + switch(pGo->GetEntry()) { - case 9: - case 14: - if (GameObject* pGo = instance->GetGameObject(uiGongGUID)) - pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + case GO_GONG: + uiGongGUID = pGo->GetGUID(); + if (m_auiEncounter[0] == DONE) + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + break; + default: break; - case 1: - case 10: - case 16: + } + } + + void SetData(uint32 uiType, uint32 uiData) + { + if (uiType == DATA_GONG_WAVES) + { + uiGongWaves = uiData; + + switch(uiGongWaves) { - GameObject* pGo = instance->GetGameObject(uiGongGUID); + case 9: + case 14: + if (GameObject* pGo = instance->GetGameObject(uiGongGUID)) + pGo->RemoveFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + break; + case 1: + case 10: + case 16: + { + GameObject* pGo = instance->GetGameObject(uiGongGUID); - if (!pGo) - return; + if (!pGo) + return; - pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); + pGo->SetFlag(GAMEOBJECT_FLAGS,GO_FLAG_UNK1); - uint32 uiCreature = 0; - uint8 uiSummonTimes = 0; + uint32 uiCreature = 0; + uint8 uiSummonTimes = 0; - switch(uiGongWaves) - { - case 1: - uiCreature = CREATURE_TOMB_FIEND; - uiSummonTimes = 7; - break; - case 10: - uiCreature = CREATURE_TOMB_REAVER; - uiSummonTimes = 3; - break; - case 16: - uiCreature = CREATURE_TUTEN_KASH; - break; - default: - break; - } + switch(uiGongWaves) + { + case 1: + uiCreature = CREATURE_TOMB_FIEND; + uiSummonTimes = 7; + break; + case 10: + uiCreature = CREATURE_TOMB_REAVER; + uiSummonTimes = 3; + break; + case 16: + uiCreature = CREATURE_TUTEN_KASH; + break; + default: + break; + } - if (Creature* pCreature = pGo->SummonCreature(uiCreature,2502.635,844.140,46.896,0.633)) - { - if (uiGongWaves == 10 || uiGongWaves == 1) + if (Creature* pCreature = pGo->SummonCreature(uiCreature,2502.635,844.140,46.896,0.633)) { - for (uint8 i = 0; i < uiSummonTimes; ++i) + if (uiGongWaves == 10 || uiGongWaves == 1) { - if (Creature* pSummon = pGo->SummonCreature(uiCreature,2502.635 + float(irand(-5,5)),844.140 + float(irand(-5,5)),46.896,0.633)) - pSummon->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); + for (uint8 i = 0; i < uiSummonTimes; ++i) + { + if (Creature* pSummon = pGo->SummonCreature(uiCreature,2502.635 + float(irand(-5,5)),844.140 + float(irand(-5,5)),46.896,0.633)) + pSummon->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); + } } + pCreature->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); } - pCreature->GetMotionMaster()->MovePoint(0,2533.479 + float(irand(-5,5)),870.020 + float(irand(-5,5)),47.678); + break; } - break; + default: + break; } - default: - break; } - } - if (uiType == BOSS_TUTEN_KASH) - { - m_auiEncounter[0] = uiData; + if (uiType == BOSS_TUTEN_KASH) + { + m_auiEncounter[0] = uiData; - if (uiData == DONE) - SaveToDB(); + if (uiData == DONE) + SaveToDB(); + } } - } - uint32 GetData(uint32 uiType) - { - switch(uiType) + uint32 GetData(uint32 uiType) { - case DATA_GONG_WAVES: - return uiGongWaves; - } + switch(uiType) + { + case DATA_GONG_WAVES: + return uiGongWaves; + } - return 0; - } + return 0; + } - uint64 GetData64(uint32 uiType) - { - switch(uiType) + uint64 GetData64(uint32 uiType) { - case DATA_GONG: return uiGongGUID; + switch(uiType) + { + case DATA_GONG: return uiGongGUID; + } + + return 0; } + }; - return 0; - } }; -InstanceData* GetInstanceData_instance_razorfen_downs(Map* pMap) -{ - return new instance_razorfen_downs(pMap); -} void AddSC_instance_razorfen_downs() { - Script* newscript; - - newscript = new Script; - newscript->Name = "instance_razorfen_downs"; - newscript->GetInstanceData = &GetInstanceData_instance_razorfen_downs; - newscript->RegisterSelf(); + new instance_razorfen_downs(); } diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp index 3eed9ee07f9..d69794ce3f7 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.cpp @@ -46,122 +46,128 @@ enum eEnums #define GOSSIP_ITEM_TEA "Teach me the cooking recipe" #define GOSSIP_ITEM_POTION "Teach me the alchemy recipe" - -bool GossipHello_npc_henry_stern (Player* pPlayer, Creature* pCreature) +
class npc_henry_stern : public CreatureScript { - if (pPlayer->GetBaseSkillValue(SKILL_COOKING) >= 175 && !pPlayer->HasSpell(SPELL_GOLDTHORN_TEA)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); +public: + npc_henry_stern() : CreatureScript("npc_henry_stern") { } - if (pPlayer->GetBaseSkillValue(SKILL_ALCHEMY) >= 180 && !pPlayer->HasSpell(SPELL_MIGHT_TROLLS_BLOOD_POTION)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_POTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + bool OnGossipSelect (Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + { + pPlayer->CastSpell(pPlayer, SPELL_TEACHING_GOLDTHORN_TEA, true); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_TEA_ANSWER, pCreature->GetGUID()); + } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + if (uiAction == GOSSIP_ACTION_INFO_DEF + 2) + { + pPlayer->CastSpell(pPlayer, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION, true); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_POTION_ANSWER, pCreature->GetGUID()); + } -bool GossipSelect_npc_henry_stern (Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->CastSpell(pPlayer, SPELL_TEACHING_GOLDTHORN_TEA, true); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_TEA_ANSWER, pCreature->GetGUID()); + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF + 2) + bool OnGossipHello (Player* pPlayer, Creature* pCreature) { - pPlayer->CastSpell(pPlayer, SPELL_TEACHING_MIGHTY_TROLLS_BLOOD_POTION, true); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_TEXT_POTION_ANSWER, pCreature->GetGUID()); + if (pPlayer->GetBaseSkillValue(SKILL_COOKING) >= 175 && !pPlayer->HasSpell(SPELL_GOLDTHORN_TEA)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TEA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + + if (pPlayer->GetBaseSkillValue(SKILL_ALCHEMY) >= 180 && !pPlayer->HasSpell(SPELL_MIGHT_TROLLS_BLOOD_POTION)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_POTION, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - return true; -} +}; + /*###### ## go_gong ######*/ - -bool GOHello_go_gong(Player* /*pPlayer*/, GameObject* pGO) +
class go_gong : public GameObjectScript { - //basic support, not blizzlike data is missing... - ScriptedInstance* pInstance = pGO->GetInstanceData(); +public: + go_gong() : GameObjectScript("go_gong") { } - if (pInstance) + bool OnGossipHello(Player* /*pPlayer*/, GameObject* pGO) { - pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); - return true; + //basic support, not blizzlike data is missing... + InstanceScript* pInstance = pGO->GetInstanceScript(); + + if (pInstance) + { + pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); + return true; + } + + return false; } - return false; -} +}; enum eTombCreature { SPELL_WEB = 745 }; - -struct npc_tomb_creatureAI : public ScriptedAI +
class npc_tomb_creature : public CreatureScript { - npc_tomb_creatureAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_tomb_creature() : CreatureScript("npc_tomb_creature") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = pCreature->GetInstanceData(); + return new npc_tomb_creatureAI (pCreature); } - ScriptedInstance* pInstance; + struct npc_tomb_creatureAI : public ScriptedAI + { + npc_tomb_creatureAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + } - uint32 uiWebTimer; + InstanceScript* pInstance; - void Reset() - { - uiWebTimer = urand(5000,8000); - } + uint32 uiWebTimer; - void UpdateAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + void Reset() + { + uiWebTimer = urand(5000,8000); + } - //from acid - if (me->GetEntry() == CREATURE_TOMB_REAVER) + void UpdateAI(const uint32 uiDiff) { - if (uiWebTimer <= uiDiff) + if (!UpdateVictim()) + return; + + //from acid + if (me->GetEntry() == CREATURE_TOMB_REAVER) { - DoCast(me->getVictim(), SPELL_WEB); - uiWebTimer = urand(7000,16000); - } else uiWebTimer -= uiDiff; + if (uiWebTimer <= uiDiff) + { + DoCast(me->getVictim(), SPELL_WEB); + uiWebTimer = urand(7000,16000); + } else uiWebTimer -= uiDiff; + } + + DoMeleeAttackIfReady(); } - DoMeleeAttackIfReady(); - } + void JustDied(Unit* /*pKiller*/) + { + if (pInstance) + pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); + } + }; - void JustDied(Unit* /*pKiller*/) - { - if (pInstance) - pInstance->SetData(DATA_GONG_WAVES,pInstance->GetData(DATA_GONG_WAVES)+1); - } }; -CreatureAI* GetAI_npc_tomb_creature(Creature* pCreature) -{ - return new npc_tomb_creatureAI (pCreature); -} void AddSC_razorfen_downs() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_henry_stern"; - newscript->pGossipHello = &GossipHello_npc_henry_stern; - newscript->pGossipSelect = &GossipSelect_npc_henry_stern; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_gong"; - newscript->pGOHello = &GOHello_go_gong; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tomb_creature"; - newscript->GetAI = &GetAI_npc_tomb_creature; - newscript->RegisterSelf(); + new npc_henry_stern(); + new go_gong(); + new npc_tomb_creature(); } diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index 691462e595d..253bfd1d3fc 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -27,80 +27,83 @@ EndScriptData */ #include "razorfen_kraul.h" #define WARD_KEEPERS_NR 2 - -struct instance_razorfen_kraul : public ScriptedInstance +
class instance_razorfen_kraul : public InstanceMapScript { - instance_razorfen_kraul(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint64 DoorWardGUID; - uint32 WardCheck_Timer; - int WardKeeperAlive; +public: + instance_razorfen_kraul() : InstanceMapScript("instance_razorfen_kraul") { } - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - WardKeeperAlive = 1; - WardCheck_Timer = 4000; - DoorWardGUID = 0; + return new instance_razorfen_kraul_InstanceMapScript(pMap); } - Player* GetPlayerInMap() + struct instance_razorfen_kraul_InstanceMapScript : public InstanceScript { - Map::PlayerList const& players = instance->GetPlayers(); + instance_razorfen_kraul_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; + + uint64 DoorWardGUID; + uint32 WardCheck_Timer; + int WardKeeperAlive; + + void Initialize() + { + WardKeeperAlive = 1; + WardCheck_Timer = 4000; + DoorWardGUID = 0; + } - if (!players.isEmpty()) + Player* GetPlayerInMap() { - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + Map::PlayerList const& players = instance->GetPlayers(); + + if (!players.isEmpty()) { - if (Player* plr = itr->getSource()) - return plr; + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + { + if (Player* plr = itr->getSource()) + return plr; + } } + sLog.outDebug("TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); + return NULL; } - sLog.outDebug("TSCR: Instance Razorfen Kraul: GetPlayerInMap, but PlayerList is empty!"); - return NULL; - } - void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) - { - switch(pGo->GetEntry()) + void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) { - case 21099: DoorWardGUID = pGo->GetGUID(); break; + switch(pGo->GetEntry()) + { + case 21099: DoorWardGUID = pGo->GetGUID(); break; + } } - } - void Update(uint32 diff) - { - if (WardCheck_Timer <= diff) + void Update(uint32 diff) { - HandleGameObject(DoorWardGUID, WardKeeperAlive); - WardKeeperAlive = 0; - WardCheck_Timer = 4000; - }else - WardCheck_Timer -= diff; - } + if (WardCheck_Timer <= diff) + { + HandleGameObject(DoorWardGUID, WardKeeperAlive); + WardKeeperAlive = 0; + WardCheck_Timer = 4000; + }else + WardCheck_Timer -= diff; + } - void SetData(uint32 type, uint32 data) - { - switch(type) + void SetData(uint32 type, uint32 data) { - case TYPE_WARD_KEEPERS: - if (data == NOT_STARTED) - WardKeeperAlive = 1; - break; + switch(type) + { + case TYPE_WARD_KEEPERS: + if (data == NOT_STARTED) + WardKeeperAlive = 1; + break; + } } - } + + }; }; -InstanceData* GetInstanceData_instance_razorfen_kraul(Map* pMap) -{ - return new instance_razorfen_kraul(pMap); -} void AddSC_instance_razorfen_kraul() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_razorfen_kraul"; - newscript->GetInstanceData = &GetInstanceData_instance_razorfen_kraul; - newscript->RegisterSelf(); + new instance_razorfen_kraul(); } diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp index a2aa56fb2d2..78c94dcbcfb 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.cpp @@ -46,151 +46,155 @@ EndContentData */ #define QUEST_WILLIX_THE_IMPORTER 1144 #define ENTRY_BOAR 4514 #define SPELL_QUILLBOAR_CHANNELING 7083 - -struct npc_willixAI : public npc_escortAI +
class npc_willix : public CreatureScript { - npc_willixAI(Creature *c) : npc_escortAI(c) {} +public: + npc_willix() : CreatureScript("npc_willix") { } - 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_WILLIX_THE_IMPORTER) { - case 3: - me->HandleEmoteCommand(EMOTE_STATE_POINT); - DoScriptText(SAY_POINT, me, pPlayer); - break; - case 4: - me->SummonCreature(ENTRY_BOAR, 2137.66, 1843.98, 48.08, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 8: - DoScriptText(SAY_BLUELEAF, me, pPlayer); - break; - case 9: - DoScriptText(SAY_DANGER, me, pPlayer); - break; - case 13: - DoScriptText(SAY_BAD, me, pPlayer); - break; - case 14: - me->SummonCreature(ENTRY_BOAR, 2078.91, 1704.54, 56.77, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 25: - DoScriptText(SAY_THINK, me, pPlayer); - break; - case 31: - DoScriptText(SAY_SOON, me, pPlayer); - break; - case 42: - DoScriptText(SAY_FINALY, me, pPlayer); - break; - case 43: - me->SummonCreature(ENTRY_BOAR, 1956.43, 1596.97, 81.75, 1.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - break; - case 45: - DoScriptText(SAY_WIN, me, pPlayer); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); - if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(pPlayer)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER,me); - break; - case 46: - DoScriptText(SAY_END, me, pPlayer); - break; + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); + DoScriptText(SAY_READY, pCreature, pPlayer); + pCreature->setFaction(113); } - } - - void Reset() {} - void EnterCombat(Unit* /*who*/) - { - DoScriptText(SAY_AGGRO1, me, NULL); + return true; } - void JustSummoned(Creature* summoned) + CreatureAI* GetAI(Creature* pCreature) const { - summoned->AI()->AttackStart(me); + return new npc_willixAI(pCreature); } - void JustDied(Unit* /*killer*/) + struct npc_willixAI : public npc_escortAI { - if (Player* pPlayer = GetPlayerForEscort()) - CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); - } -}; + npc_willixAI(Creature *c) : npc_escortAI(c) {} -bool QuestAccept_npc_willix(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_WILLIX_THE_IMPORTER) - { - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(true, false, pPlayer->GetGUID()); - DoScriptText(SAY_READY, pCreature, pPlayer); - pCreature->setFaction(113); - } + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch (i) + { + case 3: + me->HandleEmoteCommand(EMOTE_STATE_POINT); + DoScriptText(SAY_POINT, me, pPlayer); + break; + case 4: + me->SummonCreature(ENTRY_BOAR, 2137.66, 1843.98, 48.08, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 8: + DoScriptText(SAY_BLUELEAF, me, pPlayer); + break; + case 9: + DoScriptText(SAY_DANGER, me, pPlayer); + break; + case 13: + DoScriptText(SAY_BAD, me, pPlayer); + break; + case 14: + me->SummonCreature(ENTRY_BOAR, 2078.91, 1704.54, 56.77, 1.54, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 25: + DoScriptText(SAY_THINK, me, pPlayer); + break; + case 31: + DoScriptText(SAY_SOON, me, pPlayer); + break; + case 42: + DoScriptText(SAY_FINALY, me, pPlayer); + break; + case 43: + me->SummonCreature(ENTRY_BOAR, 1956.43, 1596.97, 81.75, 1.54,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + break; + case 45: + DoScriptText(SAY_WIN, me, pPlayer); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); + if (pPlayer && pPlayer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(pPlayer)->GroupEventHappens(QUEST_WILLIX_THE_IMPORTER,me); + break; + case 46: + DoScriptText(SAY_END, me, pPlayer); + break; + } + } - return true; -} + void Reset() {} -struct npc_deaths_head_ward_keeperAI : public ScriptedAI -{ - npc_deaths_head_ward_keeperAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + void EnterCombat(Unit* /*who*/) + { + DoScriptText(SAY_AGGRO1, me, NULL); + } - ScriptedInstance *pInstance; - uint32 QuillboarChanneling_Timer; + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } - void Reset() + void JustDied(Unit* /*killer*/) + { + if (Player* pPlayer = GetPlayerForEscort()) + CAST_PLR(pPlayer)->FailQuest(QUEST_WILLIX_THE_IMPORTER); + } + }; + +}; + +
class npc_deaths_head_ward_keeper : public CreatureScript +{ +public: + npc_deaths_head_ward_keeper() : CreatureScript("npc_deaths_head_ward_keeper") { } + + CreatureAI* GetAI(Creature* pCreature) const { - QuillboarChanneling_Timer = 1500; + return new npc_deaths_head_ward_keeperAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_deaths_head_ward_keeperAI : public ScriptedAI { - if (!me->isAlive()) - return; + npc_deaths_head_ward_keeperAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (pInstance) - pInstance->SetData(TYPE_WARD_KEEPERS, NOT_STARTED); + InstanceScript *pInstance; + uint32 QuillboarChanneling_Timer; - if (QuillboarChanneling_Timer <= diff) + void Reset() { - if (me->IsNonMeleeSpellCasted(false)) - me->InterruptNonMeleeSpells(true); - DoCast(me, SPELL_QUILLBOAR_CHANNELING); - QuillboarChanneling_Timer = 1100; - } else QuillboarChanneling_Timer -= diff; + QuillboarChanneling_Timer = 1500; + } + + void UpdateAI(const uint32 diff) + { + if (!me->isAlive()) + return; + + if (pInstance) + pInstance->SetData(TYPE_WARD_KEEPERS, NOT_STARTED); + + if (QuillboarChanneling_Timer <= diff) + { + if (me->IsNonMeleeSpellCasted(false)) + me->InterruptNonMeleeSpells(true); + DoCast(me, SPELL_QUILLBOAR_CHANNELING); + QuillboarChanneling_Timer = 1100; + } else QuillboarChanneling_Timer -= diff; + + } + }; - } }; -CreatureAI* GetAI_npc_deaths_head_ward_keeper(Creature* pCreature) -{ - return new npc_deaths_head_ward_keeperAI(pCreature); -} -CreatureAI* GetAI_npc_willix(Creature* pCreature) -{ - return new npc_willixAI(pCreature); -} void AddSC_razorfen_kraul() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_willix"; - newscript->GetAI = &GetAI_npc_willix; - newscript->pQuestAccept = &QuestAccept_npc_willix; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_deaths_head_ward_keeper"; - newscript->GetAI = &GetAI_npc_deaths_head_ward_keeper; - newscript->RegisterSelf(); + new npc_willix(); + new npc_deaths_head_ward_keeper(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp index 9e1c4e1af53..27cf6c0057f 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ayamiss.cpp @@ -38,90 +38,92 @@ enum Spells SPELL_SUMMONSWARMER = 25844, //might be 25708 SPELL_PARALYZE = 23414 //doesnt work correct (core) }; - -struct boss_ayamissAI : public ScriptedAI +
class boss_ayamiss : public CreatureScript { - boss_ayamissAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 STINGERSPRAY_Timer; - uint32 POISONSTINGER_Timer; - uint32 SUMMONSWARMER_Timer; - uint32 phase; +public: + boss_ayamiss() : CreatureScript("boss_ayamiss") { } - ScriptedInstance *pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - STINGERSPRAY_Timer = 30000; - POISONSTINGER_Timer = 30000; - SUMMONSWARMER_Timer = 60000; - phase=1; - - if (pInstance) - pInstance->SetData(DATA_AYAMISS_EVENT, NOT_STARTED); + return new boss_ayamissAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_ayamissAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_AYAMISS_EVENT, IN_PROGRESS); - } + boss_ayamissAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_AYAMISS_EVENT, DONE); - } + uint32 STINGERSPRAY_Timer; + uint32 POISONSTINGER_Timer; + uint32 SUMMONSWARMER_Timer; + uint32 phase; - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; + InstanceScript *pInstance; - //If he is 70% start phase 2 - if (phase == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 70 && !me->IsNonMeleeSpellCasted(false)) + void Reset() { - phase=2; + STINGERSPRAY_Timer = 30000; + POISONSTINGER_Timer = 30000; + SUMMONSWARMER_Timer = 60000; + phase=1; + + if (pInstance) + pInstance->SetData(DATA_AYAMISS_EVENT, NOT_STARTED); } - //STINGERSPRAY_Timer (only in phase2) - if (phase == 2 && STINGERSPRAY_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_STINGERSPRAY); - STINGERSPRAY_Timer = 30000; - } else STINGERSPRAY_Timer -= diff; + if (pInstance) + pInstance->SetData(DATA_AYAMISS_EVENT, IN_PROGRESS); + } - //POISONSTINGER_Timer (only in phase1) - if (phase == 1 && POISONSTINGER_Timer <= diff) + void JustDied(Unit * /*killer*/) { - DoCast(me->getVictim(), SPELL_POISONSTINGER); - POISONSTINGER_Timer = 30000; - } else POISONSTINGER_Timer -= diff; + if (pInstance) + pInstance->SetData(DATA_AYAMISS_EVENT, DONE); + } - //SUMMONSWARMER_Timer (only in phase1) - if (SUMMONSWARMER_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SUMMONSWARMER); - SUMMONSWARMER_Timer = 60000; - } else SUMMONSWARMER_Timer -= diff; + if (!UpdateVictim()) + return; + + //If he is 70% start phase 2 + if (phase == 1 && me->GetHealth()*100 / me->GetMaxHealth() <= 70 && !me->IsNonMeleeSpellCasted(false)) + { + phase=2; + } + + //STINGERSPRAY_Timer (only in phase2) + if (phase == 2 && STINGERSPRAY_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_STINGERSPRAY); + STINGERSPRAY_Timer = 30000; + } else STINGERSPRAY_Timer -= diff; + + //POISONSTINGER_Timer (only in phase1) + if (phase == 1 && POISONSTINGER_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_POISONSTINGER); + POISONSTINGER_Timer = 30000; + } else POISONSTINGER_Timer -= diff; + + //SUMMONSWARMER_Timer (only in phase1) + if (SUMMONSWARMER_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SUMMONSWARMER); + SUMMONSWARMER_Timer = 60000; + } else SUMMONSWARMER_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ayamiss(Creature* pCreature) -{ - return new boss_ayamissAI (pCreature); -} void AddSC_boss_ayamiss() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ayamiss"; - newscript->GetAI = &GetAI_boss_ayamiss; - newscript->RegisterSelf(); + new boss_ayamiss(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp index d8f6bece646..706653fd443 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_buru.cpp @@ -30,45 +30,47 @@ enum Yells { EMOTE_TARGET = -1509002 }; - -struct boss_buruAI : public ScriptedAI +
class boss_buru : public CreatureScript { - boss_buruAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; +public: + boss_buru() : CreatureScript("boss_buru") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_BURU_EVENT, NOT_STARTED); + return new boss_buruAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_buruAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_BURU_EVENT, IN_PROGRESS); - } + boss_buruAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_BURU_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_BURU_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_BURU_EVENT, DONE); + } + }; - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_BURU_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_buru(Creature* pCreature) -{ - return new boss_buruAI (pCreature); -} void AddSC_boss_buru() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_buru"; - newscript->GetAI = &GetAI_boss_buru; - newscript->RegisterSelf(); + new boss_buru(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp index c1dba225462..ace0da87556 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_kurinnaxx.cpp @@ -35,111 +35,113 @@ enum Spells SPELL_TRASH = 3391, SPELL_WIDE_SLASH = 25814 }; - -struct boss_kurinnaxxAI : public ScriptedAI +
class boss_kurinnaxx : public CreatureScript { - boss_kurinnaxxAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiMortalWoundTimer; - uint32 uiSandtrapTimer; - uint32 uiWideSlashTimer; - uint32 uiSummonPlayerTimer; - uint32 uiTrashTimer; - bool bIsEnraged; - - ScriptedInstance* pInstance; - - void Reset() - { - bIsEnraged = false; - uiMortalWoundTimer = urand(2000,7000); - uiSandtrapTimer = urand(20000,30000); - uiWideSlashTimer = urand(10000,15000); - uiTrashTimer = urand(20000,25000); - uiSummonPlayerTimer = urand(30000,40000); - - if (pInstance) - pInstance->SetData(DATA_KURINNAXX_EVENT, NOT_STARTED); - } +public: + boss_kurinnaxx() : CreatureScript("boss_kurinnaxx") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_KURINNAXX_EVENT, IN_PROGRESS); + return new boss_kurinnaxxAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct boss_kurinnaxxAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_KURINNAXX_EVENT, DONE); - } - - void UpdateAI(const uint32 diff) - { - if (!UpdateVictim()) - return; - - //If we are <30% cast enrage - if (!bIsEnraged && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + boss_kurinnaxxAI(Creature *c) : ScriptedAI(c) { - bIsEnraged = true; - DoCast(me, SPELL_ENRAGE); + pInstance = c->GetInstanceScript(); } - //Mortal Wound spell - if (uiMortalWoundTimer <= diff) + uint32 uiMortalWoundTimer; + uint32 uiSandtrapTimer; + uint32 uiWideSlashTimer; + uint32 uiSummonPlayerTimer; + uint32 uiTrashTimer; + bool bIsEnraged; + + InstanceScript* pInstance; + + void Reset() { - DoCast(me->getVictim(), SPELL_MORTALWOUND); + bIsEnraged = false; uiMortalWoundTimer = urand(2000,7000); - } else uiMortalWoundTimer -= diff; + uiSandtrapTimer = urand(20000,30000); + uiWideSlashTimer = urand(10000,15000); + uiTrashTimer = urand(20000,25000); + uiSummonPlayerTimer = urand(30000,40000); - //Santrap spell - if (uiSandtrapTimer <= diff) - { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SANDTRAP); - uiSandtrapTimer = 30000; - } else uiSandtrapTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_KURINNAXX_EVENT, NOT_STARTED); + } - //Wide Slash spell - if (uiWideSlashTimer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_WIDE_SLASH); - uiWideSlashTimer = urand(10000,15000); - } else uiWideSlashTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_KURINNAXX_EVENT, IN_PROGRESS); + } - //Trash spell - if (uiTrashTimer <= diff) + void JustDied(Unit * /*killer*/) { - DoCast(me, SPELL_TRASH); - uiTrashTimer = urand(20000,25000); - } else uiTrashTimer -= diff; + if (pInstance) + pInstance->SetData(DATA_KURINNAXX_EVENT, DONE); + } - //Summon Player spell - if (uiSummonPlayerTimer <= diff) + void UpdateAI(const uint32 diff) { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - DoCast(pTarget, SPELL_SUMMON_PLAYER); - uiSummonPlayerTimer = urand(30000,40000); - } else uiSummonPlayerTimer -= diff; + if (!UpdateVictim()) + return; + + //If we are <30% cast enrage + if (!bIsEnraged && me->GetHealth()*100 / me->GetMaxHealth() <= 30 && !me->IsNonMeleeSpellCasted(false)) + { + bIsEnraged = true; + DoCast(me, SPELL_ENRAGE); + } + + //Mortal Wound spell + if (uiMortalWoundTimer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTALWOUND); + uiMortalWoundTimer = urand(2000,7000); + } else uiMortalWoundTimer -= diff; + + //Santrap spell + if (uiSandtrapTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SANDTRAP); + uiSandtrapTimer = 30000; + } else uiSandtrapTimer -= diff; + + //Wide Slash spell + if (uiWideSlashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_WIDE_SLASH); + uiWideSlashTimer = urand(10000,15000); + } else uiWideSlashTimer -= diff; + + //Trash spell + if (uiTrashTimer <= diff) + { + DoCast(me, SPELL_TRASH); + uiTrashTimer = urand(20000,25000); + } else uiTrashTimer -= diff; + + //Summon Player spell + if (uiSummonPlayerTimer <= diff) + { + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + DoCast(pTarget, SPELL_SUMMON_PLAYER); + uiSummonPlayerTimer = urand(30000,40000); + } else uiSummonPlayerTimer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_kurinnaxx(Creature* pCreature) -{ - return new boss_kurinnaxxAI (pCreature); -} void AddSC_boss_kurinnaxx() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kurinnaxx"; - newscript->GetAI = &GetAI_boss_kurinnaxx; - newscript->RegisterSelf(); + new boss_kurinnaxx(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp index 361bb149ce7..0977440d89d 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_moam.cpp @@ -51,114 +51,116 @@ enum CombatPhase NORMAL, STONE }; - -struct boss_moamAI : public ScriptedAI +
class boss_moam : public CreatureScript { - boss_moamAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - uint32 uiTrampleTimer; - uint32 uiDrainManaTimer; - uint32 uiPhaseTimer; - CombatPhase Phase; +public: + boss_moam() : CreatureScript("boss_moam") { } - ScriptedInstance *pInstance; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - uiTrampleTimer = urand(3000,7000); - uiDrainManaTimer = urand(3000,7000); - uiPhaseTimer = 90000; - Phase = NORMAL; - me->SetPower(POWER_MANA,0); - - if (pInstance) - pInstance->SetData(DATA_MOAM_EVENT, NOT_STARTED); + return new boss_moamAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_moamAI : public ScriptedAI { - DoScriptText(EMOTE_AGGRO, me); + boss_moamAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - if (pInstance) - pInstance->SetData(DATA_MOAM_EVENT, IN_PROGRESS); - } + uint32 uiTrampleTimer; + uint32 uiDrainManaTimer; + uint32 uiPhaseTimer; + CombatPhase Phase; - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_MOAM_EVENT, DONE); - } + InstanceScript *pInstance; - void DrainMana() - { - for (uint8 i=0;i<6;++i) + void Reset() { - if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) - { - pTarget->ModifyPower(POWER_MANA, -500); - me->ModifyPower(POWER_MANA, 1000); - } + uiTrampleTimer = urand(3000,7000); + uiDrainManaTimer = urand(3000,7000); + uiPhaseTimer = 90000; + Phase = NORMAL; + me->SetPower(POWER_MANA,0); + + if (pInstance) + pInstance->SetData(DATA_MOAM_EVENT, NOT_STARTED); } - } - void UpdateAI(const uint32 diff) - { - if (Phase == NORMAL) + void EnterCombat(Unit * /*who*/) { - if (!UpdateVictim()) - return; + DoScriptText(EMOTE_AGGRO, me); - //If we are 100%MANA cast Arcane Erruption - if (me->GetPower(POWER_MANA) == me->GetMaxPower(POWER_MANA)) - { - DoCast(me->getVictim(), SPELL_ARCANEERUPTION); - DoScriptText(EMOTE_MANA_FULL, me); - me->SetPower(POWER_MANA,0); - } + if (pInstance) + pInstance->SetData(DATA_MOAM_EVENT, IN_PROGRESS); + } - //Trample Spell - if (uiTrampleTimer <= diff) - { - DoCast(me->getVictim(), SPELL_TRAMPLE); - uiTrampleTimer = urand(3000,7000); - } else uiTrampleTimer -= diff; + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_MOAM_EVENT, DONE); + } - //Drain Mana - if (uiDrainManaTimer <= diff) + void DrainMana() + { + for (uint8 i=0;i<6;++i) { - DrainMana(); - uiDrainManaTimer = urand(3000,7000); - } else uiDrainManaTimer -= diff; - - DoMeleeAttackIfReady(); + if (Unit* pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) + { + pTarget->ModifyPower(POWER_MANA, -500); + me->ModifyPower(POWER_MANA, 1000); + } + } + } - //After 90secs change phase - if (uiPhaseTimer <= diff) + void UpdateAI(const uint32 diff) + { + if (Phase == NORMAL) { - Phase = STONE; - DoCast(me, SPELL_SUMMONMANA); - DoCast(me, SPELL_SUMMONMANA); - DoCast(me, SPELL_SUMMONMANA); - DoCast(me, SPELL_GRDRSLEEP); - } else uiPhaseTimer -= diff; + if (!UpdateVictim()) + return; + + //If we are 100%MANA cast Arcane Erruption + if (me->GetPower(POWER_MANA) == me->GetMaxPower(POWER_MANA)) + { + DoCast(me->getVictim(), SPELL_ARCANEERUPTION); + DoScriptText(EMOTE_MANA_FULL, me); + me->SetPower(POWER_MANA,0); + } + + //Trample Spell + if (uiTrampleTimer <= diff) + { + DoCast(me->getVictim(), SPELL_TRAMPLE); + uiTrampleTimer = urand(3000,7000); + } else uiTrampleTimer -= diff; + + //Drain Mana + if (uiDrainManaTimer <= diff) + { + DrainMana(); + uiDrainManaTimer = urand(3000,7000); + } else uiDrainManaTimer -= diff; + + DoMeleeAttackIfReady(); + + //After 90secs change phase + if (uiPhaseTimer <= diff) + { + Phase = STONE; + DoCast(me, SPELL_SUMMONMANA); + DoCast(me, SPELL_SUMMONMANA); + DoCast(me, SPELL_SUMMONMANA); + DoCast(me, SPELL_GRDRSLEEP); + } else uiPhaseTimer -= diff; + } } - } + }; + }; -CreatureAI* GetAI_boss_moam(Creature* pCreature) -{ - return new boss_moamAI (pCreature); -} void AddSC_boss_moam() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_moam"; - newscript->GetAI = &GetAI_boss_moam; - newscript->RegisterSelf(); + new boss_moam(); } - diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp index 9b4f0430c4a..84efd150153 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_ossirian.cpp @@ -38,44 +38,47 @@ enum Yells SAY_SLAY = -1509026, SAY_DEATH = -1509027 }; - -struct boss_ossirianAI : public ScriptedAI +
class boss_ossirian : public CreatureScript { - boss_ossirianAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; +public: + boss_ossirian() : CreatureScript("boss_ossirian") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_OSSIRIAN_EVENT, NOT_STARTED); + return new boss_ossirianAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_ossirianAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_OSSIRIAN_EVENT, IN_PROGRESS); - } + boss_ossirianAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_OSSIRIAN_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_OSSIRIAN_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_OSSIRIAN_EVENT, DONE); + } + }; - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_OSSIRIAN_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_ossirian(Creature* pCreature) -{ - return new boss_ossirianAI (pCreature); -} void AddSC_boss_ossirian() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ossirian"; - newscript->GetAI = &GetAI_boss_ossirian; - newscript->RegisterSelf(); + new boss_ossirian(); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp index 3346e57685f..cdcca79ab5a 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/boss_rajaxx.cpp @@ -44,44 +44,47 @@ enum Yells SAY_KILLS_ANDOROV = -1509016, SAY_COMPLETE_QUEST = -1509017 //Yell when realm complete quest 8743 for world event }; - -struct boss_rajaxxAI : public ScriptedAI +
class boss_rajaxx : public CreatureScript { - boss_rajaxxAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } - - ScriptedInstance *pInstance; +public: + boss_rajaxx() : CreatureScript("boss_rajaxx") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (pInstance) - pInstance->SetData(DATA_RAJAXX_EVENT, NOT_STARTED); + return new boss_rajaxxAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_rajaxxAI : public ScriptedAI { - if (pInstance) - pInstance->SetData(DATA_RAJAXX_EVENT, IN_PROGRESS); - } + boss_rajaxxAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } + + InstanceScript *pInstance; + + void Reset() + { + if (pInstance) + pInstance->SetData(DATA_RAJAXX_EVENT, NOT_STARTED); + } + + void EnterCombat(Unit * /*who*/) + { + if (pInstance) + pInstance->SetData(DATA_RAJAXX_EVENT, IN_PROGRESS); + } + + void JustDied(Unit * /*killer*/) + { + if (pInstance) + pInstance->SetData(DATA_RAJAXX_EVENT, DONE); + } + }; - void JustDied(Unit * /*killer*/) - { - if (pInstance) - pInstance->SetData(DATA_RAJAXX_EVENT, DONE); - } }; -CreatureAI* GetAI_boss_rajaxx(Creature* pCreature) -{ - return new boss_rajaxxAI (pCreature); -} void AddSC_boss_rajaxx() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_rajaxx"; - newscript->GetAI = &GetAI_boss_rajaxx; - newscript->RegisterSelf(); + new boss_rajaxx(); } diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp index 26ac218e298..8b0c78ea269 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp @@ -35,181 +35,184 @@ EndScriptData */ 3 - Buru the Gorger 4 - Ayamiss the Hunter 5 - Ossirian the Unscarred */ - -struct instance_ruins_of_ahn_qiraj : public ScriptedInstance +
class instance_ruins_of_ahnqiraj : public InstanceMapScript { - instance_ruins_of_ahn_qiraj(Map* pMap) : ScriptedInstance(pMap) { Initialize(); } - - uint64 uiKurinaxx; - uint64 uiRajaxx; - uint64 uiMoam; - uint64 uiBuru; - uint64 uiAyamiss; - uint64 uiOssirian; - - uint8 m_auiEncounter[MAX_ENCOUNTER]; - std::string str_data; +public: + instance_ruins_of_ahnqiraj() : InstanceMapScript("instance_ruins_of_ahnqiraj") { } - void Initialize() + InstanceScript* GetInstanceData_instance_ruins_of_ahn_qiraj_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - uiKurinaxx = 0; - uiRajaxx = 0; - uiMoam = 0; - uiBuru = 0; - uiAyamiss = 0; - uiOssirian = 0; + return new instance_ruins_of_ahn_qiraj_InstanceMapScript(pMap); } - bool IsEncounterInProgress() const + struct instance_ruins_of_ahn_qiraj_InstanceMapScript : public InstanceScript { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) return true; + instance_ruins_of_ahn_qiraj_InstanceMapScript(Map* pMap) : InstanceScript(pMap) { Initialize(); } - return false; - } + uint64 uiKurinaxx; + uint64 uiRajaxx; + uint64 uiMoam; + uint64 uiBuru; + uint64 uiAyamiss; + uint64 uiOssirian; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch (pCreature->GetEntry()) + uint8 m_auiEncounter[MAX_ENCOUNTER]; + std::string str_data; + + void Initialize() { - case CREATURE_KURINAXX: - uiKurinaxx = pCreature->GetGUID(); - break; - case CREATURE_RAJAXX: - uiRajaxx = pCreature->GetGUID(); - break; - case CREATURE_MOAM: - uiMoam = pCreature->GetGUID(); - break; - case CREATURE_BURU: - uiBuru = pCreature->GetGUID(); - break; - case CREATURE_AYAMISS: - uiAyamiss = pCreature->GetGUID(); - break; - case CREATURE_OSSIRIAN: - uiOssirian = pCreature->GetGUID(); - break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + uiKurinaxx = 0; + uiRajaxx = 0; + uiMoam = 0; + uiBuru = 0; + uiAyamiss = 0; + uiOssirian = 0; } - } - uint32 GetData(uint32 identifier) - { - switch(identifier) + bool IsEncounterInProgress() const { - case DATA_KURINNAXX_EVENT: return m_auiEncounter[0]; - case DATA_RAJAXX_EVENT: return m_auiEncounter[1]; - case DATA_MOAM_EVENT: return m_auiEncounter[2]; - case DATA_BURU_EVENT: return m_auiEncounter[3]; - case DATA_AYAMISS_EVENT: return m_auiEncounter[4]; - case DATA_OSSIRIAN_EVENT: return m_auiEncounter[5]; - } + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) return true; - return 0; - } + return false; + } - void SetData(uint32 identifier, uint32 data) - { - switch(identifier) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case DATA_KURINNAXX_EVENT: - m_auiEncounter[0] = data; - break; - case DATA_RAJAXX_EVENT: - m_auiEncounter[1] = data; - break; - case DATA_MOAM_EVENT: - m_auiEncounter[2] = data; - break; - case DATA_BURU_EVENT: - m_auiEncounter[3] = data; - break; - case DATA_AYAMISS_EVENT: - m_auiEncounter[4] = data; - break; - case DATA_OSSIRIAN_EVENT: - m_auiEncounter[5] = data; - break; + switch (pCreature->GetEntry()) + { + case CREATURE_KURINAXX: + uiKurinaxx = pCreature->GetGUID(); + break; + case CREATURE_RAJAXX: + uiRajaxx = pCreature->GetGUID(); + break; + case CREATURE_MOAM: + uiMoam = pCreature->GetGUID(); + break; + case CREATURE_BURU: + uiBuru = pCreature->GetGUID(); + break; + case CREATURE_AYAMISS: + uiAyamiss = pCreature->GetGUID(); + break; + case CREATURE_OSSIRIAN: + uiOssirian = pCreature->GetGUID(); + break; + } } - if (data == DONE) - SaveToDB(); - } - - uint64 GetData64(uint32 uiIdentifier) - { - switch(uiIdentifier) + uint32 GetData(uint32 identifier) { - case DATA_KURINNAXX: return uiKurinaxx; - case DATA_RAJAXX: return uiRajaxx; - case DATA_MOAM: return uiMoam; - case DATA_BURU: return uiBuru; - case DATA_AYAMISS: return uiAyamiss; - case DATA_OSSIRIAN: return uiOssirian; + switch(identifier) + { + case DATA_KURINNAXX_EVENT: return m_auiEncounter[0]; + case DATA_RAJAXX_EVENT: return m_auiEncounter[1]; + case DATA_MOAM_EVENT: return m_auiEncounter[2]; + case DATA_BURU_EVENT: return m_auiEncounter[3]; + case DATA_AYAMISS_EVENT: return m_auiEncounter[4]; + case DATA_OSSIRIAN_EVENT: return m_auiEncounter[5]; + } + + return 0; } - return 0; - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "R A " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " - << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5]; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } + void SetData(uint32 identifier, uint32 data) + { + switch(identifier) + { + case DATA_KURINNAXX_EVENT: + m_auiEncounter[0] = data; + break; + case DATA_RAJAXX_EVENT: + m_auiEncounter[1] = data; + break; + case DATA_MOAM_EVENT: + m_auiEncounter[2] = data; + break; + case DATA_BURU_EVENT: + m_auiEncounter[3] = data; + break; + case DATA_AYAMISS_EVENT: + m_auiEncounter[4] = data; + break; + case DATA_OSSIRIAN_EVENT: + m_auiEncounter[5] = data; + break; + } + + if (data == DONE) + SaveToDB(); + } - void Load(const char* in) - { - if (!in) + uint64 GetData64(uint32 uiIdentifier) { - OUT_LOAD_INST_DATA_FAIL; - return; + switch(uiIdentifier) + { + case DATA_KURINNAXX: return uiKurinaxx; + case DATA_RAJAXX: return uiRajaxx; + case DATA_MOAM: return uiMoam; + case DATA_BURU: return uiBuru; + case DATA_AYAMISS: return uiAyamiss; + case DATA_OSSIRIAN: return uiOssirian; + } + + return 0; } - OUT_LOAD_INST_DATA(in); + std::string GetSaveData() + { + OUT_SAVE_INST_DATA; - char dataHead1, dataHead2; - uint16 data0, data1, data2, data3, data4, data5; + std::ostringstream saveStream; + saveStream << "R A " << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " + << m_auiEncounter[2] << " " << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5]; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; + str_data = saveStream.str(); - if (dataHead1 == 'R' && dataHead2 == 'A') - { - m_auiEncounter[0] = data0; - m_auiEncounter[1] = data1; - m_auiEncounter[2] = data2; - m_auiEncounter[3] = data3; - m_auiEncounter[4] = data4; - m_auiEncounter[5] = data5; + OUT_SAVE_INST_DATA_COMPLETE; + return str_data; + } - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); + + char dataHead1, dataHead2; + uint16 data0, data1, data2, data3, data4, data5; + + std::istringstream loadStream(in); + loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5; + + if (dataHead1 == 'R' && dataHead2 == 'A') + { + m_auiEncounter[0] = data0; + m_auiEncounter[1] = data1; + m_auiEncounter[2] = data2; + m_auiEncounter[3] = data3; + m_auiEncounter[4] = data4; + m_auiEncounter[5] = data5; + + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] == IN_PROGRESS) + m_auiEncounter[i] = NOT_STARTED; + + } else OUT_LOAD_INST_DATA_FAIL; + } + }; - } else OUT_LOAD_INST_DATA_FAIL; - } }; -InstanceData* GetInstanceData_instance_ruins_of_ahn_qiraj(Map* pMap) -{ - return new instance_ruins_of_ahn_qiraj(pMap); -} void AddSC_instance_ruins_of_ahnqiraj() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_ruins_of_ahnqiraj"; - newscript->GetInstanceData = &GetInstanceData_instance_ruins_of_ahn_qiraj; - newscript->RegisterSelf(); + new instance_ruins_of_ahnqiraj(); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index fe7a66ddb1f..826a18a5638 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -36,313 +36,321 @@ EndScriptData */ #define SPELL_HEAL 25807 #define SPELL_FEAR 19408 - -struct boss_kriAI : public ScriptedAI +
class boss_kri : public CreatureScript { - boss_kriAI(Creature *c) : ScriptedAI(c) +public: + boss_kri() : CreatureScript("boss_kri") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); + return new boss_kriAI (pCreature); } - ScriptedInstance *pInstance; - - uint32 Cleave_Timer; - uint32 ToxicVolley_Timer; - uint32 Check_Timer; - - bool VemDead; - bool Death; - - void Reset() + struct boss_kriAI : public ScriptedAI { - Cleave_Timer = 4000 + rand()%4000; - ToxicVolley_Timer = 6000 + rand()%6000; - Check_Timer = 2000; + boss_kriAI(Creature *c) : ScriptedAI(c) + { + pInstance = c->GetInstanceScript(); + } - VemDead = false; - Death = false; - } + InstanceScript *pInstance; - void EnterCombat(Unit * /*who*/) - { - } + uint32 Cleave_Timer; + uint32 ToxicVolley_Timer; + uint32 Check_Timer; - void JustDied(Unit* /*killer*/) - { - if (pInstance) + bool VemDead; + bool Death; + + void Reset() { - if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) - // Unlootable if death - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + Cleave_Timer = 4000 + rand()%4000; + ToxicVolley_Timer = 6000 + rand()%6000; + Check_Timer = 2000; - pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); + VemDead = false; + Death = false; } - } - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; - //Cleave_Timer - if (Cleave_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 5000 + rand()%7000; - } else Cleave_Timer -= diff; + } - //ToxicVolley_Timer - if (ToxicVolley_Timer <= diff) + void JustDied(Unit* /*killer*/) { - DoCast(me->getVictim(), SPELL_TOXIC_VOLLEY); - ToxicVolley_Timer = 10000 + rand()%5000; - } else ToxicVolley_Timer -= diff; + if (pInstance) + { + if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) + // Unlootable if death + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - if (me->GetHealth() <= me->GetMaxHealth() * 0.05 && !Death) - { - DoCast(me->getVictim(), SPELL_POISON_CLOUD); - Death = true; + pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); + } } - - if (!VemDead) + void UpdateAI(const uint32 diff) { - //Checking if Vem is dead. If yes we will enrage. - if (Check_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + //Cleave_Timer + if (Cleave_Timer <= diff) { - if (pInstance && pInstance->GetData(DATA_VEMISDEAD)) - { - DoCast(me, SPELL_ENRAGE); - VemDead = true; - } - Check_Timer = 2000; - } else Check_Timer -=diff; - } + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 5000 + rand()%7000; + } else Cleave_Timer -= diff; - DoMeleeAttackIfReady(); - } -}; + //ToxicVolley_Timer + if (ToxicVolley_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_TOXIC_VOLLEY); + ToxicVolley_Timer = 10000 + rand()%5000; + } else ToxicVolley_Timer -= diff; -struct boss_vemAI : public ScriptedAI -{ - boss_vemAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + if (me->GetHealth() <= me->GetMaxHealth() * 0.05 && !Death) + { + DoCast(me->getVictim(), SPELL_POISON_CLOUD); + Death = true; + } - ScriptedInstance *pInstance; + if (!VemDead) + { + //Checking if Vem is dead. If yes we will enrage. + if (Check_Timer <= diff) + { + if (pInstance && pInstance->GetData(DATA_VEMISDEAD)) + { + DoCast(me, SPELL_ENRAGE); + VemDead = true; + } + Check_Timer = 2000; + } else Check_Timer -=diff; + } - uint32 Charge_Timer; - uint32 KnockBack_Timer; - uint32 Enrage_Timer; + DoMeleeAttackIfReady(); + } + }; - bool Enraged; +}; +
class boss_vem : public CreatureScript +{ +public: + boss_vem() : CreatureScript("boss_vem") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Charge_Timer = 15000 + rand()%12000; - KnockBack_Timer = 8000 + rand()%12000; - Enrage_Timer = 120000; - - Enraged = false; + return new boss_vemAI (pCreature); } - void JustDied(Unit* /*Killer*/) + struct boss_vemAI : public ScriptedAI { - if (pInstance) + boss_vemAI(Creature *c) : ScriptedAI(c) { - pInstance->SetData(DATA_VEM_DEATH, 0); - if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) - // Unlootable if death - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); + pInstance = c->GetInstanceScript(); } - } - void EnterCombat(Unit * /*who*/) - { - } + InstanceScript *pInstance; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Charge_Timer; + uint32 KnockBack_Timer; + uint32 Enrage_Timer; - //Charge_Timer - if (Charge_Timer <= diff) + bool Enraged; + + void Reset() { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) + Charge_Timer = 15000 + rand()%12000; + KnockBack_Timer = 8000 + rand()%12000; + Enrage_Timer = 120000; + + Enraged = false; + } + + void JustDied(Unit* /*Killer*/) + { + if (pInstance) { - DoCast(pTarget, SPELL_CHARGE); - //me->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, true,1); - AttackStart(pTarget); + pInstance->SetData(DATA_VEM_DEATH, 0); + if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) + // Unlootable if death + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); } + } - Charge_Timer = 8000 + rand()%8000; - } else Charge_Timer -= diff; - - //KnockBack_Timer - if (KnockBack_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_KNOCKBACK); - if (DoGetThreat(me->getVictim())) - DoModifyThreatPercent(me->getVictim(),-80); - KnockBack_Timer = 15000 + rand()%10000; - } else KnockBack_Timer -= diff; - - //Enrage_Timer - if (!Enraged && Enrage_Timer <= diff) + } + + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_ENRAGE); - Enraged = true; - } else Charge_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } -}; + //Charge_Timer + if (Charge_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + { + DoCast(pTarget, SPELL_CHARGE); + //me->SendMonsterMove(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0, true,1); + AttackStart(pTarget); + } -struct boss_yaujAI : public ScriptedAI -{ - boss_yaujAI(Creature *c) : ScriptedAI(c) - { - pInstance = c->GetInstanceData(); - } + Charge_Timer = 8000 + rand()%8000; + } else Charge_Timer -= diff; - ScriptedInstance *pInstance; + //KnockBack_Timer + if (KnockBack_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_KNOCKBACK); + if (DoGetThreat(me->getVictim())) + DoModifyThreatPercent(me->getVictim(),-80); + KnockBack_Timer = 15000 + rand()%10000; + } else KnockBack_Timer -= diff; + + //Enrage_Timer + if (!Enraged && Enrage_Timer <= diff) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } else Charge_Timer -= diff; - uint32 Heal_Timer; - uint32 Fear_Timer; - uint32 Check_Timer; + DoMeleeAttackIfReady(); + } + }; - bool VemDead; +}; +
class boss_yauj : public CreatureScript +{ +public: + boss_yauj() : CreatureScript("boss_yauj") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Heal_Timer = 25000 + rand()%15000; - Fear_Timer = 12000 + rand()%12000; - Check_Timer = 2000; - - VemDead = false; + return new boss_yaujAI (pCreature); } - void JustDied(Unit* /*Killer*/) + struct boss_yaujAI : public ScriptedAI { - if (pInstance) + boss_yaujAI(Creature *c) : ScriptedAI(c) { - if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) - // Unlootable if death - me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); - pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); + pInstance = c->GetInstanceScript(); } - for (uint8 i = 0; i < 10; ++i) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - Creature* Summoned = me->SummonCreature(15621,me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,90000); - if (Summoned && pTarget) - Summoned->AI()->AttackStart(pTarget); - } - } + InstanceScript *pInstance; - void EnterCombat(Unit * /*who*/) - { - } + uint32 Heal_Timer; + uint32 Fear_Timer; + uint32 Check_Timer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + bool VemDead; - //Fear_Timer - if (Fear_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_FEAR); - DoResetThreat(); - Fear_Timer = 20000; - } else Fear_Timer -= diff; + Heal_Timer = 25000 + rand()%15000; + Fear_Timer = 12000 + rand()%12000; + Check_Timer = 2000; - //Casting Heal to other twins or herself. - if (Heal_Timer <= diff) + VemDead = false; + } + + void JustDied(Unit* /*Killer*/) { if (pInstance) { - Unit *pKri = Unit::GetUnit((*me), pInstance->GetData64(DATA_KRI)); - Unit *pVem = Unit::GetUnit((*me), pInstance->GetData64(DATA_VEM)); + if (pInstance->GetData(DATA_BUG_TRIO_DEATH) < 2) + // Unlootable if death + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + pInstance->SetData(DATA_BUG_TRIO_DEATH, 1); + } - switch (urand(0,2)) - { - case 0: - if (pKri) - DoCast(pKri, SPELL_HEAL); - break; - case 1: - if (pVem) - DoCast(pVem, SPELL_HEAL); - break; - case 2: - DoCast(me, SPELL_HEAL); - break; - } + for (uint8 i = 0; i < 10; ++i) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + Creature* Summoned = me->SummonCreature(15621,me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),0,TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN,90000); + if (Summoned && pTarget) + Summoned->AI()->AttackStart(pTarget); } + } - Heal_Timer = 15000+rand()%15000; - } else Heal_Timer -= diff; + void EnterCombat(Unit * /*who*/) + { + } - //Checking if Vem is dead. If yes we will enrage. - if (Check_Timer <= diff) + void UpdateAI(const uint32 diff) { - if (!VemDead) + //Return since we have no target + if (!UpdateVictim()) + return; + + //Fear_Timer + if (Fear_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FEAR); + DoResetThreat(); + Fear_Timer = 20000; + } else Fear_Timer -= diff; + + //Casting Heal to other twins or herself. + if (Heal_Timer <= diff) { if (pInstance) { - if (pInstance->GetData(DATA_VEMISDEAD)) + Unit *pKri = Unit::GetUnit((*me), pInstance->GetData64(DATA_KRI)); + Unit *pVem = Unit::GetUnit((*me), pInstance->GetData64(DATA_VEM)); + + switch (urand(0,2)) { - DoCast(me, SPELL_ENRAGE); - VemDead = true; + case 0: + if (pKri) + DoCast(pKri, SPELL_HEAL); + break; + case 1: + if (pVem) + DoCast(pVem, SPELL_HEAL); + break; + case 2: + DoCast(me, SPELL_HEAL); + break; } } - } - Check_Timer = 2000; - } else Check_Timer -= diff; - DoMeleeAttackIfReady(); - } + Heal_Timer = 15000+rand()%15000; + } else Heal_Timer -= diff; + + //Checking if Vem is dead. If yes we will enrage. + if (Check_Timer <= diff) + { + if (!VemDead) + { + if (pInstance) + { + if (pInstance->GetData(DATA_VEMISDEAD)) + { + DoCast(me, SPELL_ENRAGE); + VemDead = true; + } + } + } + Check_Timer = 2000; + } else Check_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_boss_yauj(Creature* pCreature) -{ - return new boss_yaujAI (pCreature); -} -CreatureAI* GetAI_boss_vem(Creature* pCreature) -{ - return new boss_vemAI (pCreature); -} -CreatureAI* GetAI_boss_kri(Creature* pCreature) -{ - return new boss_kriAI (pCreature); -} void AddSC_bug_trio() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_kri"; - newscript->GetAI = &GetAI_boss_kri; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_vem"; - newscript->GetAI = &GetAI_boss_vem; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_yauj"; - newscript->GetAI = &GetAI_boss_yauj; - newscript->RegisterSelf(); + new boss_kri(); + new boss_vem(); + new boss_yauj(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 40314e012e8..27e3c6d0d82 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -163,584 +163,567 @@ const Position FleshTentaclePos[2] = //Kick out position const Position KickPos = { -8545.0f, 1984.0f, -96.0f}; - -struct eye_of_cthunAI : public Scripted_NoMovementAI +
class boss_eye_of_cthun : public CreatureScript { - eye_of_cthunAI(Creature *c) : Scripted_NoMovementAI(c) +public: + boss_eye_of_cthun() : CreatureScript("boss_eye_of_cthun") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInst = c->GetInstanceData(); - if (!pInst) - sLog.outError("TSCR: No Instance eye_of_cthunAI"); + return new eye_of_cthunAI (pCreature); } - ScriptedInstance* pInst; + struct eye_of_cthunAI : public Scripted_NoMovementAI + { + eye_of_cthunAI(Creature *c) : Scripted_NoMovementAI(c) + { + pInst = c->GetInstanceScript(); + if (!pInst) + sLog.outError("TSCR: No Instance eye_of_cthunAI"); + } - //Global variables - uint32 PhaseTimer; + InstanceScript* pInst; - //Eye beam phase - uint32 BeamTimer; - uint32 EyeTentacleTimer; - uint32 ClawTentacleTimer; + //Global variables + uint32 PhaseTimer; - //Dark Glare phase - uint32 DarkGlareTick; - uint32 DarkGlareTickTimer; - float DarkGlareAngle; - bool ClockWise; + //Eye beam phase + uint32 BeamTimer; + uint32 EyeTentacleTimer; + uint32 ClawTentacleTimer; - void Reset() - { - //Phase information - PhaseTimer = 50000; //First dark glare in 50 seconds - - //Eye beam phase 50 seconds - BeamTimer = 3000; - EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam - ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) - - //Dark Beam phase 35 seconds (each tick = 1 second, 35 ticks) - DarkGlareTick = 0; - DarkGlareTickTimer = 1000; - DarkGlareAngle = 0; - ClockWise = false; - - //Reset flags - me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - me->SetVisibility(VISIBILITY_ON); - - //Reset Phase - if (pInst) - pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED); - - //to avoid having a following void zone - Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10); - if (pPortal) - pPortal->SetReactState(REACT_PASSIVE); - } + //Dark Glare phase + uint32 DarkGlareTick; + uint32 DarkGlareTickTimer; + float DarkGlareAngle; + bool ClockWise; - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - if (pInst) - pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); - } - - void SpawnEyeTentacle(float x, float y) - { - if (Creature* Spawned = DoSpawnCreature(MOB_EYE_TENTACLE, x, y, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 500)) - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - if (Spawned->AI()) - Spawned->AI()->AttackStart(pTarget); - } + void Reset() + { + //Phase information + PhaseTimer = 50000; //First dark glare in 50 seconds + + //Eye beam phase 50 seconds + BeamTimer = 3000; + EyeTentacleTimer = 45000; //Always spawns 5 seconds before Dark Beam + ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) + + //Dark Beam phase 35 seconds (each tick = 1 second, 35 ticks) + DarkGlareTick = 0; + DarkGlareTickTimer = 1000; + DarkGlareAngle = 0; + ClockWise = false; + + //Reset flags + me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); + me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetVisibility(VISIBILITY_ON); - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; + //Reset Phase + if (pInst) + pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED); - //No instance - if (!pInst) - return; + //to avoid having a following void zone + Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10); + if (pPortal) + pPortal->SetReactState(REACT_PASSIVE); + } - uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); - if (currentPhase == PHASE_EYE_GREEN_BEAM || currentPhase == PHASE_EYE_RED_BEAM) + void EnterCombat(Unit * /*who*/) { - // EyeTentacleTimer - if (EyeTentacleTimer <= diff) - { - //Spawn the 8 Eye Tentacles in the corret spots - SpawnEyeTentacle(0, 20); //south - SpawnEyeTentacle(10, 10); //south west - SpawnEyeTentacle(20, 0); //west - SpawnEyeTentacle(10, -10); //north west - - SpawnEyeTentacle(0, -20); //north - SpawnEyeTentacle(-10, -10); //north east - SpawnEyeTentacle(-20, 0); // east - SpawnEyeTentacle(-10, 10); // south east - - EyeTentacleTimer = 45000; - } else EyeTentacleTimer -= diff; + DoZoneInCombat(); + if (pInst) + pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); } - switch (currentPhase) + void SpawnEyeTentacle(float x, float y) { - case PHASE_EYE_GREEN_BEAM: - //BeamTimer - if (BeamTimer <= diff) - { - //SPELL_GREEN_BEAM - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - { - me->InterruptNonMeleeSpells(false); - DoCast(pTarget, SPELL_GREEN_BEAM); + if (Creature* Spawned = DoSpawnCreature(MOB_EYE_TENTACLE, x, y, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 500)) + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + if (Spawned->AI()) + Spawned->AI()->AttackStart(pTarget); + } - //Correctly update our target - me->SetUInt64Value(UNIT_FIELD_TARGET, pTarget->GetGUID()); - } + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + return; - //Beam every 3 seconds - BeamTimer = 3000; - } else BeamTimer -= diff; + //No instance + if (!pInst) + return; - //ClawTentacleTimer - if (ClawTentacleTimer <= diff) + uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); + if (currentPhase == PHASE_EYE_GREEN_BEAM || currentPhase == PHASE_EYE_RED_BEAM) + { + // EyeTentacleTimer + if (EyeTentacleTimer <= diff) { - if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + //Spawn the 8 Eye Tentacles in the corret spots + SpawnEyeTentacle(0, 20); //south + SpawnEyeTentacle(10, 10); //south west + SpawnEyeTentacle(20, 0); //west + SpawnEyeTentacle(10, -10); //north west + + SpawnEyeTentacle(0, -20); //north + SpawnEyeTentacle(-10, -10); //north east + SpawnEyeTentacle(-20, 0); // east + SpawnEyeTentacle(-10, 10); // south east + + EyeTentacleTimer = 45000; + } else EyeTentacleTimer -= diff; + } + + switch (currentPhase) + { + case PHASE_EYE_GREEN_BEAM: + //BeamTimer + if (BeamTimer <= diff) { - Creature* Spawned = NULL; + //SPELL_GREEN_BEAM + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + me->InterruptNonMeleeSpells(false); + DoCast(pTarget, SPELL_GREEN_BEAM); - //Spawn claw tentacle on the random target - Spawned = me->SummonCreature(MOB_CLAW_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500); + //Correctly update our target + me->SetUInt64Value(UNIT_FIELD_TARGET, pTarget->GetGUID()); + } - if (Spawned && Spawned->AI()) - Spawned->AI()->AttackStart(pTarget); - } + //Beam every 3 seconds + BeamTimer = 3000; + } else BeamTimer -= diff; - //One claw tentacle every 12.5 seconds - ClawTentacleTimer = 12500; - } else ClawTentacleTimer -= diff; + //ClawTentacleTimer + if (ClawTentacleTimer <= diff) + { + if (Unit* pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + Creature* Spawned = NULL; - //PhaseTimer - if (PhaseTimer <= diff) - { - //Switch to Dark Beam - pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_RED_BEAM); + //Spawn claw tentacle on the random target + Spawned = me->SummonCreature(MOB_CLAW_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500); - me->InterruptNonMeleeSpells(false); - me->SetReactState(REACT_PASSIVE); + if (Spawned && Spawned->AI()) + Spawned->AI()->AttackStart(pTarget); + } - //Remove any target - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + //One claw tentacle every 12.5 seconds + ClawTentacleTimer = 12500; + } else ClawTentacleTimer -= diff; - //Select random target for dark beam to start on - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + //PhaseTimer + if (PhaseTimer <= diff) { - //Face our target - DarkGlareAngle = me->GetAngle(pTarget); - DarkGlareTickTimer = 1000; - DarkGlareTick = 0; - ClockWise = RAND(true, false); - } + //Switch to Dark Beam + pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_RED_BEAM); - //Add red coloration to C'thun - DoCast(me, SPELL_RED_COLORATION, true); - - //Freeze animation - DoCast(me, SPELL_FREEZE_ANIM); - me->SetOrientation(DarkGlareAngle); - me->StopMoving(); + me->InterruptNonMeleeSpells(false); + me->SetReactState(REACT_PASSIVE); - //Darkbeam for 35 seconds - PhaseTimer = 35000; - } else PhaseTimer -= diff; + //Remove any target + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - break; + //Select random target for dark beam to start on + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + { + //Face our target + DarkGlareAngle = me->GetAngle(pTarget); + DarkGlareTickTimer = 1000; + DarkGlareTick = 0; + ClockWise = RAND(true, false); + } - case PHASE_EYE_RED_BEAM: - if (DarkGlareTick < 35) - if (DarkGlareTickTimer <= diff) - { - //Set angle and cast - if (ClockWise) - me->SetOrientation(DarkGlareAngle + ((float)DarkGlareTick*PI/35)); - else - me->SetOrientation(DarkGlareAngle - ((float)DarkGlareTick*PI/35)); + //Add red coloration to C'thun + DoCast(me, SPELL_RED_COLORATION, true); + //Freeze animation + DoCast(me, SPELL_FREEZE_ANIM); + me->SetOrientation(DarkGlareAngle); me->StopMoving(); - //Actual dark glare cast, maybe something missing here? - DoCast(me, SPELL_DARK_GLARE, false); + //Darkbeam for 35 seconds + PhaseTimer = 35000; + } else PhaseTimer -= diff; - //Increase tick - ++DarkGlareTick; + break; - //1 second per tick - DarkGlareTickTimer = 1000; - } else DarkGlareTickTimer -= diff; + case PHASE_EYE_RED_BEAM: + if (DarkGlareTick < 35) + if (DarkGlareTickTimer <= diff) + { + //Set angle and cast + if (ClockWise) + me->SetOrientation(DarkGlareAngle + ((float)DarkGlareTick*PI/35)); + else + me->SetOrientation(DarkGlareAngle - ((float)DarkGlareTick*PI/35)); - //PhaseTimer - if (PhaseTimer <= diff) - { - //Switch to Eye Beam - pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); + me->StopMoving(); - BeamTimer = 3000; - ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) + //Actual dark glare cast, maybe something missing here? + DoCast(me, SPELL_DARK_GLARE, false); - me->InterruptNonMeleeSpells(false); + //Increase tick + ++DarkGlareTick; - //Remove Red coloration from c'thun - me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); + //1 second per tick + DarkGlareTickTimer = 1000; + } else DarkGlareTickTimer -= diff; - //set it back to aggressive - me->SetReactState(REACT_AGGRESSIVE); + //PhaseTimer + if (PhaseTimer <= diff) + { + //Switch to Eye Beam + pInst->SetData(DATA_CTHUN_PHASE, PHASE_EYE_GREEN_BEAM); - //Eye Beam for 50 seconds - PhaseTimer = 50000; - } else PhaseTimer -= diff; + BeamTimer = 3000; + ClawTentacleTimer = 12500; //4 per Eye beam phase (unsure if they spawn during Dark beam) - break; + me->InterruptNonMeleeSpells(false); - //Transition phase - case PHASE_CTHUN_TRANSITION: - //Remove any target - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - me->SetHealth(0); - me->SetVisibility(VISIBILITY_OFF); - break; + //Remove Red coloration from c'thun + me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); + me->RemoveAurasDueToSpell(SPELL_FREEZE_ANIM); - //Dead phase - case PHASE_CTHUN_DONE: - Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10); - if (pPortal) - pPortal->ForcedDespawn(); + //set it back to aggressive + me->SetReactState(REACT_AGGRESSIVE); - me->ForcedDespawn(); - break; - } - } + //Eye Beam for 50 seconds + PhaseTimer = 50000; + } else PhaseTimer -= diff; - void DamageTaken(Unit * /*done_by*/, uint32 &damage) - { - //No instance - if (!pInst) - return; + break; - switch (pInst->GetData(DATA_CTHUN_PHASE)) + //Transition phase + case PHASE_CTHUN_TRANSITION: + //Remove any target + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + me->SetHealth(0); + me->SetVisibility(VISIBILITY_OFF); + break; + + //Dead phase + case PHASE_CTHUN_DONE: + Creature* pPortal= me->FindNearestCreature(MOB_CTHUN_PORTAL, 10); + if (pPortal) + pPortal->ForcedDespawn(); + + me->ForcedDespawn(); + break; + } + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) { - case PHASE_EYE_GREEN_BEAM: - case PHASE_EYE_RED_BEAM: - //Only if it will kill - if (damage < me->GetHealth()) - return; + //No instance + if (!pInst) + return; + + switch (pInst->GetData(DATA_CTHUN_PHASE)) + { + case PHASE_EYE_GREEN_BEAM: + case PHASE_EYE_RED_BEAM: + //Only if it will kill + if (damage < me->GetHealth()) + return; - //Fake death in phase 0 or 1 (green beam or dark glare phase) - me->InterruptNonMeleeSpells(false); + //Fake death in phase 0 or 1 (green beam or dark glare phase) + me->InterruptNonMeleeSpells(false); - //Remove Red coloration from c'thun - me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); + //Remove Red coloration from c'thun + me->RemoveAurasDueToSpell(SPELL_RED_COLORATION); - //Reset to normal emote state and prevent select and attack - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + //Reset to normal emote state and prevent select and attack + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - //Remove Target field - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + //Remove Target field + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - //Death animation/respawning; - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_TRANSITION); + //Death animation/respawning; + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_TRANSITION); - me->SetHealth(0); - damage = 0; + me->SetHealth(0); + damage = 0; - me->InterruptNonMeleeSpells(true); - me->RemoveAllAuras(); - break; + me->InterruptNonMeleeSpells(true); + me->RemoveAllAuras(); + break; - case PHASE_CTHUN_DONE: - //Allow death here - return; + case PHASE_CTHUN_DONE: + //Allow death here + return; - default: - //Prevent death in these phases - damage = 0; - return; + default: + //Prevent death in these phases + damage = 0; + return; + } } - } -}; + }; -struct cthunAI : public Scripted_NoMovementAI +}; +
class boss_cthun : public CreatureScript { - cthunAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); +public: + boss_cthun() : CreatureScript("boss_cthun") { } - pInst = c->GetInstanceData(); - if (!pInst) - sLog.outError("TSCR: No Instance eye_of_cthunAI"); + CreatureAI* GetAI(Creature* pCreature) const + { + return new cthunAI (pCreature); } - ScriptedInstance* pInst; - - //Out of combat whisper timer - uint32 WisperTimer; - - //Global variables - uint32 PhaseTimer; - - //------------------- + struct cthunAI : public Scripted_NoMovementAI + { + cthunAI(Creature *c) : Scripted_NoMovementAI(c) + { + SetCombatMovement(false); - //Phase transition - uint64 HoldPlayer; + pInst = c->GetInstanceScript(); + if (!pInst) + sLog.outError("TSCR: No Instance eye_of_cthunAI"); + } - //Body Phase - uint32 EyeTentacleTimer; - uint8 FleshTentaclesKilled; - uint32 GiantClawTentacleTimer; - uint32 GiantEyeTentacleTimer; - uint32 StomachAcidTimer; - uint32 StomachEnterTimer; - uint32 StomachEnterVisTimer; - uint64 StomachEnterTarget; + InstanceScript* pInst; - //Stomach map, bool = true then in stomach - UNORDERED_MAP<uint64, bool> Stomach_Map; + //Out of combat whisper timer + uint32 WisperTimer; - void Reset() - { - //One random wisper every 90 - 300 seconds - WisperTimer = 90000; + //Global variables + uint32 PhaseTimer; - //Phase information - PhaseTimer = 10000; //Emerge in 10 seconds + //------------------- - //No hold player for transition - HoldPlayer = 0; + //Phase transition + uint64 HoldPlayer; //Body Phase - EyeTentacleTimer = 30000; - FleshTentaclesKilled = 0; - GiantClawTentacleTimer = 15000; //15 seconds into body phase (1 min repeat) - GiantEyeTentacleTimer = 45000; //15 seconds into body phase (1 min repeat) - StomachAcidTimer = 4000; //Every 4 seconds - StomachEnterTimer = 10000; //Every 10 seconds - StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer - StomachEnterTarget = 0; //Target to be teleported to stomach - - //Clear players in stomach and outside - Stomach_Map.clear(); - - //Reset flags - me->RemoveAurasDueToSpell(SPELL_TRANSFORM); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - me->SetVisibility(VISIBILITY_OFF); - - if (pInst) - pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED); - } - - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - } + uint32 EyeTentacleTimer; + uint8 FleshTentaclesKilled; + uint32 GiantClawTentacleTimer; + uint32 GiantEyeTentacleTimer; + uint32 StomachAcidTimer; + uint32 StomachEnterTimer; + uint32 StomachEnterVisTimer; + uint64 StomachEnterTarget; + + //Stomach map, bool = true then in stomach + UNORDERED_MAP<uint64, bool> Stomach_Map; + + void Reset() + { + //One random wisper every 90 - 300 seconds + WisperTimer = 90000; - void SpawnEyeTentacle(float x, float y) - { - Creature* Spawned; - Spawned = DoSpawnCreature(MOB_EYE_TENTACLE, x, y, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 500); - if (Spawned && Spawned->AI()) - if (Unit *pTarget = SelectRandomNotStomach()) - Spawned->AI()->AttackStart(pTarget); - } + //Phase information + PhaseTimer = 10000; //Emerge in 10 seconds - Unit* SelectRandomNotStomach() - { - if (Stomach_Map.empty()) - return NULL; + //No hold player for transition + HoldPlayer = 0; - UNORDERED_MAP<uint64, bool>::const_iterator i = Stomach_Map.begin(); + //Body Phase + EyeTentacleTimer = 30000; + FleshTentaclesKilled = 0; + GiantClawTentacleTimer = 15000; //15 seconds into body phase (1 min repeat) + GiantEyeTentacleTimer = 45000; //15 seconds into body phase (1 min repeat) + StomachAcidTimer = 4000; //Every 4 seconds + StomachEnterTimer = 10000; //Every 10 seconds + StomachEnterVisTimer = 0; //Always 3.5 seconds after Stomach Enter Timer + StomachEnterTarget = 0; //Target to be teleported to stomach + + //Clear players in stomach and outside + Stomach_Map.clear(); + + //Reset flags + me->RemoveAurasDueToSpell(SPELL_TRANSFORM); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); + me->SetVisibility(VISIBILITY_OFF); - std::list<Unit*> temp; - std::list<Unit*>::const_iterator j; + if (pInst) + pInst->SetData(DATA_CTHUN_PHASE, PHASE_NOT_STARTED); + } - //Get all players in map - while (i != Stomach_Map.end()) + void EnterCombat(Unit * /*who*/) { - //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); - - //Only units out of stomach - if (pUnit && i->second == false) - temp.push_back(pUnit); + DoZoneInCombat(); + } - ++i; + void SpawnEyeTentacle(float x, float y) + { + Creature* Spawned; + Spawned = DoSpawnCreature(MOB_EYE_TENTACLE, x, y, 0, 0, TEMPSUMMON_CORPSE_DESPAWN, 500); + if (Spawned && Spawned->AI()) + if (Unit *pTarget = SelectRandomNotStomach()) + Spawned->AI()->AttackStart(pTarget); } - if (temp.empty()) - return NULL; + Unit* SelectRandomNotStomach() + { + if (Stomach_Map.empty()) + return NULL; - j = temp.begin(); + UNORDERED_MAP<uint64, bool>::const_iterator i = Stomach_Map.begin(); - //Get random but only if we have more than one unit on threat list - if (temp.size() > 1) - advance (j , rand() % (temp.size() - 1)); + std::list<Unit*> temp; + std::list<Unit*>::const_iterator j; - return (*j); - } - - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - { - //No target so we'll use this section to do our random wispers instance wide - //WisperTimer - if (WisperTimer <= diff) + //Get all players in map + while (i != Stomach_Map.end()) { - Map* pMap = me->GetMap(); - if (!pMap->IsDungeon()) return; + //Check for valid player + Unit* pUnit = Unit::GetUnit(*me, i->first); - //Play random sound to the zone - Map::PlayerList const &PlayerList = pMap->GetPlayers(); + //Only units out of stomach + if (pUnit && i->second == false) + temp.push_back(pUnit); - if (!PlayerList.isEmpty()) - { - for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) - { - if (Player* pPlr = itr->getSource()) - pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER,pPlr); - } - } - - //One random wisper every 90 - 300 seconds - WisperTimer = urand(90000,300000); - } else WisperTimer -= diff; + ++i; + } - return; - } + if (temp.empty()) + return NULL; - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + j = temp.begin(); - //No instance - if (!pInst) - return; + //Get random but only if we have more than one unit on threat list + if (temp.size() > 1) + advance (j , rand() % (temp.size() - 1)); - uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); - if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK) - { - // EyeTentacleTimer - if (EyeTentacleTimer <= diff) - { - //Spawn the 8 Eye Tentacles in the corret spots - SpawnEyeTentacle(0, 20); //south - SpawnEyeTentacle(10, 10); //south west - SpawnEyeTentacle(20, 0); //west - SpawnEyeTentacle(10, -10); //north west - - SpawnEyeTentacle(0, -20); //north - SpawnEyeTentacle(-10, -10); //north east - SpawnEyeTentacle(-20, 0); // east - SpawnEyeTentacle(-10, 10); // south east - - EyeTentacleTimer = 30000; // every 30sec in phase 2 - } else EyeTentacleTimer -= diff; + return (*j); } - switch (currentPhase) + void UpdateAI(const uint32 diff) { - //Transition phase - case PHASE_CTHUN_TRANSITION: - //PhaseTimer - if (PhaseTimer <= diff) + //Check if we have a target + if (!UpdateVictim()) + { + //No target so we'll use this section to do our random wispers instance wide + //WisperTimer + if (WisperTimer <= diff) { - //Switch - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); - - //Switch to c'thun model - me->InterruptNonMeleeSpells(false); - DoCast(me, SPELL_TRANSFORM, false); - me->SetHealth(me->GetMaxHealth()); - - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - - //Emerging phase - //AttackStart(Unit::GetUnit(*me, HoldpPlayer)); - DoZoneInCombat(); + Map* pMap = me->GetMap(); + if (!pMap->IsDungeon()) return; - //Place all units in threat list on outside of stomach - Stomach_Map.clear(); + //Play random sound to the zone + Map::PlayerList const &PlayerList = pMap->GetPlayers(); - std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); - for (; i != me->getThreatManager().getThreatList().end(); ++i) + if (!PlayerList.isEmpty()) { - //Outside stomach - Stomach_Map[(*i)->getUnitGuid()] = false; + for (Map::PlayerList::const_iterator itr = PlayerList.begin(); itr != PlayerList.end(); ++itr) + { + if (Player* pPlr = itr->getSource()) + pPlr->PlayDirectSound(RANDOM_SOUND_WHISPER,pPlr); + } } - //Spawn 2 flesh tentacles - FleshTentaclesKilled = 0; - - //Spawn flesh tentacle - for (uint8 i = 0; i < 2; i++) - { - Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); - if (!spawned) - ++FleshTentaclesKilled; - } + //One random wisper every 90 - 300 seconds + WisperTimer = urand(90000,300000); + } else WisperTimer -= diff; - PhaseTimer = 0; - } else PhaseTimer -= diff; + return; + } - break; + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - //Body Phase - case PHASE_CTHUN_STOMACH: - //Remove Target field - me->SetUInt64Value(UNIT_FIELD_TARGET, 0); + //No instance + if (!pInst) + return; - //Weaken - if (FleshTentaclesKilled > 1) + uint32 currentPhase = pInst->GetData(DATA_CTHUN_PHASE); + if (currentPhase == PHASE_CTHUN_STOMACH || currentPhase == PHASE_CTHUN_WEAK) + { + // EyeTentacleTimer + if (EyeTentacleTimer <= diff) { - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK); + //Spawn the 8 Eye Tentacles in the corret spots + SpawnEyeTentacle(0, 20); //south + SpawnEyeTentacle(10, 10); //south west + SpawnEyeTentacle(20, 0); //west + SpawnEyeTentacle(10, -10); //north west + + SpawnEyeTentacle(0, -20); //north + SpawnEyeTentacle(-10, -10); //north east + SpawnEyeTentacle(-20, 0); // east + SpawnEyeTentacle(-10, 10); // south east + + EyeTentacleTimer = 30000; // every 30sec in phase 2 + } else EyeTentacleTimer -= diff; + } + + switch (currentPhase) + { + //Transition phase + case PHASE_CTHUN_TRANSITION: + //PhaseTimer + if (PhaseTimer <= diff) + { + //Switch + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); - DoScriptText(EMOTE_WEAKENED, me); - PhaseTimer = 45000; + //Switch to c'thun model + me->InterruptNonMeleeSpells(false); + DoCast(me, SPELL_TRANSFORM, false); + me->SetHealth(me->GetMaxHealth()); - DoCast(me, SPELL_PURPLE_COLORATION, true); + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE | UNIT_FLAG_NON_ATTACKABLE); - UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); + //Emerging phase + //AttackStart(Unit::GetUnit(*me, HoldpPlayer)); + DoZoneInCombat(); - //Kick all players out of stomach - while (i != Stomach_Map.end()) - { - //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); + //Place all units in threat list on outside of stomach + Stomach_Map.clear(); - //Only move units in stomach - if (pUnit && i->second == true) + std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); + for (; i != me->getThreatManager().getThreatList().end(); ++i) { - //Teleport each player out - DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, rand()%6); - - //Cast knockback on them - DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); + //Outside stomach + Stomach_Map[(*i)->getUnitGuid()] = false; + } - //Remove the acid debuff - pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); + //Spawn 2 flesh tentacles + FleshTentaclesKilled = 0; - i->second = false; + //Spawn flesh tentacle + for (uint8 i = 0; i < 2; i++) + { + Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); + if (!spawned) + ++FleshTentaclesKilled; } - ++i; - } - return; - } + PhaseTimer = 0; + } else PhaseTimer -= diff; - //Stomach acid - if (StomachAcidTimer <= diff) - { - //Apply aura to all players in stomach - UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); + break; + + //Body Phase + case PHASE_CTHUN_STOMACH: + //Remove Target field + me->SetUInt64Value(UNIT_FIELD_TARGET, 0); - while (i != Stomach_Map.end()) + //Weaken + if (FleshTentaclesKilled > 1) { - //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_WEAK); + + DoScriptText(EMOTE_WEAKENED, me); + PhaseTimer = 45000; + + DoCast(me, SPELL_PURPLE_COLORATION, true); + + UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); - //Only apply to units in stomach - if (pUnit && i->second == true) + //Kick all players out of stomach + while (i != Stomach_Map.end()) { - //Cast digestive acid on them - DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); + //Check for valid player + Unit* pUnit = Unit::GetUnit(*me, i->first); - //Check if player should be kicked from stomach - if (pUnit->IsWithinDist3d(&KickPos, 15.0f)) + //Only move units in stomach + if (pUnit && i->second == true) { //Teleport each player out DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, rand()%6); @@ -753,259 +736,427 @@ struct cthunAI : public Scripted_NoMovementAI i->second = false; } + ++i; } - ++i; - } - StomachAcidTimer = 4000; - } else StomachAcidTimer -= diff; + return; + } - //Stomach Enter Timer - if (StomachEnterTimer <= diff) - { - if (Unit *pTarget = SelectRandomNotStomach()) + //Stomach acid + if (StomachAcidTimer <= diff) { - //Set target in stomach - Stomach_Map[pTarget->GetGUID()] = true; - pTarget->InterruptNonMeleeSpells(false); - pTarget->CastSpell(pTarget, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); - StomachEnterTarget = pTarget->GetGUID(); - StomachEnterVisTimer = 3800; - } + //Apply aura to all players in stomach + UNORDERED_MAP<uint64, bool>::iterator i = Stomach_Map.begin(); + + while (i != Stomach_Map.end()) + { + //Check for valid player + Unit* pUnit = Unit::GetUnit(*me, i->first); + + //Only apply to units in stomach + if (pUnit && i->second == true) + { + //Cast digestive acid on them + DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); + + //Check if player should be kicked from stomach + if (pUnit->IsWithinDist3d(&KickPos, 15.0f)) + { + //Teleport each player out + DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, rand()%6); - StomachEnterTimer = 13800; - } else StomachEnterTimer -= diff; + //Cast knockback on them + DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); - if (StomachEnterVisTimer && StomachEnterTarget) - if (StomachEnterVisTimer <= diff) + //Remove the acid debuff + pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); + + i->second = false; + } + } + ++i; + } + + StomachAcidTimer = 4000; + } else StomachAcidTimer -= diff; + + //Stomach Enter Timer + if (StomachEnterTimer <= diff) { - //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget); + if (Unit *pTarget = SelectRandomNotStomach()) + { + //Set target in stomach + Stomach_Map[pTarget->GetGUID()] = true; + pTarget->InterruptNonMeleeSpells(false); + pTarget->CastSpell(pTarget, SPELL_MOUTH_TENTACLE, true, NULL, NULL, me->GetGUID()); + StomachEnterTarget = pTarget->GetGUID(); + StomachEnterVisTimer = 3800; + } + + StomachEnterTimer = 13800; + } else StomachEnterTimer -= diff; - if (pUnit) + if (StomachEnterVisTimer && StomachEnterTarget) + if (StomachEnterVisTimer <= diff) { - DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); + //Check for valid player + Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget); + + if (pUnit) + { + DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); + } + + StomachEnterTarget = 0; + StomachEnterVisTimer = 0; + } else StomachEnterVisTimer -= diff; + + //GientClawTentacleTimer + if (GiantClawTentacleTimer <= diff) + { + if (Unit *pTarget = SelectRandomNotStomach()) + { + //Spawn claw tentacle on the random target + if (Creature* spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500)) + if (spawned->AI()) + spawned->AI()->AttackStart(pTarget); } - StomachEnterTarget = 0; - StomachEnterVisTimer = 0; - } else StomachEnterVisTimer -= diff; + //One giant claw tentacle every minute + GiantClawTentacleTimer = 60000; + } else GiantClawTentacleTimer -= diff; - //GientClawTentacleTimer - if (GiantClawTentacleTimer <= diff) - { - if (Unit *pTarget = SelectRandomNotStomach()) + //GiantEyeTentacleTimer + if (GiantEyeTentacleTimer <= diff) { - //Spawn claw tentacle on the random target - if (Creature* spawned = me->SummonCreature(MOB_GIANT_CLAW_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500)) - if (spawned->AI()) - spawned->AI()->AttackStart(pTarget); - } + if (Unit *pTarget = SelectRandomNotStomach()) + { + //Spawn claw tentacle on the random target + if (Creature* spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500)) + if (spawned->AI()) + spawned->AI()->AttackStart(pTarget); + } - //One giant claw tentacle every minute - GiantClawTentacleTimer = 60000; - } else GiantClawTentacleTimer -= diff; + //One giant eye tentacle every minute + GiantEyeTentacleTimer = 60000; + } else GiantEyeTentacleTimer -= diff; - //GiantEyeTentacleTimer - if (GiantEyeTentacleTimer <= diff) - { - if (Unit *pTarget = SelectRandomNotStomach()) + break; + + //Weakened state + case PHASE_CTHUN_WEAK: + //PhaseTimer + if (PhaseTimer <= diff) { - //Spawn claw tentacle on the random target - if (Creature* spawned = me->SummonCreature(MOB_GIANT_EYE_TENTACLE, *pTarget, TEMPSUMMON_CORPSE_DESPAWN, 500)) - if (spawned->AI()) - spawned->AI()->AttackStart(pTarget); - } + //Switch + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); - //One giant eye tentacle every minute - GiantEyeTentacleTimer = 60000; - } else GiantEyeTentacleTimer -= diff; + //Remove purple coloration + me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION); - break; + //Spawn 2 flesh tentacles + FleshTentaclesKilled = 0; - //Weakened state - case PHASE_CTHUN_WEAK: - //PhaseTimer - if (PhaseTimer <= diff) - { - //Switch - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_STOMACH); + //Spawn flesh tentacle + for (uint8 i = 0; i < 2; i++) + { + Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); + if (!spawned) + ++FleshTentaclesKilled; + } - //Remove purple coloration - me->RemoveAurasDueToSpell(SPELL_PURPLE_COLORATION); + PhaseTimer = 0; + } else PhaseTimer -= diff; - //Spawn 2 flesh tentacles - FleshTentaclesKilled = 0; + break; + } + } - //Spawn flesh tentacle - for (uint8 i = 0; i < 2; i++) - { - Creature* spawned = me->SummonCreature(MOB_FLESH_TENTACLE, FleshTentaclePos[i], TEMPSUMMON_CORPSE_DESPAWN); - if (!spawned) - ++FleshTentaclesKilled; - } + void JustDied(Unit* /*pKiller*/) + { + if (pInst) + pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_DONE); + } + + void DamageTaken(Unit * /*done_by*/, uint32 &damage) + { + //No instance + if (!pInst) + return; + + switch (pInst->GetData(DATA_CTHUN_PHASE)) + { + case PHASE_CTHUN_STOMACH: + //Not weakened so reduce damage by 99% + damage /= 100; + if (damage == 0) + damage = 1; - PhaseTimer = 0; - } else PhaseTimer -= diff; + //Prevent death in non-weakened state + if (damage >= me->GetHealth()) + damage = 0; - break; + return; + + case PHASE_CTHUN_WEAK: + //Weakened - takes normal damage + return; + + default: + damage = 0; + break; + } } - } - void JustDied(Unit* /*pKiller*/) + void DoAction(const int32 param) + { + switch(param) + { + case ACTION_FLESH_TENTACLE_KILLED: + ++FleshTentaclesKilled; + break; + } + } + }; + +}; +
class mob_eye_tentacle : public CreatureScript +{ +public: + mob_eye_tentacle() : CreatureScript("mob_eye_tentacle") { } + + CreatureAI* GetAI(Creature* pCreature) const { - if (pInst) - pInst->SetData(DATA_CTHUN_PHASE, PHASE_CTHUN_DONE); + return new eye_tentacleAI (pCreature); } - void DamageTaken(Unit * /*done_by*/, uint32 &damage) + struct eye_tentacleAI : public Scripted_NoMovementAI { - //No instance - if (!pInst) - return; - - switch (pInst->GetData(DATA_CTHUN_PHASE)) + eye_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) { - case PHASE_CTHUN_STOMACH: - //Not weakened so reduce damage by 99% - damage /= 100; - if (damage == 0) - damage = 1; - - //Prevent death in non-weakened state - if (damage >= me->GetHealth()) - damage = 0; + if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } + } - return; + uint32 MindflayTimer; + uint32 KillSelfTimer; + uint64 Portal; - case PHASE_CTHUN_WEAK: - //Weakened - takes normal damage - return; + void JustDied(Unit* /*who*/) + { + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); + } + + void Reset() + { + //Mind flay half a second after we spawn + MindflayTimer = 500; - default: - damage = 0; - break; + //This prevents eyes from overlapping + KillSelfTimer = 35000; } - } - void DoAction(const int32 param) - { - switch(param) + void EnterCombat(Unit * /*who*/) { - case ACTION_FLESH_TENTACLE_KILLED: - ++FleshTentaclesKilled; - break; + DoZoneInCombat(); } - } -}; -struct eye_tentacleAI : public Scripted_NoMovementAI -{ - eye_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) - { - if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + void UpdateAI(const uint32 diff) { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); + //Check if we have a target + if (!UpdateVictim()) + return; + + //KillSelfTimer + if (KillSelfTimer <= diff) + { + me->Kill(me); + return; + } else KillSelfTimer -= diff; + + //MindflayTimer + if (MindflayTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && !pTarget->HasAura(SPELL_DIGESTIVE_ACID)) + DoCast(pTarget, SPELL_MIND_FLAY); + + //Mindflay every 10 seconds + MindflayTimer = 10000; + } else MindflayTimer -= diff; } - } + }; - uint32 MindflayTimer; - uint32 KillSelfTimer; - uint64 Portal; +}; +
class mob_claw_tentacle : public CreatureScript +{ +public: + mob_claw_tentacle() : CreatureScript("mob_claw_tentacle") { } - void JustDied(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); + return new claw_tentacleAI (pCreature); } - void Reset() + struct claw_tentacleAI : public Scripted_NoMovementAI { - //Mind flay half a second after we spawn - MindflayTimer = 500; + claw_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) + { + SetCombatMovement(false); - //This prevents eyes from overlapping - KillSelfTimer = 35000; - } + if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } + } - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - } + uint32 GroundRuptureTimer; + uint32 HamstringTimer; + uint32 EvadeTimer; + uint64 Portal; - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; + void JustDied(Unit* /*who*/) + { + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); + } - //KillSelfTimer - if (KillSelfTimer <= diff) + void Reset() { - me->Kill(me); - return; - } else KillSelfTimer -= diff; + //First rupture should happen half a second after we spawn + GroundRuptureTimer = 500; + HamstringTimer = 2000; + EvadeTimer = 5000; + } - //MindflayTimer - if (MindflayTimer <= diff) + void EnterCombat(Unit * /*who*/) { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && !pTarget->HasAura(SPELL_DIGESTIVE_ACID)) - DoCast(pTarget, SPELL_MIND_FLAY); + DoZoneInCombat(); + } - //Mindflay every 10 seconds - MindflayTimer = 10000; - } else MindflayTimer -= diff; - } -}; + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + return; -struct claw_tentacleAI : public Scripted_NoMovementAI -{ - claw_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); + //EvadeTimer + if (!me->IsWithinMeleeRange(me->getVictim())) + if (EvadeTimer <= diff) + { + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); - if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) - { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); + //Dissapear and reappear at new position + me->SetVisibility(VISIBILITY_OFF); + + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (!pTarget) + { + me->Kill(me); + return; + } + + if (!pTarget->HasAura(SPELL_DIGESTIVE_ACID)) + { + me->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0); + if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } + + GroundRuptureTimer = 500; + HamstringTimer = 2000; + EvadeTimer = 5000; + AttackStart(pTarget); + } + + me->SetVisibility(VISIBILITY_ON); + } else EvadeTimer -= diff; + + //GroundRuptureTimer + if (GroundRuptureTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); + GroundRuptureTimer = 30000; + } else GroundRuptureTimer -= diff; + + //HamstringTimer + if (HamstringTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + HamstringTimer = 5000; + } else HamstringTimer -= diff; + + DoMeleeAttackIfReady(); } - } + }; - uint32 GroundRuptureTimer; - uint32 HamstringTimer; - uint32 EvadeTimer; - uint64 Portal; +}; +
class mob_giant_claw_tentacle : public CreatureScript +{ +public: + mob_giant_claw_tentacle() : CreatureScript("mob_giant_claw_tentacle") { } - void JustDied(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); + return new giant_claw_tentacleAI (pCreature); } - void Reset() + struct giant_claw_tentacleAI : public Scripted_NoMovementAI { - //First rupture should happen half a second after we spawn - GroundRuptureTimer = 500; - HamstringTimer = 2000; - EvadeTimer = 5000; - } + giant_claw_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) + { + SetCombatMovement(false); - void EnterCombat(Unit * /*who*/) - { - DoZoneInCombat(); - } + if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + { + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); + } + } - void UpdateAI(const uint32 diff) - { - //Check if we have a target - if (!UpdateVictim()) - return; + uint32 GroundRuptureTimer; + uint32 ThrashTimer; + uint32 HamstringTimer; + uint32 EvadeTimer; + uint64 Portal; + + void JustDied(Unit* /*who*/) + { + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); + } - //EvadeTimer - if (!me->IsWithinMeleeRange(me->getVictim())) - if (EvadeTimer <= diff) + void Reset() + { + //First rupture should happen half a second after we spawn + GroundRuptureTimer = 500; + HamstringTimer = 2000; + ThrashTimer = 5000; + EvadeTimer = 5000; + } + + void EnterCombat(Unit * /*who*/) + { + DoZoneInCombat(); + } + + void UpdateAI(const uint32 diff) + { + //Check if we have a target + if (!UpdateVictim()) + return; + + //EvadeTimer + if (!me->IsWithinMeleeRange(me->getVictim())) + if (EvadeTimer <= diff) { if (Unit* p = Unit::GetUnit(*me, Portal)) p->Kill(p); @@ -1013,7 +1164,7 @@ struct claw_tentacleAI : public Scripted_NoMovementAI //Dissapear and reappear at new position me->SetVisibility(VISIBILITY_OFF); - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); if (!pTarget) { me->Kill(me); @@ -1023,7 +1174,7 @@ struct claw_tentacleAI : public Scripted_NoMovementAI if (!pTarget->HasAura(SPELL_DIGESTIVE_ACID)) { me->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0); - if (Creature* pPortal = me->SummonCreature(MOB_SMALL_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { pPortal->SetReactState(REACT_PASSIVE); Portal = pPortal->GetGUID(); @@ -1031,279 +1182,147 @@ struct claw_tentacleAI : public Scripted_NoMovementAI GroundRuptureTimer = 500; HamstringTimer = 2000; + ThrashTimer = 5000; EvadeTimer = 5000; AttackStart(pTarget); } me->SetVisibility(VISIBILITY_ON); - } else EvadeTimer -= diff; - //GroundRuptureTimer - if (GroundRuptureTimer <= diff) - { - DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); - GroundRuptureTimer = 30000; - } else GroundRuptureTimer -= diff; + } else EvadeTimer -= diff; - //HamstringTimer - if (HamstringTimer <= diff) - { - DoCast(me->getVictim(), SPELL_HAMSTRING); - HamstringTimer = 5000; - } else HamstringTimer -= diff; + //GroundRuptureTimer + if (GroundRuptureTimer <= diff) + { + DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); + GroundRuptureTimer = 30000; + } else GroundRuptureTimer -= diff; - DoMeleeAttackIfReady(); - } -}; + //ThrashTimer + if (ThrashTimer <= diff) + { + DoCast(me->getVictim(), SPELL_THRASH); + ThrashTimer = 10000; + } else ThrashTimer -= diff; -struct giant_claw_tentacleAI : public Scripted_NoMovementAI -{ - giant_claw_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); + //HamstringTimer + if (HamstringTimer <= diff) + { + DoCast(me->getVictim(), SPELL_HAMSTRING); + HamstringTimer = 10000; + } else HamstringTimer -= diff; - if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) - { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); + DoMeleeAttackIfReady(); } - } + }; - uint32 GroundRuptureTimer; - uint32 ThrashTimer; - uint32 HamstringTimer; - uint32 EvadeTimer; - uint64 Portal; - - void JustDied(Unit* /*who*/) - { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); - } - - void Reset() - { - //First rupture should happen half a second after we spawn - GroundRuptureTimer = 500; - HamstringTimer = 2000; - ThrashTimer = 5000; - EvadeTimer = 5000; - } +}; +
class mob_giant_eye_tentacle : public CreatureScript +{ +public: + mob_giant_eye_tentacle() : CreatureScript("mob_giant_eye_tentacle") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoZoneInCombat(); + return new giant_eye_tentacleAI (pCreature); } - void UpdateAI(const uint32 diff) + struct giant_eye_tentacleAI : public Scripted_NoMovementAI { - //Check if we have a target - if (!UpdateVictim()) - return; - - //EvadeTimer - if (!me->IsWithinMeleeRange(me->getVictim())) - if (EvadeTimer <= diff) + giant_eye_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); - - //Dissapear and reappear at new position - me->SetVisibility(VISIBILITY_OFF); - - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM, 0); - if (!pTarget) - { - me->Kill(me); - return; - } + SetCombatMovement(false); - if (!pTarget->HasAura(SPELL_DIGESTIVE_ACID)) + if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) { - me->GetMap()->CreatureRelocation(me, pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ(), 0); - if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) - { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); - } - - GroundRuptureTimer = 500; - HamstringTimer = 2000; - ThrashTimer = 5000; - EvadeTimer = 5000; - AttackStart(pTarget); + pPortal->SetReactState(REACT_PASSIVE); + Portal = pPortal->GetGUID(); } + } - me->SetVisibility(VISIBILITY_ON); - - } else EvadeTimer -= diff; + uint32 BeamTimer; + uint64 Portal; - //GroundRuptureTimer - if (GroundRuptureTimer <= diff) + void JustDied(Unit* /*who*/) { - DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); - GroundRuptureTimer = 30000; - } else GroundRuptureTimer -= diff; + if (Unit* p = Unit::GetUnit(*me, Portal)) + p->Kill(p); + } - //ThrashTimer - if (ThrashTimer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_THRASH); - ThrashTimer = 10000; - } else ThrashTimer -= diff; + //Green Beam half a second after we spawn + BeamTimer = 500; + } - //HamstringTimer - if (HamstringTimer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_HAMSTRING); - HamstringTimer = 10000; - } else HamstringTimer -= diff; - - DoMeleeAttackIfReady(); - } -}; - -struct giant_eye_tentacleAI : public Scripted_NoMovementAI -{ - giant_eye_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); + DoZoneInCombat(); + } - if (Creature* pPortal = me->SummonCreature(MOB_GIANT_PORTAL, *me, TEMPSUMMON_CORPSE_DESPAWN)) + void UpdateAI(const uint32 diff) { - pPortal->SetReactState(REACT_PASSIVE); - Portal = pPortal->GetGUID(); - } - } + //Check if we have a target + if (!UpdateVictim()) + return; - uint32 BeamTimer; - uint64 Portal; + //BeamTimer + if (BeamTimer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && !pTarget->HasAura(SPELL_DIGESTIVE_ACID)) + DoCast(pTarget, SPELL_GREEN_BEAM); - void JustDied(Unit* /*who*/) - { - if (Unit* p = Unit::GetUnit(*me, Portal)) - p->Kill(p); - } + //Beam every 2 seconds + BeamTimer = 2100; + } else BeamTimer -= diff; + } + }; - void Reset() - { - //Green Beam half a second after we spawn - BeamTimer = 500; - } +}; +
class mob_giant_flesh_tentacle : public CreatureScript +{ +public: + mob_giant_flesh_tentacle() : CreatureScript("mob_giant_flesh_tentacle") { } - void EnterCombat(Unit * /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoZoneInCombat(); + return new flesh_tentacleAI (pCreature); } - void UpdateAI(const uint32 diff) + struct flesh_tentacleAI : public Scripted_NoMovementAI { - //Check if we have a target - if (!UpdateVictim()) - return; - - //BeamTimer - if (BeamTimer <= diff) + flesh_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && !pTarget->HasAura(SPELL_DIGESTIVE_ACID)) - DoCast(pTarget, SPELL_GREEN_BEAM); - - //Beam every 2 seconds - BeamTimer = 2100; - } else BeamTimer -= diff; - } -}; + SetCombatMovement(false); + } -struct flesh_tentacleAI : public Scripted_NoMovementAI -{ - flesh_tentacleAI(Creature *c) : Scripted_NoMovementAI(c) - { - SetCombatMovement(false); - } + void JustDied(Unit* /*killer*/) + { + if (CAST_SUM(me)) + if (Creature* pSummoner = CAST_CRE(CAST_SUM(me)->GetSummoner())) + if (pSummoner->AI()) + pSummoner->AI()->DoAction(ACTION_FLESH_TENTACLE_KILLED); + } + }; - void JustDied(Unit* /*killer*/) - { - if (CAST_SUM(me)) - if (Creature* pSummoner = CAST_CRE(CAST_SUM(me)->GetSummoner())) - if (pSummoner->AI()) - pSummoner->AI()->DoAction(ACTION_FLESH_TENTACLE_KILLED); - } }; //GetAIs -CreatureAI* GetAI_eye_of_cthun(Creature* pCreature) -{ - return new eye_of_cthunAI (pCreature); -} -CreatureAI* GetAI_cthun(Creature* pCreature) -{ - return new cthunAI (pCreature); -} -CreatureAI* GetAI_eye_tentacle(Creature* pCreature) -{ - return new eye_tentacleAI (pCreature); -} -CreatureAI* GetAI_claw_tentacle(Creature* pCreature) -{ - return new claw_tentacleAI (pCreature); -} -CreatureAI* GetAI_giant_claw_tentacle(Creature* pCreature) -{ - return new giant_claw_tentacleAI (pCreature); -} -CreatureAI* GetAI_giant_eye_tentacle(Creature* pCreature) -{ - return new giant_eye_tentacleAI (pCreature); -} -CreatureAI* GetAI_flesh_tentacle(Creature* pCreature) -{ - return new flesh_tentacleAI (pCreature); -} void AddSC_boss_cthun() { - Script *newscript; - - //Eye - newscript = new Script; - newscript->Name = "boss_eye_of_cthun"; - newscript->GetAI = &GetAI_eye_of_cthun; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_cthun"; - newscript->GetAI = &GetAI_cthun; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_eye_tentacle"; - newscript->GetAI = &GetAI_eye_tentacle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_claw_tentacle"; - newscript->GetAI = &GetAI_claw_tentacle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_giant_claw_tentacle"; - newscript->GetAI = &GetAI_giant_claw_tentacle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_giant_eye_tentacle"; - newscript->GetAI = &GetAI_giant_eye_tentacle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_giant_flesh_tentacle"; - newscript->GetAI = &GetAI_flesh_tentacle; - newscript->RegisterSelf(); + new boss_eye_of_cthun(); + new boss_cthun(); + new mob_eye_tentacle(); + new mob_claw_tentacle(); + new mob_giant_claw_tentacle(); + new mob_giant_eye_tentacle(); + new mob_giant_flesh_tentacle(); } diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp index 5bcc9598ebf..deddb038909 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_fankriss.cpp @@ -36,173 +36,175 @@ EndScriptData */ // Enrage for his spawns #define SPELL_ENRAGE 28798 - -struct boss_fankrissAI : public ScriptedAI +
class boss_fankriss : public CreatureScript { - boss_fankrissAI(Creature *c) : ScriptedAI(c) {} - - uint32 MortalWound_Timer; - uint32 SpawnHatchlings_Timer; - uint32 SpawnSpawns_Timer; - int Rand; - int RandX; - int RandY; +public: + boss_fankriss() : CreatureScript("boss_fankriss") { } - Creature* Hatchling; - Creature* Spawn; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - MortalWound_Timer = 10000 + rand()%5000; - SpawnHatchlings_Timer = 6000 + rand()%6000; - SpawnSpawns_Timer = 15000 + rand()%30000; + return new boss_fankrissAI (pCreature); } - void SummonSpawn(Unit* victim) + struct boss_fankrissAI : public ScriptedAI { - if (!victim) - return; + boss_fankrissAI(Creature *c) : ScriptedAI(c) {} - Rand = 10 + (rand()%10); - switch (rand()%2) - { - case 0: RandX = 0 - Rand; break; - case 1: RandX = 0 + Rand; break; - } - Rand = 0; - Rand = 10 + (rand()%10); - switch (rand()%2) + uint32 MortalWound_Timer; + uint32 SpawnHatchlings_Timer; + uint32 SpawnSpawns_Timer; + int Rand; + int RandX; + int RandY; + + Creature* Hatchling; + Creature* Spawn; + + void Reset() { - case 0: RandY = 0 - Rand; break; - case 1: RandY = 0 + Rand; break; + MortalWound_Timer = 10000 + rand()%5000; + SpawnHatchlings_Timer = 6000 + rand()%6000; + SpawnSpawns_Timer = 15000 + rand()%30000; } - Rand = 0; - Spawn = DoSpawnCreature(15630, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - if (Spawn) - Spawn->AI()->AttackStart(victim); - } - void EnterCombat(Unit * /*who*/) - { - } + void SummonSpawn(Unit* victim) + { + if (!victim) + return; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + Rand = 10 + (rand()%10); + switch (rand()%2) + { + case 0: RandX = 0 - Rand; break; + case 1: RandX = 0 + Rand; break; + } + Rand = 0; + Rand = 10 + (rand()%10); + switch (rand()%2) + { + case 0: RandY = 0 - Rand; break; + case 1: RandY = 0 + Rand; break; + } + Rand = 0; + Spawn = DoSpawnCreature(15630, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + if (Spawn) + Spawn->AI()->AttackStart(victim); + } - //MortalWound_Timer - if (MortalWound_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_MORTAL_WOUND); - MortalWound_Timer = 10000 + rand()%10000; - } else MortalWound_Timer -= diff; + } - //Summon 1-3 Spawns of Fankriss at random time. - if (SpawnSpawns_Timer <= diff) + void UpdateAI(const uint32 diff) { - switch (urand(0,2)) + //Return since we have no target + if (!UpdateVictim()) + return; + + //MortalWound_Timer + if (MortalWound_Timer <= diff) { - case 0: - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - break; - case 1: - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - break; - case 2: - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); - break; - } - SpawnSpawns_Timer = 30000 + rand()%30000; - } else SpawnSpawns_Timer -= diff; + DoCast(me->getVictim(), SPELL_MORTAL_WOUND); + MortalWound_Timer = 10000 + rand()%10000; + } else MortalWound_Timer -= diff; - // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer. - //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot. - if (me->GetHealth()*100 / me->GetMaxHealth() > 3) - { - if (SpawnHatchlings_Timer <= diff) + //Summon 1-3 Spawns of Fankriss at random time. + if (SpawnSpawns_Timer <= diff) { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) + switch (urand(0,2)) { - DoCast(pTarget, SPELL_ROOT); - - if (DoGetThreat(pTarget)) - DoModifyThreatPercent(pTarget, -100); + case 0: + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + break; + case 1: + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + break; + case 2: + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + SummonSpawn(SelectUnit(SELECT_TARGET_RANDOM,0)); + break; + } + SpawnSpawns_Timer = 30000 + rand()%30000; + } else SpawnSpawns_Timer -= diff; - switch(urand(0,2)) + // Teleporting Random Target to one of the three tunnels and spawn 4 hatchlings near the gamer. + //We will only telport if fankriss has more than 3% of hp so teleported gamers can always loot. + if (me->GetHealth()*100 / me->GetMaxHealth() > 3) + { + if (SpawnHatchlings_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget && pTarget->GetTypeId() == TYPEID_PLAYER) { - case 0: - DoTeleportPlayer(pTarget, -8106.0142,1289.2900,-74.419533,5.112); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - break; - case 1: - DoTeleportPlayer(pTarget, -7990.135354,1155.1907,-78.849319,2.608); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - break; - case 2: - DoTeleportPlayer(pTarget,-8159.7753,1127.9064,-76.868660,0.675); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); - if (Hatchling) - Hatchling->AI()->AttackStart(pTarget); - break; + DoCast(pTarget, SPELL_ROOT); + + if (DoGetThreat(pTarget)) + DoModifyThreatPercent(pTarget, -100); + + switch(urand(0,2)) + { + case 0: + DoTeleportPlayer(pTarget, -8106.0142,1289.2900,-74.419533,5.112); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + break; + case 1: + DoTeleportPlayer(pTarget, -7990.135354,1155.1907,-78.849319,2.608); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + break; + case 2: + DoTeleportPlayer(pTarget,-8159.7753,1127.9064,-76.868660,0.675); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()-3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-3, pTarget->GetPositionY()+3, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()-5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + Hatchling = me->SummonCreature(15962, pTarget->GetPositionX()-5, pTarget->GetPositionY()+5, pTarget->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000); + if (Hatchling) + Hatchling->AI()->AttackStart(pTarget); + break; + } } - } - SpawnHatchlings_Timer = 45000 + rand()%15000; - } else SpawnHatchlings_Timer -= diff; + SpawnHatchlings_Timer = 45000 + rand()%15000; + } else SpawnHatchlings_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_fankriss(Creature* pCreature) -{ - return new boss_fankrissAI (pCreature); -} void AddSC_boss_fankriss() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_fankriss"; - newscript->GetAI = &GetAI_boss_fankriss; - newscript->RegisterSelf(); + new boss_fankriss(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp index 468d535c48a..9c4345144fd 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_huhuran.cpp @@ -34,117 +34,119 @@ EndScriptData */ #define SPELL_NOXIOUSPOISON 26053 #define SPELL_WYVERNSTING 26180 #define SPELL_ACIDSPIT 26050 - -struct boss_huhuranAI : public ScriptedAI +
class boss_huhuran : public CreatureScript { - boss_huhuranAI(Creature *c) : ScriptedAI(c) {} - - uint32 Frenzy_Timer; - uint32 Wyvern_Timer; - uint32 Spit_Timer; - uint32 PoisonBolt_Timer; - uint32 NoxiousPoison_Timer; - uint32 FrenzyBack_Timer; +public: + boss_huhuran() : CreatureScript("boss_huhuran") { } - bool Frenzy; - bool Berserk; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Frenzy_Timer = 25000 + rand()%10000; - Wyvern_Timer = 18000 + rand()%10000; - Spit_Timer = 8000; - PoisonBolt_Timer = 4000; - NoxiousPoison_Timer = 10000 + rand()%10000; - FrenzyBack_Timer = 15000; - - Frenzy = false; - Berserk = false; + return new boss_huhuranAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_huhuranAI : public ScriptedAI { - } + boss_huhuranAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Frenzy_Timer; + uint32 Wyvern_Timer; + uint32 Spit_Timer; + uint32 PoisonBolt_Timer; + uint32 NoxiousPoison_Timer; + uint32 FrenzyBack_Timer; + + bool Frenzy; + bool Berserk; - //Frenzy_Timer - if (!Frenzy && Frenzy_Timer <= diff) + void Reset() { - DoCast(me, SPELL_FRENZY); - DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); - Frenzy = true; - PoisonBolt_Timer = 3000; Frenzy_Timer = 25000 + rand()%10000; - } else Frenzy_Timer -= diff; + Wyvern_Timer = 18000 + rand()%10000; + Spit_Timer = 8000; + PoisonBolt_Timer = 4000; + NoxiousPoison_Timer = 10000 + rand()%10000; + FrenzyBack_Timer = 15000; - // Wyvern Timer - if (Wyvern_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_WYVERNSTING); - Wyvern_Timer = 15000 + rand()%17000; - } else Wyvern_Timer -= diff; + Frenzy = false; + Berserk = false; + } - //Spit Timer - if (Spit_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - DoCast(me->getVictim(), SPELL_ACIDSPIT); - Spit_Timer = 5000 + rand()%5000; - } else Spit_Timer -= diff; + } - //NoxiousPoison_Timer - if (NoxiousPoison_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_NOXIOUSPOISON); - NoxiousPoison_Timer = 12000 + rand()%12000; - } else NoxiousPoison_Timer -= diff; + //Return since we have no target + if (!UpdateVictim()) + return; - //PoisonBolt only if frenzy or berserk - if (Frenzy || Berserk) - { - if (PoisonBolt_Timer <= diff) + //Frenzy_Timer + if (!Frenzy && Frenzy_Timer <= diff) { - DoCast(me->getVictim(), SPELL_POISONBOLT); + DoCast(me, SPELL_FRENZY); + DoScriptText(EMOTE_GENERIC_FRENZY_KILL, me); + Frenzy = true; PoisonBolt_Timer = 3000; - } else PoisonBolt_Timer -= diff; - } + Frenzy_Timer = 25000 + rand()%10000; + } else Frenzy_Timer -= diff; - //FrenzyBack_Timer - if (Frenzy && FrenzyBack_Timer <= diff) - { - me->InterruptNonMeleeSpells(false); - Frenzy = false; - FrenzyBack_Timer = 15000; - } else FrenzyBack_Timer -= diff; + // Wyvern Timer + if (Wyvern_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_WYVERNSTING); + Wyvern_Timer = 15000 + rand()%17000; + } else Wyvern_Timer -= diff; - if (!Berserk && me->GetHealth()*100 / me->GetMaxHealth() < 31) - { - me->InterruptNonMeleeSpells(false); - DoScriptText(EMOTE_GENERIC_BERSERK, me); - DoCast(me, SPELL_BERSERK); - Berserk = true; + //Spit Timer + if (Spit_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ACIDSPIT); + Spit_Timer = 5000 + rand()%5000; + } else Spit_Timer -= diff; + + //NoxiousPoison_Timer + if (NoxiousPoison_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_NOXIOUSPOISON); + NoxiousPoison_Timer = 12000 + rand()%12000; + } else NoxiousPoison_Timer -= diff; + + //PoisonBolt only if frenzy or berserk + if (Frenzy || Berserk) + { + if (PoisonBolt_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_POISONBOLT); + PoisonBolt_Timer = 3000; + } else PoisonBolt_Timer -= diff; + } + + //FrenzyBack_Timer + if (Frenzy && FrenzyBack_Timer <= diff) + { + me->InterruptNonMeleeSpells(false); + Frenzy = false; + FrenzyBack_Timer = 15000; + } else FrenzyBack_Timer -= diff; + + if (!Berserk && me->GetHealth()*100 / me->GetMaxHealth() < 31) + { + me->InterruptNonMeleeSpells(false); + DoScriptText(EMOTE_GENERIC_BERSERK, me); + DoCast(me, SPELL_BERSERK); + Berserk = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_huhuran(Creature* pCreature) -{ - return new boss_huhuranAI (pCreature); -} void AddSC_boss_huhuran() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_huhuran"; - newscript->GetAI = &GetAI_boss_huhuran; - newscript->RegisterSelf(); + new boss_huhuran(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp index 7a07c8f81a3..5365c349791 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_ouro.cpp @@ -32,111 +32,113 @@ EndScriptData */ #define SPELL_BIRTH 26262 //The Birth Animation #define SPELL_DIRTMOUND_PASSIVE 26092 - -struct boss_ouroAI : public ScriptedAI +
class boss_ouro : public CreatureScript { - boss_ouroAI(Creature *c) : ScriptedAI(c) {} - - uint32 Sweep_Timer; - uint32 SandBlast_Timer; - uint32 Submerge_Timer; - uint32 Back_Timer; - uint32 ChangeTarget_Timer; - uint32 Spawn_Timer; - - bool Enrage; - bool Submerged; +public: + boss_ouro() : CreatureScript("boss_ouro") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - Sweep_Timer = 5000 + rand()%5000; - SandBlast_Timer = 20000 + rand()%15000; - Submerge_Timer = 90000 + rand()%60000; - Back_Timer = 30000 + rand()%15000; - ChangeTarget_Timer = 5000 + rand()%3000; - Spawn_Timer = 10000 + rand()%10000; - - Enrage = false; - Submerged = false; + return new boss_ouroAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_ouroAI : public ScriptedAI { - DoCast(me->getVictim(), SPELL_BIRTH); - } + boss_ouroAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 Sweep_Timer; + uint32 SandBlast_Timer; + uint32 Submerge_Timer; + uint32 Back_Timer; + uint32 ChangeTarget_Timer; + uint32 Spawn_Timer; - //Sweep_Timer - if (!Submerged && Sweep_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SWEEP); - Sweep_Timer = 15000 + rand()%15000; - } else Sweep_Timer -= diff; + bool Enrage; + bool Submerged; - //SandBlast_Timer - if (!Submerged && SandBlast_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_SANDBLAST); + Sweep_Timer = 5000 + rand()%5000; SandBlast_Timer = 20000 + rand()%15000; - } else SandBlast_Timer -= diff; - - //Submerge_Timer - if (!Submerged && Submerge_Timer <= diff) - { - //Cast - me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setFaction(35); - DoCast(me, SPELL_DIRTMOUND_PASSIVE); - - Submerged = true; + Submerge_Timer = 90000 + rand()%60000; Back_Timer = 30000 + rand()%15000; - } else Submerge_Timer -= diff; - - //ChangeTarget_Timer - if (Submerged && ChangeTarget_Timer <= diff) - { - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - - if (pTarget) - DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); + ChangeTarget_Timer = 5000 + rand()%3000; + Spawn_Timer = 10000 + rand()%10000; - ChangeTarget_Timer = 10000 + rand()%10000; - } else ChangeTarget_Timer -= diff; + Enrage = false; + Submerged = false; + } - //Back_Timer - if (Submerged && Back_Timer <= diff) + void EnterCombat(Unit * /*who*/) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->setFaction(14); + DoCast(me->getVictim(), SPELL_BIRTH); + } - DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); - - Submerged = false; - Submerge_Timer = 60000 + rand()%60000; - } else Back_Timer -= diff; + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + //Sweep_Timer + if (!Submerged && Sweep_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SWEEP); + Sweep_Timer = 15000 + rand()%15000; + } else Sweep_Timer -= diff; + + //SandBlast_Timer + if (!Submerged && SandBlast_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SANDBLAST); + SandBlast_Timer = 20000 + rand()%15000; + } else SandBlast_Timer -= diff; + + //Submerge_Timer + if (!Submerged && Submerge_Timer <= diff) + { + //Cast + me->HandleEmoteCommand(EMOTE_ONESHOT_SUBMERGE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setFaction(35); + DoCast(me, SPELL_DIRTMOUND_PASSIVE); + + Submerged = true; + Back_Timer = 30000 + rand()%15000; + } else Submerge_Timer -= diff; + + //ChangeTarget_Timer + if (Submerged && ChangeTarget_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + + if (pTarget) + DoTeleportTo(pTarget->GetPositionX(), pTarget->GetPositionY(), pTarget->GetPositionZ()); + + ChangeTarget_Timer = 10000 + rand()%10000; + } else ChangeTarget_Timer -= diff; + + //Back_Timer + if (Submerged && Back_Timer <= diff) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->setFaction(14); + + DoCast(me->getVictim(), SPELL_GROUND_RUPTURE); + + Submerged = false; + Submerge_Timer = 60000 + rand()%60000; + } else Back_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_ouro(Creature* pCreature) -{ - return new boss_ouroAI (pCreature); -} void AddSC_boss_ouro() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_ouro"; - newscript->GetAI = &GetAI_boss_ouro; - newscript->RegisterSelf(); + new boss_ouro(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp index 18bd1af71a5..0fb6aedb6a8 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_sartura.cpp @@ -36,264 +36,269 @@ EndScriptData */ //Guard Spell #define SPELL_WHIRLWINDADD 26038 #define SPELL_KNOCKBACK 26027 - -struct boss_sarturaAI : public ScriptedAI +
class boss_sartura : public CreatureScript { - boss_sarturaAI(Creature *c) : ScriptedAI(c) {} - - uint32 WhirlWind_Timer; - uint32 WhirlWindRandom_Timer; - uint32 WhirlWindEnd_Timer; - uint32 AggroReset_Timer; - uint32 AggroResetEnd_Timer; - uint32 EnrageHard_Timer; - - bool Enraged; - bool EnragedHard; - bool WhirlWind; - bool AggroReset; +public: + boss_sartura() : CreatureScript("boss_sartura") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WhirlWind_Timer = 30000; - WhirlWindRandom_Timer = 3000 + rand()%4000; - WhirlWindEnd_Timer = 15000; - AggroReset_Timer = 45000 + rand()%10000; - AggroResetEnd_Timer = 5000; - EnrageHard_Timer = 10*60000; - - WhirlWind = false; - AggroReset = false; - Enraged = false; - EnragedHard = false; - + return new boss_sarturaAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct boss_sarturaAI : public ScriptedAI { - DoScriptText(SAY_AGGRO, me); - } - - void JustDied(Unit* /*Killer*/) - { - DoScriptText(SAY_DEATH, me); - } + boss_sarturaAI(Creature *c) : ScriptedAI(c) {} - void KilledUnit(Unit* /*victim*/) - { - DoScriptText(SAY_SLAY, me); - } + uint32 WhirlWind_Timer; + uint32 WhirlWindRandom_Timer; + uint32 WhirlWindEnd_Timer; + uint32 AggroReset_Timer; + uint32 AggroResetEnd_Timer; + uint32 EnrageHard_Timer; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + bool Enraged; + bool EnragedHard; + bool WhirlWind; + bool AggroReset; - if (WhirlWind) + void Reset() { - if (WhirlWindRandom_Timer <= diff) - { - //Attack random Gamers - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget) - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); - - WhirlWindRandom_Timer = 3000 + rand()%4000; - } else WhirlWindRandom_Timer -= diff; - - if (WhirlWindEnd_Timer <= diff) - { - WhirlWind = false; - WhirlWind_Timer = 25000 + rand()%15000; - } else WhirlWindEnd_Timer -= diff; + WhirlWind_Timer = 30000; + WhirlWindRandom_Timer = 3000 + rand()%4000; + WhirlWindEnd_Timer = 15000; + AggroReset_Timer = 45000 + rand()%10000; + AggroResetEnd_Timer = 5000; + EnrageHard_Timer = 10*60000; + + WhirlWind = false; + AggroReset = false; + Enraged = false; + EnragedHard = false; + } - if (!WhirlWind) + void EnterCombat(Unit * /*who*/) { - if (WhirlWind_Timer <= diff) - { - DoCast(me, SPELL_WHIRLWIND); - WhirlWind = true; - WhirlWindEnd_Timer = 15000; - } else WhirlWind_Timer -= diff; + DoScriptText(SAY_AGGRO, me); + } - if (AggroReset_Timer <= diff) - { - //Attack random Gamers - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget) - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); + void JustDied(Unit* /*Killer*/) + { + DoScriptText(SAY_DEATH, me); + } - AggroReset = true; - AggroReset_Timer = 2000 + rand()%3000; - } else AggroReset_Timer -= diff; + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(SAY_SLAY, me); + } - if (AggroReset) + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; + + if (WhirlWind) { - if (AggroResetEnd_Timer <= diff) + if (WhirlWindRandom_Timer <= diff) { - AggroReset = false; - AggroResetEnd_Timer = 5000; - AggroReset_Timer = 35000 + rand()%10000; - } else AggroResetEnd_Timer -= diff; + //Attack random Gamers + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget) + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + + WhirlWindRandom_Timer = 3000 + rand()%4000; + } else WhirlWindRandom_Timer -= diff; + + if (WhirlWindEnd_Timer <= diff) + { + WhirlWind = false; + WhirlWind_Timer = 25000 + rand()%15000; + } else WhirlWindEnd_Timer -= diff; } - //If she is 20% enrage - if (!Enraged) + if (!WhirlWind) { - if (me->GetHealth()*100 / me->GetMaxHealth() <= 20 && !me->IsNonMeleeSpellCasted(false)) + if (WhirlWind_Timer <= diff) { - DoCast(me, SPELL_ENRAGE); - Enraged = true; + DoCast(me, SPELL_WHIRLWIND); + WhirlWind = true; + WhirlWindEnd_Timer = 15000; + } else WhirlWind_Timer -= diff; + + if (AggroReset_Timer <= diff) + { + //Attack random Gamers + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget) + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + + AggroReset = true; + AggroReset_Timer = 2000 + rand()%3000; + } else AggroReset_Timer -= diff; + + if (AggroReset) + { + if (AggroResetEnd_Timer <= diff) + { + AggroReset = false; + AggroResetEnd_Timer = 5000; + AggroReset_Timer = 35000 + rand()%10000; + } else AggroResetEnd_Timer -= diff; } - } - //After 10 minutes hard enrage - if (!EnragedHard) - { - if (EnrageHard_Timer <= diff) + //If she is 20% enrage + if (!Enraged) { - DoCast(me, SPELL_ENRAGEHARD); - EnragedHard = true; - } else EnrageHard_Timer -= diff; - } + if (me->GetHealth()*100 / me->GetMaxHealth() <= 20 && !me->IsNonMeleeSpellCasted(false)) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } + } - DoMeleeAttackIfReady(); + //After 10 minutes hard enrage + if (!EnragedHard) + { + if (EnrageHard_Timer <= diff) + { + DoCast(me, SPELL_ENRAGEHARD); + EnragedHard = true; + } else EnrageHard_Timer -= diff; + } + + DoMeleeAttackIfReady(); + } } - } -}; + }; -struct mob_sartura_royal_guardAI : public ScriptedAI +}; +
class mob_sartura_royal_guard : public CreatureScript { - mob_sartura_royal_guardAI(Creature *c) : ScriptedAI(c) {} - - uint32 WhirlWind_Timer; - uint32 WhirlWindRandom_Timer; - uint32 WhirlWindEnd_Timer; - uint32 AggroReset_Timer; - uint32 AggroResetEnd_Timer; - uint32 KnockBack_Timer; +public: + mob_sartura_royal_guard() : CreatureScript("mob_sartura_royal_guard") { } - bool WhirlWind; - bool AggroReset; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WhirlWind_Timer = 30000; - WhirlWindRandom_Timer = 3000 + rand()%4000; - WhirlWindEnd_Timer = 15000; - AggroReset_Timer = 45000 + rand()%10000; - AggroResetEnd_Timer = 5000; - KnockBack_Timer = 10000; - - WhirlWind = false; - AggroReset = false; + return new mob_sartura_royal_guardAI (pCreature); } - void EnterCombat(Unit * /*who*/) + struct mob_sartura_royal_guardAI : public ScriptedAI { - } + mob_sartura_royal_guardAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 WhirlWind_Timer; + uint32 WhirlWindRandom_Timer; + uint32 WhirlWindEnd_Timer; + uint32 AggroReset_Timer; + uint32 AggroResetEnd_Timer; + uint32 KnockBack_Timer; - if (!WhirlWind && WhirlWind_Timer <= diff) + bool WhirlWind; + bool AggroReset; + + void Reset() { - DoCast(me, SPELL_WHIRLWINDADD); - WhirlWind = true; - WhirlWind_Timer = 25000 + rand()%15000; + WhirlWind_Timer = 30000; + WhirlWindRandom_Timer = 3000 + rand()%4000; WhirlWindEnd_Timer = 15000; - } else WhirlWind_Timer -= diff; + AggroReset_Timer = 45000 + rand()%10000; + AggroResetEnd_Timer = 5000; + KnockBack_Timer = 10000; + + WhirlWind = false; + AggroReset = false; + } - if (WhirlWind) + void EnterCombat(Unit * /*who*/) { - if (WhirlWindRandom_Timer <= diff) - { - //Attack random Gamers - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget) - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); - - WhirlWindRandom_Timer = 3000 + rand()%4000; - } else WhirlWindRandom_Timer -= diff; - - if (WhirlWindEnd_Timer <= diff) - { - WhirlWind = false; - } else WhirlWindEnd_Timer -= diff; } - if (!WhirlWind) + void UpdateAI(const uint32 diff) { - if (AggroReset_Timer <= diff) - { - //Attack random Gamers - Unit *pTarget = NULL; - pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); - if (pTarget) - me->AddThreat(pTarget, 1.0f); - me->TauntApply(pTarget); - AttackStart(pTarget); - - AggroReset = true; - AggroReset_Timer = 2000 + rand()%3000; - } else AggroReset_Timer -= diff; - - if (KnockBack_Timer <= diff) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (!WhirlWind && WhirlWind_Timer <= diff) { DoCast(me, SPELL_WHIRLWINDADD); - KnockBack_Timer = 10000 + rand()%10000; - } else KnockBack_Timer -= diff; - } + WhirlWind = true; + WhirlWind_Timer = 25000 + rand()%15000; + WhirlWindEnd_Timer = 15000; + } else WhirlWind_Timer -= diff; - if (AggroReset) - { - if (AggroResetEnd_Timer <= diff) + if (WhirlWind) { - AggroReset = false; - AggroResetEnd_Timer = 5000; - AggroReset_Timer = 30000 + rand()%10000; - } else AggroResetEnd_Timer -= diff; + if (WhirlWindRandom_Timer <= diff) + { + //Attack random Gamers + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget) + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + + WhirlWindRandom_Timer = 3000 + rand()%4000; + } else WhirlWindRandom_Timer -= diff; + + if (WhirlWindEnd_Timer <= diff) + { + WhirlWind = false; + } else WhirlWindEnd_Timer -= diff; + } + + if (!WhirlWind) + { + if (AggroReset_Timer <= diff) + { + //Attack random Gamers + Unit *pTarget = NULL; + pTarget = SelectUnit(SELECT_TARGET_RANDOM,1); + if (pTarget) + me->AddThreat(pTarget, 1.0f); + me->TauntApply(pTarget); + AttackStart(pTarget); + + AggroReset = true; + AggroReset_Timer = 2000 + rand()%3000; + } else AggroReset_Timer -= diff; + + if (KnockBack_Timer <= diff) + { + DoCast(me, SPELL_WHIRLWINDADD); + KnockBack_Timer = 10000 + rand()%10000; + } else KnockBack_Timer -= diff; + } + + if (AggroReset) + { + if (AggroResetEnd_Timer <= diff) + { + AggroReset = false; + AggroResetEnd_Timer = 5000; + AggroReset_Timer = 30000 + rand()%10000; + } else AggroResetEnd_Timer -= diff; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_sartura(Creature* pCreature) -{ - return new boss_sarturaAI (pCreature); -} -CreatureAI* GetAI_mob_sartura_royal_guard(Creature* pCreature) -{ - return new mob_sartura_royal_guardAI (pCreature); -} void AddSC_boss_sartura() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_sartura"; - newscript->GetAI = &GetAI_boss_sartura; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_sartura_royal_guard"; - newscript->GetAI = &GetAI_mob_sartura_royal_guard; - newscript->RegisterSelf(); + new boss_sartura(); + new mob_sartura_royal_guard(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 06b753bd5f5..a9bc909df98 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -50,251 +50,253 @@ class ov_mycoordinates x = cx; y = cy; z = cz; r = cr; } }; - -struct boss_skeramAI : public ScriptedAI +
class boss_skeram : public CreatureScript { - boss_skeramAI(Creature *c) : ScriptedAI(c) - { - IsImage = false; - } - - uint32 ArcaneExplosion_Timer; - uint32 EarthShock_Timer; - uint32 FullFillment_Timer; - uint32 Blink_Timer; - uint32 Invisible_Timer; - - bool Images75; - bool Images50; - bool Images25; - bool IsImage; - bool Invisible; +public: + boss_skeram() : CreatureScript("boss_skeram") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - ArcaneExplosion_Timer = 6000 + rand()%6000; - EarthShock_Timer = 2000; - FullFillment_Timer = 15000; - Blink_Timer = 8000 + rand()%12000; - Invisible_Timer = 500; - - Images75 = false; - Images50 = false; - Images25 = false; - Invisible = false; - - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetVisibility(VISIBILITY_ON); - - if (IsImage) - me->setDeathState(JUST_DIED); + return new boss_skeramAI (pCreature); } - void KilledUnit(Unit* /*victim*/) + struct boss_skeramAI : public ScriptedAI { - DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); - } + boss_skeramAI(Creature *c) : ScriptedAI(c) + { + IsImage = false; + } - void JustDied(Unit* /*Killer*/) - { - if (!IsImage) - DoScriptText(SAY_DEATH, me); - } + uint32 ArcaneExplosion_Timer; + uint32 EarthShock_Timer; + uint32 FullFillment_Timer; + uint32 Blink_Timer; + uint32 Invisible_Timer; - void EnterCombat(Unit * /*who*/) - { - if (IsImage || Images75) - return; - DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); - } + bool Images75; + bool Images50; + bool Images25; + bool IsImage; + bool Invisible; - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + void Reset() + { + ArcaneExplosion_Timer = 6000 + rand()%6000; + EarthShock_Timer = 2000; + FullFillment_Timer = 15000; + Blink_Timer = 8000 + rand()%12000; + Invisible_Timer = 500; + + Images75 = false; + Images50 = false; + Images25 = false; + Invisible = false; + + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetVisibility(VISIBILITY_ON); + + if (IsImage) + me->setDeathState(JUST_DIED); + } + + void KilledUnit(Unit* /*victim*/) + { + DoScriptText(RAND(SAY_SLAY1,SAY_SLAY2,SAY_SLAY3), me); + } - //ArcaneExplosion_Timer - if (ArcaneExplosion_Timer <= diff) + void JustDied(Unit* /*Killer*/) { - DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION); - ArcaneExplosion_Timer = 8000 + rand()%10000; - } else ArcaneExplosion_Timer -= diff; + if (!IsImage) + DoScriptText(SAY_DEATH, me); + } + + void EnterCombat(Unit * /*who*/) + { + if (IsImage || Images75) + return; + DoScriptText(RAND(SAY_AGGRO1,SAY_AGGRO2,SAY_AGGRO3), me); + } - //If we are within range melee the target - if (me->IsWithinMeleeRange(me->getVictim())) + void UpdateAI(const uint32 diff) { - //Make sure our attack is ready and we arn't currently casting - if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) + //Return since we have no target + if (!UpdateVictim()) + return; + + //ArcaneExplosion_Timer + if (ArcaneExplosion_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_ARCANE_EXPLOSION); + ArcaneExplosion_Timer = 8000 + rand()%10000; + } else ArcaneExplosion_Timer -= diff; + + //If we are within range melee the target + if (me->IsWithinMeleeRange(me->getVictim())) + { + //Make sure our attack is ready and we arn't currently casting + if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) + { + me->AttackerStateUpdate(me->getVictim()); + me->resetAttackTimer(); + } + }else { - me->AttackerStateUpdate(me->getVictim()); - me->resetAttackTimer(); + //EarthShock_Timer + if (EarthShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_EARTH_SHOCK); + EarthShock_Timer = 1000; + } else EarthShock_Timer -= diff; } - }else - { - //EarthShock_Timer - if (EarthShock_Timer <= diff) + + //Blink_Timer + if (Blink_Timer <= diff) { - DoCast(me->getVictim(), SPELL_EARTH_SHOCK); - EarthShock_Timer = 1000; - } else EarthShock_Timer -= diff; + //DoCast(me, SPELL_BLINK); + switch (urand(0,2)) + { + case 0: + me->GetMap()->CreatureRelocation(me, -8340.782227,2083.814453,125.648788,0.0f); + DoResetThreat(); + break; + case 1: + me->GetMap()->CreatureRelocation(me, -8341.546875,2118.504639,133.058151,0.0f); + DoResetThreat(); + break; + case 2: + me->GetMap()->CreatureRelocation(me, -8318.822266,2058.231201,133.058151,0.0f); + DoResetThreat(); + break; + } + DoStopAttack(); + + Blink_Timer= 20000 + rand()%20000; + } else Blink_Timer -= diff; + + int procent = (int) (me->GetHealth()*100 / me->GetMaxHealth() +0.5); + + //Summoning 2 Images and teleporting to a random position on 75% health + if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70)) + DoSplit(75); + + //Summoning 2 Images and teleporting to a random position on 50% health + if ((!Images50 && !IsImage) && + (procent <= 50 && procent > 45)) + DoSplit(50); + + //Summoning 2 Images and teleporting to a random position on 25% health + if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20)) + DoSplit(25); + + //Invisible_Timer + if (Invisible) + { + if (Invisible_Timer <= diff) + { + //Making Skeram visible after telporting + me->SetVisibility(VISIBILITY_ON); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + Invisible_Timer = 2500; + Invisible = false; + } else Invisible_Timer -= diff; + } + + DoMeleeAttackIfReady(); } - //Blink_Timer - if (Blink_Timer <= diff) + void DoSplit(int atPercent /* 75 50 25 */) { - //DoCast(me, SPELL_BLINK); + DoScriptText(SAY_SPLIT, me); + + ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227,2083.814453,125.648788,0); + ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875,2118.504639,133.058151,0); + ov_mycoordinates *place3 = new ov_mycoordinates(-8318.822266,2058.231201,133.058151,0); + + ov_mycoordinates *bossc=place1, *i1=place2, *i2=place3; + switch (urand(0,2)) { case 0: - me->GetMap()->CreatureRelocation(me, -8340.782227,2083.814453,125.648788,0.0f); - DoResetThreat(); + bossc=place1; + i1=place2; + i2=place3; break; case 1: - me->GetMap()->CreatureRelocation(me, -8341.546875,2118.504639,133.058151,0.0f); - DoResetThreat(); + bossc=place2; + i1=place1; + i2=place3; break; case 2: - me->GetMap()->CreatureRelocation(me, -8318.822266,2058.231201,133.058151,0.0f); - DoResetThreat(); + bossc=place3; + i1=place1; + i2=place2; break; } - DoStopAttack(); - - Blink_Timer= 20000 + rand()%20000; - } else Blink_Timer -= diff; - - int procent = (int) (me->GetHealth()*100 / me->GetMaxHealth() +0.5); - - //Summoning 2 Images and teleporting to a random position on 75% health - if ((!Images75 && !IsImage) && (procent <= 75 && procent > 70)) - DoSplit(75); - - //Summoning 2 Images and teleporting to a random position on 50% health - if ((!Images50 && !IsImage) && - (procent <= 50 && procent > 45)) - DoSplit(50); - //Summoning 2 Images and teleporting to a random position on 25% health - if ((!Images25 && !IsImage) && (procent <= 25 && procent > 20)) - DoSplit(25); - - //Invisible_Timer - if (Invisible) - { - if (Invisible_Timer <= diff) + for (uint16 i = 0; i < 41; ++i) { - //Making Skeram visible after telporting - me->SetVisibility(VISIBILITY_ON); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - Invisible_Timer = 2500; - Invisible = false; - } else Invisible_Timer -= diff; - } + if (Player *pTarget = CAST_PLR(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) + { + if (Group *pGrp = pTarget->GetGroup()) + for (uint8 ico = 0; ico < TARGETICONCOUNT; ++ico) + { + //if (grp->m_targetIcons[ico] == me->GetGUID()) -- private member :( + pGrp->SetTargetIcon(ico, 0, 0); + } - DoMeleeAttackIfReady(); - } - - void DoSplit(int atPercent /* 75 50 25 */) - { - DoScriptText(SAY_SPLIT, me); - - ov_mycoordinates *place1 = new ov_mycoordinates(-8340.782227,2083.814453,125.648788,0); - ov_mycoordinates *place2 = new ov_mycoordinates(-8341.546875,2118.504639,133.058151,0); - ov_mycoordinates *place3 = new ov_mycoordinates(-8318.822266,2058.231201,133.058151,0); - - ov_mycoordinates *bossc=place1, *i1=place2, *i2=place3; + break; + } + } - switch (urand(0,2)) - { - case 0: - bossc=place1; - i1=place2; - i2=place3; - break; - case 1: - bossc=place2; - i1=place1; - i2=place3; - break; - case 2: - bossc=place3; - i1=place1; - i2=place2; - break; - } + me->RemoveAllAuras(); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + me->SetVisibility(VISIBILITY_OFF); + me->GetMap()->CreatureRelocation(me, bossc->x, bossc->y, bossc->z, bossc->r); + Invisible = true; + delete place1; + delete place2; + delete place3; + DoResetThreat(); + DoStopAttack(); - for (uint16 i = 0; i < 41; ++i) - { - if (Player *pTarget = CAST_PLR(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) + switch (atPercent) { - if (Group *pGrp = pTarget->GetGroup()) - for (uint8 ico = 0; ico < TARGETICONCOUNT; ++ico) - { - //if (grp->m_targetIcons[ico] == me->GetGUID()) -- private member :( - pGrp->SetTargetIcon(ico, 0, 0); - } - - break; + case 75: Images75 = true; break; + case 50: Images50 = true; break; + case 25: Images25 = true; break; } - } - me->RemoveAllAuras(); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - me->SetVisibility(VISIBILITY_OFF); - me->GetMap()->CreatureRelocation(me, bossc->x, bossc->y, bossc->z, bossc->r); - Invisible = true; - delete place1; - delete place2; - delete place3; - DoResetThreat(); - DoStopAttack(); - - switch (atPercent) - { - case 75: Images75 = true; break; - case 50: Images50 = true; break; - case 25: Images25 = true; break; - } + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + Creature *Image1 = me->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); + if (Image1) + { + Image1->SetMaxHealth(me->GetMaxHealth() / 5); + Image1->SetHealth(me->GetHealth() / 5); + if (pTarget) + Image1->AI()->AttackStart(pTarget); + CAST_AI(boss_skeram::boss_skeramAI, Image1->AI())->IsImage = true; + } - Creature *Image1 = me->SummonCreature(15263, i1->x, i1->y, i1->z, i1->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); - if (Image1) - { - Image1->SetMaxHealth(me->GetMaxHealth() / 5); - Image1->SetHealth(me->GetHealth() / 5); - if (pTarget) - Image1->AI()->AttackStart(pTarget); - CAST_AI(boss_skeramAI, Image1->AI())->IsImage = true; + Creature *Image2 = me->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); + if (Image2) + { + Image2->SetMaxHealth(me->GetMaxHealth() / 5); + Image2->SetHealth(me->GetHealth() / 5); + if (pTarget) + Image2->AI()->AttackStart(pTarget); + CAST_AI(boss_skeram::boss_skeramAI, Image2->AI())->IsImage = true; + } + Invisible = true; } - Creature *Image2 = me->SummonCreature(15263,i2->x, i2->y, i2->z, i2->r, TEMPSUMMON_CORPSE_DESPAWN, 30000); - if (Image2) - { - Image2->SetMaxHealth(me->GetMaxHealth() / 5); - Image2->SetHealth(me->GetHealth() / 5); - if (pTarget) - Image2->AI()->AttackStart(pTarget); - CAST_AI(boss_skeramAI, Image2->AI())->IsImage = true; - } - Invisible = true; - } + }; }; -CreatureAI* GetAI_boss_skeram(Creature* pCreature) -{ - return new boss_skeramAI (pCreature); -} void AddSC_boss_skeram() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_skeram"; - newscript->GetAI = &GetAI_boss_skeram; - newscript->RegisterSelf(); + new boss_skeram(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index 39938d64dc5..13c188e455b 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -63,10 +63,10 @@ struct boss_twinemperorsAI : public ScriptedAI { boss_twinemperorsAI(Creature *c): ScriptedAI(c) { - pInstance = c->GetInstanceData(); + pInstance = c->GetInstanceScript(); } - ScriptedInstance *pInstance; + InstanceScript *pInstance; uint32 Heal_Timer; uint32 Teleport_Timer; @@ -382,217 +382,221 @@ struct boss_twinemperorsAI : public ScriptedAI } else EnrageTimer-=diff; } }; - -struct boss_veknilashAI : public boss_twinemperorsAI +
class boss_veknilash : public CreatureScript { - bool IAmVeklor() {return false;} - boss_veknilashAI(Creature *c) : boss_twinemperorsAI(c) {} - - uint32 UpperCut_Timer; - uint32 UnbalancingStrike_Timer; - uint32 Scarabs_Timer; - int Rand; - int RandX; - int RandY; +public: + boss_veknilash() : CreatureScript("boss_veknilash") { } - Creature* Summoned; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - TwinReset(); - UpperCut_Timer = 14000 + rand()%15000; - UnbalancingStrike_Timer = 8000 + rand()%10000; - Scarabs_Timer = 7000 + rand()%7000; - - //Added. Can be removed if its included in DB. - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + return new boss_veknilashAI (pCreature); } - void CastSpellOnBug(Creature *pTarget) + struct boss_veknilashAI : public boss_twinemperorsAI { - pTarget->setFaction(14); - pTarget->AI()->AttackStart(me->getThreatManager().getHostilTarget()); - pTarget->AddAura(SPELL_MUTATE_BUG, pTarget); - pTarget->SetHealth(pTarget->GetMaxHealth()); - } + bool IAmVeklor() {return false;} + boss_veknilashAI(Creature *c) : boss_twinemperorsAI(c) {} - void UpdateAI(const uint32 diff) - { - //Return since we have no target - if (!UpdateVictim()) - return; + uint32 UpperCut_Timer; + uint32 UnbalancingStrike_Timer; + uint32 Scarabs_Timer; + int Rand; + int RandX; + int RandY; - if (!TryActivateAfterTTelep(diff)) - return; + Creature* Summoned; - //UnbalancingStrike_Timer - if (UnbalancingStrike_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE); - UnbalancingStrike_Timer = 8000+rand()%12000; - } else UnbalancingStrike_Timer -= diff; + TwinReset(); + UpperCut_Timer = 14000 + rand()%15000; + UnbalancingStrike_Timer = 8000 + rand()%10000; + Scarabs_Timer = 7000 + rand()%7000; - if (UpperCut_Timer <= diff) + //Added. Can be removed if its included in DB. + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_MAGIC, true); + } + + void CastSpellOnBug(Creature *pTarget) { - Unit* randomMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, NOMINAL_MELEE_RANGE, true); - if (randomMelee) - DoCast(randomMelee, SPELL_UPPERCUT); - UpperCut_Timer = 15000+rand()%15000; - } else UpperCut_Timer -= diff; + pTarget->setFaction(14); + pTarget->AI()->AttackStart(me->getThreatManager().getHostilTarget()); + pTarget->AddAura(SPELL_MUTATE_BUG, pTarget); + pTarget->SetHealth(pTarget->GetMaxHealth()); + } - HandleBugs(diff); + void UpdateAI(const uint32 diff) + { + //Return since we have no target + if (!UpdateVictim()) + return; - //Heal brother when 60yrds close - TryHealBrother(diff); + if (!TryActivateAfterTTelep(diff)) + return; - //Teleporting to brother - if (Teleport_Timer <= diff) - { - TeleportToMyBrother(); - } else Teleport_Timer -= diff; + //UnbalancingStrike_Timer + if (UnbalancingStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UNBALANCING_STRIKE); + UnbalancingStrike_Timer = 8000+rand()%12000; + } else UnbalancingStrike_Timer -= diff; + + if (UpperCut_Timer <= diff) + { + Unit* randomMelee = SelectTarget(SELECT_TARGET_RANDOM, 0, NOMINAL_MELEE_RANGE, true); + if (randomMelee) + DoCast(randomMelee, SPELL_UPPERCUT); + UpperCut_Timer = 15000+rand()%15000; + } else UpperCut_Timer -= diff; - CheckEnrage(diff); + HandleBugs(diff); - DoMeleeAttackIfReady(); - } -}; + //Heal brother when 60yrds close + TryHealBrother(diff); -struct boss_veklorAI : public boss_twinemperorsAI -{ - bool IAmVeklor() {return true;} - boss_veklorAI(Creature *c) : boss_twinemperorsAI(c) {} + //Teleporting to brother + if (Teleport_Timer <= diff) + { + TeleportToMyBrother(); + } else Teleport_Timer -= diff; - uint32 ShadowBolt_Timer; - uint32 Blizzard_Timer; - uint32 ArcaneBurst_Timer; - uint32 Scorpions_Timer; - int Rand; - int RandX; - int RandY; + CheckEnrage(diff); - Creature* Summoned; + DoMeleeAttackIfReady(); + } + }; - void Reset() - { - TwinReset(); - ShadowBolt_Timer = 0; - Blizzard_Timer = 15000 + rand()%5000; - ArcaneBurst_Timer = 1000; - Scorpions_Timer = 7000 + rand()%7000; - - //Added. Can be removed if its included in DB. - me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); - me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 0); - me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 0); - } +}; +
class boss_veklor : public CreatureScript +{ +public: + boss_veklor() : CreatureScript("boss_veklor") { } - void CastSpellOnBug(Creature *pTarget) + CreatureAI* GetAI(Creature* pCreature) const { - pTarget->setFaction(14); - pTarget->AddAura(SPELL_EXPLODEBUG, pTarget); - pTarget->SetHealth(pTarget->GetMaxHealth()); + return new boss_veklorAI (pCreature); } - void UpdateAI(const uint32 diff) + struct boss_veklorAI : public boss_twinemperorsAI { - //Return since we have no target - if (!UpdateVictim()) - return; + bool IAmVeklor() {return true;} + boss_veklorAI(Creature *c) : boss_twinemperorsAI(c) {} - // reset arcane burst after teleport - we need to do this because - // when VL jumps to VN's location there will be a warrior who will get only 2s to run away - // which is almost impossible - if (AfterTeleport) - ArcaneBurst_Timer = 5000; - if (!TryActivateAfterTTelep(diff)) - return; + uint32 ShadowBolt_Timer; + uint32 Blizzard_Timer; + uint32 ArcaneBurst_Timer; + uint32 Scorpions_Timer; + int Rand; + int RandX; + int RandY; + + Creature* Summoned; - //ShadowBolt_Timer - if (ShadowBolt_Timer <= diff) + void Reset() { - if (!me->IsWithinDist(me->getVictim(), 45.0f)) - me->GetMotionMaster()->MoveChase(me->getVictim(), VEKLOR_DIST, 0); - else - DoCast(me->getVictim(), SPELL_SHADOWBOLT); - ShadowBolt_Timer = 2000; - } else ShadowBolt_Timer -= diff; + TwinReset(); + ShadowBolt_Timer = 0; + Blizzard_Timer = 15000 + rand()%5000; + ArcaneBurst_Timer = 1000; + Scorpions_Timer = 7000 + rand()%7000; + + //Added. Can be removed if its included in DB. + me->ApplySpellImmune(0, IMMUNITY_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, true); + me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 0); + me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 0); + } - //Blizzard_Timer - if (Blizzard_Timer <= diff) + void CastSpellOnBug(Creature *pTarget) { - Unit *pTarget = NULL; - pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true); - if (pTarget) - DoCast(pTarget, SPELL_BLIZZARD); - Blizzard_Timer = 15000+rand()%15000; - } else Blizzard_Timer -= diff; - - if (ArcaneBurst_Timer <= diff) + pTarget->setFaction(14); + pTarget->AddAura(SPELL_EXPLODEBUG, pTarget); + pTarget->SetHealth(pTarget->GetMaxHealth()); + } + + void UpdateAI(const uint32 diff) { - Unit *mvic; - if ((mvic=SelectTarget(SELECT_TARGET_NEAREST, 0, NOMINAL_MELEE_RANGE, true)) != NULL) - { - DoCast(mvic, SPELL_ARCANEBURST); + //Return since we have no target + if (!UpdateVictim()) + return; + + // reset arcane burst after teleport - we need to do this because + // when VL jumps to VN's location there will be a warrior who will get only 2s to run away + // which is almost impossible + if (AfterTeleport) ArcaneBurst_Timer = 5000; - } - } else ArcaneBurst_Timer -= diff; + if (!TryActivateAfterTTelep(diff)) + return; - HandleBugs(diff); + //ShadowBolt_Timer + if (ShadowBolt_Timer <= diff) + { + if (!me->IsWithinDist(me->getVictim(), 45.0f)) + me->GetMotionMaster()->MoveChase(me->getVictim(), VEKLOR_DIST, 0); + else + DoCast(me->getVictim(), SPELL_SHADOWBOLT); + ShadowBolt_Timer = 2000; + } else ShadowBolt_Timer -= diff; - //Heal brother when 60yrds close - TryHealBrother(diff); + //Blizzard_Timer + if (Blizzard_Timer <= diff) + { + Unit *pTarget = NULL; + pTarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 45, true); + if (pTarget) + DoCast(pTarget, SPELL_BLIZZARD); + Blizzard_Timer = 15000+rand()%15000; + } else Blizzard_Timer -= diff; + + if (ArcaneBurst_Timer <= diff) + { + Unit *mvic; + if ((mvic=SelectTarget(SELECT_TARGET_NEAREST, 0, NOMINAL_MELEE_RANGE, true)) != NULL) + { + DoCast(mvic, SPELL_ARCANEBURST); + ArcaneBurst_Timer = 5000; + } + } else ArcaneBurst_Timer -= diff; - //Teleporting to brother - if (Teleport_Timer <= diff) - { - TeleportToMyBrother(); - } else Teleport_Timer -= diff; + HandleBugs(diff); - CheckEnrage(diff); + //Heal brother when 60yrds close + TryHealBrother(diff); - //VL doesn't melee - //DoMeleeAttackIfReady(); - } + //Teleporting to brother + if (Teleport_Timer <= diff) + { + TeleportToMyBrother(); + } else Teleport_Timer -= diff; - void AttackStart(Unit* who) - { - if (!who) - return; + CheckEnrage(diff); + + //VL doesn't melee + //DoMeleeAttackIfReady(); + } - if (who->isTargetableForAttack()) + void AttackStart(Unit* who) { - // VL doesn't melee - if (me->Attack(who, false)) + if (!who) + return; + + if (who->isTargetableForAttack()) { - me->GetMotionMaster()->MoveChase(who, VEKLOR_DIST, 0); - me->AddThreat(who, 0.0f); + // VL doesn't melee + if (me->Attack(who, false)) + { + me->GetMotionMaster()->MoveChase(who, VEKLOR_DIST, 0); + me->AddThreat(who, 0.0f); + } } } - } + }; + }; -CreatureAI* GetAI_boss_veknilash(Creature* pCreature) -{ - return new boss_veknilashAI (pCreature); -} -CreatureAI* GetAI_boss_veklor(Creature* pCreature) -{ - return new boss_veklorAI (pCreature); -} void AddSC_boss_twinemperors() { - Script *newscript; - - newscript = new Script; - newscript->Name = "boss_veknilash"; - newscript->GetAI = &GetAI_boss_veknilash; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "boss_veklor"; - newscript->GetAI = &GetAI_boss_veklor; - newscript->RegisterSelf(); + new boss_veknilash(); + new boss_veklor(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index 9f105e27a1d..772aadd458a 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -25,144 +25,146 @@ EndScriptData */ #include "ScriptPCH.h" #include "temple_of_ahnqiraj.h" - -struct instance_temple_of_ahnqiraj : public ScriptedInstance +
class instance_temple_of_ahnqiraj : public InstanceMapScript { - instance_temple_of_ahnqiraj(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; +public: + instance_temple_of_ahnqiraj() : InstanceMapScript("instance_temple_of_ahnqiraj") { } - //If Vem is dead... - bool IsBossDied[3]; + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) + { + return new instance_temple_of_ahnqiraj_InstanceMapScript(pMap); + } - //Storing Skeram, Vem and Kri. - uint64 SkeramGUID; - uint64 VemGUID; - uint64 KriGUID; - uint64 VeklorGUID; - uint64 VeknilashGUID; + struct instance_temple_of_ahnqiraj_InstanceMapScript : public InstanceScript + { + instance_temple_of_ahnqiraj_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - uint32 BugTrioDeathCount; + //If Vem is dead... + bool IsBossDied[3]; - uint32 CthunPhase; + //Storing Skeram, Vem and Kri. + uint64 SkeramGUID; + uint64 VemGUID; + uint64 KriGUID; + uint64 VeklorGUID; + uint64 VeknilashGUID; - void Initialize() - { - IsBossDied[0] = false; - IsBossDied[1] = false; - IsBossDied[2] = false; + uint32 BugTrioDeathCount; - SkeramGUID = 0; - VemGUID = 0; - KriGUID = 0; - VeklorGUID = 0; - VeknilashGUID = 0; + uint32 CthunPhase; - BugTrioDeathCount = 0; + void Initialize() + { + IsBossDied[0] = false; + IsBossDied[1] = false; + IsBossDied[2] = false; - CthunPhase = 0; - } + SkeramGUID = 0; + VemGUID = 0; + KriGUID = 0; + VeklorGUID = 0; + VeknilashGUID = 0; - void OnCreatureCreate(Creature* pCreature, bool /*add*/) - { - switch (pCreature->GetEntry()) - { - case 15263: SkeramGUID = pCreature->GetGUID(); break; - case 15544: VemGUID = pCreature->GetGUID(); break; - case 15511: KriGUID = pCreature->GetGUID(); break; - case 15276: VeklorGUID = pCreature->GetGUID(); break; - case 15275: VeknilashGUID = pCreature->GetGUID(); break; - } - } + BugTrioDeathCount = 0; - bool IsEncounterInProgress() const - { - //not active in AQ40 - return false; - } + CthunPhase = 0; + } - uint32 GetData(uint32 type) - { - switch(type) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case DATA_VEMISDEAD: - if (IsBossDied[0]) - return 1; - break; - - case DATA_VEKLORISDEAD: - if (IsBossDied[1]) - return 1; - break; - - case DATA_VEKNILASHISDEAD: - if (IsBossDied[2]) - return 1; - break; - - case DATA_BUG_TRIO_DEATH: - return BugTrioDeathCount; - - case DATA_CTHUN_PHASE: - return CthunPhase; + switch (pCreature->GetEntry()) + { + case 15263: SkeramGUID = pCreature->GetGUID(); break; + case 15544: VemGUID = pCreature->GetGUID(); break; + case 15511: KriGUID = pCreature->GetGUID(); break; + case 15276: VeklorGUID = pCreature->GetGUID(); break; + case 15275: VeknilashGUID = pCreature->GetGUID(); break; + } } - return 0; - } - uint64 GetData64 (uint32 identifier) - { - switch(identifier) + bool IsEncounterInProgress() const { - case DATA_SKERAM: - return SkeramGUID; - case DATA_VEM: - return VemGUID; - case DATA_KRI: - return KriGUID; - case DATA_VEKLOR: - return VeklorGUID; - case DATA_VEKNILASH: - return VeknilashGUID; + //not active in AQ40 + return false; } - return 0; - } // end GetData64 - void SetData(uint32 type, uint32 data) - { - switch(type) + uint32 GetData(uint32 type) { - case DATA_VEM_DEATH: - IsBossDied[0] = true; - break; - - case DATA_BUG_TRIO_DEATH: - ++BugTrioDeathCount; - break; - - case DATA_VEKLOR_DEATH: - IsBossDied[1] = true; - break; - - case DATA_VEKNILASH_DEATH: - IsBossDied[2] = true; - break; + switch(type) + { + case DATA_VEMISDEAD: + if (IsBossDied[0]) + return 1; + break; + + case DATA_VEKLORISDEAD: + if (IsBossDied[1]) + return 1; + break; + + case DATA_VEKNILASHISDEAD: + if (IsBossDied[2]) + return 1; + break; + + case DATA_BUG_TRIO_DEATH: + return BugTrioDeathCount; + + case DATA_CTHUN_PHASE: + return CthunPhase; + } + return 0; + } - case DATA_CTHUN_PHASE: - CthunPhase = data; - break; + uint64 GetData64 (uint32 identifier) + { + switch(identifier) + { + case DATA_SKERAM: + return SkeramGUID; + case DATA_VEM: + return VemGUID; + case DATA_KRI: + return KriGUID; + case DATA_VEKLOR: + return VeklorGUID; + case DATA_VEKNILASH: + return VeknilashGUID; + } + return 0; + } // end GetData64 + + void SetData(uint32 type, uint32 data) + { + switch(type) + { + case DATA_VEM_DEATH: + IsBossDied[0] = true; + break; + + case DATA_BUG_TRIO_DEATH: + ++BugTrioDeathCount; + break; + + case DATA_VEKLOR_DEATH: + IsBossDied[1] = true; + break; + + case DATA_VEKNILASH_DEATH: + IsBossDied[2] = true; + break; + + case DATA_CTHUN_PHASE: + CthunPhase = data; + break; + } } - } + }; + }; -InstanceData* GetInstanceData_instance_temple_of_ahnqiraj(Map* pMap) -{ - return new instance_temple_of_ahnqiraj(pMap); -} void AddSC_instance_temple_of_ahnqiraj() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_temple_of_ahnqiraj"; - newscript->GetInstanceData = &GetInstanceData_instance_temple_of_ahnqiraj; - newscript->RegisterSelf(); + new instance_temple_of_ahnqiraj(); } - diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index e0ce8834b6d..ea24f7e7e5c 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -54,245 +54,247 @@ EndScriptData */ #define SPELL_STORM_BUFF 2148 #define SPELL_STORM 26546 - -struct aqsentinelAI : public ScriptedAI +
class mob_anubisath_sentinel : public CreatureScript { - uint32 ability; - int abselected; +public: + mob_anubisath_sentinel() : CreatureScript("mob_anubisath_sentinel") { } - void selectAbility(int asel) + CreatureAI* GetAI(Creature* pCreature) const { - switch (asel) - { - case 0: ability = SPELL_MENDING_BUFF;break; - case 1: ability = SPELL_KNOCK_BUFF;break; - case 2: ability = SPELL_MANAB_BUFF;break; - case 3: ability = SPELL_REFLECTAF_BUFF;break; - case 4: ability = SPELL_REFLECTSFr_BUFF;break; - case 5: ability = SPELL_THORNS_BUFF;break; - case 6: ability = SPELL_THUNDER_BUFF;break; - case 7: ability = SPELL_MSTRIKE_BUFF;break; - case 8: ability = SPELL_STORM_BUFF;break; - } + return new aqsentinelAI (pCreature); } - aqsentinelAI(Creature *c) : ScriptedAI(c) + struct aqsentinelAI : public ScriptedAI { - ClearBuddyList(); - abselected = 0; // just initialization of variable - } + uint32 ability; + int abselected; - uint64 NearbyGUID[3]; + void selectAbility(int asel) + { + switch (asel) + { + case 0: ability = SPELL_MENDING_BUFF;break; + case 1: ability = SPELL_KNOCK_BUFF;break; + case 2: ability = SPELL_MANAB_BUFF;break; + case 3: ability = SPELL_REFLECTAF_BUFF;break; + case 4: ability = SPELL_REFLECTSFr_BUFF;break; + case 5: ability = SPELL_THORNS_BUFF;break; + case 6: ability = SPELL_THUNDER_BUFF;break; + case 7: ability = SPELL_MSTRIKE_BUFF;break; + case 8: ability = SPELL_STORM_BUFF;break; + } + } - void ClearBuddyList() - { - NearbyGUID[0] = NearbyGUID[1] = NearbyGUID[2] = 0; - } + aqsentinelAI(Creature *c) : ScriptedAI(c) + { + ClearBuddyList(); + abselected = 0; // just initialization of variable + } - void AddBuddyToList(uint64 CreatureGUID) - { - if (CreatureGUID == me->GetGUID()) - return; + uint64 NearbyGUID[3]; + + void ClearBuddyList() + { + NearbyGUID[0] = NearbyGUID[1] = NearbyGUID[2] = 0; + } - for (int i=0; i<3; ++i) + void AddBuddyToList(uint64 CreatureGUID) { - if (NearbyGUID[i] == CreatureGUID) + if (CreatureGUID == me->GetGUID()) return; - if (!NearbyGUID[i]) + + for (int i=0; i<3; ++i) { - NearbyGUID[i] = CreatureGUID; - return; + if (NearbyGUID[i] == CreatureGUID) + return; + if (!NearbyGUID[i]) + { + NearbyGUID[i] = CreatureGUID; + return; + } } } - } - void GiveBuddyMyList(Creature *c) - { - aqsentinelAI *cai = CAST_AI(aqsentinelAI, (c)->AI()); - for (int i=0; i<3; ++i) - if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID()) - cai->AddBuddyToList(NearbyGUID[i]); - cai->AddBuddyToList(me->GetGUID()); - } + void GiveBuddyMyList(Creature *c) + { + aqsentinelAI *cai = CAST_AI(aqsentinelAI, (c)->AI()); + for (int i=0; i<3; ++i) + if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID()) + cai->AddBuddyToList(NearbyGUID[i]); + cai->AddBuddyToList(me->GetGUID()); + } - void SendMyListToBuddies() - { - for (int i=0; i<3; ++i) - if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i])) - GiveBuddyMyList(pNearby); - } + void SendMyListToBuddies() + { + for (int i=0; i<3; ++i) + if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i])) + GiveBuddyMyList(pNearby); + } - void CallBuddiesToAttack(Unit *who) - { - for (int i=0; i<3; ++i) + void CallBuddiesToAttack(Unit *who) { - Creature *c = Unit::GetCreature(*me, NearbyGUID[i]); - if (c) + for (int i=0; i<3; ++i) { - if (!c->isInCombat()) + Creature *c = Unit::GetCreature(*me, NearbyGUID[i]); + if (c) { - c->SetNoCallAssistance(true); - if (c->AI()) - c->AI()->AttackStart(who); + if (!c->isInCombat()) + { + c->SetNoCallAssistance(true); + if (c->AI()) + c->AI()->AttackStart(who); + } } } } - } - void AddSentinelsNear(Unit * /*nears*/) - { - std::list<Creature*> assistList; - me->GetCreatureListWithEntryInGrid(assistList,15264,70.0f); + void AddSentinelsNear(Unit * /*nears*/) + { + std::list<Creature*> assistList; + me->GetCreatureListWithEntryInGrid(assistList,15264,70.0f); - if (assistList.empty()) - return; + if (assistList.empty()) + return; - for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter) - AddBuddyToList((*iter)->GetGUID()); - } + for (std::list<Creature*>::const_iterator iter = assistList.begin(); iter != assistList.end(); ++iter) + AddBuddyToList((*iter)->GetGUID()); + } - int pickAbilityRandom(bool *chosenAbilities) - { - for (int t = 0; t < 2; ++t) + int pickAbilityRandom(bool *chosenAbilities) { - for (int i = !t ? (rand()%9) : 0; i < 9; ++i) + for (int t = 0; t < 2; ++t) { - if (!chosenAbilities[i]) + for (int i = !t ? (rand()%9) : 0; i < 9; ++i) { - chosenAbilities[i] = true; - return i; + if (!chosenAbilities[i]) + { + chosenAbilities[i] = true; + return i; + } } } + return 0; // should never happen } - return 0; // should never happen - } - void GetOtherSentinels(Unit *who) - { - bool *chosenAbilities = new bool[9]; - memset(chosenAbilities, 0, 9*sizeof(bool)); - selectAbility(pickAbilityRandom(chosenAbilities)); - - ClearBuddyList(); - AddSentinelsNear(me); - int bli; - for (bli = 0; bli < 3; ++bli) + void GetOtherSentinels(Unit *who) { - if (!NearbyGUID[bli]) - break; + bool *chosenAbilities = new bool[9]; + memset(chosenAbilities, 0, 9*sizeof(bool)); + selectAbility(pickAbilityRandom(chosenAbilities)); + + ClearBuddyList(); + AddSentinelsNear(me); + int bli; + for (bli = 0; bli < 3; ++bli) + { + if (!NearbyGUID[bli]) + break; - Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[bli]); - if (!pNearby) - break; + Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[bli]); + if (!pNearby) + break; - AddSentinelsNear(pNearby); - CAST_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false; - CAST_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities)); - } - /*if (bli < 3) - DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ - SendMyListToBuddies(); - CallBuddiesToAttack(who); + AddSentinelsNear(pNearby); + CAST_AI(aqsentinelAI, pNearby->AI())->gatherOthersWhenAggro = false; + CAST_AI(aqsentinelAI, pNearby->AI())->selectAbility(pickAbilityRandom(chosenAbilities)); + } + /*if (bli < 3) + DoYell("I dont have enough buddies.", LANG_NEUTRAL, 0);*/ + SendMyListToBuddies(); + CallBuddiesToAttack(who); - delete[] chosenAbilities; - } + delete[] chosenAbilities; + } - bool gatherOthersWhenAggro; + bool gatherOthersWhenAggro; - void Reset() - { - if (!me->isDead()) + void Reset() { - for (int i=0; i<3; ++i) + if (!me->isDead()) { - if (!NearbyGUID[i]) - continue; - if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i])) + for (int i=0; i<3; ++i) { - if (pNearby->isDead()) - pNearby->Respawn(); + if (!NearbyGUID[i]) + continue; + if (Creature *pNearby = Unit::GetCreature(*me, NearbyGUID[i])) + { + if (pNearby->isDead()) + pNearby->Respawn(); + } } } + ClearBuddyList(); + gatherOthersWhenAggro = true; } - ClearBuddyList(); - gatherOthersWhenAggro = true; - } - void GainSentinelAbility(uint32 id) - { - me->AddAura(id, me); - } + void GainSentinelAbility(uint32 id) + { + me->AddAura(id, me); + } - void EnterCombat(Unit * who) - { - if (gatherOthersWhenAggro) - GetOtherSentinels(who); + void EnterCombat(Unit * who) + { + if (gatherOthersWhenAggro) + GetOtherSentinels(who); - GainSentinelAbility(ability); - DoZoneInCombat(); - } + GainSentinelAbility(ability); + DoZoneInCombat(); + } - void JustDied(Unit* /*who*/) - { - for (int ni=0; ni<3; ++ni) + void JustDied(Unit* /*who*/) { - Creature *sent = Unit::GetCreature(*me, NearbyGUID[ni]); - if (!sent) - continue; - if (sent->isDead()) - continue; - int h = sent->GetHealth() + (sent->GetMaxHealth() / 2); - if (h > sent->GetMaxHealth()) - h = sent->GetMaxHealth(); - sent->SetHealth(h); - CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability); + for (int ni=0; ni<3; ++ni) + { + Creature *sent = Unit::GetCreature(*me, NearbyGUID[ni]); + if (!sent) + continue; + if (sent->isDead()) + continue; + int h = sent->GetHealth() + (sent->GetMaxHealth() / 2); + if (h > sent->GetMaxHealth()) + h = sent->GetMaxHealth(); + sent->SetHealth(h); + CAST_AI(aqsentinelAI, sent->AI())->GainSentinelAbility(ability); + } } - } - Unit *GetHatedManaUser() const - { - std::list<HostileReference*>::const_iterator i; - for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) + Unit *GetHatedManaUser() const { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit->getPowerType() == POWER_MANA) - return pUnit; + std::list<HostileReference*>::const_iterator i; + for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) + { + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit->getPowerType() == POWER_MANA) + return pUnit; + } + return NULL; } - return NULL; - } - Unit* GetAuraEffectTriggerTarget(uint32 spellId, uint8 /*effIndex*/) const - { - switch (spellId) + Unit* GetAuraEffectTriggerTarget(uint32 spellId, uint8 /*effIndex*/) const { - case SPELL_KNOCK_BUFF: - case SPELL_THUNDER_BUFF: - case SPELL_MSTRIKE_BUFF: - case SPELL_STORM_BUFF: - return me->getVictim(); - - case SPELL_MANAB_BUFF: - return GetHatedManaUser(); - - case SPELL_MENDING_BUFF: - case SPELL_REFLECTAF_BUFF: - case SPELL_REFLECTSFr_BUFF: - case SPELL_THORNS_BUFF: - default: - return me; + switch (spellId) + { + case SPELL_KNOCK_BUFF: + case SPELL_THUNDER_BUFF: + case SPELL_MSTRIKE_BUFF: + case SPELL_STORM_BUFF: + return me->getVictim(); + + case SPELL_MANAB_BUFF: + return GetHatedManaUser(); + + case SPELL_MENDING_BUFF: + case SPELL_REFLECTAF_BUFF: + case SPELL_REFLECTSFr_BUFF: + case SPELL_THORNS_BUFF: + default: + return me; + } } - } + }; }; -CreatureAI* GetAI_mob_anubisath_sentinelAI(Creature* pCreature) -{ - return new aqsentinelAI (pCreature); -} void AddSC_mob_anubisath_sentinel() { - Script *newscript; - newscript = new Script; - newscript->Name = "mob_anubisath_sentinel"; - newscript->GetAI = &GetAI_mob_anubisath_sentinelAI; - newscript->RegisterSelf(); + new mob_anubisath_sentinel(); } diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index 6edcf9b72cf..6f6a5cb64c8 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -27,118 +27,121 @@ EndScriptData */ #include "wailing_caverns.h" #define MAX_ENCOUNTER 9 - -struct instance_wailing_caverns : public ScriptedInstance +
class instance_wailing_caverns : public InstanceMapScript { - instance_wailing_caverns(Map* pMap) : ScriptedInstance(pMap) {Initialize();}; - - uint32 m_auiEncounter[MAX_ENCOUNTER]; - - bool yelled; - uint64 NaralexGUID; +public: + instance_wailing_caverns() : InstanceMapScript("instance_wailing_caverns") { } - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); - - yelled = false; - NaralexGUID = 0; + return new instance_wailing_caverns_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_wailing_caverns_InstanceMapScript : public InstanceScript { - if (pCreature->GetEntry() == DATA_NARALEX) - NaralexGUID = pCreature->GetGUID(); - } + instance_wailing_caverns_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();}; - void SetData(uint32 type, uint32 data) - { - switch (type) + uint32 m_auiEncounter[MAX_ENCOUNTER]; + + bool yelled; + uint64 NaralexGUID; + + void Initialize() { - case TYPE_LORD_COBRAHN: m_auiEncounter[0] = data;break; - case TYPE_LORD_PYTHAS: m_auiEncounter[1] = data;break; - case TYPE_LADY_ANACONDRA: m_auiEncounter[2] = data;break; - case TYPE_LORD_SERPENTIS: m_auiEncounter[3] = data;break; - case TYPE_NARALEX_EVENT: m_auiEncounter[4] = data;break; - case TYPE_NARALEX_PART1: m_auiEncounter[5] = data;break; - case TYPE_NARALEX_PART2: m_auiEncounter[6] = data;break; - case TYPE_NARALEX_PART3: m_auiEncounter[7] = data;break; - case TYPE_MUTANUS_THE_DEVOURER: m_auiEncounter[8] = data;break; - case TYPE_NARALEX_YELLED: yelled = true; break; + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); + + yelled = false; + NaralexGUID = 0; } - if (data == DONE)SaveToDB(); - } - uint32 GetData(uint32 type) - { - switch (type) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case TYPE_LORD_COBRAHN: return m_auiEncounter[0]; - case TYPE_LORD_PYTHAS: return m_auiEncounter[1]; - case TYPE_LADY_ANACONDRA: return m_auiEncounter[2]; - case TYPE_LORD_SERPENTIS: return m_auiEncounter[3]; - case TYPE_NARALEX_EVENT: return m_auiEncounter[4]; - case TYPE_NARALEX_PART1: return m_auiEncounter[5]; - case TYPE_NARALEX_PART2: return m_auiEncounter[6]; - case TYPE_NARALEX_PART3: return m_auiEncounter[7]; - case TYPE_MUTANUS_THE_DEVOURER: return m_auiEncounter[8]; - case TYPE_NARALEX_YELLED: return yelled; + if (pCreature->GetEntry() == DATA_NARALEX) + NaralexGUID = pCreature->GetGUID(); } - return 0; - } - - uint64 GetData64(uint32 data) - { - if (data == DATA_NARALEX)return NaralexGUID; - return 0; - } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; + void SetData(uint32 type, uint32 data) + { + switch (type) + { + case TYPE_LORD_COBRAHN: m_auiEncounter[0] = data;break; + case TYPE_LORD_PYTHAS: m_auiEncounter[1] = data;break; + case TYPE_LADY_ANACONDRA: m_auiEncounter[2] = data;break; + case TYPE_LORD_SERPENTIS: m_auiEncounter[3] = data;break; + case TYPE_NARALEX_EVENT: m_auiEncounter[4] = data;break; + case TYPE_NARALEX_PART1: m_auiEncounter[5] = data;break; + case TYPE_NARALEX_PART2: m_auiEncounter[6] = data;break; + case TYPE_NARALEX_PART3: m_auiEncounter[7] = data;break; + case TYPE_MUTANUS_THE_DEVOURER: m_auiEncounter[8] = data;break; + case TYPE_NARALEX_YELLED: yelled = true; break; + } + if (data == DONE)SaveToDB(); + } - std::ostringstream saveStream; - saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " - << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " - << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8]; + uint32 GetData(uint32 type) + { + switch (type) + { + case TYPE_LORD_COBRAHN: return m_auiEncounter[0]; + case TYPE_LORD_PYTHAS: return m_auiEncounter[1]; + case TYPE_LADY_ANACONDRA: return m_auiEncounter[2]; + case TYPE_LORD_SERPENTIS: return m_auiEncounter[3]; + case TYPE_NARALEX_EVENT: return m_auiEncounter[4]; + case TYPE_NARALEX_PART1: return m_auiEncounter[5]; + case TYPE_NARALEX_PART2: return m_auiEncounter[6]; + case TYPE_NARALEX_PART3: return m_auiEncounter[7]; + case TYPE_MUTANUS_THE_DEVOURER: return m_auiEncounter[8]; + case TYPE_NARALEX_YELLED: return yelled; + } + return 0; + } - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } + uint64 GetData64(uint32 data) + { + if (data == DATA_NARALEX)return NaralexGUID; + return 0; + } - void Load(const char* in) - { - if (!in) + std::string GetSaveData() { - OUT_LOAD_INST_DATA_FAIL; - return; + OUT_SAVE_INST_DATA; + + std::ostringstream saveStream; + saveStream << m_auiEncounter[0] << " " << m_auiEncounter[1] << " " << m_auiEncounter[2] << " " + << m_auiEncounter[3] << " " << m_auiEncounter[4] << " " << m_auiEncounter[5] << " " + << m_auiEncounter[6] << " " << m_auiEncounter[7] << " " << m_auiEncounter[8]; + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); } - OUT_LOAD_INST_DATA(in); + void Load(const char* in) + { + if (!in) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(in); - std::istringstream loadStream(in); - loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] - >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8]; + std::istringstream loadStream(in); + loadStream >> m_auiEncounter[0] >> m_auiEncounter[1] >> m_auiEncounter[2] >> m_auiEncounter[3] + >> m_auiEncounter[4] >> m_auiEncounter[5] >> m_auiEncounter[6] >> m_auiEncounter[7] >> m_auiEncounter[8]; - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] != DONE) - m_auiEncounter[i] = NOT_STARTED; + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) + if (m_auiEncounter[i] != DONE) + m_auiEncounter[i] = NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; - } + OUT_LOAD_INST_DATA_COMPLETE; + } + + }; }; -InstanceData* GetInstanceData_instance_wailing_caverns(Map* pMap) -{ - return new instance_wailing_caverns(pMap); -} void AddSC_instance_wailing_caverns() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_wailing_caverns"; - newscript->GetInstanceData = &GetInstanceData_instance_wailing_caverns; - newscript->RegisterSelf(); + new instance_wailing_caverns(); } diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 18efcbfdd04..e7909840b75 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -74,325 +74,327 @@ enum eEnums #define GOSSIP_ID_START_2 699 //The fanglords are dead! #define GOSSIP_ITEM_NARALEX "Let the event begin!" #define ACHIEVEMENT_WAILING_CAVERNS 630 - -struct npc_disciple_of_naralexAI : public npc_escortAI +
class npc_disciple_of_naralex : public CreatureScript { - npc_disciple_of_naralexAI(Creature *c) : npc_escortAI(c) +public: + npc_disciple_of_naralex() : CreatureScript("npc_disciple_of_naralex") { } + + CreatureAI* GetAI(Creature* pCreature) const { - pInstance = c->GetInstanceData(); - eventTimer = 0; - currentEvent = 0; - eventProgress = 0; - me->setActive(true); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + return new npc_disciple_of_naralexAI(pCreature); } - uint32 eventTimer; - uint32 currentEvent; - uint32 eventProgress; - ScriptedInstance *pInstance; - - void WaypointReached(uint32 i) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (!pInstance) - return; - - switch (i) + InstanceScript *pInstance = pCreature->GetInstanceScript(); + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) { - case 4: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART1; - pInstance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS); - break; - case 5: - DoScriptText(SAY_MUST_CONTINUE, me); - pInstance->SetData(TYPE_NARALEX_PART1, DONE); - break; - case 11: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART2; - pInstance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS); - break; - case 19: - DoScriptText(SAY_BEYOND_THIS_CORRIDOR, me); - break; - case 24: - eventProgress = 1; - currentEvent = TYPE_NARALEX_PART3; - pInstance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS); - break; - } - } + pPlayer->CLOSE_GOSSIP_MENU(); + if (pInstance) + pInstance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS); - void Reset() - { + DoScriptText(SAY_MAKE_PREPARATIONS, pCreature); - } + pCreature->setFaction(250); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - void EnterCombat(Unit* who) - { - DoScriptText(SAY_ATTACKED, me, who); + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); + CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); + CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); + } + return true; } - void JustDied(Unit * /*slayer*/) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { + InstanceScript *pInstance = pCreature->GetInstanceScript(); + if (pInstance) { - pInstance->SetData(TYPE_NARALEX_EVENT, FAIL); - pInstance->SetData(TYPE_NARALEX_PART1, FAIL); - pInstance->SetData(TYPE_NARALEX_PART2, FAIL); - pInstance->SetData(TYPE_NARALEX_PART3, FAIL); + pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD_RANK_2, true); + if ((pInstance->GetData(TYPE_LORD_COBRAHN) == DONE) && (pInstance->GetData(TYPE_LORD_PYTHAS) == DONE) && + (pInstance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (pInstance->GetData(TYPE_LORD_SERPENTIS) == DONE)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NARALEX, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_2, pCreature->GetGUID()); + + if (!pInstance->GetData(TYPE_NARALEX_YELLED)) + { + DoScriptText(SAY_AT_LAST, pCreature); + pInstance->SetData(TYPE_NARALEX_YELLED, 1); + } + } + else + { + pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_1, pCreature->GetGUID()); + } } + return true; } - void JustSummoned(Creature* summoned) + struct npc_disciple_of_naralexAI : public npc_escortAI { - summoned->AI()->AttackStart(me); - } + npc_disciple_of_naralexAI(Creature *c) : npc_escortAI(c) + { + pInstance = c->GetInstanceScript(); + eventTimer = 0; + currentEvent = 0; + eventProgress = 0; + me->setActive(true); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } - void UpdateAI(const uint32 diff) - { - if (currentEvent != TYPE_NARALEX_PART3) - npc_escortAI::UpdateAI(diff); + uint32 eventTimer; + uint32 currentEvent; + uint32 eventProgress; + InstanceScript *pInstance; - if (!pInstance) - return; - if (eventTimer <= diff) + void WaypointReached(uint32 i) { - eventTimer = 0; - if (pInstance->GetData(currentEvent) == IN_PROGRESS) + if (!pInstance) + return; + + switch (i) { - switch (currentEvent) + case 4: + eventProgress = 1; + currentEvent = TYPE_NARALEX_PART1; + pInstance->SetData(TYPE_NARALEX_PART1, IN_PROGRESS); + break; + case 5: + DoScriptText(SAY_MUST_CONTINUE, me); + pInstance->SetData(TYPE_NARALEX_PART1, DONE); + break; + case 11: + eventProgress = 1; + currentEvent = TYPE_NARALEX_PART2; + pInstance->SetData(TYPE_NARALEX_PART2, IN_PROGRESS); + break; + case 19: + DoScriptText(SAY_BEYOND_THIS_CORRIDOR, me); + break; + case 24: + eventProgress = 1; + currentEvent = TYPE_NARALEX_PART3; + pInstance->SetData(TYPE_NARALEX_PART3, IN_PROGRESS); + break; + } + } + + void Reset() + { + + } + + void EnterCombat(Unit* who) + { + DoScriptText(SAY_ATTACKED, me, who); + } + + void JustDied(Unit * /*slayer*/) + { + if (pInstance) + { + pInstance->SetData(TYPE_NARALEX_EVENT, FAIL); + pInstance->SetData(TYPE_NARALEX_PART1, FAIL); + pInstance->SetData(TYPE_NARALEX_PART2, FAIL); + pInstance->SetData(TYPE_NARALEX_PART3, FAIL); + } + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + + void UpdateAI(const uint32 diff) + { + if (currentEvent != TYPE_NARALEX_PART3) + npc_escortAI::UpdateAI(diff); + + if (!pInstance) + return; + if (eventTimer <= diff) + { + eventTimer = 0; + if (pInstance->GetData(currentEvent) == IN_PROGRESS) { - case TYPE_NARALEX_PART1: - if (eventProgress == 1) - { - ++eventProgress; - DoScriptText(SAY_TEMPLE_OF_PROMISE, me); - me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763, 227.874, -93.3233, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506, 216.645, -93.6756, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - } - break; - case TYPE_NARALEX_PART2: - if (eventProgress == 1) - { - ++eventProgress; - DoScriptText(SAY_BANISH_THE_SPIRITS, me); - DoCast(me, SPELL_SERPENTINE_CLEANSING); - //CAST_AI(npc_escortAI, me->AI())->SetCanDefend(false); - eventTimer = 30000; - me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261, 273.676, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658, 280.799, -92.8393, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - me->SummonCreature(NPC_DEVIATE_VIPER, -50.002, 278.578, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); - } - else - if (eventProgress == 2) - { - //CAST_AI(npc_escortAI, me->AI())->SetCanDefend(true); - DoScriptText(SAY_CAVERNS_PURIFIED, me); - pInstance->SetData(TYPE_NARALEX_PART2, DONE); - if (me->HasAura(SPELL_SERPENTINE_CLEANSING)) - me->RemoveAura(SPELL_SERPENTINE_CLEANSING); - } - break; - case TYPE_NARALEX_PART3: - if (eventProgress == 1) - { - ++eventProgress; - eventTimer = 4000; - me->SetStandState(UNIT_STAND_STATE_KNEEL); - DoScriptText(SAY_EMERALD_DREAM, me); - } - else - if (eventProgress == 2) - { - ++eventProgress; - eventTimer = 15000; - //CAST_AI(npc_escortAI, me->AI())->SetCanDefend(false); - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoCast(naralex, SPELL_NARALEXS_AWAKENING, true); - DoScriptText(EMOTE_AWAKENING_RITUAL, me); - } - else - if (eventProgress == 3) - { - ++eventProgress; - eventTimer = 15000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoScriptText(EMOTE_TROUBLED_SLEEP, naralex); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943, 199.701, -103.529, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08, 221.13, -103.609, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007, 227.428, -97.421, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - } - else - if (eventProgress == 4) - { - ++eventProgress; - eventTimer = 30000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413, 207.188, -102.469, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857, 218.645, -102.905, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102, 227.211, -102.752, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372, 235.149, -102.826, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524, 251.113, -102.558, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208, 266.466, -102.977, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167, 274.759, -102.962, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); - } - else - if (eventProgress == 5) - { - ++eventProgress; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoScriptText(EMOTE_HORRENDOUS_VISION, naralex); - me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872, 262.905, -103.503, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); - DoScriptText(SAY_MUTANUS_THE_DEVOURER, me); - pInstance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS); - } - else - if (eventProgress == 6 && pInstance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE) - { - ++eventProgress; - eventTimer = 3000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + switch (currentEvent) + { + case TYPE_NARALEX_PART1: + if (eventProgress == 1) { - AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); - if (AchievWC) + ++eventProgress; + DoScriptText(SAY_TEMPLE_OF_PROMISE, me); + me->SummonCreature(NPC_DEVIATE_RAVAGER, -82.1763, 227.874, -93.3233, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + me->SummonCreature(NPC_DEVIATE_RAVAGER, -72.9506, 216.645, -93.6756, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + } + break; + case TYPE_NARALEX_PART2: + if (eventProgress == 1) + { + ++eventProgress; + DoScriptText(SAY_BANISH_THE_SPIRITS, me); + DoCast(me, SPELL_SERPENTINE_CLEANSING); + //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false); + eventTimer = 30000; + me->SummonCreature(NPC_DEVIATE_VIPER, -61.5261, 273.676, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + me->SummonCreature(NPC_DEVIATE_VIPER, -58.4658, 280.799, -92.8393, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + me->SummonCreature(NPC_DEVIATE_VIPER, -50.002, 278.578, -92.8442, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 5000); + } + else + if (eventProgress == 2) + { + //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(true); + DoScriptText(SAY_CAVERNS_PURIFIED, me); + pInstance->SetData(TYPE_NARALEX_PART2, DONE); + if (me->HasAura(SPELL_SERPENTINE_CLEANSING)) + me->RemoveAura(SPELL_SERPENTINE_CLEANSING); + } + break; + case TYPE_NARALEX_PART3: + if (eventProgress == 1) + { + ++eventProgress; + eventTimer = 4000; + me->SetStandState(UNIT_STAND_STATE_KNEEL); + DoScriptText(SAY_EMERALD_DREAM, me); + } + else + if (eventProgress == 2) + { + ++eventProgress; + eventTimer = 15000; + //CAST_AI(npc_escort::npc_escortAI, me->AI())->SetCanDefend(false); + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoCast(naralex, SPELL_NARALEXS_AWAKENING, true); + DoScriptText(EMOTE_AWAKENING_RITUAL, me); + } + else + if (eventProgress == 3) + { + ++eventProgress; + eventTimer = 15000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoScriptText(EMOTE_TROUBLED_SLEEP, naralex); + me->SummonCreature(NPC_DEVIATE_MOCCASIN, 135.943, 199.701, -103.529, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_DEVIATE_MOCCASIN, 151.08, 221.13, -103.609, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_DEVIATE_MOCCASIN, 128.007, 227.428, -97.421, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + } + else + if (eventProgress == 4) + { + ++eventProgress; + eventTimer = 30000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoScriptText(EMOTE_WRITHE_IN_AGONY, naralex); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 133.413, 207.188, -102.469, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 142.857, 218.645, -102.905, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 105.102, 227.211, -102.752, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 153.372, 235.149, -102.826, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 149.524, 251.113, -102.558, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 136.208, 266.466, -102.977, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + me->SummonCreature(NPC_NIGHTMARE_ECTOPLASM, 126.167, 274.759, -102.962, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 15000); + } + else + if (eventProgress == 5) + { + ++eventProgress; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoScriptText(EMOTE_HORRENDOUS_VISION, naralex); + me->SummonCreature(NPC_MUTANUS_THE_DEVOURER, 150.872, 262.905, -103.503, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 300000); + DoScriptText(SAY_MUTANUS_THE_DEVOURER, me); + pInstance->SetData(TYPE_MUTANUS_THE_DEVOURER, IN_PROGRESS); + } + else + if (eventProgress == 6 && pInstance->GetData(TYPE_MUTANUS_THE_DEVOURER) == DONE) + { + ++eventProgress; + eventTimer = 3000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) { - Map* pMap = me->GetMap(); - if (pMap && pMap->IsDungeon()) + AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); + if (AchievWC) { - Map::PlayerList const &players = pMap->GetPlayers(); - for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) - itr->getSource()->CompletedAchievement(AchievWC); + Map* pMap = me->GetMap(); + if (pMap && pMap->IsDungeon()) + { + Map::PlayerList const &players = pMap->GetPlayers(); + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + itr->getSource()->CompletedAchievement(AchievWC); + } } + if (me->HasAura(SPELL_NARALEXS_AWAKENING)) + me->RemoveAura(SPELL_NARALEXS_AWAKENING); + naralex->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_I_AM_AWAKE, naralex); + } + DoScriptText(SAY_NARALEX_AWAKES, me); + } + else + if (eventProgress == 7) + { + ++eventProgress; + eventTimer = 6000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + DoScriptText(SAY_THANK_YOU, naralex); + } + else + if (eventProgress == 8) + { + ++eventProgress; + eventTimer = 8000; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + { + DoScriptText(SAY_FAREWELL, naralex); + naralex->AddAura(SPELL_FLIGHT_FORM, naralex); } - if (me->HasAura(SPELL_NARALEXS_AWAKENING)) - me->RemoveAura(SPELL_NARALEXS_AWAKENING); - naralex->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_I_AM_AWAKE, naralex); + SetRun(); + me->SetStandState(UNIT_STAND_STATE_STAND); + me->AddAura(SPELL_FLIGHT_FORM, me); + } + else + if (eventProgress == 9) + { + ++eventProgress; + eventTimer = 1500; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ()); } - DoScriptText(SAY_NARALEX_AWAKES, me); - } - else - if (eventProgress == 7) - { - ++eventProgress; - eventTimer = 6000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - DoScriptText(SAY_THANK_YOU, naralex); - } - else - if (eventProgress == 8) - { - ++eventProgress; - eventTimer = 8000; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + else + if (eventProgress == 10) { - DoScriptText(SAY_FAREWELL, naralex); - naralex->AddAura(SPELL_FLIGHT_FORM, naralex); + ++eventProgress; + eventTimer = 2500; + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + { + naralex->GetMotionMaster()->MovePoint(0, 117.095512, 247.107971, -96.167870); + naralex->GetMotionMaster()->MovePoint(1, 90.388809, 276.135406, -83.389801); + } + me->GetMotionMaster()->MovePoint(26, 117.095512, 247.107971, -96.167870); + me->GetMotionMaster()->MovePoint(27, 144.375443, 281.045837, -82.477135); } - SetRun(); - me->SetStandState(UNIT_STAND_STATE_STAND); - me->AddAura(SPELL_FLIGHT_FORM, me); - } - else - if (eventProgress == 9) - { - ++eventProgress; - eventTimer = 1500; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - naralex->GetMotionMaster()->MovePoint(25, naralex->GetPositionX(), naralex->GetPositionY(), naralex->GetPositionZ()); - } - else - if (eventProgress == 10) - { - ++eventProgress; - eventTimer = 2500; - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + else + if (eventProgress == 11) { - naralex->GetMotionMaster()->MovePoint(0, 117.095512, 247.107971, -96.167870); - naralex->GetMotionMaster()->MovePoint(1, 90.388809, 276.135406, -83.389801); + if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) + naralex->SetVisibility(VISIBILITY_OFF); + me->SetVisibility(VISIBILITY_OFF); + pInstance->SetData(TYPE_NARALEX_PART3, DONE); } - me->GetMotionMaster()->MovePoint(26, 117.095512, 247.107971, -96.167870); - me->GetMotionMaster()->MovePoint(27, 144.375443, 281.045837, -82.477135); - } - else - if (eventProgress == 11) - { - if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) - naralex->SetVisibility(VISIBILITY_OFF); - me->SetVisibility(VISIBILITY_OFF); - pInstance->SetData(TYPE_NARALEX_PART3, DONE); - } - break; + break; + } } - } - } else eventTimer -= diff; - } -}; - -CreatureAI* GetAI_npc_disciple_of_naralex(Creature* pCreature) -{ - return new npc_disciple_of_naralexAI(pCreature); -} - -bool GossipHello_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature) -{ - ScriptedInstance *pInstance = pCreature->GetInstanceData(); - - if (pInstance) - { - pCreature->CastSpell(pPlayer, SPELL_MARK_OF_THE_WILD_RANK_2, true); - if ((pInstance->GetData(TYPE_LORD_COBRAHN) == DONE) && (pInstance->GetData(TYPE_LORD_PYTHAS) == DONE) && - (pInstance->GetData(TYPE_LADY_ANACONDRA) == DONE) && (pInstance->GetData(TYPE_LORD_SERPENTIS) == DONE)) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NARALEX, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_2, pCreature->GetGUID()); - - if (!pInstance->GetData(TYPE_NARALEX_YELLED)) - { - DoScriptText(SAY_AT_LAST, pCreature); - pInstance->SetData(TYPE_NARALEX_YELLED, 1); - } - } - else - { - pPlayer->SEND_GOSSIP_MENU(GOSSIP_ID_START_1, pCreature->GetGUID()); + } else eventTimer -= diff; } - } - return true; -} + }; -bool GossipSelect_npc_disciple_of_naralex(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - ScriptedInstance *pInstance = pCreature->GetInstanceData(); - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - if (pInstance) - pInstance->SetData(TYPE_NARALEX_EVENT, IN_PROGRESS); +}; - DoScriptText(SAY_MAKE_PREPARATIONS, pCreature); - pCreature->setFaction(250); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtFar(false); - CAST_AI(npc_escortAI, (pCreature->AI()))->SetDespawnAtEnd(false); - } - return true; -} void AddSC_wailing_caverns() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_disciple_of_naralex"; - newscript->pGossipHello = &GossipHello_npc_disciple_of_naralex; - newscript->pGossipSelect = &GossipSelect_npc_disciple_of_naralex; - newscript->GetAI = &GetAI_npc_disciple_of_naralex; - newscript->RegisterSelf(); + new npc_disciple_of_naralex(); } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index 8849d9ca83f..cba513bf520 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -86,276 +86,279 @@ float Spawnsway[2][3] = {1884.86,1228.62,9}, {1887.53,1263,41} }; - -struct instance_zulfarrak : public ScriptedInstance +
class instance_zulfarrak : public InstanceMapScript { - instance_zulfarrak(Map* pMap) : ScriptedInstance(pMap) {Initialize();} - - uint32 GahzRillaEncounter; - uint64 ZumrahGUID; - uint64 BlyGUID; - uint64 WeegliGUID; - uint64 OroGUID; - uint64 RavenGUID; - uint64 MurtaGUID; - uint64 EndDoorGUID; - uint32 PyramidPhase; - uint32 major_wave_Timer; - uint32 minor_wave_Timer; - uint32 addGroupSize; - uint32 waypoint; +public: + instance_zulfarrak() : InstanceMapScript("instance_zulfarrak") { } - void Initialize() + InstanceScript* GetInstanceData_InstanceMapScript(Map* pMap) { - GahzRillaEncounter = NOT_STARTED; + return new instance_zulfarrak_InstanceMapScript(pMap); } - void OnCreatureCreate(Creature* pCreature, bool /*add*/) + struct instance_zulfarrak_InstanceMapScript : public InstanceScript { - switch (pCreature->GetEntry()) + instance_zulfarrak_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();} + + uint32 GahzRillaEncounter; + uint64 ZumrahGUID; + uint64 BlyGUID; + uint64 WeegliGUID; + uint64 OroGUID; + uint64 RavenGUID; + uint64 MurtaGUID; + uint64 EndDoorGUID; + uint32 PyramidPhase; + uint32 major_wave_Timer; + uint32 minor_wave_Timer; + uint32 addGroupSize; + uint32 waypoint; + + void Initialize() { - case ENTRY_ZUMRAH: - ZumrahGUID = pCreature->GetGUID(); - break; - case ENTRY_BLY: - BlyGUID = pCreature->GetGUID(); - pCreature->SetReactState(REACT_PASSIVE); // starts out passive (in a cage) - break; - case ENTRY_RAVEN: - RavenGUID = pCreature->GetGUID(); - pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) - break; - case ENTRY_ORO: - OroGUID = pCreature->GetGUID(); - pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) - break; - case ENTRY_WEEGLI: - WeegliGUID = pCreature->GetGUID(); - pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) - break; - case ENTRY_MURTA: - MurtaGUID = pCreature->GetGUID(); - pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) - break; - case NPC_GAHZRILLA: - if (GahzRillaEncounter >= IN_PROGRESS) - pCreature->DisappearAndDie(); - else - GahzRillaEncounter = IN_PROGRESS; - break; + GahzRillaEncounter = NOT_STARTED; } - } - void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) - { - switch(pGo->GetEntry()) + void OnCreatureCreate(Creature* pCreature, bool /*add*/) { - case GO_END_DOOR: - EndDoorGUID = pGo->GetGUID(); - break; + switch (pCreature->GetEntry()) + { + case ENTRY_ZUMRAH: + ZumrahGUID = pCreature->GetGUID(); + break; + case ENTRY_BLY: + BlyGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE); // starts out passive (in a cage) + break; + case ENTRY_RAVEN: + RavenGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) + break; + case ENTRY_ORO: + OroGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) + break; + case ENTRY_WEEGLI: + WeegliGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) + break; + case ENTRY_MURTA: + MurtaGUID = pCreature->GetGUID(); + pCreature->SetReactState(REACT_PASSIVE);// starts out passive (in a cage) + break; + case NPC_GAHZRILLA: + if (GahzRillaEncounter >= IN_PROGRESS) + pCreature->DisappearAndDie(); + else + GahzRillaEncounter = IN_PROGRESS; + break; + } } - } - uint32 GetData(uint32 type) - { - switch(type) + void OnGameObjectCreate(GameObject* pGo, bool /*apply*/) { - case EVENT_PYRAMID: - return PyramidPhase; + switch(pGo->GetEntry()) + { + case GO_END_DOOR: + EndDoorGUID = pGo->GetGUID(); + break; + } } - return 0; - } - uint64 GetData64(uint32 data) - { - switch(data) + uint32 GetData(uint32 type) { - case ENTRY_ZUMRAH: - return ZumrahGUID; - case ENTRY_BLY: - return BlyGUID; - case ENTRY_RAVEN: - return RavenGUID; - case ENTRY_ORO: - return OroGUID; - case ENTRY_WEEGLI: - return WeegliGUID; - case ENTRY_MURTA: - return MurtaGUID; - case GO_END_DOOR: - return EndDoorGUID; + switch(type) + { + case EVENT_PYRAMID: + return PyramidPhase; + } + return 0; } - return 0; - } - void SetData(uint32 type, uint32 data) - { - switch(type) + uint64 GetData64(uint32 data) { - case EVENT_PYRAMID: - PyramidPhase=data; - break; - }; - } + switch(data) + { + case ENTRY_ZUMRAH: + return ZumrahGUID; + case ENTRY_BLY: + return BlyGUID; + case ENTRY_RAVEN: + return RavenGUID; + case ENTRY_ORO: + return OroGUID; + case ENTRY_WEEGLI: + return WeegliGUID; + case ENTRY_MURTA: + return MurtaGUID; + case GO_END_DOOR: + return EndDoorGUID; + } + return 0; + } - virtual void Update(uint32 diff) - { - switch (PyramidPhase) + void SetData(uint32 type, uint32 data) { - case PYRAMID_NOT_STARTED: - case PYRAMID_KILLED_ALL_TROLLS: - break; - case PYRAMID_ARRIVED_AT_STAIR: - SpawnPyramidWave(1); - SetData(EVENT_PYRAMID,PYRAMID_WAVE_1); - major_wave_Timer=120000; - minor_wave_Timer=0; - addGroupSize=2; - break; - case PYRAMID_WAVE_1: - if (IsWaveAllDead()) - { - SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_2); - major_wave_Timer = 10000; //give players a few seconds before wave 2 starts to rebuff - } - else - if (minor_wave_Timer<diff) + switch(type) + { + case EVENT_PYRAMID: + PyramidPhase=data; + break; + }; + } + + virtual void Update(uint32 diff) + { + switch (PyramidPhase) + { + case PYRAMID_NOT_STARTED: + case PYRAMID_KILLED_ALL_TROLLS: + break; + case PYRAMID_ARRIVED_AT_STAIR: + SpawnPyramidWave(1); + SetData(EVENT_PYRAMID,PYRAMID_WAVE_1); + major_wave_Timer=120000; + minor_wave_Timer=0; + addGroupSize=2; + break; + case PYRAMID_WAVE_1: + if (IsWaveAllDead()) { - SendAddsUpStairs(addGroupSize++); - minor_wave_Timer=10000; + SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_2); + major_wave_Timer = 10000; //give players a few seconds before wave 2 starts to rebuff } else - minor_wave_Timer -= diff; - break; - case PYRAMID_PRE_WAVE_2: - if (major_wave_Timer<diff) - { - // beginning 2nd wave! - SpawnPyramidWave(2); - SetData(EVENT_PYRAMID,PYRAMID_WAVE_2); - minor_wave_Timer = 0; - addGroupSize=2; - } - else - major_wave_Timer -= diff; - break; - case PYRAMID_WAVE_2: - if (IsWaveAllDead()) - { - SpawnPyramidWave(3); - SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_3); - major_wave_Timer = 5000; //give NPCs time to return to their home spots - } - else - if (minor_wave_Timer<diff) + if (minor_wave_Timer<diff) + { + SendAddsUpStairs(addGroupSize++); + minor_wave_Timer=10000; + } + else + minor_wave_Timer -= diff; + break; + case PYRAMID_PRE_WAVE_2: + if (major_wave_Timer<diff) + { + // beginning 2nd wave! + SpawnPyramidWave(2); + SetData(EVENT_PYRAMID,PYRAMID_WAVE_2); + minor_wave_Timer = 0; + addGroupSize=2; + } + else + major_wave_Timer -= diff; + break; + case PYRAMID_WAVE_2: + if (IsWaveAllDead()) { - SendAddsUpStairs(addGroupSize++); - minor_wave_Timer=10000; + SpawnPyramidWave(3); + SetData(EVENT_PYRAMID,PYRAMID_PRE_WAVE_3); + major_wave_Timer = 5000; //give NPCs time to return to their home spots } else - minor_wave_Timer -= diff; - break; - case PYRAMID_PRE_WAVE_3: - if (major_wave_Timer<diff) - { - // move NPCs to bottom of stair - MoveNPCIfAlive(ENTRY_BLY,1887.92,1228.179,9.98,4.78); - MoveNPCIfAlive(ENTRY_MURTA,1891.57,1228.68,9.69,4.78); - MoveNPCIfAlive(ENTRY_ORO,1897.23,1228.34,9.43,4.78); - MoveNPCIfAlive(ENTRY_RAVEN,1883.68,1227.95,9.543,4.78); - MoveNPCIfAlive(ENTRY_WEEGLI,1878.02,1227.65,9.485,4.78); - SetData(EVENT_PYRAMID,PYRAMID_WAVE_3); - } - else - major_wave_Timer -= diff; - break; - case PYRAMID_WAVE_3: - if (IsWaveAllDead()) // move NPCS to their final positions - { - SetData(EVENT_PYRAMID,PYRAMID_KILLED_ALL_TROLLS); - MoveNPCIfAlive(ENTRY_BLY,1883.82,1200.83,8.87,1.32); - MoveNPCIfAlive(ENTRY_MURTA,1891.83,1201.45,8.87,1.32); - MoveNPCIfAlive(ENTRY_ORO,1894.50,1204.40,8.87,1.32); - MoveNPCIfAlive(ENTRY_RAVEN,1874.11,1206.17,8.87,1.32); - MoveNPCIfAlive(ENTRY_WEEGLI,1877.52,1199.63,8.87,1.32); - } - break; - }; - } + if (minor_wave_Timer<diff) + { + SendAddsUpStairs(addGroupSize++); + minor_wave_Timer=10000; + } + else + minor_wave_Timer -= diff; + break; + case PYRAMID_PRE_WAVE_3: + if (major_wave_Timer<diff) + { + // move NPCs to bottom of stair + MoveNPCIfAlive(ENTRY_BLY,1887.92,1228.179,9.98,4.78); + MoveNPCIfAlive(ENTRY_MURTA,1891.57,1228.68,9.69,4.78); + MoveNPCIfAlive(ENTRY_ORO,1897.23,1228.34,9.43,4.78); + MoveNPCIfAlive(ENTRY_RAVEN,1883.68,1227.95,9.543,4.78); + MoveNPCIfAlive(ENTRY_WEEGLI,1878.02,1227.65,9.485,4.78); + SetData(EVENT_PYRAMID,PYRAMID_WAVE_3); + } + else + major_wave_Timer -= diff; + break; + case PYRAMID_WAVE_3: + if (IsWaveAllDead()) // move NPCS to their final positions + { + SetData(EVENT_PYRAMID,PYRAMID_KILLED_ALL_TROLLS); + MoveNPCIfAlive(ENTRY_BLY,1883.82,1200.83,8.87,1.32); + MoveNPCIfAlive(ENTRY_MURTA,1891.83,1201.45,8.87,1.32); + MoveNPCIfAlive(ENTRY_ORO,1894.50,1204.40,8.87,1.32); + MoveNPCIfAlive(ENTRY_RAVEN,1874.11,1206.17,8.87,1.32); + MoveNPCIfAlive(ENTRY_WEEGLI,1877.52,1199.63,8.87,1.32); + } + break; + }; + } - std::list<uint64> addsAtBase,movedadds; + std::list<uint64> addsAtBase,movedadds; - void MoveNPCIfAlive(uint32 entry,float x,float y,float z,float o) - { - if (Creature* npc = instance->GetCreature(GetData64(entry))) - { - if (npc->isAlive()) + void MoveNPCIfAlive(uint32 entry,float x,float y,float z,float o) + { + if (Creature* npc = instance->GetCreature(GetData64(entry))) { - npc->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); - npc->GetMotionMaster()->MovePoint(1,x,y,z); - npc->SetHomePosition(x,y,z,o); - } + if (npc->isAlive()) + { + npc->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + npc->GetMotionMaster()->MovePoint(1,x,y,z); + npc->SetHomePosition(x,y,z,o); + } + } } - } - void SpawnPyramidWave(uint32 wave){ - for (int i = 0; i < pyramidSpawnTotal; i++) - { - if (pyramidSpawns[i][0] == (float)wave) + void SpawnPyramidWave(uint32 wave){ + for (int i = 0; i < pyramidSpawnTotal; i++) { - Position pos = {pyramidSpawns[i][2], pyramidSpawns[i][3], 8.87, 0}; - TempSummon* ts = instance->SummonCreature(pyramidSpawns[i][1],pos); - ts->GetMotionMaster()->MoveRandom(10); - addsAtBase.push_back(ts->GetGUID()); + if (pyramidSpawns[i][0] == (float)wave) + { + Position pos = {pyramidSpawns[i][2], pyramidSpawns[i][3], 8.87, 0}; + TempSummon* ts = instance->SummonCreature(pyramidSpawns[i][1],pos); + ts->GetMotionMaster()->MoveRandom(10); + addsAtBase.push_back(ts->GetGUID()); + } } } - } - bool IsWaveAllDead(){ - for(std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr) - { - if (Creature* add = instance->GetCreature((*itr))) + bool IsWaveAllDead(){ + for(std::list<uint64>::iterator itr = addsAtBase.begin(); itr != addsAtBase.end(); ++itr) { - if (add->isAlive()) - return false; + if (Creature* add = instance->GetCreature((*itr))) + { + if (add->isAlive()) + return false; + } } - } - for(std::list<uint64>::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr) - { - if (Creature* add = instance->GetCreature(((*itr)))) + for(std::list<uint64>::iterator itr = movedadds.begin(); itr != movedadds.end(); ++itr) { - if (add->isAlive()) - return false; + if (Creature* add = instance->GetCreature(((*itr)))) + { + if (add->isAlive()) + return false; + } } + return true; } - return true; - } - void SendAddsUpStairs(uint32 count) - { - //pop a add from list, send him up the stairs... - for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++) + void SendAddsUpStairs(uint32 count) { - if (Creature* add = instance->GetCreature(*addsAtBase.begin())) + //pop a add from list, send him up the stairs... + for (uint32 addCount = 0; addCount<count && !addsAtBase.empty(); addCount++) { - add->GetMotionMaster()->MovePath(PATH_ADDS,false); - movedadds.push_back(add->GetGUID()); + if (Creature* add = instance->GetCreature(*addsAtBase.begin())) + { + add->GetMotionMaster()->MovePath(PATH_ADDS,false); + movedadds.push_back(add->GetGUID()); + } + addsAtBase.erase(addsAtBase.begin()); } - addsAtBase.erase(addsAtBase.begin()); } - } + }; + }; -InstanceData* GetInstanceData_instance_zulfarrak(Map* pMap) -{ - return new instance_zulfarrak(pMap); -} void AddSC_instance_zulfarrak() { - Script *newscript; - newscript = new Script; - newscript->Name = "instance_zulfarrak"; - newscript->GetInstanceData = &GetInstanceData_instance_zulfarrak; - newscript->RegisterSelf(); + new instance_zulfarrak(); } diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index bed8bafe096..71e2a6906b7 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -55,143 +55,152 @@ enum blySpells }; #define GOSSIP_BLY "[PH] In that case, I will take my reward!" - -struct npc_sergeant_blyAI : public ScriptedAI +
class npc_sergeant_bly : public CreatureScript { - npc_sergeant_blyAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_sergeant_bly() : CreatureScript("npc_sergeant_bly") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - pInstance = pCreature->GetInstanceData(); - postGossipStep = 0; + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + CAST_AI(npc_sergeant_bly::npc_sergeant_blyAI,pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + pCreature->AI()->DoAction(); + } + return true; } - ScriptedInstance* pInstance; - - uint32 postGossipStep; - uint32 Text_Timer; - uint32 ShieldBash_Timer; - uint32 Revenge_Timer; //this is wrong, spell should never be used unless me->getVictim() dodge, parry or block attack. Trinity support required. - uint64 PlayerGUID; - - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - ShieldBash_Timer = 5000; - Revenge_Timer = 8000; + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_KILLED_ALL_TROLLS) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(1517, pCreature->GetGUID()); + } + else + if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_NOT_STARTED) + pPlayer->SEND_GOSSIP_MENU(1515, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(1516, pCreature->GetGUID()); + return true; + } + return false; + } - me->setFaction(FACTION_FRIENDLY); + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_sergeant_blyAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_sergeant_blyAI : public ScriptedAI { - if (postGossipStep>0 && postGossipStep<4) + npc_sergeant_blyAI(Creature* pCreature) : ScriptedAI(pCreature) + { + pInstance = pCreature->GetInstanceScript(); + postGossipStep = 0; + } + + InstanceScript* pInstance; + + uint32 postGossipStep; + uint32 Text_Timer; + uint32 ShieldBash_Timer; + uint32 Revenge_Timer; //this is wrong, spell should never be used unless me->getVictim() dodge, parry or block attack. Trinity support required. + uint64 PlayerGUID; + + void Reset() { - if (Text_Timer<diff) + ShieldBash_Timer = 5000; + Revenge_Timer = 8000; + + me->setFaction(FACTION_FRIENDLY); + } + + void UpdateAI(const uint32 diff) + { + if (postGossipStep>0 && postGossipStep<4) { - switch (postGossipStep) + if (Text_Timer<diff) { - case 1: - //weegli doesn't fight - he goes & blows up the door - if (Creature* pWeegli = pInstance->instance->GetCreature(pInstance->GetData64(ENTRY_WEEGLI))) - pWeegli->AI()->DoAction(); - DoScriptText(SAY_1,me); - Text_Timer = 5000; - break; - case 2: - DoScriptText(SAY_2,me); - Text_Timer = 5000; - break; - case 3: - me->setFaction(FACTION_HOSTILE); - if (Player* pTarget = Player::GetPlayer(*me, PlayerGUID)) - AttackStart(pTarget); - - if (pInstance) - { - switchFactionIfAlive(pInstance, ENTRY_RAVEN); - switchFactionIfAlive(pInstance, ENTRY_ORO); - switchFactionIfAlive(pInstance, ENTRY_MURTA); - } + switch (postGossipStep) + { + case 1: + //weegli doesn't fight - he goes & blows up the door + if (Creature* pWeegli = pInstance->instance->GetCreature(pInstance->GetData64(ENTRY_WEEGLI))) + pWeegli->AI()->DoAction(); + DoScriptText(SAY_1,me); + Text_Timer = 5000; + break; + case 2: + DoScriptText(SAY_2,me); + Text_Timer = 5000; + break; + case 3: + me->setFaction(FACTION_HOSTILE); + if (Player* pTarget = Player::GetPlayer(*me, PlayerGUID)) + AttackStart(pTarget); + + if (pInstance) + { + switchFactionIfAlive(pInstance, ENTRY_RAVEN); + switchFactionIfAlive(pInstance, ENTRY_ORO); + switchFactionIfAlive(pInstance, ENTRY_MURTA); + } + } + postGossipStep++; } - postGossipStep++; + else Text_Timer -= diff; } - else Text_Timer -= diff; - } - if (!UpdateVictim()) - return; + if (!UpdateVictim()) + return; - if (ShieldBash_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_SHIELD_BASH); - ShieldBash_Timer = 15000; + if (ShieldBash_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHIELD_BASH); + ShieldBash_Timer = 15000; + } + else + ShieldBash_Timer -= diff; + + if (Revenge_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_REVENGE); + Revenge_Timer = 10000; + } + else + Revenge_Timer -= diff; + + DoMeleeAttackIfReady(); } - else - ShieldBash_Timer -= diff; - if (Revenge_Timer <= diff) + void DoAction(const int32 param) { - DoCast(me->getVictim(), SPELL_REVENGE); - Revenge_Timer = 10000; + postGossipStep=1; + Text_Timer = 0; } - else - Revenge_Timer -= diff; - DoMeleeAttackIfReady(); - } - - void DoAction(const int32 param) - { - postGossipStep=1; - Text_Timer = 0; - } + void switchFactionIfAlive(InstanceScript* pInstance,uint32 entry) + { + if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry))) + if (crew->isAlive()) + crew->setFaction(FACTION_HOSTILE); + } + }; - void switchFactionIfAlive(ScriptedInstance* pInstance,uint32 entry) - { - if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry))) - if (crew->isAlive()) - crew->setFaction(FACTION_HOSTILE); - } }; -CreatureAI* GetAI_npc_sergeant_bly(Creature* pCreature) -{ - return new npc_sergeant_blyAI (pCreature); -} -bool GossipHello_npc_sergeant_bly(Player* pPlayer, Creature* pCreature) -{ - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) - { - if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_KILLED_ALL_TROLLS) - { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BLY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(1517, pCreature->GetGUID()); - } - else - if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_NOT_STARTED) - pPlayer->SEND_GOSSIP_MENU(1515, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(1516, pCreature->GetGUID()); - return true; - } - return false; -} -bool GossipSelect_npc_sergeant_bly(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - CAST_AI(npc_sergeant_blyAI,pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - pCreature->AI()->DoAction(); - } - return true; -} /*###### +## go_troll_cage +######*/ -void initBlyCrewMember(ScriptedInstance* pInstance, uint32 entry,float x,float y, float z) +void initBlyCrewMember(InstanceScript* pInstance, uint32 entry,float x,float y, float z) { if (Creature* crew = pInstance->instance->GetCreature(pInstance->GetData64(entry))) { @@ -202,21 +211,27 @@ void initBlyCrewMember(ScriptedInstance* pInstance, uint32 entry,float x,float y crew->setFaction(FACTION_FREED); } } - -bool GOHello_go_troll_cage(Player* pPlayer, GameObject* pGo) +
class go_troll_cage : public GameObjectScript { - if (ScriptedInstance* pInstance = pGo->GetInstanceData()) +public: + go_troll_cage() : GameObjectScript("go_troll_cage") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - pInstance->SetData(EVENT_PYRAMID, PYRAMID_CAGES_OPEN); - //set bly & co to aggressive & start moving to top of stairs - initBlyCrewMember(pInstance,ENTRY_BLY,1884.99,1263,41.52); - initBlyCrewMember(pInstance,ENTRY_RAVEN,1882.5,1263,41.52); - initBlyCrewMember(pInstance,ENTRY_ORO,1886.47,1270.68,41.68); - initBlyCrewMember(pInstance,ENTRY_WEEGLI,1890,1263,41.52); - initBlyCrewMember(pInstance,ENTRY_MURTA,1891.19,1272.03,41.60); + if (InstanceScript* pInstance = pGo->GetInstanceScript()) + { + pInstance->SetData(EVENT_PYRAMID, PYRAMID_CAGES_OPEN); + //set bly & co to aggressive & start moving to top of stairs + initBlyCrewMember(pInstance,ENTRY_BLY,1884.99,1263,41.52); + initBlyCrewMember(pInstance,ENTRY_RAVEN,1882.5,1263,41.52); + initBlyCrewMember(pInstance,ENTRY_ORO,1886.47,1270.68,41.68); + initBlyCrewMember(pInstance,ENTRY_WEEGLI,1890,1263,41.52); + initBlyCrewMember(pInstance,ENTRY_MURTA,1891.19,1272.03,41.60); + } + return false; } - return false; -} + +}; /*###### ## npc_weegli_blastfuse @@ -237,137 +252,146 @@ enum weegliSays }; #define GOSSIP_WEEGLI "[PH] Please blow up the door." - -struct npc_weegli_blastfuseAI : public ScriptedAI +
class npc_weegli_blastfuse : public CreatureScript { - npc_weegli_blastfuseAI(Creature* pCreature) : ScriptedAI(pCreature) - { - pInstance = pCreature->GetInstanceData(); - destroyingDoor=false; - Bomb_Timer = 10000; - LandMine_Timer = 30000; - } - - uint32 Bomb_Timer; - uint32 LandMine_Timer; - bool destroyingDoor; - ScriptedInstance* pInstance; +public: + npc_weegli_blastfuse() : CreatureScript("npc_weegli_blastfuse") { } - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) { - /*if (pInstance) - pInstance->SetData(0, NOT_STARTED);*/ + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + //here we make him run to door, set the charge and run away off to nowhere + pCreature->AI()->DoAction(); + } + return true; } - void AttackStart(Unit *victim) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - AttackStartCaster(victim,10);//keep back & toss bombs/shoot + if (InstanceScript* pInstance = pCreature->GetInstanceScript()) + { + switch (pInstance->GetData(EVENT_PYRAMID)) + { + case PYRAMID_KILLED_ALL_TROLLS: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEEGLI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(1514, pCreature->GetGUID()); //if event can proceed to end + break; + case PYRAMID_NOT_STARTED: + pPlayer->SEND_GOSSIP_MENU(1511, pCreature->GetGUID()); //if event not started + break; + default: + pPlayer->SEND_GOSSIP_MENU(1513, pCreature->GetGUID()); //if event are in progress + } + return true; + } + return false; } - void JustDied(Unit * /*victim*/) + CreatureAI* GetAI(Creature* pCreature) const { - /*if (pInstance) - pInstance->SetData(0, DONE);*/ + return new npc_weegli_blastfuseAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_weegli_blastfuseAI : public ScriptedAI { - if (!UpdateVictim()) - return; - - if (Bomb_Timer < diff) + npc_weegli_blastfuseAI(Creature* pCreature) : ScriptedAI(pCreature) { - DoCast(me->getVictim(),SPELL_BOMB); + pInstance = pCreature->GetInstanceScript(); + destroyingDoor=false; Bomb_Timer = 10000; + LandMine_Timer = 30000; + } + + uint32 Bomb_Timer; + uint32 LandMine_Timer; + bool destroyingDoor; + InstanceScript* pInstance; + + void Reset() + { + /*if (pInstance) + pInstance->SetData(0, NOT_STARTED);*/ } - else - Bomb_Timer -= diff; - if (me->isAttackReady() && !me->IsWithinMeleeRange(me->getVictim())) + void AttackStart(Unit *victim) { - DoCast(me->getVictim(),SPELL_SHOOT); - me->SetSheath(SHEATH_STATE_RANGED); + AttackStartCaster(victim,10);//keep back & toss bombs/shoot } - else + + void JustDied(Unit * /*victim*/) { - me->SetSheath(SHEATH_STATE_MELEE); - DoMeleeAttackIfReady(); + /*if (pInstance) + pInstance->SetData(0, DONE);*/ } - } - void MovementInform(uint32 type, uint32 id) - { - if (pInstance) + void UpdateAI(const uint32 diff) { - if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_CAGES_OPEN) + if (!UpdateVictim()) + return; + + if (Bomb_Timer < diff) { - pInstance->SetData(EVENT_PYRAMID,PYRAMID_ARRIVED_AT_STAIR); - DoScriptText(SAY_WEEGLI_OHNO,me); - me->SetHomePosition(1882.69,1272.28,41.87,0); + DoCast(me->getVictim(),SPELL_BOMB); + Bomb_Timer = 10000; } else - if (destroyingDoor) - { - pInstance->DoUseDoorOrButton(pInstance->GetData64(GO_END_DOOR)); - //TODO: leave the area... - me->ForcedDespawn(); - }; + Bomb_Timer -= diff; + + if (me->isAttackReady() && !me->IsWithinMeleeRange(me->getVictim())) + { + DoCast(me->getVictim(),SPELL_SHOOT); + me->SetSheath(SHEATH_STATE_RANGED); + } + else + { + me->SetSheath(SHEATH_STATE_MELEE); + DoMeleeAttackIfReady(); + } } - } - void DoAction(const int32 param) - { - DestroyDoor(); - } + void MovementInform(uint32 type, uint32 id) + { + if (pInstance) + { + if (pInstance->GetData(EVENT_PYRAMID) == PYRAMID_CAGES_OPEN) + { + pInstance->SetData(EVENT_PYRAMID,PYRAMID_ARRIVED_AT_STAIR); + DoScriptText(SAY_WEEGLI_OHNO,me); + me->SetHomePosition(1882.69,1272.28,41.87,0); + } + else + if (destroyingDoor) + { + pInstance->DoUseDoorOrButton(pInstance->GetData64(GO_END_DOOR)); + //TODO: leave the area... + me->ForcedDespawn(); + }; + } + } - void DestroyDoor() - { - if (me->isAlive()) + void DoAction(const int32 param) { - me->setFaction(FACTION_FRIENDLY); - me->GetMotionMaster()->MovePoint(0, 1858.57,1146.35,14.745); - me->SetHomePosition(1858.57,1146.35,14.745,3.85); // in case he gets interrupted - DoScriptText(SAY_WEEGLI_OK_I_GO,me); - destroyingDoor=true; + DestroyDoor(); } - } -}; -CreatureAI* GetAI_npc_weegli_blastfuse(Creature* pCreature) -{ - return new npc_weegli_blastfuseAI (pCreature); -} -bool GossipHello_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature) -{ - if (ScriptedInstance* pInstance = pCreature->GetInstanceData()) - { - switch (pInstance->GetData(EVENT_PYRAMID)) + void DestroyDoor() { - case PYRAMID_KILLED_ALL_TROLLS: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_WEEGLI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(1514, pCreature->GetGUID()); //if event can proceed to end - break; - case PYRAMID_NOT_STARTED: - pPlayer->SEND_GOSSIP_MENU(1511, pCreature->GetGUID()); //if event not started - break; - default: - pPlayer->SEND_GOSSIP_MENU(1513, pCreature->GetGUID()); //if event are in progress + if (me->isAlive()) + { + me->setFaction(FACTION_FRIENDLY); + me->GetMotionMaster()->MovePoint(0, 1858.57,1146.35,14.745); + me->SetHomePosition(1858.57,1146.35,14.745,3.85); // in case he gets interrupted + DoScriptText(SAY_WEEGLI_OK_I_GO,me); + destroyingDoor=true; + } } - return true; - } - return false; -} + }; + +}; + -bool GossipSelect_npc_weegli_blastfuse(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - //here we make him run to door, set the charge and run away off to nowhere - pCreature->AI()->DoAction(); - } - return true; -} /*###### ## go_shallow_grave @@ -380,22 +404,28 @@ enum ZOMBIE_CHANCE = 65, DEAD_HERO_CHANCE = 10 }; - -bool GOHello_go_shallow_grave(Player* pPlayer, GameObject* pGo) +
class go_shallow_grave : public GameObjectScript { - // randomly summon a zombie or dead hero the first time a grave is used - if (pGo->GetUseCount() == 0) +public: + go_shallow_grave() : GameObjectScript("go_shallow_grave") { } + + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - uint32 randomchance = urand(0,100); - if (randomchance < ZOMBIE_CHANCE) - pGo->SummonCreature(ZOMBIE, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); - else - if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE) - pGo->SummonCreature(DEAD_HERO, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + // randomly summon a zombie or dead hero the first time a grave is used + if (pGo->GetUseCount() == 0) + { + uint32 randomchance = urand(0,100); + if (randomchance < ZOMBIE_CHANCE) + pGo->SummonCreature(ZOMBIE, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + else + if ((randomchance-ZOMBIE_CHANCE) < DEAD_HERO_CHANCE) + pGo->SummonCreature(DEAD_HERO, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ(), 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000); + } + pGo->AddUse(); + return false; } - pGo->AddUse(); - return false; -} + +}; /*###### ## at_zumrah @@ -406,49 +436,29 @@ enum zumrahConsts ZUMRAH_ID = 7271, ZUMRAH_HOSTILE_FACTION = 37 }; - -bool AreaTrigger_at_zumrah(Player* pPlayer,const AreaTriggerEntry *at) +
class at_zumrah : public AreaTriggerScript { - Creature* pZumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f); +public: + at_zumrah() : AreaTriggerScript("at_zumrah") { } - if (!pZumrah) - return false; + bool OnTrigger(Player* pPlayer,const AreaTriggerEntry *at) + { + Creature* pZumrah = pPlayer->FindNearestCreature(ZUMRAH_ID, 30.0f); - pZumrah->setFaction(ZUMRAH_HOSTILE_FACTION); - return true; -} + if (!pZumrah) + return false; + + pZumrah->setFaction(ZUMRAH_HOSTILE_FACTION); + return true; + } + +}; void AddSC_zulfarrak() { - Script *newscript; - - newscript = new Script; - newscript->Name="npc_sergeant_bly"; - newscript->GetAI = &GetAI_npc_sergeant_bly; - newscript->pGossipHello = &GossipHello_npc_sergeant_bly; - newscript->pGossipSelect = &GossipSelect_npc_sergeant_bly; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_weegli_blastfuse"; - newscript->GetAI = &GetAI_npc_weegli_blastfuse; - newscript->pGossipHello = &GossipHello_npc_weegli_blastfuse; - newscript->pGossipSelect = &GossipSelect_npc_weegli_blastfuse; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_shallow_grave"; - newscript->pGOHello = &GOHello_go_shallow_grave; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "at_zumrah"; - newscript->pAreaTrigger = &AreaTrigger_at_zumrah; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_troll_cage"; - newscript->pGOHello = &GOHello_go_troll_cage; - newscript->RegisterSelf(); - + new npc_sergeant_bly(); + new npc_weegli_blastfuse(); + new go_shallow_grave(); + new at_zumrah(); + new go_troll_cage(); } diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp index 422f7fc54da..26a354a6bb0 100644 --- a/src/server/scripts/Kalimdor/azshara.cpp +++ b/src/server/scripts/Kalimdor/azshara.cpp @@ -37,63 +37,70 @@ EndContentData */ /*###### ## mobs_spitelashes ######*/ - -struct mobs_spitelashesAI : public ScriptedAI +
class mobs_spitelashes : public CreatureScript { - mobs_spitelashesAI(Creature *c) : ScriptedAI(c) {} - - uint32 morphtimer; - bool spellhit; +public: + mobs_spitelashes() : CreatureScript("mobs_spitelashes") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - morphtimer = 0; - spellhit = false; + return new mobs_spitelashesAI (pCreature); } - void EnterCombat(Unit * /*who*/) { } - - void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) + struct mobs_spitelashesAI : public ScriptedAI { - if (!spellhit && - Hitter->GetTypeId() == TYPEID_PLAYER && - CAST_PLR(Hitter)->GetQuestStatus(9364) == QUEST_STATUS_INCOMPLETE && - (Spellkind->Id == 118 || Spellkind->Id == 12824 || Spellkind->Id == 12825 || Spellkind->Id == 12826)) + mobs_spitelashesAI(Creature *c) : ScriptedAI(c) {} + + uint32 morphtimer; + bool spellhit; + + void Reset() { - spellhit=true; - DoCast(me, 29124); //become a sheep + morphtimer = 0; + spellhit = false; } - } - void UpdateAI(const uint32 diff) - { - // we mustn't remove the Creature in the same round in which we cast the summon spell, otherwise there will be no summons - if (spellhit && morphtimer >= 5000) + void EnterCombat(Unit * /*who*/) { } + + void SpellHit(Unit *Hitter, const SpellEntry *Spellkind) { - me->ForcedDespawn(); - return; + if (!spellhit && + Hitter->GetTypeId() == TYPEID_PLAYER && + CAST_PLR(Hitter)->GetQuestStatus(9364) == QUEST_STATUS_INCOMPLETE && + (Spellkind->Id == 118 || Spellkind->Id == 12824 || Spellkind->Id == 12825 || Spellkind->Id == 12826)) + { + spellhit=true; + DoCast(me, 29124); //become a sheep + } } - // walk 5 seconds before summoning - if (spellhit && morphtimer<5000) + + void UpdateAI(const uint32 diff) { - morphtimer+=diff; - if (morphtimer >= 5000) + // we mustn't remove the Creature in the same round in which we cast the summon spell, otherwise there will be no summons + if (spellhit && morphtimer >= 5000) + { + me->ForcedDespawn(); + return; + } + // walk 5 seconds before summoning + if (spellhit && morphtimer<5000) { - DoCast(me, 28406); //summon copies - DoCast(me, 6924); //visual explosion + morphtimer+=diff; + if (morphtimer >= 5000) + { + DoCast(me, 28406); //summon copies + DoCast(me, 6924); //visual explosion + } } + if (!UpdateVictim()) + return; + + //TODO: add abilities for the different creatures + DoMeleeAttackIfReady(); } - if (!UpdateVictim()) - return; + }; - //TODO: add abilities for the different creatures - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mobs_spitelashes(Creature* pCreature) -{ - return new mobs_spitelashesAI (pCreature); -} /*###### ## npc_loramus_thalipedes @@ -106,59 +113,66 @@ CreatureAI* GetAI_mobs_spitelashes(Creature* pCreature) #define GOSSIP_SELECT_LT3 "Indeed" #define GOSSIP_SELECT_LT4 "I will do this with or your help, Loramus" #define GOSSIP_SELECT_LT5 "Yes" - -bool GossipHello_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature) +
class npc_loramus_thalipedes : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_loramus_thalipedes() : CreatureScript("npc_loramus_thalipedes") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(2744); + break; + + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); + pPlayer->SEND_GOSSIP_MENU(1813, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+21: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); + pPlayer->SEND_GOSSIP_MENU(1814, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+22: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); + pPlayer->SEND_GOSSIP_MENU(1815, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+23: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); + pPlayer->SEND_GOSSIP_MENU(1816, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+24: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 25); + pPlayer->SEND_GOSSIP_MENU(1817, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+25: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(3141); + break; + } + return true; + } - if (pPlayer->GetQuestStatus(2744) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(3141) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + if (pPlayer->GetQuestStatus(2744) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(3141) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - return true; -} + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -bool GossipSelect_npc_loramus_thalipedes(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(2744); - break; - - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 21); - pPlayer->SEND_GOSSIP_MENU(1813, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+21: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 22); - pPlayer->SEND_GOSSIP_MENU(1814, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+22: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 23); - pPlayer->SEND_GOSSIP_MENU(1815, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+23: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 24); - pPlayer->SEND_GOSSIP_MENU(1816, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+24: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_LT5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 25); - pPlayer->SEND_GOSSIP_MENU(1817, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+25: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(3141); - break; + return true; } - return true; -} + +}; + /*#### # mob_rizzle_sprysprocket @@ -243,274 +257,269 @@ float WPs[58][4] = {1927.09, -3679.56, 33.9118, 3.42}, {1873.57, -3695.32, 33.9118, 3.44} }; - -struct mob_rizzle_sprysprocketAI : public ScriptedAI +
class mob_rizzle_sprysprocket : public CreatureScript { - mob_rizzle_sprysprocketAI(Creature *c) : ScriptedAI(c) {} - - uint32 spellEscape_Timer; - uint32 Teleport_Timer; - uint32 Check_Timer; - uint32 Grenade_Timer; - uint32 Must_Die_Timer; - uint32 CurrWP; +public: + mob_rizzle_sprysprocket() : CreatureScript("mob_rizzle_sprysprocket") { } - uint64 PlayerGUID; - - bool Must_Die; - bool Escape; - bool ContinueWP; - bool Reached; + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1 && pPlayer->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, SPELL_GIVE_SOUTHFURY_MOONSTONE, true); + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, pCreature->AI())->Must_Die_Timer = 3000; + CAST_AI(mob_rizzle_sprysprocket::mob_rizzle_sprysprocketAI, pCreature->AI())->Must_Die = true; + } + return true; + } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - spellEscape_Timer = 1300; - Teleport_Timer = 3500; - Check_Timer = 10000; - Grenade_Timer = 30000; - Must_Die_Timer = 3000; - CurrWP = 0; - - PlayerGUID = 0; - - Must_Die = false; - Escape = false; - ContinueWP = false; - Reached = false; + if (pPlayer->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) + return true; + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(10811, pCreature->GetGUID()); + return true; } - void UpdateAI(const uint32 diff) + CreatureAI* GetAI(Creature* pCreature) const { - if (Must_Die) - if (Must_Die_Timer <= diff) - { - me->ForcedDespawn(); - return; - } else Must_Die_Timer -= diff; + return new mob_rizzle_sprysprocketAI (pCreature); + } - if (!Escape) - { - if (!PlayerGUID) - return; + struct mob_rizzle_sprysprocketAI : public ScriptedAI + { + mob_rizzle_sprysprocketAI(Creature *c) : ScriptedAI(c) {} - if (spellEscape_Timer <= diff) - { - DoCast(me, SPELL_RIZZLE_ESCAPE, false); - spellEscape_Timer = 10000; - } else spellEscape_Timer -= diff; + uint32 spellEscape_Timer; + uint32 Teleport_Timer; + uint32 Check_Timer; + uint32 Grenade_Timer; + uint32 Must_Die_Timer; + uint32 CurrWP; - if (Teleport_Timer <= diff) - { - //temp solution - unit can't be teleported by core using spelleffect 5, only players - Map* pMap = me->GetMap(); - if (pMap) - { - pMap->CreatureRelocation(me, 3706.39, -3969.15, 35.9118, 0); - me->AI_SendMoveToPacket(3706.39, -3969.15, 35.9118, 0, 0, 0); - } - //begin swimming and summon depth charges - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - SendText(MSG_ESCAPE_NOTICE, pPlayer); - DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE); - me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); - me->SetSpeed(MOVE_RUN, 0.85f, true); - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); - Escape = true; - } else Teleport_Timer -= diff; + uint64 PlayerGUID; - return; - } + bool Must_Die; + bool Escape; + bool ContinueWP; + bool Reached; - if (ContinueWP) + void Reset() { - me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + spellEscape_Timer = 1300; + Teleport_Timer = 3500; + Check_Timer = 10000; + Grenade_Timer = 30000; + Must_Die_Timer = 3000; + CurrWP = 0; + + PlayerGUID = 0; + + Must_Die = false; + Escape = false; ContinueWP = false; + Reached = false; } - if (Grenade_Timer <= diff) + void UpdateAI(const uint32 diff) { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer) - { - DoScriptText(SAY_RIZZLE_GRENADE, me, pPlayer); - DoCast(pPlayer, SPELL_RIZZLE_FROST_GRENADE, true); - } - Grenade_Timer = 30000; - } else Grenade_Timer -= diff; + if (Must_Die) + if (Must_Die_Timer <= diff) + { + me->ForcedDespawn(); + return; + } else Must_Die_Timer -= diff; - if (Check_Timer <= diff) - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (!pPlayer) + if (!Escape) { - me->ForcedDespawn(); + if (!PlayerGUID) + return; + + if (spellEscape_Timer <= diff) + { + DoCast(me, SPELL_RIZZLE_ESCAPE, false); + spellEscape_Timer = 10000; + } else spellEscape_Timer -= diff; + + if (Teleport_Timer <= diff) + { + //temp solution - unit can't be teleported by core using spelleffect 5, only players + Map* pMap = me->GetMap(); + if (pMap) + { + pMap->CreatureRelocation(me, 3706.39, -3969.15, 35.9118, 0); + me->AI_SendMoveToPacket(3706.39, -3969.15, 35.9118, 0, 0, 0); + } + //begin swimming and summon depth charges + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + SendText(MSG_ESCAPE_NOTICE, pPlayer); + DoCast(me, SPELL_PERIODIC_DEPTH_CHARGE); + me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); + me->SetSpeed(MOVE_RUN, 0.85f, true); + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + Escape = true; + } else Teleport_Timer -= diff; + return; } - if (me->IsWithinDist(pPlayer, 10) && me->GetPositionX() > pPlayer->GetPositionX() && !Reached) + if (ContinueWP) { - DoScriptText(SAY_RIZZLE_FINAL, me); - me->SetUInt32Value(UNIT_NPC_FLAGS, 1); - me->setFaction(35); - me->GetMotionMaster()->MoveIdle(); - me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE); - Reached = true; + me->GetMotionMaster()->MovePoint(CurrWP, WPs[CurrWP][0], WPs[CurrWP][1], WPs[CurrWP][2]); + ContinueWP = false; } - Check_Timer = 1000; - } else Check_Timer -= diff; + if (Grenade_Timer <= diff) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer) + { + DoScriptText(SAY_RIZZLE_GRENADE, me, pPlayer); + DoCast(pPlayer, SPELL_RIZZLE_FROST_GRENADE, true); + } + Grenade_Timer = 30000; + } else Grenade_Timer -= diff; - } + if (Check_Timer <= diff) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (!pPlayer) + { + me->ForcedDespawn(); + return; + } - void SendText(const char *text, Player* pPlayer) - { - WorldPacket data(SMSG_SERVER_MESSAGE, 0); // guess size - data << text; - if (pPlayer) - pPlayer->GetSession()->SendPacket(&data); - } + if (me->IsWithinDist(pPlayer, 10) && me->GetPositionX() > pPlayer->GetPositionX() && !Reached) + { + DoScriptText(SAY_RIZZLE_FINAL, me); + me->SetUInt32Value(UNIT_NPC_FLAGS, 1); + me->setFaction(35); + me->GetMotionMaster()->MoveIdle(); + me->RemoveAurasDueToSpell(SPELL_PERIODIC_DEPTH_CHARGE); + Reached = true; + } - void AttackStart(Unit *who) - { - if (!who || PlayerGUID) - return; + Check_Timer = 1000; + } else Check_Timer -= diff; + + } - if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + void SendText(const char *text, Player* pPlayer) { - PlayerGUID = who->GetGUID(); - DoScriptText(SAY_RIZZLE_START, me); - DoCast(who, SPELL_RIZZLE_BLACKJACK, false); - return; + WorldPacket data(SMSG_SERVER_MESSAGE, 0); // guess size + data << text; + if (pPlayer) + pPlayer->GetSession()->SendPacket(&data); } - } - void EnterCombat(Unit* /*who*/) {} + void AttackStart(Unit *who) + { + if (!who || PlayerGUID) + return; - void MovementInform(uint32 type, uint32 id) - { - if (type != POINT_MOTION_TYPE) - return; + if (who->GetTypeId() == TYPEID_PLAYER && CAST_PLR(who)->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) + { + PlayerGUID = who->GetGUID(); + DoScriptText(SAY_RIZZLE_START, me); + DoCast(who, SPELL_RIZZLE_BLACKJACK, false); + return; + } + } + + void EnterCombat(Unit* /*who*/) {} - if (id == 57) + void MovementInform(uint32 type, uint32 id) { - me->ForcedDespawn(); - return; + if (type != POINT_MOTION_TYPE) + return; + + if (id == 57) + { + me->ForcedDespawn(); + return; + } + + ++CurrWP; + ContinueWP = true; } - ++CurrWP; - ContinueWP = true; - } + }; }; -bool GossipHello_mob_rizzle_sprysprocket(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(10994) != QUEST_STATUS_INCOMPLETE) - return true; - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_GET_MOONSTONE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(10811, pCreature->GetGUID()); - return true; -} -bool GossipSelect_mob_rizzle_sprysprocket(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1 && pPlayer->GetQuestStatus(10994) == QUEST_STATUS_INCOMPLETE) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, SPELL_GIVE_SOUTHFURY_MOONSTONE, true); - CAST_AI(mob_rizzle_sprysprocketAI, pCreature->AI())->Must_Die_Timer = 3000; - CAST_AI(mob_rizzle_sprysprocketAI, pCreature->AI())->Must_Die = true; - } - return true; -} -CreatureAI* GetAI_mob_rizzle_sprysprocket(Creature* pCreature) -{ - return new mob_rizzle_sprysprocketAI (pCreature); -} /*#### # mob_depth_charge ####*/ - -struct mob_depth_chargeAI : public ScriptedAI +
class mob_depth_charge : public CreatureScript { - mob_depth_chargeAI(Creature *c) : ScriptedAI(c) {} - - bool we_must_die; - uint32 must_die_timer; +public: + mob_depth_charge() : CreatureScript("mob_depth_charge") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - we_must_die = false; - must_die_timer = 1000; + return new mob_depth_chargeAI (pCreature); } - void UpdateAI(const uint32 diff) + struct mob_depth_chargeAI : public ScriptedAI { - if (we_must_die) - if (must_die_timer <= diff) - { - me->ForcedDespawn(); - } else must_die_timer -= diff; - return; - } + mob_depth_chargeAI(Creature *c) : ScriptedAI(c) {} - void MoveInLineOfSight(Unit *who) - { - if (!who) - return; + bool we_must_die; + uint32 must_die_timer; - if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5)) + void Reset() { - DoCast(who, SPELL_DEPTH_CHARGE_TRAP); - we_must_die = true; + me->SetUnitMovementFlags(MOVEMENTFLAG_HOVER | MOVEMENTFLAG_SWIMMING); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + we_must_die = false; + must_die_timer = 1000; + } + + void UpdateAI(const uint32 diff) + { + if (we_must_die) + if (must_die_timer <= diff) + { + me->ForcedDespawn(); + } else must_die_timer -= diff; return; } - } - void AttackStart(Unit * /*who*/) - { - } + void MoveInLineOfSight(Unit *who) + { + if (!who) + return; + + if (who->GetTypeId() == TYPEID_PLAYER && me->IsWithinDistInMap(who, 5)) + { + DoCast(who, SPELL_DEPTH_CHARGE_TRAP); + we_must_die = true; + return; + } + } + + void AttackStart(Unit * /*who*/) + { + } + + void EnterCombat(Unit* /*who*/) + { + } + }; - void EnterCombat(Unit* /*who*/) - { - } }; -CreatureAI* GetAI_mob_depth_charge(Creature* pCreature) -{ - return new mob_depth_chargeAI (pCreature); -} void AddSC_azshara() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mobs_spitelashes"; - newscript->GetAI = &GetAI_mobs_spitelashes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_loramus_thalipedes"; - newscript->pGossipHello = &GossipHello_npc_loramus_thalipedes; - newscript->pGossipSelect = &GossipSelect_npc_loramus_thalipedes; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_rizzle_sprysprocket"; - newscript->GetAI = &GetAI_mob_rizzle_sprysprocket; - newscript->pGossipHello = &GossipHello_mob_rizzle_sprysprocket; - newscript->pGossipSelect = &GossipSelect_mob_rizzle_sprysprocket; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_depth_charge"; - newscript->GetAI = &GetAI_mob_depth_charge; - newscript->RegisterSelf(); + new mobs_spitelashes(); + new npc_loramus_thalipedes(); + new mob_rizzle_sprysprocket(); + new mob_depth_charge(); } - diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index 6b0ee66e9ea..dd6b27dc7d2 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -29,8 +29,7 @@ npc_engineer_spark_overgrind npc_injured_draenei npc_magwin npc_geezle -mob_nestlewood_owlkin -go_ravager_cage +mob_nestlewood_owlkin
go_ravager_cage npc_death_ravager EndContentData */ @@ -57,112 +56,119 @@ enum eEnums SPELL_IRRIDATION = 35046, SPELL_STUNNED = 28630 }; - -struct npc_draenei_survivorAI : public ScriptedAI +
class npc_draenei_survivor : public CreatureScript { - npc_draenei_survivorAI(Creature *c) : ScriptedAI(c) {} +public: + npc_draenei_survivor() : CreatureScript("npc_draenei_survivor") { } - uint64 pCaster; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_draenei_survivorAI (pCreature); + } - uint32 SayThanksTimer; - uint32 RunAwayTimer; - uint32 SayHelpTimer; + struct npc_draenei_survivorAI : public ScriptedAI + { + npc_draenei_survivorAI(Creature *c) : ScriptedAI(c) {} - bool CanSayHelp; + uint64 pCaster; - void Reset() - { - pCaster = 0; + uint32 SayThanksTimer; + uint32 RunAwayTimer; + uint32 SayHelpTimer; - SayThanksTimer = 0; - RunAwayTimer = 0; - SayHelpTimer = 10000; + bool CanSayHelp; - CanSayHelp = true; + void Reset() + { + pCaster = 0; - DoCast(me, SPELL_IRRIDATION, true); + SayThanksTimer = 0; + RunAwayTimer = 0; + SayHelpTimer = 10000; - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - me->SetHealth(int(me->GetMaxHealth()*.1)); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - } + CanSayHelp = true; - void EnterCombat(Unit * /*who*/) {} + DoCast(me, SPELL_IRRIDATION, true); - void MoveInLineOfSight(Unit *who) - { - if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f)) + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->SetHealth(int(me->GetMaxHealth()*.1)); + me->SetStandState(UNIT_STAND_STATE_SLEEP); + } + + void EnterCombat(Unit * /*who*/) {} + + void MoveInLineOfSight(Unit *who) { - //Random switch between 4 texts - DoScriptText(RAND(SAY_HELP1, SAY_HELP2, SAY_HELP3, SAY_HELP4), me, who); + if (CanSayHelp && who->GetTypeId() == TYPEID_PLAYER && me->IsFriendlyTo(who) && me->IsWithinDistInMap(who, 25.0f)) + { + //Random switch between 4 texts + DoScriptText(RAND(SAY_HELP1, SAY_HELP2, SAY_HELP3, SAY_HELP4), me, who); - SayHelpTimer = 20000; - CanSayHelp = false; + SayHelpTimer = 20000; + CanSayHelp = false; + } } - } - void SpellHit(Unit *Caster, const SpellEntry *Spell) - { - if (Spell->SpellFamilyFlags[2] & 0x080000000) + void SpellHit(Unit *Caster, const SpellEntry *Spell) { - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - me->SetStandState(UNIT_STAND_STATE_STAND); + if (Spell->SpellFamilyFlags[2] & 0x080000000) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); + me->SetStandState(UNIT_STAND_STATE_STAND); - DoCast(me, SPELL_STUNNED, true); + DoCast(me, SPELL_STUNNED, true); - pCaster = Caster->GetGUID(); + pCaster = Caster->GetGUID(); - SayThanksTimer = 5000; + SayThanksTimer = 5000; + } } - } - void UpdateAI(const uint32 diff) - { - if (SayThanksTimer) + void UpdateAI(const uint32 diff) { - if (SayThanksTimer <= diff) + if (SayThanksTimer) { - me->RemoveAurasDueToSpell(SPELL_IRRIDATION); - - if (Player* pPlayer = Unit::GetPlayer(*me, pCaster)) + if (SayThanksTimer <= diff) { - DoScriptText(RAND(SAY_HEAL1, SAY_HEAL2, SAY_HEAL3, SAY_HEAL4), me, pPlayer); + me->RemoveAurasDueToSpell(SPELL_IRRIDATION); - pPlayer->TalkedToCreature(me->GetEntry(),me->GetGUID()); - } + if (Player* pPlayer = Unit::GetPlayer(*me, pCaster)) + { + DoScriptText(RAND(SAY_HEAL1, SAY_HEAL2, SAY_HEAL3, SAY_HEAL4), me, pPlayer); - me->GetMotionMaster()->Clear(); - me->GetMotionMaster()->MovePoint(0, -4115.053711f, -13754.831055f, 73.508949f); + pPlayer->TalkedToCreature(me->GetEntry(),me->GetGUID()); + } - RunAwayTimer = 10000; - SayThanksTimer = 0; - } else SayThanksTimer -= diff; + me->GetMotionMaster()->Clear(); + me->GetMotionMaster()->MovePoint(0, -4115.053711f, -13754.831055f, 73.508949f); - return; - } + RunAwayTimer = 10000; + SayThanksTimer = 0; + } else SayThanksTimer -= diff; - if (RunAwayTimer) - { - if (RunAwayTimer <= diff) - me->ForcedDespawn(); - else - RunAwayTimer -= diff; + return; + } + + if (RunAwayTimer) + { + if (RunAwayTimer <= diff) + me->ForcedDespawn(); + else + RunAwayTimer -= diff; + + return; + } - return; + if (SayHelpTimer <= diff) + { + CanSayHelp = true; + SayHelpTimer = 20000; + } else SayHelpTimer -= diff; } + }; - if (SayHelpTimer <= diff) - { - CanSayHelp = true; - SayHelpTimer = 20000; - } else SayHelpTimer -= diff; - } }; -CreatureAI* GetAI_npc_draenei_survivor(Creature* pCreature) -{ - return new npc_draenei_survivorAI (pCreature); -} /*###### ## npc_engineer_spark_overgrind @@ -182,128 +188,144 @@ enum eOvergrind }; #define GOSSIP_FIGHT "Traitor! You will be brought to justice!" - -struct npc_engineer_spark_overgrindAI : public ScriptedAI +
class npc_engineer_spark_overgrind : public CreatureScript { - npc_engineer_spark_overgrindAI(Creature *c) : ScriptedAI(c) - { - NormFaction = c->getFaction(); - NpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); +public: + npc_engineer_spark_overgrind() : CreatureScript("npc_engineer_spark_overgrind") { } - if (c->GetAreaId() == AREA_COVE || c->GetAreaId() == AREA_ISLE) - IsTreeEvent = true; + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->setFaction(FACTION_HOSTILE); + CAST_AI(npc_engineer_spark_overgrind::npc_engineer_spark_overgrindAI, pCreature->AI())->AttackStart(pPlayer); + } + return true; } - uint32 NormFaction; - uint32 NpcFlags; - - uint32 Dynamite_Timer; - uint32 Emote_Timer; - - bool IsTreeEvent; - - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - Dynamite_Timer = 8000; - Emote_Timer = 120000 + rand()%30000; + if (pPlayer->GetQuestStatus(QUEST_GNOMERCY) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - me->setFaction(NormFaction); - me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); - - IsTreeEvent = false; + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - void EnterCombat(Unit* who) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(ATTACK_YELL, me, who); + return new npc_engineer_spark_overgrindAI (pCreature); } - void UpdateAI(const uint32 diff) + struct npc_engineer_spark_overgrindAI : public ScriptedAI { - if (!me->isInCombat() && !IsTreeEvent) + npc_engineer_spark_overgrindAI(Creature *c) : ScriptedAI(c) { - if (Emote_Timer <= diff) - { - DoScriptText(SAY_TEXT, me); - DoScriptText(SAY_EMOTE, me); - Emote_Timer = 120000 + rand()%30000; - } else Emote_Timer -= diff; + NormFaction = c->getFaction(); + NpcFlags = c->GetUInt32Value(UNIT_NPC_FLAGS); + + if (c->GetAreaId() == AREA_COVE || c->GetAreaId() == AREA_ISLE) + IsTreeEvent = true; } - else if (IsTreeEvent) - return; - if (!UpdateVictim()) - return; + uint32 NormFaction; + uint32 NpcFlags; + + uint32 Dynamite_Timer; + uint32 Emote_Timer; + + bool IsTreeEvent; - if (Dynamite_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_DYNAMITE); Dynamite_Timer = 8000; - } else Dynamite_Timer -= diff; + Emote_Timer = 120000 + rand()%30000; - DoMeleeAttackIfReady(); - } -}; + me->setFaction(NormFaction); + me->SetUInt32Value(UNIT_NPC_FLAGS, NpcFlags); -CreatureAI* GetAI_npc_engineer_spark_overgrind(Creature* pCreature) -{ - return new npc_engineer_spark_overgrindAI (pCreature); -} + IsTreeEvent = false; + } + + void EnterCombat(Unit* who) + { + DoScriptText(ATTACK_YELL, me, who); + } + + void UpdateAI(const uint32 diff) + { + if (!me->isInCombat() && !IsTreeEvent) + { + if (Emote_Timer <= diff) + { + DoScriptText(SAY_TEXT, me); + DoScriptText(SAY_EMOTE, me); + Emote_Timer = 120000 + rand()%30000; + } else Emote_Timer -= diff; + } + else if (IsTreeEvent) + return; + + if (!UpdateVictim()) + return; + + if (Dynamite_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DYNAMITE); + Dynamite_Timer = 8000; + } else Dynamite_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; + +}; -bool GossipHello_npc_engineer_spark_overgrind(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_GNOMERCY) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_FIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_engineer_spark_overgrind(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->setFaction(FACTION_HOSTILE); - CAST_AI(npc_engineer_spark_overgrindAI, pCreature->AI())->AttackStart(pPlayer); - } - return true; -} /*###### ## npc_injured_draenei ######*/ - -struct npc_injured_draeneiAI : public ScriptedAI +
class npc_injured_draenei : public CreatureScript { - npc_injured_draeneiAI(Creature *c) : ScriptedAI(c) {} +public: + npc_injured_draenei() : CreatureScript("npc_injured_draenei") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - me->SetHealth(int(me->GetMaxHealth()*.15)); - switch (rand()%2) + return new npc_injured_draeneiAI (pCreature); + } + + struct npc_injured_draeneiAI : public ScriptedAI + { + npc_injured_draeneiAI(Creature *c) : ScriptedAI(c) {} + + void Reset() { - case 0: me->SetStandState(UNIT_STAND_STATE_SIT); break; - case 1: me->SetStandState(UNIT_STAND_STATE_SLEEP); break; + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + me->SetHealth(int(me->GetMaxHealth()*.15)); + switch (rand()%2) + { + case 0: me->SetStandState(UNIT_STAND_STATE_SIT); break; + case 1: me->SetStandState(UNIT_STAND_STATE_SLEEP); break; + } } - } - void EnterCombat(Unit * /*who*/) {} + void EnterCombat(Unit * /*who*/) {} - void MoveInLineOfSight(Unit * /*who*/) - { - } + void MoveInLineOfSight(Unit * /*who*/) + { + } - void UpdateAI(const uint32 /*diff*/) - { - } + void UpdateAI(const uint32 /*diff*/) + { + } + + }; }; -CreatureAI* GetAI_npc_injured_draenei(Creature* pCreature) -{ - return new npc_injured_draeneiAI (pCreature); -} /*###### ## npc_magwin @@ -320,60 +342,67 @@ enum eMagwin QUEST_A_CRY_FOR_SAY_HELP = 9528 }; - -struct npc_magwinAI : public npc_escortAI +
class npc_magwin : public CreatureScript { - npc_magwinAI(Creature *c) : npc_escortAI(c) {} +public: + npc_magwin() : CreatureScript("npc_magwin") { } - 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_A_CRY_FOR_SAY_HELP) { - case 0: - DoScriptText(SAY_START, me, pPlayer); - break; - case 17: - DoScriptText(SAY_PROGRESS, me, pPlayer); - break; - case 28: - DoScriptText(SAY_END1, me, pPlayer); - break; - case 29: - DoScriptText(EMOTE_HUG, me, pPlayer); - DoScriptText(SAY_END2, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP,me); - break; + pCreature->setFaction(113); + if (npc_escortAI* pEscortAI = CAST_AI(npc_escortAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); } + return true; } - void EnterCombat(Unit* who) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(SAY_AGGRO, me, who); + return new npc_magwinAI(pCreature); } - void Reset() { } -}; - -bool QuestAccept_npc_magwin(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_A_CRY_FOR_SAY_HELP) + struct npc_magwinAI : public npc_escortAI { - pCreature->setFaction(113); - if (npc_escortAI* pEscortAI = CAST_AI(npc_escortAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - } - return true; -} + npc_magwinAI(Creature *c) : npc_escortAI(c) {} + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 0: + DoScriptText(SAY_START, me, pPlayer); + break; + case 17: + DoScriptText(SAY_PROGRESS, me, pPlayer); + break; + case 28: + DoScriptText(SAY_END1, me, pPlayer); + break; + case 29: + DoScriptText(EMOTE_HUG, me, pPlayer); + DoScriptText(SAY_END2, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_A_CRY_FOR_SAY_HELP,me); + break; + } + } + + void EnterCombat(Unit* who) + { + DoScriptText(SAY_AGGRO, me, who); + } + + void Reset() { } + }; + +}; -CreatureAI* GetAI_npc_magwinAI(Creature* pCreature) -{ - return new npc_magwinAI(pCreature); -} /*###### ## npc_geezle @@ -400,139 +429,145 @@ enum eGeezle }; static float SparkPos[3] = {-5029.91, -11291.79, 8.096}; - -struct npc_geezleAI : public ScriptedAI +
class npc_geezle : public CreatureScript { - npc_geezleAI(Creature *c) : ScriptedAI(c) {} +public: + npc_geezle() : CreatureScript("npc_geezle") { } - uint64 SparkGUID; + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_geezleAI(pCreature); + } - uint32 Step; - uint32 SayTimer; + struct npc_geezleAI : public ScriptedAI + { + npc_geezleAI(Creature *c) : ScriptedAI(c) {} - bool EventStarted; + uint64 SparkGUID; - void Reset() - { - SparkGUID = 0; - Step = 0; - StartEvent(); - } + uint32 Step; + uint32 SayTimer; - void EnterCombat(Unit* /*who*/){} + bool EventStarted; - void StartEvent() - { - Step = 0; - EventStarted = true; - Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); - if (Spark) + void Reset() { - SparkGUID = Spark->GetGUID(); - Spark->setActive(true); - Spark->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + SparkGUID = 0; + Step = 0; + StartEvent(); } - SayTimer = 8000; - } - uint32 NextStep(uint32 Step) - { - Creature* Spark = Unit::GetCreature(*me, SparkGUID); + void EnterCombat(Unit* /*who*/){} - switch(Step) + void StartEvent() { - case 0: - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, -5080.70, -11253.61, 0.56); - me->GetMotionMaster()->MovePoint(0, -5092.26, -11252, 0.71); - return 9000; // NPCs are walking up to fire - case 1: - DespawnNagaFlag(true); - DoScriptText(EMOTE_SPARK, Spark); - return 1000; - case 2: - DoScriptText(GEEZLE_SAY_1, me, Spark); + Step = 0; + EventStarted = true; + Creature* Spark = me->SummonCreature(MOB_SPARK, SparkPos[0], SparkPos[1], SparkPos[2], 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1000); if (Spark) { - Spark->SetInFront(me); - me->SetInFront(Spark); + SparkGUID = Spark->GetGUID(); + Spark->setActive(true); + Spark->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } - return 5000; - case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; - case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; - case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; - case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; - case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; - case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; - case 9: - me->GetMotionMaster()->MoveTargetedHome(); - if (Spark) - Spark->GetMotionMaster()->MovePoint(0, SparkPos[0], SparkPos[1], SparkPos[2]); - CompleteQuest(); - return 9000; - case 10: - if (Spark) - Spark->DisappearAndDie(); - DespawnNagaFlag(false); - me->DisappearAndDie(); - default: return 99999999; + SayTimer = 8000; } - } - - // will complete Tree's company quest for all nearby players that are disguised as trees - void CompleteQuest() - { - float radius = 50.0f; - std::list<Player*> players; - Trinity::AnyPlayerInObjectRangeCheck checker(me, radius); - Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(me, players, checker); - me->VisitNearbyWorldObject(radius, searcher); - for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr) + uint32 NextStep(uint32 Step) { - if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE - &&(*itr)->HasAura(SPELL_TREE_DISGUISE)) + Creature* Spark = Unit::GetCreature(*me, SparkGUID); + + switch(Step) { - (*itr)->KilledMonsterCredit(MOB_SPARK,0); + case 0: + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, -5080.70, -11253.61, 0.56); + me->GetMotionMaster()->MovePoint(0, -5092.26, -11252, 0.71); + return 9000; // NPCs are walking up to fire + case 1: + DespawnNagaFlag(true); + DoScriptText(EMOTE_SPARK, Spark); + return 1000; + case 2: + DoScriptText(GEEZLE_SAY_1, me, Spark); + if (Spark) + { + Spark->SetInFront(me); + me->SetInFront(Spark); + } + return 5000; + case 3: DoScriptText(SPARK_SAY_2, Spark); return 7000; + case 4: DoScriptText(SPARK_SAY_3, Spark); return 8000; + case 5: DoScriptText(GEEZLE_SAY_4, me, Spark); return 8000; + case 6: DoScriptText(SPARK_SAY_5, Spark); return 9000; + case 7: DoScriptText(SPARK_SAY_6, Spark); return 8000; + case 8: DoScriptText(GEEZLE_SAY_7, me, Spark); return 2000; + case 9: + me->GetMotionMaster()->MoveTargetedHome(); + if (Spark) + Spark->GetMotionMaster()->MovePoint(0, SparkPos[0], SparkPos[1], SparkPos[2]); + CompleteQuest(); + return 9000; + case 10: + if (Spark) + Spark->DisappearAndDie(); + DespawnNagaFlag(false); + me->DisappearAndDie(); + default: return 99999999; } } - } - - void DespawnNagaFlag(bool despawn) - { - std::list<GameObject*> FlagList; - me->GetGameObjectListWithEntryInGrid(FlagList,GO_NAGA_FLAG, 100.0f); - if (!FlagList.empty()) + // will complete Tree's company quest for all nearby players that are disguised as trees + void CompleteQuest() { - for (std::list<GameObject*>::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) + float radius = 50.0f; + std::list<Player*> players; + Trinity::AnyPlayerInObjectRangeCheck checker(me, radius); + Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(me, players, checker); + me->VisitNearbyWorldObject(radius, searcher); + + for (std::list<Player*>::const_iterator itr = players.begin(); itr != players.end(); ++itr) { - if (despawn) + if ((*itr)->GetQuestStatus(QUEST_TREES_COMPANY) == QUEST_STATUS_INCOMPLETE + &&(*itr)->HasAura(SPELL_TREE_DISGUISE)) { - (*itr)->SetLootState(GO_JUST_DEACTIVATED); + (*itr)->KilledMonsterCredit(MOB_SPARK,0); } - else - (*itr)->Respawn(); } - } else sLog.outError("SD2 ERROR: FlagList is empty!"); - } + } - void UpdateAI(const uint32 diff) - { - if (SayTimer <= diff) + void DespawnNagaFlag(bool despawn) { - if (EventStarted) + std::list<GameObject*> FlagList; + me->GetGameObjectListWithEntryInGrid(FlagList,GO_NAGA_FLAG, 100.0f); + + if (!FlagList.empty()) { - SayTimer = NextStep(Step++); - } - } else SayTimer -= diff; - } -}; + for (std::list<GameObject*>::const_iterator itr = FlagList.begin(); itr != FlagList.end(); ++itr) + { + if (despawn) + { + (*itr)->SetLootState(GO_JUST_DEACTIVATED); + } + else + (*itr)->Respawn(); + } + } else sLog.outError("SD2 ERROR: FlagList is empty!"); + } -CreatureAI* GetAI_npc_geezleAI(Creature* pCreature) -{ - return new npc_geezleAI(pCreature); -} + void UpdateAI(const uint32 diff) + { + if (SayTimer <= diff) + { + if (EventStarted) + { + SayTimer = NextStep(Step++); + } + } else SayTimer -= diff; + } + }; + +}; /*###### ## mob_nestlewood_owlkin @@ -544,61 +579,68 @@ enum eOwlkin ENTRY_OWLKIN = 16518, ENTRY_OWLKIN_INOC = 16534 }; - -struct npc_nestlewood_owlkinAI : public ScriptedAI +
class npc_nestlewood_owlkin : public CreatureScript { - npc_nestlewood_owlkinAI(Creature *c) : ScriptedAI(c) {} - - uint32 DespawnTimer; +public: + npc_nestlewood_owlkin() : CreatureScript("npc_nestlewood_owlkin") { } - void Reset() + struct npc_nestlewood_owlkinAI : public ScriptedAI { - DespawnTimer = 0; - } + npc_nestlewood_owlkinAI(Creature *c) : ScriptedAI(c) {} - void UpdateAI(const uint32 diff) - { - //timer gets adjusted by the triggered aura effect - if (DespawnTimer) + uint32 DespawnTimer; + + void Reset() { - if (DespawnTimer <= diff) + DespawnTimer = 0; + } + + void UpdateAI(const uint32 diff) + { + //timer gets adjusted by the triggered aura effect + if (DespawnTimer) { - //once we are able to, despawn us - me->ForcedDespawn(); + if (DespawnTimer <= diff) + { + //once we are able to, despawn us + me->ForcedDespawn(); + return; + } else DespawnTimer -= diff; + } + + if (!UpdateVictim()) return; - } else DespawnTimer -= diff; + + DoMeleeAttackIfReady(); } + }; - if (!UpdateVictim()) - return; + bool EffectDummyCreature(Unit * /*pCaster*/, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) + { + //always check spellid and effectindex + if (spellId == SPELL_INOCULATE_OWLKIN && effIndex == 0) + { + if (pCreatureTarget->GetEntry() != ENTRY_OWLKIN) + return true; - DoMeleeAttackIfReady(); - } -}; + pCreatureTarget->UpdateEntry(ENTRY_OWLKIN_INOC); -CreatureAI* GetAI_npc_nestlewood_owlkinAI(Creature* pCreature) -{ - return new npc_nestlewood_owlkinAI (pCreature); -} + //set despawn timer, since we want to remove Creature after a short time + CAST_AI(npc_nestlewood_owlkin::npc_nestlewood_owlkinAI, pCreatureTarget->AI())->DespawnTimer = 15000; -bool EffectDummyCreature_npc_nestlewood_owlkin(Unit * /*pCaster*/, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) -{ - //always check spellid and effectindex - if (spellId == SPELL_INOCULATE_OWLKIN && effIndex == 0) - { - if (pCreatureTarget->GetEntry() != ENTRY_OWLKIN) + //always return true when we are handling this spell and effect return true; + } + return false; + } - pCreatureTarget->UpdateEntry(ENTRY_OWLKIN_INOC); + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_nestlewood_owlkinAI (pCreature); + } - //set despawn timer, since we want to remove Creature after a short time - CAST_AI(npc_nestlewood_owlkinAI, pCreatureTarget->AI())->DespawnTimer = 15000; +}; - //always return true when we are handling this spell and effect - return true; - } - return false; -} enum eRavegerCage { @@ -610,65 +652,76 @@ enum eRavegerCage QUEST_STRENGTH_ONE = 9582 }; -bool go_ravager_cage(Player* pPlayer, GameObject* pGo) +class go_ravager_cage : public GameObjectScript { +public: + go_ravager_cage() : GameObjectScript("go_ravager_cage") { } - if (pPlayer->GetQuestStatus(QUEST_STRENGTH_ONE) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - if (Creature* ravager = pGo->FindNearestCreature(NPC_DEATH_RAVAGER, 5.0f, true)) + if (pPlayer->GetQuestStatus(QUEST_STRENGTH_ONE) == QUEST_STATUS_INCOMPLETE) { - ravager->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - ravager->SetReactState(REACT_AGGRESSIVE); - ravager->AI()->AttackStart(pPlayer); + if (Creature* ravager = pGo->FindNearestCreature(NPC_DEATH_RAVAGER, 5.0f, true)) + { + ravager->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + ravager->SetReactState(REACT_AGGRESSIVE); + ravager->AI()->AttackStart(pPlayer); + } } + return true ; } - return true ; -} - -struct npc_death_ravagerAI : public ScriptedAI +}; +
class npc_death_ravager : public CreatureScript { - npc_death_ravagerAI(Creature *c) : ScriptedAI(c){} - - uint32 RendTimer; - uint32 EnragingBiteTimer; +public: + npc_death_ravager() : CreatureScript("npc_death_ravager") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - RendTimer = 30000; - EnragingBiteTimer = 20000; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); + return new npc_death_ravagerAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_death_ravagerAI : public ScriptedAI { - if (!UpdateVictim()) - return; + npc_death_ravagerAI(Creature *c) : ScriptedAI(c){} + + uint32 RendTimer; + uint32 EnragingBiteTimer; - if (RendTimer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_REND); RendTimer = 30000; + EnragingBiteTimer = 20000; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); } - else RendTimer -= diff; - if (EnragingBiteTimer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_ENRAGING_BITE); - EnragingBiteTimer = 15000; + if (!UpdateVictim()) + return; + + if (RendTimer <= diff) + { + DoCast(me->getVictim(), SPELL_REND); + RendTimer = 30000; + } + else RendTimer -= diff; + + if (EnragingBiteTimer <= diff) + { + DoCast(me->getVictim(), SPELL_ENRAGING_BITE); + EnragingBiteTimer = 15000; + } + else EnragingBiteTimer -= diff; + + DoMeleeAttackIfReady(); } - else EnragingBiteTimer -= diff; + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_death_ravagerAI(Creature* pCreature) -{ - return new npc_death_ravagerAI(pCreature); -} - /*######## ## Quest: The Prophecy of Akida ########*/ @@ -681,111 +734,76 @@ enum BristlelimbCage CAPITIVE_SAY_2 = -1000475, CAPITIVE_SAY_3 = -1000476 }; - - -struct npc_stillpine_capitiveAI : public ScriptedAI +
class npc_stillpine_capitive : public CreatureScript { - npc_stillpine_capitiveAI(Creature *c) : ScriptedAI(c){} +public: + npc_stillpine_capitive() : CreatureScript("npc_stillpine_capitive") { } - uint32 FleeTimer; - - void Reset() + struct npc_stillpine_capitiveAI : public ScriptedAI { - FleeTimer = 0; - GameObject* cage = me->FindNearestGameObject(GO_BRISTELIMB_CAGE, 5.0f); - if(cage) - cage->ResetDoorOrButton(); - } + npc_stillpine_capitiveAI(Creature *c) : ScriptedAI(c){} - void UpdateAI(const uint32 diff) - { - if(FleeTimer) + uint32 FleeTimer; + + void Reset() + { + FleeTimer = 0; + GameObject* cage = me->FindNearestGameObject(GO_BRISTELIMB_CAGE, 5.0f); + if(cage) + cage->ResetDoorOrButton(); + } + + void UpdateAI(const uint32 diff) { - if(FleeTimer <= diff) - me->ForcedDespawn(); - else FleeTimer -= diff; + if(FleeTimer) + { + if(FleeTimer <= diff) + me->ForcedDespawn(); + else FleeTimer -= diff; + } } + }; + + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_stillpine_capitiveAI(pCreature); } -}; -CreatureAI* GetAI_npc_stillpine_capitiveAI(Creature* pCreature) +}; +
class go_bristlelimb_cage : public GameObjectScript { - return new npc_stillpine_capitiveAI(pCreature); -} +public: + go_bristlelimb_cage() : GameObjectScript("go_bristlelimb_cage") { } -bool go_bristlelimb_cage(Player* pPlayer, GameObject* pGo) -{ - if(pPlayer->GetQuestStatus(QUEST_THE_PROPHECY_OF_AKIDA) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - Creature* pCreature = pGo->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true); - if(pCreature) + if(pPlayer->GetQuestStatus(QUEST_THE_PROPHECY_OF_AKIDA) == QUEST_STATUS_INCOMPLETE) { - DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), pCreature, pPlayer); - pCreature->GetMotionMaster()->MoveFleeing(pPlayer, 3500); - pPlayer->KilledMonsterCredit(pCreature->GetEntry(), pCreature->GetGUID()); - CAST_AI(npc_stillpine_capitiveAI, pCreature->AI())->FleeTimer = 3500; - return false; + Creature* pCreature = pGo->FindNearestCreature(NPC_STILLPINE_CAPITIVE, 5.0f, true); + if(pCreature) + { + DoScriptText(RAND(CAPITIVE_SAY_1, CAPITIVE_SAY_2, CAPITIVE_SAY_3), pCreature, pPlayer); + pCreature->GetMotionMaster()->MoveFleeing(pPlayer, 3500); + pPlayer->KilledMonsterCredit(pCreature->GetEntry(), pCreature->GetGUID()); + CAST_AI(npc_stillpine_capitive::npc_stillpine_capitiveAI, pCreature->AI())->FleeTimer = 3500; + return false; + } } + return true; } - return true; -} + +}; void AddSC_azuremyst_isle() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_draenei_survivor"; - newscript->GetAI = &GetAI_npc_draenei_survivor; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_engineer_spark_overgrind"; - newscript->GetAI = &GetAI_npc_engineer_spark_overgrind; - newscript->pGossipHello = &GossipHello_npc_engineer_spark_overgrind; - newscript->pGossipSelect = &GossipSelect_npc_engineer_spark_overgrind; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_injured_draenei"; - newscript->GetAI = &GetAI_npc_injured_draenei; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_magwin"; - newscript->GetAI = &GetAI_npc_magwinAI; - newscript->pQuestAccept = &QuestAccept_npc_magwin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_geezle"; - newscript->GetAI = &GetAI_npc_geezleAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_nestlewood_owlkin"; - newscript->GetAI = &GetAI_npc_nestlewood_owlkinAI; - newscript->pEffectDummyCreature = &EffectDummyCreature_npc_nestlewood_owlkin; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_death_ravager"; - newscript->GetAI = &GetAI_npc_death_ravagerAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_ravager_cage"; - newscript->pGOHello = &go_ravager_cage; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_stillpine_capitive"; - newscript->GetAI = &GetAI_npc_stillpine_capitiveAI; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_bristlelimb_cage"; - newscript->pGOHello = &go_bristlelimb_cage; - newscript->RegisterSelf(); + new npc_draenei_survivor(); + new npc_engineer_spark_overgrind(); + new npc_injured_draenei(); + new npc_magwin(); + new npc_geezle(); + new npc_nestlewood_owlkin(); + new npc_death_ravager(); + new go_ravager_cage(); + new npc_stillpine_capitive(); + new go_bristlelimb_cage(); } - diff --git a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp index 9e8c7bbe563..5ac9dfa4a37 100644 --- a/src/server/scripts/Kalimdor/bloodmyst_isle.cpp +++ b/src/server/scripts/Kalimdor/bloodmyst_isle.cpp @@ -36,44 +36,51 @@ EndContentData */ //possible creatures to be spawned const uint32 possibleSpawns[32] = {17322, 17661, 17496, 17522, 17340, 17352, 17333, 17524, 17654, 17348, 17339, 17345, 17359, 17353, 17336, 17550, 17330, 17701, 17321, 17680, 17325, 17320, 17683, 17342, 17715, 17334, 17341, 17338, 17337, 17346, 17344, 17327}; - -struct mob_webbed_creatureAI : public ScriptedAI +
class mob_webbed_creature : public CreatureScript { - mob_webbed_creatureAI(Creature *c) : ScriptedAI(c) {} +public: + mob_webbed_creature() : CreatureScript("mob_webbed_creature") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { + return new mob_webbed_creatureAI (pCreature); } - void EnterCombat(Unit* /*who*/) + struct mob_webbed_creatureAI : public ScriptedAI { - } + mob_webbed_creatureAI(Creature *c) : ScriptedAI(c) {} - void JustDied(Unit* Killer) - { - uint32 spawnCreatureID = 0; + void Reset() + { + } - switch (urand(0,2)) + void EnterCombat(Unit* /*who*/) { - case 0: - spawnCreatureID = 17681; - if (Killer->GetTypeId() == TYPEID_PLAYER) - CAST_PLR(Killer)->KilledMonsterCredit(spawnCreatureID, me->GetGUID()); - break; - case 1: - case 2: - spawnCreatureID = possibleSpawns[urand(0,30)]; - break; } - if (spawnCreatureID) - me->SummonCreature(spawnCreatureID, 0.0f, 0.0f, 0.0f, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); - } + void JustDied(Unit* Killer) + { + uint32 spawnCreatureID = 0; + + switch (urand(0,2)) + { + case 0: + spawnCreatureID = 17681; + if (Killer->GetTypeId() == TYPEID_PLAYER) + CAST_PLR(Killer)->KilledMonsterCredit(spawnCreatureID, me->GetGUID()); + break; + case 1: + case 2: + spawnCreatureID = possibleSpawns[urand(0,30)]; + break; + } + + if (spawnCreatureID) + me->SummonCreature(spawnCreatureID, 0.0f, 0.0f, 0.0f, me->GetOrientation(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 60000); + } + }; + }; -CreatureAI* GetAI_mob_webbed_creature(Creature* pCreature) -{ - return new mob_webbed_creatureAI (pCreature); -} /*###### ## npc_captured_sunhawk_agent @@ -87,65 +94,61 @@ CreatureAI* GetAI_mob_webbed_creature(Creature* pCreature) #define GOSSIP_SELECT_CSA3 "[PH] " #define GOSSIP_SELECT_CSA4 "[PH] " #define GOSSIP_SELECT_CSA5 "[PH] " - -bool GossipHello_npc_captured_sunhawk_agent(Player* pPlayer, Creature* pCreature) +
class npc_captured_sunhawk_agent : public CreatureScript { - if (pPlayer->HasAura(31609) && pPlayer->GetQuestStatus(9756) == QUEST_STATUS_INCOMPLETE) +public: + npc_captured_sunhawk_agent() : CreatureScript("npc_captured_sunhawk_agent") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_CSA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(9136, pCreature->GetGUID()); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(9137, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(9138, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(9139, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(9140, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(9141, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->TalkedToCreature(C_SUNHAWK_TRIGGER, pCreature->GetGUID()); + break; + } + return true; } - else - pPlayer->SEND_GOSSIP_MENU(9134, pCreature->GetGUID()); - - return true; -} -bool GossipSelect_npc_captured_sunhawk_agent(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(9137, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(9138, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(9139, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(9140, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SELECT_CSA5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(9141, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->TalkedToCreature(C_SUNHAWK_TRIGGER, pCreature->GetGUID()); - break; + if (pPlayer->HasAura(31609) && pPlayer->GetQuestStatus(9756) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_CSA, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(9136, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(9134, pCreature->GetGUID()); + + return true; } - return true; -} + +}; + void AddSC_bloodmyst_isle() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_webbed_creature"; - newscript->GetAI = &GetAI_mob_webbed_creature; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_captured_sunhawk_agent"; - newscript->pGossipHello = &GossipHello_npc_captured_sunhawk_agent; - newscript->pGossipSelect = &GossipSelect_npc_captured_sunhawk_agent; - newscript->RegisterSelf(); + new mob_webbed_creature(); + new npc_captured_sunhawk_agent(); } - diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp index b8b40e3c510..c7a3412133b 100644 --- a/src/server/scripts/Kalimdor/boss_azuregos.cpp +++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp @@ -34,124 +34,126 @@ EndScriptData */ #define SPELL_REFLECT 22067 #define SPELL_CLEAVE 8255 //Perhaps not right ID #define SPELL_ENRAGE 23537 - -struct boss_azuregosAI : public ScriptedAI +
class boss_azuregos : public CreatureScript { - boss_azuregosAI(Creature *c) : ScriptedAI(c) {} - - uint32 MarkOfFrost_Timer; - uint32 ManaStorm_Timer; - uint32 Chill_Timer; - uint32 Breath_Timer; - uint32 Teleport_Timer; - uint32 Reflect_Timer; - uint32 Cleave_Timer; - uint32 Enrage_Timer; - bool Enraged; - - void Reset() +public: + boss_azuregos() : CreatureScript("boss_azuregos") { } + + CreatureAI* GetAI(Creature* pCreature) const { - MarkOfFrost_Timer = 35000; - ManaStorm_Timer = 5000 + rand()%12000; - Chill_Timer = 10000 + rand()%20000; - Breath_Timer = 2000 + rand()%6000; - Teleport_Timer = 30000; - Reflect_Timer = 15000 + rand()%15000; - Cleave_Timer = 7000; - Enrage_Timer = 0; - Enraged = false; + return new boss_azuregosAI (pCreature); } - void EnterCombat(Unit * /*who*/) {} - - void UpdateAI(const uint32 diff) + struct boss_azuregosAI : public ScriptedAI { - //Return since we have no target - if (!UpdateVictim()) - return; + boss_azuregosAI(Creature *c) : ScriptedAI(c) {} + + uint32 MarkOfFrost_Timer; + uint32 ManaStorm_Timer; + uint32 Chill_Timer; + uint32 Breath_Timer; + uint32 Teleport_Timer; + uint32 Reflect_Timer; + uint32 Cleave_Timer; + uint32 Enrage_Timer; + bool Enraged; + + void Reset() + { + MarkOfFrost_Timer = 35000; + ManaStorm_Timer = 5000 + rand()%12000; + Chill_Timer = 10000 + rand()%20000; + Breath_Timer = 2000 + rand()%6000; + Teleport_Timer = 30000; + Reflect_Timer = 15000 + rand()%15000; + Cleave_Timer = 7000; + Enrage_Timer = 0; + Enraged = false; + } + + void EnterCombat(Unit * /*who*/) {} - if (Teleport_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoScriptText(SAY_TELEPORT, me); - std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); - std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); - for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) + //Return since we have no target + if (!UpdateVictim()) + return; + + if (Teleport_Timer <= diff) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + DoScriptText(SAY_TELEPORT, me); + std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); + std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); + for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { - DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation()); + Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + { + DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation()); + } } - } - DoResetThreat(); - Teleport_Timer = 30000; - } else Teleport_Timer -= diff; + DoResetThreat(); + Teleport_Timer = 30000; + } else Teleport_Timer -= diff; - // //MarkOfFrost_Timer - // if (MarkOfFrost_Timer <= diff) - // { - // DoCast(me->getVictim(), SPELL_MARKOFFROST); - // MarkOfFrost_Timer = 25000; - // } else MarkOfFrost_Timer -= diff; + // //MarkOfFrost_Timer + // if (MarkOfFrost_Timer <= diff) + // { + // DoCast(me->getVictim(), SPELL_MARKOFFROST); + // MarkOfFrost_Timer = 25000; + // } else MarkOfFrost_Timer -= diff; - //Chill_Timer - if (Chill_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CHILL); - Chill_Timer = 13000 + rand()%12000; - } else Chill_Timer -= diff; + //Chill_Timer + if (Chill_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CHILL); + Chill_Timer = 13000 + rand()%12000; + } else Chill_Timer -= diff; - //Breath_Timer - if (Breath_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_FROSTBREATH); - Breath_Timer = 10000 + rand()%5000; - } else Breath_Timer -= diff; + //Breath_Timer + if (Breath_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROSTBREATH); + Breath_Timer = 10000 + rand()%5000; + } else Breath_Timer -= diff; - //ManaStorm_Timer - if (ManaStorm_Timer <= diff) - { - if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) - DoCast(pTarget, SPELL_MANASTORM); - ManaStorm_Timer = 7500 + rand()%5000; - } else ManaStorm_Timer -= diff; + //ManaStorm_Timer + if (ManaStorm_Timer <= diff) + { + if (Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0)) + DoCast(pTarget, SPELL_MANASTORM); + ManaStorm_Timer = 7500 + rand()%5000; + } else ManaStorm_Timer -= diff; - //Reflect_Timer - if (Reflect_Timer <= diff) - { - DoCast(me, SPELL_REFLECT); - Reflect_Timer = 20000 + rand()%15000; - } else Reflect_Timer -= diff; + //Reflect_Timer + if (Reflect_Timer <= diff) + { + DoCast(me, SPELL_REFLECT); + Reflect_Timer = 20000 + rand()%15000; + } else Reflect_Timer -= diff; - //Cleave_Timer - if (Cleave_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + //Cleave_Timer + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; - //Enrage_Timer - if (me->GetHealth()*100 / me->GetMaxHealth() < 26 && !Enraged) - { - DoCast(me, SPELL_ENRAGE); - Enraged = true; + //Enrage_Timer + if (me->GetHealth()*100 / me->GetMaxHealth() < 26 && !Enraged) + { + DoCast(me, SPELL_ENRAGE); + Enraged = true; + } + + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_boss_azuregos(Creature* pCreature) -{ - return new boss_azuregosAI (pCreature); -} void AddSC_boss_azuregos() { - Script *newscript; - newscript = new Script; - newscript->Name = "boss_azuregos"; - newscript->GetAI = &GetAI_boss_azuregos; - newscript->RegisterSelf(); + new boss_azuregos(); } - diff --git a/src/server/scripts/Kalimdor/darkshore.cpp b/src/server/scripts/Kalimdor/darkshore.cpp index 8cdb8990dbd..8ba4b2ed235 100644 --- a/src/server/scripts/Kalimdor/darkshore.cpp +++ b/src/server/scripts/Kalimdor/darkshore.cpp @@ -64,111 +64,119 @@ enum eKerlonian FACTION_KER_ESCORTEE = 113 }; -//TODO: make concept similar as "ringo" -escort. Find a way to run the scripted attacks, _if_ player are choosing road. -struct npc_kerlonianAI : public FollowerAI +//TODO: make concept similar as "ringo" -escort. Find a way to run the scripted attacks, _if_ player are choosing road.
class npc_kerlonian : public CreatureScript { - npc_kerlonianAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_kerlonian() : CreatureScript("npc_kerlonian") { } - uint32 m_uiFallAsleepTimer; + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) + { + if (pQuest->GetQuestId() == QUEST_SLEEPER_AWAKENED) + { + if (npc_kerlonianAI* pKerlonianAI = CAST_AI(npc_kerlonian::npc_kerlonianAI, pCreature->AI())) + { + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + DoScriptText(SAY_KER_START, pCreature, pPlayer); + pKerlonianAI->StartFollow(pPlayer, FACTION_KER_ESCORTEE, pQuest); + } + } + + return true; + } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiFallAsleepTimer = urand(10000, 45000); + return new npc_kerlonianAI(pCreature); } - void MoveInLineOfSight(Unit *pWho) + struct npc_kerlonianAI : public FollowerAI { - FollowerAI::MoveInLineOfSight(pWho); + npc_kerlonianAI(Creature* pCreature) : FollowerAI(pCreature) { } - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_LILADRIS) + uint32 m_uiFallAsleepTimer; + + void Reset() + { + m_uiFallAsleepTimer = urand(10000, 45000); + } + + void MoveInLineOfSight(Unit *pWho) { - if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE*5)) + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_LILADRIS) { - if (Player* pPlayer = GetLeaderForFollower()) + if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE*5)) { - if (pPlayer->GetQuestStatus(QUEST_SLEEPER_AWAKENED) == QUEST_STATUS_INCOMPLETE) - pPlayer->GroupEventHappens(QUEST_SLEEPER_AWAKENED, me); + if (Player* pPlayer = GetLeaderForFollower()) + { + if (pPlayer->GetQuestStatus(QUEST_SLEEPER_AWAKENED) == QUEST_STATUS_INCOMPLETE) + pPlayer->GroupEventHappens(QUEST_SLEEPER_AWAKENED, me); - DoScriptText(SAY_KER_END, me); - } + DoScriptText(SAY_KER_END, me); + } - SetFollowComplete(); + SetFollowComplete(); + } } } - } - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) - { - if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN) - ClearSleeping(); - } + void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) + { + if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_AWAKEN) + ClearSleeping(); + } - void SetSleeping() - { - SetFollowPaused(true); + void SetSleeping() + { + SetFollowPaused(true); - DoScriptText(RAND(EMOTE_KER_SLEEP_1,EMOTE_KER_SLEEP_2,EMOTE_KER_SLEEP_3), me); + DoScriptText(RAND(EMOTE_KER_SLEEP_1,EMOTE_KER_SLEEP_2,EMOTE_KER_SLEEP_3), me); - DoScriptText(RAND(SAY_KER_SLEEP_1,SAY_KER_SLEEP_2,SAY_KER_SLEEP_3,SAY_KER_SLEEP_4), me); + DoScriptText(RAND(SAY_KER_SLEEP_1,SAY_KER_SLEEP_2,SAY_KER_SLEEP_3,SAY_KER_SLEEP_4), me); - me->SetStandState(UNIT_STAND_STATE_SLEEP); - DoCast(me, SPELL_SLEEP_VISUAL, false); - } + me->SetStandState(UNIT_STAND_STATE_SLEEP); + DoCast(me, SPELL_SLEEP_VISUAL, false); + } - void ClearSleeping() - { - me->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL); - me->SetStandState(UNIT_STAND_STATE_STAND); + void ClearSleeping() + { + me->RemoveAurasDueToSpell(SPELL_SLEEP_VISUAL); + me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(EMOTE_KER_AWAKEN, me); + DoScriptText(EMOTE_KER_AWAKEN, me); - SetFollowPaused(false); - } + SetFollowPaused(false); + } - void UpdateFollowerAI(const uint32 uiDiff) - { - if (!UpdateVictim()) + void UpdateFollowerAI(const uint32 uiDiff) { - if (!HasFollowState(STATE_FOLLOW_INPROGRESS)) - return; - - if (!HasFollowState(STATE_FOLLOW_PAUSED)) + if (!UpdateVictim()) { - if (m_uiFallAsleepTimer <= uiDiff) + if (!HasFollowState(STATE_FOLLOW_INPROGRESS)) + return; + + if (!HasFollowState(STATE_FOLLOW_PAUSED)) { - SetSleeping(); - m_uiFallAsleepTimer = urand(25000, 90000); + if (m_uiFallAsleepTimer <= uiDiff) + { + SetSleeping(); + m_uiFallAsleepTimer = urand(25000, 90000); + } + else + m_uiFallAsleepTimer -= uiDiff; } - else - m_uiFallAsleepTimer -= uiDiff; + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_kerlonian(Creature* pCreature) -{ - return new npc_kerlonianAI(pCreature); -} - -bool QuestAccept_npc_kerlonian(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_SLEEPER_AWAKENED) - { - if (npc_kerlonianAI* pKerlonianAI = CAST_AI(npc_kerlonianAI, pCreature->AI())) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_KER_START, pCreature, pPlayer); - pKerlonianAI->StartFollow(pPlayer, FACTION_KER_ESCORTEE, pQuest); - } - } - return true; -} /*#### # npc_prospector_remtravel @@ -196,106 +204,114 @@ enum eRemtravel NPC_GRAVEL_BONE = 2159, NPC_GRAVEL_GEO = 2160 }; - -struct npc_prospector_remtravelAI : public npc_escortAI +
class npc_prospector_remtravel : public CreatureScript { - npc_prospector_remtravelAI(Creature* pCreature) : npc_escortAI(pCreature) {} +public: + npc_prospector_remtravel() : CreatureScript("npc_prospector_remtravel") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(i) + if (pQuest->GetQuestId() == QUEST_ABSENT_MINDED_PT2) { - case 0: - DoScriptText(SAY_REM_START, me, pPlayer); - break; - case 5: - DoScriptText(SAY_REM_RAMP1_1, me, pPlayer); - break; - case 6: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 9: - DoScriptText(SAY_REM_RAMP1_2, me, pPlayer); - break; - case 14: - //depend quest rewarded? - DoScriptText(SAY_REM_BOOK, me, pPlayer); - break; - case 15: - DoScriptText(SAY_REM_TENT1_1, me, pPlayer); - break; - case 16: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 17: - DoScriptText(SAY_REM_TENT1_2, me, pPlayer); - break; - case 26: - DoScriptText(SAY_REM_MOSS, me, pPlayer); - break; - case 27: - DoScriptText(EMOTE_REM_MOSS, me, pPlayer); - break; - case 28: - DoScriptText(SAY_REM_MOSS_PROGRESS, me, pPlayer); - break; - case 29: - DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 31: - DoScriptText(SAY_REM_PROGRESS, me, pPlayer); - break; - case 41: - DoScriptText(SAY_REM_REMEMBER, me, pPlayer); - break; - case 42: - DoScriptText(EMOTE_REM_END, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); - break; + if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_remtravel::npc_prospector_remtravelAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID()); + + pCreature->setFaction(FACTION_ESCORTEE); } - } - void Reset() {} + return true; + } - void EnterCombat(Unit* who) + CreatureAI* GetAI(Creature* pCreature) const { - if (rand()%2) - DoScriptText(SAY_REM_AGGRO, me, who); + return new npc_prospector_remtravelAI(pCreature); } - void JustSummoned(Creature* /*pSummoned*/) + struct npc_prospector_remtravelAI : public npc_escortAI { - //unsure if it should be any - //pSummoned->AI()->AttackStart(me); - } -}; + npc_prospector_remtravelAI(Creature* pCreature) : npc_escortAI(pCreature) {} -CreatureAI* GetAI_npc_prospector_remtravel(Creature* pCreature) -{ - return new npc_prospector_remtravelAI(pCreature); -} + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); -bool QuestAccept_npc_prospector_remtravel(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_ABSENT_MINDED_PT2) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_prospector_remtravelAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID()); + if (!pPlayer) + return; + + switch(i) + { + case 0: + DoScriptText(SAY_REM_START, me, pPlayer); + break; + case 5: + DoScriptText(SAY_REM_RAMP1_1, me, pPlayer); + break; + case 6: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 9: + DoScriptText(SAY_REM_RAMP1_2, me, pPlayer); + break; + case 14: + //depend quest rewarded? + DoScriptText(SAY_REM_BOOK, me, pPlayer); + break; + case 15: + DoScriptText(SAY_REM_TENT1_1, me, pPlayer); + break; + case 16: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -10.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -10.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 17: + DoScriptText(SAY_REM_TENT1_2, me, pPlayer); + break; + case 26: + DoScriptText(SAY_REM_MOSS, me, pPlayer); + break; + case 27: + DoScriptText(EMOTE_REM_MOSS, me, pPlayer); + break; + case 28: + DoScriptText(SAY_REM_MOSS_PROGRESS, me, pPlayer); + break; + case 29: + DoSpawnCreature(NPC_GRAVEL_SCOUT, -15.0f, 3.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_BONE, -15.0f, 5.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + DoSpawnCreature(NPC_GRAVEL_GEO, -15.0f, 7.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 31: + DoScriptText(SAY_REM_PROGRESS, me, pPlayer); + break; + case 41: + DoScriptText(SAY_REM_REMEMBER, me, pPlayer); + break; + case 42: + DoScriptText(EMOTE_REM_END, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_ABSENT_MINDED_PT2, me); + break; + } + } + + void Reset() {} + + void EnterCombat(Unit* who) + { + if (rand()%2) + DoScriptText(SAY_REM_AGGRO, me, who); + } + + void JustSummoned(Creature* /*pSummoned*/) + { + //unsure if it should be any + //pSummoned->AI()->AttackStart(me); + } + }; + +}; - pCreature->setFaction(FACTION_ESCORTEE); - } - return true; -} /*#### # npc_threshwackonator @@ -311,90 +327,81 @@ enum eThreshwackonator }; #define GOSSIP_ITEM_INSERT_KEY "[PH] Insert key" - -struct npc_threshwackonatorAI : public FollowerAI +
class npc_threshwackonator : public CreatureScript { - npc_threshwackonatorAI(Creature* pCreature) : FollowerAI(pCreature) { } - - void Reset() { } +public: + npc_threshwackonator() : CreatureScript("npc_threshwackonator") { } - void MoveInLineOfSight(Unit* pWho) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - FollowerAI::MoveInLineOfSight(pWho); - - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_GELKAK) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - if (me->IsWithinDistInMap(pWho, 10.0f)) + pPlayer->CLOSE_GOSSIP_MENU(); + + if (npc_threshwackonatorAI* pThreshAI = CAST_AI(npc_threshwackonator::npc_threshwackonatorAI, pCreature->AI())) { - DoScriptText(SAY_AT_CLOSE, pWho); - DoAtEnd(); + DoScriptText(EMOTE_START, pCreature); + pThreshAI->StartFollow(pPlayer); } } + + return true; } - void DoAtEnd() + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->setFaction(FACTION_HOSTILE); + if (pPlayer->GetQuestStatus(QUEST_GYROMAST_REV) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_INSERT_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - if (Player* pHolder = GetLeaderForFollower()) - me->AI()->AttackStart(pHolder); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } - SetFollowComplete(); + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_threshwackonatorAI(pCreature); } -}; -CreatureAI* GetAI_npc_threshwackonator(Creature* pCreature) -{ - return new npc_threshwackonatorAI(pCreature); -} + struct npc_threshwackonatorAI : public FollowerAI + { + npc_threshwackonatorAI(Creature* pCreature) : FollowerAI(pCreature) { } -bool GossipHello_npc_threshwackonator(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_GYROMAST_REV) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_INSERT_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + void Reset() { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + void MoveInLineOfSight(Unit* pWho) + { + FollowerAI::MoveInLineOfSight(pWho); -bool GossipSelect_npc_threshwackonator(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_GELKAK) + { + if (me->IsWithinDistInMap(pWho, 10.0f)) + { + DoScriptText(SAY_AT_CLOSE, pWho); + DoAtEnd(); + } + } + } - if (npc_threshwackonatorAI* pThreshAI = CAST_AI(npc_threshwackonatorAI, pCreature->AI())) + void DoAtEnd() { - DoScriptText(EMOTE_START, pCreature); - pThreshAI->StartFollow(pPlayer); + me->setFaction(FACTION_HOSTILE); + + if (Player* pHolder = GetLeaderForFollower()) + me->AI()->AttackStart(pHolder); + + SetFollowComplete(); } - } + }; + +}; + + - return true; -} void AddSC_darkshore() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_kerlonian"; - newscript->GetAI = &GetAI_npc_kerlonian; - newscript->pQuestAccept = &QuestAccept_npc_kerlonian; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_prospector_remtravel"; - newscript->GetAI = &GetAI_npc_prospector_remtravel; - newscript->pQuestAccept = &QuestAccept_npc_prospector_remtravel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_threshwackonator"; - newscript->GetAI = &GetAI_npc_threshwackonator; - newscript->pGossipHello = &GossipHello_npc_threshwackonator; - newscript->pGossipSelect = &GossipSelect_npc_threshwackonator; - newscript->pGossipSelect = &GossipSelect_npc_threshwackonator; - newscript->RegisterSelf(); + new npc_kerlonian(); + new npc_prospector_remtravel(); + new npc_threshwackonator(); } - diff --git a/src/server/scripts/Kalimdor/desolace.cpp b/src/server/scripts/Kalimdor/desolace.cpp index f9f79ffc917..565a16169b2 100644 --- a/src/server/scripts/Kalimdor/desolace.cpp +++ b/src/server/scripts/Kalimdor/desolace.cpp @@ -51,211 +51,217 @@ enum eDyingKodo SPELL_KODO_KOMBO_GOSSIP = 18362 }; - -struct npc_aged_dying_ancient_kodoAI : public ScriptedAI +
class npc_aged_dying_ancient_kodo : public CreatureScript { - npc_aged_dying_ancient_kodoAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } - - uint32 m_uiDespawnTimer; +public: + npc_aged_dying_ancient_kodo() : CreatureScript("npc_aged_dying_ancient_kodo") { } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - m_uiDespawnTimer = 0; + if (pPlayer->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && pCreature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) + { + //the expected quest objective + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + + pPlayer->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF); + pCreature->GetMotionMaster()->MoveIdle(); + } + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - void MoveInLineOfSight(Unit* pWho) + bool EffectDummyCreature(Unit *pCaster, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) { - if (pWho->GetEntry() == NPC_SMEED) + //always check spellid and effectindex + if (spellId == SPELL_KODO_KOMBO_ITEM && effIndex == 0) { - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return; + //no effect if player/creature already have aura from spells + if (pCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || pCreatureTarget->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) + return true; - if (me->IsWithinDistInMap(pWho, 10.0f)) + if (pCreatureTarget->GetEntry() == NPC_AGED_KODO || + pCreatureTarget->GetEntry() == NPC_DYING_KODO || + pCreatureTarget->GetEntry() == NPC_ANCIENT_KODO) { - DoScriptText(RAND(SAY_SMEED_HOME_1,SAY_SMEED_HOME_2,SAY_SMEED_HOME_3), pWho); + pCaster->CastSpell(pCaster,SPELL_KODO_KOMBO_PLAYER_BUFF,true); + + pCreatureTarget->UpdateEntry(NPC_TAMED_KODO); + pCreatureTarget->CastSpell(pCreatureTarget,SPELL_KODO_KOMBO_DESPAWN_BUFF,false); - //spell have no implemented effect (dummy), so useful to notify spellHit - DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true); + if (pCreatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + pCreatureTarget->GetMotionMaster()->MoveIdle(); + + pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, pCreatureTarget->GetFollowAngle()); } + + //always return true when we are handling this spell and effect + return true; } + return false; } - void SpellHit(Unit* /*pCaster*/, SpellEntry const* pSpell) + CreatureAI* GetAI(Creature* pCreature) const { - if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) - { - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - m_uiDespawnTimer = 60000; - } + return new npc_aged_dying_ancient_kodoAI(pCreature); } - void UpdateAI(const uint32 diff) + struct npc_aged_dying_ancient_kodoAI : public ScriptedAI { - //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. - if (m_uiDespawnTimer && m_uiDespawnTimer <= diff) - { - if (!me->getVictim() && me->isAlive()) - { - Reset(); - me->setDeathState(JUST_DIED); - me->Respawn(); - return; - } - } else m_uiDespawnTimer -= diff; + npc_aged_dying_ancient_kodoAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } - if (!UpdateVictim()) - return; + uint32 m_uiDespawnTimer; - DoMeleeAttackIfReady(); - } -}; + void Reset() + { + m_uiDespawnTimer = 0; + } -CreatureAI* GetAI_npc_aged_dying_ancient_kodo(Creature* pCreature) -{ - return new npc_aged_dying_ancient_kodoAI(pCreature); -} + void MoveInLineOfSight(Unit* pWho) + { + if (pWho->GetEntry() == NPC_SMEED) + { + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return; -bool EffectDummyCreature_npc_aged_dying_ancient_kodo(Unit *pCaster, uint32 spellId, uint32 effIndex, Creature *pCreatureTarget) -{ - //always check spellid and effectindex - if (spellId == SPELL_KODO_KOMBO_ITEM && effIndex == 0) - { - //no effect if player/creature already have aura from spells - if (pCaster->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) || pCreatureTarget->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) - return true; + if (me->IsWithinDistInMap(pWho, 10.0f)) + { + DoScriptText(RAND(SAY_SMEED_HOME_1,SAY_SMEED_HOME_2,SAY_SMEED_HOME_3), pWho); - if (pCreatureTarget->GetEntry() == NPC_AGED_KODO || - pCreatureTarget->GetEntry() == NPC_DYING_KODO || - pCreatureTarget->GetEntry() == NPC_ANCIENT_KODO) - { - pCaster->CastSpell(pCaster,SPELL_KODO_KOMBO_PLAYER_BUFF,true); + //spell have no implemented effect (dummy), so useful to notify spellHit + DoCast(me, SPELL_KODO_KOMBO_GOSSIP, true); + } + } + } - pCreatureTarget->UpdateEntry(NPC_TAMED_KODO); - pCreatureTarget->CastSpell(pCreatureTarget,SPELL_KODO_KOMBO_DESPAWN_BUFF,false); + void SpellHit(Unit* /*pCaster*/, SpellEntry const* pSpell) + { + if (pSpell->Id == SPELL_KODO_KOMBO_GOSSIP) + { + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + m_uiDespawnTimer = 60000; + } + } - if (pCreatureTarget->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) - pCreatureTarget->GetMotionMaster()->MoveIdle(); + void UpdateAI(const uint32 diff) + { + //timer should always be == 0 unless we already updated entry of creature. Then not expect this updated to ever be in combat. + if (m_uiDespawnTimer && m_uiDespawnTimer <= diff) + { + if (!me->getVictim() && me->isAlive()) + { + Reset(); + me->setDeathState(JUST_DIED); + me->Respawn(); + return; + } + } else m_uiDespawnTimer -= diff; + + if (!UpdateVictim()) + return; - pCreatureTarget->GetMotionMaster()->MoveFollow(pCaster, PET_FOLLOW_DIST, pCreatureTarget->GetFollowAngle()); + DoMeleeAttackIfReady(); } + }; - //always return true when we are handling this spell and effect - return true; - } - return false; -} +}; -bool GossipHello_npc_aged_dying_ancient_kodo(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->HasAura(SPELL_KODO_KOMBO_PLAYER_BUFF) && pCreature->HasAura(SPELL_KODO_KOMBO_DESPAWN_BUFF)) - { - //the expected quest objective - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pPlayer->RemoveAurasDueToSpell(SPELL_KODO_KOMBO_PLAYER_BUFF); - pCreature->GetMotionMaster()->MoveIdle(); - } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} /*###### ## go_iruxos. Quest 5381 ######*/ - -bool GOHello_go_iruxos(Player *pPlayer, GameObject* /*pGO*/) +
class go_iruxos : public GameObjectScript { - if (pPlayer->GetQuestStatus(5381) == QUEST_STATUS_INCOMPLETE) - pPlayer->SummonCreature(11876, pPlayer->GetInnPosX(),pPlayer->GetInnPosY(),pPlayer->GetInnPosZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); +public: + go_iruxos() : GameObjectScript("go_iruxos") { } - return true; -} + bool OnGossipHello(Player *pPlayer, GameObject* /*pGO*/) + { + if (pPlayer->GetQuestStatus(5381) == QUEST_STATUS_INCOMPLETE) + pPlayer->SummonCreature(11876, pPlayer->GetInnPosX(),pPlayer->GetInnPosY(),pPlayer->GetInnPosZ(),0,TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT,10000); + + return true; + } + +}; /*###### ## npc_dalinda_malem. Quest 1440 ######*/ #define QUEST_RETURN_TO_VAHLARRIEL 1440 - -struct npc_dalindaAI : public npc_escortAI +
class npc_dalinda : public CreatureScript { - npc_dalindaAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - void WaypointReached(uint32 i) +public: + npc_dalinda() : CreatureScript("npc_dalinda") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - switch (i) - { - case 1: - me->IsStandState(); - break; - case 15: - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_RETURN_TO_VAHLARRIEL, me); - break; + if (quest->GetQuestId() == QUEST_RETURN_TO_VAHLARRIEL) + { + if (npc_escortAI* pEscortAI = CAST_AI(npc_dalinda::npc_dalindaAI, pCreature->AI())) + { + pEscortAI->Start(true, false, pPlayer->GetGUID()); + pCreature->setFaction(113); + } } + return true; } - void EnterCombat(Unit* /*pWho*/) { } - - void Reset() {} - - void JustDied(Unit* /*pKiller*/) + CreatureAI* GetAI(Creature* pCreature) const { - Player* pPlayer = GetPlayerForEscort(); - if (pPlayer) - pPlayer->FailQuest(QUEST_RETURN_TO_VAHLARRIEL); - return; + return new npc_dalindaAI(pCreature); } - void UpdateAI(const uint32 uiDiff) - { - npc_escortAI::UpdateAI(uiDiff); - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); - } -}; + struct npc_dalindaAI : public npc_escortAI + { + npc_dalindaAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + switch (i) + { + case 1: + me->IsStandState(); + break; + case 15: + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_RETURN_TO_VAHLARRIEL, me); + break; + } + } -CreatureAI* GetAI_npc_dalinda(Creature* pCreature) -{ - return new npc_dalindaAI(pCreature); -} + void EnterCombat(Unit* /*pWho*/) { } -bool QuestAccept_npc_dalinda(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_RETURN_TO_VAHLARRIEL) - { - if (npc_escortAI* pEscortAI = CAST_AI(npc_dalindaAI, pCreature->AI())) + void Reset() {} + + void JustDied(Unit* /*pKiller*/) { - pEscortAI->Start(true, false, pPlayer->GetGUID()); - pCreature->setFaction(113); + Player* pPlayer = GetPlayerForEscort(); + if (pPlayer) + pPlayer->FailQuest(QUEST_RETURN_TO_VAHLARRIEL); + return; } - } - return true; -} + + void UpdateAI(const uint32 uiDiff) + { + npc_escortAI::UpdateAI(uiDiff); + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } + }; + +}; + + void AddSC_desolace() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_aged_dying_ancient_kodo"; - newscript->GetAI = &GetAI_npc_aged_dying_ancient_kodo; - newscript->pEffectDummyCreature = &EffectDummyCreature_npc_aged_dying_ancient_kodo; - newscript->pGossipHello = &GossipHello_npc_aged_dying_ancient_kodo; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "go_iruxos"; - newscript->pGOHello = &GOHello_go_iruxos; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_dalinda"; - newscript->GetAI = &GetAI_npc_dalinda; - newscript->pQuestAccept = &QuestAccept_npc_dalinda; - newscript->RegisterSelf(); - + new npc_aged_dying_ancient_kodo(); + new go_iruxos(); + new npc_dalinda(); } diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index fd2ed655f05..7369f061cd7 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -36,69 +36,71 @@ enum LazyPeon SPELL_BUFF_SLEEP = 17743, SPELL_AWAKEN_PEON = 19938 }; - -struct npc_lazy_peonAI : public ScriptedAI +
class npc_lazy_peon : public CreatureScript { - npc_lazy_peonAI(Creature *c) : ScriptedAI(c) {} - - uint64 uiPlayerGUID; - - uint32 m_uiRebuffTimer; - bool work; +public: + npc_lazy_peon() : CreatureScript("npc_lazy_peon") { } - void Reset () + CreatureAI* GetAI(Creature* pCreature) const { - uiPlayerGUID = 0; - work = false; + return new npc_lazy_peonAI(pCreature); } - void MovementInform(uint32 /*type*/, uint32 id) + struct npc_lazy_peonAI : public ScriptedAI { - if (id == 1) - work = true; - } + npc_lazy_peonAI(Creature *c) : ScriptedAI(c) {} - void SpellHit(Unit *caster, const SpellEntry *spell) - { - if (spell->Id == SPELL_AWAKEN_PEON && caster->GetTypeId() == TYPEID_PLAYER - && CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE) + uint64 uiPlayerGUID; + + uint32 m_uiRebuffTimer; + bool work; + + void Reset () { - caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(),me->GetGUID()); - DoScriptText(SAY_SPELL_HIT, me, caster); - me->RemoveAllAuras(); - if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20)) - me->GetMotionMaster()->MovePoint(1,Lumberpile->GetPositionX()-1,Lumberpile->GetPositionY(),Lumberpile->GetPositionZ()); + uiPlayerGUID = 0; + work = false; } - } - void UpdateAI(const uint32 uiDiff) - { - if (work == true) - me->HandleEmoteCommand(466); - if (m_uiRebuffTimer <= uiDiff) + void MovementInform(uint32 /*type*/, uint32 id) { - DoCast(me, SPELL_BUFF_SLEEP); - m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes + if (id == 1) + work = true; } - else - m_uiRebuffTimer -= uiDiff; - if (!UpdateVictim()) - return; - DoMeleeAttackIfReady(); - } + + void SpellHit(Unit *caster, const SpellEntry *spell) + { + if (spell->Id == SPELL_AWAKEN_PEON && caster->GetTypeId() == TYPEID_PLAYER + && CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE) + { + caster->ToPlayer()->KilledMonsterCredit(me->GetEntry(),me->GetGUID()); + DoScriptText(SAY_SPELL_HIT, me, caster); + me->RemoveAllAuras(); + if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20)) + me->GetMotionMaster()->MovePoint(1,Lumberpile->GetPositionX()-1,Lumberpile->GetPositionY(),Lumberpile->GetPositionZ()); + } + } + + void UpdateAI(const uint32 uiDiff) + { + if (work == true) + me->HandleEmoteCommand(466); + if (m_uiRebuffTimer <= uiDiff) + { + DoCast(me, SPELL_BUFF_SLEEP); + m_uiRebuffTimer = 300000; //Rebuff agian in 5 minutes + } + else + m_uiRebuffTimer -= uiDiff; + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); + } + }; + }; -CreatureAI* GetAI_npc_lazy_peon(Creature* pCreature) -{ - return new npc_lazy_peonAI(pCreature); -} void AddSC_durotar() { - Script* newscript; - - newscript = new Script; - newscript->Name = "npc_lazy_peon"; - newscript->GetAI = &GetAI_npc_lazy_peon; - newscript->RegisterSelf(); -}
\ No newline at end of file + new npc_lazy_peon(); +} diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index a5190cbdd30..827d2122621 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -51,63 +51,70 @@ enum eHuskSpirit NPC_RISEN_SPIRIT = 23554, NPC_RESTLESS_APPARITION = 23861 }; - -struct mobs_risen_husk_spiritAI : public ScriptedAI +
class mobs_risen_husk_spirit : public CreatureScript { - mobs_risen_husk_spiritAI(Creature *c) : ScriptedAI(c) {} - - uint32 m_uiConsumeFlesh_Timer; - uint32 m_uiIntangiblePresence_Timer; +public: + mobs_risen_husk_spirit() : CreatureScript("mobs_risen_husk_spirit") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiConsumeFlesh_Timer = 10000; - m_uiIntangiblePresence_Timer = 5000; + return new mobs_risen_husk_spiritAI (pCreature); } - void UpdateAI(const uint32 uiDiff) + struct mobs_risen_husk_spiritAI : public ScriptedAI { - if (!UpdateVictim()) - return; + mobs_risen_husk_spiritAI(Creature *c) : ScriptedAI(c) {} - if (m_uiConsumeFlesh_Timer <= uiDiff) - { - if (me->GetEntry() == NPC_RISEN_HUSK) - DoCast(me->getVictim(), SPELL_CONSUME_FLESH); + uint32 m_uiConsumeFlesh_Timer; + uint32 m_uiIntangiblePresence_Timer; - m_uiConsumeFlesh_Timer = 15000; + void Reset() + { + m_uiConsumeFlesh_Timer = 10000; + m_uiIntangiblePresence_Timer = 5000; } - else - m_uiConsumeFlesh_Timer -= uiDiff; - if (m_uiIntangiblePresence_Timer <= uiDiff) + void UpdateAI(const uint32 uiDiff) { - if (me->GetEntry() == NPC_RISEN_SPIRIT) - DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); + if (!UpdateVictim()) + return; - m_uiIntangiblePresence_Timer = 20000; - } - else - m_uiIntangiblePresence_Timer -= uiDiff; + if (m_uiConsumeFlesh_Timer <= uiDiff) + { + if (me->GetEntry() == NPC_RISEN_HUSK) + DoCast(me->getVictim(), SPELL_CONSUME_FLESH); - DoMeleeAttackIfReady(); - } + m_uiConsumeFlesh_Timer = 15000; + } + else + m_uiConsumeFlesh_Timer -= uiDiff; - void JustDied(Unit* pKiller) - { - if (pKiller->GetTypeId() == TYPEID_PLAYER) - if (CAST_PLR(pKiller)->GetQuestStatus(QUEST_WHATS_HAUNTING_WITCH_HILL) == QUEST_STATUS_INCOMPLETE) + if (m_uiIntangiblePresence_Timer <= uiDiff) { - DoCast(pKiller, SPELL_SUMMON_RESTLESS_APPARITION, true); - CAST_PLR(pKiller)->KilledMonsterCredit(NPC_RESTLESS_APPARITION,0); + if (me->GetEntry() == NPC_RISEN_SPIRIT) + DoCast(me->getVictim(), SPELL_INTANGIBLE_PRESENCE); + + m_uiIntangiblePresence_Timer = 20000; } - } + else + m_uiIntangiblePresence_Timer -= uiDiff; + + DoMeleeAttackIfReady(); + } + + void JustDied(Unit* pKiller) + { + if (pKiller->GetTypeId() == TYPEID_PLAYER) + if (CAST_PLR(pKiller)->GetQuestStatus(QUEST_WHATS_HAUNTING_WITCH_HILL) == QUEST_STATUS_INCOMPLETE) + { + DoCast(pKiller, SPELL_SUMMON_RESTLESS_APPARITION, true); + CAST_PLR(pKiller)->KilledMonsterCredit(NPC_RESTLESS_APPARITION,0); + } + } + }; + }; -CreatureAI* GetAI_mobs_risen_husk_spirit(Creature* pCreature) -{ - return new mobs_risen_husk_spiritAI (pCreature); -} /*###### ## npc_restless_apparition @@ -119,21 +126,28 @@ enum eRestlessApparition SAY_RESTLESS_2 = -1000470, SAY_RESTLESS_3 = -1000471 }; - -struct npc_restless_apparitionAI : public ScriptedAI +
class npc_restless_apparition : public CreatureScript { - npc_restless_apparitionAI(Creature* pCreature) : ScriptedAI(pCreature) {} +public: + npc_restless_apparition() : CreatureScript("npc_restless_apparition") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_RESTLESS_1,SAY_RESTLESS_2,SAY_RESTLESS_3), me); + return new npc_restless_apparitionAI (pCreature); } + + struct npc_restless_apparitionAI : public ScriptedAI + { + npc_restless_apparitionAI(Creature* pCreature) : ScriptedAI(pCreature) {} + + void Reset() + { + DoScriptText(RAND(SAY_RESTLESS_1,SAY_RESTLESS_2,SAY_RESTLESS_3), me); + } + }; + }; -CreatureAI* GetAI_npc_restless_apparition(Creature* pCreature) -{ - return new npc_restless_apparitionAI (pCreature); -} /*###### ## npc_deserter_agitator @@ -144,34 +158,42 @@ enum eAgitator QUEST_TRAITORS_AMONG_US = 11126, FACTION_THER_DESERTER = 1883 }; - -struct npc_deserter_agitatorAI : public ScriptedAI +
class npc_deserter_agitator : public CreatureScript { - npc_deserter_agitatorAI(Creature* pCreature) : ScriptedAI(pCreature) { } +public: + npc_deserter_agitator() : CreatureScript("npc_deserter_agitator") { } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - me->RestoreFaction(); - } -}; + if (pPlayer->GetQuestStatus(QUEST_TRAITORS_AMONG_US) == QUEST_STATUS_INCOMPLETE) + { + pCreature->setFaction(FACTION_THER_DESERTER); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); -CreatureAI* GetAI_npc_deserter_agitator(Creature* pCreature) -{ - return new npc_deserter_agitatorAI (pCreature); -} + return true; + } -bool GossipHello_npc_deserter_agitator(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_TRAITORS_AMONG_US) == QUEST_STATUS_INCOMPLETE) + CreatureAI* GetAI(Creature* pCreature) const { - pCreature->setFaction(FACTION_THER_DESERTER); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + return new npc_deserter_agitatorAI (pCreature); } - else - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + struct npc_deserter_agitatorAI : public ScriptedAI + { + npc_deserter_agitatorAI(Creature* pCreature) : ScriptedAI(pCreature) { } + + void Reset() + { + me->RestoreFaction(); + } + }; + +}; + + /*###### ## npc_lady_jaina_proudmoore @@ -184,29 +206,36 @@ enum eLadyJaina }; #define GOSSIP_ITEM_JAINA "I know this is rather silly but i have a young ward who is a bit shy and would like your autograph." - -bool GossipHello_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature) +
class npc_lady_jaina_proudmoore : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lady_jaina_proudmoore() : CreatureScript("npc_lady_jaina_proudmoore") { } - if (pPlayer->GetQuestStatus(QUEST_JAINAS_AUTOGRAPH) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_JAINA, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_SENDER_INFO) + { + pPlayer->SEND_GOSSIP_MENU(7012, pCreature->GetGUID()); + pPlayer->CastSpell(pPlayer, SPELL_JAINAS_AUTOGRAPH, false); + } + return true; + } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - return true; -} + if (pPlayer->GetQuestStatus(QUEST_JAINAS_AUTOGRAPH) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_JAINA, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); -bool GossipSelect_npc_lady_jaina_proudmoore(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_SENDER_INFO) - { - pPlayer->SEND_GOSSIP_MENU(7012, pCreature->GetGUID()); - pPlayer->CastSpell(pPlayer, SPELL_JAINAS_AUTOGRAPH, false); + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_nat_pagle @@ -216,30 +245,37 @@ enum eNatPagle { QUEST_NATS_MEASURING_TAPE = 8227 }; - -bool GossipHello_npc_nat_pagle(Player* pPlayer, Creature* pCreature) +
class npc_nat_pagle : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_nat_pagle() : CreatureScript("npc_nat_pagle") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(QUEST_NATS_MEASURING_TAPE)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(7640, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + + return true; } - else - pPlayer->SEND_GOSSIP_MENU(7638, pCreature->GetGUID()); - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_nat_pagle(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(QUEST_NATS_MEASURING_TAPE)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(7640, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(7638, pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### ## npc_private_hendel @@ -262,54 +298,62 @@ enum eHendel NPC_TERVOSH = 4967 }; -//TODO: develop this further, end event not created -struct npc_private_hendelAI : public ScriptedAI +//TODO: develop this further, end event not created
class npc_private_hendel : public CreatureScript { - npc_private_hendelAI(Creature* pCreature) : ScriptedAI(pCreature) { } +public: + npc_private_hendel() : CreatureScript("npc_private_hendel") { } - void Reset() + bool OnQuestAccept(Player* /*pPlayer*/, Creature* pCreature, const Quest* pQuest) { - me->RestoreFaction(); + if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT16) + pCreature->setFaction(FACTION_HOSTILE); + + return true; } - void AttackedBy(Unit* pAttacker) + CreatureAI* GetAI(Creature* pCreature) const { - if (me->getVictim()) - return; - - if (me->IsFriendlyTo(pAttacker)) - return; - - AttackStart(pAttacker); + return new npc_private_hendelAI(pCreature); } - void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + struct npc_private_hendelAI : public ScriptedAI { - if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 20)) + npc_private_hendelAI(Creature* pCreature) : ScriptedAI(pCreature) { } + + void Reset() { - uiDamage = 0; + me->RestoreFaction(); + } + + void AttackedBy(Unit* pAttacker) + { + if (me->getVictim()) + return; - if (Player* pPlayer = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) - pPlayer->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); + if (me->IsFriendlyTo(pAttacker)) + return; - DoScriptText(EMOTE_SURRENDER, me); - EnterEvadeMode(); + AttackStart(pAttacker); } - } -}; -bool QuestAccept_npc_private_hendel(Player* /*pPlayer*/, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_MISSING_DIPLO_PT16) - pCreature->setFaction(FACTION_HOSTILE); + void DamageTaken(Unit* pDoneBy, uint32 &uiDamage) + { + if (uiDamage > me->GetHealth() || ((me->GetHealth() - uiDamage)*100 / me->GetMaxHealth() < 20)) + { + uiDamage = 0; + + if (Player* pPlayer = pDoneBy->GetCharmerOrOwnerPlayerOrPlayerItself()) + pPlayer->GroupEventHappens(QUEST_MISSING_DIPLO_PT16, me); + + DoScriptText(EMOTE_SURRENDER, me); + EnterEvadeMode(); + } + } + }; + +}; - return true; -} -CreatureAI* GetAI_npc_private_hendel(Creature* pCreature) -{ - return new npc_private_hendelAI(pCreature); -} /*###### ## npc_zelfrax @@ -322,106 +366,79 @@ enum eZelfrax SAY_ZELFRAX = -1000472, SAY_ZELFRAX_2 = -1000473 }; - -struct npc_zelfraxAI : public ScriptedAI +
class npc_zelfrax : public CreatureScript { - npc_zelfraxAI(Creature* pCreature) : ScriptedAI(pCreature) +public: + npc_zelfrax() : CreatureScript("npc_zelfrax") { } + + CreatureAI* GetAI(Creature* pCreature) const { - MoveToDock(); + return new npc_zelfraxAI(pCreature); } - void AttackStart(Unit* pWho) + struct npc_zelfraxAI : public ScriptedAI { - if (!pWho) - return; + npc_zelfraxAI(Creature* pCreature) : ScriptedAI(pCreature) + { + MoveToDock(); + } - if (me->Attack(pWho, true)) + void AttackStart(Unit* pWho) { - me->SetInCombatWith(pWho); - pWho->SetInCombatWith(me); + if (!pWho) + return; + + if (me->Attack(pWho, true)) + { + me->SetInCombatWith(pWho); + pWho->SetInCombatWith(me); - if (IsCombatMovement()) - me->GetMotionMaster()->MoveChase(pWho); + if (IsCombatMovement()) + me->GetMotionMaster()->MoveChase(pWho); + } } - } - void MovementInform(uint32 uiType, uint32 /*uiId*/) - { - if (uiType != POINT_MOTION_TYPE) - return; + void MovementInform(uint32 uiType, uint32 /*uiId*/) + { + if (uiType != POINT_MOTION_TYPE) + return; - me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); - me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); - SetCombatMovement(true); + me->SetHomePosition(me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),me->GetOrientation()); + me->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_OOC_NOT_ATTACKABLE); + SetCombatMovement(true); - if (me->isInCombat()) - if (Unit* pUnit = me->getVictim()) - me->GetMotionMaster()->MoveChase(pUnit); - } + if (me->isInCombat()) + if (Unit* pUnit = me->getVictim()) + me->GetMotionMaster()->MoveChase(pUnit); + } - void MoveToDock() - { - SetCombatMovement(false); - me->GetMotionMaster()->MovePoint(0,MovePosition); - DoScriptText(SAY_ZELFRAX,me); - DoScriptText(SAY_ZELFRAX_2,me); - } + void MoveToDock() + { + SetCombatMovement(false); + me->GetMotionMaster()->MovePoint(0,MovePosition); + DoScriptText(SAY_ZELFRAX,me); + DoScriptText(SAY_ZELFRAX_2,me); + } - void UpdateAI(uint32 const /*uiDiff*/) - { - if (!UpdateVictim()) - return; + void UpdateAI(uint32 const /*uiDiff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_zelfrax(Creature* pCreature) -{ - return new npc_zelfraxAI(pCreature); -} void AddSC_dustwallow_marsh() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mobs_risen_husk_spirit"; - newscript->GetAI = &GetAI_mobs_risen_husk_spirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_restless_apparition"; - newscript->GetAI = &GetAI_npc_restless_apparition; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_deserter_agitator"; - newscript->GetAI = &GetAI_npc_deserter_agitator; - newscript->pGossipHello = &GossipHello_npc_deserter_agitator; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lady_jaina_proudmoore"; - newscript->pGossipHello = &GossipHello_npc_lady_jaina_proudmoore; - newscript->pGossipSelect = &GossipSelect_npc_lady_jaina_proudmoore; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_nat_pagle"; - newscript->pGossipHello = &GossipHello_npc_nat_pagle; - newscript->pGossipSelect = &GossipSelect_npc_nat_pagle; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_private_hendel"; - newscript->GetAI = &GetAI_npc_private_hendel; - newscript->pQuestAccept = &QuestAccept_npc_private_hendel; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_zelfrax"; - newscript->GetAI = &GetAI_npc_zelfrax; - newscript->RegisterSelf(); + new mobs_risen_husk_spirit(); + new npc_restless_apparition(); + new npc_deserter_agitator(); + new npc_lady_jaina_proudmoore(); + new npc_nat_pagle(); + new npc_private_hendel(); + new npc_zelfrax(); } - diff --git a/src/server/scripts/Kalimdor/felwood.cpp b/src/server/scripts/Kalimdor/felwood.cpp index 66757e0de36..d08304a20a9 100644 --- a/src/server/scripts/Kalimdor/felwood.cpp +++ b/src/server/scripts/Kalimdor/felwood.cpp @@ -34,59 +34,59 @@ EndContentData */ ######*/ #define GOSSIP_ITEM_BEACON "Please make me a Cenarion Beacon" - -bool GossipHello_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCreature) +
class npcs_riverbreeze_and_silversky : public CreatureScript { - uint32 eCreature = pCreature->GetEntry(); - - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npcs_riverbreeze_and_silversky() : CreatureScript("npcs_riverbreeze_and_silversky") { } - if (eCreature == 9528) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - if (pPlayer->GetQuestRewardStatus(4101)) + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(2848, pCreature->GetGUID()); - } else if (pPlayer->GetTeam() == HORDE) - pPlayer->SEND_GOSSIP_MENU(2845, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(2844, pCreature->GetGUID()); + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 15120, false); + } + return true; } - if (eCreature == 9529) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - if (pPlayer->GetQuestRewardStatus(4102)) + uint32 eCreature = pCreature->GetEntry(); + + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (eCreature == 9528) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(2849, pCreature->GetGUID()); - } else if (pPlayer->GetTeam() == ALLIANCE) - pPlayer->SEND_GOSSIP_MENU(2843, pCreature->GetGUID()); - else - pPlayer->SEND_GOSSIP_MENU(2842, pCreature->GetGUID()); - } + if (pPlayer->GetQuestRewardStatus(4101)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(2848, pCreature->GetGUID()); + } else if (pPlayer->GetTeam() == HORDE) + pPlayer->SEND_GOSSIP_MENU(2845, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(2844, pCreature->GetGUID()); + } - return true; -} + if (eCreature == 9529) + { + if (pPlayer->GetQuestRewardStatus(4102)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_BEACON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(2849, pCreature->GetGUID()); + } else if (pPlayer->GetTeam() == ALLIANCE) + pPlayer->SEND_GOSSIP_MENU(2843, pCreature->GetGUID()); + else + pPlayer->SEND_GOSSIP_MENU(2842, pCreature->GetGUID()); + } -bool GossipSelect_npcs_riverbreeze_and_silversky(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 15120, false); + return true; } - return true; -} + +}; + void AddSC_felwood() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npcs_riverbreeze_and_silversky"; - newscript->pGossipHello = &GossipHello_npcs_riverbreeze_and_silversky; - newscript->pGossipSelect = &GossipSelect_npcs_riverbreeze_and_silversky; - newscript->RegisterSelf(); + new npcs_riverbreeze_and_silversky(); } - diff --git a/src/server/scripts/Kalimdor/feralas.cpp b/src/server/scripts/Kalimdor/feralas.cpp index 86117e80616..94a64bc8a58 100644 --- a/src/server/scripts/Kalimdor/feralas.cpp +++ b/src/server/scripts/Kalimdor/feralas.cpp @@ -31,30 +31,37 @@ EndScriptData */ ######*/ #define GOSSIP_HELLO "Buy somethin', will ya?" - -bool GossipHello_npc_gregan_brewspewer(Player* pPlayer, Creature* pCreature) +
class npc_gregan_brewspewer : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pCreature->isVendor() && pPlayer->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_gregan_brewspewer() : CreatureScript("npc_gregan_brewspewer") { } - pPlayer->SEND_GOSSIP_MENU(2433, pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + pPlayer->SEND_GOSSIP_MENU(2434, pCreature->GetGUID()); + } + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + return true; + } -bool GossipSelect_npc_gregan_brewspewer(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - pPlayer->SEND_GOSSIP_MENU(2434, pCreature->GetGUID()); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pCreature->isVendor() && pPlayer->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(2433, pCreature->GetGUID()); + return true; } - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - return true; -} + +}; + /*###### ## npc_oox22fe @@ -80,105 +87,119 @@ enum eOOX FACTION_ESCORTEE_A = 774, FACTION_ESCORTEE_H = 775 }; - -struct npc_oox22feAI : public npc_escortAI +
class npc_oox22fe : public CreatureScript { - npc_oox22feAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_oox22fe() : CreatureScript("npc_oox22fe") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch (i) + if (pQuest->GetQuestId() == QUEST_RESCUE_OOX22FE) { - // First Ambush(3 Yetis) - case 11: - DoScriptText(SAY_OOX_AMBUSH, me); - me->SummonCreature(NPC_YETI, -4841.01, 1593.91, 73.42, 3.98, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_YETI, -4837.61, 1568.58, 78.21, 3.13, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_YETI, -4841.89, 1569.95, 76.53, 0.68, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - break; - //Second Ambush(3 Gorillas) - case 21: - DoScriptText(SAY_OOX_AMBUSH, me); - me->SummonCreature(NPC_GORILLA, -4595.81, 2005.99, 53.08, 3.74, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_GORILLA, -4597.53, 2008.31, 52.70, 3.78, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_GORILLA, -4599.37, 2010.59, 52.77, 3.84, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - break; - //Third Ambush(4 Gnolls) - case 30: - DoScriptText(SAY_OOX_AMBUSH, me); - me->SummonCreature(NPC_WOODPAW_REAVER, -4425.14, 2075.87, 47.77, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_WOODPAW_BRUTE , -4426.68, 2077.98, 47.57, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_WOODPAW_MYSTIC, -4428.33, 2080.24, 47.43, 3.87, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - me->SummonCreature(NPC_WOODPAW_ALPHA , -4430.04, 2075.54, 46.83, 3.81, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); - break; - case 37: - DoScriptText(SAY_OOX_END, me); - // Award quest credit - if (Player* pPlayer = GetPlayerForEscort()) - { - pPlayer->GroupEventHappens(QUEST_RESCUE_OOX22FE, me); - } - break; + DoScriptText(SAY_OOX_START, pCreature); + //change that the npc is not lying dead on the ground + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + + if (pPlayer->GetTeam() == ALLIANCE) + pCreature->setFaction(FACTION_ESCORTEE_A); + + if (pPlayer->GetTeam() == HORDE) + pCreature->setFaction(FACTION_ESCORTEE_H); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_oox22fe::npc_oox22feAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) - me->SetStandState(UNIT_STAND_STATE_DEAD); + return new npc_oox22feAI(pCreature); } - void EnterCombat(Unit* /*who*/) + struct npc_oox22feAI : public npc_escortAI { - //For an small probability the npc says something when he get aggro - if (urand(0,9) > 7) - DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me); - } + npc_oox22feAI(Creature* pCreature) : npc_escortAI(pCreature) { } - void JustSummoned(Creature* summoned) - { - summoned->AI()->AttackStart(me); - } -}; + void WaypointReached(uint32 i) + { + switch (i) + { + // First Ambush(3 Yetis) + case 11: + DoScriptText(SAY_OOX_AMBUSH, me); + me->SummonCreature(NPC_YETI, -4841.01, 1593.91, 73.42, 3.98, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_YETI, -4837.61, 1568.58, 78.21, 3.13, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_YETI, -4841.89, 1569.95, 76.53, 0.68, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + break; + //Second Ambush(3 Gorillas) + case 21: + DoScriptText(SAY_OOX_AMBUSH, me); + me->SummonCreature(NPC_GORILLA, -4595.81, 2005.99, 53.08, 3.74, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_GORILLA, -4597.53, 2008.31, 52.70, 3.78, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_GORILLA, -4599.37, 2010.59, 52.77, 3.84, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + break; + //Third Ambush(4 Gnolls) + case 30: + DoScriptText(SAY_OOX_AMBUSH, me); + me->SummonCreature(NPC_WOODPAW_REAVER, -4425.14, 2075.87, 47.77, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_WOODPAW_BRUTE , -4426.68, 2077.98, 47.57, 3.77, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_WOODPAW_MYSTIC, -4428.33, 2080.24, 47.43, 3.87, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + me->SummonCreature(NPC_WOODPAW_ALPHA , -4430.04, 2075.54, 46.83, 3.81, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 10000); + break; + case 37: + DoScriptText(SAY_OOX_END, me); + // Award quest credit + if (Player* pPlayer = GetPlayerForEscort()) + { + pPlayer->GroupEventHappens(QUEST_RESCUE_OOX22FE, me); + } + break; + } + } -CreatureAI* GetAI_npc_oox22fe(Creature* pCreature) -{ - return new npc_oox22feAI(pCreature); -} + void Reset() + { + if (!HasEscortState(STATE_ESCORT_ESCORTING)) + me->SetStandState(UNIT_STAND_STATE_DEAD); + } -bool QuestAccept_npc_oox22fe(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_RESCUE_OOX22FE) - { - DoScriptText(SAY_OOX_START, pCreature); - //change that the npc is not lying dead on the ground - pCreature->SetStandState(UNIT_STAND_STATE_STAND); + void EnterCombat(Unit* /*who*/) + { + //For an small probability the npc says something when he get aggro + if (urand(0,9) > 7) + DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me); + } - if (pPlayer->GetTeam() == ALLIANCE) - pCreature->setFaction(FACTION_ESCORTEE_A); + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + }; - if (pPlayer->GetTeam() == HORDE) - pCreature->setFaction(FACTION_ESCORTEE_H); +}; - if (npc_escortAI* pEscortAI = CAST_AI(npc_oox22feAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - } - return true; -} /*###### ## npc_screecher_spirit ######*/ - -bool GossipHello_npc_screecher_spirit(Player* pPlayer, Creature* pCreature) +
class npc_screecher_spirit : public CreatureScript { - pPlayer->SEND_GOSSIP_MENU(2039, pCreature->GetGUID()); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); +public: + npc_screecher_spirit() : CreatureScript("npc_screecher_spirit") { } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + pPlayer->SEND_GOSSIP_MENU(2039, pCreature->GetGUID()); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + + return true; + } + +}; /*###### ## AddSC @@ -186,23 +207,7 @@ bool GossipHello_npc_screecher_spirit(Player* pPlayer, Creature* pCreature) void AddSC_feralas() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_gregan_brewspewer"; - newscript->pGossipHello = &GossipHello_npc_gregan_brewspewer; - newscript->pGossipSelect = &GossipSelect_npc_gregan_brewspewer; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_oox22fe"; - newscript->GetAI = &GetAI_npc_oox22fe; - newscript->pQuestAccept = &QuestAccept_npc_oox22fe; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_screecher_spirit"; - newscript->pGossipHello = &GossipHello_npc_screecher_spirit; - newscript->RegisterSelf(); + new npc_gregan_brewspewer(); + new npc_oox22fe(); + new npc_screecher_spirit(); } - diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index 75f484abc15..adbe055300f 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -48,48 +48,55 @@ enum eBunthen #define GOSSIP_ITEM_THUNDER "I'd like to fly to Thunder Bluff." #define GOSSIP_ITEM_AQ_END "Do you know where I can find Half Pendant of Aquatic Endurance?" - -bool GossipHello_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature) +
class npc_bunthen_plainswind : public CreatureScript { - if (pPlayer->getClass() != CLASS_DRUID) - pPlayer->SEND_GOSSIP_MENU(4916, pCreature->GetGUID()); - else if (pPlayer->GetTeam() != HORDE) - { - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); +public: + npc_bunthen_plainswind() : CreatureScript("npc_bunthen_plainswind") { } - pPlayer->SEND_GOSSIP_MENU(4917, pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) + pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_HORDE); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->SEND_GOSSIP_MENU(5373, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(5376, pCreature->GetGUID()); + break; + } + return true; } - else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THUNDER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (pPlayer->getClass() != CLASS_DRUID) + pPlayer->SEND_GOSSIP_MENU(4916, pCreature->GetGUID()); + else if (pPlayer->GetTeam() != HORDE) + { + if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(4917, pCreature->GetGUID()); + } + else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_THUNDER, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(4918, pCreature->GetGUID()); - } - return true; -} + if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_END, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); -bool GossipSelect_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == HORDE) - pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_HORDE); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->SEND_GOSSIP_MENU(5373, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(5376, pCreature->GetGUID()); - break; + pPlayer->SEND_GOSSIP_MENU(4918, pCreature->GetGUID()); + } + return true; } - return true; -} + +}; + /*###### ## npc_great_bear_spirit @@ -99,47 +106,54 @@ bool GossipSelect_npc_bunthen_plainswind(Player* pPlayer, Creature* pCreature, u #define GOSSIP_BEAR2 "I seek to understand the importance of strength of the body." #define GOSSIP_BEAR3 "I seek to understand the importance of strength of the heart." #define GOSSIP_BEAR4 "I have heard your words, Great Bear Spirit, and I understand. I now seek your blessings to fully learn the way of the Claw." - -bool GossipHello_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature) +
class npc_great_bear_spirit : public CreatureScript { - //ally or horde quest - if (pPlayer->GetQuestStatus(5929) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(5930) == QUEST_STATUS_INCOMPLETE) +public: + npc_great_bear_spirit() : CreatureScript("npc_great_bear_spirit") { } + + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - pPlayer->SEND_GOSSIP_MENU(4719, pCreature->GetGUID()); + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(4721, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(4733, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(4734, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(4735, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(5929) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(5929); + if (pPlayer->GetQuestStatus(5930) == QUEST_STATUS_INCOMPLETE) + pPlayer->AreaExploredOrEventHappens(5930); + break; + } + return true; } - else - pPlayer->SEND_GOSSIP_MENU(4718, pCreature->GetGUID()); - - return true; -} -bool GossipSelect_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(4721, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(4733, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(4734, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(4735, pCreature->GetGUID()); - if (pPlayer->GetQuestStatus(5929) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(5929); - if (pPlayer->GetQuestStatus(5930) == QUEST_STATUS_INCOMPLETE) - pPlayer->AreaExploredOrEventHappens(5930); - break; + //ally or horde quest + if (pPlayer->GetQuestStatus(5929) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(5930) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BEAR1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + pPlayer->SEND_GOSSIP_MENU(4719, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(4718, pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_silva_filnaveth @@ -147,48 +161,55 @@ bool GossipSelect_npc_great_bear_spirit(Player* pPlayer, Creature* pCreature, ui #define GOSSIP_ITEM_RUTHERAN "I'd like to fly to Rut'theran Village." #define GOSSIP_ITEM_AQ_AGI "Do you know where I can find Half Pendant of Aquatic Agility?" - -bool GossipHello_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature) +
class npc_silva_filnaveth : public CreatureScript { - if (pPlayer->getClass() != CLASS_DRUID) - pPlayer->SEND_GOSSIP_MENU(4913, pCreature->GetGUID()); - else if (pPlayer->GetTeam() != ALLIANCE) - { - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); +public: + npc_silva_filnaveth() : CreatureScript("npc_silva_filnaveth") { } - pPlayer->SEND_GOSSIP_MENU(4915, pCreature->GetGUID()); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->CLOSE_GOSSIP_MENU(); + if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) + pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_ALLY); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->SEND_GOSSIP_MENU(5374, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->SEND_GOSSIP_MENU(5375, pCreature->GetGUID()); + break; + } + return true; } - else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RUTHERAN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + if (pPlayer->getClass() != CLASS_DRUID) + pPlayer->SEND_GOSSIP_MENU(4913, pCreature->GetGUID()); + else if (pPlayer->GetTeam() != ALLIANCE) + { + if (pPlayer->GetQuestStatus(QUEST_SEA_LION_HORDE) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(4915, pCreature->GetGUID()); + } + else if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_RUTHERAN, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(4914, pCreature->GetGUID()); - } - return true; -} + if (pPlayer->GetQuestStatus(QUEST_SEA_LION_ALLY) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_AQ_AGI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); -bool GossipSelect_npc_silva_filnaveth(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->CLOSE_GOSSIP_MENU(); - if (pPlayer->getClass() == CLASS_DRUID && pPlayer->GetTeam() == ALLIANCE) - pPlayer->ActivateTaxiPathTo(TAXI_PATH_ID_ALLY); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->SEND_GOSSIP_MENU(5374, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->SEND_GOSSIP_MENU(5375, pCreature->GetGUID()); - break; + pPlayer->SEND_GOSSIP_MENU(4914, pCreature->GetGUID()); + } + return true; } - return true; -} + +}; + /*###### ## npc_clintar_spirit @@ -258,281 +279,294 @@ float Clintar_spirit_WP[41][5] = #define CLINTAR_SPIRIT_SAY_GET_TWO -1000290 #define CLINTAR_SPIRIT_SAY_GET_THREE -1000291 #define CLINTAR_SPIRIT_SAY_GET_FINAL -1000292 - -struct npc_clintar_spiritAI : public npc_escortAI +
class npc_clintar_spirit : public CreatureScript { public: - npc_clintar_spiritAI(Creature *c) : npc_escortAI(c) {} - - uint32 Step; - uint32 CurrWP; - uint32 Event_Timer; - uint32 checkPlayer_Timer; - - uint64 PlayerGUID; - - bool Event_onWait; + npc_clintar_spirit() : CreatureScript("npc_clintar_spirit") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - if (!PlayerGUID) - { - Step = 0; - CurrWP = 0; - Event_Timer = 0; - PlayerGUID = 0; - checkPlayer_Timer = 1000; - Event_onWait = false; - } + return new npc_clintar_spiritAI (pCreature); } - void JustDied(Unit * /*killer*/) + struct npc_clintar_spiritAI : public npc_escortAI { - if (!PlayerGUID) - return; + public: + npc_clintar_spiritAI(Creature *c) : npc_escortAI(c) {} - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) - { - pPlayer->FailQuest(10965); - PlayerGUID = 0; - Reset(); - } - } + uint32 Step; + uint32 CurrWP; + uint32 Event_Timer; + uint32 checkPlayer_Timer; - void EnterEvadeMode() - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) + uint64 PlayerGUID; + + bool Event_onWait; + + void Reset() { - AttackStart(pPlayer->getAttackerForHelper()); - return; + if (!PlayerGUID) + { + Step = 0; + CurrWP = 0; + Event_Timer = 0; + PlayerGUID = 0; + checkPlayer_Timer = 1000; + Event_onWait = false; + } } - npc_escortAI::EnterEvadeMode(); - } - void EnterCombat(Unit* who) - { - uint32 rnd = rand()%2; - switch(rnd) + void JustDied(Unit * /*killer*/) { - case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break; - case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break; + if (!PlayerGUID) + return; + + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->FailQuest(10965); + PlayerGUID = 0; + Reset(); + } } - } - void StartEvent(Player* pPlayer) - { - if (!pPlayer) - return; - if (pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) + void EnterEvadeMode() { - for (uint8 i = 0; i < 41; ++i) + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) { - AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]); + AttackStart(pPlayer->getAttackerForHelper()); + return; } - PlayerGUID = pPlayer->GetGUID(); - Start(true,false,PlayerGUID); + npc_escortAI::EnterEvadeMode(); } - return; - } - - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - if (!PlayerGUID) + void EnterCombat(Unit* who) { - me->setDeathState(JUST_DIED); - return; + uint32 rnd = rand()%2; + switch(rnd) + { + case 0: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_1, me, who); break; + case 1: DoScriptText(CLINTAR_SPIRIT_SAY_UNDER_ATTACK_2, me, who); break; + } } - if (!me->isInCombat() && !Event_onWait) + void StartEvent(Player* pPlayer) { - if (checkPlayer_Timer <= diff) + if (!pPlayer) + return; + if (pPlayer->GetQuestStatus(10965) == QUEST_STATUS_INCOMPLETE) { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) - AttackStart(pPlayer->getAttackerForHelper()); - checkPlayer_Timer = 1000; - } else checkPlayer_Timer -= diff; + for (uint8 i = 0; i < 41; ++i) + { + AddWaypoint(i, Clintar_spirit_WP[i][0], Clintar_spirit_WP[i][1], Clintar_spirit_WP[i][2], (uint32)Clintar_spirit_WP[i][4]); + } + PlayerGUID = pPlayer->GetGUID(); + Start(true,false,PlayerGUID); + } + return; } - if (Event_onWait && Event_Timer <= diff) + void UpdateAI(const uint32 diff) { + npc_escortAI::UpdateAI(diff); - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (!pPlayer || (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_NONE)) + if (!PlayerGUID) { me->setDeathState(JUST_DIED); return; } - switch(CurrWP) + if (!me->isInCombat() && !Event_onWait) { - case 0: - switch(Step) - { - case 0: - me->Say(CLINTAR_SPIRIT_SAY_START,0,PlayerGUID); - Event_Timer = 8000; - Step = 1; - break; - case 1: - Event_onWait = false; - break; - } - break; - case 6: - switch(Step) - { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; - Step = 1; - break; - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, pPlayer); - Event_onWait = false; - break; - } - break; - case 15: - switch(Step) - { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; - Step = 1; - break; - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; - break; - } - break; - case 16: - switch(Step) - { - case 0: - DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, pPlayer); - Event_Timer = 15000; - Step = 1; - break; - case 1: - Event_onWait = false; - break; - } - break; - case 20: - switch(Step) - { - case 0: - { - Creature *mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); - if (mob) - { - mob->AddThreat(me,10000.0f); - mob->AI()->AttackStart(me); - } - Event_Timer = 2000; - Step = 1; - break; - } - case 1: - Event_onWait = false; - break; - } - break; - case 24: - switch(Step) - { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); - Event_Timer = 5000; - Step = 1; - break; - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_onWait = false; - break; - } - break; - case 25: - switch(Step) - { - case 0: - DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, pPlayer); - Event_Timer = 4000; - Step = 1; - break; - case 1: - Event_onWait = false; - break; - } - break; - case 40: - switch(Step) - { - case 0: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); - DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, pPlayer); - pPlayer->CompleteQuest(10965); - Event_Timer = 1500; - Step = 1; - break; - case 1: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); - Event_Timer = 3000; - Step = 2; - break; - case 2: - pPlayer->TalkedToCreature(me->GetEntry(), me->GetGUID()); - PlayerGUID = 0; - Reset(); - me->setDeathState(JUST_DIED); - break; - } - break; - default: - Event_onWait = false; - break; + if (checkPlayer_Timer <= diff) + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (pPlayer && pPlayer->isInCombat() && pPlayer->getAttackerForHelper()) + AttackStart(pPlayer->getAttackerForHelper()); + checkPlayer_Timer = 1000; + } else checkPlayer_Timer -= diff; } - } else if (Event_onWait) Event_Timer -= diff; - } + if (Event_onWait && Event_Timer <= diff) + { + + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + if (!pPlayer || (pPlayer && pPlayer->GetQuestStatus(10965) == QUEST_STATUS_NONE)) + { + me->setDeathState(JUST_DIED); + return; + } + + switch(CurrWP) + { + case 0: + switch(Step) + { + case 0: + me->Say(CLINTAR_SPIRIT_SAY_START,0,PlayerGUID); + Event_Timer = 8000; + Step = 1; + break; + case 1: + Event_onWait = false; + break; + } + break; + case 6: + switch(Step) + { + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); + Event_Timer = 5000; + Step = 1; + break; + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + DoScriptText(CLINTAR_SPIRIT_SAY_GET_ONE, me, pPlayer); + Event_onWait = false; + break; + } + break; + case 15: + switch(Step) + { + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); + Event_Timer = 5000; + Step = 1; + break; + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + Event_onWait = false; + break; + } + break; + case 16: + switch(Step) + { + case 0: + DoScriptText(CLINTAR_SPIRIT_SAY_GET_TWO, me, pPlayer); + Event_Timer = 15000; + Step = 1; + break; + case 1: + Event_onWait = false; + break; + } + break; + case 20: + switch(Step) + { + case 0: + { + Creature *mob = me->SummonCreature(ASPECT_RAVEN, ASPECT_RAVEN_SUMMON_X, ASPECT_RAVEN_SUMMON_Y, ASPECT_RAVEN_SUMMON_Z, 0, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 2000); + if (mob) + { + mob->AddThreat(me,10000.0f); + mob->AI()->AttackStart(me); + } + Event_Timer = 2000; + Step = 1; + break; + } + case 1: + Event_onWait = false; + break; + } + break; + case 24: + switch(Step) + { + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 133); + Event_Timer = 5000; + Step = 1; + break; + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + Event_onWait = false; + break; + } + break; + case 25: + switch(Step) + { + case 0: + DoScriptText(CLINTAR_SPIRIT_SAY_GET_THREE, me, pPlayer); + Event_Timer = 4000; + Step = 1; + break; + case 1: + Event_onWait = false; + break; + } + break; + case 40: + switch(Step) + { + case 0: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 2); + DoScriptText(CLINTAR_SPIRIT_SAY_GET_FINAL, me, pPlayer); + pPlayer->CompleteQuest(10965); + Event_Timer = 1500; + Step = 1; + break; + case 1: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, 0); + Event_Timer = 3000; + Step = 2; + break; + case 2: + pPlayer->TalkedToCreature(me->GetEntry(), me->GetGUID()); + PlayerGUID = 0; + Reset(); + me->setDeathState(JUST_DIED); + break; + } + break; + default: + Event_onWait = false; + break; + } + + } else if (Event_onWait) Event_Timer -= diff; + } + + void WaypointReached(uint32 id) + { + CurrWP = id; + Event_Timer = 0; + Step = 0; + Event_onWait = true; + } + }; - void WaypointReached(uint32 id) - { - CurrWP = id; - Event_Timer = 0; - Step = 0; - Event_onWait = true; - } }; -CreatureAI* GetAI_npc_clintar_spirit(Creature* pCreature) -{ - return new npc_clintar_spiritAI (pCreature); -} /*#### # npc_clintar_dreamwalker ####*/ #define CLINTAR_SPIRIT 22916 - -bool QuestAccept_npc_clintar_dreamwalker(Player* pPlayer, Creature* pCreature, Quest const *quest) +
class npc_clintar_dreamwalker : public CreatureScript { - if (quest->GetQuestId() == 10965) +public: + npc_clintar_dreamwalker() : CreatureScript("npc_clintar_dreamwalker") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const *quest) { - Creature *clintar_spirit = pCreature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000); - if (clintar_spirit) - CAST_AI(npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(pPlayer); + if (quest->GetQuestId() == 10965) + { + Creature *clintar_spirit = pCreature->SummonCreature(CLINTAR_SPIRIT, CLINTAR_SPIRIT_SUMMON_X, CLINTAR_SPIRIT_SUMMON_Y, CLINTAR_SPIRIT_SUMMON_Z, CLINTAR_SPIRIT_SUMMON_O, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 100000); + if (clintar_spirit) + CAST_AI(npc_clintar_spirit::npc_clintar_spiritAI, clintar_spirit->AI())->StartEvent(pPlayer); + } + return true; } - return true; -} + +}; /*#### # @@ -540,34 +574,9 @@ bool QuestAccept_npc_clintar_dreamwalker(Player* pPlayer, Creature* pCreature, Q void AddSC_moonglade() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_bunthen_plainswind"; - newscript->pGossipHello = &GossipHello_npc_bunthen_plainswind; - newscript->pGossipSelect = &GossipSelect_npc_bunthen_plainswind; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_great_bear_spirit"; - newscript->pGossipHello = &GossipHello_npc_great_bear_spirit; - newscript->pGossipSelect = &GossipSelect_npc_great_bear_spirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_silva_filnaveth"; - newscript->pGossipHello = &GossipHello_npc_silva_filnaveth; - newscript->pGossipSelect = &GossipSelect_npc_silva_filnaveth; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_clintar_dreamwalker"; - newscript->pQuestAccept = &QuestAccept_npc_clintar_dreamwalker; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_clintar_spirit"; - newscript->GetAI = &GetAI_npc_clintar_spirit; - newscript->RegisterSelf(); + new npc_bunthen_plainswind(); + new npc_great_bear_spirit(); + new npc_silva_filnaveth(); + new npc_clintar_dreamwalker(); + new npc_clintar_spirit(); } - diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp index 0021643eb53..049abbce363 100644 --- a/src/server/scripts/Kalimdor/mulgore.cpp +++ b/src/server/scripts/Kalimdor/mulgore.cpp @@ -37,27 +37,34 @@ EndContentData */ ######*/ #define GOSSIP_SW "Tell me a story, Skorn." - -bool GossipHello_npc_skorn_whitecloud(Player* pPlayer, Creature* pCreature) +
class npc_skorn_whitecloud : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_skorn_whitecloud() : CreatureScript("npc_skorn_whitecloud") { } - if (!pPlayer->GetQuestRewardStatus(770)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + pPlayer->SEND_GOSSIP_MENU(523, pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(522, pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_skorn_whitecloud(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) - pPlayer->SEND_GOSSIP_MENU(523, pCreature->GetGUID()); + if (!pPlayer->GetQuestRewardStatus(770)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(522, pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*##### # npc_kyle_frenzied @@ -75,114 +82,121 @@ enum eKyleFrenzied NPC_KYLE_FRIENDLY = 23622, POINT_ID = 1 }; - -struct npc_kyle_frenziedAI : public ScriptedAI +
class npc_kyle_frenzied : public CreatureScript { - npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {} - - bool bEvent; - bool m_bIsMovingToLunch; - uint64 uiPlayerGUID; - uint32 uiEventTimer; - uint8 uiEventPhase; +public: + npc_kyle_frenzied() : CreatureScript("npc_kyle_frenzied") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - bEvent = false; - m_bIsMovingToLunch = false; - uiPlayerGUID = 0; - uiEventTimer = 5000; - uiEventPhase = 0; - - if (me->GetEntry() == NPC_KYLE_FRIENDLY) - me->UpdateEntry(NPC_KYLE_FRENZIED); + return new npc_kyle_frenziedAI (pCreature); } - void SpellHit(Unit* pCaster, SpellEntry const* pSpell) + struct npc_kyle_frenziedAI : public ScriptedAI { - if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) - { - if (pCaster->GetTypeId() == TYPEID_PLAYER) - uiPlayerGUID = pCaster->GetGUID(); + npc_kyle_frenziedAI(Creature *c) : ScriptedAI(c) {} - if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) - { - me->GetMotionMaster()->MovementExpired(); - me->GetMotionMaster()->MoveIdle(); - me->StopMoving(); - } + bool bEvent; + bool m_bIsMovingToLunch; + uint64 uiPlayerGUID; + uint32 uiEventTimer; + uint8 uiEventPhase; + + void Reset() + { + bEvent = false; + m_bIsMovingToLunch = false; + uiPlayerGUID = 0; + uiEventTimer = 5000; + uiEventPhase = 0; - bEvent = true; - DoScriptText(EMOTE_SEE_LUNCH, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL); + if (me->GetEntry() == NPC_KYLE_FRIENDLY) + me->UpdateEntry(NPC_KYLE_FRENZIED); } - } - void MovementInform(uint32 uiType, uint32 uiPointId) - { - if (uiType != POINT_MOTION_TYPE || !bEvent) - return; + void SpellHit(Unit* pCaster, SpellEntry const* pSpell) + { + if (!me->getVictim() && !bEvent && pSpell->Id == SPELL_LUNCH) + { + if (pCaster->GetTypeId() == TYPEID_PLAYER) + uiPlayerGUID = pCaster->GetGUID(); - if (uiPointId == POINT_ID) - m_bIsMovingToLunch = false; - } + if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) + { + me->GetMotionMaster()->MovementExpired(); + me->GetMotionMaster()->MoveIdle(); + me->StopMoving(); + } - void UpdateAI(const uint32 diff) - { - if (bEvent) + bEvent = true; + DoScriptText(EMOTE_SEE_LUNCH, me); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_CREATURE_SPECIAL); + } + } + + void MovementInform(uint32 uiType, uint32 uiPointId) { - if (m_bIsMovingToLunch) + if (uiType != POINT_MOTION_TYPE || !bEvent) return; - if (uiEventTimer <= diff) + if (uiPointId == POINT_ID) + m_bIsMovingToLunch = false; + } + + void UpdateAI(const uint32 diff) + { + if (bEvent) { - uiEventTimer = 5000; - ++uiEventPhase; + if (m_bIsMovingToLunch) + return; - switch(uiEventPhase) + if (uiEventTimer <= diff) { - case 1: - if (Unit* pUnit = Unit::GetUnit(*me,uiPlayerGUID)) - { - if (GameObject* pGo = pUnit->GetGameObject(SPELL_LUNCH)) + uiEventTimer = 5000; + ++uiEventPhase; + + switch(uiEventPhase) + { + case 1: + if (Unit* pUnit = Unit::GetUnit(*me,uiPlayerGUID)) { - m_bIsMovingToLunch = true; - me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); + if (GameObject* pGo = pUnit->GetGameObject(SPELL_LUNCH)) + { + m_bIsMovingToLunch = true; + me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); + } } - } - break; - case 2: - DoScriptText(EMOTE_EAT_LUNCH, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); - break; - case 3: - if (Player* pUnit = Unit::GetPlayer(*me, uiPlayerGUID)) - pUnit->TalkedToCreature(me->GetEntry(), me->GetGUID()); - - me->UpdateEntry(NPC_KYLE_FRIENDLY); - break; - case 4: - uiEventTimer = 30000; - DoScriptText(EMOTE_DANCE, me); - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL); - break; - case 5: - me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); - Reset(); - me->GetMotionMaster()->Clear(); - break; + break; + case 2: + DoScriptText(EMOTE_EAT_LUNCH, me); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); + break; + case 3: + if (Player* pUnit = Unit::GetPlayer(*me, uiPlayerGUID)) + pUnit->TalkedToCreature(me->GetEntry(), me->GetGUID()); + + me->UpdateEntry(NPC_KYLE_FRIENDLY); + break; + case 4: + uiEventTimer = 30000; + DoScriptText(EMOTE_DANCE, me); + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_DANCESPECIAL); + break; + case 5: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); + Reset(); + me->GetMotionMaster()->Clear(); + break; + } } + else + uiEventTimer -= diff; } - else - uiEventTimer -= diff; } - } + }; + }; -CreatureAI* GetAI_npc_kyle_frenzied(Creature* pCreature) -{ - return new npc_kyle_frenziedAI (pCreature); -} /*##### # npc_plains_vision @@ -241,55 +255,62 @@ float wp_plain_vision[50][3] = {-1511.39, 362.537, 62.4539}, {-1508.68, 366.822, 62.733} }; - -struct npc_plains_visionAI : public ScriptedAI +
class npc_plains_vision : public CreatureScript { - npc_plains_visionAI(Creature *c) : ScriptedAI(c) {} +public: + npc_plains_vision() : CreatureScript("npc_plains_vision") { } - bool newWaypoint; - uint8 WayPointId; - uint8 amountWP; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - WayPointId = 0; - newWaypoint = true; - amountWP = 49; + return new npc_plains_visionAI (pCreature); } - void EnterCombat(Unit* /*who*/){} - - void MovementInform(uint32 type, uint32 id) + struct npc_plains_visionAI : public ScriptedAI { - if (type != POINT_MOTION_TYPE) - return; + npc_plains_visionAI(Creature *c) : ScriptedAI(c) {} - if (id < amountWP) + bool newWaypoint; + uint8 WayPointId; + uint8 amountWP; + + void Reset() { - ++WayPointId; + WayPointId = 0; newWaypoint = true; + amountWP = 49; } - else + + void EnterCombat(Unit* /*who*/){} + + void MovementInform(uint32 type, uint32 id) { - me->setDeathState(JUST_DIED); - me->RemoveCorpse(); + if (type != POINT_MOTION_TYPE) + return; + + if (id < amountWP) + { + ++WayPointId; + newWaypoint = true; + } + else + { + me->setDeathState(JUST_DIED); + me->RemoveCorpse(); + } } - } - void UpdateAI(const uint32 /*diff*/) - { - if (newWaypoint) + void UpdateAI(const uint32 /*diff*/) { - me->GetMotionMaster()->MovePoint(WayPointId, wp_plain_vision[WayPointId][0], wp_plain_vision[WayPointId][1], wp_plain_vision[WayPointId][2]); - newWaypoint = false; + if (newWaypoint) + { + me->GetMotionMaster()->MovePoint(WayPointId, wp_plain_vision[WayPointId][0], wp_plain_vision[WayPointId][1], wp_plain_vision[WayPointId][2]); + newWaypoint = false; + } } - } + }; + }; -CreatureAI* GetAI_npc_plains_vision(Creature* pCreature) -{ - return new npc_plains_visionAI (pCreature); -} /*##### # @@ -297,22 +318,7 @@ CreatureAI* GetAI_npc_plains_vision(Creature* pCreature) void AddSC_mulgore() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_skorn_whitecloud"; - newscript->pGossipHello = &GossipHello_npc_skorn_whitecloud; - newscript->pGossipSelect = &GossipSelect_npc_skorn_whitecloud; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_kyle_frenzied"; - newscript->GetAI = &GetAI_npc_kyle_frenzied; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_plains_vision"; - newscript->GetAI = &GetAI_npc_plains_vision; - newscript->RegisterSelf(); + new npc_skorn_whitecloud(); + new npc_kyle_frenzied(); + new npc_plains_vision(); } - diff --git a/src/server/scripts/Kalimdor/orgrimmar.cpp b/src/server/scripts/Kalimdor/orgrimmar.cpp index 24879f9e38f..e8ab1a6e241 100644 --- a/src/server/scripts/Kalimdor/orgrimmar.cpp +++ b/src/server/scripts/Kalimdor/orgrimmar.cpp @@ -38,34 +38,41 @@ EndContentData */ #define QUEST_5727 5727 #define GOSSIP_HNF "You may speak frankly, Neeru..." -#define GOSSIP_SNF "[PH] ..." -bool GossipHello_npc_neeru_fireblade(Player* pPlayer, Creature* pCreature) +#define GOSSIP_SNF "[PH] ..."
class npc_neeru_fireblade : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_neeru_fireblade() : CreatureScript("npc_neeru_fireblade") { } - if (pPlayer->GetQuestStatus(QUEST_5727) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(QUEST_5727); + break; + } + return true; + } -bool GossipSelect_npc_neeru_fireblade(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(QUEST_5727); - break; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_5727) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HNF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(4513, pCreature->GetGUID()); + return true; } - return true; -} + +}; + /*###### ## npc_shenthul @@ -75,86 +82,94 @@ enum eShenthul { QUEST_SHATTERED_SALUTE = 2460 }; - -struct npc_shenthulAI : public ScriptedAI +
class npc_shenthul : public CreatureScript { - npc_shenthulAI(Creature* c) : ScriptedAI(c) {} - - bool CanTalk; - bool CanEmote; - uint32 Salute_Timer; - uint32 Reset_Timer; - uint64 PlayerGUID; +public: + npc_shenthul() : CreatureScript("npc_shenthul") { } - void Reset() + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - CanTalk = false; - CanEmote = false; - Salute_Timer = 6000; - Reset_Timer = 0; - PlayerGUID = 0; + if (quest->GetQuestId() == QUEST_SHATTERED_SALUTE) + { + CAST_AI(npc_shenthul::npc_shenthulAI, pCreature->AI())->CanTalk = true; + CAST_AI(npc_shenthul::npc_shenthulAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); + } + return true; } - void EnterCombat(Unit* /*who*/) {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_shenthulAI (pCreature); + } - void UpdateAI(const uint32 diff) + struct npc_shenthulAI : public ScriptedAI { - if (CanEmote) + npc_shenthulAI(Creature* c) : ScriptedAI(c) {} + + bool CanTalk; + bool CanEmote; + uint32 Salute_Timer; + uint32 Reset_Timer; + uint64 PlayerGUID; + + void Reset() { - if (Reset_Timer <= diff) - { - if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) - { - if (pPlayer->GetTypeId() == TYPEID_PLAYER && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) - pPlayer->FailQuest(QUEST_SHATTERED_SALUTE); - } - Reset(); - } else Reset_Timer -= diff; + CanTalk = false; + CanEmote = false; + Salute_Timer = 6000; + Reset_Timer = 0; + PlayerGUID = 0; } - if (CanTalk && !CanEmote) + void EnterCombat(Unit* /*who*/) {} + + void UpdateAI(const uint32 diff) { - if (Salute_Timer <= diff) + if (CanEmote) { - me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); - CanEmote = true; - Reset_Timer = 60000; - } else Salute_Timer -= diff; - } + if (Reset_Timer <= diff) + { + if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID)) + { + if (pPlayer->GetTypeId() == TYPEID_PLAYER && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) + pPlayer->FailQuest(QUEST_SHATTERED_SALUTE); + } + Reset(); + } else Reset_Timer -= diff; + } - if (!UpdateVictim()) - return; + if (CanTalk && !CanEmote) + { + if (Salute_Timer <= diff) + { + me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + CanEmote = true; + Reset_Timer = 60000; + } else Salute_Timer -= diff; + } - DoMeleeAttackIfReady(); - } + if (!UpdateVictim()) + return; - void ReceiveEmote(Player* pPlayer, uint32 emote) - { - if (emote == TEXTEMOTE_SALUTE && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) + DoMeleeAttackIfReady(); + } + + void ReceiveEmote(Player* pPlayer, uint32 emote) { - if (CanEmote) + if (emote == TEXTEMOTE_SALUTE && pPlayer->GetQuestStatus(QUEST_SHATTERED_SALUTE) == QUEST_STATUS_INCOMPLETE) { - pPlayer->AreaExploredOrEventHappens(QUEST_SHATTERED_SALUTE); - Reset(); + if (CanEmote) + { + pPlayer->AreaExploredOrEventHappens(QUEST_SHATTERED_SALUTE); + Reset(); + } } } - } + }; + }; -CreatureAI* GetAI_npc_shenthul(Creature* pCreature) -{ - return new npc_shenthulAI (pCreature); -} -bool QuestAccept_npc_shenthul(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_SHATTERED_SALUTE) - { - CAST_AI(npc_shenthulAI, pCreature->AI())->CanTalk = true; - CAST_AI(npc_shenthulAI, pCreature->AI())->PlayerGUID = pPlayer->GetGUID(); - } - return true; -} /*###### ## npc_thrall_warchief @@ -173,116 +188,107 @@ bool QuestAccept_npc_shenthul(Player* pPlayer, Creature* pCreature, Quest const* #define GOSSIP_STW5 "I live only to serve, Warchief! My life is empty and meaningless without your guidance." #define GOSSIP_STW6 "Of course, Warchief!" -//TODO: verify abilities/timers -struct npc_thrall_warchiefAI : public ScriptedAI +//TODO: verify abilities/timers
class npc_thrall_warchief : public CreatureScript { - npc_thrall_warchiefAI(Creature* c) : ScriptedAI(c) {} +public: + npc_thrall_warchief() : CreatureScript("npc_thrall_warchief") { } - uint32 ChainLightning_Timer; - uint32 Shock_Timer; + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(5733, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(5734, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(5735, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(5736, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(5737, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + pPlayer->SEND_GOSSIP_MENU(5738, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+7: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(QUEST_6566); + break; + } + return true; + } - void Reset() + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - ChainLightning_Timer = 2000; - Shock_Timer = 8000; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(QUEST_6566) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HTW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - void EnterCombat(Unit * /*who*/) {} + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_thrall_warchiefAI (pCreature); + } - void UpdateAI(const uint32 diff) + struct npc_thrall_warchiefAI : public ScriptedAI { - if (!UpdateVictim()) - return; + npc_thrall_warchiefAI(Creature* c) : ScriptedAI(c) {} + + uint32 ChainLightning_Timer; + uint32 Shock_Timer; - if (ChainLightning_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); - ChainLightning_Timer = 9000; - } else ChainLightning_Timer -= diff; + ChainLightning_Timer = 2000; + Shock_Timer = 8000; + } + + void EnterCombat(Unit * /*who*/) {} - if (Shock_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_SHOCK); - Shock_Timer = 15000; - } else Shock_Timer -= diff; + if (!UpdateVictim()) + return; - DoMeleeAttackIfReady(); - } -}; -CreatureAI* GetAI_npc_thrall_warchief(Creature* pCreature) -{ - return new npc_thrall_warchiefAI (pCreature); -} + if (ChainLightning_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CHAIN_LIGHTNING); + ChainLightning_Timer = 9000; + } else ChainLightning_Timer -= diff; -bool GossipHello_npc_thrall_warchief(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (Shock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_SHOCK); + Shock_Timer = 15000; + } else Shock_Timer -= diff; - if (pPlayer->GetQuestStatus(QUEST_6566) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HTW, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + DoMeleeAttackIfReady(); + } + }; + +}; - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_thrall_warchief(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(5733, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(5734, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(5735, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(5736, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(5737, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_STW6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); - pPlayer->SEND_GOSSIP_MENU(5738, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+7: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(QUEST_6566); - break; - } - return true; -} void AddSC_orgrimmar() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_neeru_fireblade"; - newscript->pGossipHello = &GossipHello_npc_neeru_fireblade; - newscript->pGossipSelect = &GossipSelect_npc_neeru_fireblade; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_shenthul"; - newscript->GetAI = &GetAI_npc_shenthul; - newscript->pQuestAccept = &QuestAccept_npc_shenthul; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_thrall_warchief"; - newscript->GetAI = &GetAI_npc_thrall_warchief; - newscript->pGossipHello = &GossipHello_npc_thrall_warchief; - newscript->pGossipSelect = &GossipSelect_npc_thrall_warchief; - newscript->RegisterSelf(); + new npc_neeru_fireblade(); + new npc_shenthul(); + new npc_thrall_warchief(); } - diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index f96c8140772..f86d5dfd4a1 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -42,59 +42,66 @@ EndContentData */ #define GOSSIP_DEMITRIAN5 "<Nod>" #define GOSSIP_DEMITRIAN6 "Caught unaware? How?" #define GOSSIP_DEMITRIAN7 "So what did Ragnaros do next?" - -bool GossipHello_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature) +
class npc_highlord_demitrian : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_highlord_demitrian() : CreatureScript("npc_highlord_demitrian") { } - if (pPlayer->GetQuestStatus(7785) == QUEST_STATUS_NONE && - (pPlayer->HasItemCount(18563,1,false) || pPlayer->HasItemCount(18564,1,false))) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(6842, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(6843, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(6844, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(6867, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(6868, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + pPlayer->SEND_GOSSIP_MENU(6869, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+6: + pPlayer->SEND_GOSSIP_MENU(6870, pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(6812, pCreature->GetGUID()); + ItemPosCountVec dest; + uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 19016, 1); + if (msg == EQUIP_ERR_OK) + pPlayer->StoreNewItem(dest, 19016, true); + break; + } return true; -} + } -bool GossipSelect_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(6842, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(6843, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(6844, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(6867, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(6868, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - pPlayer->SEND_GOSSIP_MENU(6869, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+6: - pPlayer->SEND_GOSSIP_MENU(6870, pCreature->GetGUID()); - - ItemPosCountVec dest; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 19016, 1); - if (msg == EQUIP_ERR_OK) - pPlayer->StoreNewItem(dest, 19016, true); - break; + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(7785) == QUEST_STATUS_NONE && + (pPlayer->HasItemCount(18563,1,false) || pPlayer->HasItemCount(18564,1,false))) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_DEMITRIAN1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(6812, pCreature->GetGUID()); + return true; } - return true; -} + +}; + /*### ## npcs_rutgar_and_frankal @@ -119,89 +126,96 @@ bool GossipSelect_npc_highlord_demitrian(Player* pPlayer, Creature* pCreature, u //trigger creatures to kill #define TRIGGER_RUTGAR 15222 #define TRIGGER_FRANKAL 15221 - -bool GossipHello_npcs_rutgar_and_frankal(Player* pPlayer, Creature* pCreature) +
class npcs_rutgar_and_frankal : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npcs_rutgar_and_frankal() : CreatureScript("npcs_rutgar_and_frankal") { } - if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && - pCreature->GetEntry() == 15170 && - !pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(7755, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(7756, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(7757, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(7758, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(7759, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 5: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + pPlayer->SEND_GOSSIP_MENU(7760, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 6: + pPlayer->SEND_GOSSIP_MENU(7761, pCreature->GetGUID()); + //'kill' our trigger to update quest status + pPlayer->KilledMonsterCredit(TRIGGER_RUTGAR, pCreature->GetGUID()); + break; + + case GOSSIP_ACTION_INFO_DEF + 9: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(7762, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 10: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM12, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); + pPlayer->SEND_GOSSIP_MENU(7763, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 11: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM13, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); + pPlayer->SEND_GOSSIP_MENU(7764, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 12: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM14, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); + pPlayer->SEND_GOSSIP_MENU(7765, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 13: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM15, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); + pPlayer->SEND_GOSSIP_MENU(7766, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF + 14: + pPlayer->SEND_GOSSIP_MENU(7767, pCreature->GetGUID()); + //'kill' our trigger to update quest status + pPlayer->KilledMonsterCredit(TRIGGER_FRANKAL, pCreature->GetGUID()); + break; + } + return true; + } - if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && - pCreature->GetEntry() == 15171 && - pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(7754, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && + pCreature->GetEntry() == 15170 && + !pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - return true; -} + if (pPlayer->GetQuestStatus(8304) == QUEST_STATUS_INCOMPLETE && + pCreature->GetEntry() == 15171 && + pPlayer->GetReqKillOrCastCurrentCount(8304, TRIGGER_RUTGAR)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); -bool GossipSelect_npcs_rutgar_and_frankal(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(7755, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(7756, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(7757, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(7758, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(7759, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 5: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM7, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); - pPlayer->SEND_GOSSIP_MENU(7760, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 6: - pPlayer->SEND_GOSSIP_MENU(7761, pCreature->GetGUID()); - //'kill' our trigger to update quest status - pPlayer->KilledMonsterCredit(TRIGGER_RUTGAR, pCreature->GetGUID()); - break; + pPlayer->SEND_GOSSIP_MENU(7754, pCreature->GetGUID()); - case GOSSIP_ACTION_INFO_DEF + 9: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM11, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(7762, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 10: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM12, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 11); - pPlayer->SEND_GOSSIP_MENU(7763, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 11: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM13, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 12); - pPlayer->SEND_GOSSIP_MENU(7764, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 12: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM14, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 13); - pPlayer->SEND_GOSSIP_MENU(7765, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 13: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM15, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 14); - pPlayer->SEND_GOSSIP_MENU(7766, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF + 14: - pPlayer->SEND_GOSSIP_MENU(7767, pCreature->GetGUID()); - //'kill' our trigger to update quest status - pPlayer->KilledMonsterCredit(TRIGGER_FRANKAL, pCreature->GetGUID()); - break; + return true; } - return true; -} + +}; + /*#### # quest_a_pawn_on_the_eternal_board (Defines) @@ -467,676 +481,674 @@ static SpawnSpells SpawnCast[]=// }; /*##### # npc_anachronos_the_ancient -######*/ -struct npc_anachronos_the_ancientAI : public ScriptedAI +######*/
class npc_anachronos_the_ancient : public CreatureScript { - npc_anachronos_the_ancientAI(Creature* c) : ScriptedAI(c) {} - - uint32 AnimationTimer; - uint8 AnimationCount; - - uint64 AnachronosQuestTriggerGUID; - uint64 MerithraGUID; - uint64 ArygosGUID; - uint64 CaelestraszGUID; - uint64 FandralGUID; - uint64 PlayerGUID; - bool eventEnd; +public: + npc_anachronos_the_ancient() : CreatureScript("npc_anachronos_the_ancient") { } - void Reset() + CreatureAI* GetAI(Creature* c) { - AnimationTimer = 1500; - AnimationCount = 0; - AnachronosQuestTriggerGUID = 0; - MerithraGUID = 0; - ArygosGUID = 0; - CaelestraszGUID = 0; - FandralGUID = 0; - PlayerGUID = 0; - eventEnd = false; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + return new npc_anachronos_the_ancientAI(c); } - void HandleAnimation() + struct npc_anachronos_the_ancientAI : public ScriptedAI { - Player* plr = Unit::GetPlayer(*me, PlayerGUID); - if (!plr) - return; + npc_anachronos_the_ancientAI(Creature* c) : ScriptedAI(c) {} - Unit* Fandral = plr->FindNearestCreature(C_FANDRAL_STAGHELM, 100, me); - Unit* Arygos = plr->FindNearestCreature(C_ARYGOS, 100,me); - Unit* Caelestrasz = plr->FindNearestCreature(C_CAELESTRASZ, 100, me); - Unit* Merithra = plr->FindNearestCreature(C_MERITHRA, 100,me); + uint32 AnimationTimer; + uint8 AnimationCount; - if (!Fandral || !Arygos || !Caelestrasz || !Merithra) - return; + uint64 AnachronosQuestTriggerGUID; + uint64 MerithraGUID; + uint64 ArygosGUID; + uint64 CaelestraszGUID; + uint64 FandralGUID; + uint64 PlayerGUID; + bool eventEnd; + + void Reset() + { + AnimationTimer = 1500; + AnimationCount = 0; + AnachronosQuestTriggerGUID = 0; + MerithraGUID = 0; + ArygosGUID = 0; + CaelestraszGUID = 0; + FandralGUID = 0; + PlayerGUID = 0; + eventEnd = false; + + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + } - Unit* mob; - AnimationTimer = EventAnim[AnimationCount].Timer; - if (eventEnd == false) + void HandleAnimation() { - switch(AnimationCount) + Player* plr = Unit::GetPlayer(*me, PlayerGUID); + if (!plr) + return; + + Unit* Fandral = plr->FindNearestCreature(C_FANDRAL_STAGHELM, 100, me); + Unit* Arygos = plr->FindNearestCreature(C_ARYGOS, 100,me); + Unit* Caelestrasz = plr->FindNearestCreature(C_CAELESTRASZ, 100, me); + Unit* Merithra = plr->FindNearestCreature(C_MERITHRA, 100,me); + + if (!Fandral || !Arygos || !Caelestrasz || !Merithra) + return; + + Unit* mob; + AnimationTimer = EventAnim[AnimationCount].Timer; + if (eventEnd == false) { - case 0: - DoScriptText(ANACHRONOS_SAY_1, me , Fandral); - break; - case 1: - Fandral->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); - DoScriptText(FANDRAL_SAY_1, Fandral,me); - break; - case 2: - Fandral->SetUInt64Value(UNIT_FIELD_TARGET,NULL); - DoScriptText(MERITHRA_EMOTE_1,Merithra); - break; - case 3: - DoScriptText(MERITHRA_SAY_1,Merithra); - break; - case 4: - DoScriptText(ARYGOS_EMOTE_1,Arygos); - break; - case 5: - Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, Fandral->GetGUID()); - DoScriptText(CAELESTRASZ_SAY_1, Caelestrasz); - break; - case 6: - DoScriptText(MERITHRA_SAY_2, Merithra); - break; - case 7: - Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, NULL); - Merithra->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); - break; - case 8: - DoScriptText(MERITHRA_YELL_1,Merithra); - break; - case 9: - Merithra->CastSpell(Merithra,25105,true); - break; - case 10: - Merithra->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Merithra->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - Merithra->GetMotionMaster()->MoveCharge(-8065,1530,6.61,3); - break; - case 11: - Merithra->CastSpell(Merithra,24818,false); - break; - case 12: - Merithra->GetMotionMaster()->MoveCharge(-8100,1530,50,42); - break; - case 13: - break; - case 14: - DoScriptText(ARYGOS_SAY_1,Arygos); - Merithra->SetVisibility(VISIBILITY_OFF); - break; - case 15: - Arygos->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); - Merithra->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,42); - break; - case 16: - DoScriptText(ARYGOS_YELL_1, Arygos); - break; - case 17: - Arygos->CastSpell(Arygos,25107,true); - break; - case 18: - Arygos->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); - Arygos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - Arygos->GetMotionMaster()->MoveCharge(-8065,1530,6.61,42); - break; - case 19: - Arygos->CastSpell(Arygos,50505,false); - break; - case 20: - Arygos->GetMotionMaster()->MoveCharge(-8095,1530,50,42); - break; - case 21: - break; - case 22: - DoScriptText(CAELESTRASZ_SAY_2,Caelestrasz, Fandral); - break; - case 23: - Caelestrasz->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); - Arygos->SetVisibility(VISIBILITY_OFF); - Arygos->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,10); - break; - case 24: - DoScriptText(CAELESTRASZ_YELL_1, Caelestrasz); - break; - case 25: - Caelestrasz->CastSpell(Caelestrasz,25106,true); - break; - case 26: - Caelestrasz->HandleEmoteCommand(254); - Caelestrasz->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - Caelestrasz->GetMotionMaster()->MoveCharge(-8065,1530,7.61,4); - break; - case 27: - Caelestrasz->CastSpell(Caelestrasz,54293,false); - break; - case 28: - DoScriptText(ANACHRONOS_SAY_2,me, Fandral); - break; - case 29: - Caelestrasz->GetMotionMaster()->MoveCharge(-8095,1530,50,42); - DoScriptText(FANDRAL_SAY_2, Fandral, me); - break; - case 30: - break; - case 31: - DoScriptText(ANACHRONOS_SAY_3, me, Fandral); - break; - case 32: - Caelestrasz->SetVisibility(VISIBILITY_OFF); - Caelestrasz->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,42); - Fandral->GetMotionMaster()->MoveCharge(-8108,1529,2.77,8); - me->GetMotionMaster()->MoveCharge(-8113,1525,2.77,8); - break;//both run to the gate - case 33: - DoScriptText(ANACHRONOS_SAY_4, me); - Caelestrasz->GetMotionMaster()->MoveCharge(-8050,1473,65,15); - break; //Text: sands will stop - case 34: - DoCast(plr, 23017, true);//Arcane Channeling - break; - case 35: - me->CastSpell(-8088,1520.43,2.67,25158,true); - break; - case 36: - DoCast(plr, 25159, true); - break; - case 37: - me->SummonGameObject(GO_GATE_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); - break; - case 38: - DoCast(plr, 25166, true); - me->SummonGameObject(GO_GLYPH_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); - break; - case 39: - DoScriptText(ANACHRONOS_SAY_5, me, Fandral); - break; - case 40: - Fandral->CastSpell(me, 25167, true); - break; - case 41: - Fandral->SummonGameObject(GO_ROOTS_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); - DoScriptText(FANDRAL_SAY_3, Fandral); - break; - case 42: - me->CastStop(); - DoScriptText(FANDRAL_EMOTE_1, Fandral); - break; - case 43: - Fandral->CastStop(); - break; - case 44: - DoScriptText(ANACHRONOS_SAY_6, me); - break; - case 45: - DoScriptText(ANACHRONOS_SAY_7, me); - break; - case 46: - DoScriptText(ANACHRONOS_SAY_8, me); - me->GetMotionMaster()->MoveCharge(-8110,1527,2.77,4); - break; - case 47: - DoScriptText(ANACHRONOS_EMOTE_1, me); - break; - case 48: - DoScriptText(FANDRAL_SAY_4,Fandral,me); - break; - case 49: - DoScriptText(FANDRAL_SAY_5,Fandral,me); - break; - case 50: - DoScriptText(FANDRAL_EMOTE_2,Fandral); - Fandral->CastSpell(-8127,1525,17.5,33806,true); - break; - case 51: + switch(AnimationCount) { - uint32 entries[4] = { 15423, 15424, 15414, 15422 }; - for (uint8 i = 0; i < 4; ++i) + case 0: + DoScriptText(ANACHRONOS_SAY_1, me , Fandral); + break; + case 1: + Fandral->SetUInt64Value(UNIT_FIELD_TARGET, me->GetGUID()); + DoScriptText(FANDRAL_SAY_1, Fandral,me); + break; + case 2: + Fandral->SetUInt64Value(UNIT_FIELD_TARGET,NULL); + DoScriptText(MERITHRA_EMOTE_1,Merithra); + break; + case 3: + DoScriptText(MERITHRA_SAY_1,Merithra); + break; + case 4: + DoScriptText(ARYGOS_EMOTE_1,Arygos); + break; + case 5: + Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, Fandral->GetGUID()); + DoScriptText(CAELESTRASZ_SAY_1, Caelestrasz); + break; + case 6: + DoScriptText(MERITHRA_SAY_2, Merithra); + break; + case 7: + Caelestrasz->SetUInt64Value(UNIT_FIELD_TARGET, NULL); + Merithra->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); + break; + case 8: + DoScriptText(MERITHRA_YELL_1,Merithra); + break; + case 9: + Merithra->CastSpell(Merithra,25105,true); + break; + case 10: + Merithra->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + Merithra->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Merithra->GetMotionMaster()->MoveCharge(-8065,1530,6.61,3); + break; + case 11: + Merithra->CastSpell(Merithra,24818,false); + break; + case 12: + Merithra->GetMotionMaster()->MoveCharge(-8100,1530,50,42); + break; + case 13: + break; + case 14: + DoScriptText(ARYGOS_SAY_1,Arygos); + Merithra->SetVisibility(VISIBILITY_OFF); + break; + case 15: + Arygos->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); + Merithra->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,42); + break; + case 16: + DoScriptText(ARYGOS_YELL_1, Arygos); + break; + case 17: + Arygos->CastSpell(Arygos,25107,true); + break; + case 18: + Arygos->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF); + Arygos->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Arygos->GetMotionMaster()->MoveCharge(-8065,1530,6.61,42); + break; + case 19: + Arygos->CastSpell(Arygos,50505,false); + break; + case 20: + Arygos->GetMotionMaster()->MoveCharge(-8095,1530,50,42); + break; + case 21: + break; + case 22: + DoScriptText(CAELESTRASZ_SAY_2,Caelestrasz, Fandral); + break; + case 23: + Caelestrasz->GetMotionMaster()->MoveCharge(-8065,1530,2.61,10); + Arygos->SetVisibility(VISIBILITY_OFF); + Arygos->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,10); + break; + case 24: + DoScriptText(CAELESTRASZ_YELL_1, Caelestrasz); + break; + case 25: + Caelestrasz->CastSpell(Caelestrasz,25106,true); + break; + case 26: + Caelestrasz->HandleEmoteCommand(254); + Caelestrasz->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + Caelestrasz->GetMotionMaster()->MoveCharge(-8065,1530,7.61,4); + break; + case 27: + Caelestrasz->CastSpell(Caelestrasz,54293,false); + break; + case 28: + DoScriptText(ANACHRONOS_SAY_2,me, Fandral); + break; + case 29: + Caelestrasz->GetMotionMaster()->MoveCharge(-8095,1530,50,42); + DoScriptText(FANDRAL_SAY_2, Fandral, me); + break; + case 30: + break; + case 31: + DoScriptText(ANACHRONOS_SAY_3, me, Fandral); + break; + case 32: + Caelestrasz->SetVisibility(VISIBILITY_OFF); + Caelestrasz->GetMotionMaster()->MoveCharge(-8034.535,1535.14,2.61,42); + Fandral->GetMotionMaster()->MoveCharge(-8108,1529,2.77,8); + me->GetMotionMaster()->MoveCharge(-8113,1525,2.77,8); + break;//both run to the gate + case 33: + DoScriptText(ANACHRONOS_SAY_4, me); + Caelestrasz->GetMotionMaster()->MoveCharge(-8050,1473,65,15); + break; //Text: sands will stop + case 34: + DoCast(plr, 23017, true);//Arcane Channeling + break; + case 35: + me->CastSpell(-8088,1520.43,2.67,25158,true); + break; + case 36: + DoCast(plr, 25159, true); + break; + case 37: + me->SummonGameObject(GO_GATE_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); + break; + case 38: + DoCast(plr, 25166, true); + me->SummonGameObject(GO_GLYPH_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); + break; + case 39: + DoScriptText(ANACHRONOS_SAY_5, me, Fandral); + break; + case 40: + Fandral->CastSpell(me, 25167, true); + break; + case 41: + Fandral->SummonGameObject(GO_ROOTS_OF_AHN_QIRAJ,-8130,1525,17.5,0,0,0,0,0,0); + DoScriptText(FANDRAL_SAY_3, Fandral); + break; + case 42: + me->CastStop(); + DoScriptText(FANDRAL_EMOTE_1, Fandral); + break; + case 43: + Fandral->CastStop(); + break; + case 44: + DoScriptText(ANACHRONOS_SAY_6, me); + break; + case 45: + DoScriptText(ANACHRONOS_SAY_7, me); + break; + case 46: + DoScriptText(ANACHRONOS_SAY_8, me); + me->GetMotionMaster()->MoveCharge(-8110,1527,2.77,4); + break; + case 47: + DoScriptText(ANACHRONOS_EMOTE_1, me); + break; + case 48: + DoScriptText(FANDRAL_SAY_4,Fandral,me); + break; + case 49: + DoScriptText(FANDRAL_SAY_5,Fandral,me); + break; + case 50: + DoScriptText(FANDRAL_EMOTE_2,Fandral); + Fandral->CastSpell(-8127,1525,17.5,33806,true); + break; + case 51: { - mob = plr->FindNearestCreature(entries[i],50,me); - while (mob) + uint32 entries[4] = { 15423, 15424, 15414, 15422 }; + for (uint8 i = 0; i < 4; ++i) { - mob->RemoveFromWorld(); - mob = plr->FindNearestCreature(15423,50,me); + mob = plr->FindNearestCreature(entries[i],50,me); + while (mob) + { + mob->RemoveFromWorld(); + mob = plr->FindNearestCreature(15423,50,me); + } } + break; } - break; + case 52: + Fandral->GetMotionMaster()->MoveCharge(-8028.75, 1538.795, 2.61,4); + DoScriptText(ANACHRONOS_SAY_9, me,Fandral); + break; + case 53: + DoScriptText(FANDRAL_SAY_6,Fandral); + break; + case 54: + DoScriptText(ANACHRONOS_EMOTE_2,me); + break; + case 55: + Fandral->SetVisibility(VISIBILITY_OFF); + break; + case 56: + DoScriptText(ANACHRONOS_EMOTE_3, me); + me->GetMotionMaster()->MoveCharge(-8116,1522,3.65,4); + break; + case 57: + me->GetMotionMaster()->MoveCharge(-8116.7,1527,3.7,4); + break; + case 58: + me->GetMotionMaster()->MoveCharge(-8112.67,1529.9,2.86,4); + break; + case 59: + me->GetMotionMaster()->MoveCharge(-8117.99,1532.24,3.94,4); + break; + case 60: + if (plr) + DoScriptText(ANACHRONOS_SAY_10, me,plr); + me->GetMotionMaster()->MoveCharge(-8113.46,1524.16,2.89,4); + break; + case 61: + me->GetMotionMaster()->MoveCharge(-8057.1,1470.32,2.61,6); + if (plr->IsInRange(me,0,15)) + plr->GroupEventHappens(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD ,me); + break; + case 62: + me->SetDisplayId(15500); + break; + case 63: + me->HandleEmoteCommand(254); + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + break; + case 64: + me->GetMotionMaster()->MoveCharge(-8000,1400,150,9); + break; + case 65: + me->SetVisibility(VISIBILITY_OFF); + if (Creature* AnachronosQuestTrigger = (Unit::GetCreature(*me, AnachronosQuestTriggerGUID))) + { + DoScriptText(ARYGOS_YELL_1,me); + AnachronosQuestTrigger->AI()->EnterEvadeMode(); + eventEnd=true; + } + break; } - case 52: - Fandral->GetMotionMaster()->MoveCharge(-8028.75, 1538.795, 2.61,4); - DoScriptText(ANACHRONOS_SAY_9, me,Fandral); - break; - case 53: - DoScriptText(FANDRAL_SAY_6,Fandral); - break; - case 54: - DoScriptText(ANACHRONOS_EMOTE_2,me); - break; - case 55: - Fandral->SetVisibility(VISIBILITY_OFF); - break; - case 56: - DoScriptText(ANACHRONOS_EMOTE_3, me); - me->GetMotionMaster()->MoveCharge(-8116,1522,3.65,4); - break; - case 57: - me->GetMotionMaster()->MoveCharge(-8116.7,1527,3.7,4); - break; - case 58: - me->GetMotionMaster()->MoveCharge(-8112.67,1529.9,2.86,4); - break; - case 59: - me->GetMotionMaster()->MoveCharge(-8117.99,1532.24,3.94,4); - break; - case 60: - if (plr) - DoScriptText(ANACHRONOS_SAY_10, me,plr); - me->GetMotionMaster()->MoveCharge(-8113.46,1524.16,2.89,4); - break; - case 61: - me->GetMotionMaster()->MoveCharge(-8057.1,1470.32,2.61,6); - if (plr->IsInRange(me,0,15)) - plr->GroupEventHappens(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD ,me); - break; - case 62: - me->SetDisplayId(15500); - break; - case 63: - me->HandleEmoteCommand(254); - me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); - break; - case 64: - me->GetMotionMaster()->MoveCharge(-8000,1400,150,9); - break; - case 65: - me->SetVisibility(VISIBILITY_OFF); - if (Creature* AnachronosQuestTrigger = (Unit::GetCreature(*me, AnachronosQuestTriggerGUID))) - { - DoScriptText(ARYGOS_YELL_1,me); - AnachronosQuestTrigger->AI()->EnterEvadeMode(); - eventEnd=true; - } - break; } + ++AnimationCount; } - ++AnimationCount; - } - void UpdateAI(const uint32 diff) - { - if (AnimationTimer) + void UpdateAI(const uint32 diff) { - if (AnimationTimer <= diff) - HandleAnimation(); - else AnimationTimer -= diff; + if (AnimationTimer) + { + if (AnimationTimer <= diff) + HandleAnimation(); + else AnimationTimer -= diff; + } + if (AnimationCount < 65) + me->CombatStop(); + if (AnimationCount == 65 || eventEnd) + me->AI()->EnterEvadeMode(); } - if (AnimationCount < 65) - me->CombatStop(); - if (AnimationCount == 65 || eventEnd) - me->AI()->EnterEvadeMode(); - } + }; + }; /*###### # mob_qiraj_war_spawn ######*/ - -struct mob_qiraj_war_spawnAI : public ScriptedAI +
class mob_qiraj_war_spawn : public CreatureScript { - mob_qiraj_war_spawnAI(Creature* c) : ScriptedAI(c) {} - - uint64 MobGUID; - uint64 PlayerGUID; - uint32 SpellTimer1, SpellTimer2, SpellTimer3,SpellTimer4; - bool Timers; - bool hasTarget; +public: + mob_qiraj_war_spawn() : CreatureScript("mob_qiraj_war_spawn") { } - void Reset() + CreatureAI* GetAI(Creature* c) { - MobGUID = 0; - PlayerGUID = 0; - Timers = false; - hasTarget = false; + return new mob_qiraj_war_spawnAI(c); } - void EnterCombat(Unit* /*who*/) {} - void JustDied(Unit* slayer); - - void UpdateAI(const uint32 diff) + struct mob_qiraj_war_spawnAI : public ScriptedAI { - Unit *pTarget = NULL; - //Player* plr = me->GetPlayer(PlayerGUID); + mob_qiraj_war_spawnAI(Creature* c) : ScriptedAI(c) {} + + uint64 MobGUID; + uint64 PlayerGUID; + uint32 SpellTimer1, SpellTimer2, SpellTimer3,SpellTimer4; + bool Timers; + bool hasTarget; - if (!Timers) + void Reset() { - if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) //all but Kaldorei Soldiers - { - SpellTimer1 = SpawnCast[1].Timer1; - SpellTimer2 = SpawnCast[2].Timer1; - SpellTimer3 = SpawnCast[3].Timer1; - } - if (me->GetEntry() == 15423 || me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) - SpellTimer4 = SpawnCast[0].Timer1; - Timers = true; + MobGUID = 0; + PlayerGUID = 0; + Timers = false; + hasTarget = false; } - if (me->GetEntry() == 15424 || me->GetEntry() == 15422|| me->GetEntry() == 15414) + + void EnterCombat(Unit* /*who*/) {} + void JustDied(Unit* /*slayer*/); + + void UpdateAI(const uint32 diff) { - if (SpellTimer1 <= diff) + Unit *pTarget = NULL; + //Player* plr = me->GetPlayer(PlayerGUID); + + if (!Timers) { - DoCast(me, SpawnCast[1].SpellId); - DoCast(me, 24319); - SpellTimer1 = SpawnCast[1].Timer2; - } else SpellTimer1 -= diff; - if (SpellTimer2 <= diff) + if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) //all but Kaldorei Soldiers + { + SpellTimer1 = SpawnCast[1].Timer1; + SpellTimer2 = SpawnCast[2].Timer1; + SpellTimer3 = SpawnCast[3].Timer1; + } + if (me->GetEntry() == 15423 || me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) + SpellTimer4 = SpawnCast[0].Timer1; + Timers = true; + } + if (me->GetEntry() == 15424 || me->GetEntry() == 15422|| me->GetEntry() == 15414) { - DoCast(me, SpawnCast[2].SpellId); - SpellTimer2 = SpawnCast[2].Timer2; - } else SpellTimer2 -= diff; - if (SpellTimer3 <= diff) + if (SpellTimer1 <= diff) + { + DoCast(me, SpawnCast[1].SpellId); + DoCast(me, 24319); + SpellTimer1 = SpawnCast[1].Timer2; + } else SpellTimer1 -= diff; + if (SpellTimer2 <= diff) + { + DoCast(me, SpawnCast[2].SpellId); + SpellTimer2 = SpawnCast[2].Timer2; + } else SpellTimer2 -= diff; + if (SpellTimer3 <= diff) + { + DoCast(me, SpawnCast[3].SpellId); + SpellTimer3 = SpawnCast[3].Timer2; + } else SpellTimer3 -= diff; + } + if (me->GetEntry() == 15423 || me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) { - DoCast(me, SpawnCast[3].SpellId); - SpellTimer3 = SpawnCast[3].Timer2; - } else SpellTimer3 -= diff; - } - if (me->GetEntry() == 15423 || me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) - { - if (SpellTimer4 <= diff) + if (SpellTimer4 <= diff) + { + me->RemoveAllAttackers(); + me->AttackStop(); + DoCast(me, 15533); + SpellTimer4 = SpawnCast[0].Timer2; + } else SpellTimer4 -= diff; + } + if (!hasTarget) { - me->RemoveAllAttackers(); - me->AttackStop(); - DoCast(me, 15533); - SpellTimer4 = SpawnCast[0].Timer2; - } else SpellTimer4 -= diff; - } - if (!hasTarget) - { - if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) - pTarget = me->FindNearestCreature(15423,20,true); - if (me->GetEntry() == 15423) + if (me->GetEntry() == 15424 || me->GetEntry() == 15422 || me->GetEntry() == 15414) + pTarget = me->FindNearestCreature(15423,20,true); + if (me->GetEntry() == 15423) + { + uint8 tar = urand(0,2); + + if (tar == 0) + pTarget = me->FindNearestCreature(15422,20,true); + else if (tar == 1) + pTarget = me->FindNearestCreature(15424,20,true); + else if (tar == 2) + pTarget = me->FindNearestCreature(15414,20,true); + } + hasTarget = true; + if (pTarget) + me->AI()->AttackStart(pTarget); + } + if (!(me->FindNearestCreature(15379,60))) + DoCast(me, 33652); + + if (!UpdateVictim()) { - uint8 tar = urand(0,2); - - if (tar == 0) - pTarget = me->FindNearestCreature(15422,20,true); - else if (tar == 1) - pTarget = me->FindNearestCreature(15424,20,true); - else if (tar == 2) - pTarget = me->FindNearestCreature(15414,20,true); + hasTarget = false; + return; } - hasTarget = true; - if (pTarget) - me->AI()->AttackStart(pTarget); - } - if (!(me->FindNearestCreature(15379,60))) - DoCast(me, 33652); - if (!UpdateVictim()) - { - hasTarget = false; - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; /*##### # npc_anachronos_quest_trigger #####*/ - -struct npc_anachronos_quest_triggerAI : public ScriptedAI +
class npc_anachronos_quest_trigger : public CreatureScript { - npc_anachronos_quest_triggerAI(Creature* c) : ScriptedAI(c) {} +public: + npc_anachronos_quest_trigger() : CreatureScript("npc_anachronos_quest_trigger") { } - uint64 PlayerGUID; + CreatureAI* GetAI(Creature* c) + { + return new npc_anachronos_quest_triggerAI(c); + } - uint32 WaveTimer; - uint32 AnnounceTimer; + struct npc_anachronos_quest_triggerAI : public ScriptedAI + { + npc_anachronos_quest_triggerAI(Creature* c) : ScriptedAI(c) {} - int8 LiveCount; - uint8 WaveCount; + uint64 PlayerGUID; - bool EventStarted; - bool Announced; - bool Failed; + uint32 WaveTimer; + uint32 AnnounceTimer; - void Reset() - { - PlayerGUID = 0; + int8 LiveCount; + uint8 WaveCount; + + bool EventStarted; + bool Announced; + bool Failed; - WaveTimer = 2000; - AnnounceTimer = 1000; - LiveCount = 0; - WaveCount = 0; + void Reset() + { + PlayerGUID = 0; - EventStarted = false; - Announced = false; - Failed = false; + WaveTimer = 2000; + AnnounceTimer = 1000; + LiveCount = 0; + WaveCount = 0; - me->SetVisibility(VISIBILITY_OFF); - } + EventStarted = false; + Announced = false; + Failed = false; - void SummonNextWave() - { - //uint8 count = WavesInfo[WaveCount].SpawnCount; - uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; - srand(time(NULL));//initializing random seed - //uint8 KaldoreiSoldierCount = 0; - //uint8 AnubisathConquerorCount = 0; - //uint8 QirajiWaspCount = 0; - for (uint8 i = 0; i < 67; ++i) + me->SetVisibility(VISIBILITY_OFF); + } + + void SummonNextWave() { - Creature* Spawn = NULL; - float X = SpawnLocation[locIndex + i].x; - float Y = SpawnLocation[locIndex + i].y; - float Z = SpawnLocation[locIndex + i].z; - float O = SpawnLocation[locIndex + i].o; - uint32 desptimer = WavesInfo[WaveCount].DespTimer; - Spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer); - - if (Spawn) + //uint8 count = WavesInfo[WaveCount].SpawnCount; + uint8 locIndex = WavesInfo[WaveCount].UsedSpawnPoint; + srand(time(NULL));//initializing random seed + //uint8 KaldoreiSoldierCount = 0; + //uint8 AnubisathConquerorCount = 0; + //uint8 QirajiWaspCount = 0; + for (uint8 i = 0; i < 67; ++i) { - Spawn->LoadCreaturesAddon(); - if (Spawn->GetGUID() == 15423) - Spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID,15427+rand()%4); - if (i >= 30) WaveCount = 1; - if (i >= 33) WaveCount = 2; - if (i >= 45) WaveCount = 3; - if (i >= 51) WaveCount = 4; - - if (WaveCount < 5) //1-4 Wave + Creature* Spawn = NULL; + float X = SpawnLocation[locIndex + i].x; + float Y = SpawnLocation[locIndex + i].y; + float Z = SpawnLocation[locIndex + i].z; + float O = SpawnLocation[locIndex + i].o; + uint32 desptimer = WavesInfo[WaveCount].DespTimer; + Spawn = me->SummonCreature(WavesInfo[WaveCount].CreatureId, X, Y, Z, O, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, desptimer); + + if (Spawn) { - CAST_AI(mob_qiraj_war_spawnAI, Spawn->AI())->MobGUID = me->GetGUID(); - CAST_AI(mob_qiraj_war_spawnAI, Spawn->AI())->PlayerGUID = PlayerGUID; + Spawn->LoadCreaturesAddon(); + if (Spawn->GetGUID() == 15423) + Spawn->SetUInt32Value(UNIT_FIELD_DISPLAYID,15427+rand()%4); + if (i >= 30) WaveCount = 1; + if (i >= 33) WaveCount = 2; + if (i >= 45) WaveCount = 3; + if (i >= 51) WaveCount = 4; + + if (WaveCount < 5) //1-4 Wave + { + CAST_AI(mob_qiraj_war_spawn::mob_qiraj_war_spawnAI, Spawn->AI())->MobGUID = me->GetGUID(); + CAST_AI(mob_qiraj_war_spawn::mob_qiraj_war_spawnAI, Spawn->AI())->PlayerGUID = PlayerGUID; + } } } + WaveTimer = WavesInfo[WaveCount].SpawnTimer; + AnnounceTimer = WavesInfo[WaveCount].YellTimer; } - WaveTimer = WavesInfo[WaveCount].SpawnTimer; - AnnounceTimer = WavesInfo[WaveCount].YellTimer; - } - void CheckEventFail() - { - Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); + void CheckEventFail() + { + Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID); - if (!pPlayer) - return; + if (!pPlayer) + return; - if (Group *EventGroup = pPlayer->GetGroup()) - { - Player* GroupMember; + if (Group *EventGroup = pPlayer->GetGroup()) + { + Player* GroupMember; - uint8 GroupMemberCount = 0; - uint8 DeadMemberCount = 0; - uint8 FailedMemberCount = 0; + uint8 GroupMemberCount = 0; + uint8 DeadMemberCount = 0; + uint8 FailedMemberCount = 0; - const Group::MemberSlotList members = EventGroup->GetMemberSlots(); + const Group::MemberSlotList members = EventGroup->GetMemberSlots(); - for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) - { - GroupMember = (Unit::GetPlayer(*me, itr->guid)); - if (!GroupMember) - continue; - if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE) + for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { - GroupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD); - GroupMember->SetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD, QUEST_STATUS_NONE); - ++FailedMemberCount; + GroupMember = (Unit::GetPlayer(*me, itr->guid)); + if (!GroupMember) + continue; + if (!GroupMember->IsWithinDistInMap(me, EVENT_AREA_RADIUS) && GroupMember->GetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) == QUEST_STATUS_INCOMPLETE) + { + GroupMember->FailQuest(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD); + GroupMember->SetQuestStatus(QUEST_A_PAWN_ON_THE_ETERNAL_BOARD, QUEST_STATUS_NONE); + ++FailedMemberCount; + } + ++GroupMemberCount; + + if (GroupMember->isDead()) + ++DeadMemberCount; } - ++GroupMemberCount; - if (GroupMember->isDead()) - ++DeadMemberCount; + if (GroupMemberCount == FailedMemberCount || !pPlayer->IsWithinDistInMap(me, EVENT_AREA_RADIUS)) + Failed = true; //only so event can restart } - - if (GroupMemberCount == FailedMemberCount || !pPlayer->IsWithinDistInMap(me, EVENT_AREA_RADIUS)) - Failed = true; //only so event can restart } - } - void LiveCounter() - { - --LiveCount; - if (!LiveCount) - Announced = false; - } - - void UpdateAI(const uint32 diff) - { - if (!PlayerGUID || !EventStarted) - return; + void LiveCounter() + { + --LiveCount; + if (!LiveCount) + Announced = false; + } - if (WaveCount < 4) + void UpdateAI(const uint32 diff) { - if (!Announced && AnnounceTimer <= diff) + if (!PlayerGUID || !EventStarted) + return; + + if (WaveCount < 4) { - DoScriptText(WavesInfo[WaveCount].WaveTextId, me); - Announced = true; - } else AnnounceTimer -= diff; + if (!Announced && AnnounceTimer <= diff) + { + DoScriptText(WavesInfo[WaveCount].WaveTextId, me); + Announced = true; + } else AnnounceTimer -= diff; - if (WaveTimer <= diff) - SummonNextWave(); - else WaveTimer -= diff; - } - CheckEventFail(); - if (WaveCount == 4 || Failed) - EnterEvadeMode(); + if (WaveTimer <= diff) + SummonNextWave(); + else WaveTimer -= diff; + } + CheckEventFail(); + if (WaveCount == 4 || Failed) + EnterEvadeMode(); + }; }; + }; -void mob_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/) + +void mob_qiraj_war_spawn::mob_qiraj_war_spawnAI::JustDied(Unit* /*slayer*/) { me->RemoveCorpse(); if (Creature* Mob = (Unit::GetCreature(*me, MobGUID))) - CAST_AI(npc_anachronos_quest_triggerAI, Mob->AI())->LiveCounter(); + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, Mob->AI())->LiveCounter(); }; + /*##### # go_crystalline_tear ######*/ - -bool GOQuestAccept_GO_crystalline_tear(Player* plr, GameObject* go, Quest const* quest) +
class go_crystalline_tear : public GameObjectScript { - if (quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) - { +public: + go_crystalline_tear() : GameObjectScript("go_crystalline_tear") { } - if (Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, plr)) + bool OnQuestAccept(Player* plr, GameObject* go, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_A_PAWN_ON_THE_ETERNAL_BOARD) { - Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379,-8032.767, 1533.148,2.61, 1.5,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380,-8034.52, 1537.843, 2.61, 5.7,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - /* Unit *Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - - if (Merithra) + if (Unit* Anachronos_Quest_Trigger = go->FindNearestCreature(15454, 100, plr)) { - Merithra->SetUInt32Value(UNIT_NPC_FLAGS, 0); - Merithra->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - Merithra->SetUInt32Value(UNIT_FIELD_DISPLAYID,15420); - Merithra->setFaction(35); - } - if (Caelestrasz) - { - Caelestrasz->SetUInt32Value(UNIT_NPC_FLAGS, 0); - Caelestrasz->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - Caelestrasz->SetUInt32Value(UNIT_FIELD_DISPLAYID,15419); - Caelestrasz->setFaction(35); - } + Unit *Merithra = Anachronos_Quest_Trigger->SummonCreature(15378,-8034.535,1535.14,2.61,0,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); + Unit *Caelestrasz = Anachronos_Quest_Trigger->SummonCreature(15379,-8032.767, 1533.148,2.61, 1.5,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); + Unit *Arygos = Anachronos_Quest_Trigger->SummonCreature(15380,-8034.52, 1537.843, 2.61, 5.7,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); + /* Unit *Fandral = */ Anachronos_Quest_Trigger->SummonCreature(15382,-8028.462, 1535.843, 2.61, 3.141592,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); + Creature *Anachronos = Anachronos_Quest_Trigger->SummonCreature(15381,-8028.75, 1538.795, 2.61, 4,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,220000); - if (Arygos) - { - Arygos->SetUInt32Value(UNIT_NPC_FLAGS, 0); - Arygos->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - Arygos->SetUInt32Value(UNIT_FIELD_DISPLAYID,15418); - Arygos->setFaction(35); - } + if (Merithra) + { + Merithra->SetUInt32Value(UNIT_NPC_FLAGS, 0); + Merithra->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + Merithra->SetUInt32Value(UNIT_FIELD_DISPLAYID,15420); + Merithra->setFaction(35); + } - if (Anachronos) - { - CAST_AI(npc_anachronos_the_ancientAI, Anachronos->AI())->PlayerGUID = plr->GetGUID(); - CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Failed=false; - CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->PlayerGUID = plr->GetGUID(); - CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->EventStarted=true; - CAST_AI(npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Announced=true; + if (Caelestrasz) + { + Caelestrasz->SetUInt32Value(UNIT_NPC_FLAGS, 0); + Caelestrasz->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + Caelestrasz->SetUInt32Value(UNIT_FIELD_DISPLAYID,15419); + Caelestrasz->setFaction(35); + } + + if (Arygos) + { + Arygos->SetUInt32Value(UNIT_NPC_FLAGS, 0); + Arygos->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + Arygos->SetUInt32Value(UNIT_FIELD_DISPLAYID,15418); + Arygos->setFaction(35); + } + + if (Anachronos) + { + CAST_AI(npc_anachronos_the_ancient::npc_anachronos_the_ancientAI, Anachronos->AI())->PlayerGUID = plr->GetGUID(); + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Failed=false; + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->PlayerGUID = plr->GetGUID(); + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->EventStarted=true; + CAST_AI(npc_anachronos_quest_trigger::npc_anachronos_quest_triggerAI, CAST_CRE(Anachronos_Quest_Trigger)->AI())->Announced=true; + } } } + return true; } - return true; -} -CreatureAI* GetAI_npc_anachronos_quest_trigger(Creature* c) -{ - return new npc_anachronos_quest_triggerAI(c); -} - -CreatureAI* GetAI_mob_qiraj_war_spawn(Creature* c) -{ - return new mob_qiraj_war_spawnAI(c); -} - -CreatureAI* GetAI_npc_anachronos_the_ancient(Creature* c) -{ - return new npc_anachronos_the_ancientAI(c); -} +}; void AddSC_silithus() { - Script *newscript; - - newscript = new Script; - newscript->Name = "go_crystalline_tear"; - newscript->pGOQuestAccept = &GOQuestAccept_GO_crystalline_tear; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_anachronos_quest_trigger"; - newscript->GetAI = &GetAI_npc_anachronos_quest_trigger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_anachronos_the_ancient"; - newscript->GetAI = &GetAI_npc_anachronos_the_ancient; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "mob_qiraj_war_spawn"; - newscript->GetAI = &GetAI_mob_qiraj_war_spawn; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_highlord_demitrian"; - newscript->pGossipHello = &GossipHello_npc_highlord_demitrian; - newscript->pGossipSelect = &GossipSelect_npc_highlord_demitrian; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npcs_rutgar_and_frankal"; - newscript->pGossipHello = &GossipHello_npcs_rutgar_and_frankal; - newscript->pGossipSelect = &GossipSelect_npcs_rutgar_and_frankal; - newscript->RegisterSelf(); + new go_crystalline_tear(); + new npc_anachronos_quest_trigger(); + new npc_anachronos_the_ancient(); + new mob_qiraj_war_spawn(); + new npc_highlord_demitrian(); + new npcs_rutgar_and_frankal(); } - diff --git a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp index 17ad95c2cee..cbc5dada3e1 100644 --- a/src/server/scripts/Kalimdor/stonetalon_mountains.cpp +++ b/src/server/scripts/Kalimdor/stonetalon_mountains.cpp @@ -40,43 +40,50 @@ EndContentData */ #define GOSSIP_HBD3 "Nozdormu" #define GOSSIP_HBD4 "Alexstrasza" #define GOSSIP_HBD5 "Malygos" - -bool GossipHello_npc_braug_dimspirit(Player* pPlayer, Creature* pCreature) +
class npc_braug_dimspirit : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_braug_dimspirit() : CreatureScript("npc_braug_dimspirit") { } - if (pPlayer->GetQuestStatus(6627) == QUEST_STATUS_INCOMPLETE) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer,6766,false); - pPlayer->SEND_GOSSIP_MENU(5820, pCreature->GetGUID()); + } + if (uiAction == GOSSIP_ACTION_INFO_DEF+2) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(6627); + } + return true; } - else - pPlayer->SEND_GOSSIP_MENU(5819, pCreature->GetGUID()); - return true; -} - -bool GossipSelect_npc_braug_dimspirit(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer,6766,false); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(6627) == QUEST_STATUS_INCOMPLETE) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HBD5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(5820, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(5819, pCreature->GetGUID()); + + return true; } - if (uiAction == GOSSIP_ACTION_INFO_DEF+2) - { - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(6627); - } - return true; -} + +}; + /*###### ## npc_kaya_flathoof @@ -96,60 +103,67 @@ enum eKaya QUEST_PROTECT_KAYA = 6523 }; - -struct npc_kaya_flathoofAI : public npc_escortAI +
class npc_kaya_flathoof : public CreatureScript { - npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {} +public: + npc_kaya_flathoof() : CreatureScript("npc_kaya_flathoof") { } - void WaypointReached(uint32 i) + struct npc_kaya_flathoofAI : public npc_escortAI { - Player* pPlayer = GetPlayerForEscort(); + npc_kaya_flathoofAI(Creature* c) : npc_escortAI(c) {} - if (!pPlayer) - return; + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) + { + case 16: + DoScriptText(SAY_AMBUSH, me); + me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53, -503.34, -46.31, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85, -503.77, -45.90, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37, -496.23, -45.71, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); + break; + case 18: me->SetInFront(pPlayer); + DoScriptText(SAY_END, me, pPlayer); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_PROTECT_KAYA, me); + break; + } + } - switch(i) + void JustSummoned(Creature* summoned) { - case 16: - DoScriptText(SAY_AMBUSH, me); - me->SummonCreature(NPC_GRIMTOTEM_BRUTE, -48.53, -503.34, -46.31, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_GRIMTOTEM_RUFFIAN, -38.85, -503.77, -45.90, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - me->SummonCreature(NPC_GRIMTOTEM_SORCERER, -36.37, -496.23, -45.71, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000); - break; - case 18: me->SetInFront(pPlayer); - DoScriptText(SAY_END, me, pPlayer); - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_PROTECT_KAYA, me); - break; + summoned->AI()->AttackStart(me); } - } - void JustSummoned(Creature* summoned) + void Reset(){} + }; + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - summoned->AI()->AttackStart(me); - } + if (quest->GetQuestId() == QUEST_PROTECT_KAYA) + { + if (npc_escortAI* pEscortAI = CAST_AI(npc_kaya_flathoof::npc_kaya_flathoofAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); - void Reset(){} -}; + DoScriptText(SAY_START, pCreature); + pCreature->setFaction(113); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + } + return true; + } -bool QuestAccept_npc_kaya_flathoof(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_PROTECT_KAYA) + CreatureAI* GetAI(Creature* pCreature) const { - if (npc_escortAI* pEscortAI = CAST_AI(npc_kaya_flathoofAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - - DoScriptText(SAY_START, pCreature); - pCreature->setFaction(113); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + return new npc_kaya_flathoofAI(pCreature); } - return true; -} -CreatureAI* GetAI_npc_kaya_flathoofAI(Creature* pCreature) -{ - return new npc_kaya_flathoofAI(pCreature); -} +}; + /*###### ## AddSC @@ -157,18 +171,6 @@ CreatureAI* GetAI_npc_kaya_flathoofAI(Creature* pCreature) void AddSC_stonetalon_mountains() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_braug_dimspirit"; - newscript->pGossipHello = &GossipHello_npc_braug_dimspirit; - newscript->pGossipSelect = &GossipSelect_npc_braug_dimspirit; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_kaya_flathoof"; - newscript->GetAI = &GetAI_npc_kaya_flathoofAI; - newscript->pQuestAccept = &QuestAccept_npc_kaya_flathoof; - newscript->RegisterSelf(); + new npc_braug_dimspirit(); + new npc_kaya_flathoof(); } - diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp index 7ef9e5039d9..f60fa90a29d 100644 --- a/src/server/scripts/Kalimdor/tanaris.cpp +++ b/src/server/scripts/Kalimdor/tanaris.cpp @@ -45,91 +45,98 @@ EndContentData */ #define SPELL_AQUA_JET 13586 #define SPELL_FROST_SHOCK 15089 - -struct mob_aquementasAI : public ScriptedAI +
class mob_aquementas : public CreatureScript { - mob_aquementasAI(Creature *c) : ScriptedAI(c) {} - - uint32 SendItem_Timer; - uint32 SwitchFaction_Timer; - bool isFriendly; - - uint32 FrostShock_Timer; - uint32 AquaJet_Timer; +public: + mob_aquementas() : CreatureScript("mob_aquementas") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - SendItem_Timer = 0; - SwitchFaction_Timer = 10000; - me->setFaction(35); - isFriendly = true; - - AquaJet_Timer = 5000; - FrostShock_Timer = 1000; + return new mob_aquementasAI (pCreature); } - void SendItem(Unit* receiver) + struct mob_aquementasAI : public ScriptedAI { - if (CAST_PLR(receiver)->HasItemCount(11169,1,false) && - CAST_PLR(receiver)->HasItemCount(11172,11,false) && - CAST_PLR(receiver)->HasItemCount(11173,1,false) && - !CAST_PLR(receiver)->HasItemCount(11522,1,true)) - { - ItemPosCountVec dest; - uint8 msg = CAST_PLR(receiver)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, false); - if (msg == EQUIP_ERR_OK) - CAST_PLR(receiver)->StoreNewItem(dest, 11522, 1, true); - } - } + mob_aquementasAI(Creature *c) : ScriptedAI(c) {} - void EnterCombat(Unit* who) - { - DoScriptText(AGGRO_YELL_AQUE, me, who); - } + uint32 SendItem_Timer; + uint32 SwitchFaction_Timer; + bool isFriendly; - void UpdateAI(const uint32 diff) - { - if (isFriendly) + uint32 FrostShock_Timer; + uint32 AquaJet_Timer; + + void Reset() { - if (SwitchFaction_Timer <= diff) - { - me->setFaction(91); - isFriendly = false; - } else SwitchFaction_Timer -= diff; - } + SendItem_Timer = 0; + SwitchFaction_Timer = 10000; + me->setFaction(35); + isFriendly = true; - if (!UpdateVictim()) - return; + AquaJet_Timer = 5000; + FrostShock_Timer = 1000; + } - if (!isFriendly) + void SendItem(Unit* receiver) { - if (SendItem_Timer <= diff) + if (CAST_PLR(receiver)->HasItemCount(11169,1,false) && + CAST_PLR(receiver)->HasItemCount(11172,11,false) && + CAST_PLR(receiver)->HasItemCount(11173,1,false) && + !CAST_PLR(receiver)->HasItemCount(11522,1,true)) { - if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) - SendItem(me->getVictim()); - SendItem_Timer = 5000; - } else SendItem_Timer -= diff; + ItemPosCountVec dest; + uint8 msg = CAST_PLR(receiver)->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, 11522, 1, false); + if (msg == EQUIP_ERR_OK) + CAST_PLR(receiver)->StoreNewItem(dest, 11522, 1, true); + } } - if (FrostShock_Timer <= diff) + void EnterCombat(Unit* who) { - DoCast(me->getVictim(), SPELL_FROST_SHOCK); - FrostShock_Timer = 15000; - } else FrostShock_Timer -= diff; + DoScriptText(AGGRO_YELL_AQUE, me, who); + } - if (AquaJet_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me, SPELL_AQUA_JET); - AquaJet_Timer = 15000; - } else AquaJet_Timer -= diff; + if (isFriendly) + { + if (SwitchFaction_Timer <= diff) + { + me->setFaction(91); + isFriendly = false; + } else SwitchFaction_Timer -= diff; + } + + if (!UpdateVictim()) + return; + + if (!isFriendly) + { + if (SendItem_Timer <= diff) + { + if (me->getVictim()->GetTypeId() == TYPEID_PLAYER) + SendItem(me->getVictim()); + SendItem_Timer = 5000; + } else SendItem_Timer -= diff; + } + + if (FrostShock_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_FROST_SHOCK); + FrostShock_Timer = 15000; + } else FrostShock_Timer -= diff; + + if (AquaJet_Timer <= diff) + { + DoCast(me, SPELL_AQUA_JET); + AquaJet_Timer = 15000; + } else AquaJet_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_mob_aquementas(Creature* pCreature) -{ - return new mob_aquementasAI (pCreature); -} /*###### ## npc_custodian_of_time @@ -149,139 +156,161 @@ CreatureAI* GetAI_mob_aquementas(Creature* pCreature) #define WHISPER_CUSTODIAN_12 -1000228 #define WHISPER_CUSTODIAN_13 -1000229 #define WHISPER_CUSTODIAN_14 -1000230 - -struct npc_custodian_of_timeAI : public npc_escortAI +
class npc_custodian_of_time : public CreatureScript { - npc_custodian_of_timeAI(Creature *c) : npc_escortAI(c) {} +public: + npc_custodian_of_time() : CreatureScript("npc_custodian_of_time") { } - void WaypointReached(uint32 i) + CreatureAI* GetAI(Creature* pCreature) const { - Player *pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; - - switch(i) - { - case 0: DoScriptText(WHISPER_CUSTODIAN_1, me, pPlayer); break; - case 1: DoScriptText(WHISPER_CUSTODIAN_2, me, pPlayer); break; - case 2: DoScriptText(WHISPER_CUSTODIAN_3, me, pPlayer); break; - case 3: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 5: DoScriptText(WHISPER_CUSTODIAN_5, me, pPlayer); break; - case 6: DoScriptText(WHISPER_CUSTODIAN_6, me, pPlayer); break; - case 7: DoScriptText(WHISPER_CUSTODIAN_7, me, pPlayer); break; - case 8: DoScriptText(WHISPER_CUSTODIAN_8, me, pPlayer); break; - case 9: DoScriptText(WHISPER_CUSTODIAN_9, me, pPlayer); break; - case 10: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 13: DoScriptText(WHISPER_CUSTODIAN_10, me, pPlayer); break; - case 14: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 16: DoScriptText(WHISPER_CUSTODIAN_11, me, pPlayer); break; - case 17: DoScriptText(WHISPER_CUSTODIAN_12, me, pPlayer); break; - case 18: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 22: DoScriptText(WHISPER_CUSTODIAN_13, me, pPlayer); break; - case 23: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; - case 24: - DoScriptText(WHISPER_CUSTODIAN_14, me, pPlayer); - DoCast(pPlayer, 34883); - // below here is temporary workaround, to be removed when spell works properly - pPlayer->AreaExploredOrEventHappens(10277); - break; - } + return new npc_custodian_of_timeAI(pCreature); } - void MoveInLineOfSight(Unit *who) + struct npc_custodian_of_timeAI : public npc_escortAI { - if (HasEscortState(STATE_ESCORT_ESCORTING)) - return; + npc_custodian_of_timeAI(Creature *c) : npc_escortAI(c) {} - if (who->GetTypeId() == TYPEID_PLAYER) + void WaypointReached(uint32 i) { - if (who->HasAura(34877) && CAST_PLR(who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE) + Player *pPlayer = GetPlayerForEscort(); + if (!pPlayer) + return; + + switch(i) + { + case 0: DoScriptText(WHISPER_CUSTODIAN_1, me, pPlayer); break; + case 1: DoScriptText(WHISPER_CUSTODIAN_2, me, pPlayer); break; + case 2: DoScriptText(WHISPER_CUSTODIAN_3, me, pPlayer); break; + case 3: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 5: DoScriptText(WHISPER_CUSTODIAN_5, me, pPlayer); break; + case 6: DoScriptText(WHISPER_CUSTODIAN_6, me, pPlayer); break; + case 7: DoScriptText(WHISPER_CUSTODIAN_7, me, pPlayer); break; + case 8: DoScriptText(WHISPER_CUSTODIAN_8, me, pPlayer); break; + case 9: DoScriptText(WHISPER_CUSTODIAN_9, me, pPlayer); break; + case 10: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 13: DoScriptText(WHISPER_CUSTODIAN_10, me, pPlayer); break; + case 14: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 16: DoScriptText(WHISPER_CUSTODIAN_11, me, pPlayer); break; + case 17: DoScriptText(WHISPER_CUSTODIAN_12, me, pPlayer); break; + case 18: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 22: DoScriptText(WHISPER_CUSTODIAN_13, me, pPlayer); break; + case 23: DoScriptText(WHISPER_CUSTODIAN_4, me, pPlayer); break; + case 24: + DoScriptText(WHISPER_CUSTODIAN_14, me, pPlayer); + DoCast(pPlayer, 34883); + // below here is temporary workaround, to be removed when spell works properly + pPlayer->AreaExploredOrEventHappens(10277); + break; + } + } + + void MoveInLineOfSight(Unit *who) + { + if (HasEscortState(STATE_ESCORT_ESCORTING)) + return; + + if (who->GetTypeId() == TYPEID_PLAYER) { - float Radius = 10.0; - if (me->IsWithinDistInMap(who, Radius)) + if (who->HasAura(34877) && CAST_PLR(who)->GetQuestStatus(10277) == QUEST_STATUS_INCOMPLETE) { - Start(false, false, who->GetGUID()); + float Radius = 10.0; + if (me->IsWithinDistInMap(who, Radius)) + { + Start(false, false, who->GetGUID()); + } } } } - } - void EnterCombat(Unit* /*who*/) {} - void Reset() { } + void EnterCombat(Unit* /*who*/) {} + void Reset() { } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + } + }; - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - } }; -CreatureAI* GetAI_npc_custodian_of_time(Creature* pCreature) -{ - return new npc_custodian_of_timeAI(pCreature); -} /*###### ## npc_marin_noggenfogger ######*/ - -bool GossipHello_npc_marin_noggenfogger(Player* pPlayer, Creature* pCreature) +
class npc_marin_noggenfogger : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_marin_noggenfogger() : CreatureScript("npc_marin_noggenfogger") { } - if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(2662)) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_marin_noggenfogger(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + if (pCreature->isVendor() && pPlayer->GetQuestRewardStatus(2662)) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### ## npc_steward_of_time ######*/ #define GOSSIP_ITEM_FLIGHT "Please take me to the master's lair." - -bool GossipHello_npc_steward_of_time(Player* pPlayer, Creature* pCreature) +
class npc_steward_of_time : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_steward_of_time() : CreatureScript("npc_steward_of_time") { } - if (pPlayer->GetQuestStatus(10279) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestRewardStatus(10279)) + bool OnQuestAccept(Player* pPlayer, Creature* /*pCreature*/, Quest const *quest) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(9978, pCreature->GetGUID()); + if (quest->GetQuestId() == 10279) //Quest: To The Master's Lair + pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) + + return false; } - else - pPlayer->SEND_GOSSIP_MENU(9977, pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) + pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) -bool QuestAccept_npc_steward_of_time(Player* pPlayer, Creature* /*pCreature*/, Quest const *quest) -{ - if (quest->GetQuestId() == 10279) //Quest: To The Master's Lair - pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) + return true; + } - return false; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(10279) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestRewardStatus(10279)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_FLIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(9978, pCreature->GetGUID()); + } + else + pPlayer->SEND_GOSSIP_MENU(9977, pCreature->GetGUID()); + + return true; + } + +}; -bool GossipSelect_npc_steward_of_time(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) - pPlayer->CastSpell(pPlayer,34891,true); //(Flight through Caverns) - return true; -} /*###### ## npc_stone_watcher_of_norgannon @@ -293,51 +322,58 @@ bool GossipSelect_npc_steward_of_time(Player* pPlayer, Creature* /*pCreature*/, #define GOSSIP_ITEM_NORGANNON_4 "Excuse me? We've been \"reschedueled for visitations\"? What does that mean?!" #define GOSSIP_ITEM_NORGANNON_5 "So, what's inside Uldum?" #define GOSSIP_ITEM_NORGANNON_6 "I will return when i have the Plates of Uldum." - -bool GossipHello_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCreature) +
class npc_stone_watcher_of_norgannon : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_stone_watcher_of_norgannon() : CreatureScript("npc_stone_watcher_of_norgannon") { } - if (pPlayer->GetQuestStatus(2954) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(1675, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + pPlayer->SEND_GOSSIP_MENU(1676, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + pPlayer->SEND_GOSSIP_MENU(1677, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); + pPlayer->SEND_GOSSIP_MENU(1678, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + pPlayer->SEND_GOSSIP_MENU(1679, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(2954); + break; + } + return true; + } + + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(1674, pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(2954) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); - return true; -} + pPlayer->SEND_GOSSIP_MENU(1674, pCreature->GetGUID()); -bool GossipSelect_npc_stone_watcher_of_norgannon(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(1675, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - pPlayer->SEND_GOSSIP_MENU(1676, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - pPlayer->SEND_GOSSIP_MENU(1677, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - pPlayer->SEND_GOSSIP_MENU(1678, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_NORGANNON_6, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); - pPlayer->SEND_GOSSIP_MENU(1679, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(2954); - break; + return true; } - return true; -} + +}; + /*###### ## npc_OOX17 @@ -358,78 +394,86 @@ enum e00X17 SPAWN_SECOND_1 = 5617, SPAWN_SECOND_2 = 7805 }; - -struct npc_OOX17AI : public npc_escortAI +
class npc_OOX17 : public CreatureScript { - npc_OOX17AI(Creature *c) : npc_escortAI(c) {} +public: + npc_OOX17() : CreatureScript("npc_OOX17") { } - void WaypointReached(uint32 i) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) { - Player* pPlayer = GetPlayerForEscort(); - - if (!pPlayer) - return; - - switch(i) { - case 23: - me->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8355.96, -4447.79, 10.10, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - break; - - case 56: - me->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - me->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_OOX_AMBUSH, me); - if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) - DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); - break; - - case 86: - if (pPlayer) - { - DoScriptText(SAY_OOX_END, me); - pPlayer->GroupEventHappens(Q_OOX17, me); - } - break; + if (quest->GetQuestId() == Q_OOX17) + { + pCreature->setFaction(113); + pCreature->SetHealth(pCreature->GetMaxHealth()); + pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + DoScriptText(SAY_OOX_START, pCreature); + + if (npc_escortAI* pEscortAI = CAST_AI(npc_OOX17::npc_OOX17AI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); } + return true; } - void Reset(){} - - void EnterCombat(Unit* /*who*/) + CreatureAI* GetAI(Creature* pCreature) const { - DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me); + return new npc_OOX17AI(pCreature); } - void JustSummoned(Creature* summoned) + struct npc_OOX17AI : public npc_escortAI { - summoned->AI()->AttackStart(me); - } + npc_OOX17AI(Creature *c) : npc_escortAI(c) {} + + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(i) { + case 23: + me->SummonCreature(SPAWN_FIRST, -8350.96, -4445.79, 10.10, 6.20, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8355.96, -4447.79, 10.10, 6.27, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_FIRST, -8353.96, -4442.79, 10.10, 6.08, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + break; + + case 56: + me->SummonCreature(SPAWN_SECOND_1, -7510.07, -4795.50, 9.35, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7515.07, -4797.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + me->SummonCreature(SPAWN_SECOND_2, -7518.07, -4792.50, 9.35, 6.22, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_OOX_AMBUSH, me); + if (Unit* scoff = me->FindNearestCreature(SPAWN_SECOND_2, 30)) + DoScriptText(SAY_OOX17_AMBUSH_REPLY, scoff); + break; + + case 86: + if (pPlayer) + { + DoScriptText(SAY_OOX_END, me); + pPlayer->GroupEventHappens(Q_OOX17, me); + } + break; + } + } + + void Reset(){} + + void EnterCombat(Unit* /*who*/) + { + DoScriptText(RAND(SAY_OOX_AGGRO1,SAY_OOX_AGGRO2), me); + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + }; + }; -bool QuestAccept_npc_OOX17(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == Q_OOX17) - { - pCreature->setFaction(113); - pCreature->SetHealth(pCreature->GetMaxHealth()); - pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); - DoScriptText(SAY_OOX_START, pCreature); - - if (npc_escortAI* pEscortAI = CAST_AI(npc_OOX17AI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); - } - return true; -} -CreatureAI* GetAI_npc_OOX17(Creature* pCreature) -{ - return new npc_OOX17AI(pCreature); -} /*#### # npc_tooga @@ -454,184 +498,156 @@ enum eTooga }; const float m_afToWaterLoc[] = {-7032.664551, -4906.199219, -1.606446}; - -struct npc_toogaAI : public FollowerAI +
class npc_tooga : public CreatureScript { - npc_toogaAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_tooga() : CreatureScript("npc_tooga") { } - uint32 m_uiCheckSpeechTimer; - uint32 m_uiPostEventTimer; - uint32 m_uiPhasePostEvent; + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) + { + if (pQuest->GetQuestId() == QUEST_TOOGA) + { + if (npc_toogaAI* pToogaAI = CAST_AI(npc_tooga::npc_toogaAI, pCreature->AI())) + pToogaAI->StartFollow(pPlayer, FACTION_TOOG_ESCORTEE, pQuest); + } - uint64 TortaGUID; + return true; + } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiCheckSpeechTimer = 2500; - m_uiPostEventTimer = 1000; - m_uiPhasePostEvent = 0; - - TortaGUID = 0; + return new npc_toogaAI(pCreature); } - void MoveInLineOfSight(Unit *pWho) + struct npc_toogaAI : public FollowerAI { - FollowerAI::MoveInLineOfSight(pWho); + npc_toogaAI(Creature* pCreature) : FollowerAI(pCreature) { } + + uint32 m_uiCheckSpeechTimer; + uint32 m_uiPostEventTimer; + uint32 m_uiPhasePostEvent; + + uint64 TortaGUID; + + void Reset() + { + m_uiCheckSpeechTimer = 2500; + m_uiPostEventTimer = 1000; + m_uiPhasePostEvent = 0; + + TortaGUID = 0; + } - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT) && pWho->GetEntry() == NPC_TORTA) + void MoveInLineOfSight(Unit *pWho) { - if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE | STATE_FOLLOW_POSTEVENT) && pWho->GetEntry() == NPC_TORTA) { - if (Player* pPlayer = GetLeaderForFollower()) + if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) { - if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) - pPlayer->GroupEventHappens(QUEST_TOOGA, me); - } + if (Player* pPlayer = GetLeaderForFollower()) + { + if (pPlayer->GetQuestStatus(QUEST_TOOGA) == QUEST_STATUS_INCOMPLETE) + pPlayer->GroupEventHappens(QUEST_TOOGA, me); + } - TortaGUID = pWho->GetGUID(); - SetFollowComplete(true); + TortaGUID = pWho->GetGUID(); + SetFollowComplete(true); + } } } - } - void MovementInform(uint32 uiMotionType, uint32 uiPointId) - { - FollowerAI::MovementInform(uiMotionType, uiPointId); + void MovementInform(uint32 uiMotionType, uint32 uiPointId) + { + FollowerAI::MovementInform(uiMotionType, uiPointId); - if (uiMotionType != POINT_MOTION_TYPE) - return; + if (uiMotionType != POINT_MOTION_TYPE) + return; - if (uiPointId == POINT_ID_TO_WATER) - SetFollowComplete(); - } + if (uiPointId == POINT_ID_TO_WATER) + SetFollowComplete(); + } - void UpdateFollowerAI(const uint32 uiDiff) - { - if (!UpdateVictim()) + void UpdateFollowerAI(const uint32 uiDiff) { - //we are doing the post-event, or... - if (HasFollowState(STATE_FOLLOW_POSTEVENT)) + if (!UpdateVictim()) { - if (m_uiPostEventTimer <= uiDiff) + //we are doing the post-event, or... + if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { - m_uiPostEventTimer = 5000; - - Unit *pTorta = Unit::GetUnit(*me, TortaGUID); - if (!pTorta || !pTorta->isAlive()) + if (m_uiPostEventTimer <= uiDiff) { - //something happened, so just complete - SetFollowComplete(); - return; + m_uiPostEventTimer = 5000; + + Unit *pTorta = Unit::GetUnit(*me, TortaGUID); + if (!pTorta || !pTorta->isAlive()) + { + //something happened, so just complete + SetFollowComplete(); + return; + } + + switch(m_uiPhasePostEvent) + { + case 1: + DoScriptText(SAY_TOOG_POST_1, me); + break; + case 2: + DoScriptText(SAY_TORT_POST_2, pTorta); + break; + case 3: + DoScriptText(SAY_TOOG_POST_3, me); + break; + case 4: + DoScriptText(SAY_TORT_POST_4, pTorta); + break; + case 5: + DoScriptText(SAY_TOOG_POST_5, me); + break; + case 6: + DoScriptText(SAY_TORT_POST_6, pTorta); + me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); + break; + } + + ++m_uiPhasePostEvent; } - - switch(m_uiPhasePostEvent) - { - case 1: - DoScriptText(SAY_TOOG_POST_1, me); - break; - case 2: - DoScriptText(SAY_TORT_POST_2, pTorta); - break; - case 3: - DoScriptText(SAY_TOOG_POST_3, me); - break; - case 4: - DoScriptText(SAY_TORT_POST_4, pTorta); - break; - case 5: - DoScriptText(SAY_TOOG_POST_5, me); - break; - case 6: - DoScriptText(SAY_TORT_POST_6, pTorta); - me->GetMotionMaster()->MovePoint(POINT_ID_TO_WATER, m_afToWaterLoc[0], m_afToWaterLoc[1], m_afToWaterLoc[2]); - break; - } - - ++m_uiPhasePostEvent; + else + m_uiPostEventTimer -= uiDiff; } - else - m_uiPostEventTimer -= uiDiff; - } - //...we are doing regular speech check - else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) - { - if (m_uiCheckSpeechTimer <= uiDiff) + //...we are doing regular speech check + else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - m_uiCheckSpeechTimer = 5000; + if (m_uiCheckSpeechTimer <= uiDiff) + { + m_uiCheckSpeechTimer = 5000; - if (urand(0,9) > 8) - DoScriptText(RAND(SAY_TOOG_THIRST,SAY_TOOG_WORRIED), me); + if (urand(0,9) > 8) + DoScriptText(RAND(SAY_TOOG_THIRST,SAY_TOOG_WORRIED), me); + } + else + m_uiCheckSpeechTimer -= uiDiff; } - else - m_uiCheckSpeechTimer -= uiDiff; + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_tooga(Creature* pCreature) -{ - return new npc_toogaAI(pCreature); -} -bool QuestAccept_npc_tooga(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_TOOGA) - { - if (npc_toogaAI* pToogaAI = CAST_AI(npc_toogaAI, pCreature->AI())) - pToogaAI->StartFollow(pPlayer, FACTION_TOOG_ESCORTEE, pQuest); - } - - return true; -} void AddSC_tanaris() { - Script *newscript; - - newscript = new Script; - newscript->Name = "mob_aquementas"; - newscript->GetAI = &GetAI_mob_aquementas; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_custodian_of_time"; - newscript->GetAI = &GetAI_npc_custodian_of_time; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_marin_noggenfogger"; - newscript->pGossipHello = &GossipHello_npc_marin_noggenfogger; - newscript->pGossipSelect = &GossipSelect_npc_marin_noggenfogger; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_steward_of_time"; - newscript->pGossipHello = &GossipHello_npc_steward_of_time; - newscript->pGossipSelect = &GossipSelect_npc_steward_of_time; - newscript->pQuestAccept = &QuestAccept_npc_steward_of_time; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_stone_watcher_of_norgannon"; - newscript->pGossipHello = &GossipHello_npc_stone_watcher_of_norgannon; - newscript->pGossipSelect = &GossipSelect_npc_stone_watcher_of_norgannon; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_OOX17"; - newscript->GetAI = &GetAI_npc_OOX17; - newscript->pQuestAccept = &QuestAccept_npc_OOX17; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_tooga"; - newscript->GetAI = &GetAI_npc_tooga; - newscript->pQuestAccept = &QuestAccept_npc_tooga; - newscript->RegisterSelf(); + new mob_aquementas(); + new npc_custodian_of_time(); + new npc_marin_noggenfogger(); + new npc_steward_of_time(); + new npc_stone_watcher_of_norgannon(); + new npc_OOX17(); + new npc_tooga(); } - diff --git a/src/server/scripts/Kalimdor/teldrassil.cpp b/src/server/scripts/Kalimdor/teldrassil.cpp index a6659dcd6d9..7e64623a9e2 100644 --- a/src/server/scripts/Kalimdor/teldrassil.cpp +++ b/src/server/scripts/Kalimdor/teldrassil.cpp @@ -42,75 +42,76 @@ enum eMist NPC_ARYNIA = 3519, FACTION_DARNASSUS = 79 }; - -struct npc_mistAI : public FollowerAI +
class npc_mist : public CreatureScript { - npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_mist() : CreatureScript("npc_mist") { } + + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* pQuest) + { + if (pQuest->GetQuestId() == QUEST_MIST) + { + if (npc_mistAI* pMistAI = CAST_AI(npc_mist::npc_mistAI, pCreature->AI())) + pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest); + } - void Reset() { } + return true; + } - void MoveInLineOfSight(Unit *pWho) + CreatureAI* GetAI(Creature* pCreature) const { - FollowerAI::MoveInLineOfSight(pWho); + return new npc_mistAI(pCreature); + } - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA) + struct npc_mistAI : public FollowerAI + { + npc_mistAI(Creature* pCreature) : FollowerAI(pCreature) { } + + void Reset() { } + + void MoveInLineOfSight(Unit *pWho) { - if (me->IsWithinDistInMap(pWho, 10.0f)) + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_ARYNIA) { - DoScriptText(SAY_AT_HOME, pWho); - DoComplete(); + if (me->IsWithinDistInMap(pWho, 10.0f)) + { + DoScriptText(SAY_AT_HOME, pWho); + DoComplete(); + } } } - } - void DoComplete() - { - DoScriptText(EMOTE_AT_HOME, me); - - if (Player* pPlayer = GetLeaderForFollower()) + void DoComplete() { - if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) - pPlayer->GroupEventHappens(QUEST_MIST, me); + DoScriptText(EMOTE_AT_HOME, me); + + if (Player* pPlayer = GetLeaderForFollower()) + { + if (pPlayer->GetQuestStatus(QUEST_MIST) == QUEST_STATUS_INCOMPLETE) + pPlayer->GroupEventHappens(QUEST_MIST, me); + } + + //The follow is over (and for later development, run off to the woods before really end) + SetFollowComplete(); } - //The follow is over (and for later development, run off to the woods before really end) - SetFollowComplete(); - } + //call not needed here, no known abilities + /*void UpdateFollowerAI(const uint32 uiDiff) + { + if (!UpdateVictim()) + return; - //call not needed here, no known abilities - /*void UpdateFollowerAI(const uint32 uiDiff) - { - if (!UpdateVictim()) - return; + DoMeleeAttackIfReady(); + }*/ + }; - DoMeleeAttackIfReady(); - }*/ }; -CreatureAI* GetAI_npc_mist(Creature* pCreature) -{ - return new npc_mistAI(pCreature); -} -bool QuestAccept_npc_mist(Player* pPlayer, Creature* pCreature, Quest const* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_MIST) - { - if (npc_mistAI* pMistAI = CAST_AI(npc_mistAI, pCreature->AI())) - pMistAI->StartFollow(pPlayer, FACTION_DARNASSUS, pQuest); - } - - return true; -} void AddSC_teldrassil() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_mist"; - newscript->GetAI = &GetAI_npc_mist; - newscript->pQuestAccept = &QuestAccept_npc_mist; - newscript->RegisterSelf(); + new npc_mist(); } - diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index a41e046618b..956a76e8130 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -45,25 +45,32 @@ enum eQuests { QUEST_LOST_IN_BATTLE = 4921 }; - -bool GossipHello_npc_beaten_corpse(Player* pPlayer, Creature* pCreature) +
class npc_beaten_corpse : public CreatureScript { - if (pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_COMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CORPSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); +public: + npc_beaten_corpse() : CreatureScript("npc_beaten_corpse") { } - pPlayer->SEND_GOSSIP_MENU(3557, pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + { + pPlayer->SEND_GOSSIP_MENU(3558, pCreature->GetGUID()); + pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + } + return true; + } -bool GossipSelect_npc_beaten_corpse(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF +1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->SEND_GOSSIP_MENU(3558, pCreature->GetGUID()); - pPlayer->TalkedToCreature(pCreature->GetEntry(), pCreature->GetGUID()); + if (pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_LOST_IN_BATTLE) == QUEST_STATUS_COMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_CORPSE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(3557, pCreature->GetGUID()); + return true; } - return true; -} + +}; + /*###### # npc_gilthares @@ -87,106 +94,121 @@ enum eGilthares AREA_MERCHANT_COAST = 391, FACTION_ESCORTEE = 232 //guessed, possible not needed for this quest }; - -struct npc_giltharesAI : public npc_escortAI +
class npc_gilthares : public CreatureScript { - npc_giltharesAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - void Reset() { } +public: + npc_gilthares() : CreatureScript("npc_gilthares") { } - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - Player* pPlayer = GetPlayerForEscort(); + if (pQuest->GetQuestId() == QUEST_FREE_FROM_HOLD) + { + pCreature->setFaction(FACTION_ESCORTEE); + pCreature->SetStandState(UNIT_STAND_STATE_STAND); - if (!pPlayer) - return; + DoScriptText(SAY_GIL_START, pCreature, pPlayer); - switch(uiPointId) - { - case 16: - DoScriptText(SAY_GIL_AT_LAST, me, pPlayer); - break; - case 17: - DoScriptText(SAY_GIL_PROCEED, me, pPlayer); - break; - case 18: - DoScriptText(SAY_GIL_FREEBOOTERS, me, pPlayer); - break; - case 37: - DoScriptText(SAY_GIL_ALMOST, me, pPlayer); - break; - case 47: - DoScriptText(SAY_GIL_SWEET, me, pPlayer); - break; - case 53: - DoScriptText(SAY_GIL_FREED, me, pPlayer); - pPlayer->GroupEventHappens(QUEST_FREE_FROM_HOLD, me); - break; + if (npc_giltharesAI* pEscortAI = CAST_AI(npc_gilthares::npc_giltharesAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void EnterCombat(Unit* pWho) + CreatureAI* GetAI(Creature* pCreature) const { - //not always use - if (rand()%4) - return; + return new npc_giltharesAI(pCreature); + } - //only aggro text if not player and only in this area - if (pWho->GetTypeId() != TYPEID_PLAYER && me->GetAreaId() == AREA_MERCHANT_COAST) + struct npc_giltharesAI : public npc_escortAI + { + npc_giltharesAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) { - //appears to be pretty much random (possible only if escorter not in combat with pWho yet?) - DoScriptText(RAND(SAY_GIL_AGGRO_1, SAY_GIL_AGGRO_2, SAY_GIL_AGGRO_3, SAY_GIL_AGGRO_4), me, pWho); + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; + + switch(uiPointId) + { + case 16: + DoScriptText(SAY_GIL_AT_LAST, me, pPlayer); + break; + case 17: + DoScriptText(SAY_GIL_PROCEED, me, pPlayer); + break; + case 18: + DoScriptText(SAY_GIL_FREEBOOTERS, me, pPlayer); + break; + case 37: + DoScriptText(SAY_GIL_ALMOST, me, pPlayer); + break; + case 47: + DoScriptText(SAY_GIL_SWEET, me, pPlayer); + break; + case 53: + DoScriptText(SAY_GIL_FREED, me, pPlayer); + pPlayer->GroupEventHappens(QUEST_FREE_FROM_HOLD, me); + break; + } } - } -}; -CreatureAI* GetAI_npc_gilthares(Creature* pCreature) -{ - return new npc_giltharesAI(pCreature); -} + void EnterCombat(Unit* pWho) + { + //not always use + if (rand()%4) + return; -bool QuestAccept_npc_gilthares(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_FREE_FROM_HOLD) - { - pCreature->setFaction(FACTION_ESCORTEE); - pCreature->SetStandState(UNIT_STAND_STATE_STAND); + //only aggro text if not player and only in this area + if (pWho->GetTypeId() != TYPEID_PLAYER && me->GetAreaId() == AREA_MERCHANT_COAST) + { + //appears to be pretty much random (possible only if escorter not in combat with pWho yet?) + DoScriptText(RAND(SAY_GIL_AGGRO_1, SAY_GIL_AGGRO_2, SAY_GIL_AGGRO_3, SAY_GIL_AGGRO_4), me, pWho); + } + } + }; + +}; - DoScriptText(SAY_GIL_START, pCreature, pPlayer); - if (npc_giltharesAI* pEscortAI = CAST_AI(npc_giltharesAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} /*###### ## npc_sputtervalve ######*/ #define GOSSIP_SPUTTERVALVE "Can you tell me about this shard?" - -bool GossipHello_npc_sputtervalve(Player* pPlayer, Creature* pCreature) +
class npc_sputtervalve : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pPlayer->GetQuestStatus(6981) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SPUTTERVALVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); +public: + npc_sputtervalve() : CreatureScript("npc_sputtervalve") { } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); - return true; -} + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_INFO_DEF) + { + pPlayer->SEND_GOSSIP_MENU(2013, pCreature->GetGUID()); + pPlayer->AreaExploredOrEventHappens(6981); + } + return true; + } -bool GossipSelect_npc_sputtervalve(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->SEND_GOSSIP_MENU(2013, pCreature->GetGUID()); - pPlayer->AreaExploredOrEventHappens(6981); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(6981) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SPUTTERVALVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; } - return true; -} + +}; + /*###### ## npc_taskmaster_fizzule @@ -198,89 +220,96 @@ enum eEnums SPELL_FLARE = 10113, SPELL_FOLLY = 10137, }; - -struct npc_taskmaster_fizzuleAI : public ScriptedAI +
class npc_taskmaster_fizzule : public CreatureScript { - npc_taskmaster_fizzuleAI(Creature* c) : ScriptedAI(c) - { - factionNorm = c->getFaction(); - } +public: + npc_taskmaster_fizzule() : CreatureScript("npc_taskmaster_fizzule") { } - uint32 factionNorm; - bool IsFriend; - uint32 Reset_Timer; - uint8 FlareCount; - - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - IsFriend = false; - Reset_Timer = 120000; - FlareCount = 0; - me->setFaction(factionNorm); + return new npc_taskmaster_fizzuleAI(pCreature); } - void DoFriend() + struct npc_taskmaster_fizzuleAI : public ScriptedAI { - me->RemoveAllAuras(); - me->DeleteThreatList(); - me->CombatStop(true); + npc_taskmaster_fizzuleAI(Creature* c) : ScriptedAI(c) + { + factionNorm = c->getFaction(); + } - me->StopMoving(); - me->GetMotionMaster()->MoveIdle(); + uint32 factionNorm; + bool IsFriend; + uint32 Reset_Timer; + uint8 FlareCount; - me->setFaction(FACTION_FRIENDLY_F); - me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); - } + void Reset() + { + IsFriend = false; + Reset_Timer = 120000; + FlareCount = 0; + me->setFaction(factionNorm); + } - void SpellHit(Unit * /*caster*/, const SpellEntry *spell) - { - if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY) + void DoFriend() { - ++FlareCount; + me->RemoveAllAuras(); + me->DeleteThreatList(); + me->CombatStop(true); - if (FlareCount >= 2) - IsFriend = true; - } - } + me->StopMoving(); + me->GetMotionMaster()->MoveIdle(); - void EnterCombat(Unit* /*who*/) {} + me->setFaction(FACTION_FRIENDLY_F); + me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); + } - void UpdateAI(const uint32 diff) - { - if (IsFriend) + void SpellHit(Unit * /*caster*/, const SpellEntry *spell) { - if (Reset_Timer <= diff) + if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY) { - EnterEvadeMode(); - return; - } else Reset_Timer -= diff; - } + ++FlareCount; - if (!UpdateVictim()) - return; + if (FlareCount >= 2) + IsFriend = true; + } + } - DoMeleeAttackIfReady(); - } + void EnterCombat(Unit* /*who*/) {} - void ReceiveEmote(Player* /*pPlayer*/, uint32 emote) - { - if (emote == TEXTEMOTE_SALUTE) + void UpdateAI(const uint32 diff) { - if (FlareCount >= 2) + if (IsFriend) { - if (me->getFaction() == FACTION_FRIENDLY_F) + if (Reset_Timer <= diff) + { + EnterEvadeMode(); return; + } else Reset_Timer -= diff; + } + + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + + void ReceiveEmote(Player* /*pPlayer*/, uint32 emote) + { + if (emote == TEXTEMOTE_SALUTE) + { + if (FlareCount >= 2) + { + if (me->getFaction() == FACTION_FRIENDLY_F) + return; - DoFriend(); + DoFriend(); + } } } - } + }; + }; -CreatureAI* GetAI_npc_taskmaster_fizzule(Creature* pCreature) -{ - return new npc_taskmaster_fizzuleAI(pCreature); -} /*##### ## npc_twiggy_flathead @@ -307,199 +336,206 @@ float AffrayChallengerLoc[6][4]= {-1674, -4326, 2.79, 3.49}, {-1677, -4334, 2.79, 1.66} }; - -struct npc_twiggy_flatheadAI : public ScriptedAI +
class npc_twiggy_flathead : public CreatureScript { - npc_twiggy_flatheadAI(Creature *c) : ScriptedAI(c) {} - - bool EventInProgress; - bool EventGrate; - bool EventBigWill; - bool Challenger_down[6]; - uint32 Wave; - uint32 Wave_Timer; - uint32 Challenger_checker; - uint64 PlayerGUID; - uint64 AffrayChallenger[6]; - uint64 BigWill; - - void Reset() +public: + npc_twiggy_flathead() : CreatureScript("npc_twiggy_flathead") { } + + CreatureAI* GetAI(Creature* pCreature) const { - EventInProgress = false; - EventGrate = false; - EventBigWill = false; - Wave_Timer = 600000; - Challenger_checker = 0; - Wave = 0; - PlayerGUID = 0; - - for (uint8 i = 0; i < 6; ++i) - { - AffrayChallenger[i] = 0; - Challenger_down[i] = false; - } - BigWill = 0; + return new npc_twiggy_flatheadAI (pCreature); } - void EnterCombat(Unit * /*who*/) { } - - void MoveInLineOfSight(Unit *who) + struct npc_twiggy_flatheadAI : public ScriptedAI { - if (!who || (!who->isAlive())) return; + npc_twiggy_flatheadAI(Creature *c) : ScriptedAI(c) {} + + bool EventInProgress; + bool EventGrate; + bool EventBigWill; + bool Challenger_down[6]; + uint32 Wave; + uint32 Wave_Timer; + uint32 Challenger_checker; + uint64 PlayerGUID; + uint64 AffrayChallenger[6]; + uint64 BigWill; + + void Reset() + { + EventInProgress = false; + EventGrate = false; + EventBigWill = false; + Wave_Timer = 600000; + Challenger_checker = 0; + Wave = 0; + PlayerGUID = 0; + + for (uint8 i = 0; i < 6; ++i) + { + AffrayChallenger[i] = 0; + Challenger_down[i] = false; + } + BigWill = 0; + } + + void EnterCombat(Unit * /*who*/) { } - if (me->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress) + void MoveInLineOfSight(Unit *who) { - PlayerGUID = who->GetGUID(); - EventInProgress = true; + if (!who || (!who->isAlive())) return; + + if (me->IsWithinDistInMap(who, 10.0f) && (who->GetTypeId() == TYPEID_PLAYER) && CAST_PLR(who)->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE && !EventInProgress) + { + PlayerGUID = who->GetGUID(); + EventInProgress = true; + } } - } - void KilledUnit(Unit * /*victim*/) { } + void KilledUnit(Unit * /*victim*/) { } - void UpdateAI(const uint32 diff) - { - if (EventInProgress) { - Player* pWarrior = NULL; + void UpdateAI(const uint32 diff) + { + if (EventInProgress) { + Player* pWarrior = NULL; - if (PlayerGUID) - pWarrior = Unit::GetPlayer(*me, PlayerGUID); + if (PlayerGUID) + pWarrior = Unit::GetPlayer(*me, PlayerGUID); - if (!pWarrior) - return; + if (!pWarrior) + return; - if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { - EventInProgress = false; - DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); - pWarrior->FailQuest(1719); + if (!pWarrior->isAlive() && pWarrior->GetQuestStatus(1719) == QUEST_STATUS_INCOMPLETE) { + EventInProgress = false; + DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); + pWarrior->FailQuest(1719); - for (uint8 i = 0; i < 6; ++i) - { - if (AffrayChallenger[i]) + for (uint8 i = 0; i < 6; ++i) + { + if (AffrayChallenger[i]) + { + Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[i]); + if (pCreature) { + if (pCreature->isAlive()) + { + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pCreature->setDeathState(JUST_DIED); + } + } + } + AffrayChallenger[i] = 0; + Challenger_down[i] = false; + } + + if (BigWill) { - Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[i]); + Creature* pCreature = Unit::GetCreature((*me), BigWill); if (pCreature) { - if (pCreature->isAlive()) - { + if (pCreature->isAlive()) { pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); pCreature->setDeathState(JUST_DIED); } } } - AffrayChallenger[i] = 0; - Challenger_down[i] = false; + BigWill = 0; } - if (BigWill) + if (!EventGrate && EventInProgress) { - Creature* pCreature = Unit::GetCreature((*me), BigWill); - if (pCreature) { - if (pCreature->isAlive()) { - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IN_COMBAT); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pCreature->setDeathState(JUST_DIED); - } - } - } - BigWill = 0; - } - - if (!EventGrate && EventInProgress) - { - float x,y,z; - pWarrior->GetPosition(x, y, z); + float x,y,z; + pWarrior->GetPosition(x, y, z); - if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { - pWarrior->AreaExploredOrEventHappens(1719); - DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me); + if (x >= -1684 && x <= -1674 && y >= -4334 && y <= -4324) { + pWarrior->AreaExploredOrEventHappens(1719); + DoScriptText(SAY_TWIGGY_FLATHEAD_BEGIN, me); - for (uint8 i = 0; i < 6; ++i) - { - Creature* pCreature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); - if (!pCreature) - continue; - pCreature->setFaction(35); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - AffrayChallenger[i] = pCreature->GetGUID(); + for (uint8 i = 0; i < 6; ++i) + { + Creature* pCreature = me->SummonCreature(NPC_AFFRAY_CHALLENGER, AffrayChallengerLoc[i][0], AffrayChallengerLoc[i][1], AffrayChallengerLoc[i][2], AffrayChallengerLoc[i][3], TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 600000); + if (!pCreature) + continue; + pCreature->setFaction(35); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + AffrayChallenger[i] = pCreature->GetGUID(); + } + Wave_Timer = 5000; + Challenger_checker = 1000; + EventGrate = true; } - Wave_Timer = 5000; - Challenger_checker = 1000; - EventGrate = true; } - } - else if (EventInProgress) - { - if (Challenger_checker <= diff) + else if (EventInProgress) { - for (uint8 i = 0; i < 6; ++i) + if (Challenger_checker <= diff) { - if (AffrayChallenger[i]) + for (uint8 i = 0; i < 6; ++i) { - Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[i]); - if ((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i]) + if (AffrayChallenger[i]) { - DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); - Challenger_down[i] = true; + Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[i]); + if ((!pCreature || (!pCreature->isAlive())) && !Challenger_down[i]) + { + DoScriptText(SAY_TWIGGY_FLATHEAD_DOWN, me); + Challenger_down[i] = true; + } } } - } - Challenger_checker = 1000; - } else Challenger_checker -= diff; + Challenger_checker = 1000; + } else Challenger_checker -= diff; - if (Wave_Timer <= diff) - { - if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill) + if (Wave_Timer <= diff) { - DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, me); - Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[Wave]); - if (pCreature && (pCreature->isAlive())) + if (AffrayChallenger[Wave] && Wave < 6 && !EventBigWill) { - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); - pCreature->setFaction(14); - pCreature->AI()->AttackStart(pWarrior); - ++Wave; - Wave_Timer = 20000; + DoScriptText(SAY_TWIGGY_FLATHEAD_FRAY, me); + Creature* pCreature = Unit::GetCreature((*me), AffrayChallenger[Wave]); + if (pCreature && (pCreature->isAlive())) + { + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + pCreature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + pCreature->HandleEmoteCommand(EMOTE_ONESHOT_ROAR); + pCreature->setFaction(14); + pCreature->AI()->AttackStart(pWarrior); + ++Wave; + Wave_Timer = 20000; + } } - } - else if (Wave >= 6 && !EventBigWill) { - if (Creature* pCreature = me->SummonCreature(NPC_BIG_WILL, -1722, -4341, 6.12, 6.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 480000)) - { - BigWill = pCreature->GetGUID(); - //pCreature->GetMotionMaster()->MovePoint(0, -1693, -4343, 4.32); - //pCreature->GetMotionMaster()->MovePoint(1, -1684, -4333, 2.78); - pCreature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79); - pCreature->HandleEmoteCommand(EMOTE_STATE_READYUNARMED); - EventBigWill = true; - Wave_Timer = 1000; + else if (Wave >= 6 && !EventBigWill) { + if (Creature* pCreature = me->SummonCreature(NPC_BIG_WILL, -1722, -4341, 6.12, 6.26, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 480000)) + { + BigWill = pCreature->GetGUID(); + //pCreature->GetMotionMaster()->MovePoint(0, -1693, -4343, 4.32); + //pCreature->GetMotionMaster()->MovePoint(1, -1684, -4333, 2.78); + pCreature->GetMotionMaster()->MovePoint(2, -1682, -4329, 2.79); + pCreature->HandleEmoteCommand(EMOTE_STATE_READYUNARMED); + EventBigWill = true; + Wave_Timer = 1000; + } } - } - else if (Wave >= 6 && EventBigWill && BigWill) - { - Creature* pCreature = Unit::GetCreature((*me), BigWill); - if (!pCreature || !pCreature->isAlive()) + else if (Wave >= 6 && EventBigWill && BigWill) { - DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me); - EventInProgress = false; - EventBigWill = false; - EventGrate = false; - PlayerGUID = 0; - Wave = 0; + Creature* pCreature = Unit::GetCreature((*me), BigWill); + if (!pCreature || !pCreature->isAlive()) + { + DoScriptText(SAY_TWIGGY_FLATHEAD_OVER, me); + EventInProgress = false; + EventBigWill = false; + EventGrate = false; + PlayerGUID = 0; + Wave = 0; + } } - } - } else Wave_Timer -= diff; + } else Wave_Timer -= diff; + } } } - } + }; + }; -CreatureAI* GetAI_npc_twiggy_flathead(Creature* pCreature) -{ - return new npc_twiggy_flatheadAI (pCreature); -} /*##### ## npc_wizzlecrank_shredder @@ -521,183 +557,160 @@ enum eEnums_Wizzlecrank NPC_PILOT_WIZZ = 3451, NPC_MERCENARY = 3282, }; - -struct npc_wizzlecrank_shredderAI : public npc_escortAI +
class npc_wizzlecrank_shredder : public CreatureScript { - npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature) - { - m_bIsPostEvent = false; - m_uiPostEventTimer = 1000; - m_uiPostEventCount = 0; - } - - bool m_bIsPostEvent; - uint32 m_uiPostEventTimer; - uint32 m_uiPostEventCount; +public: + npc_wizzlecrank_shredder() : CreatureScript("npc_wizzlecrank_shredder") { } - void Reset() + struct npc_wizzlecrank_shredderAI : public npc_escortAI { - if (!HasEscortState(STATE_ESCORT_ESCORTING)) + npc_wizzlecrank_shredderAI(Creature* pCreature) : npc_escortAI(pCreature) { - if (me->getStandState() == UNIT_STAND_STATE_DEAD) - me->SetStandState(UNIT_STAND_STATE_STAND); - m_bIsPostEvent = false; m_uiPostEventTimer = 1000; m_uiPostEventCount = 0; } - } - - void WaypointReached(uint32 uiPointId) - { - Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; + bool m_bIsPostEvent; + uint32 m_uiPostEventTimer; + uint32 m_uiPostEventCount; - switch(uiPointId) + void Reset() { - case 0: - DoScriptText(SAY_STARTUP1, me); - break; - case 9: - SetRun(false); - break; - case 17: - if (Creature* pTemp = me->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) + if (!HasEscortState(STATE_ESCORT_ESCORTING)) { - DoScriptText(SAY_MERCENARY, pTemp); - me->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + if (me->getStandState() == UNIT_STAND_STATE_DEAD) + me->SetStandState(UNIT_STAND_STATE_STAND); + + m_bIsPostEvent = false; + m_uiPostEventTimer = 1000; + m_uiPostEventCount = 0; } - break; - case 24: - m_bIsPostEvent = true; - break; } - } - void WaypointStart(uint32 uiPointId) - { - Player* pPlayer = GetPlayerForEscort(); + void WaypointReached(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); - if (!pPlayer) - return; + if (!pPlayer) + return; - switch(uiPointId) - { + switch(uiPointId) + { + case 0: + DoScriptText(SAY_STARTUP1, me); + break; case 9: - DoScriptText(SAY_STARTUP2, me, pPlayer); + SetRun(false); break; - case 18: - DoScriptText(SAY_PROGRESS_1, me, pPlayer); - SetRun(); + case 17: + if (Creature* pTemp = me->SummonCreature(NPC_MERCENARY, 1128.489f, -3037.611f, 92.701f, 1.472f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000)) + { + DoScriptText(SAY_MERCENARY, pTemp); + me->SummonCreature(NPC_MERCENARY, 1160.172f, -2980.168f, 97.313f, 3.690f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 120000); + } + break; + case 24: + m_bIsPostEvent = true; break; + } } - } - void JustSummoned(Creature* pSummoned) - { - if (pSummoned->GetEntry() == NPC_PILOT_WIZZ) - me->SetStandState(UNIT_STAND_STATE_DEAD); + void WaypointStart(uint32 uiPointId) + { + Player* pPlayer = GetPlayerForEscort(); - if (pSummoned->GetEntry() == NPC_MERCENARY) - pSummoned->AI()->AttackStart(me); - } + if (!pPlayer) + return; - void UpdateEscortAI(const uint32 uiDiff) - { - if (!UpdateVictim()) + switch(uiPointId) + { + case 9: + DoScriptText(SAY_STARTUP2, me, pPlayer); + break; + case 18: + DoScriptText(SAY_PROGRESS_1, me, pPlayer); + SetRun(); + break; + } + } + + void JustSummoned(Creature* pSummoned) + { + if (pSummoned->GetEntry() == NPC_PILOT_WIZZ) + me->SetStandState(UNIT_STAND_STATE_DEAD); + + if (pSummoned->GetEntry() == NPC_MERCENARY) + pSummoned->AI()->AttackStart(me); + } + + void UpdateEscortAI(const uint32 uiDiff) { - if (m_bIsPostEvent) + if (!UpdateVictim()) { - if (m_uiPostEventTimer <= uiDiff) + if (m_bIsPostEvent) { - switch(m_uiPostEventCount) + if (m_uiPostEventTimer <= uiDiff) { - case 0: - DoScriptText(SAY_PROGRESS_2, me); - break; - case 1: - DoScriptText(SAY_PROGRESS_3, me); - break; - case 2: - DoScriptText(SAY_END, me); - break; - case 3: - if (Player* pPlayer = GetPlayerForEscort()) - { - pPlayer->GroupEventHappens(QUEST_ESCAPE, me); - me->SummonCreature(NPC_PILOT_WIZZ, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); - } - break; - } + switch(m_uiPostEventCount) + { + case 0: + DoScriptText(SAY_PROGRESS_2, me); + break; + case 1: + DoScriptText(SAY_PROGRESS_3, me); + break; + case 2: + DoScriptText(SAY_END, me); + break; + case 3: + if (Player* pPlayer = GetPlayerForEscort()) + { + pPlayer->GroupEventHappens(QUEST_ESCAPE, me); + me->SummonCreature(NPC_PILOT_WIZZ, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 180000); + } + break; + } - ++m_uiPostEventCount; - m_uiPostEventTimer = 5000; + ++m_uiPostEventCount; + m_uiPostEventTimer = 5000; + } + else + m_uiPostEventTimer -= uiDiff; } - else - m_uiPostEventTimer -= uiDiff; + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, Quest const* quest) + { + if (quest->GetQuestId() == QUEST_ESCAPE) + { + pCreature->setFaction(FACTION_RATCHET); + if (npc_escortAI* pEscortAI = CAST_AI(npc_wizzlecrank_shredder::npc_wizzlecrank_shredderAI, pCreature->AI())) + pEscortAI->Start(true, false, pPlayer->GetGUID()); + } + return true; } -}; -bool QuestAccept_npc_wizzlecrank_shredder(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_ESCAPE) + CreatureAI* GetAI(Creature* pCreature) const { - pCreature->setFaction(FACTION_RATCHET); - if (npc_escortAI* pEscortAI = CAST_AI(npc_wizzlecrank_shredderAI, pCreature->AI())) - pEscortAI->Start(true, false, pPlayer->GetGUID()); + return new npc_wizzlecrank_shredderAI(pCreature); } - return true; -} -CreatureAI* GetAI_npc_wizzlecrank_shredderAI(Creature* pCreature) -{ - return new npc_wizzlecrank_shredderAI(pCreature); -} +}; + void AddSC_the_barrens() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_beaten_corpse"; - newscript->pGossipHello = &GossipHello_npc_beaten_corpse; - newscript->pGossipSelect = &GossipSelect_npc_beaten_corpse; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_gilthares"; - newscript->GetAI = &GetAI_npc_gilthares; - newscript->pQuestAccept = &QuestAccept_npc_gilthares; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_sputtervalve"; - newscript->pGossipHello = &GossipHello_npc_sputtervalve; - newscript->pGossipSelect = &GossipSelect_npc_sputtervalve; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_taskmaster_fizzule"; - newscript->GetAI = &GetAI_npc_taskmaster_fizzule; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_twiggy_flathead"; - newscript->GetAI = &GetAI_npc_twiggy_flathead; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_wizzlecrank_shredder"; - newscript->GetAI = &GetAI_npc_wizzlecrank_shredderAI; - newscript->pQuestAccept = &QuestAccept_npc_wizzlecrank_shredder; - newscript->RegisterSelf(); + new npc_beaten_corpse(); + new npc_gilthares(); + new npc_sputtervalve(); + new npc_taskmaster_fizzule(); + new npc_twiggy_flathead(); + new npc_wizzlecrank_shredder(); } - diff --git a/src/server/scripts/Kalimdor/thousand_needles.cpp b/src/server/scripts/Kalimdor/thousand_needles.cpp index 6aded229ddd..7938bf293f2 100644 --- a/src/server/scripts/Kalimdor/thousand_needles.cpp +++ b/src/server/scripts/Kalimdor/thousand_needles.cpp @@ -27,9 +27,8 @@ EndScriptData */ npc_kanati npc_lakota_windsong npc_swiftmountain -npc_plucky +npc_plucky
npc_enraged_panther go_panther_cage -npc_enraged_panther EndContentData */ #include "ScriptPCH.h" @@ -48,56 +47,64 @@ enum eKanati }; const float m_afGalakLoc[]= {-4867.387695, -1357.353760, -48.226 }; - -struct npc_kanatiAI : public npc_escortAI +
class npc_kanati : public CreatureScript { - npc_kanatiAI(Creature* pCreature) : npc_escortAI(pCreature) { } - - void Reset() { } +public: + npc_kanati() : CreatureScript("npc_kanati") { } - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_PROTECT_KANATI) { - case 0: - DoScriptText(SAY_KAN_START, me); - DoSpawnGalak(); - break; - case 1: - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_PROTECT_KANATI, me); - break; + if (npc_kanatiAI* pEscortAI = CAST_AI(npc_kanati::npc_kanatiAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest, true); } + return true; } - void DoSpawnGalak() + CreatureAI* GetAI(Creature* pCreature) const { - for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_GALAK_ASS, - m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f, - TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + return new npc_kanatiAI(pCreature); } - void JustSummoned(Creature* pSummoned) + struct npc_kanatiAI : public npc_escortAI { - pSummoned->AI()->AttackStart(me); - } + npc_kanatiAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 0: + DoScriptText(SAY_KAN_START, me); + DoSpawnGalak(); + break; + case 1: + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_PROTECT_KANATI, me); + break; + } + } + + void DoSpawnGalak() + { + for (int i = 0; i < 3; ++i) + me->SummonCreature(NPC_GALAK_ASS, + m_afGalakLoc[0], m_afGalakLoc[1], m_afGalakLoc[2], 0.0f, + TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + } + + void JustSummoned(Creature* pSummoned) + { + pSummoned->AI()->AttackStart(me); + } + }; + }; -CreatureAI* GetAI_npc_kanati(Creature* pCreature) -{ - return new npc_kanatiAI(pCreature); -} -bool QuestAccept_npc_kanati(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_PROTECT_KANATI) - { - if (npc_kanatiAI* pEscortAI = CAST_AI(npc_kanatiAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest, true); - } - return true; -} /*###### # npc_lakota_windsong @@ -129,62 +136,70 @@ float m_afBanditLoc[6][6]= {-4767.985352, -1873.169189, 90.192}, {-4788.861328, -1888.007813, 89.888} }; - -struct npc_lakota_windsongAI : public npc_escortAI +
class npc_lakota_windsong : public CreatureScript { - npc_lakota_windsongAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_lakota_windsong() : CreatureScript("npc_lakota_windsong") { } - void Reset() { } - - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_FREE_AT_LAST) { - case 8: - DoScriptText(SAY_LAKO_LOOK_OUT, me); - DoSpawnBandits(ID_AMBUSH_1); - break; - case 14: - DoScriptText(SAY_LAKO_HERE_COME, me); - DoSpawnBandits(ID_AMBUSH_2); - break; - case 21: - DoScriptText(SAY_LAKO_MORE, me); - DoSpawnBandits(ID_AMBUSH_3); - break; - case 45: - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_FREE_AT_LAST, me); - break; + DoScriptText(SAY_LAKO_START, pCreature, pPlayer); + pCreature->setFaction(FACTION_ESCORTEE_LAKO); + + if (npc_lakota_windsongAI* pEscortAI = CAST_AI(npc_lakota_windsong::npc_lakota_windsongAI, pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void DoSpawnBandits(int uiAmbushId) + CreatureAI* GetAI(Creature* pCreature) const { - for (int i = 0; i < 2; ++i) - me->SummonCreature(NPC_GRIM_BANDIT, - m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + return new npc_lakota_windsongAI(pCreature); } -}; - -CreatureAI* GetAI_npc_lakota_windsong(Creature* pCreature) -{ - return new npc_lakota_windsongAI(pCreature); -} -bool QuestAccept_npc_lakota_windsong(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_FREE_AT_LAST) + struct npc_lakota_windsongAI : public npc_escortAI { - DoScriptText(SAY_LAKO_START, pCreature, pPlayer); - pCreature->setFaction(FACTION_ESCORTEE_LAKO); + npc_lakota_windsongAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 8: + DoScriptText(SAY_LAKO_LOOK_OUT, me); + DoSpawnBandits(ID_AMBUSH_1); + break; + case 14: + DoScriptText(SAY_LAKO_HERE_COME, me); + DoSpawnBandits(ID_AMBUSH_2); + break; + case 21: + DoScriptText(SAY_LAKO_MORE, me); + DoSpawnBandits(ID_AMBUSH_3); + break; + case 45: + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_FREE_AT_LAST, me); + break; + } + } + + void DoSpawnBandits(int uiAmbushId) + { + for (int i = 0; i < 2; ++i) + me->SummonCreature(NPC_GRIM_BANDIT, + m_afBanditLoc[i+uiAmbushId][0], m_afBanditLoc[i+uiAmbushId][1], m_afBanditLoc[i+uiAmbushId][2], 0.0f, + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + } + }; + +}; + - if (npc_lakota_windsongAI* pEscortAI = CAST_AI(npc_lakota_windsongAI, pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} /*###### # npc_paoka_swiftmountain @@ -207,57 +222,65 @@ float m_afWyvernLoc[3][3]= {-4970.241, -927.378, -4.951}, {-4985.364, -952.528, -5.199} }; - -struct npc_paoka_swiftmountainAI : public npc_escortAI +
class npc_paoka_swiftmountain : public CreatureScript { - npc_paoka_swiftmountainAI(Creature* pCreature) : npc_escortAI(pCreature) { } +public: + npc_paoka_swiftmountain() : CreatureScript("npc_paoka_swiftmountain") { } - void Reset() { } - - void WaypointReached(uint32 uiPointId) + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) { - switch(uiPointId) + if (pQuest->GetQuestId() == QUEST_HOMEWARD) { - case 15: - DoScriptText(SAY_WYVERN, me); - DoSpawnWyvern(); - break; - case 26: - DoScriptText(SAY_COMPLETE, me); - break; - case 27: - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->GroupEventHappens(QUEST_HOMEWARD, me); - break; + DoScriptText(SAY_START, pCreature, pPlayer); + pCreature->setFaction(FACTION_ESCORTEE); + + if (npc_paoka_swiftmountainAI* pEscortAI = CAST_AI(npc_paoka_swiftmountain::npc_paoka_swiftmountainAI,pCreature->AI())) + pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); } + return true; } - void DoSpawnWyvern() + CreatureAI* GetAI(Creature* pCreature) const { - for (int i = 0; i < 3; ++i) - me->SummonCreature(NPC_WYVERN, - m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, - TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + return new npc_paoka_swiftmountainAI(pCreature); } -}; - -CreatureAI* GetAI_npc_paoka_swiftmountain(Creature* pCreature) -{ - return new npc_paoka_swiftmountainAI(pCreature); -} -bool QuestAccept_npc_paoka_swiftmountain(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_HOMEWARD) + struct npc_paoka_swiftmountainAI : public npc_escortAI { - DoScriptText(SAY_START, pCreature, pPlayer); - pCreature->setFaction(FACTION_ESCORTEE); + npc_paoka_swiftmountainAI(Creature* pCreature) : npc_escortAI(pCreature) { } + + void Reset() { } + + void WaypointReached(uint32 uiPointId) + { + switch(uiPointId) + { + case 15: + DoScriptText(SAY_WYVERN, me); + DoSpawnWyvern(); + break; + case 26: + DoScriptText(SAY_COMPLETE, me); + break; + case 27: + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->GroupEventHappens(QUEST_HOMEWARD, me); + break; + } + } + + void DoSpawnWyvern() + { + for (int i = 0; i < 3; ++i) + me->SummonCreature(NPC_WYVERN, + m_afWyvernLoc[i][0], m_afWyvernLoc[i][1], m_afWyvernLoc[i][2], 0.0f, + TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 60000); + } + }; + +}; + - if (npc_paoka_swiftmountainAI* pEscortAI = CAST_AI(npc_paoka_swiftmountainAI,pCreature->AI())) - pEscortAI->Start(false, false, pPlayer->GetGUID(), pQuest); - } - return true; -} /*##### # npc_plucky @@ -272,185 +295,173 @@ enum ePlucky SPELL_PLUCKY_HUMAN = 9192, SPELL_PLUCKY_CHICKEN = 9220 }; - -struct npc_pluckyAI : public ScriptedAI +
class npc_plucky : public CreatureScript { - npc_pluckyAI(Creature *c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } - - uint32 m_uiNormFaction; - uint32 m_uiResetTimer; +public: + npc_plucky() : CreatureScript("npc_plucky") { } - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) { - m_uiResetTimer = 120000; + switch(uiAction) + { + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->CompleteQuest(QUEST_SCOOP); + break; + } + return true; + } - if (me->getFaction() != m_uiNormFaction) - me->setFaction(m_uiNormFaction); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(738, pCreature->GetGUID()); - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + return true; + } - DoCast(me, SPELL_PLUCKY_CHICKEN, false); + CreatureAI* GetAI(Creature* pCreature) const + { + return new npc_pluckyAI(pCreature); } - void ReceiveEmote(Player* pPlayer, uint32 uiTextEmote) + struct npc_pluckyAI : public ScriptedAI { - if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) + npc_pluckyAI(Creature *c) : ScriptedAI(c) { m_uiNormFaction = c->getFaction(); } + + uint32 m_uiNormFaction; + uint32 m_uiResetTimer; + + void Reset() { - if (uiTextEmote == TEXTEMOTE_BECKON) - { - me->setFaction(FACTION_FRIENDLY); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - DoCast(me, SPELL_PLUCKY_HUMAN, false); - } + m_uiResetTimer = 120000; + + if (me->getFaction() != m_uiNormFaction) + me->setFaction(m_uiNormFaction); + + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + DoCast(me, SPELL_PLUCKY_CHICKEN, false); } - if (uiTextEmote == TEXTEMOTE_CHICKEN) + void ReceiveEmote(Player* pPlayer, uint32 uiTextEmote) { - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) - return; - else + if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) { - me->setFaction(FACTION_FRIENDLY); - me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); - DoCast(me, SPELL_PLUCKY_HUMAN, false); - me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + if (uiTextEmote == TEXTEMOTE_BECKON) + { + me->setFaction(FACTION_FRIENDLY); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + DoCast(me, SPELL_PLUCKY_HUMAN, false); + } + } + + if (uiTextEmote == TEXTEMOTE_CHICKEN) + { + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + return; + else + { + me->setFaction(FACTION_FRIENDLY); + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + DoCast(me, SPELL_PLUCKY_HUMAN, false); + me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + } } } - } - void UpdateAI(const uint32 uiDiff) - { - if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) + void UpdateAI(const uint32 uiDiff) { - if (m_uiResetTimer <= uiDiff) + if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP)) { - if (!me->getVictim()) - EnterEvadeMode(); + if (m_uiResetTimer <= uiDiff) + { + if (!me->getVictim()) + EnterEvadeMode(); + else + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + + return; + } else - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + m_uiResetTimer -= uiDiff; + } + if (!UpdateVictim()) return; - } - else - m_uiResetTimer -= uiDiff; - } - if (!UpdateVictim()) - return; + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -bool GossipHello_npc_plucky(Player* pPlayer, Creature* pCreature) -{ - if (pPlayer->GetQuestStatus(QUEST_SCOOP) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_P, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(738, pCreature->GetGUID()); - - return true; -} - -bool GossipSelect_npc_plucky(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 uiAction) -{ - switch(uiAction) - { - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->CompleteQuest(QUEST_SCOOP); - break; - } - return true; -} - -CreatureAI* GetAI_npc_plucky(Creature* pCreature) -{ - return new npc_pluckyAI(pCreature); -} - enum ePantherCage { ENRAGED_PANTHER = 10992 }; -bool go_panther_cage(Player* pPlayer, GameObject* pGo) +class go_panther_cage : public GameObjectScript { +public: + go_panther_cage() : GameObjectScript("go_panther_cage") { } - if (pPlayer->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE) + bool OnGossipHello(Player* pPlayer, GameObject* pGo) { - if (Creature* panther = pGo->FindNearestCreature(ENRAGED_PANTHER, 5, true)) + + if (pPlayer->GetQuestStatus(5151) == QUEST_STATUS_INCOMPLETE) { - panther->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); - panther->SetReactState(REACT_AGGRESSIVE); - panther->AI()->AttackStart(pPlayer); + if (Creature* panther = pGo->FindNearestCreature(ENRAGED_PANTHER, 5, true)) + { + panther->RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_NON_ATTACKABLE); + panther->SetReactState(REACT_AGGRESSIVE); + panther->AI()->AttackStart(pPlayer); + } } - } - return true ; -} - -struct npc_enraged_pantherAI : public ScriptedAI + return true ; + } +}; +
class npc_enraged_panther : public CreatureScript { - npc_enraged_pantherAI(Creature *c) : ScriptedAI(c) {} +public: + npc_enraged_panther() : CreatureScript("npc_enraged_panther") { } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetReactState(REACT_PASSIVE); + return new npc_enraged_pantherAI(pCreature); } - void UpdateAI(const uint32 /*diff*/) + struct npc_enraged_pantherAI : public ScriptedAI { - if (!UpdateVictim()) - return; + npc_enraged_pantherAI(Creature *c) : ScriptedAI(c) {} + + void Reset() + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); + me->SetReactState(REACT_PASSIVE); + } + + void UpdateAI(const uint32 /*diff*/) + { + if (!UpdateVictim()) + return; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_enraged_panther(Creature* pCreature) -{ - return new npc_enraged_pantherAI(pCreature); -} void AddSC_thousand_needles() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_kanati"; - newscript->GetAI = &GetAI_npc_kanati; - newscript->pQuestAccept = &QuestAccept_npc_kanati; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_lakota_windsong"; - newscript->GetAI = &GetAI_npc_lakota_windsong; - newscript->pQuestAccept = &QuestAccept_npc_lakota_windsong; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_paoka_swiftmountain"; - newscript->GetAI = &GetAI_npc_paoka_swiftmountain; - newscript->pQuestAccept = &QuestAccept_npc_paoka_swiftmountain; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_plucky"; - newscript->GetAI = &GetAI_npc_plucky; - newscript->pGossipHello = &GossipHello_npc_plucky; - newscript->pGossipSelect = &GossipSelect_npc_plucky; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="npc_enraged_panther"; - newscript->GetAI = &GetAI_npc_enraged_panther; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name="go_panther_cage"; - newscript->pGOHello = &go_panther_cage; - newscript->RegisterSelf(); + new npc_kanati(); + new npc_lakota_windsong(); + new npc_paoka_swiftmountain(); + new npc_plucky(); + new npc_enraged_panther(); + new go_panther_cage(); } - diff --git a/src/server/scripts/Kalimdor/thunder_bluff.cpp b/src/server/scripts/Kalimdor/thunder_bluff.cpp index 71c2c174fc7..a0588735c64 100644 --- a/src/server/scripts/Kalimdor/thunder_bluff.cpp +++ b/src/server/scripts/Kalimdor/thunder_bluff.cpp @@ -36,105 +36,106 @@ EndScriptData */ #define SPELL_UPPERCUT 22916 #define GOSSIP_HCB "I know this is rather silly but a young ward who is a bit shy would like your hoofprint." -//TODO: verify abilities/timers -struct npc_cairne_bloodhoofAI : public ScriptedAI +//TODO: verify abilities/timers
class npc_cairne_bloodhoof : public CreatureScript { - npc_cairne_bloodhoofAI(Creature* c) : ScriptedAI(c) {} +public: + npc_cairne_bloodhoof() : CreatureScript("npc_cairne_bloodhoof") { } - uint32 BerserkerCharge_Timer; - uint32 Cleave_Timer; - uint32 MortalStrike_Timer; - uint32 Thunderclap_Timer; - uint32 Uppercut_Timer; - - void Reset() + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - BerserkerCharge_Timer = 30000; - Cleave_Timer = 5000; - MortalStrike_Timer = 10000; - Thunderclap_Timer = 15000; - Uppercut_Timer = 10000; + if (uiAction == GOSSIP_SENDER_INFO) + { + pPlayer->CastSpell(pPlayer, 23123, false); + pPlayer->SEND_GOSSIP_MENU(7014, pCreature->GetGUID()); + } + return true; } - void EnterCombat(Unit * /*who*/) {} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); + + pPlayer->SEND_GOSSIP_MENU(7013, pCreature->GetGUID()); + + return true; + } - void UpdateAI(const uint32 diff) + CreatureAI* GetAI(Creature* pCreature) const { - if (!UpdateVictim()) - return; + return new npc_cairne_bloodhoofAI (pCreature); + } - if (BerserkerCharge_Timer <= diff) - { - Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); - if (pTarget) - DoCast(pTarget, SPELL_BERSERKER_CHARGE); - BerserkerCharge_Timer = 25000; - } else BerserkerCharge_Timer -= diff; + struct npc_cairne_bloodhoofAI : public ScriptedAI + { + npc_cairne_bloodhoofAI(Creature* c) : ScriptedAI(c) {} - if (Uppercut_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_UPPERCUT); - Uppercut_Timer = 20000; - } else Uppercut_Timer -= diff; + uint32 BerserkerCharge_Timer; + uint32 Cleave_Timer; + uint32 MortalStrike_Timer; + uint32 Thunderclap_Timer; + uint32 Uppercut_Timer; - if (Thunderclap_Timer <= diff) + void Reset() { - DoCast(me->getVictim(), SPELL_THUNDERCLAP); + BerserkerCharge_Timer = 30000; + Cleave_Timer = 5000; + MortalStrike_Timer = 10000; Thunderclap_Timer = 15000; - } else Thunderclap_Timer -= diff; + Uppercut_Timer = 10000; + } - if (MortalStrike_Timer <= diff) - { - DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); - MortalStrike_Timer = 15000; - } else MortalStrike_Timer -= diff; + void EnterCombat(Unit * /*who*/) {} - if (Cleave_Timer <= diff) + void UpdateAI(const uint32 diff) { - DoCast(me->getVictim(), SPELL_CLEAVE); - Cleave_Timer = 7000; - } else Cleave_Timer -= diff; + if (!UpdateVictim()) + return; + + if (BerserkerCharge_Timer <= diff) + { + Unit *pTarget = SelectUnit(SELECT_TARGET_RANDOM,0); + if (pTarget) + DoCast(pTarget, SPELL_BERSERKER_CHARGE); + BerserkerCharge_Timer = 25000; + } else BerserkerCharge_Timer -= diff; + + if (Uppercut_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_UPPERCUT); + Uppercut_Timer = 20000; + } else Uppercut_Timer -= diff; + + if (Thunderclap_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_THUNDERCLAP); + Thunderclap_Timer = 15000; + } else Thunderclap_Timer -= diff; + + if (MortalStrike_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); + MortalStrike_Timer = 15000; + } else MortalStrike_Timer -= diff; + + if (Cleave_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_CLEAVE); + Cleave_Timer = 7000; + } else Cleave_Timer -= diff; + + DoMeleeAttackIfReady(); + } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_cairne_bloodhoof(Creature* pCreature) -{ - return new npc_cairne_bloodhoofAI (pCreature); -} - -bool GossipHello_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature) -{ - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - - if (pPlayer->GetQuestStatus(925) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HCB, GOSSIP_SENDER_MAIN, GOSSIP_SENDER_INFO); - - pPlayer->SEND_GOSSIP_MENU(7013, pCreature->GetGUID()); - return true; -} -bool GossipSelect_npc_cairne_bloodhoof(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_SENDER_INFO) - { - pPlayer->CastSpell(pPlayer, 23123, false); - pPlayer->SEND_GOSSIP_MENU(7014, pCreature->GetGUID()); - } - return true; -} void AddSC_thunder_bluff() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_cairne_bloodhoof"; - newscript->GetAI = &GetAI_npc_cairne_bloodhoof; - newscript->pGossipHello = &GossipHello_npc_cairne_bloodhoof; - newscript->pGossipSelect = &GossipSelect_npc_cairne_bloodhoof; - newscript->RegisterSelf(); + new npc_cairne_bloodhoof(); } - diff --git a/src/server/scripts/Kalimdor/ungoro_crater.cpp b/src/server/scripts/Kalimdor/ungoro_crater.cpp index 19181ba570f..63db08ed1c5 100644 --- a/src/server/scripts/Kalimdor/ungoro_crater.cpp +++ b/src/server/scripts/Kalimdor/ungoro_crater.cpp @@ -45,95 +45,103 @@ EndContentData */ #define ENTRY_TARLORD 6519 #define ENTRY_TARLORD1 6519 #define ENTRY_STOMPER 6513 - -struct npc_ameAI : public npc_escortAI +
class npc_ame : public CreatureScript { - npc_ameAI(Creature *c) : npc_escortAI(c) {} - - uint32 DEMORALIZINGSHOUT_Timer; +public: + npc_ame() : CreatureScript("npc_ame") { } - 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_CHASING_AME) { - - case 19: - me->SummonCreature(ENTRY_STOMPER, -6391.69, -1730.49, -272.83, 4.96, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO1, me, pPlayer); - break; - case 28: - DoScriptText(SAY_SEARCH, me, pPlayer); - break; - case 38: - me->SummonCreature(ENTRY_TARLORD, -6370.75, -1382.84, -270.51, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO2, me, pPlayer); - break; - case 49: - me->SummonCreature(ENTRY_TARLORD1, -6324.44, -1181.05, -270.17, 4.34, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); - DoScriptText(SAY_AGGRO3, me, pPlayer); - break; - case 55: - DoScriptText(SAY_FINISH, me, pPlayer); - if (pPlayer) - pPlayer->GroupEventHappens(QUEST_CHASING_AME,me); - break; - + CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); + DoScriptText(SAY_READY, pCreature, pPlayer); + pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); + // Change faction so mobs attack + pCreature->setFaction(113); } + return true; } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - DEMORALIZINGSHOUT_Timer = 5000; + return new npc_ameAI(pCreature); } - void JustSummoned(Creature* summoned) + struct npc_ameAI : public npc_escortAI { - summoned->AI()->AttackStart(me); - } + npc_ameAI(Creature *c) : npc_escortAI(c) {} - void JustDied(Unit* /*killer*/) - { - if (Player* pPlayer = GetPlayerForEscort()) - pPlayer->FailQuest(QUEST_CHASING_AME); - } + uint32 DEMORALIZINGSHOUT_Timer; - void UpdateAI(const uint32 diff) - { - npc_escortAI::UpdateAI(diff); - if (!UpdateVictim()) - return; + void WaypointReached(uint32 i) + { + Player* pPlayer = GetPlayerForEscort(); + + if (!pPlayer) + return; - if (DEMORALIZINGSHOUT_Timer <= diff) + switch (i) + { + + case 19: + me->SummonCreature(ENTRY_STOMPER, -6391.69, -1730.49, -272.83, 4.96, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO1, me, pPlayer); + break; + case 28: + DoScriptText(SAY_SEARCH, me, pPlayer); + break; + case 38: + me->SummonCreature(ENTRY_TARLORD, -6370.75, -1382.84, -270.51, 6.06, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO2, me, pPlayer); + break; + case 49: + me->SummonCreature(ENTRY_TARLORD1, -6324.44, -1181.05, -270.17, 4.34, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 25000); + DoScriptText(SAY_AGGRO3, me, pPlayer); + break; + case 55: + DoScriptText(SAY_FINISH, me, pPlayer); + if (pPlayer) + pPlayer->GroupEventHappens(QUEST_CHASING_AME,me); + break; + + } + } + + void Reset() { - DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); - DEMORALIZINGSHOUT_Timer = 70000; - } else DEMORALIZINGSHOUT_Timer -= diff; + DEMORALIZINGSHOUT_Timer = 5000; + } + + void JustSummoned(Creature* summoned) + { + summoned->AI()->AttackStart(me); + } + + void JustDied(Unit* /*killer*/) + { + if (Player* pPlayer = GetPlayerForEscort()) + pPlayer->FailQuest(QUEST_CHASING_AME); + } + + void UpdateAI(const uint32 diff) + { + npc_escortAI::UpdateAI(diff); + if (!UpdateVictim()) + return; + + if (DEMORALIZINGSHOUT_Timer <= diff) + { + DoCast(me->getVictim(), SPELL_DEMORALIZINGSHOUT); + DEMORALIZINGSHOUT_Timer = 70000; + } else DEMORALIZINGSHOUT_Timer -= diff; + + } + }; - } }; -bool QuestAccept_npc_ame(Player* pPlayer, Creature* pCreature, Quest const* quest) -{ - if (quest->GetQuestId() == QUEST_CHASING_AME) - { - CAST_AI(npc_escortAI, (pCreature->AI()))->Start(false, false, pPlayer->GetGUID()); - DoScriptText(SAY_READY, pCreature, pPlayer); - pCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - // Change faction so mobs attack - pCreature->setFaction(113); - } - return true; -} -CreatureAI* GetAI_npc_ame(Creature* pCreature) -{ - return new npc_ameAI(pCreature); -} /*#### # npc_ringo @@ -168,191 +176,187 @@ enum eRingo NPC_SPRAGGLE = 9997, FACTION_ESCORTEE = 113 }; - -struct npc_ringoAI : public FollowerAI +
class npc_ringo : public CreatureScript { - npc_ringoAI(Creature* pCreature) : FollowerAI(pCreature) { } +public: + npc_ringo() : CreatureScript("npc_ringo") { } - uint32 m_uiFaintTimer; - uint32 m_uiEndEventProgress; - uint32 m_uiEndEventTimer; + bool OnQuestAccept(Player* pPlayer, Creature* pCreature, const Quest* pQuest) + { + if (pQuest->GetQuestId() == QUEST_A_LITTLE_HELP) + { + if (npc_ringoAI* pRingoAI = CAST_AI(npc_ringo::npc_ringoAI, pCreature->AI())) + { + pCreature->SetStandState(UNIT_STAND_STATE_STAND); + pRingoAI->StartFollow(pPlayer, FACTION_ESCORTEE, pQuest); + } + } - uint64 SpraggleGUID; + return true; + } - void Reset() + CreatureAI* GetAI(Creature* pCreature) const { - m_uiFaintTimer = urand(30000, 60000); - m_uiEndEventProgress = 0; - m_uiEndEventTimer = 1000; - SpraggleGUID = 0; + return new npc_ringoAI(pCreature); } - void MoveInLineOfSight(Unit *pWho) + struct npc_ringoAI : public FollowerAI { - FollowerAI::MoveInLineOfSight(pWho); + npc_ringoAI(Creature* pCreature) : FollowerAI(pCreature) { } - if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_SPRAGGLE) + uint32 m_uiFaintTimer; + uint32 m_uiEndEventProgress; + uint32 m_uiEndEventTimer; + + uint64 SpraggleGUID; + + void Reset() { - if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) + m_uiFaintTimer = urand(30000, 60000); + m_uiEndEventProgress = 0; + m_uiEndEventTimer = 1000; + SpraggleGUID = 0; + } + + void MoveInLineOfSight(Unit *pWho) + { + FollowerAI::MoveInLineOfSight(pWho); + + if (!me->getVictim() && !HasFollowState(STATE_FOLLOW_COMPLETE) && pWho->GetEntry() == NPC_SPRAGGLE) { - if (Player* pPlayer = GetLeaderForFollower()) + if (me->IsWithinDistInMap(pWho, INTERACTION_DISTANCE)) { - if (pPlayer->GetQuestStatus(QUEST_A_LITTLE_HELP) == QUEST_STATUS_INCOMPLETE) - pPlayer->GroupEventHappens(QUEST_A_LITTLE_HELP, me); - } + if (Player* pPlayer = GetLeaderForFollower()) + { + if (pPlayer->GetQuestStatus(QUEST_A_LITTLE_HELP) == QUEST_STATUS_INCOMPLETE) + pPlayer->GroupEventHappens(QUEST_A_LITTLE_HELP, me); + } - SpraggleGUID = pWho->GetGUID(); - SetFollowComplete(true); + SpraggleGUID = pWho->GetGUID(); + SetFollowComplete(true); + } } } - } - void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) - { - if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO) - ClearFaint(); - } + void SpellHit(Unit* /*pCaster*/, const SpellEntry* pSpell) + { + if (HasFollowState(STATE_FOLLOW_INPROGRESS | STATE_FOLLOW_PAUSED) && pSpell->Id == SPELL_REVIVE_RINGO) + ClearFaint(); + } - void SetFaint() - { - if (!HasFollowState(STATE_FOLLOW_POSTEVENT)) + void SetFaint() { - SetFollowPaused(true); + if (!HasFollowState(STATE_FOLLOW_POSTEVENT)) + { + SetFollowPaused(true); - DoScriptText(RAND(SAY_FAINT_1,SAY_FAINT_2,SAY_FAINT_3,SAY_FAINT_4), me); - } + DoScriptText(RAND(SAY_FAINT_1,SAY_FAINT_2,SAY_FAINT_3,SAY_FAINT_4), me); + } - //what does actually happen here? Emote? Aura? - me->SetStandState(UNIT_STAND_STATE_SLEEP); - } + //what does actually happen here? Emote? Aura? + me->SetStandState(UNIT_STAND_STATE_SLEEP); + } - void ClearFaint() - { - me->SetStandState(UNIT_STAND_STATE_STAND); + void ClearFaint() + { + me->SetStandState(UNIT_STAND_STATE_STAND); - if (HasFollowState(STATE_FOLLOW_POSTEVENT)) - return; + if (HasFollowState(STATE_FOLLOW_POSTEVENT)) + return; - DoScriptText(RAND(SAY_WAKE_1,SAY_WAKE_2,SAY_WAKE_3,SAY_WAKE_4), me); + DoScriptText(RAND(SAY_WAKE_1,SAY_WAKE_2,SAY_WAKE_3,SAY_WAKE_4), me); - SetFollowPaused(false); - } + SetFollowPaused(false); + } - void UpdateFollowerAI(const uint32 uiDiff) - { - if (!UpdateVictim()) + void UpdateFollowerAI(const uint32 uiDiff) { - if (HasFollowState(STATE_FOLLOW_POSTEVENT)) + if (!UpdateVictim()) { - if (m_uiEndEventTimer <= uiDiff) + if (HasFollowState(STATE_FOLLOW_POSTEVENT)) { - Unit *pSpraggle = Unit::GetUnit(*me, SpraggleGUID); - if (!pSpraggle || !pSpraggle->isAlive()) - { - SetFollowComplete(); - return; - } - - switch(m_uiEndEventProgress) + if (m_uiEndEventTimer <= uiDiff) { - case 1: - DoScriptText(SAY_RIN_END_1, me); - m_uiEndEventTimer = 3000; - break; - case 2: - DoScriptText(SAY_SPR_END_2, pSpraggle); - m_uiEndEventTimer = 5000; - break; - case 3: - DoScriptText(SAY_RIN_END_3, me); - m_uiEndEventTimer = 1000; - break; - case 4: - DoScriptText(EMOTE_RIN_END_4, me); - SetFaint(); - m_uiEndEventTimer = 9000; - break; - case 5: - DoScriptText(EMOTE_RIN_END_5, me); - ClearFaint(); - m_uiEndEventTimer = 1000; - break; - case 6: - DoScriptText(SAY_RIN_END_6, me); - m_uiEndEventTimer = 3000; - break; - case 7: - DoScriptText(SAY_SPR_END_7, pSpraggle); - m_uiEndEventTimer = 10000; - break; - case 8: - DoScriptText(EMOTE_RIN_END_8, me); - m_uiEndEventTimer = 5000; - break; - case 9: + Unit *pSpraggle = Unit::GetUnit(*me, SpraggleGUID); + if (!pSpraggle || !pSpraggle->isAlive()) + { SetFollowComplete(); - break; + return; + } + + switch(m_uiEndEventProgress) + { + case 1: + DoScriptText(SAY_RIN_END_1, me); + m_uiEndEventTimer = 3000; + break; + case 2: + DoScriptText(SAY_SPR_END_2, pSpraggle); + m_uiEndEventTimer = 5000; + break; + case 3: + DoScriptText(SAY_RIN_END_3, me); + m_uiEndEventTimer = 1000; + break; + case 4: + DoScriptText(EMOTE_RIN_END_4, me); + SetFaint(); + m_uiEndEventTimer = 9000; + break; + case 5: + DoScriptText(EMOTE_RIN_END_5, me); + ClearFaint(); + m_uiEndEventTimer = 1000; + break; + case 6: + DoScriptText(SAY_RIN_END_6, me); + m_uiEndEventTimer = 3000; + break; + case 7: + DoScriptText(SAY_SPR_END_7, pSpraggle); + m_uiEndEventTimer = 10000; + break; + case 8: + DoScriptText(EMOTE_RIN_END_8, me); + m_uiEndEventTimer = 5000; + break; + case 9: + SetFollowComplete(); + break; + } + + ++m_uiEndEventProgress; } - - ++m_uiEndEventProgress; + else + m_uiEndEventTimer -= uiDiff; } - else - m_uiEndEventTimer -= uiDiff; - } - else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) - { - if (!HasFollowState(STATE_FOLLOW_PAUSED)) + else if (HasFollowState(STATE_FOLLOW_INPROGRESS)) { - if (m_uiFaintTimer <= uiDiff) + if (!HasFollowState(STATE_FOLLOW_PAUSED)) { - SetFaint(); - m_uiFaintTimer = urand(60000, 120000); + if (m_uiFaintTimer <= uiDiff) + { + SetFaint(); + m_uiFaintTimer = urand(60000, 120000); + } + else + m_uiFaintTimer -= uiDiff; } - else - m_uiFaintTimer -= uiDiff; } + + return; } - return; + DoMeleeAttackIfReady(); } + }; - DoMeleeAttackIfReady(); - } }; -CreatureAI* GetAI_npc_ringo(Creature* pCreature) -{ - return new npc_ringoAI(pCreature); -} -bool QuestAccept_npc_ringo(Player* pPlayer, Creature* pCreature, const Quest* pQuest) -{ - if (pQuest->GetQuestId() == QUEST_A_LITTLE_HELP) - { - if (npc_ringoAI* pRingoAI = CAST_AI(npc_ringoAI, pCreature->AI())) - { - pCreature->SetStandState(UNIT_STAND_STATE_STAND); - pRingoAI->StartFollow(pPlayer, FACTION_ESCORTEE, pQuest); - } - } - - return true; -} void AddSC_ungoro_crater() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_ame"; - newscript->GetAI = &GetAI_npc_ame; - newscript->pQuestAccept = &QuestAccept_npc_ame; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_ringo"; - newscript->GetAI = &GetAI_npc_ringo; - newscript->pQuestAccept = &QuestAccept_npc_ringo; - newscript->RegisterSelf(); + new npc_ame(); + new npc_ringo(); } - diff --git a/src/server/scripts/Kalimdor/winterspring.cpp b/src/server/scripts/Kalimdor/winterspring.cpp index c07f80b7c91..e72435a6797 100644 --- a/src/server/scripts/Kalimdor/winterspring.cpp +++ b/src/server/scripts/Kalimdor/winterspring.cpp @@ -42,129 +42,133 @@ EndContentData */ #define GOSSIP_SL3 "What deal?" #define GOSSIP_SL4 "Then what happened?" #define GOSSIP_SL5 "He is not safe, i'll make sure of that." - -bool GossipHello_npc_lorax(Player* pPlayer, Creature* pCreature) +
class npc_lorax : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_lorax() : CreatureScript("npc_lorax") { } - if (pPlayer->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + switch (uiAction) + { + case GOSSIP_ACTION_INFO_DEF: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + pPlayer->SEND_GOSSIP_MENU(3759, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+1: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + pPlayer->SEND_GOSSIP_MENU(3760, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+2: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + pPlayer->SEND_GOSSIP_MENU(3761, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+3: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + pPlayer->SEND_GOSSIP_MENU(3762, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+4: + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); + pPlayer->SEND_GOSSIP_MENU(3763, pCreature->GetGUID()); + break; + case GOSSIP_ACTION_INFO_DEF+5: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->AreaExploredOrEventHappens(5126); + break; + } + return true; + } - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); - return true; -} + if (pPlayer->GetQuestStatus(5126) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); -bool GossipSelect_npc_lorax(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - switch (uiAction) - { - case GOSSIP_ACTION_INFO_DEF: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - pPlayer->SEND_GOSSIP_MENU(3759, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+1: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - pPlayer->SEND_GOSSIP_MENU(3760, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+2: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - pPlayer->SEND_GOSSIP_MENU(3761, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+3: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); - pPlayer->SEND_GOSSIP_MENU(3762, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+4: - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SL5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); - pPlayer->SEND_GOSSIP_MENU(3763, pCreature->GetGUID()); - break; - case GOSSIP_ACTION_INFO_DEF+5: - pPlayer->CLOSE_GOSSIP_MENU(); - pPlayer->AreaExploredOrEventHappens(5126); - break; + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; } - return true; -} + +}; + /*###### ## npc_rivern_frostwind ######*/ - -bool GossipHello_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature) +
class npc_rivern_frostwind : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_rivern_frostwind() : CreatureScript("npc_rivern_frostwind") { } - if (pCreature->isVendor() && pPlayer->GetReputationRank(589) == REP_EXALTED) - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) + { + if (uiAction == GOSSIP_ACTION_TRADE) + pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); - pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + return true; + } - return true; -} + bool OnGossipHello(Player* pPlayer, Creature* pCreature) + { + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); -bool GossipSelect_npc_rivern_frostwind(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_TRADE) - pPlayer->SEND_VENDORLIST(pCreature->GetGUID()); + if (pCreature->isVendor() && pPlayer->GetReputationRank(589) == REP_EXALTED) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); + + pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); + + return true; + } + +}; - return true; -} /*###### ## npc_witch_doctor_mauari ######*/ #define GOSSIP_HWDM "I'd like you to make me a new Cache of Mau'ari please." - -bool GossipHello_npc_witch_doctor_mauari(Player* pPlayer, Creature* pCreature) +
class npc_witch_doctor_mauari : public CreatureScript { - if (pCreature->isQuestGiver()) - pPlayer->PrepareQuestMenu(pCreature->GetGUID()); +public: + npc_witch_doctor_mauari() : CreatureScript("npc_witch_doctor_mauari") { } - if (pPlayer->GetQuestRewardStatus(975)) + bool OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) { - pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - pPlayer->SEND_GOSSIP_MENU(3377, pCreature->GetGUID()); - }else - pPlayer->SEND_GOSSIP_MENU(3375, pCreature->GetGUID()); + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->CLOSE_GOSSIP_MENU(); + pCreature->CastSpell(pPlayer, 16351, false); + } - return true; -} + return true; + } -bool GossipSelect_npc_witch_doctor_mauari(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) -{ - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + bool OnGossipHello(Player* pPlayer, Creature* pCreature) { - pPlayer->CLOSE_GOSSIP_MENU(); - pCreature->CastSpell(pPlayer, 16351, false); + if (pCreature->isQuestGiver()) + pPlayer->PrepareQuestMenu(pCreature->GetGUID()); + + if (pPlayer->GetQuestRewardStatus(975)) + { + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HWDM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + pPlayer->SEND_GOSSIP_MENU(3377, pCreature->GetGUID()); + }else + pPlayer->SEND_GOSSIP_MENU(3375, pCreature->GetGUID()); + + return true; } - return true; -} +}; + void AddSC_winterspring() { - Script *newscript; - - newscript = new Script; - newscript->Name = "npc_lorax"; - newscript->pGossipHello = &GossipHello_npc_lorax; - newscript->pGossipSelect = &GossipSelect_npc_lorax; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_rivern_frostwind"; - newscript->pGossipHello = &GossipHello_npc_rivern_frostwind; - newscript->pGossipSelect = &GossipSelect_npc_rivern_frostwind; - newscript->RegisterSelf(); - - newscript = new Script; - newscript->Name = "npc_witch_doctor_mauari"; - newscript->pGossipHello = &GossipHello_npc_witch_doctor_mauari; - newscript->pGossipSelect = &GossipSelect_npc_witch_doctor_mauari; - newscript->RegisterSelf(); + new npc_lorax(); + new npc_rivern_frostwind(); + new npc_witch_doctor_mauari(); } - |
